Add function vmaFlushAllocations, vmaInvalidateAllocations for multiple allocations at once

Closes #119
Added internal class VmaSmallVector.
Refactored common code into a new function VmaAllocator_T::GetFlushOrInvalidateRange.
Regenerated docs.
diff --git a/docs/html/allocation_annotation.html b/docs/html/allocation_annotation.html
index f827465..ed07741 100644
--- a/docs/html/allocation_annotation.html
+++ b/docs/html/allocation_annotation.html
@@ -116,18 +116,18 @@
 <dl class="section note"><dt>Note</dt><dd>Passing string name to VMA allocation doesn't automatically set it to the Vulkan buffer or image created with it. You must do it manually using an extension like VK_EXT_debug_utils, which is independent of this library. </dd></dl>
 </div></div><!-- contents -->
 </div><!-- PageDoc -->
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2671</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_a8259e85c272683434f4abb4ddddffe19"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">VmaAllocationCreateInfo::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2765</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2672</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_a8259e85c272683434f4abb4ddddffe19"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">VmaAllocationCreateInfo::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2766</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a86dd08aba8633bfa4ad0df2e76481d8b"><div class="ttname"><a href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a></div><div class="ttdeci">void vmaGetAllocationInfo(VmaAllocator allocator, VmaAllocation allocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">Returns current information about specified allocation and atomically marks it as used in current fra...</div></div>
 <div class="ttc" id="astruct_vma_allocation_html"><div class="ttname"><a href="struct_vma_allocation.html">VmaAllocation</a></div><div class="ttdoc">Represents single memory allocation.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2568</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2569</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a02a94f25679275851a53e82eacbcfc73"><div class="ttname"><a href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73">vmaCreateImage</a></div><div class="ttdeci">VkResult vmaCreateImage(VmaAllocator allocator, const VkImageCreateInfo *pImageCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkImage *pImage, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">Function similar to vmaCreateBuffer().</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2734</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:3101</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2735</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:3102</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ac72ee55598617e8eecca384e746bab51"><div class="ttname"><a href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a></div><div class="ttdeci">VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</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:2728</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2725</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="ttdoc">Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3063</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:2729</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2726</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="ttdoc">Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3064</div></div>
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
 Generated by &#160;<a href="http://www.doxygen.org/index.html">
diff --git a/docs/html/choosing_memory_type.html b/docs/html/choosing_memory_type.html
index 9394694..f680cf1 100644
--- a/docs/html/choosing_memory_type.html
+++ b/docs/html/choosing_memory_type.html
@@ -132,15 +132,15 @@
 </div></div><!-- contents -->
 </div><!-- PageDoc -->
 <div class="ttc" id="astruct_vma_allocation_html"><div class="ttname"><a href="struct_vma_allocation.html">VmaAllocation</a></div><div class="ttdoc">Represents single memory allocation.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2568</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_a9166390303ff42d783305bc31c2b6b90"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">VmaAllocationCreateInfo::requiredFlags</a></div><div class="ttdeci">VkMemoryPropertyFlags requiredFlags</div><div class="ttdoc">Flags that must be set in a Memory Type chosen for an allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2739</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2734</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2569</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_a9166390303ff42d783305bc31c2b6b90"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">VmaAllocationCreateInfo::requiredFlags</a></div><div class="ttdeci">VkMemoryPropertyFlags requiredFlags</div><div class="ttdoc">Flags that must be set in a Memory Type chosen for an allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2740</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2735</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ac72ee55598617e8eecca384e746bab51"><div class="ttname"><a href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a></div><div class="ttdeci">VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_MAPPED_BIT</div><div class="ttdoc">Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2645</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:2728</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2725</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_a7fe8d81a1ad10b2a2faacacee5b15d6d"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">VmaAllocationCreateInfo::preferredFlags</a></div><div class="ttdeci">VkMemoryPropertyFlags preferredFlags</div><div class="ttdoc">Flags that preferably should be set in a memory type chosen for an allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2744</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_a3bf940c0271d85d6ba32a4d820075055"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">VmaAllocationCreateInfo::memoryTypeBits</a></div><div class="ttdeci">uint32_t memoryTypeBits</div><div class="ttdoc">Bitmask containing one bit set for every memory type acceptable for this allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2752</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_MAPPED_BIT</div><div class="ttdoc">Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2646</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:2729</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2726</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_a7fe8d81a1ad10b2a2faacacee5b15d6d"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">VmaAllocationCreateInfo::preferredFlags</a></div><div class="ttdeci">VkMemoryPropertyFlags preferredFlags</div><div class="ttdoc">Flags that preferably should be set in a memory type chosen for an allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2745</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_a3bf940c0271d85d6ba32a4d820075055"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">VmaAllocationCreateInfo::memoryTypeBits</a></div><div class="ttdeci">uint32_t memoryTypeBits</div><div class="ttdoc">Bitmask containing one bit set for every memory type acceptable for this allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2753</div></div>
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
 Generated by &#160;<a href="http://www.doxygen.org/index.html">
diff --git a/docs/html/custom_memory_pools.html b/docs/html/custom_memory_pools.html
index ec7a471..4ae3b69 100644
--- a/docs/html/custom_memory_pools.html
+++ b/docs/html/custom_memory_pools.html
@@ -180,21 +180,21 @@
 </ul>
 </div></div><!-- contents -->
 </div><!-- PageDoc -->
-<div class="ttc" id="astruct_vma_pool_create_info_html_a596fa76b685d3f1f688f84a709a5b319"><div class="ttname"><a href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">VmaPoolCreateInfo::memoryTypeIndex</a></div><div class="ttdeci">uint32_t memoryTypeIndex</div><div class="ttdoc">Vulkan memory type index to allocate this pool from.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2890</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_a6272c0555cfd1fe28bff1afeb6190150"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">VmaAllocationCreateInfo::pool</a></div><div class="ttdeci">VmaPool pool</div><div class="ttdoc">Pool that this allocation should be created in.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2758</div></div>
+<div class="ttc" id="astruct_vma_pool_create_info_html_a596fa76b685d3f1f688f84a709a5b319"><div class="ttname"><a href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">VmaPoolCreateInfo::memoryTypeIndex</a></div><div class="ttdeci">uint32_t memoryTypeIndex</div><div class="ttdoc">Vulkan memory type index to allocate this pool from.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2891</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_a6272c0555cfd1fe28bff1afeb6190150"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">VmaAllocationCreateInfo::pool</a></div><div class="ttdeci">VmaPool pool</div><div class="ttdoc">Pool that this allocation should be created in.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2759</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a5485779c8f1948238fc4e92232fa65e1"><div class="ttname"><a href="vk__mem__alloc_8h.html#a5485779c8f1948238fc4e92232fa65e1">vmaDestroyPool</a></div><div class="ttdeci">void vmaDestroyPool(VmaAllocator allocator, VmaPool pool)</div><div class="ttdoc">Destroys VmaPool object and frees Vulkan device memory.</div></div>
 <div class="ttc" id="astruct_vma_allocation_html"><div class="ttname"><a href="struct_vma_allocation.html">VmaAllocation</a></div><div class="ttdoc">Represents single memory allocation.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2568</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2569</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a5c8770ded7c59c8caac6de0c2cb00b50"><div class="ttname"><a href="vk__mem__alloc_8h.html#a5c8770ded7c59c8caac6de0c2cb00b50">vmaCreatePool</a></div><div class="ttdeci">VkResult vmaCreatePool(VmaAllocator allocator, const VmaPoolCreateInfo *pCreateInfo, VmaPool *pPool)</div><div class="ttdoc">Allocates Vulkan device memory and creates VmaPool object.</div></div>
-<div class="ttc" id="astruct_vma_pool_create_info_html_ae41142f2834fcdc82baa4883c187b75c"><div class="ttname"><a href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">VmaPoolCreateInfo::maxBlockCount</a></div><div class="ttdeci">size_t maxBlockCount</div><div class="ttdoc">Maximum number of blocks that can be allocated in this pool. Optional.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2915</div></div>
-<div class="ttc" id="astruct_vma_pool_create_info_html"><div class="ttname"><a href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a></div><div class="ttdoc">Describes parameter of created VmaPool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2887</div></div>
+<div class="ttc" id="astruct_vma_pool_create_info_html_ae41142f2834fcdc82baa4883c187b75c"><div class="ttname"><a href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">VmaPoolCreateInfo::maxBlockCount</a></div><div class="ttdeci">size_t maxBlockCount</div><div class="ttdoc">Maximum number of blocks that can be allocated in this pool. Optional.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2916</div></div>
+<div class="ttc" id="astruct_vma_pool_create_info_html"><div class="ttname"><a href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a></div><div class="ttdoc">Describes parameter of created VmaPool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2888</div></div>
 <div class="ttc" id="astruct_vma_pool_html"><div class="ttname"><a href="struct_vma_pool.html">VmaPool</a></div><div class="ttdoc">Represents custom memory pool.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ae790ab9ffaf7667fb8f62523e6897888"><div class="ttname"><a href="vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888">vmaFindMemoryTypeIndexForBufferInfo</a></div><div class="ttdeci">VkResult vmaFindMemoryTypeIndexForBufferInfo(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, uint32_t *pMemoryTypeIndex)</div><div class="ttdoc">Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2734</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2735</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ac72ee55598617e8eecca384e746bab51"><div class="ttname"><a href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a></div><div class="ttdeci">VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a0d9f4e4ba5bf9aab1f1c746387753d77"><div class="ttname"><a href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a></div><div class="ttdeci">void vmaDestroyBuffer(VmaAllocator allocator, VkBuffer buffer, VmaAllocation allocation)</div><div class="ttdoc">Destroys Vulkan buffer and frees allocated memory.</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2725</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="ttdoc">Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3063</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2726</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="ttdoc">Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3064</div></div>
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
 Generated by &#160;<a href="http://www.doxygen.org/index.html">
diff --git a/docs/html/defragmentation.html b/docs/html/defragmentation.html
index b9f33c5..f91c9a5 100644
--- a/docs/html/defragmentation.html
+++ b/docs/html/defragmentation.html
@@ -214,22 +214,22 @@
 </ol>
 </div></div><!-- contents -->
 </div><!-- PageDoc -->
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a3cf86ab32c1da779b4923d301a3056ba"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">VmaDefragmentationInfo2::allocationCount</a></div><div class="ttdeci">uint32_t allocationCount</div><div class="ttdoc">Number of allocations in pAllocations array.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3421</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a3cf86ab32c1da779b4923d301a3056ba"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">VmaDefragmentationInfo2::allocationCount</a></div><div class="ttdeci">uint32_t allocationCount</div><div class="ttdoc">Number of allocations in pAllocations array.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3470</div></div>
 <div class="ttc" id="astruct_vma_allocator_html"><div class="ttname"><a href="struct_vma_allocator.html">VmaAllocator</a></div><div class="ttdoc">Represents main object of this library initialized.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a86dd08aba8633bfa4ad0df2e76481d8b"><div class="ttname"><a href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a></div><div class="ttdeci">void vmaGetAllocationInfo(VmaAllocator allocator, VmaAllocation allocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">Returns current information about specified allocation and atomically marks it as used in current fra...</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a8774e20e91e245aae959ba63efa15dd2"><div class="ttname"><a href="vk__mem__alloc_8h.html#a8774e20e91e245aae959ba63efa15dd2">vmaDefragmentationEnd</a></div><div class="ttdeci">VkResult vmaDefragmentationEnd(VmaAllocator allocator, VmaDefragmentationContext context)</div><div class="ttdoc">Ends defragmentation process.</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a4ddbc898d0afe1518f863a3763628f08"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08">VmaDefragmentationInfo2::maxGpuBytesToMove</a></div><div class="ttdeci">VkDeviceSize maxGpuBytesToMove</div><div class="ttdoc">Maximum total numbers of bytes that can be copied while moving allocations to different places using ...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3470</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a7f71f39590c5316771493d2333f9c1bd"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd">VmaDefragmentationInfo2::commandBuffer</a></div><div class="ttdeci">VkCommandBuffer commandBuffer</div><div class="ttdoc">Optional. Command buffer where GPU copy commands will be posted.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3484</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html"><div class="ttname"><a href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a></div><div class="ttdoc">Parameters for defragmentation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3415</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a4ddbc898d0afe1518f863a3763628f08"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08">VmaDefragmentationInfo2::maxGpuBytesToMove</a></div><div class="ttdeci">VkDeviceSize maxGpuBytesToMove</div><div class="ttdoc">Maximum total numbers of bytes that can be copied while moving allocations to different places using ...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3519</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a7f71f39590c5316771493d2333f9c1bd"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd">VmaDefragmentationInfo2::commandBuffer</a></div><div class="ttdeci">VkCommandBuffer commandBuffer</div><div class="ttdoc">Optional. Command buffer where GPU copy commands will be posted.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3533</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html"><div class="ttname"><a href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a></div><div class="ttdoc">Parameters for defragmentation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3464</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a6b0929b914b60cf2d45cac4bf3547470"><div class="ttname"><a href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470">vmaBindBufferMemory</a></div><div class="ttdeci">VkResult vmaBindBufferMemory(VmaAllocator allocator, VmaAllocation allocation, VkBuffer buffer)</div><div class="ttdoc">Binds buffer to allocation.</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_ab6d288f29d028156cf73542d630a2e32"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">VmaDefragmentationInfo2::pAllocations</a></div><div class="ttdeci">const VmaAllocation * pAllocations</div><div class="ttdoc">Pointer to array of allocations that can be defragmented.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3430</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a40d53d33e71ba0b66f844ed63c05a3f6"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6">VmaDefragmentationInfo2::maxGpuAllocationsToMove</a></div><div class="ttdeci">uint32_t maxGpuAllocationsToMove</div><div class="ttdoc">Maximum number of allocations that can be moved to a different place using transfers on GPU side,...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3475</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_af78e1ea40c22d85137b65f6b384a4d0a"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">VmaDefragmentationInfo2::maxCpuBytesToMove</a></div><div class="ttdeci">VkDeviceSize maxCpuBytesToMove</div><div class="ttdoc">Maximum total numbers of bytes that can be copied while moving allocations to different places using ...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3460</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_ab6d288f29d028156cf73542d630a2e32"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">VmaDefragmentationInfo2::pAllocations</a></div><div class="ttdeci">const VmaAllocation * pAllocations</div><div class="ttdoc">Pointer to array of allocations that can be defragmented.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3479</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a40d53d33e71ba0b66f844ed63c05a3f6"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6">VmaDefragmentationInfo2::maxGpuAllocationsToMove</a></div><div class="ttdeci">uint32_t maxGpuAllocationsToMove</div><div class="ttdoc">Maximum number of allocations that can be moved to a different place using transfers on GPU side,...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3524</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_af78e1ea40c22d85137b65f6b384a4d0a"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">VmaDefragmentationInfo2::maxCpuBytesToMove</a></div><div class="ttdeci">VkDeviceSize maxCpuBytesToMove</div><div class="ttdoc">Maximum total numbers of bytes that can be copied while moving allocations to different places using ...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3509</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a36ba776fd7fd5cb1e9359fdc0d8e6e8a"><div class="ttname"><a href="vk__mem__alloc_8h.html#a36ba776fd7fd5cb1e9359fdc0d8e6e8a">vmaDefragmentationBegin</a></div><div class="ttdeci">VkResult vmaDefragmentationBegin(VmaAllocator allocator, const VmaDefragmentationInfo2 *pInfo, VmaDefragmentationStats *pStats, VmaDefragmentationContext *pContext)</div><div class="ttdoc">Begins defragmentation process.</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a76d51a644dc7f5405d0cdd0025ecd0cc"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">VmaDefragmentationInfo2::pAllocationsChanged</a></div><div class="ttdeci">VkBool32 * pAllocationsChanged</div><div class="ttdoc">Optional, output. Pointer to array that will be filled with information whether the allocation at cer...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3436</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="ttdoc">Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3063</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a76d51a644dc7f5405d0cdd0025ecd0cc"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">VmaDefragmentationInfo2::pAllocationsChanged</a></div><div class="ttdeci">VkBool32 * pAllocationsChanged</div><div class="ttdoc">Optional, output. Pointer to array that will be filled with information whether the allocation at cer...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3485</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="ttdoc">Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3064</div></div>
 <div class="ttc" id="astruct_vma_defragmentation_context_html"><div class="ttname"><a href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a></div><div class="ttdoc">Represents Opaque object that represents started defragmentation process.</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a94c2c7223d52878445a8cccce396b671"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">VmaDefragmentationInfo2::maxCpuAllocationsToMove</a></div><div class="ttdeci">uint32_t maxCpuAllocationsToMove</div><div class="ttdoc">Maximum number of allocations that can be moved to a different place using transfers on CPU side,...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3465</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a94c2c7223d52878445a8cccce396b671"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">VmaDefragmentationInfo2::maxCpuAllocationsToMove</a></div><div class="ttdeci">uint32_t maxCpuAllocationsToMove</div><div class="ttdoc">Maximum number of allocations that can be moved to a different place using transfers on CPU side,...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3514</div></div>
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
 Generated by &#160;<a href="http://www.doxygen.org/index.html">
diff --git a/docs/html/globals.html b/docs/html/globals.html
index 8e5fd88..7cedd8a 100644
--- a/docs/html/globals.html
+++ b/docs/html/globals.html
@@ -364,7 +364,10 @@
 : <a class="el" href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472">vk_mem_alloc.h</a>
 </li>
 <li>vmaFlushAllocation()
-: <a class="el" href="vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de">vk_mem_alloc.h</a>
+: <a class="el" href="vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f">vk_mem_alloc.h</a>
+</li>
+<li>vmaFlushAllocations()
+: <a class="el" href="vk__mem__alloc_8h.html#ac3dd00da721875ed99fa8a881922bdfc">vk_mem_alloc.h</a>
 </li>
 <li>vmaFreeMemory()
 : <a class="el" href="vk__mem__alloc_8h.html#a5fea5518972ae9094b1526cbcb19b05f">vk_mem_alloc.h</a>
@@ -400,7 +403,10 @@
 : <a class="el" href="vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153">vk_mem_alloc.h</a>
 </li>
 <li>vmaInvalidateAllocation()
-: <a class="el" href="vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006">vk_mem_alloc.h</a>
+: <a class="el" href="vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae">vk_mem_alloc.h</a>
+</li>
+<li>vmaInvalidateAllocations()
+: <a class="el" href="vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5">vk_mem_alloc.h</a>
 </li>
 <li>vmaMakePoolAllocationsLost()
 : <a class="el" href="vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024">vk_mem_alloc.h</a>
@@ -412,7 +418,7 @@
 : <a class="el" href="vk__mem__alloc_8h.html#a806e8499dde802e59eb72a1dc811c35f">vk_mem_alloc.h</a>
 </li>
 <li>VmaPoolCreateFlagBits
-: <a class="el" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7">vk_mem_alloc.h</a>
+: <a class="el" href="vk__mem__alloc_8h.html#a4d4f2efc2509157a9e4ecd4fd7942303">vk_mem_alloc.h</a>
 </li>
 <li>VmaPoolCreateFlags
 : <a class="el" href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a">vk_mem_alloc.h</a>
diff --git a/docs/html/globals_func.html b/docs/html/globals_func.html
index caa3819..8d2bc2a 100644
--- a/docs/html/globals_func.html
+++ b/docs/html/globals_func.html
@@ -152,7 +152,10 @@
 : <a class="el" href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472">vk_mem_alloc.h</a>
 </li>
 <li>vmaFlushAllocation()
-: <a class="el" href="vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de">vk_mem_alloc.h</a>
+: <a class="el" href="vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f">vk_mem_alloc.h</a>
+</li>
+<li>vmaFlushAllocations()
+: <a class="el" href="vk__mem__alloc_8h.html#ac3dd00da721875ed99fa8a881922bdfc">vk_mem_alloc.h</a>
 </li>
 <li>vmaFreeMemory()
 : <a class="el" href="vk__mem__alloc_8h.html#a5fea5518972ae9094b1526cbcb19b05f">vk_mem_alloc.h</a>
@@ -188,7 +191,10 @@
 : <a class="el" href="vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153">vk_mem_alloc.h</a>
 </li>
 <li>vmaInvalidateAllocation()
-: <a class="el" href="vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006">vk_mem_alloc.h</a>
+: <a class="el" href="vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae">vk_mem_alloc.h</a>
+</li>
+<li>vmaInvalidateAllocations()
+: <a class="el" href="vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5">vk_mem_alloc.h</a>
 </li>
 <li>vmaMakePoolAllocationsLost()
 : <a class="el" href="vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024">vk_mem_alloc.h</a>
diff --git a/docs/html/lost_allocations.html b/docs/html/lost_allocations.html
index 53ff3cf..c88c690 100644
--- a/docs/html/lost_allocations.html
+++ b/docs/html/lost_allocations.html
@@ -125,15 +125,15 @@
 </div></div><!-- contents -->
 </div><!-- PageDoc -->
 <div class="ttc" id="avk__mem__alloc_8h_html_a43d8ba9673c846f049089a5029d5c73a"><div class="ttname"><a href="vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a">vmaTouchAllocation</a></div><div class="ttdeci">VkBool32 vmaTouchAllocation(VmaAllocator allocator, VmaAllocation allocation)</div><div class="ttdoc">Returns VK_TRUE if allocation is not lost and atomically marks it as used in current frame.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2658</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2659</div></div>
 <div class="ttc" id="astruct_vma_allocation_html"><div class="ttname"><a href="struct_vma_allocation.html">VmaAllocation</a></div><div class="ttdoc">Represents single memory allocation.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2568</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2665</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2734</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2569</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2666</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2735</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ac72ee55598617e8eecca384e746bab51"><div class="ttname"><a href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a></div><div class="ttdeci">VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a0d9f4e4ba5bf9aab1f1c746387753d77"><div class="ttname"><a href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a></div><div class="ttdeci">void vmaDestroyBuffer(VmaAllocator allocator, VkBuffer buffer, VmaAllocation allocation)</div><div class="ttdoc">Destroys Vulkan buffer and frees allocated memory.</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:2728</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2725</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:2729</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2726</div></div>
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
 Generated by &#160;<a href="http://www.doxygen.org/index.html">
diff --git a/docs/html/memory_mapping.html b/docs/html/memory_mapping.html
index 061affb..5e4f73d 100644
--- a/docs/html/memory_mapping.html
+++ b/docs/html/memory_mapping.html
@@ -120,7 +120,7 @@
 </ul>
 <h1><a class="anchor" id="memory_mapping_cache_control"></a>
 Cache flush and invalidate</h1>
-<p>Memory in Vulkan doesn't need to be unmapped before using it on GPU, but unless a memory types has <code>VK_MEMORY_PROPERTY_HOST_COHERENT_BIT</code> flag set, you need to manually <b>invalidate</b> cache before reading of mapped pointer and <b>flush</b> cache after writing to mapped pointer. Map/unmap operations don't do that automatically. Vulkan provides following functions for this purpose <code>vkFlushMappedMemoryRanges()</code>, <code>vkInvalidateMappedMemoryRanges()</code>, but this library provides more convenient functions that refer to given allocation object: <a class="el" href="vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de" title="Flushes memory of given allocation.">vmaFlushAllocation()</a>, <a class="el" href="vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006" title="Invalidates memory of given allocation.">vmaInvalidateAllocation()</a>.</p>
+<p>Memory in Vulkan doesn't need to be unmapped before using it on GPU, but unless a memory types has <code>VK_MEMORY_PROPERTY_HOST_COHERENT_BIT</code> flag set, you need to manually <b>invalidate</b> cache before reading of mapped pointer and <b>flush</b> cache after writing to mapped pointer. Map/unmap operations don't do that automatically. Vulkan provides following functions for this purpose <code>vkFlushMappedMemoryRanges()</code>, <code>vkInvalidateMappedMemoryRanges()</code>, but this library provides more convenient functions that refer to given allocation object: <a class="el" href="vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f" title="Flushes memory of given allocation.">vmaFlushAllocation()</a>, <a class="el" href="vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae" title="Invalidates memory of given allocation.">vmaInvalidateAllocation()</a>, or multiple objects at once: <a class="el" href="vk__mem__alloc_8h.html#ac3dd00da721875ed99fa8a881922bdfc" title="Flushes memory of given set of allocations.">vmaFlushAllocations()</a>, <a class="el" href="vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5" title="Invalidates memory of given set of allocations.">vmaInvalidateAllocations()</a>.</p>
 <p>Regions of memory specified for flush/invalidate must be aligned to <code>VkPhysicalDeviceLimits::nonCoherentAtomSize</code>. This is automatically ensured by the library. In any memory type that is <code>HOST_VISIBLE</code> but not <code>HOST_COHERENT</code>, all allocations within blocks are aligned to this value, so their offsets are always multiply of <code>nonCoherentAtomSize</code> and two different allocations never share same "line" of this size.</p>
 <p>Please note that memory allocated with <a class="el" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a> is guaranteed to be <code>HOST_COHERENT</code>.</p>
 <p>Also, Windows drivers from all 3 <b>PC</b> GPU vendors (AMD, Intel, NVIDIA) currently provide <code>HOST_COHERENT</code> flag on all memory types that are <code>HOST_VISIBLE</code>, so on this platform you may not need to bother.</p>
@@ -186,20 +186,20 @@
 <div class="ttc" id="avk__mem__alloc_8h_html_a9bc268595cb33f6ec4d519cfce81ff45"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45">vmaUnmapMemory</a></div><div class="ttdeci">void vmaUnmapMemory(VmaAllocator allocator, VmaAllocation allocation)</div><div class="ttdoc">Unmaps memory represented by given allocation, mapped previously using vmaMapMemory().</div></div>
 <div class="ttc" id="astruct_vma_allocator_html"><div class="ttname"><a href="struct_vma_allocator.html">VmaAllocator</a></div><div class="ttdoc">Represents main object of this library initialized.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a8701444752eb5de4464adb5a2b514bca"><div class="ttname"><a href="vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca">vmaGetMemoryTypeProperties</a></div><div class="ttdeci">void vmaGetMemoryTypeProperties(VmaAllocator allocator, uint32_t memoryTypeIndex, VkMemoryPropertyFlags *pFlags)</div><div class="ttdoc">Given Memory Type Index, returns Property Flags of this memory type.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_CPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2578</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_CPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2579</div></div>
 <div class="ttc" id="astruct_vma_allocation_html"><div class="ttname"><a href="struct_vma_allocation.html">VmaAllocation</a></div><div class="ttdoc">Represents single memory allocation.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2568</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2569</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ad5bd1243512d099706de88168992f069"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069">vmaMapMemory</a></div><div class="ttdeci">VkResult vmaMapMemory(VmaAllocator allocator, VmaAllocation allocation, void **ppData)</div><div class="ttdoc">Maps memory represented by given allocation and returns pointer to it.</div></div>
-<div class="ttc" id="astruct_vma_allocation_info_html_a5eeffbe2d2f30f53370ff14aefbadbe2"><div class="ttname"><a href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">VmaAllocationInfo::pMappedData</a></div><div class="ttdeci">void * pMappedData</div><div class="ttdoc">Pointer to the beginning of this allocation as mapped data.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3096</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2734</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:3101</div></div>
+<div class="ttc" id="astruct_vma_allocation_info_html_a5eeffbe2d2f30f53370ff14aefbadbe2"><div class="ttname"><a href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">VmaAllocationInfo::pMappedData</a></div><div class="ttdeci">void * pMappedData</div><div class="ttdoc">Pointer to the beginning of this allocation as mapped data.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3097</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2735</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:3102</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ac72ee55598617e8eecca384e746bab51"><div class="ttname"><a href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a></div><div class="ttdeci">VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div></div>
-<div class="ttc" id="astruct_vma_allocation_info_html_a7f6b0aa58c135e488e6b40a388dad9d5"><div class="ttname"><a href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">VmaAllocationInfo::memoryType</a></div><div class="ttdeci">uint32_t memoryType</div><div class="ttdoc">Memory type index that this allocation was allocated from.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3068</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_MAPPED_BIT</div><div class="ttdoc">Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2645</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:2728</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2725</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_a7fe8d81a1ad10b2a2faacacee5b15d6d"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">VmaAllocationCreateInfo::preferredFlags</a></div><div class="ttdeci">VkMemoryPropertyFlags preferredFlags</div><div class="ttdoc">Flags that preferably should be set in a memory type chosen for an allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2744</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="ttdoc">Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3063</div></div>
+<div class="ttc" id="astruct_vma_allocation_info_html_a7f6b0aa58c135e488e6b40a388dad9d5"><div class="ttname"><a href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">VmaAllocationInfo::memoryType</a></div><div class="ttdeci">uint32_t memoryType</div><div class="ttdoc">Memory type index that this allocation was allocated from.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3069</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_MAPPED_BIT</div><div class="ttdoc">Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2646</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:2729</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2726</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_a7fe8d81a1ad10b2a2faacacee5b15d6d"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">VmaAllocationCreateInfo::preferredFlags</a></div><div class="ttdeci">VkMemoryPropertyFlags preferredFlags</div><div class="ttdoc">Flags that preferably should be set in a memory type chosen for an allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2745</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="ttdoc">Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3064</div></div>
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
 Generated by &#160;<a href="http://www.doxygen.org/index.html">
diff --git a/docs/html/quick_start.html b/docs/html/quick_start.html
index 0e0592c..43e2e78 100644
--- a/docs/html/quick_start.html
+++ b/docs/html/quick_start.html
@@ -119,18 +119,18 @@
 <div class="line"><a class="code" href="vk__mem__alloc_8h.html#aa8d164061c88f22fb1fd3c8f3534bc1d">vmaDestroyAllocator</a>(allocator);</div>
 </div><!-- fragment --> </div></div><!-- contents -->
 </div><!-- PageDoc -->
-<div class="ttc" id="astruct_vma_allocator_create_info_html_a08230f04ae6ccf8a78150a9e829a7156"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156">VmaAllocatorCreateInfo::physicalDevice</a></div><div class="ttdeci">VkPhysicalDevice physicalDevice</div><div class="ttdoc">Vulkan physical device.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2265</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_a08230f04ae6ccf8a78150a9e829a7156"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156">VmaAllocatorCreateInfo::physicalDevice</a></div><div class="ttdeci">VkPhysicalDevice physicalDevice</div><div class="ttdoc">Vulkan physical device.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2266</div></div>
 <div class="ttc" id="astruct_vma_allocator_html"><div class="ttname"><a href="struct_vma_allocator.html">VmaAllocator</a></div><div class="ttdoc">Represents main object of this library initialized.</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html"><div class="ttname"><a href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a></div><div class="ttdoc">Description of a Allocator to be created.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2259</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html"><div class="ttname"><a href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a></div><div class="ttdoc">Description of a Allocator to be created.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2260</div></div>
 <div class="ttc" id="astruct_vma_allocation_html"><div class="ttname"><a href="struct_vma_allocation.html">VmaAllocation</a></div><div class="ttdoc">Represents single memory allocation.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2568</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2569</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_aa8d164061c88f22fb1fd3c8f3534bc1d"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa8d164061c88f22fb1fd3c8f3534bc1d">vmaDestroyAllocator</a></div><div class="ttdeci">void vmaDestroyAllocator(VmaAllocator allocator)</div><div class="ttdoc">Destroys allocator object.</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_ad924ddd77b04039c88d0c09b0ffcd500"><div class="ttname"><a href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500">VmaAllocatorCreateInfo::device</a></div><div class="ttdeci">VkDevice device</div><div class="ttdoc">Vulkan device.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2268</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2734</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_ad924ddd77b04039c88d0c09b0ffcd500"><div class="ttname"><a href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500">VmaAllocatorCreateInfo::device</a></div><div class="ttdeci">VkDevice device</div><div class="ttdoc">Vulkan device.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2269</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2735</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ac72ee55598617e8eecca384e746bab51"><div class="ttname"><a href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a></div><div class="ttdeci">VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a200692051ddb34240248234f5f4c17bb"><div class="ttname"><a href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb">vmaCreateAllocator</a></div><div class="ttdeci">VkResult vmaCreateAllocator(const VmaAllocatorCreateInfo *pCreateInfo, VmaAllocator *pAllocator)</div><div class="ttdoc">Creates Allocator object.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a0d9f4e4ba5bf9aab1f1c746387753d77"><div class="ttname"><a href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a></div><div class="ttdeci">void vmaDestroyBuffer(VmaAllocator allocator, VkBuffer buffer, VmaAllocation allocation)</div><div class="ttdoc">Destroys Vulkan buffer and frees allocated memory.</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2725</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2726</div></div>
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
 Generated by &#160;<a href="http://www.doxygen.org/index.html">
diff --git a/docs/html/search/all_12.js b/docs/html/search/all_12.js
index 7d77393..1ca905f 100644
--- a/docs/html/search/all_12.js
+++ b/docs/html/search/all_12.js
@@ -118,38 +118,40 @@
   ['vmafindmemorytypeindex_199',['vmaFindMemoryTypeIndex',['../vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a',1,'vk_mem_alloc.h']]],
   ['vmafindmemorytypeindexforbufferinfo_200',['vmaFindMemoryTypeIndexForBufferInfo',['../vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888',1,'vk_mem_alloc.h']]],
   ['vmafindmemorytypeindexforimageinfo_201',['vmaFindMemoryTypeIndexForImageInfo',['../vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472',1,'vk_mem_alloc.h']]],
-  ['vmaflushallocation_202',['vmaFlushAllocation',['../vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de',1,'vk_mem_alloc.h']]],
-  ['vmafreememory_203',['vmaFreeMemory',['../vk__mem__alloc_8h.html#a5fea5518972ae9094b1526cbcb19b05f',1,'vk_mem_alloc.h']]],
-  ['vmafreememorypages_204',['vmaFreeMemoryPages',['../vk__mem__alloc_8h.html#a834b1e4aef395c0a1d56a28e69a4a17e',1,'vk_mem_alloc.h']]],
-  ['vmafreestatsstring_205',['vmaFreeStatsString',['../vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288',1,'vk_mem_alloc.h']]],
-  ['vmagetallocationinfo_206',['vmaGetAllocationInfo',['../vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b',1,'vk_mem_alloc.h']]],
-  ['vmagetallocatorinfo_207',['vmaGetAllocatorInfo',['../vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7',1,'vk_mem_alloc.h']]],
-  ['vmagetbudget_208',['vmaGetBudget',['../vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba',1,'vk_mem_alloc.h']]],
-  ['vmagetmemoryproperties_209',['vmaGetMemoryProperties',['../vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19',1,'vk_mem_alloc.h']]],
-  ['vmagetmemorytypeproperties_210',['vmaGetMemoryTypeProperties',['../vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca',1,'vk_mem_alloc.h']]],
-  ['vmagetphysicaldeviceproperties_211',['vmaGetPhysicalDeviceProperties',['../vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0',1,'vk_mem_alloc.h']]],
-  ['vmagetpoolname_212',['vmaGetPoolName',['../vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030',1,'vk_mem_alloc.h']]],
-  ['vmagetpoolstats_213',['vmaGetPoolStats',['../vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153',1,'vk_mem_alloc.h']]],
-  ['vmainvalidateallocation_214',['vmaInvalidateAllocation',['../vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006',1,'vk_mem_alloc.h']]],
-  ['vmamakepoolallocationslost_215',['vmaMakePoolAllocationsLost',['../vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024',1,'vk_mem_alloc.h']]],
-  ['vmamapmemory_216',['vmaMapMemory',['../vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069',1,'vk_mem_alloc.h']]],
-  ['vmamemoryusage_217',['VmaMemoryUsage',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc',1,'VmaMemoryUsage():&#160;vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a806e8499dde802e59eb72a1dc811c35f',1,'VmaMemoryUsage():&#160;vk_mem_alloc.h']]],
-  ['vmapool_218',['VmaPool',['../struct_vma_pool.html',1,'']]],
-  ['vmapoolcreateflagbits_219',['VmaPoolCreateFlagBits',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7',1,'VmaPoolCreateFlagBits():&#160;vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a4d4f2efc2509157a9e4ecd4fd7942303',1,'VmaPoolCreateFlagBits():&#160;vk_mem_alloc.h']]],
-  ['vmapoolcreateflags_220',['VmaPoolCreateFlags',['../vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a',1,'vk_mem_alloc.h']]],
-  ['vmapoolcreateinfo_221',['VmaPoolCreateInfo',['../struct_vma_pool_create_info.html',1,'VmaPoolCreateInfo'],['../vk__mem__alloc_8h.html#a1017aa83489c0eee8d2163d2bf253f67',1,'VmaPoolCreateInfo():&#160;vk_mem_alloc.h']]],
-  ['vmapoolstats_222',['VmaPoolStats',['../struct_vma_pool_stats.html',1,'VmaPoolStats'],['../vk__mem__alloc_8h.html#a4759a2d9f99c19ba7627553c847132f1',1,'VmaPoolStats():&#160;vk_mem_alloc.h']]],
-  ['vmarecordflagbits_223',['VmaRecordFlagBits',['../vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2',1,'VmaRecordFlagBits():&#160;vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#acd24d5eb58abff7e1f43cb32a1ba1413',1,'VmaRecordFlagBits():&#160;vk_mem_alloc.h']]],
-  ['vmarecordflags_224',['VmaRecordFlags',['../vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828',1,'vk_mem_alloc.h']]],
-  ['vmarecordsettings_225',['VmaRecordSettings',['../struct_vma_record_settings.html',1,'VmaRecordSettings'],['../vk__mem__alloc_8h.html#a16e21c877101493fce582664cd8754fc',1,'VmaRecordSettings():&#160;vk_mem_alloc.h']]],
-  ['vmaresizeallocation_226',['vmaResizeAllocation',['../vk__mem__alloc_8h.html#a0ff488958ca72b28e545880463cb8696',1,'vk_mem_alloc.h']]],
-  ['vmasetallocationuserdata_227',['vmaSetAllocationUserData',['../vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f',1,'vk_mem_alloc.h']]],
-  ['vmasetcurrentframeindex_228',['vmaSetCurrentFrameIndex',['../vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236',1,'vk_mem_alloc.h']]],
-  ['vmasetpoolname_229',['vmaSetPoolName',['../vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58',1,'vk_mem_alloc.h']]],
-  ['vmastatinfo_230',['VmaStatInfo',['../struct_vma_stat_info.html',1,'VmaStatInfo'],['../vk__mem__alloc_8h.html#aec5b57e29c97b5d69c6d5654d60df878',1,'VmaStatInfo():&#160;vk_mem_alloc.h']]],
-  ['vmastats_231',['VmaStats',['../struct_vma_stats.html',1,'VmaStats'],['../vk__mem__alloc_8h.html#a21813b2efdf3836767a9058cd8a94034',1,'VmaStats():&#160;vk_mem_alloc.h']]],
-  ['vmatouchallocation_232',['vmaTouchAllocation',['../vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a',1,'vk_mem_alloc.h']]],
-  ['vmaunmapmemory_233',['vmaUnmapMemory',['../vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45',1,'vk_mem_alloc.h']]],
-  ['vmavulkanfunctions_234',['VmaVulkanFunctions',['../struct_vma_vulkan_functions.html',1,'VmaVulkanFunctions'],['../vk__mem__alloc_8h.html#abb0a8e3b5040d847571cca6c7f9a8074',1,'VmaVulkanFunctions():&#160;vk_mem_alloc.h']]],
-  ['vulkanapiversion_235',['vulkanApiVersion',['../struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285',1,'VmaAllocatorCreateInfo']]]
+  ['vmaflushallocation_202',['vmaFlushAllocation',['../vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f',1,'vk_mem_alloc.h']]],
+  ['vmaflushallocations_203',['vmaFlushAllocations',['../vk__mem__alloc_8h.html#ac3dd00da721875ed99fa8a881922bdfc',1,'vk_mem_alloc.h']]],
+  ['vmafreememory_204',['vmaFreeMemory',['../vk__mem__alloc_8h.html#a5fea5518972ae9094b1526cbcb19b05f',1,'vk_mem_alloc.h']]],
+  ['vmafreememorypages_205',['vmaFreeMemoryPages',['../vk__mem__alloc_8h.html#a834b1e4aef395c0a1d56a28e69a4a17e',1,'vk_mem_alloc.h']]],
+  ['vmafreestatsstring_206',['vmaFreeStatsString',['../vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288',1,'vk_mem_alloc.h']]],
+  ['vmagetallocationinfo_207',['vmaGetAllocationInfo',['../vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b',1,'vk_mem_alloc.h']]],
+  ['vmagetallocatorinfo_208',['vmaGetAllocatorInfo',['../vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7',1,'vk_mem_alloc.h']]],
+  ['vmagetbudget_209',['vmaGetBudget',['../vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba',1,'vk_mem_alloc.h']]],
+  ['vmagetmemoryproperties_210',['vmaGetMemoryProperties',['../vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19',1,'vk_mem_alloc.h']]],
+  ['vmagetmemorytypeproperties_211',['vmaGetMemoryTypeProperties',['../vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca',1,'vk_mem_alloc.h']]],
+  ['vmagetphysicaldeviceproperties_212',['vmaGetPhysicalDeviceProperties',['../vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0',1,'vk_mem_alloc.h']]],
+  ['vmagetpoolname_213',['vmaGetPoolName',['../vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030',1,'vk_mem_alloc.h']]],
+  ['vmagetpoolstats_214',['vmaGetPoolStats',['../vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153',1,'vk_mem_alloc.h']]],
+  ['vmainvalidateallocation_215',['vmaInvalidateAllocation',['../vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae',1,'vk_mem_alloc.h']]],
+  ['vmainvalidateallocations_216',['vmaInvalidateAllocations',['../vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5',1,'vk_mem_alloc.h']]],
+  ['vmamakepoolallocationslost_217',['vmaMakePoolAllocationsLost',['../vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024',1,'vk_mem_alloc.h']]],
+  ['vmamapmemory_218',['vmaMapMemory',['../vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069',1,'vk_mem_alloc.h']]],
+  ['vmamemoryusage_219',['VmaMemoryUsage',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc',1,'VmaMemoryUsage():&#160;vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a806e8499dde802e59eb72a1dc811c35f',1,'VmaMemoryUsage():&#160;vk_mem_alloc.h']]],
+  ['vmapool_220',['VmaPool',['../struct_vma_pool.html',1,'']]],
+  ['vmapoolcreateflagbits_221',['VmaPoolCreateFlagBits',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7',1,'VmaPoolCreateFlagBits():&#160;vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a4d4f2efc2509157a9e4ecd4fd7942303',1,'VmaPoolCreateFlagBits():&#160;vk_mem_alloc.h']]],
+  ['vmapoolcreateflags_222',['VmaPoolCreateFlags',['../vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a',1,'vk_mem_alloc.h']]],
+  ['vmapoolcreateinfo_223',['VmaPoolCreateInfo',['../struct_vma_pool_create_info.html',1,'VmaPoolCreateInfo'],['../vk__mem__alloc_8h.html#a1017aa83489c0eee8d2163d2bf253f67',1,'VmaPoolCreateInfo():&#160;vk_mem_alloc.h']]],
+  ['vmapoolstats_224',['VmaPoolStats',['../struct_vma_pool_stats.html',1,'VmaPoolStats'],['../vk__mem__alloc_8h.html#a4759a2d9f99c19ba7627553c847132f1',1,'VmaPoolStats():&#160;vk_mem_alloc.h']]],
+  ['vmarecordflagbits_225',['VmaRecordFlagBits',['../vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2',1,'VmaRecordFlagBits():&#160;vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#acd24d5eb58abff7e1f43cb32a1ba1413',1,'VmaRecordFlagBits():&#160;vk_mem_alloc.h']]],
+  ['vmarecordflags_226',['VmaRecordFlags',['../vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828',1,'vk_mem_alloc.h']]],
+  ['vmarecordsettings_227',['VmaRecordSettings',['../struct_vma_record_settings.html',1,'VmaRecordSettings'],['../vk__mem__alloc_8h.html#a16e21c877101493fce582664cd8754fc',1,'VmaRecordSettings():&#160;vk_mem_alloc.h']]],
+  ['vmaresizeallocation_228',['vmaResizeAllocation',['../vk__mem__alloc_8h.html#a0ff488958ca72b28e545880463cb8696',1,'vk_mem_alloc.h']]],
+  ['vmasetallocationuserdata_229',['vmaSetAllocationUserData',['../vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f',1,'vk_mem_alloc.h']]],
+  ['vmasetcurrentframeindex_230',['vmaSetCurrentFrameIndex',['../vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236',1,'vk_mem_alloc.h']]],
+  ['vmasetpoolname_231',['vmaSetPoolName',['../vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58',1,'vk_mem_alloc.h']]],
+  ['vmastatinfo_232',['VmaStatInfo',['../struct_vma_stat_info.html',1,'VmaStatInfo'],['../vk__mem__alloc_8h.html#aec5b57e29c97b5d69c6d5654d60df878',1,'VmaStatInfo():&#160;vk_mem_alloc.h']]],
+  ['vmastats_233',['VmaStats',['../struct_vma_stats.html',1,'VmaStats'],['../vk__mem__alloc_8h.html#a21813b2efdf3836767a9058cd8a94034',1,'VmaStats():&#160;vk_mem_alloc.h']]],
+  ['vmatouchallocation_234',['vmaTouchAllocation',['../vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a',1,'vk_mem_alloc.h']]],
+  ['vmaunmapmemory_235',['vmaUnmapMemory',['../vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45',1,'vk_mem_alloc.h']]],
+  ['vmavulkanfunctions_236',['VmaVulkanFunctions',['../struct_vma_vulkan_functions.html',1,'VmaVulkanFunctions'],['../vk__mem__alloc_8h.html#abb0a8e3b5040d847571cca6c7f9a8074',1,'VmaVulkanFunctions():&#160;vk_mem_alloc.h']]],
+  ['vulkanapiversion_237',['vulkanApiVersion',['../struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285',1,'VmaAllocatorCreateInfo']]]
 ];
diff --git a/docs/html/search/classes_0.js b/docs/html/search/classes_0.js
index 263ae40..71d8cb1 100644
--- a/docs/html/search/classes_0.js
+++ b/docs/html/search/classes_0.js
@@ -1,24 +1,24 @@
 var searchData=
 [
-  ['vmaallocation_236',['VmaAllocation',['../struct_vma_allocation.html',1,'']]],
-  ['vmaallocationcreateinfo_237',['VmaAllocationCreateInfo',['../struct_vma_allocation_create_info.html',1,'']]],
-  ['vmaallocationinfo_238',['VmaAllocationInfo',['../struct_vma_allocation_info.html',1,'']]],
-  ['vmaallocator_239',['VmaAllocator',['../struct_vma_allocator.html',1,'']]],
-  ['vmaallocatorcreateinfo_240',['VmaAllocatorCreateInfo',['../struct_vma_allocator_create_info.html',1,'']]],
-  ['vmaallocatorinfo_241',['VmaAllocatorInfo',['../struct_vma_allocator_info.html',1,'']]],
-  ['vmabudget_242',['VmaBudget',['../struct_vma_budget.html',1,'']]],
-  ['vmadefragmentationcontext_243',['VmaDefragmentationContext',['../struct_vma_defragmentation_context.html',1,'']]],
-  ['vmadefragmentationinfo_244',['VmaDefragmentationInfo',['../struct_vma_defragmentation_info.html',1,'']]],
-  ['vmadefragmentationinfo2_245',['VmaDefragmentationInfo2',['../struct_vma_defragmentation_info2.html',1,'']]],
-  ['vmadefragmentationpassinfo_246',['VmaDefragmentationPassInfo',['../struct_vma_defragmentation_pass_info.html',1,'']]],
-  ['vmadefragmentationpassmoveinfo_247',['VmaDefragmentationPassMoveInfo',['../struct_vma_defragmentation_pass_move_info.html',1,'']]],
-  ['vmadefragmentationstats_248',['VmaDefragmentationStats',['../struct_vma_defragmentation_stats.html',1,'']]],
-  ['vmadevicememorycallbacks_249',['VmaDeviceMemoryCallbacks',['../struct_vma_device_memory_callbacks.html',1,'']]],
-  ['vmapool_250',['VmaPool',['../struct_vma_pool.html',1,'']]],
-  ['vmapoolcreateinfo_251',['VmaPoolCreateInfo',['../struct_vma_pool_create_info.html',1,'']]],
-  ['vmapoolstats_252',['VmaPoolStats',['../struct_vma_pool_stats.html',1,'']]],
-  ['vmarecordsettings_253',['VmaRecordSettings',['../struct_vma_record_settings.html',1,'']]],
-  ['vmastatinfo_254',['VmaStatInfo',['../struct_vma_stat_info.html',1,'']]],
-  ['vmastats_255',['VmaStats',['../struct_vma_stats.html',1,'']]],
-  ['vmavulkanfunctions_256',['VmaVulkanFunctions',['../struct_vma_vulkan_functions.html',1,'']]]
+  ['vmaallocation_238',['VmaAllocation',['../struct_vma_allocation.html',1,'']]],
+  ['vmaallocationcreateinfo_239',['VmaAllocationCreateInfo',['../struct_vma_allocation_create_info.html',1,'']]],
+  ['vmaallocationinfo_240',['VmaAllocationInfo',['../struct_vma_allocation_info.html',1,'']]],
+  ['vmaallocator_241',['VmaAllocator',['../struct_vma_allocator.html',1,'']]],
+  ['vmaallocatorcreateinfo_242',['VmaAllocatorCreateInfo',['../struct_vma_allocator_create_info.html',1,'']]],
+  ['vmaallocatorinfo_243',['VmaAllocatorInfo',['../struct_vma_allocator_info.html',1,'']]],
+  ['vmabudget_244',['VmaBudget',['../struct_vma_budget.html',1,'']]],
+  ['vmadefragmentationcontext_245',['VmaDefragmentationContext',['../struct_vma_defragmentation_context.html',1,'']]],
+  ['vmadefragmentationinfo_246',['VmaDefragmentationInfo',['../struct_vma_defragmentation_info.html',1,'']]],
+  ['vmadefragmentationinfo2_247',['VmaDefragmentationInfo2',['../struct_vma_defragmentation_info2.html',1,'']]],
+  ['vmadefragmentationpassinfo_248',['VmaDefragmentationPassInfo',['../struct_vma_defragmentation_pass_info.html',1,'']]],
+  ['vmadefragmentationpassmoveinfo_249',['VmaDefragmentationPassMoveInfo',['../struct_vma_defragmentation_pass_move_info.html',1,'']]],
+  ['vmadefragmentationstats_250',['VmaDefragmentationStats',['../struct_vma_defragmentation_stats.html',1,'']]],
+  ['vmadevicememorycallbacks_251',['VmaDeviceMemoryCallbacks',['../struct_vma_device_memory_callbacks.html',1,'']]],
+  ['vmapool_252',['VmaPool',['../struct_vma_pool.html',1,'']]],
+  ['vmapoolcreateinfo_253',['VmaPoolCreateInfo',['../struct_vma_pool_create_info.html',1,'']]],
+  ['vmapoolstats_254',['VmaPoolStats',['../struct_vma_pool_stats.html',1,'']]],
+  ['vmarecordsettings_255',['VmaRecordSettings',['../struct_vma_record_settings.html',1,'']]],
+  ['vmastatinfo_256',['VmaStatInfo',['../struct_vma_stat_info.html',1,'']]],
+  ['vmastats_257',['VmaStats',['../struct_vma_stats.html',1,'']]],
+  ['vmavulkanfunctions_258',['VmaVulkanFunctions',['../struct_vma_vulkan_functions.html',1,'']]]
 ];
diff --git a/docs/html/search/defines_0.js b/docs/html/search/defines_0.js
index f9e8d33..615c3c4 100644
--- a/docs/html/search/defines_0.js
+++ b/docs/html/search/defines_0.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['nominmax_468',['NOMINMAX',['../vk__mem__alloc_8h.html#a9f918755b601cf4bffca775992e6fb90',1,'vk_mem_alloc.h']]]
+  ['nominmax_472',['NOMINMAX',['../vk__mem__alloc_8h.html#a9f918755b601cf4bffca775992e6fb90',1,'vk_mem_alloc.h']]]
 ];
diff --git a/docs/html/search/defines_1.js b/docs/html/search/defines_1.js
index 9179c5b..997e6ba 100644
--- a/docs/html/search/defines_1.js
+++ b/docs/html/search/defines_1.js
@@ -1,10 +1,10 @@
 var searchData=
 [
-  ['vma_5fbind_5fmemory2_469',['VMA_BIND_MEMORY2',['../vk__mem__alloc_8h.html#a88bef97f86d70a34a4c0746e09a2680d',1,'vk_mem_alloc.h']]],
-  ['vma_5fbuffer_5fdevice_5faddress_470',['VMA_BUFFER_DEVICE_ADDRESS',['../vk__mem__alloc_8h.html#a7f9d5e71b70dd1a137c303a8a8262c10',1,'vk_mem_alloc.h']]],
-  ['vma_5fdedicated_5fallocation_471',['VMA_DEDICATED_ALLOCATION',['../vk__mem__alloc_8h.html#af7b860e63b96d11e44ae8587ba06bbf4',1,'vk_mem_alloc.h']]],
-  ['vma_5fmemory_5fbudget_472',['VMA_MEMORY_BUDGET',['../vk__mem__alloc_8h.html#a05decf1cf4ebf767beba7acca6c1ec3a',1,'vk_mem_alloc.h']]],
-  ['vma_5frecording_5fenabled_473',['VMA_RECORDING_ENABLED',['../vk__mem__alloc_8h.html#a1f0c126759fc96ccb6e2d23c101d770c',1,'vk_mem_alloc.h']]],
-  ['vma_5fstats_5fstring_5fenabled_474',['VMA_STATS_STRING_ENABLED',['../vk__mem__alloc_8h.html#ae25f0d55fd91cb166f002b63244800e1',1,'vk_mem_alloc.h']]],
-  ['vma_5fvulkan_5fversion_475',['VMA_VULKAN_VERSION',['../vk__mem__alloc_8h.html#a1a2407c283893638cc039bb31fcd74b6',1,'vk_mem_alloc.h']]]
+  ['vma_5fbind_5fmemory2_473',['VMA_BIND_MEMORY2',['../vk__mem__alloc_8h.html#a88bef97f86d70a34a4c0746e09a2680d',1,'vk_mem_alloc.h']]],
+  ['vma_5fbuffer_5fdevice_5faddress_474',['VMA_BUFFER_DEVICE_ADDRESS',['../vk__mem__alloc_8h.html#a7f9d5e71b70dd1a137c303a8a8262c10',1,'vk_mem_alloc.h']]],
+  ['vma_5fdedicated_5fallocation_475',['VMA_DEDICATED_ALLOCATION',['../vk__mem__alloc_8h.html#af7b860e63b96d11e44ae8587ba06bbf4',1,'vk_mem_alloc.h']]],
+  ['vma_5fmemory_5fbudget_476',['VMA_MEMORY_BUDGET',['../vk__mem__alloc_8h.html#a05decf1cf4ebf767beba7acca6c1ec3a',1,'vk_mem_alloc.h']]],
+  ['vma_5frecording_5fenabled_477',['VMA_RECORDING_ENABLED',['../vk__mem__alloc_8h.html#a1f0c126759fc96ccb6e2d23c101d770c',1,'vk_mem_alloc.h']]],
+  ['vma_5fstats_5fstring_5fenabled_478',['VMA_STATS_STRING_ENABLED',['../vk__mem__alloc_8h.html#ae25f0d55fd91cb166f002b63244800e1',1,'vk_mem_alloc.h']]],
+  ['vma_5fvulkan_5fversion_479',['VMA_VULKAN_VERSION',['../vk__mem__alloc_8h.html#a1a2407c283893638cc039bb31fcd74b6',1,'vk_mem_alloc.h']]]
 ];
diff --git a/docs/html/search/enums_0.js b/docs/html/search/enums_0.js
index d4fbd21..a65c89d 100644
--- a/docs/html/search/enums_0.js
+++ b/docs/html/search/enums_0.js
@@ -1,9 +1,9 @@
 var searchData=
 [
-  ['vmaallocationcreateflagbits_421',['VmaAllocationCreateFlagBits',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597',1,'vk_mem_alloc.h']]],
-  ['vmaallocatorcreateflagbits_422',['VmaAllocatorCreateFlagBits',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c',1,'vk_mem_alloc.h']]],
-  ['vmadefragmentationflagbits_423',['VmaDefragmentationFlagBits',['../vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50c',1,'vk_mem_alloc.h']]],
-  ['vmamemoryusage_424',['VmaMemoryUsage',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc',1,'vk_mem_alloc.h']]],
-  ['vmapoolcreateflagbits_425',['VmaPoolCreateFlagBits',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7',1,'vk_mem_alloc.h']]],
-  ['vmarecordflagbits_426',['VmaRecordFlagBits',['../vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2',1,'vk_mem_alloc.h']]]
+  ['vmaallocationcreateflagbits_425',['VmaAllocationCreateFlagBits',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597',1,'vk_mem_alloc.h']]],
+  ['vmaallocatorcreateflagbits_426',['VmaAllocatorCreateFlagBits',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c',1,'vk_mem_alloc.h']]],
+  ['vmadefragmentationflagbits_427',['VmaDefragmentationFlagBits',['../vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50c',1,'vk_mem_alloc.h']]],
+  ['vmamemoryusage_428',['VmaMemoryUsage',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc',1,'vk_mem_alloc.h']]],
+  ['vmapoolcreateflagbits_429',['VmaPoolCreateFlagBits',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7',1,'vk_mem_alloc.h']]],
+  ['vmarecordflagbits_430',['VmaRecordFlagBits',['../vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2',1,'vk_mem_alloc.h']]]
 ];
diff --git a/docs/html/search/enumvalues_0.js b/docs/html/search/enumvalues_0.js
index b3cfcfb..82bd66b 100644
--- a/docs/html/search/enumvalues_0.js
+++ b/docs/html/search/enumvalues_0.js
@@ -1,44 +1,44 @@
 var searchData=
 [
-  ['vma_5fallocation_5fcreate_5fcan_5fbecome_5flost_5fbit_427',['VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fcan_5fmake_5fother_5flost_5fbit_428',['VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fdedicated_5fmemory_5fbit_429',['VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fdont_5fbind_5fbit_430',['VMA_ALLOCATION_CREATE_DONT_BIND_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fflag_5fbits_5fmax_5fenum_431',['VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fmapped_5fbit_432',['VMA_ALLOCATION_CREATE_MAPPED_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fnever_5fallocate_5fbit_433',['VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fstrategy_5fbest_5ffit_5fbit_434',['VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fstrategy_5ffirst_5ffit_5fbit_435',['VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fstrategy_5fmask_436',['VMA_ALLOCATION_CREATE_STRATEGY_MASK',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fstrategy_5fmin_5ffragmentation_5fbit_437',['VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fstrategy_5fmin_5fmemory_5fbit_438',['VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fstrategy_5fmin_5ftime_5fbit_439',['VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fstrategy_5fworst_5ffit_5fbit_440',['VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fupper_5faddress_5fbit_441',['VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fuser_5fdata_5fcopy_5fstring_5fbit_442',['VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocation_5fcreate_5fwithin_5fbudget_5fbit_443',['VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocator_5fcreate_5famd_5fdevice_5fcoherent_5fmemory_5fbit_444',['VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocator_5fcreate_5fbuffer_5fdevice_5faddress_5fbit_445',['VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocator_5fcreate_5fext_5fmemory_5fbudget_5fbit_446',['VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocator_5fcreate_5fexternally_5fsynchronized_5fbit_447',['VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocator_5fcreate_5fflag_5fbits_5fmax_5fenum_448',['VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocator_5fcreate_5fkhr_5fbind_5fmemory2_5fbit_449',['VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee',1,'vk_mem_alloc.h']]],
-  ['vma_5fallocator_5fcreate_5fkhr_5fdedicated_5fallocation_5fbit_450',['VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878',1,'vk_mem_alloc.h']]],
-  ['vma_5fdefragmentation_5fflag_5fbits_5fmax_5fenum_451',['VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97',1,'vk_mem_alloc.h']]],
-  ['vma_5fdefragmentation_5fflag_5fincremental_452',['VMA_DEFRAGMENTATION_FLAG_INCREMENTAL',['../vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33',1,'vk_mem_alloc.h']]],
-  ['vma_5fmemory_5fusage_5fcpu_5fcopy_453',['VMA_MEMORY_USAGE_CPU_COPY',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500',1,'vk_mem_alloc.h']]],
-  ['vma_5fmemory_5fusage_5fcpu_5fonly_454',['VMA_MEMORY_USAGE_CPU_ONLY',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5',1,'vk_mem_alloc.h']]],
-  ['vma_5fmemory_5fusage_5fcpu_5fto_5fgpu_455',['VMA_MEMORY_USAGE_CPU_TO_GPU',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67',1,'vk_mem_alloc.h']]],
-  ['vma_5fmemory_5fusage_5fgpu_5flazily_5fallocated_456',['VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d',1,'vk_mem_alloc.h']]],
-  ['vma_5fmemory_5fusage_5fgpu_5fonly_457',['VMA_MEMORY_USAGE_GPU_ONLY',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7',1,'vk_mem_alloc.h']]],
-  ['vma_5fmemory_5fusage_5fgpu_5fto_5fcpu_458',['VMA_MEMORY_USAGE_GPU_TO_CPU',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27',1,'vk_mem_alloc.h']]],
-  ['vma_5fmemory_5fusage_5fmax_5fenum_459',['VMA_MEMORY_USAGE_MAX_ENUM',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e',1,'vk_mem_alloc.h']]],
-  ['vma_5fmemory_5fusage_5funknown_460',['VMA_MEMORY_USAGE_UNKNOWN',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd',1,'vk_mem_alloc.h']]],
-  ['vma_5fpool_5fcreate_5falgorithm_5fmask_461',['VMA_POOL_CREATE_ALGORITHM_MASK',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c',1,'vk_mem_alloc.h']]],
-  ['vma_5fpool_5fcreate_5fbuddy_5falgorithm_5fbit_462',['VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e',1,'vk_mem_alloc.h']]],
-  ['vma_5fpool_5fcreate_5fflag_5fbits_5fmax_5fenum_463',['VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec',1,'vk_mem_alloc.h']]],
-  ['vma_5fpool_5fcreate_5fignore_5fbuffer_5fimage_5fgranularity_5fbit_464',['VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2',1,'vk_mem_alloc.h']]],
-  ['vma_5fpool_5fcreate_5flinear_5falgorithm_5fbit_465',['VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726',1,'vk_mem_alloc.h']]],
-  ['vma_5frecord_5fflag_5fbits_5fmax_5fenum_466',['VMA_RECORD_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e',1,'vk_mem_alloc.h']]],
-  ['vma_5frecord_5fflush_5fafter_5fcall_5fbit_467',['VMA_RECORD_FLUSH_AFTER_CALL_BIT',['../vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7',1,'vk_mem_alloc.h']]]
+  ['vma_5fallocation_5fcreate_5fcan_5fbecome_5flost_5fbit_431',['VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fcan_5fmake_5fother_5flost_5fbit_432',['VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fdedicated_5fmemory_5fbit_433',['VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fdont_5fbind_5fbit_434',['VMA_ALLOCATION_CREATE_DONT_BIND_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fflag_5fbits_5fmax_5fenum_435',['VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fmapped_5fbit_436',['VMA_ALLOCATION_CREATE_MAPPED_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fnever_5fallocate_5fbit_437',['VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fstrategy_5fbest_5ffit_5fbit_438',['VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fstrategy_5ffirst_5ffit_5fbit_439',['VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fstrategy_5fmask_440',['VMA_ALLOCATION_CREATE_STRATEGY_MASK',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fstrategy_5fmin_5ffragmentation_5fbit_441',['VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fstrategy_5fmin_5fmemory_5fbit_442',['VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fstrategy_5fmin_5ftime_5fbit_443',['VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fstrategy_5fworst_5ffit_5fbit_444',['VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fupper_5faddress_5fbit_445',['VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fuser_5fdata_5fcopy_5fstring_5fbit_446',['VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocation_5fcreate_5fwithin_5fbudget_5fbit_447',['VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocator_5fcreate_5famd_5fdevice_5fcoherent_5fmemory_5fbit_448',['VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocator_5fcreate_5fbuffer_5fdevice_5faddress_5fbit_449',['VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocator_5fcreate_5fext_5fmemory_5fbudget_5fbit_450',['VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocator_5fcreate_5fexternally_5fsynchronized_5fbit_451',['VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocator_5fcreate_5fflag_5fbits_5fmax_5fenum_452',['VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocator_5fcreate_5fkhr_5fbind_5fmemory2_5fbit_453',['VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee',1,'vk_mem_alloc.h']]],
+  ['vma_5fallocator_5fcreate_5fkhr_5fdedicated_5fallocation_5fbit_454',['VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878',1,'vk_mem_alloc.h']]],
+  ['vma_5fdefragmentation_5fflag_5fbits_5fmax_5fenum_455',['VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97',1,'vk_mem_alloc.h']]],
+  ['vma_5fdefragmentation_5fflag_5fincremental_456',['VMA_DEFRAGMENTATION_FLAG_INCREMENTAL',['../vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33',1,'vk_mem_alloc.h']]],
+  ['vma_5fmemory_5fusage_5fcpu_5fcopy_457',['VMA_MEMORY_USAGE_CPU_COPY',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500',1,'vk_mem_alloc.h']]],
+  ['vma_5fmemory_5fusage_5fcpu_5fonly_458',['VMA_MEMORY_USAGE_CPU_ONLY',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5',1,'vk_mem_alloc.h']]],
+  ['vma_5fmemory_5fusage_5fcpu_5fto_5fgpu_459',['VMA_MEMORY_USAGE_CPU_TO_GPU',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67',1,'vk_mem_alloc.h']]],
+  ['vma_5fmemory_5fusage_5fgpu_5flazily_5fallocated_460',['VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d',1,'vk_mem_alloc.h']]],
+  ['vma_5fmemory_5fusage_5fgpu_5fonly_461',['VMA_MEMORY_USAGE_GPU_ONLY',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7',1,'vk_mem_alloc.h']]],
+  ['vma_5fmemory_5fusage_5fgpu_5fto_5fcpu_462',['VMA_MEMORY_USAGE_GPU_TO_CPU',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27',1,'vk_mem_alloc.h']]],
+  ['vma_5fmemory_5fusage_5fmax_5fenum_463',['VMA_MEMORY_USAGE_MAX_ENUM',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e',1,'vk_mem_alloc.h']]],
+  ['vma_5fmemory_5fusage_5funknown_464',['VMA_MEMORY_USAGE_UNKNOWN',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd',1,'vk_mem_alloc.h']]],
+  ['vma_5fpool_5fcreate_5falgorithm_5fmask_465',['VMA_POOL_CREATE_ALGORITHM_MASK',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c',1,'vk_mem_alloc.h']]],
+  ['vma_5fpool_5fcreate_5fbuddy_5falgorithm_5fbit_466',['VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e',1,'vk_mem_alloc.h']]],
+  ['vma_5fpool_5fcreate_5fflag_5fbits_5fmax_5fenum_467',['VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec',1,'vk_mem_alloc.h']]],
+  ['vma_5fpool_5fcreate_5fignore_5fbuffer_5fimage_5fgranularity_5fbit_468',['VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2',1,'vk_mem_alloc.h']]],
+  ['vma_5fpool_5fcreate_5flinear_5falgorithm_5fbit_469',['VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726',1,'vk_mem_alloc.h']]],
+  ['vma_5frecord_5fflag_5fbits_5fmax_5fenum_470',['VMA_RECORD_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e',1,'vk_mem_alloc.h']]],
+  ['vma_5frecord_5fflush_5fafter_5fcall_5fbit_471',['VMA_RECORD_FLUSH_AFTER_CALL_BIT',['../vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7',1,'vk_mem_alloc.h']]]
 ];
diff --git a/docs/html/search/files_0.js b/docs/html/search/files_0.js
index 942faa9..4c467ee 100644
--- a/docs/html/search/files_0.js
+++ b/docs/html/search/files_0.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['vk_5fmem_5falloc_2eh_257',['vk_mem_alloc.h',['../vk__mem__alloc_8h.html',1,'']]]
+  ['vk_5fmem_5falloc_2eh_259',['vk_mem_alloc.h',['../vk__mem__alloc_8h.html',1,'']]]
 ];
diff --git a/docs/html/search/functions_0.js b/docs/html/search/functions_0.js
index 3696f52..ed18dfa 100644
--- a/docs/html/search/functions_0.js
+++ b/docs/html/search/functions_0.js
@@ -1,53 +1,55 @@
 var searchData=
 [
-  ['vmaallocatememory_258',['vmaAllocateMemory',['../vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8',1,'vk_mem_alloc.h']]],
-  ['vmaallocatememoryforbuffer_259',['vmaAllocateMemoryForBuffer',['../vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b',1,'vk_mem_alloc.h']]],
-  ['vmaallocatememoryforimage_260',['vmaAllocateMemoryForImage',['../vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb',1,'vk_mem_alloc.h']]],
-  ['vmaallocatememorypages_261',['vmaAllocateMemoryPages',['../vk__mem__alloc_8h.html#ad37e82e492b3de38fc3f4cffd9ad0ae1',1,'vk_mem_alloc.h']]],
-  ['vmabegindefragmentationpass_262',['vmaBeginDefragmentationPass',['../vk__mem__alloc_8h.html#ac0f01545b6262f7d4d128fc8f8e5c77b',1,'vk_mem_alloc.h']]],
-  ['vmabindbuffermemory_263',['vmaBindBufferMemory',['../vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470',1,'vk_mem_alloc.h']]],
-  ['vmabindbuffermemory2_264',['vmaBindBufferMemory2',['../vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a',1,'vk_mem_alloc.h']]],
-  ['vmabindimagememory_265',['vmaBindImageMemory',['../vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5',1,'vk_mem_alloc.h']]],
-  ['vmabindimagememory2_266',['vmaBindImageMemory2',['../vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc',1,'vk_mem_alloc.h']]],
-  ['vmabuildstatsstring_267',['vmaBuildStatsString',['../vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0',1,'vk_mem_alloc.h']]],
-  ['vmacalculatestats_268',['vmaCalculateStats',['../vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3',1,'vk_mem_alloc.h']]],
-  ['vmacheckcorruption_269',['vmaCheckCorruption',['../vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98',1,'vk_mem_alloc.h']]],
-  ['vmacheckpoolcorruption_270',['vmaCheckPoolCorruption',['../vk__mem__alloc_8h.html#ad535935619c7a549bf837e1bb0068f89',1,'vk_mem_alloc.h']]],
-  ['vmacreateallocator_271',['vmaCreateAllocator',['../vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb',1,'vk_mem_alloc.h']]],
-  ['vmacreatebuffer_272',['vmaCreateBuffer',['../vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51',1,'vk_mem_alloc.h']]],
-  ['vmacreateimage_273',['vmaCreateImage',['../vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73',1,'vk_mem_alloc.h']]],
-  ['vmacreatelostallocation_274',['vmaCreateLostAllocation',['../vk__mem__alloc_8h.html#ae5c9657d9e94756269145b01c05d16f1',1,'vk_mem_alloc.h']]],
-  ['vmacreatepool_275',['vmaCreatePool',['../vk__mem__alloc_8h.html#a5c8770ded7c59c8caac6de0c2cb00b50',1,'vk_mem_alloc.h']]],
-  ['vmadefragment_276',['vmaDefragment',['../vk__mem__alloc_8h.html#a9f0f8f56db5f7f57fe4454f465142dac',1,'vk_mem_alloc.h']]],
-  ['vmadefragmentationbegin_277',['vmaDefragmentationBegin',['../vk__mem__alloc_8h.html#a36ba776fd7fd5cb1e9359fdc0d8e6e8a',1,'vk_mem_alloc.h']]],
-  ['vmadefragmentationend_278',['vmaDefragmentationEnd',['../vk__mem__alloc_8h.html#a8774e20e91e245aae959ba63efa15dd2',1,'vk_mem_alloc.h']]],
-  ['vmadestroyallocator_279',['vmaDestroyAllocator',['../vk__mem__alloc_8h.html#aa8d164061c88f22fb1fd3c8f3534bc1d',1,'vk_mem_alloc.h']]],
-  ['vmadestroybuffer_280',['vmaDestroyBuffer',['../vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77',1,'vk_mem_alloc.h']]],
-  ['vmadestroyimage_281',['vmaDestroyImage',['../vk__mem__alloc_8h.html#ae50d2cb3b4a3bfd4dd40987234e50e7e',1,'vk_mem_alloc.h']]],
-  ['vmadestroypool_282',['vmaDestroyPool',['../vk__mem__alloc_8h.html#a5485779c8f1948238fc4e92232fa65e1',1,'vk_mem_alloc.h']]],
-  ['vmaenddefragmentationpass_283',['vmaEndDefragmentationPass',['../vk__mem__alloc_8h.html#a1b9ffa538bed905af55c747cc48963bd',1,'vk_mem_alloc.h']]],
-  ['vmafindmemorytypeindex_284',['vmaFindMemoryTypeIndex',['../vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a',1,'vk_mem_alloc.h']]],
-  ['vmafindmemorytypeindexforbufferinfo_285',['vmaFindMemoryTypeIndexForBufferInfo',['../vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888',1,'vk_mem_alloc.h']]],
-  ['vmafindmemorytypeindexforimageinfo_286',['vmaFindMemoryTypeIndexForImageInfo',['../vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472',1,'vk_mem_alloc.h']]],
-  ['vmaflushallocation_287',['vmaFlushAllocation',['../vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de',1,'vk_mem_alloc.h']]],
-  ['vmafreememory_288',['vmaFreeMemory',['../vk__mem__alloc_8h.html#a5fea5518972ae9094b1526cbcb19b05f',1,'vk_mem_alloc.h']]],
-  ['vmafreememorypages_289',['vmaFreeMemoryPages',['../vk__mem__alloc_8h.html#a834b1e4aef395c0a1d56a28e69a4a17e',1,'vk_mem_alloc.h']]],
-  ['vmafreestatsstring_290',['vmaFreeStatsString',['../vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288',1,'vk_mem_alloc.h']]],
-  ['vmagetallocationinfo_291',['vmaGetAllocationInfo',['../vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b',1,'vk_mem_alloc.h']]],
-  ['vmagetallocatorinfo_292',['vmaGetAllocatorInfo',['../vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7',1,'vk_mem_alloc.h']]],
-  ['vmagetbudget_293',['vmaGetBudget',['../vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba',1,'vk_mem_alloc.h']]],
-  ['vmagetmemoryproperties_294',['vmaGetMemoryProperties',['../vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19',1,'vk_mem_alloc.h']]],
-  ['vmagetmemorytypeproperties_295',['vmaGetMemoryTypeProperties',['../vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca',1,'vk_mem_alloc.h']]],
-  ['vmagetphysicaldeviceproperties_296',['vmaGetPhysicalDeviceProperties',['../vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0',1,'vk_mem_alloc.h']]],
-  ['vmagetpoolname_297',['vmaGetPoolName',['../vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030',1,'vk_mem_alloc.h']]],
-  ['vmagetpoolstats_298',['vmaGetPoolStats',['../vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153',1,'vk_mem_alloc.h']]],
-  ['vmainvalidateallocation_299',['vmaInvalidateAllocation',['../vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006',1,'vk_mem_alloc.h']]],
-  ['vmamakepoolallocationslost_300',['vmaMakePoolAllocationsLost',['../vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024',1,'vk_mem_alloc.h']]],
-  ['vmamapmemory_301',['vmaMapMemory',['../vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069',1,'vk_mem_alloc.h']]],
-  ['vmaresizeallocation_302',['vmaResizeAllocation',['../vk__mem__alloc_8h.html#a0ff488958ca72b28e545880463cb8696',1,'vk_mem_alloc.h']]],
-  ['vmasetallocationuserdata_303',['vmaSetAllocationUserData',['../vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f',1,'vk_mem_alloc.h']]],
-  ['vmasetcurrentframeindex_304',['vmaSetCurrentFrameIndex',['../vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236',1,'vk_mem_alloc.h']]],
-  ['vmasetpoolname_305',['vmaSetPoolName',['../vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58',1,'vk_mem_alloc.h']]],
-  ['vmatouchallocation_306',['vmaTouchAllocation',['../vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a',1,'vk_mem_alloc.h']]],
-  ['vmaunmapmemory_307',['vmaUnmapMemory',['../vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45',1,'vk_mem_alloc.h']]]
+  ['vmaallocatememory_260',['vmaAllocateMemory',['../vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8',1,'vk_mem_alloc.h']]],
+  ['vmaallocatememoryforbuffer_261',['vmaAllocateMemoryForBuffer',['../vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b',1,'vk_mem_alloc.h']]],
+  ['vmaallocatememoryforimage_262',['vmaAllocateMemoryForImage',['../vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb',1,'vk_mem_alloc.h']]],
+  ['vmaallocatememorypages_263',['vmaAllocateMemoryPages',['../vk__mem__alloc_8h.html#ad37e82e492b3de38fc3f4cffd9ad0ae1',1,'vk_mem_alloc.h']]],
+  ['vmabegindefragmentationpass_264',['vmaBeginDefragmentationPass',['../vk__mem__alloc_8h.html#ac0f01545b6262f7d4d128fc8f8e5c77b',1,'vk_mem_alloc.h']]],
+  ['vmabindbuffermemory_265',['vmaBindBufferMemory',['../vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470',1,'vk_mem_alloc.h']]],
+  ['vmabindbuffermemory2_266',['vmaBindBufferMemory2',['../vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a',1,'vk_mem_alloc.h']]],
+  ['vmabindimagememory_267',['vmaBindImageMemory',['../vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5',1,'vk_mem_alloc.h']]],
+  ['vmabindimagememory2_268',['vmaBindImageMemory2',['../vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc',1,'vk_mem_alloc.h']]],
+  ['vmabuildstatsstring_269',['vmaBuildStatsString',['../vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0',1,'vk_mem_alloc.h']]],
+  ['vmacalculatestats_270',['vmaCalculateStats',['../vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3',1,'vk_mem_alloc.h']]],
+  ['vmacheckcorruption_271',['vmaCheckCorruption',['../vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98',1,'vk_mem_alloc.h']]],
+  ['vmacheckpoolcorruption_272',['vmaCheckPoolCorruption',['../vk__mem__alloc_8h.html#ad535935619c7a549bf837e1bb0068f89',1,'vk_mem_alloc.h']]],
+  ['vmacreateallocator_273',['vmaCreateAllocator',['../vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb',1,'vk_mem_alloc.h']]],
+  ['vmacreatebuffer_274',['vmaCreateBuffer',['../vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51',1,'vk_mem_alloc.h']]],
+  ['vmacreateimage_275',['vmaCreateImage',['../vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73',1,'vk_mem_alloc.h']]],
+  ['vmacreatelostallocation_276',['vmaCreateLostAllocation',['../vk__mem__alloc_8h.html#ae5c9657d9e94756269145b01c05d16f1',1,'vk_mem_alloc.h']]],
+  ['vmacreatepool_277',['vmaCreatePool',['../vk__mem__alloc_8h.html#a5c8770ded7c59c8caac6de0c2cb00b50',1,'vk_mem_alloc.h']]],
+  ['vmadefragment_278',['vmaDefragment',['../vk__mem__alloc_8h.html#a9f0f8f56db5f7f57fe4454f465142dac',1,'vk_mem_alloc.h']]],
+  ['vmadefragmentationbegin_279',['vmaDefragmentationBegin',['../vk__mem__alloc_8h.html#a36ba776fd7fd5cb1e9359fdc0d8e6e8a',1,'vk_mem_alloc.h']]],
+  ['vmadefragmentationend_280',['vmaDefragmentationEnd',['../vk__mem__alloc_8h.html#a8774e20e91e245aae959ba63efa15dd2',1,'vk_mem_alloc.h']]],
+  ['vmadestroyallocator_281',['vmaDestroyAllocator',['../vk__mem__alloc_8h.html#aa8d164061c88f22fb1fd3c8f3534bc1d',1,'vk_mem_alloc.h']]],
+  ['vmadestroybuffer_282',['vmaDestroyBuffer',['../vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77',1,'vk_mem_alloc.h']]],
+  ['vmadestroyimage_283',['vmaDestroyImage',['../vk__mem__alloc_8h.html#ae50d2cb3b4a3bfd4dd40987234e50e7e',1,'vk_mem_alloc.h']]],
+  ['vmadestroypool_284',['vmaDestroyPool',['../vk__mem__alloc_8h.html#a5485779c8f1948238fc4e92232fa65e1',1,'vk_mem_alloc.h']]],
+  ['vmaenddefragmentationpass_285',['vmaEndDefragmentationPass',['../vk__mem__alloc_8h.html#a1b9ffa538bed905af55c747cc48963bd',1,'vk_mem_alloc.h']]],
+  ['vmafindmemorytypeindex_286',['vmaFindMemoryTypeIndex',['../vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a',1,'vk_mem_alloc.h']]],
+  ['vmafindmemorytypeindexforbufferinfo_287',['vmaFindMemoryTypeIndexForBufferInfo',['../vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888',1,'vk_mem_alloc.h']]],
+  ['vmafindmemorytypeindexforimageinfo_288',['vmaFindMemoryTypeIndexForImageInfo',['../vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472',1,'vk_mem_alloc.h']]],
+  ['vmaflushallocation_289',['vmaFlushAllocation',['../vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f',1,'vk_mem_alloc.h']]],
+  ['vmaflushallocations_290',['vmaFlushAllocations',['../vk__mem__alloc_8h.html#ac3dd00da721875ed99fa8a881922bdfc',1,'vk_mem_alloc.h']]],
+  ['vmafreememory_291',['vmaFreeMemory',['../vk__mem__alloc_8h.html#a5fea5518972ae9094b1526cbcb19b05f',1,'vk_mem_alloc.h']]],
+  ['vmafreememorypages_292',['vmaFreeMemoryPages',['../vk__mem__alloc_8h.html#a834b1e4aef395c0a1d56a28e69a4a17e',1,'vk_mem_alloc.h']]],
+  ['vmafreestatsstring_293',['vmaFreeStatsString',['../vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288',1,'vk_mem_alloc.h']]],
+  ['vmagetallocationinfo_294',['vmaGetAllocationInfo',['../vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b',1,'vk_mem_alloc.h']]],
+  ['vmagetallocatorinfo_295',['vmaGetAllocatorInfo',['../vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7',1,'vk_mem_alloc.h']]],
+  ['vmagetbudget_296',['vmaGetBudget',['../vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba',1,'vk_mem_alloc.h']]],
+  ['vmagetmemoryproperties_297',['vmaGetMemoryProperties',['../vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19',1,'vk_mem_alloc.h']]],
+  ['vmagetmemorytypeproperties_298',['vmaGetMemoryTypeProperties',['../vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca',1,'vk_mem_alloc.h']]],
+  ['vmagetphysicaldeviceproperties_299',['vmaGetPhysicalDeviceProperties',['../vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0',1,'vk_mem_alloc.h']]],
+  ['vmagetpoolname_300',['vmaGetPoolName',['../vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030',1,'vk_mem_alloc.h']]],
+  ['vmagetpoolstats_301',['vmaGetPoolStats',['../vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153',1,'vk_mem_alloc.h']]],
+  ['vmainvalidateallocation_302',['vmaInvalidateAllocation',['../vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae',1,'vk_mem_alloc.h']]],
+  ['vmainvalidateallocations_303',['vmaInvalidateAllocations',['../vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5',1,'vk_mem_alloc.h']]],
+  ['vmamakepoolallocationslost_304',['vmaMakePoolAllocationsLost',['../vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024',1,'vk_mem_alloc.h']]],
+  ['vmamapmemory_305',['vmaMapMemory',['../vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069',1,'vk_mem_alloc.h']]],
+  ['vmaresizeallocation_306',['vmaResizeAllocation',['../vk__mem__alloc_8h.html#a0ff488958ca72b28e545880463cb8696',1,'vk_mem_alloc.h']]],
+  ['vmasetallocationuserdata_307',['vmaSetAllocationUserData',['../vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f',1,'vk_mem_alloc.h']]],
+  ['vmasetcurrentframeindex_308',['vmaSetCurrentFrameIndex',['../vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236',1,'vk_mem_alloc.h']]],
+  ['vmasetpoolname_309',['vmaSetPoolName',['../vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58',1,'vk_mem_alloc.h']]],
+  ['vmatouchallocation_310',['vmaTouchAllocation',['../vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a',1,'vk_mem_alloc.h']]],
+  ['vmaunmapmemory_311',['vmaUnmapMemory',['../vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45',1,'vk_mem_alloc.h']]]
 ];
diff --git a/docs/html/search/pages_0.js b/docs/html/search/pages_0.js
index 587a470..3b385d3 100644
--- a/docs/html/search/pages_0.js
+++ b/docs/html/search/pages_0.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['allocation_20names_20and_20user_20data_476',['Allocation names and user data',['../allocation_annotation.html',1,'index']]]
+  ['allocation_20names_20and_20user_20data_480',['Allocation names and user data',['../allocation_annotation.html',1,'index']]]
 ];
diff --git a/docs/html/search/pages_1.js b/docs/html/search/pages_1.js
index cb8e626..23ebec4 100644
--- a/docs/html/search/pages_1.js
+++ b/docs/html/search/pages_1.js
@@ -1,6 +1,6 @@
 var searchData=
 [
-  ['choosing_20memory_20type_477',['Choosing memory type',['../choosing_memory_type.html',1,'index']]],
-  ['configuration_478',['Configuration',['../configuration.html',1,'index']]],
-  ['custom_20memory_20pools_479',['Custom memory pools',['../custom_memory_pools.html',1,'index']]]
+  ['choosing_20memory_20type_481',['Choosing memory type',['../choosing_memory_type.html',1,'index']]],
+  ['configuration_482',['Configuration',['../configuration.html',1,'index']]],
+  ['custom_20memory_20pools_483',['Custom memory pools',['../custom_memory_pools.html',1,'index']]]
 ];
diff --git a/docs/html/search/pages_2.js b/docs/html/search/pages_2.js
index f5abef5..687395c 100644
--- a/docs/html/search/pages_2.js
+++ b/docs/html/search/pages_2.js
@@ -1,6 +1,6 @@
 var searchData=
 [
-  ['debugging_20incorrect_20memory_20usage_480',['Debugging incorrect memory usage',['../debugging_memory_usage.html',1,'index']]],
-  ['defragmentation_481',['Defragmentation',['../defragmentation.html',1,'index']]],
-  ['deprecated_20list_482',['Deprecated List',['../deprecated.html',1,'']]]
+  ['debugging_20incorrect_20memory_20usage_484',['Debugging incorrect memory usage',['../debugging_memory_usage.html',1,'index']]],
+  ['defragmentation_485',['Defragmentation',['../defragmentation.html',1,'index']]],
+  ['deprecated_20list_486',['Deprecated List',['../deprecated.html',1,'']]]
 ];
diff --git a/docs/html/search/pages_3.js b/docs/html/search/pages_3.js
index 30a0a86..1491c8e 100644
--- a/docs/html/search/pages_3.js
+++ b/docs/html/search/pages_3.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['enabling_20buffer_20device_20address_483',['Enabling buffer device address',['../enabling_buffer_device_address.html',1,'index']]]
+  ['enabling_20buffer_20device_20address_487',['Enabling buffer device address',['../enabling_buffer_device_address.html',1,'index']]]
 ];
diff --git a/docs/html/search/pages_4.js b/docs/html/search/pages_4.js
index 70f6a63..d9b7b32 100644
--- a/docs/html/search/pages_4.js
+++ b/docs/html/search/pages_4.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['general_20considerations_484',['General considerations',['../general_considerations.html',1,'index']]]
+  ['general_20considerations_488',['General considerations',['../general_considerations.html',1,'index']]]
 ];
diff --git a/docs/html/search/pages_5.js b/docs/html/search/pages_5.js
index d5fa03c..caa7a41 100644
--- a/docs/html/search/pages_5.js
+++ b/docs/html/search/pages_5.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['lost_20allocations_485',['Lost allocations',['../lost_allocations.html',1,'index']]]
+  ['lost_20allocations_489',['Lost allocations',['../lost_allocations.html',1,'index']]]
 ];
diff --git a/docs/html/search/pages_6.js b/docs/html/search/pages_6.js
index 891dc07..733175b 100644
--- a/docs/html/search/pages_6.js
+++ b/docs/html/search/pages_6.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['memory_20mapping_486',['Memory mapping',['../memory_mapping.html',1,'index']]]
+  ['memory_20mapping_490',['Memory mapping',['../memory_mapping.html',1,'index']]]
 ];
diff --git a/docs/html/search/pages_7.js b/docs/html/search/pages_7.js
index e259d4d..2a1dc52 100644
--- a/docs/html/search/pages_7.js
+++ b/docs/html/search/pages_7.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['quick_20start_487',['Quick start',['../quick_start.html',1,'index']]]
+  ['quick_20start_491',['Quick start',['../quick_start.html',1,'index']]]
 ];
diff --git a/docs/html/search/pages_8.js b/docs/html/search/pages_8.js
index c536ab1..f0b034c 100644
--- a/docs/html/search/pages_8.js
+++ b/docs/html/search/pages_8.js
@@ -1,5 +1,5 @@
 var searchData=
 [
-  ['record_20and_20replay_488',['Record and replay',['../record_and_replay.html',1,'index']]],
-  ['recommended_20usage_20patterns_489',['Recommended usage patterns',['../usage_patterns.html',1,'index']]]
+  ['record_20and_20replay_492',['Record and replay',['../record_and_replay.html',1,'index']]],
+  ['recommended_20usage_20patterns_493',['Recommended usage patterns',['../usage_patterns.html',1,'index']]]
 ];
diff --git a/docs/html/search/pages_9.js b/docs/html/search/pages_9.js
index 2f855b9..eacae9b 100644
--- a/docs/html/search/pages_9.js
+++ b/docs/html/search/pages_9.js
@@ -1,5 +1,5 @@
 var searchData=
 [
-  ['statistics_490',['Statistics',['../statistics.html',1,'index']]],
-  ['staying_20within_20budget_491',['Staying within budget',['../staying_within_budget.html',1,'index']]]
+  ['statistics_494',['Statistics',['../statistics.html',1,'index']]],
+  ['staying_20within_20budget_495',['Staying within budget',['../staying_within_budget.html',1,'index']]]
 ];
diff --git a/docs/html/search/pages_a.js b/docs/html/search/pages_a.js
index 29196aa..b8e1a18 100644
--- a/docs/html/search/pages_a.js
+++ b/docs/html/search/pages_a.js
@@ -1,6 +1,6 @@
 var searchData=
 [
-  ['vulkan_20memory_20allocator_492',['Vulkan Memory Allocator',['../index.html',1,'']]],
-  ['vk_5famd_5fdevice_5fcoherent_5fmemory_493',['VK_AMD_device_coherent_memory',['../vk_amd_device_coherent_memory.html',1,'index']]],
-  ['vk_5fkhr_5fdedicated_5fallocation_494',['VK_KHR_dedicated_allocation',['../vk_khr_dedicated_allocation.html',1,'index']]]
+  ['vulkan_20memory_20allocator_496',['Vulkan Memory Allocator',['../index.html',1,'']]],
+  ['vk_5famd_5fdevice_5fcoherent_5fmemory_497',['VK_AMD_device_coherent_memory',['../vk_amd_device_coherent_memory.html',1,'index']]],
+  ['vk_5fkhr_5fdedicated_5fallocation_498',['VK_KHR_dedicated_allocation',['../vk_khr_dedicated_allocation.html',1,'index']]]
 ];
diff --git a/docs/html/search/typedefs_0.js b/docs/html/search/typedefs_0.js
index cc8b3cd..6475b90 100644
--- a/docs/html/search/typedefs_0.js
+++ b/docs/html/search/typedefs_0.js
@@ -1,5 +1,5 @@
 var searchData=
 [
-  ['pfn_5fvmaallocatedevicememoryfunction_391',['PFN_vmaAllocateDeviceMemoryFunction',['../vk__mem__alloc_8h.html#a7e1ed85f7799600b03ad51a77acc21f3',1,'vk_mem_alloc.h']]],
-  ['pfn_5fvmafreedevicememoryfunction_392',['PFN_vmaFreeDeviceMemoryFunction',['../vk__mem__alloc_8h.html#a154ccaaf53dc2c36378f80f0c4f3679b',1,'vk_mem_alloc.h']]]
+  ['pfn_5fvmaallocatedevicememoryfunction_395',['PFN_vmaAllocateDeviceMemoryFunction',['../vk__mem__alloc_8h.html#a7e1ed85f7799600b03ad51a77acc21f3',1,'vk_mem_alloc.h']]],
+  ['pfn_5fvmafreedevicememoryfunction_396',['PFN_vmaFreeDeviceMemoryFunction',['../vk__mem__alloc_8h.html#a154ccaaf53dc2c36378f80f0c4f3679b',1,'vk_mem_alloc.h']]]
 ];
diff --git a/docs/html/search/typedefs_1.js b/docs/html/search/typedefs_1.js
index 039d466..cd8fdb1 100644
--- a/docs/html/search/typedefs_1.js
+++ b/docs/html/search/typedefs_1.js
@@ -1,31 +1,31 @@
 var searchData=
 [
-  ['vmaallocationcreateflagbits_393',['VmaAllocationCreateFlagBits',['../vk__mem__alloc_8h.html#a4fceecc301f4064dc808d3cd6c038941',1,'vk_mem_alloc.h']]],
-  ['vmaallocationcreateflags_394',['VmaAllocationCreateFlags',['../vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817',1,'vk_mem_alloc.h']]],
-  ['vmaallocationcreateinfo_395',['VmaAllocationCreateInfo',['../vk__mem__alloc_8h.html#a3bf110892ea2fb4649fedb68488d026a',1,'vk_mem_alloc.h']]],
-  ['vmaallocationinfo_396',['VmaAllocationInfo',['../vk__mem__alloc_8h.html#a1cf7774606721026a68aabe3af2e5b50',1,'vk_mem_alloc.h']]],
-  ['vmaallocatorcreateflagbits_397',['VmaAllocatorCreateFlagBits',['../vk__mem__alloc_8h.html#afd73b95e737ee7e76f827cb5472f559f',1,'vk_mem_alloc.h']]],
-  ['vmaallocatorcreateflags_398',['VmaAllocatorCreateFlags',['../vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d',1,'vk_mem_alloc.h']]],
-  ['vmaallocatorcreateinfo_399',['VmaAllocatorCreateInfo',['../vk__mem__alloc_8h.html#aad9652301d33759b83e52d4f3605a14a',1,'vk_mem_alloc.h']]],
-  ['vmaallocatorinfo_400',['VmaAllocatorInfo',['../vk__mem__alloc_8h.html#a1988031b0223fdbd564250fa1edd942c',1,'vk_mem_alloc.h']]],
-  ['vmabudget_401',['VmaBudget',['../vk__mem__alloc_8h.html#aa078667e71b1ef24e87a6a30d128381d',1,'vk_mem_alloc.h']]],
-  ['vmadefragmentationflagbits_402',['VmaDefragmentationFlagBits',['../vk__mem__alloc_8h.html#a13415cc0b443353a7b5abda300b833fc',1,'vk_mem_alloc.h']]],
-  ['vmadefragmentationflags_403',['VmaDefragmentationFlags',['../vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d',1,'vk_mem_alloc.h']]],
-  ['vmadefragmentationinfo_404',['VmaDefragmentationInfo',['../vk__mem__alloc_8h.html#a2bf47f96bf92bed2a49461bd9af3acfa',1,'vk_mem_alloc.h']]],
-  ['vmadefragmentationinfo2_405',['VmaDefragmentationInfo2',['../vk__mem__alloc_8h.html#ad6daeffaa670ce6d11a203a6224c9937',1,'vk_mem_alloc.h']]],
-  ['vmadefragmentationpassinfo_406',['VmaDefragmentationPassInfo',['../vk__mem__alloc_8h.html#a72aebd522242d56abea67b4f47f6549e',1,'vk_mem_alloc.h']]],
-  ['vmadefragmentationpassmoveinfo_407',['VmaDefragmentationPassMoveInfo',['../vk__mem__alloc_8h.html#ad6799e8e2b1527abfc84d33bc44aeaf5',1,'vk_mem_alloc.h']]],
-  ['vmadefragmentationstats_408',['VmaDefragmentationStats',['../vk__mem__alloc_8h.html#ad94034192259c2e34a4d1c5e27810403',1,'vk_mem_alloc.h']]],
-  ['vmadevicememorycallbacks_409',['VmaDeviceMemoryCallbacks',['../vk__mem__alloc_8h.html#a77692d3c8770ea8882d573206bd27b2b',1,'vk_mem_alloc.h']]],
-  ['vmamemoryusage_410',['VmaMemoryUsage',['../vk__mem__alloc_8h.html#a806e8499dde802e59eb72a1dc811c35f',1,'vk_mem_alloc.h']]],
-  ['vmapoolcreateflagbits_411',['VmaPoolCreateFlagBits',['../vk__mem__alloc_8h.html#a4d4f2efc2509157a9e4ecd4fd7942303',1,'vk_mem_alloc.h']]],
-  ['vmapoolcreateflags_412',['VmaPoolCreateFlags',['../vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a',1,'vk_mem_alloc.h']]],
-  ['vmapoolcreateinfo_413',['VmaPoolCreateInfo',['../vk__mem__alloc_8h.html#a1017aa83489c0eee8d2163d2bf253f67',1,'vk_mem_alloc.h']]],
-  ['vmapoolstats_414',['VmaPoolStats',['../vk__mem__alloc_8h.html#a4759a2d9f99c19ba7627553c847132f1',1,'vk_mem_alloc.h']]],
-  ['vmarecordflagbits_415',['VmaRecordFlagBits',['../vk__mem__alloc_8h.html#acd24d5eb58abff7e1f43cb32a1ba1413',1,'vk_mem_alloc.h']]],
-  ['vmarecordflags_416',['VmaRecordFlags',['../vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828',1,'vk_mem_alloc.h']]],
-  ['vmarecordsettings_417',['VmaRecordSettings',['../vk__mem__alloc_8h.html#a16e21c877101493fce582664cd8754fc',1,'vk_mem_alloc.h']]],
-  ['vmastatinfo_418',['VmaStatInfo',['../vk__mem__alloc_8h.html#aec5b57e29c97b5d69c6d5654d60df878',1,'vk_mem_alloc.h']]],
-  ['vmastats_419',['VmaStats',['../vk__mem__alloc_8h.html#a21813b2efdf3836767a9058cd8a94034',1,'vk_mem_alloc.h']]],
-  ['vmavulkanfunctions_420',['VmaVulkanFunctions',['../vk__mem__alloc_8h.html#abb0a8e3b5040d847571cca6c7f9a8074',1,'vk_mem_alloc.h']]]
+  ['vmaallocationcreateflagbits_397',['VmaAllocationCreateFlagBits',['../vk__mem__alloc_8h.html#a4fceecc301f4064dc808d3cd6c038941',1,'vk_mem_alloc.h']]],
+  ['vmaallocationcreateflags_398',['VmaAllocationCreateFlags',['../vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817',1,'vk_mem_alloc.h']]],
+  ['vmaallocationcreateinfo_399',['VmaAllocationCreateInfo',['../vk__mem__alloc_8h.html#a3bf110892ea2fb4649fedb68488d026a',1,'vk_mem_alloc.h']]],
+  ['vmaallocationinfo_400',['VmaAllocationInfo',['../vk__mem__alloc_8h.html#a1cf7774606721026a68aabe3af2e5b50',1,'vk_mem_alloc.h']]],
+  ['vmaallocatorcreateflagbits_401',['VmaAllocatorCreateFlagBits',['../vk__mem__alloc_8h.html#afd73b95e737ee7e76f827cb5472f559f',1,'vk_mem_alloc.h']]],
+  ['vmaallocatorcreateflags_402',['VmaAllocatorCreateFlags',['../vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d',1,'vk_mem_alloc.h']]],
+  ['vmaallocatorcreateinfo_403',['VmaAllocatorCreateInfo',['../vk__mem__alloc_8h.html#aad9652301d33759b83e52d4f3605a14a',1,'vk_mem_alloc.h']]],
+  ['vmaallocatorinfo_404',['VmaAllocatorInfo',['../vk__mem__alloc_8h.html#a1988031b0223fdbd564250fa1edd942c',1,'vk_mem_alloc.h']]],
+  ['vmabudget_405',['VmaBudget',['../vk__mem__alloc_8h.html#aa078667e71b1ef24e87a6a30d128381d',1,'vk_mem_alloc.h']]],
+  ['vmadefragmentationflagbits_406',['VmaDefragmentationFlagBits',['../vk__mem__alloc_8h.html#a13415cc0b443353a7b5abda300b833fc',1,'vk_mem_alloc.h']]],
+  ['vmadefragmentationflags_407',['VmaDefragmentationFlags',['../vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d',1,'vk_mem_alloc.h']]],
+  ['vmadefragmentationinfo_408',['VmaDefragmentationInfo',['../vk__mem__alloc_8h.html#a2bf47f96bf92bed2a49461bd9af3acfa',1,'vk_mem_alloc.h']]],
+  ['vmadefragmentationinfo2_409',['VmaDefragmentationInfo2',['../vk__mem__alloc_8h.html#ad6daeffaa670ce6d11a203a6224c9937',1,'vk_mem_alloc.h']]],
+  ['vmadefragmentationpassinfo_410',['VmaDefragmentationPassInfo',['../vk__mem__alloc_8h.html#a72aebd522242d56abea67b4f47f6549e',1,'vk_mem_alloc.h']]],
+  ['vmadefragmentationpassmoveinfo_411',['VmaDefragmentationPassMoveInfo',['../vk__mem__alloc_8h.html#ad6799e8e2b1527abfc84d33bc44aeaf5',1,'vk_mem_alloc.h']]],
+  ['vmadefragmentationstats_412',['VmaDefragmentationStats',['../vk__mem__alloc_8h.html#ad94034192259c2e34a4d1c5e27810403',1,'vk_mem_alloc.h']]],
+  ['vmadevicememorycallbacks_413',['VmaDeviceMemoryCallbacks',['../vk__mem__alloc_8h.html#a77692d3c8770ea8882d573206bd27b2b',1,'vk_mem_alloc.h']]],
+  ['vmamemoryusage_414',['VmaMemoryUsage',['../vk__mem__alloc_8h.html#a806e8499dde802e59eb72a1dc811c35f',1,'vk_mem_alloc.h']]],
+  ['vmapoolcreateflagbits_415',['VmaPoolCreateFlagBits',['../vk__mem__alloc_8h.html#a4d4f2efc2509157a9e4ecd4fd7942303',1,'vk_mem_alloc.h']]],
+  ['vmapoolcreateflags_416',['VmaPoolCreateFlags',['../vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a',1,'vk_mem_alloc.h']]],
+  ['vmapoolcreateinfo_417',['VmaPoolCreateInfo',['../vk__mem__alloc_8h.html#a1017aa83489c0eee8d2163d2bf253f67',1,'vk_mem_alloc.h']]],
+  ['vmapoolstats_418',['VmaPoolStats',['../vk__mem__alloc_8h.html#a4759a2d9f99c19ba7627553c847132f1',1,'vk_mem_alloc.h']]],
+  ['vmarecordflagbits_419',['VmaRecordFlagBits',['../vk__mem__alloc_8h.html#acd24d5eb58abff7e1f43cb32a1ba1413',1,'vk_mem_alloc.h']]],
+  ['vmarecordflags_420',['VmaRecordFlags',['../vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828',1,'vk_mem_alloc.h']]],
+  ['vmarecordsettings_421',['VmaRecordSettings',['../vk__mem__alloc_8h.html#a16e21c877101493fce582664cd8754fc',1,'vk_mem_alloc.h']]],
+  ['vmastatinfo_422',['VmaStatInfo',['../vk__mem__alloc_8h.html#aec5b57e29c97b5d69c6d5654d60df878',1,'vk_mem_alloc.h']]],
+  ['vmastats_423',['VmaStats',['../vk__mem__alloc_8h.html#a21813b2efdf3836767a9058cd8a94034',1,'vk_mem_alloc.h']]],
+  ['vmavulkanfunctions_424',['VmaVulkanFunctions',['../vk__mem__alloc_8h.html#abb0a8e3b5040d847571cca6c7f9a8074',1,'vk_mem_alloc.h']]]
 ];
diff --git a/docs/html/search/variables_0.js b/docs/html/search/variables_0.js
index b202b0a..c301aa7 100644
--- a/docs/html/search/variables_0.js
+++ b/docs/html/search/variables_0.js
@@ -1,10 +1,10 @@
 var searchData=
 [
-  ['allocation_308',['allocation',['../struct_vma_defragmentation_pass_move_info.html#ae885c861c2dd8d622e6c19e281d035cc',1,'VmaDefragmentationPassMoveInfo']]],
-  ['allocationbytes_309',['allocationBytes',['../struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8',1,'VmaBudget']]],
-  ['allocationcount_310',['allocationCount',['../struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff',1,'VmaStatInfo::allocationCount()'],['../struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb',1,'VmaPoolStats::allocationCount()'],['../struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba',1,'VmaDefragmentationInfo2::allocationCount()']]],
-  ['allocationsizeavg_311',['allocationSizeAvg',['../struct_vma_stat_info.html#a1081a039964e566c672e7a2347f9e599',1,'VmaStatInfo']]],
-  ['allocationsizemax_312',['allocationSizeMax',['../struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c',1,'VmaStatInfo']]],
-  ['allocationsizemin_313',['allocationSizeMin',['../struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea',1,'VmaStatInfo']]],
-  ['allocationsmoved_314',['allocationsMoved',['../struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9',1,'VmaDefragmentationStats']]]
+  ['allocation_312',['allocation',['../struct_vma_defragmentation_pass_move_info.html#ae885c861c2dd8d622e6c19e281d035cc',1,'VmaDefragmentationPassMoveInfo']]],
+  ['allocationbytes_313',['allocationBytes',['../struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8',1,'VmaBudget']]],
+  ['allocationcount_314',['allocationCount',['../struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff',1,'VmaStatInfo::allocationCount()'],['../struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb',1,'VmaPoolStats::allocationCount()'],['../struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba',1,'VmaDefragmentationInfo2::allocationCount()']]],
+  ['allocationsizeavg_315',['allocationSizeAvg',['../struct_vma_stat_info.html#a1081a039964e566c672e7a2347f9e599',1,'VmaStatInfo']]],
+  ['allocationsizemax_316',['allocationSizeMax',['../struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c',1,'VmaStatInfo']]],
+  ['allocationsizemin_317',['allocationSizeMin',['../struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea',1,'VmaStatInfo']]],
+  ['allocationsmoved_318',['allocationsMoved',['../struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9',1,'VmaDefragmentationStats']]]
 ];
diff --git a/docs/html/search/variables_1.js b/docs/html/search/variables_1.js
index 34e26f9..8b6acfe 100644
--- a/docs/html/search/variables_1.js
+++ b/docs/html/search/variables_1.js
@@ -1,9 +1,9 @@
 var searchData=
 [
-  ['blockbytes_315',['blockBytes',['../struct_vma_budget.html#a58b492901baab685f466199124e514a0',1,'VmaBudget']]],
-  ['blockcount_316',['blockCount',['../struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4',1,'VmaStatInfo::blockCount()'],['../struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7',1,'VmaPoolStats::blockCount()']]],
-  ['blocksize_317',['blockSize',['../struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676',1,'VmaPoolCreateInfo']]],
-  ['budget_318',['budget',['../struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd',1,'VmaBudget']]],
-  ['bytesfreed_319',['bytesFreed',['../struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28',1,'VmaDefragmentationStats']]],
-  ['bytesmoved_320',['bytesMoved',['../struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d',1,'VmaDefragmentationStats']]]
+  ['blockbytes_319',['blockBytes',['../struct_vma_budget.html#a58b492901baab685f466199124e514a0',1,'VmaBudget']]],
+  ['blockcount_320',['blockCount',['../struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4',1,'VmaStatInfo::blockCount()'],['../struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7',1,'VmaPoolStats::blockCount()']]],
+  ['blocksize_321',['blockSize',['../struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676',1,'VmaPoolCreateInfo']]],
+  ['budget_322',['budget',['../struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd',1,'VmaBudget']]],
+  ['bytesfreed_323',['bytesFreed',['../struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28',1,'VmaDefragmentationStats']]],
+  ['bytesmoved_324',['bytesMoved',['../struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d',1,'VmaDefragmentationStats']]]
 ];
diff --git a/docs/html/search/variables_2.js b/docs/html/search/variables_2.js
index f5e708e..3754879 100644
--- a/docs/html/search/variables_2.js
+++ b/docs/html/search/variables_2.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['commandbuffer_321',['commandBuffer',['../struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd',1,'VmaDefragmentationInfo2']]]
+  ['commandbuffer_325',['commandBuffer',['../struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd',1,'VmaDefragmentationInfo2']]]
 ];
diff --git a/docs/html/search/variables_3.js b/docs/html/search/variables_3.js
index 7733ef6..3335fa9 100644
--- a/docs/html/search/variables_3.js
+++ b/docs/html/search/variables_3.js
@@ -1,6 +1,6 @@
 var searchData=
 [
-  ['device_322',['device',['../struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500',1,'VmaAllocatorCreateInfo::device()'],['../struct_vma_allocator_info.html#a012b4c485bf3b0ea8921352c5ee0c357',1,'VmaAllocatorInfo::device()']]],
-  ['devicememory_323',['deviceMemory',['../struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67',1,'VmaAllocationInfo']]],
-  ['devicememoryblocksfreed_324',['deviceMemoryBlocksFreed',['../struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b',1,'VmaDefragmentationStats']]]
+  ['device_326',['device',['../struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500',1,'VmaAllocatorCreateInfo::device()'],['../struct_vma_allocator_info.html#a012b4c485bf3b0ea8921352c5ee0c357',1,'VmaAllocatorInfo::device()']]],
+  ['devicememory_327',['deviceMemory',['../struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67',1,'VmaAllocationInfo']]],
+  ['devicememoryblocksfreed_328',['deviceMemoryBlocksFreed',['../struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b',1,'VmaDefragmentationStats']]]
 ];
diff --git a/docs/html/search/variables_4.js b/docs/html/search/variables_4.js
index 1ed97e3..332a035 100644
--- a/docs/html/search/variables_4.js
+++ b/docs/html/search/variables_4.js
@@ -1,5 +1,5 @@
 var searchData=
 [
-  ['flags_325',['flags',['../struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a',1,'VmaRecordSettings::flags()'],['../struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346',1,'VmaAllocatorCreateInfo::flags()'],['../struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b',1,'VmaAllocationCreateInfo::flags()'],['../struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446',1,'VmaPoolCreateInfo::flags()'],['../struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9',1,'VmaDefragmentationInfo2::flags()']]],
-  ['frameinusecount_326',['frameInUseCount',['../struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7',1,'VmaAllocatorCreateInfo::frameInUseCount()'],['../struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa',1,'VmaPoolCreateInfo::frameInUseCount()']]]
+  ['flags_329',['flags',['../struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a',1,'VmaRecordSettings::flags()'],['../struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346',1,'VmaAllocatorCreateInfo::flags()'],['../struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b',1,'VmaAllocationCreateInfo::flags()'],['../struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446',1,'VmaPoolCreateInfo::flags()'],['../struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9',1,'VmaDefragmentationInfo2::flags()']]],
+  ['frameinusecount_330',['frameInUseCount',['../struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7',1,'VmaAllocatorCreateInfo::frameInUseCount()'],['../struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa',1,'VmaPoolCreateInfo::frameInUseCount()']]]
 ];
diff --git a/docs/html/search/variables_5.js b/docs/html/search/variables_5.js
index cf75a0d..7327328 100644
--- a/docs/html/search/variables_5.js
+++ b/docs/html/search/variables_5.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['instance_327',['instance',['../struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b',1,'VmaAllocatorCreateInfo::instance()'],['../struct_vma_allocator_info.html#a2ed6a4d2d3fea039d66a13f15d0ce5fe',1,'VmaAllocatorInfo::instance()']]]
+  ['instance_331',['instance',['../struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b',1,'VmaAllocatorCreateInfo::instance()'],['../struct_vma_allocator_info.html#a2ed6a4d2d3fea039d66a13f15d0ce5fe',1,'VmaAllocatorInfo::instance()']]]
 ];
diff --git a/docs/html/search/variables_6.js b/docs/html/search/variables_6.js
index 26fc61c..6f721c4 100644
--- a/docs/html/search/variables_6.js
+++ b/docs/html/search/variables_6.js
@@ -1,17 +1,17 @@
 var searchData=
 [
-  ['maxallocationstomove_328',['maxAllocationsToMove',['../struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc',1,'VmaDefragmentationInfo']]],
-  ['maxblockcount_329',['maxBlockCount',['../struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c',1,'VmaPoolCreateInfo']]],
-  ['maxbytestomove_330',['maxBytesToMove',['../struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d',1,'VmaDefragmentationInfo']]],
-  ['maxcpuallocationstomove_331',['maxCpuAllocationsToMove',['../struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671',1,'VmaDefragmentationInfo2']]],
-  ['maxcpubytestomove_332',['maxCpuBytesToMove',['../struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a',1,'VmaDefragmentationInfo2']]],
-  ['maxgpuallocationstomove_333',['maxGpuAllocationsToMove',['../struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6',1,'VmaDefragmentationInfo2']]],
-  ['maxgpubytestomove_334',['maxGpuBytesToMove',['../struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08',1,'VmaDefragmentationInfo2']]],
-  ['memory_335',['memory',['../struct_vma_defragmentation_pass_move_info.html#a06eb0c8690aa0d3478a036753492e769',1,'VmaDefragmentationPassMoveInfo']]],
-  ['memoryheap_336',['memoryHeap',['../struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0',1,'VmaStats']]],
-  ['memorytype_337',['memoryType',['../struct_vma_stats.html#a13e3caf754be79352c42408756309331',1,'VmaStats::memoryType()'],['../struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5',1,'VmaAllocationInfo::memoryType()']]],
-  ['memorytypebits_338',['memoryTypeBits',['../struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055',1,'VmaAllocationCreateInfo']]],
-  ['memorytypeindex_339',['memoryTypeIndex',['../struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319',1,'VmaPoolCreateInfo']]],
-  ['minblockcount_340',['minBlockCount',['../struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae',1,'VmaPoolCreateInfo']]],
-  ['movecount_341',['moveCount',['../struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c',1,'VmaDefragmentationPassInfo']]]
+  ['maxallocationstomove_332',['maxAllocationsToMove',['../struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc',1,'VmaDefragmentationInfo']]],
+  ['maxblockcount_333',['maxBlockCount',['../struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c',1,'VmaPoolCreateInfo']]],
+  ['maxbytestomove_334',['maxBytesToMove',['../struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d',1,'VmaDefragmentationInfo']]],
+  ['maxcpuallocationstomove_335',['maxCpuAllocationsToMove',['../struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671',1,'VmaDefragmentationInfo2']]],
+  ['maxcpubytestomove_336',['maxCpuBytesToMove',['../struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a',1,'VmaDefragmentationInfo2']]],
+  ['maxgpuallocationstomove_337',['maxGpuAllocationsToMove',['../struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6',1,'VmaDefragmentationInfo2']]],
+  ['maxgpubytestomove_338',['maxGpuBytesToMove',['../struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08',1,'VmaDefragmentationInfo2']]],
+  ['memory_339',['memory',['../struct_vma_defragmentation_pass_move_info.html#a06eb0c8690aa0d3478a036753492e769',1,'VmaDefragmentationPassMoveInfo']]],
+  ['memoryheap_340',['memoryHeap',['../struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0',1,'VmaStats']]],
+  ['memorytype_341',['memoryType',['../struct_vma_stats.html#a13e3caf754be79352c42408756309331',1,'VmaStats::memoryType()'],['../struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5',1,'VmaAllocationInfo::memoryType()']]],
+  ['memorytypebits_342',['memoryTypeBits',['../struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055',1,'VmaAllocationCreateInfo']]],
+  ['memorytypeindex_343',['memoryTypeIndex',['../struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319',1,'VmaPoolCreateInfo']]],
+  ['minblockcount_344',['minBlockCount',['../struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae',1,'VmaPoolCreateInfo']]],
+  ['movecount_345',['moveCount',['../struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c',1,'VmaDefragmentationPassInfo']]]
 ];
diff --git a/docs/html/search/variables_7.js b/docs/html/search/variables_7.js
index 2ae2b85..13aadd0 100644
--- a/docs/html/search/variables_7.js
+++ b/docs/html/search/variables_7.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['offset_342',['offset',['../struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268',1,'VmaAllocationInfo::offset()'],['../struct_vma_defragmentation_pass_move_info.html#a8ab4508bc03625b0653c880576be96c6',1,'VmaDefragmentationPassMoveInfo::offset()']]]
+  ['offset_346',['offset',['../struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268',1,'VmaAllocationInfo::offset()'],['../struct_vma_defragmentation_pass_move_info.html#a8ab4508bc03625b0653c880576be96c6',1,'VmaDefragmentationPassMoveInfo::offset()']]]
 ];
diff --git a/docs/html/search/variables_8.js b/docs/html/search/variables_8.js
index b22c7f9..408b163 100644
--- a/docs/html/search/variables_8.js
+++ b/docs/html/search/variables_8.js
@@ -1,22 +1,22 @@
 var searchData=
 [
-  ['pallocationcallbacks_343',['pAllocationCallbacks',['../struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d',1,'VmaAllocatorCreateInfo']]],
-  ['pallocations_344',['pAllocations',['../struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32',1,'VmaDefragmentationInfo2']]],
-  ['pallocationschanged_345',['pAllocationsChanged',['../struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc',1,'VmaDefragmentationInfo2']]],
-  ['pdevicememorycallbacks_346',['pDeviceMemoryCallbacks',['../struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e',1,'VmaAllocatorCreateInfo']]],
-  ['pfilepath_347',['pFilePath',['../struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d',1,'VmaRecordSettings']]],
-  ['pfnallocate_348',['pfnAllocate',['../struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb',1,'VmaDeviceMemoryCallbacks']]],
-  ['pfnfree_349',['pfnFree',['../struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c',1,'VmaDeviceMemoryCallbacks']]],
-  ['pheapsizelimit_350',['pHeapSizeLimit',['../struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b',1,'VmaAllocatorCreateInfo']]],
-  ['physicaldevice_351',['physicalDevice',['../struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156',1,'VmaAllocatorCreateInfo::physicalDevice()'],['../struct_vma_allocator_info.html#aba2b703f96e51d567717e1fb2935b47a',1,'VmaAllocatorInfo::physicalDevice()']]],
-  ['pmappeddata_352',['pMappedData',['../struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2',1,'VmaAllocationInfo']]],
-  ['pmoves_353',['pMoves',['../struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792',1,'VmaDefragmentationPassInfo']]],
-  ['pool_354',['pool',['../struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150',1,'VmaAllocationCreateInfo']]],
-  ['poolcount_355',['poolCount',['../struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d',1,'VmaDefragmentationInfo2']]],
-  ['ppools_356',['pPools',['../struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b',1,'VmaDefragmentationInfo2']]],
-  ['precordsettings_357',['pRecordSettings',['../struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee',1,'VmaAllocatorCreateInfo']]],
-  ['preferredflags_358',['preferredFlags',['../struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d',1,'VmaAllocationCreateInfo']]],
-  ['preferredlargeheapblocksize_359',['preferredLargeHeapBlockSize',['../struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a',1,'VmaAllocatorCreateInfo']]],
-  ['puserdata_360',['pUserData',['../struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6',1,'VmaDeviceMemoryCallbacks::pUserData()'],['../struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19',1,'VmaAllocationCreateInfo::pUserData()'],['../struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13',1,'VmaAllocationInfo::pUserData()']]],
-  ['pvulkanfunctions_361',['pVulkanFunctions',['../struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd',1,'VmaAllocatorCreateInfo']]]
+  ['pallocationcallbacks_347',['pAllocationCallbacks',['../struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d',1,'VmaAllocatorCreateInfo']]],
+  ['pallocations_348',['pAllocations',['../struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32',1,'VmaDefragmentationInfo2']]],
+  ['pallocationschanged_349',['pAllocationsChanged',['../struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc',1,'VmaDefragmentationInfo2']]],
+  ['pdevicememorycallbacks_350',['pDeviceMemoryCallbacks',['../struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e',1,'VmaAllocatorCreateInfo']]],
+  ['pfilepath_351',['pFilePath',['../struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d',1,'VmaRecordSettings']]],
+  ['pfnallocate_352',['pfnAllocate',['../struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb',1,'VmaDeviceMemoryCallbacks']]],
+  ['pfnfree_353',['pfnFree',['../struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c',1,'VmaDeviceMemoryCallbacks']]],
+  ['pheapsizelimit_354',['pHeapSizeLimit',['../struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b',1,'VmaAllocatorCreateInfo']]],
+  ['physicaldevice_355',['physicalDevice',['../struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156',1,'VmaAllocatorCreateInfo::physicalDevice()'],['../struct_vma_allocator_info.html#aba2b703f96e51d567717e1fb2935b47a',1,'VmaAllocatorInfo::physicalDevice()']]],
+  ['pmappeddata_356',['pMappedData',['../struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2',1,'VmaAllocationInfo']]],
+  ['pmoves_357',['pMoves',['../struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792',1,'VmaDefragmentationPassInfo']]],
+  ['pool_358',['pool',['../struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150',1,'VmaAllocationCreateInfo']]],
+  ['poolcount_359',['poolCount',['../struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d',1,'VmaDefragmentationInfo2']]],
+  ['ppools_360',['pPools',['../struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b',1,'VmaDefragmentationInfo2']]],
+  ['precordsettings_361',['pRecordSettings',['../struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee',1,'VmaAllocatorCreateInfo']]],
+  ['preferredflags_362',['preferredFlags',['../struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d',1,'VmaAllocationCreateInfo']]],
+  ['preferredlargeheapblocksize_363',['preferredLargeHeapBlockSize',['../struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a',1,'VmaAllocatorCreateInfo']]],
+  ['puserdata_364',['pUserData',['../struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6',1,'VmaDeviceMemoryCallbacks::pUserData()'],['../struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19',1,'VmaAllocationCreateInfo::pUserData()'],['../struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13',1,'VmaAllocationInfo::pUserData()']]],
+  ['pvulkanfunctions_365',['pVulkanFunctions',['../struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd',1,'VmaAllocatorCreateInfo']]]
 ];
diff --git a/docs/html/search/variables_9.js b/docs/html/search/variables_9.js
index e380bb5..464801a 100644
--- a/docs/html/search/variables_9.js
+++ b/docs/html/search/variables_9.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['requiredflags_362',['requiredFlags',['../struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90',1,'VmaAllocationCreateInfo']]]
+  ['requiredflags_366',['requiredFlags',['../struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90',1,'VmaAllocationCreateInfo']]]
 ];
diff --git a/docs/html/search/variables_a.js b/docs/html/search/variables_a.js
index 224ea91..096c052 100644
--- a/docs/html/search/variables_a.js
+++ b/docs/html/search/variables_a.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['size_363',['size',['../struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c',1,'VmaPoolStats::size()'],['../struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f',1,'VmaAllocationInfo::size()']]]
+  ['size_367',['size',['../struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c',1,'VmaPoolStats::size()'],['../struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f',1,'VmaAllocationInfo::size()']]]
 ];
diff --git a/docs/html/search/variables_b.js b/docs/html/search/variables_b.js
index 449ff4e..8ba1d7d 100644
--- a/docs/html/search/variables_b.js
+++ b/docs/html/search/variables_b.js
@@ -1,4 +1,4 @@
 var searchData=
 [
-  ['total_364',['total',['../struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9',1,'VmaStats']]]
+  ['total_368',['total',['../struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9',1,'VmaStats']]]
 ];
diff --git a/docs/html/search/variables_c.js b/docs/html/search/variables_c.js
index 5d102ba..a6b01a4 100644
--- a/docs/html/search/variables_c.js
+++ b/docs/html/search/variables_c.js
@@ -1,11 +1,11 @@
 var searchData=
 [
-  ['unusedbytes_365',['unusedBytes',['../struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669',1,'VmaStatInfo']]],
-  ['unusedrangecount_366',['unusedRangeCount',['../struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9',1,'VmaStatInfo::unusedRangeCount()'],['../struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4',1,'VmaPoolStats::unusedRangeCount()']]],
-  ['unusedrangesizeavg_367',['unusedRangeSizeAvg',['../struct_vma_stat_info.html#a2f9b3452af90c9768a30b7fb6ae194fc',1,'VmaStatInfo']]],
-  ['unusedrangesizemax_368',['unusedRangeSizeMax',['../struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4',1,'VmaStatInfo::unusedRangeSizeMax()'],['../struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b',1,'VmaPoolStats::unusedRangeSizeMax()']]],
-  ['unusedrangesizemin_369',['unusedRangeSizeMin',['../struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4',1,'VmaStatInfo']]],
-  ['unusedsize_370',['unusedSize',['../struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8',1,'VmaPoolStats']]],
-  ['usage_371',['usage',['../struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6',1,'VmaBudget::usage()'],['../struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910',1,'VmaAllocationCreateInfo::usage()']]],
-  ['usedbytes_372',['usedBytes',['../struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a',1,'VmaStatInfo']]]
+  ['unusedbytes_369',['unusedBytes',['../struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669',1,'VmaStatInfo']]],
+  ['unusedrangecount_370',['unusedRangeCount',['../struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9',1,'VmaStatInfo::unusedRangeCount()'],['../struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4',1,'VmaPoolStats::unusedRangeCount()']]],
+  ['unusedrangesizeavg_371',['unusedRangeSizeAvg',['../struct_vma_stat_info.html#a2f9b3452af90c9768a30b7fb6ae194fc',1,'VmaStatInfo']]],
+  ['unusedrangesizemax_372',['unusedRangeSizeMax',['../struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4',1,'VmaStatInfo::unusedRangeSizeMax()'],['../struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b',1,'VmaPoolStats::unusedRangeSizeMax()']]],
+  ['unusedrangesizemin_373',['unusedRangeSizeMin',['../struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4',1,'VmaStatInfo']]],
+  ['unusedsize_374',['unusedSize',['../struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8',1,'VmaPoolStats']]],
+  ['usage_375',['usage',['../struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6',1,'VmaBudget::usage()'],['../struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910',1,'VmaAllocationCreateInfo::usage()']]],
+  ['usedbytes_376',['usedBytes',['../struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a',1,'VmaStatInfo']]]
 ];
diff --git a/docs/html/search/variables_d.js b/docs/html/search/variables_d.js
index 3ac2f37..108e48a 100644
--- a/docs/html/search/variables_d.js
+++ b/docs/html/search/variables_d.js
@@ -1,21 +1,21 @@
 var searchData=
 [
-  ['vkallocatememory_373',['vkAllocateMemory',['../struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c',1,'VmaVulkanFunctions']]],
-  ['vkbindbuffermemory_374',['vkBindBufferMemory',['../struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2',1,'VmaVulkanFunctions']]],
-  ['vkbindimagememory_375',['vkBindImageMemory',['../struct_vma_vulkan_functions.html#a1338d96a128a5ade648b8d934907c637',1,'VmaVulkanFunctions']]],
-  ['vkcmdcopybuffer_376',['vkCmdCopyBuffer',['../struct_vma_vulkan_functions.html#ae5c0db8c89a3b82593dc16aa6a49fa3a',1,'VmaVulkanFunctions']]],
-  ['vkcreatebuffer_377',['vkCreateBuffer',['../struct_vma_vulkan_functions.html#ae8084315a25006271a2edfc3a447519f',1,'VmaVulkanFunctions']]],
-  ['vkcreateimage_378',['vkCreateImage',['../struct_vma_vulkan_functions.html#a23ebe70be515b9b5010a1d691200e325',1,'VmaVulkanFunctions']]],
-  ['vkdestroybuffer_379',['vkDestroyBuffer',['../struct_vma_vulkan_functions.html#a7e054606faddb07f0e8556f3ed317d45',1,'VmaVulkanFunctions']]],
-  ['vkdestroyimage_380',['vkDestroyImage',['../struct_vma_vulkan_functions.html#a90b898227039b1dcb3520f6e91f09ffa',1,'VmaVulkanFunctions']]],
-  ['vkflushmappedmemoryranges_381',['vkFlushMappedMemoryRanges',['../struct_vma_vulkan_functions.html#a33c322f4c4ad2810f8a9c97a277572f9',1,'VmaVulkanFunctions']]],
-  ['vkfreememory_382',['vkFreeMemory',['../struct_vma_vulkan_functions.html#a4c658701778564d62034255b5dda91b4',1,'VmaVulkanFunctions']]],
-  ['vkgetbuffermemoryrequirements_383',['vkGetBufferMemoryRequirements',['../struct_vma_vulkan_functions.html#a5b92901df89a4194b0d12f6071d4d143',1,'VmaVulkanFunctions']]],
-  ['vkgetimagememoryrequirements_384',['vkGetImageMemoryRequirements',['../struct_vma_vulkan_functions.html#a475f6f49f8debe4d10800592606d53f4',1,'VmaVulkanFunctions']]],
-  ['vkgetphysicaldevicememoryproperties_385',['vkGetPhysicalDeviceMemoryProperties',['../struct_vma_vulkan_functions.html#a60d25c33bba06bb8592e6875cbaa9830',1,'VmaVulkanFunctions']]],
-  ['vkgetphysicaldeviceproperties_386',['vkGetPhysicalDeviceProperties',['../struct_vma_vulkan_functions.html#a77b7a74082823e865dd6546623468f96',1,'VmaVulkanFunctions']]],
-  ['vkinvalidatemappedmemoryranges_387',['vkInvalidateMappedMemoryRanges',['../struct_vma_vulkan_functions.html#a5c1093bc32386a8060c37c9f282078a1',1,'VmaVulkanFunctions']]],
-  ['vkmapmemory_388',['vkMapMemory',['../struct_vma_vulkan_functions.html#ab5c1f38dea3a2cf00dc9eb4f57218c49',1,'VmaVulkanFunctions']]],
-  ['vkunmapmemory_389',['vkUnmapMemory',['../struct_vma_vulkan_functions.html#acc798589736f0becb317fc2196c1d8b9',1,'VmaVulkanFunctions']]],
-  ['vulkanapiversion_390',['vulkanApiVersion',['../struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285',1,'VmaAllocatorCreateInfo']]]
+  ['vkallocatememory_377',['vkAllocateMemory',['../struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c',1,'VmaVulkanFunctions']]],
+  ['vkbindbuffermemory_378',['vkBindBufferMemory',['../struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2',1,'VmaVulkanFunctions']]],
+  ['vkbindimagememory_379',['vkBindImageMemory',['../struct_vma_vulkan_functions.html#a1338d96a128a5ade648b8d934907c637',1,'VmaVulkanFunctions']]],
+  ['vkcmdcopybuffer_380',['vkCmdCopyBuffer',['../struct_vma_vulkan_functions.html#ae5c0db8c89a3b82593dc16aa6a49fa3a',1,'VmaVulkanFunctions']]],
+  ['vkcreatebuffer_381',['vkCreateBuffer',['../struct_vma_vulkan_functions.html#ae8084315a25006271a2edfc3a447519f',1,'VmaVulkanFunctions']]],
+  ['vkcreateimage_382',['vkCreateImage',['../struct_vma_vulkan_functions.html#a23ebe70be515b9b5010a1d691200e325',1,'VmaVulkanFunctions']]],
+  ['vkdestroybuffer_383',['vkDestroyBuffer',['../struct_vma_vulkan_functions.html#a7e054606faddb07f0e8556f3ed317d45',1,'VmaVulkanFunctions']]],
+  ['vkdestroyimage_384',['vkDestroyImage',['../struct_vma_vulkan_functions.html#a90b898227039b1dcb3520f6e91f09ffa',1,'VmaVulkanFunctions']]],
+  ['vkflushmappedmemoryranges_385',['vkFlushMappedMemoryRanges',['../struct_vma_vulkan_functions.html#a33c322f4c4ad2810f8a9c97a277572f9',1,'VmaVulkanFunctions']]],
+  ['vkfreememory_386',['vkFreeMemory',['../struct_vma_vulkan_functions.html#a4c658701778564d62034255b5dda91b4',1,'VmaVulkanFunctions']]],
+  ['vkgetbuffermemoryrequirements_387',['vkGetBufferMemoryRequirements',['../struct_vma_vulkan_functions.html#a5b92901df89a4194b0d12f6071d4d143',1,'VmaVulkanFunctions']]],
+  ['vkgetimagememoryrequirements_388',['vkGetImageMemoryRequirements',['../struct_vma_vulkan_functions.html#a475f6f49f8debe4d10800592606d53f4',1,'VmaVulkanFunctions']]],
+  ['vkgetphysicaldevicememoryproperties_389',['vkGetPhysicalDeviceMemoryProperties',['../struct_vma_vulkan_functions.html#a60d25c33bba06bb8592e6875cbaa9830',1,'VmaVulkanFunctions']]],
+  ['vkgetphysicaldeviceproperties_390',['vkGetPhysicalDeviceProperties',['../struct_vma_vulkan_functions.html#a77b7a74082823e865dd6546623468f96',1,'VmaVulkanFunctions']]],
+  ['vkinvalidatemappedmemoryranges_391',['vkInvalidateMappedMemoryRanges',['../struct_vma_vulkan_functions.html#a5c1093bc32386a8060c37c9f282078a1',1,'VmaVulkanFunctions']]],
+  ['vkmapmemory_392',['vkMapMemory',['../struct_vma_vulkan_functions.html#ab5c1f38dea3a2cf00dc9eb4f57218c49',1,'VmaVulkanFunctions']]],
+  ['vkunmapmemory_393',['vkUnmapMemory',['../struct_vma_vulkan_functions.html#acc798589736f0becb317fc2196c1d8b9',1,'VmaVulkanFunctions']]],
+  ['vulkanapiversion_394',['vulkanApiVersion',['../struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285',1,'VmaAllocatorCreateInfo']]]
 ];
diff --git a/docs/html/vk__mem__alloc_8h.html b/docs/html/vk__mem__alloc_8h.html
index dd21e9e..f0fa5d4 100644
--- a/docs/html/vk__mem__alloc_8h.html
+++ b/docs/html/vk__mem__alloc_8h.html
@@ -407,12 +407,18 @@
 <tr class="memitem:a9bc268595cb33f6ec4d519cfce81ff45"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45">vmaUnmapMemory</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</td></tr>
 <tr class="memdesc:a9bc268595cb33f6ec4d519cfce81ff45"><td class="mdescLeft">&#160;</td><td class="mdescRight">Unmaps memory represented by given allocation, mapped previously using <a class="el" href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069" title="Maps memory represented by given allocation and returns pointer to it.">vmaMapMemory()</a>.  <a href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45">More...</a><br /></td></tr>
 <tr class="separator:a9bc268595cb33f6ec4d519cfce81ff45"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:abc34ee6f021f459aff885f3758c435de"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de">vmaFlushAllocation</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</td></tr>
-<tr class="memdesc:abc34ee6f021f459aff885f3758c435de"><td class="mdescLeft">&#160;</td><td class="mdescRight">Flushes memory of given allocation.  <a href="vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de">More...</a><br /></td></tr>
-<tr class="separator:abc34ee6f021f459aff885f3758c435de"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:a0d0eb0c1102268fa9a476d12ecbe4006"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006">vmaInvalidateAllocation</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</td></tr>
-<tr class="memdesc:a0d0eb0c1102268fa9a476d12ecbe4006"><td class="mdescLeft">&#160;</td><td class="mdescRight">Invalidates memory of given allocation.  <a href="vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006">More...</a><br /></td></tr>
-<tr class="separator:a0d0eb0c1102268fa9a476d12ecbe4006"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a30c37c1eec6025f397be41644f48490f"><td class="memItemLeft" align="right" valign="top">VkResult&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f">vmaFlushAllocation</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</td></tr>
+<tr class="memdesc:a30c37c1eec6025f397be41644f48490f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Flushes memory of given allocation.  <a href="vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f">More...</a><br /></td></tr>
+<tr class="separator:a30c37c1eec6025f397be41644f48490f"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:aaa8412919139ef413a4215ac6a290fae"><td class="memItemLeft" align="right" valign="top">VkResult&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae">vmaInvalidateAllocation</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</td></tr>
+<tr class="memdesc:aaa8412919139ef413a4215ac6a290fae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Invalidates memory of given allocation.  <a href="vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae">More...</a><br /></td></tr>
+<tr class="separator:aaa8412919139ef413a4215ac6a290fae"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ac3dd00da721875ed99fa8a881922bdfc"><td class="memItemLeft" align="right" valign="top">VkResult&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#ac3dd00da721875ed99fa8a881922bdfc">vmaFlushAllocations</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, uint32_t allocationCount, const <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> *allocations, const VkDeviceSize *offsets, const VkDeviceSize *sizes)</td></tr>
+<tr class="memdesc:ac3dd00da721875ed99fa8a881922bdfc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Flushes memory of given set of allocations.  <a href="vk__mem__alloc_8h.html#ac3dd00da721875ed99fa8a881922bdfc">More...</a><br /></td></tr>
+<tr class="separator:ac3dd00da721875ed99fa8a881922bdfc"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ab25b558d75f7378ec944a1522fdcc3c5"><td class="memItemLeft" align="right" valign="top">VkResult&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5">vmaInvalidateAllocations</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, uint32_t allocationCount, const <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> *allocations, const VkDeviceSize *offsets, const VkDeviceSize *sizes)</td></tr>
+<tr class="memdesc:ab25b558d75f7378ec944a1522fdcc3c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Invalidates memory of given set of allocations.  <a href="vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5">More...</a><br /></td></tr>
+<tr class="separator:ab25b558d75f7378ec944a1522fdcc3c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
 <tr class="memitem:a49329a7f030dafcf82f7b73334c22e98"><td class="memItemLeft" align="right" valign="top">VkResult&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98">vmaCheckCorruption</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, uint32_t memoryTypeBits)</td></tr>
 <tr class="memdesc:a49329a7f030dafcf82f7b73334c22e98"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks magic number in margins around all allocations in given memory types (in both default and custom pools) in search for corruptions.  <a href="vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98">More...</a><br /></td></tr>
 <tr class="separator:a49329a7f030dafcf82f7b73334c22e98"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -2604,14 +2610,14 @@
 
 </div>
 </div>
-<a id="abc34ee6f021f459aff885f3758c435de"></a>
-<h2 class="memtitle"><span class="permalink"><a href="#abc34ee6f021f459aff885f3758c435de">&#9670;&nbsp;</a></span>vmaFlushAllocation()</h2>
+<a id="a30c37c1eec6025f397be41644f48490f"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a30c37c1eec6025f397be41644f48490f">&#9670;&nbsp;</a></span>vmaFlushAllocation()</h2>
 
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">void vmaFlushAllocation </td>
+          <td class="memname">VkResult vmaFlushAllocation </td>
           <td>(</td>
           <td class="paramtype"><a class="el" href="struct_vma_allocator.html">VmaAllocator</a>&#160;</td>
           <td class="paramname"><em>allocator</em>, </td>
@@ -2651,7 +2657,68 @@
 <li>If <code>size</code> is 0, this call is ignored.</li>
 <li>If memory type that the <code>allocation</code> belongs to is not <code>HOST_VISIBLE</code> or it is <code>HOST_COHERENT</code>, this call is ignored.</li>
 </ul>
-<p>Warning! <code>offset</code> and <code>size</code> are relative to the contents of given <code>allocation</code>. If you mean whole allocation, you can pass 0 and <code>VK_WHOLE_SIZE</code>, respectively. Do not pass allocation's offset as <code>offset</code>!!! </p>
+<p>Warning! <code>offset</code> and <code>size</code> are relative to the contents of given <code>allocation</code>. If you mean whole allocation, you can pass 0 and <code>VK_WHOLE_SIZE</code>, respectively. Do not pass allocation's offset as <code>offset</code>!!!</p>
+<p>This function returns the <code>VkResult</code> from <code>vkFlushMappedMemoryRanges</code> if it is called, otherwise <code>VK_SUCCESS</code>. </p>
+
+</div>
+</div>
+<a id="ac3dd00da721875ed99fa8a881922bdfc"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#ac3dd00da721875ed99fa8a881922bdfc">&#9670;&nbsp;</a></span>vmaFlushAllocations()</h2>
+
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">VkResult vmaFlushAllocations </td>
+          <td>(</td>
+          <td class="paramtype"><a class="el" href="struct_vma_allocator.html">VmaAllocator</a>&#160;</td>
+          <td class="paramname"><em>allocator</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">uint32_t&#160;</td>
+          <td class="paramname"><em>allocationCount</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> *&#160;</td>
+          <td class="paramname"><em>allocations</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const VkDeviceSize *&#160;</td>
+          <td class="paramname"><em>offsets</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const VkDeviceSize *&#160;</td>
+          <td class="paramname"><em>sizes</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Flushes memory of given set of allocations. </p>
+<p>Calls <code>vkFlushMappedMemoryRanges()</code> for memory associated with given ranges of given allocations. For more information, see documentation of <a class="el" href="vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f" title="Flushes memory of given allocation.">vmaFlushAllocation()</a>.</p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">allocator</td><td></td></tr>
+    <tr><td class="paramname">allocationCount</td><td></td></tr>
+    <tr><td class="paramname">allocations</td><td></td></tr>
+    <tr><td class="paramname">offsets</td><td>If not null, it must point to an array of offsets of regions to flush, relative to the beginning of respective allocations. Null means all ofsets are zero. </td></tr>
+    <tr><td class="paramname">sizes</td><td>If not null, it must point to an array of sizes of regions to flush in respective allocations. Null means <code>VK_WHOLE_SIZE</code> for all allocations.</td></tr>
+  </table>
+  </dd>
+</dl>
+<p>This function returns the <code>VkResult</code> from <code>vkFlushMappedMemoryRanges</code> if it is called, otherwise <code>VK_SUCCESS</code>. </p>
 
 </div>
 </div>
@@ -3040,14 +3107,14 @@
 
 </div>
 </div>
-<a id="a0d0eb0c1102268fa9a476d12ecbe4006"></a>
-<h2 class="memtitle"><span class="permalink"><a href="#a0d0eb0c1102268fa9a476d12ecbe4006">&#9670;&nbsp;</a></span>vmaInvalidateAllocation()</h2>
+<a id="aaa8412919139ef413a4215ac6a290fae"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#aaa8412919139ef413a4215ac6a290fae">&#9670;&nbsp;</a></span>vmaInvalidateAllocation()</h2>
 
 <div class="memitem">
 <div class="memproto">
       <table class="memname">
         <tr>
-          <td class="memname">void vmaInvalidateAllocation </td>
+          <td class="memname">VkResult vmaInvalidateAllocation </td>
           <td>(</td>
           <td class="paramtype"><a class="el" href="struct_vma_allocator.html">VmaAllocator</a>&#160;</td>
           <td class="paramname"><em>allocator</em>, </td>
@@ -3087,7 +3154,68 @@
 <li>If <code>size</code> is 0, this call is ignored.</li>
 <li>If memory type that the <code>allocation</code> belongs to is not <code>HOST_VISIBLE</code> or it is <code>HOST_COHERENT</code>, this call is ignored.</li>
 </ul>
-<p>Warning! <code>offset</code> and <code>size</code> are relative to the contents of given <code>allocation</code>. If you mean whole allocation, you can pass 0 and <code>VK_WHOLE_SIZE</code>, respectively. Do not pass allocation's offset as <code>offset</code>!!! </p>
+<p>Warning! <code>offset</code> and <code>size</code> are relative to the contents of given <code>allocation</code>. If you mean whole allocation, you can pass 0 and <code>VK_WHOLE_SIZE</code>, respectively. Do not pass allocation's offset as <code>offset</code>!!!</p>
+<p>This function returns the <code>VkResult</code> from <code>vkInvalidateMappedMemoryRanges</code> if it is called, otherwise <code>VK_SUCCESS</code>. </p>
+
+</div>
+</div>
+<a id="ab25b558d75f7378ec944a1522fdcc3c5"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#ab25b558d75f7378ec944a1522fdcc3c5">&#9670;&nbsp;</a></span>vmaInvalidateAllocations()</h2>
+
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">VkResult vmaInvalidateAllocations </td>
+          <td>(</td>
+          <td class="paramtype"><a class="el" href="struct_vma_allocator.html">VmaAllocator</a>&#160;</td>
+          <td class="paramname"><em>allocator</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">uint32_t&#160;</td>
+          <td class="paramname"><em>allocationCount</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> *&#160;</td>
+          <td class="paramname"><em>allocations</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const VkDeviceSize *&#160;</td>
+          <td class="paramname"><em>offsets</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const VkDeviceSize *&#160;</td>
+          <td class="paramname"><em>sizes</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Invalidates memory of given set of allocations. </p>
+<p>Calls <code>vkInvalidateMappedMemoryRanges()</code> for memory associated with given ranges of given allocations. For more information, see documentation of <a class="el" href="vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae" title="Invalidates memory of given allocation.">vmaInvalidateAllocation()</a>.</p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">allocator</td><td></td></tr>
+    <tr><td class="paramname">allocationCount</td><td></td></tr>
+    <tr><td class="paramname">allocations</td><td></td></tr>
+    <tr><td class="paramname">offsets</td><td>If not null, it must point to an array of offsets of regions to flush, relative to the beginning of respective allocations. Null means all ofsets are zero. </td></tr>
+    <tr><td class="paramname">sizes</td><td>If not null, it must point to an array of sizes of regions to flush in respective allocations. Null means <code>VK_WHOLE_SIZE</code> for all allocations.</td></tr>
+  </table>
+  </dd>
+</dl>
+<p>This function returns the <code>VkResult</code> from <code>vkInvalidateMappedMemoryRanges</code> if it is called, otherwise <code>VK_SUCCESS</code>. </p>
 
 </div>
 </div>
@@ -3175,7 +3303,7 @@
 <p>It is also safe to call this function on allocation created with <a class="el" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f" title="Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.">VMA_ALLOCATION_CREATE_MAPPED_BIT</a> flag. Its memory stays mapped all the time. You must still call <a class="el" href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45" title="Unmaps memory represented by given allocation, mapped previously using vmaMapMemory().">vmaUnmapMemory()</a> same number of times as you called <a class="el" href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069" title="Maps memory represented by given allocation and returns pointer to it.">vmaMapMemory()</a>. You must not call <a class="el" href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45" title="Unmaps memory represented by given allocation, mapped previously using vmaMapMemory().">vmaUnmapMemory()</a> additional time to free the "0-th" mapping made automatically due to <a class="el" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f" title="Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.">VMA_ALLOCATION_CREATE_MAPPED_BIT</a> flag.</p>
 <p>This function fails when used on allocation made in memory type that is not <code>HOST_VISIBLE</code>.</p>
 <p>This function always fails when called for allocation that was created with <a class="el" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a> flag. Such allocations cannot be mapped.</p>
-<p>This function doesn't automatically flush or invalidate caches. If the allocation is made from a memory types that is not <code>HOST_COHERENT</code>, you also need to use <a class="el" href="vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006" title="Invalidates memory of given allocation.">vmaInvalidateAllocation()</a> / <a class="el" href="vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de" title="Flushes memory of given allocation.">vmaFlushAllocation()</a>, as required by Vulkan specification. </p>
+<p>This function doesn't automatically flush or invalidate caches. If the allocation is made from a memory types that is not <code>HOST_COHERENT</code>, you also need to use <a class="el" href="vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae" title="Invalidates memory of given allocation.">vmaInvalidateAllocation()</a> / <a class="el" href="vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f" title="Flushes memory of given allocation.">vmaFlushAllocation()</a>, as required by Vulkan specification. </p>
 
 </div>
 </div>
@@ -3383,7 +3511,7 @@
 
 <p>Unmaps memory represented by given allocation, mapped previously using <a class="el" href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069" title="Maps memory represented by given allocation and returns pointer to it.">vmaMapMemory()</a>. </p>
 <p>For details, see description of <a class="el" href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069" title="Maps memory represented by given allocation and returns pointer to it.">vmaMapMemory()</a>.</p>
-<p>This function doesn't automatically flush or invalidate caches. If the allocation is made from a memory types that is not <code>HOST_COHERENT</code>, you also need to use <a class="el" href="vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006" title="Invalidates memory of given allocation.">vmaInvalidateAllocation()</a> / <a class="el" href="vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de" title="Flushes memory of given allocation.">vmaFlushAllocation()</a>, as required by Vulkan specification. </p>
+<p>This function doesn't automatically flush or invalidate caches. If the allocation is made from a memory types that is not <code>HOST_COHERENT</code>, you also need to use <a class="el" href="vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae" title="Invalidates memory of given allocation.">vmaInvalidateAllocation()</a> / <a class="el" href="vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f" title="Flushes memory of given allocation.">vmaFlushAllocation()</a>, as required by Vulkan specification. </p>
 
 </div>
 </div>
diff --git a/docs/html/vk__mem__alloc_8h_source.html b/docs/html/vk__mem__alloc_8h_source.html
index 9427464..8efe83d 100644
--- a/docs/html/vk__mem__alloc_8h_source.html
+++ b/docs/html/vk__mem__alloc_8h_source.html
@@ -94,15787 +94,16103 @@
 <div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div>
 <div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
-<div class="line"><a name="l01889"></a><span class="lineno"> 1889</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l01890"></a><span class="lineno"> 1890</span>&#160;<span class="comment">Define this macro to 0/1 to disable/enable support for recording functionality,</span></div>
-<div class="line"><a name="l01891"></a><span class="lineno"> 1891</span>&#160;<span class="comment">available through VmaAllocatorCreateInfo::pRecordSettings.</span></div>
-<div class="line"><a name="l01892"></a><span class="lineno"> 1892</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l01893"></a><span class="lineno"> 1893</span>&#160;<span class="preprocessor">#ifndef VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l01894"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a1f0c126759fc96ccb6e2d23c101d770c"> 1894</a></span>&#160;<span class="preprocessor">    #define VMA_RECORDING_ENABLED 0</span></div>
-<div class="line"><a name="l01895"></a><span class="lineno"> 1895</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l01896"></a><span class="lineno"> 1896</span>&#160; </div>
-<div class="line"><a name="l01897"></a><span class="lineno"> 1897</span>&#160;<span class="preprocessor">#ifndef NOMINMAX</span></div>
-<div class="line"><a name="l01898"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9f918755b601cf4bffca775992e6fb90"> 1898</a></span>&#160;<span class="preprocessor">    #define NOMINMAX // For windows.h</span></div>
-<div class="line"><a name="l01899"></a><span class="lineno"> 1899</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l01900"></a><span class="lineno"> 1900</span>&#160; </div>
-<div class="line"><a name="l01901"></a><span class="lineno"> 1901</span>&#160;<span class="preprocessor">#if defined(__ANDROID__) &amp;&amp; defined(VK_NO_PROTOTYPES) &amp;&amp; VMA_STATIC_VULKAN_FUNCTIONS</span></div>
-<div class="line"><a name="l01902"></a><span class="lineno"> 1902</span>&#160;    <span class="keyword">extern</span> PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;</div>
-<div class="line"><a name="l01903"></a><span class="lineno"> 1903</span>&#160;    <span class="keyword">extern</span> PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;</div>
-<div class="line"><a name="l01904"></a><span class="lineno"> 1904</span>&#160;    <span class="keyword">extern</span> PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;</div>
-<div class="line"><a name="l01905"></a><span class="lineno"> 1905</span>&#160;    <span class="keyword">extern</span> PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;</div>
-<div class="line"><a name="l01906"></a><span class="lineno"> 1906</span>&#160;    <span class="keyword">extern</span> PFN_vkAllocateMemory vkAllocateMemory;</div>
-<div class="line"><a name="l01907"></a><span class="lineno"> 1907</span>&#160;    <span class="keyword">extern</span> PFN_vkFreeMemory vkFreeMemory;</div>
-<div class="line"><a name="l01908"></a><span class="lineno"> 1908</span>&#160;    <span class="keyword">extern</span> PFN_vkMapMemory vkMapMemory;</div>
-<div class="line"><a name="l01909"></a><span class="lineno"> 1909</span>&#160;    <span class="keyword">extern</span> PFN_vkUnmapMemory vkUnmapMemory;</div>
-<div class="line"><a name="l01910"></a><span class="lineno"> 1910</span>&#160;    <span class="keyword">extern</span> PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;</div>
-<div class="line"><a name="l01911"></a><span class="lineno"> 1911</span>&#160;    <span class="keyword">extern</span> PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges;</div>
-<div class="line"><a name="l01912"></a><span class="lineno"> 1912</span>&#160;    <span class="keyword">extern</span> PFN_vkBindBufferMemory vkBindBufferMemory;</div>
-<div class="line"><a name="l01913"></a><span class="lineno"> 1913</span>&#160;    <span class="keyword">extern</span> PFN_vkBindImageMemory vkBindImageMemory;</div>
-<div class="line"><a name="l01914"></a><span class="lineno"> 1914</span>&#160;    <span class="keyword">extern</span> PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;</div>
-<div class="line"><a name="l01915"></a><span class="lineno"> 1915</span>&#160;    <span class="keyword">extern</span> PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;</div>
-<div class="line"><a name="l01916"></a><span class="lineno"> 1916</span>&#160;    <span class="keyword">extern</span> PFN_vkCreateBuffer vkCreateBuffer;</div>
-<div class="line"><a name="l01917"></a><span class="lineno"> 1917</span>&#160;    <span class="keyword">extern</span> PFN_vkDestroyBuffer vkDestroyBuffer;</div>
-<div class="line"><a name="l01918"></a><span class="lineno"> 1918</span>&#160;    <span class="keyword">extern</span> PFN_vkCreateImage vkCreateImage;</div>
-<div class="line"><a name="l01919"></a><span class="lineno"> 1919</span>&#160;    <span class="keyword">extern</span> PFN_vkDestroyImage vkDestroyImage;</div>
-<div class="line"><a name="l01920"></a><span class="lineno"> 1920</span>&#160;    <span class="keyword">extern</span> PFN_vkCmdCopyBuffer vkCmdCopyBuffer;</div>
-<div class="line"><a name="l01921"></a><span class="lineno"> 1921</span>&#160;<span class="preprocessor">    #if VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l01922"></a><span class="lineno"> 1922</span>&#160;        <span class="keyword">extern</span> PFN_vkGetBufferMemoryRequirements2 vkGetBufferMemoryRequirements2;</div>
-<div class="line"><a name="l01923"></a><span class="lineno"> 1923</span>&#160;        <span class="keyword">extern</span> PFN_vkGetImageMemoryRequirements2 vkGetImageMemoryRequirements2;</div>
-<div class="line"><a name="l01924"></a><span class="lineno"> 1924</span>&#160;        <span class="keyword">extern</span> PFN_vkBindBufferMemory2 vkBindBufferMemory2;</div>
-<div class="line"><a name="l01925"></a><span class="lineno"> 1925</span>&#160;        <span class="keyword">extern</span> PFN_vkBindImageMemory2 vkBindImageMemory2;</div>
-<div class="line"><a name="l01926"></a><span class="lineno"> 1926</span>&#160;        <span class="keyword">extern</span> PFN_vkGetPhysicalDeviceMemoryProperties2 vkGetPhysicalDeviceMemoryProperties2;</div>
-<div class="line"><a name="l01927"></a><span class="lineno"> 1927</span>&#160;<span class="preprocessor">    #endif // #if VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l01928"></a><span class="lineno"> 1928</span>&#160;<span class="preprocessor">#endif // #if defined(__ANDROID__) &amp;&amp; VMA_STATIC_VULKAN_FUNCTIONS &amp;&amp; VK_NO_PROTOTYPES</span></div>
-<div class="line"><a name="l01929"></a><span class="lineno"> 1929</span>&#160; </div>
-<div class="line"><a name="l01930"></a><span class="lineno"> 1930</span>&#160;<span class="preprocessor">#ifndef VULKAN_H_</span></div>
-<div class="line"><a name="l01931"></a><span class="lineno"> 1931</span>&#160;<span class="preprocessor">    #include &lt;vulkan/vulkan.h&gt;</span></div>
-<div class="line"><a name="l01932"></a><span class="lineno"> 1932</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l01933"></a><span class="lineno"> 1933</span>&#160; </div>
-<div class="line"><a name="l01934"></a><span class="lineno"> 1934</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l01935"></a><span class="lineno"> 1935</span>&#160;<span class="preprocessor">    #if defined(_WIN32)</span></div>
-<div class="line"><a name="l01936"></a><span class="lineno"> 1936</span>&#160;<span class="preprocessor">        #include &lt;windows.h&gt;</span></div>
-<div class="line"><a name="l01937"></a><span class="lineno"> 1937</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l01938"></a><span class="lineno"> 1938</span>&#160;<span class="preprocessor">        #error VMA Recording functionality is not yet available for non-Windows platforms</span></div>
-<div class="line"><a name="l01939"></a><span class="lineno"> 1939</span>&#160;<span class="preprocessor">    #endif</span></div>
-<div class="line"><a name="l01940"></a><span class="lineno"> 1940</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l01941"></a><span class="lineno"> 1941</span>&#160; </div>
-<div class="line"><a name="l01942"></a><span class="lineno"> 1942</span>&#160;<span class="comment">// Define this macro to declare maximum supported Vulkan version in format AAABBBCCC,</span></div>
-<div class="line"><a name="l01943"></a><span class="lineno"> 1943</span>&#160;<span class="comment">// where AAA = major, BBB = minor, CCC = patch.</span></div>
-<div class="line"><a name="l01944"></a><span class="lineno"> 1944</span>&#160;<span class="comment">// If you want to use version &gt; 1.0, it still needs to be enabled via VmaAllocatorCreateInfo::vulkanApiVersion.</span></div>
-<div class="line"><a name="l01945"></a><span class="lineno"> 1945</span>&#160;<span class="preprocessor">#if !defined(VMA_VULKAN_VERSION)</span></div>
-<div class="line"><a name="l01946"></a><span class="lineno"> 1946</span>&#160;<span class="preprocessor">    #if defined(VK_VERSION_1_2)</span></div>
-<div class="line"><a name="l01947"></a><span class="lineno"> 1947</span>&#160;<span class="preprocessor">        #define VMA_VULKAN_VERSION 1002000</span></div>
-<div class="line"><a name="l01948"></a><span class="lineno"> 1948</span>&#160;<span class="preprocessor">    #elif defined(VK_VERSION_1_1)</span></div>
-<div class="line"><a name="l01949"></a><span class="lineno"> 1949</span>&#160;<span class="preprocessor">        #define VMA_VULKAN_VERSION 1001000</span></div>
-<div class="line"><a name="l01950"></a><span class="lineno"> 1950</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l01951"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a1a2407c283893638cc039bb31fcd74b6"> 1951</a></span>&#160;<span class="preprocessor">        #define VMA_VULKAN_VERSION 1000000</span></div>
-<div class="line"><a name="l01952"></a><span class="lineno"> 1952</span>&#160;<span class="preprocessor">    #endif</span></div>
-<div class="line"><a name="l01953"></a><span class="lineno"> 1953</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l01954"></a><span class="lineno"> 1954</span>&#160; </div>
-<div class="line"><a name="l01955"></a><span class="lineno"> 1955</span>&#160;<span class="preprocessor">#if !defined(VMA_DEDICATED_ALLOCATION)</span></div>
-<div class="line"><a name="l01956"></a><span class="lineno"> 1956</span>&#160;<span class="preprocessor">    #if VK_KHR_get_memory_requirements2 &amp;&amp; VK_KHR_dedicated_allocation</span></div>
-<div class="line"><a name="l01957"></a><span class="lineno"> 1957</span>&#160;<span class="preprocessor">        #define VMA_DEDICATED_ALLOCATION 1</span></div>
-<div class="line"><a name="l01958"></a><span class="lineno"> 1958</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l01959"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#af7b860e63b96d11e44ae8587ba06bbf4"> 1959</a></span>&#160;<span class="preprocessor">        #define VMA_DEDICATED_ALLOCATION 0</span></div>
-<div class="line"><a name="l01960"></a><span class="lineno"> 1960</span>&#160;<span class="preprocessor">    #endif</span></div>
-<div class="line"><a name="l01961"></a><span class="lineno"> 1961</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l01962"></a><span class="lineno"> 1962</span>&#160; </div>
-<div class="line"><a name="l01963"></a><span class="lineno"> 1963</span>&#160;<span class="preprocessor">#if !defined(VMA_BIND_MEMORY2)</span></div>
-<div class="line"><a name="l01964"></a><span class="lineno"> 1964</span>&#160;<span class="preprocessor">    #if VK_KHR_bind_memory2</span></div>
-<div class="line"><a name="l01965"></a><span class="lineno"> 1965</span>&#160;<span class="preprocessor">        #define VMA_BIND_MEMORY2 1</span></div>
-<div class="line"><a name="l01966"></a><span class="lineno"> 1966</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l01967"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a88bef97f86d70a34a4c0746e09a2680d"> 1967</a></span>&#160;<span class="preprocessor">        #define VMA_BIND_MEMORY2 0</span></div>
-<div class="line"><a name="l01968"></a><span class="lineno"> 1968</span>&#160;<span class="preprocessor">    #endif</span></div>
-<div class="line"><a name="l01969"></a><span class="lineno"> 1969</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l01970"></a><span class="lineno"> 1970</span>&#160; </div>
-<div class="line"><a name="l01971"></a><span class="lineno"> 1971</span>&#160;<span class="preprocessor">#if !defined(VMA_MEMORY_BUDGET)</span></div>
-<div class="line"><a name="l01972"></a><span class="lineno"> 1972</span>&#160;<span class="preprocessor">    #if VK_EXT_memory_budget &amp;&amp; (VK_KHR_get_physical_device_properties2 || VMA_VULKAN_VERSION &gt;= 1001000)</span></div>
-<div class="line"><a name="l01973"></a><span class="lineno"> 1973</span>&#160;<span class="preprocessor">        #define VMA_MEMORY_BUDGET 1</span></div>
-<div class="line"><a name="l01974"></a><span class="lineno"> 1974</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l01975"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a05decf1cf4ebf767beba7acca6c1ec3a"> 1975</a></span>&#160;<span class="preprocessor">        #define VMA_MEMORY_BUDGET 0</span></div>
-<div class="line"><a name="l01976"></a><span class="lineno"> 1976</span>&#160;<span class="preprocessor">    #endif</span></div>
-<div class="line"><a name="l01977"></a><span class="lineno"> 1977</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l01978"></a><span class="lineno"> 1978</span>&#160; </div>
-<div class="line"><a name="l01979"></a><span class="lineno"> 1979</span>&#160;<span class="comment">// Defined to 1 when VK_KHR_buffer_device_address device extension or equivalent core Vulkan 1.2 feature is defined in its headers.</span></div>
-<div class="line"><a name="l01980"></a><span class="lineno"> 1980</span>&#160;<span class="preprocessor">#if !defined(VMA_BUFFER_DEVICE_ADDRESS)</span></div>
-<div class="line"><a name="l01981"></a><span class="lineno"> 1981</span>&#160;<span class="preprocessor">    #if VK_KHR_buffer_device_address || VMA_VULKAN_VERSION &gt;= 1002000</span></div>
-<div class="line"><a name="l01982"></a><span class="lineno"> 1982</span>&#160;<span class="preprocessor">        #define VMA_BUFFER_DEVICE_ADDRESS 1</span></div>
-<div class="line"><a name="l01983"></a><span class="lineno"> 1983</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l01984"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a7f9d5e71b70dd1a137c303a8a8262c10"> 1984</a></span>&#160;<span class="preprocessor">        #define VMA_BUFFER_DEVICE_ADDRESS 0</span></div>
-<div class="line"><a name="l01985"></a><span class="lineno"> 1985</span>&#160;<span class="preprocessor">    #endif</span></div>
-<div class="line"><a name="l01986"></a><span class="lineno"> 1986</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l01987"></a><span class="lineno"> 1987</span>&#160; </div>
-<div class="line"><a name="l01988"></a><span class="lineno"> 1988</span>&#160;<span class="comment">// Define these macros to decorate all public functions with additional code,</span></div>
-<div class="line"><a name="l01989"></a><span class="lineno"> 1989</span>&#160;<span class="comment">// before and after returned type, appropriately. This may be useful for</span></div>
-<div class="line"><a name="l01990"></a><span class="lineno"> 1990</span>&#160;<span class="comment">// exporing the functions when compiling VMA as a separate library. Example:</span></div>
-<div class="line"><a name="l01991"></a><span class="lineno"> 1991</span>&#160;<span class="comment">// #define VMA_CALL_PRE  __declspec(dllexport)</span></div>
-<div class="line"><a name="l01992"></a><span class="lineno"> 1992</span>&#160;<span class="comment">// #define VMA_CALL_POST __cdecl</span></div>
-<div class="line"><a name="l01993"></a><span class="lineno"> 1993</span>&#160;<span class="preprocessor">#ifndef VMA_CALL_PRE</span></div>
-<div class="line"><a name="l01994"></a><span class="lineno"> 1994</span>&#160;<span class="preprocessor">    #define VMA_CALL_PRE</span></div>
-<div class="line"><a name="l01995"></a><span class="lineno"> 1995</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l01996"></a><span class="lineno"> 1996</span>&#160;<span class="preprocessor">#ifndef VMA_CALL_POST</span></div>
-<div class="line"><a name="l01997"></a><span class="lineno"> 1997</span>&#160;<span class="preprocessor">    #define VMA_CALL_POST</span></div>
-<div class="line"><a name="l01998"></a><span class="lineno"> 1998</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l01999"></a><span class="lineno"> 1999</span>&#160; </div>
-<div class="line"><a name="l02000"></a><span class="lineno"> 2000</span>&#160;<span class="comment">// Define this macro to decorate pointers with an attribute specifying the</span></div>
-<div class="line"><a name="l02001"></a><span class="lineno"> 2001</span>&#160;<span class="comment">// length of the array they point to if they are not null.</span></div>
-<div class="line"><a name="l02002"></a><span class="lineno"> 2002</span>&#160;<span class="comment">//</span></div>
-<div class="line"><a name="l02003"></a><span class="lineno"> 2003</span>&#160;<span class="comment">// The length may be one of</span></div>
-<div class="line"><a name="l02004"></a><span class="lineno"> 2004</span>&#160;<span class="comment">// - The name of another parameter in the argument list where the pointer is declared</span></div>
-<div class="line"><a name="l02005"></a><span class="lineno"> 2005</span>&#160;<span class="comment">// - The name of another member in the struct where the pointer is declared</span></div>
-<div class="line"><a name="l02006"></a><span class="lineno"> 2006</span>&#160;<span class="comment">// - The name of a member of a struct type, meaning the value of that member in</span></div>
-<div class="line"><a name="l02007"></a><span class="lineno"> 2007</span>&#160;<span class="comment">//   the context of the call. For example</span></div>
-<div class="line"><a name="l02008"></a><span class="lineno"> 2008</span>&#160;<span class="comment">//   VMA_LEN_IF_NOT_NULL(&quot;VkPhysicalDeviceMemoryProperties::memoryHeapCount&quot;),</span></div>
-<div class="line"><a name="l02009"></a><span class="lineno"> 2009</span>&#160;<span class="comment">//   this means the number of memory heaps available in the device associated</span></div>
-<div class="line"><a name="l02010"></a><span class="lineno"> 2010</span>&#160;<span class="comment">//   with the VmaAllocator being dealt with.</span></div>
-<div class="line"><a name="l02011"></a><span class="lineno"> 2011</span>&#160;<span class="preprocessor">#ifndef VMA_LEN_IF_NOT_NULL</span></div>
-<div class="line"><a name="l02012"></a><span class="lineno"> 2012</span>&#160;<span class="preprocessor">    #define VMA_LEN_IF_NOT_NULL(len)</span></div>
-<div class="line"><a name="l02013"></a><span class="lineno"> 2013</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l02014"></a><span class="lineno"> 2014</span>&#160; </div>
-<div class="line"><a name="l02015"></a><span class="lineno"> 2015</span>&#160;<span class="comment">// The VMA_NULLABLE macro is defined to be _Nullable when compiling with Clang.</span></div>
-<div class="line"><a name="l02016"></a><span class="lineno"> 2016</span>&#160;<span class="comment">// see: https://clang.llvm.org/docs/AttributeReference.html#nullable</span></div>
-<div class="line"><a name="l02017"></a><span class="lineno"> 2017</span>&#160;<span class="preprocessor">#ifndef VMA_NULLABLE</span></div>
-<div class="line"><a name="l02018"></a><span class="lineno"> 2018</span>&#160;<span class="preprocessor">    #ifdef __clang__</span></div>
-<div class="line"><a name="l02019"></a><span class="lineno"> 2019</span>&#160;<span class="preprocessor">        #define VMA_NULLABLE _Nullable</span></div>
-<div class="line"><a name="l02020"></a><span class="lineno"> 2020</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l02021"></a><span class="lineno"> 2021</span>&#160;<span class="preprocessor">        #define VMA_NULLABLE</span></div>
-<div class="line"><a name="l02022"></a><span class="lineno"> 2022</span>&#160;<span class="preprocessor">    #endif</span></div>
-<div class="line"><a name="l02023"></a><span class="lineno"> 2023</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l02024"></a><span class="lineno"> 2024</span>&#160; </div>
-<div class="line"><a name="l02025"></a><span class="lineno"> 2025</span>&#160;<span class="comment">// The VMA_NOT_NULL macro is defined to be _Nonnull when compiling with Clang.</span></div>
-<div class="line"><a name="l02026"></a><span class="lineno"> 2026</span>&#160;<span class="comment">// see: https://clang.llvm.org/docs/AttributeReference.html#nonnull</span></div>
-<div class="line"><a name="l02027"></a><span class="lineno"> 2027</span>&#160;<span class="preprocessor">#ifndef VMA_NOT_NULL</span></div>
-<div class="line"><a name="l02028"></a><span class="lineno"> 2028</span>&#160;<span class="preprocessor">    #ifdef __clang__</span></div>
-<div class="line"><a name="l02029"></a><span class="lineno"> 2029</span>&#160;<span class="preprocessor">        #define VMA_NOT_NULL _Nonnull</span></div>
-<div class="line"><a name="l02030"></a><span class="lineno"> 2030</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l02031"></a><span class="lineno"> 2031</span>&#160;<span class="preprocessor">        #define VMA_NOT_NULL</span></div>
-<div class="line"><a name="l02032"></a><span class="lineno"> 2032</span>&#160;<span class="preprocessor">    #endif</span></div>
-<div class="line"><a name="l02033"></a><span class="lineno"> 2033</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l02034"></a><span class="lineno"> 2034</span>&#160; </div>
-<div class="line"><a name="l02035"></a><span class="lineno"> 2035</span>&#160;<span class="comment">// If non-dispatchable handles are represented as pointers then we can give</span></div>
-<div class="line"><a name="l02036"></a><span class="lineno"> 2036</span>&#160;<span class="comment">// then nullability annotations</span></div>
-<div class="line"><a name="l02037"></a><span class="lineno"> 2037</span>&#160;<span class="preprocessor">#ifndef VMA_NOT_NULL_NON_DISPATCHABLE</span></div>
-<div class="line"><a name="l02038"></a><span class="lineno"> 2038</span>&#160;<span class="preprocessor">    #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) &amp;&amp; !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)</span></div>
-<div class="line"><a name="l02039"></a><span class="lineno"> 2039</span>&#160;<span class="preprocessor">        #define VMA_NOT_NULL_NON_DISPATCHABLE VMA_NOT_NULL</span></div>
-<div class="line"><a name="l02040"></a><span class="lineno"> 2040</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l02041"></a><span class="lineno"> 2041</span>&#160;<span class="preprocessor">        #define VMA_NOT_NULL_NON_DISPATCHABLE</span></div>
-<div class="line"><a name="l02042"></a><span class="lineno"> 2042</span>&#160;<span class="preprocessor">    #endif</span></div>
-<div class="line"><a name="l02043"></a><span class="lineno"> 2043</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l02044"></a><span class="lineno"> 2044</span>&#160; </div>
-<div class="line"><a name="l02045"></a><span class="lineno"> 2045</span>&#160;<span class="preprocessor">#ifndef VMA_NULLABLE_NON_DISPATCHABLE</span></div>
-<div class="line"><a name="l02046"></a><span class="lineno"> 2046</span>&#160;<span class="preprocessor">    #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) &amp;&amp; !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)</span></div>
-<div class="line"><a name="l02047"></a><span class="lineno"> 2047</span>&#160;<span class="preprocessor">        #define VMA_NULLABLE_NON_DISPATCHABLE VMA_NULLABLE</span></div>
-<div class="line"><a name="l02048"></a><span class="lineno"> 2048</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l02049"></a><span class="lineno"> 2049</span>&#160;<span class="preprocessor">        #define VMA_NULLABLE_NON_DISPATCHABLE</span></div>
-<div class="line"><a name="l02050"></a><span class="lineno"> 2050</span>&#160;<span class="preprocessor">    #endif</span></div>
-<div class="line"><a name="l02051"></a><span class="lineno"> 2051</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l02052"></a><span class="lineno"> 2052</span>&#160; </div>
-<div class="line"><a name="l02062"></a><span class="lineno"> 2062</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a>)</div>
-<div class="line"><a name="l02063"></a><span class="lineno"> 2063</span>&#160; </div>
-<div class="line"><a name="l02064"></a><span class="lineno"> 2064</span>&#160;<span class="keyword">typedef</span> void (VKAPI_PTR *<a class="code" href="vk__mem__alloc_8h.html#a7e1ed85f7799600b03ad51a77acc21f3">PFN_vmaAllocateDeviceMemoryFunction</a>)(</div>
-<div class="line"><a name="l02066"></a><span class="lineno"> 2066</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL                    allocator,</div>
-<div class="line"><a name="l02067"></a><span class="lineno"> 2067</span>&#160;    uint32_t                                     memoryType,</div>
-<div class="line"><a name="l02068"></a><span class="lineno"> 2068</span>&#160;    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,</div>
-<div class="line"><a name="l02069"></a><span class="lineno"> 2069</span>&#160;    VkDeviceSize                                 size,</div>
-<div class="line"><a name="l02070"></a><span class="lineno"> 2070</span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE                           pUserData);</div>
-<div class="line"><a name="l02072"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a154ccaaf53dc2c36378f80f0c4f3679b"> 2072</a></span>&#160;<span class="keyword">typedef</span> void (VKAPI_PTR *<a class="code" href="vk__mem__alloc_8h.html#a154ccaaf53dc2c36378f80f0c4f3679b">PFN_vmaFreeDeviceMemoryFunction</a>)(</div>
-<div class="line"><a name="l02073"></a><span class="lineno"> 2073</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL                    allocator,</div>
-<div class="line"><a name="l02074"></a><span class="lineno"> 2074</span>&#160;    uint32_t                                     memoryType,</div>
-<div class="line"><a name="l02075"></a><span class="lineno"> 2075</span>&#160;    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,</div>
-<div class="line"><a name="l02076"></a><span class="lineno"> 2076</span>&#160;    VkDeviceSize                                 size,</div>
-<div class="line"><a name="l02077"></a><span class="lineno"> 2077</span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE                           pUserData);</div>
-<div class="line"><a name="l02078"></a><span class="lineno"> 2078</span>&#160; </div>
-<div class="line"><a name="l02086"></a><span class="lineno"><a class="line" href="struct_vma_device_memory_callbacks.html"> 2086</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks</a> {</div>
-<div class="line"><a name="l02088"></a><span class="lineno"><a class="line" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb"> 2088</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a7e1ed85f7799600b03ad51a77acc21f3">PFN_vmaAllocateDeviceMemoryFunction</a> VMA_NULLABLE <a class="code" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">pfnAllocate</a>;</div>
-<div class="line"><a name="l02090"></a><span class="lineno"><a class="line" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c"> 2090</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a154ccaaf53dc2c36378f80f0c4f3679b">PFN_vmaFreeDeviceMemoryFunction</a> VMA_NULLABLE <a class="code" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">pfnFree</a>;</div>
-<div class="line"><a name="l02092"></a><span class="lineno"><a class="line" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6"> 2092</a></span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE <a class="code" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">pUserData</a>;</div>
-<div class="line"><a name="l02093"></a><span class="lineno"> 2093</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a77692d3c8770ea8882d573206bd27b2b">VmaDeviceMemoryCallbacks</a>;</div>
-<div class="line"><a name="l02094"></a><span class="lineno"> 2094</span>&#160; </div>
-<div class="line"><a name="l02096"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c"> 2096</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c">VmaAllocatorCreateFlagBits</a> {</div>
-<div class="line"><a name="l02101"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d"> 2101</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d">VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT</a> = 0x00000001,</div>
-<div class="line"><a name="l02126"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878"> 2126</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a> = 0x00000002,</div>
-<div class="line"><a name="l02141"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee"> 2141</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a> = 0x00000004,</div>
-<div class="line"><a name="l02153"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0"> 2153</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0">VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT</a> = 0x00000008,</div>
-<div class="line"><a name="l02171"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f"> 2171</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f">VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT</a> = 0x00000010,</div>
-<div class="line"><a name="l02189"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089"> 2189</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089">VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT</a> = 0x00000020,</div>
-<div class="line"><a name="l02190"></a><span class="lineno"> 2190</span>&#160; </div>
-<div class="line"><a name="l02191"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c"> 2191</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c">VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
-<div class="line"><a name="l02192"></a><span class="lineno"> 2192</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c">VmaAllocatorCreateFlagBits</a>;</div>
-<div class="line"><a name="l02193"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d"> 2193</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d">VmaAllocatorCreateFlags</a>;</div>
-<div class="line"><a name="l02194"></a><span class="lineno"> 2194</span>&#160; </div>
-<div class="line"><a name="l02199"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html"> 2199</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a> {</div>
-<div class="line"><a name="l02200"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a77b7a74082823e865dd6546623468f96"> 2200</a></span>&#160;    PFN_vkGetPhysicalDeviceProperties VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a77b7a74082823e865dd6546623468f96">vkGetPhysicalDeviceProperties</a>;</div>
-<div class="line"><a name="l02201"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a60d25c33bba06bb8592e6875cbaa9830"> 2201</a></span>&#160;    PFN_vkGetPhysicalDeviceMemoryProperties VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a60d25c33bba06bb8592e6875cbaa9830">vkGetPhysicalDeviceMemoryProperties</a>;</div>
-<div class="line"><a name="l02202"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c"> 2202</a></span>&#160;    PFN_vkAllocateMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c">vkAllocateMemory</a>;</div>
-<div class="line"><a name="l02203"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a4c658701778564d62034255b5dda91b4"> 2203</a></span>&#160;    PFN_vkFreeMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a4c658701778564d62034255b5dda91b4">vkFreeMemory</a>;</div>
-<div class="line"><a name="l02204"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#ab5c1f38dea3a2cf00dc9eb4f57218c49"> 2204</a></span>&#160;    PFN_vkMapMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#ab5c1f38dea3a2cf00dc9eb4f57218c49">vkMapMemory</a>;</div>
-<div class="line"><a name="l02205"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#acc798589736f0becb317fc2196c1d8b9"> 2205</a></span>&#160;    PFN_vkUnmapMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#acc798589736f0becb317fc2196c1d8b9">vkUnmapMemory</a>;</div>
-<div class="line"><a name="l02206"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a33c322f4c4ad2810f8a9c97a277572f9"> 2206</a></span>&#160;    PFN_vkFlushMappedMemoryRanges VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a33c322f4c4ad2810f8a9c97a277572f9">vkFlushMappedMemoryRanges</a>;</div>
-<div class="line"><a name="l02207"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a5c1093bc32386a8060c37c9f282078a1"> 2207</a></span>&#160;    PFN_vkInvalidateMappedMemoryRanges VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a5c1093bc32386a8060c37c9f282078a1">vkInvalidateMappedMemoryRanges</a>;</div>
-<div class="line"><a name="l02208"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2"> 2208</a></span>&#160;    PFN_vkBindBufferMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2">vkBindBufferMemory</a>;</div>
-<div class="line"><a name="l02209"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a1338d96a128a5ade648b8d934907c637"> 2209</a></span>&#160;    PFN_vkBindImageMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a1338d96a128a5ade648b8d934907c637">vkBindImageMemory</a>;</div>
-<div class="line"><a name="l02210"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a5b92901df89a4194b0d12f6071d4d143"> 2210</a></span>&#160;    PFN_vkGetBufferMemoryRequirements VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a5b92901df89a4194b0d12f6071d4d143">vkGetBufferMemoryRequirements</a>;</div>
-<div class="line"><a name="l02211"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a475f6f49f8debe4d10800592606d53f4"> 2211</a></span>&#160;    PFN_vkGetImageMemoryRequirements VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a475f6f49f8debe4d10800592606d53f4">vkGetImageMemoryRequirements</a>;</div>
-<div class="line"><a name="l02212"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#ae8084315a25006271a2edfc3a447519f"> 2212</a></span>&#160;    PFN_vkCreateBuffer VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#ae8084315a25006271a2edfc3a447519f">vkCreateBuffer</a>;</div>
-<div class="line"><a name="l02213"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a7e054606faddb07f0e8556f3ed317d45"> 2213</a></span>&#160;    PFN_vkDestroyBuffer VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a7e054606faddb07f0e8556f3ed317d45">vkDestroyBuffer</a>;</div>
-<div class="line"><a name="l02214"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a23ebe70be515b9b5010a1d691200e325"> 2214</a></span>&#160;    PFN_vkCreateImage VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a23ebe70be515b9b5010a1d691200e325">vkCreateImage</a>;</div>
-<div class="line"><a name="l02215"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a90b898227039b1dcb3520f6e91f09ffa"> 2215</a></span>&#160;    PFN_vkDestroyImage VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a90b898227039b1dcb3520f6e91f09ffa">vkDestroyImage</a>;</div>
-<div class="line"><a name="l02216"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#ae5c0db8c89a3b82593dc16aa6a49fa3a"> 2216</a></span>&#160;    PFN_vkCmdCopyBuffer VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#ae5c0db8c89a3b82593dc16aa6a49fa3a">vkCmdCopyBuffer</a>;</div>
-<div class="line"><a name="l02217"></a><span class="lineno"> 2217</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l02218"></a><span class="lineno"> 2218</span>&#160;    PFN_vkGetBufferMemoryRequirements2KHR VMA_NULLABLE vkGetBufferMemoryRequirements2KHR;</div>
-<div class="line"><a name="l02219"></a><span class="lineno"> 2219</span>&#160;    PFN_vkGetImageMemoryRequirements2KHR VMA_NULLABLE vkGetImageMemoryRequirements2KHR;</div>
-<div class="line"><a name="l02220"></a><span class="lineno"> 2220</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l02221"></a><span class="lineno"> 2221</span>&#160;<span class="preprocessor">#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l02222"></a><span class="lineno"> 2222</span>&#160;    PFN_vkBindBufferMemory2KHR VMA_NULLABLE vkBindBufferMemory2KHR;</div>
-<div class="line"><a name="l02223"></a><span class="lineno"> 2223</span>&#160;    PFN_vkBindImageMemory2KHR VMA_NULLABLE vkBindImageMemory2KHR;</div>
-<div class="line"><a name="l02224"></a><span class="lineno"> 2224</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l02225"></a><span class="lineno"> 2225</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l02226"></a><span class="lineno"> 2226</span>&#160;    PFN_vkGetPhysicalDeviceMemoryProperties2KHR VMA_NULLABLE vkGetPhysicalDeviceMemoryProperties2KHR;</div>
-<div class="line"><a name="l02227"></a><span class="lineno"> 2227</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l02228"></a><span class="lineno"> 2228</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#abb0a8e3b5040d847571cca6c7f9a8074">VmaVulkanFunctions</a>;</div>
-<div class="line"><a name="l02229"></a><span class="lineno"> 2229</span>&#160; </div>
-<div class="line"><a name="l02231"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2"> 2231</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2">VmaRecordFlagBits</a> {</div>
-<div class="line"><a name="l02237"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7"> 2237</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7">VMA_RECORD_FLUSH_AFTER_CALL_BIT</a> = 0x00000001,</div>
-<div class="line"><a name="l02238"></a><span class="lineno"> 2238</span>&#160;    </div>
-<div class="line"><a name="l02239"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e"> 2239</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e">VMA_RECORD_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
-<div class="line"><a name="l02240"></a><span class="lineno"> 2240</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2">VmaRecordFlagBits</a>;</div>
-<div class="line"><a name="l02241"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828"> 2241</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828">VmaRecordFlags</a>;</div>
-<div class="line"><a name="l02242"></a><span class="lineno"> 2242</span>&#160; </div>
-<div class="line"><a name="l02244"></a><span class="lineno"><a class="line" href="struct_vma_record_settings.html"> 2244</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_record_settings.html">VmaRecordSettings</a></div>
-<div class="line"><a name="l02245"></a><span class="lineno"> 2245</span>&#160;{</div>
-<div class="line"><a name="l02247"></a><span class="lineno"><a class="line" href="struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a"> 2247</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828">VmaRecordFlags</a> <a class="code" href="struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a">flags</a>;</div>
-<div class="line"><a name="l02255"></a><span class="lineno"><a class="line" href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d"> 2255</a></span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* VMA_NOT_NULL <a class="code" href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d">pFilePath</a>;</div>
-<div class="line"><a name="l02256"></a><span class="lineno"> 2256</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a16e21c877101493fce582664cd8754fc">VmaRecordSettings</a>;</div>
-<div class="line"><a name="l02257"></a><span class="lineno"> 2257</span>&#160; </div>
-<div class="line"><a name="l02259"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html"> 2259</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a></div>
-<div class="line"><a name="l02260"></a><span class="lineno"> 2260</span>&#160;{</div>
-<div class="line"><a name="l02262"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346"> 2262</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d">VmaAllocatorCreateFlags</a> <a class="code" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">flags</a>;</div>
-<div class="line"><a name="l02264"></a><span class="lineno"> 2264</span>&#160; </div>
-<div class="line"><a name="l02265"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156"> 2265</a></span>&#160;    VkPhysicalDevice VMA_NOT_NULL <a class="code" href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156">physicalDevice</a>;</div>
-<div class="line"><a name="l02267"></a><span class="lineno"> 2267</span>&#160; </div>
-<div class="line"><a name="l02268"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500"> 2268</a></span>&#160;    VkDevice VMA_NOT_NULL <a class="code" href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500">device</a>;</div>
-<div class="line"><a name="l02270"></a><span class="lineno"> 2270</span>&#160; </div>
-<div class="line"><a name="l02271"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a"> 2271</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a">preferredLargeHeapBlockSize</a>;</div>
-<div class="line"><a name="l02273"></a><span class="lineno"> 2273</span>&#160; </div>
-<div class="line"><a name="l02274"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d"> 2274</a></span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* VMA_NULLABLE <a class="code" href="struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d">pAllocationCallbacks</a>;</div>
-<div class="line"><a name="l02276"></a><span class="lineno"> 2276</span>&#160; </div>
-<div class="line"><a name="l02277"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e"> 2277</a></span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks</a>* VMA_NULLABLE <a class="code" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">pDeviceMemoryCallbacks</a>;</div>
-<div class="line"><a name="l02291"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7"> 2291</a></span>&#160;    uint32_t <a class="code" href="struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7">frameInUseCount</a>;</div>
-<div class="line"><a name="l02316"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b"> 2316</a></span>&#160;    <span class="keyword">const</span> VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(<span class="stringliteral">&quot;VkPhysicalDeviceMemoryProperties::memoryHeapCount&quot;</span>) <a class="code" href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b">pHeapSizeLimit</a>;</div>
-<div class="line"><a name="l02317"></a><span class="lineno"> 2317</span>&#160; </div>
-<div class="line"><a name="l02322"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd"> 2322</a></span>&#160;    const <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* VMA_NULLABLE <a class="code" href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd">pVulkanFunctions</a>;</div>
-<div class="line"><a name="l02329"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee"> 2329</a></span>&#160;    const <a class="code" href="struct_vma_record_settings.html">VmaRecordSettings</a>* VMA_NULLABLE <a class="code" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee">pRecordSettings</a>;</div>
-<div class="line"><a name="l02334"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b"> 2334</a></span>&#160;    VkInstance VMA_NOT_NULL_NON_DISPATCHABLE <a class="code" href="struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b">instance</a>;</div>
-<div class="line"><a name="l02343"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285"> 2343</a></span>&#160;    uint32_t <a class="code" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">vulkanApiVersion</a>;</div>
-<div class="line"><a name="l02344"></a><span class="lineno"> 2344</span>&#160;} <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>;</div>
-<div class="line"><a name="l02345"></a><span class="lineno"> 2345</span>&#160; </div>
-<div class="line"><a name="l02347"></a><span class="lineno"> 2347</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb">vmaCreateAllocator</a>(</div>
-<div class="line"><a name="l02348"></a><span class="lineno"> 2348</span>&#160;    const <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* VMA_NOT_NULL pCreateInfo,</div>
-<div class="line"><a name="l02349"></a><span class="lineno"> 2349</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NULLABLE * VMA_NOT_NULL pAllocator);</div>
-<div class="line"><a name="l02350"></a><span class="lineno"> 2350</span>&#160; </div>
-<div class="line"><a name="l02352"></a><span class="lineno"> 2352</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa8d164061c88f22fb1fd3c8f3534bc1d">vmaDestroyAllocator</a>(</div>
-<div class="line"><a name="l02353"></a><span class="lineno"> 2353</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NULLABLE allocator);</div>
-<div class="line"><a name="l02354"></a><span class="lineno"> 2354</span>&#160; </div>
-<div class="line"><a name="l02357"></a><span class="lineno"><a class="line" href="struct_vma_allocator_info.html"> 2357</a></span>&#160;typedef struct <a class="code" href="struct_vma_allocator_info.html">VmaAllocatorInfo</a></div>
-<div class="line"><a name="l02358"></a><span class="lineno"> 2358</span>&#160;{</div>
-<div class="line"><a name="l02363"></a><span class="lineno"><a class="line" href="struct_vma_allocator_info.html#a2ed6a4d2d3fea039d66a13f15d0ce5fe"> 2363</a></span>&#160;    VkInstance VMA_NOT_NULL <a class="code" href="struct_vma_allocator_info.html#a2ed6a4d2d3fea039d66a13f15d0ce5fe">instance</a>;</div>
-<div class="line"><a name="l02368"></a><span class="lineno"><a class="line" href="struct_vma_allocator_info.html#aba2b703f96e51d567717e1fb2935b47a"> 2368</a></span>&#160;    VkPhysicalDevice VMA_NOT_NULL <a class="code" href="struct_vma_allocator_info.html#aba2b703f96e51d567717e1fb2935b47a">physicalDevice</a>;</div>
-<div class="line"><a name="l02373"></a><span class="lineno"><a class="line" href="struct_vma_allocator_info.html#a012b4c485bf3b0ea8921352c5ee0c357"> 2373</a></span>&#160;    VkDevice VMA_NOT_NULL <a class="code" href="struct_vma_allocator_info.html#a012b4c485bf3b0ea8921352c5ee0c357">device</a>;</div>
-<div class="line"><a name="l02374"></a><span class="lineno"> 2374</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a1988031b0223fdbd564250fa1edd942c">VmaAllocatorInfo</a>;</div>
-<div class="line"><a name="l02375"></a><span class="lineno"> 2375</span>&#160; </div>
-<div class="line"><a name="l02381"></a><span class="lineno"> 2381</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7">vmaGetAllocatorInfo</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator, <a class="code" href="struct_vma_allocator_info.html">VmaAllocatorInfo</a>* VMA_NOT_NULL pAllocatorInfo);</div>
-<div class="line"><a name="l02382"></a><span class="lineno"> 2382</span>&#160; </div>
-<div class="line"><a name="l02387"></a><span class="lineno"> 2387</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0">vmaGetPhysicalDeviceProperties</a>(</div>
-<div class="line"><a name="l02388"></a><span class="lineno"> 2388</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02389"></a><span class="lineno"> 2389</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceProperties* VMA_NULLABLE * VMA_NOT_NULL ppPhysicalDeviceProperties);</div>
-<div class="line"><a name="l02390"></a><span class="lineno"> 2390</span>&#160; </div>
-<div class="line"><a name="l02395"></a><span class="lineno"> 2395</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19">vmaGetMemoryProperties</a>(</div>
-<div class="line"><a name="l02396"></a><span class="lineno"> 2396</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02397"></a><span class="lineno"> 2397</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceMemoryProperties* VMA_NULLABLE * VMA_NOT_NULL ppPhysicalDeviceMemoryProperties);</div>
-<div class="line"><a name="l02398"></a><span class="lineno"> 2398</span>&#160; </div>
-<div class="line"><a name="l02405"></a><span class="lineno"> 2405</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca">vmaGetMemoryTypeProperties</a>(</div>
-<div class="line"><a name="l02406"></a><span class="lineno"> 2406</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02407"></a><span class="lineno"> 2407</span>&#160;    uint32_t memoryTypeIndex,</div>
-<div class="line"><a name="l02408"></a><span class="lineno"> 2408</span>&#160;    VkMemoryPropertyFlags* VMA_NOT_NULL pFlags);</div>
-<div class="line"><a name="l02409"></a><span class="lineno"> 2409</span>&#160; </div>
-<div class="line"><a name="l02418"></a><span class="lineno"> 2418</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236">vmaSetCurrentFrameIndex</a>(</div>
-<div class="line"><a name="l02419"></a><span class="lineno"> 2419</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02420"></a><span class="lineno"> 2420</span>&#160;    uint32_t frameIndex);</div>
-<div class="line"><a name="l02421"></a><span class="lineno"> 2421</span>&#160; </div>
-<div class="line"><a name="l02424"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html"> 2424</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a></div>
-<div class="line"><a name="l02425"></a><span class="lineno"> 2425</span>&#160;{</div>
-<div class="line"><a name="l02427"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4"> 2427</a></span>&#160;    uint32_t <a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a>;</div>
-<div class="line"><a name="l02429"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff"> 2429</a></span>&#160;    uint32_t <a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>;</div>
-<div class="line"><a name="l02431"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9"> 2431</a></span>&#160;    uint32_t <a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
-<div class="line"><a name="l02433"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a"> 2433</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a>;</div>
-<div class="line"><a name="l02435"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669"> 2435</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>;</div>
-<div class="line"><a name="l02436"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea"> 2436</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, allocationSizeAvg, allocationSizeMax;</div>
-<div class="line"><a name="l02437"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4"> 2437</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSizeAvg, unusedRangeSizeMax;</div>
-<div class="line"><a name="l02438"></a><span class="lineno"> 2438</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#aec5b57e29c97b5d69c6d5654d60df878">VmaStatInfo</a>;</div>
-<div class="line"><a name="l02439"></a><span class="lineno"> 2439</span>&#160; </div>
-<div class="line"><a name="l02441"></a><span class="lineno"><a class="line" href="struct_vma_stats.html"> 2441</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_stats.html">VmaStats</a></div>
-<div class="line"><a name="l02442"></a><span class="lineno"> 2442</span>&#160;{</div>
-<div class="line"><a name="l02443"></a><span class="lineno"><a class="line" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331"> 2443</a></span>&#160;    <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> memoryType[VK_MAX_MEMORY_TYPES];</div>
-<div class="line"><a name="l02444"></a><span class="lineno"><a class="line" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0"> 2444</a></span>&#160;    <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> memoryHeap[VK_MAX_MEMORY_HEAPS];</div>
-<div class="line"><a name="l02445"></a><span class="lineno"><a class="line" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9"> 2445</a></span>&#160;    <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> <a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>;</div>
-<div class="line"><a name="l02446"></a><span class="lineno"> 2446</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a21813b2efdf3836767a9058cd8a94034">VmaStats</a>;</div>
-<div class="line"><a name="l02447"></a><span class="lineno"> 2447</span>&#160; </div>
-<div class="line"><a name="l02457"></a><span class="lineno"> 2457</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3">vmaCalculateStats</a>(</div>
-<div class="line"><a name="l02458"></a><span class="lineno"> 2458</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02459"></a><span class="lineno"> 2459</span>&#160;    <a class="code" href="struct_vma_stats.html">VmaStats</a>* VMA_NOT_NULL pStats);</div>
-<div class="line"><a name="l02460"></a><span class="lineno"> 2460</span>&#160; </div>
-<div class="line"><a name="l02463"></a><span class="lineno"><a class="line" href="struct_vma_budget.html"> 2463</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_budget.html">VmaBudget</a></div>
-<div class="line"><a name="l02464"></a><span class="lineno"> 2464</span>&#160;{</div>
-<div class="line"><a name="l02467"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0"> 2467</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a>;</div>
-<div class="line"><a name="l02468"></a><span class="lineno"> 2468</span>&#160;    </div>
-<div class="line"><a name="l02478"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8"> 2478</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8">allocationBytes</a>;</div>
-<div class="line"><a name="l02479"></a><span class="lineno"> 2479</span>&#160;    </div>
-<div class="line"><a name="l02488"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6"> 2488</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a>;</div>
-<div class="line"><a name="l02489"></a><span class="lineno"> 2489</span>&#160;    </div>
-<div class="line"><a name="l02499"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd"> 2499</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a>;</div>
-<div class="line"><a name="l02500"></a><span class="lineno"> 2500</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#aa078667e71b1ef24e87a6a30d128381d">VmaBudget</a>;</div>
-<div class="line"><a name="l02501"></a><span class="lineno"> 2501</span>&#160; </div>
-<div class="line"><a name="l02512"></a><span class="lineno"> 2512</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba">vmaGetBudget</a>(</div>
-<div class="line"><a name="l02513"></a><span class="lineno"> 2513</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02514"></a><span class="lineno"> 2514</span>&#160;    <a class="code" href="struct_vma_budget.html">VmaBudget</a>* VMA_NOT_NULL pBudget);</div>
-<div class="line"><a name="l02515"></a><span class="lineno"> 2515</span>&#160; </div>
-<div class="line"><a name="l02516"></a><span class="lineno"> 2516</span>&#160;<span class="preprocessor">#ifndef VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l02517"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ae25f0d55fd91cb166f002b63244800e1"> 2517</a></span>&#160;<span class="preprocessor">#define VMA_STATS_STRING_ENABLED 1</span></div>
-<div class="line"><a name="l02518"></a><span class="lineno"> 2518</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l02519"></a><span class="lineno"> 2519</span>&#160; </div>
-<div class="line"><a name="l02520"></a><span class="lineno"> 2520</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l02521"></a><span class="lineno"> 2521</span>&#160; </div>
-<div class="line"><a name="l02523"></a><span class="lineno"> 2523</span>&#160; </div>
-<div class="line"><a name="l02525"></a><span class="lineno"> 2525</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0">vmaBuildStatsString</a>(</div>
-<div class="line"><a name="l02526"></a><span class="lineno"> 2526</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02527"></a><span class="lineno"> 2527</span>&#160;    <span class="keywordtype">char</span>* VMA_NULLABLE * VMA_NOT_NULL ppStatsString,</div>
-<div class="line"><a name="l02528"></a><span class="lineno"> 2528</span>&#160;    VkBool32 detailedMap);</div>
-<div class="line"><a name="l02529"></a><span class="lineno"> 2529</span>&#160; </div>
-<div class="line"><a name="l02530"></a><span class="lineno"> 2530</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288">vmaFreeStatsString</a>(</div>
-<div class="line"><a name="l02531"></a><span class="lineno"> 2531</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02532"></a><span class="lineno"> 2532</span>&#160;    <span class="keywordtype">char</span>* VMA_NULLABLE pStatsString);</div>
-<div class="line"><a name="l02533"></a><span class="lineno"> 2533</span>&#160; </div>
-<div class="line"><a name="l02534"></a><span class="lineno"> 2534</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l02535"></a><span class="lineno"> 2535</span>&#160; </div>
-<div class="line"><a name="l02544"></a><span class="lineno"> 2544</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_pool.html">VmaPool</a>)</div>
-<div class="line"><a name="l02545"></a><span class="lineno"> 2545</span>&#160; </div>
-<div class="line"><a name="l02546"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc"> 2546</a></span>&#160;typedef enum <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a></div>
-<div class="line"><a name="l02547"></a><span class="lineno"> 2547</span>&#160;{</div>
-<div class="line"><a name="l02551"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd"> 2551</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd">VMA_MEMORY_USAGE_UNKNOWN</a> = 0,</div>
-<div class="line"><a name="l02568"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"> 2568</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a> = 1,</div>
-<div class="line"><a name="l02578"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5"> 2578</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a> = 2,</div>
-<div class="line"><a name="l02585"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67"> 2585</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67">VMA_MEMORY_USAGE_CPU_TO_GPU</a> = 3,</div>
-<div class="line"><a name="l02594"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27"> 2594</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27">VMA_MEMORY_USAGE_GPU_TO_CPU</a> = 4,</div>
-<div class="line"><a name="l02600"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500"> 2600</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500">VMA_MEMORY_USAGE_CPU_COPY</a> = 5,</div>
-<div class="line"><a name="l02608"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d"> 2608</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d">VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED</a> = 6,</div>
-<div class="line"><a name="l02609"></a><span class="lineno"> 2609</span>&#160; </div>
-<div class="line"><a name="l02610"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e"> 2610</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e">VMA_MEMORY_USAGE_MAX_ENUM</a> = 0x7FFFFFFF</div>
-<div class="line"><a name="l02611"></a><span class="lineno"> 2611</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a>;</div>
-<div class="line"><a name="l02612"></a><span class="lineno"> 2612</span>&#160; </div>
-<div class="line"><a name="l02614"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597"> 2614</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597">VmaAllocationCreateFlagBits</a> {</div>
-<div class="line"><a name="l02621"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f"> 2621</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a> = 0x00000001,</div>
-<div class="line"><a name="l02622"></a><span class="lineno"> 2622</span>&#160; </div>
-<div class="line"><a name="l02632"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff"> 2632</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a> = 0x00000002,</div>
-<div class="line"><a name="l02645"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"> 2645</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a> = 0x00000004,</div>
-<div class="line"><a name="l02658"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2"> 2658</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a> = 0x00000008,</div>
-<div class="line"><a name="l02665"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e"> 2665</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a> = 0x00000010,</div>
-<div class="line"><a name="l02671"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520"> 2671</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a> = 0x00000020,</div>
-<div class="line"><a name="l02676"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df"> 2676</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a> = 0x00000040,</div>
-<div class="line"><a name="l02682"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea"> 2682</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea">VMA_ALLOCATION_CREATE_DONT_BIND_BIT</a> = 0x00000080,</div>
-<div class="line"><a name="l02686"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d"> 2686</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d">VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT</a> = 0x00000100,</div>
-<div class="line"><a name="l02687"></a><span class="lineno"> 2687</span>&#160; </div>
-<div class="line"><a name="l02691"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d"> 2691</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>  = 0x00010000,</div>
-<div class="line"><a name="l02695"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62"> 2695</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a> = 0x00020000,</div>
-<div class="line"><a name="l02702"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777"> 2702</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a> = 0x00040000,</div>
-<div class="line"><a name="l02703"></a><span class="lineno"> 2703</span>&#160; </div>
-<div class="line"><a name="l02706"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d"> 2706</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT</a> = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>,</div>
-<div class="line"><a name="l02709"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d"> 2709</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT</a> = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>,</div>
-<div class="line"><a name="l02712"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706"> 2712</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706">VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT</a> = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a>,</div>
-<div class="line"><a name="l02713"></a><span class="lineno"> 2713</span>&#160; </div>
-<div class="line"><a name="l02716"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e"> 2716</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e">VMA_ALLOCATION_CREATE_STRATEGY_MASK</a> =</div>
-<div class="line"><a name="l02717"></a><span class="lineno"> 2717</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a> |</div>
-<div class="line"><a name="l02718"></a><span class="lineno"> 2718</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a> |</div>
-<div class="line"><a name="l02719"></a><span class="lineno"> 2719</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>,</div>
-<div class="line"><a name="l02720"></a><span class="lineno"> 2720</span>&#160; </div>
-<div class="line"><a name="l02721"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882"> 2721</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882">VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
-<div class="line"><a name="l02722"></a><span class="lineno"> 2722</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597">VmaAllocationCreateFlagBits</a>;</div>
-<div class="line"><a name="l02723"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817"> 2723</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a>;</div>
-<div class="line"><a name="l02724"></a><span class="lineno"> 2724</span>&#160; </div>
-<div class="line"><a name="l02725"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html"> 2725</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div>
-<div class="line"><a name="l02726"></a><span class="lineno"> 2726</span>&#160;{</div>
-<div class="line"><a name="l02728"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b"> 2728</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> <a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>;</div>
-<div class="line"><a name="l02734"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910"> 2734</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a> <a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>;</div>
-<div class="line"><a name="l02739"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90"> 2739</a></span>&#160;    VkMemoryPropertyFlags <a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>;</div>
-<div class="line"><a name="l02744"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d"> 2744</a></span>&#160;    VkMemoryPropertyFlags <a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>;</div>
-<div class="line"><a name="l02752"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055"> 2752</a></span>&#160;    uint32_t <a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>;</div>
-<div class="line"><a name="l02758"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150"> 2758</a></span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NULLABLE <a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>;</div>
-<div class="line"><a name="l02765"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19"> 2765</a></span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE <a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>;</div>
-<div class="line"><a name="l02766"></a><span class="lineno"> 2766</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a3bf110892ea2fb4649fedb68488d026a">VmaAllocationCreateInfo</a>;</div>
-<div class="line"><a name="l02767"></a><span class="lineno"> 2767</span>&#160; </div>
-<div class="line"><a name="l02784"></a><span class="lineno"> 2784</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(</div>
-<div class="line"><a name="l02785"></a><span class="lineno"> 2785</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02786"></a><span class="lineno"> 2786</span>&#160;    uint32_t memoryTypeBits,</div>
-<div class="line"><a name="l02787"></a><span class="lineno"> 2787</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pAllocationCreateInfo,</div>
-<div class="line"><a name="l02788"></a><span class="lineno"> 2788</span>&#160;    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);</div>
-<div class="line"><a name="l02789"></a><span class="lineno"> 2789</span>&#160; </div>
-<div class="line"><a name="l02802"></a><span class="lineno"> 2802</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888">vmaFindMemoryTypeIndexForBufferInfo</a>(</div>
-<div class="line"><a name="l02803"></a><span class="lineno"> 2803</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02804"></a><span class="lineno"> 2804</span>&#160;    <span class="keyword">const</span> VkBufferCreateInfo* VMA_NOT_NULL pBufferCreateInfo,</div>
-<div class="line"><a name="l02805"></a><span class="lineno"> 2805</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pAllocationCreateInfo,</div>
-<div class="line"><a name="l02806"></a><span class="lineno"> 2806</span>&#160;    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);</div>
-<div class="line"><a name="l02807"></a><span class="lineno"> 2807</span>&#160; </div>
-<div class="line"><a name="l02820"></a><span class="lineno"> 2820</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472">vmaFindMemoryTypeIndexForImageInfo</a>(</div>
-<div class="line"><a name="l02821"></a><span class="lineno"> 2821</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02822"></a><span class="lineno"> 2822</span>&#160;    <span class="keyword">const</span> VkImageCreateInfo* VMA_NOT_NULL pImageCreateInfo,</div>
-<div class="line"><a name="l02823"></a><span class="lineno"> 2823</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pAllocationCreateInfo,</div>
-<div class="line"><a name="l02824"></a><span class="lineno"> 2824</span>&#160;    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);</div>
-<div class="line"><a name="l02825"></a><span class="lineno"> 2825</span>&#160; </div>
-<div class="line"><a name="l02827"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7"> 2827</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7">VmaPoolCreateFlagBits</a> {</div>
-<div class="line"><a name="l02845"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2"> 2845</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2">VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT</a> = 0x00000002,</div>
-<div class="line"><a name="l02846"></a><span class="lineno"> 2846</span>&#160; </div>
-<div class="line"><a name="l02862"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726"> 2862</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a> = 0x00000004,</div>
-<div class="line"><a name="l02863"></a><span class="lineno"> 2863</span>&#160; </div>
-<div class="line"><a name="l02873"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e"> 2873</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a> = 0x00000008,</div>
-<div class="line"><a name="l02874"></a><span class="lineno"> 2874</span>&#160; </div>
-<div class="line"><a name="l02877"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c"> 2877</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c">VMA_POOL_CREATE_ALGORITHM_MASK</a> =</div>
-<div class="line"><a name="l02878"></a><span class="lineno"> 2878</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a> |</div>
-<div class="line"><a name="l02879"></a><span class="lineno"> 2879</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a>,</div>
-<div class="line"><a name="l02880"></a><span class="lineno"> 2880</span>&#160; </div>
-<div class="line"><a name="l02881"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec"> 2881</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec">VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
-<div class="line"><a name="l02882"></a><span class="lineno"> 2882</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7">VmaPoolCreateFlagBits</a>;</div>
-<div class="line"><a name="l02883"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a"> 2883</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a">VmaPoolCreateFlags</a>;</div>
-<div class="line"><a name="l02884"></a><span class="lineno"> 2884</span>&#160; </div>
-<div class="line"><a name="l02887"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html"> 2887</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a> {</div>
-<div class="line"><a name="l02890"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319"> 2890</a></span>&#160;    uint32_t <a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a>;</div>
-<div class="line"><a name="l02893"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446"> 2893</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a">VmaPoolCreateFlags</a> <a class="code" href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446">flags</a>;</div>
-<div class="line"><a name="l02902"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676"> 2902</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676">blockSize</a>;</div>
-<div class="line"><a name="l02907"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae"> 2907</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae">minBlockCount</a>;</div>
-<div class="line"><a name="l02915"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c"> 2915</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">maxBlockCount</a>;</div>
-<div class="line"><a name="l02929"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa"> 2929</a></span>&#160;    uint32_t <a class="code" href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa">frameInUseCount</a>;</div>
-<div class="line"><a name="l02930"></a><span class="lineno"> 2930</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a1017aa83489c0eee8d2163d2bf253f67">VmaPoolCreateInfo</a>;</div>
-<div class="line"><a name="l02931"></a><span class="lineno"> 2931</span>&#160; </div>
-<div class="line"><a name="l02934"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html"> 2934</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a> {</div>
-<div class="line"><a name="l02937"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c"> 2937</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a>;</div>
-<div class="line"><a name="l02940"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8"> 2940</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a>;</div>
-<div class="line"><a name="l02943"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb"> 2943</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a>;</div>
-<div class="line"><a name="l02946"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4"> 2946</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
-<div class="line"><a name="l02953"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b"> 2953</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>;</div>
-<div class="line"><a name="l02956"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7"> 2956</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7">blockCount</a>;</div>
-<div class="line"><a name="l02957"></a><span class="lineno"> 2957</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a4759a2d9f99c19ba7627553c847132f1">VmaPoolStats</a>;</div>
-<div class="line"><a name="l02958"></a><span class="lineno"> 2958</span>&#160; </div>
-<div class="line"><a name="l02965"></a><span class="lineno"> 2965</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5c8770ded7c59c8caac6de0c2cb00b50">vmaCreatePool</a>(</div>
-<div class="line"><a name="l02966"></a><span class="lineno"> 2966</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02967"></a><span class="lineno"> 2967</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>* VMA_NOT_NULL pCreateInfo,</div>
-<div class="line"><a name="l02968"></a><span class="lineno"> 2968</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NULLABLE * VMA_NOT_NULL pPool);</div>
-<div class="line"><a name="l02969"></a><span class="lineno"> 2969</span>&#160; </div>
-<div class="line"><a name="l02972"></a><span class="lineno"> 2972</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5485779c8f1948238fc4e92232fa65e1">vmaDestroyPool</a>(</div>
-<div class="line"><a name="l02973"></a><span class="lineno"> 2973</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02974"></a><span class="lineno"> 2974</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NULLABLE pool);</div>
-<div class="line"><a name="l02975"></a><span class="lineno"> 2975</span>&#160; </div>
-<div class="line"><a name="l02982"></a><span class="lineno"> 2982</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153">vmaGetPoolStats</a>(</div>
-<div class="line"><a name="l02983"></a><span class="lineno"> 2983</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02984"></a><span class="lineno"> 2984</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL pool,</div>
-<div class="line"><a name="l02985"></a><span class="lineno"> 2985</span>&#160;    <a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* VMA_NOT_NULL pPoolStats);</div>
-<div class="line"><a name="l02986"></a><span class="lineno"> 2986</span>&#160; </div>
-<div class="line"><a name="l02993"></a><span class="lineno"> 2993</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024">vmaMakePoolAllocationsLost</a>(</div>
-<div class="line"><a name="l02994"></a><span class="lineno"> 2994</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l02995"></a><span class="lineno"> 2995</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL pool,</div>
-<div class="line"><a name="l02996"></a><span class="lineno"> 2996</span>&#160;    <span class="keywordtype">size_t</span>* VMA_NULLABLE pLostAllocationCount);</div>
-<div class="line"><a name="l02997"></a><span class="lineno"> 2997</span>&#160; </div>
-<div class="line"><a name="l03012"></a><span class="lineno"> 3012</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad535935619c7a549bf837e1bb0068f89">vmaCheckPoolCorruption</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator, <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL pool);</div>
-<div class="line"><a name="l03013"></a><span class="lineno"> 3013</span>&#160; </div>
-<div class="line"><a name="l03020"></a><span class="lineno"> 3020</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030">vmaGetPoolName</a>(</div>
-<div class="line"><a name="l03021"></a><span class="lineno"> 3021</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03022"></a><span class="lineno"> 3022</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL pool,</div>
-<div class="line"><a name="l03023"></a><span class="lineno"> 3023</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* VMA_NULLABLE * VMA_NOT_NULL ppName);</div>
-<div class="line"><a name="l03024"></a><span class="lineno"> 3024</span>&#160; </div>
-<div class="line"><a name="l03030"></a><span class="lineno"> 3030</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58">vmaSetPoolName</a>(</div>
-<div class="line"><a name="l03031"></a><span class="lineno"> 3031</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03032"></a><span class="lineno"> 3032</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL pool,</div>
-<div class="line"><a name="l03033"></a><span class="lineno"> 3033</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* VMA_NULLABLE pName);</div>
-<div class="line"><a name="l03034"></a><span class="lineno"> 3034</span>&#160; </div>
-<div class="line"><a name="l03059"></a><span class="lineno"> 3059</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>)</div>
-<div class="line"><a name="l03060"></a><span class="lineno"> 3060</span>&#160; </div>
+<div class="line"><a name="l01890"></a><span class="lineno"> 1890</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l01891"></a><span class="lineno"> 1891</span>&#160;<span class="comment">Define this macro to 0/1 to disable/enable support for recording functionality,</span></div>
+<div class="line"><a name="l01892"></a><span class="lineno"> 1892</span>&#160;<span class="comment">available through VmaAllocatorCreateInfo::pRecordSettings.</span></div>
+<div class="line"><a name="l01893"></a><span class="lineno"> 1893</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l01894"></a><span class="lineno"> 1894</span>&#160;<span class="preprocessor">#ifndef VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l01895"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a1f0c126759fc96ccb6e2d23c101d770c"> 1895</a></span>&#160;<span class="preprocessor">    #define VMA_RECORDING_ENABLED 0</span></div>
+<div class="line"><a name="l01896"></a><span class="lineno"> 1896</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l01897"></a><span class="lineno"> 1897</span>&#160; </div>
+<div class="line"><a name="l01898"></a><span class="lineno"> 1898</span>&#160;<span class="preprocessor">#ifndef NOMINMAX</span></div>
+<div class="line"><a name="l01899"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9f918755b601cf4bffca775992e6fb90"> 1899</a></span>&#160;<span class="preprocessor">    #define NOMINMAX // For windows.h</span></div>
+<div class="line"><a name="l01900"></a><span class="lineno"> 1900</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l01901"></a><span class="lineno"> 1901</span>&#160; </div>
+<div class="line"><a name="l01902"></a><span class="lineno"> 1902</span>&#160;<span class="preprocessor">#if defined(__ANDROID__) &amp;&amp; defined(VK_NO_PROTOTYPES) &amp;&amp; VMA_STATIC_VULKAN_FUNCTIONS</span></div>
+<div class="line"><a name="l01903"></a><span class="lineno"> 1903</span>&#160;    <span class="keyword">extern</span> PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;</div>
+<div class="line"><a name="l01904"></a><span class="lineno"> 1904</span>&#160;    <span class="keyword">extern</span> PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;</div>
+<div class="line"><a name="l01905"></a><span class="lineno"> 1905</span>&#160;    <span class="keyword">extern</span> PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;</div>
+<div class="line"><a name="l01906"></a><span class="lineno"> 1906</span>&#160;    <span class="keyword">extern</span> PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;</div>
+<div class="line"><a name="l01907"></a><span class="lineno"> 1907</span>&#160;    <span class="keyword">extern</span> PFN_vkAllocateMemory vkAllocateMemory;</div>
+<div class="line"><a name="l01908"></a><span class="lineno"> 1908</span>&#160;    <span class="keyword">extern</span> PFN_vkFreeMemory vkFreeMemory;</div>
+<div class="line"><a name="l01909"></a><span class="lineno"> 1909</span>&#160;    <span class="keyword">extern</span> PFN_vkMapMemory vkMapMemory;</div>
+<div class="line"><a name="l01910"></a><span class="lineno"> 1910</span>&#160;    <span class="keyword">extern</span> PFN_vkUnmapMemory vkUnmapMemory;</div>
+<div class="line"><a name="l01911"></a><span class="lineno"> 1911</span>&#160;    <span class="keyword">extern</span> PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;</div>
+<div class="line"><a name="l01912"></a><span class="lineno"> 1912</span>&#160;    <span class="keyword">extern</span> PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges;</div>
+<div class="line"><a name="l01913"></a><span class="lineno"> 1913</span>&#160;    <span class="keyword">extern</span> PFN_vkBindBufferMemory vkBindBufferMemory;</div>
+<div class="line"><a name="l01914"></a><span class="lineno"> 1914</span>&#160;    <span class="keyword">extern</span> PFN_vkBindImageMemory vkBindImageMemory;</div>
+<div class="line"><a name="l01915"></a><span class="lineno"> 1915</span>&#160;    <span class="keyword">extern</span> PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;</div>
+<div class="line"><a name="l01916"></a><span class="lineno"> 1916</span>&#160;    <span class="keyword">extern</span> PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;</div>
+<div class="line"><a name="l01917"></a><span class="lineno"> 1917</span>&#160;    <span class="keyword">extern</span> PFN_vkCreateBuffer vkCreateBuffer;</div>
+<div class="line"><a name="l01918"></a><span class="lineno"> 1918</span>&#160;    <span class="keyword">extern</span> PFN_vkDestroyBuffer vkDestroyBuffer;</div>
+<div class="line"><a name="l01919"></a><span class="lineno"> 1919</span>&#160;    <span class="keyword">extern</span> PFN_vkCreateImage vkCreateImage;</div>
+<div class="line"><a name="l01920"></a><span class="lineno"> 1920</span>&#160;    <span class="keyword">extern</span> PFN_vkDestroyImage vkDestroyImage;</div>
+<div class="line"><a name="l01921"></a><span class="lineno"> 1921</span>&#160;    <span class="keyword">extern</span> PFN_vkCmdCopyBuffer vkCmdCopyBuffer;</div>
+<div class="line"><a name="l01922"></a><span class="lineno"> 1922</span>&#160;<span class="preprocessor">    #if VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l01923"></a><span class="lineno"> 1923</span>&#160;        <span class="keyword">extern</span> PFN_vkGetBufferMemoryRequirements2 vkGetBufferMemoryRequirements2;</div>
+<div class="line"><a name="l01924"></a><span class="lineno"> 1924</span>&#160;        <span class="keyword">extern</span> PFN_vkGetImageMemoryRequirements2 vkGetImageMemoryRequirements2;</div>
+<div class="line"><a name="l01925"></a><span class="lineno"> 1925</span>&#160;        <span class="keyword">extern</span> PFN_vkBindBufferMemory2 vkBindBufferMemory2;</div>
+<div class="line"><a name="l01926"></a><span class="lineno"> 1926</span>&#160;        <span class="keyword">extern</span> PFN_vkBindImageMemory2 vkBindImageMemory2;</div>
+<div class="line"><a name="l01927"></a><span class="lineno"> 1927</span>&#160;        <span class="keyword">extern</span> PFN_vkGetPhysicalDeviceMemoryProperties2 vkGetPhysicalDeviceMemoryProperties2;</div>
+<div class="line"><a name="l01928"></a><span class="lineno"> 1928</span>&#160;<span class="preprocessor">    #endif // #if VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l01929"></a><span class="lineno"> 1929</span>&#160;<span class="preprocessor">#endif // #if defined(__ANDROID__) &amp;&amp; VMA_STATIC_VULKAN_FUNCTIONS &amp;&amp; VK_NO_PROTOTYPES</span></div>
+<div class="line"><a name="l01930"></a><span class="lineno"> 1930</span>&#160; </div>
+<div class="line"><a name="l01931"></a><span class="lineno"> 1931</span>&#160;<span class="preprocessor">#ifndef VULKAN_H_</span></div>
+<div class="line"><a name="l01932"></a><span class="lineno"> 1932</span>&#160;<span class="preprocessor">    #include &lt;vulkan/vulkan.h&gt;</span></div>
+<div class="line"><a name="l01933"></a><span class="lineno"> 1933</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l01934"></a><span class="lineno"> 1934</span>&#160; </div>
+<div class="line"><a name="l01935"></a><span class="lineno"> 1935</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l01936"></a><span class="lineno"> 1936</span>&#160;<span class="preprocessor">    #if defined(_WIN32)</span></div>
+<div class="line"><a name="l01937"></a><span class="lineno"> 1937</span>&#160;<span class="preprocessor">        #include &lt;windows.h&gt;</span></div>
+<div class="line"><a name="l01938"></a><span class="lineno"> 1938</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l01939"></a><span class="lineno"> 1939</span>&#160;<span class="preprocessor">        #error VMA Recording functionality is not yet available for non-Windows platforms</span></div>
+<div class="line"><a name="l01940"></a><span class="lineno"> 1940</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l01941"></a><span class="lineno"> 1941</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l01942"></a><span class="lineno"> 1942</span>&#160; </div>
+<div class="line"><a name="l01943"></a><span class="lineno"> 1943</span>&#160;<span class="comment">// Define this macro to declare maximum supported Vulkan version in format AAABBBCCC,</span></div>
+<div class="line"><a name="l01944"></a><span class="lineno"> 1944</span>&#160;<span class="comment">// where AAA = major, BBB = minor, CCC = patch.</span></div>
+<div class="line"><a name="l01945"></a><span class="lineno"> 1945</span>&#160;<span class="comment">// If you want to use version &gt; 1.0, it still needs to be enabled via VmaAllocatorCreateInfo::vulkanApiVersion.</span></div>
+<div class="line"><a name="l01946"></a><span class="lineno"> 1946</span>&#160;<span class="preprocessor">#if !defined(VMA_VULKAN_VERSION)</span></div>
+<div class="line"><a name="l01947"></a><span class="lineno"> 1947</span>&#160;<span class="preprocessor">    #if defined(VK_VERSION_1_2)</span></div>
+<div class="line"><a name="l01948"></a><span class="lineno"> 1948</span>&#160;<span class="preprocessor">        #define VMA_VULKAN_VERSION 1002000</span></div>
+<div class="line"><a name="l01949"></a><span class="lineno"> 1949</span>&#160;<span class="preprocessor">    #elif defined(VK_VERSION_1_1)</span></div>
+<div class="line"><a name="l01950"></a><span class="lineno"> 1950</span>&#160;<span class="preprocessor">        #define VMA_VULKAN_VERSION 1001000</span></div>
+<div class="line"><a name="l01951"></a><span class="lineno"> 1951</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l01952"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a1a2407c283893638cc039bb31fcd74b6"> 1952</a></span>&#160;<span class="preprocessor">        #define VMA_VULKAN_VERSION 1000000</span></div>
+<div class="line"><a name="l01953"></a><span class="lineno"> 1953</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l01954"></a><span class="lineno"> 1954</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l01955"></a><span class="lineno"> 1955</span>&#160; </div>
+<div class="line"><a name="l01956"></a><span class="lineno"> 1956</span>&#160;<span class="preprocessor">#if !defined(VMA_DEDICATED_ALLOCATION)</span></div>
+<div class="line"><a name="l01957"></a><span class="lineno"> 1957</span>&#160;<span class="preprocessor">    #if VK_KHR_get_memory_requirements2 &amp;&amp; VK_KHR_dedicated_allocation</span></div>
+<div class="line"><a name="l01958"></a><span class="lineno"> 1958</span>&#160;<span class="preprocessor">        #define VMA_DEDICATED_ALLOCATION 1</span></div>
+<div class="line"><a name="l01959"></a><span class="lineno"> 1959</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l01960"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#af7b860e63b96d11e44ae8587ba06bbf4"> 1960</a></span>&#160;<span class="preprocessor">        #define VMA_DEDICATED_ALLOCATION 0</span></div>
+<div class="line"><a name="l01961"></a><span class="lineno"> 1961</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l01962"></a><span class="lineno"> 1962</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l01963"></a><span class="lineno"> 1963</span>&#160; </div>
+<div class="line"><a name="l01964"></a><span class="lineno"> 1964</span>&#160;<span class="preprocessor">#if !defined(VMA_BIND_MEMORY2)</span></div>
+<div class="line"><a name="l01965"></a><span class="lineno"> 1965</span>&#160;<span class="preprocessor">    #if VK_KHR_bind_memory2</span></div>
+<div class="line"><a name="l01966"></a><span class="lineno"> 1966</span>&#160;<span class="preprocessor">        #define VMA_BIND_MEMORY2 1</span></div>
+<div class="line"><a name="l01967"></a><span class="lineno"> 1967</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l01968"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a88bef97f86d70a34a4c0746e09a2680d"> 1968</a></span>&#160;<span class="preprocessor">        #define VMA_BIND_MEMORY2 0</span></div>
+<div class="line"><a name="l01969"></a><span class="lineno"> 1969</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l01970"></a><span class="lineno"> 1970</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l01971"></a><span class="lineno"> 1971</span>&#160; </div>
+<div class="line"><a name="l01972"></a><span class="lineno"> 1972</span>&#160;<span class="preprocessor">#if !defined(VMA_MEMORY_BUDGET)</span></div>
+<div class="line"><a name="l01973"></a><span class="lineno"> 1973</span>&#160;<span class="preprocessor">    #if VK_EXT_memory_budget &amp;&amp; (VK_KHR_get_physical_device_properties2 || VMA_VULKAN_VERSION &gt;= 1001000)</span></div>
+<div class="line"><a name="l01974"></a><span class="lineno"> 1974</span>&#160;<span class="preprocessor">        #define VMA_MEMORY_BUDGET 1</span></div>
+<div class="line"><a name="l01975"></a><span class="lineno"> 1975</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l01976"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a05decf1cf4ebf767beba7acca6c1ec3a"> 1976</a></span>&#160;<span class="preprocessor">        #define VMA_MEMORY_BUDGET 0</span></div>
+<div class="line"><a name="l01977"></a><span class="lineno"> 1977</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l01978"></a><span class="lineno"> 1978</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l01979"></a><span class="lineno"> 1979</span>&#160; </div>
+<div class="line"><a name="l01980"></a><span class="lineno"> 1980</span>&#160;<span class="comment">// Defined to 1 when VK_KHR_buffer_device_address device extension or equivalent core Vulkan 1.2 feature is defined in its headers.</span></div>
+<div class="line"><a name="l01981"></a><span class="lineno"> 1981</span>&#160;<span class="preprocessor">#if !defined(VMA_BUFFER_DEVICE_ADDRESS)</span></div>
+<div class="line"><a name="l01982"></a><span class="lineno"> 1982</span>&#160;<span class="preprocessor">    #if VK_KHR_buffer_device_address || VMA_VULKAN_VERSION &gt;= 1002000</span></div>
+<div class="line"><a name="l01983"></a><span class="lineno"> 1983</span>&#160;<span class="preprocessor">        #define VMA_BUFFER_DEVICE_ADDRESS 1</span></div>
+<div class="line"><a name="l01984"></a><span class="lineno"> 1984</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l01985"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a7f9d5e71b70dd1a137c303a8a8262c10"> 1985</a></span>&#160;<span class="preprocessor">        #define VMA_BUFFER_DEVICE_ADDRESS 0</span></div>
+<div class="line"><a name="l01986"></a><span class="lineno"> 1986</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l01987"></a><span class="lineno"> 1987</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l01988"></a><span class="lineno"> 1988</span>&#160; </div>
+<div class="line"><a name="l01989"></a><span class="lineno"> 1989</span>&#160;<span class="comment">// Define these macros to decorate all public functions with additional code,</span></div>
+<div class="line"><a name="l01990"></a><span class="lineno"> 1990</span>&#160;<span class="comment">// before and after returned type, appropriately. This may be useful for</span></div>
+<div class="line"><a name="l01991"></a><span class="lineno"> 1991</span>&#160;<span class="comment">// exporing the functions when compiling VMA as a separate library. Example:</span></div>
+<div class="line"><a name="l01992"></a><span class="lineno"> 1992</span>&#160;<span class="comment">// #define VMA_CALL_PRE  __declspec(dllexport)</span></div>
+<div class="line"><a name="l01993"></a><span class="lineno"> 1993</span>&#160;<span class="comment">// #define VMA_CALL_POST __cdecl</span></div>
+<div class="line"><a name="l01994"></a><span class="lineno"> 1994</span>&#160;<span class="preprocessor">#ifndef VMA_CALL_PRE</span></div>
+<div class="line"><a name="l01995"></a><span class="lineno"> 1995</span>&#160;<span class="preprocessor">    #define VMA_CALL_PRE</span></div>
+<div class="line"><a name="l01996"></a><span class="lineno"> 1996</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l01997"></a><span class="lineno"> 1997</span>&#160;<span class="preprocessor">#ifndef VMA_CALL_POST</span></div>
+<div class="line"><a name="l01998"></a><span class="lineno"> 1998</span>&#160;<span class="preprocessor">    #define VMA_CALL_POST</span></div>
+<div class="line"><a name="l01999"></a><span class="lineno"> 1999</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l02000"></a><span class="lineno"> 2000</span>&#160; </div>
+<div class="line"><a name="l02001"></a><span class="lineno"> 2001</span>&#160;<span class="comment">// Define this macro to decorate pointers with an attribute specifying the</span></div>
+<div class="line"><a name="l02002"></a><span class="lineno"> 2002</span>&#160;<span class="comment">// length of the array they point to if they are not null.</span></div>
+<div class="line"><a name="l02003"></a><span class="lineno"> 2003</span>&#160;<span class="comment">//</span></div>
+<div class="line"><a name="l02004"></a><span class="lineno"> 2004</span>&#160;<span class="comment">// The length may be one of</span></div>
+<div class="line"><a name="l02005"></a><span class="lineno"> 2005</span>&#160;<span class="comment">// - The name of another parameter in the argument list where the pointer is declared</span></div>
+<div class="line"><a name="l02006"></a><span class="lineno"> 2006</span>&#160;<span class="comment">// - The name of another member in the struct where the pointer is declared</span></div>
+<div class="line"><a name="l02007"></a><span class="lineno"> 2007</span>&#160;<span class="comment">// - The name of a member of a struct type, meaning the value of that member in</span></div>
+<div class="line"><a name="l02008"></a><span class="lineno"> 2008</span>&#160;<span class="comment">//   the context of the call. For example</span></div>
+<div class="line"><a name="l02009"></a><span class="lineno"> 2009</span>&#160;<span class="comment">//   VMA_LEN_IF_NOT_NULL(&quot;VkPhysicalDeviceMemoryProperties::memoryHeapCount&quot;),</span></div>
+<div class="line"><a name="l02010"></a><span class="lineno"> 2010</span>&#160;<span class="comment">//   this means the number of memory heaps available in the device associated</span></div>
+<div class="line"><a name="l02011"></a><span class="lineno"> 2011</span>&#160;<span class="comment">//   with the VmaAllocator being dealt with.</span></div>
+<div class="line"><a name="l02012"></a><span class="lineno"> 2012</span>&#160;<span class="preprocessor">#ifndef VMA_LEN_IF_NOT_NULL</span></div>
+<div class="line"><a name="l02013"></a><span class="lineno"> 2013</span>&#160;<span class="preprocessor">    #define VMA_LEN_IF_NOT_NULL(len)</span></div>
+<div class="line"><a name="l02014"></a><span class="lineno"> 2014</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l02015"></a><span class="lineno"> 2015</span>&#160; </div>
+<div class="line"><a name="l02016"></a><span class="lineno"> 2016</span>&#160;<span class="comment">// The VMA_NULLABLE macro is defined to be _Nullable when compiling with Clang.</span></div>
+<div class="line"><a name="l02017"></a><span class="lineno"> 2017</span>&#160;<span class="comment">// see: https://clang.llvm.org/docs/AttributeReference.html#nullable</span></div>
+<div class="line"><a name="l02018"></a><span class="lineno"> 2018</span>&#160;<span class="preprocessor">#ifndef VMA_NULLABLE</span></div>
+<div class="line"><a name="l02019"></a><span class="lineno"> 2019</span>&#160;<span class="preprocessor">    #ifdef __clang__</span></div>
+<div class="line"><a name="l02020"></a><span class="lineno"> 2020</span>&#160;<span class="preprocessor">        #define VMA_NULLABLE _Nullable</span></div>
+<div class="line"><a name="l02021"></a><span class="lineno"> 2021</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l02022"></a><span class="lineno"> 2022</span>&#160;<span class="preprocessor">        #define VMA_NULLABLE</span></div>
+<div class="line"><a name="l02023"></a><span class="lineno"> 2023</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l02024"></a><span class="lineno"> 2024</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l02025"></a><span class="lineno"> 2025</span>&#160; </div>
+<div class="line"><a name="l02026"></a><span class="lineno"> 2026</span>&#160;<span class="comment">// The VMA_NOT_NULL macro is defined to be _Nonnull when compiling with Clang.</span></div>
+<div class="line"><a name="l02027"></a><span class="lineno"> 2027</span>&#160;<span class="comment">// see: https://clang.llvm.org/docs/AttributeReference.html#nonnull</span></div>
+<div class="line"><a name="l02028"></a><span class="lineno"> 2028</span>&#160;<span class="preprocessor">#ifndef VMA_NOT_NULL</span></div>
+<div class="line"><a name="l02029"></a><span class="lineno"> 2029</span>&#160;<span class="preprocessor">    #ifdef __clang__</span></div>
+<div class="line"><a name="l02030"></a><span class="lineno"> 2030</span>&#160;<span class="preprocessor">        #define VMA_NOT_NULL _Nonnull</span></div>
+<div class="line"><a name="l02031"></a><span class="lineno"> 2031</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l02032"></a><span class="lineno"> 2032</span>&#160;<span class="preprocessor">        #define VMA_NOT_NULL</span></div>
+<div class="line"><a name="l02033"></a><span class="lineno"> 2033</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l02034"></a><span class="lineno"> 2034</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l02035"></a><span class="lineno"> 2035</span>&#160; </div>
+<div class="line"><a name="l02036"></a><span class="lineno"> 2036</span>&#160;<span class="comment">// If non-dispatchable handles are represented as pointers then we can give</span></div>
+<div class="line"><a name="l02037"></a><span class="lineno"> 2037</span>&#160;<span class="comment">// then nullability annotations</span></div>
+<div class="line"><a name="l02038"></a><span class="lineno"> 2038</span>&#160;<span class="preprocessor">#ifndef VMA_NOT_NULL_NON_DISPATCHABLE</span></div>
+<div class="line"><a name="l02039"></a><span class="lineno"> 2039</span>&#160;<span class="preprocessor">    #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) &amp;&amp; !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)</span></div>
+<div class="line"><a name="l02040"></a><span class="lineno"> 2040</span>&#160;<span class="preprocessor">        #define VMA_NOT_NULL_NON_DISPATCHABLE VMA_NOT_NULL</span></div>
+<div class="line"><a name="l02041"></a><span class="lineno"> 2041</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l02042"></a><span class="lineno"> 2042</span>&#160;<span class="preprocessor">        #define VMA_NOT_NULL_NON_DISPATCHABLE</span></div>
+<div class="line"><a name="l02043"></a><span class="lineno"> 2043</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l02044"></a><span class="lineno"> 2044</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l02045"></a><span class="lineno"> 2045</span>&#160; </div>
+<div class="line"><a name="l02046"></a><span class="lineno"> 2046</span>&#160;<span class="preprocessor">#ifndef VMA_NULLABLE_NON_DISPATCHABLE</span></div>
+<div class="line"><a name="l02047"></a><span class="lineno"> 2047</span>&#160;<span class="preprocessor">    #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) &amp;&amp; !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)</span></div>
+<div class="line"><a name="l02048"></a><span class="lineno"> 2048</span>&#160;<span class="preprocessor">        #define VMA_NULLABLE_NON_DISPATCHABLE VMA_NULLABLE</span></div>
+<div class="line"><a name="l02049"></a><span class="lineno"> 2049</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l02050"></a><span class="lineno"> 2050</span>&#160;<span class="preprocessor">        #define VMA_NULLABLE_NON_DISPATCHABLE</span></div>
+<div class="line"><a name="l02051"></a><span class="lineno"> 2051</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l02052"></a><span class="lineno"> 2052</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l02053"></a><span class="lineno"> 2053</span>&#160; </div>
+<div class="line"><a name="l02063"></a><span class="lineno"> 2063</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a>)</div>
+<div class="line"><a name="l02064"></a><span class="lineno"> 2064</span>&#160; </div>
+<div class="line"><a name="l02065"></a><span class="lineno"> 2065</span>&#160;<span class="keyword">typedef</span> void (VKAPI_PTR *<a class="code" href="vk__mem__alloc_8h.html#a7e1ed85f7799600b03ad51a77acc21f3">PFN_vmaAllocateDeviceMemoryFunction</a>)(</div>
+<div class="line"><a name="l02067"></a><span class="lineno"> 2067</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL                    allocator,</div>
+<div class="line"><a name="l02068"></a><span class="lineno"> 2068</span>&#160;    uint32_t                                     memoryType,</div>
+<div class="line"><a name="l02069"></a><span class="lineno"> 2069</span>&#160;    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,</div>
+<div class="line"><a name="l02070"></a><span class="lineno"> 2070</span>&#160;    VkDeviceSize                                 size,</div>
+<div class="line"><a name="l02071"></a><span class="lineno"> 2071</span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE                           pUserData);</div>
+<div class="line"><a name="l02073"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a154ccaaf53dc2c36378f80f0c4f3679b"> 2073</a></span>&#160;<span class="keyword">typedef</span> void (VKAPI_PTR *<a class="code" href="vk__mem__alloc_8h.html#a154ccaaf53dc2c36378f80f0c4f3679b">PFN_vmaFreeDeviceMemoryFunction</a>)(</div>
+<div class="line"><a name="l02074"></a><span class="lineno"> 2074</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL                    allocator,</div>
+<div class="line"><a name="l02075"></a><span class="lineno"> 2075</span>&#160;    uint32_t                                     memoryType,</div>
+<div class="line"><a name="l02076"></a><span class="lineno"> 2076</span>&#160;    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,</div>
+<div class="line"><a name="l02077"></a><span class="lineno"> 2077</span>&#160;    VkDeviceSize                                 size,</div>
+<div class="line"><a name="l02078"></a><span class="lineno"> 2078</span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE                           pUserData);</div>
+<div class="line"><a name="l02079"></a><span class="lineno"> 2079</span>&#160; </div>
+<div class="line"><a name="l02087"></a><span class="lineno"><a class="line" href="struct_vma_device_memory_callbacks.html"> 2087</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks</a> {</div>
+<div class="line"><a name="l02089"></a><span class="lineno"><a class="line" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb"> 2089</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a7e1ed85f7799600b03ad51a77acc21f3">PFN_vmaAllocateDeviceMemoryFunction</a> VMA_NULLABLE <a class="code" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">pfnAllocate</a>;</div>
+<div class="line"><a name="l02091"></a><span class="lineno"><a class="line" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c"> 2091</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a154ccaaf53dc2c36378f80f0c4f3679b">PFN_vmaFreeDeviceMemoryFunction</a> VMA_NULLABLE <a class="code" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">pfnFree</a>;</div>
+<div class="line"><a name="l02093"></a><span class="lineno"><a class="line" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6"> 2093</a></span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE <a class="code" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">pUserData</a>;</div>
+<div class="line"><a name="l02094"></a><span class="lineno"> 2094</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a77692d3c8770ea8882d573206bd27b2b">VmaDeviceMemoryCallbacks</a>;</div>
+<div class="line"><a name="l02095"></a><span class="lineno"> 2095</span>&#160; </div>
+<div class="line"><a name="l02097"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c"> 2097</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c">VmaAllocatorCreateFlagBits</a> {</div>
+<div class="line"><a name="l02102"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d"> 2102</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d">VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT</a> = 0x00000001,</div>
+<div class="line"><a name="l02127"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878"> 2127</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a> = 0x00000002,</div>
+<div class="line"><a name="l02142"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee"> 2142</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a> = 0x00000004,</div>
+<div class="line"><a name="l02154"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0"> 2154</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0">VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT</a> = 0x00000008,</div>
+<div class="line"><a name="l02172"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f"> 2172</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f">VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT</a> = 0x00000010,</div>
+<div class="line"><a name="l02190"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089"> 2190</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089">VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT</a> = 0x00000020,</div>
+<div class="line"><a name="l02191"></a><span class="lineno"> 2191</span>&#160; </div>
+<div class="line"><a name="l02192"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c"> 2192</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c">VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
+<div class="line"><a name="l02193"></a><span class="lineno"> 2193</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c">VmaAllocatorCreateFlagBits</a>;</div>
+<div class="line"><a name="l02194"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d"> 2194</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d">VmaAllocatorCreateFlags</a>;</div>
+<div class="line"><a name="l02195"></a><span class="lineno"> 2195</span>&#160; </div>
+<div class="line"><a name="l02200"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html"> 2200</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a> {</div>
+<div class="line"><a name="l02201"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a77b7a74082823e865dd6546623468f96"> 2201</a></span>&#160;    PFN_vkGetPhysicalDeviceProperties VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a77b7a74082823e865dd6546623468f96">vkGetPhysicalDeviceProperties</a>;</div>
+<div class="line"><a name="l02202"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a60d25c33bba06bb8592e6875cbaa9830"> 2202</a></span>&#160;    PFN_vkGetPhysicalDeviceMemoryProperties VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a60d25c33bba06bb8592e6875cbaa9830">vkGetPhysicalDeviceMemoryProperties</a>;</div>
+<div class="line"><a name="l02203"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c"> 2203</a></span>&#160;    PFN_vkAllocateMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c">vkAllocateMemory</a>;</div>
+<div class="line"><a name="l02204"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a4c658701778564d62034255b5dda91b4"> 2204</a></span>&#160;    PFN_vkFreeMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a4c658701778564d62034255b5dda91b4">vkFreeMemory</a>;</div>
+<div class="line"><a name="l02205"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#ab5c1f38dea3a2cf00dc9eb4f57218c49"> 2205</a></span>&#160;    PFN_vkMapMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#ab5c1f38dea3a2cf00dc9eb4f57218c49">vkMapMemory</a>;</div>
+<div class="line"><a name="l02206"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#acc798589736f0becb317fc2196c1d8b9"> 2206</a></span>&#160;    PFN_vkUnmapMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#acc798589736f0becb317fc2196c1d8b9">vkUnmapMemory</a>;</div>
+<div class="line"><a name="l02207"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a33c322f4c4ad2810f8a9c97a277572f9"> 2207</a></span>&#160;    PFN_vkFlushMappedMemoryRanges VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a33c322f4c4ad2810f8a9c97a277572f9">vkFlushMappedMemoryRanges</a>;</div>
+<div class="line"><a name="l02208"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a5c1093bc32386a8060c37c9f282078a1"> 2208</a></span>&#160;    PFN_vkInvalidateMappedMemoryRanges VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a5c1093bc32386a8060c37c9f282078a1">vkInvalidateMappedMemoryRanges</a>;</div>
+<div class="line"><a name="l02209"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2"> 2209</a></span>&#160;    PFN_vkBindBufferMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2">vkBindBufferMemory</a>;</div>
+<div class="line"><a name="l02210"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a1338d96a128a5ade648b8d934907c637"> 2210</a></span>&#160;    PFN_vkBindImageMemory VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a1338d96a128a5ade648b8d934907c637">vkBindImageMemory</a>;</div>
+<div class="line"><a name="l02211"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a5b92901df89a4194b0d12f6071d4d143"> 2211</a></span>&#160;    PFN_vkGetBufferMemoryRequirements VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a5b92901df89a4194b0d12f6071d4d143">vkGetBufferMemoryRequirements</a>;</div>
+<div class="line"><a name="l02212"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a475f6f49f8debe4d10800592606d53f4"> 2212</a></span>&#160;    PFN_vkGetImageMemoryRequirements VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a475f6f49f8debe4d10800592606d53f4">vkGetImageMemoryRequirements</a>;</div>
+<div class="line"><a name="l02213"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#ae8084315a25006271a2edfc3a447519f"> 2213</a></span>&#160;    PFN_vkCreateBuffer VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#ae8084315a25006271a2edfc3a447519f">vkCreateBuffer</a>;</div>
+<div class="line"><a name="l02214"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a7e054606faddb07f0e8556f3ed317d45"> 2214</a></span>&#160;    PFN_vkDestroyBuffer VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a7e054606faddb07f0e8556f3ed317d45">vkDestroyBuffer</a>;</div>
+<div class="line"><a name="l02215"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a23ebe70be515b9b5010a1d691200e325"> 2215</a></span>&#160;    PFN_vkCreateImage VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a23ebe70be515b9b5010a1d691200e325">vkCreateImage</a>;</div>
+<div class="line"><a name="l02216"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a90b898227039b1dcb3520f6e91f09ffa"> 2216</a></span>&#160;    PFN_vkDestroyImage VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#a90b898227039b1dcb3520f6e91f09ffa">vkDestroyImage</a>;</div>
+<div class="line"><a name="l02217"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#ae5c0db8c89a3b82593dc16aa6a49fa3a"> 2217</a></span>&#160;    PFN_vkCmdCopyBuffer VMA_NULLABLE <a class="code" href="struct_vma_vulkan_functions.html#ae5c0db8c89a3b82593dc16aa6a49fa3a">vkCmdCopyBuffer</a>;</div>
+<div class="line"><a name="l02218"></a><span class="lineno"> 2218</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l02219"></a><span class="lineno"> 2219</span>&#160;    PFN_vkGetBufferMemoryRequirements2KHR VMA_NULLABLE vkGetBufferMemoryRequirements2KHR;</div>
+<div class="line"><a name="l02220"></a><span class="lineno"> 2220</span>&#160;    PFN_vkGetImageMemoryRequirements2KHR VMA_NULLABLE vkGetImageMemoryRequirements2KHR;</div>
+<div class="line"><a name="l02221"></a><span class="lineno"> 2221</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l02222"></a><span class="lineno"> 2222</span>&#160;<span class="preprocessor">#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l02223"></a><span class="lineno"> 2223</span>&#160;    PFN_vkBindBufferMemory2KHR VMA_NULLABLE vkBindBufferMemory2KHR;</div>
+<div class="line"><a name="l02224"></a><span class="lineno"> 2224</span>&#160;    PFN_vkBindImageMemory2KHR VMA_NULLABLE vkBindImageMemory2KHR;</div>
+<div class="line"><a name="l02225"></a><span class="lineno"> 2225</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l02226"></a><span class="lineno"> 2226</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l02227"></a><span class="lineno"> 2227</span>&#160;    PFN_vkGetPhysicalDeviceMemoryProperties2KHR VMA_NULLABLE vkGetPhysicalDeviceMemoryProperties2KHR;</div>
+<div class="line"><a name="l02228"></a><span class="lineno"> 2228</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l02229"></a><span class="lineno"> 2229</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#abb0a8e3b5040d847571cca6c7f9a8074">VmaVulkanFunctions</a>;</div>
+<div class="line"><a name="l02230"></a><span class="lineno"> 2230</span>&#160; </div>
+<div class="line"><a name="l02232"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2"> 2232</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2">VmaRecordFlagBits</a> {</div>
+<div class="line"><a name="l02238"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7"> 2238</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7">VMA_RECORD_FLUSH_AFTER_CALL_BIT</a> = 0x00000001,</div>
+<div class="line"><a name="l02239"></a><span class="lineno"> 2239</span>&#160;    </div>
+<div class="line"><a name="l02240"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e"> 2240</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e">VMA_RECORD_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
+<div class="line"><a name="l02241"></a><span class="lineno"> 2241</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2">VmaRecordFlagBits</a>;</div>
+<div class="line"><a name="l02242"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828"> 2242</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828">VmaRecordFlags</a>;</div>
+<div class="line"><a name="l02243"></a><span class="lineno"> 2243</span>&#160; </div>
+<div class="line"><a name="l02245"></a><span class="lineno"><a class="line" href="struct_vma_record_settings.html"> 2245</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_record_settings.html">VmaRecordSettings</a></div>
+<div class="line"><a name="l02246"></a><span class="lineno"> 2246</span>&#160;{</div>
+<div class="line"><a name="l02248"></a><span class="lineno"><a class="line" href="struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a"> 2248</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828">VmaRecordFlags</a> <a class="code" href="struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a">flags</a>;</div>
+<div class="line"><a name="l02256"></a><span class="lineno"><a class="line" href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d"> 2256</a></span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* VMA_NOT_NULL <a class="code" href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d">pFilePath</a>;</div>
+<div class="line"><a name="l02257"></a><span class="lineno"> 2257</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a16e21c877101493fce582664cd8754fc">VmaRecordSettings</a>;</div>
+<div class="line"><a name="l02258"></a><span class="lineno"> 2258</span>&#160; </div>
+<div class="line"><a name="l02260"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html"> 2260</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a></div>
+<div class="line"><a name="l02261"></a><span class="lineno"> 2261</span>&#160;{</div>
+<div class="line"><a name="l02263"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346"> 2263</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d">VmaAllocatorCreateFlags</a> <a class="code" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">flags</a>;</div>
+<div class="line"><a name="l02265"></a><span class="lineno"> 2265</span>&#160; </div>
+<div class="line"><a name="l02266"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156"> 2266</a></span>&#160;    VkPhysicalDevice VMA_NOT_NULL <a class="code" href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156">physicalDevice</a>;</div>
+<div class="line"><a name="l02268"></a><span class="lineno"> 2268</span>&#160; </div>
+<div class="line"><a name="l02269"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500"> 2269</a></span>&#160;    VkDevice VMA_NOT_NULL <a class="code" href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500">device</a>;</div>
+<div class="line"><a name="l02271"></a><span class="lineno"> 2271</span>&#160; </div>
+<div class="line"><a name="l02272"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a"> 2272</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a">preferredLargeHeapBlockSize</a>;</div>
+<div class="line"><a name="l02274"></a><span class="lineno"> 2274</span>&#160; </div>
+<div class="line"><a name="l02275"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d"> 2275</a></span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* VMA_NULLABLE <a class="code" href="struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d">pAllocationCallbacks</a>;</div>
+<div class="line"><a name="l02277"></a><span class="lineno"> 2277</span>&#160; </div>
+<div class="line"><a name="l02278"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e"> 2278</a></span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks</a>* VMA_NULLABLE <a class="code" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">pDeviceMemoryCallbacks</a>;</div>
+<div class="line"><a name="l02292"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7"> 2292</a></span>&#160;    uint32_t <a class="code" href="struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7">frameInUseCount</a>;</div>
+<div class="line"><a name="l02317"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b"> 2317</a></span>&#160;    <span class="keyword">const</span> VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(<span class="stringliteral">&quot;VkPhysicalDeviceMemoryProperties::memoryHeapCount&quot;</span>) <a class="code" href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b">pHeapSizeLimit</a>;</div>
+<div class="line"><a name="l02318"></a><span class="lineno"> 2318</span>&#160; </div>
+<div class="line"><a name="l02323"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd"> 2323</a></span>&#160;    const <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* VMA_NULLABLE <a class="code" href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd">pVulkanFunctions</a>;</div>
+<div class="line"><a name="l02330"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee"> 2330</a></span>&#160;    const <a class="code" href="struct_vma_record_settings.html">VmaRecordSettings</a>* VMA_NULLABLE <a class="code" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee">pRecordSettings</a>;</div>
+<div class="line"><a name="l02335"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b"> 2335</a></span>&#160;    VkInstance VMA_NOT_NULL <a class="code" href="struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b">instance</a>;</div>
+<div class="line"><a name="l02344"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285"> 2344</a></span>&#160;    uint32_t <a class="code" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">vulkanApiVersion</a>;</div>
+<div class="line"><a name="l02345"></a><span class="lineno"> 2345</span>&#160;} <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>;</div>
+<div class="line"><a name="l02346"></a><span class="lineno"> 2346</span>&#160; </div>
+<div class="line"><a name="l02348"></a><span class="lineno"> 2348</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb">vmaCreateAllocator</a>(</div>
+<div class="line"><a name="l02349"></a><span class="lineno"> 2349</span>&#160;    const <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* VMA_NOT_NULL pCreateInfo,</div>
+<div class="line"><a name="l02350"></a><span class="lineno"> 2350</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NULLABLE * VMA_NOT_NULL pAllocator);</div>
+<div class="line"><a name="l02351"></a><span class="lineno"> 2351</span>&#160; </div>
+<div class="line"><a name="l02353"></a><span class="lineno"> 2353</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa8d164061c88f22fb1fd3c8f3534bc1d">vmaDestroyAllocator</a>(</div>
+<div class="line"><a name="l02354"></a><span class="lineno"> 2354</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NULLABLE allocator);</div>
+<div class="line"><a name="l02355"></a><span class="lineno"> 2355</span>&#160; </div>
+<div class="line"><a name="l02358"></a><span class="lineno"><a class="line" href="struct_vma_allocator_info.html"> 2358</a></span>&#160;typedef struct <a class="code" href="struct_vma_allocator_info.html">VmaAllocatorInfo</a></div>
+<div class="line"><a name="l02359"></a><span class="lineno"> 2359</span>&#160;{</div>
+<div class="line"><a name="l02364"></a><span class="lineno"><a class="line" href="struct_vma_allocator_info.html#a2ed6a4d2d3fea039d66a13f15d0ce5fe"> 2364</a></span>&#160;    VkInstance VMA_NOT_NULL <a class="code" href="struct_vma_allocator_info.html#a2ed6a4d2d3fea039d66a13f15d0ce5fe">instance</a>;</div>
+<div class="line"><a name="l02369"></a><span class="lineno"><a class="line" href="struct_vma_allocator_info.html#aba2b703f96e51d567717e1fb2935b47a"> 2369</a></span>&#160;    VkPhysicalDevice VMA_NOT_NULL <a class="code" href="struct_vma_allocator_info.html#aba2b703f96e51d567717e1fb2935b47a">physicalDevice</a>;</div>
+<div class="line"><a name="l02374"></a><span class="lineno"><a class="line" href="struct_vma_allocator_info.html#a012b4c485bf3b0ea8921352c5ee0c357"> 2374</a></span>&#160;    VkDevice VMA_NOT_NULL <a class="code" href="struct_vma_allocator_info.html#a012b4c485bf3b0ea8921352c5ee0c357">device</a>;</div>
+<div class="line"><a name="l02375"></a><span class="lineno"> 2375</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a1988031b0223fdbd564250fa1edd942c">VmaAllocatorInfo</a>;</div>
+<div class="line"><a name="l02376"></a><span class="lineno"> 2376</span>&#160; </div>
+<div class="line"><a name="l02382"></a><span class="lineno"> 2382</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7">vmaGetAllocatorInfo</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator, <a class="code" href="struct_vma_allocator_info.html">VmaAllocatorInfo</a>* VMA_NOT_NULL pAllocatorInfo);</div>
+<div class="line"><a name="l02383"></a><span class="lineno"> 2383</span>&#160; </div>
+<div class="line"><a name="l02388"></a><span class="lineno"> 2388</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0">vmaGetPhysicalDeviceProperties</a>(</div>
+<div class="line"><a name="l02389"></a><span class="lineno"> 2389</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02390"></a><span class="lineno"> 2390</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceProperties* VMA_NULLABLE * VMA_NOT_NULL ppPhysicalDeviceProperties);</div>
+<div class="line"><a name="l02391"></a><span class="lineno"> 2391</span>&#160; </div>
+<div class="line"><a name="l02396"></a><span class="lineno"> 2396</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19">vmaGetMemoryProperties</a>(</div>
+<div class="line"><a name="l02397"></a><span class="lineno"> 2397</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02398"></a><span class="lineno"> 2398</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceMemoryProperties* VMA_NULLABLE * VMA_NOT_NULL ppPhysicalDeviceMemoryProperties);</div>
+<div class="line"><a name="l02399"></a><span class="lineno"> 2399</span>&#160; </div>
+<div class="line"><a name="l02406"></a><span class="lineno"> 2406</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca">vmaGetMemoryTypeProperties</a>(</div>
+<div class="line"><a name="l02407"></a><span class="lineno"> 2407</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02408"></a><span class="lineno"> 2408</span>&#160;    uint32_t memoryTypeIndex,</div>
+<div class="line"><a name="l02409"></a><span class="lineno"> 2409</span>&#160;    VkMemoryPropertyFlags* VMA_NOT_NULL pFlags);</div>
+<div class="line"><a name="l02410"></a><span class="lineno"> 2410</span>&#160; </div>
+<div class="line"><a name="l02419"></a><span class="lineno"> 2419</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236">vmaSetCurrentFrameIndex</a>(</div>
+<div class="line"><a name="l02420"></a><span class="lineno"> 2420</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02421"></a><span class="lineno"> 2421</span>&#160;    uint32_t frameIndex);</div>
+<div class="line"><a name="l02422"></a><span class="lineno"> 2422</span>&#160; </div>
+<div class="line"><a name="l02425"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html"> 2425</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a></div>
+<div class="line"><a name="l02426"></a><span class="lineno"> 2426</span>&#160;{</div>
+<div class="line"><a name="l02428"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4"> 2428</a></span>&#160;    uint32_t <a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a>;</div>
+<div class="line"><a name="l02430"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff"> 2430</a></span>&#160;    uint32_t <a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>;</div>
+<div class="line"><a name="l02432"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9"> 2432</a></span>&#160;    uint32_t <a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
+<div class="line"><a name="l02434"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a"> 2434</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a>;</div>
+<div class="line"><a name="l02436"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669"> 2436</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>;</div>
+<div class="line"><a name="l02437"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea"> 2437</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, allocationSizeAvg, allocationSizeMax;</div>
+<div class="line"><a name="l02438"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4"> 2438</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSizeAvg, unusedRangeSizeMax;</div>
+<div class="line"><a name="l02439"></a><span class="lineno"> 2439</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#aec5b57e29c97b5d69c6d5654d60df878">VmaStatInfo</a>;</div>
+<div class="line"><a name="l02440"></a><span class="lineno"> 2440</span>&#160; </div>
+<div class="line"><a name="l02442"></a><span class="lineno"><a class="line" href="struct_vma_stats.html"> 2442</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_stats.html">VmaStats</a></div>
+<div class="line"><a name="l02443"></a><span class="lineno"> 2443</span>&#160;{</div>
+<div class="line"><a name="l02444"></a><span class="lineno"><a class="line" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331"> 2444</a></span>&#160;    <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> memoryType[VK_MAX_MEMORY_TYPES];</div>
+<div class="line"><a name="l02445"></a><span class="lineno"><a class="line" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0"> 2445</a></span>&#160;    <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> memoryHeap[VK_MAX_MEMORY_HEAPS];</div>
+<div class="line"><a name="l02446"></a><span class="lineno"><a class="line" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9"> 2446</a></span>&#160;    <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> <a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>;</div>
+<div class="line"><a name="l02447"></a><span class="lineno"> 2447</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a21813b2efdf3836767a9058cd8a94034">VmaStats</a>;</div>
+<div class="line"><a name="l02448"></a><span class="lineno"> 2448</span>&#160; </div>
+<div class="line"><a name="l02458"></a><span class="lineno"> 2458</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3">vmaCalculateStats</a>(</div>
+<div class="line"><a name="l02459"></a><span class="lineno"> 2459</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02460"></a><span class="lineno"> 2460</span>&#160;    <a class="code" href="struct_vma_stats.html">VmaStats</a>* VMA_NOT_NULL pStats);</div>
+<div class="line"><a name="l02461"></a><span class="lineno"> 2461</span>&#160; </div>
+<div class="line"><a name="l02464"></a><span class="lineno"><a class="line" href="struct_vma_budget.html"> 2464</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_budget.html">VmaBudget</a></div>
+<div class="line"><a name="l02465"></a><span class="lineno"> 2465</span>&#160;{</div>
+<div class="line"><a name="l02468"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0"> 2468</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a>;</div>
+<div class="line"><a name="l02469"></a><span class="lineno"> 2469</span>&#160;    </div>
+<div class="line"><a name="l02479"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8"> 2479</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8">allocationBytes</a>;</div>
+<div class="line"><a name="l02480"></a><span class="lineno"> 2480</span>&#160;    </div>
+<div class="line"><a name="l02489"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6"> 2489</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a>;</div>
+<div class="line"><a name="l02490"></a><span class="lineno"> 2490</span>&#160;    </div>
+<div class="line"><a name="l02500"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd"> 2500</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a>;</div>
+<div class="line"><a name="l02501"></a><span class="lineno"> 2501</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#aa078667e71b1ef24e87a6a30d128381d">VmaBudget</a>;</div>
+<div class="line"><a name="l02502"></a><span class="lineno"> 2502</span>&#160; </div>
+<div class="line"><a name="l02513"></a><span class="lineno"> 2513</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba">vmaGetBudget</a>(</div>
+<div class="line"><a name="l02514"></a><span class="lineno"> 2514</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02515"></a><span class="lineno"> 2515</span>&#160;    <a class="code" href="struct_vma_budget.html">VmaBudget</a>* VMA_NOT_NULL pBudget);</div>
+<div class="line"><a name="l02516"></a><span class="lineno"> 2516</span>&#160; </div>
+<div class="line"><a name="l02517"></a><span class="lineno"> 2517</span>&#160;<span class="preprocessor">#ifndef VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l02518"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ae25f0d55fd91cb166f002b63244800e1"> 2518</a></span>&#160;<span class="preprocessor">#define VMA_STATS_STRING_ENABLED 1</span></div>
+<div class="line"><a name="l02519"></a><span class="lineno"> 2519</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l02520"></a><span class="lineno"> 2520</span>&#160; </div>
+<div class="line"><a name="l02521"></a><span class="lineno"> 2521</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l02522"></a><span class="lineno"> 2522</span>&#160; </div>
+<div class="line"><a name="l02524"></a><span class="lineno"> 2524</span>&#160; </div>
+<div class="line"><a name="l02526"></a><span class="lineno"> 2526</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0">vmaBuildStatsString</a>(</div>
+<div class="line"><a name="l02527"></a><span class="lineno"> 2527</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02528"></a><span class="lineno"> 2528</span>&#160;    <span class="keywordtype">char</span>* VMA_NULLABLE * VMA_NOT_NULL ppStatsString,</div>
+<div class="line"><a name="l02529"></a><span class="lineno"> 2529</span>&#160;    VkBool32 detailedMap);</div>
+<div class="line"><a name="l02530"></a><span class="lineno"> 2530</span>&#160; </div>
+<div class="line"><a name="l02531"></a><span class="lineno"> 2531</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288">vmaFreeStatsString</a>(</div>
+<div class="line"><a name="l02532"></a><span class="lineno"> 2532</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02533"></a><span class="lineno"> 2533</span>&#160;    <span class="keywordtype">char</span>* VMA_NULLABLE pStatsString);</div>
+<div class="line"><a name="l02534"></a><span class="lineno"> 2534</span>&#160; </div>
+<div class="line"><a name="l02535"></a><span class="lineno"> 2535</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l02536"></a><span class="lineno"> 2536</span>&#160; </div>
+<div class="line"><a name="l02545"></a><span class="lineno"> 2545</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_pool.html">VmaPool</a>)</div>
+<div class="line"><a name="l02546"></a><span class="lineno"> 2546</span>&#160; </div>
+<div class="line"><a name="l02547"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc"> 2547</a></span>&#160;typedef enum <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a></div>
+<div class="line"><a name="l02548"></a><span class="lineno"> 2548</span>&#160;{</div>
+<div class="line"><a name="l02552"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd"> 2552</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd">VMA_MEMORY_USAGE_UNKNOWN</a> = 0,</div>
+<div class="line"><a name="l02569"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"> 2569</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a> = 1,</div>
+<div class="line"><a name="l02579"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5"> 2579</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a> = 2,</div>
+<div class="line"><a name="l02586"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67"> 2586</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67">VMA_MEMORY_USAGE_CPU_TO_GPU</a> = 3,</div>
+<div class="line"><a name="l02595"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27"> 2595</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27">VMA_MEMORY_USAGE_GPU_TO_CPU</a> = 4,</div>
+<div class="line"><a name="l02601"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500"> 2601</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500">VMA_MEMORY_USAGE_CPU_COPY</a> = 5,</div>
+<div class="line"><a name="l02609"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d"> 2609</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d">VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED</a> = 6,</div>
+<div class="line"><a name="l02610"></a><span class="lineno"> 2610</span>&#160; </div>
+<div class="line"><a name="l02611"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e"> 2611</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e">VMA_MEMORY_USAGE_MAX_ENUM</a> = 0x7FFFFFFF</div>
+<div class="line"><a name="l02612"></a><span class="lineno"> 2612</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a>;</div>
+<div class="line"><a name="l02613"></a><span class="lineno"> 2613</span>&#160; </div>
+<div class="line"><a name="l02615"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597"> 2615</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597">VmaAllocationCreateFlagBits</a> {</div>
+<div class="line"><a name="l02622"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f"> 2622</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a> = 0x00000001,</div>
+<div class="line"><a name="l02623"></a><span class="lineno"> 2623</span>&#160; </div>
+<div class="line"><a name="l02633"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff"> 2633</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a> = 0x00000002,</div>
+<div class="line"><a name="l02646"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"> 2646</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a> = 0x00000004,</div>
+<div class="line"><a name="l02659"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2"> 2659</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a> = 0x00000008,</div>
+<div class="line"><a name="l02666"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e"> 2666</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a> = 0x00000010,</div>
+<div class="line"><a name="l02672"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520"> 2672</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a> = 0x00000020,</div>
+<div class="line"><a name="l02677"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df"> 2677</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a> = 0x00000040,</div>
+<div class="line"><a name="l02683"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea"> 2683</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea">VMA_ALLOCATION_CREATE_DONT_BIND_BIT</a> = 0x00000080,</div>
+<div class="line"><a name="l02687"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d"> 2687</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d">VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT</a> = 0x00000100,</div>
+<div class="line"><a name="l02688"></a><span class="lineno"> 2688</span>&#160; </div>
+<div class="line"><a name="l02692"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d"> 2692</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>  = 0x00010000,</div>
+<div class="line"><a name="l02696"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62"> 2696</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a> = 0x00020000,</div>
+<div class="line"><a name="l02703"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777"> 2703</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a> = 0x00040000,</div>
+<div class="line"><a name="l02704"></a><span class="lineno"> 2704</span>&#160; </div>
+<div class="line"><a name="l02707"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d"> 2707</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT</a> = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>,</div>
+<div class="line"><a name="l02710"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d"> 2710</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT</a> = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>,</div>
+<div class="line"><a name="l02713"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706"> 2713</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706">VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT</a> = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a>,</div>
+<div class="line"><a name="l02714"></a><span class="lineno"> 2714</span>&#160; </div>
+<div class="line"><a name="l02717"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e"> 2717</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e">VMA_ALLOCATION_CREATE_STRATEGY_MASK</a> =</div>
+<div class="line"><a name="l02718"></a><span class="lineno"> 2718</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a> |</div>
+<div class="line"><a name="l02719"></a><span class="lineno"> 2719</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a> |</div>
+<div class="line"><a name="l02720"></a><span class="lineno"> 2720</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>,</div>
+<div class="line"><a name="l02721"></a><span class="lineno"> 2721</span>&#160; </div>
+<div class="line"><a name="l02722"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882"> 2722</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882">VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
+<div class="line"><a name="l02723"></a><span class="lineno"> 2723</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597">VmaAllocationCreateFlagBits</a>;</div>
+<div class="line"><a name="l02724"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817"> 2724</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a>;</div>
+<div class="line"><a name="l02725"></a><span class="lineno"> 2725</span>&#160; </div>
+<div class="line"><a name="l02726"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html"> 2726</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div>
+<div class="line"><a name="l02727"></a><span class="lineno"> 2727</span>&#160;{</div>
+<div class="line"><a name="l02729"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b"> 2729</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> <a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>;</div>
+<div class="line"><a name="l02735"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910"> 2735</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a> <a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>;</div>
+<div class="line"><a name="l02740"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90"> 2740</a></span>&#160;    VkMemoryPropertyFlags <a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>;</div>
+<div class="line"><a name="l02745"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d"> 2745</a></span>&#160;    VkMemoryPropertyFlags <a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>;</div>
+<div class="line"><a name="l02753"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055"> 2753</a></span>&#160;    uint32_t <a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>;</div>
+<div class="line"><a name="l02759"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150"> 2759</a></span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NULLABLE <a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>;</div>
+<div class="line"><a name="l02766"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19"> 2766</a></span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE <a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>;</div>
+<div class="line"><a name="l02767"></a><span class="lineno"> 2767</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a3bf110892ea2fb4649fedb68488d026a">VmaAllocationCreateInfo</a>;</div>
+<div class="line"><a name="l02768"></a><span class="lineno"> 2768</span>&#160; </div>
+<div class="line"><a name="l02785"></a><span class="lineno"> 2785</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(</div>
+<div class="line"><a name="l02786"></a><span class="lineno"> 2786</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02787"></a><span class="lineno"> 2787</span>&#160;    uint32_t memoryTypeBits,</div>
+<div class="line"><a name="l02788"></a><span class="lineno"> 2788</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pAllocationCreateInfo,</div>
+<div class="line"><a name="l02789"></a><span class="lineno"> 2789</span>&#160;    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);</div>
+<div class="line"><a name="l02790"></a><span class="lineno"> 2790</span>&#160; </div>
+<div class="line"><a name="l02803"></a><span class="lineno"> 2803</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888">vmaFindMemoryTypeIndexForBufferInfo</a>(</div>
+<div class="line"><a name="l02804"></a><span class="lineno"> 2804</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02805"></a><span class="lineno"> 2805</span>&#160;    <span class="keyword">const</span> VkBufferCreateInfo* VMA_NOT_NULL pBufferCreateInfo,</div>
+<div class="line"><a name="l02806"></a><span class="lineno"> 2806</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pAllocationCreateInfo,</div>
+<div class="line"><a name="l02807"></a><span class="lineno"> 2807</span>&#160;    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);</div>
+<div class="line"><a name="l02808"></a><span class="lineno"> 2808</span>&#160; </div>
+<div class="line"><a name="l02821"></a><span class="lineno"> 2821</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472">vmaFindMemoryTypeIndexForImageInfo</a>(</div>
+<div class="line"><a name="l02822"></a><span class="lineno"> 2822</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02823"></a><span class="lineno"> 2823</span>&#160;    <span class="keyword">const</span> VkImageCreateInfo* VMA_NOT_NULL pImageCreateInfo,</div>
+<div class="line"><a name="l02824"></a><span class="lineno"> 2824</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pAllocationCreateInfo,</div>
+<div class="line"><a name="l02825"></a><span class="lineno"> 2825</span>&#160;    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);</div>
+<div class="line"><a name="l02826"></a><span class="lineno"> 2826</span>&#160; </div>
+<div class="line"><a name="l02828"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7"> 2828</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7">VmaPoolCreateFlagBits</a> {</div>
+<div class="line"><a name="l02846"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2"> 2846</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2">VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT</a> = 0x00000002,</div>
+<div class="line"><a name="l02847"></a><span class="lineno"> 2847</span>&#160; </div>
+<div class="line"><a name="l02863"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726"> 2863</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a> = 0x00000004,</div>
+<div class="line"><a name="l02864"></a><span class="lineno"> 2864</span>&#160; </div>
+<div class="line"><a name="l02874"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e"> 2874</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a> = 0x00000008,</div>
+<div class="line"><a name="l02875"></a><span class="lineno"> 2875</span>&#160; </div>
+<div class="line"><a name="l02878"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c"> 2878</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c">VMA_POOL_CREATE_ALGORITHM_MASK</a> =</div>
+<div class="line"><a name="l02879"></a><span class="lineno"> 2879</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a> |</div>
+<div class="line"><a name="l02880"></a><span class="lineno"> 2880</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a>,</div>
+<div class="line"><a name="l02881"></a><span class="lineno"> 2881</span>&#160; </div>
+<div class="line"><a name="l02882"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec"> 2882</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec">VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
+<div class="line"><a name="l02883"></a><span class="lineno"> 2883</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7">VmaPoolCreateFlagBits</a>;</div>
+<div class="line"><a name="l02884"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a"> 2884</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a">VmaPoolCreateFlags</a>;</div>
+<div class="line"><a name="l02885"></a><span class="lineno"> 2885</span>&#160; </div>
+<div class="line"><a name="l02888"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html"> 2888</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a> {</div>
+<div class="line"><a name="l02891"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319"> 2891</a></span>&#160;    uint32_t <a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a>;</div>
+<div class="line"><a name="l02894"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446"> 2894</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a">VmaPoolCreateFlags</a> <a class="code" href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446">flags</a>;</div>
+<div class="line"><a name="l02903"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676"> 2903</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676">blockSize</a>;</div>
+<div class="line"><a name="l02908"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae"> 2908</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae">minBlockCount</a>;</div>
+<div class="line"><a name="l02916"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c"> 2916</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">maxBlockCount</a>;</div>
+<div class="line"><a name="l02930"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa"> 2930</a></span>&#160;    uint32_t <a class="code" href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa">frameInUseCount</a>;</div>
+<div class="line"><a name="l02931"></a><span class="lineno"> 2931</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a1017aa83489c0eee8d2163d2bf253f67">VmaPoolCreateInfo</a>;</div>
+<div class="line"><a name="l02932"></a><span class="lineno"> 2932</span>&#160; </div>
+<div class="line"><a name="l02935"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html"> 2935</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a> {</div>
+<div class="line"><a name="l02938"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c"> 2938</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a>;</div>
+<div class="line"><a name="l02941"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8"> 2941</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a>;</div>
+<div class="line"><a name="l02944"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb"> 2944</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a>;</div>
+<div class="line"><a name="l02947"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4"> 2947</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
+<div class="line"><a name="l02954"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b"> 2954</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>;</div>
+<div class="line"><a name="l02957"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7"> 2957</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7">blockCount</a>;</div>
+<div class="line"><a name="l02958"></a><span class="lineno"> 2958</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a4759a2d9f99c19ba7627553c847132f1">VmaPoolStats</a>;</div>
+<div class="line"><a name="l02959"></a><span class="lineno"> 2959</span>&#160; </div>
+<div class="line"><a name="l02966"></a><span class="lineno"> 2966</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5c8770ded7c59c8caac6de0c2cb00b50">vmaCreatePool</a>(</div>
+<div class="line"><a name="l02967"></a><span class="lineno"> 2967</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02968"></a><span class="lineno"> 2968</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>* VMA_NOT_NULL pCreateInfo,</div>
+<div class="line"><a name="l02969"></a><span class="lineno"> 2969</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NULLABLE * VMA_NOT_NULL pPool);</div>
+<div class="line"><a name="l02970"></a><span class="lineno"> 2970</span>&#160; </div>
+<div class="line"><a name="l02973"></a><span class="lineno"> 2973</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5485779c8f1948238fc4e92232fa65e1">vmaDestroyPool</a>(</div>
+<div class="line"><a name="l02974"></a><span class="lineno"> 2974</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02975"></a><span class="lineno"> 2975</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NULLABLE pool);</div>
+<div class="line"><a name="l02976"></a><span class="lineno"> 2976</span>&#160; </div>
+<div class="line"><a name="l02983"></a><span class="lineno"> 2983</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153">vmaGetPoolStats</a>(</div>
+<div class="line"><a name="l02984"></a><span class="lineno"> 2984</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02985"></a><span class="lineno"> 2985</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL pool,</div>
+<div class="line"><a name="l02986"></a><span class="lineno"> 2986</span>&#160;    <a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* VMA_NOT_NULL pPoolStats);</div>
+<div class="line"><a name="l02987"></a><span class="lineno"> 2987</span>&#160; </div>
+<div class="line"><a name="l02994"></a><span class="lineno"> 2994</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024">vmaMakePoolAllocationsLost</a>(</div>
+<div class="line"><a name="l02995"></a><span class="lineno"> 2995</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l02996"></a><span class="lineno"> 2996</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL pool,</div>
+<div class="line"><a name="l02997"></a><span class="lineno"> 2997</span>&#160;    <span class="keywordtype">size_t</span>* VMA_NULLABLE pLostAllocationCount);</div>
+<div class="line"><a name="l02998"></a><span class="lineno"> 2998</span>&#160; </div>
+<div class="line"><a name="l03013"></a><span class="lineno"> 3013</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad535935619c7a549bf837e1bb0068f89">vmaCheckPoolCorruption</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator, <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL pool);</div>
+<div class="line"><a name="l03014"></a><span class="lineno"> 3014</span>&#160; </div>
+<div class="line"><a name="l03021"></a><span class="lineno"> 3021</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030">vmaGetPoolName</a>(</div>
+<div class="line"><a name="l03022"></a><span class="lineno"> 3022</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03023"></a><span class="lineno"> 3023</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL pool,</div>
+<div class="line"><a name="l03024"></a><span class="lineno"> 3024</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* VMA_NULLABLE * VMA_NOT_NULL ppName);</div>
+<div class="line"><a name="l03025"></a><span class="lineno"> 3025</span>&#160; </div>
+<div class="line"><a name="l03031"></a><span class="lineno"> 3031</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58">vmaSetPoolName</a>(</div>
+<div class="line"><a name="l03032"></a><span class="lineno"> 3032</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03033"></a><span class="lineno"> 3033</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL pool,</div>
+<div class="line"><a name="l03034"></a><span class="lineno"> 3034</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* VMA_NULLABLE pName);</div>
+<div class="line"><a name="l03035"></a><span class="lineno"> 3035</span>&#160; </div>
+<div class="line"><a name="l03060"></a><span class="lineno"> 3060</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>)</div>
 <div class="line"><a name="l03061"></a><span class="lineno"> 3061</span>&#160; </div>
-<div class="line"><a name="l03063"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html"> 3063</a></span>&#160;typedef struct <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a> {</div>
-<div class="line"><a name="l03068"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5"> 3068</a></span>&#160;    uint32_t <a class="code" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">memoryType</a>;</div>
-<div class="line"><a name="l03077"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67"> 3077</a></span>&#160;    VkDeviceMemory VMA_NULLABLE_NON_DISPATCHABLE <a class="code" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">deviceMemory</a>;</div>
-<div class="line"><a name="l03082"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268"> 3082</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">offset</a>;</div>
-<div class="line"><a name="l03087"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f"> 3087</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f">size</a>;</div>
-<div class="line"><a name="l03096"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2"> 3096</a></span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE <a class="code" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a>;</div>
-<div class="line"><a name="l03101"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13"> 3101</a></span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE <a class="code" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a>;</div>
-<div class="line"><a name="l03102"></a><span class="lineno"> 3102</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a1cf7774606721026a68aabe3af2e5b50">VmaAllocationInfo</a>;</div>
-<div class="line"><a name="l03103"></a><span class="lineno"> 3103</span>&#160; </div>
-<div class="line"><a name="l03114"></a><span class="lineno"> 3114</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8">vmaAllocateMemory</a>(</div>
-<div class="line"><a name="l03115"></a><span class="lineno"> 3115</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03116"></a><span class="lineno"> 3116</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements* VMA_NOT_NULL pVkMemoryRequirements,</div>
-<div class="line"><a name="l03117"></a><span class="lineno"> 3117</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pCreateInfo,</div>
-<div class="line"><a name="l03118"></a><span class="lineno"> 3118</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation,</div>
-<div class="line"><a name="l03119"></a><span class="lineno"> 3119</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE pAllocationInfo);</div>
-<div class="line"><a name="l03120"></a><span class="lineno"> 3120</span>&#160; </div>
-<div class="line"><a name="l03140"></a><span class="lineno"> 3140</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad37e82e492b3de38fc3f4cffd9ad0ae1">vmaAllocateMemoryPages</a>(</div>
-<div class="line"><a name="l03141"></a><span class="lineno"> 3141</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03142"></a><span class="lineno"> 3142</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements* VMA_NOT_NULL pVkMemoryRequirements,</div>
-<div class="line"><a name="l03143"></a><span class="lineno"> 3143</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pCreateInfo,</div>
-<div class="line"><a name="l03144"></a><span class="lineno"> 3144</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l03145"></a><span class="lineno"> 3145</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations,</div>
-<div class="line"><a name="l03146"></a><span class="lineno"> 3146</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationInfo);</div>
-<div class="line"><a name="l03147"></a><span class="lineno"> 3147</span>&#160; </div>
-<div class="line"><a name="l03154"></a><span class="lineno"> 3154</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer</a>(</div>
-<div class="line"><a name="l03155"></a><span class="lineno"> 3155</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03156"></a><span class="lineno"> 3156</span>&#160;    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer,</div>
-<div class="line"><a name="l03157"></a><span class="lineno"> 3157</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pCreateInfo,</div>
-<div class="line"><a name="l03158"></a><span class="lineno"> 3158</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation,</div>
-<div class="line"><a name="l03159"></a><span class="lineno"> 3159</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE pAllocationInfo);</div>
-<div class="line"><a name="l03160"></a><span class="lineno"> 3160</span>&#160; </div>
-<div class="line"><a name="l03162"></a><span class="lineno"> 3162</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb">vmaAllocateMemoryForImage</a>(</div>
-<div class="line"><a name="l03163"></a><span class="lineno"> 3163</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03164"></a><span class="lineno"> 3164</span>&#160;    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image,</div>
-<div class="line"><a name="l03165"></a><span class="lineno"> 3165</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pCreateInfo,</div>
-<div class="line"><a name="l03166"></a><span class="lineno"> 3166</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation,</div>
-<div class="line"><a name="l03167"></a><span class="lineno"> 3167</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE pAllocationInfo);</div>
-<div class="line"><a name="l03168"></a><span class="lineno"> 3168</span>&#160; </div>
-<div class="line"><a name="l03173"></a><span class="lineno"> 3173</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5fea5518972ae9094b1526cbcb19b05f">vmaFreeMemory</a>(</div>
-<div class="line"><a name="l03174"></a><span class="lineno"> 3174</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03175"></a><span class="lineno"> 3175</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE allocation);</div>
-<div class="line"><a name="l03176"></a><span class="lineno"> 3176</span>&#160; </div>
-<div class="line"><a name="l03187"></a><span class="lineno"> 3187</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a834b1e4aef395c0a1d56a28e69a4a17e">vmaFreeMemoryPages</a>(</div>
-<div class="line"><a name="l03188"></a><span class="lineno"> 3188</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03189"></a><span class="lineno"> 3189</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l03190"></a><span class="lineno"> 3190</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations);</div>
-<div class="line"><a name="l03191"></a><span class="lineno"> 3191</span>&#160; </div>
-<div class="line"><a name="l03199"></a><span class="lineno"> 3199</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0ff488958ca72b28e545880463cb8696">vmaResizeAllocation</a>(</div>
-<div class="line"><a name="l03200"></a><span class="lineno"> 3200</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03201"></a><span class="lineno"> 3201</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
-<div class="line"><a name="l03202"></a><span class="lineno"> 3202</span>&#160;    VkDeviceSize newSize);</div>
-<div class="line"><a name="l03203"></a><span class="lineno"> 3203</span>&#160; </div>
-<div class="line"><a name="l03220"></a><span class="lineno"> 3220</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a>(</div>
-<div class="line"><a name="l03221"></a><span class="lineno"> 3221</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03222"></a><span class="lineno"> 3222</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
-<div class="line"><a name="l03223"></a><span class="lineno"> 3223</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NOT_NULL pAllocationInfo);</div>
-<div class="line"><a name="l03224"></a><span class="lineno"> 3224</span>&#160; </div>
-<div class="line"><a name="l03239"></a><span class="lineno"> 3239</span>&#160;VMA_CALL_PRE VkBool32 VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a">vmaTouchAllocation</a>(</div>
-<div class="line"><a name="l03240"></a><span class="lineno"> 3240</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03241"></a><span class="lineno"> 3241</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation);</div>
-<div class="line"><a name="l03242"></a><span class="lineno"> 3242</span>&#160; </div>
-<div class="line"><a name="l03256"></a><span class="lineno"> 3256</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f">vmaSetAllocationUserData</a>(</div>
-<div class="line"><a name="l03257"></a><span class="lineno"> 3257</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03258"></a><span class="lineno"> 3258</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
-<div class="line"><a name="l03259"></a><span class="lineno"> 3259</span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE pUserData);</div>
-<div class="line"><a name="l03260"></a><span class="lineno"> 3260</span>&#160; </div>
-<div class="line"><a name="l03271"></a><span class="lineno"> 3271</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae5c9657d9e94756269145b01c05d16f1">vmaCreateLostAllocation</a>(</div>
-<div class="line"><a name="l03272"></a><span class="lineno"> 3272</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03273"></a><span class="lineno"> 3273</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation);</div>
-<div class="line"><a name="l03274"></a><span class="lineno"> 3274</span>&#160; </div>
-<div class="line"><a name="l03313"></a><span class="lineno"> 3313</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069">vmaMapMemory</a>(</div>
-<div class="line"><a name="l03314"></a><span class="lineno"> 3314</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03315"></a><span class="lineno"> 3315</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
-<div class="line"><a name="l03316"></a><span class="lineno"> 3316</span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE * VMA_NOT_NULL ppData);</div>
-<div class="line"><a name="l03317"></a><span class="lineno"> 3317</span>&#160; </div>
-<div class="line"><a name="l03326"></a><span class="lineno"> 3326</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45">vmaUnmapMemory</a>(</div>
-<div class="line"><a name="l03327"></a><span class="lineno"> 3327</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03328"></a><span class="lineno"> 3328</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation);</div>
-<div class="line"><a name="l03329"></a><span class="lineno"> 3329</span>&#160; </div>
-<div class="line"><a name="l03348"></a><span class="lineno"> 3348</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de">vmaFlushAllocation</a>(</div>
-<div class="line"><a name="l03349"></a><span class="lineno"> 3349</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03350"></a><span class="lineno"> 3350</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
-<div class="line"><a name="l03351"></a><span class="lineno"> 3351</span>&#160;    VkDeviceSize offset,</div>
-<div class="line"><a name="l03352"></a><span class="lineno"> 3352</span>&#160;    VkDeviceSize size);</div>
-<div class="line"><a name="l03353"></a><span class="lineno"> 3353</span>&#160; </div>
-<div class="line"><a name="l03372"></a><span class="lineno"> 3372</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006">vmaInvalidateAllocation</a>(</div>
-<div class="line"><a name="l03373"></a><span class="lineno"> 3373</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03374"></a><span class="lineno"> 3374</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
-<div class="line"><a name="l03375"></a><span class="lineno"> 3375</span>&#160;    VkDeviceSize offset,</div>
-<div class="line"><a name="l03376"></a><span class="lineno"> 3376</span>&#160;    VkDeviceSize size);</div>
-<div class="line"><a name="l03377"></a><span class="lineno"> 3377</span>&#160; </div>
-<div class="line"><a name="l03394"></a><span class="lineno"> 3394</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98">vmaCheckCorruption</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator, uint32_t memoryTypeBits);</div>
-<div class="line"><a name="l03395"></a><span class="lineno"> 3395</span>&#160; </div>
-<div class="line"><a name="l03402"></a><span class="lineno"> 3402</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a>)</div>
-<div class="line"><a name="l03403"></a><span class="lineno"> 3403</span>&#160; </div>
-<div class="line"><a name="l03404"></a><span class="lineno"> 3404</span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50c">VmaDefragmentationFlagBits</a> {</div>
-<div class="line"><a name="l03406"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33"> 3406</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a> = 0x1,</div>
-<div class="line"><a name="l03407"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97"> 3407</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97">VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
-<div class="line"><a name="l03408"></a><span class="lineno"> 3408</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50c">VmaDefragmentationFlagBits</a>;</div>
-<div class="line"><a name="l03409"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d"> 3409</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a>;</div>
-<div class="line"><a name="l03410"></a><span class="lineno"> 3410</span>&#160; </div>
-<div class="line"><a name="l03415"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html"> 3415</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a> {</div>
-<div class="line"><a name="l03418"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9"> 3418</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> <a class="code" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9">flags</a>;</div>
-<div class="line"><a name="l03421"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba"> 3421</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a>;</div>
-<div class="line"><a name="l03430"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32"> 3430</a></span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) <a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a>;</div>
-<div class="line"><a name="l03436"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc"> 3436</a></span>&#160;    VkBool32* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) <a class="code" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">pAllocationsChanged</a>;</div>
-<div class="line"><a name="l03439"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d"> 3439</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a>;</div>
-<div class="line"><a name="l03455"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b"> 3455</a></span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(poolCount) <a class="code" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">pPools</a>;</div>
-<div class="line"><a name="l03460"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a"> 3460</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">maxCpuBytesToMove</a>;</div>
-<div class="line"><a name="l03465"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671"> 3465</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">maxCpuAllocationsToMove</a>;</div>
-<div class="line"><a name="l03470"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08"> 3470</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08">maxGpuBytesToMove</a>;</div>
-<div class="line"><a name="l03475"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6"> 3475</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6">maxGpuAllocationsToMove</a>;</div>
-<div class="line"><a name="l03484"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd"> 3484</a></span>&#160;    VkCommandBuffer VMA_NULLABLE_NON_DISPATCHABLE <a class="code" href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd">commandBuffer</a>;</div>
-<div class="line"><a name="l03485"></a><span class="lineno"> 3485</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ad6daeffaa670ce6d11a203a6224c9937">VmaDefragmentationInfo2</a>;</div>
-<div class="line"><a name="l03486"></a><span class="lineno"> 3486</span>&#160; </div>
-<div class="line"><a name="l03487"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_move_info.html"> 3487</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a> {</div>
-<div class="line"><a name="l03488"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_move_info.html#ae885c861c2dd8d622e6c19e281d035cc"> 3488</a></span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL <a class="code" href="struct_vma_defragmentation_pass_move_info.html#ae885c861c2dd8d622e6c19e281d035cc">allocation</a>;</div>
-<div class="line"><a name="l03489"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_move_info.html#a06eb0c8690aa0d3478a036753492e769"> 3489</a></span>&#160;    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE <a class="code" href="struct_vma_defragmentation_pass_move_info.html#a06eb0c8690aa0d3478a036753492e769">memory</a>;</div>
-<div class="line"><a name="l03490"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_move_info.html#a8ab4508bc03625b0653c880576be96c6"> 3490</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_pass_move_info.html#a8ab4508bc03625b0653c880576be96c6">offset</a>;</div>
-<div class="line"><a name="l03491"></a><span class="lineno"> 3491</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ad6799e8e2b1527abfc84d33bc44aeaf5">VmaDefragmentationPassMoveInfo</a>;</div>
-<div class="line"><a name="l03492"></a><span class="lineno"> 3492</span>&#160; </div>
-<div class="line"><a name="l03497"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_info.html"> 3497</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a> {</div>
-<div class="line"><a name="l03498"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c"> 3498</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a>;</div>
-<div class="line"><a name="l03499"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792"> 3499</a></span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a>* VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(moveCount) <a class="code" href="struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792">pMoves</a>;</div>
-<div class="line"><a name="l03500"></a><span class="lineno"> 3500</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a72aebd522242d56abea67b4f47f6549e">VmaDefragmentationPassInfo</a>;</div>
-<div class="line"><a name="l03501"></a><span class="lineno"> 3501</span>&#160; </div>
-<div class="line"><a name="l03506"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info.html"> 3506</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a> {</div>
-<div class="line"><a name="l03511"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d"> 3511</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d">maxBytesToMove</a>;</div>
-<div class="line"><a name="l03516"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc"> 3516</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc">maxAllocationsToMove</a>;</div>
-<div class="line"><a name="l03517"></a><span class="lineno"> 3517</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a2bf47f96bf92bed2a49461bd9af3acfa">VmaDefragmentationInfo</a>;</div>
-<div class="line"><a name="l03518"></a><span class="lineno"> 3518</span>&#160; </div>
-<div class="line"><a name="l03520"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html"> 3520</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a> {</div>
-<div class="line"><a name="l03522"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d"> 3522</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d">bytesMoved</a>;</div>
-<div class="line"><a name="l03524"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28"> 3524</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28">bytesFreed</a>;</div>
-<div class="line"><a name="l03526"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9"> 3526</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9">allocationsMoved</a>;</div>
-<div class="line"><a name="l03528"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b"> 3528</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b">deviceMemoryBlocksFreed</a>;</div>
-<div class="line"><a name="l03529"></a><span class="lineno"> 3529</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ad94034192259c2e34a4d1c5e27810403">VmaDefragmentationStats</a>;</div>
-<div class="line"><a name="l03530"></a><span class="lineno"> 3530</span>&#160; </div>
-<div class="line"><a name="l03560"></a><span class="lineno"> 3560</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a36ba776fd7fd5cb1e9359fdc0d8e6e8a">vmaDefragmentationBegin</a>(</div>
-<div class="line"><a name="l03561"></a><span class="lineno"> 3561</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03562"></a><span class="lineno"> 3562</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>* VMA_NOT_NULL pInfo,</div>
-<div class="line"><a name="l03563"></a><span class="lineno"> 3563</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* VMA_NULLABLE pStats,</div>
-<div class="line"><a name="l03564"></a><span class="lineno"> 3564</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> VMA_NULLABLE * VMA_NOT_NULL pContext);</div>
-<div class="line"><a name="l03565"></a><span class="lineno"> 3565</span>&#160; </div>
-<div class="line"><a name="l03571"></a><span class="lineno"> 3571</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a8774e20e91e245aae959ba63efa15dd2">vmaDefragmentationEnd</a>(</div>
-<div class="line"><a name="l03572"></a><span class="lineno"> 3572</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03573"></a><span class="lineno"> 3573</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> VMA_NULLABLE context);</div>
-<div class="line"><a name="l03574"></a><span class="lineno"> 3574</span>&#160; </div>
-<div class="line"><a name="l03575"></a><span class="lineno"> 3575</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ac0f01545b6262f7d4d128fc8f8e5c77b">vmaBeginDefragmentationPass</a>(</div>
-<div class="line"><a name="l03576"></a><span class="lineno"> 3576</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03577"></a><span class="lineno"> 3577</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> VMA_NULLABLE context,</div>
-<div class="line"><a name="l03578"></a><span class="lineno"> 3578</span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* VMA_NOT_NULL pInfo</div>
-<div class="line"><a name="l03579"></a><span class="lineno"> 3579</span>&#160;);</div>
-<div class="line"><a name="l03580"></a><span class="lineno"> 3580</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a1b9ffa538bed905af55c747cc48963bd">vmaEndDefragmentationPass</a>(</div>
-<div class="line"><a name="l03581"></a><span class="lineno"> 3581</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03582"></a><span class="lineno"> 3582</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> VMA_NULLABLE context</div>
-<div class="line"><a name="l03583"></a><span class="lineno"> 3583</span>&#160;);</div>
-<div class="line"><a name="l03584"></a><span class="lineno"> 3584</span>&#160; </div>
-<div class="line"><a name="l03625"></a><span class="lineno"> 3625</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a9f0f8f56db5f7f57fe4454f465142dac">vmaDefragment</a>(</div>
-<div class="line"><a name="l03626"></a><span class="lineno"> 3626</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03627"></a><span class="lineno"> 3627</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations,</div>
-<div class="line"><a name="l03628"></a><span class="lineno"> 3628</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l03629"></a><span class="lineno"> 3629</span>&#160;    VkBool32* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationsChanged,</div>
-<div class="line"><a name="l03630"></a><span class="lineno"> 3630</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a>* VMA_NULLABLE pDefragmentationInfo,</div>
-<div class="line"><a name="l03631"></a><span class="lineno"> 3631</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* VMA_NULLABLE pDefragmentationStats);</div>
-<div class="line"><a name="l03632"></a><span class="lineno"> 3632</span>&#160; </div>
-<div class="line"><a name="l03645"></a><span class="lineno"> 3645</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470">vmaBindBufferMemory</a>(</div>
-<div class="line"><a name="l03646"></a><span class="lineno"> 3646</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03647"></a><span class="lineno"> 3647</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
-<div class="line"><a name="l03648"></a><span class="lineno"> 3648</span>&#160;    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer);</div>
-<div class="line"><a name="l03649"></a><span class="lineno"> 3649</span>&#160; </div>
-<div class="line"><a name="l03660"></a><span class="lineno"> 3660</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a">vmaBindBufferMemory2</a>(</div>
-<div class="line"><a name="l03661"></a><span class="lineno"> 3661</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03662"></a><span class="lineno"> 3662</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
-<div class="line"><a name="l03663"></a><span class="lineno"> 3663</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l03664"></a><span class="lineno"> 3664</span>&#160;    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer,</div>
-<div class="line"><a name="l03665"></a><span class="lineno"> 3665</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* VMA_NULLABLE pNext);</div>
-<div class="line"><a name="l03666"></a><span class="lineno"> 3666</span>&#160; </div>
-<div class="line"><a name="l03679"></a><span class="lineno"> 3679</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5">vmaBindImageMemory</a>(</div>
-<div class="line"><a name="l03680"></a><span class="lineno"> 3680</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03681"></a><span class="lineno"> 3681</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
-<div class="line"><a name="l03682"></a><span class="lineno"> 3682</span>&#160;    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image);</div>
-<div class="line"><a name="l03683"></a><span class="lineno"> 3683</span>&#160; </div>
-<div class="line"><a name="l03694"></a><span class="lineno"> 3694</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc">vmaBindImageMemory2</a>(</div>
+<div class="line"><a name="l03062"></a><span class="lineno"> 3062</span>&#160; </div>
+<div class="line"><a name="l03064"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html"> 3064</a></span>&#160;typedef struct <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a> {</div>
+<div class="line"><a name="l03069"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5"> 3069</a></span>&#160;    uint32_t <a class="code" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">memoryType</a>;</div>
+<div class="line"><a name="l03078"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67"> 3078</a></span>&#160;    VkDeviceMemory VMA_NULLABLE_NON_DISPATCHABLE <a class="code" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">deviceMemory</a>;</div>
+<div class="line"><a name="l03083"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268"> 3083</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">offset</a>;</div>
+<div class="line"><a name="l03088"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f"> 3088</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f">size</a>;</div>
+<div class="line"><a name="l03097"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2"> 3097</a></span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE <a class="code" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a>;</div>
+<div class="line"><a name="l03102"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13"> 3102</a></span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE <a class="code" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a>;</div>
+<div class="line"><a name="l03103"></a><span class="lineno"> 3103</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a1cf7774606721026a68aabe3af2e5b50">VmaAllocationInfo</a>;</div>
+<div class="line"><a name="l03104"></a><span class="lineno"> 3104</span>&#160; </div>
+<div class="line"><a name="l03115"></a><span class="lineno"> 3115</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8">vmaAllocateMemory</a>(</div>
+<div class="line"><a name="l03116"></a><span class="lineno"> 3116</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03117"></a><span class="lineno"> 3117</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements* VMA_NOT_NULL pVkMemoryRequirements,</div>
+<div class="line"><a name="l03118"></a><span class="lineno"> 3118</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pCreateInfo,</div>
+<div class="line"><a name="l03119"></a><span class="lineno"> 3119</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation,</div>
+<div class="line"><a name="l03120"></a><span class="lineno"> 3120</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE pAllocationInfo);</div>
+<div class="line"><a name="l03121"></a><span class="lineno"> 3121</span>&#160; </div>
+<div class="line"><a name="l03141"></a><span class="lineno"> 3141</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad37e82e492b3de38fc3f4cffd9ad0ae1">vmaAllocateMemoryPages</a>(</div>
+<div class="line"><a name="l03142"></a><span class="lineno"> 3142</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03143"></a><span class="lineno"> 3143</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements* VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pVkMemoryRequirements,</div>
+<div class="line"><a name="l03144"></a><span class="lineno"> 3144</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pCreateInfo,</div>
+<div class="line"><a name="l03145"></a><span class="lineno"> 3145</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l03146"></a><span class="lineno"> 3146</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations,</div>
+<div class="line"><a name="l03147"></a><span class="lineno"> 3147</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationInfo);</div>
+<div class="line"><a name="l03148"></a><span class="lineno"> 3148</span>&#160; </div>
+<div class="line"><a name="l03155"></a><span class="lineno"> 3155</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer</a>(</div>
+<div class="line"><a name="l03156"></a><span class="lineno"> 3156</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03157"></a><span class="lineno"> 3157</span>&#160;    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer,</div>
+<div class="line"><a name="l03158"></a><span class="lineno"> 3158</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pCreateInfo,</div>
+<div class="line"><a name="l03159"></a><span class="lineno"> 3159</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation,</div>
+<div class="line"><a name="l03160"></a><span class="lineno"> 3160</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE pAllocationInfo);</div>
+<div class="line"><a name="l03161"></a><span class="lineno"> 3161</span>&#160; </div>
+<div class="line"><a name="l03163"></a><span class="lineno"> 3163</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb">vmaAllocateMemoryForImage</a>(</div>
+<div class="line"><a name="l03164"></a><span class="lineno"> 3164</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03165"></a><span class="lineno"> 3165</span>&#160;    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image,</div>
+<div class="line"><a name="l03166"></a><span class="lineno"> 3166</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pCreateInfo,</div>
+<div class="line"><a name="l03167"></a><span class="lineno"> 3167</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation,</div>
+<div class="line"><a name="l03168"></a><span class="lineno"> 3168</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE pAllocationInfo);</div>
+<div class="line"><a name="l03169"></a><span class="lineno"> 3169</span>&#160; </div>
+<div class="line"><a name="l03174"></a><span class="lineno"> 3174</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5fea5518972ae9094b1526cbcb19b05f">vmaFreeMemory</a>(</div>
+<div class="line"><a name="l03175"></a><span class="lineno"> 3175</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03176"></a><span class="lineno"> 3176</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE allocation);</div>
+<div class="line"><a name="l03177"></a><span class="lineno"> 3177</span>&#160; </div>
+<div class="line"><a name="l03188"></a><span class="lineno"> 3188</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a834b1e4aef395c0a1d56a28e69a4a17e">vmaFreeMemoryPages</a>(</div>
+<div class="line"><a name="l03189"></a><span class="lineno"> 3189</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03190"></a><span class="lineno"> 3190</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l03191"></a><span class="lineno"> 3191</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations);</div>
+<div class="line"><a name="l03192"></a><span class="lineno"> 3192</span>&#160; </div>
+<div class="line"><a name="l03200"></a><span class="lineno"> 3200</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0ff488958ca72b28e545880463cb8696">vmaResizeAllocation</a>(</div>
+<div class="line"><a name="l03201"></a><span class="lineno"> 3201</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03202"></a><span class="lineno"> 3202</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
+<div class="line"><a name="l03203"></a><span class="lineno"> 3203</span>&#160;    VkDeviceSize newSize);</div>
+<div class="line"><a name="l03204"></a><span class="lineno"> 3204</span>&#160; </div>
+<div class="line"><a name="l03221"></a><span class="lineno"> 3221</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a>(</div>
+<div class="line"><a name="l03222"></a><span class="lineno"> 3222</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03223"></a><span class="lineno"> 3223</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
+<div class="line"><a name="l03224"></a><span class="lineno"> 3224</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NOT_NULL pAllocationInfo);</div>
+<div class="line"><a name="l03225"></a><span class="lineno"> 3225</span>&#160; </div>
+<div class="line"><a name="l03240"></a><span class="lineno"> 3240</span>&#160;VMA_CALL_PRE VkBool32 VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a">vmaTouchAllocation</a>(</div>
+<div class="line"><a name="l03241"></a><span class="lineno"> 3241</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03242"></a><span class="lineno"> 3242</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation);</div>
+<div class="line"><a name="l03243"></a><span class="lineno"> 3243</span>&#160; </div>
+<div class="line"><a name="l03257"></a><span class="lineno"> 3257</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f">vmaSetAllocationUserData</a>(</div>
+<div class="line"><a name="l03258"></a><span class="lineno"> 3258</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03259"></a><span class="lineno"> 3259</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
+<div class="line"><a name="l03260"></a><span class="lineno"> 3260</span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE pUserData);</div>
+<div class="line"><a name="l03261"></a><span class="lineno"> 3261</span>&#160; </div>
+<div class="line"><a name="l03272"></a><span class="lineno"> 3272</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae5c9657d9e94756269145b01c05d16f1">vmaCreateLostAllocation</a>(</div>
+<div class="line"><a name="l03273"></a><span class="lineno"> 3273</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03274"></a><span class="lineno"> 3274</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation);</div>
+<div class="line"><a name="l03275"></a><span class="lineno"> 3275</span>&#160; </div>
+<div class="line"><a name="l03314"></a><span class="lineno"> 3314</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069">vmaMapMemory</a>(</div>
+<div class="line"><a name="l03315"></a><span class="lineno"> 3315</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03316"></a><span class="lineno"> 3316</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
+<div class="line"><a name="l03317"></a><span class="lineno"> 3317</span>&#160;    <span class="keywordtype">void</span>* VMA_NULLABLE * VMA_NOT_NULL ppData);</div>
+<div class="line"><a name="l03318"></a><span class="lineno"> 3318</span>&#160; </div>
+<div class="line"><a name="l03327"></a><span class="lineno"> 3327</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45">vmaUnmapMemory</a>(</div>
+<div class="line"><a name="l03328"></a><span class="lineno"> 3328</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03329"></a><span class="lineno"> 3329</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation);</div>
+<div class="line"><a name="l03330"></a><span class="lineno"> 3330</span>&#160; </div>
+<div class="line"><a name="l03352"></a><span class="lineno"> 3352</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f">vmaFlushAllocation</a>(</div>
+<div class="line"><a name="l03353"></a><span class="lineno"> 3353</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03354"></a><span class="lineno"> 3354</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
+<div class="line"><a name="l03355"></a><span class="lineno"> 3355</span>&#160;    VkDeviceSize offset,</div>
+<div class="line"><a name="l03356"></a><span class="lineno"> 3356</span>&#160;    VkDeviceSize size);</div>
+<div class="line"><a name="l03357"></a><span class="lineno"> 3357</span>&#160; </div>
+<div class="line"><a name="l03379"></a><span class="lineno"> 3379</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae">vmaInvalidateAllocation</a>(</div>
+<div class="line"><a name="l03380"></a><span class="lineno"> 3380</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03381"></a><span class="lineno"> 3381</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
+<div class="line"><a name="l03382"></a><span class="lineno"> 3382</span>&#160;    VkDeviceSize offset,</div>
+<div class="line"><a name="l03383"></a><span class="lineno"> 3383</span>&#160;    VkDeviceSize size);</div>
+<div class="line"><a name="l03384"></a><span class="lineno"> 3384</span>&#160; </div>
+<div class="line"><a name="l03399"></a><span class="lineno"> 3399</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ac3dd00da721875ed99fa8a881922bdfc">vmaFlushAllocations</a>(</div>
+<div class="line"><a name="l03400"></a><span class="lineno"> 3400</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03401"></a><span class="lineno"> 3401</span>&#160;    uint32_t allocationCount,</div>
+<div class="line"><a name="l03402"></a><span class="lineno"> 3402</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) allocations,</div>
+<div class="line"><a name="l03403"></a><span class="lineno"> 3403</span>&#160;    <span class="keyword">const</span> VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) offsets,</div>
+<div class="line"><a name="l03404"></a><span class="lineno"> 3404</span>&#160;    <span class="keyword">const</span> VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) sizes);</div>
+<div class="line"><a name="l03405"></a><span class="lineno"> 3405</span>&#160; </div>
+<div class="line"><a name="l03420"></a><span class="lineno"> 3420</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5">vmaInvalidateAllocations</a>(</div>
+<div class="line"><a name="l03421"></a><span class="lineno"> 3421</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03422"></a><span class="lineno"> 3422</span>&#160;    uint32_t allocationCount,</div>
+<div class="line"><a name="l03423"></a><span class="lineno"> 3423</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) allocations,</div>
+<div class="line"><a name="l03424"></a><span class="lineno"> 3424</span>&#160;    <span class="keyword">const</span> VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) offsets,</div>
+<div class="line"><a name="l03425"></a><span class="lineno"> 3425</span>&#160;    <span class="keyword">const</span> VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) sizes);</div>
+<div class="line"><a name="l03426"></a><span class="lineno"> 3426</span>&#160; </div>
+<div class="line"><a name="l03443"></a><span class="lineno"> 3443</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98">vmaCheckCorruption</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator, uint32_t memoryTypeBits);</div>
+<div class="line"><a name="l03444"></a><span class="lineno"> 3444</span>&#160; </div>
+<div class="line"><a name="l03451"></a><span class="lineno"> 3451</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a>)</div>
+<div class="line"><a name="l03452"></a><span class="lineno"> 3452</span>&#160; </div>
+<div class="line"><a name="l03453"></a><span class="lineno"> 3453</span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50c">VmaDefragmentationFlagBits</a> {</div>
+<div class="line"><a name="l03455"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33"> 3455</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a> = 0x1,</div>
+<div class="line"><a name="l03456"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97"> 3456</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97">VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
+<div class="line"><a name="l03457"></a><span class="lineno"> 3457</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50c">VmaDefragmentationFlagBits</a>;</div>
+<div class="line"><a name="l03458"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d"> 3458</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a>;</div>
+<div class="line"><a name="l03459"></a><span class="lineno"> 3459</span>&#160; </div>
+<div class="line"><a name="l03464"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html"> 3464</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a> {</div>
+<div class="line"><a name="l03467"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9"> 3467</a></span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> <a class="code" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9">flags</a>;</div>
+<div class="line"><a name="l03470"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba"> 3470</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a>;</div>
+<div class="line"><a name="l03479"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32"> 3479</a></span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) <a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a>;</div>
+<div class="line"><a name="l03485"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc"> 3485</a></span>&#160;    VkBool32* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) <a class="code" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">pAllocationsChanged</a>;</div>
+<div class="line"><a name="l03488"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d"> 3488</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a>;</div>
+<div class="line"><a name="l03504"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b"> 3504</a></span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a> VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(poolCount) <a class="code" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">pPools</a>;</div>
+<div class="line"><a name="l03509"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a"> 3509</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">maxCpuBytesToMove</a>;</div>
+<div class="line"><a name="l03514"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671"> 3514</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">maxCpuAllocationsToMove</a>;</div>
+<div class="line"><a name="l03519"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08"> 3519</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08">maxGpuBytesToMove</a>;</div>
+<div class="line"><a name="l03524"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6"> 3524</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6">maxGpuAllocationsToMove</a>;</div>
+<div class="line"><a name="l03533"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd"> 3533</a></span>&#160;    VkCommandBuffer VMA_NULLABLE <a class="code" href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd">commandBuffer</a>;</div>
+<div class="line"><a name="l03534"></a><span class="lineno"> 3534</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ad6daeffaa670ce6d11a203a6224c9937">VmaDefragmentationInfo2</a>;</div>
+<div class="line"><a name="l03535"></a><span class="lineno"> 3535</span>&#160; </div>
+<div class="line"><a name="l03536"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_move_info.html"> 3536</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a> {</div>
+<div class="line"><a name="l03537"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_move_info.html#ae885c861c2dd8d622e6c19e281d035cc"> 3537</a></span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL <a class="code" href="struct_vma_defragmentation_pass_move_info.html#ae885c861c2dd8d622e6c19e281d035cc">allocation</a>;</div>
+<div class="line"><a name="l03538"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_move_info.html#a06eb0c8690aa0d3478a036753492e769"> 3538</a></span>&#160;    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE <a class="code" href="struct_vma_defragmentation_pass_move_info.html#a06eb0c8690aa0d3478a036753492e769">memory</a>;</div>
+<div class="line"><a name="l03539"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_move_info.html#a8ab4508bc03625b0653c880576be96c6"> 3539</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_pass_move_info.html#a8ab4508bc03625b0653c880576be96c6">offset</a>;</div>
+<div class="line"><a name="l03540"></a><span class="lineno"> 3540</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ad6799e8e2b1527abfc84d33bc44aeaf5">VmaDefragmentationPassMoveInfo</a>;</div>
+<div class="line"><a name="l03541"></a><span class="lineno"> 3541</span>&#160; </div>
+<div class="line"><a name="l03546"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_info.html"> 3546</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a> {</div>
+<div class="line"><a name="l03547"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c"> 3547</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a>;</div>
+<div class="line"><a name="l03548"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792"> 3548</a></span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a>* VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(moveCount) <a class="code" href="struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792">pMoves</a>;</div>
+<div class="line"><a name="l03549"></a><span class="lineno"> 3549</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a72aebd522242d56abea67b4f47f6549e">VmaDefragmentationPassInfo</a>;</div>
+<div class="line"><a name="l03550"></a><span class="lineno"> 3550</span>&#160; </div>
+<div class="line"><a name="l03555"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info.html"> 3555</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a> {</div>
+<div class="line"><a name="l03560"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d"> 3560</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d">maxBytesToMove</a>;</div>
+<div class="line"><a name="l03565"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc"> 3565</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc">maxAllocationsToMove</a>;</div>
+<div class="line"><a name="l03566"></a><span class="lineno"> 3566</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a2bf47f96bf92bed2a49461bd9af3acfa">VmaDefragmentationInfo</a>;</div>
+<div class="line"><a name="l03567"></a><span class="lineno"> 3567</span>&#160; </div>
+<div class="line"><a name="l03569"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html"> 3569</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a> {</div>
+<div class="line"><a name="l03571"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d"> 3571</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d">bytesMoved</a>;</div>
+<div class="line"><a name="l03573"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28"> 3573</a></span>&#160;    VkDeviceSize <a class="code" href="struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28">bytesFreed</a>;</div>
+<div class="line"><a name="l03575"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9"> 3575</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9">allocationsMoved</a>;</div>
+<div class="line"><a name="l03577"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b"> 3577</a></span>&#160;    uint32_t <a class="code" href="struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b">deviceMemoryBlocksFreed</a>;</div>
+<div class="line"><a name="l03578"></a><span class="lineno"> 3578</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ad94034192259c2e34a4d1c5e27810403">VmaDefragmentationStats</a>;</div>
+<div class="line"><a name="l03579"></a><span class="lineno"> 3579</span>&#160; </div>
+<div class="line"><a name="l03609"></a><span class="lineno"> 3609</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a36ba776fd7fd5cb1e9359fdc0d8e6e8a">vmaDefragmentationBegin</a>(</div>
+<div class="line"><a name="l03610"></a><span class="lineno"> 3610</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03611"></a><span class="lineno"> 3611</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>* VMA_NOT_NULL pInfo,</div>
+<div class="line"><a name="l03612"></a><span class="lineno"> 3612</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* VMA_NULLABLE pStats,</div>
+<div class="line"><a name="l03613"></a><span class="lineno"> 3613</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> VMA_NULLABLE * VMA_NOT_NULL pContext);</div>
+<div class="line"><a name="l03614"></a><span class="lineno"> 3614</span>&#160; </div>
+<div class="line"><a name="l03620"></a><span class="lineno"> 3620</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a8774e20e91e245aae959ba63efa15dd2">vmaDefragmentationEnd</a>(</div>
+<div class="line"><a name="l03621"></a><span class="lineno"> 3621</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03622"></a><span class="lineno"> 3622</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> VMA_NULLABLE context);</div>
+<div class="line"><a name="l03623"></a><span class="lineno"> 3623</span>&#160; </div>
+<div class="line"><a name="l03624"></a><span class="lineno"> 3624</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ac0f01545b6262f7d4d128fc8f8e5c77b">vmaBeginDefragmentationPass</a>(</div>
+<div class="line"><a name="l03625"></a><span class="lineno"> 3625</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03626"></a><span class="lineno"> 3626</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> VMA_NULLABLE context,</div>
+<div class="line"><a name="l03627"></a><span class="lineno"> 3627</span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* VMA_NOT_NULL pInfo</div>
+<div class="line"><a name="l03628"></a><span class="lineno"> 3628</span>&#160;);</div>
+<div class="line"><a name="l03629"></a><span class="lineno"> 3629</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a1b9ffa538bed905af55c747cc48963bd">vmaEndDefragmentationPass</a>(</div>
+<div class="line"><a name="l03630"></a><span class="lineno"> 3630</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03631"></a><span class="lineno"> 3631</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> VMA_NULLABLE context</div>
+<div class="line"><a name="l03632"></a><span class="lineno"> 3632</span>&#160;);</div>
+<div class="line"><a name="l03633"></a><span class="lineno"> 3633</span>&#160; </div>
+<div class="line"><a name="l03674"></a><span class="lineno"> 3674</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a9f0f8f56db5f7f57fe4454f465142dac">vmaDefragment</a>(</div>
+<div class="line"><a name="l03675"></a><span class="lineno"> 3675</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03676"></a><span class="lineno"> 3676</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations,</div>
+<div class="line"><a name="l03677"></a><span class="lineno"> 3677</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l03678"></a><span class="lineno"> 3678</span>&#160;    VkBool32* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationsChanged,</div>
+<div class="line"><a name="l03679"></a><span class="lineno"> 3679</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a>* VMA_NULLABLE pDefragmentationInfo,</div>
+<div class="line"><a name="l03680"></a><span class="lineno"> 3680</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* VMA_NULLABLE pDefragmentationStats);</div>
+<div class="line"><a name="l03681"></a><span class="lineno"> 3681</span>&#160; </div>
+<div class="line"><a name="l03694"></a><span class="lineno"> 3694</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470">vmaBindBufferMemory</a>(</div>
 <div class="line"><a name="l03695"></a><span class="lineno"> 3695</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
 <div class="line"><a name="l03696"></a><span class="lineno"> 3696</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
-<div class="line"><a name="l03697"></a><span class="lineno"> 3697</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l03698"></a><span class="lineno"> 3698</span>&#160;    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image,</div>
-<div class="line"><a name="l03699"></a><span class="lineno"> 3699</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* VMA_NULLABLE pNext);</div>
-<div class="line"><a name="l03700"></a><span class="lineno"> 3700</span>&#160; </div>
-<div class="line"><a name="l03727"></a><span class="lineno"> 3727</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(</div>
-<div class="line"><a name="l03728"></a><span class="lineno"> 3728</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03729"></a><span class="lineno"> 3729</span>&#160;    <span class="keyword">const</span> VkBufferCreateInfo* VMA_NOT_NULL pBufferCreateInfo,</div>
-<div class="line"><a name="l03730"></a><span class="lineno"> 3730</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pAllocationCreateInfo,</div>
-<div class="line"><a name="l03731"></a><span class="lineno"> 3731</span>&#160;    VkBuffer VMA_NULLABLE_NON_DISPATCHABLE * VMA_NOT_NULL pBuffer,</div>
-<div class="line"><a name="l03732"></a><span class="lineno"> 3732</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation,</div>
-<div class="line"><a name="l03733"></a><span class="lineno"> 3733</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE pAllocationInfo);</div>
-<div class="line"><a name="l03734"></a><span class="lineno"> 3734</span>&#160; </div>
-<div class="line"><a name="l03746"></a><span class="lineno"> 3746</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a>(</div>
-<div class="line"><a name="l03747"></a><span class="lineno"> 3747</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03748"></a><span class="lineno"> 3748</span>&#160;    VkBuffer VMA_NULLABLE_NON_DISPATCHABLE buffer,</div>
-<div class="line"><a name="l03749"></a><span class="lineno"> 3749</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE allocation);</div>
-<div class="line"><a name="l03750"></a><span class="lineno"> 3750</span>&#160; </div>
-<div class="line"><a name="l03752"></a><span class="lineno"> 3752</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73">vmaCreateImage</a>(</div>
-<div class="line"><a name="l03753"></a><span class="lineno"> 3753</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03754"></a><span class="lineno"> 3754</span>&#160;    <span class="keyword">const</span> VkImageCreateInfo* VMA_NOT_NULL pImageCreateInfo,</div>
-<div class="line"><a name="l03755"></a><span class="lineno"> 3755</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pAllocationCreateInfo,</div>
-<div class="line"><a name="l03756"></a><span class="lineno"> 3756</span>&#160;    VkImage VMA_NULLABLE_NON_DISPATCHABLE * VMA_NOT_NULL pImage,</div>
-<div class="line"><a name="l03757"></a><span class="lineno"> 3757</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation,</div>
-<div class="line"><a name="l03758"></a><span class="lineno"> 3758</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE pAllocationInfo);</div>
-<div class="line"><a name="l03759"></a><span class="lineno"> 3759</span>&#160; </div>
-<div class="line"><a name="l03771"></a><span class="lineno"> 3771</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae50d2cb3b4a3bfd4dd40987234e50e7e">vmaDestroyImage</a>(</div>
-<div class="line"><a name="l03772"></a><span class="lineno"> 3772</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
-<div class="line"><a name="l03773"></a><span class="lineno"> 3773</span>&#160;    VkImage VMA_NULLABLE_NON_DISPATCHABLE image,</div>
-<div class="line"><a name="l03774"></a><span class="lineno"> 3774</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE allocation);</div>
-<div class="line"><a name="l03775"></a><span class="lineno"> 3775</span>&#160; </div>
-<div class="line"><a name="l03776"></a><span class="lineno"> 3776</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div>
-<div class="line"><a name="l03777"></a><span class="lineno"> 3777</span>&#160;}</div>
-<div class="line"><a name="l03778"></a><span class="lineno"> 3778</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03779"></a><span class="lineno"> 3779</span>&#160; </div>
-<div class="line"><a name="l03780"></a><span class="lineno"> 3780</span>&#160;<span class="preprocessor">#endif // AMD_VULKAN_MEMORY_ALLOCATOR_H</span></div>
-<div class="line"><a name="l03781"></a><span class="lineno"> 3781</span>&#160; </div>
-<div class="line"><a name="l03782"></a><span class="lineno"> 3782</span>&#160;<span class="comment">// For Visual Studio IntelliSense.</span></div>
-<div class="line"><a name="l03783"></a><span class="lineno"> 3783</span>&#160;<span class="preprocessor">#if defined(__cplusplus) &amp;&amp; defined(__INTELLISENSE__)</span></div>
-<div class="line"><a name="l03784"></a><span class="lineno"> 3784</span>&#160;<span class="preprocessor">#define VMA_IMPLEMENTATION</span></div>
-<div class="line"><a name="l03785"></a><span class="lineno"> 3785</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03786"></a><span class="lineno"> 3786</span>&#160; </div>
-<div class="line"><a name="l03787"></a><span class="lineno"> 3787</span>&#160;<span class="preprocessor">#ifdef VMA_IMPLEMENTATION</span></div>
-<div class="line"><a name="l03788"></a><span class="lineno"> 3788</span>&#160;<span class="preprocessor">#undef VMA_IMPLEMENTATION</span></div>
-<div class="line"><a name="l03789"></a><span class="lineno"> 3789</span>&#160; </div>
-<div class="line"><a name="l03790"></a><span class="lineno"> 3790</span>&#160;<span class="preprocessor">#include &lt;cstdint&gt;</span></div>
-<div class="line"><a name="l03791"></a><span class="lineno"> 3791</span>&#160;<span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
-<div class="line"><a name="l03792"></a><span class="lineno"> 3792</span>&#160;<span class="preprocessor">#include &lt;cstring&gt;</span></div>
-<div class="line"><a name="l03793"></a><span class="lineno"> 3793</span>&#160;<span class="preprocessor">#include &lt;utility&gt;</span></div>
-<div class="line"><a name="l03794"></a><span class="lineno"> 3794</span>&#160; </div>
-<div class="line"><a name="l03795"></a><span class="lineno"> 3795</span>&#160;<span class="comment">/*******************************************************************************</span></div>
-<div class="line"><a name="l03796"></a><span class="lineno"> 3796</span>&#160;<span class="comment">CONFIGURATION SECTION</span></div>
-<div class="line"><a name="l03797"></a><span class="lineno"> 3797</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l03798"></a><span class="lineno"> 3798</span>&#160;<span class="comment">Define some of these macros before each #include of this header or change them</span></div>
-<div class="line"><a name="l03799"></a><span class="lineno"> 3799</span>&#160;<span class="comment">here if you need other then default behavior depending on your environment.</span></div>
-<div class="line"><a name="l03800"></a><span class="lineno"> 3800</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l03801"></a><span class="lineno"> 3801</span>&#160; </div>
-<div class="line"><a name="l03802"></a><span class="lineno"> 3802</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l03803"></a><span class="lineno"> 3803</span>&#160;<span class="comment">Define this macro to 1 to make the library fetch pointers to Vulkan functions</span></div>
-<div class="line"><a name="l03804"></a><span class="lineno"> 3804</span>&#160;<span class="comment">internally, like:</span></div>
-<div class="line"><a name="l03805"></a><span class="lineno"> 3805</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l03806"></a><span class="lineno"> 3806</span>&#160;<span class="comment">    vulkanFunctions.vkAllocateMemory = &amp;vkAllocateMemory;</span></div>
-<div class="line"><a name="l03807"></a><span class="lineno"> 3807</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l03808"></a><span class="lineno"> 3808</span>&#160;<span class="preprocessor">#if !defined(VMA_STATIC_VULKAN_FUNCTIONS) &amp;&amp; !defined(VK_NO_PROTOTYPES)</span></div>
-<div class="line"><a name="l03809"></a><span class="lineno"> 3809</span>&#160;<span class="preprocessor">    #define VMA_STATIC_VULKAN_FUNCTIONS 1</span></div>
-<div class="line"><a name="l03810"></a><span class="lineno"> 3810</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03811"></a><span class="lineno"> 3811</span>&#160; </div>
-<div class="line"><a name="l03812"></a><span class="lineno"> 3812</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l03813"></a><span class="lineno"> 3813</span>&#160;<span class="comment">Define this macro to 1 to make the library fetch pointers to Vulkan functions</span></div>
-<div class="line"><a name="l03814"></a><span class="lineno"> 3814</span>&#160;<span class="comment">internally, like:</span></div>
-<div class="line"><a name="l03815"></a><span class="lineno"> 3815</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l03816"></a><span class="lineno"> 3816</span>&#160;<span class="comment">    vulkanFunctions.vkAllocateMemory = (PFN_vkAllocateMemory)vkGetDeviceProcAddr(m_hDevice, vkAllocateMemory);</span></div>
-<div class="line"><a name="l03817"></a><span class="lineno"> 3817</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l03818"></a><span class="lineno"> 3818</span>&#160;<span class="preprocessor">#if !defined(VMA_DYNAMIC_VULKAN_FUNCTIONS)</span></div>
-<div class="line"><a name="l03819"></a><span class="lineno"> 3819</span>&#160;<span class="preprocessor">    #define VMA_DYNAMIC_VULKAN_FUNCTIONS 1</span></div>
-<div class="line"><a name="l03820"></a><span class="lineno"> 3820</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03821"></a><span class="lineno"> 3821</span>&#160; </div>
-<div class="line"><a name="l03822"></a><span class="lineno"> 3822</span>&#160;<span class="comment">// Define this macro to 1 to make the library use STL containers instead of its own implementation.</span></div>
-<div class="line"><a name="l03823"></a><span class="lineno"> 3823</span>&#160;<span class="comment">//#define VMA_USE_STL_CONTAINERS 1</span></div>
+<div class="line"><a name="l03697"></a><span class="lineno"> 3697</span>&#160;    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer);</div>
+<div class="line"><a name="l03698"></a><span class="lineno"> 3698</span>&#160; </div>
+<div class="line"><a name="l03709"></a><span class="lineno"> 3709</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a">vmaBindBufferMemory2</a>(</div>
+<div class="line"><a name="l03710"></a><span class="lineno"> 3710</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03711"></a><span class="lineno"> 3711</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
+<div class="line"><a name="l03712"></a><span class="lineno"> 3712</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l03713"></a><span class="lineno"> 3713</span>&#160;    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer,</div>
+<div class="line"><a name="l03714"></a><span class="lineno"> 3714</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* VMA_NULLABLE pNext);</div>
+<div class="line"><a name="l03715"></a><span class="lineno"> 3715</span>&#160; </div>
+<div class="line"><a name="l03728"></a><span class="lineno"> 3728</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5">vmaBindImageMemory</a>(</div>
+<div class="line"><a name="l03729"></a><span class="lineno"> 3729</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03730"></a><span class="lineno"> 3730</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
+<div class="line"><a name="l03731"></a><span class="lineno"> 3731</span>&#160;    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image);</div>
+<div class="line"><a name="l03732"></a><span class="lineno"> 3732</span>&#160; </div>
+<div class="line"><a name="l03743"></a><span class="lineno"> 3743</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc">vmaBindImageMemory2</a>(</div>
+<div class="line"><a name="l03744"></a><span class="lineno"> 3744</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03745"></a><span class="lineno"> 3745</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NOT_NULL allocation,</div>
+<div class="line"><a name="l03746"></a><span class="lineno"> 3746</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l03747"></a><span class="lineno"> 3747</span>&#160;    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image,</div>
+<div class="line"><a name="l03748"></a><span class="lineno"> 3748</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* VMA_NULLABLE pNext);</div>
+<div class="line"><a name="l03749"></a><span class="lineno"> 3749</span>&#160; </div>
+<div class="line"><a name="l03776"></a><span class="lineno"> 3776</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(</div>
+<div class="line"><a name="l03777"></a><span class="lineno"> 3777</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03778"></a><span class="lineno"> 3778</span>&#160;    <span class="keyword">const</span> VkBufferCreateInfo* VMA_NOT_NULL pBufferCreateInfo,</div>
+<div class="line"><a name="l03779"></a><span class="lineno"> 3779</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pAllocationCreateInfo,</div>
+<div class="line"><a name="l03780"></a><span class="lineno"> 3780</span>&#160;    VkBuffer VMA_NULLABLE_NON_DISPATCHABLE * VMA_NOT_NULL pBuffer,</div>
+<div class="line"><a name="l03781"></a><span class="lineno"> 3781</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation,</div>
+<div class="line"><a name="l03782"></a><span class="lineno"> 3782</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE pAllocationInfo);</div>
+<div class="line"><a name="l03783"></a><span class="lineno"> 3783</span>&#160; </div>
+<div class="line"><a name="l03795"></a><span class="lineno"> 3795</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a>(</div>
+<div class="line"><a name="l03796"></a><span class="lineno"> 3796</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03797"></a><span class="lineno"> 3797</span>&#160;    VkBuffer VMA_NULLABLE_NON_DISPATCHABLE buffer,</div>
+<div class="line"><a name="l03798"></a><span class="lineno"> 3798</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE allocation);</div>
+<div class="line"><a name="l03799"></a><span class="lineno"> 3799</span>&#160; </div>
+<div class="line"><a name="l03801"></a><span class="lineno"> 3801</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73">vmaCreateImage</a>(</div>
+<div class="line"><a name="l03802"></a><span class="lineno"> 3802</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03803"></a><span class="lineno"> 3803</span>&#160;    <span class="keyword">const</span> VkImageCreateInfo* VMA_NOT_NULL pImageCreateInfo,</div>
+<div class="line"><a name="l03804"></a><span class="lineno"> 3804</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* VMA_NOT_NULL pAllocationCreateInfo,</div>
+<div class="line"><a name="l03805"></a><span class="lineno"> 3805</span>&#160;    VkImage VMA_NULLABLE_NON_DISPATCHABLE * VMA_NOT_NULL pImage,</div>
+<div class="line"><a name="l03806"></a><span class="lineno"> 3806</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE * VMA_NOT_NULL pAllocation,</div>
+<div class="line"><a name="l03807"></a><span class="lineno"> 3807</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* VMA_NULLABLE pAllocationInfo);</div>
+<div class="line"><a name="l03808"></a><span class="lineno"> 3808</span>&#160; </div>
+<div class="line"><a name="l03820"></a><span class="lineno"> 3820</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae50d2cb3b4a3bfd4dd40987234e50e7e">vmaDestroyImage</a>(</div>
+<div class="line"><a name="l03821"></a><span class="lineno"> 3821</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> VMA_NOT_NULL allocator,</div>
+<div class="line"><a name="l03822"></a><span class="lineno"> 3822</span>&#160;    VkImage VMA_NULLABLE_NON_DISPATCHABLE image,</div>
+<div class="line"><a name="l03823"></a><span class="lineno"> 3823</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VMA_NULLABLE allocation);</div>
 <div class="line"><a name="l03824"></a><span class="lineno"> 3824</span>&#160; </div>
-<div class="line"><a name="l03825"></a><span class="lineno"> 3825</span>&#160;<span class="comment">/* Set this macro to 1 to make the library including and using STL containers:</span></div>
-<div class="line"><a name="l03826"></a><span class="lineno"> 3826</span>&#160;<span class="comment">std::pair, std::vector, std::list, std::unordered_map.</span></div>
-<div class="line"><a name="l03827"></a><span class="lineno"> 3827</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l03828"></a><span class="lineno"> 3828</span>&#160;<span class="comment">Set it to 0 or undefined to make the library using its own implementation of</span></div>
-<div class="line"><a name="l03829"></a><span class="lineno"> 3829</span>&#160;<span class="comment">the containers.</span></div>
-<div class="line"><a name="l03830"></a><span class="lineno"> 3830</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l03831"></a><span class="lineno"> 3831</span>&#160;<span class="preprocessor">#if VMA_USE_STL_CONTAINERS</span></div>
-<div class="line"><a name="l03832"></a><span class="lineno"> 3832</span>&#160;<span class="preprocessor">   #define VMA_USE_STL_VECTOR 1</span></div>
-<div class="line"><a name="l03833"></a><span class="lineno"> 3833</span>&#160;<span class="preprocessor">   #define VMA_USE_STL_UNORDERED_MAP 1</span></div>
-<div class="line"><a name="l03834"></a><span class="lineno"> 3834</span>&#160;<span class="preprocessor">   #define VMA_USE_STL_LIST 1</span></div>
-<div class="line"><a name="l03835"></a><span class="lineno"> 3835</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03836"></a><span class="lineno"> 3836</span>&#160; </div>
-<div class="line"><a name="l03837"></a><span class="lineno"> 3837</span>&#160;<span class="preprocessor">#ifndef VMA_USE_STL_SHARED_MUTEX</span></div>
-<div class="line"><a name="l03838"></a><span class="lineno"> 3838</span>&#160;    <span class="comment">// Compiler conforms to C++17.</span></div>
-<div class="line"><a name="l03839"></a><span class="lineno"> 3839</span>&#160;<span class="preprocessor">    #if __cplusplus &gt;= 201703L</span></div>
-<div class="line"><a name="l03840"></a><span class="lineno"> 3840</span>&#160;<span class="preprocessor">        #define VMA_USE_STL_SHARED_MUTEX 1</span></div>
-<div class="line"><a name="l03841"></a><span class="lineno"> 3841</span>&#160;    <span class="comment">// Visual studio defines __cplusplus properly only when passed additional parameter: /Zc:__cplusplus</span></div>
-<div class="line"><a name="l03842"></a><span class="lineno"> 3842</span>&#160;    <span class="comment">// Otherwise it&#39;s always 199711L, despite shared_mutex works since Visual Studio 2015 Update 2.</span></div>
-<div class="line"><a name="l03843"></a><span class="lineno"> 3843</span>&#160;    <span class="comment">// See: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/</span></div>
-<div class="line"><a name="l03844"></a><span class="lineno"> 3844</span>&#160;<span class="preprocessor">    #elif defined(_MSC_FULL_VER) &amp;&amp; _MSC_FULL_VER &gt;= 190023918 &amp;&amp; __cplusplus == 199711L &amp;&amp; _MSVC_LANG &gt;= 201703L</span></div>
-<div class="line"><a name="l03845"></a><span class="lineno"> 3845</span>&#160;<span class="preprocessor">        #define VMA_USE_STL_SHARED_MUTEX 1</span></div>
-<div class="line"><a name="l03846"></a><span class="lineno"> 3846</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l03847"></a><span class="lineno"> 3847</span>&#160;<span class="preprocessor">        #define VMA_USE_STL_SHARED_MUTEX 0</span></div>
-<div class="line"><a name="l03848"></a><span class="lineno"> 3848</span>&#160;<span class="preprocessor">    #endif</span></div>
-<div class="line"><a name="l03849"></a><span class="lineno"> 3849</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03825"></a><span class="lineno"> 3825</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div>
+<div class="line"><a name="l03826"></a><span class="lineno"> 3826</span>&#160;}</div>
+<div class="line"><a name="l03827"></a><span class="lineno"> 3827</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03828"></a><span class="lineno"> 3828</span>&#160; </div>
+<div class="line"><a name="l03829"></a><span class="lineno"> 3829</span>&#160;<span class="preprocessor">#endif // AMD_VULKAN_MEMORY_ALLOCATOR_H</span></div>
+<div class="line"><a name="l03830"></a><span class="lineno"> 3830</span>&#160; </div>
+<div class="line"><a name="l03831"></a><span class="lineno"> 3831</span>&#160;<span class="comment">// For Visual Studio IntelliSense.</span></div>
+<div class="line"><a name="l03832"></a><span class="lineno"> 3832</span>&#160;<span class="preprocessor">#if defined(__cplusplus) &amp;&amp; defined(__INTELLISENSE__)</span></div>
+<div class="line"><a name="l03833"></a><span class="lineno"> 3833</span>&#160;<span class="preprocessor">#define VMA_IMPLEMENTATION</span></div>
+<div class="line"><a name="l03834"></a><span class="lineno"> 3834</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03835"></a><span class="lineno"> 3835</span>&#160; </div>
+<div class="line"><a name="l03836"></a><span class="lineno"> 3836</span>&#160;<span class="preprocessor">#ifdef VMA_IMPLEMENTATION</span></div>
+<div class="line"><a name="l03837"></a><span class="lineno"> 3837</span>&#160;<span class="preprocessor">#undef VMA_IMPLEMENTATION</span></div>
+<div class="line"><a name="l03838"></a><span class="lineno"> 3838</span>&#160; </div>
+<div class="line"><a name="l03839"></a><span class="lineno"> 3839</span>&#160;<span class="preprocessor">#include &lt;cstdint&gt;</span></div>
+<div class="line"><a name="l03840"></a><span class="lineno"> 3840</span>&#160;<span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
+<div class="line"><a name="l03841"></a><span class="lineno"> 3841</span>&#160;<span class="preprocessor">#include &lt;cstring&gt;</span></div>
+<div class="line"><a name="l03842"></a><span class="lineno"> 3842</span>&#160;<span class="preprocessor">#include &lt;utility&gt;</span></div>
+<div class="line"><a name="l03843"></a><span class="lineno"> 3843</span>&#160; </div>
+<div class="line"><a name="l03844"></a><span class="lineno"> 3844</span>&#160;<span class="comment">/*******************************************************************************</span></div>
+<div class="line"><a name="l03845"></a><span class="lineno"> 3845</span>&#160;<span class="comment">CONFIGURATION SECTION</span></div>
+<div class="line"><a name="l03846"></a><span class="lineno"> 3846</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l03847"></a><span class="lineno"> 3847</span>&#160;<span class="comment">Define some of these macros before each #include of this header or change them</span></div>
+<div class="line"><a name="l03848"></a><span class="lineno"> 3848</span>&#160;<span class="comment">here if you need other then default behavior depending on your environment.</span></div>
+<div class="line"><a name="l03849"></a><span class="lineno"> 3849</span>&#160;<span class="comment">*/</span></div>
 <div class="line"><a name="l03850"></a><span class="lineno"> 3850</span>&#160; </div>
 <div class="line"><a name="l03851"></a><span class="lineno"> 3851</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l03852"></a><span class="lineno"> 3852</span>&#160;<span class="comment">THESE INCLUDES ARE NOT ENABLED BY DEFAULT.</span></div>
-<div class="line"><a name="l03853"></a><span class="lineno"> 3853</span>&#160;<span class="comment">Library has its own container implementation.</span></div>
-<div class="line"><a name="l03854"></a><span class="lineno"> 3854</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l03855"></a><span class="lineno"> 3855</span>&#160;<span class="preprocessor">#if VMA_USE_STL_VECTOR</span></div>
-<div class="line"><a name="l03856"></a><span class="lineno"> 3856</span>&#160;<span class="preprocessor">   #include &lt;vector&gt;</span></div>
-<div class="line"><a name="l03857"></a><span class="lineno"> 3857</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03858"></a><span class="lineno"> 3858</span>&#160; </div>
-<div class="line"><a name="l03859"></a><span class="lineno"> 3859</span>&#160;<span class="preprocessor">#if VMA_USE_STL_UNORDERED_MAP</span></div>
-<div class="line"><a name="l03860"></a><span class="lineno"> 3860</span>&#160;<span class="preprocessor">   #include &lt;unordered_map&gt;</span></div>
-<div class="line"><a name="l03861"></a><span class="lineno"> 3861</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03862"></a><span class="lineno"> 3862</span>&#160; </div>
-<div class="line"><a name="l03863"></a><span class="lineno"> 3863</span>&#160;<span class="preprocessor">#if VMA_USE_STL_LIST</span></div>
-<div class="line"><a name="l03864"></a><span class="lineno"> 3864</span>&#160;<span class="preprocessor">   #include &lt;list&gt;</span></div>
-<div class="line"><a name="l03865"></a><span class="lineno"> 3865</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03866"></a><span class="lineno"> 3866</span>&#160; </div>
-<div class="line"><a name="l03867"></a><span class="lineno"> 3867</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l03868"></a><span class="lineno"> 3868</span>&#160;<span class="comment">Following headers are used in this CONFIGURATION section only, so feel free to</span></div>
-<div class="line"><a name="l03869"></a><span class="lineno"> 3869</span>&#160;<span class="comment">remove them if not needed.</span></div>
-<div class="line"><a name="l03870"></a><span class="lineno"> 3870</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l03871"></a><span class="lineno"> 3871</span>&#160;<span class="preprocessor">#include &lt;cassert&gt;</span> <span class="comment">// for assert</span></div>
-<div class="line"><a name="l03872"></a><span class="lineno"> 3872</span>&#160;<span class="preprocessor">#include &lt;algorithm&gt;</span> <span class="comment">// for min, max</span></div>
-<div class="line"><a name="l03873"></a><span class="lineno"> 3873</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div>
-<div class="line"><a name="l03874"></a><span class="lineno"> 3874</span>&#160; </div>
-<div class="line"><a name="l03875"></a><span class="lineno"> 3875</span>&#160;<span class="preprocessor">#ifndef VMA_NULL</span></div>
-<div class="line"><a name="l03876"></a><span class="lineno"> 3876</span>&#160;   <span class="comment">// Value used as null pointer. Define it to e.g.: nullptr, NULL, 0, (void*)0.</span></div>
-<div class="line"><a name="l03877"></a><span class="lineno"> 3877</span>&#160;<span class="preprocessor">   #define VMA_NULL   nullptr</span></div>
-<div class="line"><a name="l03878"></a><span class="lineno"> 3878</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03879"></a><span class="lineno"> 3879</span>&#160; </div>
-<div class="line"><a name="l03880"></a><span class="lineno"> 3880</span>&#160;<span class="preprocessor">#if defined(__ANDROID_API__) &amp;&amp; (__ANDROID_API__ &lt; 16)</span></div>
-<div class="line"><a name="l03881"></a><span class="lineno"> 3881</span>&#160;<span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
-<div class="line"><a name="l03882"></a><span class="lineno"> 3882</span>&#160;<span class="keywordtype">void</span> *aligned_alloc(<span class="keywordtype">size_t</span> alignment, <span class="keywordtype">size_t</span> size)</div>
-<div class="line"><a name="l03883"></a><span class="lineno"> 3883</span>&#160;{</div>
-<div class="line"><a name="l03884"></a><span class="lineno"> 3884</span>&#160;    <span class="comment">// alignment must be &gt;= sizeof(void*)</span></div>
-<div class="line"><a name="l03885"></a><span class="lineno"> 3885</span>&#160;    <span class="keywordflow">if</span>(alignment &lt; <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*))</div>
-<div class="line"><a name="l03886"></a><span class="lineno"> 3886</span>&#160;    {</div>
-<div class="line"><a name="l03887"></a><span class="lineno"> 3887</span>&#160;        alignment = <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*);</div>
-<div class="line"><a name="l03888"></a><span class="lineno"> 3888</span>&#160;    }</div>
-<div class="line"><a name="l03889"></a><span class="lineno"> 3889</span>&#160; </div>
-<div class="line"><a name="l03890"></a><span class="lineno"> 3890</span>&#160;    <span class="keywordflow">return</span> memalign(alignment, size);</div>
-<div class="line"><a name="l03891"></a><span class="lineno"> 3891</span>&#160;}</div>
-<div class="line"><a name="l03892"></a><span class="lineno"> 3892</span>&#160;<span class="preprocessor">#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) &amp;&amp; defined(__GLIBCXX__) &amp;&amp; !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))</span></div>
-<div class="line"><a name="l03893"></a><span class="lineno"> 3893</span>&#160;<span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
-<div class="line"><a name="l03894"></a><span class="lineno"> 3894</span>&#160;<span class="keywordtype">void</span> *aligned_alloc(<span class="keywordtype">size_t</span> alignment, <span class="keywordtype">size_t</span> size)</div>
-<div class="line"><a name="l03895"></a><span class="lineno"> 3895</span>&#160;{</div>
-<div class="line"><a name="l03896"></a><span class="lineno"> 3896</span>&#160;    <span class="comment">// alignment must be &gt;= sizeof(void*)</span></div>
-<div class="line"><a name="l03897"></a><span class="lineno"> 3897</span>&#160;    <span class="keywordflow">if</span>(alignment &lt; <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*))</div>
-<div class="line"><a name="l03898"></a><span class="lineno"> 3898</span>&#160;    {</div>
-<div class="line"><a name="l03899"></a><span class="lineno"> 3899</span>&#160;        alignment = <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*);</div>
-<div class="line"><a name="l03900"></a><span class="lineno"> 3900</span>&#160;    }</div>
-<div class="line"><a name="l03901"></a><span class="lineno"> 3901</span>&#160; </div>
-<div class="line"><a name="l03902"></a><span class="lineno"> 3902</span>&#160;    <span class="keywordtype">void</span> *pointer;</div>
-<div class="line"><a name="l03903"></a><span class="lineno"> 3903</span>&#160;    <span class="keywordflow">if</span>(posix_memalign(&amp;pointer, alignment, size) == 0)</div>
-<div class="line"><a name="l03904"></a><span class="lineno"> 3904</span>&#160;        <span class="keywordflow">return</span> pointer;</div>
-<div class="line"><a name="l03905"></a><span class="lineno"> 3905</span>&#160;    <span class="keywordflow">return</span> VMA_NULL;</div>
-<div class="line"><a name="l03906"></a><span class="lineno"> 3906</span>&#160;}</div>
-<div class="line"><a name="l03907"></a><span class="lineno"> 3907</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03908"></a><span class="lineno"> 3908</span>&#160; </div>
-<div class="line"><a name="l03909"></a><span class="lineno"> 3909</span>&#160;<span class="comment">// If your compiler is not compatible with C++11 and definition of</span></div>
-<div class="line"><a name="l03910"></a><span class="lineno"> 3910</span>&#160;<span class="comment">// aligned_alloc() function is missing, uncommeting following line may help:</span></div>
+<div class="line"><a name="l03852"></a><span class="lineno"> 3852</span>&#160;<span class="comment">Define this macro to 1 to make the library fetch pointers to Vulkan functions</span></div>
+<div class="line"><a name="l03853"></a><span class="lineno"> 3853</span>&#160;<span class="comment">internally, like:</span></div>
+<div class="line"><a name="l03854"></a><span class="lineno"> 3854</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l03855"></a><span class="lineno"> 3855</span>&#160;<span class="comment">    vulkanFunctions.vkAllocateMemory = &amp;vkAllocateMemory;</span></div>
+<div class="line"><a name="l03856"></a><span class="lineno"> 3856</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l03857"></a><span class="lineno"> 3857</span>&#160;<span class="preprocessor">#if !defined(VMA_STATIC_VULKAN_FUNCTIONS) &amp;&amp; !defined(VK_NO_PROTOTYPES)</span></div>
+<div class="line"><a name="l03858"></a><span class="lineno"> 3858</span>&#160;<span class="preprocessor">    #define VMA_STATIC_VULKAN_FUNCTIONS 1</span></div>
+<div class="line"><a name="l03859"></a><span class="lineno"> 3859</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03860"></a><span class="lineno"> 3860</span>&#160; </div>
+<div class="line"><a name="l03861"></a><span class="lineno"> 3861</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l03862"></a><span class="lineno"> 3862</span>&#160;<span class="comment">Define this macro to 1 to make the library fetch pointers to Vulkan functions</span></div>
+<div class="line"><a name="l03863"></a><span class="lineno"> 3863</span>&#160;<span class="comment">internally, like:</span></div>
+<div class="line"><a name="l03864"></a><span class="lineno"> 3864</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l03865"></a><span class="lineno"> 3865</span>&#160;<span class="comment">    vulkanFunctions.vkAllocateMemory = (PFN_vkAllocateMemory)vkGetDeviceProcAddr(m_hDevice, vkAllocateMemory);</span></div>
+<div class="line"><a name="l03866"></a><span class="lineno"> 3866</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l03867"></a><span class="lineno"> 3867</span>&#160;<span class="preprocessor">#if !defined(VMA_DYNAMIC_VULKAN_FUNCTIONS)</span></div>
+<div class="line"><a name="l03868"></a><span class="lineno"> 3868</span>&#160;<span class="preprocessor">    #define VMA_DYNAMIC_VULKAN_FUNCTIONS 1</span></div>
+<div class="line"><a name="l03869"></a><span class="lineno"> 3869</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03870"></a><span class="lineno"> 3870</span>&#160; </div>
+<div class="line"><a name="l03871"></a><span class="lineno"> 3871</span>&#160;<span class="comment">// Define this macro to 1 to make the library use STL containers instead of its own implementation.</span></div>
+<div class="line"><a name="l03872"></a><span class="lineno"> 3872</span>&#160;<span class="comment">//#define VMA_USE_STL_CONTAINERS 1</span></div>
+<div class="line"><a name="l03873"></a><span class="lineno"> 3873</span>&#160; </div>
+<div class="line"><a name="l03874"></a><span class="lineno"> 3874</span>&#160;<span class="comment">/* Set this macro to 1 to make the library including and using STL containers:</span></div>
+<div class="line"><a name="l03875"></a><span class="lineno"> 3875</span>&#160;<span class="comment">std::pair, std::vector, std::list, std::unordered_map.</span></div>
+<div class="line"><a name="l03876"></a><span class="lineno"> 3876</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l03877"></a><span class="lineno"> 3877</span>&#160;<span class="comment">Set it to 0 or undefined to make the library using its own implementation of</span></div>
+<div class="line"><a name="l03878"></a><span class="lineno"> 3878</span>&#160;<span class="comment">the containers.</span></div>
+<div class="line"><a name="l03879"></a><span class="lineno"> 3879</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l03880"></a><span class="lineno"> 3880</span>&#160;<span class="preprocessor">#if VMA_USE_STL_CONTAINERS</span></div>
+<div class="line"><a name="l03881"></a><span class="lineno"> 3881</span>&#160;<span class="preprocessor">   #define VMA_USE_STL_VECTOR 1</span></div>
+<div class="line"><a name="l03882"></a><span class="lineno"> 3882</span>&#160;<span class="preprocessor">   #define VMA_USE_STL_UNORDERED_MAP 1</span></div>
+<div class="line"><a name="l03883"></a><span class="lineno"> 3883</span>&#160;<span class="preprocessor">   #define VMA_USE_STL_LIST 1</span></div>
+<div class="line"><a name="l03884"></a><span class="lineno"> 3884</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03885"></a><span class="lineno"> 3885</span>&#160; </div>
+<div class="line"><a name="l03886"></a><span class="lineno"> 3886</span>&#160;<span class="preprocessor">#ifndef VMA_USE_STL_SHARED_MUTEX</span></div>
+<div class="line"><a name="l03887"></a><span class="lineno"> 3887</span>&#160;    <span class="comment">// Compiler conforms to C++17.</span></div>
+<div class="line"><a name="l03888"></a><span class="lineno"> 3888</span>&#160;<span class="preprocessor">    #if __cplusplus &gt;= 201703L</span></div>
+<div class="line"><a name="l03889"></a><span class="lineno"> 3889</span>&#160;<span class="preprocessor">        #define VMA_USE_STL_SHARED_MUTEX 1</span></div>
+<div class="line"><a name="l03890"></a><span class="lineno"> 3890</span>&#160;    <span class="comment">// Visual studio defines __cplusplus properly only when passed additional parameter: /Zc:__cplusplus</span></div>
+<div class="line"><a name="l03891"></a><span class="lineno"> 3891</span>&#160;    <span class="comment">// Otherwise it&#39;s always 199711L, despite shared_mutex works since Visual Studio 2015 Update 2.</span></div>
+<div class="line"><a name="l03892"></a><span class="lineno"> 3892</span>&#160;    <span class="comment">// See: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/</span></div>
+<div class="line"><a name="l03893"></a><span class="lineno"> 3893</span>&#160;<span class="preprocessor">    #elif defined(_MSC_FULL_VER) &amp;&amp; _MSC_FULL_VER &gt;= 190023918 &amp;&amp; __cplusplus == 199711L &amp;&amp; _MSVC_LANG &gt;= 201703L</span></div>
+<div class="line"><a name="l03894"></a><span class="lineno"> 3894</span>&#160;<span class="preprocessor">        #define VMA_USE_STL_SHARED_MUTEX 1</span></div>
+<div class="line"><a name="l03895"></a><span class="lineno"> 3895</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l03896"></a><span class="lineno"> 3896</span>&#160;<span class="preprocessor">        #define VMA_USE_STL_SHARED_MUTEX 0</span></div>
+<div class="line"><a name="l03897"></a><span class="lineno"> 3897</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l03898"></a><span class="lineno"> 3898</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03899"></a><span class="lineno"> 3899</span>&#160; </div>
+<div class="line"><a name="l03900"></a><span class="lineno"> 3900</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l03901"></a><span class="lineno"> 3901</span>&#160;<span class="comment">THESE INCLUDES ARE NOT ENABLED BY DEFAULT.</span></div>
+<div class="line"><a name="l03902"></a><span class="lineno"> 3902</span>&#160;<span class="comment">Library has its own container implementation.</span></div>
+<div class="line"><a name="l03903"></a><span class="lineno"> 3903</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l03904"></a><span class="lineno"> 3904</span>&#160;<span class="preprocessor">#if VMA_USE_STL_VECTOR</span></div>
+<div class="line"><a name="l03905"></a><span class="lineno"> 3905</span>&#160;<span class="preprocessor">   #include &lt;vector&gt;</span></div>
+<div class="line"><a name="l03906"></a><span class="lineno"> 3906</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03907"></a><span class="lineno"> 3907</span>&#160; </div>
+<div class="line"><a name="l03908"></a><span class="lineno"> 3908</span>&#160;<span class="preprocessor">#if VMA_USE_STL_UNORDERED_MAP</span></div>
+<div class="line"><a name="l03909"></a><span class="lineno"> 3909</span>&#160;<span class="preprocessor">   #include &lt;unordered_map&gt;</span></div>
+<div class="line"><a name="l03910"></a><span class="lineno"> 3910</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l03911"></a><span class="lineno"> 3911</span>&#160; </div>
-<div class="line"><a name="l03912"></a><span class="lineno"> 3912</span>&#160;<span class="comment">//#include &lt;malloc.h&gt;</span></div>
-<div class="line"><a name="l03913"></a><span class="lineno"> 3913</span>&#160; </div>
-<div class="line"><a name="l03914"></a><span class="lineno"> 3914</span>&#160;<span class="comment">// Normal assert to check for programmer&#39;s errors, especially in Debug configuration.</span></div>
-<div class="line"><a name="l03915"></a><span class="lineno"> 3915</span>&#160;<span class="preprocessor">#ifndef VMA_ASSERT</span></div>
-<div class="line"><a name="l03916"></a><span class="lineno"> 3916</span>&#160;<span class="preprocessor">   #ifdef NDEBUG</span></div>
-<div class="line"><a name="l03917"></a><span class="lineno"> 3917</span>&#160;<span class="preprocessor">       #define VMA_ASSERT(expr)</span></div>
-<div class="line"><a name="l03918"></a><span class="lineno"> 3918</span>&#160;<span class="preprocessor">   #else</span></div>
-<div class="line"><a name="l03919"></a><span class="lineno"> 3919</span>&#160;<span class="preprocessor">       #define VMA_ASSERT(expr)         assert(expr)</span></div>
-<div class="line"><a name="l03920"></a><span class="lineno"> 3920</span>&#160;<span class="preprocessor">   #endif</span></div>
-<div class="line"><a name="l03921"></a><span class="lineno"> 3921</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03922"></a><span class="lineno"> 3922</span>&#160; </div>
-<div class="line"><a name="l03923"></a><span class="lineno"> 3923</span>&#160;<span class="comment">// Assert that will be called very often, like inside data structures e.g. operator[].</span></div>
-<div class="line"><a name="l03924"></a><span class="lineno"> 3924</span>&#160;<span class="comment">// Making it non-empty can make program slow.</span></div>
-<div class="line"><a name="l03925"></a><span class="lineno"> 3925</span>&#160;<span class="preprocessor">#ifndef VMA_HEAVY_ASSERT</span></div>
-<div class="line"><a name="l03926"></a><span class="lineno"> 3926</span>&#160;<span class="preprocessor">   #ifdef NDEBUG</span></div>
-<div class="line"><a name="l03927"></a><span class="lineno"> 3927</span>&#160;<span class="preprocessor">       #define VMA_HEAVY_ASSERT(expr)</span></div>
-<div class="line"><a name="l03928"></a><span class="lineno"> 3928</span>&#160;<span class="preprocessor">   #else</span></div>
-<div class="line"><a name="l03929"></a><span class="lineno"> 3929</span>&#160;<span class="preprocessor">       #define VMA_HEAVY_ASSERT(expr)   //VMA_ASSERT(expr)</span></div>
-<div class="line"><a name="l03930"></a><span class="lineno"> 3930</span>&#160;<span class="preprocessor">   #endif</span></div>
-<div class="line"><a name="l03931"></a><span class="lineno"> 3931</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03932"></a><span class="lineno"> 3932</span>&#160; </div>
-<div class="line"><a name="l03933"></a><span class="lineno"> 3933</span>&#160;<span class="preprocessor">#ifndef VMA_ALIGN_OF</span></div>
-<div class="line"><a name="l03934"></a><span class="lineno"> 3934</span>&#160;<span class="preprocessor">   #define VMA_ALIGN_OF(type)       (__alignof(type))</span></div>
-<div class="line"><a name="l03935"></a><span class="lineno"> 3935</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03936"></a><span class="lineno"> 3936</span>&#160; </div>
-<div class="line"><a name="l03937"></a><span class="lineno"> 3937</span>&#160;<span class="preprocessor">#ifndef VMA_SYSTEM_ALIGNED_MALLOC</span></div>
-<div class="line"><a name="l03938"></a><span class="lineno"> 3938</span>&#160;<span class="preprocessor">   #if defined(_WIN32)</span></div>
-<div class="line"><a name="l03939"></a><span class="lineno"> 3939</span>&#160;<span class="preprocessor">       #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment)   (_aligned_malloc((size), (alignment)))</span></div>
-<div class="line"><a name="l03940"></a><span class="lineno"> 3940</span>&#160;<span class="preprocessor">   #else</span></div>
-<div class="line"><a name="l03941"></a><span class="lineno"> 3941</span>&#160;<span class="preprocessor">       #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment)   (aligned_alloc((alignment), (size) ))</span></div>
-<div class="line"><a name="l03942"></a><span class="lineno"> 3942</span>&#160;<span class="preprocessor">   #endif</span></div>
-<div class="line"><a name="l03943"></a><span class="lineno"> 3943</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03944"></a><span class="lineno"> 3944</span>&#160; </div>
-<div class="line"><a name="l03945"></a><span class="lineno"> 3945</span>&#160;<span class="preprocessor">#ifndef VMA_SYSTEM_FREE</span></div>
-<div class="line"><a name="l03946"></a><span class="lineno"> 3946</span>&#160;<span class="preprocessor">   #if defined(_WIN32)</span></div>
-<div class="line"><a name="l03947"></a><span class="lineno"> 3947</span>&#160;<span class="preprocessor">       #define VMA_SYSTEM_FREE(ptr)   _aligned_free(ptr)</span></div>
-<div class="line"><a name="l03948"></a><span class="lineno"> 3948</span>&#160;<span class="preprocessor">   #else</span></div>
-<div class="line"><a name="l03949"></a><span class="lineno"> 3949</span>&#160;<span class="preprocessor">       #define VMA_SYSTEM_FREE(ptr)   free(ptr)</span></div>
-<div class="line"><a name="l03950"></a><span class="lineno"> 3950</span>&#160;<span class="preprocessor">   #endif</span></div>
-<div class="line"><a name="l03951"></a><span class="lineno"> 3951</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03952"></a><span class="lineno"> 3952</span>&#160; </div>
-<div class="line"><a name="l03953"></a><span class="lineno"> 3953</span>&#160;<span class="preprocessor">#ifndef VMA_MIN</span></div>
-<div class="line"><a name="l03954"></a><span class="lineno"> 3954</span>&#160;<span class="preprocessor">   #define VMA_MIN(v1, v2)    (std::min((v1), (v2)))</span></div>
-<div class="line"><a name="l03955"></a><span class="lineno"> 3955</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03956"></a><span class="lineno"> 3956</span>&#160; </div>
-<div class="line"><a name="l03957"></a><span class="lineno"> 3957</span>&#160;<span class="preprocessor">#ifndef VMA_MAX</span></div>
-<div class="line"><a name="l03958"></a><span class="lineno"> 3958</span>&#160;<span class="preprocessor">   #define VMA_MAX(v1, v2)    (std::max((v1), (v2)))</span></div>
-<div class="line"><a name="l03959"></a><span class="lineno"> 3959</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03912"></a><span class="lineno"> 3912</span>&#160;<span class="preprocessor">#if VMA_USE_STL_LIST</span></div>
+<div class="line"><a name="l03913"></a><span class="lineno"> 3913</span>&#160;<span class="preprocessor">   #include &lt;list&gt;</span></div>
+<div class="line"><a name="l03914"></a><span class="lineno"> 3914</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03915"></a><span class="lineno"> 3915</span>&#160; </div>
+<div class="line"><a name="l03916"></a><span class="lineno"> 3916</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l03917"></a><span class="lineno"> 3917</span>&#160;<span class="comment">Following headers are used in this CONFIGURATION section only, so feel free to</span></div>
+<div class="line"><a name="l03918"></a><span class="lineno"> 3918</span>&#160;<span class="comment">remove them if not needed.</span></div>
+<div class="line"><a name="l03919"></a><span class="lineno"> 3919</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l03920"></a><span class="lineno"> 3920</span>&#160;<span class="preprocessor">#include &lt;cassert&gt;</span> <span class="comment">// for assert</span></div>
+<div class="line"><a name="l03921"></a><span class="lineno"> 3921</span>&#160;<span class="preprocessor">#include &lt;algorithm&gt;</span> <span class="comment">// for min, max</span></div>
+<div class="line"><a name="l03922"></a><span class="lineno"> 3922</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div>
+<div class="line"><a name="l03923"></a><span class="lineno"> 3923</span>&#160; </div>
+<div class="line"><a name="l03924"></a><span class="lineno"> 3924</span>&#160;<span class="preprocessor">#ifndef VMA_NULL</span></div>
+<div class="line"><a name="l03925"></a><span class="lineno"> 3925</span>&#160;   <span class="comment">// Value used as null pointer. Define it to e.g.: nullptr, NULL, 0, (void*)0.</span></div>
+<div class="line"><a name="l03926"></a><span class="lineno"> 3926</span>&#160;<span class="preprocessor">   #define VMA_NULL   nullptr</span></div>
+<div class="line"><a name="l03927"></a><span class="lineno"> 3927</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03928"></a><span class="lineno"> 3928</span>&#160; </div>
+<div class="line"><a name="l03929"></a><span class="lineno"> 3929</span>&#160;<span class="preprocessor">#if defined(__ANDROID_API__) &amp;&amp; (__ANDROID_API__ &lt; 16)</span></div>
+<div class="line"><a name="l03930"></a><span class="lineno"> 3930</span>&#160;<span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
+<div class="line"><a name="l03931"></a><span class="lineno"> 3931</span>&#160;<span class="keywordtype">void</span> *aligned_alloc(<span class="keywordtype">size_t</span> alignment, <span class="keywordtype">size_t</span> size)</div>
+<div class="line"><a name="l03932"></a><span class="lineno"> 3932</span>&#160;{</div>
+<div class="line"><a name="l03933"></a><span class="lineno"> 3933</span>&#160;    <span class="comment">// alignment must be &gt;= sizeof(void*)</span></div>
+<div class="line"><a name="l03934"></a><span class="lineno"> 3934</span>&#160;    <span class="keywordflow">if</span>(alignment &lt; <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*))</div>
+<div class="line"><a name="l03935"></a><span class="lineno"> 3935</span>&#160;    {</div>
+<div class="line"><a name="l03936"></a><span class="lineno"> 3936</span>&#160;        alignment = <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*);</div>
+<div class="line"><a name="l03937"></a><span class="lineno"> 3937</span>&#160;    }</div>
+<div class="line"><a name="l03938"></a><span class="lineno"> 3938</span>&#160; </div>
+<div class="line"><a name="l03939"></a><span class="lineno"> 3939</span>&#160;    <span class="keywordflow">return</span> memalign(alignment, size);</div>
+<div class="line"><a name="l03940"></a><span class="lineno"> 3940</span>&#160;}</div>
+<div class="line"><a name="l03941"></a><span class="lineno"> 3941</span>&#160;<span class="preprocessor">#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) &amp;&amp; defined(__GLIBCXX__) &amp;&amp; !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))</span></div>
+<div class="line"><a name="l03942"></a><span class="lineno"> 3942</span>&#160;<span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
+<div class="line"><a name="l03943"></a><span class="lineno"> 3943</span>&#160;<span class="keywordtype">void</span> *aligned_alloc(<span class="keywordtype">size_t</span> alignment, <span class="keywordtype">size_t</span> size)</div>
+<div class="line"><a name="l03944"></a><span class="lineno"> 3944</span>&#160;{</div>
+<div class="line"><a name="l03945"></a><span class="lineno"> 3945</span>&#160;    <span class="comment">// alignment must be &gt;= sizeof(void*)</span></div>
+<div class="line"><a name="l03946"></a><span class="lineno"> 3946</span>&#160;    <span class="keywordflow">if</span>(alignment &lt; <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*))</div>
+<div class="line"><a name="l03947"></a><span class="lineno"> 3947</span>&#160;    {</div>
+<div class="line"><a name="l03948"></a><span class="lineno"> 3948</span>&#160;        alignment = <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*);</div>
+<div class="line"><a name="l03949"></a><span class="lineno"> 3949</span>&#160;    }</div>
+<div class="line"><a name="l03950"></a><span class="lineno"> 3950</span>&#160; </div>
+<div class="line"><a name="l03951"></a><span class="lineno"> 3951</span>&#160;    <span class="keywordtype">void</span> *pointer;</div>
+<div class="line"><a name="l03952"></a><span class="lineno"> 3952</span>&#160;    <span class="keywordflow">if</span>(posix_memalign(&amp;pointer, alignment, size) == 0)</div>
+<div class="line"><a name="l03953"></a><span class="lineno"> 3953</span>&#160;        <span class="keywordflow">return</span> pointer;</div>
+<div class="line"><a name="l03954"></a><span class="lineno"> 3954</span>&#160;    <span class="keywordflow">return</span> VMA_NULL;</div>
+<div class="line"><a name="l03955"></a><span class="lineno"> 3955</span>&#160;}</div>
+<div class="line"><a name="l03956"></a><span class="lineno"> 3956</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03957"></a><span class="lineno"> 3957</span>&#160; </div>
+<div class="line"><a name="l03958"></a><span class="lineno"> 3958</span>&#160;<span class="comment">// If your compiler is not compatible with C++11 and definition of</span></div>
+<div class="line"><a name="l03959"></a><span class="lineno"> 3959</span>&#160;<span class="comment">// aligned_alloc() function is missing, uncommeting following line may help:</span></div>
 <div class="line"><a name="l03960"></a><span class="lineno"> 3960</span>&#160; </div>
-<div class="line"><a name="l03961"></a><span class="lineno"> 3961</span>&#160;<span class="preprocessor">#ifndef VMA_SWAP</span></div>
-<div class="line"><a name="l03962"></a><span class="lineno"> 3962</span>&#160;<span class="preprocessor">   #define VMA_SWAP(v1, v2)   std::swap((v1), (v2))</span></div>
-<div class="line"><a name="l03963"></a><span class="lineno"> 3963</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03964"></a><span class="lineno"> 3964</span>&#160; </div>
-<div class="line"><a name="l03965"></a><span class="lineno"> 3965</span>&#160;<span class="preprocessor">#ifndef VMA_SORT</span></div>
-<div class="line"><a name="l03966"></a><span class="lineno"> 3966</span>&#160;<span class="preprocessor">   #define VMA_SORT(beg, end, cmp)  std::sort(beg, end, cmp)</span></div>
-<div class="line"><a name="l03967"></a><span class="lineno"> 3967</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03968"></a><span class="lineno"> 3968</span>&#160; </div>
-<div class="line"><a name="l03969"></a><span class="lineno"> 3969</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_LOG</span></div>
-<div class="line"><a name="l03970"></a><span class="lineno"> 3970</span>&#160;<span class="preprocessor">   #define VMA_DEBUG_LOG(format, ...)</span></div>
-<div class="line"><a name="l03971"></a><span class="lineno"> 3971</span>&#160;   <span class="comment">/*</span></div>
-<div class="line"><a name="l03972"></a><span class="lineno"> 3972</span>&#160;<span class="comment">   #define VMA_DEBUG_LOG(format, ...) do { \</span></div>
-<div class="line"><a name="l03973"></a><span class="lineno"> 3973</span>&#160;<span class="comment">       printf(format, __VA_ARGS__); \</span></div>
-<div class="line"><a name="l03974"></a><span class="lineno"> 3974</span>&#160;<span class="comment">       printf(&quot;\n&quot;); \</span></div>
-<div class="line"><a name="l03975"></a><span class="lineno"> 3975</span>&#160;<span class="comment">   } while(false)</span></div>
-<div class="line"><a name="l03976"></a><span class="lineno"> 3976</span>&#160;<span class="comment">   */</span></div>
-<div class="line"><a name="l03977"></a><span class="lineno"> 3977</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03978"></a><span class="lineno"> 3978</span>&#160; </div>
-<div class="line"><a name="l03979"></a><span class="lineno"> 3979</span>&#160;<span class="comment">// Define this macro to 1 to enable functions: vmaBuildStatsString, vmaFreeStatsString.</span></div>
-<div class="line"><a name="l03980"></a><span class="lineno"> 3980</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l03981"></a><span class="lineno"> 3981</span>&#160;    <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> VmaUint32ToStr(<span class="keywordtype">char</span>* outStr, <span class="keywordtype">size_t</span> strLen, uint32_t num)</div>
-<div class="line"><a name="l03982"></a><span class="lineno"> 3982</span>&#160;    {</div>
-<div class="line"><a name="l03983"></a><span class="lineno"> 3983</span>&#160;        snprintf(outStr, strLen, <span class="stringliteral">&quot;%u&quot;</span>, <span class="keyword">static_cast&lt;</span><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span><span class="keyword">&gt;</span>(num));</div>
-<div class="line"><a name="l03984"></a><span class="lineno"> 3984</span>&#160;    }</div>
-<div class="line"><a name="l03985"></a><span class="lineno"> 3985</span>&#160;    <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> VmaUint64ToStr(<span class="keywordtype">char</span>* outStr, <span class="keywordtype">size_t</span> strLen, uint64_t num)</div>
-<div class="line"><a name="l03986"></a><span class="lineno"> 3986</span>&#160;    {</div>
-<div class="line"><a name="l03987"></a><span class="lineno"> 3987</span>&#160;        snprintf(outStr, strLen, <span class="stringliteral">&quot;%llu&quot;</span>, <span class="keyword">static_cast&lt;</span><span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span><span class="keyword">&gt;</span>(num));</div>
-<div class="line"><a name="l03988"></a><span class="lineno"> 3988</span>&#160;    }</div>
-<div class="line"><a name="l03989"></a><span class="lineno"> 3989</span>&#160;    <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> VmaPtrToStr(<span class="keywordtype">char</span>* outStr, <span class="keywordtype">size_t</span> strLen, <span class="keyword">const</span> <span class="keywordtype">void</span>* ptr)</div>
-<div class="line"><a name="l03990"></a><span class="lineno"> 3990</span>&#160;    {</div>
-<div class="line"><a name="l03991"></a><span class="lineno"> 3991</span>&#160;        snprintf(outStr, strLen, <span class="stringliteral">&quot;%p&quot;</span>, ptr);</div>
-<div class="line"><a name="l03992"></a><span class="lineno"> 3992</span>&#160;    }</div>
-<div class="line"><a name="l03993"></a><span class="lineno"> 3993</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l03994"></a><span class="lineno"> 3994</span>&#160; </div>
-<div class="line"><a name="l03995"></a><span class="lineno"> 3995</span>&#160;<span class="preprocessor">#ifndef VMA_MUTEX</span></div>
-<div class="line"><a name="l03996"></a><span class="lineno"> 3996</span>&#160;    <span class="keyword">class </span>VmaMutex</div>
-<div class="line"><a name="l03997"></a><span class="lineno"> 3997</span>&#160;    {</div>
-<div class="line"><a name="l03998"></a><span class="lineno"> 3998</span>&#160;    <span class="keyword">public</span>:</div>
-<div class="line"><a name="l03999"></a><span class="lineno"> 3999</span>&#160;        <span class="keywordtype">void</span> Lock() { m_Mutex.lock(); }</div>
-<div class="line"><a name="l04000"></a><span class="lineno"> 4000</span>&#160;        <span class="keywordtype">void</span> Unlock() { m_Mutex.unlock(); }</div>
-<div class="line"><a name="l04001"></a><span class="lineno"> 4001</span>&#160;        <span class="keywordtype">bool</span> TryLock() { <span class="keywordflow">return</span> m_Mutex.try_lock(); }</div>
-<div class="line"><a name="l04002"></a><span class="lineno"> 4002</span>&#160;    <span class="keyword">private</span>:</div>
-<div class="line"><a name="l04003"></a><span class="lineno"> 4003</span>&#160;        std::mutex m_Mutex;</div>
-<div class="line"><a name="l04004"></a><span class="lineno"> 4004</span>&#160;    };</div>
-<div class="line"><a name="l04005"></a><span class="lineno"> 4005</span>&#160;<span class="preprocessor">    #define VMA_MUTEX VmaMutex</span></div>
-<div class="line"><a name="l04006"></a><span class="lineno"> 4006</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04007"></a><span class="lineno"> 4007</span>&#160; </div>
-<div class="line"><a name="l04008"></a><span class="lineno"> 4008</span>&#160;<span class="comment">// Read-write mutex, where &quot;read&quot; is shared access, &quot;write&quot; is exclusive access.</span></div>
-<div class="line"><a name="l04009"></a><span class="lineno"> 4009</span>&#160;<span class="preprocessor">#ifndef VMA_RW_MUTEX</span></div>
-<div class="line"><a name="l04010"></a><span class="lineno"> 4010</span>&#160;<span class="preprocessor">    #if VMA_USE_STL_SHARED_MUTEX</span></div>
-<div class="line"><a name="l04011"></a><span class="lineno"> 4011</span>&#160;        <span class="comment">// Use std::shared_mutex from C++17.</span></div>
-<div class="line"><a name="l04012"></a><span class="lineno"> 4012</span>&#160;<span class="preprocessor">        #include &lt;shared_mutex&gt;</span></div>
-<div class="line"><a name="l04013"></a><span class="lineno"> 4013</span>&#160;        <span class="keyword">class </span>VmaRWMutex</div>
-<div class="line"><a name="l04014"></a><span class="lineno"> 4014</span>&#160;        {</div>
-<div class="line"><a name="l04015"></a><span class="lineno"> 4015</span>&#160;        <span class="keyword">public</span>:</div>
-<div class="line"><a name="l04016"></a><span class="lineno"> 4016</span>&#160;            <span class="keywordtype">void</span> LockRead() { m_Mutex.lock_shared(); }</div>
-<div class="line"><a name="l04017"></a><span class="lineno"> 4017</span>&#160;            <span class="keywordtype">void</span> UnlockRead() { m_Mutex.unlock_shared(); }</div>
-<div class="line"><a name="l04018"></a><span class="lineno"> 4018</span>&#160;            <span class="keywordtype">bool</span> TryLockRead() { <span class="keywordflow">return</span> m_Mutex.try_lock_shared(); }</div>
-<div class="line"><a name="l04019"></a><span class="lineno"> 4019</span>&#160;            <span class="keywordtype">void</span> LockWrite() { m_Mutex.lock(); }</div>
-<div class="line"><a name="l04020"></a><span class="lineno"> 4020</span>&#160;            <span class="keywordtype">void</span> UnlockWrite() { m_Mutex.unlock(); }</div>
-<div class="line"><a name="l04021"></a><span class="lineno"> 4021</span>&#160;            <span class="keywordtype">bool</span> TryLockWrite() { <span class="keywordflow">return</span> m_Mutex.try_lock(); }</div>
-<div class="line"><a name="l04022"></a><span class="lineno"> 4022</span>&#160;        <span class="keyword">private</span>:</div>
-<div class="line"><a name="l04023"></a><span class="lineno"> 4023</span>&#160;            std::shared_mutex m_Mutex;</div>
-<div class="line"><a name="l04024"></a><span class="lineno"> 4024</span>&#160;        };</div>
-<div class="line"><a name="l04025"></a><span class="lineno"> 4025</span>&#160;<span class="preprocessor">        #define VMA_RW_MUTEX VmaRWMutex</span></div>
-<div class="line"><a name="l04026"></a><span class="lineno"> 4026</span>&#160;<span class="preprocessor">    #elif defined(_WIN32) &amp;&amp; defined(WINVER) &amp;&amp; WINVER &gt;= 0x0600</span></div>
-<div class="line"><a name="l04027"></a><span class="lineno"> 4027</span>&#160;        <span class="comment">// Use SRWLOCK from WinAPI.</span></div>
-<div class="line"><a name="l04028"></a><span class="lineno"> 4028</span>&#160;        <span class="comment">// Minimum supported client = Windows Vista, server = Windows Server 2008.</span></div>
-<div class="line"><a name="l04029"></a><span class="lineno"> 4029</span>&#160;        <span class="keyword">class </span>VmaRWMutex</div>
-<div class="line"><a name="l04030"></a><span class="lineno"> 4030</span>&#160;        {</div>
-<div class="line"><a name="l04031"></a><span class="lineno"> 4031</span>&#160;        <span class="keyword">public</span>:</div>
-<div class="line"><a name="l04032"></a><span class="lineno"> 4032</span>&#160;            VmaRWMutex() { InitializeSRWLock(&amp;m_Lock); }</div>
-<div class="line"><a name="l04033"></a><span class="lineno"> 4033</span>&#160;            <span class="keywordtype">void</span> LockRead() { AcquireSRWLockShared(&amp;m_Lock); }</div>
-<div class="line"><a name="l04034"></a><span class="lineno"> 4034</span>&#160;            <span class="keywordtype">void</span> UnlockRead() { ReleaseSRWLockShared(&amp;m_Lock); }</div>
-<div class="line"><a name="l04035"></a><span class="lineno"> 4035</span>&#160;            <span class="keywordtype">bool</span> TryLockRead() { <span class="keywordflow">return</span> TryAcquireSRWLockShared(&amp;m_Lock) != FALSE; }</div>
-<div class="line"><a name="l04036"></a><span class="lineno"> 4036</span>&#160;            <span class="keywordtype">void</span> LockWrite() { AcquireSRWLockExclusive(&amp;m_Lock); }</div>
-<div class="line"><a name="l04037"></a><span class="lineno"> 4037</span>&#160;            <span class="keywordtype">void</span> UnlockWrite() { ReleaseSRWLockExclusive(&amp;m_Lock); }</div>
-<div class="line"><a name="l04038"></a><span class="lineno"> 4038</span>&#160;            <span class="keywordtype">bool</span> TryLockWrite() { <span class="keywordflow">return</span> TryAcquireSRWLockExclusive(&amp;m_Lock) != FALSE; }</div>
-<div class="line"><a name="l04039"></a><span class="lineno"> 4039</span>&#160;        <span class="keyword">private</span>:</div>
-<div class="line"><a name="l04040"></a><span class="lineno"> 4040</span>&#160;            SRWLOCK m_Lock;</div>
-<div class="line"><a name="l04041"></a><span class="lineno"> 4041</span>&#160;        };</div>
-<div class="line"><a name="l04042"></a><span class="lineno"> 4042</span>&#160;<span class="preprocessor">        #define VMA_RW_MUTEX VmaRWMutex</span></div>
-<div class="line"><a name="l04043"></a><span class="lineno"> 4043</span>&#160;<span class="preprocessor">    #else</span></div>
-<div class="line"><a name="l04044"></a><span class="lineno"> 4044</span>&#160;        <span class="comment">// Less efficient fallback: Use normal mutex.</span></div>
-<div class="line"><a name="l04045"></a><span class="lineno"> 4045</span>&#160;        <span class="keyword">class </span>VmaRWMutex</div>
-<div class="line"><a name="l04046"></a><span class="lineno"> 4046</span>&#160;        {</div>
-<div class="line"><a name="l04047"></a><span class="lineno"> 4047</span>&#160;        <span class="keyword">public</span>:</div>
-<div class="line"><a name="l04048"></a><span class="lineno"> 4048</span>&#160;            <span class="keywordtype">void</span> LockRead() { m_Mutex.Lock(); }</div>
-<div class="line"><a name="l04049"></a><span class="lineno"> 4049</span>&#160;            <span class="keywordtype">void</span> UnlockRead() { m_Mutex.Unlock(); }</div>
-<div class="line"><a name="l04050"></a><span class="lineno"> 4050</span>&#160;            <span class="keywordtype">bool</span> TryLockRead() { <span class="keywordflow">return</span> m_Mutex.TryLock(); }</div>
-<div class="line"><a name="l04051"></a><span class="lineno"> 4051</span>&#160;            <span class="keywordtype">void</span> LockWrite() { m_Mutex.Lock(); }</div>
-<div class="line"><a name="l04052"></a><span class="lineno"> 4052</span>&#160;            <span class="keywordtype">void</span> UnlockWrite() { m_Mutex.Unlock(); }</div>
-<div class="line"><a name="l04053"></a><span class="lineno"> 4053</span>&#160;            <span class="keywordtype">bool</span> TryLockWrite() { <span class="keywordflow">return</span> m_Mutex.TryLock(); }</div>
-<div class="line"><a name="l04054"></a><span class="lineno"> 4054</span>&#160;        <span class="keyword">private</span>:</div>
-<div class="line"><a name="l04055"></a><span class="lineno"> 4055</span>&#160;            VMA_MUTEX m_Mutex;</div>
-<div class="line"><a name="l04056"></a><span class="lineno"> 4056</span>&#160;        };</div>
-<div class="line"><a name="l04057"></a><span class="lineno"> 4057</span>&#160;<span class="preprocessor">        #define VMA_RW_MUTEX VmaRWMutex</span></div>
-<div class="line"><a name="l04058"></a><span class="lineno"> 4058</span>&#160;<span class="preprocessor">    #endif // #if VMA_USE_STL_SHARED_MUTEX</span></div>
-<div class="line"><a name="l04059"></a><span class="lineno"> 4059</span>&#160;<span class="preprocessor">#endif // #ifndef VMA_RW_MUTEX</span></div>
-<div class="line"><a name="l04060"></a><span class="lineno"> 4060</span>&#160; </div>
-<div class="line"><a name="l04061"></a><span class="lineno"> 4061</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l04062"></a><span class="lineno"> 4062</span>&#160;<span class="comment">If providing your own implementation, you need to implement a subset of std::atomic.</span></div>
-<div class="line"><a name="l04063"></a><span class="lineno"> 4063</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l04064"></a><span class="lineno"> 4064</span>&#160;<span class="preprocessor">#ifndef VMA_ATOMIC_UINT32</span></div>
-<div class="line"><a name="l04065"></a><span class="lineno"> 4065</span>&#160;<span class="preprocessor">    #include &lt;atomic&gt;</span></div>
-<div class="line"><a name="l04066"></a><span class="lineno"> 4066</span>&#160;<span class="preprocessor">    #define VMA_ATOMIC_UINT32 std::atomic&lt;uint32_t&gt;</span></div>
-<div class="line"><a name="l04067"></a><span class="lineno"> 4067</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04068"></a><span class="lineno"> 4068</span>&#160; </div>
-<div class="line"><a name="l04069"></a><span class="lineno"> 4069</span>&#160;<span class="preprocessor">#ifndef VMA_ATOMIC_UINT64</span></div>
-<div class="line"><a name="l04070"></a><span class="lineno"> 4070</span>&#160;<span class="preprocessor">    #include &lt;atomic&gt;</span></div>
-<div class="line"><a name="l04071"></a><span class="lineno"> 4071</span>&#160;<span class="preprocessor">    #define VMA_ATOMIC_UINT64 std::atomic&lt;uint64_t&gt;</span></div>
-<div class="line"><a name="l04072"></a><span class="lineno"> 4072</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04073"></a><span class="lineno"> 4073</span>&#160; </div>
-<div class="line"><a name="l04074"></a><span class="lineno"> 4074</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_ALWAYS_DEDICATED_MEMORY</span></div>
-<div class="line"><a name="l04075"></a><span class="lineno"> 4075</span>&#160; </div>
-<div class="line"><a name="l04079"></a><span class="lineno"> 4079</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_ALWAYS_DEDICATED_MEMORY (0)</span></div>
-<div class="line"><a name="l04080"></a><span class="lineno"> 4080</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04081"></a><span class="lineno"> 4081</span>&#160; </div>
-<div class="line"><a name="l04082"></a><span class="lineno"> 4082</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_ALIGNMENT</span></div>
-<div class="line"><a name="l04083"></a><span class="lineno"> 4083</span>&#160; </div>
-<div class="line"><a name="l04087"></a><span class="lineno"> 4087</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_ALIGNMENT (1)</span></div>
-<div class="line"><a name="l04088"></a><span class="lineno"> 4088</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04089"></a><span class="lineno"> 4089</span>&#160; </div>
-<div class="line"><a name="l04090"></a><span class="lineno"> 4090</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_MARGIN</span></div>
-<div class="line"><a name="l04091"></a><span class="lineno"> 4091</span>&#160; </div>
-<div class="line"><a name="l04095"></a><span class="lineno"> 4095</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_MARGIN (0)</span></div>
-<div class="line"><a name="l04096"></a><span class="lineno"> 4096</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04097"></a><span class="lineno"> 4097</span>&#160; </div>
-<div class="line"><a name="l04098"></a><span class="lineno"> 4098</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_INITIALIZE_ALLOCATIONS</span></div>
-<div class="line"><a name="l04099"></a><span class="lineno"> 4099</span>&#160; </div>
-<div class="line"><a name="l04103"></a><span class="lineno"> 4103</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_INITIALIZE_ALLOCATIONS (0)</span></div>
-<div class="line"><a name="l04104"></a><span class="lineno"> 4104</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04105"></a><span class="lineno"> 4105</span>&#160; </div>
-<div class="line"><a name="l04106"></a><span class="lineno"> 4106</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_DETECT_CORRUPTION</span></div>
-<div class="line"><a name="l04107"></a><span class="lineno"> 4107</span>&#160; </div>
-<div class="line"><a name="l04112"></a><span class="lineno"> 4112</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_DETECT_CORRUPTION (0)</span></div>
-<div class="line"><a name="l04113"></a><span class="lineno"> 4113</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04114"></a><span class="lineno"> 4114</span>&#160; </div>
-<div class="line"><a name="l04115"></a><span class="lineno"> 4115</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_GLOBAL_MUTEX</span></div>
-<div class="line"><a name="l04116"></a><span class="lineno"> 4116</span>&#160; </div>
-<div class="line"><a name="l04120"></a><span class="lineno"> 4120</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_GLOBAL_MUTEX (0)</span></div>
+<div class="line"><a name="l03961"></a><span class="lineno"> 3961</span>&#160;<span class="comment">//#include &lt;malloc.h&gt;</span></div>
+<div class="line"><a name="l03962"></a><span class="lineno"> 3962</span>&#160; </div>
+<div class="line"><a name="l03963"></a><span class="lineno"> 3963</span>&#160;<span class="comment">// Normal assert to check for programmer&#39;s errors, especially in Debug configuration.</span></div>
+<div class="line"><a name="l03964"></a><span class="lineno"> 3964</span>&#160;<span class="preprocessor">#ifndef VMA_ASSERT</span></div>
+<div class="line"><a name="l03965"></a><span class="lineno"> 3965</span>&#160;<span class="preprocessor">   #ifdef NDEBUG</span></div>
+<div class="line"><a name="l03966"></a><span class="lineno"> 3966</span>&#160;<span class="preprocessor">       #define VMA_ASSERT(expr)</span></div>
+<div class="line"><a name="l03967"></a><span class="lineno"> 3967</span>&#160;<span class="preprocessor">   #else</span></div>
+<div class="line"><a name="l03968"></a><span class="lineno"> 3968</span>&#160;<span class="preprocessor">       #define VMA_ASSERT(expr)         assert(expr)</span></div>
+<div class="line"><a name="l03969"></a><span class="lineno"> 3969</span>&#160;<span class="preprocessor">   #endif</span></div>
+<div class="line"><a name="l03970"></a><span class="lineno"> 3970</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03971"></a><span class="lineno"> 3971</span>&#160; </div>
+<div class="line"><a name="l03972"></a><span class="lineno"> 3972</span>&#160;<span class="comment">// Assert that will be called very often, like inside data structures e.g. operator[].</span></div>
+<div class="line"><a name="l03973"></a><span class="lineno"> 3973</span>&#160;<span class="comment">// Making it non-empty can make program slow.</span></div>
+<div class="line"><a name="l03974"></a><span class="lineno"> 3974</span>&#160;<span class="preprocessor">#ifndef VMA_HEAVY_ASSERT</span></div>
+<div class="line"><a name="l03975"></a><span class="lineno"> 3975</span>&#160;<span class="preprocessor">   #ifdef NDEBUG</span></div>
+<div class="line"><a name="l03976"></a><span class="lineno"> 3976</span>&#160;<span class="preprocessor">       #define VMA_HEAVY_ASSERT(expr)</span></div>
+<div class="line"><a name="l03977"></a><span class="lineno"> 3977</span>&#160;<span class="preprocessor">   #else</span></div>
+<div class="line"><a name="l03978"></a><span class="lineno"> 3978</span>&#160;<span class="preprocessor">       #define VMA_HEAVY_ASSERT(expr)   //VMA_ASSERT(expr)</span></div>
+<div class="line"><a name="l03979"></a><span class="lineno"> 3979</span>&#160;<span class="preprocessor">   #endif</span></div>
+<div class="line"><a name="l03980"></a><span class="lineno"> 3980</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03981"></a><span class="lineno"> 3981</span>&#160; </div>
+<div class="line"><a name="l03982"></a><span class="lineno"> 3982</span>&#160;<span class="preprocessor">#ifndef VMA_ALIGN_OF</span></div>
+<div class="line"><a name="l03983"></a><span class="lineno"> 3983</span>&#160;<span class="preprocessor">   #define VMA_ALIGN_OF(type)       (__alignof(type))</span></div>
+<div class="line"><a name="l03984"></a><span class="lineno"> 3984</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03985"></a><span class="lineno"> 3985</span>&#160; </div>
+<div class="line"><a name="l03986"></a><span class="lineno"> 3986</span>&#160;<span class="preprocessor">#ifndef VMA_SYSTEM_ALIGNED_MALLOC</span></div>
+<div class="line"><a name="l03987"></a><span class="lineno"> 3987</span>&#160;<span class="preprocessor">   #if defined(_WIN32)</span></div>
+<div class="line"><a name="l03988"></a><span class="lineno"> 3988</span>&#160;<span class="preprocessor">       #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment)   (_aligned_malloc((size), (alignment)))</span></div>
+<div class="line"><a name="l03989"></a><span class="lineno"> 3989</span>&#160;<span class="preprocessor">   #else</span></div>
+<div class="line"><a name="l03990"></a><span class="lineno"> 3990</span>&#160;<span class="preprocessor">       #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment)   (aligned_alloc((alignment), (size) ))</span></div>
+<div class="line"><a name="l03991"></a><span class="lineno"> 3991</span>&#160;<span class="preprocessor">   #endif</span></div>
+<div class="line"><a name="l03992"></a><span class="lineno"> 3992</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l03993"></a><span class="lineno"> 3993</span>&#160; </div>
+<div class="line"><a name="l03994"></a><span class="lineno"> 3994</span>&#160;<span class="preprocessor">#ifndef VMA_SYSTEM_FREE</span></div>
+<div class="line"><a name="l03995"></a><span class="lineno"> 3995</span>&#160;<span class="preprocessor">   #if defined(_WIN32)</span></div>
+<div class="line"><a name="l03996"></a><span class="lineno"> 3996</span>&#160;<span class="preprocessor">       #define VMA_SYSTEM_FREE(ptr)   _aligned_free(ptr)</span></div>
+<div class="line"><a name="l03997"></a><span class="lineno"> 3997</span>&#160;<span class="preprocessor">   #else</span></div>
+<div class="line"><a name="l03998"></a><span class="lineno"> 3998</span>&#160;<span class="preprocessor">       #define VMA_SYSTEM_FREE(ptr)   free(ptr)</span></div>
+<div class="line"><a name="l03999"></a><span class="lineno"> 3999</span>&#160;<span class="preprocessor">   #endif</span></div>
+<div class="line"><a name="l04000"></a><span class="lineno"> 4000</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04001"></a><span class="lineno"> 4001</span>&#160; </div>
+<div class="line"><a name="l04002"></a><span class="lineno"> 4002</span>&#160;<span class="preprocessor">#ifndef VMA_MIN</span></div>
+<div class="line"><a name="l04003"></a><span class="lineno"> 4003</span>&#160;<span class="preprocessor">   #define VMA_MIN(v1, v2)    (std::min((v1), (v2)))</span></div>
+<div class="line"><a name="l04004"></a><span class="lineno"> 4004</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04005"></a><span class="lineno"> 4005</span>&#160; </div>
+<div class="line"><a name="l04006"></a><span class="lineno"> 4006</span>&#160;<span class="preprocessor">#ifndef VMA_MAX</span></div>
+<div class="line"><a name="l04007"></a><span class="lineno"> 4007</span>&#160;<span class="preprocessor">   #define VMA_MAX(v1, v2)    (std::max((v1), (v2)))</span></div>
+<div class="line"><a name="l04008"></a><span class="lineno"> 4008</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04009"></a><span class="lineno"> 4009</span>&#160; </div>
+<div class="line"><a name="l04010"></a><span class="lineno"> 4010</span>&#160;<span class="preprocessor">#ifndef VMA_SWAP</span></div>
+<div class="line"><a name="l04011"></a><span class="lineno"> 4011</span>&#160;<span class="preprocessor">   #define VMA_SWAP(v1, v2)   std::swap((v1), (v2))</span></div>
+<div class="line"><a name="l04012"></a><span class="lineno"> 4012</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04013"></a><span class="lineno"> 4013</span>&#160; </div>
+<div class="line"><a name="l04014"></a><span class="lineno"> 4014</span>&#160;<span class="preprocessor">#ifndef VMA_SORT</span></div>
+<div class="line"><a name="l04015"></a><span class="lineno"> 4015</span>&#160;<span class="preprocessor">   #define VMA_SORT(beg, end, cmp)  std::sort(beg, end, cmp)</span></div>
+<div class="line"><a name="l04016"></a><span class="lineno"> 4016</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04017"></a><span class="lineno"> 4017</span>&#160; </div>
+<div class="line"><a name="l04018"></a><span class="lineno"> 4018</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_LOG</span></div>
+<div class="line"><a name="l04019"></a><span class="lineno"> 4019</span>&#160;<span class="preprocessor">   #define VMA_DEBUG_LOG(format, ...)</span></div>
+<div class="line"><a name="l04020"></a><span class="lineno"> 4020</span>&#160;   <span class="comment">/*</span></div>
+<div class="line"><a name="l04021"></a><span class="lineno"> 4021</span>&#160;<span class="comment">   #define VMA_DEBUG_LOG(format, ...) do { \</span></div>
+<div class="line"><a name="l04022"></a><span class="lineno"> 4022</span>&#160;<span class="comment">       printf(format, __VA_ARGS__); \</span></div>
+<div class="line"><a name="l04023"></a><span class="lineno"> 4023</span>&#160;<span class="comment">       printf(&quot;\n&quot;); \</span></div>
+<div class="line"><a name="l04024"></a><span class="lineno"> 4024</span>&#160;<span class="comment">   } while(false)</span></div>
+<div class="line"><a name="l04025"></a><span class="lineno"> 4025</span>&#160;<span class="comment">   */</span></div>
+<div class="line"><a name="l04026"></a><span class="lineno"> 4026</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04027"></a><span class="lineno"> 4027</span>&#160; </div>
+<div class="line"><a name="l04028"></a><span class="lineno"> 4028</span>&#160;<span class="comment">// Define this macro to 1 to enable functions: vmaBuildStatsString, vmaFreeStatsString.</span></div>
+<div class="line"><a name="l04029"></a><span class="lineno"> 4029</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l04030"></a><span class="lineno"> 4030</span>&#160;    <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> VmaUint32ToStr(<span class="keywordtype">char</span>* outStr, <span class="keywordtype">size_t</span> strLen, uint32_t num)</div>
+<div class="line"><a name="l04031"></a><span class="lineno"> 4031</span>&#160;    {</div>
+<div class="line"><a name="l04032"></a><span class="lineno"> 4032</span>&#160;        snprintf(outStr, strLen, <span class="stringliteral">&quot;%u&quot;</span>, <span class="keyword">static_cast&lt;</span><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span><span class="keyword">&gt;</span>(num));</div>
+<div class="line"><a name="l04033"></a><span class="lineno"> 4033</span>&#160;    }</div>
+<div class="line"><a name="l04034"></a><span class="lineno"> 4034</span>&#160;    <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> VmaUint64ToStr(<span class="keywordtype">char</span>* outStr, <span class="keywordtype">size_t</span> strLen, uint64_t num)</div>
+<div class="line"><a name="l04035"></a><span class="lineno"> 4035</span>&#160;    {</div>
+<div class="line"><a name="l04036"></a><span class="lineno"> 4036</span>&#160;        snprintf(outStr, strLen, <span class="stringliteral">&quot;%llu&quot;</span>, <span class="keyword">static_cast&lt;</span><span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span><span class="keyword">&gt;</span>(num));</div>
+<div class="line"><a name="l04037"></a><span class="lineno"> 4037</span>&#160;    }</div>
+<div class="line"><a name="l04038"></a><span class="lineno"> 4038</span>&#160;    <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> VmaPtrToStr(<span class="keywordtype">char</span>* outStr, <span class="keywordtype">size_t</span> strLen, <span class="keyword">const</span> <span class="keywordtype">void</span>* ptr)</div>
+<div class="line"><a name="l04039"></a><span class="lineno"> 4039</span>&#160;    {</div>
+<div class="line"><a name="l04040"></a><span class="lineno"> 4040</span>&#160;        snprintf(outStr, strLen, <span class="stringliteral">&quot;%p&quot;</span>, ptr);</div>
+<div class="line"><a name="l04041"></a><span class="lineno"> 4041</span>&#160;    }</div>
+<div class="line"><a name="l04042"></a><span class="lineno"> 4042</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04043"></a><span class="lineno"> 4043</span>&#160; </div>
+<div class="line"><a name="l04044"></a><span class="lineno"> 4044</span>&#160;<span class="preprocessor">#ifndef VMA_MUTEX</span></div>
+<div class="line"><a name="l04045"></a><span class="lineno"> 4045</span>&#160;    <span class="keyword">class </span>VmaMutex</div>
+<div class="line"><a name="l04046"></a><span class="lineno"> 4046</span>&#160;    {</div>
+<div class="line"><a name="l04047"></a><span class="lineno"> 4047</span>&#160;    <span class="keyword">public</span>:</div>
+<div class="line"><a name="l04048"></a><span class="lineno"> 4048</span>&#160;        <span class="keywordtype">void</span> Lock() { m_Mutex.lock(); }</div>
+<div class="line"><a name="l04049"></a><span class="lineno"> 4049</span>&#160;        <span class="keywordtype">void</span> Unlock() { m_Mutex.unlock(); }</div>
+<div class="line"><a name="l04050"></a><span class="lineno"> 4050</span>&#160;        <span class="keywordtype">bool</span> TryLock() { <span class="keywordflow">return</span> m_Mutex.try_lock(); }</div>
+<div class="line"><a name="l04051"></a><span class="lineno"> 4051</span>&#160;    <span class="keyword">private</span>:</div>
+<div class="line"><a name="l04052"></a><span class="lineno"> 4052</span>&#160;        std::mutex m_Mutex;</div>
+<div class="line"><a name="l04053"></a><span class="lineno"> 4053</span>&#160;    };</div>
+<div class="line"><a name="l04054"></a><span class="lineno"> 4054</span>&#160;<span class="preprocessor">    #define VMA_MUTEX VmaMutex</span></div>
+<div class="line"><a name="l04055"></a><span class="lineno"> 4055</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04056"></a><span class="lineno"> 4056</span>&#160; </div>
+<div class="line"><a name="l04057"></a><span class="lineno"> 4057</span>&#160;<span class="comment">// Read-write mutex, where &quot;read&quot; is shared access, &quot;write&quot; is exclusive access.</span></div>
+<div class="line"><a name="l04058"></a><span class="lineno"> 4058</span>&#160;<span class="preprocessor">#ifndef VMA_RW_MUTEX</span></div>
+<div class="line"><a name="l04059"></a><span class="lineno"> 4059</span>&#160;<span class="preprocessor">    #if VMA_USE_STL_SHARED_MUTEX</span></div>
+<div class="line"><a name="l04060"></a><span class="lineno"> 4060</span>&#160;        <span class="comment">// Use std::shared_mutex from C++17.</span></div>
+<div class="line"><a name="l04061"></a><span class="lineno"> 4061</span>&#160;<span class="preprocessor">        #include &lt;shared_mutex&gt;</span></div>
+<div class="line"><a name="l04062"></a><span class="lineno"> 4062</span>&#160;        <span class="keyword">class </span>VmaRWMutex</div>
+<div class="line"><a name="l04063"></a><span class="lineno"> 4063</span>&#160;        {</div>
+<div class="line"><a name="l04064"></a><span class="lineno"> 4064</span>&#160;        <span class="keyword">public</span>:</div>
+<div class="line"><a name="l04065"></a><span class="lineno"> 4065</span>&#160;            <span class="keywordtype">void</span> LockRead() { m_Mutex.lock_shared(); }</div>
+<div class="line"><a name="l04066"></a><span class="lineno"> 4066</span>&#160;            <span class="keywordtype">void</span> UnlockRead() { m_Mutex.unlock_shared(); }</div>
+<div class="line"><a name="l04067"></a><span class="lineno"> 4067</span>&#160;            <span class="keywordtype">bool</span> TryLockRead() { <span class="keywordflow">return</span> m_Mutex.try_lock_shared(); }</div>
+<div class="line"><a name="l04068"></a><span class="lineno"> 4068</span>&#160;            <span class="keywordtype">void</span> LockWrite() { m_Mutex.lock(); }</div>
+<div class="line"><a name="l04069"></a><span class="lineno"> 4069</span>&#160;            <span class="keywordtype">void</span> UnlockWrite() { m_Mutex.unlock(); }</div>
+<div class="line"><a name="l04070"></a><span class="lineno"> 4070</span>&#160;            <span class="keywordtype">bool</span> TryLockWrite() { <span class="keywordflow">return</span> m_Mutex.try_lock(); }</div>
+<div class="line"><a name="l04071"></a><span class="lineno"> 4071</span>&#160;        <span class="keyword">private</span>:</div>
+<div class="line"><a name="l04072"></a><span class="lineno"> 4072</span>&#160;            std::shared_mutex m_Mutex;</div>
+<div class="line"><a name="l04073"></a><span class="lineno"> 4073</span>&#160;        };</div>
+<div class="line"><a name="l04074"></a><span class="lineno"> 4074</span>&#160;<span class="preprocessor">        #define VMA_RW_MUTEX VmaRWMutex</span></div>
+<div class="line"><a name="l04075"></a><span class="lineno"> 4075</span>&#160;<span class="preprocessor">    #elif defined(_WIN32) &amp;&amp; defined(WINVER) &amp;&amp; WINVER &gt;= 0x0600</span></div>
+<div class="line"><a name="l04076"></a><span class="lineno"> 4076</span>&#160;        <span class="comment">// Use SRWLOCK from WinAPI.</span></div>
+<div class="line"><a name="l04077"></a><span class="lineno"> 4077</span>&#160;        <span class="comment">// Minimum supported client = Windows Vista, server = Windows Server 2008.</span></div>
+<div class="line"><a name="l04078"></a><span class="lineno"> 4078</span>&#160;        <span class="keyword">class </span>VmaRWMutex</div>
+<div class="line"><a name="l04079"></a><span class="lineno"> 4079</span>&#160;        {</div>
+<div class="line"><a name="l04080"></a><span class="lineno"> 4080</span>&#160;        <span class="keyword">public</span>:</div>
+<div class="line"><a name="l04081"></a><span class="lineno"> 4081</span>&#160;            VmaRWMutex() { InitializeSRWLock(&amp;m_Lock); }</div>
+<div class="line"><a name="l04082"></a><span class="lineno"> 4082</span>&#160;            <span class="keywordtype">void</span> LockRead() { AcquireSRWLockShared(&amp;m_Lock); }</div>
+<div class="line"><a name="l04083"></a><span class="lineno"> 4083</span>&#160;            <span class="keywordtype">void</span> UnlockRead() { ReleaseSRWLockShared(&amp;m_Lock); }</div>
+<div class="line"><a name="l04084"></a><span class="lineno"> 4084</span>&#160;            <span class="keywordtype">bool</span> TryLockRead() { <span class="keywordflow">return</span> TryAcquireSRWLockShared(&amp;m_Lock) != FALSE; }</div>
+<div class="line"><a name="l04085"></a><span class="lineno"> 4085</span>&#160;            <span class="keywordtype">void</span> LockWrite() { AcquireSRWLockExclusive(&amp;m_Lock); }</div>
+<div class="line"><a name="l04086"></a><span class="lineno"> 4086</span>&#160;            <span class="keywordtype">void</span> UnlockWrite() { ReleaseSRWLockExclusive(&amp;m_Lock); }</div>
+<div class="line"><a name="l04087"></a><span class="lineno"> 4087</span>&#160;            <span class="keywordtype">bool</span> TryLockWrite() { <span class="keywordflow">return</span> TryAcquireSRWLockExclusive(&amp;m_Lock) != FALSE; }</div>
+<div class="line"><a name="l04088"></a><span class="lineno"> 4088</span>&#160;        <span class="keyword">private</span>:</div>
+<div class="line"><a name="l04089"></a><span class="lineno"> 4089</span>&#160;            SRWLOCK m_Lock;</div>
+<div class="line"><a name="l04090"></a><span class="lineno"> 4090</span>&#160;        };</div>
+<div class="line"><a name="l04091"></a><span class="lineno"> 4091</span>&#160;<span class="preprocessor">        #define VMA_RW_MUTEX VmaRWMutex</span></div>
+<div class="line"><a name="l04092"></a><span class="lineno"> 4092</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l04093"></a><span class="lineno"> 4093</span>&#160;        <span class="comment">// Less efficient fallback: Use normal mutex.</span></div>
+<div class="line"><a name="l04094"></a><span class="lineno"> 4094</span>&#160;        <span class="keyword">class </span>VmaRWMutex</div>
+<div class="line"><a name="l04095"></a><span class="lineno"> 4095</span>&#160;        {</div>
+<div class="line"><a name="l04096"></a><span class="lineno"> 4096</span>&#160;        <span class="keyword">public</span>:</div>
+<div class="line"><a name="l04097"></a><span class="lineno"> 4097</span>&#160;            <span class="keywordtype">void</span> LockRead() { m_Mutex.Lock(); }</div>
+<div class="line"><a name="l04098"></a><span class="lineno"> 4098</span>&#160;            <span class="keywordtype">void</span> UnlockRead() { m_Mutex.Unlock(); }</div>
+<div class="line"><a name="l04099"></a><span class="lineno"> 4099</span>&#160;            <span class="keywordtype">bool</span> TryLockRead() { <span class="keywordflow">return</span> m_Mutex.TryLock(); }</div>
+<div class="line"><a name="l04100"></a><span class="lineno"> 4100</span>&#160;            <span class="keywordtype">void</span> LockWrite() { m_Mutex.Lock(); }</div>
+<div class="line"><a name="l04101"></a><span class="lineno"> 4101</span>&#160;            <span class="keywordtype">void</span> UnlockWrite() { m_Mutex.Unlock(); }</div>
+<div class="line"><a name="l04102"></a><span class="lineno"> 4102</span>&#160;            <span class="keywordtype">bool</span> TryLockWrite() { <span class="keywordflow">return</span> m_Mutex.TryLock(); }</div>
+<div class="line"><a name="l04103"></a><span class="lineno"> 4103</span>&#160;        <span class="keyword">private</span>:</div>
+<div class="line"><a name="l04104"></a><span class="lineno"> 4104</span>&#160;            VMA_MUTEX m_Mutex;</div>
+<div class="line"><a name="l04105"></a><span class="lineno"> 4105</span>&#160;        };</div>
+<div class="line"><a name="l04106"></a><span class="lineno"> 4106</span>&#160;<span class="preprocessor">        #define VMA_RW_MUTEX VmaRWMutex</span></div>
+<div class="line"><a name="l04107"></a><span class="lineno"> 4107</span>&#160;<span class="preprocessor">    #endif // #if VMA_USE_STL_SHARED_MUTEX</span></div>
+<div class="line"><a name="l04108"></a><span class="lineno"> 4108</span>&#160;<span class="preprocessor">#endif // #ifndef VMA_RW_MUTEX</span></div>
+<div class="line"><a name="l04109"></a><span class="lineno"> 4109</span>&#160; </div>
+<div class="line"><a name="l04110"></a><span class="lineno"> 4110</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l04111"></a><span class="lineno"> 4111</span>&#160;<span class="comment">If providing your own implementation, you need to implement a subset of std::atomic.</span></div>
+<div class="line"><a name="l04112"></a><span class="lineno"> 4112</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l04113"></a><span class="lineno"> 4113</span>&#160;<span class="preprocessor">#ifndef VMA_ATOMIC_UINT32</span></div>
+<div class="line"><a name="l04114"></a><span class="lineno"> 4114</span>&#160;<span class="preprocessor">    #include &lt;atomic&gt;</span></div>
+<div class="line"><a name="l04115"></a><span class="lineno"> 4115</span>&#160;<span class="preprocessor">    #define VMA_ATOMIC_UINT32 std::atomic&lt;uint32_t&gt;</span></div>
+<div class="line"><a name="l04116"></a><span class="lineno"> 4116</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04117"></a><span class="lineno"> 4117</span>&#160; </div>
+<div class="line"><a name="l04118"></a><span class="lineno"> 4118</span>&#160;<span class="preprocessor">#ifndef VMA_ATOMIC_UINT64</span></div>
+<div class="line"><a name="l04119"></a><span class="lineno"> 4119</span>&#160;<span class="preprocessor">    #include &lt;atomic&gt;</span></div>
+<div class="line"><a name="l04120"></a><span class="lineno"> 4120</span>&#160;<span class="preprocessor">    #define VMA_ATOMIC_UINT64 std::atomic&lt;uint64_t&gt;</span></div>
 <div class="line"><a name="l04121"></a><span class="lineno"> 4121</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l04122"></a><span class="lineno"> 4122</span>&#160; </div>
-<div class="line"><a name="l04123"></a><span class="lineno"> 4123</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY</span></div>
+<div class="line"><a name="l04123"></a><span class="lineno"> 4123</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_ALWAYS_DEDICATED_MEMORY</span></div>
 <div class="line"><a name="l04124"></a><span class="lineno"> 4124</span>&#160; </div>
-<div class="line"><a name="l04128"></a><span class="lineno"> 4128</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY (1)</span></div>
+<div class="line"><a name="l04128"></a><span class="lineno"> 4128</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_ALWAYS_DEDICATED_MEMORY (0)</span></div>
 <div class="line"><a name="l04129"></a><span class="lineno"> 4129</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l04130"></a><span class="lineno"> 4130</span>&#160; </div>
-<div class="line"><a name="l04131"></a><span class="lineno"> 4131</span>&#160;<span class="preprocessor">#ifndef VMA_SMALL_HEAP_MAX_SIZE</span></div>
-<div class="line"><a name="l04132"></a><span class="lineno"> 4132</span>&#160;<span class="preprocessor">   #define VMA_SMALL_HEAP_MAX_SIZE (1024ull * 1024 * 1024)</span></div>
-<div class="line"><a name="l04134"></a><span class="lineno"> 4134</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04135"></a><span class="lineno"> 4135</span>&#160; </div>
-<div class="line"><a name="l04136"></a><span class="lineno"> 4136</span>&#160;<span class="preprocessor">#ifndef VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE</span></div>
-<div class="line"><a name="l04137"></a><span class="lineno"> 4137</span>&#160;<span class="preprocessor">   #define VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE (256ull * 1024 * 1024)</span></div>
-<div class="line"><a name="l04139"></a><span class="lineno"> 4139</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04131"></a><span class="lineno"> 4131</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_ALIGNMENT</span></div>
+<div class="line"><a name="l04132"></a><span class="lineno"> 4132</span>&#160; </div>
+<div class="line"><a name="l04136"></a><span class="lineno"> 4136</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_ALIGNMENT (1)</span></div>
+<div class="line"><a name="l04137"></a><span class="lineno"> 4137</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04138"></a><span class="lineno"> 4138</span>&#160; </div>
+<div class="line"><a name="l04139"></a><span class="lineno"> 4139</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_MARGIN</span></div>
 <div class="line"><a name="l04140"></a><span class="lineno"> 4140</span>&#160; </div>
-<div class="line"><a name="l04141"></a><span class="lineno"> 4141</span>&#160;<span class="preprocessor">#ifndef VMA_CLASS_NO_COPY</span></div>
-<div class="line"><a name="l04142"></a><span class="lineno"> 4142</span>&#160;<span class="preprocessor">    #define VMA_CLASS_NO_COPY(className) \</span></div>
-<div class="line"><a name="l04143"></a><span class="lineno"> 4143</span>&#160;<span class="preprocessor">        private: \</span></div>
-<div class="line"><a name="l04144"></a><span class="lineno"> 4144</span>&#160;<span class="preprocessor">            className(const className&amp;) = delete; \</span></div>
-<div class="line"><a name="l04145"></a><span class="lineno"> 4145</span>&#160;<span class="preprocessor">            className&amp; operator=(const className&amp;) = delete;</span></div>
-<div class="line"><a name="l04146"></a><span class="lineno"> 4146</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04147"></a><span class="lineno"> 4147</span>&#160; </div>
-<div class="line"><a name="l04148"></a><span class="lineno"> 4148</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_FRAME_INDEX_LOST = UINT32_MAX;</div>
-<div class="line"><a name="l04149"></a><span class="lineno"> 4149</span>&#160; </div>
-<div class="line"><a name="l04150"></a><span class="lineno"> 4150</span>&#160;<span class="comment">// Decimal 2139416166, float NaN, little-endian binary 66 E6 84 7F.</span></div>
-<div class="line"><a name="l04151"></a><span class="lineno"> 4151</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_CORRUPTION_DETECTION_MAGIC_VALUE = 0x7F84E666;</div>
-<div class="line"><a name="l04152"></a><span class="lineno"> 4152</span>&#160; </div>
-<div class="line"><a name="l04153"></a><span class="lineno"> 4153</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint8_t VMA_ALLOCATION_FILL_PATTERN_CREATED   = 0xDC;</div>
-<div class="line"><a name="l04154"></a><span class="lineno"> 4154</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint8_t VMA_ALLOCATION_FILL_PATTERN_DESTROYED = 0xEF;</div>
-<div class="line"><a name="l04155"></a><span class="lineno"> 4155</span>&#160; </div>
-<div class="line"><a name="l04156"></a><span class="lineno"> 4156</span>&#160;<span class="comment">/*******************************************************************************</span></div>
-<div class="line"><a name="l04157"></a><span class="lineno"> 4157</span>&#160;<span class="comment">END OF CONFIGURATION</span></div>
-<div class="line"><a name="l04158"></a><span class="lineno"> 4158</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l04159"></a><span class="lineno"> 4159</span>&#160; </div>
-<div class="line"><a name="l04160"></a><span class="lineno"> 4160</span>&#160;<span class="comment">// # Copy of some Vulkan definitions so we don&#39;t need to check their existence just to handle few constants.</span></div>
-<div class="line"><a name="l04161"></a><span class="lineno"> 4161</span>&#160; </div>
-<div class="line"><a name="l04162"></a><span class="lineno"> 4162</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY = 0x00000040;</div>
-<div class="line"><a name="l04163"></a><span class="lineno"> 4163</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY = 0x00000080;</div>
-<div class="line"><a name="l04164"></a><span class="lineno"> 4164</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_COPY = 0x00020000;</div>
+<div class="line"><a name="l04144"></a><span class="lineno"> 4144</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_MARGIN (0)</span></div>
+<div class="line"><a name="l04145"></a><span class="lineno"> 4145</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04146"></a><span class="lineno"> 4146</span>&#160; </div>
+<div class="line"><a name="l04147"></a><span class="lineno"> 4147</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_INITIALIZE_ALLOCATIONS</span></div>
+<div class="line"><a name="l04148"></a><span class="lineno"> 4148</span>&#160; </div>
+<div class="line"><a name="l04152"></a><span class="lineno"> 4152</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_INITIALIZE_ALLOCATIONS (0)</span></div>
+<div class="line"><a name="l04153"></a><span class="lineno"> 4153</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04154"></a><span class="lineno"> 4154</span>&#160; </div>
+<div class="line"><a name="l04155"></a><span class="lineno"> 4155</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_DETECT_CORRUPTION</span></div>
+<div class="line"><a name="l04156"></a><span class="lineno"> 4156</span>&#160; </div>
+<div class="line"><a name="l04161"></a><span class="lineno"> 4161</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_DETECT_CORRUPTION (0)</span></div>
+<div class="line"><a name="l04162"></a><span class="lineno"> 4162</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04163"></a><span class="lineno"> 4163</span>&#160; </div>
+<div class="line"><a name="l04164"></a><span class="lineno"> 4164</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_GLOBAL_MUTEX</span></div>
 <div class="line"><a name="l04165"></a><span class="lineno"> 4165</span>&#160; </div>
-<div class="line"><a name="l04166"></a><span class="lineno"> 4166</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_ALLOCATION_INTERNAL_STRATEGY_MIN_OFFSET = 0x10000000u;</div>
-<div class="line"><a name="l04167"></a><span class="lineno"> 4167</span>&#160; </div>
-<div class="line"><a name="l04168"></a><span class="lineno"> 4168</span>&#160;<span class="keyword">static</span> VkAllocationCallbacks VmaEmptyAllocationCallbacks = {</div>
-<div class="line"><a name="l04169"></a><span class="lineno"> 4169</span>&#160;    VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL };</div>
-<div class="line"><a name="l04170"></a><span class="lineno"> 4170</span>&#160; </div>
-<div class="line"><a name="l04171"></a><span class="lineno"> 4171</span>&#160;<span class="comment">// Returns number of bits set to 1 in (v).</span></div>
-<div class="line"><a name="l04172"></a><span class="lineno"> 4172</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint32_t VmaCountBitsSet(uint32_t v)</div>
-<div class="line"><a name="l04173"></a><span class="lineno"> 4173</span>&#160;{</div>
-<div class="line"><a name="l04174"></a><span class="lineno"> 4174</span>&#160;    uint32_t c = v - ((v &gt;&gt; 1) &amp; 0x55555555);</div>
-<div class="line"><a name="l04175"></a><span class="lineno"> 4175</span>&#160;    c = ((c &gt;&gt;  2) &amp; 0x33333333) + (c &amp; 0x33333333);</div>
-<div class="line"><a name="l04176"></a><span class="lineno"> 4176</span>&#160;    c = ((c &gt;&gt;  4) + c) &amp; 0x0F0F0F0F;</div>
-<div class="line"><a name="l04177"></a><span class="lineno"> 4177</span>&#160;    c = ((c &gt;&gt;  8) + c) &amp; 0x00FF00FF;</div>
-<div class="line"><a name="l04178"></a><span class="lineno"> 4178</span>&#160;    c = ((c &gt;&gt; 16) + c) &amp; 0x0000FFFF;</div>
-<div class="line"><a name="l04179"></a><span class="lineno"> 4179</span>&#160;    <span class="keywordflow">return</span> c;</div>
-<div class="line"><a name="l04180"></a><span class="lineno"> 4180</span>&#160;}</div>
-<div class="line"><a name="l04181"></a><span class="lineno"> 4181</span>&#160; </div>
-<div class="line"><a name="l04182"></a><span class="lineno"> 4182</span>&#160;<span class="comment">// Aligns given value up to nearest multiply of align value. For example: VmaAlignUp(11, 8) = 16.</span></div>
-<div class="line"><a name="l04183"></a><span class="lineno"> 4183</span>&#160;<span class="comment">// Use types like uint32_t, uint64_t as T.</span></div>
-<div class="line"><a name="l04184"></a><span class="lineno"> 4184</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l04185"></a><span class="lineno"> 4185</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> T VmaAlignUp(T val, T align)</div>
-<div class="line"><a name="l04186"></a><span class="lineno"> 4186</span>&#160;{</div>
-<div class="line"><a name="l04187"></a><span class="lineno"> 4187</span>&#160;    <span class="keywordflow">return</span> (val + align - 1) / align * align;</div>
-<div class="line"><a name="l04188"></a><span class="lineno"> 4188</span>&#160;}</div>
-<div class="line"><a name="l04189"></a><span class="lineno"> 4189</span>&#160;<span class="comment">// Aligns given value down to nearest multiply of align value. For example: VmaAlignUp(11, 8) = 8.</span></div>
-<div class="line"><a name="l04190"></a><span class="lineno"> 4190</span>&#160;<span class="comment">// Use types like uint32_t, uint64_t as T.</span></div>
-<div class="line"><a name="l04191"></a><span class="lineno"> 4191</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l04192"></a><span class="lineno"> 4192</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> T VmaAlignDown(T val, T align)</div>
-<div class="line"><a name="l04193"></a><span class="lineno"> 4193</span>&#160;{</div>
-<div class="line"><a name="l04194"></a><span class="lineno"> 4194</span>&#160;    <span class="keywordflow">return</span> val / align * align;</div>
-<div class="line"><a name="l04195"></a><span class="lineno"> 4195</span>&#160;}</div>
+<div class="line"><a name="l04169"></a><span class="lineno"> 4169</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_GLOBAL_MUTEX (0)</span></div>
+<div class="line"><a name="l04170"></a><span class="lineno"> 4170</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04171"></a><span class="lineno"> 4171</span>&#160; </div>
+<div class="line"><a name="l04172"></a><span class="lineno"> 4172</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY</span></div>
+<div class="line"><a name="l04173"></a><span class="lineno"> 4173</span>&#160; </div>
+<div class="line"><a name="l04177"></a><span class="lineno"> 4177</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY (1)</span></div>
+<div class="line"><a name="l04178"></a><span class="lineno"> 4178</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04179"></a><span class="lineno"> 4179</span>&#160; </div>
+<div class="line"><a name="l04180"></a><span class="lineno"> 4180</span>&#160;<span class="preprocessor">#ifndef VMA_SMALL_HEAP_MAX_SIZE</span></div>
+<div class="line"><a name="l04181"></a><span class="lineno"> 4181</span>&#160;<span class="preprocessor">   #define VMA_SMALL_HEAP_MAX_SIZE (1024ull * 1024 * 1024)</span></div>
+<div class="line"><a name="l04183"></a><span class="lineno"> 4183</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04184"></a><span class="lineno"> 4184</span>&#160; </div>
+<div class="line"><a name="l04185"></a><span class="lineno"> 4185</span>&#160;<span class="preprocessor">#ifndef VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE</span></div>
+<div class="line"><a name="l04186"></a><span class="lineno"> 4186</span>&#160;<span class="preprocessor">   #define VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE (256ull * 1024 * 1024)</span></div>
+<div class="line"><a name="l04188"></a><span class="lineno"> 4188</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04189"></a><span class="lineno"> 4189</span>&#160; </div>
+<div class="line"><a name="l04190"></a><span class="lineno"> 4190</span>&#160;<span class="preprocessor">#ifndef VMA_CLASS_NO_COPY</span></div>
+<div class="line"><a name="l04191"></a><span class="lineno"> 4191</span>&#160;<span class="preprocessor">    #define VMA_CLASS_NO_COPY(className) \</span></div>
+<div class="line"><a name="l04192"></a><span class="lineno"> 4192</span>&#160;<span class="preprocessor">        private: \</span></div>
+<div class="line"><a name="l04193"></a><span class="lineno"> 4193</span>&#160;<span class="preprocessor">            className(const className&amp;) = delete; \</span></div>
+<div class="line"><a name="l04194"></a><span class="lineno"> 4194</span>&#160;<span class="preprocessor">            className&amp; operator=(const className&amp;) = delete;</span></div>
+<div class="line"><a name="l04195"></a><span class="lineno"> 4195</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l04196"></a><span class="lineno"> 4196</span>&#160; </div>
-<div class="line"><a name="l04197"></a><span class="lineno"> 4197</span>&#160;<span class="comment">// Division with mathematical rounding to nearest number.</span></div>
-<div class="line"><a name="l04198"></a><span class="lineno"> 4198</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l04199"></a><span class="lineno"> 4199</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> T VmaRoundDiv(T x, T y)</div>
-<div class="line"><a name="l04200"></a><span class="lineno"> 4200</span>&#160;{</div>
-<div class="line"><a name="l04201"></a><span class="lineno"> 4201</span>&#160;    <span class="keywordflow">return</span> (x + (y / (T)2)) / y;</div>
-<div class="line"><a name="l04202"></a><span class="lineno"> 4202</span>&#160;}</div>
-<div class="line"><a name="l04203"></a><span class="lineno"> 4203</span>&#160; </div>
-<div class="line"><a name="l04204"></a><span class="lineno"> 4204</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l04205"></a><span class="lineno"> 4205</span>&#160;<span class="comment">Returns true if given number is a power of two.</span></div>
-<div class="line"><a name="l04206"></a><span class="lineno"> 4206</span>&#160;<span class="comment">T must be unsigned integer number or signed integer but always nonnegative.</span></div>
-<div class="line"><a name="l04207"></a><span class="lineno"> 4207</span>&#160;<span class="comment">For 0 returns true.</span></div>
-<div class="line"><a name="l04208"></a><span class="lineno"> 4208</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l04209"></a><span class="lineno"> 4209</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l04210"></a><span class="lineno"> 4210</span>&#160;<span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaIsPow2(T x)</div>
-<div class="line"><a name="l04211"></a><span class="lineno"> 4211</span>&#160;{</div>
-<div class="line"><a name="l04212"></a><span class="lineno"> 4212</span>&#160;    <span class="keywordflow">return</span> (x &amp; (x-1)) == 0;</div>
-<div class="line"><a name="l04213"></a><span class="lineno"> 4213</span>&#160;}</div>
+<div class="line"><a name="l04197"></a><span class="lineno"> 4197</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_FRAME_INDEX_LOST = UINT32_MAX;</div>
+<div class="line"><a name="l04198"></a><span class="lineno"> 4198</span>&#160; </div>
+<div class="line"><a name="l04199"></a><span class="lineno"> 4199</span>&#160;<span class="comment">// Decimal 2139416166, float NaN, little-endian binary 66 E6 84 7F.</span></div>
+<div class="line"><a name="l04200"></a><span class="lineno"> 4200</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_CORRUPTION_DETECTION_MAGIC_VALUE = 0x7F84E666;</div>
+<div class="line"><a name="l04201"></a><span class="lineno"> 4201</span>&#160; </div>
+<div class="line"><a name="l04202"></a><span class="lineno"> 4202</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint8_t VMA_ALLOCATION_FILL_PATTERN_CREATED   = 0xDC;</div>
+<div class="line"><a name="l04203"></a><span class="lineno"> 4203</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint8_t VMA_ALLOCATION_FILL_PATTERN_DESTROYED = 0xEF;</div>
+<div class="line"><a name="l04204"></a><span class="lineno"> 4204</span>&#160; </div>
+<div class="line"><a name="l04205"></a><span class="lineno"> 4205</span>&#160;<span class="comment">/*******************************************************************************</span></div>
+<div class="line"><a name="l04206"></a><span class="lineno"> 4206</span>&#160;<span class="comment">END OF CONFIGURATION</span></div>
+<div class="line"><a name="l04207"></a><span class="lineno"> 4207</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l04208"></a><span class="lineno"> 4208</span>&#160; </div>
+<div class="line"><a name="l04209"></a><span class="lineno"> 4209</span>&#160;<span class="comment">// # Copy of some Vulkan definitions so we don&#39;t need to check their existence just to handle few constants.</span></div>
+<div class="line"><a name="l04210"></a><span class="lineno"> 4210</span>&#160; </div>
+<div class="line"><a name="l04211"></a><span class="lineno"> 4211</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY = 0x00000040;</div>
+<div class="line"><a name="l04212"></a><span class="lineno"> 4212</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY = 0x00000080;</div>
+<div class="line"><a name="l04213"></a><span class="lineno"> 4213</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_COPY = 0x00020000;</div>
 <div class="line"><a name="l04214"></a><span class="lineno"> 4214</span>&#160; </div>
-<div class="line"><a name="l04215"></a><span class="lineno"> 4215</span>&#160;<span class="comment">// Returns smallest power of 2 greater or equal to v.</span></div>
-<div class="line"><a name="l04216"></a><span class="lineno"> 4216</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint32_t VmaNextPow2(uint32_t v)</div>
-<div class="line"><a name="l04217"></a><span class="lineno"> 4217</span>&#160;{</div>
-<div class="line"><a name="l04218"></a><span class="lineno"> 4218</span>&#160;    v--;</div>
-<div class="line"><a name="l04219"></a><span class="lineno"> 4219</span>&#160;    v |= v &gt;&gt; 1;</div>
-<div class="line"><a name="l04220"></a><span class="lineno"> 4220</span>&#160;    v |= v &gt;&gt; 2;</div>
-<div class="line"><a name="l04221"></a><span class="lineno"> 4221</span>&#160;    v |= v &gt;&gt; 4;</div>
-<div class="line"><a name="l04222"></a><span class="lineno"> 4222</span>&#160;    v |= v &gt;&gt; 8;</div>
-<div class="line"><a name="l04223"></a><span class="lineno"> 4223</span>&#160;    v |= v &gt;&gt; 16;</div>
-<div class="line"><a name="l04224"></a><span class="lineno"> 4224</span>&#160;    v++;</div>
-<div class="line"><a name="l04225"></a><span class="lineno"> 4225</span>&#160;    <span class="keywordflow">return</span> v;</div>
-<div class="line"><a name="l04226"></a><span class="lineno"> 4226</span>&#160;}</div>
-<div class="line"><a name="l04227"></a><span class="lineno"> 4227</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint64_t VmaNextPow2(uint64_t v)</div>
-<div class="line"><a name="l04228"></a><span class="lineno"> 4228</span>&#160;{</div>
-<div class="line"><a name="l04229"></a><span class="lineno"> 4229</span>&#160;    v--;</div>
-<div class="line"><a name="l04230"></a><span class="lineno"> 4230</span>&#160;    v |= v &gt;&gt; 1;</div>
-<div class="line"><a name="l04231"></a><span class="lineno"> 4231</span>&#160;    v |= v &gt;&gt; 2;</div>
-<div class="line"><a name="l04232"></a><span class="lineno"> 4232</span>&#160;    v |= v &gt;&gt; 4;</div>
-<div class="line"><a name="l04233"></a><span class="lineno"> 4233</span>&#160;    v |= v &gt;&gt; 8;</div>
-<div class="line"><a name="l04234"></a><span class="lineno"> 4234</span>&#160;    v |= v &gt;&gt; 16;</div>
-<div class="line"><a name="l04235"></a><span class="lineno"> 4235</span>&#160;    v |= v &gt;&gt; 32;</div>
-<div class="line"><a name="l04236"></a><span class="lineno"> 4236</span>&#160;    v++;</div>
-<div class="line"><a name="l04237"></a><span class="lineno"> 4237</span>&#160;    <span class="keywordflow">return</span> v;</div>
-<div class="line"><a name="l04238"></a><span class="lineno"> 4238</span>&#160;}</div>
-<div class="line"><a name="l04239"></a><span class="lineno"> 4239</span>&#160; </div>
-<div class="line"><a name="l04240"></a><span class="lineno"> 4240</span>&#160;<span class="comment">// Returns largest power of 2 less or equal to v.</span></div>
-<div class="line"><a name="l04241"></a><span class="lineno"> 4241</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint32_t VmaPrevPow2(uint32_t v)</div>
+<div class="line"><a name="l04215"></a><span class="lineno"> 4215</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_ALLOCATION_INTERNAL_STRATEGY_MIN_OFFSET = 0x10000000u;</div>
+<div class="line"><a name="l04216"></a><span class="lineno"> 4216</span>&#160; </div>
+<div class="line"><a name="l04217"></a><span class="lineno"> 4217</span>&#160;<span class="keyword">static</span> VkAllocationCallbacks VmaEmptyAllocationCallbacks = {</div>
+<div class="line"><a name="l04218"></a><span class="lineno"> 4218</span>&#160;    VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL };</div>
+<div class="line"><a name="l04219"></a><span class="lineno"> 4219</span>&#160; </div>
+<div class="line"><a name="l04220"></a><span class="lineno"> 4220</span>&#160;<span class="comment">// Returns number of bits set to 1 in (v).</span></div>
+<div class="line"><a name="l04221"></a><span class="lineno"> 4221</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint32_t VmaCountBitsSet(uint32_t v)</div>
+<div class="line"><a name="l04222"></a><span class="lineno"> 4222</span>&#160;{</div>
+<div class="line"><a name="l04223"></a><span class="lineno"> 4223</span>&#160;    uint32_t c = v - ((v &gt;&gt; 1) &amp; 0x55555555);</div>
+<div class="line"><a name="l04224"></a><span class="lineno"> 4224</span>&#160;    c = ((c &gt;&gt;  2) &amp; 0x33333333) + (c &amp; 0x33333333);</div>
+<div class="line"><a name="l04225"></a><span class="lineno"> 4225</span>&#160;    c = ((c &gt;&gt;  4) + c) &amp; 0x0F0F0F0F;</div>
+<div class="line"><a name="l04226"></a><span class="lineno"> 4226</span>&#160;    c = ((c &gt;&gt;  8) + c) &amp; 0x00FF00FF;</div>
+<div class="line"><a name="l04227"></a><span class="lineno"> 4227</span>&#160;    c = ((c &gt;&gt; 16) + c) &amp; 0x0000FFFF;</div>
+<div class="line"><a name="l04228"></a><span class="lineno"> 4228</span>&#160;    <span class="keywordflow">return</span> c;</div>
+<div class="line"><a name="l04229"></a><span class="lineno"> 4229</span>&#160;}</div>
+<div class="line"><a name="l04230"></a><span class="lineno"> 4230</span>&#160; </div>
+<div class="line"><a name="l04231"></a><span class="lineno"> 4231</span>&#160;<span class="comment">// Aligns given value up to nearest multiply of align value. For example: VmaAlignUp(11, 8) = 16.</span></div>
+<div class="line"><a name="l04232"></a><span class="lineno"> 4232</span>&#160;<span class="comment">// Use types like uint32_t, uint64_t as T.</span></div>
+<div class="line"><a name="l04233"></a><span class="lineno"> 4233</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l04234"></a><span class="lineno"> 4234</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> T VmaAlignUp(T val, T align)</div>
+<div class="line"><a name="l04235"></a><span class="lineno"> 4235</span>&#160;{</div>
+<div class="line"><a name="l04236"></a><span class="lineno"> 4236</span>&#160;    <span class="keywordflow">return</span> (val + align - 1) / align * align;</div>
+<div class="line"><a name="l04237"></a><span class="lineno"> 4237</span>&#160;}</div>
+<div class="line"><a name="l04238"></a><span class="lineno"> 4238</span>&#160;<span class="comment">// Aligns given value down to nearest multiply of align value. For example: VmaAlignUp(11, 8) = 8.</span></div>
+<div class="line"><a name="l04239"></a><span class="lineno"> 4239</span>&#160;<span class="comment">// Use types like uint32_t, uint64_t as T.</span></div>
+<div class="line"><a name="l04240"></a><span class="lineno"> 4240</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l04241"></a><span class="lineno"> 4241</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> T VmaAlignDown(T val, T align)</div>
 <div class="line"><a name="l04242"></a><span class="lineno"> 4242</span>&#160;{</div>
-<div class="line"><a name="l04243"></a><span class="lineno"> 4243</span>&#160;    v |= v &gt;&gt; 1;</div>
-<div class="line"><a name="l04244"></a><span class="lineno"> 4244</span>&#160;    v |= v &gt;&gt; 2;</div>
-<div class="line"><a name="l04245"></a><span class="lineno"> 4245</span>&#160;    v |= v &gt;&gt; 4;</div>
-<div class="line"><a name="l04246"></a><span class="lineno"> 4246</span>&#160;    v |= v &gt;&gt; 8;</div>
-<div class="line"><a name="l04247"></a><span class="lineno"> 4247</span>&#160;    v |= v &gt;&gt; 16;</div>
-<div class="line"><a name="l04248"></a><span class="lineno"> 4248</span>&#160;    v = v ^ (v &gt;&gt; 1);</div>
-<div class="line"><a name="l04249"></a><span class="lineno"> 4249</span>&#160;    <span class="keywordflow">return</span> v;</div>
-<div class="line"><a name="l04250"></a><span class="lineno"> 4250</span>&#160;}</div>
-<div class="line"><a name="l04251"></a><span class="lineno"> 4251</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint64_t VmaPrevPow2(uint64_t v)</div>
-<div class="line"><a name="l04252"></a><span class="lineno"> 4252</span>&#160;{</div>
-<div class="line"><a name="l04253"></a><span class="lineno"> 4253</span>&#160;    v |= v &gt;&gt; 1;</div>
-<div class="line"><a name="l04254"></a><span class="lineno"> 4254</span>&#160;    v |= v &gt;&gt; 2;</div>
-<div class="line"><a name="l04255"></a><span class="lineno"> 4255</span>&#160;    v |= v &gt;&gt; 4;</div>
-<div class="line"><a name="l04256"></a><span class="lineno"> 4256</span>&#160;    v |= v &gt;&gt; 8;</div>
-<div class="line"><a name="l04257"></a><span class="lineno"> 4257</span>&#160;    v |= v &gt;&gt; 16;</div>
-<div class="line"><a name="l04258"></a><span class="lineno"> 4258</span>&#160;    v |= v &gt;&gt; 32;</div>
-<div class="line"><a name="l04259"></a><span class="lineno"> 4259</span>&#160;    v = v ^ (v &gt;&gt; 1);</div>
-<div class="line"><a name="l04260"></a><span class="lineno"> 4260</span>&#160;    <span class="keywordflow">return</span> v;</div>
-<div class="line"><a name="l04261"></a><span class="lineno"> 4261</span>&#160;}</div>
-<div class="line"><a name="l04262"></a><span class="lineno"> 4262</span>&#160; </div>
-<div class="line"><a name="l04263"></a><span class="lineno"> 4263</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaStrIsEmpty(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
-<div class="line"><a name="l04264"></a><span class="lineno"> 4264</span>&#160;{</div>
-<div class="line"><a name="l04265"></a><span class="lineno"> 4265</span>&#160;    <span class="keywordflow">return</span> pStr == VMA_NULL || *pStr == <span class="charliteral">&#39;\0&#39;</span>;</div>
-<div class="line"><a name="l04266"></a><span class="lineno"> 4266</span>&#160;}</div>
-<div class="line"><a name="l04267"></a><span class="lineno"> 4267</span>&#160; </div>
-<div class="line"><a name="l04268"></a><span class="lineno"> 4268</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l04269"></a><span class="lineno"> 4269</span>&#160; </div>
-<div class="line"><a name="l04270"></a><span class="lineno"> 4270</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* VmaAlgorithmToStr(uint32_t algorithm)</div>
-<div class="line"><a name="l04271"></a><span class="lineno"> 4271</span>&#160;{</div>
-<div class="line"><a name="l04272"></a><span class="lineno"> 4272</span>&#160;    <span class="keywordflow">switch</span>(algorithm)</div>
-<div class="line"><a name="l04273"></a><span class="lineno"> 4273</span>&#160;    {</div>
-<div class="line"><a name="l04274"></a><span class="lineno"> 4274</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>:</div>
-<div class="line"><a name="l04275"></a><span class="lineno"> 4275</span>&#160;        <span class="keywordflow">return</span> <span class="stringliteral">&quot;Linear&quot;</span>;</div>
-<div class="line"><a name="l04276"></a><span class="lineno"> 4276</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a>:</div>
-<div class="line"><a name="l04277"></a><span class="lineno"> 4277</span>&#160;        <span class="keywordflow">return</span> <span class="stringliteral">&quot;Buddy&quot;</span>;</div>
-<div class="line"><a name="l04278"></a><span class="lineno"> 4278</span>&#160;    <span class="keywordflow">case</span> 0:</div>
-<div class="line"><a name="l04279"></a><span class="lineno"> 4279</span>&#160;        <span class="keywordflow">return</span> <span class="stringliteral">&quot;Default&quot;</span>;</div>
-<div class="line"><a name="l04280"></a><span class="lineno"> 4280</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l04281"></a><span class="lineno"> 4281</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l04282"></a><span class="lineno"> 4282</span>&#160;        <span class="keywordflow">return</span> <span class="stringliteral">&quot;&quot;</span>;</div>
-<div class="line"><a name="l04283"></a><span class="lineno"> 4283</span>&#160;    }</div>
-<div class="line"><a name="l04284"></a><span class="lineno"> 4284</span>&#160;}</div>
-<div class="line"><a name="l04285"></a><span class="lineno"> 4285</span>&#160; </div>
-<div class="line"><a name="l04286"></a><span class="lineno"> 4286</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l04287"></a><span class="lineno"> 4287</span>&#160; </div>
-<div class="line"><a name="l04288"></a><span class="lineno"> 4288</span>&#160;<span class="preprocessor">#ifndef VMA_SORT</span></div>
-<div class="line"><a name="l04289"></a><span class="lineno"> 4289</span>&#160; </div>
-<div class="line"><a name="l04290"></a><span class="lineno"> 4290</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> Iterator, <span class="keyword">typename</span> Compare&gt;</div>
-<div class="line"><a name="l04291"></a><span class="lineno"> 4291</span>&#160;Iterator VmaQuickSortPartition(Iterator beg, Iterator end, Compare cmp)</div>
-<div class="line"><a name="l04292"></a><span class="lineno"> 4292</span>&#160;{</div>
-<div class="line"><a name="l04293"></a><span class="lineno"> 4293</span>&#160;    Iterator centerValue = end; --centerValue;</div>
-<div class="line"><a name="l04294"></a><span class="lineno"> 4294</span>&#160;    Iterator insertIndex = beg;</div>
-<div class="line"><a name="l04295"></a><span class="lineno"> 4295</span>&#160;    <span class="keywordflow">for</span>(Iterator memTypeIndex = beg; memTypeIndex &lt; centerValue; ++memTypeIndex)</div>
-<div class="line"><a name="l04296"></a><span class="lineno"> 4296</span>&#160;    {</div>
-<div class="line"><a name="l04297"></a><span class="lineno"> 4297</span>&#160;        <span class="keywordflow">if</span>(cmp(*memTypeIndex, *centerValue))</div>
-<div class="line"><a name="l04298"></a><span class="lineno"> 4298</span>&#160;        {</div>
-<div class="line"><a name="l04299"></a><span class="lineno"> 4299</span>&#160;            <span class="keywordflow">if</span>(insertIndex != memTypeIndex)</div>
-<div class="line"><a name="l04300"></a><span class="lineno"> 4300</span>&#160;            {</div>
-<div class="line"><a name="l04301"></a><span class="lineno"> 4301</span>&#160;                VMA_SWAP(*memTypeIndex, *insertIndex);</div>
-<div class="line"><a name="l04302"></a><span class="lineno"> 4302</span>&#160;            }</div>
-<div class="line"><a name="l04303"></a><span class="lineno"> 4303</span>&#160;            ++insertIndex;</div>
-<div class="line"><a name="l04304"></a><span class="lineno"> 4304</span>&#160;        }</div>
-<div class="line"><a name="l04305"></a><span class="lineno"> 4305</span>&#160;    }</div>
-<div class="line"><a name="l04306"></a><span class="lineno"> 4306</span>&#160;    <span class="keywordflow">if</span>(insertIndex != centerValue)</div>
-<div class="line"><a name="l04307"></a><span class="lineno"> 4307</span>&#160;    {</div>
-<div class="line"><a name="l04308"></a><span class="lineno"> 4308</span>&#160;        VMA_SWAP(*insertIndex, *centerValue);</div>
-<div class="line"><a name="l04309"></a><span class="lineno"> 4309</span>&#160;    }</div>
-<div class="line"><a name="l04310"></a><span class="lineno"> 4310</span>&#160;    <span class="keywordflow">return</span> insertIndex;</div>
-<div class="line"><a name="l04311"></a><span class="lineno"> 4311</span>&#160;}</div>
-<div class="line"><a name="l04312"></a><span class="lineno"> 4312</span>&#160; </div>
-<div class="line"><a name="l04313"></a><span class="lineno"> 4313</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> Iterator, <span class="keyword">typename</span> Compare&gt;</div>
-<div class="line"><a name="l04314"></a><span class="lineno"> 4314</span>&#160;<span class="keywordtype">void</span> VmaQuickSort(Iterator beg, Iterator end, Compare cmp)</div>
-<div class="line"><a name="l04315"></a><span class="lineno"> 4315</span>&#160;{</div>
-<div class="line"><a name="l04316"></a><span class="lineno"> 4316</span>&#160;    <span class="keywordflow">if</span>(beg &lt; end)</div>
-<div class="line"><a name="l04317"></a><span class="lineno"> 4317</span>&#160;    {</div>
-<div class="line"><a name="l04318"></a><span class="lineno"> 4318</span>&#160;        Iterator it = VmaQuickSortPartition&lt;Iterator, Compare&gt;(beg, end, cmp);</div>
-<div class="line"><a name="l04319"></a><span class="lineno"> 4319</span>&#160;        VmaQuickSort&lt;Iterator, Compare&gt;(beg, it, cmp);</div>
-<div class="line"><a name="l04320"></a><span class="lineno"> 4320</span>&#160;        VmaQuickSort&lt;Iterator, Compare&gt;(it + 1, end, cmp);</div>
-<div class="line"><a name="l04321"></a><span class="lineno"> 4321</span>&#160;    }</div>
-<div class="line"><a name="l04322"></a><span class="lineno"> 4322</span>&#160;}</div>
-<div class="line"><a name="l04323"></a><span class="lineno"> 4323</span>&#160; </div>
-<div class="line"><a name="l04324"></a><span class="lineno"> 4324</span>&#160;<span class="preprocessor">#define VMA_SORT(beg, end, cmp) VmaQuickSort(beg, end, cmp)</span></div>
-<div class="line"><a name="l04325"></a><span class="lineno"> 4325</span>&#160; </div>
-<div class="line"><a name="l04326"></a><span class="lineno"> 4326</span>&#160;<span class="preprocessor">#endif // #ifndef VMA_SORT</span></div>
-<div class="line"><a name="l04327"></a><span class="lineno"> 4327</span>&#160; </div>
-<div class="line"><a name="l04328"></a><span class="lineno"> 4328</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l04329"></a><span class="lineno"> 4329</span>&#160;<span class="comment">Returns true if two memory blocks occupy overlapping pages.</span></div>
-<div class="line"><a name="l04330"></a><span class="lineno"> 4330</span>&#160;<span class="comment">ResourceA must be in less memory offset than ResourceB.</span></div>
-<div class="line"><a name="l04331"></a><span class="lineno"> 4331</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l04332"></a><span class="lineno"> 4332</span>&#160;<span class="comment">Algorithm is based on &quot;Vulkan 1.0.39 - A Specification (with all registered Vulkan extensions)&quot;</span></div>
-<div class="line"><a name="l04333"></a><span class="lineno"> 4333</span>&#160;<span class="comment">chapter 11.6 &quot;Resource Memory Association&quot;, paragraph &quot;Buffer-Image Granularity&quot;.</span></div>
-<div class="line"><a name="l04334"></a><span class="lineno"> 4334</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l04335"></a><span class="lineno"> 4335</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaBlocksOnSamePage(</div>
-<div class="line"><a name="l04336"></a><span class="lineno"> 4336</span>&#160;    VkDeviceSize resourceAOffset,</div>
-<div class="line"><a name="l04337"></a><span class="lineno"> 4337</span>&#160;    VkDeviceSize resourceASize,</div>
-<div class="line"><a name="l04338"></a><span class="lineno"> 4338</span>&#160;    VkDeviceSize resourceBOffset,</div>
-<div class="line"><a name="l04339"></a><span class="lineno"> 4339</span>&#160;    VkDeviceSize pageSize)</div>
-<div class="line"><a name="l04340"></a><span class="lineno"> 4340</span>&#160;{</div>
-<div class="line"><a name="l04341"></a><span class="lineno"> 4341</span>&#160;    VMA_ASSERT(resourceAOffset + resourceASize &lt;= resourceBOffset &amp;&amp; resourceASize &gt; 0 &amp;&amp; pageSize &gt; 0);</div>
-<div class="line"><a name="l04342"></a><span class="lineno"> 4342</span>&#160;    VkDeviceSize resourceAEnd = resourceAOffset + resourceASize - 1;</div>
-<div class="line"><a name="l04343"></a><span class="lineno"> 4343</span>&#160;    VkDeviceSize resourceAEndPage = resourceAEnd &amp; ~(pageSize - 1);</div>
-<div class="line"><a name="l04344"></a><span class="lineno"> 4344</span>&#160;    VkDeviceSize resourceBStart = resourceBOffset;</div>
-<div class="line"><a name="l04345"></a><span class="lineno"> 4345</span>&#160;    VkDeviceSize resourceBStartPage = resourceBStart &amp; ~(pageSize - 1);</div>
-<div class="line"><a name="l04346"></a><span class="lineno"> 4346</span>&#160;    <span class="keywordflow">return</span> resourceAEndPage == resourceBStartPage;</div>
-<div class="line"><a name="l04347"></a><span class="lineno"> 4347</span>&#160;}</div>
-<div class="line"><a name="l04348"></a><span class="lineno"> 4348</span>&#160; </div>
-<div class="line"><a name="l04349"></a><span class="lineno"> 4349</span>&#160;<span class="keyword">enum</span> VmaSuballocationType</div>
-<div class="line"><a name="l04350"></a><span class="lineno"> 4350</span>&#160;{</div>
-<div class="line"><a name="l04351"></a><span class="lineno"> 4351</span>&#160;    VMA_SUBALLOCATION_TYPE_FREE = 0,</div>
-<div class="line"><a name="l04352"></a><span class="lineno"> 4352</span>&#160;    VMA_SUBALLOCATION_TYPE_UNKNOWN = 1,</div>
-<div class="line"><a name="l04353"></a><span class="lineno"> 4353</span>&#160;    VMA_SUBALLOCATION_TYPE_BUFFER = 2,</div>
-<div class="line"><a name="l04354"></a><span class="lineno"> 4354</span>&#160;    VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN = 3,</div>
-<div class="line"><a name="l04355"></a><span class="lineno"> 4355</span>&#160;    VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR = 4,</div>
-<div class="line"><a name="l04356"></a><span class="lineno"> 4356</span>&#160;    VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL = 5,</div>
-<div class="line"><a name="l04357"></a><span class="lineno"> 4357</span>&#160;    VMA_SUBALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF</div>
-<div class="line"><a name="l04358"></a><span class="lineno"> 4358</span>&#160;};</div>
-<div class="line"><a name="l04359"></a><span class="lineno"> 4359</span>&#160; </div>
-<div class="line"><a name="l04360"></a><span class="lineno"> 4360</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l04361"></a><span class="lineno"> 4361</span>&#160;<span class="comment">Returns true if given suballocation types could conflict and must respect</span></div>
-<div class="line"><a name="l04362"></a><span class="lineno"> 4362</span>&#160;<span class="comment">VkPhysicalDeviceLimits::bufferImageGranularity. They conflict if one is buffer</span></div>
-<div class="line"><a name="l04363"></a><span class="lineno"> 4363</span>&#160;<span class="comment">or linear image and another one is optimal image. If type is unknown, behave</span></div>
-<div class="line"><a name="l04364"></a><span class="lineno"> 4364</span>&#160;<span class="comment">conservatively.</span></div>
-<div class="line"><a name="l04365"></a><span class="lineno"> 4365</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l04366"></a><span class="lineno"> 4366</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaIsBufferImageGranularityConflict(</div>
-<div class="line"><a name="l04367"></a><span class="lineno"> 4367</span>&#160;    VmaSuballocationType suballocType1,</div>
-<div class="line"><a name="l04368"></a><span class="lineno"> 4368</span>&#160;    VmaSuballocationType suballocType2)</div>
-<div class="line"><a name="l04369"></a><span class="lineno"> 4369</span>&#160;{</div>
-<div class="line"><a name="l04370"></a><span class="lineno"> 4370</span>&#160;    <span class="keywordflow">if</span>(suballocType1 &gt; suballocType2)</div>
-<div class="line"><a name="l04371"></a><span class="lineno"> 4371</span>&#160;    {</div>
-<div class="line"><a name="l04372"></a><span class="lineno"> 4372</span>&#160;        VMA_SWAP(suballocType1, suballocType2);</div>
-<div class="line"><a name="l04373"></a><span class="lineno"> 4373</span>&#160;    }</div>
-<div class="line"><a name="l04374"></a><span class="lineno"> 4374</span>&#160;    </div>
-<div class="line"><a name="l04375"></a><span class="lineno"> 4375</span>&#160;    <span class="keywordflow">switch</span>(suballocType1)</div>
-<div class="line"><a name="l04376"></a><span class="lineno"> 4376</span>&#160;    {</div>
-<div class="line"><a name="l04377"></a><span class="lineno"> 4377</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_FREE:</div>
-<div class="line"><a name="l04378"></a><span class="lineno"> 4378</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l04379"></a><span class="lineno"> 4379</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_UNKNOWN:</div>
-<div class="line"><a name="l04380"></a><span class="lineno"> 4380</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l04381"></a><span class="lineno"> 4381</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_BUFFER:</div>
-<div class="line"><a name="l04382"></a><span class="lineno"> 4382</span>&#160;        <span class="keywordflow">return</span></div>
-<div class="line"><a name="l04383"></a><span class="lineno"> 4383</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||</div>
-<div class="line"><a name="l04384"></a><span class="lineno"> 4384</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;</div>
-<div class="line"><a name="l04385"></a><span class="lineno"> 4385</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN:</div>
-<div class="line"><a name="l04386"></a><span class="lineno"> 4386</span>&#160;        <span class="keywordflow">return</span></div>
-<div class="line"><a name="l04387"></a><span class="lineno"> 4387</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||</div>
-<div class="line"><a name="l04388"></a><span class="lineno"> 4388</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR ||</div>
-<div class="line"><a name="l04389"></a><span class="lineno"> 4389</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;</div>
-<div class="line"><a name="l04390"></a><span class="lineno"> 4390</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR:</div>
-<div class="line"><a name="l04391"></a><span class="lineno"> 4391</span>&#160;        <span class="keywordflow">return</span></div>
-<div class="line"><a name="l04392"></a><span class="lineno"> 4392</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;</div>
-<div class="line"><a name="l04393"></a><span class="lineno"> 4393</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL:</div>
-<div class="line"><a name="l04394"></a><span class="lineno"> 4394</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l04395"></a><span class="lineno"> 4395</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l04396"></a><span class="lineno"> 4396</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l04397"></a><span class="lineno"> 4397</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l04398"></a><span class="lineno"> 4398</span>&#160;    }</div>
-<div class="line"><a name="l04399"></a><span class="lineno"> 4399</span>&#160;}</div>
-<div class="line"><a name="l04400"></a><span class="lineno"> 4400</span>&#160; </div>
-<div class="line"><a name="l04401"></a><span class="lineno"> 4401</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaWriteMagicValue(<span class="keywordtype">void</span>* pData, VkDeviceSize offset)</div>
-<div class="line"><a name="l04402"></a><span class="lineno"> 4402</span>&#160;{</div>
-<div class="line"><a name="l04403"></a><span class="lineno"> 4403</span>&#160;<span class="preprocessor">#if VMA_DEBUG_MARGIN &gt; 0 &amp;&amp; VMA_DEBUG_DETECT_CORRUPTION</span></div>
-<div class="line"><a name="l04404"></a><span class="lineno"> 4404</span>&#160;    uint32_t* pDst = (uint32_t*)((<span class="keywordtype">char</span>*)pData + offset);</div>
-<div class="line"><a name="l04405"></a><span class="lineno"> 4405</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> numberCount = VMA_DEBUG_MARGIN / <span class="keyword">sizeof</span>(uint32_t);</div>
-<div class="line"><a name="l04406"></a><span class="lineno"> 4406</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; numberCount; ++i, ++pDst)</div>
-<div class="line"><a name="l04407"></a><span class="lineno"> 4407</span>&#160;    {</div>
-<div class="line"><a name="l04408"></a><span class="lineno"> 4408</span>&#160;        *pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;</div>
-<div class="line"><a name="l04409"></a><span class="lineno"> 4409</span>&#160;    }</div>
-<div class="line"><a name="l04410"></a><span class="lineno"> 4410</span>&#160;<span class="preprocessor">#else</span></div>
-<div class="line"><a name="l04411"></a><span class="lineno"> 4411</span>&#160;    <span class="comment">// no-op</span></div>
-<div class="line"><a name="l04412"></a><span class="lineno"> 4412</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04413"></a><span class="lineno"> 4413</span>&#160;}</div>
-<div class="line"><a name="l04414"></a><span class="lineno"> 4414</span>&#160; </div>
-<div class="line"><a name="l04415"></a><span class="lineno"> 4415</span>&#160;<span class="keyword">static</span> <span class="keywordtype">bool</span> VmaValidateMagicValue(<span class="keyword">const</span> <span class="keywordtype">void</span>* pData, VkDeviceSize offset)</div>
-<div class="line"><a name="l04416"></a><span class="lineno"> 4416</span>&#160;{</div>
-<div class="line"><a name="l04417"></a><span class="lineno"> 4417</span>&#160;<span class="preprocessor">#if VMA_DEBUG_MARGIN &gt; 0 &amp;&amp; VMA_DEBUG_DETECT_CORRUPTION</span></div>
-<div class="line"><a name="l04418"></a><span class="lineno"> 4418</span>&#160;    <span class="keyword">const</span> uint32_t* pSrc = (<span class="keyword">const</span> uint32_t*)((<span class="keyword">const</span> <span class="keywordtype">char</span>*)pData + offset);</div>
-<div class="line"><a name="l04419"></a><span class="lineno"> 4419</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> numberCount = VMA_DEBUG_MARGIN / <span class="keyword">sizeof</span>(uint32_t);</div>
-<div class="line"><a name="l04420"></a><span class="lineno"> 4420</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; numberCount; ++i, ++pSrc)</div>
-<div class="line"><a name="l04421"></a><span class="lineno"> 4421</span>&#160;    {</div>
-<div class="line"><a name="l04422"></a><span class="lineno"> 4422</span>&#160;        <span class="keywordflow">if</span>(*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE)</div>
-<div class="line"><a name="l04423"></a><span class="lineno"> 4423</span>&#160;        {</div>
-<div class="line"><a name="l04424"></a><span class="lineno"> 4424</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l04425"></a><span class="lineno"> 4425</span>&#160;        }</div>
-<div class="line"><a name="l04426"></a><span class="lineno"> 4426</span>&#160;    }</div>
-<div class="line"><a name="l04427"></a><span class="lineno"> 4427</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04428"></a><span class="lineno"> 4428</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l04429"></a><span class="lineno"> 4429</span>&#160;}</div>
-<div class="line"><a name="l04430"></a><span class="lineno"> 4430</span>&#160; </div>
-<div class="line"><a name="l04431"></a><span class="lineno"> 4431</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l04432"></a><span class="lineno"> 4432</span>&#160;<span class="comment">Fills structure with parameters of an example buffer to be used for transfers</span></div>
-<div class="line"><a name="l04433"></a><span class="lineno"> 4433</span>&#160;<span class="comment">during GPU memory defragmentation.</span></div>
-<div class="line"><a name="l04434"></a><span class="lineno"> 4434</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l04435"></a><span class="lineno"> 4435</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFillGpuDefragmentationBufferCreateInfo(VkBufferCreateInfo&amp; outBufCreateInfo)</div>
-<div class="line"><a name="l04436"></a><span class="lineno"> 4436</span>&#160;{</div>
-<div class="line"><a name="l04437"></a><span class="lineno"> 4437</span>&#160;    memset(&amp;outBufCreateInfo, 0, <span class="keyword">sizeof</span>(outBufCreateInfo));</div>
-<div class="line"><a name="l04438"></a><span class="lineno"> 4438</span>&#160;    outBufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;</div>
-<div class="line"><a name="l04439"></a><span class="lineno"> 4439</span>&#160;    outBufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;</div>
-<div class="line"><a name="l04440"></a><span class="lineno"> 4440</span>&#160;    outBufCreateInfo.size = (VkDeviceSize)VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE; <span class="comment">// Example size.</span></div>
-<div class="line"><a name="l04441"></a><span class="lineno"> 4441</span>&#160;}</div>
-<div class="line"><a name="l04442"></a><span class="lineno"> 4442</span>&#160; </div>
-<div class="line"><a name="l04443"></a><span class="lineno"> 4443</span>&#160;<span class="comment">// Helper RAII class to lock a mutex in constructor and unlock it in destructor (at the end of scope).</span></div>
-<div class="line"><a name="l04444"></a><span class="lineno"> 4444</span>&#160;<span class="keyword">struct </span>VmaMutexLock</div>
-<div class="line"><a name="l04445"></a><span class="lineno"> 4445</span>&#160;{</div>
-<div class="line"><a name="l04446"></a><span class="lineno"> 4446</span>&#160;    VMA_CLASS_NO_COPY(VmaMutexLock)</div>
-<div class="line"><a name="l04447"></a><span class="lineno"> 4447</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l04448"></a><span class="lineno"> 4448</span>&#160;    VmaMutexLock(VMA_MUTEX&amp; mutex, <span class="keywordtype">bool</span> useMutex = <span class="keyword">true</span>) :</div>
-<div class="line"><a name="l04449"></a><span class="lineno"> 4449</span>&#160;        m_pMutex(useMutex ? &amp;mutex : VMA_NULL)</div>
-<div class="line"><a name="l04450"></a><span class="lineno"> 4450</span>&#160;    { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;Lock(); } }</div>
-<div class="line"><a name="l04451"></a><span class="lineno"> 4451</span>&#160;    ~VmaMutexLock()</div>
-<div class="line"><a name="l04452"></a><span class="lineno"> 4452</span>&#160;    { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;Unlock(); } }</div>
-<div class="line"><a name="l04453"></a><span class="lineno"> 4453</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l04454"></a><span class="lineno"> 4454</span>&#160;    VMA_MUTEX* m_pMutex;</div>
-<div class="line"><a name="l04455"></a><span class="lineno"> 4455</span>&#160;};</div>
-<div class="line"><a name="l04456"></a><span class="lineno"> 4456</span>&#160; </div>
-<div class="line"><a name="l04457"></a><span class="lineno"> 4457</span>&#160;<span class="comment">// Helper RAII class to lock a RW mutex in constructor and unlock it in destructor (at the end of scope), for reading.</span></div>
-<div class="line"><a name="l04458"></a><span class="lineno"> 4458</span>&#160;<span class="keyword">struct </span>VmaMutexLockRead</div>
-<div class="line"><a name="l04459"></a><span class="lineno"> 4459</span>&#160;{</div>
-<div class="line"><a name="l04460"></a><span class="lineno"> 4460</span>&#160;    VMA_CLASS_NO_COPY(VmaMutexLockRead)</div>
-<div class="line"><a name="l04461"></a><span class="lineno"> 4461</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l04462"></a><span class="lineno"> 4462</span>&#160;    VmaMutexLockRead(VMA_RW_MUTEX&amp; mutex, <span class="keywordtype">bool</span> useMutex) :</div>
-<div class="line"><a name="l04463"></a><span class="lineno"> 4463</span>&#160;        m_pMutex(useMutex ? &amp;mutex : VMA_NULL)</div>
-<div class="line"><a name="l04464"></a><span class="lineno"> 4464</span>&#160;    { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;LockRead(); } }</div>
-<div class="line"><a name="l04465"></a><span class="lineno"> 4465</span>&#160;    ~VmaMutexLockRead() { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;UnlockRead(); } }</div>
-<div class="line"><a name="l04466"></a><span class="lineno"> 4466</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l04467"></a><span class="lineno"> 4467</span>&#160;    VMA_RW_MUTEX* m_pMutex;</div>
-<div class="line"><a name="l04468"></a><span class="lineno"> 4468</span>&#160;};</div>
-<div class="line"><a name="l04469"></a><span class="lineno"> 4469</span>&#160; </div>
-<div class="line"><a name="l04470"></a><span class="lineno"> 4470</span>&#160;<span class="comment">// Helper RAII class to lock a RW mutex in constructor and unlock it in destructor (at the end of scope), for writing.</span></div>
-<div class="line"><a name="l04471"></a><span class="lineno"> 4471</span>&#160;<span class="keyword">struct </span>VmaMutexLockWrite</div>
-<div class="line"><a name="l04472"></a><span class="lineno"> 4472</span>&#160;{</div>
-<div class="line"><a name="l04473"></a><span class="lineno"> 4473</span>&#160;    VMA_CLASS_NO_COPY(VmaMutexLockWrite)</div>
-<div class="line"><a name="l04474"></a><span class="lineno"> 4474</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l04475"></a><span class="lineno"> 4475</span>&#160;    VmaMutexLockWrite(VMA_RW_MUTEX&amp; mutex, <span class="keywordtype">bool</span> useMutex) :</div>
-<div class="line"><a name="l04476"></a><span class="lineno"> 4476</span>&#160;        m_pMutex(useMutex ? &amp;mutex : VMA_NULL)</div>
-<div class="line"><a name="l04477"></a><span class="lineno"> 4477</span>&#160;    { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;LockWrite(); } }</div>
-<div class="line"><a name="l04478"></a><span class="lineno"> 4478</span>&#160;    ~VmaMutexLockWrite() { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;UnlockWrite(); } }</div>
-<div class="line"><a name="l04479"></a><span class="lineno"> 4479</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l04480"></a><span class="lineno"> 4480</span>&#160;    VMA_RW_MUTEX* m_pMutex;</div>
-<div class="line"><a name="l04481"></a><span class="lineno"> 4481</span>&#160;};</div>
-<div class="line"><a name="l04482"></a><span class="lineno"> 4482</span>&#160; </div>
-<div class="line"><a name="l04483"></a><span class="lineno"> 4483</span>&#160;<span class="preprocessor">#if VMA_DEBUG_GLOBAL_MUTEX</span></div>
-<div class="line"><a name="l04484"></a><span class="lineno"> 4484</span>&#160;    <span class="keyword">static</span> VMA_MUTEX gDebugGlobalMutex;</div>
-<div class="line"><a name="l04485"></a><span class="lineno"> 4485</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_GLOBAL_MUTEX_LOCK VmaMutexLock debugGlobalMutexLock(gDebugGlobalMutex, true);</span></div>
-<div class="line"><a name="l04486"></a><span class="lineno"> 4486</span>&#160;<span class="preprocessor">#else</span></div>
-<div class="line"><a name="l04487"></a><span class="lineno"> 4487</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_GLOBAL_MUTEX_LOCK</span></div>
-<div class="line"><a name="l04488"></a><span class="lineno"> 4488</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l04489"></a><span class="lineno"> 4489</span>&#160; </div>
-<div class="line"><a name="l04490"></a><span class="lineno"> 4490</span>&#160;<span class="comment">// Minimum size of a free suballocation to register it in the free suballocation collection.</span></div>
-<div class="line"><a name="l04491"></a><span class="lineno"> 4491</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> VkDeviceSize VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER = 16;</div>
-<div class="line"><a name="l04492"></a><span class="lineno"> 4492</span>&#160; </div>
-<div class="line"><a name="l04493"></a><span class="lineno"> 4493</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l04494"></a><span class="lineno"> 4494</span>&#160;<span class="comment">Performs binary search and returns iterator to first element that is greater or</span></div>
-<div class="line"><a name="l04495"></a><span class="lineno"> 4495</span>&#160;<span class="comment">equal to (key), according to comparison (cmp).</span></div>
-<div class="line"><a name="l04496"></a><span class="lineno"> 4496</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l04497"></a><span class="lineno"> 4497</span>&#160;<span class="comment">Cmp should return true if first argument is less than second argument.</span></div>
-<div class="line"><a name="l04498"></a><span class="lineno"> 4498</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l04499"></a><span class="lineno"> 4499</span>&#160;<span class="comment">Returned value is the found element, if present in the collection or place where</span></div>
-<div class="line"><a name="l04500"></a><span class="lineno"> 4500</span>&#160;<span class="comment">new element with value (key) should be inserted.</span></div>
-<div class="line"><a name="l04501"></a><span class="lineno"> 4501</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l04502"></a><span class="lineno"> 4502</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> IterT, <span class="keyword">typename</span> KeyT&gt;</div>
-<div class="line"><a name="l04503"></a><span class="lineno"> 4503</span>&#160;<span class="keyword">static</span> IterT VmaBinaryFindFirstNotLess(IterT beg, IterT end, <span class="keyword">const</span> KeyT &amp;key, <span class="keyword">const</span> CmpLess&amp; cmp)</div>
-<div class="line"><a name="l04504"></a><span class="lineno"> 4504</span>&#160;{</div>
-<div class="line"><a name="l04505"></a><span class="lineno"> 4505</span>&#160;    <span class="keywordtype">size_t</span> down = 0, up = (end - beg);</div>
-<div class="line"><a name="l04506"></a><span class="lineno"> 4506</span>&#160;    <span class="keywordflow">while</span>(down &lt; up)</div>
-<div class="line"><a name="l04507"></a><span class="lineno"> 4507</span>&#160;    {</div>
-<div class="line"><a name="l04508"></a><span class="lineno"> 4508</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> mid = (down + up) / 2;</div>
-<div class="line"><a name="l04509"></a><span class="lineno"> 4509</span>&#160;        <span class="keywordflow">if</span>(cmp(*(beg+mid), key))</div>
-<div class="line"><a name="l04510"></a><span class="lineno"> 4510</span>&#160;        {</div>
-<div class="line"><a name="l04511"></a><span class="lineno"> 4511</span>&#160;            down = mid + 1;</div>
-<div class="line"><a name="l04512"></a><span class="lineno"> 4512</span>&#160;        }</div>
-<div class="line"><a name="l04513"></a><span class="lineno"> 4513</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l04514"></a><span class="lineno"> 4514</span>&#160;        {</div>
-<div class="line"><a name="l04515"></a><span class="lineno"> 4515</span>&#160;            up = mid;</div>
-<div class="line"><a name="l04516"></a><span class="lineno"> 4516</span>&#160;        }</div>
-<div class="line"><a name="l04517"></a><span class="lineno"> 4517</span>&#160;    }</div>
-<div class="line"><a name="l04518"></a><span class="lineno"> 4518</span>&#160;    <span class="keywordflow">return</span> beg + down;</div>
-<div class="line"><a name="l04519"></a><span class="lineno"> 4519</span>&#160;}</div>
-<div class="line"><a name="l04520"></a><span class="lineno"> 4520</span>&#160; </div>
-<div class="line"><a name="l04521"></a><span class="lineno"> 4521</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> IterT, <span class="keyword">typename</span> KeyT&gt;</div>
-<div class="line"><a name="l04522"></a><span class="lineno"> 4522</span>&#160;IterT VmaBinaryFindSorted(<span class="keyword">const</span> IterT&amp; beg, <span class="keyword">const</span> IterT&amp; end, <span class="keyword">const</span> KeyT&amp; value, <span class="keyword">const</span> CmpLess&amp; cmp)</div>
-<div class="line"><a name="l04523"></a><span class="lineno"> 4523</span>&#160;{</div>
-<div class="line"><a name="l04524"></a><span class="lineno"> 4524</span>&#160;    IterT it = VmaBinaryFindFirstNotLess&lt;CmpLess, IterT, KeyT&gt;(</div>
-<div class="line"><a name="l04525"></a><span class="lineno"> 4525</span>&#160;        beg, end, value, cmp);</div>
-<div class="line"><a name="l04526"></a><span class="lineno"> 4526</span>&#160;    <span class="keywordflow">if</span>(it == end ||</div>
-<div class="line"><a name="l04527"></a><span class="lineno"> 4527</span>&#160;        (!cmp(*it, value) &amp;&amp; !cmp(value, *it)))</div>
-<div class="line"><a name="l04528"></a><span class="lineno"> 4528</span>&#160;    {</div>
-<div class="line"><a name="l04529"></a><span class="lineno"> 4529</span>&#160;        <span class="keywordflow">return</span> it;</div>
-<div class="line"><a name="l04530"></a><span class="lineno"> 4530</span>&#160;    }</div>
-<div class="line"><a name="l04531"></a><span class="lineno"> 4531</span>&#160;    <span class="keywordflow">return</span> end;</div>
-<div class="line"><a name="l04532"></a><span class="lineno"> 4532</span>&#160;}</div>
-<div class="line"><a name="l04533"></a><span class="lineno"> 4533</span>&#160; </div>
-<div class="line"><a name="l04534"></a><span class="lineno"> 4534</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l04535"></a><span class="lineno"> 4535</span>&#160;<span class="comment">Returns true if all pointers in the array are not-null and unique.</span></div>
-<div class="line"><a name="l04536"></a><span class="lineno"> 4536</span>&#160;<span class="comment">Warning! O(n^2) complexity. Use only inside VMA_HEAVY_ASSERT.</span></div>
-<div class="line"><a name="l04537"></a><span class="lineno"> 4537</span>&#160;<span class="comment">T must be pointer type, e.g. VmaAllocation, VmaPool.</span></div>
-<div class="line"><a name="l04538"></a><span class="lineno"> 4538</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l04539"></a><span class="lineno"> 4539</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l04540"></a><span class="lineno"> 4540</span>&#160;<span class="keyword">static</span> <span class="keywordtype">bool</span> VmaValidatePointerArray(uint32_t count, <span class="keyword">const</span> T* arr)</div>
-<div class="line"><a name="l04541"></a><span class="lineno"> 4541</span>&#160;{</div>
-<div class="line"><a name="l04542"></a><span class="lineno"> 4542</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; count; ++i)</div>
-<div class="line"><a name="l04543"></a><span class="lineno"> 4543</span>&#160;    {</div>
-<div class="line"><a name="l04544"></a><span class="lineno"> 4544</span>&#160;        <span class="keyword">const</span> T iPtr = arr[i];</div>
-<div class="line"><a name="l04545"></a><span class="lineno"> 4545</span>&#160;        <span class="keywordflow">if</span>(iPtr == VMA_NULL)</div>
-<div class="line"><a name="l04546"></a><span class="lineno"> 4546</span>&#160;        {</div>
-<div class="line"><a name="l04547"></a><span class="lineno"> 4547</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l04548"></a><span class="lineno"> 4548</span>&#160;        }</div>
-<div class="line"><a name="l04549"></a><span class="lineno"> 4549</span>&#160;        <span class="keywordflow">for</span>(uint32_t j = i + 1; j &lt; count; ++j)</div>
-<div class="line"><a name="l04550"></a><span class="lineno"> 4550</span>&#160;        {</div>
-<div class="line"><a name="l04551"></a><span class="lineno"> 4551</span>&#160;            <span class="keywordflow">if</span>(iPtr == arr[j])</div>
-<div class="line"><a name="l04552"></a><span class="lineno"> 4552</span>&#160;            {</div>
-<div class="line"><a name="l04553"></a><span class="lineno"> 4553</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l04554"></a><span class="lineno"> 4554</span>&#160;            }</div>
-<div class="line"><a name="l04555"></a><span class="lineno"> 4555</span>&#160;        }</div>
-<div class="line"><a name="l04556"></a><span class="lineno"> 4556</span>&#160;    }</div>
-<div class="line"><a name="l04557"></a><span class="lineno"> 4557</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l04558"></a><span class="lineno"> 4558</span>&#160;}</div>
-<div class="line"><a name="l04559"></a><span class="lineno"> 4559</span>&#160; </div>
-<div class="line"><a name="l04560"></a><span class="lineno"> 4560</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> MainT, <span class="keyword">typename</span> NewT&gt;</div>
-<div class="line"><a name="l04561"></a><span class="lineno"> 4561</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> VmaPnextChainPushFront(MainT* mainStruct, NewT* newStruct)</div>
-<div class="line"><a name="l04562"></a><span class="lineno"> 4562</span>&#160;{</div>
-<div class="line"><a name="l04563"></a><span class="lineno"> 4563</span>&#160;    newStruct-&gt;pNext = mainStruct-&gt;pNext;</div>
-<div class="line"><a name="l04564"></a><span class="lineno"> 4564</span>&#160;    mainStruct-&gt;pNext = newStruct;</div>
-<div class="line"><a name="l04565"></a><span class="lineno"> 4565</span>&#160;}</div>
-<div class="line"><a name="l04566"></a><span class="lineno"> 4566</span>&#160; </div>
-<div class="line"><a name="l04568"></a><span class="lineno"> 4568</span>&#160;<span class="comment">// Memory allocation</span></div>
+<div class="line"><a name="l04243"></a><span class="lineno"> 4243</span>&#160;    <span class="keywordflow">return</span> val / align * align;</div>
+<div class="line"><a name="l04244"></a><span class="lineno"> 4244</span>&#160;}</div>
+<div class="line"><a name="l04245"></a><span class="lineno"> 4245</span>&#160; </div>
+<div class="line"><a name="l04246"></a><span class="lineno"> 4246</span>&#160;<span class="comment">// Division with mathematical rounding to nearest number.</span></div>
+<div class="line"><a name="l04247"></a><span class="lineno"> 4247</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l04248"></a><span class="lineno"> 4248</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> T VmaRoundDiv(T x, T y)</div>
+<div class="line"><a name="l04249"></a><span class="lineno"> 4249</span>&#160;{</div>
+<div class="line"><a name="l04250"></a><span class="lineno"> 4250</span>&#160;    <span class="keywordflow">return</span> (x + (y / (T)2)) / y;</div>
+<div class="line"><a name="l04251"></a><span class="lineno"> 4251</span>&#160;}</div>
+<div class="line"><a name="l04252"></a><span class="lineno"> 4252</span>&#160; </div>
+<div class="line"><a name="l04253"></a><span class="lineno"> 4253</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l04254"></a><span class="lineno"> 4254</span>&#160;<span class="comment">Returns true if given number is a power of two.</span></div>
+<div class="line"><a name="l04255"></a><span class="lineno"> 4255</span>&#160;<span class="comment">T must be unsigned integer number or signed integer but always nonnegative.</span></div>
+<div class="line"><a name="l04256"></a><span class="lineno"> 4256</span>&#160;<span class="comment">For 0 returns true.</span></div>
+<div class="line"><a name="l04257"></a><span class="lineno"> 4257</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l04258"></a><span class="lineno"> 4258</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l04259"></a><span class="lineno"> 4259</span>&#160;<span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaIsPow2(T x)</div>
+<div class="line"><a name="l04260"></a><span class="lineno"> 4260</span>&#160;{</div>
+<div class="line"><a name="l04261"></a><span class="lineno"> 4261</span>&#160;    <span class="keywordflow">return</span> (x &amp; (x-1)) == 0;</div>
+<div class="line"><a name="l04262"></a><span class="lineno"> 4262</span>&#160;}</div>
+<div class="line"><a name="l04263"></a><span class="lineno"> 4263</span>&#160; </div>
+<div class="line"><a name="l04264"></a><span class="lineno"> 4264</span>&#160;<span class="comment">// Returns smallest power of 2 greater or equal to v.</span></div>
+<div class="line"><a name="l04265"></a><span class="lineno"> 4265</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint32_t VmaNextPow2(uint32_t v)</div>
+<div class="line"><a name="l04266"></a><span class="lineno"> 4266</span>&#160;{</div>
+<div class="line"><a name="l04267"></a><span class="lineno"> 4267</span>&#160;    v--;</div>
+<div class="line"><a name="l04268"></a><span class="lineno"> 4268</span>&#160;    v |= v &gt;&gt; 1;</div>
+<div class="line"><a name="l04269"></a><span class="lineno"> 4269</span>&#160;    v |= v &gt;&gt; 2;</div>
+<div class="line"><a name="l04270"></a><span class="lineno"> 4270</span>&#160;    v |= v &gt;&gt; 4;</div>
+<div class="line"><a name="l04271"></a><span class="lineno"> 4271</span>&#160;    v |= v &gt;&gt; 8;</div>
+<div class="line"><a name="l04272"></a><span class="lineno"> 4272</span>&#160;    v |= v &gt;&gt; 16;</div>
+<div class="line"><a name="l04273"></a><span class="lineno"> 4273</span>&#160;    v++;</div>
+<div class="line"><a name="l04274"></a><span class="lineno"> 4274</span>&#160;    <span class="keywordflow">return</span> v;</div>
+<div class="line"><a name="l04275"></a><span class="lineno"> 4275</span>&#160;}</div>
+<div class="line"><a name="l04276"></a><span class="lineno"> 4276</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint64_t VmaNextPow2(uint64_t v)</div>
+<div class="line"><a name="l04277"></a><span class="lineno"> 4277</span>&#160;{</div>
+<div class="line"><a name="l04278"></a><span class="lineno"> 4278</span>&#160;    v--;</div>
+<div class="line"><a name="l04279"></a><span class="lineno"> 4279</span>&#160;    v |= v &gt;&gt; 1;</div>
+<div class="line"><a name="l04280"></a><span class="lineno"> 4280</span>&#160;    v |= v &gt;&gt; 2;</div>
+<div class="line"><a name="l04281"></a><span class="lineno"> 4281</span>&#160;    v |= v &gt;&gt; 4;</div>
+<div class="line"><a name="l04282"></a><span class="lineno"> 4282</span>&#160;    v |= v &gt;&gt; 8;</div>
+<div class="line"><a name="l04283"></a><span class="lineno"> 4283</span>&#160;    v |= v &gt;&gt; 16;</div>
+<div class="line"><a name="l04284"></a><span class="lineno"> 4284</span>&#160;    v |= v &gt;&gt; 32;</div>
+<div class="line"><a name="l04285"></a><span class="lineno"> 4285</span>&#160;    v++;</div>
+<div class="line"><a name="l04286"></a><span class="lineno"> 4286</span>&#160;    <span class="keywordflow">return</span> v;</div>
+<div class="line"><a name="l04287"></a><span class="lineno"> 4287</span>&#160;}</div>
+<div class="line"><a name="l04288"></a><span class="lineno"> 4288</span>&#160; </div>
+<div class="line"><a name="l04289"></a><span class="lineno"> 4289</span>&#160;<span class="comment">// Returns largest power of 2 less or equal to v.</span></div>
+<div class="line"><a name="l04290"></a><span class="lineno"> 4290</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint32_t VmaPrevPow2(uint32_t v)</div>
+<div class="line"><a name="l04291"></a><span class="lineno"> 4291</span>&#160;{</div>
+<div class="line"><a name="l04292"></a><span class="lineno"> 4292</span>&#160;    v |= v &gt;&gt; 1;</div>
+<div class="line"><a name="l04293"></a><span class="lineno"> 4293</span>&#160;    v |= v &gt;&gt; 2;</div>
+<div class="line"><a name="l04294"></a><span class="lineno"> 4294</span>&#160;    v |= v &gt;&gt; 4;</div>
+<div class="line"><a name="l04295"></a><span class="lineno"> 4295</span>&#160;    v |= v &gt;&gt; 8;</div>
+<div class="line"><a name="l04296"></a><span class="lineno"> 4296</span>&#160;    v |= v &gt;&gt; 16;</div>
+<div class="line"><a name="l04297"></a><span class="lineno"> 4297</span>&#160;    v = v ^ (v &gt;&gt; 1);</div>
+<div class="line"><a name="l04298"></a><span class="lineno"> 4298</span>&#160;    <span class="keywordflow">return</span> v;</div>
+<div class="line"><a name="l04299"></a><span class="lineno"> 4299</span>&#160;}</div>
+<div class="line"><a name="l04300"></a><span class="lineno"> 4300</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint64_t VmaPrevPow2(uint64_t v)</div>
+<div class="line"><a name="l04301"></a><span class="lineno"> 4301</span>&#160;{</div>
+<div class="line"><a name="l04302"></a><span class="lineno"> 4302</span>&#160;    v |= v &gt;&gt; 1;</div>
+<div class="line"><a name="l04303"></a><span class="lineno"> 4303</span>&#160;    v |= v &gt;&gt; 2;</div>
+<div class="line"><a name="l04304"></a><span class="lineno"> 4304</span>&#160;    v |= v &gt;&gt; 4;</div>
+<div class="line"><a name="l04305"></a><span class="lineno"> 4305</span>&#160;    v |= v &gt;&gt; 8;</div>
+<div class="line"><a name="l04306"></a><span class="lineno"> 4306</span>&#160;    v |= v &gt;&gt; 16;</div>
+<div class="line"><a name="l04307"></a><span class="lineno"> 4307</span>&#160;    v |= v &gt;&gt; 32;</div>
+<div class="line"><a name="l04308"></a><span class="lineno"> 4308</span>&#160;    v = v ^ (v &gt;&gt; 1);</div>
+<div class="line"><a name="l04309"></a><span class="lineno"> 4309</span>&#160;    <span class="keywordflow">return</span> v;</div>
+<div class="line"><a name="l04310"></a><span class="lineno"> 4310</span>&#160;}</div>
+<div class="line"><a name="l04311"></a><span class="lineno"> 4311</span>&#160; </div>
+<div class="line"><a name="l04312"></a><span class="lineno"> 4312</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaStrIsEmpty(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
+<div class="line"><a name="l04313"></a><span class="lineno"> 4313</span>&#160;{</div>
+<div class="line"><a name="l04314"></a><span class="lineno"> 4314</span>&#160;    <span class="keywordflow">return</span> pStr == VMA_NULL || *pStr == <span class="charliteral">&#39;\0&#39;</span>;</div>
+<div class="line"><a name="l04315"></a><span class="lineno"> 4315</span>&#160;}</div>
+<div class="line"><a name="l04316"></a><span class="lineno"> 4316</span>&#160; </div>
+<div class="line"><a name="l04317"></a><span class="lineno"> 4317</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l04318"></a><span class="lineno"> 4318</span>&#160; </div>
+<div class="line"><a name="l04319"></a><span class="lineno"> 4319</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* VmaAlgorithmToStr(uint32_t algorithm)</div>
+<div class="line"><a name="l04320"></a><span class="lineno"> 4320</span>&#160;{</div>
+<div class="line"><a name="l04321"></a><span class="lineno"> 4321</span>&#160;    <span class="keywordflow">switch</span>(algorithm)</div>
+<div class="line"><a name="l04322"></a><span class="lineno"> 4322</span>&#160;    {</div>
+<div class="line"><a name="l04323"></a><span class="lineno"> 4323</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>:</div>
+<div class="line"><a name="l04324"></a><span class="lineno"> 4324</span>&#160;        <span class="keywordflow">return</span> <span class="stringliteral">&quot;Linear&quot;</span>;</div>
+<div class="line"><a name="l04325"></a><span class="lineno"> 4325</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a>:</div>
+<div class="line"><a name="l04326"></a><span class="lineno"> 4326</span>&#160;        <span class="keywordflow">return</span> <span class="stringliteral">&quot;Buddy&quot;</span>;</div>
+<div class="line"><a name="l04327"></a><span class="lineno"> 4327</span>&#160;    <span class="keywordflow">case</span> 0:</div>
+<div class="line"><a name="l04328"></a><span class="lineno"> 4328</span>&#160;        <span class="keywordflow">return</span> <span class="stringliteral">&quot;Default&quot;</span>;</div>
+<div class="line"><a name="l04329"></a><span class="lineno"> 4329</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l04330"></a><span class="lineno"> 4330</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l04331"></a><span class="lineno"> 4331</span>&#160;        <span class="keywordflow">return</span> <span class="stringliteral">&quot;&quot;</span>;</div>
+<div class="line"><a name="l04332"></a><span class="lineno"> 4332</span>&#160;    }</div>
+<div class="line"><a name="l04333"></a><span class="lineno"> 4333</span>&#160;}</div>
+<div class="line"><a name="l04334"></a><span class="lineno"> 4334</span>&#160; </div>
+<div class="line"><a name="l04335"></a><span class="lineno"> 4335</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l04336"></a><span class="lineno"> 4336</span>&#160; </div>
+<div class="line"><a name="l04337"></a><span class="lineno"> 4337</span>&#160;<span class="preprocessor">#ifndef VMA_SORT</span></div>
+<div class="line"><a name="l04338"></a><span class="lineno"> 4338</span>&#160; </div>
+<div class="line"><a name="l04339"></a><span class="lineno"> 4339</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> Iterator, <span class="keyword">typename</span> Compare&gt;</div>
+<div class="line"><a name="l04340"></a><span class="lineno"> 4340</span>&#160;Iterator VmaQuickSortPartition(Iterator beg, Iterator end, Compare cmp)</div>
+<div class="line"><a name="l04341"></a><span class="lineno"> 4341</span>&#160;{</div>
+<div class="line"><a name="l04342"></a><span class="lineno"> 4342</span>&#160;    Iterator centerValue = end; --centerValue;</div>
+<div class="line"><a name="l04343"></a><span class="lineno"> 4343</span>&#160;    Iterator insertIndex = beg;</div>
+<div class="line"><a name="l04344"></a><span class="lineno"> 4344</span>&#160;    <span class="keywordflow">for</span>(Iterator memTypeIndex = beg; memTypeIndex &lt; centerValue; ++memTypeIndex)</div>
+<div class="line"><a name="l04345"></a><span class="lineno"> 4345</span>&#160;    {</div>
+<div class="line"><a name="l04346"></a><span class="lineno"> 4346</span>&#160;        <span class="keywordflow">if</span>(cmp(*memTypeIndex, *centerValue))</div>
+<div class="line"><a name="l04347"></a><span class="lineno"> 4347</span>&#160;        {</div>
+<div class="line"><a name="l04348"></a><span class="lineno"> 4348</span>&#160;            <span class="keywordflow">if</span>(insertIndex != memTypeIndex)</div>
+<div class="line"><a name="l04349"></a><span class="lineno"> 4349</span>&#160;            {</div>
+<div class="line"><a name="l04350"></a><span class="lineno"> 4350</span>&#160;                VMA_SWAP(*memTypeIndex, *insertIndex);</div>
+<div class="line"><a name="l04351"></a><span class="lineno"> 4351</span>&#160;            }</div>
+<div class="line"><a name="l04352"></a><span class="lineno"> 4352</span>&#160;            ++insertIndex;</div>
+<div class="line"><a name="l04353"></a><span class="lineno"> 4353</span>&#160;        }</div>
+<div class="line"><a name="l04354"></a><span class="lineno"> 4354</span>&#160;    }</div>
+<div class="line"><a name="l04355"></a><span class="lineno"> 4355</span>&#160;    <span class="keywordflow">if</span>(insertIndex != centerValue)</div>
+<div class="line"><a name="l04356"></a><span class="lineno"> 4356</span>&#160;    {</div>
+<div class="line"><a name="l04357"></a><span class="lineno"> 4357</span>&#160;        VMA_SWAP(*insertIndex, *centerValue);</div>
+<div class="line"><a name="l04358"></a><span class="lineno"> 4358</span>&#160;    }</div>
+<div class="line"><a name="l04359"></a><span class="lineno"> 4359</span>&#160;    <span class="keywordflow">return</span> insertIndex;</div>
+<div class="line"><a name="l04360"></a><span class="lineno"> 4360</span>&#160;}</div>
+<div class="line"><a name="l04361"></a><span class="lineno"> 4361</span>&#160; </div>
+<div class="line"><a name="l04362"></a><span class="lineno"> 4362</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> Iterator, <span class="keyword">typename</span> Compare&gt;</div>
+<div class="line"><a name="l04363"></a><span class="lineno"> 4363</span>&#160;<span class="keywordtype">void</span> VmaQuickSort(Iterator beg, Iterator end, Compare cmp)</div>
+<div class="line"><a name="l04364"></a><span class="lineno"> 4364</span>&#160;{</div>
+<div class="line"><a name="l04365"></a><span class="lineno"> 4365</span>&#160;    <span class="keywordflow">if</span>(beg &lt; end)</div>
+<div class="line"><a name="l04366"></a><span class="lineno"> 4366</span>&#160;    {</div>
+<div class="line"><a name="l04367"></a><span class="lineno"> 4367</span>&#160;        Iterator it = VmaQuickSortPartition&lt;Iterator, Compare&gt;(beg, end, cmp);</div>
+<div class="line"><a name="l04368"></a><span class="lineno"> 4368</span>&#160;        VmaQuickSort&lt;Iterator, Compare&gt;(beg, it, cmp);</div>
+<div class="line"><a name="l04369"></a><span class="lineno"> 4369</span>&#160;        VmaQuickSort&lt;Iterator, Compare&gt;(it + 1, end, cmp);</div>
+<div class="line"><a name="l04370"></a><span class="lineno"> 4370</span>&#160;    }</div>
+<div class="line"><a name="l04371"></a><span class="lineno"> 4371</span>&#160;}</div>
+<div class="line"><a name="l04372"></a><span class="lineno"> 4372</span>&#160; </div>
+<div class="line"><a name="l04373"></a><span class="lineno"> 4373</span>&#160;<span class="preprocessor">#define VMA_SORT(beg, end, cmp) VmaQuickSort(beg, end, cmp)</span></div>
+<div class="line"><a name="l04374"></a><span class="lineno"> 4374</span>&#160; </div>
+<div class="line"><a name="l04375"></a><span class="lineno"> 4375</span>&#160;<span class="preprocessor">#endif // #ifndef VMA_SORT</span></div>
+<div class="line"><a name="l04376"></a><span class="lineno"> 4376</span>&#160; </div>
+<div class="line"><a name="l04377"></a><span class="lineno"> 4377</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l04378"></a><span class="lineno"> 4378</span>&#160;<span class="comment">Returns true if two memory blocks occupy overlapping pages.</span></div>
+<div class="line"><a name="l04379"></a><span class="lineno"> 4379</span>&#160;<span class="comment">ResourceA must be in less memory offset than ResourceB.</span></div>
+<div class="line"><a name="l04380"></a><span class="lineno"> 4380</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l04381"></a><span class="lineno"> 4381</span>&#160;<span class="comment">Algorithm is based on &quot;Vulkan 1.0.39 - A Specification (with all registered Vulkan extensions)&quot;</span></div>
+<div class="line"><a name="l04382"></a><span class="lineno"> 4382</span>&#160;<span class="comment">chapter 11.6 &quot;Resource Memory Association&quot;, paragraph &quot;Buffer-Image Granularity&quot;.</span></div>
+<div class="line"><a name="l04383"></a><span class="lineno"> 4383</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l04384"></a><span class="lineno"> 4384</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaBlocksOnSamePage(</div>
+<div class="line"><a name="l04385"></a><span class="lineno"> 4385</span>&#160;    VkDeviceSize resourceAOffset,</div>
+<div class="line"><a name="l04386"></a><span class="lineno"> 4386</span>&#160;    VkDeviceSize resourceASize,</div>
+<div class="line"><a name="l04387"></a><span class="lineno"> 4387</span>&#160;    VkDeviceSize resourceBOffset,</div>
+<div class="line"><a name="l04388"></a><span class="lineno"> 4388</span>&#160;    VkDeviceSize pageSize)</div>
+<div class="line"><a name="l04389"></a><span class="lineno"> 4389</span>&#160;{</div>
+<div class="line"><a name="l04390"></a><span class="lineno"> 4390</span>&#160;    VMA_ASSERT(resourceAOffset + resourceASize &lt;= resourceBOffset &amp;&amp; resourceASize &gt; 0 &amp;&amp; pageSize &gt; 0);</div>
+<div class="line"><a name="l04391"></a><span class="lineno"> 4391</span>&#160;    VkDeviceSize resourceAEnd = resourceAOffset + resourceASize - 1;</div>
+<div class="line"><a name="l04392"></a><span class="lineno"> 4392</span>&#160;    VkDeviceSize resourceAEndPage = resourceAEnd &amp; ~(pageSize - 1);</div>
+<div class="line"><a name="l04393"></a><span class="lineno"> 4393</span>&#160;    VkDeviceSize resourceBStart = resourceBOffset;</div>
+<div class="line"><a name="l04394"></a><span class="lineno"> 4394</span>&#160;    VkDeviceSize resourceBStartPage = resourceBStart &amp; ~(pageSize - 1);</div>
+<div class="line"><a name="l04395"></a><span class="lineno"> 4395</span>&#160;    <span class="keywordflow">return</span> resourceAEndPage == resourceBStartPage;</div>
+<div class="line"><a name="l04396"></a><span class="lineno"> 4396</span>&#160;}</div>
+<div class="line"><a name="l04397"></a><span class="lineno"> 4397</span>&#160; </div>
+<div class="line"><a name="l04398"></a><span class="lineno"> 4398</span>&#160;<span class="keyword">enum</span> VmaSuballocationType</div>
+<div class="line"><a name="l04399"></a><span class="lineno"> 4399</span>&#160;{</div>
+<div class="line"><a name="l04400"></a><span class="lineno"> 4400</span>&#160;    VMA_SUBALLOCATION_TYPE_FREE = 0,</div>
+<div class="line"><a name="l04401"></a><span class="lineno"> 4401</span>&#160;    VMA_SUBALLOCATION_TYPE_UNKNOWN = 1,</div>
+<div class="line"><a name="l04402"></a><span class="lineno"> 4402</span>&#160;    VMA_SUBALLOCATION_TYPE_BUFFER = 2,</div>
+<div class="line"><a name="l04403"></a><span class="lineno"> 4403</span>&#160;    VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN = 3,</div>
+<div class="line"><a name="l04404"></a><span class="lineno"> 4404</span>&#160;    VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR = 4,</div>
+<div class="line"><a name="l04405"></a><span class="lineno"> 4405</span>&#160;    VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL = 5,</div>
+<div class="line"><a name="l04406"></a><span class="lineno"> 4406</span>&#160;    VMA_SUBALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF</div>
+<div class="line"><a name="l04407"></a><span class="lineno"> 4407</span>&#160;};</div>
+<div class="line"><a name="l04408"></a><span class="lineno"> 4408</span>&#160; </div>
+<div class="line"><a name="l04409"></a><span class="lineno"> 4409</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l04410"></a><span class="lineno"> 4410</span>&#160;<span class="comment">Returns true if given suballocation types could conflict and must respect</span></div>
+<div class="line"><a name="l04411"></a><span class="lineno"> 4411</span>&#160;<span class="comment">VkPhysicalDeviceLimits::bufferImageGranularity. They conflict if one is buffer</span></div>
+<div class="line"><a name="l04412"></a><span class="lineno"> 4412</span>&#160;<span class="comment">or linear image and another one is optimal image. If type is unknown, behave</span></div>
+<div class="line"><a name="l04413"></a><span class="lineno"> 4413</span>&#160;<span class="comment">conservatively.</span></div>
+<div class="line"><a name="l04414"></a><span class="lineno"> 4414</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l04415"></a><span class="lineno"> 4415</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaIsBufferImageGranularityConflict(</div>
+<div class="line"><a name="l04416"></a><span class="lineno"> 4416</span>&#160;    VmaSuballocationType suballocType1,</div>
+<div class="line"><a name="l04417"></a><span class="lineno"> 4417</span>&#160;    VmaSuballocationType suballocType2)</div>
+<div class="line"><a name="l04418"></a><span class="lineno"> 4418</span>&#160;{</div>
+<div class="line"><a name="l04419"></a><span class="lineno"> 4419</span>&#160;    <span class="keywordflow">if</span>(suballocType1 &gt; suballocType2)</div>
+<div class="line"><a name="l04420"></a><span class="lineno"> 4420</span>&#160;    {</div>
+<div class="line"><a name="l04421"></a><span class="lineno"> 4421</span>&#160;        VMA_SWAP(suballocType1, suballocType2);</div>
+<div class="line"><a name="l04422"></a><span class="lineno"> 4422</span>&#160;    }</div>
+<div class="line"><a name="l04423"></a><span class="lineno"> 4423</span>&#160;    </div>
+<div class="line"><a name="l04424"></a><span class="lineno"> 4424</span>&#160;    <span class="keywordflow">switch</span>(suballocType1)</div>
+<div class="line"><a name="l04425"></a><span class="lineno"> 4425</span>&#160;    {</div>
+<div class="line"><a name="l04426"></a><span class="lineno"> 4426</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_FREE:</div>
+<div class="line"><a name="l04427"></a><span class="lineno"> 4427</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l04428"></a><span class="lineno"> 4428</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_UNKNOWN:</div>
+<div class="line"><a name="l04429"></a><span class="lineno"> 4429</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l04430"></a><span class="lineno"> 4430</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_BUFFER:</div>
+<div class="line"><a name="l04431"></a><span class="lineno"> 4431</span>&#160;        <span class="keywordflow">return</span></div>
+<div class="line"><a name="l04432"></a><span class="lineno"> 4432</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||</div>
+<div class="line"><a name="l04433"></a><span class="lineno"> 4433</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;</div>
+<div class="line"><a name="l04434"></a><span class="lineno"> 4434</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN:</div>
+<div class="line"><a name="l04435"></a><span class="lineno"> 4435</span>&#160;        <span class="keywordflow">return</span></div>
+<div class="line"><a name="l04436"></a><span class="lineno"> 4436</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||</div>
+<div class="line"><a name="l04437"></a><span class="lineno"> 4437</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR ||</div>
+<div class="line"><a name="l04438"></a><span class="lineno"> 4438</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;</div>
+<div class="line"><a name="l04439"></a><span class="lineno"> 4439</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR:</div>
+<div class="line"><a name="l04440"></a><span class="lineno"> 4440</span>&#160;        <span class="keywordflow">return</span></div>
+<div class="line"><a name="l04441"></a><span class="lineno"> 4441</span>&#160;            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;</div>
+<div class="line"><a name="l04442"></a><span class="lineno"> 4442</span>&#160;    <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL:</div>
+<div class="line"><a name="l04443"></a><span class="lineno"> 4443</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l04444"></a><span class="lineno"> 4444</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l04445"></a><span class="lineno"> 4445</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l04446"></a><span class="lineno"> 4446</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l04447"></a><span class="lineno"> 4447</span>&#160;    }</div>
+<div class="line"><a name="l04448"></a><span class="lineno"> 4448</span>&#160;}</div>
+<div class="line"><a name="l04449"></a><span class="lineno"> 4449</span>&#160; </div>
+<div class="line"><a name="l04450"></a><span class="lineno"> 4450</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaWriteMagicValue(<span class="keywordtype">void</span>* pData, VkDeviceSize offset)</div>
+<div class="line"><a name="l04451"></a><span class="lineno"> 4451</span>&#160;{</div>
+<div class="line"><a name="l04452"></a><span class="lineno"> 4452</span>&#160;<span class="preprocessor">#if VMA_DEBUG_MARGIN &gt; 0 &amp;&amp; VMA_DEBUG_DETECT_CORRUPTION</span></div>
+<div class="line"><a name="l04453"></a><span class="lineno"> 4453</span>&#160;    uint32_t* pDst = (uint32_t*)((<span class="keywordtype">char</span>*)pData + offset);</div>
+<div class="line"><a name="l04454"></a><span class="lineno"> 4454</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> numberCount = VMA_DEBUG_MARGIN / <span class="keyword">sizeof</span>(uint32_t);</div>
+<div class="line"><a name="l04455"></a><span class="lineno"> 4455</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; numberCount; ++i, ++pDst)</div>
+<div class="line"><a name="l04456"></a><span class="lineno"> 4456</span>&#160;    {</div>
+<div class="line"><a name="l04457"></a><span class="lineno"> 4457</span>&#160;        *pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;</div>
+<div class="line"><a name="l04458"></a><span class="lineno"> 4458</span>&#160;    }</div>
+<div class="line"><a name="l04459"></a><span class="lineno"> 4459</span>&#160;<span class="preprocessor">#else</span></div>
+<div class="line"><a name="l04460"></a><span class="lineno"> 4460</span>&#160;    <span class="comment">// no-op</span></div>
+<div class="line"><a name="l04461"></a><span class="lineno"> 4461</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04462"></a><span class="lineno"> 4462</span>&#160;}</div>
+<div class="line"><a name="l04463"></a><span class="lineno"> 4463</span>&#160; </div>
+<div class="line"><a name="l04464"></a><span class="lineno"> 4464</span>&#160;<span class="keyword">static</span> <span class="keywordtype">bool</span> VmaValidateMagicValue(<span class="keyword">const</span> <span class="keywordtype">void</span>* pData, VkDeviceSize offset)</div>
+<div class="line"><a name="l04465"></a><span class="lineno"> 4465</span>&#160;{</div>
+<div class="line"><a name="l04466"></a><span class="lineno"> 4466</span>&#160;<span class="preprocessor">#if VMA_DEBUG_MARGIN &gt; 0 &amp;&amp; VMA_DEBUG_DETECT_CORRUPTION</span></div>
+<div class="line"><a name="l04467"></a><span class="lineno"> 4467</span>&#160;    <span class="keyword">const</span> uint32_t* pSrc = (<span class="keyword">const</span> uint32_t*)((<span class="keyword">const</span> <span class="keywordtype">char</span>*)pData + offset);</div>
+<div class="line"><a name="l04468"></a><span class="lineno"> 4468</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> numberCount = VMA_DEBUG_MARGIN / <span class="keyword">sizeof</span>(uint32_t);</div>
+<div class="line"><a name="l04469"></a><span class="lineno"> 4469</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; numberCount; ++i, ++pSrc)</div>
+<div class="line"><a name="l04470"></a><span class="lineno"> 4470</span>&#160;    {</div>
+<div class="line"><a name="l04471"></a><span class="lineno"> 4471</span>&#160;        <span class="keywordflow">if</span>(*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE)</div>
+<div class="line"><a name="l04472"></a><span class="lineno"> 4472</span>&#160;        {</div>
+<div class="line"><a name="l04473"></a><span class="lineno"> 4473</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l04474"></a><span class="lineno"> 4474</span>&#160;        }</div>
+<div class="line"><a name="l04475"></a><span class="lineno"> 4475</span>&#160;    }</div>
+<div class="line"><a name="l04476"></a><span class="lineno"> 4476</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04477"></a><span class="lineno"> 4477</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l04478"></a><span class="lineno"> 4478</span>&#160;}</div>
+<div class="line"><a name="l04479"></a><span class="lineno"> 4479</span>&#160; </div>
+<div class="line"><a name="l04480"></a><span class="lineno"> 4480</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l04481"></a><span class="lineno"> 4481</span>&#160;<span class="comment">Fills structure with parameters of an example buffer to be used for transfers</span></div>
+<div class="line"><a name="l04482"></a><span class="lineno"> 4482</span>&#160;<span class="comment">during GPU memory defragmentation.</span></div>
+<div class="line"><a name="l04483"></a><span class="lineno"> 4483</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l04484"></a><span class="lineno"> 4484</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFillGpuDefragmentationBufferCreateInfo(VkBufferCreateInfo&amp; outBufCreateInfo)</div>
+<div class="line"><a name="l04485"></a><span class="lineno"> 4485</span>&#160;{</div>
+<div class="line"><a name="l04486"></a><span class="lineno"> 4486</span>&#160;    memset(&amp;outBufCreateInfo, 0, <span class="keyword">sizeof</span>(outBufCreateInfo));</div>
+<div class="line"><a name="l04487"></a><span class="lineno"> 4487</span>&#160;    outBufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;</div>
+<div class="line"><a name="l04488"></a><span class="lineno"> 4488</span>&#160;    outBufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;</div>
+<div class="line"><a name="l04489"></a><span class="lineno"> 4489</span>&#160;    outBufCreateInfo.size = (VkDeviceSize)VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE; <span class="comment">// Example size.</span></div>
+<div class="line"><a name="l04490"></a><span class="lineno"> 4490</span>&#160;}</div>
+<div class="line"><a name="l04491"></a><span class="lineno"> 4491</span>&#160; </div>
+<div class="line"><a name="l04492"></a><span class="lineno"> 4492</span>&#160;<span class="comment">// Helper RAII class to lock a mutex in constructor and unlock it in destructor (at the end of scope).</span></div>
+<div class="line"><a name="l04493"></a><span class="lineno"> 4493</span>&#160;<span class="keyword">struct </span>VmaMutexLock</div>
+<div class="line"><a name="l04494"></a><span class="lineno"> 4494</span>&#160;{</div>
+<div class="line"><a name="l04495"></a><span class="lineno"> 4495</span>&#160;    VMA_CLASS_NO_COPY(VmaMutexLock)</div>
+<div class="line"><a name="l04496"></a><span class="lineno"> 4496</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l04497"></a><span class="lineno"> 4497</span>&#160;    VmaMutexLock(VMA_MUTEX&amp; mutex, <span class="keywordtype">bool</span> useMutex = <span class="keyword">true</span>) :</div>
+<div class="line"><a name="l04498"></a><span class="lineno"> 4498</span>&#160;        m_pMutex(useMutex ? &amp;mutex : VMA_NULL)</div>
+<div class="line"><a name="l04499"></a><span class="lineno"> 4499</span>&#160;    { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;Lock(); } }</div>
+<div class="line"><a name="l04500"></a><span class="lineno"> 4500</span>&#160;    ~VmaMutexLock()</div>
+<div class="line"><a name="l04501"></a><span class="lineno"> 4501</span>&#160;    { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;Unlock(); } }</div>
+<div class="line"><a name="l04502"></a><span class="lineno"> 4502</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l04503"></a><span class="lineno"> 4503</span>&#160;    VMA_MUTEX* m_pMutex;</div>
+<div class="line"><a name="l04504"></a><span class="lineno"> 4504</span>&#160;};</div>
+<div class="line"><a name="l04505"></a><span class="lineno"> 4505</span>&#160; </div>
+<div class="line"><a name="l04506"></a><span class="lineno"> 4506</span>&#160;<span class="comment">// Helper RAII class to lock a RW mutex in constructor and unlock it in destructor (at the end of scope), for reading.</span></div>
+<div class="line"><a name="l04507"></a><span class="lineno"> 4507</span>&#160;<span class="keyword">struct </span>VmaMutexLockRead</div>
+<div class="line"><a name="l04508"></a><span class="lineno"> 4508</span>&#160;{</div>
+<div class="line"><a name="l04509"></a><span class="lineno"> 4509</span>&#160;    VMA_CLASS_NO_COPY(VmaMutexLockRead)</div>
+<div class="line"><a name="l04510"></a><span class="lineno"> 4510</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l04511"></a><span class="lineno"> 4511</span>&#160;    VmaMutexLockRead(VMA_RW_MUTEX&amp; mutex, <span class="keywordtype">bool</span> useMutex) :</div>
+<div class="line"><a name="l04512"></a><span class="lineno"> 4512</span>&#160;        m_pMutex(useMutex ? &amp;mutex : VMA_NULL)</div>
+<div class="line"><a name="l04513"></a><span class="lineno"> 4513</span>&#160;    { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;LockRead(); } }</div>
+<div class="line"><a name="l04514"></a><span class="lineno"> 4514</span>&#160;    ~VmaMutexLockRead() { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;UnlockRead(); } }</div>
+<div class="line"><a name="l04515"></a><span class="lineno"> 4515</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l04516"></a><span class="lineno"> 4516</span>&#160;    VMA_RW_MUTEX* m_pMutex;</div>
+<div class="line"><a name="l04517"></a><span class="lineno"> 4517</span>&#160;};</div>
+<div class="line"><a name="l04518"></a><span class="lineno"> 4518</span>&#160; </div>
+<div class="line"><a name="l04519"></a><span class="lineno"> 4519</span>&#160;<span class="comment">// Helper RAII class to lock a RW mutex in constructor and unlock it in destructor (at the end of scope), for writing.</span></div>
+<div class="line"><a name="l04520"></a><span class="lineno"> 4520</span>&#160;<span class="keyword">struct </span>VmaMutexLockWrite</div>
+<div class="line"><a name="l04521"></a><span class="lineno"> 4521</span>&#160;{</div>
+<div class="line"><a name="l04522"></a><span class="lineno"> 4522</span>&#160;    VMA_CLASS_NO_COPY(VmaMutexLockWrite)</div>
+<div class="line"><a name="l04523"></a><span class="lineno"> 4523</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l04524"></a><span class="lineno"> 4524</span>&#160;    VmaMutexLockWrite(VMA_RW_MUTEX&amp; mutex, <span class="keywordtype">bool</span> useMutex) :</div>
+<div class="line"><a name="l04525"></a><span class="lineno"> 4525</span>&#160;        m_pMutex(useMutex ? &amp;mutex : VMA_NULL)</div>
+<div class="line"><a name="l04526"></a><span class="lineno"> 4526</span>&#160;    { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;LockWrite(); } }</div>
+<div class="line"><a name="l04527"></a><span class="lineno"> 4527</span>&#160;    ~VmaMutexLockWrite() { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;UnlockWrite(); } }</div>
+<div class="line"><a name="l04528"></a><span class="lineno"> 4528</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l04529"></a><span class="lineno"> 4529</span>&#160;    VMA_RW_MUTEX* m_pMutex;</div>
+<div class="line"><a name="l04530"></a><span class="lineno"> 4530</span>&#160;};</div>
+<div class="line"><a name="l04531"></a><span class="lineno"> 4531</span>&#160; </div>
+<div class="line"><a name="l04532"></a><span class="lineno"> 4532</span>&#160;<span class="preprocessor">#if VMA_DEBUG_GLOBAL_MUTEX</span></div>
+<div class="line"><a name="l04533"></a><span class="lineno"> 4533</span>&#160;    <span class="keyword">static</span> VMA_MUTEX gDebugGlobalMutex;</div>
+<div class="line"><a name="l04534"></a><span class="lineno"> 4534</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_GLOBAL_MUTEX_LOCK VmaMutexLock debugGlobalMutexLock(gDebugGlobalMutex, true);</span></div>
+<div class="line"><a name="l04535"></a><span class="lineno"> 4535</span>&#160;<span class="preprocessor">#else</span></div>
+<div class="line"><a name="l04536"></a><span class="lineno"> 4536</span>&#160;<span class="preprocessor">    #define VMA_DEBUG_GLOBAL_MUTEX_LOCK</span></div>
+<div class="line"><a name="l04537"></a><span class="lineno"> 4537</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l04538"></a><span class="lineno"> 4538</span>&#160; </div>
+<div class="line"><a name="l04539"></a><span class="lineno"> 4539</span>&#160;<span class="comment">// Minimum size of a free suballocation to register it in the free suballocation collection.</span></div>
+<div class="line"><a name="l04540"></a><span class="lineno"> 4540</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> VkDeviceSize VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER = 16;</div>
+<div class="line"><a name="l04541"></a><span class="lineno"> 4541</span>&#160; </div>
+<div class="line"><a name="l04542"></a><span class="lineno"> 4542</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l04543"></a><span class="lineno"> 4543</span>&#160;<span class="comment">Performs binary search and returns iterator to first element that is greater or</span></div>
+<div class="line"><a name="l04544"></a><span class="lineno"> 4544</span>&#160;<span class="comment">equal to (key), according to comparison (cmp).</span></div>
+<div class="line"><a name="l04545"></a><span class="lineno"> 4545</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l04546"></a><span class="lineno"> 4546</span>&#160;<span class="comment">Cmp should return true if first argument is less than second argument.</span></div>
+<div class="line"><a name="l04547"></a><span class="lineno"> 4547</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l04548"></a><span class="lineno"> 4548</span>&#160;<span class="comment">Returned value is the found element, if present in the collection or place where</span></div>
+<div class="line"><a name="l04549"></a><span class="lineno"> 4549</span>&#160;<span class="comment">new element with value (key) should be inserted.</span></div>
+<div class="line"><a name="l04550"></a><span class="lineno"> 4550</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l04551"></a><span class="lineno"> 4551</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> IterT, <span class="keyword">typename</span> KeyT&gt;</div>
+<div class="line"><a name="l04552"></a><span class="lineno"> 4552</span>&#160;<span class="keyword">static</span> IterT VmaBinaryFindFirstNotLess(IterT beg, IterT end, <span class="keyword">const</span> KeyT &amp;key, <span class="keyword">const</span> CmpLess&amp; cmp)</div>
+<div class="line"><a name="l04553"></a><span class="lineno"> 4553</span>&#160;{</div>
+<div class="line"><a name="l04554"></a><span class="lineno"> 4554</span>&#160;    <span class="keywordtype">size_t</span> down = 0, up = (end - beg);</div>
+<div class="line"><a name="l04555"></a><span class="lineno"> 4555</span>&#160;    <span class="keywordflow">while</span>(down &lt; up)</div>
+<div class="line"><a name="l04556"></a><span class="lineno"> 4556</span>&#160;    {</div>
+<div class="line"><a name="l04557"></a><span class="lineno"> 4557</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> mid = (down + up) / 2;</div>
+<div class="line"><a name="l04558"></a><span class="lineno"> 4558</span>&#160;        <span class="keywordflow">if</span>(cmp(*(beg+mid), key))</div>
+<div class="line"><a name="l04559"></a><span class="lineno"> 4559</span>&#160;        {</div>
+<div class="line"><a name="l04560"></a><span class="lineno"> 4560</span>&#160;            down = mid + 1;</div>
+<div class="line"><a name="l04561"></a><span class="lineno"> 4561</span>&#160;        }</div>
+<div class="line"><a name="l04562"></a><span class="lineno"> 4562</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l04563"></a><span class="lineno"> 4563</span>&#160;        {</div>
+<div class="line"><a name="l04564"></a><span class="lineno"> 4564</span>&#160;            up = mid;</div>
+<div class="line"><a name="l04565"></a><span class="lineno"> 4565</span>&#160;        }</div>
+<div class="line"><a name="l04566"></a><span class="lineno"> 4566</span>&#160;    }</div>
+<div class="line"><a name="l04567"></a><span class="lineno"> 4567</span>&#160;    <span class="keywordflow">return</span> beg + down;</div>
+<div class="line"><a name="l04568"></a><span class="lineno"> 4568</span>&#160;}</div>
 <div class="line"><a name="l04569"></a><span class="lineno"> 4569</span>&#160; </div>
-<div class="line"><a name="l04570"></a><span class="lineno"> 4570</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span>* VmaMalloc(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, <span class="keywordtype">size_t</span> size, <span class="keywordtype">size_t</span> alignment)</div>
-<div class="line"><a name="l04571"></a><span class="lineno"> 4571</span>&#160;{</div>
-<div class="line"><a name="l04572"></a><span class="lineno"> 4572</span>&#160;    <span class="keywordflow">if</span>((pAllocationCallbacks != VMA_NULL) &amp;&amp;</div>
-<div class="line"><a name="l04573"></a><span class="lineno"> 4573</span>&#160;        (pAllocationCallbacks-&gt;pfnAllocation != VMA_NULL))</div>
-<div class="line"><a name="l04574"></a><span class="lineno"> 4574</span>&#160;    {</div>
-<div class="line"><a name="l04575"></a><span class="lineno"> 4575</span>&#160;        <span class="keywordflow">return</span> (*pAllocationCallbacks-&gt;pfnAllocation)(</div>
-<div class="line"><a name="l04576"></a><span class="lineno"> 4576</span>&#160;            pAllocationCallbacks-&gt;pUserData,</div>
-<div class="line"><a name="l04577"></a><span class="lineno"> 4577</span>&#160;            size,</div>
-<div class="line"><a name="l04578"></a><span class="lineno"> 4578</span>&#160;            alignment,</div>
-<div class="line"><a name="l04579"></a><span class="lineno"> 4579</span>&#160;            VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);</div>
-<div class="line"><a name="l04580"></a><span class="lineno"> 4580</span>&#160;    }</div>
-<div class="line"><a name="l04581"></a><span class="lineno"> 4581</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l04582"></a><span class="lineno"> 4582</span>&#160;    {</div>
-<div class="line"><a name="l04583"></a><span class="lineno"> 4583</span>&#160;        <span class="keywordflow">return</span> VMA_SYSTEM_ALIGNED_MALLOC(size, alignment);</div>
-<div class="line"><a name="l04584"></a><span class="lineno"> 4584</span>&#160;    }</div>
-<div class="line"><a name="l04585"></a><span class="lineno"> 4585</span>&#160;}</div>
-<div class="line"><a name="l04586"></a><span class="lineno"> 4586</span>&#160; </div>
-<div class="line"><a name="l04587"></a><span class="lineno"> 4587</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFree(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, <span class="keywordtype">void</span>* ptr)</div>
-<div class="line"><a name="l04588"></a><span class="lineno"> 4588</span>&#160;{</div>
-<div class="line"><a name="l04589"></a><span class="lineno"> 4589</span>&#160;    <span class="keywordflow">if</span>((pAllocationCallbacks != VMA_NULL) &amp;&amp;</div>
-<div class="line"><a name="l04590"></a><span class="lineno"> 4590</span>&#160;        (pAllocationCallbacks-&gt;pfnFree != VMA_NULL))</div>
-<div class="line"><a name="l04591"></a><span class="lineno"> 4591</span>&#160;    {</div>
-<div class="line"><a name="l04592"></a><span class="lineno"> 4592</span>&#160;        (*pAllocationCallbacks-&gt;pfnFree)(pAllocationCallbacks-&gt;pUserData, ptr);</div>
-<div class="line"><a name="l04593"></a><span class="lineno"> 4593</span>&#160;    }</div>
-<div class="line"><a name="l04594"></a><span class="lineno"> 4594</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l04595"></a><span class="lineno"> 4595</span>&#160;    {</div>
-<div class="line"><a name="l04596"></a><span class="lineno"> 4596</span>&#160;        VMA_SYSTEM_FREE(ptr);</div>
-<div class="line"><a name="l04597"></a><span class="lineno"> 4597</span>&#160;    }</div>
-<div class="line"><a name="l04598"></a><span class="lineno"> 4598</span>&#160;}</div>
-<div class="line"><a name="l04599"></a><span class="lineno"> 4599</span>&#160; </div>
-<div class="line"><a name="l04600"></a><span class="lineno"> 4600</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l04601"></a><span class="lineno"> 4601</span>&#160;<span class="keyword">static</span> T* VmaAllocate(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks)</div>
-<div class="line"><a name="l04602"></a><span class="lineno"> 4602</span>&#160;{</div>
-<div class="line"><a name="l04603"></a><span class="lineno"> 4603</span>&#160;    <span class="keywordflow">return</span> (T*)VmaMalloc(pAllocationCallbacks, <span class="keyword">sizeof</span>(T), VMA_ALIGN_OF(T));</div>
-<div class="line"><a name="l04604"></a><span class="lineno"> 4604</span>&#160;}</div>
-<div class="line"><a name="l04605"></a><span class="lineno"> 4605</span>&#160; </div>
-<div class="line"><a name="l04606"></a><span class="lineno"> 4606</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l04607"></a><span class="lineno"> 4607</span>&#160;<span class="keyword">static</span> T* VmaAllocateArray(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, <span class="keywordtype">size_t</span> count)</div>
-<div class="line"><a name="l04608"></a><span class="lineno"> 4608</span>&#160;{</div>
-<div class="line"><a name="l04609"></a><span class="lineno"> 4609</span>&#160;    <span class="keywordflow">return</span> (T*)VmaMalloc(pAllocationCallbacks, <span class="keyword">sizeof</span>(T) * count, VMA_ALIGN_OF(T));</div>
-<div class="line"><a name="l04610"></a><span class="lineno"> 4610</span>&#160;}</div>
-<div class="line"><a name="l04611"></a><span class="lineno"> 4611</span>&#160; </div>
-<div class="line"><a name="l04612"></a><span class="lineno"> 4612</span>&#160;<span class="preprocessor">#define vma_new(allocator, type)   new(VmaAllocate&lt;type&gt;(allocator))(type)</span></div>
-<div class="line"><a name="l04613"></a><span class="lineno"> 4613</span>&#160; </div>
-<div class="line"><a name="l04614"></a><span class="lineno"> 4614</span>&#160;<span class="preprocessor">#define vma_new_array(allocator, type, count)   new(VmaAllocateArray&lt;type&gt;((allocator), (count)))(type)</span></div>
+<div class="line"><a name="l04570"></a><span class="lineno"> 4570</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> IterT, <span class="keyword">typename</span> KeyT&gt;</div>
+<div class="line"><a name="l04571"></a><span class="lineno"> 4571</span>&#160;IterT VmaBinaryFindSorted(<span class="keyword">const</span> IterT&amp; beg, <span class="keyword">const</span> IterT&amp; end, <span class="keyword">const</span> KeyT&amp; value, <span class="keyword">const</span> CmpLess&amp; cmp)</div>
+<div class="line"><a name="l04572"></a><span class="lineno"> 4572</span>&#160;{</div>
+<div class="line"><a name="l04573"></a><span class="lineno"> 4573</span>&#160;    IterT it = VmaBinaryFindFirstNotLess&lt;CmpLess, IterT, KeyT&gt;(</div>
+<div class="line"><a name="l04574"></a><span class="lineno"> 4574</span>&#160;        beg, end, value, cmp);</div>
+<div class="line"><a name="l04575"></a><span class="lineno"> 4575</span>&#160;    <span class="keywordflow">if</span>(it == end ||</div>
+<div class="line"><a name="l04576"></a><span class="lineno"> 4576</span>&#160;        (!cmp(*it, value) &amp;&amp; !cmp(value, *it)))</div>
+<div class="line"><a name="l04577"></a><span class="lineno"> 4577</span>&#160;    {</div>
+<div class="line"><a name="l04578"></a><span class="lineno"> 4578</span>&#160;        <span class="keywordflow">return</span> it;</div>
+<div class="line"><a name="l04579"></a><span class="lineno"> 4579</span>&#160;    }</div>
+<div class="line"><a name="l04580"></a><span class="lineno"> 4580</span>&#160;    <span class="keywordflow">return</span> end;</div>
+<div class="line"><a name="l04581"></a><span class="lineno"> 4581</span>&#160;}</div>
+<div class="line"><a name="l04582"></a><span class="lineno"> 4582</span>&#160; </div>
+<div class="line"><a name="l04583"></a><span class="lineno"> 4583</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l04584"></a><span class="lineno"> 4584</span>&#160;<span class="comment">Returns true if all pointers in the array are not-null and unique.</span></div>
+<div class="line"><a name="l04585"></a><span class="lineno"> 4585</span>&#160;<span class="comment">Warning! O(n^2) complexity. Use only inside VMA_HEAVY_ASSERT.</span></div>
+<div class="line"><a name="l04586"></a><span class="lineno"> 4586</span>&#160;<span class="comment">T must be pointer type, e.g. VmaAllocation, VmaPool.</span></div>
+<div class="line"><a name="l04587"></a><span class="lineno"> 4587</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l04588"></a><span class="lineno"> 4588</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l04589"></a><span class="lineno"> 4589</span>&#160;<span class="keyword">static</span> <span class="keywordtype">bool</span> VmaValidatePointerArray(uint32_t count, <span class="keyword">const</span> T* arr)</div>
+<div class="line"><a name="l04590"></a><span class="lineno"> 4590</span>&#160;{</div>
+<div class="line"><a name="l04591"></a><span class="lineno"> 4591</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; count; ++i)</div>
+<div class="line"><a name="l04592"></a><span class="lineno"> 4592</span>&#160;    {</div>
+<div class="line"><a name="l04593"></a><span class="lineno"> 4593</span>&#160;        <span class="keyword">const</span> T iPtr = arr[i];</div>
+<div class="line"><a name="l04594"></a><span class="lineno"> 4594</span>&#160;        <span class="keywordflow">if</span>(iPtr == VMA_NULL)</div>
+<div class="line"><a name="l04595"></a><span class="lineno"> 4595</span>&#160;        {</div>
+<div class="line"><a name="l04596"></a><span class="lineno"> 4596</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l04597"></a><span class="lineno"> 4597</span>&#160;        }</div>
+<div class="line"><a name="l04598"></a><span class="lineno"> 4598</span>&#160;        <span class="keywordflow">for</span>(uint32_t j = i + 1; j &lt; count; ++j)</div>
+<div class="line"><a name="l04599"></a><span class="lineno"> 4599</span>&#160;        {</div>
+<div class="line"><a name="l04600"></a><span class="lineno"> 4600</span>&#160;            <span class="keywordflow">if</span>(iPtr == arr[j])</div>
+<div class="line"><a name="l04601"></a><span class="lineno"> 4601</span>&#160;            {</div>
+<div class="line"><a name="l04602"></a><span class="lineno"> 4602</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l04603"></a><span class="lineno"> 4603</span>&#160;            }</div>
+<div class="line"><a name="l04604"></a><span class="lineno"> 4604</span>&#160;        }</div>
+<div class="line"><a name="l04605"></a><span class="lineno"> 4605</span>&#160;    }</div>
+<div class="line"><a name="l04606"></a><span class="lineno"> 4606</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l04607"></a><span class="lineno"> 4607</span>&#160;}</div>
+<div class="line"><a name="l04608"></a><span class="lineno"> 4608</span>&#160; </div>
+<div class="line"><a name="l04609"></a><span class="lineno"> 4609</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> MainT, <span class="keyword">typename</span> NewT&gt;</div>
+<div class="line"><a name="l04610"></a><span class="lineno"> 4610</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> VmaPnextChainPushFront(MainT* mainStruct, NewT* newStruct)</div>
+<div class="line"><a name="l04611"></a><span class="lineno"> 4611</span>&#160;{</div>
+<div class="line"><a name="l04612"></a><span class="lineno"> 4612</span>&#160;    newStruct-&gt;pNext = mainStruct-&gt;pNext;</div>
+<div class="line"><a name="l04613"></a><span class="lineno"> 4613</span>&#160;    mainStruct-&gt;pNext = newStruct;</div>
+<div class="line"><a name="l04614"></a><span class="lineno"> 4614</span>&#160;}</div>
 <div class="line"><a name="l04615"></a><span class="lineno"> 4615</span>&#160; </div>
-<div class="line"><a name="l04616"></a><span class="lineno"> 4616</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l04617"></a><span class="lineno"> 4617</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, T* ptr)</div>
-<div class="line"><a name="l04618"></a><span class="lineno"> 4618</span>&#160;{</div>
-<div class="line"><a name="l04619"></a><span class="lineno"> 4619</span>&#160;    ptr-&gt;~T();</div>
-<div class="line"><a name="l04620"></a><span class="lineno"> 4620</span>&#160;    VmaFree(pAllocationCallbacks, ptr);</div>
-<div class="line"><a name="l04621"></a><span class="lineno"> 4621</span>&#160;}</div>
-<div class="line"><a name="l04622"></a><span class="lineno"> 4622</span>&#160; </div>
-<div class="line"><a name="l04623"></a><span class="lineno"> 4623</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l04624"></a><span class="lineno"> 4624</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete_array(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, T* ptr, <span class="keywordtype">size_t</span> count)</div>
-<div class="line"><a name="l04625"></a><span class="lineno"> 4625</span>&#160;{</div>
-<div class="line"><a name="l04626"></a><span class="lineno"> 4626</span>&#160;    <span class="keywordflow">if</span>(ptr != VMA_NULL)</div>
-<div class="line"><a name="l04627"></a><span class="lineno"> 4627</span>&#160;    {</div>
-<div class="line"><a name="l04628"></a><span class="lineno"> 4628</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = count; i--; )</div>
-<div class="line"><a name="l04629"></a><span class="lineno"> 4629</span>&#160;        {</div>
-<div class="line"><a name="l04630"></a><span class="lineno"> 4630</span>&#160;            ptr[i].~T();</div>
-<div class="line"><a name="l04631"></a><span class="lineno"> 4631</span>&#160;        }</div>
-<div class="line"><a name="l04632"></a><span class="lineno"> 4632</span>&#160;        VmaFree(pAllocationCallbacks, ptr);</div>
+<div class="line"><a name="l04617"></a><span class="lineno"> 4617</span>&#160;<span class="comment">// Memory allocation</span></div>
+<div class="line"><a name="l04618"></a><span class="lineno"> 4618</span>&#160; </div>
+<div class="line"><a name="l04619"></a><span class="lineno"> 4619</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span>* VmaMalloc(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, <span class="keywordtype">size_t</span> size, <span class="keywordtype">size_t</span> alignment)</div>
+<div class="line"><a name="l04620"></a><span class="lineno"> 4620</span>&#160;{</div>
+<div class="line"><a name="l04621"></a><span class="lineno"> 4621</span>&#160;    <span class="keywordflow">if</span>((pAllocationCallbacks != VMA_NULL) &amp;&amp;</div>
+<div class="line"><a name="l04622"></a><span class="lineno"> 4622</span>&#160;        (pAllocationCallbacks-&gt;pfnAllocation != VMA_NULL))</div>
+<div class="line"><a name="l04623"></a><span class="lineno"> 4623</span>&#160;    {</div>
+<div class="line"><a name="l04624"></a><span class="lineno"> 4624</span>&#160;        <span class="keywordflow">return</span> (*pAllocationCallbacks-&gt;pfnAllocation)(</div>
+<div class="line"><a name="l04625"></a><span class="lineno"> 4625</span>&#160;            pAllocationCallbacks-&gt;pUserData,</div>
+<div class="line"><a name="l04626"></a><span class="lineno"> 4626</span>&#160;            size,</div>
+<div class="line"><a name="l04627"></a><span class="lineno"> 4627</span>&#160;            alignment,</div>
+<div class="line"><a name="l04628"></a><span class="lineno"> 4628</span>&#160;            VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);</div>
+<div class="line"><a name="l04629"></a><span class="lineno"> 4629</span>&#160;    }</div>
+<div class="line"><a name="l04630"></a><span class="lineno"> 4630</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l04631"></a><span class="lineno"> 4631</span>&#160;    {</div>
+<div class="line"><a name="l04632"></a><span class="lineno"> 4632</span>&#160;        <span class="keywordflow">return</span> VMA_SYSTEM_ALIGNED_MALLOC(size, alignment);</div>
 <div class="line"><a name="l04633"></a><span class="lineno"> 4633</span>&#160;    }</div>
 <div class="line"><a name="l04634"></a><span class="lineno"> 4634</span>&#160;}</div>
 <div class="line"><a name="l04635"></a><span class="lineno"> 4635</span>&#160; </div>
-<div class="line"><a name="l04636"></a><span class="lineno"> 4636</span>&#160;<span class="keyword">static</span> <span class="keywordtype">char</span>* VmaCreateStringCopy(<span class="keyword">const</span> VkAllocationCallbacks* allocs, <span class="keyword">const</span> <span class="keywordtype">char</span>* srcStr)</div>
+<div class="line"><a name="l04636"></a><span class="lineno"> 4636</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFree(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, <span class="keywordtype">void</span>* ptr)</div>
 <div class="line"><a name="l04637"></a><span class="lineno"> 4637</span>&#160;{</div>
-<div class="line"><a name="l04638"></a><span class="lineno"> 4638</span>&#160;    <span class="keywordflow">if</span>(srcStr != VMA_NULL)</div>
-<div class="line"><a name="l04639"></a><span class="lineno"> 4639</span>&#160;    {</div>
-<div class="line"><a name="l04640"></a><span class="lineno"> 4640</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> len = strlen(srcStr);</div>
-<div class="line"><a name="l04641"></a><span class="lineno"> 4641</span>&#160;        <span class="keywordtype">char</span>* <span class="keyword">const</span> result = vma_new_array(allocs, <span class="keywordtype">char</span>, len + 1);</div>
-<div class="line"><a name="l04642"></a><span class="lineno"> 4642</span>&#160;        memcpy(result, srcStr, len + 1);</div>
-<div class="line"><a name="l04643"></a><span class="lineno"> 4643</span>&#160;        <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l04644"></a><span class="lineno"> 4644</span>&#160;    }</div>
-<div class="line"><a name="l04645"></a><span class="lineno"> 4645</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l04646"></a><span class="lineno"> 4646</span>&#160;    {</div>
-<div class="line"><a name="l04647"></a><span class="lineno"> 4647</span>&#160;        <span class="keywordflow">return</span> VMA_NULL;</div>
-<div class="line"><a name="l04648"></a><span class="lineno"> 4648</span>&#160;    }</div>
-<div class="line"><a name="l04649"></a><span class="lineno"> 4649</span>&#160;}</div>
-<div class="line"><a name="l04650"></a><span class="lineno"> 4650</span>&#160; </div>
-<div class="line"><a name="l04651"></a><span class="lineno"> 4651</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFreeString(<span class="keyword">const</span> VkAllocationCallbacks* allocs, <span class="keywordtype">char</span>* str)</div>
-<div class="line"><a name="l04652"></a><span class="lineno"> 4652</span>&#160;{</div>
-<div class="line"><a name="l04653"></a><span class="lineno"> 4653</span>&#160;    <span class="keywordflow">if</span>(str != VMA_NULL)</div>
-<div class="line"><a name="l04654"></a><span class="lineno"> 4654</span>&#160;    {</div>
-<div class="line"><a name="l04655"></a><span class="lineno"> 4655</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> len = strlen(str);</div>
-<div class="line"><a name="l04656"></a><span class="lineno"> 4656</span>&#160;        vma_delete_array(allocs, str, len + 1);</div>
-<div class="line"><a name="l04657"></a><span class="lineno"> 4657</span>&#160;    }</div>
-<div class="line"><a name="l04658"></a><span class="lineno"> 4658</span>&#160;}</div>
-<div class="line"><a name="l04659"></a><span class="lineno"> 4659</span>&#160; </div>
-<div class="line"><a name="l04660"></a><span class="lineno"> 4660</span>&#160;<span class="comment">// STL-compatible allocator.</span></div>
-<div class="line"><a name="l04661"></a><span class="lineno"> 4661</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l04662"></a><span class="lineno"> 4662</span>&#160;<span class="keyword">class </span>VmaStlAllocator</div>
-<div class="line"><a name="l04663"></a><span class="lineno"> 4663</span>&#160;{</div>
-<div class="line"><a name="l04664"></a><span class="lineno"> 4664</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l04665"></a><span class="lineno"> 4665</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* <span class="keyword">const</span> m_pCallbacks;</div>
-<div class="line"><a name="l04666"></a><span class="lineno"> 4666</span>&#160;    <span class="keyword">typedef</span> T value_type;</div>
-<div class="line"><a name="l04667"></a><span class="lineno"> 4667</span>&#160;    </div>
-<div class="line"><a name="l04668"></a><span class="lineno"> 4668</span>&#160;    VmaStlAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pCallbacks) : m_pCallbacks(pCallbacks) { }</div>
-<div class="line"><a name="l04669"></a><span class="lineno"> 4669</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt; VmaStlAllocator(<span class="keyword">const</span> VmaStlAllocator&lt;U&gt;&amp; src) : m_pCallbacks(src.m_pCallbacks) { }</div>
-<div class="line"><a name="l04670"></a><span class="lineno"> 4670</span>&#160; </div>
-<div class="line"><a name="l04671"></a><span class="lineno"> 4671</span>&#160;    T* allocate(<span class="keywordtype">size_t</span> n) { <span class="keywordflow">return</span> VmaAllocateArray&lt;T&gt;(m_pCallbacks, n); }</div>
-<div class="line"><a name="l04672"></a><span class="lineno"> 4672</span>&#160;    <span class="keywordtype">void</span> deallocate(T* p, <span class="keywordtype">size_t</span> n) { VmaFree(m_pCallbacks, p); }</div>
-<div class="line"><a name="l04673"></a><span class="lineno"> 4673</span>&#160; </div>
-<div class="line"><a name="l04674"></a><span class="lineno"> 4674</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt;</div>
-<div class="line"><a name="l04675"></a><span class="lineno"> 4675</span>&#160;    <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> VmaStlAllocator&lt;U&gt;&amp; rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l04676"></a><span class="lineno"> 4676</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l04677"></a><span class="lineno"> 4677</span>&#160;        <span class="keywordflow">return</span> m_pCallbacks == rhs.m_pCallbacks;</div>
-<div class="line"><a name="l04678"></a><span class="lineno"> 4678</span>&#160;    }</div>
-<div class="line"><a name="l04679"></a><span class="lineno"> 4679</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt;</div>
-<div class="line"><a name="l04680"></a><span class="lineno"> 4680</span>&#160;    <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> VmaStlAllocator&lt;U&gt;&amp; rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l04681"></a><span class="lineno"> 4681</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l04682"></a><span class="lineno"> 4682</span>&#160;        <span class="keywordflow">return</span> m_pCallbacks != rhs.m_pCallbacks;</div>
-<div class="line"><a name="l04683"></a><span class="lineno"> 4683</span>&#160;    }</div>
+<div class="line"><a name="l04638"></a><span class="lineno"> 4638</span>&#160;    <span class="keywordflow">if</span>((pAllocationCallbacks != VMA_NULL) &amp;&amp;</div>
+<div class="line"><a name="l04639"></a><span class="lineno"> 4639</span>&#160;        (pAllocationCallbacks-&gt;pfnFree != VMA_NULL))</div>
+<div class="line"><a name="l04640"></a><span class="lineno"> 4640</span>&#160;    {</div>
+<div class="line"><a name="l04641"></a><span class="lineno"> 4641</span>&#160;        (*pAllocationCallbacks-&gt;pfnFree)(pAllocationCallbacks-&gt;pUserData, ptr);</div>
+<div class="line"><a name="l04642"></a><span class="lineno"> 4642</span>&#160;    }</div>
+<div class="line"><a name="l04643"></a><span class="lineno"> 4643</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l04644"></a><span class="lineno"> 4644</span>&#160;    {</div>
+<div class="line"><a name="l04645"></a><span class="lineno"> 4645</span>&#160;        VMA_SYSTEM_FREE(ptr);</div>
+<div class="line"><a name="l04646"></a><span class="lineno"> 4646</span>&#160;    }</div>
+<div class="line"><a name="l04647"></a><span class="lineno"> 4647</span>&#160;}</div>
+<div class="line"><a name="l04648"></a><span class="lineno"> 4648</span>&#160; </div>
+<div class="line"><a name="l04649"></a><span class="lineno"> 4649</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l04650"></a><span class="lineno"> 4650</span>&#160;<span class="keyword">static</span> T* VmaAllocate(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks)</div>
+<div class="line"><a name="l04651"></a><span class="lineno"> 4651</span>&#160;{</div>
+<div class="line"><a name="l04652"></a><span class="lineno"> 4652</span>&#160;    <span class="keywordflow">return</span> (T*)VmaMalloc(pAllocationCallbacks, <span class="keyword">sizeof</span>(T), VMA_ALIGN_OF(T));</div>
+<div class="line"><a name="l04653"></a><span class="lineno"> 4653</span>&#160;}</div>
+<div class="line"><a name="l04654"></a><span class="lineno"> 4654</span>&#160; </div>
+<div class="line"><a name="l04655"></a><span class="lineno"> 4655</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l04656"></a><span class="lineno"> 4656</span>&#160;<span class="keyword">static</span> T* VmaAllocateArray(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, <span class="keywordtype">size_t</span> count)</div>
+<div class="line"><a name="l04657"></a><span class="lineno"> 4657</span>&#160;{</div>
+<div class="line"><a name="l04658"></a><span class="lineno"> 4658</span>&#160;    <span class="keywordflow">return</span> (T*)VmaMalloc(pAllocationCallbacks, <span class="keyword">sizeof</span>(T) * count, VMA_ALIGN_OF(T));</div>
+<div class="line"><a name="l04659"></a><span class="lineno"> 4659</span>&#160;}</div>
+<div class="line"><a name="l04660"></a><span class="lineno"> 4660</span>&#160; </div>
+<div class="line"><a name="l04661"></a><span class="lineno"> 4661</span>&#160;<span class="preprocessor">#define vma_new(allocator, type)   new(VmaAllocate&lt;type&gt;(allocator))(type)</span></div>
+<div class="line"><a name="l04662"></a><span class="lineno"> 4662</span>&#160; </div>
+<div class="line"><a name="l04663"></a><span class="lineno"> 4663</span>&#160;<span class="preprocessor">#define vma_new_array(allocator, type, count)   new(VmaAllocateArray&lt;type&gt;((allocator), (count)))(type)</span></div>
+<div class="line"><a name="l04664"></a><span class="lineno"> 4664</span>&#160; </div>
+<div class="line"><a name="l04665"></a><span class="lineno"> 4665</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l04666"></a><span class="lineno"> 4666</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, T* ptr)</div>
+<div class="line"><a name="l04667"></a><span class="lineno"> 4667</span>&#160;{</div>
+<div class="line"><a name="l04668"></a><span class="lineno"> 4668</span>&#160;    ptr-&gt;~T();</div>
+<div class="line"><a name="l04669"></a><span class="lineno"> 4669</span>&#160;    VmaFree(pAllocationCallbacks, ptr);</div>
+<div class="line"><a name="l04670"></a><span class="lineno"> 4670</span>&#160;}</div>
+<div class="line"><a name="l04671"></a><span class="lineno"> 4671</span>&#160; </div>
+<div class="line"><a name="l04672"></a><span class="lineno"> 4672</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l04673"></a><span class="lineno"> 4673</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete_array(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, T* ptr, <span class="keywordtype">size_t</span> count)</div>
+<div class="line"><a name="l04674"></a><span class="lineno"> 4674</span>&#160;{</div>
+<div class="line"><a name="l04675"></a><span class="lineno"> 4675</span>&#160;    <span class="keywordflow">if</span>(ptr != VMA_NULL)</div>
+<div class="line"><a name="l04676"></a><span class="lineno"> 4676</span>&#160;    {</div>
+<div class="line"><a name="l04677"></a><span class="lineno"> 4677</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = count; i--; )</div>
+<div class="line"><a name="l04678"></a><span class="lineno"> 4678</span>&#160;        {</div>
+<div class="line"><a name="l04679"></a><span class="lineno"> 4679</span>&#160;            ptr[i].~T();</div>
+<div class="line"><a name="l04680"></a><span class="lineno"> 4680</span>&#160;        }</div>
+<div class="line"><a name="l04681"></a><span class="lineno"> 4681</span>&#160;        VmaFree(pAllocationCallbacks, ptr);</div>
+<div class="line"><a name="l04682"></a><span class="lineno"> 4682</span>&#160;    }</div>
+<div class="line"><a name="l04683"></a><span class="lineno"> 4683</span>&#160;}</div>
 <div class="line"><a name="l04684"></a><span class="lineno"> 4684</span>&#160; </div>
-<div class="line"><a name="l04685"></a><span class="lineno"> 4685</span>&#160;    VmaStlAllocator&amp; operator=(<span class="keyword">const</span> VmaStlAllocator&amp; x) = <span class="keyword">delete</span>;</div>
-<div class="line"><a name="l04686"></a><span class="lineno"> 4686</span>&#160;};</div>
-<div class="line"><a name="l04687"></a><span class="lineno"> 4687</span>&#160; </div>
-<div class="line"><a name="l04688"></a><span class="lineno"> 4688</span>&#160;<span class="preprocessor">#if VMA_USE_STL_VECTOR</span></div>
-<div class="line"><a name="l04689"></a><span class="lineno"> 4689</span>&#160; </div>
-<div class="line"><a name="l04690"></a><span class="lineno"> 4690</span>&#160;<span class="preprocessor">#define VmaVector std::vector</span></div>
-<div class="line"><a name="l04691"></a><span class="lineno"> 4691</span>&#160; </div>
-<div class="line"><a name="l04692"></a><span class="lineno"> 4692</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
-<div class="line"><a name="l04693"></a><span class="lineno"> 4693</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorInsert(std::vector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index, <span class="keyword">const</span> T&amp; item)</div>
-<div class="line"><a name="l04694"></a><span class="lineno"> 4694</span>&#160;{</div>
-<div class="line"><a name="l04695"></a><span class="lineno"> 4695</span>&#160;    vec.insert(vec.begin() + index, item);</div>
-<div class="line"><a name="l04696"></a><span class="lineno"> 4696</span>&#160;}</div>
-<div class="line"><a name="l04697"></a><span class="lineno"> 4697</span>&#160; </div>
-<div class="line"><a name="l04698"></a><span class="lineno"> 4698</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
-<div class="line"><a name="l04699"></a><span class="lineno"> 4699</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorRemove(std::vector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index)</div>
-<div class="line"><a name="l04700"></a><span class="lineno"> 4700</span>&#160;{</div>
-<div class="line"><a name="l04701"></a><span class="lineno"> 4701</span>&#160;    vec.erase(vec.begin() + index);</div>
-<div class="line"><a name="l04702"></a><span class="lineno"> 4702</span>&#160;}</div>
-<div class="line"><a name="l04703"></a><span class="lineno"> 4703</span>&#160; </div>
-<div class="line"><a name="l04704"></a><span class="lineno"> 4704</span>&#160;<span class="preprocessor">#else // #if VMA_USE_STL_VECTOR</span></div>
-<div class="line"><a name="l04705"></a><span class="lineno"> 4705</span>&#160; </div>
-<div class="line"><a name="l04706"></a><span class="lineno"> 4706</span>&#160;<span class="comment">/* Class with interface compatible with subset of std::vector.</span></div>
-<div class="line"><a name="l04707"></a><span class="lineno"> 4707</span>&#160;<span class="comment">T must be POD because constructors and destructors are not called and memcpy is</span></div>
-<div class="line"><a name="l04708"></a><span class="lineno"> 4708</span>&#160;<span class="comment">used for these objects. */</span></div>
-<div class="line"><a name="l04709"></a><span class="lineno"> 4709</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> AllocatorT&gt;</div>
-<div class="line"><a name="l04710"></a><span class="lineno"> 4710</span>&#160;<span class="keyword">class </span>VmaVector</div>
-<div class="line"><a name="l04711"></a><span class="lineno"> 4711</span>&#160;{</div>
-<div class="line"><a name="l04712"></a><span class="lineno"> 4712</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l04713"></a><span class="lineno"> 4713</span>&#160;    <span class="keyword">typedef</span> T value_type;</div>
-<div class="line"><a name="l04714"></a><span class="lineno"> 4714</span>&#160; </div>
-<div class="line"><a name="l04715"></a><span class="lineno"> 4715</span>&#160;    VmaVector(<span class="keyword">const</span> AllocatorT&amp; allocator) :</div>
-<div class="line"><a name="l04716"></a><span class="lineno"> 4716</span>&#160;        m_Allocator(allocator),</div>
-<div class="line"><a name="l04717"></a><span class="lineno"> 4717</span>&#160;        m_pArray(VMA_NULL),</div>
-<div class="line"><a name="l04718"></a><span class="lineno"> 4718</span>&#160;        m_Count(0),</div>
-<div class="line"><a name="l04719"></a><span class="lineno"> 4719</span>&#160;        m_Capacity(0)</div>
-<div class="line"><a name="l04720"></a><span class="lineno"> 4720</span>&#160;    {</div>
-<div class="line"><a name="l04721"></a><span class="lineno"> 4721</span>&#160;    }</div>
+<div class="line"><a name="l04685"></a><span class="lineno"> 4685</span>&#160;<span class="keyword">static</span> <span class="keywordtype">char</span>* VmaCreateStringCopy(<span class="keyword">const</span> VkAllocationCallbacks* allocs, <span class="keyword">const</span> <span class="keywordtype">char</span>* srcStr)</div>
+<div class="line"><a name="l04686"></a><span class="lineno"> 4686</span>&#160;{</div>
+<div class="line"><a name="l04687"></a><span class="lineno"> 4687</span>&#160;    <span class="keywordflow">if</span>(srcStr != VMA_NULL)</div>
+<div class="line"><a name="l04688"></a><span class="lineno"> 4688</span>&#160;    {</div>
+<div class="line"><a name="l04689"></a><span class="lineno"> 4689</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> len = strlen(srcStr);</div>
+<div class="line"><a name="l04690"></a><span class="lineno"> 4690</span>&#160;        <span class="keywordtype">char</span>* <span class="keyword">const</span> result = vma_new_array(allocs, <span class="keywordtype">char</span>, len + 1);</div>
+<div class="line"><a name="l04691"></a><span class="lineno"> 4691</span>&#160;        memcpy(result, srcStr, len + 1);</div>
+<div class="line"><a name="l04692"></a><span class="lineno"> 4692</span>&#160;        <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l04693"></a><span class="lineno"> 4693</span>&#160;    }</div>
+<div class="line"><a name="l04694"></a><span class="lineno"> 4694</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l04695"></a><span class="lineno"> 4695</span>&#160;    {</div>
+<div class="line"><a name="l04696"></a><span class="lineno"> 4696</span>&#160;        <span class="keywordflow">return</span> VMA_NULL;</div>
+<div class="line"><a name="l04697"></a><span class="lineno"> 4697</span>&#160;    }</div>
+<div class="line"><a name="l04698"></a><span class="lineno"> 4698</span>&#160;}</div>
+<div class="line"><a name="l04699"></a><span class="lineno"> 4699</span>&#160; </div>
+<div class="line"><a name="l04700"></a><span class="lineno"> 4700</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFreeString(<span class="keyword">const</span> VkAllocationCallbacks* allocs, <span class="keywordtype">char</span>* str)</div>
+<div class="line"><a name="l04701"></a><span class="lineno"> 4701</span>&#160;{</div>
+<div class="line"><a name="l04702"></a><span class="lineno"> 4702</span>&#160;    <span class="keywordflow">if</span>(str != VMA_NULL)</div>
+<div class="line"><a name="l04703"></a><span class="lineno"> 4703</span>&#160;    {</div>
+<div class="line"><a name="l04704"></a><span class="lineno"> 4704</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> len = strlen(str);</div>
+<div class="line"><a name="l04705"></a><span class="lineno"> 4705</span>&#160;        vma_delete_array(allocs, str, len + 1);</div>
+<div class="line"><a name="l04706"></a><span class="lineno"> 4706</span>&#160;    }</div>
+<div class="line"><a name="l04707"></a><span class="lineno"> 4707</span>&#160;}</div>
+<div class="line"><a name="l04708"></a><span class="lineno"> 4708</span>&#160; </div>
+<div class="line"><a name="l04709"></a><span class="lineno"> 4709</span>&#160;<span class="comment">// STL-compatible allocator.</span></div>
+<div class="line"><a name="l04710"></a><span class="lineno"> 4710</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l04711"></a><span class="lineno"> 4711</span>&#160;<span class="keyword">class </span>VmaStlAllocator</div>
+<div class="line"><a name="l04712"></a><span class="lineno"> 4712</span>&#160;{</div>
+<div class="line"><a name="l04713"></a><span class="lineno"> 4713</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l04714"></a><span class="lineno"> 4714</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* <span class="keyword">const</span> m_pCallbacks;</div>
+<div class="line"><a name="l04715"></a><span class="lineno"> 4715</span>&#160;    <span class="keyword">typedef</span> T value_type;</div>
+<div class="line"><a name="l04716"></a><span class="lineno"> 4716</span>&#160;    </div>
+<div class="line"><a name="l04717"></a><span class="lineno"> 4717</span>&#160;    VmaStlAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pCallbacks) : m_pCallbacks(pCallbacks) { }</div>
+<div class="line"><a name="l04718"></a><span class="lineno"> 4718</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt; VmaStlAllocator(<span class="keyword">const</span> VmaStlAllocator&lt;U&gt;&amp; src) : m_pCallbacks(src.m_pCallbacks) { }</div>
+<div class="line"><a name="l04719"></a><span class="lineno"> 4719</span>&#160; </div>
+<div class="line"><a name="l04720"></a><span class="lineno"> 4720</span>&#160;    T* allocate(<span class="keywordtype">size_t</span> n) { <span class="keywordflow">return</span> VmaAllocateArray&lt;T&gt;(m_pCallbacks, n); }</div>
+<div class="line"><a name="l04721"></a><span class="lineno"> 4721</span>&#160;    <span class="keywordtype">void</span> deallocate(T* p, <span class="keywordtype">size_t</span> n) { VmaFree(m_pCallbacks, p); }</div>
 <div class="line"><a name="l04722"></a><span class="lineno"> 4722</span>&#160; </div>
-<div class="line"><a name="l04723"></a><span class="lineno"> 4723</span>&#160;    VmaVector(<span class="keywordtype">size_t</span> count, <span class="keyword">const</span> AllocatorT&amp; allocator) :</div>
-<div class="line"><a name="l04724"></a><span class="lineno"> 4724</span>&#160;        m_Allocator(allocator),</div>
-<div class="line"><a name="l04725"></a><span class="lineno"> 4725</span>&#160;        m_pArray(count ? (T*)VmaAllocateArray&lt;T&gt;(allocator.m_pCallbacks, count) : VMA_NULL),</div>
-<div class="line"><a name="l04726"></a><span class="lineno"> 4726</span>&#160;        m_Count(count),</div>
-<div class="line"><a name="l04727"></a><span class="lineno"> 4727</span>&#160;        m_Capacity(count)</div>
-<div class="line"><a name="l04728"></a><span class="lineno"> 4728</span>&#160;    {</div>
-<div class="line"><a name="l04729"></a><span class="lineno"> 4729</span>&#160;    }</div>
-<div class="line"><a name="l04730"></a><span class="lineno"> 4730</span>&#160;    </div>
-<div class="line"><a name="l04731"></a><span class="lineno"> 4731</span>&#160;    <span class="comment">// This version of the constructor is here for compatibility with pre-C++14 std::vector.</span></div>
-<div class="line"><a name="l04732"></a><span class="lineno"> 4732</span>&#160;    <span class="comment">// value is unused.</span></div>
-<div class="line"><a name="l04733"></a><span class="lineno"> 4733</span>&#160;    VmaVector(<span class="keywordtype">size_t</span> count, <span class="keyword">const</span> T&amp; value, <span class="keyword">const</span> AllocatorT&amp; allocator)</div>
-<div class="line"><a name="l04734"></a><span class="lineno"> 4734</span>&#160;        : VmaVector(count, allocator) {}</div>
-<div class="line"><a name="l04735"></a><span class="lineno"> 4735</span>&#160;    </div>
-<div class="line"><a name="l04736"></a><span class="lineno"> 4736</span>&#160;    VmaVector(<span class="keyword">const</span> VmaVector&lt;T, AllocatorT&gt;&amp; src) :</div>
-<div class="line"><a name="l04737"></a><span class="lineno"> 4737</span>&#160;        m_Allocator(src.m_Allocator),</div>
-<div class="line"><a name="l04738"></a><span class="lineno"> 4738</span>&#160;        m_pArray(src.m_Count ? (T*)VmaAllocateArray&lt;T&gt;(src.m_Allocator.m_pCallbacks, src.m_Count) : VMA_NULL),</div>
-<div class="line"><a name="l04739"></a><span class="lineno"> 4739</span>&#160;        m_Count(src.m_Count),</div>
-<div class="line"><a name="l04740"></a><span class="lineno"> 4740</span>&#160;        m_Capacity(src.m_Count)</div>
-<div class="line"><a name="l04741"></a><span class="lineno"> 4741</span>&#160;    {</div>
-<div class="line"><a name="l04742"></a><span class="lineno"> 4742</span>&#160;        <span class="keywordflow">if</span>(m_Count != 0)</div>
-<div class="line"><a name="l04743"></a><span class="lineno"> 4743</span>&#160;        {</div>
-<div class="line"><a name="l04744"></a><span class="lineno"> 4744</span>&#160;            memcpy(m_pArray, src.m_pArray, m_Count * <span class="keyword">sizeof</span>(T));</div>
-<div class="line"><a name="l04745"></a><span class="lineno"> 4745</span>&#160;        }</div>
-<div class="line"><a name="l04746"></a><span class="lineno"> 4746</span>&#160;    }</div>
-<div class="line"><a name="l04747"></a><span class="lineno"> 4747</span>&#160;    </div>
-<div class="line"><a name="l04748"></a><span class="lineno"> 4748</span>&#160;    ~VmaVector()</div>
-<div class="line"><a name="l04749"></a><span class="lineno"> 4749</span>&#160;    {</div>
-<div class="line"><a name="l04750"></a><span class="lineno"> 4750</span>&#160;        VmaFree(m_Allocator.m_pCallbacks, m_pArray);</div>
-<div class="line"><a name="l04751"></a><span class="lineno"> 4751</span>&#160;    }</div>
+<div class="line"><a name="l04723"></a><span class="lineno"> 4723</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt;</div>
+<div class="line"><a name="l04724"></a><span class="lineno"> 4724</span>&#160;    <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> VmaStlAllocator&lt;U&gt;&amp; rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l04725"></a><span class="lineno"> 4725</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l04726"></a><span class="lineno"> 4726</span>&#160;        <span class="keywordflow">return</span> m_pCallbacks == rhs.m_pCallbacks;</div>
+<div class="line"><a name="l04727"></a><span class="lineno"> 4727</span>&#160;    }</div>
+<div class="line"><a name="l04728"></a><span class="lineno"> 4728</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt;</div>
+<div class="line"><a name="l04729"></a><span class="lineno"> 4729</span>&#160;    <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> VmaStlAllocator&lt;U&gt;&amp; rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l04730"></a><span class="lineno"> 4730</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l04731"></a><span class="lineno"> 4731</span>&#160;        <span class="keywordflow">return</span> m_pCallbacks != rhs.m_pCallbacks;</div>
+<div class="line"><a name="l04732"></a><span class="lineno"> 4732</span>&#160;    }</div>
+<div class="line"><a name="l04733"></a><span class="lineno"> 4733</span>&#160; </div>
+<div class="line"><a name="l04734"></a><span class="lineno"> 4734</span>&#160;    VmaStlAllocator&amp; operator=(<span class="keyword">const</span> VmaStlAllocator&amp; x) = <span class="keyword">delete</span>;</div>
+<div class="line"><a name="l04735"></a><span class="lineno"> 4735</span>&#160;};</div>
+<div class="line"><a name="l04736"></a><span class="lineno"> 4736</span>&#160; </div>
+<div class="line"><a name="l04737"></a><span class="lineno"> 4737</span>&#160;<span class="preprocessor">#if VMA_USE_STL_VECTOR</span></div>
+<div class="line"><a name="l04738"></a><span class="lineno"> 4738</span>&#160; </div>
+<div class="line"><a name="l04739"></a><span class="lineno"> 4739</span>&#160;<span class="preprocessor">#define VmaVector std::vector</span></div>
+<div class="line"><a name="l04740"></a><span class="lineno"> 4740</span>&#160; </div>
+<div class="line"><a name="l04741"></a><span class="lineno"> 4741</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
+<div class="line"><a name="l04742"></a><span class="lineno"> 4742</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorInsert(std::vector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index, <span class="keyword">const</span> T&amp; item)</div>
+<div class="line"><a name="l04743"></a><span class="lineno"> 4743</span>&#160;{</div>
+<div class="line"><a name="l04744"></a><span class="lineno"> 4744</span>&#160;    vec.insert(vec.begin() + index, item);</div>
+<div class="line"><a name="l04745"></a><span class="lineno"> 4745</span>&#160;}</div>
+<div class="line"><a name="l04746"></a><span class="lineno"> 4746</span>&#160; </div>
+<div class="line"><a name="l04747"></a><span class="lineno"> 4747</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
+<div class="line"><a name="l04748"></a><span class="lineno"> 4748</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorRemove(std::vector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index)</div>
+<div class="line"><a name="l04749"></a><span class="lineno"> 4749</span>&#160;{</div>
+<div class="line"><a name="l04750"></a><span class="lineno"> 4750</span>&#160;    vec.erase(vec.begin() + index);</div>
+<div class="line"><a name="l04751"></a><span class="lineno"> 4751</span>&#160;}</div>
 <div class="line"><a name="l04752"></a><span class="lineno"> 4752</span>&#160; </div>
-<div class="line"><a name="l04753"></a><span class="lineno"> 4753</span>&#160;    VmaVector&amp; operator=(<span class="keyword">const</span> VmaVector&lt;T, AllocatorT&gt;&amp; rhs)</div>
-<div class="line"><a name="l04754"></a><span class="lineno"> 4754</span>&#160;    {</div>
-<div class="line"><a name="l04755"></a><span class="lineno"> 4755</span>&#160;        <span class="keywordflow">if</span>(&amp;rhs != <span class="keyword">this</span>)</div>
-<div class="line"><a name="l04756"></a><span class="lineno"> 4756</span>&#160;        {</div>
-<div class="line"><a name="l04757"></a><span class="lineno"> 4757</span>&#160;            resize(rhs.m_Count);</div>
-<div class="line"><a name="l04758"></a><span class="lineno"> 4758</span>&#160;            <span class="keywordflow">if</span>(m_Count != 0)</div>
-<div class="line"><a name="l04759"></a><span class="lineno"> 4759</span>&#160;            {</div>
-<div class="line"><a name="l04760"></a><span class="lineno"> 4760</span>&#160;                memcpy(m_pArray, rhs.m_pArray, m_Count * <span class="keyword">sizeof</span>(T));</div>
-<div class="line"><a name="l04761"></a><span class="lineno"> 4761</span>&#160;            }</div>
-<div class="line"><a name="l04762"></a><span class="lineno"> 4762</span>&#160;        }</div>
-<div class="line"><a name="l04763"></a><span class="lineno"> 4763</span>&#160;        <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
-<div class="line"><a name="l04764"></a><span class="lineno"> 4764</span>&#160;    }</div>
-<div class="line"><a name="l04765"></a><span class="lineno"> 4765</span>&#160;    </div>
-<div class="line"><a name="l04766"></a><span class="lineno"> 4766</span>&#160;    <span class="keywordtype">bool</span> empty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count == 0; }</div>
-<div class="line"><a name="l04767"></a><span class="lineno"> 4767</span>&#160;    <span class="keywordtype">size_t</span> size()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count; }</div>
-<div class="line"><a name="l04768"></a><span class="lineno"> 4768</span>&#160;    T* data() { <span class="keywordflow">return</span> m_pArray; }</div>
-<div class="line"><a name="l04769"></a><span class="lineno"> 4769</span>&#160;    <span class="keyword">const</span> T* data()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pArray; }</div>
-<div class="line"><a name="l04770"></a><span class="lineno"> 4770</span>&#160;    </div>
-<div class="line"><a name="l04771"></a><span class="lineno"> 4771</span>&#160;    T&amp; operator[](<span class="keywordtype">size_t</span> index)</div>
-<div class="line"><a name="l04772"></a><span class="lineno"> 4772</span>&#160;    {</div>
-<div class="line"><a name="l04773"></a><span class="lineno"> 4773</span>&#160;        VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
-<div class="line"><a name="l04774"></a><span class="lineno"> 4774</span>&#160;        <span class="keywordflow">return</span> m_pArray[index];</div>
-<div class="line"><a name="l04775"></a><span class="lineno"> 4775</span>&#160;    }</div>
-<div class="line"><a name="l04776"></a><span class="lineno"> 4776</span>&#160;    <span class="keyword">const</span> T&amp; operator[](<span class="keywordtype">size_t</span> index)<span class="keyword"> const</span></div>
-<div class="line"><a name="l04777"></a><span class="lineno"> 4777</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l04778"></a><span class="lineno"> 4778</span>&#160;        VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
-<div class="line"><a name="l04779"></a><span class="lineno"> 4779</span>&#160;        <span class="keywordflow">return</span> m_pArray[index];</div>
-<div class="line"><a name="l04780"></a><span class="lineno"> 4780</span>&#160;    }</div>
-<div class="line"><a name="l04781"></a><span class="lineno"> 4781</span>&#160; </div>
-<div class="line"><a name="l04782"></a><span class="lineno"> 4782</span>&#160;    T&amp; front()</div>
-<div class="line"><a name="l04783"></a><span class="lineno"> 4783</span>&#160;    {</div>
-<div class="line"><a name="l04784"></a><span class="lineno"> 4784</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
-<div class="line"><a name="l04785"></a><span class="lineno"> 4785</span>&#160;        <span class="keywordflow">return</span> m_pArray[0];</div>
-<div class="line"><a name="l04786"></a><span class="lineno"> 4786</span>&#160;    }</div>
-<div class="line"><a name="l04787"></a><span class="lineno"> 4787</span>&#160;    <span class="keyword">const</span> T&amp; front()<span class="keyword"> const</span></div>
-<div class="line"><a name="l04788"></a><span class="lineno"> 4788</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l04789"></a><span class="lineno"> 4789</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
-<div class="line"><a name="l04790"></a><span class="lineno"> 4790</span>&#160;        <span class="keywordflow">return</span> m_pArray[0];</div>
-<div class="line"><a name="l04791"></a><span class="lineno"> 4791</span>&#160;    }</div>
-<div class="line"><a name="l04792"></a><span class="lineno"> 4792</span>&#160;    T&amp; back()</div>
-<div class="line"><a name="l04793"></a><span class="lineno"> 4793</span>&#160;    {</div>
-<div class="line"><a name="l04794"></a><span class="lineno"> 4794</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
-<div class="line"><a name="l04795"></a><span class="lineno"> 4795</span>&#160;        <span class="keywordflow">return</span> m_pArray[m_Count - 1];</div>
-<div class="line"><a name="l04796"></a><span class="lineno"> 4796</span>&#160;    }</div>
-<div class="line"><a name="l04797"></a><span class="lineno"> 4797</span>&#160;    <span class="keyword">const</span> T&amp; back()<span class="keyword"> const</span></div>
-<div class="line"><a name="l04798"></a><span class="lineno"> 4798</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l04799"></a><span class="lineno"> 4799</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
-<div class="line"><a name="l04800"></a><span class="lineno"> 4800</span>&#160;        <span class="keywordflow">return</span> m_pArray[m_Count - 1];</div>
-<div class="line"><a name="l04801"></a><span class="lineno"> 4801</span>&#160;    }</div>
-<div class="line"><a name="l04802"></a><span class="lineno"> 4802</span>&#160; </div>
-<div class="line"><a name="l04803"></a><span class="lineno"> 4803</span>&#160;    <span class="keywordtype">void</span> reserve(<span class="keywordtype">size_t</span> newCapacity, <span class="keywordtype">bool</span> freeMemory = <span class="keyword">false</span>)</div>
-<div class="line"><a name="l04804"></a><span class="lineno"> 4804</span>&#160;    {</div>
-<div class="line"><a name="l04805"></a><span class="lineno"> 4805</span>&#160;        newCapacity = VMA_MAX(newCapacity, m_Count);</div>
-<div class="line"><a name="l04806"></a><span class="lineno"> 4806</span>&#160;        </div>
-<div class="line"><a name="l04807"></a><span class="lineno"> 4807</span>&#160;        <span class="keywordflow">if</span>((newCapacity &lt; m_Capacity) &amp;&amp; !freeMemory)</div>
-<div class="line"><a name="l04808"></a><span class="lineno"> 4808</span>&#160;        {</div>
-<div class="line"><a name="l04809"></a><span class="lineno"> 4809</span>&#160;            newCapacity = m_Capacity;</div>
-<div class="line"><a name="l04810"></a><span class="lineno"> 4810</span>&#160;        }</div>
-<div class="line"><a name="l04811"></a><span class="lineno"> 4811</span>&#160;        </div>
-<div class="line"><a name="l04812"></a><span class="lineno"> 4812</span>&#160;        <span class="keywordflow">if</span>(newCapacity != m_Capacity)</div>
-<div class="line"><a name="l04813"></a><span class="lineno"> 4813</span>&#160;        {</div>
-<div class="line"><a name="l04814"></a><span class="lineno"> 4814</span>&#160;            T* <span class="keyword">const</span> newArray = newCapacity ? VmaAllocateArray&lt;T&gt;(m_Allocator, newCapacity) : VMA_NULL;</div>
-<div class="line"><a name="l04815"></a><span class="lineno"> 4815</span>&#160;            <span class="keywordflow">if</span>(m_Count != 0)</div>
-<div class="line"><a name="l04816"></a><span class="lineno"> 4816</span>&#160;            {</div>
-<div class="line"><a name="l04817"></a><span class="lineno"> 4817</span>&#160;                memcpy(newArray, m_pArray, m_Count * <span class="keyword">sizeof</span>(T));</div>
-<div class="line"><a name="l04818"></a><span class="lineno"> 4818</span>&#160;            }</div>
-<div class="line"><a name="l04819"></a><span class="lineno"> 4819</span>&#160;            VmaFree(m_Allocator.m_pCallbacks, m_pArray);</div>
-<div class="line"><a name="l04820"></a><span class="lineno"> 4820</span>&#160;            m_Capacity = newCapacity;</div>
-<div class="line"><a name="l04821"></a><span class="lineno"> 4821</span>&#160;            m_pArray = newArray;</div>
-<div class="line"><a name="l04822"></a><span class="lineno"> 4822</span>&#160;        }</div>
-<div class="line"><a name="l04823"></a><span class="lineno"> 4823</span>&#160;    }</div>
-<div class="line"><a name="l04824"></a><span class="lineno"> 4824</span>&#160; </div>
-<div class="line"><a name="l04825"></a><span class="lineno"> 4825</span>&#160;    <span class="keywordtype">void</span> resize(<span class="keywordtype">size_t</span> newCount, <span class="keywordtype">bool</span> freeMemory = <span class="keyword">false</span>)</div>
-<div class="line"><a name="l04826"></a><span class="lineno"> 4826</span>&#160;    {</div>
-<div class="line"><a name="l04827"></a><span class="lineno"> 4827</span>&#160;        <span class="keywordtype">size_t</span> newCapacity = m_Capacity;</div>
-<div class="line"><a name="l04828"></a><span class="lineno"> 4828</span>&#160;        <span class="keywordflow">if</span>(newCount &gt; m_Capacity)</div>
-<div class="line"><a name="l04829"></a><span class="lineno"> 4829</span>&#160;        {</div>
-<div class="line"><a name="l04830"></a><span class="lineno"> 4830</span>&#160;            newCapacity = VMA_MAX(newCount, VMA_MAX(m_Capacity * 3 / 2, (<span class="keywordtype">size_t</span>)8));</div>
-<div class="line"><a name="l04831"></a><span class="lineno"> 4831</span>&#160;        }</div>
-<div class="line"><a name="l04832"></a><span class="lineno"> 4832</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(freeMemory)</div>
-<div class="line"><a name="l04833"></a><span class="lineno"> 4833</span>&#160;        {</div>
-<div class="line"><a name="l04834"></a><span class="lineno"> 4834</span>&#160;            newCapacity = newCount;</div>
-<div class="line"><a name="l04835"></a><span class="lineno"> 4835</span>&#160;        }</div>
-<div class="line"><a name="l04836"></a><span class="lineno"> 4836</span>&#160; </div>
-<div class="line"><a name="l04837"></a><span class="lineno"> 4837</span>&#160;        <span class="keywordflow">if</span>(newCapacity != m_Capacity)</div>
-<div class="line"><a name="l04838"></a><span class="lineno"> 4838</span>&#160;        {</div>
-<div class="line"><a name="l04839"></a><span class="lineno"> 4839</span>&#160;            T* <span class="keyword">const</span> newArray = newCapacity ? VmaAllocateArray&lt;T&gt;(m_Allocator.m_pCallbacks, newCapacity) : VMA_NULL;</div>
-<div class="line"><a name="l04840"></a><span class="lineno"> 4840</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> elementsToCopy = VMA_MIN(m_Count, newCount);</div>
-<div class="line"><a name="l04841"></a><span class="lineno"> 4841</span>&#160;            <span class="keywordflow">if</span>(elementsToCopy != 0)</div>
-<div class="line"><a name="l04842"></a><span class="lineno"> 4842</span>&#160;            {</div>
-<div class="line"><a name="l04843"></a><span class="lineno"> 4843</span>&#160;                memcpy(newArray, m_pArray, elementsToCopy * <span class="keyword">sizeof</span>(T));</div>
-<div class="line"><a name="l04844"></a><span class="lineno"> 4844</span>&#160;            }</div>
-<div class="line"><a name="l04845"></a><span class="lineno"> 4845</span>&#160;            VmaFree(m_Allocator.m_pCallbacks, m_pArray);</div>
-<div class="line"><a name="l04846"></a><span class="lineno"> 4846</span>&#160;            m_Capacity = newCapacity;</div>
-<div class="line"><a name="l04847"></a><span class="lineno"> 4847</span>&#160;            m_pArray = newArray;</div>
-<div class="line"><a name="l04848"></a><span class="lineno"> 4848</span>&#160;        }</div>
-<div class="line"><a name="l04849"></a><span class="lineno"> 4849</span>&#160; </div>
-<div class="line"><a name="l04850"></a><span class="lineno"> 4850</span>&#160;        m_Count = newCount;</div>
-<div class="line"><a name="l04851"></a><span class="lineno"> 4851</span>&#160;    }</div>
-<div class="line"><a name="l04852"></a><span class="lineno"> 4852</span>&#160; </div>
-<div class="line"><a name="l04853"></a><span class="lineno"> 4853</span>&#160;    <span class="keywordtype">void</span> clear(<span class="keywordtype">bool</span> freeMemory = <span class="keyword">false</span>)</div>
-<div class="line"><a name="l04854"></a><span class="lineno"> 4854</span>&#160;    {</div>
-<div class="line"><a name="l04855"></a><span class="lineno"> 4855</span>&#160;        resize(0, freeMemory);</div>
-<div class="line"><a name="l04856"></a><span class="lineno"> 4856</span>&#160;    }</div>
-<div class="line"><a name="l04857"></a><span class="lineno"> 4857</span>&#160; </div>
-<div class="line"><a name="l04858"></a><span class="lineno"> 4858</span>&#160;    <span class="keywordtype">void</span> insert(<span class="keywordtype">size_t</span> index, <span class="keyword">const</span> T&amp; src)</div>
-<div class="line"><a name="l04859"></a><span class="lineno"> 4859</span>&#160;    {</div>
-<div class="line"><a name="l04860"></a><span class="lineno"> 4860</span>&#160;        VMA_HEAVY_ASSERT(index &lt;= m_Count);</div>
-<div class="line"><a name="l04861"></a><span class="lineno"> 4861</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> oldCount = size();</div>
-<div class="line"><a name="l04862"></a><span class="lineno"> 4862</span>&#160;        resize(oldCount + 1);</div>
-<div class="line"><a name="l04863"></a><span class="lineno"> 4863</span>&#160;        <span class="keywordflow">if</span>(index &lt; oldCount)</div>
-<div class="line"><a name="l04864"></a><span class="lineno"> 4864</span>&#160;        {</div>
-<div class="line"><a name="l04865"></a><span class="lineno"> 4865</span>&#160;            memmove(m_pArray + (index + 1), m_pArray + index, (oldCount - index) * <span class="keyword">sizeof</span>(T));</div>
-<div class="line"><a name="l04866"></a><span class="lineno"> 4866</span>&#160;        }</div>
-<div class="line"><a name="l04867"></a><span class="lineno"> 4867</span>&#160;        m_pArray[index] = src;</div>
-<div class="line"><a name="l04868"></a><span class="lineno"> 4868</span>&#160;    }</div>
-<div class="line"><a name="l04869"></a><span class="lineno"> 4869</span>&#160; </div>
-<div class="line"><a name="l04870"></a><span class="lineno"> 4870</span>&#160;    <span class="keywordtype">void</span> remove(<span class="keywordtype">size_t</span> index)</div>
-<div class="line"><a name="l04871"></a><span class="lineno"> 4871</span>&#160;    {</div>
-<div class="line"><a name="l04872"></a><span class="lineno"> 4872</span>&#160;        VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
-<div class="line"><a name="l04873"></a><span class="lineno"> 4873</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> oldCount = size();</div>
-<div class="line"><a name="l04874"></a><span class="lineno"> 4874</span>&#160;        <span class="keywordflow">if</span>(index &lt; oldCount - 1)</div>
-<div class="line"><a name="l04875"></a><span class="lineno"> 4875</span>&#160;        {</div>
-<div class="line"><a name="l04876"></a><span class="lineno"> 4876</span>&#160;            memmove(m_pArray + index, m_pArray + (index + 1), (oldCount - index - 1) * <span class="keyword">sizeof</span>(T));</div>
-<div class="line"><a name="l04877"></a><span class="lineno"> 4877</span>&#160;        }</div>
-<div class="line"><a name="l04878"></a><span class="lineno"> 4878</span>&#160;        resize(oldCount - 1);</div>
-<div class="line"><a name="l04879"></a><span class="lineno"> 4879</span>&#160;    }</div>
-<div class="line"><a name="l04880"></a><span class="lineno"> 4880</span>&#160; </div>
-<div class="line"><a name="l04881"></a><span class="lineno"> 4881</span>&#160;    <span class="keywordtype">void</span> push_back(<span class="keyword">const</span> T&amp; src)</div>
-<div class="line"><a name="l04882"></a><span class="lineno"> 4882</span>&#160;    {</div>
-<div class="line"><a name="l04883"></a><span class="lineno"> 4883</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> newIndex = size();</div>
-<div class="line"><a name="l04884"></a><span class="lineno"> 4884</span>&#160;        resize(newIndex + 1);</div>
-<div class="line"><a name="l04885"></a><span class="lineno"> 4885</span>&#160;        m_pArray[newIndex] = src;</div>
-<div class="line"><a name="l04886"></a><span class="lineno"> 4886</span>&#160;    }</div>
-<div class="line"><a name="l04887"></a><span class="lineno"> 4887</span>&#160; </div>
-<div class="line"><a name="l04888"></a><span class="lineno"> 4888</span>&#160;    <span class="keywordtype">void</span> pop_back()</div>
-<div class="line"><a name="l04889"></a><span class="lineno"> 4889</span>&#160;    {</div>
-<div class="line"><a name="l04890"></a><span class="lineno"> 4890</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
-<div class="line"><a name="l04891"></a><span class="lineno"> 4891</span>&#160;        resize(size() - 1);</div>
-<div class="line"><a name="l04892"></a><span class="lineno"> 4892</span>&#160;    }</div>
-<div class="line"><a name="l04893"></a><span class="lineno"> 4893</span>&#160; </div>
-<div class="line"><a name="l04894"></a><span class="lineno"> 4894</span>&#160;    <span class="keywordtype">void</span> push_front(<span class="keyword">const</span> T&amp; src)</div>
-<div class="line"><a name="l04895"></a><span class="lineno"> 4895</span>&#160;    {</div>
-<div class="line"><a name="l04896"></a><span class="lineno"> 4896</span>&#160;        insert(0, src);</div>
-<div class="line"><a name="l04897"></a><span class="lineno"> 4897</span>&#160;    }</div>
+<div class="line"><a name="l04753"></a><span class="lineno"> 4753</span>&#160;<span class="preprocessor">#else // #if VMA_USE_STL_VECTOR</span></div>
+<div class="line"><a name="l04754"></a><span class="lineno"> 4754</span>&#160; </div>
+<div class="line"><a name="l04755"></a><span class="lineno"> 4755</span>&#160;<span class="comment">/* Class with interface compatible with subset of std::vector.</span></div>
+<div class="line"><a name="l04756"></a><span class="lineno"> 4756</span>&#160;<span class="comment">T must be POD because constructors and destructors are not called and memcpy is</span></div>
+<div class="line"><a name="l04757"></a><span class="lineno"> 4757</span>&#160;<span class="comment">used for these objects. */</span></div>
+<div class="line"><a name="l04758"></a><span class="lineno"> 4758</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> AllocatorT&gt;</div>
+<div class="line"><a name="l04759"></a><span class="lineno"> 4759</span>&#160;<span class="keyword">class </span>VmaVector</div>
+<div class="line"><a name="l04760"></a><span class="lineno"> 4760</span>&#160;{</div>
+<div class="line"><a name="l04761"></a><span class="lineno"> 4761</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l04762"></a><span class="lineno"> 4762</span>&#160;    <span class="keyword">typedef</span> T value_type;</div>
+<div class="line"><a name="l04763"></a><span class="lineno"> 4763</span>&#160; </div>
+<div class="line"><a name="l04764"></a><span class="lineno"> 4764</span>&#160;    VmaVector(<span class="keyword">const</span> AllocatorT&amp; allocator) :</div>
+<div class="line"><a name="l04765"></a><span class="lineno"> 4765</span>&#160;        m_Allocator(allocator),</div>
+<div class="line"><a name="l04766"></a><span class="lineno"> 4766</span>&#160;        m_pArray(VMA_NULL),</div>
+<div class="line"><a name="l04767"></a><span class="lineno"> 4767</span>&#160;        m_Count(0),</div>
+<div class="line"><a name="l04768"></a><span class="lineno"> 4768</span>&#160;        m_Capacity(0)</div>
+<div class="line"><a name="l04769"></a><span class="lineno"> 4769</span>&#160;    {</div>
+<div class="line"><a name="l04770"></a><span class="lineno"> 4770</span>&#160;    }</div>
+<div class="line"><a name="l04771"></a><span class="lineno"> 4771</span>&#160; </div>
+<div class="line"><a name="l04772"></a><span class="lineno"> 4772</span>&#160;    VmaVector(<span class="keywordtype">size_t</span> count, <span class="keyword">const</span> AllocatorT&amp; allocator) :</div>
+<div class="line"><a name="l04773"></a><span class="lineno"> 4773</span>&#160;        m_Allocator(allocator),</div>
+<div class="line"><a name="l04774"></a><span class="lineno"> 4774</span>&#160;        m_pArray(count ? (T*)VmaAllocateArray&lt;T&gt;(allocator.m_pCallbacks, count) : VMA_NULL),</div>
+<div class="line"><a name="l04775"></a><span class="lineno"> 4775</span>&#160;        m_Count(count),</div>
+<div class="line"><a name="l04776"></a><span class="lineno"> 4776</span>&#160;        m_Capacity(count)</div>
+<div class="line"><a name="l04777"></a><span class="lineno"> 4777</span>&#160;    {</div>
+<div class="line"><a name="l04778"></a><span class="lineno"> 4778</span>&#160;    }</div>
+<div class="line"><a name="l04779"></a><span class="lineno"> 4779</span>&#160;    </div>
+<div class="line"><a name="l04780"></a><span class="lineno"> 4780</span>&#160;    <span class="comment">// This version of the constructor is here for compatibility with pre-C++14 std::vector.</span></div>
+<div class="line"><a name="l04781"></a><span class="lineno"> 4781</span>&#160;    <span class="comment">// value is unused.</span></div>
+<div class="line"><a name="l04782"></a><span class="lineno"> 4782</span>&#160;    VmaVector(<span class="keywordtype">size_t</span> count, <span class="keyword">const</span> T&amp; value, <span class="keyword">const</span> AllocatorT&amp; allocator)</div>
+<div class="line"><a name="l04783"></a><span class="lineno"> 4783</span>&#160;        : VmaVector(count, allocator) {}</div>
+<div class="line"><a name="l04784"></a><span class="lineno"> 4784</span>&#160;    </div>
+<div class="line"><a name="l04785"></a><span class="lineno"> 4785</span>&#160;    VmaVector(<span class="keyword">const</span> VmaVector&lt;T, AllocatorT&gt;&amp; src) :</div>
+<div class="line"><a name="l04786"></a><span class="lineno"> 4786</span>&#160;        m_Allocator(src.m_Allocator),</div>
+<div class="line"><a name="l04787"></a><span class="lineno"> 4787</span>&#160;        m_pArray(src.m_Count ? (T*)VmaAllocateArray&lt;T&gt;(src.m_Allocator.m_pCallbacks, src.m_Count) : VMA_NULL),</div>
+<div class="line"><a name="l04788"></a><span class="lineno"> 4788</span>&#160;        m_Count(src.m_Count),</div>
+<div class="line"><a name="l04789"></a><span class="lineno"> 4789</span>&#160;        m_Capacity(src.m_Count)</div>
+<div class="line"><a name="l04790"></a><span class="lineno"> 4790</span>&#160;    {</div>
+<div class="line"><a name="l04791"></a><span class="lineno"> 4791</span>&#160;        <span class="keywordflow">if</span>(m_Count != 0)</div>
+<div class="line"><a name="l04792"></a><span class="lineno"> 4792</span>&#160;        {</div>
+<div class="line"><a name="l04793"></a><span class="lineno"> 4793</span>&#160;            memcpy(m_pArray, src.m_pArray, m_Count * <span class="keyword">sizeof</span>(T));</div>
+<div class="line"><a name="l04794"></a><span class="lineno"> 4794</span>&#160;        }</div>
+<div class="line"><a name="l04795"></a><span class="lineno"> 4795</span>&#160;    }</div>
+<div class="line"><a name="l04796"></a><span class="lineno"> 4796</span>&#160;    </div>
+<div class="line"><a name="l04797"></a><span class="lineno"> 4797</span>&#160;    ~VmaVector()</div>
+<div class="line"><a name="l04798"></a><span class="lineno"> 4798</span>&#160;    {</div>
+<div class="line"><a name="l04799"></a><span class="lineno"> 4799</span>&#160;        VmaFree(m_Allocator.m_pCallbacks, m_pArray);</div>
+<div class="line"><a name="l04800"></a><span class="lineno"> 4800</span>&#160;    }</div>
+<div class="line"><a name="l04801"></a><span class="lineno"> 4801</span>&#160; </div>
+<div class="line"><a name="l04802"></a><span class="lineno"> 4802</span>&#160;    VmaVector&amp; operator=(<span class="keyword">const</span> VmaVector&lt;T, AllocatorT&gt;&amp; rhs)</div>
+<div class="line"><a name="l04803"></a><span class="lineno"> 4803</span>&#160;    {</div>
+<div class="line"><a name="l04804"></a><span class="lineno"> 4804</span>&#160;        <span class="keywordflow">if</span>(&amp;rhs != <span class="keyword">this</span>)</div>
+<div class="line"><a name="l04805"></a><span class="lineno"> 4805</span>&#160;        {</div>
+<div class="line"><a name="l04806"></a><span class="lineno"> 4806</span>&#160;            resize(rhs.m_Count);</div>
+<div class="line"><a name="l04807"></a><span class="lineno"> 4807</span>&#160;            <span class="keywordflow">if</span>(m_Count != 0)</div>
+<div class="line"><a name="l04808"></a><span class="lineno"> 4808</span>&#160;            {</div>
+<div class="line"><a name="l04809"></a><span class="lineno"> 4809</span>&#160;                memcpy(m_pArray, rhs.m_pArray, m_Count * <span class="keyword">sizeof</span>(T));</div>
+<div class="line"><a name="l04810"></a><span class="lineno"> 4810</span>&#160;            }</div>
+<div class="line"><a name="l04811"></a><span class="lineno"> 4811</span>&#160;        }</div>
+<div class="line"><a name="l04812"></a><span class="lineno"> 4812</span>&#160;        <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
+<div class="line"><a name="l04813"></a><span class="lineno"> 4813</span>&#160;    }</div>
+<div class="line"><a name="l04814"></a><span class="lineno"> 4814</span>&#160;    </div>
+<div class="line"><a name="l04815"></a><span class="lineno"> 4815</span>&#160;    <span class="keywordtype">bool</span> empty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count == 0; }</div>
+<div class="line"><a name="l04816"></a><span class="lineno"> 4816</span>&#160;    <span class="keywordtype">size_t</span> size()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count; }</div>
+<div class="line"><a name="l04817"></a><span class="lineno"> 4817</span>&#160;    T* data() { <span class="keywordflow">return</span> m_pArray; }</div>
+<div class="line"><a name="l04818"></a><span class="lineno"> 4818</span>&#160;    <span class="keyword">const</span> T* data()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pArray; }</div>
+<div class="line"><a name="l04819"></a><span class="lineno"> 4819</span>&#160;    </div>
+<div class="line"><a name="l04820"></a><span class="lineno"> 4820</span>&#160;    T&amp; operator[](<span class="keywordtype">size_t</span> index)</div>
+<div class="line"><a name="l04821"></a><span class="lineno"> 4821</span>&#160;    {</div>
+<div class="line"><a name="l04822"></a><span class="lineno"> 4822</span>&#160;        VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
+<div class="line"><a name="l04823"></a><span class="lineno"> 4823</span>&#160;        <span class="keywordflow">return</span> m_pArray[index];</div>
+<div class="line"><a name="l04824"></a><span class="lineno"> 4824</span>&#160;    }</div>
+<div class="line"><a name="l04825"></a><span class="lineno"> 4825</span>&#160;    <span class="keyword">const</span> T&amp; operator[](<span class="keywordtype">size_t</span> index)<span class="keyword"> const</span></div>
+<div class="line"><a name="l04826"></a><span class="lineno"> 4826</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l04827"></a><span class="lineno"> 4827</span>&#160;        VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
+<div class="line"><a name="l04828"></a><span class="lineno"> 4828</span>&#160;        <span class="keywordflow">return</span> m_pArray[index];</div>
+<div class="line"><a name="l04829"></a><span class="lineno"> 4829</span>&#160;    }</div>
+<div class="line"><a name="l04830"></a><span class="lineno"> 4830</span>&#160; </div>
+<div class="line"><a name="l04831"></a><span class="lineno"> 4831</span>&#160;    T&amp; front()</div>
+<div class="line"><a name="l04832"></a><span class="lineno"> 4832</span>&#160;    {</div>
+<div class="line"><a name="l04833"></a><span class="lineno"> 4833</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l04834"></a><span class="lineno"> 4834</span>&#160;        <span class="keywordflow">return</span> m_pArray[0];</div>
+<div class="line"><a name="l04835"></a><span class="lineno"> 4835</span>&#160;    }</div>
+<div class="line"><a name="l04836"></a><span class="lineno"> 4836</span>&#160;    <span class="keyword">const</span> T&amp; front()<span class="keyword"> const</span></div>
+<div class="line"><a name="l04837"></a><span class="lineno"> 4837</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l04838"></a><span class="lineno"> 4838</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l04839"></a><span class="lineno"> 4839</span>&#160;        <span class="keywordflow">return</span> m_pArray[0];</div>
+<div class="line"><a name="l04840"></a><span class="lineno"> 4840</span>&#160;    }</div>
+<div class="line"><a name="l04841"></a><span class="lineno"> 4841</span>&#160;    T&amp; back()</div>
+<div class="line"><a name="l04842"></a><span class="lineno"> 4842</span>&#160;    {</div>
+<div class="line"><a name="l04843"></a><span class="lineno"> 4843</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l04844"></a><span class="lineno"> 4844</span>&#160;        <span class="keywordflow">return</span> m_pArray[m_Count - 1];</div>
+<div class="line"><a name="l04845"></a><span class="lineno"> 4845</span>&#160;    }</div>
+<div class="line"><a name="l04846"></a><span class="lineno"> 4846</span>&#160;    <span class="keyword">const</span> T&amp; back()<span class="keyword"> const</span></div>
+<div class="line"><a name="l04847"></a><span class="lineno"> 4847</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l04848"></a><span class="lineno"> 4848</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l04849"></a><span class="lineno"> 4849</span>&#160;        <span class="keywordflow">return</span> m_pArray[m_Count - 1];</div>
+<div class="line"><a name="l04850"></a><span class="lineno"> 4850</span>&#160;    }</div>
+<div class="line"><a name="l04851"></a><span class="lineno"> 4851</span>&#160; </div>
+<div class="line"><a name="l04852"></a><span class="lineno"> 4852</span>&#160;    <span class="keywordtype">void</span> reserve(<span class="keywordtype">size_t</span> newCapacity, <span class="keywordtype">bool</span> freeMemory = <span class="keyword">false</span>)</div>
+<div class="line"><a name="l04853"></a><span class="lineno"> 4853</span>&#160;    {</div>
+<div class="line"><a name="l04854"></a><span class="lineno"> 4854</span>&#160;        newCapacity = VMA_MAX(newCapacity, m_Count);</div>
+<div class="line"><a name="l04855"></a><span class="lineno"> 4855</span>&#160;        </div>
+<div class="line"><a name="l04856"></a><span class="lineno"> 4856</span>&#160;        <span class="keywordflow">if</span>((newCapacity &lt; m_Capacity) &amp;&amp; !freeMemory)</div>
+<div class="line"><a name="l04857"></a><span class="lineno"> 4857</span>&#160;        {</div>
+<div class="line"><a name="l04858"></a><span class="lineno"> 4858</span>&#160;            newCapacity = m_Capacity;</div>
+<div class="line"><a name="l04859"></a><span class="lineno"> 4859</span>&#160;        }</div>
+<div class="line"><a name="l04860"></a><span class="lineno"> 4860</span>&#160;        </div>
+<div class="line"><a name="l04861"></a><span class="lineno"> 4861</span>&#160;        <span class="keywordflow">if</span>(newCapacity != m_Capacity)</div>
+<div class="line"><a name="l04862"></a><span class="lineno"> 4862</span>&#160;        {</div>
+<div class="line"><a name="l04863"></a><span class="lineno"> 4863</span>&#160;            T* <span class="keyword">const</span> newArray = newCapacity ? VmaAllocateArray&lt;T&gt;(m_Allocator, newCapacity) : VMA_NULL;</div>
+<div class="line"><a name="l04864"></a><span class="lineno"> 4864</span>&#160;            <span class="keywordflow">if</span>(m_Count != 0)</div>
+<div class="line"><a name="l04865"></a><span class="lineno"> 4865</span>&#160;            {</div>
+<div class="line"><a name="l04866"></a><span class="lineno"> 4866</span>&#160;                memcpy(newArray, m_pArray, m_Count * <span class="keyword">sizeof</span>(T));</div>
+<div class="line"><a name="l04867"></a><span class="lineno"> 4867</span>&#160;            }</div>
+<div class="line"><a name="l04868"></a><span class="lineno"> 4868</span>&#160;            VmaFree(m_Allocator.m_pCallbacks, m_pArray);</div>
+<div class="line"><a name="l04869"></a><span class="lineno"> 4869</span>&#160;            m_Capacity = newCapacity;</div>
+<div class="line"><a name="l04870"></a><span class="lineno"> 4870</span>&#160;            m_pArray = newArray;</div>
+<div class="line"><a name="l04871"></a><span class="lineno"> 4871</span>&#160;        }</div>
+<div class="line"><a name="l04872"></a><span class="lineno"> 4872</span>&#160;    }</div>
+<div class="line"><a name="l04873"></a><span class="lineno"> 4873</span>&#160; </div>
+<div class="line"><a name="l04874"></a><span class="lineno"> 4874</span>&#160;    <span class="keywordtype">void</span> resize(<span class="keywordtype">size_t</span> newCount, <span class="keywordtype">bool</span> freeMemory = <span class="keyword">false</span>)</div>
+<div class="line"><a name="l04875"></a><span class="lineno"> 4875</span>&#160;    {</div>
+<div class="line"><a name="l04876"></a><span class="lineno"> 4876</span>&#160;        <span class="keywordtype">size_t</span> newCapacity = m_Capacity;</div>
+<div class="line"><a name="l04877"></a><span class="lineno"> 4877</span>&#160;        <span class="keywordflow">if</span>(newCount &gt; m_Capacity)</div>
+<div class="line"><a name="l04878"></a><span class="lineno"> 4878</span>&#160;        {</div>
+<div class="line"><a name="l04879"></a><span class="lineno"> 4879</span>&#160;            newCapacity = VMA_MAX(newCount, VMA_MAX(m_Capacity * 3 / 2, (<span class="keywordtype">size_t</span>)8));</div>
+<div class="line"><a name="l04880"></a><span class="lineno"> 4880</span>&#160;        }</div>
+<div class="line"><a name="l04881"></a><span class="lineno"> 4881</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(freeMemory)</div>
+<div class="line"><a name="l04882"></a><span class="lineno"> 4882</span>&#160;        {</div>
+<div class="line"><a name="l04883"></a><span class="lineno"> 4883</span>&#160;            newCapacity = newCount;</div>
+<div class="line"><a name="l04884"></a><span class="lineno"> 4884</span>&#160;        }</div>
+<div class="line"><a name="l04885"></a><span class="lineno"> 4885</span>&#160; </div>
+<div class="line"><a name="l04886"></a><span class="lineno"> 4886</span>&#160;        <span class="keywordflow">if</span>(newCapacity != m_Capacity)</div>
+<div class="line"><a name="l04887"></a><span class="lineno"> 4887</span>&#160;        {</div>
+<div class="line"><a name="l04888"></a><span class="lineno"> 4888</span>&#160;            T* <span class="keyword">const</span> newArray = newCapacity ? VmaAllocateArray&lt;T&gt;(m_Allocator.m_pCallbacks, newCapacity) : VMA_NULL;</div>
+<div class="line"><a name="l04889"></a><span class="lineno"> 4889</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> elementsToCopy = VMA_MIN(m_Count, newCount);</div>
+<div class="line"><a name="l04890"></a><span class="lineno"> 4890</span>&#160;            <span class="keywordflow">if</span>(elementsToCopy != 0)</div>
+<div class="line"><a name="l04891"></a><span class="lineno"> 4891</span>&#160;            {</div>
+<div class="line"><a name="l04892"></a><span class="lineno"> 4892</span>&#160;                memcpy(newArray, m_pArray, elementsToCopy * <span class="keyword">sizeof</span>(T));</div>
+<div class="line"><a name="l04893"></a><span class="lineno"> 4893</span>&#160;            }</div>
+<div class="line"><a name="l04894"></a><span class="lineno"> 4894</span>&#160;            VmaFree(m_Allocator.m_pCallbacks, m_pArray);</div>
+<div class="line"><a name="l04895"></a><span class="lineno"> 4895</span>&#160;            m_Capacity = newCapacity;</div>
+<div class="line"><a name="l04896"></a><span class="lineno"> 4896</span>&#160;            m_pArray = newArray;</div>
+<div class="line"><a name="l04897"></a><span class="lineno"> 4897</span>&#160;        }</div>
 <div class="line"><a name="l04898"></a><span class="lineno"> 4898</span>&#160; </div>
-<div class="line"><a name="l04899"></a><span class="lineno"> 4899</span>&#160;    <span class="keywordtype">void</span> pop_front()</div>
-<div class="line"><a name="l04900"></a><span class="lineno"> 4900</span>&#160;    {</div>
-<div class="line"><a name="l04901"></a><span class="lineno"> 4901</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
-<div class="line"><a name="l04902"></a><span class="lineno"> 4902</span>&#160;        remove(0);</div>
-<div class="line"><a name="l04903"></a><span class="lineno"> 4903</span>&#160;    }</div>
-<div class="line"><a name="l04904"></a><span class="lineno"> 4904</span>&#160; </div>
-<div class="line"><a name="l04905"></a><span class="lineno"> 4905</span>&#160;    <span class="keyword">typedef</span> T* iterator;</div>
+<div class="line"><a name="l04899"></a><span class="lineno"> 4899</span>&#160;        m_Count = newCount;</div>
+<div class="line"><a name="l04900"></a><span class="lineno"> 4900</span>&#160;    }</div>
+<div class="line"><a name="l04901"></a><span class="lineno"> 4901</span>&#160; </div>
+<div class="line"><a name="l04902"></a><span class="lineno"> 4902</span>&#160;    <span class="keywordtype">void</span> clear(<span class="keywordtype">bool</span> freeMemory = <span class="keyword">false</span>)</div>
+<div class="line"><a name="l04903"></a><span class="lineno"> 4903</span>&#160;    {</div>
+<div class="line"><a name="l04904"></a><span class="lineno"> 4904</span>&#160;        resize(0, freeMemory);</div>
+<div class="line"><a name="l04905"></a><span class="lineno"> 4905</span>&#160;    }</div>
 <div class="line"><a name="l04906"></a><span class="lineno"> 4906</span>&#160; </div>
-<div class="line"><a name="l04907"></a><span class="lineno"> 4907</span>&#160;    iterator begin() { <span class="keywordflow">return</span> m_pArray; }</div>
-<div class="line"><a name="l04908"></a><span class="lineno"> 4908</span>&#160;    iterator end() { <span class="keywordflow">return</span> m_pArray + m_Count; }</div>
-<div class="line"><a name="l04909"></a><span class="lineno"> 4909</span>&#160; </div>
-<div class="line"><a name="l04910"></a><span class="lineno"> 4910</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l04911"></a><span class="lineno"> 4911</span>&#160;    AllocatorT m_Allocator;</div>
-<div class="line"><a name="l04912"></a><span class="lineno"> 4912</span>&#160;    T* m_pArray;</div>
-<div class="line"><a name="l04913"></a><span class="lineno"> 4913</span>&#160;    <span class="keywordtype">size_t</span> m_Count;</div>
-<div class="line"><a name="l04914"></a><span class="lineno"> 4914</span>&#160;    <span class="keywordtype">size_t</span> m_Capacity;</div>
-<div class="line"><a name="l04915"></a><span class="lineno"> 4915</span>&#160;};</div>
-<div class="line"><a name="l04916"></a><span class="lineno"> 4916</span>&#160; </div>
-<div class="line"><a name="l04917"></a><span class="lineno"> 4917</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
-<div class="line"><a name="l04918"></a><span class="lineno"> 4918</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorInsert(VmaVector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index, <span class="keyword">const</span> T&amp; item)</div>
-<div class="line"><a name="l04919"></a><span class="lineno"> 4919</span>&#160;{</div>
-<div class="line"><a name="l04920"></a><span class="lineno"> 4920</span>&#160;    vec.insert(index, item);</div>
-<div class="line"><a name="l04921"></a><span class="lineno"> 4921</span>&#160;}</div>
-<div class="line"><a name="l04922"></a><span class="lineno"> 4922</span>&#160; </div>
-<div class="line"><a name="l04923"></a><span class="lineno"> 4923</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
-<div class="line"><a name="l04924"></a><span class="lineno"> 4924</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorRemove(VmaVector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index)</div>
-<div class="line"><a name="l04925"></a><span class="lineno"> 4925</span>&#160;{</div>
-<div class="line"><a name="l04926"></a><span class="lineno"> 4926</span>&#160;    vec.remove(index);</div>
-<div class="line"><a name="l04927"></a><span class="lineno"> 4927</span>&#160;}</div>
-<div class="line"><a name="l04928"></a><span class="lineno"> 4928</span>&#160; </div>
-<div class="line"><a name="l04929"></a><span class="lineno"> 4929</span>&#160;<span class="preprocessor">#endif // #if VMA_USE_STL_VECTOR</span></div>
-<div class="line"><a name="l04930"></a><span class="lineno"> 4930</span>&#160; </div>
-<div class="line"><a name="l04931"></a><span class="lineno"> 4931</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> VectorT&gt;</div>
-<div class="line"><a name="l04932"></a><span class="lineno"> 4932</span>&#160;<span class="keywordtype">size_t</span> VmaVectorInsertSorted(VectorT&amp; vector, <span class="keyword">const</span> <span class="keyword">typename</span> VectorT::value_type&amp; value)</div>
-<div class="line"><a name="l04933"></a><span class="lineno"> 4933</span>&#160;{</div>
-<div class="line"><a name="l04934"></a><span class="lineno"> 4934</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> indexToInsert = VmaBinaryFindFirstNotLess(</div>
-<div class="line"><a name="l04935"></a><span class="lineno"> 4935</span>&#160;        vector.data(),</div>
-<div class="line"><a name="l04936"></a><span class="lineno"> 4936</span>&#160;        vector.data() + vector.size(),</div>
-<div class="line"><a name="l04937"></a><span class="lineno"> 4937</span>&#160;        value,</div>
-<div class="line"><a name="l04938"></a><span class="lineno"> 4938</span>&#160;        CmpLess()) - vector.data();</div>
-<div class="line"><a name="l04939"></a><span class="lineno"> 4939</span>&#160;    VmaVectorInsert(vector, indexToInsert, value);</div>
-<div class="line"><a name="l04940"></a><span class="lineno"> 4940</span>&#160;    <span class="keywordflow">return</span> indexToInsert;</div>
-<div class="line"><a name="l04941"></a><span class="lineno"> 4941</span>&#160;}</div>
+<div class="line"><a name="l04907"></a><span class="lineno"> 4907</span>&#160;    <span class="keywordtype">void</span> insert(<span class="keywordtype">size_t</span> index, <span class="keyword">const</span> T&amp; src)</div>
+<div class="line"><a name="l04908"></a><span class="lineno"> 4908</span>&#160;    {</div>
+<div class="line"><a name="l04909"></a><span class="lineno"> 4909</span>&#160;        VMA_HEAVY_ASSERT(index &lt;= m_Count);</div>
+<div class="line"><a name="l04910"></a><span class="lineno"> 4910</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> oldCount = size();</div>
+<div class="line"><a name="l04911"></a><span class="lineno"> 4911</span>&#160;        resize(oldCount + 1);</div>
+<div class="line"><a name="l04912"></a><span class="lineno"> 4912</span>&#160;        <span class="keywordflow">if</span>(index &lt; oldCount)</div>
+<div class="line"><a name="l04913"></a><span class="lineno"> 4913</span>&#160;        {</div>
+<div class="line"><a name="l04914"></a><span class="lineno"> 4914</span>&#160;            memmove(m_pArray + (index + 1), m_pArray + index, (oldCount - index) * <span class="keyword">sizeof</span>(T));</div>
+<div class="line"><a name="l04915"></a><span class="lineno"> 4915</span>&#160;        }</div>
+<div class="line"><a name="l04916"></a><span class="lineno"> 4916</span>&#160;        m_pArray[index] = src;</div>
+<div class="line"><a name="l04917"></a><span class="lineno"> 4917</span>&#160;    }</div>
+<div class="line"><a name="l04918"></a><span class="lineno"> 4918</span>&#160; </div>
+<div class="line"><a name="l04919"></a><span class="lineno"> 4919</span>&#160;    <span class="keywordtype">void</span> remove(<span class="keywordtype">size_t</span> index)</div>
+<div class="line"><a name="l04920"></a><span class="lineno"> 4920</span>&#160;    {</div>
+<div class="line"><a name="l04921"></a><span class="lineno"> 4921</span>&#160;        VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
+<div class="line"><a name="l04922"></a><span class="lineno"> 4922</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> oldCount = size();</div>
+<div class="line"><a name="l04923"></a><span class="lineno"> 4923</span>&#160;        <span class="keywordflow">if</span>(index &lt; oldCount - 1)</div>
+<div class="line"><a name="l04924"></a><span class="lineno"> 4924</span>&#160;        {</div>
+<div class="line"><a name="l04925"></a><span class="lineno"> 4925</span>&#160;            memmove(m_pArray + index, m_pArray + (index + 1), (oldCount - index - 1) * <span class="keyword">sizeof</span>(T));</div>
+<div class="line"><a name="l04926"></a><span class="lineno"> 4926</span>&#160;        }</div>
+<div class="line"><a name="l04927"></a><span class="lineno"> 4927</span>&#160;        resize(oldCount - 1);</div>
+<div class="line"><a name="l04928"></a><span class="lineno"> 4928</span>&#160;    }</div>
+<div class="line"><a name="l04929"></a><span class="lineno"> 4929</span>&#160; </div>
+<div class="line"><a name="l04930"></a><span class="lineno"> 4930</span>&#160;    <span class="keywordtype">void</span> push_back(<span class="keyword">const</span> T&amp; src)</div>
+<div class="line"><a name="l04931"></a><span class="lineno"> 4931</span>&#160;    {</div>
+<div class="line"><a name="l04932"></a><span class="lineno"> 4932</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> newIndex = size();</div>
+<div class="line"><a name="l04933"></a><span class="lineno"> 4933</span>&#160;        resize(newIndex + 1);</div>
+<div class="line"><a name="l04934"></a><span class="lineno"> 4934</span>&#160;        m_pArray[newIndex] = src;</div>
+<div class="line"><a name="l04935"></a><span class="lineno"> 4935</span>&#160;    }</div>
+<div class="line"><a name="l04936"></a><span class="lineno"> 4936</span>&#160; </div>
+<div class="line"><a name="l04937"></a><span class="lineno"> 4937</span>&#160;    <span class="keywordtype">void</span> pop_back()</div>
+<div class="line"><a name="l04938"></a><span class="lineno"> 4938</span>&#160;    {</div>
+<div class="line"><a name="l04939"></a><span class="lineno"> 4939</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l04940"></a><span class="lineno"> 4940</span>&#160;        resize(size() - 1);</div>
+<div class="line"><a name="l04941"></a><span class="lineno"> 4941</span>&#160;    }</div>
 <div class="line"><a name="l04942"></a><span class="lineno"> 4942</span>&#160; </div>
-<div class="line"><a name="l04943"></a><span class="lineno"> 4943</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> VectorT&gt;</div>
-<div class="line"><a name="l04944"></a><span class="lineno"> 4944</span>&#160;<span class="keywordtype">bool</span> VmaVectorRemoveSorted(VectorT&amp; vector, <span class="keyword">const</span> <span class="keyword">typename</span> VectorT::value_type&amp; value)</div>
-<div class="line"><a name="l04945"></a><span class="lineno"> 4945</span>&#160;{</div>
-<div class="line"><a name="l04946"></a><span class="lineno"> 4946</span>&#160;    CmpLess comparator;</div>
-<div class="line"><a name="l04947"></a><span class="lineno"> 4947</span>&#160;    <span class="keyword">typename</span> VectorT::iterator it = VmaBinaryFindFirstNotLess(</div>
-<div class="line"><a name="l04948"></a><span class="lineno"> 4948</span>&#160;        vector.begin(),</div>
-<div class="line"><a name="l04949"></a><span class="lineno"> 4949</span>&#160;        vector.end(),</div>
-<div class="line"><a name="l04950"></a><span class="lineno"> 4950</span>&#160;        value,</div>
-<div class="line"><a name="l04951"></a><span class="lineno"> 4951</span>&#160;        comparator);</div>
-<div class="line"><a name="l04952"></a><span class="lineno"> 4952</span>&#160;    <span class="keywordflow">if</span>((it != vector.end()) &amp;&amp; !comparator(*it, value) &amp;&amp; !comparator(value, *it))</div>
-<div class="line"><a name="l04953"></a><span class="lineno"> 4953</span>&#160;    {</div>
-<div class="line"><a name="l04954"></a><span class="lineno"> 4954</span>&#160;        <span class="keywordtype">size_t</span> indexToRemove = it - vector.begin();</div>
-<div class="line"><a name="l04955"></a><span class="lineno"> 4955</span>&#160;        VmaVectorRemove(vector, indexToRemove);</div>
-<div class="line"><a name="l04956"></a><span class="lineno"> 4956</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l04957"></a><span class="lineno"> 4957</span>&#160;    }</div>
-<div class="line"><a name="l04958"></a><span class="lineno"> 4958</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l04959"></a><span class="lineno"> 4959</span>&#160;}</div>
-<div class="line"><a name="l04960"></a><span class="lineno"> 4960</span>&#160; </div>
-<div class="line"><a name="l04962"></a><span class="lineno"> 4962</span>&#160;<span class="comment">// class VmaPoolAllocator</span></div>
-<div class="line"><a name="l04963"></a><span class="lineno"> 4963</span>&#160; </div>
-<div class="line"><a name="l04964"></a><span class="lineno"> 4964</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l04965"></a><span class="lineno"> 4965</span>&#160;<span class="comment">Allocator for objects of type T using a list of arrays (pools) to speed up</span></div>
-<div class="line"><a name="l04966"></a><span class="lineno"> 4966</span>&#160;<span class="comment">allocation. Number of elements that can be allocated is not bounded because</span></div>
-<div class="line"><a name="l04967"></a><span class="lineno"> 4967</span>&#160;<span class="comment">allocator can create multiple blocks.</span></div>
-<div class="line"><a name="l04968"></a><span class="lineno"> 4968</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l04969"></a><span class="lineno"> 4969</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l04970"></a><span class="lineno"> 4970</span>&#160;<span class="keyword">class </span>VmaPoolAllocator</div>
-<div class="line"><a name="l04971"></a><span class="lineno"> 4971</span>&#160;{</div>
-<div class="line"><a name="l04972"></a><span class="lineno"> 4972</span>&#160;    VMA_CLASS_NO_COPY(VmaPoolAllocator)</div>
-<div class="line"><a name="l04973"></a><span class="lineno"> 4973</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l04974"></a><span class="lineno"> 4974</span>&#160;    VmaPoolAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, uint32_t firstBlockCapacity);</div>
-<div class="line"><a name="l04975"></a><span class="lineno"> 4975</span>&#160;    ~VmaPoolAllocator();</div>
-<div class="line"><a name="l04976"></a><span class="lineno"> 4976</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span>... Types&gt; T* Alloc(Types... args);</div>
-<div class="line"><a name="l04977"></a><span class="lineno"> 4977</span>&#160;    <span class="keywordtype">void</span> Free(T* ptr);</div>
-<div class="line"><a name="l04978"></a><span class="lineno"> 4978</span>&#160; </div>
-<div class="line"><a name="l04979"></a><span class="lineno"> 4979</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l04980"></a><span class="lineno"> 4980</span>&#160;    <span class="keyword">union </span>Item</div>
-<div class="line"><a name="l04981"></a><span class="lineno"> 4981</span>&#160;    {</div>
-<div class="line"><a name="l04982"></a><span class="lineno"> 4982</span>&#160;        uint32_t NextFreeIndex;</div>
-<div class="line"><a name="l04983"></a><span class="lineno"> 4983</span>&#160;        <span class="keyword">alignas</span>(T) <span class="keywordtype">char</span> Value[<span class="keyword">sizeof</span>(T)];</div>
-<div class="line"><a name="l04984"></a><span class="lineno"> 4984</span>&#160;    };</div>
-<div class="line"><a name="l04985"></a><span class="lineno"> 4985</span>&#160; </div>
-<div class="line"><a name="l04986"></a><span class="lineno"> 4986</span>&#160;    <span class="keyword">struct </span>ItemBlock</div>
-<div class="line"><a name="l04987"></a><span class="lineno"> 4987</span>&#160;    {</div>
-<div class="line"><a name="l04988"></a><span class="lineno"> 4988</span>&#160;        Item* pItems;</div>
-<div class="line"><a name="l04989"></a><span class="lineno"> 4989</span>&#160;        uint32_t Capacity;</div>
-<div class="line"><a name="l04990"></a><span class="lineno"> 4990</span>&#160;        uint32_t FirstFreeIndex;</div>
-<div class="line"><a name="l04991"></a><span class="lineno"> 4991</span>&#160;    };</div>
-<div class="line"><a name="l04992"></a><span class="lineno"> 4992</span>&#160;    </div>
-<div class="line"><a name="l04993"></a><span class="lineno"> 4993</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* m_pAllocationCallbacks;</div>
-<div class="line"><a name="l04994"></a><span class="lineno"> 4994</span>&#160;    <span class="keyword">const</span> uint32_t m_FirstBlockCapacity;</div>
-<div class="line"><a name="l04995"></a><span class="lineno"> 4995</span>&#160;    VmaVector&lt; ItemBlock, VmaStlAllocator&lt;ItemBlock&gt; &gt; m_ItemBlocks;</div>
-<div class="line"><a name="l04996"></a><span class="lineno"> 4996</span>&#160; </div>
-<div class="line"><a name="l04997"></a><span class="lineno"> 4997</span>&#160;    ItemBlock&amp; CreateNewBlock();</div>
-<div class="line"><a name="l04998"></a><span class="lineno"> 4998</span>&#160;};</div>
-<div class="line"><a name="l04999"></a><span class="lineno"> 4999</span>&#160; </div>
-<div class="line"><a name="l05000"></a><span class="lineno"> 5000</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05001"></a><span class="lineno"> 5001</span>&#160;VmaPoolAllocator&lt;T&gt;::VmaPoolAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, uint32_t firstBlockCapacity) :</div>
-<div class="line"><a name="l05002"></a><span class="lineno"> 5002</span>&#160;    m_pAllocationCallbacks(pAllocationCallbacks),</div>
-<div class="line"><a name="l05003"></a><span class="lineno"> 5003</span>&#160;    m_FirstBlockCapacity(firstBlockCapacity),</div>
-<div class="line"><a name="l05004"></a><span class="lineno"> 5004</span>&#160;    m_ItemBlocks(VmaStlAllocator&lt;ItemBlock&gt;(pAllocationCallbacks))</div>
-<div class="line"><a name="l05005"></a><span class="lineno"> 5005</span>&#160;{</div>
-<div class="line"><a name="l05006"></a><span class="lineno"> 5006</span>&#160;    VMA_ASSERT(m_FirstBlockCapacity &gt; 1);</div>
-<div class="line"><a name="l05007"></a><span class="lineno"> 5007</span>&#160;}</div>
-<div class="line"><a name="l05008"></a><span class="lineno"> 5008</span>&#160; </div>
-<div class="line"><a name="l05009"></a><span class="lineno"> 5009</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05010"></a><span class="lineno"> 5010</span>&#160;VmaPoolAllocator&lt;T&gt;::~VmaPoolAllocator()</div>
-<div class="line"><a name="l05011"></a><span class="lineno"> 5011</span>&#160;{</div>
-<div class="line"><a name="l05012"></a><span class="lineno"> 5012</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_ItemBlocks.size(); i--; )</div>
-<div class="line"><a name="l05013"></a><span class="lineno"> 5013</span>&#160;        vma_delete_array(m_pAllocationCallbacks, m_ItemBlocks[i].pItems, m_ItemBlocks[i].Capacity);</div>
-<div class="line"><a name="l05014"></a><span class="lineno"> 5014</span>&#160;    m_ItemBlocks.clear();</div>
-<div class="line"><a name="l05015"></a><span class="lineno"> 5015</span>&#160;}</div>
-<div class="line"><a name="l05016"></a><span class="lineno"> 5016</span>&#160; </div>
-<div class="line"><a name="l05017"></a><span class="lineno"> 5017</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05018"></a><span class="lineno"> 5018</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span>... Types&gt; T* VmaPoolAllocator&lt;T&gt;::Alloc(Types... args)</div>
-<div class="line"><a name="l05019"></a><span class="lineno"> 5019</span>&#160;{</div>
-<div class="line"><a name="l05020"></a><span class="lineno"> 5020</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_ItemBlocks.size(); i--; )</div>
-<div class="line"><a name="l05021"></a><span class="lineno"> 5021</span>&#160;    {</div>
-<div class="line"><a name="l05022"></a><span class="lineno"> 5022</span>&#160;        ItemBlock&amp; block = m_ItemBlocks[i];</div>
-<div class="line"><a name="l05023"></a><span class="lineno"> 5023</span>&#160;        <span class="comment">// This block has some free items: Use first one.</span></div>
-<div class="line"><a name="l05024"></a><span class="lineno"> 5024</span>&#160;        <span class="keywordflow">if</span>(block.FirstFreeIndex != UINT32_MAX)</div>
-<div class="line"><a name="l05025"></a><span class="lineno"> 5025</span>&#160;        {</div>
-<div class="line"><a name="l05026"></a><span class="lineno"> 5026</span>&#160;            Item* <span class="keyword">const</span> pItem = &amp;block.pItems[block.FirstFreeIndex];</div>
-<div class="line"><a name="l05027"></a><span class="lineno"> 5027</span>&#160;            block.FirstFreeIndex = pItem-&gt;NextFreeIndex;</div>
-<div class="line"><a name="l05028"></a><span class="lineno"> 5028</span>&#160;            T* result = (T*)&amp;pItem-&gt;Value;</div>
-<div class="line"><a name="l05029"></a><span class="lineno"> 5029</span>&#160;            <span class="keyword">new</span>(result)T(std::forward&lt;Types&gt;(args)...); <span class="comment">// Explicit constructor call.</span></div>
-<div class="line"><a name="l05030"></a><span class="lineno"> 5030</span>&#160;            <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l05031"></a><span class="lineno"> 5031</span>&#160;        }</div>
-<div class="line"><a name="l05032"></a><span class="lineno"> 5032</span>&#160;    }</div>
-<div class="line"><a name="l05033"></a><span class="lineno"> 5033</span>&#160; </div>
-<div class="line"><a name="l05034"></a><span class="lineno"> 5034</span>&#160;    <span class="comment">// No block has free item: Create new one and use it.</span></div>
-<div class="line"><a name="l05035"></a><span class="lineno"> 5035</span>&#160;    ItemBlock&amp; newBlock = CreateNewBlock();</div>
-<div class="line"><a name="l05036"></a><span class="lineno"> 5036</span>&#160;    Item* <span class="keyword">const</span> pItem = &amp;newBlock.pItems[0];</div>
-<div class="line"><a name="l05037"></a><span class="lineno"> 5037</span>&#160;    newBlock.FirstFreeIndex = pItem-&gt;NextFreeIndex;</div>
-<div class="line"><a name="l05038"></a><span class="lineno"> 5038</span>&#160;    T* result = (T*)&amp;pItem-&gt;Value;</div>
-<div class="line"><a name="l05039"></a><span class="lineno"> 5039</span>&#160;    <span class="keyword">new</span>(result)T(std::forward&lt;Types&gt;(args)...); <span class="comment">// Explicit constructor call.</span></div>
-<div class="line"><a name="l05040"></a><span class="lineno"> 5040</span>&#160;    <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l05041"></a><span class="lineno"> 5041</span>&#160;}</div>
-<div class="line"><a name="l05042"></a><span class="lineno"> 5042</span>&#160; </div>
-<div class="line"><a name="l05043"></a><span class="lineno"> 5043</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05044"></a><span class="lineno"> 5044</span>&#160;<span class="keywordtype">void</span> VmaPoolAllocator&lt;T&gt;::Free(T* ptr)</div>
-<div class="line"><a name="l05045"></a><span class="lineno"> 5045</span>&#160;{</div>
-<div class="line"><a name="l05046"></a><span class="lineno"> 5046</span>&#160;    <span class="comment">// Search all memory blocks to find ptr.</span></div>
-<div class="line"><a name="l05047"></a><span class="lineno"> 5047</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_ItemBlocks.size(); i--; )</div>
+<div class="line"><a name="l04943"></a><span class="lineno"> 4943</span>&#160;    <span class="keywordtype">void</span> push_front(<span class="keyword">const</span> T&amp; src)</div>
+<div class="line"><a name="l04944"></a><span class="lineno"> 4944</span>&#160;    {</div>
+<div class="line"><a name="l04945"></a><span class="lineno"> 4945</span>&#160;        insert(0, src);</div>
+<div class="line"><a name="l04946"></a><span class="lineno"> 4946</span>&#160;    }</div>
+<div class="line"><a name="l04947"></a><span class="lineno"> 4947</span>&#160; </div>
+<div class="line"><a name="l04948"></a><span class="lineno"> 4948</span>&#160;    <span class="keywordtype">void</span> pop_front()</div>
+<div class="line"><a name="l04949"></a><span class="lineno"> 4949</span>&#160;    {</div>
+<div class="line"><a name="l04950"></a><span class="lineno"> 4950</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l04951"></a><span class="lineno"> 4951</span>&#160;        remove(0);</div>
+<div class="line"><a name="l04952"></a><span class="lineno"> 4952</span>&#160;    }</div>
+<div class="line"><a name="l04953"></a><span class="lineno"> 4953</span>&#160; </div>
+<div class="line"><a name="l04954"></a><span class="lineno"> 4954</span>&#160;    <span class="keyword">typedef</span> T* iterator;</div>
+<div class="line"><a name="l04955"></a><span class="lineno"> 4955</span>&#160; </div>
+<div class="line"><a name="l04956"></a><span class="lineno"> 4956</span>&#160;    iterator begin() { <span class="keywordflow">return</span> m_pArray; }</div>
+<div class="line"><a name="l04957"></a><span class="lineno"> 4957</span>&#160;    iterator end() { <span class="keywordflow">return</span> m_pArray + m_Count; }</div>
+<div class="line"><a name="l04958"></a><span class="lineno"> 4958</span>&#160; </div>
+<div class="line"><a name="l04959"></a><span class="lineno"> 4959</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l04960"></a><span class="lineno"> 4960</span>&#160;    AllocatorT m_Allocator;</div>
+<div class="line"><a name="l04961"></a><span class="lineno"> 4961</span>&#160;    T* m_pArray;</div>
+<div class="line"><a name="l04962"></a><span class="lineno"> 4962</span>&#160;    <span class="keywordtype">size_t</span> m_Count;</div>
+<div class="line"><a name="l04963"></a><span class="lineno"> 4963</span>&#160;    <span class="keywordtype">size_t</span> m_Capacity;</div>
+<div class="line"><a name="l04964"></a><span class="lineno"> 4964</span>&#160;};</div>
+<div class="line"><a name="l04965"></a><span class="lineno"> 4965</span>&#160; </div>
+<div class="line"><a name="l04966"></a><span class="lineno"> 4966</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
+<div class="line"><a name="l04967"></a><span class="lineno"> 4967</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorInsert(VmaVector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index, <span class="keyword">const</span> T&amp; item)</div>
+<div class="line"><a name="l04968"></a><span class="lineno"> 4968</span>&#160;{</div>
+<div class="line"><a name="l04969"></a><span class="lineno"> 4969</span>&#160;    vec.insert(index, item);</div>
+<div class="line"><a name="l04970"></a><span class="lineno"> 4970</span>&#160;}</div>
+<div class="line"><a name="l04971"></a><span class="lineno"> 4971</span>&#160; </div>
+<div class="line"><a name="l04972"></a><span class="lineno"> 4972</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
+<div class="line"><a name="l04973"></a><span class="lineno"> 4973</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorRemove(VmaVector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index)</div>
+<div class="line"><a name="l04974"></a><span class="lineno"> 4974</span>&#160;{</div>
+<div class="line"><a name="l04975"></a><span class="lineno"> 4975</span>&#160;    vec.remove(index);</div>
+<div class="line"><a name="l04976"></a><span class="lineno"> 4976</span>&#160;}</div>
+<div class="line"><a name="l04977"></a><span class="lineno"> 4977</span>&#160; </div>
+<div class="line"><a name="l04978"></a><span class="lineno"> 4978</span>&#160;<span class="preprocessor">#endif // #if VMA_USE_STL_VECTOR</span></div>
+<div class="line"><a name="l04979"></a><span class="lineno"> 4979</span>&#160; </div>
+<div class="line"><a name="l04980"></a><span class="lineno"> 4980</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> VectorT&gt;</div>
+<div class="line"><a name="l04981"></a><span class="lineno"> 4981</span>&#160;<span class="keywordtype">size_t</span> VmaVectorInsertSorted(VectorT&amp; vector, <span class="keyword">const</span> <span class="keyword">typename</span> VectorT::value_type&amp; value)</div>
+<div class="line"><a name="l04982"></a><span class="lineno"> 4982</span>&#160;{</div>
+<div class="line"><a name="l04983"></a><span class="lineno"> 4983</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> indexToInsert = VmaBinaryFindFirstNotLess(</div>
+<div class="line"><a name="l04984"></a><span class="lineno"> 4984</span>&#160;        vector.data(),</div>
+<div class="line"><a name="l04985"></a><span class="lineno"> 4985</span>&#160;        vector.data() + vector.size(),</div>
+<div class="line"><a name="l04986"></a><span class="lineno"> 4986</span>&#160;        value,</div>
+<div class="line"><a name="l04987"></a><span class="lineno"> 4987</span>&#160;        CmpLess()) - vector.data();</div>
+<div class="line"><a name="l04988"></a><span class="lineno"> 4988</span>&#160;    VmaVectorInsert(vector, indexToInsert, value);</div>
+<div class="line"><a name="l04989"></a><span class="lineno"> 4989</span>&#160;    <span class="keywordflow">return</span> indexToInsert;</div>
+<div class="line"><a name="l04990"></a><span class="lineno"> 4990</span>&#160;}</div>
+<div class="line"><a name="l04991"></a><span class="lineno"> 4991</span>&#160; </div>
+<div class="line"><a name="l04992"></a><span class="lineno"> 4992</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> VectorT&gt;</div>
+<div class="line"><a name="l04993"></a><span class="lineno"> 4993</span>&#160;<span class="keywordtype">bool</span> VmaVectorRemoveSorted(VectorT&amp; vector, <span class="keyword">const</span> <span class="keyword">typename</span> VectorT::value_type&amp; value)</div>
+<div class="line"><a name="l04994"></a><span class="lineno"> 4994</span>&#160;{</div>
+<div class="line"><a name="l04995"></a><span class="lineno"> 4995</span>&#160;    CmpLess comparator;</div>
+<div class="line"><a name="l04996"></a><span class="lineno"> 4996</span>&#160;    <span class="keyword">typename</span> VectorT::iterator it = VmaBinaryFindFirstNotLess(</div>
+<div class="line"><a name="l04997"></a><span class="lineno"> 4997</span>&#160;        vector.begin(),</div>
+<div class="line"><a name="l04998"></a><span class="lineno"> 4998</span>&#160;        vector.end(),</div>
+<div class="line"><a name="l04999"></a><span class="lineno"> 4999</span>&#160;        value,</div>
+<div class="line"><a name="l05000"></a><span class="lineno"> 5000</span>&#160;        comparator);</div>
+<div class="line"><a name="l05001"></a><span class="lineno"> 5001</span>&#160;    <span class="keywordflow">if</span>((it != vector.end()) &amp;&amp; !comparator(*it, value) &amp;&amp; !comparator(value, *it))</div>
+<div class="line"><a name="l05002"></a><span class="lineno"> 5002</span>&#160;    {</div>
+<div class="line"><a name="l05003"></a><span class="lineno"> 5003</span>&#160;        <span class="keywordtype">size_t</span> indexToRemove = it - vector.begin();</div>
+<div class="line"><a name="l05004"></a><span class="lineno"> 5004</span>&#160;        VmaVectorRemove(vector, indexToRemove);</div>
+<div class="line"><a name="l05005"></a><span class="lineno"> 5005</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l05006"></a><span class="lineno"> 5006</span>&#160;    }</div>
+<div class="line"><a name="l05007"></a><span class="lineno"> 5007</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l05008"></a><span class="lineno"> 5008</span>&#160;}</div>
+<div class="line"><a name="l05009"></a><span class="lineno"> 5009</span>&#160; </div>
+<div class="line"><a name="l05011"></a><span class="lineno"> 5011</span>&#160;<span class="comment">// class VmaSmallVector</span></div>
+<div class="line"><a name="l05012"></a><span class="lineno"> 5012</span>&#160; </div>
+<div class="line"><a name="l05013"></a><span class="lineno"> 5013</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l05014"></a><span class="lineno"> 5014</span>&#160;<span class="comment">This is a vector (a variable-sized array), optimized for the case when the array is small.</span></div>
+<div class="line"><a name="l05015"></a><span class="lineno"> 5015</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l05016"></a><span class="lineno"> 5016</span>&#160;<span class="comment">It contains some number of elements in-place, which allows it to avoid heap allocation</span></div>
+<div class="line"><a name="l05017"></a><span class="lineno"> 5017</span>&#160;<span class="comment">when the actual number of elements is below that threshold. This allows normal &quot;small&quot;</span></div>
+<div class="line"><a name="l05018"></a><span class="lineno"> 5018</span>&#160;<span class="comment">cases to be fast without losing generality for large inputs.</span></div>
+<div class="line"><a name="l05019"></a><span class="lineno"> 5019</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l05020"></a><span class="lineno"> 5020</span>&#160; </div>
+<div class="line"><a name="l05021"></a><span class="lineno"> 5021</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> AllocatorT, <span class="keywordtype">size_t</span> N&gt;</div>
+<div class="line"><a name="l05022"></a><span class="lineno"> 5022</span>&#160;<span class="keyword">class </span>VmaSmallVector</div>
+<div class="line"><a name="l05023"></a><span class="lineno"> 5023</span>&#160;{</div>
+<div class="line"><a name="l05024"></a><span class="lineno"> 5024</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l05025"></a><span class="lineno"> 5025</span>&#160;    <span class="keyword">typedef</span> T value_type;</div>
+<div class="line"><a name="l05026"></a><span class="lineno"> 5026</span>&#160; </div>
+<div class="line"><a name="l05027"></a><span class="lineno"> 5027</span>&#160;    VmaSmallVector(<span class="keyword">const</span> AllocatorT&amp; allocator) :</div>
+<div class="line"><a name="l05028"></a><span class="lineno"> 5028</span>&#160;        m_Count(0),</div>
+<div class="line"><a name="l05029"></a><span class="lineno"> 5029</span>&#160;        m_DynamicArray(allocator)</div>
+<div class="line"><a name="l05030"></a><span class="lineno"> 5030</span>&#160;    {</div>
+<div class="line"><a name="l05031"></a><span class="lineno"> 5031</span>&#160;    }</div>
+<div class="line"><a name="l05032"></a><span class="lineno"> 5032</span>&#160;    VmaSmallVector(<span class="keywordtype">size_t</span> count, <span class="keyword">const</span> AllocatorT&amp; allocator) :</div>
+<div class="line"><a name="l05033"></a><span class="lineno"> 5033</span>&#160;        m_Count(count),</div>
+<div class="line"><a name="l05034"></a><span class="lineno"> 5034</span>&#160;        m_DynamicArray(count &gt; N ? count : 0, allocator)</div>
+<div class="line"><a name="l05035"></a><span class="lineno"> 5035</span>&#160;    {</div>
+<div class="line"><a name="l05036"></a><span class="lineno"> 5036</span>&#160;    }</div>
+<div class="line"><a name="l05037"></a><span class="lineno"> 5037</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> SrcT, <span class="keyword">typename</span> SrcAllocatorT, <span class="keywordtype">size_t</span> SrcN&gt;</div>
+<div class="line"><a name="l05038"></a><span class="lineno"> 5038</span>&#160;    VmaSmallVector(<span class="keyword">const</span> VmaSmallVector&lt;SrcT, SrcAllocatorT, SrcN&gt;&amp; src) = <span class="keyword">delete</span>;</div>
+<div class="line"><a name="l05039"></a><span class="lineno"> 5039</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> SrcT, <span class="keyword">typename</span> SrcAllocatorT, <span class="keywordtype">size_t</span> SrcN&gt;</div>
+<div class="line"><a name="l05040"></a><span class="lineno"> 5040</span>&#160;    VmaSmallVector&lt;T, AllocatorT, N&gt;&amp; operator=(<span class="keyword">const</span> VmaSmallVector&lt;SrcT, SrcAllocatorT, SrcN&gt;&amp; rhs) = <span class="keyword">delete</span>;</div>
+<div class="line"><a name="l05041"></a><span class="lineno"> 5041</span>&#160; </div>
+<div class="line"><a name="l05042"></a><span class="lineno"> 5042</span>&#160;    <span class="keywordtype">bool</span> empty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count == 0; }</div>
+<div class="line"><a name="l05043"></a><span class="lineno"> 5043</span>&#160;    <span class="keywordtype">size_t</span> size()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count; }</div>
+<div class="line"><a name="l05044"></a><span class="lineno"> 5044</span>&#160;    T* data() { <span class="keywordflow">return</span> m_Count &gt; N ? m_DynamicArray.data() : m_StaticArray; }</div>
+<div class="line"><a name="l05045"></a><span class="lineno"> 5045</span>&#160;    <span class="keyword">const</span> T* data()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count &gt; N ? m_DynamicArray.data() : m_StaticArray; }</div>
+<div class="line"><a name="l05046"></a><span class="lineno"> 5046</span>&#160; </div>
+<div class="line"><a name="l05047"></a><span class="lineno"> 5047</span>&#160;    T&amp; operator[](<span class="keywordtype">size_t</span> index)</div>
 <div class="line"><a name="l05048"></a><span class="lineno"> 5048</span>&#160;    {</div>
-<div class="line"><a name="l05049"></a><span class="lineno"> 5049</span>&#160;        ItemBlock&amp; block = m_ItemBlocks[i];</div>
-<div class="line"><a name="l05050"></a><span class="lineno"> 5050</span>&#160;        </div>
-<div class="line"><a name="l05051"></a><span class="lineno"> 5051</span>&#160;        <span class="comment">// Casting to union.</span></div>
-<div class="line"><a name="l05052"></a><span class="lineno"> 5052</span>&#160;        Item* pItemPtr;</div>
-<div class="line"><a name="l05053"></a><span class="lineno"> 5053</span>&#160;        memcpy(&amp;pItemPtr, &amp;ptr, <span class="keyword">sizeof</span>(pItemPtr));</div>
-<div class="line"><a name="l05054"></a><span class="lineno"> 5054</span>&#160;        </div>
-<div class="line"><a name="l05055"></a><span class="lineno"> 5055</span>&#160;        <span class="comment">// Check if pItemPtr is in address range of this block.</span></div>
-<div class="line"><a name="l05056"></a><span class="lineno"> 5056</span>&#160;        <span class="keywordflow">if</span>((pItemPtr &gt;= block.pItems) &amp;&amp; (pItemPtr &lt; block.pItems + block.Capacity))</div>
-<div class="line"><a name="l05057"></a><span class="lineno"> 5057</span>&#160;        {</div>
-<div class="line"><a name="l05058"></a><span class="lineno"> 5058</span>&#160;            ptr-&gt;~T(); <span class="comment">// Explicit destructor call.</span></div>
-<div class="line"><a name="l05059"></a><span class="lineno"> 5059</span>&#160;            <span class="keyword">const</span> uint32_t index = <span class="keyword">static_cast&lt;</span>uint32_t<span class="keyword">&gt;</span>(pItemPtr - block.pItems);</div>
-<div class="line"><a name="l05060"></a><span class="lineno"> 5060</span>&#160;            pItemPtr-&gt;NextFreeIndex = block.FirstFreeIndex;</div>
-<div class="line"><a name="l05061"></a><span class="lineno"> 5061</span>&#160;            block.FirstFreeIndex = index;</div>
-<div class="line"><a name="l05062"></a><span class="lineno"> 5062</span>&#160;            <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l05063"></a><span class="lineno"> 5063</span>&#160;        }</div>
-<div class="line"><a name="l05064"></a><span class="lineno"> 5064</span>&#160;    }</div>
-<div class="line"><a name="l05065"></a><span class="lineno"> 5065</span>&#160;    VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Pointer doesn&#39;t belong to this memory pool.&quot;</span>);</div>
-<div class="line"><a name="l05066"></a><span class="lineno"> 5066</span>&#160;}</div>
-<div class="line"><a name="l05067"></a><span class="lineno"> 5067</span>&#160; </div>
-<div class="line"><a name="l05068"></a><span class="lineno"> 5068</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05069"></a><span class="lineno"> 5069</span>&#160;<span class="keyword">typename</span> VmaPoolAllocator&lt;T&gt;::ItemBlock&amp; VmaPoolAllocator&lt;T&gt;::CreateNewBlock()</div>
-<div class="line"><a name="l05070"></a><span class="lineno"> 5070</span>&#160;{</div>
-<div class="line"><a name="l05071"></a><span class="lineno"> 5071</span>&#160;    <span class="keyword">const</span> uint32_t newBlockCapacity = m_ItemBlocks.empty() ?</div>
-<div class="line"><a name="l05072"></a><span class="lineno"> 5072</span>&#160;        m_FirstBlockCapacity : m_ItemBlocks.back().Capacity * 3 / 2;</div>
-<div class="line"><a name="l05073"></a><span class="lineno"> 5073</span>&#160; </div>
-<div class="line"><a name="l05074"></a><span class="lineno"> 5074</span>&#160;    <span class="keyword">const</span> ItemBlock newBlock = {</div>
-<div class="line"><a name="l05075"></a><span class="lineno"> 5075</span>&#160;        vma_new_array(m_pAllocationCallbacks, Item, newBlockCapacity),</div>
-<div class="line"><a name="l05076"></a><span class="lineno"> 5076</span>&#160;        newBlockCapacity,</div>
-<div class="line"><a name="l05077"></a><span class="lineno"> 5077</span>&#160;        0 };</div>
+<div class="line"><a name="l05049"></a><span class="lineno"> 5049</span>&#160;        VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
+<div class="line"><a name="l05050"></a><span class="lineno"> 5050</span>&#160;        <span class="keywordflow">return</span> data()[index];</div>
+<div class="line"><a name="l05051"></a><span class="lineno"> 5051</span>&#160;    }</div>
+<div class="line"><a name="l05052"></a><span class="lineno"> 5052</span>&#160;    <span class="keyword">const</span> T&amp; operator[](<span class="keywordtype">size_t</span> index)<span class="keyword"> const</span></div>
+<div class="line"><a name="l05053"></a><span class="lineno"> 5053</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l05054"></a><span class="lineno"> 5054</span>&#160;        VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
+<div class="line"><a name="l05055"></a><span class="lineno"> 5055</span>&#160;        <span class="keywordflow">return</span> data()[index];</div>
+<div class="line"><a name="l05056"></a><span class="lineno"> 5056</span>&#160;    }</div>
+<div class="line"><a name="l05057"></a><span class="lineno"> 5057</span>&#160; </div>
+<div class="line"><a name="l05058"></a><span class="lineno"> 5058</span>&#160;    T&amp; front()</div>
+<div class="line"><a name="l05059"></a><span class="lineno"> 5059</span>&#160;    {</div>
+<div class="line"><a name="l05060"></a><span class="lineno"> 5060</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l05061"></a><span class="lineno"> 5061</span>&#160;        <span class="keywordflow">return</span> data()[0];</div>
+<div class="line"><a name="l05062"></a><span class="lineno"> 5062</span>&#160;    }</div>
+<div class="line"><a name="l05063"></a><span class="lineno"> 5063</span>&#160;    <span class="keyword">const</span> T&amp; front()<span class="keyword"> const</span></div>
+<div class="line"><a name="l05064"></a><span class="lineno"> 5064</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l05065"></a><span class="lineno"> 5065</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l05066"></a><span class="lineno"> 5066</span>&#160;        <span class="keywordflow">return</span> data()[0];</div>
+<div class="line"><a name="l05067"></a><span class="lineno"> 5067</span>&#160;    }</div>
+<div class="line"><a name="l05068"></a><span class="lineno"> 5068</span>&#160;    T&amp; back()</div>
+<div class="line"><a name="l05069"></a><span class="lineno"> 5069</span>&#160;    {</div>
+<div class="line"><a name="l05070"></a><span class="lineno"> 5070</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l05071"></a><span class="lineno"> 5071</span>&#160;        <span class="keywordflow">return</span> data()[m_Count - 1];</div>
+<div class="line"><a name="l05072"></a><span class="lineno"> 5072</span>&#160;    }</div>
+<div class="line"><a name="l05073"></a><span class="lineno"> 5073</span>&#160;    <span class="keyword">const</span> T&amp; back()<span class="keyword"> const</span></div>
+<div class="line"><a name="l05074"></a><span class="lineno"> 5074</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l05075"></a><span class="lineno"> 5075</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l05076"></a><span class="lineno"> 5076</span>&#160;        <span class="keywordflow">return</span> data()[m_Count - 1];</div>
+<div class="line"><a name="l05077"></a><span class="lineno"> 5077</span>&#160;    }</div>
 <div class="line"><a name="l05078"></a><span class="lineno"> 5078</span>&#160; </div>
-<div class="line"><a name="l05079"></a><span class="lineno"> 5079</span>&#160;    m_ItemBlocks.push_back(newBlock);</div>
-<div class="line"><a name="l05080"></a><span class="lineno"> 5080</span>&#160; </div>
-<div class="line"><a name="l05081"></a><span class="lineno"> 5081</span>&#160;    <span class="comment">// Setup singly-linked list of all free items in this block.</span></div>
-<div class="line"><a name="l05082"></a><span class="lineno"> 5082</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; newBlockCapacity - 1; ++i)</div>
-<div class="line"><a name="l05083"></a><span class="lineno"> 5083</span>&#160;        newBlock.pItems[i].NextFreeIndex = i + 1;</div>
-<div class="line"><a name="l05084"></a><span class="lineno"> 5084</span>&#160;    newBlock.pItems[newBlockCapacity - 1].NextFreeIndex = UINT32_MAX;</div>
-<div class="line"><a name="l05085"></a><span class="lineno"> 5085</span>&#160;    <span class="keywordflow">return</span> m_ItemBlocks.back();</div>
-<div class="line"><a name="l05086"></a><span class="lineno"> 5086</span>&#160;}</div>
-<div class="line"><a name="l05087"></a><span class="lineno"> 5087</span>&#160; </div>
-<div class="line"><a name="l05089"></a><span class="lineno"> 5089</span>&#160;<span class="comment">// class VmaRawList, VmaList</span></div>
-<div class="line"><a name="l05090"></a><span class="lineno"> 5090</span>&#160; </div>
-<div class="line"><a name="l05091"></a><span class="lineno"> 5091</span>&#160;<span class="preprocessor">#if VMA_USE_STL_LIST</span></div>
-<div class="line"><a name="l05092"></a><span class="lineno"> 5092</span>&#160; </div>
-<div class="line"><a name="l05093"></a><span class="lineno"> 5093</span>&#160;<span class="preprocessor">#define VmaList std::list</span></div>
-<div class="line"><a name="l05094"></a><span class="lineno"> 5094</span>&#160; </div>
-<div class="line"><a name="l05095"></a><span class="lineno"> 5095</span>&#160;<span class="preprocessor">#else // #if VMA_USE_STL_LIST</span></div>
-<div class="line"><a name="l05096"></a><span class="lineno"> 5096</span>&#160; </div>
-<div class="line"><a name="l05097"></a><span class="lineno"> 5097</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05098"></a><span class="lineno"> 5098</span>&#160;<span class="keyword">struct </span>VmaListItem</div>
-<div class="line"><a name="l05099"></a><span class="lineno"> 5099</span>&#160;{</div>
-<div class="line"><a name="l05100"></a><span class="lineno"> 5100</span>&#160;    VmaListItem* pPrev;</div>
-<div class="line"><a name="l05101"></a><span class="lineno"> 5101</span>&#160;    VmaListItem* pNext;</div>
-<div class="line"><a name="l05102"></a><span class="lineno"> 5102</span>&#160;    T Value;</div>
-<div class="line"><a name="l05103"></a><span class="lineno"> 5103</span>&#160;};</div>
-<div class="line"><a name="l05104"></a><span class="lineno"> 5104</span>&#160; </div>
-<div class="line"><a name="l05105"></a><span class="lineno"> 5105</span>&#160;<span class="comment">// Doubly linked list.</span></div>
-<div class="line"><a name="l05106"></a><span class="lineno"> 5106</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05107"></a><span class="lineno"> 5107</span>&#160;<span class="keyword">class </span>VmaRawList</div>
-<div class="line"><a name="l05108"></a><span class="lineno"> 5108</span>&#160;{</div>
-<div class="line"><a name="l05109"></a><span class="lineno"> 5109</span>&#160;    VMA_CLASS_NO_COPY(VmaRawList)</div>
-<div class="line"><a name="l05110"></a><span class="lineno"> 5110</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l05111"></a><span class="lineno"> 5111</span>&#160;    <span class="keyword">typedef</span> VmaListItem&lt;T&gt; ItemType;</div>
-<div class="line"><a name="l05112"></a><span class="lineno"> 5112</span>&#160; </div>
-<div class="line"><a name="l05113"></a><span class="lineno"> 5113</span>&#160;    VmaRawList(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks);</div>
-<div class="line"><a name="l05114"></a><span class="lineno"> 5114</span>&#160;    ~VmaRawList();</div>
-<div class="line"><a name="l05115"></a><span class="lineno"> 5115</span>&#160;    <span class="keywordtype">void</span> Clear();</div>
+<div class="line"><a name="l05079"></a><span class="lineno"> 5079</span>&#160;    <span class="keywordtype">void</span> resize(<span class="keywordtype">size_t</span> newCount, <span class="keywordtype">bool</span> freeMemory = <span class="keyword">false</span>)</div>
+<div class="line"><a name="l05080"></a><span class="lineno"> 5080</span>&#160;    {</div>
+<div class="line"><a name="l05081"></a><span class="lineno"> 5081</span>&#160;        <span class="keywordflow">if</span>(newCount &gt; N &amp;&amp; m_Count &gt; N)</div>
+<div class="line"><a name="l05082"></a><span class="lineno"> 5082</span>&#160;        {</div>
+<div class="line"><a name="l05083"></a><span class="lineno"> 5083</span>&#160;            <span class="comment">// Any direction, staying in m_DynamicArray</span></div>
+<div class="line"><a name="l05084"></a><span class="lineno"> 5084</span>&#160;            m_DynamicArray.resize(newCount, freeMemory);</div>
+<div class="line"><a name="l05085"></a><span class="lineno"> 5085</span>&#160;        }</div>
+<div class="line"><a name="l05086"></a><span class="lineno"> 5086</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(newCount &gt; N &amp;&amp; m_Count &lt;= N)</div>
+<div class="line"><a name="l05087"></a><span class="lineno"> 5087</span>&#160;        {</div>
+<div class="line"><a name="l05088"></a><span class="lineno"> 5088</span>&#160;            <span class="comment">// Growing, moving from m_StaticArray to m_DynamicArray</span></div>
+<div class="line"><a name="l05089"></a><span class="lineno"> 5089</span>&#160;            m_DynamicArray.resize(newCount, freeMemory);</div>
+<div class="line"><a name="l05090"></a><span class="lineno"> 5090</span>&#160;            <span class="keywordflow">if</span>(m_Count &gt; 0)</div>
+<div class="line"><a name="l05091"></a><span class="lineno"> 5091</span>&#160;            {</div>
+<div class="line"><a name="l05092"></a><span class="lineno"> 5092</span>&#160;                memcpy(m_DynamicArray.data(), m_StaticArray, m_Count * <span class="keyword">sizeof</span>(T));</div>
+<div class="line"><a name="l05093"></a><span class="lineno"> 5093</span>&#160;            }</div>
+<div class="line"><a name="l05094"></a><span class="lineno"> 5094</span>&#160;        }</div>
+<div class="line"><a name="l05095"></a><span class="lineno"> 5095</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(newCount &lt;= N &amp;&amp; m_Count &gt; N)</div>
+<div class="line"><a name="l05096"></a><span class="lineno"> 5096</span>&#160;        {</div>
+<div class="line"><a name="l05097"></a><span class="lineno"> 5097</span>&#160;            <span class="comment">// Shrinking, moving from m_DynamicArray to m_StaticArray</span></div>
+<div class="line"><a name="l05098"></a><span class="lineno"> 5098</span>&#160;            <span class="keywordflow">if</span>(newCount &gt; 0)</div>
+<div class="line"><a name="l05099"></a><span class="lineno"> 5099</span>&#160;            {</div>
+<div class="line"><a name="l05100"></a><span class="lineno"> 5100</span>&#160;                memcpy(m_StaticArray, m_DynamicArray.data(), newCount * <span class="keyword">sizeof</span>(T));</div>
+<div class="line"><a name="l05101"></a><span class="lineno"> 5101</span>&#160;            }</div>
+<div class="line"><a name="l05102"></a><span class="lineno"> 5102</span>&#160;            m_DynamicArray.resize(0, freeMemory);</div>
+<div class="line"><a name="l05103"></a><span class="lineno"> 5103</span>&#160;        }</div>
+<div class="line"><a name="l05104"></a><span class="lineno"> 5104</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05105"></a><span class="lineno"> 5105</span>&#160;        {</div>
+<div class="line"><a name="l05106"></a><span class="lineno"> 5106</span>&#160;            <span class="comment">// Any direction, staying in m_StaticArray - nothing to do here</span></div>
+<div class="line"><a name="l05107"></a><span class="lineno"> 5107</span>&#160;        }</div>
+<div class="line"><a name="l05108"></a><span class="lineno"> 5108</span>&#160;        m_Count = newCount;</div>
+<div class="line"><a name="l05109"></a><span class="lineno"> 5109</span>&#160;    }</div>
+<div class="line"><a name="l05110"></a><span class="lineno"> 5110</span>&#160; </div>
+<div class="line"><a name="l05111"></a><span class="lineno"> 5111</span>&#160;    <span class="keywordtype">void</span> clear(<span class="keywordtype">bool</span> freeMemory = <span class="keyword">false</span>)</div>
+<div class="line"><a name="l05112"></a><span class="lineno"> 5112</span>&#160;    {</div>
+<div class="line"><a name="l05113"></a><span class="lineno"> 5113</span>&#160;        m_DynamicArray.clear(freeMemory);</div>
+<div class="line"><a name="l05114"></a><span class="lineno"> 5114</span>&#160;        m_Count = 0;</div>
+<div class="line"><a name="l05115"></a><span class="lineno"> 5115</span>&#160;    }</div>
 <div class="line"><a name="l05116"></a><span class="lineno"> 5116</span>&#160; </div>
-<div class="line"><a name="l05117"></a><span class="lineno"> 5117</span>&#160;    <span class="keywordtype">size_t</span> GetCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count; }</div>
-<div class="line"><a name="l05118"></a><span class="lineno"> 5118</span>&#160;    <span class="keywordtype">bool</span> IsEmpty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count == 0; }</div>
-<div class="line"><a name="l05119"></a><span class="lineno"> 5119</span>&#160; </div>
-<div class="line"><a name="l05120"></a><span class="lineno"> 5120</span>&#160;    ItemType* Front() { <span class="keywordflow">return</span> m_pFront; }</div>
-<div class="line"><a name="l05121"></a><span class="lineno"> 5121</span>&#160;    <span class="keyword">const</span> ItemType* Front()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pFront; }</div>
-<div class="line"><a name="l05122"></a><span class="lineno"> 5122</span>&#160;    ItemType* Back() { <span class="keywordflow">return</span> m_pBack; }</div>
-<div class="line"><a name="l05123"></a><span class="lineno"> 5123</span>&#160;    <span class="keyword">const</span> ItemType* Back()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pBack; }</div>
-<div class="line"><a name="l05124"></a><span class="lineno"> 5124</span>&#160; </div>
-<div class="line"><a name="l05125"></a><span class="lineno"> 5125</span>&#160;    ItemType* PushBack();</div>
-<div class="line"><a name="l05126"></a><span class="lineno"> 5126</span>&#160;    ItemType* PushFront();</div>
-<div class="line"><a name="l05127"></a><span class="lineno"> 5127</span>&#160;    ItemType* PushBack(<span class="keyword">const</span> T&amp; value);</div>
-<div class="line"><a name="l05128"></a><span class="lineno"> 5128</span>&#160;    ItemType* PushFront(<span class="keyword">const</span> T&amp; value);</div>
-<div class="line"><a name="l05129"></a><span class="lineno"> 5129</span>&#160;    <span class="keywordtype">void</span> PopBack();</div>
-<div class="line"><a name="l05130"></a><span class="lineno"> 5130</span>&#160;    <span class="keywordtype">void</span> PopFront();</div>
-<div class="line"><a name="l05131"></a><span class="lineno"> 5131</span>&#160;    </div>
-<div class="line"><a name="l05132"></a><span class="lineno"> 5132</span>&#160;    <span class="comment">// Item can be null - it means PushBack.</span></div>
-<div class="line"><a name="l05133"></a><span class="lineno"> 5133</span>&#160;    ItemType* InsertBefore(ItemType* pItem);</div>
-<div class="line"><a name="l05134"></a><span class="lineno"> 5134</span>&#160;    <span class="comment">// Item can be null - it means PushFront.</span></div>
-<div class="line"><a name="l05135"></a><span class="lineno"> 5135</span>&#160;    ItemType* InsertAfter(ItemType* pItem);</div>
-<div class="line"><a name="l05136"></a><span class="lineno"> 5136</span>&#160; </div>
-<div class="line"><a name="l05137"></a><span class="lineno"> 5137</span>&#160;    ItemType* InsertBefore(ItemType* pItem, <span class="keyword">const</span> T&amp; value);</div>
-<div class="line"><a name="l05138"></a><span class="lineno"> 5138</span>&#160;    ItemType* InsertAfter(ItemType* pItem, <span class="keyword">const</span> T&amp; value);</div>
-<div class="line"><a name="l05139"></a><span class="lineno"> 5139</span>&#160; </div>
-<div class="line"><a name="l05140"></a><span class="lineno"> 5140</span>&#160;    <span class="keywordtype">void</span> Remove(ItemType* pItem);</div>
-<div class="line"><a name="l05141"></a><span class="lineno"> 5141</span>&#160; </div>
-<div class="line"><a name="l05142"></a><span class="lineno"> 5142</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l05143"></a><span class="lineno"> 5143</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* <span class="keyword">const</span> m_pAllocationCallbacks;</div>
-<div class="line"><a name="l05144"></a><span class="lineno"> 5144</span>&#160;    VmaPoolAllocator&lt;ItemType&gt; m_ItemAllocator;</div>
-<div class="line"><a name="l05145"></a><span class="lineno"> 5145</span>&#160;    ItemType* m_pFront;</div>
-<div class="line"><a name="l05146"></a><span class="lineno"> 5146</span>&#160;    ItemType* m_pBack;</div>
-<div class="line"><a name="l05147"></a><span class="lineno"> 5147</span>&#160;    <span class="keywordtype">size_t</span> m_Count;</div>
-<div class="line"><a name="l05148"></a><span class="lineno"> 5148</span>&#160;};</div>
-<div class="line"><a name="l05149"></a><span class="lineno"> 5149</span>&#160; </div>
-<div class="line"><a name="l05150"></a><span class="lineno"> 5150</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05151"></a><span class="lineno"> 5151</span>&#160;VmaRawList&lt;T&gt;::VmaRawList(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks) :</div>
-<div class="line"><a name="l05152"></a><span class="lineno"> 5152</span>&#160;    m_pAllocationCallbacks(pAllocationCallbacks),</div>
-<div class="line"><a name="l05153"></a><span class="lineno"> 5153</span>&#160;    m_ItemAllocator(pAllocationCallbacks, 128),</div>
-<div class="line"><a name="l05154"></a><span class="lineno"> 5154</span>&#160;    m_pFront(VMA_NULL),</div>
-<div class="line"><a name="l05155"></a><span class="lineno"> 5155</span>&#160;    m_pBack(VMA_NULL),</div>
-<div class="line"><a name="l05156"></a><span class="lineno"> 5156</span>&#160;    m_Count(0)</div>
-<div class="line"><a name="l05157"></a><span class="lineno"> 5157</span>&#160;{</div>
-<div class="line"><a name="l05158"></a><span class="lineno"> 5158</span>&#160;}</div>
-<div class="line"><a name="l05159"></a><span class="lineno"> 5159</span>&#160; </div>
-<div class="line"><a name="l05160"></a><span class="lineno"> 5160</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05161"></a><span class="lineno"> 5161</span>&#160;VmaRawList&lt;T&gt;::~VmaRawList()</div>
-<div class="line"><a name="l05162"></a><span class="lineno"> 5162</span>&#160;{</div>
-<div class="line"><a name="l05163"></a><span class="lineno"> 5163</span>&#160;    <span class="comment">// Intentionally not calling Clear, because that would be unnecessary</span></div>
-<div class="line"><a name="l05164"></a><span class="lineno"> 5164</span>&#160;    <span class="comment">// computations to return all items to m_ItemAllocator as free.</span></div>
-<div class="line"><a name="l05165"></a><span class="lineno"> 5165</span>&#160;}</div>
-<div class="line"><a name="l05166"></a><span class="lineno"> 5166</span>&#160; </div>
-<div class="line"><a name="l05167"></a><span class="lineno"> 5167</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05168"></a><span class="lineno"> 5168</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::Clear()</div>
-<div class="line"><a name="l05169"></a><span class="lineno"> 5169</span>&#160;{</div>
-<div class="line"><a name="l05170"></a><span class="lineno"> 5170</span>&#160;    <span class="keywordflow">if</span>(IsEmpty() == <span class="keyword">false</span>)</div>
-<div class="line"><a name="l05171"></a><span class="lineno"> 5171</span>&#160;    {</div>
-<div class="line"><a name="l05172"></a><span class="lineno"> 5172</span>&#160;        ItemType* pItem = m_pBack;</div>
-<div class="line"><a name="l05173"></a><span class="lineno"> 5173</span>&#160;        <span class="keywordflow">while</span>(pItem != VMA_NULL)</div>
-<div class="line"><a name="l05174"></a><span class="lineno"> 5174</span>&#160;        {</div>
-<div class="line"><a name="l05175"></a><span class="lineno"> 5175</span>&#160;            ItemType* <span class="keyword">const</span> pPrevItem = pItem-&gt;pPrev;</div>
-<div class="line"><a name="l05176"></a><span class="lineno"> 5176</span>&#160;            m_ItemAllocator.Free(pItem);</div>
-<div class="line"><a name="l05177"></a><span class="lineno"> 5177</span>&#160;            pItem = pPrevItem;</div>
-<div class="line"><a name="l05178"></a><span class="lineno"> 5178</span>&#160;        }</div>
-<div class="line"><a name="l05179"></a><span class="lineno"> 5179</span>&#160;        m_pFront = VMA_NULL;</div>
-<div class="line"><a name="l05180"></a><span class="lineno"> 5180</span>&#160;        m_pBack = VMA_NULL;</div>
-<div class="line"><a name="l05181"></a><span class="lineno"> 5181</span>&#160;        m_Count = 0;</div>
-<div class="line"><a name="l05182"></a><span class="lineno"> 5182</span>&#160;    }</div>
-<div class="line"><a name="l05183"></a><span class="lineno"> 5183</span>&#160;}</div>
-<div class="line"><a name="l05184"></a><span class="lineno"> 5184</span>&#160; </div>
-<div class="line"><a name="l05185"></a><span class="lineno"> 5185</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05186"></a><span class="lineno"> 5186</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushBack()</div>
-<div class="line"><a name="l05187"></a><span class="lineno"> 5187</span>&#160;{</div>
-<div class="line"><a name="l05188"></a><span class="lineno"> 5188</span>&#160;    ItemType* <span class="keyword">const</span> pNewItem = m_ItemAllocator.Alloc();</div>
-<div class="line"><a name="l05189"></a><span class="lineno"> 5189</span>&#160;    pNewItem-&gt;pNext = VMA_NULL;</div>
-<div class="line"><a name="l05190"></a><span class="lineno"> 5190</span>&#160;    <span class="keywordflow">if</span>(IsEmpty())</div>
-<div class="line"><a name="l05191"></a><span class="lineno"> 5191</span>&#160;    {</div>
-<div class="line"><a name="l05192"></a><span class="lineno"> 5192</span>&#160;        pNewItem-&gt;pPrev = VMA_NULL;</div>
-<div class="line"><a name="l05193"></a><span class="lineno"> 5193</span>&#160;        m_pFront = pNewItem;</div>
-<div class="line"><a name="l05194"></a><span class="lineno"> 5194</span>&#160;        m_pBack = pNewItem;</div>
-<div class="line"><a name="l05195"></a><span class="lineno"> 5195</span>&#160;        m_Count = 1;</div>
-<div class="line"><a name="l05196"></a><span class="lineno"> 5196</span>&#160;    }</div>
-<div class="line"><a name="l05197"></a><span class="lineno"> 5197</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l05198"></a><span class="lineno"> 5198</span>&#160;    {</div>
-<div class="line"><a name="l05199"></a><span class="lineno"> 5199</span>&#160;        pNewItem-&gt;pPrev = m_pBack;</div>
-<div class="line"><a name="l05200"></a><span class="lineno"> 5200</span>&#160;        m_pBack-&gt;pNext = pNewItem;</div>
-<div class="line"><a name="l05201"></a><span class="lineno"> 5201</span>&#160;        m_pBack = pNewItem;</div>
-<div class="line"><a name="l05202"></a><span class="lineno"> 5202</span>&#160;        ++m_Count;</div>
-<div class="line"><a name="l05203"></a><span class="lineno"> 5203</span>&#160;    }</div>
-<div class="line"><a name="l05204"></a><span class="lineno"> 5204</span>&#160;    <span class="keywordflow">return</span> pNewItem;</div>
-<div class="line"><a name="l05205"></a><span class="lineno"> 5205</span>&#160;}</div>
-<div class="line"><a name="l05206"></a><span class="lineno"> 5206</span>&#160; </div>
-<div class="line"><a name="l05207"></a><span class="lineno"> 5207</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05208"></a><span class="lineno"> 5208</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushFront()</div>
-<div class="line"><a name="l05209"></a><span class="lineno"> 5209</span>&#160;{</div>
-<div class="line"><a name="l05210"></a><span class="lineno"> 5210</span>&#160;    ItemType* <span class="keyword">const</span> pNewItem = m_ItemAllocator.Alloc();</div>
-<div class="line"><a name="l05211"></a><span class="lineno"> 5211</span>&#160;    pNewItem-&gt;pPrev = VMA_NULL;</div>
-<div class="line"><a name="l05212"></a><span class="lineno"> 5212</span>&#160;    <span class="keywordflow">if</span>(IsEmpty())</div>
-<div class="line"><a name="l05213"></a><span class="lineno"> 5213</span>&#160;    {</div>
-<div class="line"><a name="l05214"></a><span class="lineno"> 5214</span>&#160;        pNewItem-&gt;pNext = VMA_NULL;</div>
-<div class="line"><a name="l05215"></a><span class="lineno"> 5215</span>&#160;        m_pFront = pNewItem;</div>
-<div class="line"><a name="l05216"></a><span class="lineno"> 5216</span>&#160;        m_pBack = pNewItem;</div>
-<div class="line"><a name="l05217"></a><span class="lineno"> 5217</span>&#160;        m_Count = 1;</div>
-<div class="line"><a name="l05218"></a><span class="lineno"> 5218</span>&#160;    }</div>
-<div class="line"><a name="l05219"></a><span class="lineno"> 5219</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l05220"></a><span class="lineno"> 5220</span>&#160;    {</div>
-<div class="line"><a name="l05221"></a><span class="lineno"> 5221</span>&#160;        pNewItem-&gt;pNext = m_pFront;</div>
-<div class="line"><a name="l05222"></a><span class="lineno"> 5222</span>&#160;        m_pFront-&gt;pPrev = pNewItem;</div>
-<div class="line"><a name="l05223"></a><span class="lineno"> 5223</span>&#160;        m_pFront = pNewItem;</div>
-<div class="line"><a name="l05224"></a><span class="lineno"> 5224</span>&#160;        ++m_Count;</div>
-<div class="line"><a name="l05225"></a><span class="lineno"> 5225</span>&#160;    }</div>
-<div class="line"><a name="l05226"></a><span class="lineno"> 5226</span>&#160;    <span class="keywordflow">return</span> pNewItem;</div>
-<div class="line"><a name="l05227"></a><span class="lineno"> 5227</span>&#160;}</div>
-<div class="line"><a name="l05228"></a><span class="lineno"> 5228</span>&#160; </div>
-<div class="line"><a name="l05229"></a><span class="lineno"> 5229</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05230"></a><span class="lineno"> 5230</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushBack(<span class="keyword">const</span> T&amp; value)</div>
-<div class="line"><a name="l05231"></a><span class="lineno"> 5231</span>&#160;{</div>
-<div class="line"><a name="l05232"></a><span class="lineno"> 5232</span>&#160;    ItemType* <span class="keyword">const</span> pNewItem = PushBack();</div>
-<div class="line"><a name="l05233"></a><span class="lineno"> 5233</span>&#160;    pNewItem-&gt;Value = value;</div>
-<div class="line"><a name="l05234"></a><span class="lineno"> 5234</span>&#160;    <span class="keywordflow">return</span> pNewItem;</div>
-<div class="line"><a name="l05235"></a><span class="lineno"> 5235</span>&#160;}</div>
-<div class="line"><a name="l05236"></a><span class="lineno"> 5236</span>&#160; </div>
-<div class="line"><a name="l05237"></a><span class="lineno"> 5237</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05238"></a><span class="lineno"> 5238</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushFront(<span class="keyword">const</span> T&amp; value)</div>
-<div class="line"><a name="l05239"></a><span class="lineno"> 5239</span>&#160;{</div>
-<div class="line"><a name="l05240"></a><span class="lineno"> 5240</span>&#160;    ItemType* <span class="keyword">const</span> pNewItem = PushFront();</div>
-<div class="line"><a name="l05241"></a><span class="lineno"> 5241</span>&#160;    pNewItem-&gt;Value = value;</div>
-<div class="line"><a name="l05242"></a><span class="lineno"> 5242</span>&#160;    <span class="keywordflow">return</span> pNewItem;</div>
-<div class="line"><a name="l05243"></a><span class="lineno"> 5243</span>&#160;}</div>
-<div class="line"><a name="l05244"></a><span class="lineno"> 5244</span>&#160; </div>
-<div class="line"><a name="l05245"></a><span class="lineno"> 5245</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05246"></a><span class="lineno"> 5246</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::PopBack()</div>
-<div class="line"><a name="l05247"></a><span class="lineno"> 5247</span>&#160;{</div>
-<div class="line"><a name="l05248"></a><span class="lineno"> 5248</span>&#160;    VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
-<div class="line"><a name="l05249"></a><span class="lineno"> 5249</span>&#160;    ItemType* <span class="keyword">const</span> pBackItem = m_pBack;</div>
-<div class="line"><a name="l05250"></a><span class="lineno"> 5250</span>&#160;    ItemType* <span class="keyword">const</span> pPrevItem = pBackItem-&gt;pPrev;</div>
-<div class="line"><a name="l05251"></a><span class="lineno"> 5251</span>&#160;    <span class="keywordflow">if</span>(pPrevItem != VMA_NULL)</div>
-<div class="line"><a name="l05252"></a><span class="lineno"> 5252</span>&#160;    {</div>
-<div class="line"><a name="l05253"></a><span class="lineno"> 5253</span>&#160;        pPrevItem-&gt;pNext = VMA_NULL;</div>
-<div class="line"><a name="l05254"></a><span class="lineno"> 5254</span>&#160;    }</div>
-<div class="line"><a name="l05255"></a><span class="lineno"> 5255</span>&#160;    m_pBack = pPrevItem;</div>
-<div class="line"><a name="l05256"></a><span class="lineno"> 5256</span>&#160;    m_ItemAllocator.Free(pBackItem);</div>
-<div class="line"><a name="l05257"></a><span class="lineno"> 5257</span>&#160;    --m_Count;</div>
-<div class="line"><a name="l05258"></a><span class="lineno"> 5258</span>&#160;}</div>
-<div class="line"><a name="l05259"></a><span class="lineno"> 5259</span>&#160; </div>
-<div class="line"><a name="l05260"></a><span class="lineno"> 5260</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05261"></a><span class="lineno"> 5261</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::PopFront()</div>
-<div class="line"><a name="l05262"></a><span class="lineno"> 5262</span>&#160;{</div>
-<div class="line"><a name="l05263"></a><span class="lineno"> 5263</span>&#160;    VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
-<div class="line"><a name="l05264"></a><span class="lineno"> 5264</span>&#160;    ItemType* <span class="keyword">const</span> pFrontItem = m_pFront;</div>
-<div class="line"><a name="l05265"></a><span class="lineno"> 5265</span>&#160;    ItemType* <span class="keyword">const</span> pNextItem = pFrontItem-&gt;pNext;</div>
-<div class="line"><a name="l05266"></a><span class="lineno"> 5266</span>&#160;    <span class="keywordflow">if</span>(pNextItem != VMA_NULL)</div>
-<div class="line"><a name="l05267"></a><span class="lineno"> 5267</span>&#160;    {</div>
-<div class="line"><a name="l05268"></a><span class="lineno"> 5268</span>&#160;        pNextItem-&gt;pPrev = VMA_NULL;</div>
-<div class="line"><a name="l05269"></a><span class="lineno"> 5269</span>&#160;    }</div>
-<div class="line"><a name="l05270"></a><span class="lineno"> 5270</span>&#160;    m_pFront = pNextItem;</div>
-<div class="line"><a name="l05271"></a><span class="lineno"> 5271</span>&#160;    m_ItemAllocator.Free(pFrontItem);</div>
-<div class="line"><a name="l05272"></a><span class="lineno"> 5272</span>&#160;    --m_Count;</div>
-<div class="line"><a name="l05273"></a><span class="lineno"> 5273</span>&#160;}</div>
-<div class="line"><a name="l05274"></a><span class="lineno"> 5274</span>&#160; </div>
-<div class="line"><a name="l05275"></a><span class="lineno"> 5275</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05276"></a><span class="lineno"> 5276</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::Remove(ItemType* pItem)</div>
-<div class="line"><a name="l05277"></a><span class="lineno"> 5277</span>&#160;{</div>
-<div class="line"><a name="l05278"></a><span class="lineno"> 5278</span>&#160;    VMA_HEAVY_ASSERT(pItem != VMA_NULL);</div>
-<div class="line"><a name="l05279"></a><span class="lineno"> 5279</span>&#160;    VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
-<div class="line"><a name="l05280"></a><span class="lineno"> 5280</span>&#160; </div>
-<div class="line"><a name="l05281"></a><span class="lineno"> 5281</span>&#160;    <span class="keywordflow">if</span>(pItem-&gt;pPrev != VMA_NULL)</div>
-<div class="line"><a name="l05282"></a><span class="lineno"> 5282</span>&#160;    {</div>
-<div class="line"><a name="l05283"></a><span class="lineno"> 5283</span>&#160;        pItem-&gt;pPrev-&gt;pNext = pItem-&gt;pNext;</div>
-<div class="line"><a name="l05284"></a><span class="lineno"> 5284</span>&#160;    }</div>
-<div class="line"><a name="l05285"></a><span class="lineno"> 5285</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l05286"></a><span class="lineno"> 5286</span>&#160;    {</div>
-<div class="line"><a name="l05287"></a><span class="lineno"> 5287</span>&#160;        VMA_HEAVY_ASSERT(m_pFront == pItem);</div>
-<div class="line"><a name="l05288"></a><span class="lineno"> 5288</span>&#160;        m_pFront = pItem-&gt;pNext;</div>
-<div class="line"><a name="l05289"></a><span class="lineno"> 5289</span>&#160;    }</div>
-<div class="line"><a name="l05290"></a><span class="lineno"> 5290</span>&#160; </div>
-<div class="line"><a name="l05291"></a><span class="lineno"> 5291</span>&#160;    <span class="keywordflow">if</span>(pItem-&gt;pNext != VMA_NULL)</div>
-<div class="line"><a name="l05292"></a><span class="lineno"> 5292</span>&#160;    {</div>
-<div class="line"><a name="l05293"></a><span class="lineno"> 5293</span>&#160;        pItem-&gt;pNext-&gt;pPrev = pItem-&gt;pPrev;</div>
-<div class="line"><a name="l05294"></a><span class="lineno"> 5294</span>&#160;    }</div>
-<div class="line"><a name="l05295"></a><span class="lineno"> 5295</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l05296"></a><span class="lineno"> 5296</span>&#160;    {</div>
-<div class="line"><a name="l05297"></a><span class="lineno"> 5297</span>&#160;        VMA_HEAVY_ASSERT(m_pBack == pItem);</div>
-<div class="line"><a name="l05298"></a><span class="lineno"> 5298</span>&#160;        m_pBack = pItem-&gt;pPrev;</div>
-<div class="line"><a name="l05299"></a><span class="lineno"> 5299</span>&#160;    }</div>
-<div class="line"><a name="l05300"></a><span class="lineno"> 5300</span>&#160; </div>
-<div class="line"><a name="l05301"></a><span class="lineno"> 5301</span>&#160;    m_ItemAllocator.Free(pItem);</div>
-<div class="line"><a name="l05302"></a><span class="lineno"> 5302</span>&#160;    --m_Count;</div>
-<div class="line"><a name="l05303"></a><span class="lineno"> 5303</span>&#160;}</div>
-<div class="line"><a name="l05304"></a><span class="lineno"> 5304</span>&#160; </div>
-<div class="line"><a name="l05305"></a><span class="lineno"> 5305</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05306"></a><span class="lineno"> 5306</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertBefore(ItemType* pItem)</div>
-<div class="line"><a name="l05307"></a><span class="lineno"> 5307</span>&#160;{</div>
-<div class="line"><a name="l05308"></a><span class="lineno"> 5308</span>&#160;    <span class="keywordflow">if</span>(pItem != VMA_NULL)</div>
-<div class="line"><a name="l05309"></a><span class="lineno"> 5309</span>&#160;    {</div>
-<div class="line"><a name="l05310"></a><span class="lineno"> 5310</span>&#160;        ItemType* <span class="keyword">const</span> prevItem = pItem-&gt;pPrev;</div>
-<div class="line"><a name="l05311"></a><span class="lineno"> 5311</span>&#160;        ItemType* <span class="keyword">const</span> newItem = m_ItemAllocator.Alloc();</div>
-<div class="line"><a name="l05312"></a><span class="lineno"> 5312</span>&#160;        newItem-&gt;pPrev = prevItem;</div>
-<div class="line"><a name="l05313"></a><span class="lineno"> 5313</span>&#160;        newItem-&gt;pNext = pItem;</div>
-<div class="line"><a name="l05314"></a><span class="lineno"> 5314</span>&#160;        pItem-&gt;pPrev = newItem;</div>
-<div class="line"><a name="l05315"></a><span class="lineno"> 5315</span>&#160;        <span class="keywordflow">if</span>(prevItem != VMA_NULL)</div>
-<div class="line"><a name="l05316"></a><span class="lineno"> 5316</span>&#160;        {</div>
-<div class="line"><a name="l05317"></a><span class="lineno"> 5317</span>&#160;            prevItem-&gt;pNext = newItem;</div>
-<div class="line"><a name="l05318"></a><span class="lineno"> 5318</span>&#160;        }</div>
-<div class="line"><a name="l05319"></a><span class="lineno"> 5319</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l05320"></a><span class="lineno"> 5320</span>&#160;        {</div>
-<div class="line"><a name="l05321"></a><span class="lineno"> 5321</span>&#160;            VMA_HEAVY_ASSERT(m_pFront == pItem);</div>
-<div class="line"><a name="l05322"></a><span class="lineno"> 5322</span>&#160;            m_pFront = newItem;</div>
-<div class="line"><a name="l05323"></a><span class="lineno"> 5323</span>&#160;        }</div>
-<div class="line"><a name="l05324"></a><span class="lineno"> 5324</span>&#160;        ++m_Count;</div>
-<div class="line"><a name="l05325"></a><span class="lineno"> 5325</span>&#160;        <span class="keywordflow">return</span> newItem;</div>
-<div class="line"><a name="l05326"></a><span class="lineno"> 5326</span>&#160;    }</div>
-<div class="line"><a name="l05327"></a><span class="lineno"> 5327</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l05328"></a><span class="lineno"> 5328</span>&#160;        <span class="keywordflow">return</span> PushBack();</div>
-<div class="line"><a name="l05329"></a><span class="lineno"> 5329</span>&#160;}</div>
+<div class="line"><a name="l05117"></a><span class="lineno"> 5117</span>&#160;    <span class="keywordtype">void</span> insert(<span class="keywordtype">size_t</span> index, <span class="keyword">const</span> T&amp; src)</div>
+<div class="line"><a name="l05118"></a><span class="lineno"> 5118</span>&#160;    {</div>
+<div class="line"><a name="l05119"></a><span class="lineno"> 5119</span>&#160;        VMA_HEAVY_ASSERT(index &lt;= m_Count);</div>
+<div class="line"><a name="l05120"></a><span class="lineno"> 5120</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> oldCount = size();</div>
+<div class="line"><a name="l05121"></a><span class="lineno"> 5121</span>&#160;        resize(oldCount + 1);</div>
+<div class="line"><a name="l05122"></a><span class="lineno"> 5122</span>&#160;        T* <span class="keyword">const</span> dataPtr = data();</div>
+<div class="line"><a name="l05123"></a><span class="lineno"> 5123</span>&#160;        <span class="keywordflow">if</span>(index &lt; oldCount)</div>
+<div class="line"><a name="l05124"></a><span class="lineno"> 5124</span>&#160;        {</div>
+<div class="line"><a name="l05125"></a><span class="lineno"> 5125</span>&#160;            <span class="comment">//  I know, this could be more optimal for case where memmove can be memcpy directly from m_StaticArray to m_DynamicArray.</span></div>
+<div class="line"><a name="l05126"></a><span class="lineno"> 5126</span>&#160;            memmove(dataPtr + (index + 1), dataPtr + index, (oldCount - index) * <span class="keyword">sizeof</span>(T));</div>
+<div class="line"><a name="l05127"></a><span class="lineno"> 5127</span>&#160;        }</div>
+<div class="line"><a name="l05128"></a><span class="lineno"> 5128</span>&#160;        dataPtr[index] = src;</div>
+<div class="line"><a name="l05129"></a><span class="lineno"> 5129</span>&#160;    }</div>
+<div class="line"><a name="l05130"></a><span class="lineno"> 5130</span>&#160; </div>
+<div class="line"><a name="l05131"></a><span class="lineno"> 5131</span>&#160;    <span class="keywordtype">void</span> remove(<span class="keywordtype">size_t</span> index)</div>
+<div class="line"><a name="l05132"></a><span class="lineno"> 5132</span>&#160;    {</div>
+<div class="line"><a name="l05133"></a><span class="lineno"> 5133</span>&#160;        VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
+<div class="line"><a name="l05134"></a><span class="lineno"> 5134</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> oldCount = size();</div>
+<div class="line"><a name="l05135"></a><span class="lineno"> 5135</span>&#160;        <span class="keywordflow">if</span>(index &lt; oldCount - 1)</div>
+<div class="line"><a name="l05136"></a><span class="lineno"> 5136</span>&#160;        {</div>
+<div class="line"><a name="l05137"></a><span class="lineno"> 5137</span>&#160;            <span class="comment">//  I know, this could be more optimal for case where memmove can be memcpy directly from m_DynamicArray to m_StaticArray.</span></div>
+<div class="line"><a name="l05138"></a><span class="lineno"> 5138</span>&#160;            T* <span class="keyword">const</span> dataPtr = data();</div>
+<div class="line"><a name="l05139"></a><span class="lineno"> 5139</span>&#160;            memmove(dataPtr + index, dataPtr + (index + 1), (oldCount - index - 1) * <span class="keyword">sizeof</span>(T));</div>
+<div class="line"><a name="l05140"></a><span class="lineno"> 5140</span>&#160;        }</div>
+<div class="line"><a name="l05141"></a><span class="lineno"> 5141</span>&#160;        resize(oldCount - 1);</div>
+<div class="line"><a name="l05142"></a><span class="lineno"> 5142</span>&#160;    }</div>
+<div class="line"><a name="l05143"></a><span class="lineno"> 5143</span>&#160; </div>
+<div class="line"><a name="l05144"></a><span class="lineno"> 5144</span>&#160;    <span class="keywordtype">void</span> push_back(<span class="keyword">const</span> T&amp; src)</div>
+<div class="line"><a name="l05145"></a><span class="lineno"> 5145</span>&#160;    {</div>
+<div class="line"><a name="l05146"></a><span class="lineno"> 5146</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> newIndex = size();</div>
+<div class="line"><a name="l05147"></a><span class="lineno"> 5147</span>&#160;        resize(newIndex + 1);</div>
+<div class="line"><a name="l05148"></a><span class="lineno"> 5148</span>&#160;        data()[newIndex] = src;</div>
+<div class="line"><a name="l05149"></a><span class="lineno"> 5149</span>&#160;    }</div>
+<div class="line"><a name="l05150"></a><span class="lineno"> 5150</span>&#160; </div>
+<div class="line"><a name="l05151"></a><span class="lineno"> 5151</span>&#160;    <span class="keywordtype">void</span> pop_back()</div>
+<div class="line"><a name="l05152"></a><span class="lineno"> 5152</span>&#160;    {</div>
+<div class="line"><a name="l05153"></a><span class="lineno"> 5153</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l05154"></a><span class="lineno"> 5154</span>&#160;        resize(size() - 1);</div>
+<div class="line"><a name="l05155"></a><span class="lineno"> 5155</span>&#160;    }</div>
+<div class="line"><a name="l05156"></a><span class="lineno"> 5156</span>&#160; </div>
+<div class="line"><a name="l05157"></a><span class="lineno"> 5157</span>&#160;    <span class="keywordtype">void</span> push_front(<span class="keyword">const</span> T&amp; src)</div>
+<div class="line"><a name="l05158"></a><span class="lineno"> 5158</span>&#160;    {</div>
+<div class="line"><a name="l05159"></a><span class="lineno"> 5159</span>&#160;        insert(0, src);</div>
+<div class="line"><a name="l05160"></a><span class="lineno"> 5160</span>&#160;    }</div>
+<div class="line"><a name="l05161"></a><span class="lineno"> 5161</span>&#160; </div>
+<div class="line"><a name="l05162"></a><span class="lineno"> 5162</span>&#160;    <span class="keywordtype">void</span> pop_front()</div>
+<div class="line"><a name="l05163"></a><span class="lineno"> 5163</span>&#160;    {</div>
+<div class="line"><a name="l05164"></a><span class="lineno"> 5164</span>&#160;        VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l05165"></a><span class="lineno"> 5165</span>&#160;        remove(0);</div>
+<div class="line"><a name="l05166"></a><span class="lineno"> 5166</span>&#160;    }</div>
+<div class="line"><a name="l05167"></a><span class="lineno"> 5167</span>&#160; </div>
+<div class="line"><a name="l05168"></a><span class="lineno"> 5168</span>&#160;    <span class="keyword">typedef</span> T* iterator;</div>
+<div class="line"><a name="l05169"></a><span class="lineno"> 5169</span>&#160; </div>
+<div class="line"><a name="l05170"></a><span class="lineno"> 5170</span>&#160;    iterator begin() { <span class="keywordflow">return</span> data(); }</div>
+<div class="line"><a name="l05171"></a><span class="lineno"> 5171</span>&#160;    iterator end() { <span class="keywordflow">return</span> data() + m_Count; }</div>
+<div class="line"><a name="l05172"></a><span class="lineno"> 5172</span>&#160; </div>
+<div class="line"><a name="l05173"></a><span class="lineno"> 5173</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l05174"></a><span class="lineno"> 5174</span>&#160;    <span class="keywordtype">size_t</span> m_Count;</div>
+<div class="line"><a name="l05175"></a><span class="lineno"> 5175</span>&#160;    T m_StaticArray[N]; <span class="comment">// Used when m_Size &lt;= N</span></div>
+<div class="line"><a name="l05176"></a><span class="lineno"> 5176</span>&#160;    VmaVector&lt;T, AllocatorT&gt; m_DynamicArray; <span class="comment">// Used when m_Size &gt; N</span></div>
+<div class="line"><a name="l05177"></a><span class="lineno"> 5177</span>&#160;};</div>
+<div class="line"><a name="l05178"></a><span class="lineno"> 5178</span>&#160; </div>
+<div class="line"><a name="l05180"></a><span class="lineno"> 5180</span>&#160;<span class="comment">// class VmaPoolAllocator</span></div>
+<div class="line"><a name="l05181"></a><span class="lineno"> 5181</span>&#160; </div>
+<div class="line"><a name="l05182"></a><span class="lineno"> 5182</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l05183"></a><span class="lineno"> 5183</span>&#160;<span class="comment">Allocator for objects of type T using a list of arrays (pools) to speed up</span></div>
+<div class="line"><a name="l05184"></a><span class="lineno"> 5184</span>&#160;<span class="comment">allocation. Number of elements that can be allocated is not bounded because</span></div>
+<div class="line"><a name="l05185"></a><span class="lineno"> 5185</span>&#160;<span class="comment">allocator can create multiple blocks.</span></div>
+<div class="line"><a name="l05186"></a><span class="lineno"> 5186</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l05187"></a><span class="lineno"> 5187</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05188"></a><span class="lineno"> 5188</span>&#160;<span class="keyword">class </span>VmaPoolAllocator</div>
+<div class="line"><a name="l05189"></a><span class="lineno"> 5189</span>&#160;{</div>
+<div class="line"><a name="l05190"></a><span class="lineno"> 5190</span>&#160;    VMA_CLASS_NO_COPY(VmaPoolAllocator)</div>
+<div class="line"><a name="l05191"></a><span class="lineno"> 5191</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l05192"></a><span class="lineno"> 5192</span>&#160;    VmaPoolAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, uint32_t firstBlockCapacity);</div>
+<div class="line"><a name="l05193"></a><span class="lineno"> 5193</span>&#160;    ~VmaPoolAllocator();</div>
+<div class="line"><a name="l05194"></a><span class="lineno"> 5194</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span>... Types&gt; T* Alloc(Types... args);</div>
+<div class="line"><a name="l05195"></a><span class="lineno"> 5195</span>&#160;    <span class="keywordtype">void</span> Free(T* ptr);</div>
+<div class="line"><a name="l05196"></a><span class="lineno"> 5196</span>&#160; </div>
+<div class="line"><a name="l05197"></a><span class="lineno"> 5197</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l05198"></a><span class="lineno"> 5198</span>&#160;    <span class="keyword">union </span>Item</div>
+<div class="line"><a name="l05199"></a><span class="lineno"> 5199</span>&#160;    {</div>
+<div class="line"><a name="l05200"></a><span class="lineno"> 5200</span>&#160;        uint32_t NextFreeIndex;</div>
+<div class="line"><a name="l05201"></a><span class="lineno"> 5201</span>&#160;        <span class="keyword">alignas</span>(T) <span class="keywordtype">char</span> Value[<span class="keyword">sizeof</span>(T)];</div>
+<div class="line"><a name="l05202"></a><span class="lineno"> 5202</span>&#160;    };</div>
+<div class="line"><a name="l05203"></a><span class="lineno"> 5203</span>&#160; </div>
+<div class="line"><a name="l05204"></a><span class="lineno"> 5204</span>&#160;    <span class="keyword">struct </span>ItemBlock</div>
+<div class="line"><a name="l05205"></a><span class="lineno"> 5205</span>&#160;    {</div>
+<div class="line"><a name="l05206"></a><span class="lineno"> 5206</span>&#160;        Item* pItems;</div>
+<div class="line"><a name="l05207"></a><span class="lineno"> 5207</span>&#160;        uint32_t Capacity;</div>
+<div class="line"><a name="l05208"></a><span class="lineno"> 5208</span>&#160;        uint32_t FirstFreeIndex;</div>
+<div class="line"><a name="l05209"></a><span class="lineno"> 5209</span>&#160;    };</div>
+<div class="line"><a name="l05210"></a><span class="lineno"> 5210</span>&#160;    </div>
+<div class="line"><a name="l05211"></a><span class="lineno"> 5211</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* m_pAllocationCallbacks;</div>
+<div class="line"><a name="l05212"></a><span class="lineno"> 5212</span>&#160;    <span class="keyword">const</span> uint32_t m_FirstBlockCapacity;</div>
+<div class="line"><a name="l05213"></a><span class="lineno"> 5213</span>&#160;    VmaVector&lt; ItemBlock, VmaStlAllocator&lt;ItemBlock&gt; &gt; m_ItemBlocks;</div>
+<div class="line"><a name="l05214"></a><span class="lineno"> 5214</span>&#160; </div>
+<div class="line"><a name="l05215"></a><span class="lineno"> 5215</span>&#160;    ItemBlock&amp; CreateNewBlock();</div>
+<div class="line"><a name="l05216"></a><span class="lineno"> 5216</span>&#160;};</div>
+<div class="line"><a name="l05217"></a><span class="lineno"> 5217</span>&#160; </div>
+<div class="line"><a name="l05218"></a><span class="lineno"> 5218</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05219"></a><span class="lineno"> 5219</span>&#160;VmaPoolAllocator&lt;T&gt;::VmaPoolAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, uint32_t firstBlockCapacity) :</div>
+<div class="line"><a name="l05220"></a><span class="lineno"> 5220</span>&#160;    m_pAllocationCallbacks(pAllocationCallbacks),</div>
+<div class="line"><a name="l05221"></a><span class="lineno"> 5221</span>&#160;    m_FirstBlockCapacity(firstBlockCapacity),</div>
+<div class="line"><a name="l05222"></a><span class="lineno"> 5222</span>&#160;    m_ItemBlocks(VmaStlAllocator&lt;ItemBlock&gt;(pAllocationCallbacks))</div>
+<div class="line"><a name="l05223"></a><span class="lineno"> 5223</span>&#160;{</div>
+<div class="line"><a name="l05224"></a><span class="lineno"> 5224</span>&#160;    VMA_ASSERT(m_FirstBlockCapacity &gt; 1);</div>
+<div class="line"><a name="l05225"></a><span class="lineno"> 5225</span>&#160;}</div>
+<div class="line"><a name="l05226"></a><span class="lineno"> 5226</span>&#160; </div>
+<div class="line"><a name="l05227"></a><span class="lineno"> 5227</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05228"></a><span class="lineno"> 5228</span>&#160;VmaPoolAllocator&lt;T&gt;::~VmaPoolAllocator()</div>
+<div class="line"><a name="l05229"></a><span class="lineno"> 5229</span>&#160;{</div>
+<div class="line"><a name="l05230"></a><span class="lineno"> 5230</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_ItemBlocks.size(); i--; )</div>
+<div class="line"><a name="l05231"></a><span class="lineno"> 5231</span>&#160;        vma_delete_array(m_pAllocationCallbacks, m_ItemBlocks[i].pItems, m_ItemBlocks[i].Capacity);</div>
+<div class="line"><a name="l05232"></a><span class="lineno"> 5232</span>&#160;    m_ItemBlocks.clear();</div>
+<div class="line"><a name="l05233"></a><span class="lineno"> 5233</span>&#160;}</div>
+<div class="line"><a name="l05234"></a><span class="lineno"> 5234</span>&#160; </div>
+<div class="line"><a name="l05235"></a><span class="lineno"> 5235</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05236"></a><span class="lineno"> 5236</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span>... Types&gt; T* VmaPoolAllocator&lt;T&gt;::Alloc(Types... args)</div>
+<div class="line"><a name="l05237"></a><span class="lineno"> 5237</span>&#160;{</div>
+<div class="line"><a name="l05238"></a><span class="lineno"> 5238</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_ItemBlocks.size(); i--; )</div>
+<div class="line"><a name="l05239"></a><span class="lineno"> 5239</span>&#160;    {</div>
+<div class="line"><a name="l05240"></a><span class="lineno"> 5240</span>&#160;        ItemBlock&amp; block = m_ItemBlocks[i];</div>
+<div class="line"><a name="l05241"></a><span class="lineno"> 5241</span>&#160;        <span class="comment">// This block has some free items: Use first one.</span></div>
+<div class="line"><a name="l05242"></a><span class="lineno"> 5242</span>&#160;        <span class="keywordflow">if</span>(block.FirstFreeIndex != UINT32_MAX)</div>
+<div class="line"><a name="l05243"></a><span class="lineno"> 5243</span>&#160;        {</div>
+<div class="line"><a name="l05244"></a><span class="lineno"> 5244</span>&#160;            Item* <span class="keyword">const</span> pItem = &amp;block.pItems[block.FirstFreeIndex];</div>
+<div class="line"><a name="l05245"></a><span class="lineno"> 5245</span>&#160;            block.FirstFreeIndex = pItem-&gt;NextFreeIndex;</div>
+<div class="line"><a name="l05246"></a><span class="lineno"> 5246</span>&#160;            T* result = (T*)&amp;pItem-&gt;Value;</div>
+<div class="line"><a name="l05247"></a><span class="lineno"> 5247</span>&#160;            <span class="keyword">new</span>(result)T(std::forward&lt;Types&gt;(args)...); <span class="comment">// Explicit constructor call.</span></div>
+<div class="line"><a name="l05248"></a><span class="lineno"> 5248</span>&#160;            <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l05249"></a><span class="lineno"> 5249</span>&#160;        }</div>
+<div class="line"><a name="l05250"></a><span class="lineno"> 5250</span>&#160;    }</div>
+<div class="line"><a name="l05251"></a><span class="lineno"> 5251</span>&#160; </div>
+<div class="line"><a name="l05252"></a><span class="lineno"> 5252</span>&#160;    <span class="comment">// No block has free item: Create new one and use it.</span></div>
+<div class="line"><a name="l05253"></a><span class="lineno"> 5253</span>&#160;    ItemBlock&amp; newBlock = CreateNewBlock();</div>
+<div class="line"><a name="l05254"></a><span class="lineno"> 5254</span>&#160;    Item* <span class="keyword">const</span> pItem = &amp;newBlock.pItems[0];</div>
+<div class="line"><a name="l05255"></a><span class="lineno"> 5255</span>&#160;    newBlock.FirstFreeIndex = pItem-&gt;NextFreeIndex;</div>
+<div class="line"><a name="l05256"></a><span class="lineno"> 5256</span>&#160;    T* result = (T*)&amp;pItem-&gt;Value;</div>
+<div class="line"><a name="l05257"></a><span class="lineno"> 5257</span>&#160;    <span class="keyword">new</span>(result)T(std::forward&lt;Types&gt;(args)...); <span class="comment">// Explicit constructor call.</span></div>
+<div class="line"><a name="l05258"></a><span class="lineno"> 5258</span>&#160;    <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l05259"></a><span class="lineno"> 5259</span>&#160;}</div>
+<div class="line"><a name="l05260"></a><span class="lineno"> 5260</span>&#160; </div>
+<div class="line"><a name="l05261"></a><span class="lineno"> 5261</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05262"></a><span class="lineno"> 5262</span>&#160;<span class="keywordtype">void</span> VmaPoolAllocator&lt;T&gt;::Free(T* ptr)</div>
+<div class="line"><a name="l05263"></a><span class="lineno"> 5263</span>&#160;{</div>
+<div class="line"><a name="l05264"></a><span class="lineno"> 5264</span>&#160;    <span class="comment">// Search all memory blocks to find ptr.</span></div>
+<div class="line"><a name="l05265"></a><span class="lineno"> 5265</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_ItemBlocks.size(); i--; )</div>
+<div class="line"><a name="l05266"></a><span class="lineno"> 5266</span>&#160;    {</div>
+<div class="line"><a name="l05267"></a><span class="lineno"> 5267</span>&#160;        ItemBlock&amp; block = m_ItemBlocks[i];</div>
+<div class="line"><a name="l05268"></a><span class="lineno"> 5268</span>&#160;        </div>
+<div class="line"><a name="l05269"></a><span class="lineno"> 5269</span>&#160;        <span class="comment">// Casting to union.</span></div>
+<div class="line"><a name="l05270"></a><span class="lineno"> 5270</span>&#160;        Item* pItemPtr;</div>
+<div class="line"><a name="l05271"></a><span class="lineno"> 5271</span>&#160;        memcpy(&amp;pItemPtr, &amp;ptr, <span class="keyword">sizeof</span>(pItemPtr));</div>
+<div class="line"><a name="l05272"></a><span class="lineno"> 5272</span>&#160;        </div>
+<div class="line"><a name="l05273"></a><span class="lineno"> 5273</span>&#160;        <span class="comment">// Check if pItemPtr is in address range of this block.</span></div>
+<div class="line"><a name="l05274"></a><span class="lineno"> 5274</span>&#160;        <span class="keywordflow">if</span>((pItemPtr &gt;= block.pItems) &amp;&amp; (pItemPtr &lt; block.pItems + block.Capacity))</div>
+<div class="line"><a name="l05275"></a><span class="lineno"> 5275</span>&#160;        {</div>
+<div class="line"><a name="l05276"></a><span class="lineno"> 5276</span>&#160;            ptr-&gt;~T(); <span class="comment">// Explicit destructor call.</span></div>
+<div class="line"><a name="l05277"></a><span class="lineno"> 5277</span>&#160;            <span class="keyword">const</span> uint32_t index = <span class="keyword">static_cast&lt;</span>uint32_t<span class="keyword">&gt;</span>(pItemPtr - block.pItems);</div>
+<div class="line"><a name="l05278"></a><span class="lineno"> 5278</span>&#160;            pItemPtr-&gt;NextFreeIndex = block.FirstFreeIndex;</div>
+<div class="line"><a name="l05279"></a><span class="lineno"> 5279</span>&#160;            block.FirstFreeIndex = index;</div>
+<div class="line"><a name="l05280"></a><span class="lineno"> 5280</span>&#160;            <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l05281"></a><span class="lineno"> 5281</span>&#160;        }</div>
+<div class="line"><a name="l05282"></a><span class="lineno"> 5282</span>&#160;    }</div>
+<div class="line"><a name="l05283"></a><span class="lineno"> 5283</span>&#160;    VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Pointer doesn&#39;t belong to this memory pool.&quot;</span>);</div>
+<div class="line"><a name="l05284"></a><span class="lineno"> 5284</span>&#160;}</div>
+<div class="line"><a name="l05285"></a><span class="lineno"> 5285</span>&#160; </div>
+<div class="line"><a name="l05286"></a><span class="lineno"> 5286</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05287"></a><span class="lineno"> 5287</span>&#160;<span class="keyword">typename</span> VmaPoolAllocator&lt;T&gt;::ItemBlock&amp; VmaPoolAllocator&lt;T&gt;::CreateNewBlock()</div>
+<div class="line"><a name="l05288"></a><span class="lineno"> 5288</span>&#160;{</div>
+<div class="line"><a name="l05289"></a><span class="lineno"> 5289</span>&#160;    <span class="keyword">const</span> uint32_t newBlockCapacity = m_ItemBlocks.empty() ?</div>
+<div class="line"><a name="l05290"></a><span class="lineno"> 5290</span>&#160;        m_FirstBlockCapacity : m_ItemBlocks.back().Capacity * 3 / 2;</div>
+<div class="line"><a name="l05291"></a><span class="lineno"> 5291</span>&#160; </div>
+<div class="line"><a name="l05292"></a><span class="lineno"> 5292</span>&#160;    <span class="keyword">const</span> ItemBlock newBlock = {</div>
+<div class="line"><a name="l05293"></a><span class="lineno"> 5293</span>&#160;        vma_new_array(m_pAllocationCallbacks, Item, newBlockCapacity),</div>
+<div class="line"><a name="l05294"></a><span class="lineno"> 5294</span>&#160;        newBlockCapacity,</div>
+<div class="line"><a name="l05295"></a><span class="lineno"> 5295</span>&#160;        0 };</div>
+<div class="line"><a name="l05296"></a><span class="lineno"> 5296</span>&#160; </div>
+<div class="line"><a name="l05297"></a><span class="lineno"> 5297</span>&#160;    m_ItemBlocks.push_back(newBlock);</div>
+<div class="line"><a name="l05298"></a><span class="lineno"> 5298</span>&#160; </div>
+<div class="line"><a name="l05299"></a><span class="lineno"> 5299</span>&#160;    <span class="comment">// Setup singly-linked list of all free items in this block.</span></div>
+<div class="line"><a name="l05300"></a><span class="lineno"> 5300</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; newBlockCapacity - 1; ++i)</div>
+<div class="line"><a name="l05301"></a><span class="lineno"> 5301</span>&#160;        newBlock.pItems[i].NextFreeIndex = i + 1;</div>
+<div class="line"><a name="l05302"></a><span class="lineno"> 5302</span>&#160;    newBlock.pItems[newBlockCapacity - 1].NextFreeIndex = UINT32_MAX;</div>
+<div class="line"><a name="l05303"></a><span class="lineno"> 5303</span>&#160;    <span class="keywordflow">return</span> m_ItemBlocks.back();</div>
+<div class="line"><a name="l05304"></a><span class="lineno"> 5304</span>&#160;}</div>
+<div class="line"><a name="l05305"></a><span class="lineno"> 5305</span>&#160; </div>
+<div class="line"><a name="l05307"></a><span class="lineno"> 5307</span>&#160;<span class="comment">// class VmaRawList, VmaList</span></div>
+<div class="line"><a name="l05308"></a><span class="lineno"> 5308</span>&#160; </div>
+<div class="line"><a name="l05309"></a><span class="lineno"> 5309</span>&#160;<span class="preprocessor">#if VMA_USE_STL_LIST</span></div>
+<div class="line"><a name="l05310"></a><span class="lineno"> 5310</span>&#160; </div>
+<div class="line"><a name="l05311"></a><span class="lineno"> 5311</span>&#160;<span class="preprocessor">#define VmaList std::list</span></div>
+<div class="line"><a name="l05312"></a><span class="lineno"> 5312</span>&#160; </div>
+<div class="line"><a name="l05313"></a><span class="lineno"> 5313</span>&#160;<span class="preprocessor">#else // #if VMA_USE_STL_LIST</span></div>
+<div class="line"><a name="l05314"></a><span class="lineno"> 5314</span>&#160; </div>
+<div class="line"><a name="l05315"></a><span class="lineno"> 5315</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05316"></a><span class="lineno"> 5316</span>&#160;<span class="keyword">struct </span>VmaListItem</div>
+<div class="line"><a name="l05317"></a><span class="lineno"> 5317</span>&#160;{</div>
+<div class="line"><a name="l05318"></a><span class="lineno"> 5318</span>&#160;    VmaListItem* pPrev;</div>
+<div class="line"><a name="l05319"></a><span class="lineno"> 5319</span>&#160;    VmaListItem* pNext;</div>
+<div class="line"><a name="l05320"></a><span class="lineno"> 5320</span>&#160;    T Value;</div>
+<div class="line"><a name="l05321"></a><span class="lineno"> 5321</span>&#160;};</div>
+<div class="line"><a name="l05322"></a><span class="lineno"> 5322</span>&#160; </div>
+<div class="line"><a name="l05323"></a><span class="lineno"> 5323</span>&#160;<span class="comment">// Doubly linked list.</span></div>
+<div class="line"><a name="l05324"></a><span class="lineno"> 5324</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05325"></a><span class="lineno"> 5325</span>&#160;<span class="keyword">class </span>VmaRawList</div>
+<div class="line"><a name="l05326"></a><span class="lineno"> 5326</span>&#160;{</div>
+<div class="line"><a name="l05327"></a><span class="lineno"> 5327</span>&#160;    VMA_CLASS_NO_COPY(VmaRawList)</div>
+<div class="line"><a name="l05328"></a><span class="lineno"> 5328</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l05329"></a><span class="lineno"> 5329</span>&#160;    <span class="keyword">typedef</span> VmaListItem&lt;T&gt; ItemType;</div>
 <div class="line"><a name="l05330"></a><span class="lineno"> 5330</span>&#160; </div>
-<div class="line"><a name="l05331"></a><span class="lineno"> 5331</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05332"></a><span class="lineno"> 5332</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertAfter(ItemType* pItem)</div>
-<div class="line"><a name="l05333"></a><span class="lineno"> 5333</span>&#160;{</div>
-<div class="line"><a name="l05334"></a><span class="lineno"> 5334</span>&#160;    <span class="keywordflow">if</span>(pItem != VMA_NULL)</div>
-<div class="line"><a name="l05335"></a><span class="lineno"> 5335</span>&#160;    {</div>
-<div class="line"><a name="l05336"></a><span class="lineno"> 5336</span>&#160;        ItemType* <span class="keyword">const</span> nextItem = pItem-&gt;pNext;</div>
-<div class="line"><a name="l05337"></a><span class="lineno"> 5337</span>&#160;        ItemType* <span class="keyword">const</span> newItem = m_ItemAllocator.Alloc();</div>
-<div class="line"><a name="l05338"></a><span class="lineno"> 5338</span>&#160;        newItem-&gt;pNext = nextItem;</div>
-<div class="line"><a name="l05339"></a><span class="lineno"> 5339</span>&#160;        newItem-&gt;pPrev = pItem;</div>
-<div class="line"><a name="l05340"></a><span class="lineno"> 5340</span>&#160;        pItem-&gt;pNext = newItem;</div>
-<div class="line"><a name="l05341"></a><span class="lineno"> 5341</span>&#160;        <span class="keywordflow">if</span>(nextItem != VMA_NULL)</div>
-<div class="line"><a name="l05342"></a><span class="lineno"> 5342</span>&#160;        {</div>
-<div class="line"><a name="l05343"></a><span class="lineno"> 5343</span>&#160;            nextItem-&gt;pPrev = newItem;</div>
-<div class="line"><a name="l05344"></a><span class="lineno"> 5344</span>&#160;        }</div>
-<div class="line"><a name="l05345"></a><span class="lineno"> 5345</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l05346"></a><span class="lineno"> 5346</span>&#160;        {</div>
-<div class="line"><a name="l05347"></a><span class="lineno"> 5347</span>&#160;            VMA_HEAVY_ASSERT(m_pBack == pItem);</div>
-<div class="line"><a name="l05348"></a><span class="lineno"> 5348</span>&#160;            m_pBack = newItem;</div>
-<div class="line"><a name="l05349"></a><span class="lineno"> 5349</span>&#160;        }</div>
-<div class="line"><a name="l05350"></a><span class="lineno"> 5350</span>&#160;        ++m_Count;</div>
-<div class="line"><a name="l05351"></a><span class="lineno"> 5351</span>&#160;        <span class="keywordflow">return</span> newItem;</div>
-<div class="line"><a name="l05352"></a><span class="lineno"> 5352</span>&#160;    }</div>
-<div class="line"><a name="l05353"></a><span class="lineno"> 5353</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l05354"></a><span class="lineno"> 5354</span>&#160;        <span class="keywordflow">return</span> PushFront();</div>
-<div class="line"><a name="l05355"></a><span class="lineno"> 5355</span>&#160;}</div>
-<div class="line"><a name="l05356"></a><span class="lineno"> 5356</span>&#160; </div>
-<div class="line"><a name="l05357"></a><span class="lineno"> 5357</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05358"></a><span class="lineno"> 5358</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertBefore(ItemType* pItem, <span class="keyword">const</span> T&amp; value)</div>
-<div class="line"><a name="l05359"></a><span class="lineno"> 5359</span>&#160;{</div>
-<div class="line"><a name="l05360"></a><span class="lineno"> 5360</span>&#160;    ItemType* <span class="keyword">const</span> newItem = InsertBefore(pItem);</div>
-<div class="line"><a name="l05361"></a><span class="lineno"> 5361</span>&#160;    newItem-&gt;Value = value;</div>
-<div class="line"><a name="l05362"></a><span class="lineno"> 5362</span>&#160;    <span class="keywordflow">return</span> newItem;</div>
-<div class="line"><a name="l05363"></a><span class="lineno"> 5363</span>&#160;}</div>
-<div class="line"><a name="l05364"></a><span class="lineno"> 5364</span>&#160; </div>
-<div class="line"><a name="l05365"></a><span class="lineno"> 5365</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l05366"></a><span class="lineno"> 5366</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertAfter(ItemType* pItem, <span class="keyword">const</span> T&amp; value)</div>
-<div class="line"><a name="l05367"></a><span class="lineno"> 5367</span>&#160;{</div>
-<div class="line"><a name="l05368"></a><span class="lineno"> 5368</span>&#160;    ItemType* <span class="keyword">const</span> newItem = InsertAfter(pItem);</div>
-<div class="line"><a name="l05369"></a><span class="lineno"> 5369</span>&#160;    newItem-&gt;Value = value;</div>
-<div class="line"><a name="l05370"></a><span class="lineno"> 5370</span>&#160;    <span class="keywordflow">return</span> newItem;</div>
-<div class="line"><a name="l05371"></a><span class="lineno"> 5371</span>&#160;}</div>
-<div class="line"><a name="l05372"></a><span class="lineno"> 5372</span>&#160; </div>
-<div class="line"><a name="l05373"></a><span class="lineno"> 5373</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> AllocatorT&gt;</div>
-<div class="line"><a name="l05374"></a><span class="lineno"> 5374</span>&#160;<span class="keyword">class </span>VmaList</div>
+<div class="line"><a name="l05331"></a><span class="lineno"> 5331</span>&#160;    VmaRawList(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks);</div>
+<div class="line"><a name="l05332"></a><span class="lineno"> 5332</span>&#160;    ~VmaRawList();</div>
+<div class="line"><a name="l05333"></a><span class="lineno"> 5333</span>&#160;    <span class="keywordtype">void</span> Clear();</div>
+<div class="line"><a name="l05334"></a><span class="lineno"> 5334</span>&#160; </div>
+<div class="line"><a name="l05335"></a><span class="lineno"> 5335</span>&#160;    <span class="keywordtype">size_t</span> GetCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count; }</div>
+<div class="line"><a name="l05336"></a><span class="lineno"> 5336</span>&#160;    <span class="keywordtype">bool</span> IsEmpty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count == 0; }</div>
+<div class="line"><a name="l05337"></a><span class="lineno"> 5337</span>&#160; </div>
+<div class="line"><a name="l05338"></a><span class="lineno"> 5338</span>&#160;    ItemType* Front() { <span class="keywordflow">return</span> m_pFront; }</div>
+<div class="line"><a name="l05339"></a><span class="lineno"> 5339</span>&#160;    <span class="keyword">const</span> ItemType* Front()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pFront; }</div>
+<div class="line"><a name="l05340"></a><span class="lineno"> 5340</span>&#160;    ItemType* Back() { <span class="keywordflow">return</span> m_pBack; }</div>
+<div class="line"><a name="l05341"></a><span class="lineno"> 5341</span>&#160;    <span class="keyword">const</span> ItemType* Back()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pBack; }</div>
+<div class="line"><a name="l05342"></a><span class="lineno"> 5342</span>&#160; </div>
+<div class="line"><a name="l05343"></a><span class="lineno"> 5343</span>&#160;    ItemType* PushBack();</div>
+<div class="line"><a name="l05344"></a><span class="lineno"> 5344</span>&#160;    ItemType* PushFront();</div>
+<div class="line"><a name="l05345"></a><span class="lineno"> 5345</span>&#160;    ItemType* PushBack(<span class="keyword">const</span> T&amp; value);</div>
+<div class="line"><a name="l05346"></a><span class="lineno"> 5346</span>&#160;    ItemType* PushFront(<span class="keyword">const</span> T&amp; value);</div>
+<div class="line"><a name="l05347"></a><span class="lineno"> 5347</span>&#160;    <span class="keywordtype">void</span> PopBack();</div>
+<div class="line"><a name="l05348"></a><span class="lineno"> 5348</span>&#160;    <span class="keywordtype">void</span> PopFront();</div>
+<div class="line"><a name="l05349"></a><span class="lineno"> 5349</span>&#160;    </div>
+<div class="line"><a name="l05350"></a><span class="lineno"> 5350</span>&#160;    <span class="comment">// Item can be null - it means PushBack.</span></div>
+<div class="line"><a name="l05351"></a><span class="lineno"> 5351</span>&#160;    ItemType* InsertBefore(ItemType* pItem);</div>
+<div class="line"><a name="l05352"></a><span class="lineno"> 5352</span>&#160;    <span class="comment">// Item can be null - it means PushFront.</span></div>
+<div class="line"><a name="l05353"></a><span class="lineno"> 5353</span>&#160;    ItemType* InsertAfter(ItemType* pItem);</div>
+<div class="line"><a name="l05354"></a><span class="lineno"> 5354</span>&#160; </div>
+<div class="line"><a name="l05355"></a><span class="lineno"> 5355</span>&#160;    ItemType* InsertBefore(ItemType* pItem, <span class="keyword">const</span> T&amp; value);</div>
+<div class="line"><a name="l05356"></a><span class="lineno"> 5356</span>&#160;    ItemType* InsertAfter(ItemType* pItem, <span class="keyword">const</span> T&amp; value);</div>
+<div class="line"><a name="l05357"></a><span class="lineno"> 5357</span>&#160; </div>
+<div class="line"><a name="l05358"></a><span class="lineno"> 5358</span>&#160;    <span class="keywordtype">void</span> Remove(ItemType* pItem);</div>
+<div class="line"><a name="l05359"></a><span class="lineno"> 5359</span>&#160; </div>
+<div class="line"><a name="l05360"></a><span class="lineno"> 5360</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l05361"></a><span class="lineno"> 5361</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* <span class="keyword">const</span> m_pAllocationCallbacks;</div>
+<div class="line"><a name="l05362"></a><span class="lineno"> 5362</span>&#160;    VmaPoolAllocator&lt;ItemType&gt; m_ItemAllocator;</div>
+<div class="line"><a name="l05363"></a><span class="lineno"> 5363</span>&#160;    ItemType* m_pFront;</div>
+<div class="line"><a name="l05364"></a><span class="lineno"> 5364</span>&#160;    ItemType* m_pBack;</div>
+<div class="line"><a name="l05365"></a><span class="lineno"> 5365</span>&#160;    <span class="keywordtype">size_t</span> m_Count;</div>
+<div class="line"><a name="l05366"></a><span class="lineno"> 5366</span>&#160;};</div>
+<div class="line"><a name="l05367"></a><span class="lineno"> 5367</span>&#160; </div>
+<div class="line"><a name="l05368"></a><span class="lineno"> 5368</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05369"></a><span class="lineno"> 5369</span>&#160;VmaRawList&lt;T&gt;::VmaRawList(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks) :</div>
+<div class="line"><a name="l05370"></a><span class="lineno"> 5370</span>&#160;    m_pAllocationCallbacks(pAllocationCallbacks),</div>
+<div class="line"><a name="l05371"></a><span class="lineno"> 5371</span>&#160;    m_ItemAllocator(pAllocationCallbacks, 128),</div>
+<div class="line"><a name="l05372"></a><span class="lineno"> 5372</span>&#160;    m_pFront(VMA_NULL),</div>
+<div class="line"><a name="l05373"></a><span class="lineno"> 5373</span>&#160;    m_pBack(VMA_NULL),</div>
+<div class="line"><a name="l05374"></a><span class="lineno"> 5374</span>&#160;    m_Count(0)</div>
 <div class="line"><a name="l05375"></a><span class="lineno"> 5375</span>&#160;{</div>
-<div class="line"><a name="l05376"></a><span class="lineno"> 5376</span>&#160;    VMA_CLASS_NO_COPY(VmaList)</div>
-<div class="line"><a name="l05377"></a><span class="lineno"> 5377</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l05378"></a><span class="lineno"> 5378</span>&#160;    <span class="keyword">class </span>iterator</div>
-<div class="line"><a name="l05379"></a><span class="lineno"> 5379</span>&#160;    {</div>
-<div class="line"><a name="l05380"></a><span class="lineno"> 5380</span>&#160;    <span class="keyword">public</span>:</div>
-<div class="line"><a name="l05381"></a><span class="lineno"> 5381</span>&#160;        iterator() :</div>
-<div class="line"><a name="l05382"></a><span class="lineno"> 5382</span>&#160;            m_pList(VMA_NULL),</div>
-<div class="line"><a name="l05383"></a><span class="lineno"> 5383</span>&#160;            m_pItem(VMA_NULL)</div>
-<div class="line"><a name="l05384"></a><span class="lineno"> 5384</span>&#160;        {</div>
-<div class="line"><a name="l05385"></a><span class="lineno"> 5385</span>&#160;        }</div>
-<div class="line"><a name="l05386"></a><span class="lineno"> 5386</span>&#160; </div>
-<div class="line"><a name="l05387"></a><span class="lineno"> 5387</span>&#160;        T&amp; operator*()<span class="keyword"> const</span></div>
-<div class="line"><a name="l05388"></a><span class="lineno"> 5388</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l05389"></a><span class="lineno"> 5389</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
-<div class="line"><a name="l05390"></a><span class="lineno"> 5390</span>&#160;            <span class="keywordflow">return</span> m_pItem-&gt;Value;</div>
-<div class="line"><a name="l05391"></a><span class="lineno"> 5391</span>&#160;        }</div>
-<div class="line"><a name="l05392"></a><span class="lineno"> 5392</span>&#160;        T* operator-&gt;()<span class="keyword"> const</span></div>
-<div class="line"><a name="l05393"></a><span class="lineno"> 5393</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l05394"></a><span class="lineno"> 5394</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
-<div class="line"><a name="l05395"></a><span class="lineno"> 5395</span>&#160;            <span class="keywordflow">return</span> &amp;m_pItem-&gt;Value;</div>
+<div class="line"><a name="l05376"></a><span class="lineno"> 5376</span>&#160;}</div>
+<div class="line"><a name="l05377"></a><span class="lineno"> 5377</span>&#160; </div>
+<div class="line"><a name="l05378"></a><span class="lineno"> 5378</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05379"></a><span class="lineno"> 5379</span>&#160;VmaRawList&lt;T&gt;::~VmaRawList()</div>
+<div class="line"><a name="l05380"></a><span class="lineno"> 5380</span>&#160;{</div>
+<div class="line"><a name="l05381"></a><span class="lineno"> 5381</span>&#160;    <span class="comment">// Intentionally not calling Clear, because that would be unnecessary</span></div>
+<div class="line"><a name="l05382"></a><span class="lineno"> 5382</span>&#160;    <span class="comment">// computations to return all items to m_ItemAllocator as free.</span></div>
+<div class="line"><a name="l05383"></a><span class="lineno"> 5383</span>&#160;}</div>
+<div class="line"><a name="l05384"></a><span class="lineno"> 5384</span>&#160; </div>
+<div class="line"><a name="l05385"></a><span class="lineno"> 5385</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05386"></a><span class="lineno"> 5386</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::Clear()</div>
+<div class="line"><a name="l05387"></a><span class="lineno"> 5387</span>&#160;{</div>
+<div class="line"><a name="l05388"></a><span class="lineno"> 5388</span>&#160;    <span class="keywordflow">if</span>(IsEmpty() == <span class="keyword">false</span>)</div>
+<div class="line"><a name="l05389"></a><span class="lineno"> 5389</span>&#160;    {</div>
+<div class="line"><a name="l05390"></a><span class="lineno"> 5390</span>&#160;        ItemType* pItem = m_pBack;</div>
+<div class="line"><a name="l05391"></a><span class="lineno"> 5391</span>&#160;        <span class="keywordflow">while</span>(pItem != VMA_NULL)</div>
+<div class="line"><a name="l05392"></a><span class="lineno"> 5392</span>&#160;        {</div>
+<div class="line"><a name="l05393"></a><span class="lineno"> 5393</span>&#160;            ItemType* <span class="keyword">const</span> pPrevItem = pItem-&gt;pPrev;</div>
+<div class="line"><a name="l05394"></a><span class="lineno"> 5394</span>&#160;            m_ItemAllocator.Free(pItem);</div>
+<div class="line"><a name="l05395"></a><span class="lineno"> 5395</span>&#160;            pItem = pPrevItem;</div>
 <div class="line"><a name="l05396"></a><span class="lineno"> 5396</span>&#160;        }</div>
-<div class="line"><a name="l05397"></a><span class="lineno"> 5397</span>&#160; </div>
-<div class="line"><a name="l05398"></a><span class="lineno"> 5398</span>&#160;        iterator&amp; operator++()</div>
-<div class="line"><a name="l05399"></a><span class="lineno"> 5399</span>&#160;        {</div>
-<div class="line"><a name="l05400"></a><span class="lineno"> 5400</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
-<div class="line"><a name="l05401"></a><span class="lineno"> 5401</span>&#160;            m_pItem = m_pItem-&gt;pNext;</div>
-<div class="line"><a name="l05402"></a><span class="lineno"> 5402</span>&#160;            <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05403"></a><span class="lineno"> 5403</span>&#160;        }</div>
-<div class="line"><a name="l05404"></a><span class="lineno"> 5404</span>&#160;        iterator&amp; operator--()</div>
-<div class="line"><a name="l05405"></a><span class="lineno"> 5405</span>&#160;        {</div>
-<div class="line"><a name="l05406"></a><span class="lineno"> 5406</span>&#160;            <span class="keywordflow">if</span>(m_pItem != VMA_NULL)</div>
-<div class="line"><a name="l05407"></a><span class="lineno"> 5407</span>&#160;            {</div>
-<div class="line"><a name="l05408"></a><span class="lineno"> 5408</span>&#160;                m_pItem = m_pItem-&gt;pPrev;</div>
-<div class="line"><a name="l05409"></a><span class="lineno"> 5409</span>&#160;            }</div>
-<div class="line"><a name="l05410"></a><span class="lineno"> 5410</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l05411"></a><span class="lineno"> 5411</span>&#160;            {</div>
-<div class="line"><a name="l05412"></a><span class="lineno"> 5412</span>&#160;                VMA_HEAVY_ASSERT(!m_pList-&gt;IsEmpty());</div>
-<div class="line"><a name="l05413"></a><span class="lineno"> 5413</span>&#160;                m_pItem = m_pList-&gt;Back();</div>
-<div class="line"><a name="l05414"></a><span class="lineno"> 5414</span>&#160;            }</div>
-<div class="line"><a name="l05415"></a><span class="lineno"> 5415</span>&#160;            <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05416"></a><span class="lineno"> 5416</span>&#160;        }</div>
-<div class="line"><a name="l05417"></a><span class="lineno"> 5417</span>&#160; </div>
-<div class="line"><a name="l05418"></a><span class="lineno"> 5418</span>&#160;        iterator operator++(<span class="keywordtype">int</span>)</div>
-<div class="line"><a name="l05419"></a><span class="lineno"> 5419</span>&#160;        {</div>
-<div class="line"><a name="l05420"></a><span class="lineno"> 5420</span>&#160;            iterator result = *<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05421"></a><span class="lineno"> 5421</span>&#160;            ++*<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05422"></a><span class="lineno"> 5422</span>&#160;            <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l05423"></a><span class="lineno"> 5423</span>&#160;        }</div>
-<div class="line"><a name="l05424"></a><span class="lineno"> 5424</span>&#160;        iterator operator--(<span class="keywordtype">int</span>)</div>
-<div class="line"><a name="l05425"></a><span class="lineno"> 5425</span>&#160;        {</div>
-<div class="line"><a name="l05426"></a><span class="lineno"> 5426</span>&#160;            iterator result = *<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05427"></a><span class="lineno"> 5427</span>&#160;            --*<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05428"></a><span class="lineno"> 5428</span>&#160;            <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l05429"></a><span class="lineno"> 5429</span>&#160;        }</div>
-<div class="line"><a name="l05430"></a><span class="lineno"> 5430</span>&#160; </div>
-<div class="line"><a name="l05431"></a><span class="lineno"> 5431</span>&#160;        <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> iterator&amp; rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l05432"></a><span class="lineno"> 5432</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l05433"></a><span class="lineno"> 5433</span>&#160;            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
-<div class="line"><a name="l05434"></a><span class="lineno"> 5434</span>&#160;            <span class="keywordflow">return</span> m_pItem == rhs.m_pItem;</div>
-<div class="line"><a name="l05435"></a><span class="lineno"> 5435</span>&#160;        }</div>
-<div class="line"><a name="l05436"></a><span class="lineno"> 5436</span>&#160;        <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> iterator&amp; rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l05437"></a><span class="lineno"> 5437</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l05438"></a><span class="lineno"> 5438</span>&#160;            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
-<div class="line"><a name="l05439"></a><span class="lineno"> 5439</span>&#160;            <span class="keywordflow">return</span> m_pItem != rhs.m_pItem;</div>
-<div class="line"><a name="l05440"></a><span class="lineno"> 5440</span>&#160;        }</div>
-<div class="line"><a name="l05441"></a><span class="lineno"> 5441</span>&#160;        </div>
-<div class="line"><a name="l05442"></a><span class="lineno"> 5442</span>&#160;    <span class="keyword">private</span>:</div>
-<div class="line"><a name="l05443"></a><span class="lineno"> 5443</span>&#160;        VmaRawList&lt;T&gt;* m_pList;</div>
-<div class="line"><a name="l05444"></a><span class="lineno"> 5444</span>&#160;        VmaListItem&lt;T&gt;* m_pItem;</div>
-<div class="line"><a name="l05445"></a><span class="lineno"> 5445</span>&#160; </div>
-<div class="line"><a name="l05446"></a><span class="lineno"> 5446</span>&#160;        iterator(VmaRawList&lt;T&gt;* pList, VmaListItem&lt;T&gt;* pItem) :</div>
-<div class="line"><a name="l05447"></a><span class="lineno"> 5447</span>&#160;            m_pList(pList),</div>
-<div class="line"><a name="l05448"></a><span class="lineno"> 5448</span>&#160;            m_pItem(pItem)</div>
-<div class="line"><a name="l05449"></a><span class="lineno"> 5449</span>&#160;        {</div>
-<div class="line"><a name="l05450"></a><span class="lineno"> 5450</span>&#160;        }</div>
-<div class="line"><a name="l05451"></a><span class="lineno"> 5451</span>&#160; </div>
-<div class="line"><a name="l05452"></a><span class="lineno"> 5452</span>&#160;        <span class="keyword">friend</span> <span class="keyword">class </span>VmaList&lt;T, AllocatorT&gt;;</div>
-<div class="line"><a name="l05453"></a><span class="lineno"> 5453</span>&#160;    };</div>
+<div class="line"><a name="l05397"></a><span class="lineno"> 5397</span>&#160;        m_pFront = VMA_NULL;</div>
+<div class="line"><a name="l05398"></a><span class="lineno"> 5398</span>&#160;        m_pBack = VMA_NULL;</div>
+<div class="line"><a name="l05399"></a><span class="lineno"> 5399</span>&#160;        m_Count = 0;</div>
+<div class="line"><a name="l05400"></a><span class="lineno"> 5400</span>&#160;    }</div>
+<div class="line"><a name="l05401"></a><span class="lineno"> 5401</span>&#160;}</div>
+<div class="line"><a name="l05402"></a><span class="lineno"> 5402</span>&#160; </div>
+<div class="line"><a name="l05403"></a><span class="lineno"> 5403</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05404"></a><span class="lineno"> 5404</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushBack()</div>
+<div class="line"><a name="l05405"></a><span class="lineno"> 5405</span>&#160;{</div>
+<div class="line"><a name="l05406"></a><span class="lineno"> 5406</span>&#160;    ItemType* <span class="keyword">const</span> pNewItem = m_ItemAllocator.Alloc();</div>
+<div class="line"><a name="l05407"></a><span class="lineno"> 5407</span>&#160;    pNewItem-&gt;pNext = VMA_NULL;</div>
+<div class="line"><a name="l05408"></a><span class="lineno"> 5408</span>&#160;    <span class="keywordflow">if</span>(IsEmpty())</div>
+<div class="line"><a name="l05409"></a><span class="lineno"> 5409</span>&#160;    {</div>
+<div class="line"><a name="l05410"></a><span class="lineno"> 5410</span>&#160;        pNewItem-&gt;pPrev = VMA_NULL;</div>
+<div class="line"><a name="l05411"></a><span class="lineno"> 5411</span>&#160;        m_pFront = pNewItem;</div>
+<div class="line"><a name="l05412"></a><span class="lineno"> 5412</span>&#160;        m_pBack = pNewItem;</div>
+<div class="line"><a name="l05413"></a><span class="lineno"> 5413</span>&#160;        m_Count = 1;</div>
+<div class="line"><a name="l05414"></a><span class="lineno"> 5414</span>&#160;    }</div>
+<div class="line"><a name="l05415"></a><span class="lineno"> 5415</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05416"></a><span class="lineno"> 5416</span>&#160;    {</div>
+<div class="line"><a name="l05417"></a><span class="lineno"> 5417</span>&#160;        pNewItem-&gt;pPrev = m_pBack;</div>
+<div class="line"><a name="l05418"></a><span class="lineno"> 5418</span>&#160;        m_pBack-&gt;pNext = pNewItem;</div>
+<div class="line"><a name="l05419"></a><span class="lineno"> 5419</span>&#160;        m_pBack = pNewItem;</div>
+<div class="line"><a name="l05420"></a><span class="lineno"> 5420</span>&#160;        ++m_Count;</div>
+<div class="line"><a name="l05421"></a><span class="lineno"> 5421</span>&#160;    }</div>
+<div class="line"><a name="l05422"></a><span class="lineno"> 5422</span>&#160;    <span class="keywordflow">return</span> pNewItem;</div>
+<div class="line"><a name="l05423"></a><span class="lineno"> 5423</span>&#160;}</div>
+<div class="line"><a name="l05424"></a><span class="lineno"> 5424</span>&#160; </div>
+<div class="line"><a name="l05425"></a><span class="lineno"> 5425</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05426"></a><span class="lineno"> 5426</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushFront()</div>
+<div class="line"><a name="l05427"></a><span class="lineno"> 5427</span>&#160;{</div>
+<div class="line"><a name="l05428"></a><span class="lineno"> 5428</span>&#160;    ItemType* <span class="keyword">const</span> pNewItem = m_ItemAllocator.Alloc();</div>
+<div class="line"><a name="l05429"></a><span class="lineno"> 5429</span>&#160;    pNewItem-&gt;pPrev = VMA_NULL;</div>
+<div class="line"><a name="l05430"></a><span class="lineno"> 5430</span>&#160;    <span class="keywordflow">if</span>(IsEmpty())</div>
+<div class="line"><a name="l05431"></a><span class="lineno"> 5431</span>&#160;    {</div>
+<div class="line"><a name="l05432"></a><span class="lineno"> 5432</span>&#160;        pNewItem-&gt;pNext = VMA_NULL;</div>
+<div class="line"><a name="l05433"></a><span class="lineno"> 5433</span>&#160;        m_pFront = pNewItem;</div>
+<div class="line"><a name="l05434"></a><span class="lineno"> 5434</span>&#160;        m_pBack = pNewItem;</div>
+<div class="line"><a name="l05435"></a><span class="lineno"> 5435</span>&#160;        m_Count = 1;</div>
+<div class="line"><a name="l05436"></a><span class="lineno"> 5436</span>&#160;    }</div>
+<div class="line"><a name="l05437"></a><span class="lineno"> 5437</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05438"></a><span class="lineno"> 5438</span>&#160;    {</div>
+<div class="line"><a name="l05439"></a><span class="lineno"> 5439</span>&#160;        pNewItem-&gt;pNext = m_pFront;</div>
+<div class="line"><a name="l05440"></a><span class="lineno"> 5440</span>&#160;        m_pFront-&gt;pPrev = pNewItem;</div>
+<div class="line"><a name="l05441"></a><span class="lineno"> 5441</span>&#160;        m_pFront = pNewItem;</div>
+<div class="line"><a name="l05442"></a><span class="lineno"> 5442</span>&#160;        ++m_Count;</div>
+<div class="line"><a name="l05443"></a><span class="lineno"> 5443</span>&#160;    }</div>
+<div class="line"><a name="l05444"></a><span class="lineno"> 5444</span>&#160;    <span class="keywordflow">return</span> pNewItem;</div>
+<div class="line"><a name="l05445"></a><span class="lineno"> 5445</span>&#160;}</div>
+<div class="line"><a name="l05446"></a><span class="lineno"> 5446</span>&#160; </div>
+<div class="line"><a name="l05447"></a><span class="lineno"> 5447</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05448"></a><span class="lineno"> 5448</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushBack(<span class="keyword">const</span> T&amp; value)</div>
+<div class="line"><a name="l05449"></a><span class="lineno"> 5449</span>&#160;{</div>
+<div class="line"><a name="l05450"></a><span class="lineno"> 5450</span>&#160;    ItemType* <span class="keyword">const</span> pNewItem = PushBack();</div>
+<div class="line"><a name="l05451"></a><span class="lineno"> 5451</span>&#160;    pNewItem-&gt;Value = value;</div>
+<div class="line"><a name="l05452"></a><span class="lineno"> 5452</span>&#160;    <span class="keywordflow">return</span> pNewItem;</div>
+<div class="line"><a name="l05453"></a><span class="lineno"> 5453</span>&#160;}</div>
 <div class="line"><a name="l05454"></a><span class="lineno"> 5454</span>&#160; </div>
-<div class="line"><a name="l05455"></a><span class="lineno"> 5455</span>&#160;    <span class="keyword">class </span>const_iterator</div>
-<div class="line"><a name="l05456"></a><span class="lineno"> 5456</span>&#160;    {</div>
-<div class="line"><a name="l05457"></a><span class="lineno"> 5457</span>&#160;    <span class="keyword">public</span>:</div>
-<div class="line"><a name="l05458"></a><span class="lineno"> 5458</span>&#160;        const_iterator() :</div>
-<div class="line"><a name="l05459"></a><span class="lineno"> 5459</span>&#160;            m_pList(VMA_NULL),</div>
-<div class="line"><a name="l05460"></a><span class="lineno"> 5460</span>&#160;            m_pItem(VMA_NULL)</div>
-<div class="line"><a name="l05461"></a><span class="lineno"> 5461</span>&#160;        {</div>
-<div class="line"><a name="l05462"></a><span class="lineno"> 5462</span>&#160;        }</div>
-<div class="line"><a name="l05463"></a><span class="lineno"> 5463</span>&#160; </div>
-<div class="line"><a name="l05464"></a><span class="lineno"> 5464</span>&#160;        const_iterator(<span class="keyword">const</span> iterator&amp; src) :</div>
-<div class="line"><a name="l05465"></a><span class="lineno"> 5465</span>&#160;            m_pList(src.m_pList),</div>
-<div class="line"><a name="l05466"></a><span class="lineno"> 5466</span>&#160;            m_pItem(src.m_pItem)</div>
-<div class="line"><a name="l05467"></a><span class="lineno"> 5467</span>&#160;        {</div>
-<div class="line"><a name="l05468"></a><span class="lineno"> 5468</span>&#160;        }</div>
-<div class="line"><a name="l05469"></a><span class="lineno"> 5469</span>&#160;        </div>
-<div class="line"><a name="l05470"></a><span class="lineno"> 5470</span>&#160;        <span class="keyword">const</span> T&amp; operator*()<span class="keyword"> const</span></div>
-<div class="line"><a name="l05471"></a><span class="lineno"> 5471</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l05472"></a><span class="lineno"> 5472</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
-<div class="line"><a name="l05473"></a><span class="lineno"> 5473</span>&#160;            <span class="keywordflow">return</span> m_pItem-&gt;Value;</div>
-<div class="line"><a name="l05474"></a><span class="lineno"> 5474</span>&#160;        }</div>
-<div class="line"><a name="l05475"></a><span class="lineno"> 5475</span>&#160;        <span class="keyword">const</span> T* operator-&gt;()<span class="keyword"> const</span></div>
-<div class="line"><a name="l05476"></a><span class="lineno"> 5476</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l05477"></a><span class="lineno"> 5477</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
-<div class="line"><a name="l05478"></a><span class="lineno"> 5478</span>&#160;            <span class="keywordflow">return</span> &amp;m_pItem-&gt;Value;</div>
-<div class="line"><a name="l05479"></a><span class="lineno"> 5479</span>&#160;        }</div>
-<div class="line"><a name="l05480"></a><span class="lineno"> 5480</span>&#160; </div>
-<div class="line"><a name="l05481"></a><span class="lineno"> 5481</span>&#160;        const_iterator&amp; operator++()</div>
-<div class="line"><a name="l05482"></a><span class="lineno"> 5482</span>&#160;        {</div>
-<div class="line"><a name="l05483"></a><span class="lineno"> 5483</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
-<div class="line"><a name="l05484"></a><span class="lineno"> 5484</span>&#160;            m_pItem = m_pItem-&gt;pNext;</div>
-<div class="line"><a name="l05485"></a><span class="lineno"> 5485</span>&#160;            <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05486"></a><span class="lineno"> 5486</span>&#160;        }</div>
-<div class="line"><a name="l05487"></a><span class="lineno"> 5487</span>&#160;        const_iterator&amp; operator--()</div>
-<div class="line"><a name="l05488"></a><span class="lineno"> 5488</span>&#160;        {</div>
-<div class="line"><a name="l05489"></a><span class="lineno"> 5489</span>&#160;            <span class="keywordflow">if</span>(m_pItem != VMA_NULL)</div>
-<div class="line"><a name="l05490"></a><span class="lineno"> 5490</span>&#160;            {</div>
-<div class="line"><a name="l05491"></a><span class="lineno"> 5491</span>&#160;                m_pItem = m_pItem-&gt;pPrev;</div>
-<div class="line"><a name="l05492"></a><span class="lineno"> 5492</span>&#160;            }</div>
-<div class="line"><a name="l05493"></a><span class="lineno"> 5493</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l05494"></a><span class="lineno"> 5494</span>&#160;            {</div>
-<div class="line"><a name="l05495"></a><span class="lineno"> 5495</span>&#160;                VMA_HEAVY_ASSERT(!m_pList-&gt;IsEmpty());</div>
-<div class="line"><a name="l05496"></a><span class="lineno"> 5496</span>&#160;                m_pItem = m_pList-&gt;Back();</div>
-<div class="line"><a name="l05497"></a><span class="lineno"> 5497</span>&#160;            }</div>
-<div class="line"><a name="l05498"></a><span class="lineno"> 5498</span>&#160;            <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05499"></a><span class="lineno"> 5499</span>&#160;        }</div>
-<div class="line"><a name="l05500"></a><span class="lineno"> 5500</span>&#160; </div>
-<div class="line"><a name="l05501"></a><span class="lineno"> 5501</span>&#160;        const_iterator operator++(<span class="keywordtype">int</span>)</div>
-<div class="line"><a name="l05502"></a><span class="lineno"> 5502</span>&#160;        {</div>
-<div class="line"><a name="l05503"></a><span class="lineno"> 5503</span>&#160;            const_iterator result = *<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05504"></a><span class="lineno"> 5504</span>&#160;            ++*<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05505"></a><span class="lineno"> 5505</span>&#160;            <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l05506"></a><span class="lineno"> 5506</span>&#160;        }</div>
-<div class="line"><a name="l05507"></a><span class="lineno"> 5507</span>&#160;        const_iterator operator--(<span class="keywordtype">int</span>)</div>
-<div class="line"><a name="l05508"></a><span class="lineno"> 5508</span>&#160;        {</div>
-<div class="line"><a name="l05509"></a><span class="lineno"> 5509</span>&#160;            const_iterator result = *<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05510"></a><span class="lineno"> 5510</span>&#160;            --*<span class="keyword">this</span>;</div>
-<div class="line"><a name="l05511"></a><span class="lineno"> 5511</span>&#160;            <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l05512"></a><span class="lineno"> 5512</span>&#160;        }</div>
-<div class="line"><a name="l05513"></a><span class="lineno"> 5513</span>&#160; </div>
-<div class="line"><a name="l05514"></a><span class="lineno"> 5514</span>&#160;        <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> const_iterator&amp; rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l05515"></a><span class="lineno"> 5515</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l05516"></a><span class="lineno"> 5516</span>&#160;            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
-<div class="line"><a name="l05517"></a><span class="lineno"> 5517</span>&#160;            <span class="keywordflow">return</span> m_pItem == rhs.m_pItem;</div>
-<div class="line"><a name="l05518"></a><span class="lineno"> 5518</span>&#160;        }</div>
-<div class="line"><a name="l05519"></a><span class="lineno"> 5519</span>&#160;        <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> const_iterator&amp; rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l05520"></a><span class="lineno"> 5520</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l05521"></a><span class="lineno"> 5521</span>&#160;            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
-<div class="line"><a name="l05522"></a><span class="lineno"> 5522</span>&#160;            <span class="keywordflow">return</span> m_pItem != rhs.m_pItem;</div>
-<div class="line"><a name="l05523"></a><span class="lineno"> 5523</span>&#160;        }</div>
-<div class="line"><a name="l05524"></a><span class="lineno"> 5524</span>&#160;        </div>
-<div class="line"><a name="l05525"></a><span class="lineno"> 5525</span>&#160;    <span class="keyword">private</span>:</div>
-<div class="line"><a name="l05526"></a><span class="lineno"> 5526</span>&#160;        const_iterator(<span class="keyword">const</span> VmaRawList&lt;T&gt;* pList, <span class="keyword">const</span> VmaListItem&lt;T&gt;* pItem) :</div>
-<div class="line"><a name="l05527"></a><span class="lineno"> 5527</span>&#160;            m_pList(pList),</div>
-<div class="line"><a name="l05528"></a><span class="lineno"> 5528</span>&#160;            m_pItem(pItem)</div>
-<div class="line"><a name="l05529"></a><span class="lineno"> 5529</span>&#160;        {</div>
-<div class="line"><a name="l05530"></a><span class="lineno"> 5530</span>&#160;        }</div>
-<div class="line"><a name="l05531"></a><span class="lineno"> 5531</span>&#160; </div>
-<div class="line"><a name="l05532"></a><span class="lineno"> 5532</span>&#160;        <span class="keyword">const</span> VmaRawList&lt;T&gt;* m_pList;</div>
-<div class="line"><a name="l05533"></a><span class="lineno"> 5533</span>&#160;        <span class="keyword">const</span> VmaListItem&lt;T&gt;* m_pItem;</div>
-<div class="line"><a name="l05534"></a><span class="lineno"> 5534</span>&#160; </div>
-<div class="line"><a name="l05535"></a><span class="lineno"> 5535</span>&#160;        <span class="keyword">friend</span> <span class="keyword">class </span>VmaList&lt;T, AllocatorT&gt;;</div>
-<div class="line"><a name="l05536"></a><span class="lineno"> 5536</span>&#160;    };</div>
-<div class="line"><a name="l05537"></a><span class="lineno"> 5537</span>&#160; </div>
-<div class="line"><a name="l05538"></a><span class="lineno"> 5538</span>&#160;    VmaList(<span class="keyword">const</span> AllocatorT&amp; allocator) : m_RawList(allocator.m_pCallbacks) { }</div>
-<div class="line"><a name="l05539"></a><span class="lineno"> 5539</span>&#160; </div>
-<div class="line"><a name="l05540"></a><span class="lineno"> 5540</span>&#160;    <span class="keywordtype">bool</span> empty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_RawList.IsEmpty(); }</div>
-<div class="line"><a name="l05541"></a><span class="lineno"> 5541</span>&#160;    <span class="keywordtype">size_t</span> size()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_RawList.GetCount(); }</div>
-<div class="line"><a name="l05542"></a><span class="lineno"> 5542</span>&#160; </div>
-<div class="line"><a name="l05543"></a><span class="lineno"> 5543</span>&#160;    iterator begin() { <span class="keywordflow">return</span> iterator(&amp;m_RawList, m_RawList.Front()); }</div>
-<div class="line"><a name="l05544"></a><span class="lineno"> 5544</span>&#160;    iterator end() { <span class="keywordflow">return</span> iterator(&amp;m_RawList, VMA_NULL); }</div>
-<div class="line"><a name="l05545"></a><span class="lineno"> 5545</span>&#160; </div>
-<div class="line"><a name="l05546"></a><span class="lineno"> 5546</span>&#160;    const_iterator cbegin()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> const_iterator(&amp;m_RawList, m_RawList.Front()); }</div>
-<div class="line"><a name="l05547"></a><span class="lineno"> 5547</span>&#160;    const_iterator cend()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> const_iterator(&amp;m_RawList, VMA_NULL); }</div>
+<div class="line"><a name="l05455"></a><span class="lineno"> 5455</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05456"></a><span class="lineno"> 5456</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushFront(<span class="keyword">const</span> T&amp; value)</div>
+<div class="line"><a name="l05457"></a><span class="lineno"> 5457</span>&#160;{</div>
+<div class="line"><a name="l05458"></a><span class="lineno"> 5458</span>&#160;    ItemType* <span class="keyword">const</span> pNewItem = PushFront();</div>
+<div class="line"><a name="l05459"></a><span class="lineno"> 5459</span>&#160;    pNewItem-&gt;Value = value;</div>
+<div class="line"><a name="l05460"></a><span class="lineno"> 5460</span>&#160;    <span class="keywordflow">return</span> pNewItem;</div>
+<div class="line"><a name="l05461"></a><span class="lineno"> 5461</span>&#160;}</div>
+<div class="line"><a name="l05462"></a><span class="lineno"> 5462</span>&#160; </div>
+<div class="line"><a name="l05463"></a><span class="lineno"> 5463</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05464"></a><span class="lineno"> 5464</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::PopBack()</div>
+<div class="line"><a name="l05465"></a><span class="lineno"> 5465</span>&#160;{</div>
+<div class="line"><a name="l05466"></a><span class="lineno"> 5466</span>&#160;    VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l05467"></a><span class="lineno"> 5467</span>&#160;    ItemType* <span class="keyword">const</span> pBackItem = m_pBack;</div>
+<div class="line"><a name="l05468"></a><span class="lineno"> 5468</span>&#160;    ItemType* <span class="keyword">const</span> pPrevItem = pBackItem-&gt;pPrev;</div>
+<div class="line"><a name="l05469"></a><span class="lineno"> 5469</span>&#160;    <span class="keywordflow">if</span>(pPrevItem != VMA_NULL)</div>
+<div class="line"><a name="l05470"></a><span class="lineno"> 5470</span>&#160;    {</div>
+<div class="line"><a name="l05471"></a><span class="lineno"> 5471</span>&#160;        pPrevItem-&gt;pNext = VMA_NULL;</div>
+<div class="line"><a name="l05472"></a><span class="lineno"> 5472</span>&#160;    }</div>
+<div class="line"><a name="l05473"></a><span class="lineno"> 5473</span>&#160;    m_pBack = pPrevItem;</div>
+<div class="line"><a name="l05474"></a><span class="lineno"> 5474</span>&#160;    m_ItemAllocator.Free(pBackItem);</div>
+<div class="line"><a name="l05475"></a><span class="lineno"> 5475</span>&#160;    --m_Count;</div>
+<div class="line"><a name="l05476"></a><span class="lineno"> 5476</span>&#160;}</div>
+<div class="line"><a name="l05477"></a><span class="lineno"> 5477</span>&#160; </div>
+<div class="line"><a name="l05478"></a><span class="lineno"> 5478</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05479"></a><span class="lineno"> 5479</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::PopFront()</div>
+<div class="line"><a name="l05480"></a><span class="lineno"> 5480</span>&#160;{</div>
+<div class="line"><a name="l05481"></a><span class="lineno"> 5481</span>&#160;    VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l05482"></a><span class="lineno"> 5482</span>&#160;    ItemType* <span class="keyword">const</span> pFrontItem = m_pFront;</div>
+<div class="line"><a name="l05483"></a><span class="lineno"> 5483</span>&#160;    ItemType* <span class="keyword">const</span> pNextItem = pFrontItem-&gt;pNext;</div>
+<div class="line"><a name="l05484"></a><span class="lineno"> 5484</span>&#160;    <span class="keywordflow">if</span>(pNextItem != VMA_NULL)</div>
+<div class="line"><a name="l05485"></a><span class="lineno"> 5485</span>&#160;    {</div>
+<div class="line"><a name="l05486"></a><span class="lineno"> 5486</span>&#160;        pNextItem-&gt;pPrev = VMA_NULL;</div>
+<div class="line"><a name="l05487"></a><span class="lineno"> 5487</span>&#160;    }</div>
+<div class="line"><a name="l05488"></a><span class="lineno"> 5488</span>&#160;    m_pFront = pNextItem;</div>
+<div class="line"><a name="l05489"></a><span class="lineno"> 5489</span>&#160;    m_ItemAllocator.Free(pFrontItem);</div>
+<div class="line"><a name="l05490"></a><span class="lineno"> 5490</span>&#160;    --m_Count;</div>
+<div class="line"><a name="l05491"></a><span class="lineno"> 5491</span>&#160;}</div>
+<div class="line"><a name="l05492"></a><span class="lineno"> 5492</span>&#160; </div>
+<div class="line"><a name="l05493"></a><span class="lineno"> 5493</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05494"></a><span class="lineno"> 5494</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::Remove(ItemType* pItem)</div>
+<div class="line"><a name="l05495"></a><span class="lineno"> 5495</span>&#160;{</div>
+<div class="line"><a name="l05496"></a><span class="lineno"> 5496</span>&#160;    VMA_HEAVY_ASSERT(pItem != VMA_NULL);</div>
+<div class="line"><a name="l05497"></a><span class="lineno"> 5497</span>&#160;    VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
+<div class="line"><a name="l05498"></a><span class="lineno"> 5498</span>&#160; </div>
+<div class="line"><a name="l05499"></a><span class="lineno"> 5499</span>&#160;    <span class="keywordflow">if</span>(pItem-&gt;pPrev != VMA_NULL)</div>
+<div class="line"><a name="l05500"></a><span class="lineno"> 5500</span>&#160;    {</div>
+<div class="line"><a name="l05501"></a><span class="lineno"> 5501</span>&#160;        pItem-&gt;pPrev-&gt;pNext = pItem-&gt;pNext;</div>
+<div class="line"><a name="l05502"></a><span class="lineno"> 5502</span>&#160;    }</div>
+<div class="line"><a name="l05503"></a><span class="lineno"> 5503</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05504"></a><span class="lineno"> 5504</span>&#160;    {</div>
+<div class="line"><a name="l05505"></a><span class="lineno"> 5505</span>&#160;        VMA_HEAVY_ASSERT(m_pFront == pItem);</div>
+<div class="line"><a name="l05506"></a><span class="lineno"> 5506</span>&#160;        m_pFront = pItem-&gt;pNext;</div>
+<div class="line"><a name="l05507"></a><span class="lineno"> 5507</span>&#160;    }</div>
+<div class="line"><a name="l05508"></a><span class="lineno"> 5508</span>&#160; </div>
+<div class="line"><a name="l05509"></a><span class="lineno"> 5509</span>&#160;    <span class="keywordflow">if</span>(pItem-&gt;pNext != VMA_NULL)</div>
+<div class="line"><a name="l05510"></a><span class="lineno"> 5510</span>&#160;    {</div>
+<div class="line"><a name="l05511"></a><span class="lineno"> 5511</span>&#160;        pItem-&gt;pNext-&gt;pPrev = pItem-&gt;pPrev;</div>
+<div class="line"><a name="l05512"></a><span class="lineno"> 5512</span>&#160;    }</div>
+<div class="line"><a name="l05513"></a><span class="lineno"> 5513</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05514"></a><span class="lineno"> 5514</span>&#160;    {</div>
+<div class="line"><a name="l05515"></a><span class="lineno"> 5515</span>&#160;        VMA_HEAVY_ASSERT(m_pBack == pItem);</div>
+<div class="line"><a name="l05516"></a><span class="lineno"> 5516</span>&#160;        m_pBack = pItem-&gt;pPrev;</div>
+<div class="line"><a name="l05517"></a><span class="lineno"> 5517</span>&#160;    }</div>
+<div class="line"><a name="l05518"></a><span class="lineno"> 5518</span>&#160; </div>
+<div class="line"><a name="l05519"></a><span class="lineno"> 5519</span>&#160;    m_ItemAllocator.Free(pItem);</div>
+<div class="line"><a name="l05520"></a><span class="lineno"> 5520</span>&#160;    --m_Count;</div>
+<div class="line"><a name="l05521"></a><span class="lineno"> 5521</span>&#160;}</div>
+<div class="line"><a name="l05522"></a><span class="lineno"> 5522</span>&#160; </div>
+<div class="line"><a name="l05523"></a><span class="lineno"> 5523</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05524"></a><span class="lineno"> 5524</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertBefore(ItemType* pItem)</div>
+<div class="line"><a name="l05525"></a><span class="lineno"> 5525</span>&#160;{</div>
+<div class="line"><a name="l05526"></a><span class="lineno"> 5526</span>&#160;    <span class="keywordflow">if</span>(pItem != VMA_NULL)</div>
+<div class="line"><a name="l05527"></a><span class="lineno"> 5527</span>&#160;    {</div>
+<div class="line"><a name="l05528"></a><span class="lineno"> 5528</span>&#160;        ItemType* <span class="keyword">const</span> prevItem = pItem-&gt;pPrev;</div>
+<div class="line"><a name="l05529"></a><span class="lineno"> 5529</span>&#160;        ItemType* <span class="keyword">const</span> newItem = m_ItemAllocator.Alloc();</div>
+<div class="line"><a name="l05530"></a><span class="lineno"> 5530</span>&#160;        newItem-&gt;pPrev = prevItem;</div>
+<div class="line"><a name="l05531"></a><span class="lineno"> 5531</span>&#160;        newItem-&gt;pNext = pItem;</div>
+<div class="line"><a name="l05532"></a><span class="lineno"> 5532</span>&#160;        pItem-&gt;pPrev = newItem;</div>
+<div class="line"><a name="l05533"></a><span class="lineno"> 5533</span>&#160;        <span class="keywordflow">if</span>(prevItem != VMA_NULL)</div>
+<div class="line"><a name="l05534"></a><span class="lineno"> 5534</span>&#160;        {</div>
+<div class="line"><a name="l05535"></a><span class="lineno"> 5535</span>&#160;            prevItem-&gt;pNext = newItem;</div>
+<div class="line"><a name="l05536"></a><span class="lineno"> 5536</span>&#160;        }</div>
+<div class="line"><a name="l05537"></a><span class="lineno"> 5537</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05538"></a><span class="lineno"> 5538</span>&#160;        {</div>
+<div class="line"><a name="l05539"></a><span class="lineno"> 5539</span>&#160;            VMA_HEAVY_ASSERT(m_pFront == pItem);</div>
+<div class="line"><a name="l05540"></a><span class="lineno"> 5540</span>&#160;            m_pFront = newItem;</div>
+<div class="line"><a name="l05541"></a><span class="lineno"> 5541</span>&#160;        }</div>
+<div class="line"><a name="l05542"></a><span class="lineno"> 5542</span>&#160;        ++m_Count;</div>
+<div class="line"><a name="l05543"></a><span class="lineno"> 5543</span>&#160;        <span class="keywordflow">return</span> newItem;</div>
+<div class="line"><a name="l05544"></a><span class="lineno"> 5544</span>&#160;    }</div>
+<div class="line"><a name="l05545"></a><span class="lineno"> 5545</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05546"></a><span class="lineno"> 5546</span>&#160;        <span class="keywordflow">return</span> PushBack();</div>
+<div class="line"><a name="l05547"></a><span class="lineno"> 5547</span>&#160;}</div>
 <div class="line"><a name="l05548"></a><span class="lineno"> 5548</span>&#160; </div>
-<div class="line"><a name="l05549"></a><span class="lineno"> 5549</span>&#160;    <span class="keywordtype">void</span> clear() { m_RawList.Clear(); }</div>
-<div class="line"><a name="l05550"></a><span class="lineno"> 5550</span>&#160;    <span class="keywordtype">void</span> push_back(<span class="keyword">const</span> T&amp; value) { m_RawList.PushBack(value); }</div>
-<div class="line"><a name="l05551"></a><span class="lineno"> 5551</span>&#160;    <span class="keywordtype">void</span> erase(iterator it) { m_RawList.Remove(it.m_pItem); }</div>
-<div class="line"><a name="l05552"></a><span class="lineno"> 5552</span>&#160;    iterator insert(iterator it, <span class="keyword">const</span> T&amp; value) { <span class="keywordflow">return</span> iterator(&amp;m_RawList, m_RawList.InsertBefore(it.m_pItem, value)); }</div>
-<div class="line"><a name="l05553"></a><span class="lineno"> 5553</span>&#160; </div>
-<div class="line"><a name="l05554"></a><span class="lineno"> 5554</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l05555"></a><span class="lineno"> 5555</span>&#160;    VmaRawList&lt;T&gt; m_RawList;</div>
-<div class="line"><a name="l05556"></a><span class="lineno"> 5556</span>&#160;};</div>
-<div class="line"><a name="l05557"></a><span class="lineno"> 5557</span>&#160; </div>
-<div class="line"><a name="l05558"></a><span class="lineno"> 5558</span>&#160;<span class="preprocessor">#endif // #if VMA_USE_STL_LIST</span></div>
-<div class="line"><a name="l05559"></a><span class="lineno"> 5559</span>&#160; </div>
-<div class="line"><a name="l05561"></a><span class="lineno"> 5561</span>&#160;<span class="comment">// class VmaMap</span></div>
-<div class="line"><a name="l05562"></a><span class="lineno"> 5562</span>&#160; </div>
-<div class="line"><a name="l05563"></a><span class="lineno"> 5563</span>&#160;<span class="comment">// Unused in this version.</span></div>
-<div class="line"><a name="l05564"></a><span class="lineno"> 5564</span>&#160;<span class="preprocessor">#if 0</span></div>
-<div class="line"><a name="l05565"></a><span class="lineno"> 5565</span>&#160; </div>
-<div class="line"><a name="l05566"></a><span class="lineno"> 5566</span>&#160;<span class="preprocessor">#if VMA_USE_STL_UNORDERED_MAP</span></div>
-<div class="line"><a name="l05567"></a><span class="lineno"> 5567</span>&#160; </div>
-<div class="line"><a name="l05568"></a><span class="lineno"> 5568</span>&#160;<span class="preprocessor">#define VmaPair std::pair</span></div>
-<div class="line"><a name="l05569"></a><span class="lineno"> 5569</span>&#160; </div>
-<div class="line"><a name="l05570"></a><span class="lineno"> 5570</span>&#160;<span class="preprocessor">#define VMA_MAP_TYPE(KeyT, ValueT) \</span></div>
-<div class="line"><a name="l05571"></a><span class="lineno"> 5571</span>&#160;<span class="preprocessor">    std::unordered_map&lt; KeyT, ValueT, std::hash&lt;KeyT&gt;, std::equal_to&lt;KeyT&gt;, VmaStlAllocator&lt; std::pair&lt;KeyT, ValueT&gt; &gt; &gt;</span></div>
-<div class="line"><a name="l05572"></a><span class="lineno"> 5572</span>&#160; </div>
-<div class="line"><a name="l05573"></a><span class="lineno"> 5573</span>&#160;<span class="preprocessor">#else // #if VMA_USE_STL_UNORDERED_MAP</span></div>
+<div class="line"><a name="l05549"></a><span class="lineno"> 5549</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05550"></a><span class="lineno"> 5550</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertAfter(ItemType* pItem)</div>
+<div class="line"><a name="l05551"></a><span class="lineno"> 5551</span>&#160;{</div>
+<div class="line"><a name="l05552"></a><span class="lineno"> 5552</span>&#160;    <span class="keywordflow">if</span>(pItem != VMA_NULL)</div>
+<div class="line"><a name="l05553"></a><span class="lineno"> 5553</span>&#160;    {</div>
+<div class="line"><a name="l05554"></a><span class="lineno"> 5554</span>&#160;        ItemType* <span class="keyword">const</span> nextItem = pItem-&gt;pNext;</div>
+<div class="line"><a name="l05555"></a><span class="lineno"> 5555</span>&#160;        ItemType* <span class="keyword">const</span> newItem = m_ItemAllocator.Alloc();</div>
+<div class="line"><a name="l05556"></a><span class="lineno"> 5556</span>&#160;        newItem-&gt;pNext = nextItem;</div>
+<div class="line"><a name="l05557"></a><span class="lineno"> 5557</span>&#160;        newItem-&gt;pPrev = pItem;</div>
+<div class="line"><a name="l05558"></a><span class="lineno"> 5558</span>&#160;        pItem-&gt;pNext = newItem;</div>
+<div class="line"><a name="l05559"></a><span class="lineno"> 5559</span>&#160;        <span class="keywordflow">if</span>(nextItem != VMA_NULL)</div>
+<div class="line"><a name="l05560"></a><span class="lineno"> 5560</span>&#160;        {</div>
+<div class="line"><a name="l05561"></a><span class="lineno"> 5561</span>&#160;            nextItem-&gt;pPrev = newItem;</div>
+<div class="line"><a name="l05562"></a><span class="lineno"> 5562</span>&#160;        }</div>
+<div class="line"><a name="l05563"></a><span class="lineno"> 5563</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05564"></a><span class="lineno"> 5564</span>&#160;        {</div>
+<div class="line"><a name="l05565"></a><span class="lineno"> 5565</span>&#160;            VMA_HEAVY_ASSERT(m_pBack == pItem);</div>
+<div class="line"><a name="l05566"></a><span class="lineno"> 5566</span>&#160;            m_pBack = newItem;</div>
+<div class="line"><a name="l05567"></a><span class="lineno"> 5567</span>&#160;        }</div>
+<div class="line"><a name="l05568"></a><span class="lineno"> 5568</span>&#160;        ++m_Count;</div>
+<div class="line"><a name="l05569"></a><span class="lineno"> 5569</span>&#160;        <span class="keywordflow">return</span> newItem;</div>
+<div class="line"><a name="l05570"></a><span class="lineno"> 5570</span>&#160;    }</div>
+<div class="line"><a name="l05571"></a><span class="lineno"> 5571</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05572"></a><span class="lineno"> 5572</span>&#160;        <span class="keywordflow">return</span> PushFront();</div>
+<div class="line"><a name="l05573"></a><span class="lineno"> 5573</span>&#160;}</div>
 <div class="line"><a name="l05574"></a><span class="lineno"> 5574</span>&#160; </div>
-<div class="line"><a name="l05575"></a><span class="lineno"> 5575</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T1, <span class="keyword">typename</span> T2&gt;</div>
-<div class="line"><a name="l05576"></a><span class="lineno"> 5576</span>&#160;<span class="keyword">struct </span>VmaPair</div>
+<div class="line"><a name="l05575"></a><span class="lineno"> 5575</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05576"></a><span class="lineno"> 5576</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertBefore(ItemType* pItem, <span class="keyword">const</span> T&amp; value)</div>
 <div class="line"><a name="l05577"></a><span class="lineno"> 5577</span>&#160;{</div>
-<div class="line"><a name="l05578"></a><span class="lineno"> 5578</span>&#160;    T1 first;</div>
-<div class="line"><a name="l05579"></a><span class="lineno"> 5579</span>&#160;    T2 second;</div>
-<div class="line"><a name="l05580"></a><span class="lineno"> 5580</span>&#160; </div>
-<div class="line"><a name="l05581"></a><span class="lineno"> 5581</span>&#160;    VmaPair() : first(), second() { }</div>
-<div class="line"><a name="l05582"></a><span class="lineno"> 5582</span>&#160;    VmaPair(<span class="keyword">const</span> T1&amp; firstSrc, <span class="keyword">const</span> T2&amp; secondSrc) : first(firstSrc), second(secondSrc) { }</div>
-<div class="line"><a name="l05583"></a><span class="lineno"> 5583</span>&#160;};</div>
-<div class="line"><a name="l05584"></a><span class="lineno"> 5584</span>&#160; </div>
-<div class="line"><a name="l05585"></a><span class="lineno"> 5585</span>&#160;<span class="comment">/* Class compatible with subset of interface of std::unordered_map.</span></div>
-<div class="line"><a name="l05586"></a><span class="lineno"> 5586</span>&#160;<span class="comment">KeyT, ValueT must be POD because they will be stored in VmaVector.</span></div>
-<div class="line"><a name="l05587"></a><span class="lineno"> 5587</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l05588"></a><span class="lineno"> 5588</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
-<div class="line"><a name="l05589"></a><span class="lineno"> 5589</span>&#160;<span class="keyword">class </span>VmaMap</div>
-<div class="line"><a name="l05590"></a><span class="lineno"> 5590</span>&#160;{</div>
-<div class="line"><a name="l05591"></a><span class="lineno"> 5591</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l05592"></a><span class="lineno"> 5592</span>&#160;    <span class="keyword">typedef</span> VmaPair&lt;KeyT, ValueT&gt; PairType;</div>
-<div class="line"><a name="l05593"></a><span class="lineno"> 5593</span>&#160;    <span class="keyword">typedef</span> PairType* iterator;</div>
-<div class="line"><a name="l05594"></a><span class="lineno"> 5594</span>&#160; </div>
-<div class="line"><a name="l05595"></a><span class="lineno"> 5595</span>&#160;    VmaMap(<span class="keyword">const</span> VmaStlAllocator&lt;PairType&gt;&amp; allocator) : m_Vector(allocator) { }</div>
-<div class="line"><a name="l05596"></a><span class="lineno"> 5596</span>&#160; </div>
-<div class="line"><a name="l05597"></a><span class="lineno"> 5597</span>&#160;    iterator begin() { <span class="keywordflow">return</span> m_Vector.begin(); }</div>
-<div class="line"><a name="l05598"></a><span class="lineno"> 5598</span>&#160;    iterator end() { <span class="keywordflow">return</span> m_Vector.end(); }</div>
-<div class="line"><a name="l05599"></a><span class="lineno"> 5599</span>&#160; </div>
-<div class="line"><a name="l05600"></a><span class="lineno"> 5600</span>&#160;    <span class="keywordtype">void</span> insert(<span class="keyword">const</span> PairType&amp; pair);</div>
-<div class="line"><a name="l05601"></a><span class="lineno"> 5601</span>&#160;    iterator find(<span class="keyword">const</span> KeyT&amp; key);</div>
-<div class="line"><a name="l05602"></a><span class="lineno"> 5602</span>&#160;    <span class="keywordtype">void</span> erase(iterator it);</div>
-<div class="line"><a name="l05603"></a><span class="lineno"> 5603</span>&#160;    </div>
-<div class="line"><a name="l05604"></a><span class="lineno"> 5604</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l05605"></a><span class="lineno"> 5605</span>&#160;    VmaVector&lt; PairType, VmaStlAllocator&lt;PairType&gt; &gt; m_Vector;</div>
-<div class="line"><a name="l05606"></a><span class="lineno"> 5606</span>&#160;};</div>
-<div class="line"><a name="l05607"></a><span class="lineno"> 5607</span>&#160; </div>
-<div class="line"><a name="l05608"></a><span class="lineno"> 5608</span>&#160;<span class="preprocessor">#define VMA_MAP_TYPE(KeyT, ValueT) VmaMap&lt;KeyT, ValueT&gt;</span></div>
-<div class="line"><a name="l05609"></a><span class="lineno"> 5609</span>&#160; </div>
-<div class="line"><a name="l05610"></a><span class="lineno"> 5610</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> FirstT, <span class="keyword">typename</span> SecondT&gt;</div>
-<div class="line"><a name="l05611"></a><span class="lineno"> 5611</span>&#160;<span class="keyword">struct </span>VmaPairFirstLess</div>
-<div class="line"><a name="l05612"></a><span class="lineno"> 5612</span>&#160;{</div>
-<div class="line"><a name="l05613"></a><span class="lineno"> 5613</span>&#160;    <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaPair&lt;FirstT, SecondT&gt;&amp; lhs, <span class="keyword">const</span> VmaPair&lt;FirstT, SecondT&gt;&amp; rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l05614"></a><span class="lineno"> 5614</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l05615"></a><span class="lineno"> 5615</span>&#160;        <span class="keywordflow">return</span> lhs.first &lt; rhs.first;</div>
-<div class="line"><a name="l05616"></a><span class="lineno"> 5616</span>&#160;    }</div>
-<div class="line"><a name="l05617"></a><span class="lineno"> 5617</span>&#160;    <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaPair&lt;FirstT, SecondT&gt;&amp; lhs, <span class="keyword">const</span> FirstT&amp; rhsFirst)<span class="keyword"> const</span></div>
-<div class="line"><a name="l05618"></a><span class="lineno"> 5618</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l05619"></a><span class="lineno"> 5619</span>&#160;        <span class="keywordflow">return</span> lhs.first &lt; rhsFirst;</div>
-<div class="line"><a name="l05620"></a><span class="lineno"> 5620</span>&#160;    }</div>
-<div class="line"><a name="l05621"></a><span class="lineno"> 5621</span>&#160;};</div>
-<div class="line"><a name="l05622"></a><span class="lineno"> 5622</span>&#160; </div>
-<div class="line"><a name="l05623"></a><span class="lineno"> 5623</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
-<div class="line"><a name="l05624"></a><span class="lineno"> 5624</span>&#160;<span class="keywordtype">void</span> VmaMap&lt;KeyT, ValueT&gt;::insert(<span class="keyword">const</span> PairType&amp; pair)</div>
-<div class="line"><a name="l05625"></a><span class="lineno"> 5625</span>&#160;{</div>
-<div class="line"><a name="l05626"></a><span class="lineno"> 5626</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> indexToInsert = VmaBinaryFindFirstNotLess(</div>
-<div class="line"><a name="l05627"></a><span class="lineno"> 5627</span>&#160;        m_Vector.data(),</div>
-<div class="line"><a name="l05628"></a><span class="lineno"> 5628</span>&#160;        m_Vector.data() + m_Vector.size(),</div>
-<div class="line"><a name="l05629"></a><span class="lineno"> 5629</span>&#160;        pair,</div>
-<div class="line"><a name="l05630"></a><span class="lineno"> 5630</span>&#160;        VmaPairFirstLess&lt;KeyT, ValueT&gt;()) - m_Vector.data();</div>
-<div class="line"><a name="l05631"></a><span class="lineno"> 5631</span>&#160;    VmaVectorInsert(m_Vector, indexToInsert, pair);</div>
-<div class="line"><a name="l05632"></a><span class="lineno"> 5632</span>&#160;}</div>
-<div class="line"><a name="l05633"></a><span class="lineno"> 5633</span>&#160; </div>
-<div class="line"><a name="l05634"></a><span class="lineno"> 5634</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
-<div class="line"><a name="l05635"></a><span class="lineno"> 5635</span>&#160;VmaPair&lt;KeyT, ValueT&gt;* VmaMap&lt;KeyT, ValueT&gt;::find(<span class="keyword">const</span> KeyT&amp; key)</div>
-<div class="line"><a name="l05636"></a><span class="lineno"> 5636</span>&#160;{</div>
-<div class="line"><a name="l05637"></a><span class="lineno"> 5637</span>&#160;    PairType* it = VmaBinaryFindFirstNotLess(</div>
-<div class="line"><a name="l05638"></a><span class="lineno"> 5638</span>&#160;        m_Vector.data(),</div>
-<div class="line"><a name="l05639"></a><span class="lineno"> 5639</span>&#160;        m_Vector.data() + m_Vector.size(),</div>
-<div class="line"><a name="l05640"></a><span class="lineno"> 5640</span>&#160;        key,</div>
-<div class="line"><a name="l05641"></a><span class="lineno"> 5641</span>&#160;        VmaPairFirstLess&lt;KeyT, ValueT&gt;());</div>
-<div class="line"><a name="l05642"></a><span class="lineno"> 5642</span>&#160;    <span class="keywordflow">if</span>((it != m_Vector.end()) &amp;&amp; (it-&gt;first == key))</div>
-<div class="line"><a name="l05643"></a><span class="lineno"> 5643</span>&#160;    {</div>
-<div class="line"><a name="l05644"></a><span class="lineno"> 5644</span>&#160;        <span class="keywordflow">return</span> it;</div>
-<div class="line"><a name="l05645"></a><span class="lineno"> 5645</span>&#160;    }</div>
-<div class="line"><a name="l05646"></a><span class="lineno"> 5646</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l05647"></a><span class="lineno"> 5647</span>&#160;    {</div>
-<div class="line"><a name="l05648"></a><span class="lineno"> 5648</span>&#160;        <span class="keywordflow">return</span> m_Vector.end();</div>
-<div class="line"><a name="l05649"></a><span class="lineno"> 5649</span>&#160;    }</div>
-<div class="line"><a name="l05650"></a><span class="lineno"> 5650</span>&#160;}</div>
-<div class="line"><a name="l05651"></a><span class="lineno"> 5651</span>&#160; </div>
-<div class="line"><a name="l05652"></a><span class="lineno"> 5652</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
-<div class="line"><a name="l05653"></a><span class="lineno"> 5653</span>&#160;<span class="keywordtype">void</span> VmaMap&lt;KeyT, ValueT&gt;::erase(iterator it)</div>
-<div class="line"><a name="l05654"></a><span class="lineno"> 5654</span>&#160;{</div>
-<div class="line"><a name="l05655"></a><span class="lineno"> 5655</span>&#160;    VmaVectorRemove(m_Vector, it - m_Vector.begin());</div>
-<div class="line"><a name="l05656"></a><span class="lineno"> 5656</span>&#160;}</div>
-<div class="line"><a name="l05657"></a><span class="lineno"> 5657</span>&#160; </div>
-<div class="line"><a name="l05658"></a><span class="lineno"> 5658</span>&#160;<span class="preprocessor">#endif // #if VMA_USE_STL_UNORDERED_MAP</span></div>
-<div class="line"><a name="l05659"></a><span class="lineno"> 5659</span>&#160; </div>
-<div class="line"><a name="l05660"></a><span class="lineno"> 5660</span>&#160;<span class="preprocessor">#endif // #if 0</span></div>
-<div class="line"><a name="l05661"></a><span class="lineno"> 5661</span>&#160; </div>
+<div class="line"><a name="l05578"></a><span class="lineno"> 5578</span>&#160;    ItemType* <span class="keyword">const</span> newItem = InsertBefore(pItem);</div>
+<div class="line"><a name="l05579"></a><span class="lineno"> 5579</span>&#160;    newItem-&gt;Value = value;</div>
+<div class="line"><a name="l05580"></a><span class="lineno"> 5580</span>&#160;    <span class="keywordflow">return</span> newItem;</div>
+<div class="line"><a name="l05581"></a><span class="lineno"> 5581</span>&#160;}</div>
+<div class="line"><a name="l05582"></a><span class="lineno"> 5582</span>&#160; </div>
+<div class="line"><a name="l05583"></a><span class="lineno"> 5583</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l05584"></a><span class="lineno"> 5584</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertAfter(ItemType* pItem, <span class="keyword">const</span> T&amp; value)</div>
+<div class="line"><a name="l05585"></a><span class="lineno"> 5585</span>&#160;{</div>
+<div class="line"><a name="l05586"></a><span class="lineno"> 5586</span>&#160;    ItemType* <span class="keyword">const</span> newItem = InsertAfter(pItem);</div>
+<div class="line"><a name="l05587"></a><span class="lineno"> 5587</span>&#160;    newItem-&gt;Value = value;</div>
+<div class="line"><a name="l05588"></a><span class="lineno"> 5588</span>&#160;    <span class="keywordflow">return</span> newItem;</div>
+<div class="line"><a name="l05589"></a><span class="lineno"> 5589</span>&#160;}</div>
+<div class="line"><a name="l05590"></a><span class="lineno"> 5590</span>&#160; </div>
+<div class="line"><a name="l05591"></a><span class="lineno"> 5591</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> AllocatorT&gt;</div>
+<div class="line"><a name="l05592"></a><span class="lineno"> 5592</span>&#160;<span class="keyword">class </span>VmaList</div>
+<div class="line"><a name="l05593"></a><span class="lineno"> 5593</span>&#160;{</div>
+<div class="line"><a name="l05594"></a><span class="lineno"> 5594</span>&#160;    VMA_CLASS_NO_COPY(VmaList)</div>
+<div class="line"><a name="l05595"></a><span class="lineno"> 5595</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l05596"></a><span class="lineno"> 5596</span>&#160;    <span class="keyword">class </span>iterator</div>
+<div class="line"><a name="l05597"></a><span class="lineno"> 5597</span>&#160;    {</div>
+<div class="line"><a name="l05598"></a><span class="lineno"> 5598</span>&#160;    <span class="keyword">public</span>:</div>
+<div class="line"><a name="l05599"></a><span class="lineno"> 5599</span>&#160;        iterator() :</div>
+<div class="line"><a name="l05600"></a><span class="lineno"> 5600</span>&#160;            m_pList(VMA_NULL),</div>
+<div class="line"><a name="l05601"></a><span class="lineno"> 5601</span>&#160;            m_pItem(VMA_NULL)</div>
+<div class="line"><a name="l05602"></a><span class="lineno"> 5602</span>&#160;        {</div>
+<div class="line"><a name="l05603"></a><span class="lineno"> 5603</span>&#160;        }</div>
+<div class="line"><a name="l05604"></a><span class="lineno"> 5604</span>&#160; </div>
+<div class="line"><a name="l05605"></a><span class="lineno"> 5605</span>&#160;        T&amp; operator*()<span class="keyword"> const</span></div>
+<div class="line"><a name="l05606"></a><span class="lineno"> 5606</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l05607"></a><span class="lineno"> 5607</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
+<div class="line"><a name="l05608"></a><span class="lineno"> 5608</span>&#160;            <span class="keywordflow">return</span> m_pItem-&gt;Value;</div>
+<div class="line"><a name="l05609"></a><span class="lineno"> 5609</span>&#160;        }</div>
+<div class="line"><a name="l05610"></a><span class="lineno"> 5610</span>&#160;        T* operator-&gt;()<span class="keyword"> const</span></div>
+<div class="line"><a name="l05611"></a><span class="lineno"> 5611</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l05612"></a><span class="lineno"> 5612</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
+<div class="line"><a name="l05613"></a><span class="lineno"> 5613</span>&#160;            <span class="keywordflow">return</span> &amp;m_pItem-&gt;Value;</div>
+<div class="line"><a name="l05614"></a><span class="lineno"> 5614</span>&#160;        }</div>
+<div class="line"><a name="l05615"></a><span class="lineno"> 5615</span>&#160; </div>
+<div class="line"><a name="l05616"></a><span class="lineno"> 5616</span>&#160;        iterator&amp; operator++()</div>
+<div class="line"><a name="l05617"></a><span class="lineno"> 5617</span>&#160;        {</div>
+<div class="line"><a name="l05618"></a><span class="lineno"> 5618</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
+<div class="line"><a name="l05619"></a><span class="lineno"> 5619</span>&#160;            m_pItem = m_pItem-&gt;pNext;</div>
+<div class="line"><a name="l05620"></a><span class="lineno"> 5620</span>&#160;            <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05621"></a><span class="lineno"> 5621</span>&#160;        }</div>
+<div class="line"><a name="l05622"></a><span class="lineno"> 5622</span>&#160;        iterator&amp; operator--()</div>
+<div class="line"><a name="l05623"></a><span class="lineno"> 5623</span>&#160;        {</div>
+<div class="line"><a name="l05624"></a><span class="lineno"> 5624</span>&#160;            <span class="keywordflow">if</span>(m_pItem != VMA_NULL)</div>
+<div class="line"><a name="l05625"></a><span class="lineno"> 5625</span>&#160;            {</div>
+<div class="line"><a name="l05626"></a><span class="lineno"> 5626</span>&#160;                m_pItem = m_pItem-&gt;pPrev;</div>
+<div class="line"><a name="l05627"></a><span class="lineno"> 5627</span>&#160;            }</div>
+<div class="line"><a name="l05628"></a><span class="lineno"> 5628</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05629"></a><span class="lineno"> 5629</span>&#160;            {</div>
+<div class="line"><a name="l05630"></a><span class="lineno"> 5630</span>&#160;                VMA_HEAVY_ASSERT(!m_pList-&gt;IsEmpty());</div>
+<div class="line"><a name="l05631"></a><span class="lineno"> 5631</span>&#160;                m_pItem = m_pList-&gt;Back();</div>
+<div class="line"><a name="l05632"></a><span class="lineno"> 5632</span>&#160;            }</div>
+<div class="line"><a name="l05633"></a><span class="lineno"> 5633</span>&#160;            <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05634"></a><span class="lineno"> 5634</span>&#160;        }</div>
+<div class="line"><a name="l05635"></a><span class="lineno"> 5635</span>&#160; </div>
+<div class="line"><a name="l05636"></a><span class="lineno"> 5636</span>&#160;        iterator operator++(<span class="keywordtype">int</span>)</div>
+<div class="line"><a name="l05637"></a><span class="lineno"> 5637</span>&#160;        {</div>
+<div class="line"><a name="l05638"></a><span class="lineno"> 5638</span>&#160;            iterator result = *<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05639"></a><span class="lineno"> 5639</span>&#160;            ++*<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05640"></a><span class="lineno"> 5640</span>&#160;            <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l05641"></a><span class="lineno"> 5641</span>&#160;        }</div>
+<div class="line"><a name="l05642"></a><span class="lineno"> 5642</span>&#160;        iterator operator--(<span class="keywordtype">int</span>)</div>
+<div class="line"><a name="l05643"></a><span class="lineno"> 5643</span>&#160;        {</div>
+<div class="line"><a name="l05644"></a><span class="lineno"> 5644</span>&#160;            iterator result = *<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05645"></a><span class="lineno"> 5645</span>&#160;            --*<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05646"></a><span class="lineno"> 5646</span>&#160;            <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l05647"></a><span class="lineno"> 5647</span>&#160;        }</div>
+<div class="line"><a name="l05648"></a><span class="lineno"> 5648</span>&#160; </div>
+<div class="line"><a name="l05649"></a><span class="lineno"> 5649</span>&#160;        <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> iterator&amp; rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l05650"></a><span class="lineno"> 5650</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l05651"></a><span class="lineno"> 5651</span>&#160;            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
+<div class="line"><a name="l05652"></a><span class="lineno"> 5652</span>&#160;            <span class="keywordflow">return</span> m_pItem == rhs.m_pItem;</div>
+<div class="line"><a name="l05653"></a><span class="lineno"> 5653</span>&#160;        }</div>
+<div class="line"><a name="l05654"></a><span class="lineno"> 5654</span>&#160;        <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> iterator&amp; rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l05655"></a><span class="lineno"> 5655</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l05656"></a><span class="lineno"> 5656</span>&#160;            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
+<div class="line"><a name="l05657"></a><span class="lineno"> 5657</span>&#160;            <span class="keywordflow">return</span> m_pItem != rhs.m_pItem;</div>
+<div class="line"><a name="l05658"></a><span class="lineno"> 5658</span>&#160;        }</div>
+<div class="line"><a name="l05659"></a><span class="lineno"> 5659</span>&#160;        </div>
+<div class="line"><a name="l05660"></a><span class="lineno"> 5660</span>&#160;    <span class="keyword">private</span>:</div>
+<div class="line"><a name="l05661"></a><span class="lineno"> 5661</span>&#160;        VmaRawList&lt;T&gt;* m_pList;</div>
+<div class="line"><a name="l05662"></a><span class="lineno"> 5662</span>&#160;        VmaListItem&lt;T&gt;* m_pItem;</div>
 <div class="line"><a name="l05663"></a><span class="lineno"> 5663</span>&#160; </div>
-<div class="line"><a name="l05664"></a><span class="lineno"> 5664</span>&#160;<span class="keyword">class </span>VmaDeviceMemoryBlock;</div>
-<div class="line"><a name="l05665"></a><span class="lineno"> 5665</span>&#160; </div>
-<div class="line"><a name="l05666"></a><span class="lineno"> 5666</span>&#160;<span class="keyword">enum</span> VMA_CACHE_OPERATION { VMA_CACHE_FLUSH, VMA_CACHE_INVALIDATE };</div>
-<div class="line"><a name="l05667"></a><span class="lineno"> 5667</span>&#160; </div>
-<div class="line"><a name="l05668"></a><span class="lineno"> 5668</span>&#160;<span class="keyword">struct </span>VmaAllocation_T</div>
-<div class="line"><a name="l05669"></a><span class="lineno"> 5669</span>&#160;{</div>
-<div class="line"><a name="l05670"></a><span class="lineno"> 5670</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l05671"></a><span class="lineno"> 5671</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> uint8_t MAP_COUNT_FLAG_PERSISTENT_MAP = 0x80;</div>
+<div class="line"><a name="l05664"></a><span class="lineno"> 5664</span>&#160;        iterator(VmaRawList&lt;T&gt;* pList, VmaListItem&lt;T&gt;* pItem) :</div>
+<div class="line"><a name="l05665"></a><span class="lineno"> 5665</span>&#160;            m_pList(pList),</div>
+<div class="line"><a name="l05666"></a><span class="lineno"> 5666</span>&#160;            m_pItem(pItem)</div>
+<div class="line"><a name="l05667"></a><span class="lineno"> 5667</span>&#160;        {</div>
+<div class="line"><a name="l05668"></a><span class="lineno"> 5668</span>&#160;        }</div>
+<div class="line"><a name="l05669"></a><span class="lineno"> 5669</span>&#160; </div>
+<div class="line"><a name="l05670"></a><span class="lineno"> 5670</span>&#160;        <span class="keyword">friend</span> <span class="keyword">class </span>VmaList&lt;T, AllocatorT&gt;;</div>
+<div class="line"><a name="l05671"></a><span class="lineno"> 5671</span>&#160;    };</div>
 <div class="line"><a name="l05672"></a><span class="lineno"> 5672</span>&#160; </div>
-<div class="line"><a name="l05673"></a><span class="lineno"> 5673</span>&#160;    <span class="keyword">enum</span> FLAGS</div>
+<div class="line"><a name="l05673"></a><span class="lineno"> 5673</span>&#160;    <span class="keyword">class </span>const_iterator</div>
 <div class="line"><a name="l05674"></a><span class="lineno"> 5674</span>&#160;    {</div>
-<div class="line"><a name="l05675"></a><span class="lineno"> 5675</span>&#160;        FLAG_USER_DATA_STRING = 0x01,</div>
-<div class="line"><a name="l05676"></a><span class="lineno"> 5676</span>&#160;    };</div>
-<div class="line"><a name="l05677"></a><span class="lineno"> 5677</span>&#160; </div>
-<div class="line"><a name="l05678"></a><span class="lineno"> 5678</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l05679"></a><span class="lineno"> 5679</span>&#160;    <span class="keyword">enum</span> ALLOCATION_TYPE</div>
-<div class="line"><a name="l05680"></a><span class="lineno"> 5680</span>&#160;    {</div>
-<div class="line"><a name="l05681"></a><span class="lineno"> 5681</span>&#160;        ALLOCATION_TYPE_NONE,</div>
-<div class="line"><a name="l05682"></a><span class="lineno"> 5682</span>&#160;        ALLOCATION_TYPE_BLOCK,</div>
-<div class="line"><a name="l05683"></a><span class="lineno"> 5683</span>&#160;        ALLOCATION_TYPE_DEDICATED,</div>
-<div class="line"><a name="l05684"></a><span class="lineno"> 5684</span>&#160;    };</div>
-<div class="line"><a name="l05685"></a><span class="lineno"> 5685</span>&#160; </div>
-<div class="line"><a name="l05686"></a><span class="lineno"> 5686</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l05687"></a><span class="lineno"> 5687</span>&#160;<span class="comment">    This struct is allocated using VmaPoolAllocator.</span></div>
-<div class="line"><a name="l05688"></a><span class="lineno"> 5688</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l05689"></a><span class="lineno"> 5689</span>&#160; </div>
-<div class="line"><a name="l05690"></a><span class="lineno"> 5690</span>&#160;    VmaAllocation_T(uint32_t currentFrameIndex, <span class="keywordtype">bool</span> userDataString) :</div>
-<div class="line"><a name="l05691"></a><span class="lineno"> 5691</span>&#160;        m_Alignment{1},</div>
-<div class="line"><a name="l05692"></a><span class="lineno"> 5692</span>&#160;        m_Size{0},</div>
-<div class="line"><a name="l05693"></a><span class="lineno"> 5693</span>&#160;        m_pUserData{VMA_NULL},</div>
-<div class="line"><a name="l05694"></a><span class="lineno"> 5694</span>&#160;        m_LastUseFrameIndex{currentFrameIndex},</div>
-<div class="line"><a name="l05695"></a><span class="lineno"> 5695</span>&#160;        m_MemoryTypeIndex{0},</div>
-<div class="line"><a name="l05696"></a><span class="lineno"> 5696</span>&#160;        m_Type{(uint8_t)ALLOCATION_TYPE_NONE},</div>
-<div class="line"><a name="l05697"></a><span class="lineno"> 5697</span>&#160;        m_SuballocationType{(uint8_t)VMA_SUBALLOCATION_TYPE_UNKNOWN},</div>
-<div class="line"><a name="l05698"></a><span class="lineno"> 5698</span>&#160;        m_MapCount{0},</div>
-<div class="line"><a name="l05699"></a><span class="lineno"> 5699</span>&#160;        m_Flags{userDataString ? (uint8_t)FLAG_USER_DATA_STRING : (uint8_t)0}</div>
-<div class="line"><a name="l05700"></a><span class="lineno"> 5700</span>&#160;    {</div>
-<div class="line"><a name="l05701"></a><span class="lineno"> 5701</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l05702"></a><span class="lineno"> 5702</span>&#160;        m_CreationFrameIndex = currentFrameIndex;</div>
-<div class="line"><a name="l05703"></a><span class="lineno"> 5703</span>&#160;        m_BufferImageUsage = 0;</div>
-<div class="line"><a name="l05704"></a><span class="lineno"> 5704</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l05705"></a><span class="lineno"> 5705</span>&#160;    }</div>
-<div class="line"><a name="l05706"></a><span class="lineno"> 5706</span>&#160; </div>
-<div class="line"><a name="l05707"></a><span class="lineno"> 5707</span>&#160;    ~VmaAllocation_T()</div>
-<div class="line"><a name="l05708"></a><span class="lineno"> 5708</span>&#160;    {</div>
-<div class="line"><a name="l05709"></a><span class="lineno"> 5709</span>&#160;        VMA_ASSERT((m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP) == 0 &amp;&amp; <span class="stringliteral">&quot;Allocation was not unmapped before destruction.&quot;</span>);</div>
-<div class="line"><a name="l05710"></a><span class="lineno"> 5710</span>&#160; </div>
-<div class="line"><a name="l05711"></a><span class="lineno"> 5711</span>&#160;        <span class="comment">// Check if owned string was freed.</span></div>
-<div class="line"><a name="l05712"></a><span class="lineno"> 5712</span>&#160;        VMA_ASSERT(m_pUserData == VMA_NULL);</div>
-<div class="line"><a name="l05713"></a><span class="lineno"> 5713</span>&#160;    }</div>
-<div class="line"><a name="l05714"></a><span class="lineno"> 5714</span>&#160; </div>
-<div class="line"><a name="l05715"></a><span class="lineno"> 5715</span>&#160;    <span class="keywordtype">void</span> InitBlockAllocation(</div>
-<div class="line"><a name="l05716"></a><span class="lineno"> 5716</span>&#160;        VmaDeviceMemoryBlock* block,</div>
-<div class="line"><a name="l05717"></a><span class="lineno"> 5717</span>&#160;        VkDeviceSize offset,</div>
-<div class="line"><a name="l05718"></a><span class="lineno"> 5718</span>&#160;        VkDeviceSize alignment,</div>
-<div class="line"><a name="l05719"></a><span class="lineno"> 5719</span>&#160;        VkDeviceSize size,</div>
-<div class="line"><a name="l05720"></a><span class="lineno"> 5720</span>&#160;        uint32_t memoryTypeIndex,</div>
-<div class="line"><a name="l05721"></a><span class="lineno"> 5721</span>&#160;        VmaSuballocationType suballocationType,</div>
-<div class="line"><a name="l05722"></a><span class="lineno"> 5722</span>&#160;        <span class="keywordtype">bool</span> mapped,</div>
-<div class="line"><a name="l05723"></a><span class="lineno"> 5723</span>&#160;        <span class="keywordtype">bool</span> canBecomeLost)</div>
-<div class="line"><a name="l05724"></a><span class="lineno"> 5724</span>&#160;    {</div>
-<div class="line"><a name="l05725"></a><span class="lineno"> 5725</span>&#160;        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);</div>
-<div class="line"><a name="l05726"></a><span class="lineno"> 5726</span>&#160;        VMA_ASSERT(block != VMA_NULL);</div>
-<div class="line"><a name="l05727"></a><span class="lineno"> 5727</span>&#160;        m_Type = (uint8_t)ALLOCATION_TYPE_BLOCK;</div>
-<div class="line"><a name="l05728"></a><span class="lineno"> 5728</span>&#160;        m_Alignment = alignment;</div>
-<div class="line"><a name="l05729"></a><span class="lineno"> 5729</span>&#160;        m_Size = size;</div>
-<div class="line"><a name="l05730"></a><span class="lineno"> 5730</span>&#160;        m_MemoryTypeIndex = memoryTypeIndex;</div>
-<div class="line"><a name="l05731"></a><span class="lineno"> 5731</span>&#160;        m_MapCount = mapped ? MAP_COUNT_FLAG_PERSISTENT_MAP : 0;</div>
-<div class="line"><a name="l05732"></a><span class="lineno"> 5732</span>&#160;        m_SuballocationType = (uint8_t)suballocationType;</div>
-<div class="line"><a name="l05733"></a><span class="lineno"> 5733</span>&#160;        m_BlockAllocation.m_Block = block;</div>
-<div class="line"><a name="l05734"></a><span class="lineno"> 5734</span>&#160;        m_BlockAllocation.m_Offset = offset;</div>
-<div class="line"><a name="l05735"></a><span class="lineno"> 5735</span>&#160;        m_BlockAllocation.m_CanBecomeLost = canBecomeLost;</div>
-<div class="line"><a name="l05736"></a><span class="lineno"> 5736</span>&#160;    }</div>
-<div class="line"><a name="l05737"></a><span class="lineno"> 5737</span>&#160; </div>
-<div class="line"><a name="l05738"></a><span class="lineno"> 5738</span>&#160;    <span class="keywordtype">void</span> InitLost()</div>
-<div class="line"><a name="l05739"></a><span class="lineno"> 5739</span>&#160;    {</div>
-<div class="line"><a name="l05740"></a><span class="lineno"> 5740</span>&#160;        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);</div>
-<div class="line"><a name="l05741"></a><span class="lineno"> 5741</span>&#160;        VMA_ASSERT(m_LastUseFrameIndex.load() == VMA_FRAME_INDEX_LOST);</div>
-<div class="line"><a name="l05742"></a><span class="lineno"> 5742</span>&#160;        m_Type = (uint8_t)ALLOCATION_TYPE_BLOCK;</div>
-<div class="line"><a name="l05743"></a><span class="lineno"> 5743</span>&#160;        m_MemoryTypeIndex = 0;</div>
-<div class="line"><a name="l05744"></a><span class="lineno"> 5744</span>&#160;        m_BlockAllocation.m_Block = VMA_NULL;</div>
-<div class="line"><a name="l05745"></a><span class="lineno"> 5745</span>&#160;        m_BlockAllocation.m_Offset = 0;</div>
-<div class="line"><a name="l05746"></a><span class="lineno"> 5746</span>&#160;        m_BlockAllocation.m_CanBecomeLost = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l05747"></a><span class="lineno"> 5747</span>&#160;    }</div>
-<div class="line"><a name="l05748"></a><span class="lineno"> 5748</span>&#160; </div>
-<div class="line"><a name="l05749"></a><span class="lineno"> 5749</span>&#160;    <span class="keywordtype">void</span> ChangeBlockAllocation(</div>
-<div class="line"><a name="l05750"></a><span class="lineno"> 5750</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l05751"></a><span class="lineno"> 5751</span>&#160;        VmaDeviceMemoryBlock* block,</div>
-<div class="line"><a name="l05752"></a><span class="lineno"> 5752</span>&#160;        VkDeviceSize offset); </div>
-<div class="line"><a name="l05753"></a><span class="lineno"> 5753</span>&#160; </div>
-<div class="line"><a name="l05754"></a><span class="lineno"> 5754</span>&#160;    <span class="keywordtype">void</span> ChangeOffset(VkDeviceSize newOffset);</div>
+<div class="line"><a name="l05675"></a><span class="lineno"> 5675</span>&#160;    <span class="keyword">public</span>:</div>
+<div class="line"><a name="l05676"></a><span class="lineno"> 5676</span>&#160;        const_iterator() :</div>
+<div class="line"><a name="l05677"></a><span class="lineno"> 5677</span>&#160;            m_pList(VMA_NULL),</div>
+<div class="line"><a name="l05678"></a><span class="lineno"> 5678</span>&#160;            m_pItem(VMA_NULL)</div>
+<div class="line"><a name="l05679"></a><span class="lineno"> 5679</span>&#160;        {</div>
+<div class="line"><a name="l05680"></a><span class="lineno"> 5680</span>&#160;        }</div>
+<div class="line"><a name="l05681"></a><span class="lineno"> 5681</span>&#160; </div>
+<div class="line"><a name="l05682"></a><span class="lineno"> 5682</span>&#160;        const_iterator(<span class="keyword">const</span> iterator&amp; src) :</div>
+<div class="line"><a name="l05683"></a><span class="lineno"> 5683</span>&#160;            m_pList(src.m_pList),</div>
+<div class="line"><a name="l05684"></a><span class="lineno"> 5684</span>&#160;            m_pItem(src.m_pItem)</div>
+<div class="line"><a name="l05685"></a><span class="lineno"> 5685</span>&#160;        {</div>
+<div class="line"><a name="l05686"></a><span class="lineno"> 5686</span>&#160;        }</div>
+<div class="line"><a name="l05687"></a><span class="lineno"> 5687</span>&#160;        </div>
+<div class="line"><a name="l05688"></a><span class="lineno"> 5688</span>&#160;        <span class="keyword">const</span> T&amp; operator*()<span class="keyword"> const</span></div>
+<div class="line"><a name="l05689"></a><span class="lineno"> 5689</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l05690"></a><span class="lineno"> 5690</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
+<div class="line"><a name="l05691"></a><span class="lineno"> 5691</span>&#160;            <span class="keywordflow">return</span> m_pItem-&gt;Value;</div>
+<div class="line"><a name="l05692"></a><span class="lineno"> 5692</span>&#160;        }</div>
+<div class="line"><a name="l05693"></a><span class="lineno"> 5693</span>&#160;        <span class="keyword">const</span> T* operator-&gt;()<span class="keyword"> const</span></div>
+<div class="line"><a name="l05694"></a><span class="lineno"> 5694</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l05695"></a><span class="lineno"> 5695</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
+<div class="line"><a name="l05696"></a><span class="lineno"> 5696</span>&#160;            <span class="keywordflow">return</span> &amp;m_pItem-&gt;Value;</div>
+<div class="line"><a name="l05697"></a><span class="lineno"> 5697</span>&#160;        }</div>
+<div class="line"><a name="l05698"></a><span class="lineno"> 5698</span>&#160; </div>
+<div class="line"><a name="l05699"></a><span class="lineno"> 5699</span>&#160;        const_iterator&amp; operator++()</div>
+<div class="line"><a name="l05700"></a><span class="lineno"> 5700</span>&#160;        {</div>
+<div class="line"><a name="l05701"></a><span class="lineno"> 5701</span>&#160;            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
+<div class="line"><a name="l05702"></a><span class="lineno"> 5702</span>&#160;            m_pItem = m_pItem-&gt;pNext;</div>
+<div class="line"><a name="l05703"></a><span class="lineno"> 5703</span>&#160;            <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05704"></a><span class="lineno"> 5704</span>&#160;        }</div>
+<div class="line"><a name="l05705"></a><span class="lineno"> 5705</span>&#160;        const_iterator&amp; operator--()</div>
+<div class="line"><a name="l05706"></a><span class="lineno"> 5706</span>&#160;        {</div>
+<div class="line"><a name="l05707"></a><span class="lineno"> 5707</span>&#160;            <span class="keywordflow">if</span>(m_pItem != VMA_NULL)</div>
+<div class="line"><a name="l05708"></a><span class="lineno"> 5708</span>&#160;            {</div>
+<div class="line"><a name="l05709"></a><span class="lineno"> 5709</span>&#160;                m_pItem = m_pItem-&gt;pPrev;</div>
+<div class="line"><a name="l05710"></a><span class="lineno"> 5710</span>&#160;            }</div>
+<div class="line"><a name="l05711"></a><span class="lineno"> 5711</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05712"></a><span class="lineno"> 5712</span>&#160;            {</div>
+<div class="line"><a name="l05713"></a><span class="lineno"> 5713</span>&#160;                VMA_HEAVY_ASSERT(!m_pList-&gt;IsEmpty());</div>
+<div class="line"><a name="l05714"></a><span class="lineno"> 5714</span>&#160;                m_pItem = m_pList-&gt;Back();</div>
+<div class="line"><a name="l05715"></a><span class="lineno"> 5715</span>&#160;            }</div>
+<div class="line"><a name="l05716"></a><span class="lineno"> 5716</span>&#160;            <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05717"></a><span class="lineno"> 5717</span>&#160;        }</div>
+<div class="line"><a name="l05718"></a><span class="lineno"> 5718</span>&#160; </div>
+<div class="line"><a name="l05719"></a><span class="lineno"> 5719</span>&#160;        const_iterator operator++(<span class="keywordtype">int</span>)</div>
+<div class="line"><a name="l05720"></a><span class="lineno"> 5720</span>&#160;        {</div>
+<div class="line"><a name="l05721"></a><span class="lineno"> 5721</span>&#160;            const_iterator result = *<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05722"></a><span class="lineno"> 5722</span>&#160;            ++*<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05723"></a><span class="lineno"> 5723</span>&#160;            <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l05724"></a><span class="lineno"> 5724</span>&#160;        }</div>
+<div class="line"><a name="l05725"></a><span class="lineno"> 5725</span>&#160;        const_iterator operator--(<span class="keywordtype">int</span>)</div>
+<div class="line"><a name="l05726"></a><span class="lineno"> 5726</span>&#160;        {</div>
+<div class="line"><a name="l05727"></a><span class="lineno"> 5727</span>&#160;            const_iterator result = *<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05728"></a><span class="lineno"> 5728</span>&#160;            --*<span class="keyword">this</span>;</div>
+<div class="line"><a name="l05729"></a><span class="lineno"> 5729</span>&#160;            <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l05730"></a><span class="lineno"> 5730</span>&#160;        }</div>
+<div class="line"><a name="l05731"></a><span class="lineno"> 5731</span>&#160; </div>
+<div class="line"><a name="l05732"></a><span class="lineno"> 5732</span>&#160;        <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> const_iterator&amp; rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l05733"></a><span class="lineno"> 5733</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l05734"></a><span class="lineno"> 5734</span>&#160;            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
+<div class="line"><a name="l05735"></a><span class="lineno"> 5735</span>&#160;            <span class="keywordflow">return</span> m_pItem == rhs.m_pItem;</div>
+<div class="line"><a name="l05736"></a><span class="lineno"> 5736</span>&#160;        }</div>
+<div class="line"><a name="l05737"></a><span class="lineno"> 5737</span>&#160;        <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> const_iterator&amp; rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l05738"></a><span class="lineno"> 5738</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l05739"></a><span class="lineno"> 5739</span>&#160;            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
+<div class="line"><a name="l05740"></a><span class="lineno"> 5740</span>&#160;            <span class="keywordflow">return</span> m_pItem != rhs.m_pItem;</div>
+<div class="line"><a name="l05741"></a><span class="lineno"> 5741</span>&#160;        }</div>
+<div class="line"><a name="l05742"></a><span class="lineno"> 5742</span>&#160;        </div>
+<div class="line"><a name="l05743"></a><span class="lineno"> 5743</span>&#160;    <span class="keyword">private</span>:</div>
+<div class="line"><a name="l05744"></a><span class="lineno"> 5744</span>&#160;        const_iterator(<span class="keyword">const</span> VmaRawList&lt;T&gt;* pList, <span class="keyword">const</span> VmaListItem&lt;T&gt;* pItem) :</div>
+<div class="line"><a name="l05745"></a><span class="lineno"> 5745</span>&#160;            m_pList(pList),</div>
+<div class="line"><a name="l05746"></a><span class="lineno"> 5746</span>&#160;            m_pItem(pItem)</div>
+<div class="line"><a name="l05747"></a><span class="lineno"> 5747</span>&#160;        {</div>
+<div class="line"><a name="l05748"></a><span class="lineno"> 5748</span>&#160;        }</div>
+<div class="line"><a name="l05749"></a><span class="lineno"> 5749</span>&#160; </div>
+<div class="line"><a name="l05750"></a><span class="lineno"> 5750</span>&#160;        <span class="keyword">const</span> VmaRawList&lt;T&gt;* m_pList;</div>
+<div class="line"><a name="l05751"></a><span class="lineno"> 5751</span>&#160;        <span class="keyword">const</span> VmaListItem&lt;T&gt;* m_pItem;</div>
+<div class="line"><a name="l05752"></a><span class="lineno"> 5752</span>&#160; </div>
+<div class="line"><a name="l05753"></a><span class="lineno"> 5753</span>&#160;        <span class="keyword">friend</span> <span class="keyword">class </span>VmaList&lt;T, AllocatorT&gt;;</div>
+<div class="line"><a name="l05754"></a><span class="lineno"> 5754</span>&#160;    };</div>
 <div class="line"><a name="l05755"></a><span class="lineno"> 5755</span>&#160; </div>
-<div class="line"><a name="l05756"></a><span class="lineno"> 5756</span>&#160;    <span class="comment">// pMappedData not null means allocation is created with MAPPED flag.</span></div>
-<div class="line"><a name="l05757"></a><span class="lineno"> 5757</span>&#160;    <span class="keywordtype">void</span> InitDedicatedAllocation(</div>
-<div class="line"><a name="l05758"></a><span class="lineno"> 5758</span>&#160;        uint32_t memoryTypeIndex,</div>
-<div class="line"><a name="l05759"></a><span class="lineno"> 5759</span>&#160;        VkDeviceMemory hMemory,</div>
-<div class="line"><a name="l05760"></a><span class="lineno"> 5760</span>&#160;        VmaSuballocationType suballocationType,</div>
-<div class="line"><a name="l05761"></a><span class="lineno"> 5761</span>&#160;        <span class="keywordtype">void</span>* pMappedData,</div>
-<div class="line"><a name="l05762"></a><span class="lineno"> 5762</span>&#160;        VkDeviceSize size)</div>
-<div class="line"><a name="l05763"></a><span class="lineno"> 5763</span>&#160;    {</div>
-<div class="line"><a name="l05764"></a><span class="lineno"> 5764</span>&#160;        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);</div>
-<div class="line"><a name="l05765"></a><span class="lineno"> 5765</span>&#160;        VMA_ASSERT(hMemory != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l05766"></a><span class="lineno"> 5766</span>&#160;        m_Type = (uint8_t)ALLOCATION_TYPE_DEDICATED;</div>
-<div class="line"><a name="l05767"></a><span class="lineno"> 5767</span>&#160;        m_Alignment = 0;</div>
-<div class="line"><a name="l05768"></a><span class="lineno"> 5768</span>&#160;        m_Size = size;</div>
-<div class="line"><a name="l05769"></a><span class="lineno"> 5769</span>&#160;        m_MemoryTypeIndex = memoryTypeIndex;</div>
-<div class="line"><a name="l05770"></a><span class="lineno"> 5770</span>&#160;        m_SuballocationType = (uint8_t)suballocationType;</div>
-<div class="line"><a name="l05771"></a><span class="lineno"> 5771</span>&#160;        m_MapCount = (pMappedData != VMA_NULL) ? MAP_COUNT_FLAG_PERSISTENT_MAP : 0;</div>
-<div class="line"><a name="l05772"></a><span class="lineno"> 5772</span>&#160;        m_DedicatedAllocation.m_hMemory = hMemory;</div>
-<div class="line"><a name="l05773"></a><span class="lineno"> 5773</span>&#160;        m_DedicatedAllocation.m_pMappedData = pMappedData;</div>
-<div class="line"><a name="l05774"></a><span class="lineno"> 5774</span>&#160;    }</div>
+<div class="line"><a name="l05756"></a><span class="lineno"> 5756</span>&#160;    VmaList(<span class="keyword">const</span> AllocatorT&amp; allocator) : m_RawList(allocator.m_pCallbacks) { }</div>
+<div class="line"><a name="l05757"></a><span class="lineno"> 5757</span>&#160; </div>
+<div class="line"><a name="l05758"></a><span class="lineno"> 5758</span>&#160;    <span class="keywordtype">bool</span> empty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_RawList.IsEmpty(); }</div>
+<div class="line"><a name="l05759"></a><span class="lineno"> 5759</span>&#160;    <span class="keywordtype">size_t</span> size()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_RawList.GetCount(); }</div>
+<div class="line"><a name="l05760"></a><span class="lineno"> 5760</span>&#160; </div>
+<div class="line"><a name="l05761"></a><span class="lineno"> 5761</span>&#160;    iterator begin() { <span class="keywordflow">return</span> iterator(&amp;m_RawList, m_RawList.Front()); }</div>
+<div class="line"><a name="l05762"></a><span class="lineno"> 5762</span>&#160;    iterator end() { <span class="keywordflow">return</span> iterator(&amp;m_RawList, VMA_NULL); }</div>
+<div class="line"><a name="l05763"></a><span class="lineno"> 5763</span>&#160; </div>
+<div class="line"><a name="l05764"></a><span class="lineno"> 5764</span>&#160;    const_iterator cbegin()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> const_iterator(&amp;m_RawList, m_RawList.Front()); }</div>
+<div class="line"><a name="l05765"></a><span class="lineno"> 5765</span>&#160;    const_iterator cend()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> const_iterator(&amp;m_RawList, VMA_NULL); }</div>
+<div class="line"><a name="l05766"></a><span class="lineno"> 5766</span>&#160; </div>
+<div class="line"><a name="l05767"></a><span class="lineno"> 5767</span>&#160;    <span class="keywordtype">void</span> clear() { m_RawList.Clear(); }</div>
+<div class="line"><a name="l05768"></a><span class="lineno"> 5768</span>&#160;    <span class="keywordtype">void</span> push_back(<span class="keyword">const</span> T&amp; value) { m_RawList.PushBack(value); }</div>
+<div class="line"><a name="l05769"></a><span class="lineno"> 5769</span>&#160;    <span class="keywordtype">void</span> erase(iterator it) { m_RawList.Remove(it.m_pItem); }</div>
+<div class="line"><a name="l05770"></a><span class="lineno"> 5770</span>&#160;    iterator insert(iterator it, <span class="keyword">const</span> T&amp; value) { <span class="keywordflow">return</span> iterator(&amp;m_RawList, m_RawList.InsertBefore(it.m_pItem, value)); }</div>
+<div class="line"><a name="l05771"></a><span class="lineno"> 5771</span>&#160; </div>
+<div class="line"><a name="l05772"></a><span class="lineno"> 5772</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l05773"></a><span class="lineno"> 5773</span>&#160;    VmaRawList&lt;T&gt; m_RawList;</div>
+<div class="line"><a name="l05774"></a><span class="lineno"> 5774</span>&#160;};</div>
 <div class="line"><a name="l05775"></a><span class="lineno"> 5775</span>&#160; </div>
-<div class="line"><a name="l05776"></a><span class="lineno"> 5776</span>&#160;    ALLOCATION_TYPE GetType()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (ALLOCATION_TYPE)m_Type; }</div>
-<div class="line"><a name="l05777"></a><span class="lineno"> 5777</span>&#160;    VkDeviceSize GetAlignment()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Alignment; }</div>
-<div class="line"><a name="l05778"></a><span class="lineno"> 5778</span>&#160;    VkDeviceSize GetSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Size; }</div>
-<div class="line"><a name="l05779"></a><span class="lineno"> 5779</span>&#160;    <span class="keywordtype">bool</span> IsUserDataString()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (m_Flags &amp; FLAG_USER_DATA_STRING) != 0; }</div>
-<div class="line"><a name="l05780"></a><span class="lineno"> 5780</span>&#160;    <span class="keywordtype">void</span>* GetUserData()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pUserData; }</div>
-<div class="line"><a name="l05781"></a><span class="lineno"> 5781</span>&#160;    <span class="keywordtype">void</span> SetUserData(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>* pUserData);</div>
-<div class="line"><a name="l05782"></a><span class="lineno"> 5782</span>&#160;    VmaSuballocationType GetSuballocationType()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (VmaSuballocationType)m_SuballocationType; }</div>
+<div class="line"><a name="l05776"></a><span class="lineno"> 5776</span>&#160;<span class="preprocessor">#endif // #if VMA_USE_STL_LIST</span></div>
+<div class="line"><a name="l05777"></a><span class="lineno"> 5777</span>&#160; </div>
+<div class="line"><a name="l05779"></a><span class="lineno"> 5779</span>&#160;<span class="comment">// class VmaMap</span></div>
+<div class="line"><a name="l05780"></a><span class="lineno"> 5780</span>&#160; </div>
+<div class="line"><a name="l05781"></a><span class="lineno"> 5781</span>&#160;<span class="comment">// Unused in this version.</span></div>
+<div class="line"><a name="l05782"></a><span class="lineno"> 5782</span>&#160;<span class="preprocessor">#if 0</span></div>
 <div class="line"><a name="l05783"></a><span class="lineno"> 5783</span>&#160; </div>
-<div class="line"><a name="l05784"></a><span class="lineno"> 5784</span>&#160;    VmaDeviceMemoryBlock* GetBlock()<span class="keyword"> const</span></div>
-<div class="line"><a name="l05785"></a><span class="lineno"> 5785</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l05786"></a><span class="lineno"> 5786</span>&#160;        VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);</div>
-<div class="line"><a name="l05787"></a><span class="lineno"> 5787</span>&#160;        <span class="keywordflow">return</span> m_BlockAllocation.m_Block;</div>
-<div class="line"><a name="l05788"></a><span class="lineno"> 5788</span>&#160;    }</div>
-<div class="line"><a name="l05789"></a><span class="lineno"> 5789</span>&#160;    VkDeviceSize GetOffset() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l05790"></a><span class="lineno"> 5790</span>&#160;    VkDeviceMemory GetMemory() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l05791"></a><span class="lineno"> 5791</span>&#160;    uint32_t GetMemoryTypeIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemoryTypeIndex; }</div>
-<div class="line"><a name="l05792"></a><span class="lineno"> 5792</span>&#160;    <span class="keywordtype">bool</span> IsPersistentMap()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (m_MapCount &amp; MAP_COUNT_FLAG_PERSISTENT_MAP) != 0; }</div>
-<div class="line"><a name="l05793"></a><span class="lineno"> 5793</span>&#160;    <span class="keywordtype">void</span>* GetMappedData() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l05794"></a><span class="lineno"> 5794</span>&#160;    <span class="keywordtype">bool</span> CanBecomeLost() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l05795"></a><span class="lineno"> 5795</span>&#160;    </div>
-<div class="line"><a name="l05796"></a><span class="lineno"> 5796</span>&#160;    uint32_t GetLastUseFrameIndex()<span class="keyword"> const</span></div>
-<div class="line"><a name="l05797"></a><span class="lineno"> 5797</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l05798"></a><span class="lineno"> 5798</span>&#160;        <span class="keywordflow">return</span> m_LastUseFrameIndex.load();</div>
-<div class="line"><a name="l05799"></a><span class="lineno"> 5799</span>&#160;    }</div>
-<div class="line"><a name="l05800"></a><span class="lineno"> 5800</span>&#160;    <span class="keywordtype">bool</span> CompareExchangeLastUseFrameIndex(uint32_t&amp; expected, uint32_t desired)</div>
-<div class="line"><a name="l05801"></a><span class="lineno"> 5801</span>&#160;    {</div>
-<div class="line"><a name="l05802"></a><span class="lineno"> 5802</span>&#160;        <span class="keywordflow">return</span> m_LastUseFrameIndex.compare_exchange_weak(expected, desired);</div>
-<div class="line"><a name="l05803"></a><span class="lineno"> 5803</span>&#160;    }</div>
-<div class="line"><a name="l05804"></a><span class="lineno"> 5804</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l05805"></a><span class="lineno"> 5805</span>&#160;<span class="comment">    - If hAllocation.LastUseFrameIndex + frameInUseCount &lt; allocator.CurrentFrameIndex,</span></div>
-<div class="line"><a name="l05806"></a><span class="lineno"> 5806</span>&#160;<span class="comment">      makes it lost by setting LastUseFrameIndex = VMA_FRAME_INDEX_LOST and returns true.</span></div>
-<div class="line"><a name="l05807"></a><span class="lineno"> 5807</span>&#160;<span class="comment">    - Else, returns false.</span></div>
-<div class="line"><a name="l05808"></a><span class="lineno"> 5808</span>&#160;<span class="comment">    </span></div>
-<div class="line"><a name="l05809"></a><span class="lineno"> 5809</span>&#160;<span class="comment">    If hAllocation is already lost, assert - you should not call it then.</span></div>
-<div class="line"><a name="l05810"></a><span class="lineno"> 5810</span>&#160;<span class="comment">    If hAllocation was not created with CAN_BECOME_LOST_BIT, assert.</span></div>
-<div class="line"><a name="l05811"></a><span class="lineno"> 5811</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l05812"></a><span class="lineno"> 5812</span>&#160;    <span class="keywordtype">bool</span> MakeLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
-<div class="line"><a name="l05813"></a><span class="lineno"> 5813</span>&#160; </div>
-<div class="line"><a name="l05814"></a><span class="lineno"> 5814</span>&#160;    <span class="keywordtype">void</span> DedicatedAllocCalcStatsInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo)</div>
-<div class="line"><a name="l05815"></a><span class="lineno"> 5815</span>&#160;    {</div>
-<div class="line"><a name="l05816"></a><span class="lineno"> 5816</span>&#160;        VMA_ASSERT(m_Type == ALLOCATION_TYPE_DEDICATED);</div>
-<div class="line"><a name="l05817"></a><span class="lineno"> 5817</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> = 1;</div>
-<div class="line"><a name="l05818"></a><span class="lineno"> 5818</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> = 1;</div>
-<div class="line"><a name="l05819"></a><span class="lineno"> 5819</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> = 0;</div>
-<div class="line"><a name="l05820"></a><span class="lineno"> 5820</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> = m_Size;</div>
-<div class="line"><a name="l05821"></a><span class="lineno"> 5821</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> = 0;</div>
-<div class="line"><a name="l05822"></a><span class="lineno"> 5822</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = m_Size;</div>
-<div class="line"><a name="l05823"></a><span class="lineno"> 5823</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = UINT64_MAX;</div>
-<div class="line"><a name="l05824"></a><span class="lineno"> 5824</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = 0;</div>
-<div class="line"><a name="l05825"></a><span class="lineno"> 5825</span>&#160;    }</div>
-<div class="line"><a name="l05826"></a><span class="lineno"> 5826</span>&#160; </div>
-<div class="line"><a name="l05827"></a><span class="lineno"> 5827</span>&#160;    <span class="keywordtype">void</span> BlockAllocMap();</div>
-<div class="line"><a name="l05828"></a><span class="lineno"> 5828</span>&#160;    <span class="keywordtype">void</span> BlockAllocUnmap();</div>
-<div class="line"><a name="l05829"></a><span class="lineno"> 5829</span>&#160;    VkResult DedicatedAllocMap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>** ppData);</div>
-<div class="line"><a name="l05830"></a><span class="lineno"> 5830</span>&#160;    <span class="keywordtype">void</span> DedicatedAllocUnmap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
-<div class="line"><a name="l05831"></a><span class="lineno"> 5831</span>&#160; </div>
-<div class="line"><a name="l05832"></a><span class="lineno"> 5832</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l05833"></a><span class="lineno"> 5833</span>&#160;    uint32_t GetCreationFrameIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_CreationFrameIndex; }</div>
-<div class="line"><a name="l05834"></a><span class="lineno"> 5834</span>&#160;    uint32_t GetBufferImageUsage()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BufferImageUsage; }</div>
-<div class="line"><a name="l05835"></a><span class="lineno"> 5835</span>&#160; </div>
-<div class="line"><a name="l05836"></a><span class="lineno"> 5836</span>&#160;    <span class="keywordtype">void</span> InitBufferImageUsage(uint32_t bufferImageUsage)</div>
-<div class="line"><a name="l05837"></a><span class="lineno"> 5837</span>&#160;    {</div>
-<div class="line"><a name="l05838"></a><span class="lineno"> 5838</span>&#160;        VMA_ASSERT(m_BufferImageUsage == 0);</div>
-<div class="line"><a name="l05839"></a><span class="lineno"> 5839</span>&#160;        m_BufferImageUsage = bufferImageUsage;</div>
-<div class="line"><a name="l05840"></a><span class="lineno"> 5840</span>&#160;    }</div>
-<div class="line"><a name="l05841"></a><span class="lineno"> 5841</span>&#160; </div>
-<div class="line"><a name="l05842"></a><span class="lineno"> 5842</span>&#160;    <span class="keywordtype">void</span> PrintParameters(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l05843"></a><span class="lineno"> 5843</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l05844"></a><span class="lineno"> 5844</span>&#160; </div>
-<div class="line"><a name="l05845"></a><span class="lineno"> 5845</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l05846"></a><span class="lineno"> 5846</span>&#160;    VkDeviceSize m_Alignment;</div>
-<div class="line"><a name="l05847"></a><span class="lineno"> 5847</span>&#160;    VkDeviceSize m_Size;</div>
-<div class="line"><a name="l05848"></a><span class="lineno"> 5848</span>&#160;    <span class="keywordtype">void</span>* m_pUserData;</div>
-<div class="line"><a name="l05849"></a><span class="lineno"> 5849</span>&#160;    VMA_ATOMIC_UINT32 m_LastUseFrameIndex;</div>
-<div class="line"><a name="l05850"></a><span class="lineno"> 5850</span>&#160;    uint32_t m_MemoryTypeIndex;</div>
-<div class="line"><a name="l05851"></a><span class="lineno"> 5851</span>&#160;    uint8_t m_Type; <span class="comment">// ALLOCATION_TYPE</span></div>
-<div class="line"><a name="l05852"></a><span class="lineno"> 5852</span>&#160;    uint8_t m_SuballocationType; <span class="comment">// VmaSuballocationType</span></div>
-<div class="line"><a name="l05853"></a><span class="lineno"> 5853</span>&#160;    <span class="comment">// Bit 0x80 is set when allocation was created with VMA_ALLOCATION_CREATE_MAPPED_BIT.</span></div>
-<div class="line"><a name="l05854"></a><span class="lineno"> 5854</span>&#160;    <span class="comment">// Bits with mask 0x7F are reference counter for vmaMapMemory()/vmaUnmapMemory().</span></div>
-<div class="line"><a name="l05855"></a><span class="lineno"> 5855</span>&#160;    uint8_t m_MapCount;</div>
-<div class="line"><a name="l05856"></a><span class="lineno"> 5856</span>&#160;    uint8_t m_Flags; <span class="comment">// enum FLAGS</span></div>
-<div class="line"><a name="l05857"></a><span class="lineno"> 5857</span>&#160; </div>
-<div class="line"><a name="l05858"></a><span class="lineno"> 5858</span>&#160;    <span class="comment">// Allocation out of VmaDeviceMemoryBlock.</span></div>
-<div class="line"><a name="l05859"></a><span class="lineno"> 5859</span>&#160;    <span class="keyword">struct </span>BlockAllocation</div>
-<div class="line"><a name="l05860"></a><span class="lineno"> 5860</span>&#160;    {</div>
-<div class="line"><a name="l05861"></a><span class="lineno"> 5861</span>&#160;        VmaDeviceMemoryBlock* m_Block;</div>
-<div class="line"><a name="l05862"></a><span class="lineno"> 5862</span>&#160;        VkDeviceSize m_Offset;</div>
-<div class="line"><a name="l05863"></a><span class="lineno"> 5863</span>&#160;        <span class="keywordtype">bool</span> m_CanBecomeLost;</div>
-<div class="line"><a name="l05864"></a><span class="lineno"> 5864</span>&#160;    };</div>
-<div class="line"><a name="l05865"></a><span class="lineno"> 5865</span>&#160; </div>
-<div class="line"><a name="l05866"></a><span class="lineno"> 5866</span>&#160;    <span class="comment">// Allocation for an object that has its own private VkDeviceMemory.</span></div>
-<div class="line"><a name="l05867"></a><span class="lineno"> 5867</span>&#160;    <span class="keyword">struct </span>DedicatedAllocation</div>
-<div class="line"><a name="l05868"></a><span class="lineno"> 5868</span>&#160;    {</div>
-<div class="line"><a name="l05869"></a><span class="lineno"> 5869</span>&#160;        VkDeviceMemory m_hMemory;</div>
-<div class="line"><a name="l05870"></a><span class="lineno"> 5870</span>&#160;        <span class="keywordtype">void</span>* m_pMappedData; <span class="comment">// Not null means memory is mapped.</span></div>
-<div class="line"><a name="l05871"></a><span class="lineno"> 5871</span>&#160;    };</div>
-<div class="line"><a name="l05872"></a><span class="lineno"> 5872</span>&#160; </div>
-<div class="line"><a name="l05873"></a><span class="lineno"> 5873</span>&#160;    <span class="keyword">union</span></div>
-<div class="line"><a name="l05874"></a><span class="lineno"> 5874</span>&#160;    {</div>
-<div class="line"><a name="l05875"></a><span class="lineno"> 5875</span>&#160;        <span class="comment">// Allocation out of VmaDeviceMemoryBlock.</span></div>
-<div class="line"><a name="l05876"></a><span class="lineno"> 5876</span>&#160;        BlockAllocation m_BlockAllocation;</div>
-<div class="line"><a name="l05877"></a><span class="lineno"> 5877</span>&#160;        <span class="comment">// Allocation for an object that has its own private VkDeviceMemory.</span></div>
-<div class="line"><a name="l05878"></a><span class="lineno"> 5878</span>&#160;        DedicatedAllocation m_DedicatedAllocation;</div>
-<div class="line"><a name="l05879"></a><span class="lineno"> 5879</span>&#160;    };</div>
-<div class="line"><a name="l05880"></a><span class="lineno"> 5880</span>&#160; </div>
-<div class="line"><a name="l05881"></a><span class="lineno"> 5881</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l05882"></a><span class="lineno"> 5882</span>&#160;    uint32_t m_CreationFrameIndex;</div>
-<div class="line"><a name="l05883"></a><span class="lineno"> 5883</span>&#160;    uint32_t m_BufferImageUsage; <span class="comment">// 0 if unknown.</span></div>
-<div class="line"><a name="l05884"></a><span class="lineno"> 5884</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l05784"></a><span class="lineno"> 5784</span>&#160;<span class="preprocessor">#if VMA_USE_STL_UNORDERED_MAP</span></div>
+<div class="line"><a name="l05785"></a><span class="lineno"> 5785</span>&#160; </div>
+<div class="line"><a name="l05786"></a><span class="lineno"> 5786</span>&#160;<span class="preprocessor">#define VmaPair std::pair</span></div>
+<div class="line"><a name="l05787"></a><span class="lineno"> 5787</span>&#160; </div>
+<div class="line"><a name="l05788"></a><span class="lineno"> 5788</span>&#160;<span class="preprocessor">#define VMA_MAP_TYPE(KeyT, ValueT) \</span></div>
+<div class="line"><a name="l05789"></a><span class="lineno"> 5789</span>&#160;<span class="preprocessor">    std::unordered_map&lt; KeyT, ValueT, std::hash&lt;KeyT&gt;, std::equal_to&lt;KeyT&gt;, VmaStlAllocator&lt; std::pair&lt;KeyT, ValueT&gt; &gt; &gt;</span></div>
+<div class="line"><a name="l05790"></a><span class="lineno"> 5790</span>&#160; </div>
+<div class="line"><a name="l05791"></a><span class="lineno"> 5791</span>&#160;<span class="preprocessor">#else // #if VMA_USE_STL_UNORDERED_MAP</span></div>
+<div class="line"><a name="l05792"></a><span class="lineno"> 5792</span>&#160; </div>
+<div class="line"><a name="l05793"></a><span class="lineno"> 5793</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T1, <span class="keyword">typename</span> T2&gt;</div>
+<div class="line"><a name="l05794"></a><span class="lineno"> 5794</span>&#160;<span class="keyword">struct </span>VmaPair</div>
+<div class="line"><a name="l05795"></a><span class="lineno"> 5795</span>&#160;{</div>
+<div class="line"><a name="l05796"></a><span class="lineno"> 5796</span>&#160;    T1 first;</div>
+<div class="line"><a name="l05797"></a><span class="lineno"> 5797</span>&#160;    T2 second;</div>
+<div class="line"><a name="l05798"></a><span class="lineno"> 5798</span>&#160; </div>
+<div class="line"><a name="l05799"></a><span class="lineno"> 5799</span>&#160;    VmaPair() : first(), second() { }</div>
+<div class="line"><a name="l05800"></a><span class="lineno"> 5800</span>&#160;    VmaPair(<span class="keyword">const</span> T1&amp; firstSrc, <span class="keyword">const</span> T2&amp; secondSrc) : first(firstSrc), second(secondSrc) { }</div>
+<div class="line"><a name="l05801"></a><span class="lineno"> 5801</span>&#160;};</div>
+<div class="line"><a name="l05802"></a><span class="lineno"> 5802</span>&#160; </div>
+<div class="line"><a name="l05803"></a><span class="lineno"> 5803</span>&#160;<span class="comment">/* Class compatible with subset of interface of std::unordered_map.</span></div>
+<div class="line"><a name="l05804"></a><span class="lineno"> 5804</span>&#160;<span class="comment">KeyT, ValueT must be POD because they will be stored in VmaVector.</span></div>
+<div class="line"><a name="l05805"></a><span class="lineno"> 5805</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l05806"></a><span class="lineno"> 5806</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
+<div class="line"><a name="l05807"></a><span class="lineno"> 5807</span>&#160;<span class="keyword">class </span>VmaMap</div>
+<div class="line"><a name="l05808"></a><span class="lineno"> 5808</span>&#160;{</div>
+<div class="line"><a name="l05809"></a><span class="lineno"> 5809</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l05810"></a><span class="lineno"> 5810</span>&#160;    <span class="keyword">typedef</span> VmaPair&lt;KeyT, ValueT&gt; PairType;</div>
+<div class="line"><a name="l05811"></a><span class="lineno"> 5811</span>&#160;    <span class="keyword">typedef</span> PairType* iterator;</div>
+<div class="line"><a name="l05812"></a><span class="lineno"> 5812</span>&#160; </div>
+<div class="line"><a name="l05813"></a><span class="lineno"> 5813</span>&#160;    VmaMap(<span class="keyword">const</span> VmaStlAllocator&lt;PairType&gt;&amp; allocator) : m_Vector(allocator) { }</div>
+<div class="line"><a name="l05814"></a><span class="lineno"> 5814</span>&#160; </div>
+<div class="line"><a name="l05815"></a><span class="lineno"> 5815</span>&#160;    iterator begin() { <span class="keywordflow">return</span> m_Vector.begin(); }</div>
+<div class="line"><a name="l05816"></a><span class="lineno"> 5816</span>&#160;    iterator end() { <span class="keywordflow">return</span> m_Vector.end(); }</div>
+<div class="line"><a name="l05817"></a><span class="lineno"> 5817</span>&#160; </div>
+<div class="line"><a name="l05818"></a><span class="lineno"> 5818</span>&#160;    <span class="keywordtype">void</span> insert(<span class="keyword">const</span> PairType&amp; pair);</div>
+<div class="line"><a name="l05819"></a><span class="lineno"> 5819</span>&#160;    iterator find(<span class="keyword">const</span> KeyT&amp; key);</div>
+<div class="line"><a name="l05820"></a><span class="lineno"> 5820</span>&#160;    <span class="keywordtype">void</span> erase(iterator it);</div>
+<div class="line"><a name="l05821"></a><span class="lineno"> 5821</span>&#160;    </div>
+<div class="line"><a name="l05822"></a><span class="lineno"> 5822</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l05823"></a><span class="lineno"> 5823</span>&#160;    VmaVector&lt; PairType, VmaStlAllocator&lt;PairType&gt; &gt; m_Vector;</div>
+<div class="line"><a name="l05824"></a><span class="lineno"> 5824</span>&#160;};</div>
+<div class="line"><a name="l05825"></a><span class="lineno"> 5825</span>&#160; </div>
+<div class="line"><a name="l05826"></a><span class="lineno"> 5826</span>&#160;<span class="preprocessor">#define VMA_MAP_TYPE(KeyT, ValueT) VmaMap&lt;KeyT, ValueT&gt;</span></div>
+<div class="line"><a name="l05827"></a><span class="lineno"> 5827</span>&#160; </div>
+<div class="line"><a name="l05828"></a><span class="lineno"> 5828</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> FirstT, <span class="keyword">typename</span> SecondT&gt;</div>
+<div class="line"><a name="l05829"></a><span class="lineno"> 5829</span>&#160;<span class="keyword">struct </span>VmaPairFirstLess</div>
+<div class="line"><a name="l05830"></a><span class="lineno"> 5830</span>&#160;{</div>
+<div class="line"><a name="l05831"></a><span class="lineno"> 5831</span>&#160;    <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaPair&lt;FirstT, SecondT&gt;&amp; lhs, <span class="keyword">const</span> VmaPair&lt;FirstT, SecondT&gt;&amp; rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l05832"></a><span class="lineno"> 5832</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l05833"></a><span class="lineno"> 5833</span>&#160;        <span class="keywordflow">return</span> lhs.first &lt; rhs.first;</div>
+<div class="line"><a name="l05834"></a><span class="lineno"> 5834</span>&#160;    }</div>
+<div class="line"><a name="l05835"></a><span class="lineno"> 5835</span>&#160;    <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaPair&lt;FirstT, SecondT&gt;&amp; lhs, <span class="keyword">const</span> FirstT&amp; rhsFirst)<span class="keyword"> const</span></div>
+<div class="line"><a name="l05836"></a><span class="lineno"> 5836</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l05837"></a><span class="lineno"> 5837</span>&#160;        <span class="keywordflow">return</span> lhs.first &lt; rhsFirst;</div>
+<div class="line"><a name="l05838"></a><span class="lineno"> 5838</span>&#160;    }</div>
+<div class="line"><a name="l05839"></a><span class="lineno"> 5839</span>&#160;};</div>
+<div class="line"><a name="l05840"></a><span class="lineno"> 5840</span>&#160; </div>
+<div class="line"><a name="l05841"></a><span class="lineno"> 5841</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
+<div class="line"><a name="l05842"></a><span class="lineno"> 5842</span>&#160;<span class="keywordtype">void</span> VmaMap&lt;KeyT, ValueT&gt;::insert(<span class="keyword">const</span> PairType&amp; pair)</div>
+<div class="line"><a name="l05843"></a><span class="lineno"> 5843</span>&#160;{</div>
+<div class="line"><a name="l05844"></a><span class="lineno"> 5844</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> indexToInsert = VmaBinaryFindFirstNotLess(</div>
+<div class="line"><a name="l05845"></a><span class="lineno"> 5845</span>&#160;        m_Vector.data(),</div>
+<div class="line"><a name="l05846"></a><span class="lineno"> 5846</span>&#160;        m_Vector.data() + m_Vector.size(),</div>
+<div class="line"><a name="l05847"></a><span class="lineno"> 5847</span>&#160;        pair,</div>
+<div class="line"><a name="l05848"></a><span class="lineno"> 5848</span>&#160;        VmaPairFirstLess&lt;KeyT, ValueT&gt;()) - m_Vector.data();</div>
+<div class="line"><a name="l05849"></a><span class="lineno"> 5849</span>&#160;    VmaVectorInsert(m_Vector, indexToInsert, pair);</div>
+<div class="line"><a name="l05850"></a><span class="lineno"> 5850</span>&#160;}</div>
+<div class="line"><a name="l05851"></a><span class="lineno"> 5851</span>&#160; </div>
+<div class="line"><a name="l05852"></a><span class="lineno"> 5852</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
+<div class="line"><a name="l05853"></a><span class="lineno"> 5853</span>&#160;VmaPair&lt;KeyT, ValueT&gt;* VmaMap&lt;KeyT, ValueT&gt;::find(<span class="keyword">const</span> KeyT&amp; key)</div>
+<div class="line"><a name="l05854"></a><span class="lineno"> 5854</span>&#160;{</div>
+<div class="line"><a name="l05855"></a><span class="lineno"> 5855</span>&#160;    PairType* it = VmaBinaryFindFirstNotLess(</div>
+<div class="line"><a name="l05856"></a><span class="lineno"> 5856</span>&#160;        m_Vector.data(),</div>
+<div class="line"><a name="l05857"></a><span class="lineno"> 5857</span>&#160;        m_Vector.data() + m_Vector.size(),</div>
+<div class="line"><a name="l05858"></a><span class="lineno"> 5858</span>&#160;        key,</div>
+<div class="line"><a name="l05859"></a><span class="lineno"> 5859</span>&#160;        VmaPairFirstLess&lt;KeyT, ValueT&gt;());</div>
+<div class="line"><a name="l05860"></a><span class="lineno"> 5860</span>&#160;    <span class="keywordflow">if</span>((it != m_Vector.end()) &amp;&amp; (it-&gt;first == key))</div>
+<div class="line"><a name="l05861"></a><span class="lineno"> 5861</span>&#160;    {</div>
+<div class="line"><a name="l05862"></a><span class="lineno"> 5862</span>&#160;        <span class="keywordflow">return</span> it;</div>
+<div class="line"><a name="l05863"></a><span class="lineno"> 5863</span>&#160;    }</div>
+<div class="line"><a name="l05864"></a><span class="lineno"> 5864</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l05865"></a><span class="lineno"> 5865</span>&#160;    {</div>
+<div class="line"><a name="l05866"></a><span class="lineno"> 5866</span>&#160;        <span class="keywordflow">return</span> m_Vector.end();</div>
+<div class="line"><a name="l05867"></a><span class="lineno"> 5867</span>&#160;    }</div>
+<div class="line"><a name="l05868"></a><span class="lineno"> 5868</span>&#160;}</div>
+<div class="line"><a name="l05869"></a><span class="lineno"> 5869</span>&#160; </div>
+<div class="line"><a name="l05870"></a><span class="lineno"> 5870</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
+<div class="line"><a name="l05871"></a><span class="lineno"> 5871</span>&#160;<span class="keywordtype">void</span> VmaMap&lt;KeyT, ValueT&gt;::erase(iterator it)</div>
+<div class="line"><a name="l05872"></a><span class="lineno"> 5872</span>&#160;{</div>
+<div class="line"><a name="l05873"></a><span class="lineno"> 5873</span>&#160;    VmaVectorRemove(m_Vector, it - m_Vector.begin());</div>
+<div class="line"><a name="l05874"></a><span class="lineno"> 5874</span>&#160;}</div>
+<div class="line"><a name="l05875"></a><span class="lineno"> 5875</span>&#160; </div>
+<div class="line"><a name="l05876"></a><span class="lineno"> 5876</span>&#160;<span class="preprocessor">#endif // #if VMA_USE_STL_UNORDERED_MAP</span></div>
+<div class="line"><a name="l05877"></a><span class="lineno"> 5877</span>&#160; </div>
+<div class="line"><a name="l05878"></a><span class="lineno"> 5878</span>&#160;<span class="preprocessor">#endif // #if 0</span></div>
+<div class="line"><a name="l05879"></a><span class="lineno"> 5879</span>&#160; </div>
+<div class="line"><a name="l05881"></a><span class="lineno"> 5881</span>&#160; </div>
+<div class="line"><a name="l05882"></a><span class="lineno"> 5882</span>&#160;<span class="keyword">class </span>VmaDeviceMemoryBlock;</div>
+<div class="line"><a name="l05883"></a><span class="lineno"> 5883</span>&#160; </div>
+<div class="line"><a name="l05884"></a><span class="lineno"> 5884</span>&#160;<span class="keyword">enum</span> VMA_CACHE_OPERATION { VMA_CACHE_FLUSH, VMA_CACHE_INVALIDATE };</div>
 <div class="line"><a name="l05885"></a><span class="lineno"> 5885</span>&#160; </div>
-<div class="line"><a name="l05886"></a><span class="lineno"> 5886</span>&#160;    <span class="keywordtype">void</span> FreeUserDataString(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
-<div class="line"><a name="l05887"></a><span class="lineno"> 5887</span>&#160;};</div>
-<div class="line"><a name="l05888"></a><span class="lineno"> 5888</span>&#160; </div>
-<div class="line"><a name="l05889"></a><span class="lineno"> 5889</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l05890"></a><span class="lineno"> 5890</span>&#160;<span class="comment">Represents a region of VmaDeviceMemoryBlock that is either assigned and returned as</span></div>
-<div class="line"><a name="l05891"></a><span class="lineno"> 5891</span>&#160;<span class="comment">allocated memory block or free.</span></div>
-<div class="line"><a name="l05892"></a><span class="lineno"> 5892</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l05893"></a><span class="lineno"> 5893</span>&#160;<span class="keyword">struct </span>VmaSuballocation</div>
-<div class="line"><a name="l05894"></a><span class="lineno"> 5894</span>&#160;{</div>
-<div class="line"><a name="l05895"></a><span class="lineno"> 5895</span>&#160;    VkDeviceSize offset;</div>
-<div class="line"><a name="l05896"></a><span class="lineno"> 5896</span>&#160;    VkDeviceSize size;</div>
-<div class="line"><a name="l05897"></a><span class="lineno"> 5897</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation;</div>
-<div class="line"><a name="l05898"></a><span class="lineno"> 5898</span>&#160;    VmaSuballocationType type;</div>
-<div class="line"><a name="l05899"></a><span class="lineno"> 5899</span>&#160;};</div>
-<div class="line"><a name="l05900"></a><span class="lineno"> 5900</span>&#160; </div>
-<div class="line"><a name="l05901"></a><span class="lineno"> 5901</span>&#160;<span class="comment">// Comparator for offsets.</span></div>
-<div class="line"><a name="l05902"></a><span class="lineno"> 5902</span>&#160;<span class="keyword">struct </span>VmaSuballocationOffsetLess</div>
-<div class="line"><a name="l05903"></a><span class="lineno"> 5903</span>&#160;{</div>
-<div class="line"><a name="l05904"></a><span class="lineno"> 5904</span>&#160;    <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaSuballocation&amp; lhs, <span class="keyword">const</span> VmaSuballocation&amp; rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l05905"></a><span class="lineno"> 5905</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l05906"></a><span class="lineno"> 5906</span>&#160;        <span class="keywordflow">return</span> lhs.offset &lt; rhs.offset;</div>
-<div class="line"><a name="l05907"></a><span class="lineno"> 5907</span>&#160;    }</div>
-<div class="line"><a name="l05908"></a><span class="lineno"> 5908</span>&#160;};</div>
-<div class="line"><a name="l05909"></a><span class="lineno"> 5909</span>&#160;<span class="keyword">struct </span>VmaSuballocationOffsetGreater</div>
-<div class="line"><a name="l05910"></a><span class="lineno"> 5910</span>&#160;{</div>
-<div class="line"><a name="l05911"></a><span class="lineno"> 5911</span>&#160;    <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaSuballocation&amp; lhs, <span class="keyword">const</span> VmaSuballocation&amp; rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l05912"></a><span class="lineno"> 5912</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l05913"></a><span class="lineno"> 5913</span>&#160;        <span class="keywordflow">return</span> lhs.offset &gt; rhs.offset;</div>
-<div class="line"><a name="l05914"></a><span class="lineno"> 5914</span>&#160;    }</div>
-<div class="line"><a name="l05915"></a><span class="lineno"> 5915</span>&#160;};</div>
-<div class="line"><a name="l05916"></a><span class="lineno"> 5916</span>&#160; </div>
-<div class="line"><a name="l05917"></a><span class="lineno"> 5917</span>&#160;<span class="keyword">typedef</span> VmaList&lt; VmaSuballocation, VmaStlAllocator&lt;VmaSuballocation&gt; &gt; VmaSuballocationList;</div>
-<div class="line"><a name="l05918"></a><span class="lineno"> 5918</span>&#160; </div>
-<div class="line"><a name="l05919"></a><span class="lineno"> 5919</span>&#160;<span class="comment">// Cost of one additional allocation lost, as equivalent in bytes.</span></div>
-<div class="line"><a name="l05920"></a><span class="lineno"> 5920</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> VkDeviceSize VMA_LOST_ALLOCATION_COST = 1048576;</div>
-<div class="line"><a name="l05921"></a><span class="lineno"> 5921</span>&#160; </div>
-<div class="line"><a name="l05922"></a><span class="lineno"> 5922</span>&#160;<span class="keyword">enum class</span> VmaAllocationRequestType</div>
-<div class="line"><a name="l05923"></a><span class="lineno"> 5923</span>&#160;{</div>
-<div class="line"><a name="l05924"></a><span class="lineno"> 5924</span>&#160;    Normal,</div>
-<div class="line"><a name="l05925"></a><span class="lineno"> 5925</span>&#160;    <span class="comment">// Used by &quot;Linear&quot; algorithm.</span></div>
-<div class="line"><a name="l05926"></a><span class="lineno"> 5926</span>&#160;    UpperAddress,</div>
-<div class="line"><a name="l05927"></a><span class="lineno"> 5927</span>&#160;    EndOf1st,</div>
-<div class="line"><a name="l05928"></a><span class="lineno"> 5928</span>&#160;    EndOf2nd,</div>
-<div class="line"><a name="l05929"></a><span class="lineno"> 5929</span>&#160;};</div>
-<div class="line"><a name="l05930"></a><span class="lineno"> 5930</span>&#160; </div>
-<div class="line"><a name="l05931"></a><span class="lineno"> 5931</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l05932"></a><span class="lineno"> 5932</span>&#160;<span class="comment">Parameters of planned allocation inside a VmaDeviceMemoryBlock.</span></div>
-<div class="line"><a name="l05933"></a><span class="lineno"> 5933</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l05934"></a><span class="lineno"> 5934</span>&#160;<span class="comment">If canMakeOtherLost was false:</span></div>
-<div class="line"><a name="l05935"></a><span class="lineno"> 5935</span>&#160;<span class="comment">- item points to a FREE suballocation.</span></div>
-<div class="line"><a name="l05936"></a><span class="lineno"> 5936</span>&#160;<span class="comment">- itemsToMakeLostCount is 0.</span></div>
-<div class="line"><a name="l05937"></a><span class="lineno"> 5937</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l05938"></a><span class="lineno"> 5938</span>&#160;<span class="comment">If canMakeOtherLost was true:</span></div>
-<div class="line"><a name="l05939"></a><span class="lineno"> 5939</span>&#160;<span class="comment">- item points to first of sequence of suballocations, which are either FREE,</span></div>
-<div class="line"><a name="l05940"></a><span class="lineno"> 5940</span>&#160;<span class="comment">  or point to VmaAllocations that can become lost.</span></div>
-<div class="line"><a name="l05941"></a><span class="lineno"> 5941</span>&#160;<span class="comment">- itemsToMakeLostCount is the number of VmaAllocations that need to be made lost for</span></div>
-<div class="line"><a name="l05942"></a><span class="lineno"> 5942</span>&#160;<span class="comment">  the requested allocation to succeed.</span></div>
-<div class="line"><a name="l05943"></a><span class="lineno"> 5943</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l05944"></a><span class="lineno"> 5944</span>&#160;<span class="keyword">struct </span>VmaAllocationRequest</div>
-<div class="line"><a name="l05945"></a><span class="lineno"> 5945</span>&#160;{</div>
-<div class="line"><a name="l05946"></a><span class="lineno"> 5946</span>&#160;    VkDeviceSize offset;</div>
-<div class="line"><a name="l05947"></a><span class="lineno"> 5947</span>&#160;    VkDeviceSize sumFreeSize; <span class="comment">// Sum size of free items that overlap with proposed allocation.</span></div>
-<div class="line"><a name="l05948"></a><span class="lineno"> 5948</span>&#160;    VkDeviceSize sumItemSize; <span class="comment">// Sum size of items to make lost that overlap with proposed allocation.</span></div>
-<div class="line"><a name="l05949"></a><span class="lineno"> 5949</span>&#160;    VmaSuballocationList::iterator item;</div>
-<div class="line"><a name="l05950"></a><span class="lineno"> 5950</span>&#160;    <span class="keywordtype">size_t</span> itemsToMakeLostCount;</div>
-<div class="line"><a name="l05951"></a><span class="lineno"> 5951</span>&#160;    <span class="keywordtype">void</span>* customData;</div>
-<div class="line"><a name="l05952"></a><span class="lineno"> 5952</span>&#160;    VmaAllocationRequestType type;</div>
-<div class="line"><a name="l05953"></a><span class="lineno"> 5953</span>&#160; </div>
-<div class="line"><a name="l05954"></a><span class="lineno"> 5954</span>&#160;    VkDeviceSize CalcCost()<span class="keyword"> const</span></div>
-<div class="line"><a name="l05955"></a><span class="lineno"> 5955</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l05956"></a><span class="lineno"> 5956</span>&#160;        <span class="keywordflow">return</span> sumItemSize + itemsToMakeLostCount * VMA_LOST_ALLOCATION_COST;</div>
-<div class="line"><a name="l05957"></a><span class="lineno"> 5957</span>&#160;    }</div>
-<div class="line"><a name="l05958"></a><span class="lineno"> 5958</span>&#160;};</div>
-<div class="line"><a name="l05959"></a><span class="lineno"> 5959</span>&#160; </div>
-<div class="line"><a name="l05960"></a><span class="lineno"> 5960</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l05961"></a><span class="lineno"> 5961</span>&#160;<span class="comment">Data structure used for bookkeeping of allocations and unused ranges of memory</span></div>
-<div class="line"><a name="l05962"></a><span class="lineno"> 5962</span>&#160;<span class="comment">in a single VkDeviceMemory block.</span></div>
-<div class="line"><a name="l05963"></a><span class="lineno"> 5963</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l05964"></a><span class="lineno"> 5964</span>&#160;<span class="keyword">class </span>VmaBlockMetadata</div>
-<div class="line"><a name="l05965"></a><span class="lineno"> 5965</span>&#160;{</div>
-<div class="line"><a name="l05966"></a><span class="lineno"> 5966</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l05967"></a><span class="lineno"> 5967</span>&#160;    VmaBlockMetadata(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
-<div class="line"><a name="l05968"></a><span class="lineno"> 5968</span>&#160;    <span class="keyword">virtual</span> ~VmaBlockMetadata() { }</div>
-<div class="line"><a name="l05969"></a><span class="lineno"> 5969</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size) { m_Size = size; }</div>
-<div class="line"><a name="l05970"></a><span class="lineno"> 5970</span>&#160; </div>
-<div class="line"><a name="l05971"></a><span class="lineno"> 5971</span>&#160;    <span class="comment">// Validates all data structures inside this object. If not valid, returns false.</span></div>
-<div class="line"><a name="l05972"></a><span class="lineno"> 5972</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span> = 0;</div>
-<div class="line"><a name="l05973"></a><span class="lineno"> 5973</span>&#160;    VkDeviceSize GetSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Size; }</div>
-<div class="line"><a name="l05974"></a><span class="lineno"> 5974</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount() <span class="keyword">const</span> = 0;</div>
-<div class="line"><a name="l05975"></a><span class="lineno"> 5975</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize() <span class="keyword">const</span> = 0;</div>
-<div class="line"><a name="l05976"></a><span class="lineno"> 5976</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span> = 0;</div>
-<div class="line"><a name="l05977"></a><span class="lineno"> 5977</span>&#160;    <span class="comment">// Returns true if this block is empty - contains only single free suballocation.</span></div>
-<div class="line"><a name="l05978"></a><span class="lineno"> 5978</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty() <span class="keyword">const</span> = 0;</div>
-<div class="line"><a name="l05979"></a><span class="lineno"> 5979</span>&#160; </div>
-<div class="line"><a name="l05980"></a><span class="lineno"> 5980</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span> = 0;</div>
-<div class="line"><a name="l05981"></a><span class="lineno"> 5981</span>&#160;    <span class="comment">// Shouldn&#39;t modify blockCount.</span></div>
-<div class="line"><a name="l05982"></a><span class="lineno"> 5982</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span> = 0;</div>
-<div class="line"><a name="l05983"></a><span class="lineno"> 5983</span>&#160; </div>
-<div class="line"><a name="l05984"></a><span class="lineno"> 5984</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l05985"></a><span class="lineno"> 5985</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span> = 0;</div>
-<div class="line"><a name="l05986"></a><span class="lineno"> 5986</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l05987"></a><span class="lineno"> 5987</span>&#160; </div>
-<div class="line"><a name="l05988"></a><span class="lineno"> 5988</span>&#160;    <span class="comment">// Tries to find a place for suballocation with given parameters inside this block.</span></div>
-<div class="line"><a name="l05989"></a><span class="lineno"> 5989</span>&#160;    <span class="comment">// If succeeded, fills pAllocationRequest and returns true.</span></div>
-<div class="line"><a name="l05990"></a><span class="lineno"> 5990</span>&#160;    <span class="comment">// If failed, returns false.</span></div>
-<div class="line"><a name="l05991"></a><span class="lineno"> 5991</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
-<div class="line"><a name="l05992"></a><span class="lineno"> 5992</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l05993"></a><span class="lineno"> 5993</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l05994"></a><span class="lineno"> 5994</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l05995"></a><span class="lineno"> 5995</span>&#160;        VkDeviceSize allocSize,</div>
-<div class="line"><a name="l05996"></a><span class="lineno"> 5996</span>&#160;        VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l05997"></a><span class="lineno"> 5997</span>&#160;        <span class="keywordtype">bool</span> upperAddress,</div>
-<div class="line"><a name="l05998"></a><span class="lineno"> 5998</span>&#160;        VmaSuballocationType allocType,</div>
-<div class="line"><a name="l05999"></a><span class="lineno"> 5999</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l06000"></a><span class="lineno"> 6000</span>&#160;        <span class="comment">// Always one of VMA_ALLOCATION_CREATE_STRATEGY_* or VMA_ALLOCATION_INTERNAL_STRATEGY_* flags.</span></div>
-<div class="line"><a name="l06001"></a><span class="lineno"> 6001</span>&#160;        uint32_t strategy,</div>
-<div class="line"><a name="l06002"></a><span class="lineno"> 6002</span>&#160;        VmaAllocationRequest* pAllocationRequest) = 0;</div>
-<div class="line"><a name="l06003"></a><span class="lineno"> 6003</span>&#160; </div>
-<div class="line"><a name="l06004"></a><span class="lineno"> 6004</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
-<div class="line"><a name="l06005"></a><span class="lineno"> 6005</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06006"></a><span class="lineno"> 6006</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l06007"></a><span class="lineno"> 6007</span>&#160;        VmaAllocationRequest* pAllocationRequest) = 0;</div>
-<div class="line"><a name="l06008"></a><span class="lineno"> 6008</span>&#160; </div>
-<div class="line"><a name="l06009"></a><span class="lineno"> 6009</span>&#160;    <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount) = 0;</div>
-<div class="line"><a name="l06010"></a><span class="lineno"> 6010</span>&#160; </div>
-<div class="line"><a name="l06011"></a><span class="lineno"> 6011</span>&#160;    <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData) = 0;</div>
-<div class="line"><a name="l06012"></a><span class="lineno"> 6012</span>&#160; </div>
-<div class="line"><a name="l06013"></a><span class="lineno"> 6013</span>&#160;    <span class="comment">// Makes actual allocation based on request. Request must already be checked and valid.</span></div>
-<div class="line"><a name="l06014"></a><span class="lineno"> 6014</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
-<div class="line"><a name="l06015"></a><span class="lineno"> 6015</span>&#160;        <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
-<div class="line"><a name="l06016"></a><span class="lineno"> 6016</span>&#160;        VmaSuballocationType type,</div>
-<div class="line"><a name="l06017"></a><span class="lineno"> 6017</span>&#160;        VkDeviceSize allocSize,</div>
-<div class="line"><a name="l06018"></a><span class="lineno"> 6018</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation) = 0;</div>
-<div class="line"><a name="l06019"></a><span class="lineno"> 6019</span>&#160; </div>
-<div class="line"><a name="l06020"></a><span class="lineno"> 6020</span>&#160;    <span class="comment">// Frees suballocation assigned to given memory region.</span></div>
-<div class="line"><a name="l06021"></a><span class="lineno"> 6021</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation) = 0;</div>
-<div class="line"><a name="l06022"></a><span class="lineno"> 6022</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset) = 0;</div>
-<div class="line"><a name="l06023"></a><span class="lineno"> 6023</span>&#160; </div>
-<div class="line"><a name="l06024"></a><span class="lineno"> 6024</span>&#160;<span class="keyword">protected</span>:</div>
-<div class="line"><a name="l06025"></a><span class="lineno"> 6025</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* GetAllocationCallbacks()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pAllocationCallbacks; }</div>
-<div class="line"><a name="l06026"></a><span class="lineno"> 6026</span>&#160; </div>
-<div class="line"><a name="l06027"></a><span class="lineno"> 6027</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l06028"></a><span class="lineno"> 6028</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap_Begin(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
-<div class="line"><a name="l06029"></a><span class="lineno"> 6029</span>&#160;        VkDeviceSize unusedBytes,</div>
-<div class="line"><a name="l06030"></a><span class="lineno"> 6030</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l06031"></a><span class="lineno"> 6031</span>&#160;        <span class="keywordtype">size_t</span> unusedRangeCount) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06032"></a><span class="lineno"> 6032</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap_Allocation(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
-<div class="line"><a name="l06033"></a><span class="lineno"> 6033</span>&#160;        VkDeviceSize offset,</div>
-<div class="line"><a name="l06034"></a><span class="lineno"> 6034</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06035"></a><span class="lineno"> 6035</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap_UnusedRange(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
-<div class="line"><a name="l06036"></a><span class="lineno"> 6036</span>&#160;        VkDeviceSize offset,</div>
-<div class="line"><a name="l06037"></a><span class="lineno"> 6037</span>&#160;        VkDeviceSize size) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06038"></a><span class="lineno"> 6038</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap_End(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06039"></a><span class="lineno"> 6039</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l06040"></a><span class="lineno"> 6040</span>&#160; </div>
-<div class="line"><a name="l06041"></a><span class="lineno"> 6041</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l06042"></a><span class="lineno"> 6042</span>&#160;    VkDeviceSize m_Size;</div>
-<div class="line"><a name="l06043"></a><span class="lineno"> 6043</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* m_pAllocationCallbacks;</div>
-<div class="line"><a name="l06044"></a><span class="lineno"> 6044</span>&#160;};</div>
-<div class="line"><a name="l06045"></a><span class="lineno"> 6045</span>&#160; </div>
-<div class="line"><a name="l06046"></a><span class="lineno"> 6046</span>&#160;<span class="preprocessor">#define VMA_VALIDATE(cond) do { if(!(cond)) { \</span></div>
-<div class="line"><a name="l06047"></a><span class="lineno"> 6047</span>&#160;<span class="preprocessor">        VMA_ASSERT(0 &amp;&amp; &quot;Validation failed: &quot; #cond); \</span></div>
-<div class="line"><a name="l06048"></a><span class="lineno"> 6048</span>&#160;<span class="preprocessor">        return false; \</span></div>
-<div class="line"><a name="l06049"></a><span class="lineno"> 6049</span>&#160;<span class="preprocessor">    } } while(false)</span></div>
-<div class="line"><a name="l06050"></a><span class="lineno"> 6050</span>&#160; </div>
-<div class="line"><a name="l06051"></a><span class="lineno"> 6051</span>&#160;<span class="keyword">class </span>VmaBlockMetadata_Generic : <span class="keyword">public</span> VmaBlockMetadata</div>
-<div class="line"><a name="l06052"></a><span class="lineno"> 6052</span>&#160;{</div>
-<div class="line"><a name="l06053"></a><span class="lineno"> 6053</span>&#160;    VMA_CLASS_NO_COPY(VmaBlockMetadata_Generic)</div>
-<div class="line"><a name="l06054"></a><span class="lineno"> 6054</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l06055"></a><span class="lineno"> 6055</span>&#160;    VmaBlockMetadata_Generic(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
-<div class="line"><a name="l06056"></a><span class="lineno"> 6056</span>&#160;    <span class="keyword">virtual</span> ~VmaBlockMetadata_Generic();</div>
-<div class="line"><a name="l06057"></a><span class="lineno"> 6057</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size);</div>
-<div class="line"><a name="l06058"></a><span class="lineno"> 6058</span>&#160; </div>
-<div class="line"><a name="l06059"></a><span class="lineno"> 6059</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06060"></a><span class="lineno"> 6060</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Suballocations.size() - m_FreeCount; }</div>
-<div class="line"><a name="l06061"></a><span class="lineno"> 6061</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_SumFreeSize; }</div>
-<div class="line"><a name="l06062"></a><span class="lineno"> 6062</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06063"></a><span class="lineno"> 6063</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06064"></a><span class="lineno"> 6064</span>&#160; </div>
-<div class="line"><a name="l06065"></a><span class="lineno"> 6065</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06066"></a><span class="lineno"> 6066</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06067"></a><span class="lineno"> 6067</span>&#160; </div>
-<div class="line"><a name="l06068"></a><span class="lineno"> 6068</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l06069"></a><span class="lineno"> 6069</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06070"></a><span class="lineno"> 6070</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l06071"></a><span class="lineno"> 6071</span>&#160; </div>
-<div class="line"><a name="l06072"></a><span class="lineno"> 6072</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
-<div class="line"><a name="l06073"></a><span class="lineno"> 6073</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06074"></a><span class="lineno"> 6074</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l06075"></a><span class="lineno"> 6075</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l06076"></a><span class="lineno"> 6076</span>&#160;        VkDeviceSize allocSize,</div>
-<div class="line"><a name="l06077"></a><span class="lineno"> 6077</span>&#160;        VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l06078"></a><span class="lineno"> 6078</span>&#160;        <span class="keywordtype">bool</span> upperAddress,</div>
-<div class="line"><a name="l06079"></a><span class="lineno"> 6079</span>&#160;        VmaSuballocationType allocType,</div>
-<div class="line"><a name="l06080"></a><span class="lineno"> 6080</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l06081"></a><span class="lineno"> 6081</span>&#160;        uint32_t strategy,</div>
-<div class="line"><a name="l06082"></a><span class="lineno"> 6082</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
+<div class="line"><a name="l05886"></a><span class="lineno"> 5886</span>&#160;<span class="keyword">struct </span>VmaAllocation_T</div>
+<div class="line"><a name="l05887"></a><span class="lineno"> 5887</span>&#160;{</div>
+<div class="line"><a name="l05888"></a><span class="lineno"> 5888</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l05889"></a><span class="lineno"> 5889</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> uint8_t MAP_COUNT_FLAG_PERSISTENT_MAP = 0x80;</div>
+<div class="line"><a name="l05890"></a><span class="lineno"> 5890</span>&#160; </div>
+<div class="line"><a name="l05891"></a><span class="lineno"> 5891</span>&#160;    <span class="keyword">enum</span> FLAGS</div>
+<div class="line"><a name="l05892"></a><span class="lineno"> 5892</span>&#160;    {</div>
+<div class="line"><a name="l05893"></a><span class="lineno"> 5893</span>&#160;        FLAG_USER_DATA_STRING = 0x01,</div>
+<div class="line"><a name="l05894"></a><span class="lineno"> 5894</span>&#160;    };</div>
+<div class="line"><a name="l05895"></a><span class="lineno"> 5895</span>&#160; </div>
+<div class="line"><a name="l05896"></a><span class="lineno"> 5896</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l05897"></a><span class="lineno"> 5897</span>&#160;    <span class="keyword">enum</span> ALLOCATION_TYPE</div>
+<div class="line"><a name="l05898"></a><span class="lineno"> 5898</span>&#160;    {</div>
+<div class="line"><a name="l05899"></a><span class="lineno"> 5899</span>&#160;        ALLOCATION_TYPE_NONE,</div>
+<div class="line"><a name="l05900"></a><span class="lineno"> 5900</span>&#160;        ALLOCATION_TYPE_BLOCK,</div>
+<div class="line"><a name="l05901"></a><span class="lineno"> 5901</span>&#160;        ALLOCATION_TYPE_DEDICATED,</div>
+<div class="line"><a name="l05902"></a><span class="lineno"> 5902</span>&#160;    };</div>
+<div class="line"><a name="l05903"></a><span class="lineno"> 5903</span>&#160; </div>
+<div class="line"><a name="l05904"></a><span class="lineno"> 5904</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l05905"></a><span class="lineno"> 5905</span>&#160;<span class="comment">    This struct is allocated using VmaPoolAllocator.</span></div>
+<div class="line"><a name="l05906"></a><span class="lineno"> 5906</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l05907"></a><span class="lineno"> 5907</span>&#160; </div>
+<div class="line"><a name="l05908"></a><span class="lineno"> 5908</span>&#160;    VmaAllocation_T(uint32_t currentFrameIndex, <span class="keywordtype">bool</span> userDataString) :</div>
+<div class="line"><a name="l05909"></a><span class="lineno"> 5909</span>&#160;        m_Alignment{1},</div>
+<div class="line"><a name="l05910"></a><span class="lineno"> 5910</span>&#160;        m_Size{0},</div>
+<div class="line"><a name="l05911"></a><span class="lineno"> 5911</span>&#160;        m_pUserData{VMA_NULL},</div>
+<div class="line"><a name="l05912"></a><span class="lineno"> 5912</span>&#160;        m_LastUseFrameIndex{currentFrameIndex},</div>
+<div class="line"><a name="l05913"></a><span class="lineno"> 5913</span>&#160;        m_MemoryTypeIndex{0},</div>
+<div class="line"><a name="l05914"></a><span class="lineno"> 5914</span>&#160;        m_Type{(uint8_t)ALLOCATION_TYPE_NONE},</div>
+<div class="line"><a name="l05915"></a><span class="lineno"> 5915</span>&#160;        m_SuballocationType{(uint8_t)VMA_SUBALLOCATION_TYPE_UNKNOWN},</div>
+<div class="line"><a name="l05916"></a><span class="lineno"> 5916</span>&#160;        m_MapCount{0},</div>
+<div class="line"><a name="l05917"></a><span class="lineno"> 5917</span>&#160;        m_Flags{userDataString ? (uint8_t)FLAG_USER_DATA_STRING : (uint8_t)0}</div>
+<div class="line"><a name="l05918"></a><span class="lineno"> 5918</span>&#160;    {</div>
+<div class="line"><a name="l05919"></a><span class="lineno"> 5919</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l05920"></a><span class="lineno"> 5920</span>&#160;        m_CreationFrameIndex = currentFrameIndex;</div>
+<div class="line"><a name="l05921"></a><span class="lineno"> 5921</span>&#160;        m_BufferImageUsage = 0;</div>
+<div class="line"><a name="l05922"></a><span class="lineno"> 5922</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l05923"></a><span class="lineno"> 5923</span>&#160;    }</div>
+<div class="line"><a name="l05924"></a><span class="lineno"> 5924</span>&#160; </div>
+<div class="line"><a name="l05925"></a><span class="lineno"> 5925</span>&#160;    ~VmaAllocation_T()</div>
+<div class="line"><a name="l05926"></a><span class="lineno"> 5926</span>&#160;    {</div>
+<div class="line"><a name="l05927"></a><span class="lineno"> 5927</span>&#160;        VMA_ASSERT((m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP) == 0 &amp;&amp; <span class="stringliteral">&quot;Allocation was not unmapped before destruction.&quot;</span>);</div>
+<div class="line"><a name="l05928"></a><span class="lineno"> 5928</span>&#160; </div>
+<div class="line"><a name="l05929"></a><span class="lineno"> 5929</span>&#160;        <span class="comment">// Check if owned string was freed.</span></div>
+<div class="line"><a name="l05930"></a><span class="lineno"> 5930</span>&#160;        VMA_ASSERT(m_pUserData == VMA_NULL);</div>
+<div class="line"><a name="l05931"></a><span class="lineno"> 5931</span>&#160;    }</div>
+<div class="line"><a name="l05932"></a><span class="lineno"> 5932</span>&#160; </div>
+<div class="line"><a name="l05933"></a><span class="lineno"> 5933</span>&#160;    <span class="keywordtype">void</span> InitBlockAllocation(</div>
+<div class="line"><a name="l05934"></a><span class="lineno"> 5934</span>&#160;        VmaDeviceMemoryBlock* block,</div>
+<div class="line"><a name="l05935"></a><span class="lineno"> 5935</span>&#160;        VkDeviceSize offset,</div>
+<div class="line"><a name="l05936"></a><span class="lineno"> 5936</span>&#160;        VkDeviceSize alignment,</div>
+<div class="line"><a name="l05937"></a><span class="lineno"> 5937</span>&#160;        VkDeviceSize size,</div>
+<div class="line"><a name="l05938"></a><span class="lineno"> 5938</span>&#160;        uint32_t memoryTypeIndex,</div>
+<div class="line"><a name="l05939"></a><span class="lineno"> 5939</span>&#160;        VmaSuballocationType suballocationType,</div>
+<div class="line"><a name="l05940"></a><span class="lineno"> 5940</span>&#160;        <span class="keywordtype">bool</span> mapped,</div>
+<div class="line"><a name="l05941"></a><span class="lineno"> 5941</span>&#160;        <span class="keywordtype">bool</span> canBecomeLost)</div>
+<div class="line"><a name="l05942"></a><span class="lineno"> 5942</span>&#160;    {</div>
+<div class="line"><a name="l05943"></a><span class="lineno"> 5943</span>&#160;        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);</div>
+<div class="line"><a name="l05944"></a><span class="lineno"> 5944</span>&#160;        VMA_ASSERT(block != VMA_NULL);</div>
+<div class="line"><a name="l05945"></a><span class="lineno"> 5945</span>&#160;        m_Type = (uint8_t)ALLOCATION_TYPE_BLOCK;</div>
+<div class="line"><a name="l05946"></a><span class="lineno"> 5946</span>&#160;        m_Alignment = alignment;</div>
+<div class="line"><a name="l05947"></a><span class="lineno"> 5947</span>&#160;        m_Size = size;</div>
+<div class="line"><a name="l05948"></a><span class="lineno"> 5948</span>&#160;        m_MemoryTypeIndex = memoryTypeIndex;</div>
+<div class="line"><a name="l05949"></a><span class="lineno"> 5949</span>&#160;        m_MapCount = mapped ? MAP_COUNT_FLAG_PERSISTENT_MAP : 0;</div>
+<div class="line"><a name="l05950"></a><span class="lineno"> 5950</span>&#160;        m_SuballocationType = (uint8_t)suballocationType;</div>
+<div class="line"><a name="l05951"></a><span class="lineno"> 5951</span>&#160;        m_BlockAllocation.m_Block = block;</div>
+<div class="line"><a name="l05952"></a><span class="lineno"> 5952</span>&#160;        m_BlockAllocation.m_Offset = offset;</div>
+<div class="line"><a name="l05953"></a><span class="lineno"> 5953</span>&#160;        m_BlockAllocation.m_CanBecomeLost = canBecomeLost;</div>
+<div class="line"><a name="l05954"></a><span class="lineno"> 5954</span>&#160;    }</div>
+<div class="line"><a name="l05955"></a><span class="lineno"> 5955</span>&#160; </div>
+<div class="line"><a name="l05956"></a><span class="lineno"> 5956</span>&#160;    <span class="keywordtype">void</span> InitLost()</div>
+<div class="line"><a name="l05957"></a><span class="lineno"> 5957</span>&#160;    {</div>
+<div class="line"><a name="l05958"></a><span class="lineno"> 5958</span>&#160;        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);</div>
+<div class="line"><a name="l05959"></a><span class="lineno"> 5959</span>&#160;        VMA_ASSERT(m_LastUseFrameIndex.load() == VMA_FRAME_INDEX_LOST);</div>
+<div class="line"><a name="l05960"></a><span class="lineno"> 5960</span>&#160;        m_Type = (uint8_t)ALLOCATION_TYPE_BLOCK;</div>
+<div class="line"><a name="l05961"></a><span class="lineno"> 5961</span>&#160;        m_MemoryTypeIndex = 0;</div>
+<div class="line"><a name="l05962"></a><span class="lineno"> 5962</span>&#160;        m_BlockAllocation.m_Block = VMA_NULL;</div>
+<div class="line"><a name="l05963"></a><span class="lineno"> 5963</span>&#160;        m_BlockAllocation.m_Offset = 0;</div>
+<div class="line"><a name="l05964"></a><span class="lineno"> 5964</span>&#160;        m_BlockAllocation.m_CanBecomeLost = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l05965"></a><span class="lineno"> 5965</span>&#160;    }</div>
+<div class="line"><a name="l05966"></a><span class="lineno"> 5966</span>&#160; </div>
+<div class="line"><a name="l05967"></a><span class="lineno"> 5967</span>&#160;    <span class="keywordtype">void</span> ChangeBlockAllocation(</div>
+<div class="line"><a name="l05968"></a><span class="lineno"> 5968</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l05969"></a><span class="lineno"> 5969</span>&#160;        VmaDeviceMemoryBlock* block,</div>
+<div class="line"><a name="l05970"></a><span class="lineno"> 5970</span>&#160;        VkDeviceSize offset); </div>
+<div class="line"><a name="l05971"></a><span class="lineno"> 5971</span>&#160; </div>
+<div class="line"><a name="l05972"></a><span class="lineno"> 5972</span>&#160;    <span class="keywordtype">void</span> ChangeOffset(VkDeviceSize newOffset);</div>
+<div class="line"><a name="l05973"></a><span class="lineno"> 5973</span>&#160; </div>
+<div class="line"><a name="l05974"></a><span class="lineno"> 5974</span>&#160;    <span class="comment">// pMappedData not null means allocation is created with MAPPED flag.</span></div>
+<div class="line"><a name="l05975"></a><span class="lineno"> 5975</span>&#160;    <span class="keywordtype">void</span> InitDedicatedAllocation(</div>
+<div class="line"><a name="l05976"></a><span class="lineno"> 5976</span>&#160;        uint32_t memoryTypeIndex,</div>
+<div class="line"><a name="l05977"></a><span class="lineno"> 5977</span>&#160;        VkDeviceMemory hMemory,</div>
+<div class="line"><a name="l05978"></a><span class="lineno"> 5978</span>&#160;        VmaSuballocationType suballocationType,</div>
+<div class="line"><a name="l05979"></a><span class="lineno"> 5979</span>&#160;        <span class="keywordtype">void</span>* pMappedData,</div>
+<div class="line"><a name="l05980"></a><span class="lineno"> 5980</span>&#160;        VkDeviceSize size)</div>
+<div class="line"><a name="l05981"></a><span class="lineno"> 5981</span>&#160;    {</div>
+<div class="line"><a name="l05982"></a><span class="lineno"> 5982</span>&#160;        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);</div>
+<div class="line"><a name="l05983"></a><span class="lineno"> 5983</span>&#160;        VMA_ASSERT(hMemory != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l05984"></a><span class="lineno"> 5984</span>&#160;        m_Type = (uint8_t)ALLOCATION_TYPE_DEDICATED;</div>
+<div class="line"><a name="l05985"></a><span class="lineno"> 5985</span>&#160;        m_Alignment = 0;</div>
+<div class="line"><a name="l05986"></a><span class="lineno"> 5986</span>&#160;        m_Size = size;</div>
+<div class="line"><a name="l05987"></a><span class="lineno"> 5987</span>&#160;        m_MemoryTypeIndex = memoryTypeIndex;</div>
+<div class="line"><a name="l05988"></a><span class="lineno"> 5988</span>&#160;        m_SuballocationType = (uint8_t)suballocationType;</div>
+<div class="line"><a name="l05989"></a><span class="lineno"> 5989</span>&#160;        m_MapCount = (pMappedData != VMA_NULL) ? MAP_COUNT_FLAG_PERSISTENT_MAP : 0;</div>
+<div class="line"><a name="l05990"></a><span class="lineno"> 5990</span>&#160;        m_DedicatedAllocation.m_hMemory = hMemory;</div>
+<div class="line"><a name="l05991"></a><span class="lineno"> 5991</span>&#160;        m_DedicatedAllocation.m_pMappedData = pMappedData;</div>
+<div class="line"><a name="l05992"></a><span class="lineno"> 5992</span>&#160;    }</div>
+<div class="line"><a name="l05993"></a><span class="lineno"> 5993</span>&#160; </div>
+<div class="line"><a name="l05994"></a><span class="lineno"> 5994</span>&#160;    ALLOCATION_TYPE GetType()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (ALLOCATION_TYPE)m_Type; }</div>
+<div class="line"><a name="l05995"></a><span class="lineno"> 5995</span>&#160;    VkDeviceSize GetAlignment()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Alignment; }</div>
+<div class="line"><a name="l05996"></a><span class="lineno"> 5996</span>&#160;    VkDeviceSize GetSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Size; }</div>
+<div class="line"><a name="l05997"></a><span class="lineno"> 5997</span>&#160;    <span class="keywordtype">bool</span> IsUserDataString()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (m_Flags &amp; FLAG_USER_DATA_STRING) != 0; }</div>
+<div class="line"><a name="l05998"></a><span class="lineno"> 5998</span>&#160;    <span class="keywordtype">void</span>* GetUserData()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pUserData; }</div>
+<div class="line"><a name="l05999"></a><span class="lineno"> 5999</span>&#160;    <span class="keywordtype">void</span> SetUserData(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>* pUserData);</div>
+<div class="line"><a name="l06000"></a><span class="lineno"> 6000</span>&#160;    VmaSuballocationType GetSuballocationType()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (VmaSuballocationType)m_SuballocationType; }</div>
+<div class="line"><a name="l06001"></a><span class="lineno"> 6001</span>&#160; </div>
+<div class="line"><a name="l06002"></a><span class="lineno"> 6002</span>&#160;    VmaDeviceMemoryBlock* GetBlock()<span class="keyword"> const</span></div>
+<div class="line"><a name="l06003"></a><span class="lineno"> 6003</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l06004"></a><span class="lineno"> 6004</span>&#160;        VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);</div>
+<div class="line"><a name="l06005"></a><span class="lineno"> 6005</span>&#160;        <span class="keywordflow">return</span> m_BlockAllocation.m_Block;</div>
+<div class="line"><a name="l06006"></a><span class="lineno"> 6006</span>&#160;    }</div>
+<div class="line"><a name="l06007"></a><span class="lineno"> 6007</span>&#160;    VkDeviceSize GetOffset() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06008"></a><span class="lineno"> 6008</span>&#160;    VkDeviceMemory GetMemory() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06009"></a><span class="lineno"> 6009</span>&#160;    uint32_t GetMemoryTypeIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemoryTypeIndex; }</div>
+<div class="line"><a name="l06010"></a><span class="lineno"> 6010</span>&#160;    <span class="keywordtype">bool</span> IsPersistentMap()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (m_MapCount &amp; MAP_COUNT_FLAG_PERSISTENT_MAP) != 0; }</div>
+<div class="line"><a name="l06011"></a><span class="lineno"> 6011</span>&#160;    <span class="keywordtype">void</span>* GetMappedData() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06012"></a><span class="lineno"> 6012</span>&#160;    <span class="keywordtype">bool</span> CanBecomeLost() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06013"></a><span class="lineno"> 6013</span>&#160;    </div>
+<div class="line"><a name="l06014"></a><span class="lineno"> 6014</span>&#160;    uint32_t GetLastUseFrameIndex()<span class="keyword"> const</span></div>
+<div class="line"><a name="l06015"></a><span class="lineno"> 6015</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l06016"></a><span class="lineno"> 6016</span>&#160;        <span class="keywordflow">return</span> m_LastUseFrameIndex.load();</div>
+<div class="line"><a name="l06017"></a><span class="lineno"> 6017</span>&#160;    }</div>
+<div class="line"><a name="l06018"></a><span class="lineno"> 6018</span>&#160;    <span class="keywordtype">bool</span> CompareExchangeLastUseFrameIndex(uint32_t&amp; expected, uint32_t desired)</div>
+<div class="line"><a name="l06019"></a><span class="lineno"> 6019</span>&#160;    {</div>
+<div class="line"><a name="l06020"></a><span class="lineno"> 6020</span>&#160;        <span class="keywordflow">return</span> m_LastUseFrameIndex.compare_exchange_weak(expected, desired);</div>
+<div class="line"><a name="l06021"></a><span class="lineno"> 6021</span>&#160;    }</div>
+<div class="line"><a name="l06022"></a><span class="lineno"> 6022</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l06023"></a><span class="lineno"> 6023</span>&#160;<span class="comment">    - If hAllocation.LastUseFrameIndex + frameInUseCount &lt; allocator.CurrentFrameIndex,</span></div>
+<div class="line"><a name="l06024"></a><span class="lineno"> 6024</span>&#160;<span class="comment">      makes it lost by setting LastUseFrameIndex = VMA_FRAME_INDEX_LOST and returns true.</span></div>
+<div class="line"><a name="l06025"></a><span class="lineno"> 6025</span>&#160;<span class="comment">    - Else, returns false.</span></div>
+<div class="line"><a name="l06026"></a><span class="lineno"> 6026</span>&#160;<span class="comment">    </span></div>
+<div class="line"><a name="l06027"></a><span class="lineno"> 6027</span>&#160;<span class="comment">    If hAllocation is already lost, assert - you should not call it then.</span></div>
+<div class="line"><a name="l06028"></a><span class="lineno"> 6028</span>&#160;<span class="comment">    If hAllocation was not created with CAN_BECOME_LOST_BIT, assert.</span></div>
+<div class="line"><a name="l06029"></a><span class="lineno"> 6029</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l06030"></a><span class="lineno"> 6030</span>&#160;    <span class="keywordtype">bool</span> MakeLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
+<div class="line"><a name="l06031"></a><span class="lineno"> 6031</span>&#160; </div>
+<div class="line"><a name="l06032"></a><span class="lineno"> 6032</span>&#160;    <span class="keywordtype">void</span> DedicatedAllocCalcStatsInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo)</div>
+<div class="line"><a name="l06033"></a><span class="lineno"> 6033</span>&#160;    {</div>
+<div class="line"><a name="l06034"></a><span class="lineno"> 6034</span>&#160;        VMA_ASSERT(m_Type == ALLOCATION_TYPE_DEDICATED);</div>
+<div class="line"><a name="l06035"></a><span class="lineno"> 6035</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> = 1;</div>
+<div class="line"><a name="l06036"></a><span class="lineno"> 6036</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> = 1;</div>
+<div class="line"><a name="l06037"></a><span class="lineno"> 6037</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> = 0;</div>
+<div class="line"><a name="l06038"></a><span class="lineno"> 6038</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> = m_Size;</div>
+<div class="line"><a name="l06039"></a><span class="lineno"> 6039</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> = 0;</div>
+<div class="line"><a name="l06040"></a><span class="lineno"> 6040</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = m_Size;</div>
+<div class="line"><a name="l06041"></a><span class="lineno"> 6041</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = UINT64_MAX;</div>
+<div class="line"><a name="l06042"></a><span class="lineno"> 6042</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = 0;</div>
+<div class="line"><a name="l06043"></a><span class="lineno"> 6043</span>&#160;    }</div>
+<div class="line"><a name="l06044"></a><span class="lineno"> 6044</span>&#160; </div>
+<div class="line"><a name="l06045"></a><span class="lineno"> 6045</span>&#160;    <span class="keywordtype">void</span> BlockAllocMap();</div>
+<div class="line"><a name="l06046"></a><span class="lineno"> 6046</span>&#160;    <span class="keywordtype">void</span> BlockAllocUnmap();</div>
+<div class="line"><a name="l06047"></a><span class="lineno"> 6047</span>&#160;    VkResult DedicatedAllocMap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>** ppData);</div>
+<div class="line"><a name="l06048"></a><span class="lineno"> 6048</span>&#160;    <span class="keywordtype">void</span> DedicatedAllocUnmap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
+<div class="line"><a name="l06049"></a><span class="lineno"> 6049</span>&#160; </div>
+<div class="line"><a name="l06050"></a><span class="lineno"> 6050</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l06051"></a><span class="lineno"> 6051</span>&#160;    uint32_t GetCreationFrameIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_CreationFrameIndex; }</div>
+<div class="line"><a name="l06052"></a><span class="lineno"> 6052</span>&#160;    uint32_t GetBufferImageUsage()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BufferImageUsage; }</div>
+<div class="line"><a name="l06053"></a><span class="lineno"> 6053</span>&#160; </div>
+<div class="line"><a name="l06054"></a><span class="lineno"> 6054</span>&#160;    <span class="keywordtype">void</span> InitBufferImageUsage(uint32_t bufferImageUsage)</div>
+<div class="line"><a name="l06055"></a><span class="lineno"> 6055</span>&#160;    {</div>
+<div class="line"><a name="l06056"></a><span class="lineno"> 6056</span>&#160;        VMA_ASSERT(m_BufferImageUsage == 0);</div>
+<div class="line"><a name="l06057"></a><span class="lineno"> 6057</span>&#160;        m_BufferImageUsage = bufferImageUsage;</div>
+<div class="line"><a name="l06058"></a><span class="lineno"> 6058</span>&#160;    }</div>
+<div class="line"><a name="l06059"></a><span class="lineno"> 6059</span>&#160; </div>
+<div class="line"><a name="l06060"></a><span class="lineno"> 6060</span>&#160;    <span class="keywordtype">void</span> PrintParameters(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06061"></a><span class="lineno"> 6061</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l06062"></a><span class="lineno"> 6062</span>&#160; </div>
+<div class="line"><a name="l06063"></a><span class="lineno"> 6063</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l06064"></a><span class="lineno"> 6064</span>&#160;    VkDeviceSize m_Alignment;</div>
+<div class="line"><a name="l06065"></a><span class="lineno"> 6065</span>&#160;    VkDeviceSize m_Size;</div>
+<div class="line"><a name="l06066"></a><span class="lineno"> 6066</span>&#160;    <span class="keywordtype">void</span>* m_pUserData;</div>
+<div class="line"><a name="l06067"></a><span class="lineno"> 6067</span>&#160;    VMA_ATOMIC_UINT32 m_LastUseFrameIndex;</div>
+<div class="line"><a name="l06068"></a><span class="lineno"> 6068</span>&#160;    uint32_t m_MemoryTypeIndex;</div>
+<div class="line"><a name="l06069"></a><span class="lineno"> 6069</span>&#160;    uint8_t m_Type; <span class="comment">// ALLOCATION_TYPE</span></div>
+<div class="line"><a name="l06070"></a><span class="lineno"> 6070</span>&#160;    uint8_t m_SuballocationType; <span class="comment">// VmaSuballocationType</span></div>
+<div class="line"><a name="l06071"></a><span class="lineno"> 6071</span>&#160;    <span class="comment">// Bit 0x80 is set when allocation was created with VMA_ALLOCATION_CREATE_MAPPED_BIT.</span></div>
+<div class="line"><a name="l06072"></a><span class="lineno"> 6072</span>&#160;    <span class="comment">// Bits with mask 0x7F are reference counter for vmaMapMemory()/vmaUnmapMemory().</span></div>
+<div class="line"><a name="l06073"></a><span class="lineno"> 6073</span>&#160;    uint8_t m_MapCount;</div>
+<div class="line"><a name="l06074"></a><span class="lineno"> 6074</span>&#160;    uint8_t m_Flags; <span class="comment">// enum FLAGS</span></div>
+<div class="line"><a name="l06075"></a><span class="lineno"> 6075</span>&#160; </div>
+<div class="line"><a name="l06076"></a><span class="lineno"> 6076</span>&#160;    <span class="comment">// Allocation out of VmaDeviceMemoryBlock.</span></div>
+<div class="line"><a name="l06077"></a><span class="lineno"> 6077</span>&#160;    <span class="keyword">struct </span>BlockAllocation</div>
+<div class="line"><a name="l06078"></a><span class="lineno"> 6078</span>&#160;    {</div>
+<div class="line"><a name="l06079"></a><span class="lineno"> 6079</span>&#160;        VmaDeviceMemoryBlock* m_Block;</div>
+<div class="line"><a name="l06080"></a><span class="lineno"> 6080</span>&#160;        VkDeviceSize m_Offset;</div>
+<div class="line"><a name="l06081"></a><span class="lineno"> 6081</span>&#160;        <span class="keywordtype">bool</span> m_CanBecomeLost;</div>
+<div class="line"><a name="l06082"></a><span class="lineno"> 6082</span>&#160;    };</div>
 <div class="line"><a name="l06083"></a><span class="lineno"> 6083</span>&#160; </div>
-<div class="line"><a name="l06084"></a><span class="lineno"> 6084</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
-<div class="line"><a name="l06085"></a><span class="lineno"> 6085</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06086"></a><span class="lineno"> 6086</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l06087"></a><span class="lineno"> 6087</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
-<div class="line"><a name="l06088"></a><span class="lineno"> 6088</span>&#160; </div>
-<div class="line"><a name="l06089"></a><span class="lineno"> 6089</span>&#160;    <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
+<div class="line"><a name="l06084"></a><span class="lineno"> 6084</span>&#160;    <span class="comment">// Allocation for an object that has its own private VkDeviceMemory.</span></div>
+<div class="line"><a name="l06085"></a><span class="lineno"> 6085</span>&#160;    <span class="keyword">struct </span>DedicatedAllocation</div>
+<div class="line"><a name="l06086"></a><span class="lineno"> 6086</span>&#160;    {</div>
+<div class="line"><a name="l06087"></a><span class="lineno"> 6087</span>&#160;        VkDeviceMemory m_hMemory;</div>
+<div class="line"><a name="l06088"></a><span class="lineno"> 6088</span>&#160;        <span class="keywordtype">void</span>* m_pMappedData; <span class="comment">// Not null means memory is mapped.</span></div>
+<div class="line"><a name="l06089"></a><span class="lineno"> 6089</span>&#160;    };</div>
 <div class="line"><a name="l06090"></a><span class="lineno"> 6090</span>&#160; </div>
-<div class="line"><a name="l06091"></a><span class="lineno"> 6091</span>&#160;    <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData);</div>
-<div class="line"><a name="l06092"></a><span class="lineno"> 6092</span>&#160; </div>
-<div class="line"><a name="l06093"></a><span class="lineno"> 6093</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
-<div class="line"><a name="l06094"></a><span class="lineno"> 6094</span>&#160;        <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
-<div class="line"><a name="l06095"></a><span class="lineno"> 6095</span>&#160;        VmaSuballocationType type,</div>
-<div class="line"><a name="l06096"></a><span class="lineno"> 6096</span>&#160;        VkDeviceSize allocSize,</div>
-<div class="line"><a name="l06097"></a><span class="lineno"> 6097</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
+<div class="line"><a name="l06091"></a><span class="lineno"> 6091</span>&#160;    <span class="keyword">union</span></div>
+<div class="line"><a name="l06092"></a><span class="lineno"> 6092</span>&#160;    {</div>
+<div class="line"><a name="l06093"></a><span class="lineno"> 6093</span>&#160;        <span class="comment">// Allocation out of VmaDeviceMemoryBlock.</span></div>
+<div class="line"><a name="l06094"></a><span class="lineno"> 6094</span>&#160;        BlockAllocation m_BlockAllocation;</div>
+<div class="line"><a name="l06095"></a><span class="lineno"> 6095</span>&#160;        <span class="comment">// Allocation for an object that has its own private VkDeviceMemory.</span></div>
+<div class="line"><a name="l06096"></a><span class="lineno"> 6096</span>&#160;        DedicatedAllocation m_DedicatedAllocation;</div>
+<div class="line"><a name="l06097"></a><span class="lineno"> 6097</span>&#160;    };</div>
 <div class="line"><a name="l06098"></a><span class="lineno"> 6098</span>&#160; </div>
-<div class="line"><a name="l06099"></a><span class="lineno"> 6099</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l06100"></a><span class="lineno"> 6100</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset);</div>
-<div class="line"><a name="l06101"></a><span class="lineno"> 6101</span>&#160; </div>
-<div class="line"><a name="l06103"></a><span class="lineno"> 6103</span>&#160;    <span class="comment">// For defragmentation</span></div>
-<div class="line"><a name="l06104"></a><span class="lineno"> 6104</span>&#160;    </div>
-<div class="line"><a name="l06105"></a><span class="lineno"> 6105</span>&#160;    <span class="keywordtype">bool</span> IsBufferImageGranularityConflictPossible(</div>
-<div class="line"><a name="l06106"></a><span class="lineno"> 6106</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l06107"></a><span class="lineno"> 6107</span>&#160;        VmaSuballocationType&amp; inOutPrevSuballocType) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06108"></a><span class="lineno"> 6108</span>&#160; </div>
-<div class="line"><a name="l06109"></a><span class="lineno"> 6109</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l06110"></a><span class="lineno"> 6110</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span>VmaDefragmentationAlgorithm_Generic;</div>
-<div class="line"><a name="l06111"></a><span class="lineno"> 6111</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span>VmaDefragmentationAlgorithm_Fast;</div>
-<div class="line"><a name="l06112"></a><span class="lineno"> 6112</span>&#160; </div>
-<div class="line"><a name="l06113"></a><span class="lineno"> 6113</span>&#160;    uint32_t m_FreeCount;</div>
-<div class="line"><a name="l06114"></a><span class="lineno"> 6114</span>&#160;    VkDeviceSize m_SumFreeSize;</div>
-<div class="line"><a name="l06115"></a><span class="lineno"> 6115</span>&#160;    VmaSuballocationList m_Suballocations;</div>
-<div class="line"><a name="l06116"></a><span class="lineno"> 6116</span>&#160;    <span class="comment">// Suballocations that are free and have size greater than certain threshold.</span></div>
-<div class="line"><a name="l06117"></a><span class="lineno"> 6117</span>&#160;    <span class="comment">// Sorted by size, ascending.</span></div>
-<div class="line"><a name="l06118"></a><span class="lineno"> 6118</span>&#160;    VmaVector&lt; VmaSuballocationList::iterator, VmaStlAllocator&lt; VmaSuballocationList::iterator &gt; &gt; m_FreeSuballocationsBySize;</div>
-<div class="line"><a name="l06119"></a><span class="lineno"> 6119</span>&#160; </div>
-<div class="line"><a name="l06120"></a><span class="lineno"> 6120</span>&#160;    <span class="keywordtype">bool</span> ValidateFreeSuballocationList() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06121"></a><span class="lineno"> 6121</span>&#160; </div>
-<div class="line"><a name="l06122"></a><span class="lineno"> 6122</span>&#160;    <span class="comment">// Checks if requested suballocation with given parameters can be placed in given pFreeSuballocItem.</span></div>
-<div class="line"><a name="l06123"></a><span class="lineno"> 6123</span>&#160;    <span class="comment">// If yes, fills pOffset and returns true. If no, returns false.</span></div>
-<div class="line"><a name="l06124"></a><span class="lineno"> 6124</span>&#160;    <span class="keywordtype">bool</span> CheckAllocation(</div>
-<div class="line"><a name="l06125"></a><span class="lineno"> 6125</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06126"></a><span class="lineno"> 6126</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l06127"></a><span class="lineno"> 6127</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l06128"></a><span class="lineno"> 6128</span>&#160;        VkDeviceSize allocSize,</div>
-<div class="line"><a name="l06129"></a><span class="lineno"> 6129</span>&#160;        VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l06130"></a><span class="lineno"> 6130</span>&#160;        VmaSuballocationType allocType,</div>
-<div class="line"><a name="l06131"></a><span class="lineno"> 6131</span>&#160;        VmaSuballocationList::const_iterator suballocItem,</div>
-<div class="line"><a name="l06132"></a><span class="lineno"> 6132</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l06133"></a><span class="lineno"> 6133</span>&#160;        VkDeviceSize* pOffset,</div>
-<div class="line"><a name="l06134"></a><span class="lineno"> 6134</span>&#160;        <span class="keywordtype">size_t</span>* itemsToMakeLostCount,</div>
-<div class="line"><a name="l06135"></a><span class="lineno"> 6135</span>&#160;        VkDeviceSize* pSumFreeSize,</div>
-<div class="line"><a name="l06136"></a><span class="lineno"> 6136</span>&#160;        VkDeviceSize* pSumItemSize) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06137"></a><span class="lineno"> 6137</span>&#160;    <span class="comment">// Given free suballocation, it merges it with following one, which must also be free.</span></div>
-<div class="line"><a name="l06138"></a><span class="lineno"> 6138</span>&#160;    <span class="keywordtype">void</span> MergeFreeWithNext(VmaSuballocationList::iterator item);</div>
-<div class="line"><a name="l06139"></a><span class="lineno"> 6139</span>&#160;    <span class="comment">// Releases given suballocation, making it free.</span></div>
-<div class="line"><a name="l06140"></a><span class="lineno"> 6140</span>&#160;    <span class="comment">// Merges it with adjacent free suballocations if applicable.</span></div>
-<div class="line"><a name="l06141"></a><span class="lineno"> 6141</span>&#160;    <span class="comment">// Returns iterator to new free suballocation at this place.</span></div>
-<div class="line"><a name="l06142"></a><span class="lineno"> 6142</span>&#160;    VmaSuballocationList::iterator FreeSuballocation(VmaSuballocationList::iterator suballocItem);</div>
-<div class="line"><a name="l06143"></a><span class="lineno"> 6143</span>&#160;    <span class="comment">// Given free suballocation, it inserts it into sorted list of</span></div>
-<div class="line"><a name="l06144"></a><span class="lineno"> 6144</span>&#160;    <span class="comment">// m_FreeSuballocationsBySize if it&#39;s suitable.</span></div>
-<div class="line"><a name="l06145"></a><span class="lineno"> 6145</span>&#160;    <span class="keywordtype">void</span> RegisterFreeSuballocation(VmaSuballocationList::iterator item);</div>
-<div class="line"><a name="l06146"></a><span class="lineno"> 6146</span>&#160;    <span class="comment">// Given free suballocation, it removes it from sorted list of</span></div>
-<div class="line"><a name="l06147"></a><span class="lineno"> 6147</span>&#160;    <span class="comment">// m_FreeSuballocationsBySize if it&#39;s suitable.</span></div>
-<div class="line"><a name="l06148"></a><span class="lineno"> 6148</span>&#160;    <span class="keywordtype">void</span> UnregisterFreeSuballocation(VmaSuballocationList::iterator item);</div>
-<div class="line"><a name="l06149"></a><span class="lineno"> 6149</span>&#160;};</div>
-<div class="line"><a name="l06150"></a><span class="lineno"> 6150</span>&#160; </div>
-<div class="line"><a name="l06151"></a><span class="lineno"> 6151</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l06152"></a><span class="lineno"> 6152</span>&#160;<span class="comment">Allocations and their references in internal data structure look like this:</span></div>
-<div class="line"><a name="l06153"></a><span class="lineno"> 6153</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l06154"></a><span class="lineno"> 6154</span>&#160;<span class="comment">if(m_2ndVectorMode == SECOND_VECTOR_EMPTY):</span></div>
+<div class="line"><a name="l06099"></a><span class="lineno"> 6099</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l06100"></a><span class="lineno"> 6100</span>&#160;    uint32_t m_CreationFrameIndex;</div>
+<div class="line"><a name="l06101"></a><span class="lineno"> 6101</span>&#160;    uint32_t m_BufferImageUsage; <span class="comment">// 0 if unknown.</span></div>
+<div class="line"><a name="l06102"></a><span class="lineno"> 6102</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l06103"></a><span class="lineno"> 6103</span>&#160; </div>
+<div class="line"><a name="l06104"></a><span class="lineno"> 6104</span>&#160;    <span class="keywordtype">void</span> FreeUserDataString(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
+<div class="line"><a name="l06105"></a><span class="lineno"> 6105</span>&#160;};</div>
+<div class="line"><a name="l06106"></a><span class="lineno"> 6106</span>&#160; </div>
+<div class="line"><a name="l06107"></a><span class="lineno"> 6107</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l06108"></a><span class="lineno"> 6108</span>&#160;<span class="comment">Represents a region of VmaDeviceMemoryBlock that is either assigned and returned as</span></div>
+<div class="line"><a name="l06109"></a><span class="lineno"> 6109</span>&#160;<span class="comment">allocated memory block or free.</span></div>
+<div class="line"><a name="l06110"></a><span class="lineno"> 6110</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l06111"></a><span class="lineno"> 6111</span>&#160;<span class="keyword">struct </span>VmaSuballocation</div>
+<div class="line"><a name="l06112"></a><span class="lineno"> 6112</span>&#160;{</div>
+<div class="line"><a name="l06113"></a><span class="lineno"> 6113</span>&#160;    VkDeviceSize offset;</div>
+<div class="line"><a name="l06114"></a><span class="lineno"> 6114</span>&#160;    VkDeviceSize size;</div>
+<div class="line"><a name="l06115"></a><span class="lineno"> 6115</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation;</div>
+<div class="line"><a name="l06116"></a><span class="lineno"> 6116</span>&#160;    VmaSuballocationType type;</div>
+<div class="line"><a name="l06117"></a><span class="lineno"> 6117</span>&#160;};</div>
+<div class="line"><a name="l06118"></a><span class="lineno"> 6118</span>&#160; </div>
+<div class="line"><a name="l06119"></a><span class="lineno"> 6119</span>&#160;<span class="comment">// Comparator for offsets.</span></div>
+<div class="line"><a name="l06120"></a><span class="lineno"> 6120</span>&#160;<span class="keyword">struct </span>VmaSuballocationOffsetLess</div>
+<div class="line"><a name="l06121"></a><span class="lineno"> 6121</span>&#160;{</div>
+<div class="line"><a name="l06122"></a><span class="lineno"> 6122</span>&#160;    <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaSuballocation&amp; lhs, <span class="keyword">const</span> VmaSuballocation&amp; rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l06123"></a><span class="lineno"> 6123</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l06124"></a><span class="lineno"> 6124</span>&#160;        <span class="keywordflow">return</span> lhs.offset &lt; rhs.offset;</div>
+<div class="line"><a name="l06125"></a><span class="lineno"> 6125</span>&#160;    }</div>
+<div class="line"><a name="l06126"></a><span class="lineno"> 6126</span>&#160;};</div>
+<div class="line"><a name="l06127"></a><span class="lineno"> 6127</span>&#160;<span class="keyword">struct </span>VmaSuballocationOffsetGreater</div>
+<div class="line"><a name="l06128"></a><span class="lineno"> 6128</span>&#160;{</div>
+<div class="line"><a name="l06129"></a><span class="lineno"> 6129</span>&#160;    <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaSuballocation&amp; lhs, <span class="keyword">const</span> VmaSuballocation&amp; rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l06130"></a><span class="lineno"> 6130</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l06131"></a><span class="lineno"> 6131</span>&#160;        <span class="keywordflow">return</span> lhs.offset &gt; rhs.offset;</div>
+<div class="line"><a name="l06132"></a><span class="lineno"> 6132</span>&#160;    }</div>
+<div class="line"><a name="l06133"></a><span class="lineno"> 6133</span>&#160;};</div>
+<div class="line"><a name="l06134"></a><span class="lineno"> 6134</span>&#160; </div>
+<div class="line"><a name="l06135"></a><span class="lineno"> 6135</span>&#160;<span class="keyword">typedef</span> VmaList&lt; VmaSuballocation, VmaStlAllocator&lt;VmaSuballocation&gt; &gt; VmaSuballocationList;</div>
+<div class="line"><a name="l06136"></a><span class="lineno"> 6136</span>&#160; </div>
+<div class="line"><a name="l06137"></a><span class="lineno"> 6137</span>&#160;<span class="comment">// Cost of one additional allocation lost, as equivalent in bytes.</span></div>
+<div class="line"><a name="l06138"></a><span class="lineno"> 6138</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> VkDeviceSize VMA_LOST_ALLOCATION_COST = 1048576;</div>
+<div class="line"><a name="l06139"></a><span class="lineno"> 6139</span>&#160; </div>
+<div class="line"><a name="l06140"></a><span class="lineno"> 6140</span>&#160;<span class="keyword">enum class</span> VmaAllocationRequestType</div>
+<div class="line"><a name="l06141"></a><span class="lineno"> 6141</span>&#160;{</div>
+<div class="line"><a name="l06142"></a><span class="lineno"> 6142</span>&#160;    Normal,</div>
+<div class="line"><a name="l06143"></a><span class="lineno"> 6143</span>&#160;    <span class="comment">// Used by &quot;Linear&quot; algorithm.</span></div>
+<div class="line"><a name="l06144"></a><span class="lineno"> 6144</span>&#160;    UpperAddress,</div>
+<div class="line"><a name="l06145"></a><span class="lineno"> 6145</span>&#160;    EndOf1st,</div>
+<div class="line"><a name="l06146"></a><span class="lineno"> 6146</span>&#160;    EndOf2nd,</div>
+<div class="line"><a name="l06147"></a><span class="lineno"> 6147</span>&#160;};</div>
+<div class="line"><a name="l06148"></a><span class="lineno"> 6148</span>&#160; </div>
+<div class="line"><a name="l06149"></a><span class="lineno"> 6149</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l06150"></a><span class="lineno"> 6150</span>&#160;<span class="comment">Parameters of planned allocation inside a VmaDeviceMemoryBlock.</span></div>
+<div class="line"><a name="l06151"></a><span class="lineno"> 6151</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l06152"></a><span class="lineno"> 6152</span>&#160;<span class="comment">If canMakeOtherLost was false:</span></div>
+<div class="line"><a name="l06153"></a><span class="lineno"> 6153</span>&#160;<span class="comment">- item points to a FREE suballocation.</span></div>
+<div class="line"><a name="l06154"></a><span class="lineno"> 6154</span>&#160;<span class="comment">- itemsToMakeLostCount is 0.</span></div>
 <div class="line"><a name="l06155"></a><span class="lineno"> 6155</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l06156"></a><span class="lineno"> 6156</span>&#160;<span class="comment">        0 +-------+</span></div>
-<div class="line"><a name="l06157"></a><span class="lineno"> 6157</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06158"></a><span class="lineno"> 6158</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06159"></a><span class="lineno"> 6159</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06160"></a><span class="lineno"> 6160</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06161"></a><span class="lineno"> 6161</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount]</span></div>
-<div class="line"><a name="l06162"></a><span class="lineno"> 6162</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06163"></a><span class="lineno"> 6163</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount + 1]</span></div>
-<div class="line"><a name="l06164"></a><span class="lineno"> 6164</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06165"></a><span class="lineno"> 6165</span>&#160;<span class="comment">          |  ...  |</span></div>
-<div class="line"><a name="l06166"></a><span class="lineno"> 6166</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06167"></a><span class="lineno"> 6167</span>&#160;<span class="comment">          | Alloc |  1st[1st.size() - 1]</span></div>
-<div class="line"><a name="l06168"></a><span class="lineno"> 6168</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06169"></a><span class="lineno"> 6169</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06170"></a><span class="lineno"> 6170</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06171"></a><span class="lineno"> 6171</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06172"></a><span class="lineno"> 6172</span>&#160;<span class="comment">GetSize() +-------+</span></div>
-<div class="line"><a name="l06173"></a><span class="lineno"> 6173</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l06174"></a><span class="lineno"> 6174</span>&#160;<span class="comment">if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER):</span></div>
-<div class="line"><a name="l06175"></a><span class="lineno"> 6175</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l06176"></a><span class="lineno"> 6176</span>&#160;<span class="comment">        0 +-------+</span></div>
-<div class="line"><a name="l06177"></a><span class="lineno"> 6177</span>&#160;<span class="comment">          | Alloc |  2nd[0]</span></div>
-<div class="line"><a name="l06178"></a><span class="lineno"> 6178</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06179"></a><span class="lineno"> 6179</span>&#160;<span class="comment">          | Alloc |  2nd[1]</span></div>
-<div class="line"><a name="l06180"></a><span class="lineno"> 6180</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06181"></a><span class="lineno"> 6181</span>&#160;<span class="comment">          |  ...  |</span></div>
-<div class="line"><a name="l06182"></a><span class="lineno"> 6182</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06183"></a><span class="lineno"> 6183</span>&#160;<span class="comment">          | Alloc |  2nd[2nd.size() - 1]</span></div>
-<div class="line"><a name="l06184"></a><span class="lineno"> 6184</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06185"></a><span class="lineno"> 6185</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06186"></a><span class="lineno"> 6186</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06187"></a><span class="lineno"> 6187</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06188"></a><span class="lineno"> 6188</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06189"></a><span class="lineno"> 6189</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount]</span></div>
-<div class="line"><a name="l06190"></a><span class="lineno"> 6190</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06191"></a><span class="lineno"> 6191</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount + 1]</span></div>
-<div class="line"><a name="l06192"></a><span class="lineno"> 6192</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06193"></a><span class="lineno"> 6193</span>&#160;<span class="comment">          |  ...  |</span></div>
-<div class="line"><a name="l06194"></a><span class="lineno"> 6194</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06195"></a><span class="lineno"> 6195</span>&#160;<span class="comment">          | Alloc |  1st[1st.size() - 1]</span></div>
-<div class="line"><a name="l06196"></a><span class="lineno"> 6196</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06197"></a><span class="lineno"> 6197</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06198"></a><span class="lineno"> 6198</span>&#160;<span class="comment">GetSize() +-------+</span></div>
-<div class="line"><a name="l06199"></a><span class="lineno"> 6199</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l06200"></a><span class="lineno"> 6200</span>&#160;<span class="comment">if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK):</span></div>
-<div class="line"><a name="l06201"></a><span class="lineno"> 6201</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l06202"></a><span class="lineno"> 6202</span>&#160;<span class="comment">        0 +-------+</span></div>
-<div class="line"><a name="l06203"></a><span class="lineno"> 6203</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06204"></a><span class="lineno"> 6204</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06205"></a><span class="lineno"> 6205</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06206"></a><span class="lineno"> 6206</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06207"></a><span class="lineno"> 6207</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount]</span></div>
-<div class="line"><a name="l06208"></a><span class="lineno"> 6208</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06209"></a><span class="lineno"> 6209</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount + 1]</span></div>
-<div class="line"><a name="l06210"></a><span class="lineno"> 6210</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06211"></a><span class="lineno"> 6211</span>&#160;<span class="comment">          |  ...  |</span></div>
-<div class="line"><a name="l06212"></a><span class="lineno"> 6212</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06213"></a><span class="lineno"> 6213</span>&#160;<span class="comment">          | Alloc |  1st[1st.size() - 1]</span></div>
-<div class="line"><a name="l06214"></a><span class="lineno"> 6214</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06215"></a><span class="lineno"> 6215</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06216"></a><span class="lineno"> 6216</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06217"></a><span class="lineno"> 6217</span>&#160;<span class="comment">          |       |</span></div>
-<div class="line"><a name="l06218"></a><span class="lineno"> 6218</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06219"></a><span class="lineno"> 6219</span>&#160;<span class="comment">          | Alloc |  2nd[2nd.size() - 1]</span></div>
-<div class="line"><a name="l06220"></a><span class="lineno"> 6220</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06221"></a><span class="lineno"> 6221</span>&#160;<span class="comment">          |  ...  |</span></div>
-<div class="line"><a name="l06222"></a><span class="lineno"> 6222</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06223"></a><span class="lineno"> 6223</span>&#160;<span class="comment">          | Alloc |  2nd[1]</span></div>
-<div class="line"><a name="l06224"></a><span class="lineno"> 6224</span>&#160;<span class="comment">          +-------+</span></div>
-<div class="line"><a name="l06225"></a><span class="lineno"> 6225</span>&#160;<span class="comment">          | Alloc |  2nd[0]</span></div>
-<div class="line"><a name="l06226"></a><span class="lineno"> 6226</span>&#160;<span class="comment">GetSize() +-------+</span></div>
-<div class="line"><a name="l06227"></a><span class="lineno"> 6227</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l06228"></a><span class="lineno"> 6228</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l06229"></a><span class="lineno"> 6229</span>&#160;<span class="keyword">class </span>VmaBlockMetadata_Linear : <span class="keyword">public</span> VmaBlockMetadata</div>
-<div class="line"><a name="l06230"></a><span class="lineno"> 6230</span>&#160;{</div>
-<div class="line"><a name="l06231"></a><span class="lineno"> 6231</span>&#160;    VMA_CLASS_NO_COPY(VmaBlockMetadata_Linear)</div>
-<div class="line"><a name="l06232"></a><span class="lineno"> 6232</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l06233"></a><span class="lineno"> 6233</span>&#160;    VmaBlockMetadata_Linear(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
-<div class="line"><a name="l06234"></a><span class="lineno"> 6234</span>&#160;    <span class="keyword">virtual</span> ~VmaBlockMetadata_Linear();</div>
-<div class="line"><a name="l06235"></a><span class="lineno"> 6235</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size);</div>
-<div class="line"><a name="l06236"></a><span class="lineno"> 6236</span>&#160; </div>
-<div class="line"><a name="l06237"></a><span class="lineno"> 6237</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06238"></a><span class="lineno"> 6238</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06239"></a><span class="lineno"> 6239</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_SumFreeSize; }</div>
-<div class="line"><a name="l06240"></a><span class="lineno"> 6240</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06241"></a><span class="lineno"> 6241</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> GetAllocationCount() == 0; }</div>
-<div class="line"><a name="l06242"></a><span class="lineno"> 6242</span>&#160; </div>
-<div class="line"><a name="l06243"></a><span class="lineno"> 6243</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06244"></a><span class="lineno"> 6244</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06245"></a><span class="lineno"> 6245</span>&#160; </div>
-<div class="line"><a name="l06246"></a><span class="lineno"> 6246</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l06247"></a><span class="lineno"> 6247</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06248"></a><span class="lineno"> 6248</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l06249"></a><span class="lineno"> 6249</span>&#160; </div>
-<div class="line"><a name="l06250"></a><span class="lineno"> 6250</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
-<div class="line"><a name="l06251"></a><span class="lineno"> 6251</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06252"></a><span class="lineno"> 6252</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l06253"></a><span class="lineno"> 6253</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l06254"></a><span class="lineno"> 6254</span>&#160;        VkDeviceSize allocSize,</div>
-<div class="line"><a name="l06255"></a><span class="lineno"> 6255</span>&#160;        VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l06256"></a><span class="lineno"> 6256</span>&#160;        <span class="keywordtype">bool</span> upperAddress,</div>
-<div class="line"><a name="l06257"></a><span class="lineno"> 6257</span>&#160;        VmaSuballocationType allocType,</div>
-<div class="line"><a name="l06258"></a><span class="lineno"> 6258</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l06259"></a><span class="lineno"> 6259</span>&#160;        uint32_t strategy,</div>
-<div class="line"><a name="l06260"></a><span class="lineno"> 6260</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
-<div class="line"><a name="l06261"></a><span class="lineno"> 6261</span>&#160; </div>
-<div class="line"><a name="l06262"></a><span class="lineno"> 6262</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
-<div class="line"><a name="l06263"></a><span class="lineno"> 6263</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06264"></a><span class="lineno"> 6264</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l06265"></a><span class="lineno"> 6265</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
-<div class="line"><a name="l06266"></a><span class="lineno"> 6266</span>&#160; </div>
-<div class="line"><a name="l06267"></a><span class="lineno"> 6267</span>&#160;    <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
+<div class="line"><a name="l06156"></a><span class="lineno"> 6156</span>&#160;<span class="comment">If canMakeOtherLost was true:</span></div>
+<div class="line"><a name="l06157"></a><span class="lineno"> 6157</span>&#160;<span class="comment">- item points to first of sequence of suballocations, which are either FREE,</span></div>
+<div class="line"><a name="l06158"></a><span class="lineno"> 6158</span>&#160;<span class="comment">  or point to VmaAllocations that can become lost.</span></div>
+<div class="line"><a name="l06159"></a><span class="lineno"> 6159</span>&#160;<span class="comment">- itemsToMakeLostCount is the number of VmaAllocations that need to be made lost for</span></div>
+<div class="line"><a name="l06160"></a><span class="lineno"> 6160</span>&#160;<span class="comment">  the requested allocation to succeed.</span></div>
+<div class="line"><a name="l06161"></a><span class="lineno"> 6161</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l06162"></a><span class="lineno"> 6162</span>&#160;<span class="keyword">struct </span>VmaAllocationRequest</div>
+<div class="line"><a name="l06163"></a><span class="lineno"> 6163</span>&#160;{</div>
+<div class="line"><a name="l06164"></a><span class="lineno"> 6164</span>&#160;    VkDeviceSize offset;</div>
+<div class="line"><a name="l06165"></a><span class="lineno"> 6165</span>&#160;    VkDeviceSize sumFreeSize; <span class="comment">// Sum size of free items that overlap with proposed allocation.</span></div>
+<div class="line"><a name="l06166"></a><span class="lineno"> 6166</span>&#160;    VkDeviceSize sumItemSize; <span class="comment">// Sum size of items to make lost that overlap with proposed allocation.</span></div>
+<div class="line"><a name="l06167"></a><span class="lineno"> 6167</span>&#160;    VmaSuballocationList::iterator item;</div>
+<div class="line"><a name="l06168"></a><span class="lineno"> 6168</span>&#160;    <span class="keywordtype">size_t</span> itemsToMakeLostCount;</div>
+<div class="line"><a name="l06169"></a><span class="lineno"> 6169</span>&#160;    <span class="keywordtype">void</span>* customData;</div>
+<div class="line"><a name="l06170"></a><span class="lineno"> 6170</span>&#160;    VmaAllocationRequestType type;</div>
+<div class="line"><a name="l06171"></a><span class="lineno"> 6171</span>&#160; </div>
+<div class="line"><a name="l06172"></a><span class="lineno"> 6172</span>&#160;    VkDeviceSize CalcCost()<span class="keyword"> const</span></div>
+<div class="line"><a name="l06173"></a><span class="lineno"> 6173</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l06174"></a><span class="lineno"> 6174</span>&#160;        <span class="keywordflow">return</span> sumItemSize + itemsToMakeLostCount * VMA_LOST_ALLOCATION_COST;</div>
+<div class="line"><a name="l06175"></a><span class="lineno"> 6175</span>&#160;    }</div>
+<div class="line"><a name="l06176"></a><span class="lineno"> 6176</span>&#160;};</div>
+<div class="line"><a name="l06177"></a><span class="lineno"> 6177</span>&#160; </div>
+<div class="line"><a name="l06178"></a><span class="lineno"> 6178</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l06179"></a><span class="lineno"> 6179</span>&#160;<span class="comment">Data structure used for bookkeeping of allocations and unused ranges of memory</span></div>
+<div class="line"><a name="l06180"></a><span class="lineno"> 6180</span>&#160;<span class="comment">in a single VkDeviceMemory block.</span></div>
+<div class="line"><a name="l06181"></a><span class="lineno"> 6181</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l06182"></a><span class="lineno"> 6182</span>&#160;<span class="keyword">class </span>VmaBlockMetadata</div>
+<div class="line"><a name="l06183"></a><span class="lineno"> 6183</span>&#160;{</div>
+<div class="line"><a name="l06184"></a><span class="lineno"> 6184</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l06185"></a><span class="lineno"> 6185</span>&#160;    VmaBlockMetadata(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
+<div class="line"><a name="l06186"></a><span class="lineno"> 6186</span>&#160;    <span class="keyword">virtual</span> ~VmaBlockMetadata() { }</div>
+<div class="line"><a name="l06187"></a><span class="lineno"> 6187</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size) { m_Size = size; }</div>
+<div class="line"><a name="l06188"></a><span class="lineno"> 6188</span>&#160; </div>
+<div class="line"><a name="l06189"></a><span class="lineno"> 6189</span>&#160;    <span class="comment">// Validates all data structures inside this object. If not valid, returns false.</span></div>
+<div class="line"><a name="l06190"></a><span class="lineno"> 6190</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span> = 0;</div>
+<div class="line"><a name="l06191"></a><span class="lineno"> 6191</span>&#160;    VkDeviceSize GetSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Size; }</div>
+<div class="line"><a name="l06192"></a><span class="lineno"> 6192</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount() <span class="keyword">const</span> = 0;</div>
+<div class="line"><a name="l06193"></a><span class="lineno"> 6193</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize() <span class="keyword">const</span> = 0;</div>
+<div class="line"><a name="l06194"></a><span class="lineno"> 6194</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span> = 0;</div>
+<div class="line"><a name="l06195"></a><span class="lineno"> 6195</span>&#160;    <span class="comment">// Returns true if this block is empty - contains only single free suballocation.</span></div>
+<div class="line"><a name="l06196"></a><span class="lineno"> 6196</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty() <span class="keyword">const</span> = 0;</div>
+<div class="line"><a name="l06197"></a><span class="lineno"> 6197</span>&#160; </div>
+<div class="line"><a name="l06198"></a><span class="lineno"> 6198</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span> = 0;</div>
+<div class="line"><a name="l06199"></a><span class="lineno"> 6199</span>&#160;    <span class="comment">// Shouldn&#39;t modify blockCount.</span></div>
+<div class="line"><a name="l06200"></a><span class="lineno"> 6200</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span> = 0;</div>
+<div class="line"><a name="l06201"></a><span class="lineno"> 6201</span>&#160; </div>
+<div class="line"><a name="l06202"></a><span class="lineno"> 6202</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l06203"></a><span class="lineno"> 6203</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span> = 0;</div>
+<div class="line"><a name="l06204"></a><span class="lineno"> 6204</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l06205"></a><span class="lineno"> 6205</span>&#160; </div>
+<div class="line"><a name="l06206"></a><span class="lineno"> 6206</span>&#160;    <span class="comment">// Tries to find a place for suballocation with given parameters inside this block.</span></div>
+<div class="line"><a name="l06207"></a><span class="lineno"> 6207</span>&#160;    <span class="comment">// If succeeded, fills pAllocationRequest and returns true.</span></div>
+<div class="line"><a name="l06208"></a><span class="lineno"> 6208</span>&#160;    <span class="comment">// If failed, returns false.</span></div>
+<div class="line"><a name="l06209"></a><span class="lineno"> 6209</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
+<div class="line"><a name="l06210"></a><span class="lineno"> 6210</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06211"></a><span class="lineno"> 6211</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06212"></a><span class="lineno"> 6212</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l06213"></a><span class="lineno"> 6213</span>&#160;        VkDeviceSize allocSize,</div>
+<div class="line"><a name="l06214"></a><span class="lineno"> 6214</span>&#160;        VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l06215"></a><span class="lineno"> 6215</span>&#160;        <span class="keywordtype">bool</span> upperAddress,</div>
+<div class="line"><a name="l06216"></a><span class="lineno"> 6216</span>&#160;        VmaSuballocationType allocType,</div>
+<div class="line"><a name="l06217"></a><span class="lineno"> 6217</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l06218"></a><span class="lineno"> 6218</span>&#160;        <span class="comment">// Always one of VMA_ALLOCATION_CREATE_STRATEGY_* or VMA_ALLOCATION_INTERNAL_STRATEGY_* flags.</span></div>
+<div class="line"><a name="l06219"></a><span class="lineno"> 6219</span>&#160;        uint32_t strategy,</div>
+<div class="line"><a name="l06220"></a><span class="lineno"> 6220</span>&#160;        VmaAllocationRequest* pAllocationRequest) = 0;</div>
+<div class="line"><a name="l06221"></a><span class="lineno"> 6221</span>&#160; </div>
+<div class="line"><a name="l06222"></a><span class="lineno"> 6222</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
+<div class="line"><a name="l06223"></a><span class="lineno"> 6223</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06224"></a><span class="lineno"> 6224</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06225"></a><span class="lineno"> 6225</span>&#160;        VmaAllocationRequest* pAllocationRequest) = 0;</div>
+<div class="line"><a name="l06226"></a><span class="lineno"> 6226</span>&#160; </div>
+<div class="line"><a name="l06227"></a><span class="lineno"> 6227</span>&#160;    <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount) = 0;</div>
+<div class="line"><a name="l06228"></a><span class="lineno"> 6228</span>&#160; </div>
+<div class="line"><a name="l06229"></a><span class="lineno"> 6229</span>&#160;    <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData) = 0;</div>
+<div class="line"><a name="l06230"></a><span class="lineno"> 6230</span>&#160; </div>
+<div class="line"><a name="l06231"></a><span class="lineno"> 6231</span>&#160;    <span class="comment">// Makes actual allocation based on request. Request must already be checked and valid.</span></div>
+<div class="line"><a name="l06232"></a><span class="lineno"> 6232</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
+<div class="line"><a name="l06233"></a><span class="lineno"> 6233</span>&#160;        <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
+<div class="line"><a name="l06234"></a><span class="lineno"> 6234</span>&#160;        VmaSuballocationType type,</div>
+<div class="line"><a name="l06235"></a><span class="lineno"> 6235</span>&#160;        VkDeviceSize allocSize,</div>
+<div class="line"><a name="l06236"></a><span class="lineno"> 6236</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation) = 0;</div>
+<div class="line"><a name="l06237"></a><span class="lineno"> 6237</span>&#160; </div>
+<div class="line"><a name="l06238"></a><span class="lineno"> 6238</span>&#160;    <span class="comment">// Frees suballocation assigned to given memory region.</span></div>
+<div class="line"><a name="l06239"></a><span class="lineno"> 6239</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation) = 0;</div>
+<div class="line"><a name="l06240"></a><span class="lineno"> 6240</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset) = 0;</div>
+<div class="line"><a name="l06241"></a><span class="lineno"> 6241</span>&#160; </div>
+<div class="line"><a name="l06242"></a><span class="lineno"> 6242</span>&#160;<span class="keyword">protected</span>:</div>
+<div class="line"><a name="l06243"></a><span class="lineno"> 6243</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* GetAllocationCallbacks()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pAllocationCallbacks; }</div>
+<div class="line"><a name="l06244"></a><span class="lineno"> 6244</span>&#160; </div>
+<div class="line"><a name="l06245"></a><span class="lineno"> 6245</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l06246"></a><span class="lineno"> 6246</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap_Begin(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
+<div class="line"><a name="l06247"></a><span class="lineno"> 6247</span>&#160;        VkDeviceSize unusedBytes,</div>
+<div class="line"><a name="l06248"></a><span class="lineno"> 6248</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l06249"></a><span class="lineno"> 6249</span>&#160;        <span class="keywordtype">size_t</span> unusedRangeCount) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06250"></a><span class="lineno"> 6250</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap_Allocation(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
+<div class="line"><a name="l06251"></a><span class="lineno"> 6251</span>&#160;        VkDeviceSize offset,</div>
+<div class="line"><a name="l06252"></a><span class="lineno"> 6252</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06253"></a><span class="lineno"> 6253</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap_UnusedRange(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
+<div class="line"><a name="l06254"></a><span class="lineno"> 6254</span>&#160;        VkDeviceSize offset,</div>
+<div class="line"><a name="l06255"></a><span class="lineno"> 6255</span>&#160;        VkDeviceSize size) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06256"></a><span class="lineno"> 6256</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap_End(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06257"></a><span class="lineno"> 6257</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l06258"></a><span class="lineno"> 6258</span>&#160; </div>
+<div class="line"><a name="l06259"></a><span class="lineno"> 6259</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l06260"></a><span class="lineno"> 6260</span>&#160;    VkDeviceSize m_Size;</div>
+<div class="line"><a name="l06261"></a><span class="lineno"> 6261</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* m_pAllocationCallbacks;</div>
+<div class="line"><a name="l06262"></a><span class="lineno"> 6262</span>&#160;};</div>
+<div class="line"><a name="l06263"></a><span class="lineno"> 6263</span>&#160; </div>
+<div class="line"><a name="l06264"></a><span class="lineno"> 6264</span>&#160;<span class="preprocessor">#define VMA_VALIDATE(cond) do { if(!(cond)) { \</span></div>
+<div class="line"><a name="l06265"></a><span class="lineno"> 6265</span>&#160;<span class="preprocessor">        VMA_ASSERT(0 &amp;&amp; &quot;Validation failed: &quot; #cond); \</span></div>
+<div class="line"><a name="l06266"></a><span class="lineno"> 6266</span>&#160;<span class="preprocessor">        return false; \</span></div>
+<div class="line"><a name="l06267"></a><span class="lineno"> 6267</span>&#160;<span class="preprocessor">    } } while(false)</span></div>
 <div class="line"><a name="l06268"></a><span class="lineno"> 6268</span>&#160; </div>
-<div class="line"><a name="l06269"></a><span class="lineno"> 6269</span>&#160;    <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData);</div>
-<div class="line"><a name="l06270"></a><span class="lineno"> 6270</span>&#160; </div>
-<div class="line"><a name="l06271"></a><span class="lineno"> 6271</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
-<div class="line"><a name="l06272"></a><span class="lineno"> 6272</span>&#160;        <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
-<div class="line"><a name="l06273"></a><span class="lineno"> 6273</span>&#160;        VmaSuballocationType type,</div>
-<div class="line"><a name="l06274"></a><span class="lineno"> 6274</span>&#160;        VkDeviceSize allocSize,</div>
-<div class="line"><a name="l06275"></a><span class="lineno"> 6275</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
+<div class="line"><a name="l06269"></a><span class="lineno"> 6269</span>&#160;<span class="keyword">class </span>VmaBlockMetadata_Generic : <span class="keyword">public</span> VmaBlockMetadata</div>
+<div class="line"><a name="l06270"></a><span class="lineno"> 6270</span>&#160;{</div>
+<div class="line"><a name="l06271"></a><span class="lineno"> 6271</span>&#160;    VMA_CLASS_NO_COPY(VmaBlockMetadata_Generic)</div>
+<div class="line"><a name="l06272"></a><span class="lineno"> 6272</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l06273"></a><span class="lineno"> 6273</span>&#160;    VmaBlockMetadata_Generic(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
+<div class="line"><a name="l06274"></a><span class="lineno"> 6274</span>&#160;    <span class="keyword">virtual</span> ~VmaBlockMetadata_Generic();</div>
+<div class="line"><a name="l06275"></a><span class="lineno"> 6275</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size);</div>
 <div class="line"><a name="l06276"></a><span class="lineno"> 6276</span>&#160; </div>
-<div class="line"><a name="l06277"></a><span class="lineno"> 6277</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l06278"></a><span class="lineno"> 6278</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset);</div>
-<div class="line"><a name="l06279"></a><span class="lineno"> 6279</span>&#160; </div>
-<div class="line"><a name="l06280"></a><span class="lineno"> 6280</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l06281"></a><span class="lineno"> 6281</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l06282"></a><span class="lineno"> 6282</span>&#160;<span class="comment">    There are two suballocation vectors, used in ping-pong way.</span></div>
-<div class="line"><a name="l06283"></a><span class="lineno"> 6283</span>&#160;<span class="comment">    The one with index m_1stVectorIndex is called 1st.</span></div>
-<div class="line"><a name="l06284"></a><span class="lineno"> 6284</span>&#160;<span class="comment">    The one with index (m_1stVectorIndex ^ 1) is called 2nd.</span></div>
-<div class="line"><a name="l06285"></a><span class="lineno"> 6285</span>&#160;<span class="comment">    2nd can be non-empty only when 1st is not empty.</span></div>
-<div class="line"><a name="l06286"></a><span class="lineno"> 6286</span>&#160;<span class="comment">    When 2nd is not empty, m_2ndVectorMode indicates its mode of operation.</span></div>
-<div class="line"><a name="l06287"></a><span class="lineno"> 6287</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l06288"></a><span class="lineno"> 6288</span>&#160;    <span class="keyword">typedef</span> VmaVector&lt; VmaSuballocation, VmaStlAllocator&lt;VmaSuballocation&gt; &gt; SuballocationVectorType;</div>
+<div class="line"><a name="l06277"></a><span class="lineno"> 6277</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06278"></a><span class="lineno"> 6278</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Suballocations.size() - m_FreeCount; }</div>
+<div class="line"><a name="l06279"></a><span class="lineno"> 6279</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_SumFreeSize; }</div>
+<div class="line"><a name="l06280"></a><span class="lineno"> 6280</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06281"></a><span class="lineno"> 6281</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06282"></a><span class="lineno"> 6282</span>&#160; </div>
+<div class="line"><a name="l06283"></a><span class="lineno"> 6283</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06284"></a><span class="lineno"> 6284</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06285"></a><span class="lineno"> 6285</span>&#160; </div>
+<div class="line"><a name="l06286"></a><span class="lineno"> 6286</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l06287"></a><span class="lineno"> 6287</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06288"></a><span class="lineno"> 6288</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l06289"></a><span class="lineno"> 6289</span>&#160; </div>
-<div class="line"><a name="l06290"></a><span class="lineno"> 6290</span>&#160;    <span class="keyword">enum</span> SECOND_VECTOR_MODE</div>
-<div class="line"><a name="l06291"></a><span class="lineno"> 6291</span>&#160;    {</div>
-<div class="line"><a name="l06292"></a><span class="lineno"> 6292</span>&#160;        SECOND_VECTOR_EMPTY,</div>
-<div class="line"><a name="l06293"></a><span class="lineno"> 6293</span>&#160;        <span class="comment">/*</span></div>
-<div class="line"><a name="l06294"></a><span class="lineno"> 6294</span>&#160;<span class="comment">        Suballocations in 2nd vector are created later than the ones in 1st, but they</span></div>
-<div class="line"><a name="l06295"></a><span class="lineno"> 6295</span>&#160;<span class="comment">        all have smaller offset.</span></div>
-<div class="line"><a name="l06296"></a><span class="lineno"> 6296</span>&#160;<span class="comment">        */</span></div>
-<div class="line"><a name="l06297"></a><span class="lineno"> 6297</span>&#160;        SECOND_VECTOR_RING_BUFFER,</div>
-<div class="line"><a name="l06298"></a><span class="lineno"> 6298</span>&#160;        <span class="comment">/*</span></div>
-<div class="line"><a name="l06299"></a><span class="lineno"> 6299</span>&#160;<span class="comment">        Suballocations in 2nd vector are upper side of double stack.</span></div>
-<div class="line"><a name="l06300"></a><span class="lineno"> 6300</span>&#160;<span class="comment">        They all have offsets higher than those in 1st vector.</span></div>
-<div class="line"><a name="l06301"></a><span class="lineno"> 6301</span>&#160;<span class="comment">        Top of this stack means smaller offsets, but higher indices in this vector.</span></div>
-<div class="line"><a name="l06302"></a><span class="lineno"> 6302</span>&#160;<span class="comment">        */</span></div>
-<div class="line"><a name="l06303"></a><span class="lineno"> 6303</span>&#160;        SECOND_VECTOR_DOUBLE_STACK,</div>
-<div class="line"><a name="l06304"></a><span class="lineno"> 6304</span>&#160;    };</div>
-<div class="line"><a name="l06305"></a><span class="lineno"> 6305</span>&#160; </div>
-<div class="line"><a name="l06306"></a><span class="lineno"> 6306</span>&#160;    VkDeviceSize m_SumFreeSize;</div>
-<div class="line"><a name="l06307"></a><span class="lineno"> 6307</span>&#160;    SuballocationVectorType m_Suballocations0, m_Suballocations1;</div>
-<div class="line"><a name="l06308"></a><span class="lineno"> 6308</span>&#160;    uint32_t m_1stVectorIndex;</div>
-<div class="line"><a name="l06309"></a><span class="lineno"> 6309</span>&#160;    SECOND_VECTOR_MODE m_2ndVectorMode;</div>
+<div class="line"><a name="l06290"></a><span class="lineno"> 6290</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
+<div class="line"><a name="l06291"></a><span class="lineno"> 6291</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06292"></a><span class="lineno"> 6292</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06293"></a><span class="lineno"> 6293</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l06294"></a><span class="lineno"> 6294</span>&#160;        VkDeviceSize allocSize,</div>
+<div class="line"><a name="l06295"></a><span class="lineno"> 6295</span>&#160;        VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l06296"></a><span class="lineno"> 6296</span>&#160;        <span class="keywordtype">bool</span> upperAddress,</div>
+<div class="line"><a name="l06297"></a><span class="lineno"> 6297</span>&#160;        VmaSuballocationType allocType,</div>
+<div class="line"><a name="l06298"></a><span class="lineno"> 6298</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l06299"></a><span class="lineno"> 6299</span>&#160;        uint32_t strategy,</div>
+<div class="line"><a name="l06300"></a><span class="lineno"> 6300</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
+<div class="line"><a name="l06301"></a><span class="lineno"> 6301</span>&#160; </div>
+<div class="line"><a name="l06302"></a><span class="lineno"> 6302</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
+<div class="line"><a name="l06303"></a><span class="lineno"> 6303</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06304"></a><span class="lineno"> 6304</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06305"></a><span class="lineno"> 6305</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
+<div class="line"><a name="l06306"></a><span class="lineno"> 6306</span>&#160; </div>
+<div class="line"><a name="l06307"></a><span class="lineno"> 6307</span>&#160;    <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
+<div class="line"><a name="l06308"></a><span class="lineno"> 6308</span>&#160; </div>
+<div class="line"><a name="l06309"></a><span class="lineno"> 6309</span>&#160;    <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData);</div>
 <div class="line"><a name="l06310"></a><span class="lineno"> 6310</span>&#160; </div>
-<div class="line"><a name="l06311"></a><span class="lineno"> 6311</span>&#160;    SuballocationVectorType&amp; AccessSuballocations1st() { <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations1 : m_Suballocations0; }</div>
-<div class="line"><a name="l06312"></a><span class="lineno"> 6312</span>&#160;    SuballocationVectorType&amp; AccessSuballocations2nd() { <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations0 : m_Suballocations1; }</div>
-<div class="line"><a name="l06313"></a><span class="lineno"> 6313</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; AccessSuballocations1st()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations1 : m_Suballocations0; }</div>
-<div class="line"><a name="l06314"></a><span class="lineno"> 6314</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; AccessSuballocations2nd()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations0 : m_Suballocations1; }</div>
-<div class="line"><a name="l06315"></a><span class="lineno"> 6315</span>&#160;    </div>
-<div class="line"><a name="l06316"></a><span class="lineno"> 6316</span>&#160;    <span class="comment">// Number of items in 1st vector with hAllocation = null at the beginning.</span></div>
-<div class="line"><a name="l06317"></a><span class="lineno"> 6317</span>&#160;    <span class="keywordtype">size_t</span> m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l06318"></a><span class="lineno"> 6318</span>&#160;    <span class="comment">// Number of other items in 1st vector with hAllocation = null somewhere in the middle.</span></div>
-<div class="line"><a name="l06319"></a><span class="lineno"> 6319</span>&#160;    <span class="keywordtype">size_t</span> m_1stNullItemsMiddleCount;</div>
-<div class="line"><a name="l06320"></a><span class="lineno"> 6320</span>&#160;    <span class="comment">// Number of items in 2nd vector with hAllocation = null.</span></div>
-<div class="line"><a name="l06321"></a><span class="lineno"> 6321</span>&#160;    <span class="keywordtype">size_t</span> m_2ndNullItemsCount;</div>
-<div class="line"><a name="l06322"></a><span class="lineno"> 6322</span>&#160; </div>
-<div class="line"><a name="l06323"></a><span class="lineno"> 6323</span>&#160;    <span class="keywordtype">bool</span> ShouldCompact1st() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06324"></a><span class="lineno"> 6324</span>&#160;    <span class="keywordtype">void</span> CleanupAfterFree();</div>
-<div class="line"><a name="l06325"></a><span class="lineno"> 6325</span>&#160; </div>
-<div class="line"><a name="l06326"></a><span class="lineno"> 6326</span>&#160;    <span class="keywordtype">bool</span> CreateAllocationRequest_LowerAddress(</div>
-<div class="line"><a name="l06327"></a><span class="lineno"> 6327</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06328"></a><span class="lineno"> 6328</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l06329"></a><span class="lineno"> 6329</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l06330"></a><span class="lineno"> 6330</span>&#160;        VkDeviceSize allocSize,</div>
-<div class="line"><a name="l06331"></a><span class="lineno"> 6331</span>&#160;        VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l06332"></a><span class="lineno"> 6332</span>&#160;        VmaSuballocationType allocType,</div>
-<div class="line"><a name="l06333"></a><span class="lineno"> 6333</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l06334"></a><span class="lineno"> 6334</span>&#160;        uint32_t strategy,</div>
-<div class="line"><a name="l06335"></a><span class="lineno"> 6335</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
-<div class="line"><a name="l06336"></a><span class="lineno"> 6336</span>&#160;    <span class="keywordtype">bool</span> CreateAllocationRequest_UpperAddress(</div>
-<div class="line"><a name="l06337"></a><span class="lineno"> 6337</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06338"></a><span class="lineno"> 6338</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l06339"></a><span class="lineno"> 6339</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l06340"></a><span class="lineno"> 6340</span>&#160;        VkDeviceSize allocSize,</div>
-<div class="line"><a name="l06341"></a><span class="lineno"> 6341</span>&#160;        VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l06342"></a><span class="lineno"> 6342</span>&#160;        VmaSuballocationType allocType,</div>
-<div class="line"><a name="l06343"></a><span class="lineno"> 6343</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l06344"></a><span class="lineno"> 6344</span>&#160;        uint32_t strategy,</div>
-<div class="line"><a name="l06345"></a><span class="lineno"> 6345</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
-<div class="line"><a name="l06346"></a><span class="lineno"> 6346</span>&#160;};</div>
-<div class="line"><a name="l06347"></a><span class="lineno"> 6347</span>&#160; </div>
-<div class="line"><a name="l06348"></a><span class="lineno"> 6348</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l06349"></a><span class="lineno"> 6349</span>&#160;<span class="comment">- GetSize() is the original size of allocated memory block.</span></div>
-<div class="line"><a name="l06350"></a><span class="lineno"> 6350</span>&#160;<span class="comment">- m_UsableSize is this size aligned down to a power of two.</span></div>
-<div class="line"><a name="l06351"></a><span class="lineno"> 6351</span>&#160;<span class="comment">  All allocations and calculations happen relative to m_UsableSize.</span></div>
-<div class="line"><a name="l06352"></a><span class="lineno"> 6352</span>&#160;<span class="comment">- GetUnusableSize() is the difference between them.</span></div>
-<div class="line"><a name="l06353"></a><span class="lineno"> 6353</span>&#160;<span class="comment">  It is repoted as separate, unused range, not available for allocations.</span></div>
-<div class="line"><a name="l06354"></a><span class="lineno"> 6354</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l06355"></a><span class="lineno"> 6355</span>&#160;<span class="comment">Node at level 0 has size = m_UsableSize.</span></div>
-<div class="line"><a name="l06356"></a><span class="lineno"> 6356</span>&#160;<span class="comment">Each next level contains nodes with size 2 times smaller than current level.</span></div>
-<div class="line"><a name="l06357"></a><span class="lineno"> 6357</span>&#160;<span class="comment">m_LevelCount is the maximum number of levels to use in the current object.</span></div>
-<div class="line"><a name="l06358"></a><span class="lineno"> 6358</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l06359"></a><span class="lineno"> 6359</span>&#160;<span class="keyword">class </span>VmaBlockMetadata_Buddy : <span class="keyword">public</span> VmaBlockMetadata</div>
-<div class="line"><a name="l06360"></a><span class="lineno"> 6360</span>&#160;{</div>
-<div class="line"><a name="l06361"></a><span class="lineno"> 6361</span>&#160;    VMA_CLASS_NO_COPY(VmaBlockMetadata_Buddy)</div>
-<div class="line"><a name="l06362"></a><span class="lineno"> 6362</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l06363"></a><span class="lineno"> 6363</span>&#160;    VmaBlockMetadata_Buddy(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
-<div class="line"><a name="l06364"></a><span class="lineno"> 6364</span>&#160;    <span class="keyword">virtual</span> ~VmaBlockMetadata_Buddy();</div>
-<div class="line"><a name="l06365"></a><span class="lineno"> 6365</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size);</div>
-<div class="line"><a name="l06366"></a><span class="lineno"> 6366</span>&#160; </div>
-<div class="line"><a name="l06367"></a><span class="lineno"> 6367</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06368"></a><span class="lineno"> 6368</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_AllocationCount; }</div>
-<div class="line"><a name="l06369"></a><span class="lineno"> 6369</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_SumFreeSize + GetUnusableSize(); }</div>
-<div class="line"><a name="l06370"></a><span class="lineno"> 6370</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06371"></a><span class="lineno"> 6371</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Root-&gt;type == Node::TYPE_FREE; }</div>
-<div class="line"><a name="l06372"></a><span class="lineno"> 6372</span>&#160; </div>
-<div class="line"><a name="l06373"></a><span class="lineno"> 6373</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06374"></a><span class="lineno"> 6374</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06375"></a><span class="lineno"> 6375</span>&#160; </div>
-<div class="line"><a name="l06376"></a><span class="lineno"> 6376</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l06377"></a><span class="lineno"> 6377</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06378"></a><span class="lineno"> 6378</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l06379"></a><span class="lineno"> 6379</span>&#160; </div>
-<div class="line"><a name="l06380"></a><span class="lineno"> 6380</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
-<div class="line"><a name="l06381"></a><span class="lineno"> 6381</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06382"></a><span class="lineno"> 6382</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l06383"></a><span class="lineno"> 6383</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l06384"></a><span class="lineno"> 6384</span>&#160;        VkDeviceSize allocSize,</div>
-<div class="line"><a name="l06385"></a><span class="lineno"> 6385</span>&#160;        VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l06386"></a><span class="lineno"> 6386</span>&#160;        <span class="keywordtype">bool</span> upperAddress,</div>
-<div class="line"><a name="l06387"></a><span class="lineno"> 6387</span>&#160;        VmaSuballocationType allocType,</div>
-<div class="line"><a name="l06388"></a><span class="lineno"> 6388</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l06389"></a><span class="lineno"> 6389</span>&#160;        uint32_t strategy,</div>
-<div class="line"><a name="l06390"></a><span class="lineno"> 6390</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
-<div class="line"><a name="l06391"></a><span class="lineno"> 6391</span>&#160; </div>
-<div class="line"><a name="l06392"></a><span class="lineno"> 6392</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
-<div class="line"><a name="l06393"></a><span class="lineno"> 6393</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06394"></a><span class="lineno"> 6394</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l06395"></a><span class="lineno"> 6395</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
-<div class="line"><a name="l06396"></a><span class="lineno"> 6396</span>&#160; </div>
-<div class="line"><a name="l06397"></a><span class="lineno"> 6397</span>&#160;    <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
-<div class="line"><a name="l06398"></a><span class="lineno"> 6398</span>&#160; </div>
-<div class="line"><a name="l06399"></a><span class="lineno"> 6399</span>&#160;    <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData) { <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT; }</div>
-<div class="line"><a name="l06400"></a><span class="lineno"> 6400</span>&#160; </div>
-<div class="line"><a name="l06401"></a><span class="lineno"> 6401</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
-<div class="line"><a name="l06402"></a><span class="lineno"> 6402</span>&#160;        <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
-<div class="line"><a name="l06403"></a><span class="lineno"> 6403</span>&#160;        VmaSuballocationType type,</div>
-<div class="line"><a name="l06404"></a><span class="lineno"> 6404</span>&#160;        VkDeviceSize allocSize,</div>
-<div class="line"><a name="l06405"></a><span class="lineno"> 6405</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
-<div class="line"><a name="l06406"></a><span class="lineno"> 6406</span>&#160; </div>
-<div class="line"><a name="l06407"></a><span class="lineno"> 6407</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation) { FreeAtOffset(allocation, allocation-&gt;GetOffset()); }</div>
-<div class="line"><a name="l06408"></a><span class="lineno"> 6408</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset) { FreeAtOffset(VMA_NULL, offset); }</div>
-<div class="line"><a name="l06409"></a><span class="lineno"> 6409</span>&#160; </div>
-<div class="line"><a name="l06410"></a><span class="lineno"> 6410</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l06411"></a><span class="lineno"> 6411</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> VkDeviceSize MIN_NODE_SIZE = 32;</div>
-<div class="line"><a name="l06412"></a><span class="lineno"> 6412</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> MAX_LEVELS = 30;</div>
-<div class="line"><a name="l06413"></a><span class="lineno"> 6413</span>&#160; </div>
-<div class="line"><a name="l06414"></a><span class="lineno"> 6414</span>&#160;    <span class="keyword">struct </span>ValidationContext</div>
-<div class="line"><a name="l06415"></a><span class="lineno"> 6415</span>&#160;    {</div>
-<div class="line"><a name="l06416"></a><span class="lineno"> 6416</span>&#160;        <span class="keywordtype">size_t</span> calculatedAllocationCount;</div>
-<div class="line"><a name="l06417"></a><span class="lineno"> 6417</span>&#160;        <span class="keywordtype">size_t</span> calculatedFreeCount;</div>
-<div class="line"><a name="l06418"></a><span class="lineno"> 6418</span>&#160;        VkDeviceSize calculatedSumFreeSize;</div>
-<div class="line"><a name="l06419"></a><span class="lineno"> 6419</span>&#160; </div>
-<div class="line"><a name="l06420"></a><span class="lineno"> 6420</span>&#160;        ValidationContext() :</div>
-<div class="line"><a name="l06421"></a><span class="lineno"> 6421</span>&#160;            calculatedAllocationCount(0),</div>
-<div class="line"><a name="l06422"></a><span class="lineno"> 6422</span>&#160;            calculatedFreeCount(0),</div>
-<div class="line"><a name="l06423"></a><span class="lineno"> 6423</span>&#160;            calculatedSumFreeSize(0) { }</div>
-<div class="line"><a name="l06424"></a><span class="lineno"> 6424</span>&#160;    };</div>
-<div class="line"><a name="l06425"></a><span class="lineno"> 6425</span>&#160; </div>
-<div class="line"><a name="l06426"></a><span class="lineno"> 6426</span>&#160;    <span class="keyword">struct </span>Node</div>
-<div class="line"><a name="l06427"></a><span class="lineno"> 6427</span>&#160;    {</div>
-<div class="line"><a name="l06428"></a><span class="lineno"> 6428</span>&#160;        VkDeviceSize offset;</div>
-<div class="line"><a name="l06429"></a><span class="lineno"> 6429</span>&#160;        <span class="keyword">enum</span> TYPE</div>
-<div class="line"><a name="l06430"></a><span class="lineno"> 6430</span>&#160;        {</div>
-<div class="line"><a name="l06431"></a><span class="lineno"> 6431</span>&#160;            TYPE_FREE,</div>
-<div class="line"><a name="l06432"></a><span class="lineno"> 6432</span>&#160;            TYPE_ALLOCATION,</div>
-<div class="line"><a name="l06433"></a><span class="lineno"> 6433</span>&#160;            TYPE_SPLIT,</div>
-<div class="line"><a name="l06434"></a><span class="lineno"> 6434</span>&#160;            TYPE_COUNT</div>
-<div class="line"><a name="l06435"></a><span class="lineno"> 6435</span>&#160;        } type;</div>
-<div class="line"><a name="l06436"></a><span class="lineno"> 6436</span>&#160;        Node* parent;</div>
-<div class="line"><a name="l06437"></a><span class="lineno"> 6437</span>&#160;        Node* buddy;</div>
-<div class="line"><a name="l06438"></a><span class="lineno"> 6438</span>&#160; </div>
-<div class="line"><a name="l06439"></a><span class="lineno"> 6439</span>&#160;        <span class="keyword">union</span></div>
-<div class="line"><a name="l06440"></a><span class="lineno"> 6440</span>&#160;        {</div>
-<div class="line"><a name="l06441"></a><span class="lineno"> 6441</span>&#160;            <span class="keyword">struct</span></div>
-<div class="line"><a name="l06442"></a><span class="lineno"> 6442</span>&#160;            {</div>
-<div class="line"><a name="l06443"></a><span class="lineno"> 6443</span>&#160;                Node* prev;</div>
-<div class="line"><a name="l06444"></a><span class="lineno"> 6444</span>&#160;                Node* next;</div>
-<div class="line"><a name="l06445"></a><span class="lineno"> 6445</span>&#160;            } free;</div>
-<div class="line"><a name="l06446"></a><span class="lineno"> 6446</span>&#160;            <span class="keyword">struct</span></div>
-<div class="line"><a name="l06447"></a><span class="lineno"> 6447</span>&#160;            {</div>
-<div class="line"><a name="l06448"></a><span class="lineno"> 6448</span>&#160;                <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc;</div>
-<div class="line"><a name="l06449"></a><span class="lineno"> 6449</span>&#160;            } allocation;</div>
-<div class="line"><a name="l06450"></a><span class="lineno"> 6450</span>&#160;            <span class="keyword">struct</span></div>
-<div class="line"><a name="l06451"></a><span class="lineno"> 6451</span>&#160;            {</div>
-<div class="line"><a name="l06452"></a><span class="lineno"> 6452</span>&#160;                Node* leftChild;</div>
-<div class="line"><a name="l06453"></a><span class="lineno"> 6453</span>&#160;            } split;</div>
-<div class="line"><a name="l06454"></a><span class="lineno"> 6454</span>&#160;        };</div>
-<div class="line"><a name="l06455"></a><span class="lineno"> 6455</span>&#160;    };</div>
-<div class="line"><a name="l06456"></a><span class="lineno"> 6456</span>&#160; </div>
-<div class="line"><a name="l06457"></a><span class="lineno"> 6457</span>&#160;    <span class="comment">// Size of the memory block aligned down to a power of two.</span></div>
-<div class="line"><a name="l06458"></a><span class="lineno"> 6458</span>&#160;    VkDeviceSize m_UsableSize;</div>
-<div class="line"><a name="l06459"></a><span class="lineno"> 6459</span>&#160;    uint32_t m_LevelCount;</div>
+<div class="line"><a name="l06311"></a><span class="lineno"> 6311</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
+<div class="line"><a name="l06312"></a><span class="lineno"> 6312</span>&#160;        <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
+<div class="line"><a name="l06313"></a><span class="lineno"> 6313</span>&#160;        VmaSuballocationType type,</div>
+<div class="line"><a name="l06314"></a><span class="lineno"> 6314</span>&#160;        VkDeviceSize allocSize,</div>
+<div class="line"><a name="l06315"></a><span class="lineno"> 6315</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
+<div class="line"><a name="l06316"></a><span class="lineno"> 6316</span>&#160; </div>
+<div class="line"><a name="l06317"></a><span class="lineno"> 6317</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l06318"></a><span class="lineno"> 6318</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset);</div>
+<div class="line"><a name="l06319"></a><span class="lineno"> 6319</span>&#160; </div>
+<div class="line"><a name="l06321"></a><span class="lineno"> 6321</span>&#160;    <span class="comment">// For defragmentation</span></div>
+<div class="line"><a name="l06322"></a><span class="lineno"> 6322</span>&#160;    </div>
+<div class="line"><a name="l06323"></a><span class="lineno"> 6323</span>&#160;    <span class="keywordtype">bool</span> IsBufferImageGranularityConflictPossible(</div>
+<div class="line"><a name="l06324"></a><span class="lineno"> 6324</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l06325"></a><span class="lineno"> 6325</span>&#160;        VmaSuballocationType&amp; inOutPrevSuballocType) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06326"></a><span class="lineno"> 6326</span>&#160; </div>
+<div class="line"><a name="l06327"></a><span class="lineno"> 6327</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l06328"></a><span class="lineno"> 6328</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span>VmaDefragmentationAlgorithm_Generic;</div>
+<div class="line"><a name="l06329"></a><span class="lineno"> 6329</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span>VmaDefragmentationAlgorithm_Fast;</div>
+<div class="line"><a name="l06330"></a><span class="lineno"> 6330</span>&#160; </div>
+<div class="line"><a name="l06331"></a><span class="lineno"> 6331</span>&#160;    uint32_t m_FreeCount;</div>
+<div class="line"><a name="l06332"></a><span class="lineno"> 6332</span>&#160;    VkDeviceSize m_SumFreeSize;</div>
+<div class="line"><a name="l06333"></a><span class="lineno"> 6333</span>&#160;    VmaSuballocationList m_Suballocations;</div>
+<div class="line"><a name="l06334"></a><span class="lineno"> 6334</span>&#160;    <span class="comment">// Suballocations that are free and have size greater than certain threshold.</span></div>
+<div class="line"><a name="l06335"></a><span class="lineno"> 6335</span>&#160;    <span class="comment">// Sorted by size, ascending.</span></div>
+<div class="line"><a name="l06336"></a><span class="lineno"> 6336</span>&#160;    VmaVector&lt; VmaSuballocationList::iterator, VmaStlAllocator&lt; VmaSuballocationList::iterator &gt; &gt; m_FreeSuballocationsBySize;</div>
+<div class="line"><a name="l06337"></a><span class="lineno"> 6337</span>&#160; </div>
+<div class="line"><a name="l06338"></a><span class="lineno"> 6338</span>&#160;    <span class="keywordtype">bool</span> ValidateFreeSuballocationList() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06339"></a><span class="lineno"> 6339</span>&#160; </div>
+<div class="line"><a name="l06340"></a><span class="lineno"> 6340</span>&#160;    <span class="comment">// Checks if requested suballocation with given parameters can be placed in given pFreeSuballocItem.</span></div>
+<div class="line"><a name="l06341"></a><span class="lineno"> 6341</span>&#160;    <span class="comment">// If yes, fills pOffset and returns true. If no, returns false.</span></div>
+<div class="line"><a name="l06342"></a><span class="lineno"> 6342</span>&#160;    <span class="keywordtype">bool</span> CheckAllocation(</div>
+<div class="line"><a name="l06343"></a><span class="lineno"> 6343</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06344"></a><span class="lineno"> 6344</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06345"></a><span class="lineno"> 6345</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l06346"></a><span class="lineno"> 6346</span>&#160;        VkDeviceSize allocSize,</div>
+<div class="line"><a name="l06347"></a><span class="lineno"> 6347</span>&#160;        VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l06348"></a><span class="lineno"> 6348</span>&#160;        VmaSuballocationType allocType,</div>
+<div class="line"><a name="l06349"></a><span class="lineno"> 6349</span>&#160;        VmaSuballocationList::const_iterator suballocItem,</div>
+<div class="line"><a name="l06350"></a><span class="lineno"> 6350</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l06351"></a><span class="lineno"> 6351</span>&#160;        VkDeviceSize* pOffset,</div>
+<div class="line"><a name="l06352"></a><span class="lineno"> 6352</span>&#160;        <span class="keywordtype">size_t</span>* itemsToMakeLostCount,</div>
+<div class="line"><a name="l06353"></a><span class="lineno"> 6353</span>&#160;        VkDeviceSize* pSumFreeSize,</div>
+<div class="line"><a name="l06354"></a><span class="lineno"> 6354</span>&#160;        VkDeviceSize* pSumItemSize) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06355"></a><span class="lineno"> 6355</span>&#160;    <span class="comment">// Given free suballocation, it merges it with following one, which must also be free.</span></div>
+<div class="line"><a name="l06356"></a><span class="lineno"> 6356</span>&#160;    <span class="keywordtype">void</span> MergeFreeWithNext(VmaSuballocationList::iterator item);</div>
+<div class="line"><a name="l06357"></a><span class="lineno"> 6357</span>&#160;    <span class="comment">// Releases given suballocation, making it free.</span></div>
+<div class="line"><a name="l06358"></a><span class="lineno"> 6358</span>&#160;    <span class="comment">// Merges it with adjacent free suballocations if applicable.</span></div>
+<div class="line"><a name="l06359"></a><span class="lineno"> 6359</span>&#160;    <span class="comment">// Returns iterator to new free suballocation at this place.</span></div>
+<div class="line"><a name="l06360"></a><span class="lineno"> 6360</span>&#160;    VmaSuballocationList::iterator FreeSuballocation(VmaSuballocationList::iterator suballocItem);</div>
+<div class="line"><a name="l06361"></a><span class="lineno"> 6361</span>&#160;    <span class="comment">// Given free suballocation, it inserts it into sorted list of</span></div>
+<div class="line"><a name="l06362"></a><span class="lineno"> 6362</span>&#160;    <span class="comment">// m_FreeSuballocationsBySize if it&#39;s suitable.</span></div>
+<div class="line"><a name="l06363"></a><span class="lineno"> 6363</span>&#160;    <span class="keywordtype">void</span> RegisterFreeSuballocation(VmaSuballocationList::iterator item);</div>
+<div class="line"><a name="l06364"></a><span class="lineno"> 6364</span>&#160;    <span class="comment">// Given free suballocation, it removes it from sorted list of</span></div>
+<div class="line"><a name="l06365"></a><span class="lineno"> 6365</span>&#160;    <span class="comment">// m_FreeSuballocationsBySize if it&#39;s suitable.</span></div>
+<div class="line"><a name="l06366"></a><span class="lineno"> 6366</span>&#160;    <span class="keywordtype">void</span> UnregisterFreeSuballocation(VmaSuballocationList::iterator item);</div>
+<div class="line"><a name="l06367"></a><span class="lineno"> 6367</span>&#160;};</div>
+<div class="line"><a name="l06368"></a><span class="lineno"> 6368</span>&#160; </div>
+<div class="line"><a name="l06369"></a><span class="lineno"> 6369</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l06370"></a><span class="lineno"> 6370</span>&#160;<span class="comment">Allocations and their references in internal data structure look like this:</span></div>
+<div class="line"><a name="l06371"></a><span class="lineno"> 6371</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l06372"></a><span class="lineno"> 6372</span>&#160;<span class="comment">if(m_2ndVectorMode == SECOND_VECTOR_EMPTY):</span></div>
+<div class="line"><a name="l06373"></a><span class="lineno"> 6373</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l06374"></a><span class="lineno"> 6374</span>&#160;<span class="comment">        0 +-------+</span></div>
+<div class="line"><a name="l06375"></a><span class="lineno"> 6375</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06376"></a><span class="lineno"> 6376</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06377"></a><span class="lineno"> 6377</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06378"></a><span class="lineno"> 6378</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06379"></a><span class="lineno"> 6379</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount]</span></div>
+<div class="line"><a name="l06380"></a><span class="lineno"> 6380</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06381"></a><span class="lineno"> 6381</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount + 1]</span></div>
+<div class="line"><a name="l06382"></a><span class="lineno"> 6382</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06383"></a><span class="lineno"> 6383</span>&#160;<span class="comment">          |  ...  |</span></div>
+<div class="line"><a name="l06384"></a><span class="lineno"> 6384</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06385"></a><span class="lineno"> 6385</span>&#160;<span class="comment">          | Alloc |  1st[1st.size() - 1]</span></div>
+<div class="line"><a name="l06386"></a><span class="lineno"> 6386</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06387"></a><span class="lineno"> 6387</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06388"></a><span class="lineno"> 6388</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06389"></a><span class="lineno"> 6389</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06390"></a><span class="lineno"> 6390</span>&#160;<span class="comment">GetSize() +-------+</span></div>
+<div class="line"><a name="l06391"></a><span class="lineno"> 6391</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l06392"></a><span class="lineno"> 6392</span>&#160;<span class="comment">if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER):</span></div>
+<div class="line"><a name="l06393"></a><span class="lineno"> 6393</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l06394"></a><span class="lineno"> 6394</span>&#160;<span class="comment">        0 +-------+</span></div>
+<div class="line"><a name="l06395"></a><span class="lineno"> 6395</span>&#160;<span class="comment">          | Alloc |  2nd[0]</span></div>
+<div class="line"><a name="l06396"></a><span class="lineno"> 6396</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06397"></a><span class="lineno"> 6397</span>&#160;<span class="comment">          | Alloc |  2nd[1]</span></div>
+<div class="line"><a name="l06398"></a><span class="lineno"> 6398</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06399"></a><span class="lineno"> 6399</span>&#160;<span class="comment">          |  ...  |</span></div>
+<div class="line"><a name="l06400"></a><span class="lineno"> 6400</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06401"></a><span class="lineno"> 6401</span>&#160;<span class="comment">          | Alloc |  2nd[2nd.size() - 1]</span></div>
+<div class="line"><a name="l06402"></a><span class="lineno"> 6402</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06403"></a><span class="lineno"> 6403</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06404"></a><span class="lineno"> 6404</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06405"></a><span class="lineno"> 6405</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06406"></a><span class="lineno"> 6406</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06407"></a><span class="lineno"> 6407</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount]</span></div>
+<div class="line"><a name="l06408"></a><span class="lineno"> 6408</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06409"></a><span class="lineno"> 6409</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount + 1]</span></div>
+<div class="line"><a name="l06410"></a><span class="lineno"> 6410</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06411"></a><span class="lineno"> 6411</span>&#160;<span class="comment">          |  ...  |</span></div>
+<div class="line"><a name="l06412"></a><span class="lineno"> 6412</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06413"></a><span class="lineno"> 6413</span>&#160;<span class="comment">          | Alloc |  1st[1st.size() - 1]</span></div>
+<div class="line"><a name="l06414"></a><span class="lineno"> 6414</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06415"></a><span class="lineno"> 6415</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06416"></a><span class="lineno"> 6416</span>&#160;<span class="comment">GetSize() +-------+</span></div>
+<div class="line"><a name="l06417"></a><span class="lineno"> 6417</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l06418"></a><span class="lineno"> 6418</span>&#160;<span class="comment">if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK):</span></div>
+<div class="line"><a name="l06419"></a><span class="lineno"> 6419</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l06420"></a><span class="lineno"> 6420</span>&#160;<span class="comment">        0 +-------+</span></div>
+<div class="line"><a name="l06421"></a><span class="lineno"> 6421</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06422"></a><span class="lineno"> 6422</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06423"></a><span class="lineno"> 6423</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06424"></a><span class="lineno"> 6424</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06425"></a><span class="lineno"> 6425</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount]</span></div>
+<div class="line"><a name="l06426"></a><span class="lineno"> 6426</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06427"></a><span class="lineno"> 6427</span>&#160;<span class="comment">          | Alloc |  1st[m_1stNullItemsBeginCount + 1]</span></div>
+<div class="line"><a name="l06428"></a><span class="lineno"> 6428</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06429"></a><span class="lineno"> 6429</span>&#160;<span class="comment">          |  ...  |</span></div>
+<div class="line"><a name="l06430"></a><span class="lineno"> 6430</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06431"></a><span class="lineno"> 6431</span>&#160;<span class="comment">          | Alloc |  1st[1st.size() - 1]</span></div>
+<div class="line"><a name="l06432"></a><span class="lineno"> 6432</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06433"></a><span class="lineno"> 6433</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06434"></a><span class="lineno"> 6434</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06435"></a><span class="lineno"> 6435</span>&#160;<span class="comment">          |       |</span></div>
+<div class="line"><a name="l06436"></a><span class="lineno"> 6436</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06437"></a><span class="lineno"> 6437</span>&#160;<span class="comment">          | Alloc |  2nd[2nd.size() - 1]</span></div>
+<div class="line"><a name="l06438"></a><span class="lineno"> 6438</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06439"></a><span class="lineno"> 6439</span>&#160;<span class="comment">          |  ...  |</span></div>
+<div class="line"><a name="l06440"></a><span class="lineno"> 6440</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06441"></a><span class="lineno"> 6441</span>&#160;<span class="comment">          | Alloc |  2nd[1]</span></div>
+<div class="line"><a name="l06442"></a><span class="lineno"> 6442</span>&#160;<span class="comment">          +-------+</span></div>
+<div class="line"><a name="l06443"></a><span class="lineno"> 6443</span>&#160;<span class="comment">          | Alloc |  2nd[0]</span></div>
+<div class="line"><a name="l06444"></a><span class="lineno"> 6444</span>&#160;<span class="comment">GetSize() +-------+</span></div>
+<div class="line"><a name="l06445"></a><span class="lineno"> 6445</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l06446"></a><span class="lineno"> 6446</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l06447"></a><span class="lineno"> 6447</span>&#160;<span class="keyword">class </span>VmaBlockMetadata_Linear : <span class="keyword">public</span> VmaBlockMetadata</div>
+<div class="line"><a name="l06448"></a><span class="lineno"> 6448</span>&#160;{</div>
+<div class="line"><a name="l06449"></a><span class="lineno"> 6449</span>&#160;    VMA_CLASS_NO_COPY(VmaBlockMetadata_Linear)</div>
+<div class="line"><a name="l06450"></a><span class="lineno"> 6450</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l06451"></a><span class="lineno"> 6451</span>&#160;    VmaBlockMetadata_Linear(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
+<div class="line"><a name="l06452"></a><span class="lineno"> 6452</span>&#160;    <span class="keyword">virtual</span> ~VmaBlockMetadata_Linear();</div>
+<div class="line"><a name="l06453"></a><span class="lineno"> 6453</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size);</div>
+<div class="line"><a name="l06454"></a><span class="lineno"> 6454</span>&#160; </div>
+<div class="line"><a name="l06455"></a><span class="lineno"> 6455</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06456"></a><span class="lineno"> 6456</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06457"></a><span class="lineno"> 6457</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_SumFreeSize; }</div>
+<div class="line"><a name="l06458"></a><span class="lineno"> 6458</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06459"></a><span class="lineno"> 6459</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> GetAllocationCount() == 0; }</div>
 <div class="line"><a name="l06460"></a><span class="lineno"> 6460</span>&#160; </div>
-<div class="line"><a name="l06461"></a><span class="lineno"> 6461</span>&#160;    Node* m_Root;</div>
-<div class="line"><a name="l06462"></a><span class="lineno"> 6462</span>&#160;    <span class="keyword">struct </span>{</div>
-<div class="line"><a name="l06463"></a><span class="lineno"> 6463</span>&#160;        Node* front;</div>
-<div class="line"><a name="l06464"></a><span class="lineno"> 6464</span>&#160;        Node* back;</div>
-<div class="line"><a name="l06465"></a><span class="lineno"> 6465</span>&#160;    } m_FreeList[MAX_LEVELS];</div>
-<div class="line"><a name="l06466"></a><span class="lineno"> 6466</span>&#160;    <span class="comment">// Number of nodes in the tree with type == TYPE_ALLOCATION.</span></div>
-<div class="line"><a name="l06467"></a><span class="lineno"> 6467</span>&#160;    <span class="keywordtype">size_t</span> m_AllocationCount;</div>
-<div class="line"><a name="l06468"></a><span class="lineno"> 6468</span>&#160;    <span class="comment">// Number of nodes in the tree with type == TYPE_FREE.</span></div>
-<div class="line"><a name="l06469"></a><span class="lineno"> 6469</span>&#160;    <span class="keywordtype">size_t</span> m_FreeCount;</div>
-<div class="line"><a name="l06470"></a><span class="lineno"> 6470</span>&#160;    <span class="comment">// This includes space wasted due to internal fragmentation. Doesn&#39;t include unusable size.</span></div>
-<div class="line"><a name="l06471"></a><span class="lineno"> 6471</span>&#160;    VkDeviceSize m_SumFreeSize;</div>
-<div class="line"><a name="l06472"></a><span class="lineno"> 6472</span>&#160; </div>
-<div class="line"><a name="l06473"></a><span class="lineno"> 6473</span>&#160;    VkDeviceSize GetUnusableSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> GetSize() - m_UsableSize; }</div>
-<div class="line"><a name="l06474"></a><span class="lineno"> 6474</span>&#160;    <span class="keywordtype">void</span> DeleteNode(Node* node);</div>
-<div class="line"><a name="l06475"></a><span class="lineno"> 6475</span>&#160;    <span class="keywordtype">bool</span> ValidateNode(ValidationContext&amp; ctx, <span class="keyword">const</span> Node* parent, <span class="keyword">const</span> Node* curr, uint32_t level, VkDeviceSize levelNodeSize) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06476"></a><span class="lineno"> 6476</span>&#160;    uint32_t AllocSizeToLevel(VkDeviceSize allocSize) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06477"></a><span class="lineno"> 6477</span>&#160;    <span class="keyword">inline</span> VkDeviceSize LevelToNodeSize(uint32_t level)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_UsableSize &gt;&gt; level; }</div>
-<div class="line"><a name="l06478"></a><span class="lineno"> 6478</span>&#160;    <span class="comment">// Alloc passed just for validation. Can be null.</span></div>
-<div class="line"><a name="l06479"></a><span class="lineno"> 6479</span>&#160;    <span class="keywordtype">void</span> FreeAtOffset(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc, VkDeviceSize offset);</div>
-<div class="line"><a name="l06480"></a><span class="lineno"> 6480</span>&#160;    <span class="keywordtype">void</span> CalcAllocationStatInfoNode(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo, <span class="keyword">const</span> Node* node, VkDeviceSize levelNodeSize) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06481"></a><span class="lineno"> 6481</span>&#160;    <span class="comment">// Adds node to the front of FreeList at given level.</span></div>
-<div class="line"><a name="l06482"></a><span class="lineno"> 6482</span>&#160;    <span class="comment">// node-&gt;type must be FREE.</span></div>
-<div class="line"><a name="l06483"></a><span class="lineno"> 6483</span>&#160;    <span class="comment">// node-&gt;free.prev, next can be undefined.</span></div>
-<div class="line"><a name="l06484"></a><span class="lineno"> 6484</span>&#160;    <span class="keywordtype">void</span> AddToFreeListFront(uint32_t level, Node* node);</div>
-<div class="line"><a name="l06485"></a><span class="lineno"> 6485</span>&#160;    <span class="comment">// Removes node from FreeList at given level.</span></div>
-<div class="line"><a name="l06486"></a><span class="lineno"> 6486</span>&#160;    <span class="comment">// node-&gt;type must be FREE.</span></div>
-<div class="line"><a name="l06487"></a><span class="lineno"> 6487</span>&#160;    <span class="comment">// node-&gt;free.prev, next stay untouched.</span></div>
-<div class="line"><a name="l06488"></a><span class="lineno"> 6488</span>&#160;    <span class="keywordtype">void</span> RemoveFromFreeList(uint32_t level, Node* node);</div>
-<div class="line"><a name="l06489"></a><span class="lineno"> 6489</span>&#160; </div>
-<div class="line"><a name="l06490"></a><span class="lineno"> 6490</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l06491"></a><span class="lineno"> 6491</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMapNode(<span class="keyword">class</span> VmaJsonWriter&amp; json, <span class="keyword">const</span> Node* node, VkDeviceSize levelNodeSize) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06492"></a><span class="lineno"> 6492</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l06493"></a><span class="lineno"> 6493</span>&#160;};</div>
+<div class="line"><a name="l06461"></a><span class="lineno"> 6461</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06462"></a><span class="lineno"> 6462</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06463"></a><span class="lineno"> 6463</span>&#160; </div>
+<div class="line"><a name="l06464"></a><span class="lineno"> 6464</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l06465"></a><span class="lineno"> 6465</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06466"></a><span class="lineno"> 6466</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l06467"></a><span class="lineno"> 6467</span>&#160; </div>
+<div class="line"><a name="l06468"></a><span class="lineno"> 6468</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
+<div class="line"><a name="l06469"></a><span class="lineno"> 6469</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06470"></a><span class="lineno"> 6470</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06471"></a><span class="lineno"> 6471</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l06472"></a><span class="lineno"> 6472</span>&#160;        VkDeviceSize allocSize,</div>
+<div class="line"><a name="l06473"></a><span class="lineno"> 6473</span>&#160;        VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l06474"></a><span class="lineno"> 6474</span>&#160;        <span class="keywordtype">bool</span> upperAddress,</div>
+<div class="line"><a name="l06475"></a><span class="lineno"> 6475</span>&#160;        VmaSuballocationType allocType,</div>
+<div class="line"><a name="l06476"></a><span class="lineno"> 6476</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l06477"></a><span class="lineno"> 6477</span>&#160;        uint32_t strategy,</div>
+<div class="line"><a name="l06478"></a><span class="lineno"> 6478</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
+<div class="line"><a name="l06479"></a><span class="lineno"> 6479</span>&#160; </div>
+<div class="line"><a name="l06480"></a><span class="lineno"> 6480</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
+<div class="line"><a name="l06481"></a><span class="lineno"> 6481</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06482"></a><span class="lineno"> 6482</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06483"></a><span class="lineno"> 6483</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
+<div class="line"><a name="l06484"></a><span class="lineno"> 6484</span>&#160; </div>
+<div class="line"><a name="l06485"></a><span class="lineno"> 6485</span>&#160;    <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
+<div class="line"><a name="l06486"></a><span class="lineno"> 6486</span>&#160; </div>
+<div class="line"><a name="l06487"></a><span class="lineno"> 6487</span>&#160;    <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData);</div>
+<div class="line"><a name="l06488"></a><span class="lineno"> 6488</span>&#160; </div>
+<div class="line"><a name="l06489"></a><span class="lineno"> 6489</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
+<div class="line"><a name="l06490"></a><span class="lineno"> 6490</span>&#160;        <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
+<div class="line"><a name="l06491"></a><span class="lineno"> 6491</span>&#160;        VmaSuballocationType type,</div>
+<div class="line"><a name="l06492"></a><span class="lineno"> 6492</span>&#160;        VkDeviceSize allocSize,</div>
+<div class="line"><a name="l06493"></a><span class="lineno"> 6493</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
 <div class="line"><a name="l06494"></a><span class="lineno"> 6494</span>&#160; </div>
-<div class="line"><a name="l06495"></a><span class="lineno"> 6495</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l06496"></a><span class="lineno"> 6496</span>&#160;<span class="comment">Represents a single block of device memory (`VkDeviceMemory`) with all the</span></div>
-<div class="line"><a name="l06497"></a><span class="lineno"> 6497</span>&#160;<span class="comment">data about its regions (aka suballocations, #VmaAllocation), assigned and free.</span></div>
-<div class="line"><a name="l06498"></a><span class="lineno"> 6498</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l06499"></a><span class="lineno"> 6499</span>&#160;<span class="comment">Thread-safety: This class must be externally synchronized.</span></div>
-<div class="line"><a name="l06500"></a><span class="lineno"> 6500</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l06501"></a><span class="lineno"> 6501</span>&#160;<span class="keyword">class </span>VmaDeviceMemoryBlock</div>
-<div class="line"><a name="l06502"></a><span class="lineno"> 6502</span>&#160;{</div>
-<div class="line"><a name="l06503"></a><span class="lineno"> 6503</span>&#160;    VMA_CLASS_NO_COPY(VmaDeviceMemoryBlock)</div>
-<div class="line"><a name="l06504"></a><span class="lineno"> 6504</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l06505"></a><span class="lineno"> 6505</span>&#160;    VmaBlockMetadata* m_pMetadata;</div>
-<div class="line"><a name="l06506"></a><span class="lineno"> 6506</span>&#160; </div>
-<div class="line"><a name="l06507"></a><span class="lineno"> 6507</span>&#160;    VmaDeviceMemoryBlock(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
-<div class="line"><a name="l06508"></a><span class="lineno"> 6508</span>&#160; </div>
-<div class="line"><a name="l06509"></a><span class="lineno"> 6509</span>&#160;    ~VmaDeviceMemoryBlock()</div>
-<div class="line"><a name="l06510"></a><span class="lineno"> 6510</span>&#160;    {</div>
-<div class="line"><a name="l06511"></a><span class="lineno"> 6511</span>&#160;        VMA_ASSERT(m_MapCount == 0 &amp;&amp; <span class="stringliteral">&quot;VkDeviceMemory block is being destroyed while it is still mapped.&quot;</span>);</div>
-<div class="line"><a name="l06512"></a><span class="lineno"> 6512</span>&#160;        VMA_ASSERT(m_hMemory == VK_NULL_HANDLE);</div>
-<div class="line"><a name="l06513"></a><span class="lineno"> 6513</span>&#160;    }</div>
-<div class="line"><a name="l06514"></a><span class="lineno"> 6514</span>&#160; </div>
-<div class="line"><a name="l06515"></a><span class="lineno"> 6515</span>&#160;    <span class="comment">// Always call after construction.</span></div>
-<div class="line"><a name="l06516"></a><span class="lineno"> 6516</span>&#160;    <span class="keywordtype">void</span> Init(</div>
-<div class="line"><a name="l06517"></a><span class="lineno"> 6517</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l06518"></a><span class="lineno"> 6518</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> hParentPool,</div>
-<div class="line"><a name="l06519"></a><span class="lineno"> 6519</span>&#160;        uint32_t newMemoryTypeIndex,</div>
-<div class="line"><a name="l06520"></a><span class="lineno"> 6520</span>&#160;        VkDeviceMemory newMemory,</div>
-<div class="line"><a name="l06521"></a><span class="lineno"> 6521</span>&#160;        VkDeviceSize newSize,</div>
-<div class="line"><a name="l06522"></a><span class="lineno"> 6522</span>&#160;        uint32_t <span class="keywordtype">id</span>,</div>
-<div class="line"><a name="l06523"></a><span class="lineno"> 6523</span>&#160;        uint32_t algorithm);</div>
-<div class="line"><a name="l06524"></a><span class="lineno"> 6524</span>&#160;    <span class="comment">// Always call before destruction.</span></div>
-<div class="line"><a name="l06525"></a><span class="lineno"> 6525</span>&#160;    <span class="keywordtype">void</span> Destroy(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator);</div>
-<div class="line"><a name="l06526"></a><span class="lineno"> 6526</span>&#160;    </div>
-<div class="line"><a name="l06527"></a><span class="lineno"> 6527</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> GetParentPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hParentPool; }</div>
-<div class="line"><a name="l06528"></a><span class="lineno"> 6528</span>&#160;    VkDeviceMemory GetDeviceMemory()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hMemory; }</div>
-<div class="line"><a name="l06529"></a><span class="lineno"> 6529</span>&#160;    uint32_t GetMemoryTypeIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemoryTypeIndex; }</div>
-<div class="line"><a name="l06530"></a><span class="lineno"> 6530</span>&#160;    uint32_t GetId()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Id; }</div>
-<div class="line"><a name="l06531"></a><span class="lineno"> 6531</span>&#160;    <span class="keywordtype">void</span>* GetMappedData()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pMappedData; }</div>
-<div class="line"><a name="l06532"></a><span class="lineno"> 6532</span>&#160; </div>
-<div class="line"><a name="l06533"></a><span class="lineno"> 6533</span>&#160;    <span class="comment">// Validates all data structures inside this object. If not valid, returns false.</span></div>
-<div class="line"><a name="l06534"></a><span class="lineno"> 6534</span>&#160;    <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06535"></a><span class="lineno"> 6535</span>&#160; </div>
-<div class="line"><a name="l06536"></a><span class="lineno"> 6536</span>&#160;    VkResult CheckCorruption(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
-<div class="line"><a name="l06537"></a><span class="lineno"> 6537</span>&#160; </div>
-<div class="line"><a name="l06538"></a><span class="lineno"> 6538</span>&#160;    <span class="comment">// ppData can be null.</span></div>
-<div class="line"><a name="l06539"></a><span class="lineno"> 6539</span>&#160;    VkResult Map(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, uint32_t count, <span class="keywordtype">void</span>** ppData);</div>
-<div class="line"><a name="l06540"></a><span class="lineno"> 6540</span>&#160;    <span class="keywordtype">void</span> Unmap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, uint32_t count);</div>
-<div class="line"><a name="l06541"></a><span class="lineno"> 6541</span>&#160; </div>
-<div class="line"><a name="l06542"></a><span class="lineno"> 6542</span>&#160;    VkResult WriteMagicValueAroundAllocation(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize);</div>
-<div class="line"><a name="l06543"></a><span class="lineno"> 6543</span>&#160;    VkResult ValidateMagicValueAroundAllocation(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize);</div>
-<div class="line"><a name="l06544"></a><span class="lineno"> 6544</span>&#160; </div>
-<div class="line"><a name="l06545"></a><span class="lineno"> 6545</span>&#160;    VkResult BindBufferMemory(</div>
-<div class="line"><a name="l06546"></a><span class="lineno"> 6546</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l06547"></a><span class="lineno"> 6547</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
-<div class="line"><a name="l06548"></a><span class="lineno"> 6548</span>&#160;        VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l06549"></a><span class="lineno"> 6549</span>&#160;        VkBuffer hBuffer,</div>
-<div class="line"><a name="l06550"></a><span class="lineno"> 6550</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
-<div class="line"><a name="l06551"></a><span class="lineno"> 6551</span>&#160;    VkResult BindImageMemory(</div>
-<div class="line"><a name="l06552"></a><span class="lineno"> 6552</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l06553"></a><span class="lineno"> 6553</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
-<div class="line"><a name="l06554"></a><span class="lineno"> 6554</span>&#160;        VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l06555"></a><span class="lineno"> 6555</span>&#160;        VkImage hImage,</div>
-<div class="line"><a name="l06556"></a><span class="lineno"> 6556</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
-<div class="line"><a name="l06557"></a><span class="lineno"> 6557</span>&#160; </div>
-<div class="line"><a name="l06558"></a><span class="lineno"> 6558</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l06559"></a><span class="lineno"> 6559</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> m_hParentPool; <span class="comment">// VK_NULL_HANDLE if not belongs to custom pool.</span></div>
-<div class="line"><a name="l06560"></a><span class="lineno"> 6560</span>&#160;    uint32_t m_MemoryTypeIndex;</div>
-<div class="line"><a name="l06561"></a><span class="lineno"> 6561</span>&#160;    uint32_t m_Id;</div>
-<div class="line"><a name="l06562"></a><span class="lineno"> 6562</span>&#160;    VkDeviceMemory m_hMemory;</div>
-<div class="line"><a name="l06563"></a><span class="lineno"> 6563</span>&#160; </div>
-<div class="line"><a name="l06564"></a><span class="lineno"> 6564</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l06565"></a><span class="lineno"> 6565</span>&#160;<span class="comment">    Protects access to m_hMemory so it&#39;s not used by multiple threads simultaneously, e.g. vkMapMemory, vkBindBufferMemory.</span></div>
-<div class="line"><a name="l06566"></a><span class="lineno"> 6566</span>&#160;<span class="comment">    Also protects m_MapCount, m_pMappedData.</span></div>
-<div class="line"><a name="l06567"></a><span class="lineno"> 6567</span>&#160;<span class="comment">    Allocations, deallocations, any change in m_pMetadata is protected by parent&#39;s VmaBlockVector::m_Mutex.</span></div>
-<div class="line"><a name="l06568"></a><span class="lineno"> 6568</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l06569"></a><span class="lineno"> 6569</span>&#160;    VMA_MUTEX m_Mutex;</div>
-<div class="line"><a name="l06570"></a><span class="lineno"> 6570</span>&#160;    uint32_t m_MapCount;</div>
-<div class="line"><a name="l06571"></a><span class="lineno"> 6571</span>&#160;    <span class="keywordtype">void</span>* m_pMappedData;</div>
-<div class="line"><a name="l06572"></a><span class="lineno"> 6572</span>&#160;};</div>
-<div class="line"><a name="l06573"></a><span class="lineno"> 6573</span>&#160; </div>
-<div class="line"><a name="l06574"></a><span class="lineno"> 6574</span>&#160;<span class="keyword">struct </span>VmaPointerLess</div>
-<div class="line"><a name="l06575"></a><span class="lineno"> 6575</span>&#160;{</div>
-<div class="line"><a name="l06576"></a><span class="lineno"> 6576</span>&#160;    <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> <span class="keywordtype">void</span>* lhs, <span class="keyword">const</span> <span class="keywordtype">void</span>* rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l06577"></a><span class="lineno"> 6577</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l06578"></a><span class="lineno"> 6578</span>&#160;        <span class="keywordflow">return</span> lhs &lt; rhs;</div>
-<div class="line"><a name="l06579"></a><span class="lineno"> 6579</span>&#160;    }</div>
-<div class="line"><a name="l06580"></a><span class="lineno"> 6580</span>&#160;};</div>
-<div class="line"><a name="l06581"></a><span class="lineno"> 6581</span>&#160; </div>
-<div class="line"><a name="l06582"></a><span class="lineno"> 6582</span>&#160;<span class="keyword">struct </span>VmaDefragmentationMove</div>
-<div class="line"><a name="l06583"></a><span class="lineno"> 6583</span>&#160;{</div>
-<div class="line"><a name="l06584"></a><span class="lineno"> 6584</span>&#160;    <span class="keywordtype">size_t</span> srcBlockIndex;</div>
-<div class="line"><a name="l06585"></a><span class="lineno"> 6585</span>&#160;    <span class="keywordtype">size_t</span> dstBlockIndex;</div>
-<div class="line"><a name="l06586"></a><span class="lineno"> 6586</span>&#160;    VkDeviceSize srcOffset;</div>
-<div class="line"><a name="l06587"></a><span class="lineno"> 6587</span>&#160;    VkDeviceSize dstOffset;</div>
-<div class="line"><a name="l06588"></a><span class="lineno"> 6588</span>&#160;    VkDeviceSize size;</div>
-<div class="line"><a name="l06589"></a><span class="lineno"> 6589</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation;</div>
-<div class="line"><a name="l06590"></a><span class="lineno"> 6590</span>&#160;    VmaDeviceMemoryBlock* pSrcBlock;</div>
-<div class="line"><a name="l06591"></a><span class="lineno"> 6591</span>&#160;    VmaDeviceMemoryBlock* pDstBlock;</div>
-<div class="line"><a name="l06592"></a><span class="lineno"> 6592</span>&#160;};</div>
+<div class="line"><a name="l06495"></a><span class="lineno"> 6495</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l06496"></a><span class="lineno"> 6496</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset);</div>
+<div class="line"><a name="l06497"></a><span class="lineno"> 6497</span>&#160; </div>
+<div class="line"><a name="l06498"></a><span class="lineno"> 6498</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l06499"></a><span class="lineno"> 6499</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l06500"></a><span class="lineno"> 6500</span>&#160;<span class="comment">    There are two suballocation vectors, used in ping-pong way.</span></div>
+<div class="line"><a name="l06501"></a><span class="lineno"> 6501</span>&#160;<span class="comment">    The one with index m_1stVectorIndex is called 1st.</span></div>
+<div class="line"><a name="l06502"></a><span class="lineno"> 6502</span>&#160;<span class="comment">    The one with index (m_1stVectorIndex ^ 1) is called 2nd.</span></div>
+<div class="line"><a name="l06503"></a><span class="lineno"> 6503</span>&#160;<span class="comment">    2nd can be non-empty only when 1st is not empty.</span></div>
+<div class="line"><a name="l06504"></a><span class="lineno"> 6504</span>&#160;<span class="comment">    When 2nd is not empty, m_2ndVectorMode indicates its mode of operation.</span></div>
+<div class="line"><a name="l06505"></a><span class="lineno"> 6505</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l06506"></a><span class="lineno"> 6506</span>&#160;    <span class="keyword">typedef</span> VmaVector&lt; VmaSuballocation, VmaStlAllocator&lt;VmaSuballocation&gt; &gt; SuballocationVectorType;</div>
+<div class="line"><a name="l06507"></a><span class="lineno"> 6507</span>&#160; </div>
+<div class="line"><a name="l06508"></a><span class="lineno"> 6508</span>&#160;    <span class="keyword">enum</span> SECOND_VECTOR_MODE</div>
+<div class="line"><a name="l06509"></a><span class="lineno"> 6509</span>&#160;    {</div>
+<div class="line"><a name="l06510"></a><span class="lineno"> 6510</span>&#160;        SECOND_VECTOR_EMPTY,</div>
+<div class="line"><a name="l06511"></a><span class="lineno"> 6511</span>&#160;        <span class="comment">/*</span></div>
+<div class="line"><a name="l06512"></a><span class="lineno"> 6512</span>&#160;<span class="comment">        Suballocations in 2nd vector are created later than the ones in 1st, but they</span></div>
+<div class="line"><a name="l06513"></a><span class="lineno"> 6513</span>&#160;<span class="comment">        all have smaller offset.</span></div>
+<div class="line"><a name="l06514"></a><span class="lineno"> 6514</span>&#160;<span class="comment">        */</span></div>
+<div class="line"><a name="l06515"></a><span class="lineno"> 6515</span>&#160;        SECOND_VECTOR_RING_BUFFER,</div>
+<div class="line"><a name="l06516"></a><span class="lineno"> 6516</span>&#160;        <span class="comment">/*</span></div>
+<div class="line"><a name="l06517"></a><span class="lineno"> 6517</span>&#160;<span class="comment">        Suballocations in 2nd vector are upper side of double stack.</span></div>
+<div class="line"><a name="l06518"></a><span class="lineno"> 6518</span>&#160;<span class="comment">        They all have offsets higher than those in 1st vector.</span></div>
+<div class="line"><a name="l06519"></a><span class="lineno"> 6519</span>&#160;<span class="comment">        Top of this stack means smaller offsets, but higher indices in this vector.</span></div>
+<div class="line"><a name="l06520"></a><span class="lineno"> 6520</span>&#160;<span class="comment">        */</span></div>
+<div class="line"><a name="l06521"></a><span class="lineno"> 6521</span>&#160;        SECOND_VECTOR_DOUBLE_STACK,</div>
+<div class="line"><a name="l06522"></a><span class="lineno"> 6522</span>&#160;    };</div>
+<div class="line"><a name="l06523"></a><span class="lineno"> 6523</span>&#160; </div>
+<div class="line"><a name="l06524"></a><span class="lineno"> 6524</span>&#160;    VkDeviceSize m_SumFreeSize;</div>
+<div class="line"><a name="l06525"></a><span class="lineno"> 6525</span>&#160;    SuballocationVectorType m_Suballocations0, m_Suballocations1;</div>
+<div class="line"><a name="l06526"></a><span class="lineno"> 6526</span>&#160;    uint32_t m_1stVectorIndex;</div>
+<div class="line"><a name="l06527"></a><span class="lineno"> 6527</span>&#160;    SECOND_VECTOR_MODE m_2ndVectorMode;</div>
+<div class="line"><a name="l06528"></a><span class="lineno"> 6528</span>&#160; </div>
+<div class="line"><a name="l06529"></a><span class="lineno"> 6529</span>&#160;    SuballocationVectorType&amp; AccessSuballocations1st() { <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations1 : m_Suballocations0; }</div>
+<div class="line"><a name="l06530"></a><span class="lineno"> 6530</span>&#160;    SuballocationVectorType&amp; AccessSuballocations2nd() { <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations0 : m_Suballocations1; }</div>
+<div class="line"><a name="l06531"></a><span class="lineno"> 6531</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; AccessSuballocations1st()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations1 : m_Suballocations0; }</div>
+<div class="line"><a name="l06532"></a><span class="lineno"> 6532</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; AccessSuballocations2nd()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations0 : m_Suballocations1; }</div>
+<div class="line"><a name="l06533"></a><span class="lineno"> 6533</span>&#160;    </div>
+<div class="line"><a name="l06534"></a><span class="lineno"> 6534</span>&#160;    <span class="comment">// Number of items in 1st vector with hAllocation = null at the beginning.</span></div>
+<div class="line"><a name="l06535"></a><span class="lineno"> 6535</span>&#160;    <span class="keywordtype">size_t</span> m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l06536"></a><span class="lineno"> 6536</span>&#160;    <span class="comment">// Number of other items in 1st vector with hAllocation = null somewhere in the middle.</span></div>
+<div class="line"><a name="l06537"></a><span class="lineno"> 6537</span>&#160;    <span class="keywordtype">size_t</span> m_1stNullItemsMiddleCount;</div>
+<div class="line"><a name="l06538"></a><span class="lineno"> 6538</span>&#160;    <span class="comment">// Number of items in 2nd vector with hAllocation = null.</span></div>
+<div class="line"><a name="l06539"></a><span class="lineno"> 6539</span>&#160;    <span class="keywordtype">size_t</span> m_2ndNullItemsCount;</div>
+<div class="line"><a name="l06540"></a><span class="lineno"> 6540</span>&#160; </div>
+<div class="line"><a name="l06541"></a><span class="lineno"> 6541</span>&#160;    <span class="keywordtype">bool</span> ShouldCompact1st() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06542"></a><span class="lineno"> 6542</span>&#160;    <span class="keywordtype">void</span> CleanupAfterFree();</div>
+<div class="line"><a name="l06543"></a><span class="lineno"> 6543</span>&#160; </div>
+<div class="line"><a name="l06544"></a><span class="lineno"> 6544</span>&#160;    <span class="keywordtype">bool</span> CreateAllocationRequest_LowerAddress(</div>
+<div class="line"><a name="l06545"></a><span class="lineno"> 6545</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06546"></a><span class="lineno"> 6546</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06547"></a><span class="lineno"> 6547</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l06548"></a><span class="lineno"> 6548</span>&#160;        VkDeviceSize allocSize,</div>
+<div class="line"><a name="l06549"></a><span class="lineno"> 6549</span>&#160;        VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l06550"></a><span class="lineno"> 6550</span>&#160;        VmaSuballocationType allocType,</div>
+<div class="line"><a name="l06551"></a><span class="lineno"> 6551</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l06552"></a><span class="lineno"> 6552</span>&#160;        uint32_t strategy,</div>
+<div class="line"><a name="l06553"></a><span class="lineno"> 6553</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
+<div class="line"><a name="l06554"></a><span class="lineno"> 6554</span>&#160;    <span class="keywordtype">bool</span> CreateAllocationRequest_UpperAddress(</div>
+<div class="line"><a name="l06555"></a><span class="lineno"> 6555</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06556"></a><span class="lineno"> 6556</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06557"></a><span class="lineno"> 6557</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l06558"></a><span class="lineno"> 6558</span>&#160;        VkDeviceSize allocSize,</div>
+<div class="line"><a name="l06559"></a><span class="lineno"> 6559</span>&#160;        VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l06560"></a><span class="lineno"> 6560</span>&#160;        VmaSuballocationType allocType,</div>
+<div class="line"><a name="l06561"></a><span class="lineno"> 6561</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l06562"></a><span class="lineno"> 6562</span>&#160;        uint32_t strategy,</div>
+<div class="line"><a name="l06563"></a><span class="lineno"> 6563</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
+<div class="line"><a name="l06564"></a><span class="lineno"> 6564</span>&#160;};</div>
+<div class="line"><a name="l06565"></a><span class="lineno"> 6565</span>&#160; </div>
+<div class="line"><a name="l06566"></a><span class="lineno"> 6566</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l06567"></a><span class="lineno"> 6567</span>&#160;<span class="comment">- GetSize() is the original size of allocated memory block.</span></div>
+<div class="line"><a name="l06568"></a><span class="lineno"> 6568</span>&#160;<span class="comment">- m_UsableSize is this size aligned down to a power of two.</span></div>
+<div class="line"><a name="l06569"></a><span class="lineno"> 6569</span>&#160;<span class="comment">  All allocations and calculations happen relative to m_UsableSize.</span></div>
+<div class="line"><a name="l06570"></a><span class="lineno"> 6570</span>&#160;<span class="comment">- GetUnusableSize() is the difference between them.</span></div>
+<div class="line"><a name="l06571"></a><span class="lineno"> 6571</span>&#160;<span class="comment">  It is repoted as separate, unused range, not available for allocations.</span></div>
+<div class="line"><a name="l06572"></a><span class="lineno"> 6572</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l06573"></a><span class="lineno"> 6573</span>&#160;<span class="comment">Node at level 0 has size = m_UsableSize.</span></div>
+<div class="line"><a name="l06574"></a><span class="lineno"> 6574</span>&#160;<span class="comment">Each next level contains nodes with size 2 times smaller than current level.</span></div>
+<div class="line"><a name="l06575"></a><span class="lineno"> 6575</span>&#160;<span class="comment">m_LevelCount is the maximum number of levels to use in the current object.</span></div>
+<div class="line"><a name="l06576"></a><span class="lineno"> 6576</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l06577"></a><span class="lineno"> 6577</span>&#160;<span class="keyword">class </span>VmaBlockMetadata_Buddy : <span class="keyword">public</span> VmaBlockMetadata</div>
+<div class="line"><a name="l06578"></a><span class="lineno"> 6578</span>&#160;{</div>
+<div class="line"><a name="l06579"></a><span class="lineno"> 6579</span>&#160;    VMA_CLASS_NO_COPY(VmaBlockMetadata_Buddy)</div>
+<div class="line"><a name="l06580"></a><span class="lineno"> 6580</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l06581"></a><span class="lineno"> 6581</span>&#160;    VmaBlockMetadata_Buddy(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
+<div class="line"><a name="l06582"></a><span class="lineno"> 6582</span>&#160;    <span class="keyword">virtual</span> ~VmaBlockMetadata_Buddy();</div>
+<div class="line"><a name="l06583"></a><span class="lineno"> 6583</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size);</div>
+<div class="line"><a name="l06584"></a><span class="lineno"> 6584</span>&#160; </div>
+<div class="line"><a name="l06585"></a><span class="lineno"> 6585</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06586"></a><span class="lineno"> 6586</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_AllocationCount; }</div>
+<div class="line"><a name="l06587"></a><span class="lineno"> 6587</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_SumFreeSize + GetUnusableSize(); }</div>
+<div class="line"><a name="l06588"></a><span class="lineno"> 6588</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06589"></a><span class="lineno"> 6589</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Root-&gt;type == Node::TYPE_FREE; }</div>
+<div class="line"><a name="l06590"></a><span class="lineno"> 6590</span>&#160; </div>
+<div class="line"><a name="l06591"></a><span class="lineno"> 6591</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06592"></a><span class="lineno"> 6592</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span>;</div>
 <div class="line"><a name="l06593"></a><span class="lineno"> 6593</span>&#160; </div>
-<div class="line"><a name="l06594"></a><span class="lineno"> 6594</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm;</div>
-<div class="line"><a name="l06595"></a><span class="lineno"> 6595</span>&#160; </div>
-<div class="line"><a name="l06596"></a><span class="lineno"> 6596</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l06597"></a><span class="lineno"> 6597</span>&#160;<span class="comment">Sequence of VmaDeviceMemoryBlock. Represents memory blocks allocated for a specific</span></div>
-<div class="line"><a name="l06598"></a><span class="lineno"> 6598</span>&#160;<span class="comment">Vulkan memory type.</span></div>
-<div class="line"><a name="l06599"></a><span class="lineno"> 6599</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l06600"></a><span class="lineno"> 6600</span>&#160;<span class="comment">Synchronized internally with a mutex.</span></div>
-<div class="line"><a name="l06601"></a><span class="lineno"> 6601</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l06602"></a><span class="lineno"> 6602</span>&#160;<span class="keyword">struct </span>VmaBlockVector</div>
-<div class="line"><a name="l06603"></a><span class="lineno"> 6603</span>&#160;{</div>
-<div class="line"><a name="l06604"></a><span class="lineno"> 6604</span>&#160;    VMA_CLASS_NO_COPY(VmaBlockVector)</div>
-<div class="line"><a name="l06605"></a><span class="lineno"> 6605</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l06606"></a><span class="lineno"> 6606</span>&#160;    VmaBlockVector(</div>
-<div class="line"><a name="l06607"></a><span class="lineno"> 6607</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l06608"></a><span class="lineno"> 6608</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> hParentPool,</div>
-<div class="line"><a name="l06609"></a><span class="lineno"> 6609</span>&#160;        uint32_t memoryTypeIndex,</div>
-<div class="line"><a name="l06610"></a><span class="lineno"> 6610</span>&#160;        VkDeviceSize preferredBlockSize,</div>
-<div class="line"><a name="l06611"></a><span class="lineno"> 6611</span>&#160;        <span class="keywordtype">size_t</span> minBlockCount,</div>
-<div class="line"><a name="l06612"></a><span class="lineno"> 6612</span>&#160;        <span class="keywordtype">size_t</span> maxBlockCount,</div>
-<div class="line"><a name="l06613"></a><span class="lineno"> 6613</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l06614"></a><span class="lineno"> 6614</span>&#160;        uint32_t frameInUseCount,</div>
-<div class="line"><a name="l06615"></a><span class="lineno"> 6615</span>&#160;        <span class="keywordtype">bool</span> explicitBlockSize,</div>
-<div class="line"><a name="l06616"></a><span class="lineno"> 6616</span>&#160;        uint32_t algorithm);</div>
-<div class="line"><a name="l06617"></a><span class="lineno"> 6617</span>&#160;    ~VmaBlockVector();</div>
+<div class="line"><a name="l06594"></a><span class="lineno"> 6594</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l06595"></a><span class="lineno"> 6595</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06596"></a><span class="lineno"> 6596</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l06597"></a><span class="lineno"> 6597</span>&#160; </div>
+<div class="line"><a name="l06598"></a><span class="lineno"> 6598</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
+<div class="line"><a name="l06599"></a><span class="lineno"> 6599</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06600"></a><span class="lineno"> 6600</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06601"></a><span class="lineno"> 6601</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l06602"></a><span class="lineno"> 6602</span>&#160;        VkDeviceSize allocSize,</div>
+<div class="line"><a name="l06603"></a><span class="lineno"> 6603</span>&#160;        VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l06604"></a><span class="lineno"> 6604</span>&#160;        <span class="keywordtype">bool</span> upperAddress,</div>
+<div class="line"><a name="l06605"></a><span class="lineno"> 6605</span>&#160;        VmaSuballocationType allocType,</div>
+<div class="line"><a name="l06606"></a><span class="lineno"> 6606</span>&#160;        <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l06607"></a><span class="lineno"> 6607</span>&#160;        uint32_t strategy,</div>
+<div class="line"><a name="l06608"></a><span class="lineno"> 6608</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
+<div class="line"><a name="l06609"></a><span class="lineno"> 6609</span>&#160; </div>
+<div class="line"><a name="l06610"></a><span class="lineno"> 6610</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
+<div class="line"><a name="l06611"></a><span class="lineno"> 6611</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06612"></a><span class="lineno"> 6612</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06613"></a><span class="lineno"> 6613</span>&#160;        VmaAllocationRequest* pAllocationRequest);</div>
+<div class="line"><a name="l06614"></a><span class="lineno"> 6614</span>&#160; </div>
+<div class="line"><a name="l06615"></a><span class="lineno"> 6615</span>&#160;    <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
+<div class="line"><a name="l06616"></a><span class="lineno"> 6616</span>&#160; </div>
+<div class="line"><a name="l06617"></a><span class="lineno"> 6617</span>&#160;    <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData) { <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT; }</div>
 <div class="line"><a name="l06618"></a><span class="lineno"> 6618</span>&#160; </div>
-<div class="line"><a name="l06619"></a><span class="lineno"> 6619</span>&#160;    VkResult CreateMinBlocks();</div>
-<div class="line"><a name="l06620"></a><span class="lineno"> 6620</span>&#160; </div>
-<div class="line"><a name="l06621"></a><span class="lineno"> 6621</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> GetAllocator()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hAllocator; }</div>
-<div class="line"><a name="l06622"></a><span class="lineno"> 6622</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> GetParentPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hParentPool; }</div>
-<div class="line"><a name="l06623"></a><span class="lineno"> 6623</span>&#160;    <span class="keywordtype">bool</span> IsCustomPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hParentPool != VMA_NULL; }</div>
-<div class="line"><a name="l06624"></a><span class="lineno"> 6624</span>&#160;    uint32_t GetMemoryTypeIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemoryTypeIndex; }</div>
-<div class="line"><a name="l06625"></a><span class="lineno"> 6625</span>&#160;    VkDeviceSize GetPreferredBlockSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_PreferredBlockSize; }</div>
-<div class="line"><a name="l06626"></a><span class="lineno"> 6626</span>&#160;    VkDeviceSize GetBufferImageGranularity()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BufferImageGranularity; }</div>
-<div class="line"><a name="l06627"></a><span class="lineno"> 6627</span>&#160;    uint32_t GetFrameInUseCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_FrameInUseCount; }</div>
-<div class="line"><a name="l06628"></a><span class="lineno"> 6628</span>&#160;    uint32_t GetAlgorithm()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Algorithm; }</div>
-<div class="line"><a name="l06629"></a><span class="lineno"> 6629</span>&#160; </div>
-<div class="line"><a name="l06630"></a><span class="lineno"> 6630</span>&#160;    <span class="keywordtype">void</span> GetPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pStats);</div>
+<div class="line"><a name="l06619"></a><span class="lineno"> 6619</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
+<div class="line"><a name="l06620"></a><span class="lineno"> 6620</span>&#160;        <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
+<div class="line"><a name="l06621"></a><span class="lineno"> 6621</span>&#160;        VmaSuballocationType type,</div>
+<div class="line"><a name="l06622"></a><span class="lineno"> 6622</span>&#160;        VkDeviceSize allocSize,</div>
+<div class="line"><a name="l06623"></a><span class="lineno"> 6623</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
+<div class="line"><a name="l06624"></a><span class="lineno"> 6624</span>&#160; </div>
+<div class="line"><a name="l06625"></a><span class="lineno"> 6625</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation) { FreeAtOffset(allocation, allocation-&gt;GetOffset()); }</div>
+<div class="line"><a name="l06626"></a><span class="lineno"> 6626</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset) { FreeAtOffset(VMA_NULL, offset); }</div>
+<div class="line"><a name="l06627"></a><span class="lineno"> 6627</span>&#160; </div>
+<div class="line"><a name="l06628"></a><span class="lineno"> 6628</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l06629"></a><span class="lineno"> 6629</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> VkDeviceSize MIN_NODE_SIZE = 32;</div>
+<div class="line"><a name="l06630"></a><span class="lineno"> 6630</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> MAX_LEVELS = 30;</div>
 <div class="line"><a name="l06631"></a><span class="lineno"> 6631</span>&#160; </div>
-<div class="line"><a name="l06632"></a><span class="lineno"> 6632</span>&#160;    <span class="keywordtype">bool</span> IsEmpty();</div>
-<div class="line"><a name="l06633"></a><span class="lineno"> 6633</span>&#160;    <span class="keywordtype">bool</span> IsCorruptionDetectionEnabled() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06634"></a><span class="lineno"> 6634</span>&#160; </div>
-<div class="line"><a name="l06635"></a><span class="lineno"> 6635</span>&#160;    VkResult Allocate(</div>
-<div class="line"><a name="l06636"></a><span class="lineno"> 6636</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06637"></a><span class="lineno"> 6637</span>&#160;        VkDeviceSize size,</div>
-<div class="line"><a name="l06638"></a><span class="lineno"> 6638</span>&#160;        VkDeviceSize alignment,</div>
-<div class="line"><a name="l06639"></a><span class="lineno"> 6639</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l06640"></a><span class="lineno"> 6640</span>&#160;        VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l06641"></a><span class="lineno"> 6641</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l06642"></a><span class="lineno"> 6642</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
+<div class="line"><a name="l06632"></a><span class="lineno"> 6632</span>&#160;    <span class="keyword">struct </span>ValidationContext</div>
+<div class="line"><a name="l06633"></a><span class="lineno"> 6633</span>&#160;    {</div>
+<div class="line"><a name="l06634"></a><span class="lineno"> 6634</span>&#160;        <span class="keywordtype">size_t</span> calculatedAllocationCount;</div>
+<div class="line"><a name="l06635"></a><span class="lineno"> 6635</span>&#160;        <span class="keywordtype">size_t</span> calculatedFreeCount;</div>
+<div class="line"><a name="l06636"></a><span class="lineno"> 6636</span>&#160;        VkDeviceSize calculatedSumFreeSize;</div>
+<div class="line"><a name="l06637"></a><span class="lineno"> 6637</span>&#160; </div>
+<div class="line"><a name="l06638"></a><span class="lineno"> 6638</span>&#160;        ValidationContext() :</div>
+<div class="line"><a name="l06639"></a><span class="lineno"> 6639</span>&#160;            calculatedAllocationCount(0),</div>
+<div class="line"><a name="l06640"></a><span class="lineno"> 6640</span>&#160;            calculatedFreeCount(0),</div>
+<div class="line"><a name="l06641"></a><span class="lineno"> 6641</span>&#160;            calculatedSumFreeSize(0) { }</div>
+<div class="line"><a name="l06642"></a><span class="lineno"> 6642</span>&#160;    };</div>
 <div class="line"><a name="l06643"></a><span class="lineno"> 6643</span>&#160; </div>
-<div class="line"><a name="l06644"></a><span class="lineno"> 6644</span>&#160;    <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
-<div class="line"><a name="l06645"></a><span class="lineno"> 6645</span>&#160; </div>
-<div class="line"><a name="l06646"></a><span class="lineno"> 6646</span>&#160;    <span class="comment">// Adds statistics of this BlockVector to pStats.</span></div>
-<div class="line"><a name="l06647"></a><span class="lineno"> 6647</span>&#160;    <span class="keywordtype">void</span> AddStats(<a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats);</div>
-<div class="line"><a name="l06648"></a><span class="lineno"> 6648</span>&#160; </div>
-<div class="line"><a name="l06649"></a><span class="lineno"> 6649</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l06650"></a><span class="lineno"> 6650</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json);</div>
-<div class="line"><a name="l06651"></a><span class="lineno"> 6651</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l06652"></a><span class="lineno"> 6652</span>&#160; </div>
-<div class="line"><a name="l06653"></a><span class="lineno"> 6653</span>&#160;    <span class="keywordtype">void</span> MakePoolAllocationsLost(</div>
-<div class="line"><a name="l06654"></a><span class="lineno"> 6654</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06655"></a><span class="lineno"> 6655</span>&#160;        <span class="keywordtype">size_t</span>* pLostAllocationCount);</div>
-<div class="line"><a name="l06656"></a><span class="lineno"> 6656</span>&#160;    VkResult CheckCorruption();</div>
-<div class="line"><a name="l06657"></a><span class="lineno"> 6657</span>&#160; </div>
-<div class="line"><a name="l06658"></a><span class="lineno"> 6658</span>&#160;    <span class="comment">// Saves results in pCtx-&gt;res.</span></div>
-<div class="line"><a name="l06659"></a><span class="lineno"> 6659</span>&#160;    <span class="keywordtype">void</span> Defragment(</div>
-<div class="line"><a name="l06660"></a><span class="lineno"> 6660</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pCtx,</div>
-<div class="line"><a name="l06661"></a><span class="lineno"> 6661</span>&#160;        <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags,</div>
-<div class="line"><a name="l06662"></a><span class="lineno"> 6662</span>&#160;        VkDeviceSize&amp; maxCpuBytesToMove, uint32_t&amp; maxCpuAllocationsToMove,</div>
-<div class="line"><a name="l06663"></a><span class="lineno"> 6663</span>&#160;        VkDeviceSize&amp; maxGpuBytesToMove, uint32_t&amp; maxGpuAllocationsToMove,</div>
-<div class="line"><a name="l06664"></a><span class="lineno"> 6664</span>&#160;        VkCommandBuffer commandBuffer);</div>
-<div class="line"><a name="l06665"></a><span class="lineno"> 6665</span>&#160;    <span class="keywordtype">void</span> DefragmentationEnd(</div>
-<div class="line"><a name="l06666"></a><span class="lineno"> 6666</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pCtx,</div>
-<div class="line"><a name="l06667"></a><span class="lineno"> 6667</span>&#160;        uint32_t flags,</div>
-<div class="line"><a name="l06668"></a><span class="lineno"> 6668</span>&#160;        <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats);</div>
-<div class="line"><a name="l06669"></a><span class="lineno"> 6669</span>&#160; </div>
-<div class="line"><a name="l06670"></a><span class="lineno"> 6670</span>&#160;    uint32_t ProcessDefragmentations(</div>
-<div class="line"><a name="l06671"></a><span class="lineno"> 6671</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext *pCtx,</div>
-<div class="line"><a name="l06672"></a><span class="lineno"> 6672</span>&#160;        <a class="code" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a>* pMove, uint32_t maxMoves);</div>
-<div class="line"><a name="l06673"></a><span class="lineno"> 6673</span>&#160; </div>
-<div class="line"><a name="l06674"></a><span class="lineno"> 6674</span>&#160;    <span class="keywordtype">void</span> CommitDefragmentations(</div>
-<div class="line"><a name="l06675"></a><span class="lineno"> 6675</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext *pCtx,</div>
-<div class="line"><a name="l06676"></a><span class="lineno"> 6676</span>&#160;        <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats);</div>
-<div class="line"><a name="l06677"></a><span class="lineno"> 6677</span>&#160; </div>
-<div class="line"><a name="l06679"></a><span class="lineno"> 6679</span>&#160;    <span class="comment">// To be used only while the m_Mutex is locked. Used during defragmentation.</span></div>
-<div class="line"><a name="l06680"></a><span class="lineno"> 6680</span>&#160; </div>
-<div class="line"><a name="l06681"></a><span class="lineno"> 6681</span>&#160;    <span class="keywordtype">size_t</span> GetBlockCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Blocks.size(); }</div>
-<div class="line"><a name="l06682"></a><span class="lineno"> 6682</span>&#160;    VmaDeviceMemoryBlock* GetBlock(<span class="keywordtype">size_t</span> index)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Blocks[index]; }</div>
-<div class="line"><a name="l06683"></a><span class="lineno"> 6683</span>&#160;    <span class="keywordtype">size_t</span> CalcAllocationCount() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06684"></a><span class="lineno"> 6684</span>&#160;    <span class="keywordtype">bool</span> IsBufferImageGranularityConflictPossible() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06685"></a><span class="lineno"> 6685</span>&#160; </div>
-<div class="line"><a name="l06686"></a><span class="lineno"> 6686</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l06687"></a><span class="lineno"> 6687</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span>VmaDefragmentationAlgorithm_Generic;</div>
-<div class="line"><a name="l06688"></a><span class="lineno"> 6688</span>&#160; </div>
-<div class="line"><a name="l06689"></a><span class="lineno"> 6689</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> m_hAllocator;</div>
-<div class="line"><a name="l06690"></a><span class="lineno"> 6690</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a> m_hParentPool;</div>
-<div class="line"><a name="l06691"></a><span class="lineno"> 6691</span>&#160;    <span class="keyword">const</span> uint32_t m_MemoryTypeIndex;</div>
-<div class="line"><a name="l06692"></a><span class="lineno"> 6692</span>&#160;    <span class="keyword">const</span> VkDeviceSize m_PreferredBlockSize;</div>
-<div class="line"><a name="l06693"></a><span class="lineno"> 6693</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> m_MinBlockCount;</div>
-<div class="line"><a name="l06694"></a><span class="lineno"> 6694</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> m_MaxBlockCount;</div>
-<div class="line"><a name="l06695"></a><span class="lineno"> 6695</span>&#160;    <span class="keyword">const</span> VkDeviceSize m_BufferImageGranularity;</div>
-<div class="line"><a name="l06696"></a><span class="lineno"> 6696</span>&#160;    <span class="keyword">const</span> uint32_t m_FrameInUseCount;</div>
-<div class="line"><a name="l06697"></a><span class="lineno"> 6697</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> m_ExplicitBlockSize;</div>
-<div class="line"><a name="l06698"></a><span class="lineno"> 6698</span>&#160;    <span class="keyword">const</span> uint32_t m_Algorithm;</div>
-<div class="line"><a name="l06699"></a><span class="lineno"> 6699</span>&#160;    VMA_RW_MUTEX m_Mutex;</div>
-<div class="line"><a name="l06700"></a><span class="lineno"> 6700</span>&#160; </div>
-<div class="line"><a name="l06701"></a><span class="lineno"> 6701</span>&#160;    <span class="comment">/* There can be at most one allocation that is completely empty (except when minBlockCount &gt; 0) -</span></div>
-<div class="line"><a name="l06702"></a><span class="lineno"> 6702</span>&#160;<span class="comment">    a hysteresis to avoid pessimistic case of alternating creation and destruction of a VkDeviceMemory. */</span></div>
-<div class="line"><a name="l06703"></a><span class="lineno"> 6703</span>&#160;    <span class="keywordtype">bool</span> m_HasEmptyBlock;</div>
-<div class="line"><a name="l06704"></a><span class="lineno"> 6704</span>&#160;    <span class="comment">// Incrementally sorted by sumFreeSize, ascending.</span></div>
-<div class="line"><a name="l06705"></a><span class="lineno"> 6705</span>&#160;    VmaVector&lt; VmaDeviceMemoryBlock*, VmaStlAllocator&lt;VmaDeviceMemoryBlock*&gt; &gt; m_Blocks;</div>
-<div class="line"><a name="l06706"></a><span class="lineno"> 6706</span>&#160;    uint32_t m_NextBlockId;</div>
+<div class="line"><a name="l06644"></a><span class="lineno"> 6644</span>&#160;    <span class="keyword">struct </span>Node</div>
+<div class="line"><a name="l06645"></a><span class="lineno"> 6645</span>&#160;    {</div>
+<div class="line"><a name="l06646"></a><span class="lineno"> 6646</span>&#160;        VkDeviceSize offset;</div>
+<div class="line"><a name="l06647"></a><span class="lineno"> 6647</span>&#160;        <span class="keyword">enum</span> TYPE</div>
+<div class="line"><a name="l06648"></a><span class="lineno"> 6648</span>&#160;        {</div>
+<div class="line"><a name="l06649"></a><span class="lineno"> 6649</span>&#160;            TYPE_FREE,</div>
+<div class="line"><a name="l06650"></a><span class="lineno"> 6650</span>&#160;            TYPE_ALLOCATION,</div>
+<div class="line"><a name="l06651"></a><span class="lineno"> 6651</span>&#160;            TYPE_SPLIT,</div>
+<div class="line"><a name="l06652"></a><span class="lineno"> 6652</span>&#160;            TYPE_COUNT</div>
+<div class="line"><a name="l06653"></a><span class="lineno"> 6653</span>&#160;        } type;</div>
+<div class="line"><a name="l06654"></a><span class="lineno"> 6654</span>&#160;        Node* parent;</div>
+<div class="line"><a name="l06655"></a><span class="lineno"> 6655</span>&#160;        Node* buddy;</div>
+<div class="line"><a name="l06656"></a><span class="lineno"> 6656</span>&#160; </div>
+<div class="line"><a name="l06657"></a><span class="lineno"> 6657</span>&#160;        <span class="keyword">union</span></div>
+<div class="line"><a name="l06658"></a><span class="lineno"> 6658</span>&#160;        {</div>
+<div class="line"><a name="l06659"></a><span class="lineno"> 6659</span>&#160;            <span class="keyword">struct</span></div>
+<div class="line"><a name="l06660"></a><span class="lineno"> 6660</span>&#160;            {</div>
+<div class="line"><a name="l06661"></a><span class="lineno"> 6661</span>&#160;                Node* prev;</div>
+<div class="line"><a name="l06662"></a><span class="lineno"> 6662</span>&#160;                Node* next;</div>
+<div class="line"><a name="l06663"></a><span class="lineno"> 6663</span>&#160;            } free;</div>
+<div class="line"><a name="l06664"></a><span class="lineno"> 6664</span>&#160;            <span class="keyword">struct</span></div>
+<div class="line"><a name="l06665"></a><span class="lineno"> 6665</span>&#160;            {</div>
+<div class="line"><a name="l06666"></a><span class="lineno"> 6666</span>&#160;                <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc;</div>
+<div class="line"><a name="l06667"></a><span class="lineno"> 6667</span>&#160;            } allocation;</div>
+<div class="line"><a name="l06668"></a><span class="lineno"> 6668</span>&#160;            <span class="keyword">struct</span></div>
+<div class="line"><a name="l06669"></a><span class="lineno"> 6669</span>&#160;            {</div>
+<div class="line"><a name="l06670"></a><span class="lineno"> 6670</span>&#160;                Node* leftChild;</div>
+<div class="line"><a name="l06671"></a><span class="lineno"> 6671</span>&#160;            } split;</div>
+<div class="line"><a name="l06672"></a><span class="lineno"> 6672</span>&#160;        };</div>
+<div class="line"><a name="l06673"></a><span class="lineno"> 6673</span>&#160;    };</div>
+<div class="line"><a name="l06674"></a><span class="lineno"> 6674</span>&#160; </div>
+<div class="line"><a name="l06675"></a><span class="lineno"> 6675</span>&#160;    <span class="comment">// Size of the memory block aligned down to a power of two.</span></div>
+<div class="line"><a name="l06676"></a><span class="lineno"> 6676</span>&#160;    VkDeviceSize m_UsableSize;</div>
+<div class="line"><a name="l06677"></a><span class="lineno"> 6677</span>&#160;    uint32_t m_LevelCount;</div>
+<div class="line"><a name="l06678"></a><span class="lineno"> 6678</span>&#160; </div>
+<div class="line"><a name="l06679"></a><span class="lineno"> 6679</span>&#160;    Node* m_Root;</div>
+<div class="line"><a name="l06680"></a><span class="lineno"> 6680</span>&#160;    <span class="keyword">struct </span>{</div>
+<div class="line"><a name="l06681"></a><span class="lineno"> 6681</span>&#160;        Node* front;</div>
+<div class="line"><a name="l06682"></a><span class="lineno"> 6682</span>&#160;        Node* back;</div>
+<div class="line"><a name="l06683"></a><span class="lineno"> 6683</span>&#160;    } m_FreeList[MAX_LEVELS];</div>
+<div class="line"><a name="l06684"></a><span class="lineno"> 6684</span>&#160;    <span class="comment">// Number of nodes in the tree with type == TYPE_ALLOCATION.</span></div>
+<div class="line"><a name="l06685"></a><span class="lineno"> 6685</span>&#160;    <span class="keywordtype">size_t</span> m_AllocationCount;</div>
+<div class="line"><a name="l06686"></a><span class="lineno"> 6686</span>&#160;    <span class="comment">// Number of nodes in the tree with type == TYPE_FREE.</span></div>
+<div class="line"><a name="l06687"></a><span class="lineno"> 6687</span>&#160;    <span class="keywordtype">size_t</span> m_FreeCount;</div>
+<div class="line"><a name="l06688"></a><span class="lineno"> 6688</span>&#160;    <span class="comment">// This includes space wasted due to internal fragmentation. Doesn&#39;t include unusable size.</span></div>
+<div class="line"><a name="l06689"></a><span class="lineno"> 6689</span>&#160;    VkDeviceSize m_SumFreeSize;</div>
+<div class="line"><a name="l06690"></a><span class="lineno"> 6690</span>&#160; </div>
+<div class="line"><a name="l06691"></a><span class="lineno"> 6691</span>&#160;    VkDeviceSize GetUnusableSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> GetSize() - m_UsableSize; }</div>
+<div class="line"><a name="l06692"></a><span class="lineno"> 6692</span>&#160;    <span class="keywordtype">void</span> DeleteNode(Node* node);</div>
+<div class="line"><a name="l06693"></a><span class="lineno"> 6693</span>&#160;    <span class="keywordtype">bool</span> ValidateNode(ValidationContext&amp; ctx, <span class="keyword">const</span> Node* parent, <span class="keyword">const</span> Node* curr, uint32_t level, VkDeviceSize levelNodeSize) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06694"></a><span class="lineno"> 6694</span>&#160;    uint32_t AllocSizeToLevel(VkDeviceSize allocSize) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06695"></a><span class="lineno"> 6695</span>&#160;    <span class="keyword">inline</span> VkDeviceSize LevelToNodeSize(uint32_t level)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_UsableSize &gt;&gt; level; }</div>
+<div class="line"><a name="l06696"></a><span class="lineno"> 6696</span>&#160;    <span class="comment">// Alloc passed just for validation. Can be null.</span></div>
+<div class="line"><a name="l06697"></a><span class="lineno"> 6697</span>&#160;    <span class="keywordtype">void</span> FreeAtOffset(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc, VkDeviceSize offset);</div>
+<div class="line"><a name="l06698"></a><span class="lineno"> 6698</span>&#160;    <span class="keywordtype">void</span> CalcAllocationStatInfoNode(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo, <span class="keyword">const</span> Node* node, VkDeviceSize levelNodeSize) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06699"></a><span class="lineno"> 6699</span>&#160;    <span class="comment">// Adds node to the front of FreeList at given level.</span></div>
+<div class="line"><a name="l06700"></a><span class="lineno"> 6700</span>&#160;    <span class="comment">// node-&gt;type must be FREE.</span></div>
+<div class="line"><a name="l06701"></a><span class="lineno"> 6701</span>&#160;    <span class="comment">// node-&gt;free.prev, next can be undefined.</span></div>
+<div class="line"><a name="l06702"></a><span class="lineno"> 6702</span>&#160;    <span class="keywordtype">void</span> AddToFreeListFront(uint32_t level, Node* node);</div>
+<div class="line"><a name="l06703"></a><span class="lineno"> 6703</span>&#160;    <span class="comment">// Removes node from FreeList at given level.</span></div>
+<div class="line"><a name="l06704"></a><span class="lineno"> 6704</span>&#160;    <span class="comment">// node-&gt;type must be FREE.</span></div>
+<div class="line"><a name="l06705"></a><span class="lineno"> 6705</span>&#160;    <span class="comment">// node-&gt;free.prev, next stay untouched.</span></div>
+<div class="line"><a name="l06706"></a><span class="lineno"> 6706</span>&#160;    <span class="keywordtype">void</span> RemoveFromFreeList(uint32_t level, Node* node);</div>
 <div class="line"><a name="l06707"></a><span class="lineno"> 6707</span>&#160; </div>
-<div class="line"><a name="l06708"></a><span class="lineno"> 6708</span>&#160;    VkDeviceSize CalcMaxBlockSize() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06709"></a><span class="lineno"> 6709</span>&#160; </div>
-<div class="line"><a name="l06710"></a><span class="lineno"> 6710</span>&#160;    <span class="comment">// Finds and removes given block from vector.</span></div>
-<div class="line"><a name="l06711"></a><span class="lineno"> 6711</span>&#160;    <span class="keywordtype">void</span> Remove(VmaDeviceMemoryBlock* pBlock);</div>
+<div class="line"><a name="l06708"></a><span class="lineno"> 6708</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l06709"></a><span class="lineno"> 6709</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMapNode(<span class="keyword">class</span> VmaJsonWriter&amp; json, <span class="keyword">const</span> Node* node, VkDeviceSize levelNodeSize) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06710"></a><span class="lineno"> 6710</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l06711"></a><span class="lineno"> 6711</span>&#160;};</div>
 <div class="line"><a name="l06712"></a><span class="lineno"> 6712</span>&#160; </div>
-<div class="line"><a name="l06713"></a><span class="lineno"> 6713</span>&#160;    <span class="comment">// Performs single step in sorting m_Blocks. They may not be fully sorted</span></div>
-<div class="line"><a name="l06714"></a><span class="lineno"> 6714</span>&#160;    <span class="comment">// after this call.</span></div>
-<div class="line"><a name="l06715"></a><span class="lineno"> 6715</span>&#160;    <span class="keywordtype">void</span> IncrementallySortBlocks();</div>
-<div class="line"><a name="l06716"></a><span class="lineno"> 6716</span>&#160; </div>
-<div class="line"><a name="l06717"></a><span class="lineno"> 6717</span>&#160;    VkResult AllocatePage(</div>
-<div class="line"><a name="l06718"></a><span class="lineno"> 6718</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06719"></a><span class="lineno"> 6719</span>&#160;        VkDeviceSize size,</div>
-<div class="line"><a name="l06720"></a><span class="lineno"> 6720</span>&#160;        VkDeviceSize alignment,</div>
-<div class="line"><a name="l06721"></a><span class="lineno"> 6721</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l06722"></a><span class="lineno"> 6722</span>&#160;        VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l06723"></a><span class="lineno"> 6723</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
+<div class="line"><a name="l06713"></a><span class="lineno"> 6713</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l06714"></a><span class="lineno"> 6714</span>&#160;<span class="comment">Represents a single block of device memory (`VkDeviceMemory`) with all the</span></div>
+<div class="line"><a name="l06715"></a><span class="lineno"> 6715</span>&#160;<span class="comment">data about its regions (aka suballocations, #VmaAllocation), assigned and free.</span></div>
+<div class="line"><a name="l06716"></a><span class="lineno"> 6716</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l06717"></a><span class="lineno"> 6717</span>&#160;<span class="comment">Thread-safety: This class must be externally synchronized.</span></div>
+<div class="line"><a name="l06718"></a><span class="lineno"> 6718</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l06719"></a><span class="lineno"> 6719</span>&#160;<span class="keyword">class </span>VmaDeviceMemoryBlock</div>
+<div class="line"><a name="l06720"></a><span class="lineno"> 6720</span>&#160;{</div>
+<div class="line"><a name="l06721"></a><span class="lineno"> 6721</span>&#160;    VMA_CLASS_NO_COPY(VmaDeviceMemoryBlock)</div>
+<div class="line"><a name="l06722"></a><span class="lineno"> 6722</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l06723"></a><span class="lineno"> 6723</span>&#160;    VmaBlockMetadata* m_pMetadata;</div>
 <div class="line"><a name="l06724"></a><span class="lineno"> 6724</span>&#160; </div>
-<div class="line"><a name="l06725"></a><span class="lineno"> 6725</span>&#160;    <span class="comment">// To be used only without CAN_MAKE_OTHER_LOST flag.</span></div>
-<div class="line"><a name="l06726"></a><span class="lineno"> 6726</span>&#160;    VkResult AllocateFromBlock(</div>
-<div class="line"><a name="l06727"></a><span class="lineno"> 6727</span>&#160;        VmaDeviceMemoryBlock* pBlock,</div>
-<div class="line"><a name="l06728"></a><span class="lineno"> 6728</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06729"></a><span class="lineno"> 6729</span>&#160;        VkDeviceSize size,</div>
-<div class="line"><a name="l06730"></a><span class="lineno"> 6730</span>&#160;        VkDeviceSize alignment,</div>
-<div class="line"><a name="l06731"></a><span class="lineno"> 6731</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlags,</div>
-<div class="line"><a name="l06732"></a><span class="lineno"> 6732</span>&#160;        <span class="keywordtype">void</span>* pUserData,</div>
-<div class="line"><a name="l06733"></a><span class="lineno"> 6733</span>&#160;        VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l06734"></a><span class="lineno"> 6734</span>&#160;        uint32_t strategy,</div>
-<div class="line"><a name="l06735"></a><span class="lineno"> 6735</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
-<div class="line"><a name="l06736"></a><span class="lineno"> 6736</span>&#160; </div>
-<div class="line"><a name="l06737"></a><span class="lineno"> 6737</span>&#160;    VkResult CreateBlock(VkDeviceSize blockSize, <span class="keywordtype">size_t</span>* pNewBlockIndex);</div>
-<div class="line"><a name="l06738"></a><span class="lineno"> 6738</span>&#160; </div>
-<div class="line"><a name="l06739"></a><span class="lineno"> 6739</span>&#160;    <span class="comment">// Saves result to pCtx-&gt;res.</span></div>
-<div class="line"><a name="l06740"></a><span class="lineno"> 6740</span>&#160;    <span class="keywordtype">void</span> ApplyDefragmentationMovesCpu(</div>
-<div class="line"><a name="l06741"></a><span class="lineno"> 6741</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pDefragCtx,</div>
-<div class="line"><a name="l06742"></a><span class="lineno"> 6742</span>&#160;        <span class="keyword">const</span> VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves);</div>
-<div class="line"><a name="l06743"></a><span class="lineno"> 6743</span>&#160;    <span class="comment">// Saves result to pCtx-&gt;res.</span></div>
-<div class="line"><a name="l06744"></a><span class="lineno"> 6744</span>&#160;    <span class="keywordtype">void</span> ApplyDefragmentationMovesGpu(</div>
-<div class="line"><a name="l06745"></a><span class="lineno"> 6745</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pDefragCtx,</div>
-<div class="line"><a name="l06746"></a><span class="lineno"> 6746</span>&#160;        VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
-<div class="line"><a name="l06747"></a><span class="lineno"> 6747</span>&#160;        VkCommandBuffer commandBuffer);</div>
-<div class="line"><a name="l06748"></a><span class="lineno"> 6748</span>&#160; </div>
-<div class="line"><a name="l06749"></a><span class="lineno"> 6749</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l06750"></a><span class="lineno"> 6750</span>&#160;<span class="comment">    Used during defragmentation. pDefragmentationStats is optional. It&#39;s in/out</span></div>
-<div class="line"><a name="l06751"></a><span class="lineno"> 6751</span>&#160;<span class="comment">    - updated with new data.</span></div>
-<div class="line"><a name="l06752"></a><span class="lineno"> 6752</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l06753"></a><span class="lineno"> 6753</span>&#160;    <span class="keywordtype">void</span> FreeEmptyBlocks(<a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pDefragmentationStats);</div>
-<div class="line"><a name="l06754"></a><span class="lineno"> 6754</span>&#160; </div>
-<div class="line"><a name="l06755"></a><span class="lineno"> 6755</span>&#160;    <span class="keywordtype">void</span> UpdateHasEmptyBlock();</div>
-<div class="line"><a name="l06756"></a><span class="lineno"> 6756</span>&#160;};</div>
-<div class="line"><a name="l06757"></a><span class="lineno"> 6757</span>&#160; </div>
-<div class="line"><a name="l06758"></a><span class="lineno"> 6758</span>&#160;<span class="keyword">struct </span>VmaPool_T</div>
-<div class="line"><a name="l06759"></a><span class="lineno"> 6759</span>&#160;{</div>
-<div class="line"><a name="l06760"></a><span class="lineno"> 6760</span>&#160;    VMA_CLASS_NO_COPY(VmaPool_T)</div>
-<div class="line"><a name="l06761"></a><span class="lineno"> 6761</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l06762"></a><span class="lineno"> 6762</span>&#160;    VmaBlockVector m_BlockVector;</div>
-<div class="line"><a name="l06763"></a><span class="lineno"> 6763</span>&#160; </div>
-<div class="line"><a name="l06764"></a><span class="lineno"> 6764</span>&#160;    VmaPool_T(</div>
-<div class="line"><a name="l06765"></a><span class="lineno"> 6765</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l06766"></a><span class="lineno"> 6766</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l06767"></a><span class="lineno"> 6767</span>&#160;        VkDeviceSize preferredBlockSize);</div>
-<div class="line"><a name="l06768"></a><span class="lineno"> 6768</span>&#160;    ~VmaPool_T();</div>
-<div class="line"><a name="l06769"></a><span class="lineno"> 6769</span>&#160; </div>
-<div class="line"><a name="l06770"></a><span class="lineno"> 6770</span>&#160;    uint32_t GetId()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Id; }</div>
-<div class="line"><a name="l06771"></a><span class="lineno"> 6771</span>&#160;    <span class="keywordtype">void</span> SetId(uint32_t <span class="keywordtype">id</span>) { VMA_ASSERT(m_Id == 0); m_Id = id; }</div>
-<div class="line"><a name="l06772"></a><span class="lineno"> 6772</span>&#160; </div>
-<div class="line"><a name="l06773"></a><span class="lineno"> 6773</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* GetName()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Name; }</div>
-<div class="line"><a name="l06774"></a><span class="lineno"> 6774</span>&#160;    <span class="keywordtype">void</span> SetName(<span class="keyword">const</span> <span class="keywordtype">char</span>* pName);</div>
+<div class="line"><a name="l06725"></a><span class="lineno"> 6725</span>&#160;    VmaDeviceMemoryBlock(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
+<div class="line"><a name="l06726"></a><span class="lineno"> 6726</span>&#160; </div>
+<div class="line"><a name="l06727"></a><span class="lineno"> 6727</span>&#160;    ~VmaDeviceMemoryBlock()</div>
+<div class="line"><a name="l06728"></a><span class="lineno"> 6728</span>&#160;    {</div>
+<div class="line"><a name="l06729"></a><span class="lineno"> 6729</span>&#160;        VMA_ASSERT(m_MapCount == 0 &amp;&amp; <span class="stringliteral">&quot;VkDeviceMemory block is being destroyed while it is still mapped.&quot;</span>);</div>
+<div class="line"><a name="l06730"></a><span class="lineno"> 6730</span>&#160;        VMA_ASSERT(m_hMemory == VK_NULL_HANDLE);</div>
+<div class="line"><a name="l06731"></a><span class="lineno"> 6731</span>&#160;    }</div>
+<div class="line"><a name="l06732"></a><span class="lineno"> 6732</span>&#160; </div>
+<div class="line"><a name="l06733"></a><span class="lineno"> 6733</span>&#160;    <span class="comment">// Always call after construction.</span></div>
+<div class="line"><a name="l06734"></a><span class="lineno"> 6734</span>&#160;    <span class="keywordtype">void</span> Init(</div>
+<div class="line"><a name="l06735"></a><span class="lineno"> 6735</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l06736"></a><span class="lineno"> 6736</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> hParentPool,</div>
+<div class="line"><a name="l06737"></a><span class="lineno"> 6737</span>&#160;        uint32_t newMemoryTypeIndex,</div>
+<div class="line"><a name="l06738"></a><span class="lineno"> 6738</span>&#160;        VkDeviceMemory newMemory,</div>
+<div class="line"><a name="l06739"></a><span class="lineno"> 6739</span>&#160;        VkDeviceSize newSize,</div>
+<div class="line"><a name="l06740"></a><span class="lineno"> 6740</span>&#160;        uint32_t <span class="keywordtype">id</span>,</div>
+<div class="line"><a name="l06741"></a><span class="lineno"> 6741</span>&#160;        uint32_t algorithm);</div>
+<div class="line"><a name="l06742"></a><span class="lineno"> 6742</span>&#160;    <span class="comment">// Always call before destruction.</span></div>
+<div class="line"><a name="l06743"></a><span class="lineno"> 6743</span>&#160;    <span class="keywordtype">void</span> Destroy(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator);</div>
+<div class="line"><a name="l06744"></a><span class="lineno"> 6744</span>&#160;    </div>
+<div class="line"><a name="l06745"></a><span class="lineno"> 6745</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> GetParentPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hParentPool; }</div>
+<div class="line"><a name="l06746"></a><span class="lineno"> 6746</span>&#160;    VkDeviceMemory GetDeviceMemory()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hMemory; }</div>
+<div class="line"><a name="l06747"></a><span class="lineno"> 6747</span>&#160;    uint32_t GetMemoryTypeIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemoryTypeIndex; }</div>
+<div class="line"><a name="l06748"></a><span class="lineno"> 6748</span>&#160;    uint32_t GetId()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Id; }</div>
+<div class="line"><a name="l06749"></a><span class="lineno"> 6749</span>&#160;    <span class="keywordtype">void</span>* GetMappedData()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pMappedData; }</div>
+<div class="line"><a name="l06750"></a><span class="lineno"> 6750</span>&#160; </div>
+<div class="line"><a name="l06751"></a><span class="lineno"> 6751</span>&#160;    <span class="comment">// Validates all data structures inside this object. If not valid, returns false.</span></div>
+<div class="line"><a name="l06752"></a><span class="lineno"> 6752</span>&#160;    <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06753"></a><span class="lineno"> 6753</span>&#160; </div>
+<div class="line"><a name="l06754"></a><span class="lineno"> 6754</span>&#160;    VkResult CheckCorruption(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
+<div class="line"><a name="l06755"></a><span class="lineno"> 6755</span>&#160; </div>
+<div class="line"><a name="l06756"></a><span class="lineno"> 6756</span>&#160;    <span class="comment">// ppData can be null.</span></div>
+<div class="line"><a name="l06757"></a><span class="lineno"> 6757</span>&#160;    VkResult Map(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, uint32_t count, <span class="keywordtype">void</span>** ppData);</div>
+<div class="line"><a name="l06758"></a><span class="lineno"> 6758</span>&#160;    <span class="keywordtype">void</span> Unmap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, uint32_t count);</div>
+<div class="line"><a name="l06759"></a><span class="lineno"> 6759</span>&#160; </div>
+<div class="line"><a name="l06760"></a><span class="lineno"> 6760</span>&#160;    VkResult WriteMagicValueAroundAllocation(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize);</div>
+<div class="line"><a name="l06761"></a><span class="lineno"> 6761</span>&#160;    VkResult ValidateMagicValueAroundAllocation(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize);</div>
+<div class="line"><a name="l06762"></a><span class="lineno"> 6762</span>&#160; </div>
+<div class="line"><a name="l06763"></a><span class="lineno"> 6763</span>&#160;    VkResult BindBufferMemory(</div>
+<div class="line"><a name="l06764"></a><span class="lineno"> 6764</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l06765"></a><span class="lineno"> 6765</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
+<div class="line"><a name="l06766"></a><span class="lineno"> 6766</span>&#160;        VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l06767"></a><span class="lineno"> 6767</span>&#160;        VkBuffer hBuffer,</div>
+<div class="line"><a name="l06768"></a><span class="lineno"> 6768</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
+<div class="line"><a name="l06769"></a><span class="lineno"> 6769</span>&#160;    VkResult BindImageMemory(</div>
+<div class="line"><a name="l06770"></a><span class="lineno"> 6770</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l06771"></a><span class="lineno"> 6771</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
+<div class="line"><a name="l06772"></a><span class="lineno"> 6772</span>&#160;        VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l06773"></a><span class="lineno"> 6773</span>&#160;        VkImage hImage,</div>
+<div class="line"><a name="l06774"></a><span class="lineno"> 6774</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
 <div class="line"><a name="l06775"></a><span class="lineno"> 6775</span>&#160; </div>
-<div class="line"><a name="l06776"></a><span class="lineno"> 6776</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l06777"></a><span class="lineno"> 6777</span>&#160;    <span class="comment">//void PrintDetailedMap(class VmaStringBuilder&amp; sb);</span></div>
-<div class="line"><a name="l06778"></a><span class="lineno"> 6778</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l06779"></a><span class="lineno"> 6779</span>&#160; </div>
-<div class="line"><a name="l06780"></a><span class="lineno"> 6780</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l06781"></a><span class="lineno"> 6781</span>&#160;    uint32_t m_Id;</div>
-<div class="line"><a name="l06782"></a><span class="lineno"> 6782</span>&#160;    <span class="keywordtype">char</span>* m_Name;</div>
-<div class="line"><a name="l06783"></a><span class="lineno"> 6783</span>&#160;};</div>
-<div class="line"><a name="l06784"></a><span class="lineno"> 6784</span>&#160; </div>
-<div class="line"><a name="l06785"></a><span class="lineno"> 6785</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l06786"></a><span class="lineno"> 6786</span>&#160;<span class="comment">Performs defragmentation:</span></div>
-<div class="line"><a name="l06787"></a><span class="lineno"> 6787</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l06788"></a><span class="lineno"> 6788</span>&#160;<span class="comment">- Updates `pBlockVector-&gt;m_pMetadata`.</span></div>
-<div class="line"><a name="l06789"></a><span class="lineno"> 6789</span>&#160;<span class="comment">- Updates allocations by calling ChangeBlockAllocation() or ChangeOffset().</span></div>
-<div class="line"><a name="l06790"></a><span class="lineno"> 6790</span>&#160;<span class="comment">- Does not move actual data, only returns requested moves as `moves`.</span></div>
-<div class="line"><a name="l06791"></a><span class="lineno"> 6791</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l06792"></a><span class="lineno"> 6792</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm</div>
+<div class="line"><a name="l06776"></a><span class="lineno"> 6776</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l06777"></a><span class="lineno"> 6777</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> m_hParentPool; <span class="comment">// VK_NULL_HANDLE if not belongs to custom pool.</span></div>
+<div class="line"><a name="l06778"></a><span class="lineno"> 6778</span>&#160;    uint32_t m_MemoryTypeIndex;</div>
+<div class="line"><a name="l06779"></a><span class="lineno"> 6779</span>&#160;    uint32_t m_Id;</div>
+<div class="line"><a name="l06780"></a><span class="lineno"> 6780</span>&#160;    VkDeviceMemory m_hMemory;</div>
+<div class="line"><a name="l06781"></a><span class="lineno"> 6781</span>&#160; </div>
+<div class="line"><a name="l06782"></a><span class="lineno"> 6782</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l06783"></a><span class="lineno"> 6783</span>&#160;<span class="comment">    Protects access to m_hMemory so it&#39;s not used by multiple threads simultaneously, e.g. vkMapMemory, vkBindBufferMemory.</span></div>
+<div class="line"><a name="l06784"></a><span class="lineno"> 6784</span>&#160;<span class="comment">    Also protects m_MapCount, m_pMappedData.</span></div>
+<div class="line"><a name="l06785"></a><span class="lineno"> 6785</span>&#160;<span class="comment">    Allocations, deallocations, any change in m_pMetadata is protected by parent&#39;s VmaBlockVector::m_Mutex.</span></div>
+<div class="line"><a name="l06786"></a><span class="lineno"> 6786</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l06787"></a><span class="lineno"> 6787</span>&#160;    VMA_MUTEX m_Mutex;</div>
+<div class="line"><a name="l06788"></a><span class="lineno"> 6788</span>&#160;    uint32_t m_MapCount;</div>
+<div class="line"><a name="l06789"></a><span class="lineno"> 6789</span>&#160;    <span class="keywordtype">void</span>* m_pMappedData;</div>
+<div class="line"><a name="l06790"></a><span class="lineno"> 6790</span>&#160;};</div>
+<div class="line"><a name="l06791"></a><span class="lineno"> 6791</span>&#160; </div>
+<div class="line"><a name="l06792"></a><span class="lineno"> 6792</span>&#160;<span class="keyword">struct </span>VmaPointerLess</div>
 <div class="line"><a name="l06793"></a><span class="lineno"> 6793</span>&#160;{</div>
-<div class="line"><a name="l06794"></a><span class="lineno"> 6794</span>&#160;    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm)</div>
-<div class="line"><a name="l06795"></a><span class="lineno"> 6795</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l06796"></a><span class="lineno"> 6796</span>&#160;    VmaDefragmentationAlgorithm(</div>
-<div class="line"><a name="l06797"></a><span class="lineno"> 6797</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l06798"></a><span class="lineno"> 6798</span>&#160;        VmaBlockVector* pBlockVector,</div>
-<div class="line"><a name="l06799"></a><span class="lineno"> 6799</span>&#160;        uint32_t currentFrameIndex) :</div>
-<div class="line"><a name="l06800"></a><span class="lineno"> 6800</span>&#160;        m_hAllocator(hAllocator),</div>
-<div class="line"><a name="l06801"></a><span class="lineno"> 6801</span>&#160;        m_pBlockVector(pBlockVector),</div>
-<div class="line"><a name="l06802"></a><span class="lineno"> 6802</span>&#160;        m_CurrentFrameIndex(currentFrameIndex)</div>
-<div class="line"><a name="l06803"></a><span class="lineno"> 6803</span>&#160;    {</div>
-<div class="line"><a name="l06804"></a><span class="lineno"> 6804</span>&#160;    }</div>
-<div class="line"><a name="l06805"></a><span class="lineno"> 6805</span>&#160;    <span class="keyword">virtual</span> ~VmaDefragmentationAlgorithm()</div>
-<div class="line"><a name="l06806"></a><span class="lineno"> 6806</span>&#160;    {</div>
-<div class="line"><a name="l06807"></a><span class="lineno"> 6807</span>&#160;    }</div>
-<div class="line"><a name="l06808"></a><span class="lineno"> 6808</span>&#160; </div>
-<div class="line"><a name="l06809"></a><span class="lineno"> 6809</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged) = 0;</div>
-<div class="line"><a name="l06810"></a><span class="lineno"> 6810</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAll() = 0;</div>
+<div class="line"><a name="l06794"></a><span class="lineno"> 6794</span>&#160;    <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> <span class="keywordtype">void</span>* lhs, <span class="keyword">const</span> <span class="keywordtype">void</span>* rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l06795"></a><span class="lineno"> 6795</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l06796"></a><span class="lineno"> 6796</span>&#160;        <span class="keywordflow">return</span> lhs &lt; rhs;</div>
+<div class="line"><a name="l06797"></a><span class="lineno"> 6797</span>&#160;    }</div>
+<div class="line"><a name="l06798"></a><span class="lineno"> 6798</span>&#160;};</div>
+<div class="line"><a name="l06799"></a><span class="lineno"> 6799</span>&#160; </div>
+<div class="line"><a name="l06800"></a><span class="lineno"> 6800</span>&#160;<span class="keyword">struct </span>VmaDefragmentationMove</div>
+<div class="line"><a name="l06801"></a><span class="lineno"> 6801</span>&#160;{</div>
+<div class="line"><a name="l06802"></a><span class="lineno"> 6802</span>&#160;    <span class="keywordtype">size_t</span> srcBlockIndex;</div>
+<div class="line"><a name="l06803"></a><span class="lineno"> 6803</span>&#160;    <span class="keywordtype">size_t</span> dstBlockIndex;</div>
+<div class="line"><a name="l06804"></a><span class="lineno"> 6804</span>&#160;    VkDeviceSize srcOffset;</div>
+<div class="line"><a name="l06805"></a><span class="lineno"> 6805</span>&#160;    VkDeviceSize dstOffset;</div>
+<div class="line"><a name="l06806"></a><span class="lineno"> 6806</span>&#160;    VkDeviceSize size;</div>
+<div class="line"><a name="l06807"></a><span class="lineno"> 6807</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation;</div>
+<div class="line"><a name="l06808"></a><span class="lineno"> 6808</span>&#160;    VmaDeviceMemoryBlock* pSrcBlock;</div>
+<div class="line"><a name="l06809"></a><span class="lineno"> 6809</span>&#160;    VmaDeviceMemoryBlock* pDstBlock;</div>
+<div class="line"><a name="l06810"></a><span class="lineno"> 6810</span>&#160;};</div>
 <div class="line"><a name="l06811"></a><span class="lineno"> 6811</span>&#160; </div>
-<div class="line"><a name="l06812"></a><span class="lineno"> 6812</span>&#160;    <span class="keyword">virtual</span> VkResult Defragment(</div>
-<div class="line"><a name="l06813"></a><span class="lineno"> 6813</span>&#160;        VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
-<div class="line"><a name="l06814"></a><span class="lineno"> 6814</span>&#160;        VkDeviceSize maxBytesToMove,</div>
-<div class="line"><a name="l06815"></a><span class="lineno"> 6815</span>&#160;        uint32_t maxAllocationsToMove,</div>
-<div class="line"><a name="l06816"></a><span class="lineno"> 6816</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags) = 0;</div>
-<div class="line"><a name="l06817"></a><span class="lineno"> 6817</span>&#160; </div>
-<div class="line"><a name="l06818"></a><span class="lineno"> 6818</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetBytesMoved() <span class="keyword">const</span> = 0;</div>
-<div class="line"><a name="l06819"></a><span class="lineno"> 6819</span>&#160;    <span class="keyword">virtual</span> uint32_t GetAllocationsMoved() <span class="keyword">const</span> = 0;</div>
-<div class="line"><a name="l06820"></a><span class="lineno"> 6820</span>&#160; </div>
-<div class="line"><a name="l06821"></a><span class="lineno"> 6821</span>&#160;<span class="keyword">protected</span>:</div>
-<div class="line"><a name="l06822"></a><span class="lineno"> 6822</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> <span class="keyword">const</span> m_hAllocator;</div>
-<div class="line"><a name="l06823"></a><span class="lineno"> 6823</span>&#160;    VmaBlockVector* <span class="keyword">const</span> m_pBlockVector;</div>
-<div class="line"><a name="l06824"></a><span class="lineno"> 6824</span>&#160;    <span class="keyword">const</span> uint32_t m_CurrentFrameIndex;</div>
-<div class="line"><a name="l06825"></a><span class="lineno"> 6825</span>&#160; </div>
-<div class="line"><a name="l06826"></a><span class="lineno"> 6826</span>&#160;    <span class="keyword">struct </span>AllocationInfo</div>
-<div class="line"><a name="l06827"></a><span class="lineno"> 6827</span>&#160;    {</div>
-<div class="line"><a name="l06828"></a><span class="lineno"> 6828</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> m_hAllocation;</div>
-<div class="line"><a name="l06829"></a><span class="lineno"> 6829</span>&#160;        VkBool32* m_pChanged;</div>
-<div class="line"><a name="l06830"></a><span class="lineno"> 6830</span>&#160; </div>
-<div class="line"><a name="l06831"></a><span class="lineno"> 6831</span>&#160;        AllocationInfo() :</div>
-<div class="line"><a name="l06832"></a><span class="lineno"> 6832</span>&#160;            m_hAllocation(VK_NULL_HANDLE),</div>
-<div class="line"><a name="l06833"></a><span class="lineno"> 6833</span>&#160;            m_pChanged(VMA_NULL)</div>
-<div class="line"><a name="l06834"></a><span class="lineno"> 6834</span>&#160;        {</div>
-<div class="line"><a name="l06835"></a><span class="lineno"> 6835</span>&#160;        }</div>
-<div class="line"><a name="l06836"></a><span class="lineno"> 6836</span>&#160;        AllocationInfo(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged) :</div>
-<div class="line"><a name="l06837"></a><span class="lineno"> 6837</span>&#160;            m_hAllocation(hAlloc),</div>
-<div class="line"><a name="l06838"></a><span class="lineno"> 6838</span>&#160;            m_pChanged(pChanged)</div>
-<div class="line"><a name="l06839"></a><span class="lineno"> 6839</span>&#160;        {</div>
-<div class="line"><a name="l06840"></a><span class="lineno"> 6840</span>&#160;        }</div>
-<div class="line"><a name="l06841"></a><span class="lineno"> 6841</span>&#160;    };</div>
-<div class="line"><a name="l06842"></a><span class="lineno"> 6842</span>&#160;};</div>
-<div class="line"><a name="l06843"></a><span class="lineno"> 6843</span>&#160; </div>
-<div class="line"><a name="l06844"></a><span class="lineno"> 6844</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm_Generic : <span class="keyword">public</span> VmaDefragmentationAlgorithm</div>
-<div class="line"><a name="l06845"></a><span class="lineno"> 6845</span>&#160;{</div>
-<div class="line"><a name="l06846"></a><span class="lineno"> 6846</span>&#160;    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm_Generic)</div>
-<div class="line"><a name="l06847"></a><span class="lineno"> 6847</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l06848"></a><span class="lineno"> 6848</span>&#160;    VmaDefragmentationAlgorithm_Generic(</div>
-<div class="line"><a name="l06849"></a><span class="lineno"> 6849</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l06850"></a><span class="lineno"> 6850</span>&#160;        VmaBlockVector* pBlockVector,</div>
-<div class="line"><a name="l06851"></a><span class="lineno"> 6851</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06852"></a><span class="lineno"> 6852</span>&#160;        <span class="keywordtype">bool</span> overlappingMoveSupported);</div>
-<div class="line"><a name="l06853"></a><span class="lineno"> 6853</span>&#160;    <span class="keyword">virtual</span> ~VmaDefragmentationAlgorithm_Generic();</div>
-<div class="line"><a name="l06854"></a><span class="lineno"> 6854</span>&#160; </div>
-<div class="line"><a name="l06855"></a><span class="lineno"> 6855</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged);</div>
-<div class="line"><a name="l06856"></a><span class="lineno"> 6856</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAll() { m_AllAllocations = <span class="keyword">true</span>; }</div>
-<div class="line"><a name="l06857"></a><span class="lineno"> 6857</span>&#160; </div>
-<div class="line"><a name="l06858"></a><span class="lineno"> 6858</span>&#160;    <span class="keyword">virtual</span> VkResult Defragment(</div>
-<div class="line"><a name="l06859"></a><span class="lineno"> 6859</span>&#160;        VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
-<div class="line"><a name="l06860"></a><span class="lineno"> 6860</span>&#160;        VkDeviceSize maxBytesToMove,</div>
-<div class="line"><a name="l06861"></a><span class="lineno"> 6861</span>&#160;        uint32_t maxAllocationsToMove,</div>
-<div class="line"><a name="l06862"></a><span class="lineno"> 6862</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags);</div>
+<div class="line"><a name="l06812"></a><span class="lineno"> 6812</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm;</div>
+<div class="line"><a name="l06813"></a><span class="lineno"> 6813</span>&#160; </div>
+<div class="line"><a name="l06814"></a><span class="lineno"> 6814</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l06815"></a><span class="lineno"> 6815</span>&#160;<span class="comment">Sequence of VmaDeviceMemoryBlock. Represents memory blocks allocated for a specific</span></div>
+<div class="line"><a name="l06816"></a><span class="lineno"> 6816</span>&#160;<span class="comment">Vulkan memory type.</span></div>
+<div class="line"><a name="l06817"></a><span class="lineno"> 6817</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l06818"></a><span class="lineno"> 6818</span>&#160;<span class="comment">Synchronized internally with a mutex.</span></div>
+<div class="line"><a name="l06819"></a><span class="lineno"> 6819</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l06820"></a><span class="lineno"> 6820</span>&#160;<span class="keyword">struct </span>VmaBlockVector</div>
+<div class="line"><a name="l06821"></a><span class="lineno"> 6821</span>&#160;{</div>
+<div class="line"><a name="l06822"></a><span class="lineno"> 6822</span>&#160;    VMA_CLASS_NO_COPY(VmaBlockVector)</div>
+<div class="line"><a name="l06823"></a><span class="lineno"> 6823</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l06824"></a><span class="lineno"> 6824</span>&#160;    VmaBlockVector(</div>
+<div class="line"><a name="l06825"></a><span class="lineno"> 6825</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l06826"></a><span class="lineno"> 6826</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> hParentPool,</div>
+<div class="line"><a name="l06827"></a><span class="lineno"> 6827</span>&#160;        uint32_t memoryTypeIndex,</div>
+<div class="line"><a name="l06828"></a><span class="lineno"> 6828</span>&#160;        VkDeviceSize preferredBlockSize,</div>
+<div class="line"><a name="l06829"></a><span class="lineno"> 6829</span>&#160;        <span class="keywordtype">size_t</span> minBlockCount,</div>
+<div class="line"><a name="l06830"></a><span class="lineno"> 6830</span>&#160;        <span class="keywordtype">size_t</span> maxBlockCount,</div>
+<div class="line"><a name="l06831"></a><span class="lineno"> 6831</span>&#160;        VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l06832"></a><span class="lineno"> 6832</span>&#160;        uint32_t frameInUseCount,</div>
+<div class="line"><a name="l06833"></a><span class="lineno"> 6833</span>&#160;        <span class="keywordtype">bool</span> explicitBlockSize,</div>
+<div class="line"><a name="l06834"></a><span class="lineno"> 6834</span>&#160;        uint32_t algorithm);</div>
+<div class="line"><a name="l06835"></a><span class="lineno"> 6835</span>&#160;    ~VmaBlockVector();</div>
+<div class="line"><a name="l06836"></a><span class="lineno"> 6836</span>&#160; </div>
+<div class="line"><a name="l06837"></a><span class="lineno"> 6837</span>&#160;    VkResult CreateMinBlocks();</div>
+<div class="line"><a name="l06838"></a><span class="lineno"> 6838</span>&#160; </div>
+<div class="line"><a name="l06839"></a><span class="lineno"> 6839</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> GetAllocator()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hAllocator; }</div>
+<div class="line"><a name="l06840"></a><span class="lineno"> 6840</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> GetParentPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hParentPool; }</div>
+<div class="line"><a name="l06841"></a><span class="lineno"> 6841</span>&#160;    <span class="keywordtype">bool</span> IsCustomPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hParentPool != VMA_NULL; }</div>
+<div class="line"><a name="l06842"></a><span class="lineno"> 6842</span>&#160;    uint32_t GetMemoryTypeIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemoryTypeIndex; }</div>
+<div class="line"><a name="l06843"></a><span class="lineno"> 6843</span>&#160;    VkDeviceSize GetPreferredBlockSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_PreferredBlockSize; }</div>
+<div class="line"><a name="l06844"></a><span class="lineno"> 6844</span>&#160;    VkDeviceSize GetBufferImageGranularity()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BufferImageGranularity; }</div>
+<div class="line"><a name="l06845"></a><span class="lineno"> 6845</span>&#160;    uint32_t GetFrameInUseCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_FrameInUseCount; }</div>
+<div class="line"><a name="l06846"></a><span class="lineno"> 6846</span>&#160;    uint32_t GetAlgorithm()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Algorithm; }</div>
+<div class="line"><a name="l06847"></a><span class="lineno"> 6847</span>&#160; </div>
+<div class="line"><a name="l06848"></a><span class="lineno"> 6848</span>&#160;    <span class="keywordtype">void</span> GetPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pStats);</div>
+<div class="line"><a name="l06849"></a><span class="lineno"> 6849</span>&#160; </div>
+<div class="line"><a name="l06850"></a><span class="lineno"> 6850</span>&#160;    <span class="keywordtype">bool</span> IsEmpty();</div>
+<div class="line"><a name="l06851"></a><span class="lineno"> 6851</span>&#160;    <span class="keywordtype">bool</span> IsCorruptionDetectionEnabled() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06852"></a><span class="lineno"> 6852</span>&#160; </div>
+<div class="line"><a name="l06853"></a><span class="lineno"> 6853</span>&#160;    VkResult Allocate(</div>
+<div class="line"><a name="l06854"></a><span class="lineno"> 6854</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06855"></a><span class="lineno"> 6855</span>&#160;        VkDeviceSize size,</div>
+<div class="line"><a name="l06856"></a><span class="lineno"> 6856</span>&#160;        VkDeviceSize alignment,</div>
+<div class="line"><a name="l06857"></a><span class="lineno"> 6857</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l06858"></a><span class="lineno"> 6858</span>&#160;        VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l06859"></a><span class="lineno"> 6859</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l06860"></a><span class="lineno"> 6860</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
+<div class="line"><a name="l06861"></a><span class="lineno"> 6861</span>&#160; </div>
+<div class="line"><a name="l06862"></a><span class="lineno"> 6862</span>&#160;    <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
 <div class="line"><a name="l06863"></a><span class="lineno"> 6863</span>&#160; </div>
-<div class="line"><a name="l06864"></a><span class="lineno"> 6864</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetBytesMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BytesMoved; }</div>
-<div class="line"><a name="l06865"></a><span class="lineno"> 6865</span>&#160;    <span class="keyword">virtual</span> uint32_t GetAllocationsMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_AllocationsMoved; }</div>
+<div class="line"><a name="l06864"></a><span class="lineno"> 6864</span>&#160;    <span class="comment">// Adds statistics of this BlockVector to pStats.</span></div>
+<div class="line"><a name="l06865"></a><span class="lineno"> 6865</span>&#160;    <span class="keywordtype">void</span> AddStats(<a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats);</div>
 <div class="line"><a name="l06866"></a><span class="lineno"> 6866</span>&#160; </div>
-<div class="line"><a name="l06867"></a><span class="lineno"> 6867</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l06868"></a><span class="lineno"> 6868</span>&#160;    uint32_t m_AllocationCount;</div>
-<div class="line"><a name="l06869"></a><span class="lineno"> 6869</span>&#160;    <span class="keywordtype">bool</span> m_AllAllocations;</div>
+<div class="line"><a name="l06867"></a><span class="lineno"> 6867</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l06868"></a><span class="lineno"> 6868</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json);</div>
+<div class="line"><a name="l06869"></a><span class="lineno"> 6869</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l06870"></a><span class="lineno"> 6870</span>&#160; </div>
-<div class="line"><a name="l06871"></a><span class="lineno"> 6871</span>&#160;    VkDeviceSize m_BytesMoved;</div>
-<div class="line"><a name="l06872"></a><span class="lineno"> 6872</span>&#160;    uint32_t m_AllocationsMoved;</div>
-<div class="line"><a name="l06873"></a><span class="lineno"> 6873</span>&#160; </div>
-<div class="line"><a name="l06874"></a><span class="lineno"> 6874</span>&#160;    <span class="keyword">struct </span>AllocationInfoSizeGreater</div>
-<div class="line"><a name="l06875"></a><span class="lineno"> 6875</span>&#160;    {</div>
-<div class="line"><a name="l06876"></a><span class="lineno"> 6876</span>&#160;        <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> AllocationInfo&amp; lhs, <span class="keyword">const</span> AllocationInfo&amp; rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l06877"></a><span class="lineno"> 6877</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l06878"></a><span class="lineno"> 6878</span>&#160;            <span class="keywordflow">return</span> lhs.m_hAllocation-&gt;GetSize() &gt; rhs.m_hAllocation-&gt;GetSize();</div>
-<div class="line"><a name="l06879"></a><span class="lineno"> 6879</span>&#160;        }</div>
-<div class="line"><a name="l06880"></a><span class="lineno"> 6880</span>&#160;    };</div>
-<div class="line"><a name="l06881"></a><span class="lineno"> 6881</span>&#160; </div>
-<div class="line"><a name="l06882"></a><span class="lineno"> 6882</span>&#160;    <span class="keyword">struct </span>AllocationInfoOffsetGreater</div>
-<div class="line"><a name="l06883"></a><span class="lineno"> 6883</span>&#160;    {</div>
-<div class="line"><a name="l06884"></a><span class="lineno"> 6884</span>&#160;        <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> AllocationInfo&amp; lhs, <span class="keyword">const</span> AllocationInfo&amp; rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l06885"></a><span class="lineno"> 6885</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l06886"></a><span class="lineno"> 6886</span>&#160;            <span class="keywordflow">return</span> lhs.m_hAllocation-&gt;GetOffset() &gt; rhs.m_hAllocation-&gt;GetOffset();</div>
-<div class="line"><a name="l06887"></a><span class="lineno"> 6887</span>&#160;        }</div>
-<div class="line"><a name="l06888"></a><span class="lineno"> 6888</span>&#160;    };</div>
-<div class="line"><a name="l06889"></a><span class="lineno"> 6889</span>&#160; </div>
-<div class="line"><a name="l06890"></a><span class="lineno"> 6890</span>&#160;    <span class="keyword">struct </span>BlockInfo</div>
-<div class="line"><a name="l06891"></a><span class="lineno"> 6891</span>&#160;    {</div>
-<div class="line"><a name="l06892"></a><span class="lineno"> 6892</span>&#160;        <span class="keywordtype">size_t</span> m_OriginalBlockIndex;</div>
-<div class="line"><a name="l06893"></a><span class="lineno"> 6893</span>&#160;        VmaDeviceMemoryBlock* m_pBlock;</div>
-<div class="line"><a name="l06894"></a><span class="lineno"> 6894</span>&#160;        <span class="keywordtype">bool</span> m_HasNonMovableAllocations;</div>
-<div class="line"><a name="l06895"></a><span class="lineno"> 6895</span>&#160;        VmaVector&lt; AllocationInfo, VmaStlAllocator&lt;AllocationInfo&gt; &gt; m_Allocations;</div>
-<div class="line"><a name="l06896"></a><span class="lineno"> 6896</span>&#160; </div>
-<div class="line"><a name="l06897"></a><span class="lineno"> 6897</span>&#160;        BlockInfo(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks) :</div>
-<div class="line"><a name="l06898"></a><span class="lineno"> 6898</span>&#160;            m_OriginalBlockIndex(SIZE_MAX),</div>
-<div class="line"><a name="l06899"></a><span class="lineno"> 6899</span>&#160;            m_pBlock(VMA_NULL),</div>
-<div class="line"><a name="l06900"></a><span class="lineno"> 6900</span>&#160;            m_HasNonMovableAllocations(true),</div>
-<div class="line"><a name="l06901"></a><span class="lineno"> 6901</span>&#160;            m_Allocations(pAllocationCallbacks)</div>
-<div class="line"><a name="l06902"></a><span class="lineno"> 6902</span>&#160;        {</div>
-<div class="line"><a name="l06903"></a><span class="lineno"> 6903</span>&#160;        }</div>
-<div class="line"><a name="l06904"></a><span class="lineno"> 6904</span>&#160; </div>
-<div class="line"><a name="l06905"></a><span class="lineno"> 6905</span>&#160;        <span class="keywordtype">void</span> CalcHasNonMovableAllocations()</div>
-<div class="line"><a name="l06906"></a><span class="lineno"> 6906</span>&#160;        {</div>
-<div class="line"><a name="l06907"></a><span class="lineno"> 6907</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockAllocCount = m_pBlock-&gt;m_pMetadata-&gt;GetAllocationCount();</div>
-<div class="line"><a name="l06908"></a><span class="lineno"> 6908</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> defragmentAllocCount = m_Allocations.size();</div>
-<div class="line"><a name="l06909"></a><span class="lineno"> 6909</span>&#160;            m_HasNonMovableAllocations = blockAllocCount != defragmentAllocCount;</div>
-<div class="line"><a name="l06910"></a><span class="lineno"> 6910</span>&#160;        }</div>
-<div class="line"><a name="l06911"></a><span class="lineno"> 6911</span>&#160; </div>
-<div class="line"><a name="l06912"></a><span class="lineno"> 6912</span>&#160;        <span class="keywordtype">void</span> SortAllocationsBySizeDescending()</div>
-<div class="line"><a name="l06913"></a><span class="lineno"> 6913</span>&#160;        {</div>
-<div class="line"><a name="l06914"></a><span class="lineno"> 6914</span>&#160;            VMA_SORT(m_Allocations.begin(), m_Allocations.end(), AllocationInfoSizeGreater());</div>
-<div class="line"><a name="l06915"></a><span class="lineno"> 6915</span>&#160;        }</div>
-<div class="line"><a name="l06916"></a><span class="lineno"> 6916</span>&#160; </div>
-<div class="line"><a name="l06917"></a><span class="lineno"> 6917</span>&#160;        <span class="keywordtype">void</span> SortAllocationsByOffsetDescending()</div>
-<div class="line"><a name="l06918"></a><span class="lineno"> 6918</span>&#160;        {</div>
-<div class="line"><a name="l06919"></a><span class="lineno"> 6919</span>&#160;            VMA_SORT(m_Allocations.begin(), m_Allocations.end(), AllocationInfoOffsetGreater());</div>
-<div class="line"><a name="l06920"></a><span class="lineno"> 6920</span>&#160;        }</div>
-<div class="line"><a name="l06921"></a><span class="lineno"> 6921</span>&#160;    };</div>
-<div class="line"><a name="l06922"></a><span class="lineno"> 6922</span>&#160; </div>
-<div class="line"><a name="l06923"></a><span class="lineno"> 6923</span>&#160;    <span class="keyword">struct </span>BlockPointerLess</div>
-<div class="line"><a name="l06924"></a><span class="lineno"> 6924</span>&#160;    {</div>
-<div class="line"><a name="l06925"></a><span class="lineno"> 6925</span>&#160;        <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> BlockInfo* pLhsBlockInfo, <span class="keyword">const</span> VmaDeviceMemoryBlock* pRhsBlock)<span class="keyword"> const</span></div>
-<div class="line"><a name="l06926"></a><span class="lineno"> 6926</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l06927"></a><span class="lineno"> 6927</span>&#160;            <span class="keywordflow">return</span> pLhsBlockInfo-&gt;m_pBlock &lt; pRhsBlock;</div>
-<div class="line"><a name="l06928"></a><span class="lineno"> 6928</span>&#160;        }</div>
-<div class="line"><a name="l06929"></a><span class="lineno"> 6929</span>&#160;        <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> BlockInfo* pLhsBlockInfo, <span class="keyword">const</span> BlockInfo* pRhsBlockInfo)<span class="keyword"> const</span></div>
-<div class="line"><a name="l06930"></a><span class="lineno"> 6930</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l06931"></a><span class="lineno"> 6931</span>&#160;            <span class="keywordflow">return</span> pLhsBlockInfo-&gt;m_pBlock &lt; pRhsBlockInfo-&gt;m_pBlock;</div>
-<div class="line"><a name="l06932"></a><span class="lineno"> 6932</span>&#160;        }</div>
-<div class="line"><a name="l06933"></a><span class="lineno"> 6933</span>&#160;    };</div>
+<div class="line"><a name="l06871"></a><span class="lineno"> 6871</span>&#160;    <span class="keywordtype">void</span> MakePoolAllocationsLost(</div>
+<div class="line"><a name="l06872"></a><span class="lineno"> 6872</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06873"></a><span class="lineno"> 6873</span>&#160;        <span class="keywordtype">size_t</span>* pLostAllocationCount);</div>
+<div class="line"><a name="l06874"></a><span class="lineno"> 6874</span>&#160;    VkResult CheckCorruption();</div>
+<div class="line"><a name="l06875"></a><span class="lineno"> 6875</span>&#160; </div>
+<div class="line"><a name="l06876"></a><span class="lineno"> 6876</span>&#160;    <span class="comment">// Saves results in pCtx-&gt;res.</span></div>
+<div class="line"><a name="l06877"></a><span class="lineno"> 6877</span>&#160;    <span class="keywordtype">void</span> Defragment(</div>
+<div class="line"><a name="l06878"></a><span class="lineno"> 6878</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pCtx,</div>
+<div class="line"><a name="l06879"></a><span class="lineno"> 6879</span>&#160;        <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags,</div>
+<div class="line"><a name="l06880"></a><span class="lineno"> 6880</span>&#160;        VkDeviceSize&amp; maxCpuBytesToMove, uint32_t&amp; maxCpuAllocationsToMove,</div>
+<div class="line"><a name="l06881"></a><span class="lineno"> 6881</span>&#160;        VkDeviceSize&amp; maxGpuBytesToMove, uint32_t&amp; maxGpuAllocationsToMove,</div>
+<div class="line"><a name="l06882"></a><span class="lineno"> 6882</span>&#160;        VkCommandBuffer commandBuffer);</div>
+<div class="line"><a name="l06883"></a><span class="lineno"> 6883</span>&#160;    <span class="keywordtype">void</span> DefragmentationEnd(</div>
+<div class="line"><a name="l06884"></a><span class="lineno"> 6884</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pCtx,</div>
+<div class="line"><a name="l06885"></a><span class="lineno"> 6885</span>&#160;        uint32_t flags,</div>
+<div class="line"><a name="l06886"></a><span class="lineno"> 6886</span>&#160;        <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats);</div>
+<div class="line"><a name="l06887"></a><span class="lineno"> 6887</span>&#160; </div>
+<div class="line"><a name="l06888"></a><span class="lineno"> 6888</span>&#160;    uint32_t ProcessDefragmentations(</div>
+<div class="line"><a name="l06889"></a><span class="lineno"> 6889</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext *pCtx,</div>
+<div class="line"><a name="l06890"></a><span class="lineno"> 6890</span>&#160;        <a class="code" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a>* pMove, uint32_t maxMoves);</div>
+<div class="line"><a name="l06891"></a><span class="lineno"> 6891</span>&#160; </div>
+<div class="line"><a name="l06892"></a><span class="lineno"> 6892</span>&#160;    <span class="keywordtype">void</span> CommitDefragmentations(</div>
+<div class="line"><a name="l06893"></a><span class="lineno"> 6893</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext *pCtx,</div>
+<div class="line"><a name="l06894"></a><span class="lineno"> 6894</span>&#160;        <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats);</div>
+<div class="line"><a name="l06895"></a><span class="lineno"> 6895</span>&#160; </div>
+<div class="line"><a name="l06897"></a><span class="lineno"> 6897</span>&#160;    <span class="comment">// To be used only while the m_Mutex is locked. Used during defragmentation.</span></div>
+<div class="line"><a name="l06898"></a><span class="lineno"> 6898</span>&#160; </div>
+<div class="line"><a name="l06899"></a><span class="lineno"> 6899</span>&#160;    <span class="keywordtype">size_t</span> GetBlockCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Blocks.size(); }</div>
+<div class="line"><a name="l06900"></a><span class="lineno"> 6900</span>&#160;    VmaDeviceMemoryBlock* GetBlock(<span class="keywordtype">size_t</span> index)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Blocks[index]; }</div>
+<div class="line"><a name="l06901"></a><span class="lineno"> 6901</span>&#160;    <span class="keywordtype">size_t</span> CalcAllocationCount() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06902"></a><span class="lineno"> 6902</span>&#160;    <span class="keywordtype">bool</span> IsBufferImageGranularityConflictPossible() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06903"></a><span class="lineno"> 6903</span>&#160; </div>
+<div class="line"><a name="l06904"></a><span class="lineno"> 6904</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l06905"></a><span class="lineno"> 6905</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span>VmaDefragmentationAlgorithm_Generic;</div>
+<div class="line"><a name="l06906"></a><span class="lineno"> 6906</span>&#160; </div>
+<div class="line"><a name="l06907"></a><span class="lineno"> 6907</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> m_hAllocator;</div>
+<div class="line"><a name="l06908"></a><span class="lineno"> 6908</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a> m_hParentPool;</div>
+<div class="line"><a name="l06909"></a><span class="lineno"> 6909</span>&#160;    <span class="keyword">const</span> uint32_t m_MemoryTypeIndex;</div>
+<div class="line"><a name="l06910"></a><span class="lineno"> 6910</span>&#160;    <span class="keyword">const</span> VkDeviceSize m_PreferredBlockSize;</div>
+<div class="line"><a name="l06911"></a><span class="lineno"> 6911</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> m_MinBlockCount;</div>
+<div class="line"><a name="l06912"></a><span class="lineno"> 6912</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> m_MaxBlockCount;</div>
+<div class="line"><a name="l06913"></a><span class="lineno"> 6913</span>&#160;    <span class="keyword">const</span> VkDeviceSize m_BufferImageGranularity;</div>
+<div class="line"><a name="l06914"></a><span class="lineno"> 6914</span>&#160;    <span class="keyword">const</span> uint32_t m_FrameInUseCount;</div>
+<div class="line"><a name="l06915"></a><span class="lineno"> 6915</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> m_ExplicitBlockSize;</div>
+<div class="line"><a name="l06916"></a><span class="lineno"> 6916</span>&#160;    <span class="keyword">const</span> uint32_t m_Algorithm;</div>
+<div class="line"><a name="l06917"></a><span class="lineno"> 6917</span>&#160;    VMA_RW_MUTEX m_Mutex;</div>
+<div class="line"><a name="l06918"></a><span class="lineno"> 6918</span>&#160; </div>
+<div class="line"><a name="l06919"></a><span class="lineno"> 6919</span>&#160;    <span class="comment">/* There can be at most one allocation that is completely empty (except when minBlockCount &gt; 0) -</span></div>
+<div class="line"><a name="l06920"></a><span class="lineno"> 6920</span>&#160;<span class="comment">    a hysteresis to avoid pessimistic case of alternating creation and destruction of a VkDeviceMemory. */</span></div>
+<div class="line"><a name="l06921"></a><span class="lineno"> 6921</span>&#160;    <span class="keywordtype">bool</span> m_HasEmptyBlock;</div>
+<div class="line"><a name="l06922"></a><span class="lineno"> 6922</span>&#160;    <span class="comment">// Incrementally sorted by sumFreeSize, ascending.</span></div>
+<div class="line"><a name="l06923"></a><span class="lineno"> 6923</span>&#160;    VmaVector&lt; VmaDeviceMemoryBlock*, VmaStlAllocator&lt;VmaDeviceMemoryBlock*&gt; &gt; m_Blocks;</div>
+<div class="line"><a name="l06924"></a><span class="lineno"> 6924</span>&#160;    uint32_t m_NextBlockId;</div>
+<div class="line"><a name="l06925"></a><span class="lineno"> 6925</span>&#160; </div>
+<div class="line"><a name="l06926"></a><span class="lineno"> 6926</span>&#160;    VkDeviceSize CalcMaxBlockSize() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l06927"></a><span class="lineno"> 6927</span>&#160; </div>
+<div class="line"><a name="l06928"></a><span class="lineno"> 6928</span>&#160;    <span class="comment">// Finds and removes given block from vector.</span></div>
+<div class="line"><a name="l06929"></a><span class="lineno"> 6929</span>&#160;    <span class="keywordtype">void</span> Remove(VmaDeviceMemoryBlock* pBlock);</div>
+<div class="line"><a name="l06930"></a><span class="lineno"> 6930</span>&#160; </div>
+<div class="line"><a name="l06931"></a><span class="lineno"> 6931</span>&#160;    <span class="comment">// Performs single step in sorting m_Blocks. They may not be fully sorted</span></div>
+<div class="line"><a name="l06932"></a><span class="lineno"> 6932</span>&#160;    <span class="comment">// after this call.</span></div>
+<div class="line"><a name="l06933"></a><span class="lineno"> 6933</span>&#160;    <span class="keywordtype">void</span> IncrementallySortBlocks();</div>
 <div class="line"><a name="l06934"></a><span class="lineno"> 6934</span>&#160; </div>
-<div class="line"><a name="l06935"></a><span class="lineno"> 6935</span>&#160;    <span class="comment">// 1. Blocks with some non-movable allocations go first.</span></div>
-<div class="line"><a name="l06936"></a><span class="lineno"> 6936</span>&#160;    <span class="comment">// 2. Blocks with smaller sumFreeSize go first.</span></div>
-<div class="line"><a name="l06937"></a><span class="lineno"> 6937</span>&#160;    <span class="keyword">struct </span>BlockInfoCompareMoveDestination</div>
-<div class="line"><a name="l06938"></a><span class="lineno"> 6938</span>&#160;    {</div>
-<div class="line"><a name="l06939"></a><span class="lineno"> 6939</span>&#160;        <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> BlockInfo* pLhsBlockInfo, <span class="keyword">const</span> BlockInfo* pRhsBlockInfo)<span class="keyword"> const</span></div>
-<div class="line"><a name="l06940"></a><span class="lineno"> 6940</span>&#160;<span class="keyword">        </span>{</div>
-<div class="line"><a name="l06941"></a><span class="lineno"> 6941</span>&#160;            <span class="keywordflow">if</span>(pLhsBlockInfo-&gt;m_HasNonMovableAllocations &amp;&amp; !pRhsBlockInfo-&gt;m_HasNonMovableAllocations)</div>
-<div class="line"><a name="l06942"></a><span class="lineno"> 6942</span>&#160;            {</div>
-<div class="line"><a name="l06943"></a><span class="lineno"> 6943</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l06944"></a><span class="lineno"> 6944</span>&#160;            }</div>
-<div class="line"><a name="l06945"></a><span class="lineno"> 6945</span>&#160;            <span class="keywordflow">if</span>(!pLhsBlockInfo-&gt;m_HasNonMovableAllocations &amp;&amp; pRhsBlockInfo-&gt;m_HasNonMovableAllocations)</div>
-<div class="line"><a name="l06946"></a><span class="lineno"> 6946</span>&#160;            {</div>
-<div class="line"><a name="l06947"></a><span class="lineno"> 6947</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l06948"></a><span class="lineno"> 6948</span>&#160;            }</div>
-<div class="line"><a name="l06949"></a><span class="lineno"> 6949</span>&#160;            <span class="keywordflow">if</span>(pLhsBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;GetSumFreeSize() &lt; pRhsBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;GetSumFreeSize())</div>
-<div class="line"><a name="l06950"></a><span class="lineno"> 6950</span>&#160;            {</div>
-<div class="line"><a name="l06951"></a><span class="lineno"> 6951</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l06952"></a><span class="lineno"> 6952</span>&#160;            }</div>
-<div class="line"><a name="l06953"></a><span class="lineno"> 6953</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l06954"></a><span class="lineno"> 6954</span>&#160;        }</div>
-<div class="line"><a name="l06955"></a><span class="lineno"> 6955</span>&#160;    };</div>
+<div class="line"><a name="l06935"></a><span class="lineno"> 6935</span>&#160;    VkResult AllocatePage(</div>
+<div class="line"><a name="l06936"></a><span class="lineno"> 6936</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06937"></a><span class="lineno"> 6937</span>&#160;        VkDeviceSize size,</div>
+<div class="line"><a name="l06938"></a><span class="lineno"> 6938</span>&#160;        VkDeviceSize alignment,</div>
+<div class="line"><a name="l06939"></a><span class="lineno"> 6939</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l06940"></a><span class="lineno"> 6940</span>&#160;        VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l06941"></a><span class="lineno"> 6941</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
+<div class="line"><a name="l06942"></a><span class="lineno"> 6942</span>&#160; </div>
+<div class="line"><a name="l06943"></a><span class="lineno"> 6943</span>&#160;    <span class="comment">// To be used only without CAN_MAKE_OTHER_LOST flag.</span></div>
+<div class="line"><a name="l06944"></a><span class="lineno"> 6944</span>&#160;    VkResult AllocateFromBlock(</div>
+<div class="line"><a name="l06945"></a><span class="lineno"> 6945</span>&#160;        VmaDeviceMemoryBlock* pBlock,</div>
+<div class="line"><a name="l06946"></a><span class="lineno"> 6946</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l06947"></a><span class="lineno"> 6947</span>&#160;        VkDeviceSize size,</div>
+<div class="line"><a name="l06948"></a><span class="lineno"> 6948</span>&#160;        VkDeviceSize alignment,</div>
+<div class="line"><a name="l06949"></a><span class="lineno"> 6949</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlags,</div>
+<div class="line"><a name="l06950"></a><span class="lineno"> 6950</span>&#160;        <span class="keywordtype">void</span>* pUserData,</div>
+<div class="line"><a name="l06951"></a><span class="lineno"> 6951</span>&#160;        VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l06952"></a><span class="lineno"> 6952</span>&#160;        uint32_t strategy,</div>
+<div class="line"><a name="l06953"></a><span class="lineno"> 6953</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
+<div class="line"><a name="l06954"></a><span class="lineno"> 6954</span>&#160; </div>
+<div class="line"><a name="l06955"></a><span class="lineno"> 6955</span>&#160;    VkResult CreateBlock(VkDeviceSize blockSize, <span class="keywordtype">size_t</span>* pNewBlockIndex);</div>
 <div class="line"><a name="l06956"></a><span class="lineno"> 6956</span>&#160; </div>
-<div class="line"><a name="l06957"></a><span class="lineno"> 6957</span>&#160;    <span class="keyword">typedef</span> VmaVector&lt; BlockInfo*, VmaStlAllocator&lt;BlockInfo*&gt; &gt; BlockInfoVector;</div>
-<div class="line"><a name="l06958"></a><span class="lineno"> 6958</span>&#160;    BlockInfoVector m_Blocks;</div>
-<div class="line"><a name="l06959"></a><span class="lineno"> 6959</span>&#160; </div>
-<div class="line"><a name="l06960"></a><span class="lineno"> 6960</span>&#160;    VkResult DefragmentRound(</div>
-<div class="line"><a name="l06961"></a><span class="lineno"> 6961</span>&#160;        VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
-<div class="line"><a name="l06962"></a><span class="lineno"> 6962</span>&#160;        VkDeviceSize maxBytesToMove,</div>
-<div class="line"><a name="l06963"></a><span class="lineno"> 6963</span>&#160;        uint32_t maxAllocationsToMove,</div>
-<div class="line"><a name="l06964"></a><span class="lineno"> 6964</span>&#160;        <span class="keywordtype">bool</span> freeOldAllocations);</div>
-<div class="line"><a name="l06965"></a><span class="lineno"> 6965</span>&#160; </div>
-<div class="line"><a name="l06966"></a><span class="lineno"> 6966</span>&#160;    <span class="keywordtype">size_t</span> CalcBlocksWithNonMovableCount() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l06967"></a><span class="lineno"> 6967</span>&#160; </div>
-<div class="line"><a name="l06968"></a><span class="lineno"> 6968</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> MoveMakesSense(</div>
-<div class="line"><a name="l06969"></a><span class="lineno"> 6969</span>&#160;        <span class="keywordtype">size_t</span> dstBlockIndex, VkDeviceSize dstOffset,</div>
-<div class="line"><a name="l06970"></a><span class="lineno"> 6970</span>&#160;        <span class="keywordtype">size_t</span> srcBlockIndex, VkDeviceSize srcOffset);</div>
-<div class="line"><a name="l06971"></a><span class="lineno"> 6971</span>&#160;};</div>
+<div class="line"><a name="l06957"></a><span class="lineno"> 6957</span>&#160;    <span class="comment">// Saves result to pCtx-&gt;res.</span></div>
+<div class="line"><a name="l06958"></a><span class="lineno"> 6958</span>&#160;    <span class="keywordtype">void</span> ApplyDefragmentationMovesCpu(</div>
+<div class="line"><a name="l06959"></a><span class="lineno"> 6959</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pDefragCtx,</div>
+<div class="line"><a name="l06960"></a><span class="lineno"> 6960</span>&#160;        <span class="keyword">const</span> VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves);</div>
+<div class="line"><a name="l06961"></a><span class="lineno"> 6961</span>&#160;    <span class="comment">// Saves result to pCtx-&gt;res.</span></div>
+<div class="line"><a name="l06962"></a><span class="lineno"> 6962</span>&#160;    <span class="keywordtype">void</span> ApplyDefragmentationMovesGpu(</div>
+<div class="line"><a name="l06963"></a><span class="lineno"> 6963</span>&#160;        <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pDefragCtx,</div>
+<div class="line"><a name="l06964"></a><span class="lineno"> 6964</span>&#160;        VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
+<div class="line"><a name="l06965"></a><span class="lineno"> 6965</span>&#160;        VkCommandBuffer commandBuffer);</div>
+<div class="line"><a name="l06966"></a><span class="lineno"> 6966</span>&#160; </div>
+<div class="line"><a name="l06967"></a><span class="lineno"> 6967</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l06968"></a><span class="lineno"> 6968</span>&#160;<span class="comment">    Used during defragmentation. pDefragmentationStats is optional. It&#39;s in/out</span></div>
+<div class="line"><a name="l06969"></a><span class="lineno"> 6969</span>&#160;<span class="comment">    - updated with new data.</span></div>
+<div class="line"><a name="l06970"></a><span class="lineno"> 6970</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l06971"></a><span class="lineno"> 6971</span>&#160;    <span class="keywordtype">void</span> FreeEmptyBlocks(<a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pDefragmentationStats);</div>
 <div class="line"><a name="l06972"></a><span class="lineno"> 6972</span>&#160; </div>
-<div class="line"><a name="l06973"></a><span class="lineno"> 6973</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm_Fast : <span class="keyword">public</span> VmaDefragmentationAlgorithm</div>
-<div class="line"><a name="l06974"></a><span class="lineno"> 6974</span>&#160;{</div>
-<div class="line"><a name="l06975"></a><span class="lineno"> 6975</span>&#160;    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm_Fast)</div>
-<div class="line"><a name="l06976"></a><span class="lineno"> 6976</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l06977"></a><span class="lineno"> 6977</span>&#160;    VmaDefragmentationAlgorithm_Fast(</div>
-<div class="line"><a name="l06978"></a><span class="lineno"> 6978</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l06979"></a><span class="lineno"> 6979</span>&#160;        VmaBlockVector* pBlockVector,</div>
-<div class="line"><a name="l06980"></a><span class="lineno"> 6980</span>&#160;        uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l06981"></a><span class="lineno"> 6981</span>&#160;        <span class="keywordtype">bool</span> overlappingMoveSupported);</div>
-<div class="line"><a name="l06982"></a><span class="lineno"> 6982</span>&#160;    <span class="keyword">virtual</span> ~VmaDefragmentationAlgorithm_Fast();</div>
-<div class="line"><a name="l06983"></a><span class="lineno"> 6983</span>&#160; </div>
-<div class="line"><a name="l06984"></a><span class="lineno"> 6984</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged) { ++m_AllocationCount; }</div>
-<div class="line"><a name="l06985"></a><span class="lineno"> 6985</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAll() { m_AllAllocations = <span class="keyword">true</span>; }</div>
-<div class="line"><a name="l06986"></a><span class="lineno"> 6986</span>&#160; </div>
-<div class="line"><a name="l06987"></a><span class="lineno"> 6987</span>&#160;    <span class="keyword">virtual</span> VkResult Defragment(</div>
-<div class="line"><a name="l06988"></a><span class="lineno"> 6988</span>&#160;        VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
-<div class="line"><a name="l06989"></a><span class="lineno"> 6989</span>&#160;        VkDeviceSize maxBytesToMove,</div>
-<div class="line"><a name="l06990"></a><span class="lineno"> 6990</span>&#160;        uint32_t maxAllocationsToMove,</div>
-<div class="line"><a name="l06991"></a><span class="lineno"> 6991</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags);</div>
-<div class="line"><a name="l06992"></a><span class="lineno"> 6992</span>&#160; </div>
-<div class="line"><a name="l06993"></a><span class="lineno"> 6993</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetBytesMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BytesMoved; }</div>
-<div class="line"><a name="l06994"></a><span class="lineno"> 6994</span>&#160;    <span class="keyword">virtual</span> uint32_t GetAllocationsMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_AllocationsMoved; }</div>
-<div class="line"><a name="l06995"></a><span class="lineno"> 6995</span>&#160; </div>
-<div class="line"><a name="l06996"></a><span class="lineno"> 6996</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l06997"></a><span class="lineno"> 6997</span>&#160;    <span class="keyword">struct </span>BlockInfo</div>
-<div class="line"><a name="l06998"></a><span class="lineno"> 6998</span>&#160;    {</div>
-<div class="line"><a name="l06999"></a><span class="lineno"> 6999</span>&#160;        <span class="keywordtype">size_t</span> origBlockIndex;</div>
-<div class="line"><a name="l07000"></a><span class="lineno"> 7000</span>&#160;    };</div>
-<div class="line"><a name="l07001"></a><span class="lineno"> 7001</span>&#160; </div>
-<div class="line"><a name="l07002"></a><span class="lineno"> 7002</span>&#160;    <span class="keyword">class </span>FreeSpaceDatabase</div>
-<div class="line"><a name="l07003"></a><span class="lineno"> 7003</span>&#160;    {</div>
-<div class="line"><a name="l07004"></a><span class="lineno"> 7004</span>&#160;    <span class="keyword">public</span>:</div>
-<div class="line"><a name="l07005"></a><span class="lineno"> 7005</span>&#160;        FreeSpaceDatabase()</div>
-<div class="line"><a name="l07006"></a><span class="lineno"> 7006</span>&#160;        {</div>
-<div class="line"><a name="l07007"></a><span class="lineno"> 7007</span>&#160;            FreeSpace s = {};</div>
-<div class="line"><a name="l07008"></a><span class="lineno"> 7008</span>&#160;            s.blockInfoIndex = SIZE_MAX;</div>
-<div class="line"><a name="l07009"></a><span class="lineno"> 7009</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; MAX_COUNT; ++i)</div>
-<div class="line"><a name="l07010"></a><span class="lineno"> 7010</span>&#160;            {</div>
-<div class="line"><a name="l07011"></a><span class="lineno"> 7011</span>&#160;                m_FreeSpaces[i] = s;</div>
-<div class="line"><a name="l07012"></a><span class="lineno"> 7012</span>&#160;            }</div>
-<div class="line"><a name="l07013"></a><span class="lineno"> 7013</span>&#160;        }</div>
-<div class="line"><a name="l07014"></a><span class="lineno"> 7014</span>&#160; </div>
-<div class="line"><a name="l07015"></a><span class="lineno"> 7015</span>&#160;        <span class="keywordtype">void</span> Register(<span class="keywordtype">size_t</span> blockInfoIndex, VkDeviceSize offset, VkDeviceSize size)</div>
-<div class="line"><a name="l07016"></a><span class="lineno"> 7016</span>&#160;        {</div>
-<div class="line"><a name="l07017"></a><span class="lineno"> 7017</span>&#160;            <span class="keywordflow">if</span>(size &lt; VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
-<div class="line"><a name="l07018"></a><span class="lineno"> 7018</span>&#160;            {</div>
-<div class="line"><a name="l07019"></a><span class="lineno"> 7019</span>&#160;                <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l07020"></a><span class="lineno"> 7020</span>&#160;            }</div>
-<div class="line"><a name="l07021"></a><span class="lineno"> 7021</span>&#160; </div>
-<div class="line"><a name="l07022"></a><span class="lineno"> 7022</span>&#160;            <span class="comment">// Find first invalid or the smallest structure.</span></div>
-<div class="line"><a name="l07023"></a><span class="lineno"> 7023</span>&#160;            <span class="keywordtype">size_t</span> bestIndex = SIZE_MAX;</div>
-<div class="line"><a name="l07024"></a><span class="lineno"> 7024</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; MAX_COUNT; ++i)</div>
-<div class="line"><a name="l07025"></a><span class="lineno"> 7025</span>&#160;            {</div>
-<div class="line"><a name="l07026"></a><span class="lineno"> 7026</span>&#160;                <span class="comment">// Empty structure.</span></div>
-<div class="line"><a name="l07027"></a><span class="lineno"> 7027</span>&#160;                <span class="keywordflow">if</span>(m_FreeSpaces[i].blockInfoIndex == SIZE_MAX)</div>
-<div class="line"><a name="l07028"></a><span class="lineno"> 7028</span>&#160;                {</div>
-<div class="line"><a name="l07029"></a><span class="lineno"> 7029</span>&#160;                    bestIndex = i;</div>
-<div class="line"><a name="l07030"></a><span class="lineno"> 7030</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l07031"></a><span class="lineno"> 7031</span>&#160;                }</div>
-<div class="line"><a name="l07032"></a><span class="lineno"> 7032</span>&#160;                <span class="keywordflow">if</span>(m_FreeSpaces[i].size &lt; size &amp;&amp;</div>
-<div class="line"><a name="l07033"></a><span class="lineno"> 7033</span>&#160;                    (bestIndex == SIZE_MAX || m_FreeSpaces[bestIndex].size &gt; m_FreeSpaces[i].size))</div>
-<div class="line"><a name="l07034"></a><span class="lineno"> 7034</span>&#160;                {</div>
-<div class="line"><a name="l07035"></a><span class="lineno"> 7035</span>&#160;                    bestIndex = i;</div>
-<div class="line"><a name="l07036"></a><span class="lineno"> 7036</span>&#160;                }</div>
-<div class="line"><a name="l07037"></a><span class="lineno"> 7037</span>&#160;            }</div>
+<div class="line"><a name="l06973"></a><span class="lineno"> 6973</span>&#160;    <span class="keywordtype">void</span> UpdateHasEmptyBlock();</div>
+<div class="line"><a name="l06974"></a><span class="lineno"> 6974</span>&#160;};</div>
+<div class="line"><a name="l06975"></a><span class="lineno"> 6975</span>&#160; </div>
+<div class="line"><a name="l06976"></a><span class="lineno"> 6976</span>&#160;<span class="keyword">struct </span>VmaPool_T</div>
+<div class="line"><a name="l06977"></a><span class="lineno"> 6977</span>&#160;{</div>
+<div class="line"><a name="l06978"></a><span class="lineno"> 6978</span>&#160;    VMA_CLASS_NO_COPY(VmaPool_T)</div>
+<div class="line"><a name="l06979"></a><span class="lineno"> 6979</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l06980"></a><span class="lineno"> 6980</span>&#160;    VmaBlockVector m_BlockVector;</div>
+<div class="line"><a name="l06981"></a><span class="lineno"> 6981</span>&#160; </div>
+<div class="line"><a name="l06982"></a><span class="lineno"> 6982</span>&#160;    VmaPool_T(</div>
+<div class="line"><a name="l06983"></a><span class="lineno"> 6983</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l06984"></a><span class="lineno"> 6984</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l06985"></a><span class="lineno"> 6985</span>&#160;        VkDeviceSize preferredBlockSize);</div>
+<div class="line"><a name="l06986"></a><span class="lineno"> 6986</span>&#160;    ~VmaPool_T();</div>
+<div class="line"><a name="l06987"></a><span class="lineno"> 6987</span>&#160; </div>
+<div class="line"><a name="l06988"></a><span class="lineno"> 6988</span>&#160;    uint32_t GetId()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Id; }</div>
+<div class="line"><a name="l06989"></a><span class="lineno"> 6989</span>&#160;    <span class="keywordtype">void</span> SetId(uint32_t <span class="keywordtype">id</span>) { VMA_ASSERT(m_Id == 0); m_Id = id; }</div>
+<div class="line"><a name="l06990"></a><span class="lineno"> 6990</span>&#160; </div>
+<div class="line"><a name="l06991"></a><span class="lineno"> 6991</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* GetName()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Name; }</div>
+<div class="line"><a name="l06992"></a><span class="lineno"> 6992</span>&#160;    <span class="keywordtype">void</span> SetName(<span class="keyword">const</span> <span class="keywordtype">char</span>* pName);</div>
+<div class="line"><a name="l06993"></a><span class="lineno"> 6993</span>&#160; </div>
+<div class="line"><a name="l06994"></a><span class="lineno"> 6994</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l06995"></a><span class="lineno"> 6995</span>&#160;    <span class="comment">//void PrintDetailedMap(class VmaStringBuilder&amp; sb);</span></div>
+<div class="line"><a name="l06996"></a><span class="lineno"> 6996</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l06997"></a><span class="lineno"> 6997</span>&#160; </div>
+<div class="line"><a name="l06998"></a><span class="lineno"> 6998</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l06999"></a><span class="lineno"> 6999</span>&#160;    uint32_t m_Id;</div>
+<div class="line"><a name="l07000"></a><span class="lineno"> 7000</span>&#160;    <span class="keywordtype">char</span>* m_Name;</div>
+<div class="line"><a name="l07001"></a><span class="lineno"> 7001</span>&#160;};</div>
+<div class="line"><a name="l07002"></a><span class="lineno"> 7002</span>&#160; </div>
+<div class="line"><a name="l07003"></a><span class="lineno"> 7003</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l07004"></a><span class="lineno"> 7004</span>&#160;<span class="comment">Performs defragmentation:</span></div>
+<div class="line"><a name="l07005"></a><span class="lineno"> 7005</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l07006"></a><span class="lineno"> 7006</span>&#160;<span class="comment">- Updates `pBlockVector-&gt;m_pMetadata`.</span></div>
+<div class="line"><a name="l07007"></a><span class="lineno"> 7007</span>&#160;<span class="comment">- Updates allocations by calling ChangeBlockAllocation() or ChangeOffset().</span></div>
+<div class="line"><a name="l07008"></a><span class="lineno"> 7008</span>&#160;<span class="comment">- Does not move actual data, only returns requested moves as `moves`.</span></div>
+<div class="line"><a name="l07009"></a><span class="lineno"> 7009</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l07010"></a><span class="lineno"> 7010</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm</div>
+<div class="line"><a name="l07011"></a><span class="lineno"> 7011</span>&#160;{</div>
+<div class="line"><a name="l07012"></a><span class="lineno"> 7012</span>&#160;    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm)</div>
+<div class="line"><a name="l07013"></a><span class="lineno"> 7013</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l07014"></a><span class="lineno"> 7014</span>&#160;    VmaDefragmentationAlgorithm(</div>
+<div class="line"><a name="l07015"></a><span class="lineno"> 7015</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l07016"></a><span class="lineno"> 7016</span>&#160;        VmaBlockVector* pBlockVector,</div>
+<div class="line"><a name="l07017"></a><span class="lineno"> 7017</span>&#160;        uint32_t currentFrameIndex) :</div>
+<div class="line"><a name="l07018"></a><span class="lineno"> 7018</span>&#160;        m_hAllocator(hAllocator),</div>
+<div class="line"><a name="l07019"></a><span class="lineno"> 7019</span>&#160;        m_pBlockVector(pBlockVector),</div>
+<div class="line"><a name="l07020"></a><span class="lineno"> 7020</span>&#160;        m_CurrentFrameIndex(currentFrameIndex)</div>
+<div class="line"><a name="l07021"></a><span class="lineno"> 7021</span>&#160;    {</div>
+<div class="line"><a name="l07022"></a><span class="lineno"> 7022</span>&#160;    }</div>
+<div class="line"><a name="l07023"></a><span class="lineno"> 7023</span>&#160;    <span class="keyword">virtual</span> ~VmaDefragmentationAlgorithm()</div>
+<div class="line"><a name="l07024"></a><span class="lineno"> 7024</span>&#160;    {</div>
+<div class="line"><a name="l07025"></a><span class="lineno"> 7025</span>&#160;    }</div>
+<div class="line"><a name="l07026"></a><span class="lineno"> 7026</span>&#160; </div>
+<div class="line"><a name="l07027"></a><span class="lineno"> 7027</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged) = 0;</div>
+<div class="line"><a name="l07028"></a><span class="lineno"> 7028</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAll() = 0;</div>
+<div class="line"><a name="l07029"></a><span class="lineno"> 7029</span>&#160; </div>
+<div class="line"><a name="l07030"></a><span class="lineno"> 7030</span>&#160;    <span class="keyword">virtual</span> VkResult Defragment(</div>
+<div class="line"><a name="l07031"></a><span class="lineno"> 7031</span>&#160;        VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
+<div class="line"><a name="l07032"></a><span class="lineno"> 7032</span>&#160;        VkDeviceSize maxBytesToMove,</div>
+<div class="line"><a name="l07033"></a><span class="lineno"> 7033</span>&#160;        uint32_t maxAllocationsToMove,</div>
+<div class="line"><a name="l07034"></a><span class="lineno"> 7034</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags) = 0;</div>
+<div class="line"><a name="l07035"></a><span class="lineno"> 7035</span>&#160; </div>
+<div class="line"><a name="l07036"></a><span class="lineno"> 7036</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetBytesMoved() <span class="keyword">const</span> = 0;</div>
+<div class="line"><a name="l07037"></a><span class="lineno"> 7037</span>&#160;    <span class="keyword">virtual</span> uint32_t GetAllocationsMoved() <span class="keyword">const</span> = 0;</div>
 <div class="line"><a name="l07038"></a><span class="lineno"> 7038</span>&#160; </div>
-<div class="line"><a name="l07039"></a><span class="lineno"> 7039</span>&#160;            <span class="keywordflow">if</span>(bestIndex != SIZE_MAX)</div>
-<div class="line"><a name="l07040"></a><span class="lineno"> 7040</span>&#160;            {</div>
-<div class="line"><a name="l07041"></a><span class="lineno"> 7041</span>&#160;                m_FreeSpaces[bestIndex].blockInfoIndex = blockInfoIndex;</div>
-<div class="line"><a name="l07042"></a><span class="lineno"> 7042</span>&#160;                m_FreeSpaces[bestIndex].offset = offset;</div>
-<div class="line"><a name="l07043"></a><span class="lineno"> 7043</span>&#160;                m_FreeSpaces[bestIndex].size = size;</div>
-<div class="line"><a name="l07044"></a><span class="lineno"> 7044</span>&#160;            }</div>
-<div class="line"><a name="l07045"></a><span class="lineno"> 7045</span>&#160;        }</div>
-<div class="line"><a name="l07046"></a><span class="lineno"> 7046</span>&#160; </div>
-<div class="line"><a name="l07047"></a><span class="lineno"> 7047</span>&#160;        <span class="keywordtype">bool</span> Fetch(VkDeviceSize alignment, VkDeviceSize size,</div>
-<div class="line"><a name="l07048"></a><span class="lineno"> 7048</span>&#160;            <span class="keywordtype">size_t</span>&amp; outBlockInfoIndex, VkDeviceSize&amp; outDstOffset)</div>
-<div class="line"><a name="l07049"></a><span class="lineno"> 7049</span>&#160;        {</div>
-<div class="line"><a name="l07050"></a><span class="lineno"> 7050</span>&#160;            <span class="keywordtype">size_t</span> bestIndex = SIZE_MAX;</div>
-<div class="line"><a name="l07051"></a><span class="lineno"> 7051</span>&#160;            VkDeviceSize bestFreeSpaceAfter = 0;</div>
-<div class="line"><a name="l07052"></a><span class="lineno"> 7052</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; MAX_COUNT; ++i)</div>
-<div class="line"><a name="l07053"></a><span class="lineno"> 7053</span>&#160;            {</div>
-<div class="line"><a name="l07054"></a><span class="lineno"> 7054</span>&#160;                <span class="comment">// Structure is valid.</span></div>
-<div class="line"><a name="l07055"></a><span class="lineno"> 7055</span>&#160;                <span class="keywordflow">if</span>(m_FreeSpaces[i].blockInfoIndex != SIZE_MAX)</div>
-<div class="line"><a name="l07056"></a><span class="lineno"> 7056</span>&#160;                {</div>
-<div class="line"><a name="l07057"></a><span class="lineno"> 7057</span>&#160;                    <span class="keyword">const</span> VkDeviceSize dstOffset = VmaAlignUp(m_FreeSpaces[i].offset, alignment);</div>
-<div class="line"><a name="l07058"></a><span class="lineno"> 7058</span>&#160;                    <span class="comment">// Allocation fits into this structure.</span></div>
-<div class="line"><a name="l07059"></a><span class="lineno"> 7059</span>&#160;                    <span class="keywordflow">if</span>(dstOffset + size &lt;= m_FreeSpaces[i].offset + m_FreeSpaces[i].size)</div>
-<div class="line"><a name="l07060"></a><span class="lineno"> 7060</span>&#160;                    {</div>
-<div class="line"><a name="l07061"></a><span class="lineno"> 7061</span>&#160;                        <span class="keyword">const</span> VkDeviceSize freeSpaceAfter = (m_FreeSpaces[i].offset + m_FreeSpaces[i].size) -</div>
-<div class="line"><a name="l07062"></a><span class="lineno"> 7062</span>&#160;                            (dstOffset + size);</div>
-<div class="line"><a name="l07063"></a><span class="lineno"> 7063</span>&#160;                        <span class="keywordflow">if</span>(bestIndex == SIZE_MAX || freeSpaceAfter &gt; bestFreeSpaceAfter)</div>
-<div class="line"><a name="l07064"></a><span class="lineno"> 7064</span>&#160;                        {</div>
-<div class="line"><a name="l07065"></a><span class="lineno"> 7065</span>&#160;                            bestIndex = i;</div>
-<div class="line"><a name="l07066"></a><span class="lineno"> 7066</span>&#160;                            bestFreeSpaceAfter = freeSpaceAfter;</div>
-<div class="line"><a name="l07067"></a><span class="lineno"> 7067</span>&#160;                        }</div>
-<div class="line"><a name="l07068"></a><span class="lineno"> 7068</span>&#160;                    }</div>
-<div class="line"><a name="l07069"></a><span class="lineno"> 7069</span>&#160;                }</div>
-<div class="line"><a name="l07070"></a><span class="lineno"> 7070</span>&#160;            }</div>
-<div class="line"><a name="l07071"></a><span class="lineno"> 7071</span>&#160;            </div>
-<div class="line"><a name="l07072"></a><span class="lineno"> 7072</span>&#160;            <span class="keywordflow">if</span>(bestIndex != SIZE_MAX)</div>
-<div class="line"><a name="l07073"></a><span class="lineno"> 7073</span>&#160;            {</div>
-<div class="line"><a name="l07074"></a><span class="lineno"> 7074</span>&#160;                outBlockInfoIndex = m_FreeSpaces[bestIndex].blockInfoIndex;</div>
-<div class="line"><a name="l07075"></a><span class="lineno"> 7075</span>&#160;                outDstOffset = VmaAlignUp(m_FreeSpaces[bestIndex].offset, alignment);</div>
-<div class="line"><a name="l07076"></a><span class="lineno"> 7076</span>&#160; </div>
-<div class="line"><a name="l07077"></a><span class="lineno"> 7077</span>&#160;                <span class="keywordflow">if</span>(bestFreeSpaceAfter &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
-<div class="line"><a name="l07078"></a><span class="lineno"> 7078</span>&#160;                {</div>
-<div class="line"><a name="l07079"></a><span class="lineno"> 7079</span>&#160;                    <span class="comment">// Leave this structure for remaining empty space.</span></div>
-<div class="line"><a name="l07080"></a><span class="lineno"> 7080</span>&#160;                    <span class="keyword">const</span> VkDeviceSize alignmentPlusSize = (outDstOffset - m_FreeSpaces[bestIndex].offset) + size;</div>
-<div class="line"><a name="l07081"></a><span class="lineno"> 7081</span>&#160;                    m_FreeSpaces[bestIndex].offset += alignmentPlusSize;</div>
-<div class="line"><a name="l07082"></a><span class="lineno"> 7082</span>&#160;                    m_FreeSpaces[bestIndex].size -= alignmentPlusSize;</div>
-<div class="line"><a name="l07083"></a><span class="lineno"> 7083</span>&#160;                }</div>
-<div class="line"><a name="l07084"></a><span class="lineno"> 7084</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l07085"></a><span class="lineno"> 7085</span>&#160;                {</div>
-<div class="line"><a name="l07086"></a><span class="lineno"> 7086</span>&#160;                    <span class="comment">// This structure becomes invalid.</span></div>
-<div class="line"><a name="l07087"></a><span class="lineno"> 7087</span>&#160;                    m_FreeSpaces[bestIndex].blockInfoIndex = SIZE_MAX;</div>
-<div class="line"><a name="l07088"></a><span class="lineno"> 7088</span>&#160;                }</div>
-<div class="line"><a name="l07089"></a><span class="lineno"> 7089</span>&#160; </div>
-<div class="line"><a name="l07090"></a><span class="lineno"> 7090</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l07091"></a><span class="lineno"> 7091</span>&#160;            }</div>
-<div class="line"><a name="l07092"></a><span class="lineno"> 7092</span>&#160; </div>
-<div class="line"><a name="l07093"></a><span class="lineno"> 7093</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l07094"></a><span class="lineno"> 7094</span>&#160;        }</div>
-<div class="line"><a name="l07095"></a><span class="lineno"> 7095</span>&#160; </div>
-<div class="line"><a name="l07096"></a><span class="lineno"> 7096</span>&#160;    <span class="keyword">private</span>:</div>
-<div class="line"><a name="l07097"></a><span class="lineno"> 7097</span>&#160;        <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> MAX_COUNT = 4;</div>
-<div class="line"><a name="l07098"></a><span class="lineno"> 7098</span>&#160; </div>
-<div class="line"><a name="l07099"></a><span class="lineno"> 7099</span>&#160;        <span class="keyword">struct </span>FreeSpace</div>
-<div class="line"><a name="l07100"></a><span class="lineno"> 7100</span>&#160;        {</div>
-<div class="line"><a name="l07101"></a><span class="lineno"> 7101</span>&#160;            <span class="keywordtype">size_t</span> blockInfoIndex; <span class="comment">// SIZE_MAX means this structure is invalid.</span></div>
-<div class="line"><a name="l07102"></a><span class="lineno"> 7102</span>&#160;            VkDeviceSize offset;</div>
-<div class="line"><a name="l07103"></a><span class="lineno"> 7103</span>&#160;            VkDeviceSize size;</div>
-<div class="line"><a name="l07104"></a><span class="lineno"> 7104</span>&#160;        } m_FreeSpaces[MAX_COUNT];</div>
-<div class="line"><a name="l07105"></a><span class="lineno"> 7105</span>&#160;    };</div>
-<div class="line"><a name="l07106"></a><span class="lineno"> 7106</span>&#160; </div>
-<div class="line"><a name="l07107"></a><span class="lineno"> 7107</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> m_OverlappingMoveSupported;</div>
-<div class="line"><a name="l07108"></a><span class="lineno"> 7108</span>&#160; </div>
-<div class="line"><a name="l07109"></a><span class="lineno"> 7109</span>&#160;    uint32_t m_AllocationCount;</div>
-<div class="line"><a name="l07110"></a><span class="lineno"> 7110</span>&#160;    <span class="keywordtype">bool</span> m_AllAllocations;</div>
-<div class="line"><a name="l07111"></a><span class="lineno"> 7111</span>&#160; </div>
-<div class="line"><a name="l07112"></a><span class="lineno"> 7112</span>&#160;    VkDeviceSize m_BytesMoved;</div>
-<div class="line"><a name="l07113"></a><span class="lineno"> 7113</span>&#160;    uint32_t m_AllocationsMoved;</div>
+<div class="line"><a name="l07039"></a><span class="lineno"> 7039</span>&#160;<span class="keyword">protected</span>:</div>
+<div class="line"><a name="l07040"></a><span class="lineno"> 7040</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> <span class="keyword">const</span> m_hAllocator;</div>
+<div class="line"><a name="l07041"></a><span class="lineno"> 7041</span>&#160;    VmaBlockVector* <span class="keyword">const</span> m_pBlockVector;</div>
+<div class="line"><a name="l07042"></a><span class="lineno"> 7042</span>&#160;    <span class="keyword">const</span> uint32_t m_CurrentFrameIndex;</div>
+<div class="line"><a name="l07043"></a><span class="lineno"> 7043</span>&#160; </div>
+<div class="line"><a name="l07044"></a><span class="lineno"> 7044</span>&#160;    <span class="keyword">struct </span>AllocationInfo</div>
+<div class="line"><a name="l07045"></a><span class="lineno"> 7045</span>&#160;    {</div>
+<div class="line"><a name="l07046"></a><span class="lineno"> 7046</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> m_hAllocation;</div>
+<div class="line"><a name="l07047"></a><span class="lineno"> 7047</span>&#160;        VkBool32* m_pChanged;</div>
+<div class="line"><a name="l07048"></a><span class="lineno"> 7048</span>&#160; </div>
+<div class="line"><a name="l07049"></a><span class="lineno"> 7049</span>&#160;        AllocationInfo() :</div>
+<div class="line"><a name="l07050"></a><span class="lineno"> 7050</span>&#160;            m_hAllocation(VK_NULL_HANDLE),</div>
+<div class="line"><a name="l07051"></a><span class="lineno"> 7051</span>&#160;            m_pChanged(VMA_NULL)</div>
+<div class="line"><a name="l07052"></a><span class="lineno"> 7052</span>&#160;        {</div>
+<div class="line"><a name="l07053"></a><span class="lineno"> 7053</span>&#160;        }</div>
+<div class="line"><a name="l07054"></a><span class="lineno"> 7054</span>&#160;        AllocationInfo(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged) :</div>
+<div class="line"><a name="l07055"></a><span class="lineno"> 7055</span>&#160;            m_hAllocation(hAlloc),</div>
+<div class="line"><a name="l07056"></a><span class="lineno"> 7056</span>&#160;            m_pChanged(pChanged)</div>
+<div class="line"><a name="l07057"></a><span class="lineno"> 7057</span>&#160;        {</div>
+<div class="line"><a name="l07058"></a><span class="lineno"> 7058</span>&#160;        }</div>
+<div class="line"><a name="l07059"></a><span class="lineno"> 7059</span>&#160;    };</div>
+<div class="line"><a name="l07060"></a><span class="lineno"> 7060</span>&#160;};</div>
+<div class="line"><a name="l07061"></a><span class="lineno"> 7061</span>&#160; </div>
+<div class="line"><a name="l07062"></a><span class="lineno"> 7062</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm_Generic : <span class="keyword">public</span> VmaDefragmentationAlgorithm</div>
+<div class="line"><a name="l07063"></a><span class="lineno"> 7063</span>&#160;{</div>
+<div class="line"><a name="l07064"></a><span class="lineno"> 7064</span>&#160;    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm_Generic)</div>
+<div class="line"><a name="l07065"></a><span class="lineno"> 7065</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l07066"></a><span class="lineno"> 7066</span>&#160;    VmaDefragmentationAlgorithm_Generic(</div>
+<div class="line"><a name="l07067"></a><span class="lineno"> 7067</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l07068"></a><span class="lineno"> 7068</span>&#160;        VmaBlockVector* pBlockVector,</div>
+<div class="line"><a name="l07069"></a><span class="lineno"> 7069</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l07070"></a><span class="lineno"> 7070</span>&#160;        <span class="keywordtype">bool</span> overlappingMoveSupported);</div>
+<div class="line"><a name="l07071"></a><span class="lineno"> 7071</span>&#160;    <span class="keyword">virtual</span> ~VmaDefragmentationAlgorithm_Generic();</div>
+<div class="line"><a name="l07072"></a><span class="lineno"> 7072</span>&#160; </div>
+<div class="line"><a name="l07073"></a><span class="lineno"> 7073</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged);</div>
+<div class="line"><a name="l07074"></a><span class="lineno"> 7074</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAll() { m_AllAllocations = <span class="keyword">true</span>; }</div>
+<div class="line"><a name="l07075"></a><span class="lineno"> 7075</span>&#160; </div>
+<div class="line"><a name="l07076"></a><span class="lineno"> 7076</span>&#160;    <span class="keyword">virtual</span> VkResult Defragment(</div>
+<div class="line"><a name="l07077"></a><span class="lineno"> 7077</span>&#160;        VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
+<div class="line"><a name="l07078"></a><span class="lineno"> 7078</span>&#160;        VkDeviceSize maxBytesToMove,</div>
+<div class="line"><a name="l07079"></a><span class="lineno"> 7079</span>&#160;        uint32_t maxAllocationsToMove,</div>
+<div class="line"><a name="l07080"></a><span class="lineno"> 7080</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags);</div>
+<div class="line"><a name="l07081"></a><span class="lineno"> 7081</span>&#160; </div>
+<div class="line"><a name="l07082"></a><span class="lineno"> 7082</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetBytesMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BytesMoved; }</div>
+<div class="line"><a name="l07083"></a><span class="lineno"> 7083</span>&#160;    <span class="keyword">virtual</span> uint32_t GetAllocationsMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_AllocationsMoved; }</div>
+<div class="line"><a name="l07084"></a><span class="lineno"> 7084</span>&#160; </div>
+<div class="line"><a name="l07085"></a><span class="lineno"> 7085</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l07086"></a><span class="lineno"> 7086</span>&#160;    uint32_t m_AllocationCount;</div>
+<div class="line"><a name="l07087"></a><span class="lineno"> 7087</span>&#160;    <span class="keywordtype">bool</span> m_AllAllocations;</div>
+<div class="line"><a name="l07088"></a><span class="lineno"> 7088</span>&#160; </div>
+<div class="line"><a name="l07089"></a><span class="lineno"> 7089</span>&#160;    VkDeviceSize m_BytesMoved;</div>
+<div class="line"><a name="l07090"></a><span class="lineno"> 7090</span>&#160;    uint32_t m_AllocationsMoved;</div>
+<div class="line"><a name="l07091"></a><span class="lineno"> 7091</span>&#160; </div>
+<div class="line"><a name="l07092"></a><span class="lineno"> 7092</span>&#160;    <span class="keyword">struct </span>AllocationInfoSizeGreater</div>
+<div class="line"><a name="l07093"></a><span class="lineno"> 7093</span>&#160;    {</div>
+<div class="line"><a name="l07094"></a><span class="lineno"> 7094</span>&#160;        <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> AllocationInfo&amp; lhs, <span class="keyword">const</span> AllocationInfo&amp; rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l07095"></a><span class="lineno"> 7095</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l07096"></a><span class="lineno"> 7096</span>&#160;            <span class="keywordflow">return</span> lhs.m_hAllocation-&gt;GetSize() &gt; rhs.m_hAllocation-&gt;GetSize();</div>
+<div class="line"><a name="l07097"></a><span class="lineno"> 7097</span>&#160;        }</div>
+<div class="line"><a name="l07098"></a><span class="lineno"> 7098</span>&#160;    };</div>
+<div class="line"><a name="l07099"></a><span class="lineno"> 7099</span>&#160; </div>
+<div class="line"><a name="l07100"></a><span class="lineno"> 7100</span>&#160;    <span class="keyword">struct </span>AllocationInfoOffsetGreater</div>
+<div class="line"><a name="l07101"></a><span class="lineno"> 7101</span>&#160;    {</div>
+<div class="line"><a name="l07102"></a><span class="lineno"> 7102</span>&#160;        <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> AllocationInfo&amp; lhs, <span class="keyword">const</span> AllocationInfo&amp; rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l07103"></a><span class="lineno"> 7103</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l07104"></a><span class="lineno"> 7104</span>&#160;            <span class="keywordflow">return</span> lhs.m_hAllocation-&gt;GetOffset() &gt; rhs.m_hAllocation-&gt;GetOffset();</div>
+<div class="line"><a name="l07105"></a><span class="lineno"> 7105</span>&#160;        }</div>
+<div class="line"><a name="l07106"></a><span class="lineno"> 7106</span>&#160;    };</div>
+<div class="line"><a name="l07107"></a><span class="lineno"> 7107</span>&#160; </div>
+<div class="line"><a name="l07108"></a><span class="lineno"> 7108</span>&#160;    <span class="keyword">struct </span>BlockInfo</div>
+<div class="line"><a name="l07109"></a><span class="lineno"> 7109</span>&#160;    {</div>
+<div class="line"><a name="l07110"></a><span class="lineno"> 7110</span>&#160;        <span class="keywordtype">size_t</span> m_OriginalBlockIndex;</div>
+<div class="line"><a name="l07111"></a><span class="lineno"> 7111</span>&#160;        VmaDeviceMemoryBlock* m_pBlock;</div>
+<div class="line"><a name="l07112"></a><span class="lineno"> 7112</span>&#160;        <span class="keywordtype">bool</span> m_HasNonMovableAllocations;</div>
+<div class="line"><a name="l07113"></a><span class="lineno"> 7113</span>&#160;        VmaVector&lt; AllocationInfo, VmaStlAllocator&lt;AllocationInfo&gt; &gt; m_Allocations;</div>
 <div class="line"><a name="l07114"></a><span class="lineno"> 7114</span>&#160; </div>
-<div class="line"><a name="l07115"></a><span class="lineno"> 7115</span>&#160;    VmaVector&lt; BlockInfo, VmaStlAllocator&lt;BlockInfo&gt; &gt; m_BlockInfos;</div>
-<div class="line"><a name="l07116"></a><span class="lineno"> 7116</span>&#160; </div>
-<div class="line"><a name="l07117"></a><span class="lineno"> 7117</span>&#160;    <span class="keywordtype">void</span> PreprocessMetadata();</div>
-<div class="line"><a name="l07118"></a><span class="lineno"> 7118</span>&#160;    <span class="keywordtype">void</span> PostprocessMetadata();</div>
-<div class="line"><a name="l07119"></a><span class="lineno"> 7119</span>&#160;    <span class="keywordtype">void</span> InsertSuballoc(VmaBlockMetadata_Generic* pMetadata, <span class="keyword">const</span> VmaSuballocation&amp; suballoc);</div>
-<div class="line"><a name="l07120"></a><span class="lineno"> 7120</span>&#160;};</div>
-<div class="line"><a name="l07121"></a><span class="lineno"> 7121</span>&#160; </div>
-<div class="line"><a name="l07122"></a><span class="lineno"> 7122</span>&#160;<span class="keyword">struct </span>VmaBlockDefragmentationContext</div>
-<div class="line"><a name="l07123"></a><span class="lineno"> 7123</span>&#160;{</div>
-<div class="line"><a name="l07124"></a><span class="lineno"> 7124</span>&#160;    <span class="keyword">enum</span> BLOCK_FLAG</div>
-<div class="line"><a name="l07125"></a><span class="lineno"> 7125</span>&#160;    {</div>
-<div class="line"><a name="l07126"></a><span class="lineno"> 7126</span>&#160;        BLOCK_FLAG_USED = 0x00000001,</div>
-<div class="line"><a name="l07127"></a><span class="lineno"> 7127</span>&#160;    };</div>
-<div class="line"><a name="l07128"></a><span class="lineno"> 7128</span>&#160;    uint32_t flags;</div>
-<div class="line"><a name="l07129"></a><span class="lineno"> 7129</span>&#160;    VkBuffer hBuffer;</div>
-<div class="line"><a name="l07130"></a><span class="lineno"> 7130</span>&#160;};</div>
-<div class="line"><a name="l07131"></a><span class="lineno"> 7131</span>&#160; </div>
-<div class="line"><a name="l07132"></a><span class="lineno"> 7132</span>&#160;<span class="keyword">class </span>VmaBlockVectorDefragmentationContext</div>
-<div class="line"><a name="l07133"></a><span class="lineno"> 7133</span>&#160;{</div>
-<div class="line"><a name="l07134"></a><span class="lineno"> 7134</span>&#160;    VMA_CLASS_NO_COPY(VmaBlockVectorDefragmentationContext)</div>
-<div class="line"><a name="l07135"></a><span class="lineno"> 7135</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l07136"></a><span class="lineno"> 7136</span>&#160;    VkResult res;</div>
-<div class="line"><a name="l07137"></a><span class="lineno"> 7137</span>&#160;    <span class="keywordtype">bool</span> mutexLocked;</div>
-<div class="line"><a name="l07138"></a><span class="lineno"> 7138</span>&#160;    VmaVector&lt; VmaBlockDefragmentationContext, VmaStlAllocator&lt;VmaBlockDefragmentationContext&gt; &gt; blockContexts;</div>
-<div class="line"><a name="l07139"></a><span class="lineno"> 7139</span>&#160;    VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt; defragmentationMoves;</div>
-<div class="line"><a name="l07140"></a><span class="lineno"> 7140</span>&#160;    uint32_t defragmentationMovesProcessed;</div>
-<div class="line"><a name="l07141"></a><span class="lineno"> 7141</span>&#160;    uint32_t defragmentationMovesCommitted;</div>
-<div class="line"><a name="l07142"></a><span class="lineno"> 7142</span>&#160;    <span class="keywordtype">bool</span> hasDefragmentationPlan;</div>
-<div class="line"><a name="l07143"></a><span class="lineno"> 7143</span>&#160; </div>
-<div class="line"><a name="l07144"></a><span class="lineno"> 7144</span>&#160;    VmaBlockVectorDefragmentationContext(</div>
-<div class="line"><a name="l07145"></a><span class="lineno"> 7145</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l07146"></a><span class="lineno"> 7146</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> hCustomPool, <span class="comment">// Optional.</span></div>
-<div class="line"><a name="l07147"></a><span class="lineno"> 7147</span>&#160;        VmaBlockVector* pBlockVector,</div>
-<div class="line"><a name="l07148"></a><span class="lineno"> 7148</span>&#160;        uint32_t currFrameIndex);</div>
-<div class="line"><a name="l07149"></a><span class="lineno"> 7149</span>&#160;    ~VmaBlockVectorDefragmentationContext();</div>
-<div class="line"><a name="l07150"></a><span class="lineno"> 7150</span>&#160; </div>
-<div class="line"><a name="l07151"></a><span class="lineno"> 7151</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> GetCustomPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hCustomPool; }</div>
-<div class="line"><a name="l07152"></a><span class="lineno"> 7152</span>&#160;    VmaBlockVector* GetBlockVector()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pBlockVector; }</div>
-<div class="line"><a name="l07153"></a><span class="lineno"> 7153</span>&#160;    VmaDefragmentationAlgorithm* GetAlgorithm()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pAlgorithm; }</div>
-<div class="line"><a name="l07154"></a><span class="lineno"> 7154</span>&#160; </div>
-<div class="line"><a name="l07155"></a><span class="lineno"> 7155</span>&#160;    <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged);</div>
-<div class="line"><a name="l07156"></a><span class="lineno"> 7156</span>&#160;    <span class="keywordtype">void</span> AddAll() { m_AllAllocations = <span class="keyword">true</span>; }</div>
-<div class="line"><a name="l07157"></a><span class="lineno"> 7157</span>&#160; </div>
-<div class="line"><a name="l07158"></a><span class="lineno"> 7158</span>&#160;    <span class="keywordtype">void</span> Begin(<span class="keywordtype">bool</span> overlappingMoveSupported, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags);</div>
-<div class="line"><a name="l07159"></a><span class="lineno"> 7159</span>&#160; </div>
-<div class="line"><a name="l07160"></a><span class="lineno"> 7160</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l07161"></a><span class="lineno"> 7161</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> m_hAllocator;</div>
-<div class="line"><a name="l07162"></a><span class="lineno"> 7162</span>&#160;    <span class="comment">// Null if not from custom pool.</span></div>
-<div class="line"><a name="l07163"></a><span class="lineno"> 7163</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a> m_hCustomPool;</div>
-<div class="line"><a name="l07164"></a><span class="lineno"> 7164</span>&#160;    <span class="comment">// Redundant, for convenience not to fetch from m_hCustomPool-&gt;m_BlockVector or m_hAllocator-&gt;m_pBlockVectors.</span></div>
-<div class="line"><a name="l07165"></a><span class="lineno"> 7165</span>&#160;    VmaBlockVector* <span class="keyword">const</span> m_pBlockVector;</div>
-<div class="line"><a name="l07166"></a><span class="lineno"> 7166</span>&#160;    <span class="keyword">const</span> uint32_t m_CurrFrameIndex;</div>
-<div class="line"><a name="l07167"></a><span class="lineno"> 7167</span>&#160;    <span class="comment">// Owner of this object.</span></div>
-<div class="line"><a name="l07168"></a><span class="lineno"> 7168</span>&#160;    VmaDefragmentationAlgorithm* m_pAlgorithm;</div>
-<div class="line"><a name="l07169"></a><span class="lineno"> 7169</span>&#160; </div>
-<div class="line"><a name="l07170"></a><span class="lineno"> 7170</span>&#160;    <span class="keyword">struct </span>AllocInfo</div>
-<div class="line"><a name="l07171"></a><span class="lineno"> 7171</span>&#160;    {</div>
-<div class="line"><a name="l07172"></a><span class="lineno"> 7172</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc;</div>
-<div class="line"><a name="l07173"></a><span class="lineno"> 7173</span>&#160;        VkBool32* pChanged;</div>
-<div class="line"><a name="l07174"></a><span class="lineno"> 7174</span>&#160;    };</div>
-<div class="line"><a name="l07175"></a><span class="lineno"> 7175</span>&#160;    <span class="comment">// Used between constructor and Begin.</span></div>
-<div class="line"><a name="l07176"></a><span class="lineno"> 7176</span>&#160;    VmaVector&lt; AllocInfo, VmaStlAllocator&lt;AllocInfo&gt; &gt; m_Allocations;</div>
-<div class="line"><a name="l07177"></a><span class="lineno"> 7177</span>&#160;    <span class="keywordtype">bool</span> m_AllAllocations;</div>
-<div class="line"><a name="l07178"></a><span class="lineno"> 7178</span>&#160;};</div>
-<div class="line"><a name="l07179"></a><span class="lineno"> 7179</span>&#160; </div>
-<div class="line"><a name="l07180"></a><span class="lineno"> 7180</span>&#160;<span class="keyword">struct </span>VmaDefragmentationContext_T</div>
-<div class="line"><a name="l07181"></a><span class="lineno"> 7181</span>&#160;{</div>
-<div class="line"><a name="l07182"></a><span class="lineno"> 7182</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l07183"></a><span class="lineno"> 7183</span>&#160;    VMA_CLASS_NO_COPY(VmaDefragmentationContext_T)</div>
-<div class="line"><a name="l07184"></a><span class="lineno"> 7184</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l07185"></a><span class="lineno"> 7185</span>&#160;    VmaDefragmentationContext_T(</div>
-<div class="line"><a name="l07186"></a><span class="lineno"> 7186</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l07187"></a><span class="lineno"> 7187</span>&#160;        uint32_t currFrameIndex,</div>
-<div class="line"><a name="l07188"></a><span class="lineno"> 7188</span>&#160;        uint32_t flags,</div>
-<div class="line"><a name="l07189"></a><span class="lineno"> 7189</span>&#160;        <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats);</div>
-<div class="line"><a name="l07190"></a><span class="lineno"> 7190</span>&#160;    ~VmaDefragmentationContext_T();</div>
-<div class="line"><a name="l07191"></a><span class="lineno"> 7191</span>&#160; </div>
-<div class="line"><a name="l07192"></a><span class="lineno"> 7192</span>&#160;    <span class="keywordtype">void</span> AddPools(uint32_t poolCount, <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPools);</div>
-<div class="line"><a name="l07193"></a><span class="lineno"> 7193</span>&#160;    <span class="keywordtype">void</span> AddAllocations(</div>
-<div class="line"><a name="l07194"></a><span class="lineno"> 7194</span>&#160;        uint32_t allocationCount,</div>
-<div class="line"><a name="l07195"></a><span class="lineno"> 7195</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations,</div>
-<div class="line"><a name="l07196"></a><span class="lineno"> 7196</span>&#160;        VkBool32* pAllocationsChanged);</div>
-<div class="line"><a name="l07197"></a><span class="lineno"> 7197</span>&#160; </div>
-<div class="line"><a name="l07198"></a><span class="lineno"> 7198</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l07199"></a><span class="lineno"> 7199</span>&#160;<span class="comment">    Returns:</span></div>
-<div class="line"><a name="l07200"></a><span class="lineno"> 7200</span>&#160;<span class="comment">    - `VK_SUCCESS` if succeeded and object can be destroyed immediately.</span></div>
-<div class="line"><a name="l07201"></a><span class="lineno"> 7201</span>&#160;<span class="comment">    - `VK_NOT_READY` if succeeded but the object must remain alive until vmaDefragmentationEnd().</span></div>
-<div class="line"><a name="l07202"></a><span class="lineno"> 7202</span>&#160;<span class="comment">    - Negative value if error occured and object can be destroyed immediately.</span></div>
-<div class="line"><a name="l07203"></a><span class="lineno"> 7203</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l07204"></a><span class="lineno"> 7204</span>&#160;    VkResult Defragment(</div>
-<div class="line"><a name="l07205"></a><span class="lineno"> 7205</span>&#160;        VkDeviceSize maxCpuBytesToMove, uint32_t maxCpuAllocationsToMove,</div>
-<div class="line"><a name="l07206"></a><span class="lineno"> 7206</span>&#160;        VkDeviceSize maxGpuBytesToMove, uint32_t maxGpuAllocationsToMove,</div>
-<div class="line"><a name="l07207"></a><span class="lineno"> 7207</span>&#160;        VkCommandBuffer commandBuffer, <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags);</div>
-<div class="line"><a name="l07208"></a><span class="lineno"> 7208</span>&#160; </div>
-<div class="line"><a name="l07209"></a><span class="lineno"> 7209</span>&#160;    VkResult DefragmentPassBegin(<a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* pInfo);</div>
-<div class="line"><a name="l07210"></a><span class="lineno"> 7210</span>&#160;    VkResult DefragmentPassEnd();</div>
-<div class="line"><a name="l07211"></a><span class="lineno"> 7211</span>&#160; </div>
-<div class="line"><a name="l07212"></a><span class="lineno"> 7212</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l07213"></a><span class="lineno"> 7213</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> m_hAllocator;</div>
-<div class="line"><a name="l07214"></a><span class="lineno"> 7214</span>&#160;    <span class="keyword">const</span> uint32_t m_CurrFrameIndex;</div>
-<div class="line"><a name="l07215"></a><span class="lineno"> 7215</span>&#160;    <span class="keyword">const</span> uint32_t m_Flags;</div>
-<div class="line"><a name="l07216"></a><span class="lineno"> 7216</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* <span class="keyword">const</span> m_pStats;</div>
-<div class="line"><a name="l07217"></a><span class="lineno"> 7217</span>&#160; </div>
-<div class="line"><a name="l07218"></a><span class="lineno"> 7218</span>&#160;    VkDeviceSize m_MaxCpuBytesToMove;</div>
-<div class="line"><a name="l07219"></a><span class="lineno"> 7219</span>&#160;    uint32_t m_MaxCpuAllocationsToMove;</div>
-<div class="line"><a name="l07220"></a><span class="lineno"> 7220</span>&#160;    VkDeviceSize m_MaxGpuBytesToMove;</div>
-<div class="line"><a name="l07221"></a><span class="lineno"> 7221</span>&#160;    uint32_t m_MaxGpuAllocationsToMove;</div>
-<div class="line"><a name="l07222"></a><span class="lineno"> 7222</span>&#160; </div>
-<div class="line"><a name="l07223"></a><span class="lineno"> 7223</span>&#160;    <span class="comment">// Owner of these objects.</span></div>
-<div class="line"><a name="l07224"></a><span class="lineno"> 7224</span>&#160;    VmaBlockVectorDefragmentationContext* m_DefaultPoolContexts[VK_MAX_MEMORY_TYPES];</div>
-<div class="line"><a name="l07225"></a><span class="lineno"> 7225</span>&#160;    <span class="comment">// Owner of these objects.</span></div>
-<div class="line"><a name="l07226"></a><span class="lineno"> 7226</span>&#160;    VmaVector&lt; VmaBlockVectorDefragmentationContext*, VmaStlAllocator&lt;VmaBlockVectorDefragmentationContext*&gt; &gt; m_CustomPoolContexts;</div>
-<div class="line"><a name="l07227"></a><span class="lineno"> 7227</span>&#160;};</div>
-<div class="line"><a name="l07228"></a><span class="lineno"> 7228</span>&#160; </div>
-<div class="line"><a name="l07229"></a><span class="lineno"> 7229</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l07230"></a><span class="lineno"> 7230</span>&#160; </div>
-<div class="line"><a name="l07231"></a><span class="lineno"> 7231</span>&#160;<span class="keyword">class </span>VmaRecorder</div>
-<div class="line"><a name="l07232"></a><span class="lineno"> 7232</span>&#160;{</div>
-<div class="line"><a name="l07233"></a><span class="lineno"> 7233</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l07234"></a><span class="lineno"> 7234</span>&#160;    VmaRecorder();</div>
-<div class="line"><a name="l07235"></a><span class="lineno"> 7235</span>&#160;    VkResult Init(<span class="keyword">const</span> <a class="code" href="struct_vma_record_settings.html">VmaRecordSettings</a>&amp; settings, <span class="keywordtype">bool</span> useMutex);</div>
-<div class="line"><a name="l07236"></a><span class="lineno"> 7236</span>&#160;    <span class="keywordtype">void</span> WriteConfiguration(</div>
-<div class="line"><a name="l07237"></a><span class="lineno"> 7237</span>&#160;        <span class="keyword">const</span> VkPhysicalDeviceProperties&amp; devProps,</div>
-<div class="line"><a name="l07238"></a><span class="lineno"> 7238</span>&#160;        <span class="keyword">const</span> VkPhysicalDeviceMemoryProperties&amp; memProps,</div>
-<div class="line"><a name="l07239"></a><span class="lineno"> 7239</span>&#160;        uint32_t vulkanApiVersion,</div>
-<div class="line"><a name="l07240"></a><span class="lineno"> 7240</span>&#160;        <span class="keywordtype">bool</span> dedicatedAllocationExtensionEnabled,</div>
-<div class="line"><a name="l07241"></a><span class="lineno"> 7241</span>&#160;        <span class="keywordtype">bool</span> bindMemory2ExtensionEnabled,</div>
-<div class="line"><a name="l07242"></a><span class="lineno"> 7242</span>&#160;        <span class="keywordtype">bool</span> memoryBudgetExtensionEnabled,</div>
-<div class="line"><a name="l07243"></a><span class="lineno"> 7243</span>&#160;        <span class="keywordtype">bool</span> deviceCoherentMemoryExtensionEnabled);</div>
-<div class="line"><a name="l07244"></a><span class="lineno"> 7244</span>&#160;    ~VmaRecorder();</div>
-<div class="line"><a name="l07245"></a><span class="lineno"> 7245</span>&#160; </div>
-<div class="line"><a name="l07246"></a><span class="lineno"> 7246</span>&#160;    <span class="keywordtype">void</span> RecordCreateAllocator(uint32_t frameIndex);</div>
-<div class="line"><a name="l07247"></a><span class="lineno"> 7247</span>&#160;    <span class="keywordtype">void</span> RecordDestroyAllocator(uint32_t frameIndex);</div>
-<div class="line"><a name="l07248"></a><span class="lineno"> 7248</span>&#160;    <span class="keywordtype">void</span> RecordCreatePool(uint32_t frameIndex,</div>
-<div class="line"><a name="l07249"></a><span class="lineno"> 7249</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l07250"></a><span class="lineno"> 7250</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
-<div class="line"><a name="l07251"></a><span class="lineno"> 7251</span>&#160;    <span class="keywordtype">void</span> RecordDestroyPool(uint32_t frameIndex, <a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
-<div class="line"><a name="l07252"></a><span class="lineno"> 7252</span>&#160;    <span class="keywordtype">void</span> RecordAllocateMemory(uint32_t frameIndex,</div>
-<div class="line"><a name="l07253"></a><span class="lineno"> 7253</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
-<div class="line"><a name="l07254"></a><span class="lineno"> 7254</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l07255"></a><span class="lineno"> 7255</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07256"></a><span class="lineno"> 7256</span>&#160;    <span class="keywordtype">void</span> RecordAllocateMemoryPages(uint32_t frameIndex,</div>
-<div class="line"><a name="l07257"></a><span class="lineno"> 7257</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
-<div class="line"><a name="l07258"></a><span class="lineno"> 7258</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l07259"></a><span class="lineno"> 7259</span>&#160;        uint64_t allocationCount,</div>
-<div class="line"><a name="l07260"></a><span class="lineno"> 7260</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
-<div class="line"><a name="l07261"></a><span class="lineno"> 7261</span>&#160;    <span class="keywordtype">void</span> RecordAllocateMemoryForBuffer(uint32_t frameIndex,</div>
-<div class="line"><a name="l07262"></a><span class="lineno"> 7262</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
-<div class="line"><a name="l07263"></a><span class="lineno"> 7263</span>&#160;        <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
-<div class="line"><a name="l07264"></a><span class="lineno"> 7264</span>&#160;        <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
-<div class="line"><a name="l07265"></a><span class="lineno"> 7265</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l07266"></a><span class="lineno"> 7266</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07267"></a><span class="lineno"> 7267</span>&#160;    <span class="keywordtype">void</span> RecordAllocateMemoryForImage(uint32_t frameIndex,</div>
-<div class="line"><a name="l07268"></a><span class="lineno"> 7268</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
-<div class="line"><a name="l07269"></a><span class="lineno"> 7269</span>&#160;        <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
-<div class="line"><a name="l07270"></a><span class="lineno"> 7270</span>&#160;        <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
-<div class="line"><a name="l07271"></a><span class="lineno"> 7271</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l07272"></a><span class="lineno"> 7272</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07273"></a><span class="lineno"> 7273</span>&#160;    <span class="keywordtype">void</span> RecordFreeMemory(uint32_t frameIndex,</div>
-<div class="line"><a name="l07274"></a><span class="lineno"> 7274</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07275"></a><span class="lineno"> 7275</span>&#160;    <span class="keywordtype">void</span> RecordFreeMemoryPages(uint32_t frameIndex,</div>
-<div class="line"><a name="l07276"></a><span class="lineno"> 7276</span>&#160;        uint64_t allocationCount,</div>
-<div class="line"><a name="l07277"></a><span class="lineno"> 7277</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
-<div class="line"><a name="l07278"></a><span class="lineno"> 7278</span>&#160;    <span class="keywordtype">void</span> RecordSetAllocationUserData(uint32_t frameIndex,</div>
-<div class="line"><a name="l07279"></a><span class="lineno"> 7279</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
-<div class="line"><a name="l07280"></a><span class="lineno"> 7280</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pUserData);</div>
-<div class="line"><a name="l07281"></a><span class="lineno"> 7281</span>&#160;    <span class="keywordtype">void</span> RecordCreateLostAllocation(uint32_t frameIndex,</div>
-<div class="line"><a name="l07282"></a><span class="lineno"> 7282</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07283"></a><span class="lineno"> 7283</span>&#160;    <span class="keywordtype">void</span> RecordMapMemory(uint32_t frameIndex,</div>
-<div class="line"><a name="l07284"></a><span class="lineno"> 7284</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07285"></a><span class="lineno"> 7285</span>&#160;    <span class="keywordtype">void</span> RecordUnmapMemory(uint32_t frameIndex,</div>
-<div class="line"><a name="l07286"></a><span class="lineno"> 7286</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07287"></a><span class="lineno"> 7287</span>&#160;    <span class="keywordtype">void</span> RecordFlushAllocation(uint32_t frameIndex,</div>
-<div class="line"><a name="l07288"></a><span class="lineno"> 7288</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size);</div>
-<div class="line"><a name="l07289"></a><span class="lineno"> 7289</span>&#160;    <span class="keywordtype">void</span> RecordInvalidateAllocation(uint32_t frameIndex,</div>
-<div class="line"><a name="l07290"></a><span class="lineno"> 7290</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size);</div>
-<div class="line"><a name="l07291"></a><span class="lineno"> 7291</span>&#160;    <span class="keywordtype">void</span> RecordCreateBuffer(uint32_t frameIndex,</div>
-<div class="line"><a name="l07292"></a><span class="lineno"> 7292</span>&#160;        <span class="keyword">const</span> VkBufferCreateInfo&amp; bufCreateInfo,</div>
-<div class="line"><a name="l07293"></a><span class="lineno"> 7293</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; allocCreateInfo,</div>
-<div class="line"><a name="l07294"></a><span class="lineno"> 7294</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07295"></a><span class="lineno"> 7295</span>&#160;    <span class="keywordtype">void</span> RecordCreateImage(uint32_t frameIndex,</div>
-<div class="line"><a name="l07296"></a><span class="lineno"> 7296</span>&#160;        <span class="keyword">const</span> VkImageCreateInfo&amp; imageCreateInfo,</div>
-<div class="line"><a name="l07297"></a><span class="lineno"> 7297</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; allocCreateInfo,</div>
-<div class="line"><a name="l07298"></a><span class="lineno"> 7298</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07299"></a><span class="lineno"> 7299</span>&#160;    <span class="keywordtype">void</span> RecordDestroyBuffer(uint32_t frameIndex,</div>
-<div class="line"><a name="l07300"></a><span class="lineno"> 7300</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07301"></a><span class="lineno"> 7301</span>&#160;    <span class="keywordtype">void</span> RecordDestroyImage(uint32_t frameIndex,</div>
-<div class="line"><a name="l07302"></a><span class="lineno"> 7302</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07303"></a><span class="lineno"> 7303</span>&#160;    <span class="keywordtype">void</span> RecordTouchAllocation(uint32_t frameIndex,</div>
-<div class="line"><a name="l07304"></a><span class="lineno"> 7304</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07305"></a><span class="lineno"> 7305</span>&#160;    <span class="keywordtype">void</span> RecordGetAllocationInfo(uint32_t frameIndex,</div>
-<div class="line"><a name="l07306"></a><span class="lineno"> 7306</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07307"></a><span class="lineno"> 7307</span>&#160;    <span class="keywordtype">void</span> RecordMakePoolAllocationsLost(uint32_t frameIndex,</div>
-<div class="line"><a name="l07308"></a><span class="lineno"> 7308</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
-<div class="line"><a name="l07309"></a><span class="lineno"> 7309</span>&#160;    <span class="keywordtype">void</span> RecordDefragmentationBegin(uint32_t frameIndex,</div>
-<div class="line"><a name="l07310"></a><span class="lineno"> 7310</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>&amp; info,</div>
-<div class="line"><a name="l07311"></a><span class="lineno"> 7311</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx);</div>
-<div class="line"><a name="l07312"></a><span class="lineno"> 7312</span>&#160;    <span class="keywordtype">void</span> RecordDefragmentationEnd(uint32_t frameIndex,</div>
-<div class="line"><a name="l07313"></a><span class="lineno"> 7313</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx);</div>
-<div class="line"><a name="l07314"></a><span class="lineno"> 7314</span>&#160;    <span class="keywordtype">void</span> RecordSetPoolName(uint32_t frameIndex,</div>
-<div class="line"><a name="l07315"></a><span class="lineno"> 7315</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
-<div class="line"><a name="l07316"></a><span class="lineno"> 7316</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">char</span>* name);</div>
-<div class="line"><a name="l07317"></a><span class="lineno"> 7317</span>&#160; </div>
-<div class="line"><a name="l07318"></a><span class="lineno"> 7318</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l07319"></a><span class="lineno"> 7319</span>&#160;    <span class="keyword">struct </span>CallParams</div>
-<div class="line"><a name="l07320"></a><span class="lineno"> 7320</span>&#160;    {</div>
-<div class="line"><a name="l07321"></a><span class="lineno"> 7321</span>&#160;        uint32_t threadId;</div>
-<div class="line"><a name="l07322"></a><span class="lineno"> 7322</span>&#160;        <span class="keywordtype">double</span> time;</div>
+<div class="line"><a name="l07115"></a><span class="lineno"> 7115</span>&#160;        BlockInfo(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks) :</div>
+<div class="line"><a name="l07116"></a><span class="lineno"> 7116</span>&#160;            m_OriginalBlockIndex(SIZE_MAX),</div>
+<div class="line"><a name="l07117"></a><span class="lineno"> 7117</span>&#160;            m_pBlock(VMA_NULL),</div>
+<div class="line"><a name="l07118"></a><span class="lineno"> 7118</span>&#160;            m_HasNonMovableAllocations(true),</div>
+<div class="line"><a name="l07119"></a><span class="lineno"> 7119</span>&#160;            m_Allocations(pAllocationCallbacks)</div>
+<div class="line"><a name="l07120"></a><span class="lineno"> 7120</span>&#160;        {</div>
+<div class="line"><a name="l07121"></a><span class="lineno"> 7121</span>&#160;        }</div>
+<div class="line"><a name="l07122"></a><span class="lineno"> 7122</span>&#160; </div>
+<div class="line"><a name="l07123"></a><span class="lineno"> 7123</span>&#160;        <span class="keywordtype">void</span> CalcHasNonMovableAllocations()</div>
+<div class="line"><a name="l07124"></a><span class="lineno"> 7124</span>&#160;        {</div>
+<div class="line"><a name="l07125"></a><span class="lineno"> 7125</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockAllocCount = m_pBlock-&gt;m_pMetadata-&gt;GetAllocationCount();</div>
+<div class="line"><a name="l07126"></a><span class="lineno"> 7126</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> defragmentAllocCount = m_Allocations.size();</div>
+<div class="line"><a name="l07127"></a><span class="lineno"> 7127</span>&#160;            m_HasNonMovableAllocations = blockAllocCount != defragmentAllocCount;</div>
+<div class="line"><a name="l07128"></a><span class="lineno"> 7128</span>&#160;        }</div>
+<div class="line"><a name="l07129"></a><span class="lineno"> 7129</span>&#160; </div>
+<div class="line"><a name="l07130"></a><span class="lineno"> 7130</span>&#160;        <span class="keywordtype">void</span> SortAllocationsBySizeDescending()</div>
+<div class="line"><a name="l07131"></a><span class="lineno"> 7131</span>&#160;        {</div>
+<div class="line"><a name="l07132"></a><span class="lineno"> 7132</span>&#160;            VMA_SORT(m_Allocations.begin(), m_Allocations.end(), AllocationInfoSizeGreater());</div>
+<div class="line"><a name="l07133"></a><span class="lineno"> 7133</span>&#160;        }</div>
+<div class="line"><a name="l07134"></a><span class="lineno"> 7134</span>&#160; </div>
+<div class="line"><a name="l07135"></a><span class="lineno"> 7135</span>&#160;        <span class="keywordtype">void</span> SortAllocationsByOffsetDescending()</div>
+<div class="line"><a name="l07136"></a><span class="lineno"> 7136</span>&#160;        {</div>
+<div class="line"><a name="l07137"></a><span class="lineno"> 7137</span>&#160;            VMA_SORT(m_Allocations.begin(), m_Allocations.end(), AllocationInfoOffsetGreater());</div>
+<div class="line"><a name="l07138"></a><span class="lineno"> 7138</span>&#160;        }</div>
+<div class="line"><a name="l07139"></a><span class="lineno"> 7139</span>&#160;    };</div>
+<div class="line"><a name="l07140"></a><span class="lineno"> 7140</span>&#160; </div>
+<div class="line"><a name="l07141"></a><span class="lineno"> 7141</span>&#160;    <span class="keyword">struct </span>BlockPointerLess</div>
+<div class="line"><a name="l07142"></a><span class="lineno"> 7142</span>&#160;    {</div>
+<div class="line"><a name="l07143"></a><span class="lineno"> 7143</span>&#160;        <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> BlockInfo* pLhsBlockInfo, <span class="keyword">const</span> VmaDeviceMemoryBlock* pRhsBlock)<span class="keyword"> const</span></div>
+<div class="line"><a name="l07144"></a><span class="lineno"> 7144</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l07145"></a><span class="lineno"> 7145</span>&#160;            <span class="keywordflow">return</span> pLhsBlockInfo-&gt;m_pBlock &lt; pRhsBlock;</div>
+<div class="line"><a name="l07146"></a><span class="lineno"> 7146</span>&#160;        }</div>
+<div class="line"><a name="l07147"></a><span class="lineno"> 7147</span>&#160;        <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> BlockInfo* pLhsBlockInfo, <span class="keyword">const</span> BlockInfo* pRhsBlockInfo)<span class="keyword"> const</span></div>
+<div class="line"><a name="l07148"></a><span class="lineno"> 7148</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l07149"></a><span class="lineno"> 7149</span>&#160;            <span class="keywordflow">return</span> pLhsBlockInfo-&gt;m_pBlock &lt; pRhsBlockInfo-&gt;m_pBlock;</div>
+<div class="line"><a name="l07150"></a><span class="lineno"> 7150</span>&#160;        }</div>
+<div class="line"><a name="l07151"></a><span class="lineno"> 7151</span>&#160;    };</div>
+<div class="line"><a name="l07152"></a><span class="lineno"> 7152</span>&#160; </div>
+<div class="line"><a name="l07153"></a><span class="lineno"> 7153</span>&#160;    <span class="comment">// 1. Blocks with some non-movable allocations go first.</span></div>
+<div class="line"><a name="l07154"></a><span class="lineno"> 7154</span>&#160;    <span class="comment">// 2. Blocks with smaller sumFreeSize go first.</span></div>
+<div class="line"><a name="l07155"></a><span class="lineno"> 7155</span>&#160;    <span class="keyword">struct </span>BlockInfoCompareMoveDestination</div>
+<div class="line"><a name="l07156"></a><span class="lineno"> 7156</span>&#160;    {</div>
+<div class="line"><a name="l07157"></a><span class="lineno"> 7157</span>&#160;        <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> BlockInfo* pLhsBlockInfo, <span class="keyword">const</span> BlockInfo* pRhsBlockInfo)<span class="keyword"> const</span></div>
+<div class="line"><a name="l07158"></a><span class="lineno"> 7158</span>&#160;<span class="keyword">        </span>{</div>
+<div class="line"><a name="l07159"></a><span class="lineno"> 7159</span>&#160;            <span class="keywordflow">if</span>(pLhsBlockInfo-&gt;m_HasNonMovableAllocations &amp;&amp; !pRhsBlockInfo-&gt;m_HasNonMovableAllocations)</div>
+<div class="line"><a name="l07160"></a><span class="lineno"> 7160</span>&#160;            {</div>
+<div class="line"><a name="l07161"></a><span class="lineno"> 7161</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l07162"></a><span class="lineno"> 7162</span>&#160;            }</div>
+<div class="line"><a name="l07163"></a><span class="lineno"> 7163</span>&#160;            <span class="keywordflow">if</span>(!pLhsBlockInfo-&gt;m_HasNonMovableAllocations &amp;&amp; pRhsBlockInfo-&gt;m_HasNonMovableAllocations)</div>
+<div class="line"><a name="l07164"></a><span class="lineno"> 7164</span>&#160;            {</div>
+<div class="line"><a name="l07165"></a><span class="lineno"> 7165</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l07166"></a><span class="lineno"> 7166</span>&#160;            }</div>
+<div class="line"><a name="l07167"></a><span class="lineno"> 7167</span>&#160;            <span class="keywordflow">if</span>(pLhsBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;GetSumFreeSize() &lt; pRhsBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;GetSumFreeSize())</div>
+<div class="line"><a name="l07168"></a><span class="lineno"> 7168</span>&#160;            {</div>
+<div class="line"><a name="l07169"></a><span class="lineno"> 7169</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l07170"></a><span class="lineno"> 7170</span>&#160;            }</div>
+<div class="line"><a name="l07171"></a><span class="lineno"> 7171</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l07172"></a><span class="lineno"> 7172</span>&#160;        }</div>
+<div class="line"><a name="l07173"></a><span class="lineno"> 7173</span>&#160;    };</div>
+<div class="line"><a name="l07174"></a><span class="lineno"> 7174</span>&#160; </div>
+<div class="line"><a name="l07175"></a><span class="lineno"> 7175</span>&#160;    <span class="keyword">typedef</span> VmaVector&lt; BlockInfo*, VmaStlAllocator&lt;BlockInfo*&gt; &gt; BlockInfoVector;</div>
+<div class="line"><a name="l07176"></a><span class="lineno"> 7176</span>&#160;    BlockInfoVector m_Blocks;</div>
+<div class="line"><a name="l07177"></a><span class="lineno"> 7177</span>&#160; </div>
+<div class="line"><a name="l07178"></a><span class="lineno"> 7178</span>&#160;    VkResult DefragmentRound(</div>
+<div class="line"><a name="l07179"></a><span class="lineno"> 7179</span>&#160;        VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
+<div class="line"><a name="l07180"></a><span class="lineno"> 7180</span>&#160;        VkDeviceSize maxBytesToMove,</div>
+<div class="line"><a name="l07181"></a><span class="lineno"> 7181</span>&#160;        uint32_t maxAllocationsToMove,</div>
+<div class="line"><a name="l07182"></a><span class="lineno"> 7182</span>&#160;        <span class="keywordtype">bool</span> freeOldAllocations);</div>
+<div class="line"><a name="l07183"></a><span class="lineno"> 7183</span>&#160; </div>
+<div class="line"><a name="l07184"></a><span class="lineno"> 7184</span>&#160;    <span class="keywordtype">size_t</span> CalcBlocksWithNonMovableCount() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l07185"></a><span class="lineno"> 7185</span>&#160; </div>
+<div class="line"><a name="l07186"></a><span class="lineno"> 7186</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> MoveMakesSense(</div>
+<div class="line"><a name="l07187"></a><span class="lineno"> 7187</span>&#160;        <span class="keywordtype">size_t</span> dstBlockIndex, VkDeviceSize dstOffset,</div>
+<div class="line"><a name="l07188"></a><span class="lineno"> 7188</span>&#160;        <span class="keywordtype">size_t</span> srcBlockIndex, VkDeviceSize srcOffset);</div>
+<div class="line"><a name="l07189"></a><span class="lineno"> 7189</span>&#160;};</div>
+<div class="line"><a name="l07190"></a><span class="lineno"> 7190</span>&#160; </div>
+<div class="line"><a name="l07191"></a><span class="lineno"> 7191</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm_Fast : <span class="keyword">public</span> VmaDefragmentationAlgorithm</div>
+<div class="line"><a name="l07192"></a><span class="lineno"> 7192</span>&#160;{</div>
+<div class="line"><a name="l07193"></a><span class="lineno"> 7193</span>&#160;    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm_Fast)</div>
+<div class="line"><a name="l07194"></a><span class="lineno"> 7194</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l07195"></a><span class="lineno"> 7195</span>&#160;    VmaDefragmentationAlgorithm_Fast(</div>
+<div class="line"><a name="l07196"></a><span class="lineno"> 7196</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l07197"></a><span class="lineno"> 7197</span>&#160;        VmaBlockVector* pBlockVector,</div>
+<div class="line"><a name="l07198"></a><span class="lineno"> 7198</span>&#160;        uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l07199"></a><span class="lineno"> 7199</span>&#160;        <span class="keywordtype">bool</span> overlappingMoveSupported);</div>
+<div class="line"><a name="l07200"></a><span class="lineno"> 7200</span>&#160;    <span class="keyword">virtual</span> ~VmaDefragmentationAlgorithm_Fast();</div>
+<div class="line"><a name="l07201"></a><span class="lineno"> 7201</span>&#160; </div>
+<div class="line"><a name="l07202"></a><span class="lineno"> 7202</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged) { ++m_AllocationCount; }</div>
+<div class="line"><a name="l07203"></a><span class="lineno"> 7203</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAll() { m_AllAllocations = <span class="keyword">true</span>; }</div>
+<div class="line"><a name="l07204"></a><span class="lineno"> 7204</span>&#160; </div>
+<div class="line"><a name="l07205"></a><span class="lineno"> 7205</span>&#160;    <span class="keyword">virtual</span> VkResult Defragment(</div>
+<div class="line"><a name="l07206"></a><span class="lineno"> 7206</span>&#160;        VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
+<div class="line"><a name="l07207"></a><span class="lineno"> 7207</span>&#160;        VkDeviceSize maxBytesToMove,</div>
+<div class="line"><a name="l07208"></a><span class="lineno"> 7208</span>&#160;        uint32_t maxAllocationsToMove,</div>
+<div class="line"><a name="l07209"></a><span class="lineno"> 7209</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags);</div>
+<div class="line"><a name="l07210"></a><span class="lineno"> 7210</span>&#160; </div>
+<div class="line"><a name="l07211"></a><span class="lineno"> 7211</span>&#160;    <span class="keyword">virtual</span> VkDeviceSize GetBytesMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BytesMoved; }</div>
+<div class="line"><a name="l07212"></a><span class="lineno"> 7212</span>&#160;    <span class="keyword">virtual</span> uint32_t GetAllocationsMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_AllocationsMoved; }</div>
+<div class="line"><a name="l07213"></a><span class="lineno"> 7213</span>&#160; </div>
+<div class="line"><a name="l07214"></a><span class="lineno"> 7214</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l07215"></a><span class="lineno"> 7215</span>&#160;    <span class="keyword">struct </span>BlockInfo</div>
+<div class="line"><a name="l07216"></a><span class="lineno"> 7216</span>&#160;    {</div>
+<div class="line"><a name="l07217"></a><span class="lineno"> 7217</span>&#160;        <span class="keywordtype">size_t</span> origBlockIndex;</div>
+<div class="line"><a name="l07218"></a><span class="lineno"> 7218</span>&#160;    };</div>
+<div class="line"><a name="l07219"></a><span class="lineno"> 7219</span>&#160; </div>
+<div class="line"><a name="l07220"></a><span class="lineno"> 7220</span>&#160;    <span class="keyword">class </span>FreeSpaceDatabase</div>
+<div class="line"><a name="l07221"></a><span class="lineno"> 7221</span>&#160;    {</div>
+<div class="line"><a name="l07222"></a><span class="lineno"> 7222</span>&#160;    <span class="keyword">public</span>:</div>
+<div class="line"><a name="l07223"></a><span class="lineno"> 7223</span>&#160;        FreeSpaceDatabase()</div>
+<div class="line"><a name="l07224"></a><span class="lineno"> 7224</span>&#160;        {</div>
+<div class="line"><a name="l07225"></a><span class="lineno"> 7225</span>&#160;            FreeSpace s = {};</div>
+<div class="line"><a name="l07226"></a><span class="lineno"> 7226</span>&#160;            s.blockInfoIndex = SIZE_MAX;</div>
+<div class="line"><a name="l07227"></a><span class="lineno"> 7227</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; MAX_COUNT; ++i)</div>
+<div class="line"><a name="l07228"></a><span class="lineno"> 7228</span>&#160;            {</div>
+<div class="line"><a name="l07229"></a><span class="lineno"> 7229</span>&#160;                m_FreeSpaces[i] = s;</div>
+<div class="line"><a name="l07230"></a><span class="lineno"> 7230</span>&#160;            }</div>
+<div class="line"><a name="l07231"></a><span class="lineno"> 7231</span>&#160;        }</div>
+<div class="line"><a name="l07232"></a><span class="lineno"> 7232</span>&#160; </div>
+<div class="line"><a name="l07233"></a><span class="lineno"> 7233</span>&#160;        <span class="keywordtype">void</span> Register(<span class="keywordtype">size_t</span> blockInfoIndex, VkDeviceSize offset, VkDeviceSize size)</div>
+<div class="line"><a name="l07234"></a><span class="lineno"> 7234</span>&#160;        {</div>
+<div class="line"><a name="l07235"></a><span class="lineno"> 7235</span>&#160;            <span class="keywordflow">if</span>(size &lt; VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
+<div class="line"><a name="l07236"></a><span class="lineno"> 7236</span>&#160;            {</div>
+<div class="line"><a name="l07237"></a><span class="lineno"> 7237</span>&#160;                <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l07238"></a><span class="lineno"> 7238</span>&#160;            }</div>
+<div class="line"><a name="l07239"></a><span class="lineno"> 7239</span>&#160; </div>
+<div class="line"><a name="l07240"></a><span class="lineno"> 7240</span>&#160;            <span class="comment">// Find first invalid or the smallest structure.</span></div>
+<div class="line"><a name="l07241"></a><span class="lineno"> 7241</span>&#160;            <span class="keywordtype">size_t</span> bestIndex = SIZE_MAX;</div>
+<div class="line"><a name="l07242"></a><span class="lineno"> 7242</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; MAX_COUNT; ++i)</div>
+<div class="line"><a name="l07243"></a><span class="lineno"> 7243</span>&#160;            {</div>
+<div class="line"><a name="l07244"></a><span class="lineno"> 7244</span>&#160;                <span class="comment">// Empty structure.</span></div>
+<div class="line"><a name="l07245"></a><span class="lineno"> 7245</span>&#160;                <span class="keywordflow">if</span>(m_FreeSpaces[i].blockInfoIndex == SIZE_MAX)</div>
+<div class="line"><a name="l07246"></a><span class="lineno"> 7246</span>&#160;                {</div>
+<div class="line"><a name="l07247"></a><span class="lineno"> 7247</span>&#160;                    bestIndex = i;</div>
+<div class="line"><a name="l07248"></a><span class="lineno"> 7248</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l07249"></a><span class="lineno"> 7249</span>&#160;                }</div>
+<div class="line"><a name="l07250"></a><span class="lineno"> 7250</span>&#160;                <span class="keywordflow">if</span>(m_FreeSpaces[i].size &lt; size &amp;&amp;</div>
+<div class="line"><a name="l07251"></a><span class="lineno"> 7251</span>&#160;                    (bestIndex == SIZE_MAX || m_FreeSpaces[bestIndex].size &gt; m_FreeSpaces[i].size))</div>
+<div class="line"><a name="l07252"></a><span class="lineno"> 7252</span>&#160;                {</div>
+<div class="line"><a name="l07253"></a><span class="lineno"> 7253</span>&#160;                    bestIndex = i;</div>
+<div class="line"><a name="l07254"></a><span class="lineno"> 7254</span>&#160;                }</div>
+<div class="line"><a name="l07255"></a><span class="lineno"> 7255</span>&#160;            }</div>
+<div class="line"><a name="l07256"></a><span class="lineno"> 7256</span>&#160; </div>
+<div class="line"><a name="l07257"></a><span class="lineno"> 7257</span>&#160;            <span class="keywordflow">if</span>(bestIndex != SIZE_MAX)</div>
+<div class="line"><a name="l07258"></a><span class="lineno"> 7258</span>&#160;            {</div>
+<div class="line"><a name="l07259"></a><span class="lineno"> 7259</span>&#160;                m_FreeSpaces[bestIndex].blockInfoIndex = blockInfoIndex;</div>
+<div class="line"><a name="l07260"></a><span class="lineno"> 7260</span>&#160;                m_FreeSpaces[bestIndex].offset = offset;</div>
+<div class="line"><a name="l07261"></a><span class="lineno"> 7261</span>&#160;                m_FreeSpaces[bestIndex].size = size;</div>
+<div class="line"><a name="l07262"></a><span class="lineno"> 7262</span>&#160;            }</div>
+<div class="line"><a name="l07263"></a><span class="lineno"> 7263</span>&#160;        }</div>
+<div class="line"><a name="l07264"></a><span class="lineno"> 7264</span>&#160; </div>
+<div class="line"><a name="l07265"></a><span class="lineno"> 7265</span>&#160;        <span class="keywordtype">bool</span> Fetch(VkDeviceSize alignment, VkDeviceSize size,</div>
+<div class="line"><a name="l07266"></a><span class="lineno"> 7266</span>&#160;            <span class="keywordtype">size_t</span>&amp; outBlockInfoIndex, VkDeviceSize&amp; outDstOffset)</div>
+<div class="line"><a name="l07267"></a><span class="lineno"> 7267</span>&#160;        {</div>
+<div class="line"><a name="l07268"></a><span class="lineno"> 7268</span>&#160;            <span class="keywordtype">size_t</span> bestIndex = SIZE_MAX;</div>
+<div class="line"><a name="l07269"></a><span class="lineno"> 7269</span>&#160;            VkDeviceSize bestFreeSpaceAfter = 0;</div>
+<div class="line"><a name="l07270"></a><span class="lineno"> 7270</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; MAX_COUNT; ++i)</div>
+<div class="line"><a name="l07271"></a><span class="lineno"> 7271</span>&#160;            {</div>
+<div class="line"><a name="l07272"></a><span class="lineno"> 7272</span>&#160;                <span class="comment">// Structure is valid.</span></div>
+<div class="line"><a name="l07273"></a><span class="lineno"> 7273</span>&#160;                <span class="keywordflow">if</span>(m_FreeSpaces[i].blockInfoIndex != SIZE_MAX)</div>
+<div class="line"><a name="l07274"></a><span class="lineno"> 7274</span>&#160;                {</div>
+<div class="line"><a name="l07275"></a><span class="lineno"> 7275</span>&#160;                    <span class="keyword">const</span> VkDeviceSize dstOffset = VmaAlignUp(m_FreeSpaces[i].offset, alignment);</div>
+<div class="line"><a name="l07276"></a><span class="lineno"> 7276</span>&#160;                    <span class="comment">// Allocation fits into this structure.</span></div>
+<div class="line"><a name="l07277"></a><span class="lineno"> 7277</span>&#160;                    <span class="keywordflow">if</span>(dstOffset + size &lt;= m_FreeSpaces[i].offset + m_FreeSpaces[i].size)</div>
+<div class="line"><a name="l07278"></a><span class="lineno"> 7278</span>&#160;                    {</div>
+<div class="line"><a name="l07279"></a><span class="lineno"> 7279</span>&#160;                        <span class="keyword">const</span> VkDeviceSize freeSpaceAfter = (m_FreeSpaces[i].offset + m_FreeSpaces[i].size) -</div>
+<div class="line"><a name="l07280"></a><span class="lineno"> 7280</span>&#160;                            (dstOffset + size);</div>
+<div class="line"><a name="l07281"></a><span class="lineno"> 7281</span>&#160;                        <span class="keywordflow">if</span>(bestIndex == SIZE_MAX || freeSpaceAfter &gt; bestFreeSpaceAfter)</div>
+<div class="line"><a name="l07282"></a><span class="lineno"> 7282</span>&#160;                        {</div>
+<div class="line"><a name="l07283"></a><span class="lineno"> 7283</span>&#160;                            bestIndex = i;</div>
+<div class="line"><a name="l07284"></a><span class="lineno"> 7284</span>&#160;                            bestFreeSpaceAfter = freeSpaceAfter;</div>
+<div class="line"><a name="l07285"></a><span class="lineno"> 7285</span>&#160;                        }</div>
+<div class="line"><a name="l07286"></a><span class="lineno"> 7286</span>&#160;                    }</div>
+<div class="line"><a name="l07287"></a><span class="lineno"> 7287</span>&#160;                }</div>
+<div class="line"><a name="l07288"></a><span class="lineno"> 7288</span>&#160;            }</div>
+<div class="line"><a name="l07289"></a><span class="lineno"> 7289</span>&#160;            </div>
+<div class="line"><a name="l07290"></a><span class="lineno"> 7290</span>&#160;            <span class="keywordflow">if</span>(bestIndex != SIZE_MAX)</div>
+<div class="line"><a name="l07291"></a><span class="lineno"> 7291</span>&#160;            {</div>
+<div class="line"><a name="l07292"></a><span class="lineno"> 7292</span>&#160;                outBlockInfoIndex = m_FreeSpaces[bestIndex].blockInfoIndex;</div>
+<div class="line"><a name="l07293"></a><span class="lineno"> 7293</span>&#160;                outDstOffset = VmaAlignUp(m_FreeSpaces[bestIndex].offset, alignment);</div>
+<div class="line"><a name="l07294"></a><span class="lineno"> 7294</span>&#160; </div>
+<div class="line"><a name="l07295"></a><span class="lineno"> 7295</span>&#160;                <span class="keywordflow">if</span>(bestFreeSpaceAfter &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
+<div class="line"><a name="l07296"></a><span class="lineno"> 7296</span>&#160;                {</div>
+<div class="line"><a name="l07297"></a><span class="lineno"> 7297</span>&#160;                    <span class="comment">// Leave this structure for remaining empty space.</span></div>
+<div class="line"><a name="l07298"></a><span class="lineno"> 7298</span>&#160;                    <span class="keyword">const</span> VkDeviceSize alignmentPlusSize = (outDstOffset - m_FreeSpaces[bestIndex].offset) + size;</div>
+<div class="line"><a name="l07299"></a><span class="lineno"> 7299</span>&#160;                    m_FreeSpaces[bestIndex].offset += alignmentPlusSize;</div>
+<div class="line"><a name="l07300"></a><span class="lineno"> 7300</span>&#160;                    m_FreeSpaces[bestIndex].size -= alignmentPlusSize;</div>
+<div class="line"><a name="l07301"></a><span class="lineno"> 7301</span>&#160;                }</div>
+<div class="line"><a name="l07302"></a><span class="lineno"> 7302</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l07303"></a><span class="lineno"> 7303</span>&#160;                {</div>
+<div class="line"><a name="l07304"></a><span class="lineno"> 7304</span>&#160;                    <span class="comment">// This structure becomes invalid.</span></div>
+<div class="line"><a name="l07305"></a><span class="lineno"> 7305</span>&#160;                    m_FreeSpaces[bestIndex].blockInfoIndex = SIZE_MAX;</div>
+<div class="line"><a name="l07306"></a><span class="lineno"> 7306</span>&#160;                }</div>
+<div class="line"><a name="l07307"></a><span class="lineno"> 7307</span>&#160; </div>
+<div class="line"><a name="l07308"></a><span class="lineno"> 7308</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l07309"></a><span class="lineno"> 7309</span>&#160;            }</div>
+<div class="line"><a name="l07310"></a><span class="lineno"> 7310</span>&#160; </div>
+<div class="line"><a name="l07311"></a><span class="lineno"> 7311</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l07312"></a><span class="lineno"> 7312</span>&#160;        }</div>
+<div class="line"><a name="l07313"></a><span class="lineno"> 7313</span>&#160; </div>
+<div class="line"><a name="l07314"></a><span class="lineno"> 7314</span>&#160;    <span class="keyword">private</span>:</div>
+<div class="line"><a name="l07315"></a><span class="lineno"> 7315</span>&#160;        <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> MAX_COUNT = 4;</div>
+<div class="line"><a name="l07316"></a><span class="lineno"> 7316</span>&#160; </div>
+<div class="line"><a name="l07317"></a><span class="lineno"> 7317</span>&#160;        <span class="keyword">struct </span>FreeSpace</div>
+<div class="line"><a name="l07318"></a><span class="lineno"> 7318</span>&#160;        {</div>
+<div class="line"><a name="l07319"></a><span class="lineno"> 7319</span>&#160;            <span class="keywordtype">size_t</span> blockInfoIndex; <span class="comment">// SIZE_MAX means this structure is invalid.</span></div>
+<div class="line"><a name="l07320"></a><span class="lineno"> 7320</span>&#160;            VkDeviceSize offset;</div>
+<div class="line"><a name="l07321"></a><span class="lineno"> 7321</span>&#160;            VkDeviceSize size;</div>
+<div class="line"><a name="l07322"></a><span class="lineno"> 7322</span>&#160;        } m_FreeSpaces[MAX_COUNT];</div>
 <div class="line"><a name="l07323"></a><span class="lineno"> 7323</span>&#160;    };</div>
 <div class="line"><a name="l07324"></a><span class="lineno"> 7324</span>&#160; </div>
-<div class="line"><a name="l07325"></a><span class="lineno"> 7325</span>&#160;    <span class="keyword">class </span>UserDataString</div>
-<div class="line"><a name="l07326"></a><span class="lineno"> 7326</span>&#160;    {</div>
-<div class="line"><a name="l07327"></a><span class="lineno"> 7327</span>&#160;    <span class="keyword">public</span>:</div>
-<div class="line"><a name="l07328"></a><span class="lineno"> 7328</span>&#160;        UserDataString(<a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlags, <span class="keyword">const</span> <span class="keywordtype">void</span>* pUserData);</div>
-<div class="line"><a name="l07329"></a><span class="lineno"> 7329</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">char</span>* GetString()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Str; }</div>
-<div class="line"><a name="l07330"></a><span class="lineno"> 7330</span>&#160; </div>
-<div class="line"><a name="l07331"></a><span class="lineno"> 7331</span>&#160;    <span class="keyword">private</span>:</div>
-<div class="line"><a name="l07332"></a><span class="lineno"> 7332</span>&#160;        <span class="keywordtype">char</span> m_PtrStr[17];</div>
-<div class="line"><a name="l07333"></a><span class="lineno"> 7333</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">char</span>* m_Str;</div>
-<div class="line"><a name="l07334"></a><span class="lineno"> 7334</span>&#160;    };</div>
-<div class="line"><a name="l07335"></a><span class="lineno"> 7335</span>&#160; </div>
-<div class="line"><a name="l07336"></a><span class="lineno"> 7336</span>&#160;    <span class="keywordtype">bool</span> m_UseMutex;</div>
-<div class="line"><a name="l07337"></a><span class="lineno"> 7337</span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828">VmaRecordFlags</a> m_Flags;</div>
-<div class="line"><a name="l07338"></a><span class="lineno"> 7338</span>&#160;    FILE* m_File;</div>
-<div class="line"><a name="l07339"></a><span class="lineno"> 7339</span>&#160;    VMA_MUTEX m_FileMutex;</div>
-<div class="line"><a name="l07340"></a><span class="lineno"> 7340</span>&#160;    int64_t m_Freq;</div>
-<div class="line"><a name="l07341"></a><span class="lineno"> 7341</span>&#160;    int64_t m_StartCounter;</div>
-<div class="line"><a name="l07342"></a><span class="lineno"> 7342</span>&#160; </div>
-<div class="line"><a name="l07343"></a><span class="lineno"> 7343</span>&#160;    <span class="keywordtype">void</span> GetBasicParams(CallParams&amp; outParams);</div>
-<div class="line"><a name="l07344"></a><span class="lineno"> 7344</span>&#160; </div>
-<div class="line"><a name="l07345"></a><span class="lineno"> 7345</span>&#160;    <span class="comment">// T must be a pointer type, e.g. VmaAllocation, VmaPool.</span></div>
-<div class="line"><a name="l07346"></a><span class="lineno"> 7346</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l07347"></a><span class="lineno"> 7347</span>&#160;    <span class="keywordtype">void</span> PrintPointerList(uint64_t count, <span class="keyword">const</span> T* pItems)</div>
-<div class="line"><a name="l07348"></a><span class="lineno"> 7348</span>&#160;    {</div>
-<div class="line"><a name="l07349"></a><span class="lineno"> 7349</span>&#160;        <span class="keywordflow">if</span>(count)</div>
-<div class="line"><a name="l07350"></a><span class="lineno"> 7350</span>&#160;        {</div>
-<div class="line"><a name="l07351"></a><span class="lineno"> 7351</span>&#160;            fprintf(m_File, <span class="stringliteral">&quot;%p&quot;</span>, pItems[0]);</div>
-<div class="line"><a name="l07352"></a><span class="lineno"> 7352</span>&#160;            <span class="keywordflow">for</span>(uint64_t i = 1; i &lt; count; ++i)</div>
-<div class="line"><a name="l07353"></a><span class="lineno"> 7353</span>&#160;            {</div>
-<div class="line"><a name="l07354"></a><span class="lineno"> 7354</span>&#160;                fprintf(m_File, <span class="stringliteral">&quot; %p&quot;</span>, pItems[i]);</div>
-<div class="line"><a name="l07355"></a><span class="lineno"> 7355</span>&#160;            }</div>
-<div class="line"><a name="l07356"></a><span class="lineno"> 7356</span>&#160;        }</div>
-<div class="line"><a name="l07357"></a><span class="lineno"> 7357</span>&#160;    }</div>
-<div class="line"><a name="l07358"></a><span class="lineno"> 7358</span>&#160; </div>
-<div class="line"><a name="l07359"></a><span class="lineno"> 7359</span>&#160;    <span class="keywordtype">void</span> PrintPointerList(uint64_t count, <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pItems);</div>
-<div class="line"><a name="l07360"></a><span class="lineno"> 7360</span>&#160;    <span class="keywordtype">void</span> Flush();</div>
-<div class="line"><a name="l07361"></a><span class="lineno"> 7361</span>&#160;};</div>
-<div class="line"><a name="l07362"></a><span class="lineno"> 7362</span>&#160; </div>
-<div class="line"><a name="l07363"></a><span class="lineno"> 7363</span>&#160;<span class="preprocessor">#endif // #if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l07364"></a><span class="lineno"> 7364</span>&#160; </div>
-<div class="line"><a name="l07365"></a><span class="lineno"> 7365</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l07366"></a><span class="lineno"> 7366</span>&#160;<span class="comment">Thread-safe wrapper over VmaPoolAllocator free list, for allocation of VmaAllocation_T objects.</span></div>
-<div class="line"><a name="l07367"></a><span class="lineno"> 7367</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l07368"></a><span class="lineno"> 7368</span>&#160;<span class="keyword">class </span>VmaAllocationObjectAllocator</div>
-<div class="line"><a name="l07369"></a><span class="lineno"> 7369</span>&#160;{</div>
-<div class="line"><a name="l07370"></a><span class="lineno"> 7370</span>&#160;    VMA_CLASS_NO_COPY(VmaAllocationObjectAllocator)</div>
-<div class="line"><a name="l07371"></a><span class="lineno"> 7371</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l07372"></a><span class="lineno"> 7372</span>&#160;    VmaAllocationObjectAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks);</div>
-<div class="line"><a name="l07373"></a><span class="lineno"> 7373</span>&#160; </div>
-<div class="line"><a name="l07374"></a><span class="lineno"> 7374</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span>... Types&gt; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> Allocate(Types... args);</div>
-<div class="line"><a name="l07375"></a><span class="lineno"> 7375</span>&#160;    <span class="keywordtype">void</span> Free(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc);</div>
-<div class="line"><a name="l07376"></a><span class="lineno"> 7376</span>&#160; </div>
-<div class="line"><a name="l07377"></a><span class="lineno"> 7377</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l07378"></a><span class="lineno"> 7378</span>&#160;    VMA_MUTEX m_Mutex;</div>
-<div class="line"><a name="l07379"></a><span class="lineno"> 7379</span>&#160;    VmaPoolAllocator&lt;VmaAllocation_T&gt; m_Allocator;</div>
-<div class="line"><a name="l07380"></a><span class="lineno"> 7380</span>&#160;};</div>
-<div class="line"><a name="l07381"></a><span class="lineno"> 7381</span>&#160; </div>
-<div class="line"><a name="l07382"></a><span class="lineno"> 7382</span>&#160;<span class="keyword">struct </span>VmaCurrentBudgetData</div>
-<div class="line"><a name="l07383"></a><span class="lineno"> 7383</span>&#160;{</div>
-<div class="line"><a name="l07384"></a><span class="lineno"> 7384</span>&#160;    VMA_ATOMIC_UINT64 m_BlockBytes[VK_MAX_MEMORY_HEAPS];</div>
-<div class="line"><a name="l07385"></a><span class="lineno"> 7385</span>&#160;    VMA_ATOMIC_UINT64 m_AllocationBytes[VK_MAX_MEMORY_HEAPS];</div>
-<div class="line"><a name="l07386"></a><span class="lineno"> 7386</span>&#160; </div>
-<div class="line"><a name="l07387"></a><span class="lineno"> 7387</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l07388"></a><span class="lineno"> 7388</span>&#160;    VMA_ATOMIC_UINT32 m_OperationsSinceBudgetFetch;</div>
-<div class="line"><a name="l07389"></a><span class="lineno"> 7389</span>&#160;    VMA_RW_MUTEX m_BudgetMutex;</div>
-<div class="line"><a name="l07390"></a><span class="lineno"> 7390</span>&#160;    uint64_t m_VulkanUsage[VK_MAX_MEMORY_HEAPS];</div>
-<div class="line"><a name="l07391"></a><span class="lineno"> 7391</span>&#160;    uint64_t m_VulkanBudget[VK_MAX_MEMORY_HEAPS];</div>
-<div class="line"><a name="l07392"></a><span class="lineno"> 7392</span>&#160;    uint64_t m_BlockBytesAtBudgetFetch[VK_MAX_MEMORY_HEAPS];</div>
-<div class="line"><a name="l07393"></a><span class="lineno"> 7393</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l07394"></a><span class="lineno"> 7394</span>&#160; </div>
-<div class="line"><a name="l07395"></a><span class="lineno"> 7395</span>&#160;    VmaCurrentBudgetData()</div>
-<div class="line"><a name="l07396"></a><span class="lineno"> 7396</span>&#160;    {</div>
-<div class="line"><a name="l07397"></a><span class="lineno"> 7397</span>&#160;        <span class="keywordflow">for</span>(uint32_t heapIndex = 0; heapIndex &lt; VK_MAX_MEMORY_HEAPS; ++heapIndex)</div>
-<div class="line"><a name="l07398"></a><span class="lineno"> 7398</span>&#160;        {</div>
-<div class="line"><a name="l07399"></a><span class="lineno"> 7399</span>&#160;            m_BlockBytes[heapIndex] = 0;</div>
-<div class="line"><a name="l07400"></a><span class="lineno"> 7400</span>&#160;            m_AllocationBytes[heapIndex] = 0;</div>
-<div class="line"><a name="l07401"></a><span class="lineno"> 7401</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l07402"></a><span class="lineno"> 7402</span>&#160;            m_VulkanUsage[heapIndex] = 0;</div>
-<div class="line"><a name="l07403"></a><span class="lineno"> 7403</span>&#160;            m_VulkanBudget[heapIndex] = 0;</div>
-<div class="line"><a name="l07404"></a><span class="lineno"> 7404</span>&#160;            m_BlockBytesAtBudgetFetch[heapIndex] = 0;</div>
-<div class="line"><a name="l07405"></a><span class="lineno"> 7405</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l07406"></a><span class="lineno"> 7406</span>&#160;        }</div>
-<div class="line"><a name="l07407"></a><span class="lineno"> 7407</span>&#160; </div>
-<div class="line"><a name="l07408"></a><span class="lineno"> 7408</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l07409"></a><span class="lineno"> 7409</span>&#160;        m_OperationsSinceBudgetFetch = 0;</div>
-<div class="line"><a name="l07410"></a><span class="lineno"> 7410</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l07411"></a><span class="lineno"> 7411</span>&#160;    }</div>
-<div class="line"><a name="l07412"></a><span class="lineno"> 7412</span>&#160; </div>
-<div class="line"><a name="l07413"></a><span class="lineno"> 7413</span>&#160;    <span class="keywordtype">void</span> AddAllocation(uint32_t heapIndex, VkDeviceSize allocationSize)</div>
-<div class="line"><a name="l07414"></a><span class="lineno"> 7414</span>&#160;    {</div>
-<div class="line"><a name="l07415"></a><span class="lineno"> 7415</span>&#160;        m_AllocationBytes[heapIndex] += allocationSize;</div>
-<div class="line"><a name="l07416"></a><span class="lineno"> 7416</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l07417"></a><span class="lineno"> 7417</span>&#160;        ++m_OperationsSinceBudgetFetch;</div>
-<div class="line"><a name="l07418"></a><span class="lineno"> 7418</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l07419"></a><span class="lineno"> 7419</span>&#160;    }</div>
-<div class="line"><a name="l07420"></a><span class="lineno"> 7420</span>&#160; </div>
-<div class="line"><a name="l07421"></a><span class="lineno"> 7421</span>&#160;    <span class="keywordtype">void</span> RemoveAllocation(uint32_t heapIndex, VkDeviceSize allocationSize)</div>
-<div class="line"><a name="l07422"></a><span class="lineno"> 7422</span>&#160;    {</div>
-<div class="line"><a name="l07423"></a><span class="lineno"> 7423</span>&#160;        VMA_ASSERT(m_AllocationBytes[heapIndex] &gt;= allocationSize); <span class="comment">// DELME</span></div>
-<div class="line"><a name="l07424"></a><span class="lineno"> 7424</span>&#160;        m_AllocationBytes[heapIndex] -= allocationSize;</div>
-<div class="line"><a name="l07425"></a><span class="lineno"> 7425</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l07426"></a><span class="lineno"> 7426</span>&#160;        ++m_OperationsSinceBudgetFetch;</div>
-<div class="line"><a name="l07427"></a><span class="lineno"> 7427</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l07428"></a><span class="lineno"> 7428</span>&#160;    }</div>
-<div class="line"><a name="l07429"></a><span class="lineno"> 7429</span>&#160;};</div>
-<div class="line"><a name="l07430"></a><span class="lineno"> 7430</span>&#160; </div>
-<div class="line"><a name="l07431"></a><span class="lineno"> 7431</span>&#160;<span class="comment">// Main allocator object.</span></div>
-<div class="line"><a name="l07432"></a><span class="lineno"> 7432</span>&#160;<span class="keyword">struct </span>VmaAllocator_T</div>
-<div class="line"><a name="l07433"></a><span class="lineno"> 7433</span>&#160;{</div>
-<div class="line"><a name="l07434"></a><span class="lineno"> 7434</span>&#160;    VMA_CLASS_NO_COPY(VmaAllocator_T)</div>
-<div class="line"><a name="l07435"></a><span class="lineno"> 7435</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l07436"></a><span class="lineno"> 7436</span>&#160;    <span class="keywordtype">bool</span> m_UseMutex;</div>
-<div class="line"><a name="l07437"></a><span class="lineno"> 7437</span>&#160;    uint32_t m_VulkanApiVersion;</div>
-<div class="line"><a name="l07438"></a><span class="lineno"> 7438</span>&#160;    <span class="keywordtype">bool</span> m_UseKhrDedicatedAllocation; <span class="comment">// Can be set only if m_VulkanApiVersion &lt; VK_MAKE_VERSION(1, 1, 0).</span></div>
-<div class="line"><a name="l07439"></a><span class="lineno"> 7439</span>&#160;    <span class="keywordtype">bool</span> m_UseKhrBindMemory2; <span class="comment">// Can be set only if m_VulkanApiVersion &lt; VK_MAKE_VERSION(1, 1, 0).</span></div>
-<div class="line"><a name="l07440"></a><span class="lineno"> 7440</span>&#160;    <span class="keywordtype">bool</span> m_UseExtMemoryBudget;</div>
-<div class="line"><a name="l07441"></a><span class="lineno"> 7441</span>&#160;    <span class="keywordtype">bool</span> m_UseAmdDeviceCoherentMemory;</div>
-<div class="line"><a name="l07442"></a><span class="lineno"> 7442</span>&#160;    <span class="keywordtype">bool</span> m_UseKhrBufferDeviceAddress;</div>
-<div class="line"><a name="l07443"></a><span class="lineno"> 7443</span>&#160;    VkDevice m_hDevice;</div>
-<div class="line"><a name="l07444"></a><span class="lineno"> 7444</span>&#160;    VkInstance m_hInstance;</div>
-<div class="line"><a name="l07445"></a><span class="lineno"> 7445</span>&#160;    <span class="keywordtype">bool</span> m_AllocationCallbacksSpecified;</div>
-<div class="line"><a name="l07446"></a><span class="lineno"> 7446</span>&#160;    VkAllocationCallbacks m_AllocationCallbacks;</div>
-<div class="line"><a name="l07447"></a><span class="lineno"> 7447</span>&#160;    <a class="code" href="struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks</a> m_DeviceMemoryCallbacks;</div>
-<div class="line"><a name="l07448"></a><span class="lineno"> 7448</span>&#160;    VmaAllocationObjectAllocator m_AllocationObjectAllocator;</div>
-<div class="line"><a name="l07449"></a><span class="lineno"> 7449</span>&#160;    </div>
-<div class="line"><a name="l07450"></a><span class="lineno"> 7450</span>&#160;    <span class="comment">// Each bit (1 &lt;&lt; i) is set if HeapSizeLimit is enabled for that heap, so cannot allocate more than the heap size.</span></div>
-<div class="line"><a name="l07451"></a><span class="lineno"> 7451</span>&#160;    uint32_t m_HeapSizeLimitMask;</div>
-<div class="line"><a name="l07452"></a><span class="lineno"> 7452</span>&#160; </div>
-<div class="line"><a name="l07453"></a><span class="lineno"> 7453</span>&#160;    VkPhysicalDeviceProperties m_PhysicalDeviceProperties;</div>
-<div class="line"><a name="l07454"></a><span class="lineno"> 7454</span>&#160;    VkPhysicalDeviceMemoryProperties m_MemProps;</div>
-<div class="line"><a name="l07455"></a><span class="lineno"> 7455</span>&#160; </div>
-<div class="line"><a name="l07456"></a><span class="lineno"> 7456</span>&#160;    <span class="comment">// Default pools.</span></div>
-<div class="line"><a name="l07457"></a><span class="lineno"> 7457</span>&#160;    VmaBlockVector* m_pBlockVectors[VK_MAX_MEMORY_TYPES];</div>
-<div class="line"><a name="l07458"></a><span class="lineno"> 7458</span>&#160; </div>
-<div class="line"><a name="l07459"></a><span class="lineno"> 7459</span>&#160;    <span class="comment">// Each vector is sorted by memory (handle value).</span></div>
-<div class="line"><a name="l07460"></a><span class="lineno"> 7460</span>&#160;    <span class="keyword">typedef</span> VmaVector&lt; VmaAllocation, VmaStlAllocator&lt;VmaAllocation&gt; &gt; AllocationVectorType;</div>
-<div class="line"><a name="l07461"></a><span class="lineno"> 7461</span>&#160;    AllocationVectorType* m_pDedicatedAllocations[VK_MAX_MEMORY_TYPES];</div>
-<div class="line"><a name="l07462"></a><span class="lineno"> 7462</span>&#160;    VMA_RW_MUTEX m_DedicatedAllocationsMutex[VK_MAX_MEMORY_TYPES];</div>
+<div class="line"><a name="l07325"></a><span class="lineno"> 7325</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> m_OverlappingMoveSupported;</div>
+<div class="line"><a name="l07326"></a><span class="lineno"> 7326</span>&#160; </div>
+<div class="line"><a name="l07327"></a><span class="lineno"> 7327</span>&#160;    uint32_t m_AllocationCount;</div>
+<div class="line"><a name="l07328"></a><span class="lineno"> 7328</span>&#160;    <span class="keywordtype">bool</span> m_AllAllocations;</div>
+<div class="line"><a name="l07329"></a><span class="lineno"> 7329</span>&#160; </div>
+<div class="line"><a name="l07330"></a><span class="lineno"> 7330</span>&#160;    VkDeviceSize m_BytesMoved;</div>
+<div class="line"><a name="l07331"></a><span class="lineno"> 7331</span>&#160;    uint32_t m_AllocationsMoved;</div>
+<div class="line"><a name="l07332"></a><span class="lineno"> 7332</span>&#160; </div>
+<div class="line"><a name="l07333"></a><span class="lineno"> 7333</span>&#160;    VmaVector&lt; BlockInfo, VmaStlAllocator&lt;BlockInfo&gt; &gt; m_BlockInfos;</div>
+<div class="line"><a name="l07334"></a><span class="lineno"> 7334</span>&#160; </div>
+<div class="line"><a name="l07335"></a><span class="lineno"> 7335</span>&#160;    <span class="keywordtype">void</span> PreprocessMetadata();</div>
+<div class="line"><a name="l07336"></a><span class="lineno"> 7336</span>&#160;    <span class="keywordtype">void</span> PostprocessMetadata();</div>
+<div class="line"><a name="l07337"></a><span class="lineno"> 7337</span>&#160;    <span class="keywordtype">void</span> InsertSuballoc(VmaBlockMetadata_Generic* pMetadata, <span class="keyword">const</span> VmaSuballocation&amp; suballoc);</div>
+<div class="line"><a name="l07338"></a><span class="lineno"> 7338</span>&#160;};</div>
+<div class="line"><a name="l07339"></a><span class="lineno"> 7339</span>&#160; </div>
+<div class="line"><a name="l07340"></a><span class="lineno"> 7340</span>&#160;<span class="keyword">struct </span>VmaBlockDefragmentationContext</div>
+<div class="line"><a name="l07341"></a><span class="lineno"> 7341</span>&#160;{</div>
+<div class="line"><a name="l07342"></a><span class="lineno"> 7342</span>&#160;    <span class="keyword">enum</span> BLOCK_FLAG</div>
+<div class="line"><a name="l07343"></a><span class="lineno"> 7343</span>&#160;    {</div>
+<div class="line"><a name="l07344"></a><span class="lineno"> 7344</span>&#160;        BLOCK_FLAG_USED = 0x00000001,</div>
+<div class="line"><a name="l07345"></a><span class="lineno"> 7345</span>&#160;    };</div>
+<div class="line"><a name="l07346"></a><span class="lineno"> 7346</span>&#160;    uint32_t flags;</div>
+<div class="line"><a name="l07347"></a><span class="lineno"> 7347</span>&#160;    VkBuffer hBuffer;</div>
+<div class="line"><a name="l07348"></a><span class="lineno"> 7348</span>&#160;};</div>
+<div class="line"><a name="l07349"></a><span class="lineno"> 7349</span>&#160; </div>
+<div class="line"><a name="l07350"></a><span class="lineno"> 7350</span>&#160;<span class="keyword">class </span>VmaBlockVectorDefragmentationContext</div>
+<div class="line"><a name="l07351"></a><span class="lineno"> 7351</span>&#160;{</div>
+<div class="line"><a name="l07352"></a><span class="lineno"> 7352</span>&#160;    VMA_CLASS_NO_COPY(VmaBlockVectorDefragmentationContext)</div>
+<div class="line"><a name="l07353"></a><span class="lineno"> 7353</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l07354"></a><span class="lineno"> 7354</span>&#160;    VkResult res;</div>
+<div class="line"><a name="l07355"></a><span class="lineno"> 7355</span>&#160;    <span class="keywordtype">bool</span> mutexLocked;</div>
+<div class="line"><a name="l07356"></a><span class="lineno"> 7356</span>&#160;    VmaVector&lt; VmaBlockDefragmentationContext, VmaStlAllocator&lt;VmaBlockDefragmentationContext&gt; &gt; blockContexts;</div>
+<div class="line"><a name="l07357"></a><span class="lineno"> 7357</span>&#160;    VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt; defragmentationMoves;</div>
+<div class="line"><a name="l07358"></a><span class="lineno"> 7358</span>&#160;    uint32_t defragmentationMovesProcessed;</div>
+<div class="line"><a name="l07359"></a><span class="lineno"> 7359</span>&#160;    uint32_t defragmentationMovesCommitted;</div>
+<div class="line"><a name="l07360"></a><span class="lineno"> 7360</span>&#160;    <span class="keywordtype">bool</span> hasDefragmentationPlan;</div>
+<div class="line"><a name="l07361"></a><span class="lineno"> 7361</span>&#160; </div>
+<div class="line"><a name="l07362"></a><span class="lineno"> 7362</span>&#160;    VmaBlockVectorDefragmentationContext(</div>
+<div class="line"><a name="l07363"></a><span class="lineno"> 7363</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l07364"></a><span class="lineno"> 7364</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> hCustomPool, <span class="comment">// Optional.</span></div>
+<div class="line"><a name="l07365"></a><span class="lineno"> 7365</span>&#160;        VmaBlockVector* pBlockVector,</div>
+<div class="line"><a name="l07366"></a><span class="lineno"> 7366</span>&#160;        uint32_t currFrameIndex);</div>
+<div class="line"><a name="l07367"></a><span class="lineno"> 7367</span>&#160;    ~VmaBlockVectorDefragmentationContext();</div>
+<div class="line"><a name="l07368"></a><span class="lineno"> 7368</span>&#160; </div>
+<div class="line"><a name="l07369"></a><span class="lineno"> 7369</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> GetCustomPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hCustomPool; }</div>
+<div class="line"><a name="l07370"></a><span class="lineno"> 7370</span>&#160;    VmaBlockVector* GetBlockVector()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pBlockVector; }</div>
+<div class="line"><a name="l07371"></a><span class="lineno"> 7371</span>&#160;    VmaDefragmentationAlgorithm* GetAlgorithm()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pAlgorithm; }</div>
+<div class="line"><a name="l07372"></a><span class="lineno"> 7372</span>&#160; </div>
+<div class="line"><a name="l07373"></a><span class="lineno"> 7373</span>&#160;    <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged);</div>
+<div class="line"><a name="l07374"></a><span class="lineno"> 7374</span>&#160;    <span class="keywordtype">void</span> AddAll() { m_AllAllocations = <span class="keyword">true</span>; }</div>
+<div class="line"><a name="l07375"></a><span class="lineno"> 7375</span>&#160; </div>
+<div class="line"><a name="l07376"></a><span class="lineno"> 7376</span>&#160;    <span class="keywordtype">void</span> Begin(<span class="keywordtype">bool</span> overlappingMoveSupported, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags);</div>
+<div class="line"><a name="l07377"></a><span class="lineno"> 7377</span>&#160; </div>
+<div class="line"><a name="l07378"></a><span class="lineno"> 7378</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l07379"></a><span class="lineno"> 7379</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> m_hAllocator;</div>
+<div class="line"><a name="l07380"></a><span class="lineno"> 7380</span>&#160;    <span class="comment">// Null if not from custom pool.</span></div>
+<div class="line"><a name="l07381"></a><span class="lineno"> 7381</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a> m_hCustomPool;</div>
+<div class="line"><a name="l07382"></a><span class="lineno"> 7382</span>&#160;    <span class="comment">// Redundant, for convenience not to fetch from m_hCustomPool-&gt;m_BlockVector or m_hAllocator-&gt;m_pBlockVectors.</span></div>
+<div class="line"><a name="l07383"></a><span class="lineno"> 7383</span>&#160;    VmaBlockVector* <span class="keyword">const</span> m_pBlockVector;</div>
+<div class="line"><a name="l07384"></a><span class="lineno"> 7384</span>&#160;    <span class="keyword">const</span> uint32_t m_CurrFrameIndex;</div>
+<div class="line"><a name="l07385"></a><span class="lineno"> 7385</span>&#160;    <span class="comment">// Owner of this object.</span></div>
+<div class="line"><a name="l07386"></a><span class="lineno"> 7386</span>&#160;    VmaDefragmentationAlgorithm* m_pAlgorithm;</div>
+<div class="line"><a name="l07387"></a><span class="lineno"> 7387</span>&#160; </div>
+<div class="line"><a name="l07388"></a><span class="lineno"> 7388</span>&#160;    <span class="keyword">struct </span>AllocInfo</div>
+<div class="line"><a name="l07389"></a><span class="lineno"> 7389</span>&#160;    {</div>
+<div class="line"><a name="l07390"></a><span class="lineno"> 7390</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc;</div>
+<div class="line"><a name="l07391"></a><span class="lineno"> 7391</span>&#160;        VkBool32* pChanged;</div>
+<div class="line"><a name="l07392"></a><span class="lineno"> 7392</span>&#160;    };</div>
+<div class="line"><a name="l07393"></a><span class="lineno"> 7393</span>&#160;    <span class="comment">// Used between constructor and Begin.</span></div>
+<div class="line"><a name="l07394"></a><span class="lineno"> 7394</span>&#160;    VmaVector&lt; AllocInfo, VmaStlAllocator&lt;AllocInfo&gt; &gt; m_Allocations;</div>
+<div class="line"><a name="l07395"></a><span class="lineno"> 7395</span>&#160;    <span class="keywordtype">bool</span> m_AllAllocations;</div>
+<div class="line"><a name="l07396"></a><span class="lineno"> 7396</span>&#160;};</div>
+<div class="line"><a name="l07397"></a><span class="lineno"> 7397</span>&#160; </div>
+<div class="line"><a name="l07398"></a><span class="lineno"> 7398</span>&#160;<span class="keyword">struct </span>VmaDefragmentationContext_T</div>
+<div class="line"><a name="l07399"></a><span class="lineno"> 7399</span>&#160;{</div>
+<div class="line"><a name="l07400"></a><span class="lineno"> 7400</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l07401"></a><span class="lineno"> 7401</span>&#160;    VMA_CLASS_NO_COPY(VmaDefragmentationContext_T)</div>
+<div class="line"><a name="l07402"></a><span class="lineno"> 7402</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l07403"></a><span class="lineno"> 7403</span>&#160;    VmaDefragmentationContext_T(</div>
+<div class="line"><a name="l07404"></a><span class="lineno"> 7404</span>&#160;        <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l07405"></a><span class="lineno"> 7405</span>&#160;        uint32_t currFrameIndex,</div>
+<div class="line"><a name="l07406"></a><span class="lineno"> 7406</span>&#160;        uint32_t flags,</div>
+<div class="line"><a name="l07407"></a><span class="lineno"> 7407</span>&#160;        <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats);</div>
+<div class="line"><a name="l07408"></a><span class="lineno"> 7408</span>&#160;    ~VmaDefragmentationContext_T();</div>
+<div class="line"><a name="l07409"></a><span class="lineno"> 7409</span>&#160; </div>
+<div class="line"><a name="l07410"></a><span class="lineno"> 7410</span>&#160;    <span class="keywordtype">void</span> AddPools(uint32_t poolCount, <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPools);</div>
+<div class="line"><a name="l07411"></a><span class="lineno"> 7411</span>&#160;    <span class="keywordtype">void</span> AddAllocations(</div>
+<div class="line"><a name="l07412"></a><span class="lineno"> 7412</span>&#160;        uint32_t allocationCount,</div>
+<div class="line"><a name="l07413"></a><span class="lineno"> 7413</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations,</div>
+<div class="line"><a name="l07414"></a><span class="lineno"> 7414</span>&#160;        VkBool32* pAllocationsChanged);</div>
+<div class="line"><a name="l07415"></a><span class="lineno"> 7415</span>&#160; </div>
+<div class="line"><a name="l07416"></a><span class="lineno"> 7416</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l07417"></a><span class="lineno"> 7417</span>&#160;<span class="comment">    Returns:</span></div>
+<div class="line"><a name="l07418"></a><span class="lineno"> 7418</span>&#160;<span class="comment">    - `VK_SUCCESS` if succeeded and object can be destroyed immediately.</span></div>
+<div class="line"><a name="l07419"></a><span class="lineno"> 7419</span>&#160;<span class="comment">    - `VK_NOT_READY` if succeeded but the object must remain alive until vmaDefragmentationEnd().</span></div>
+<div class="line"><a name="l07420"></a><span class="lineno"> 7420</span>&#160;<span class="comment">    - Negative value if error occured and object can be destroyed immediately.</span></div>
+<div class="line"><a name="l07421"></a><span class="lineno"> 7421</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l07422"></a><span class="lineno"> 7422</span>&#160;    VkResult Defragment(</div>
+<div class="line"><a name="l07423"></a><span class="lineno"> 7423</span>&#160;        VkDeviceSize maxCpuBytesToMove, uint32_t maxCpuAllocationsToMove,</div>
+<div class="line"><a name="l07424"></a><span class="lineno"> 7424</span>&#160;        VkDeviceSize maxGpuBytesToMove, uint32_t maxGpuAllocationsToMove,</div>
+<div class="line"><a name="l07425"></a><span class="lineno"> 7425</span>&#160;        VkCommandBuffer commandBuffer, <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags);</div>
+<div class="line"><a name="l07426"></a><span class="lineno"> 7426</span>&#160; </div>
+<div class="line"><a name="l07427"></a><span class="lineno"> 7427</span>&#160;    VkResult DefragmentPassBegin(<a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* pInfo);</div>
+<div class="line"><a name="l07428"></a><span class="lineno"> 7428</span>&#160;    VkResult DefragmentPassEnd();</div>
+<div class="line"><a name="l07429"></a><span class="lineno"> 7429</span>&#160; </div>
+<div class="line"><a name="l07430"></a><span class="lineno"> 7430</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l07431"></a><span class="lineno"> 7431</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> m_hAllocator;</div>
+<div class="line"><a name="l07432"></a><span class="lineno"> 7432</span>&#160;    <span class="keyword">const</span> uint32_t m_CurrFrameIndex;</div>
+<div class="line"><a name="l07433"></a><span class="lineno"> 7433</span>&#160;    <span class="keyword">const</span> uint32_t m_Flags;</div>
+<div class="line"><a name="l07434"></a><span class="lineno"> 7434</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* <span class="keyword">const</span> m_pStats;</div>
+<div class="line"><a name="l07435"></a><span class="lineno"> 7435</span>&#160; </div>
+<div class="line"><a name="l07436"></a><span class="lineno"> 7436</span>&#160;    VkDeviceSize m_MaxCpuBytesToMove;</div>
+<div class="line"><a name="l07437"></a><span class="lineno"> 7437</span>&#160;    uint32_t m_MaxCpuAllocationsToMove;</div>
+<div class="line"><a name="l07438"></a><span class="lineno"> 7438</span>&#160;    VkDeviceSize m_MaxGpuBytesToMove;</div>
+<div class="line"><a name="l07439"></a><span class="lineno"> 7439</span>&#160;    uint32_t m_MaxGpuAllocationsToMove;</div>
+<div class="line"><a name="l07440"></a><span class="lineno"> 7440</span>&#160; </div>
+<div class="line"><a name="l07441"></a><span class="lineno"> 7441</span>&#160;    <span class="comment">// Owner of these objects.</span></div>
+<div class="line"><a name="l07442"></a><span class="lineno"> 7442</span>&#160;    VmaBlockVectorDefragmentationContext* m_DefaultPoolContexts[VK_MAX_MEMORY_TYPES];</div>
+<div class="line"><a name="l07443"></a><span class="lineno"> 7443</span>&#160;    <span class="comment">// Owner of these objects.</span></div>
+<div class="line"><a name="l07444"></a><span class="lineno"> 7444</span>&#160;    VmaVector&lt; VmaBlockVectorDefragmentationContext*, VmaStlAllocator&lt;VmaBlockVectorDefragmentationContext*&gt; &gt; m_CustomPoolContexts;</div>
+<div class="line"><a name="l07445"></a><span class="lineno"> 7445</span>&#160;};</div>
+<div class="line"><a name="l07446"></a><span class="lineno"> 7446</span>&#160; </div>
+<div class="line"><a name="l07447"></a><span class="lineno"> 7447</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l07448"></a><span class="lineno"> 7448</span>&#160; </div>
+<div class="line"><a name="l07449"></a><span class="lineno"> 7449</span>&#160;<span class="keyword">class </span>VmaRecorder</div>
+<div class="line"><a name="l07450"></a><span class="lineno"> 7450</span>&#160;{</div>
+<div class="line"><a name="l07451"></a><span class="lineno"> 7451</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l07452"></a><span class="lineno"> 7452</span>&#160;    VmaRecorder();</div>
+<div class="line"><a name="l07453"></a><span class="lineno"> 7453</span>&#160;    VkResult Init(<span class="keyword">const</span> <a class="code" href="struct_vma_record_settings.html">VmaRecordSettings</a>&amp; settings, <span class="keywordtype">bool</span> useMutex);</div>
+<div class="line"><a name="l07454"></a><span class="lineno"> 7454</span>&#160;    <span class="keywordtype">void</span> WriteConfiguration(</div>
+<div class="line"><a name="l07455"></a><span class="lineno"> 7455</span>&#160;        <span class="keyword">const</span> VkPhysicalDeviceProperties&amp; devProps,</div>
+<div class="line"><a name="l07456"></a><span class="lineno"> 7456</span>&#160;        <span class="keyword">const</span> VkPhysicalDeviceMemoryProperties&amp; memProps,</div>
+<div class="line"><a name="l07457"></a><span class="lineno"> 7457</span>&#160;        uint32_t vulkanApiVersion,</div>
+<div class="line"><a name="l07458"></a><span class="lineno"> 7458</span>&#160;        <span class="keywordtype">bool</span> dedicatedAllocationExtensionEnabled,</div>
+<div class="line"><a name="l07459"></a><span class="lineno"> 7459</span>&#160;        <span class="keywordtype">bool</span> bindMemory2ExtensionEnabled,</div>
+<div class="line"><a name="l07460"></a><span class="lineno"> 7460</span>&#160;        <span class="keywordtype">bool</span> memoryBudgetExtensionEnabled,</div>
+<div class="line"><a name="l07461"></a><span class="lineno"> 7461</span>&#160;        <span class="keywordtype">bool</span> deviceCoherentMemoryExtensionEnabled);</div>
+<div class="line"><a name="l07462"></a><span class="lineno"> 7462</span>&#160;    ~VmaRecorder();</div>
 <div class="line"><a name="l07463"></a><span class="lineno"> 7463</span>&#160; </div>
-<div class="line"><a name="l07464"></a><span class="lineno"> 7464</span>&#160;    VmaCurrentBudgetData m_Budget;</div>
-<div class="line"><a name="l07465"></a><span class="lineno"> 7465</span>&#160; </div>
-<div class="line"><a name="l07466"></a><span class="lineno"> 7466</span>&#160;    VmaAllocator_T(<span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo);</div>
-<div class="line"><a name="l07467"></a><span class="lineno"> 7467</span>&#160;    VkResult Init(<span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo);</div>
-<div class="line"><a name="l07468"></a><span class="lineno"> 7468</span>&#160;    ~VmaAllocator_T();</div>
-<div class="line"><a name="l07469"></a><span class="lineno"> 7469</span>&#160; </div>
-<div class="line"><a name="l07470"></a><span class="lineno"> 7470</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* GetAllocationCallbacks()<span class="keyword"> const</span></div>
-<div class="line"><a name="l07471"></a><span class="lineno"> 7471</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l07472"></a><span class="lineno"> 7472</span>&#160;        <span class="keywordflow">return</span> m_AllocationCallbacksSpecified ? &amp;m_AllocationCallbacks : 0;</div>
-<div class="line"><a name="l07473"></a><span class="lineno"> 7473</span>&#160;    }</div>
-<div class="line"><a name="l07474"></a><span class="lineno"> 7474</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>&amp; GetVulkanFunctions()<span class="keyword"> const</span></div>
-<div class="line"><a name="l07475"></a><span class="lineno"> 7475</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l07476"></a><span class="lineno"> 7476</span>&#160;        <span class="keywordflow">return</span> m_VulkanFunctions;</div>
-<div class="line"><a name="l07477"></a><span class="lineno"> 7477</span>&#160;    }</div>
-<div class="line"><a name="l07478"></a><span class="lineno"> 7478</span>&#160; </div>
-<div class="line"><a name="l07479"></a><span class="lineno"> 7479</span>&#160;    VkPhysicalDevice GetPhysicalDevice()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_PhysicalDevice; }</div>
-<div class="line"><a name="l07480"></a><span class="lineno"> 7480</span>&#160; </div>
-<div class="line"><a name="l07481"></a><span class="lineno"> 7481</span>&#160;    VkDeviceSize GetBufferImageGranularity()<span class="keyword"> const</span></div>
-<div class="line"><a name="l07482"></a><span class="lineno"> 7482</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l07483"></a><span class="lineno"> 7483</span>&#160;        <span class="keywordflow">return</span> VMA_MAX(</div>
-<div class="line"><a name="l07484"></a><span class="lineno"> 7484</span>&#160;            <span class="keyword">static_cast&lt;</span>VkDeviceSize<span class="keyword">&gt;</span>(VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY),</div>
-<div class="line"><a name="l07485"></a><span class="lineno"> 7485</span>&#160;            m_PhysicalDeviceProperties.limits.bufferImageGranularity);</div>
-<div class="line"><a name="l07486"></a><span class="lineno"> 7486</span>&#160;    }</div>
-<div class="line"><a name="l07487"></a><span class="lineno"> 7487</span>&#160; </div>
-<div class="line"><a name="l07488"></a><span class="lineno"> 7488</span>&#160;    uint32_t GetMemoryHeapCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemProps.memoryHeapCount; }</div>
-<div class="line"><a name="l07489"></a><span class="lineno"> 7489</span>&#160;    uint32_t GetMemoryTypeCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemProps.memoryTypeCount; }</div>
-<div class="line"><a name="l07490"></a><span class="lineno"> 7490</span>&#160; </div>
-<div class="line"><a name="l07491"></a><span class="lineno"> 7491</span>&#160;    uint32_t MemoryTypeIndexToHeapIndex(uint32_t memTypeIndex)<span class="keyword"> const</span></div>
-<div class="line"><a name="l07492"></a><span class="lineno"> 7492</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l07493"></a><span class="lineno"> 7493</span>&#160;        VMA_ASSERT(memTypeIndex &lt; m_MemProps.memoryTypeCount);</div>
-<div class="line"><a name="l07494"></a><span class="lineno"> 7494</span>&#160;        <span class="keywordflow">return</span> m_MemProps.memoryTypes[memTypeIndex].heapIndex;</div>
-<div class="line"><a name="l07495"></a><span class="lineno"> 7495</span>&#160;    }</div>
-<div class="line"><a name="l07496"></a><span class="lineno"> 7496</span>&#160;    <span class="comment">// True when specific memory type is HOST_VISIBLE but not HOST_COHERENT.</span></div>
-<div class="line"><a name="l07497"></a><span class="lineno"> 7497</span>&#160;    <span class="keywordtype">bool</span> IsMemoryTypeNonCoherent(uint32_t memTypeIndex)<span class="keyword"> const</span></div>
-<div class="line"><a name="l07498"></a><span class="lineno"> 7498</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l07499"></a><span class="lineno"> 7499</span>&#160;        <span class="keywordflow">return</span> (m_MemProps.memoryTypes[memTypeIndex].propertyFlags &amp; (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) ==</div>
-<div class="line"><a name="l07500"></a><span class="lineno"> 7500</span>&#160;            VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;</div>
-<div class="line"><a name="l07501"></a><span class="lineno"> 7501</span>&#160;    }</div>
-<div class="line"><a name="l07502"></a><span class="lineno"> 7502</span>&#160;    <span class="comment">// Minimum alignment for all allocations in specific memory type.</span></div>
-<div class="line"><a name="l07503"></a><span class="lineno"> 7503</span>&#160;    VkDeviceSize GetMemoryTypeMinAlignment(uint32_t memTypeIndex)<span class="keyword"> const</span></div>
-<div class="line"><a name="l07504"></a><span class="lineno"> 7504</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l07505"></a><span class="lineno"> 7505</span>&#160;        <span class="keywordflow">return</span> IsMemoryTypeNonCoherent(memTypeIndex) ?</div>
-<div class="line"><a name="l07506"></a><span class="lineno"> 7506</span>&#160;            VMA_MAX((VkDeviceSize)VMA_DEBUG_ALIGNMENT, m_PhysicalDeviceProperties.limits.nonCoherentAtomSize) :</div>
-<div class="line"><a name="l07507"></a><span class="lineno"> 7507</span>&#160;            (VkDeviceSize)VMA_DEBUG_ALIGNMENT;</div>
-<div class="line"><a name="l07508"></a><span class="lineno"> 7508</span>&#160;    }</div>
-<div class="line"><a name="l07509"></a><span class="lineno"> 7509</span>&#160; </div>
-<div class="line"><a name="l07510"></a><span class="lineno"> 7510</span>&#160;    <span class="keywordtype">bool</span> IsIntegratedGpu()<span class="keyword"> const</span></div>
-<div class="line"><a name="l07511"></a><span class="lineno"> 7511</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l07512"></a><span class="lineno"> 7512</span>&#160;        <span class="keywordflow">return</span> m_PhysicalDeviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;</div>
-<div class="line"><a name="l07513"></a><span class="lineno"> 7513</span>&#160;    }</div>
-<div class="line"><a name="l07514"></a><span class="lineno"> 7514</span>&#160; </div>
-<div class="line"><a name="l07515"></a><span class="lineno"> 7515</span>&#160;    uint32_t GetGlobalMemoryTypeBits()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_GlobalMemoryTypeBits; }</div>
-<div class="line"><a name="l07516"></a><span class="lineno"> 7516</span>&#160; </div>
-<div class="line"><a name="l07517"></a><span class="lineno"> 7517</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l07518"></a><span class="lineno"> 7518</span>&#160;    VmaRecorder* GetRecorder()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pRecorder; }</div>
-<div class="line"><a name="l07519"></a><span class="lineno"> 7519</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l07520"></a><span class="lineno"> 7520</span>&#160; </div>
-<div class="line"><a name="l07521"></a><span class="lineno"> 7521</span>&#160;    <span class="keywordtype">void</span> GetBufferMemoryRequirements(</div>
-<div class="line"><a name="l07522"></a><span class="lineno"> 7522</span>&#160;        VkBuffer hBuffer,</div>
-<div class="line"><a name="l07523"></a><span class="lineno"> 7523</span>&#160;        VkMemoryRequirements&amp; memReq,</div>
-<div class="line"><a name="l07524"></a><span class="lineno"> 7524</span>&#160;        <span class="keywordtype">bool</span>&amp; requiresDedicatedAllocation,</div>
-<div class="line"><a name="l07525"></a><span class="lineno"> 7525</span>&#160;        <span class="keywordtype">bool</span>&amp; prefersDedicatedAllocation) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l07526"></a><span class="lineno"> 7526</span>&#160;    <span class="keywordtype">void</span> GetImageMemoryRequirements(</div>
-<div class="line"><a name="l07527"></a><span class="lineno"> 7527</span>&#160;        VkImage hImage,</div>
-<div class="line"><a name="l07528"></a><span class="lineno"> 7528</span>&#160;        VkMemoryRequirements&amp; memReq,</div>
-<div class="line"><a name="l07529"></a><span class="lineno"> 7529</span>&#160;        <span class="keywordtype">bool</span>&amp; requiresDedicatedAllocation,</div>
-<div class="line"><a name="l07530"></a><span class="lineno"> 7530</span>&#160;        <span class="keywordtype">bool</span>&amp; prefersDedicatedAllocation) <span class="keyword">const</span>;</div>
-<div class="line"><a name="l07531"></a><span class="lineno"> 7531</span>&#160; </div>
-<div class="line"><a name="l07532"></a><span class="lineno"> 7532</span>&#160;    <span class="comment">// Main allocation function.</span></div>
-<div class="line"><a name="l07533"></a><span class="lineno"> 7533</span>&#160;    VkResult AllocateMemory(</div>
-<div class="line"><a name="l07534"></a><span class="lineno"> 7534</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
-<div class="line"><a name="l07535"></a><span class="lineno"> 7535</span>&#160;        <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
-<div class="line"><a name="l07536"></a><span class="lineno"> 7536</span>&#160;        <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
-<div class="line"><a name="l07537"></a><span class="lineno"> 7537</span>&#160;        VkBuffer dedicatedBuffer,</div>
-<div class="line"><a name="l07538"></a><span class="lineno"> 7538</span>&#160;        VkBufferUsageFlags dedicatedBufferUsage, <span class="comment">// UINT32_MAX when unknown.</span></div>
-<div class="line"><a name="l07539"></a><span class="lineno"> 7539</span>&#160;        VkImage dedicatedImage,</div>
-<div class="line"><a name="l07540"></a><span class="lineno"> 7540</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l07541"></a><span class="lineno"> 7541</span>&#160;        VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l07542"></a><span class="lineno"> 7542</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l07543"></a><span class="lineno"> 7543</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
-<div class="line"><a name="l07544"></a><span class="lineno"> 7544</span>&#160; </div>
-<div class="line"><a name="l07545"></a><span class="lineno"> 7545</span>&#160;    <span class="comment">// Main deallocation function.</span></div>
-<div class="line"><a name="l07546"></a><span class="lineno"> 7546</span>&#160;    <span class="keywordtype">void</span> FreeMemory(</div>
-<div class="line"><a name="l07547"></a><span class="lineno"> 7547</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l07548"></a><span class="lineno"> 7548</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
-<div class="line"><a name="l07549"></a><span class="lineno"> 7549</span>&#160; </div>
-<div class="line"><a name="l07550"></a><span class="lineno"> 7550</span>&#160;    VkResult ResizeAllocation(</div>
-<div class="line"><a name="l07551"></a><span class="lineno"> 7551</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc,</div>
-<div class="line"><a name="l07552"></a><span class="lineno"> 7552</span>&#160;        VkDeviceSize newSize);</div>
+<div class="line"><a name="l07464"></a><span class="lineno"> 7464</span>&#160;    <span class="keywordtype">void</span> RecordCreateAllocator(uint32_t frameIndex);</div>
+<div class="line"><a name="l07465"></a><span class="lineno"> 7465</span>&#160;    <span class="keywordtype">void</span> RecordDestroyAllocator(uint32_t frameIndex);</div>
+<div class="line"><a name="l07466"></a><span class="lineno"> 7466</span>&#160;    <span class="keywordtype">void</span> RecordCreatePool(uint32_t frameIndex,</div>
+<div class="line"><a name="l07467"></a><span class="lineno"> 7467</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l07468"></a><span class="lineno"> 7468</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
+<div class="line"><a name="l07469"></a><span class="lineno"> 7469</span>&#160;    <span class="keywordtype">void</span> RecordDestroyPool(uint32_t frameIndex, <a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
+<div class="line"><a name="l07470"></a><span class="lineno"> 7470</span>&#160;    <span class="keywordtype">void</span> RecordAllocateMemory(uint32_t frameIndex,</div>
+<div class="line"><a name="l07471"></a><span class="lineno"> 7471</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
+<div class="line"><a name="l07472"></a><span class="lineno"> 7472</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l07473"></a><span class="lineno"> 7473</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07474"></a><span class="lineno"> 7474</span>&#160;    <span class="keywordtype">void</span> RecordAllocateMemoryPages(uint32_t frameIndex,</div>
+<div class="line"><a name="l07475"></a><span class="lineno"> 7475</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
+<div class="line"><a name="l07476"></a><span class="lineno"> 7476</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l07477"></a><span class="lineno"> 7477</span>&#160;        uint64_t allocationCount,</div>
+<div class="line"><a name="l07478"></a><span class="lineno"> 7478</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
+<div class="line"><a name="l07479"></a><span class="lineno"> 7479</span>&#160;    <span class="keywordtype">void</span> RecordAllocateMemoryForBuffer(uint32_t frameIndex,</div>
+<div class="line"><a name="l07480"></a><span class="lineno"> 7480</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
+<div class="line"><a name="l07481"></a><span class="lineno"> 7481</span>&#160;        <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
+<div class="line"><a name="l07482"></a><span class="lineno"> 7482</span>&#160;        <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
+<div class="line"><a name="l07483"></a><span class="lineno"> 7483</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l07484"></a><span class="lineno"> 7484</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07485"></a><span class="lineno"> 7485</span>&#160;    <span class="keywordtype">void</span> RecordAllocateMemoryForImage(uint32_t frameIndex,</div>
+<div class="line"><a name="l07486"></a><span class="lineno"> 7486</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
+<div class="line"><a name="l07487"></a><span class="lineno"> 7487</span>&#160;        <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
+<div class="line"><a name="l07488"></a><span class="lineno"> 7488</span>&#160;        <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
+<div class="line"><a name="l07489"></a><span class="lineno"> 7489</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l07490"></a><span class="lineno"> 7490</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07491"></a><span class="lineno"> 7491</span>&#160;    <span class="keywordtype">void</span> RecordFreeMemory(uint32_t frameIndex,</div>
+<div class="line"><a name="l07492"></a><span class="lineno"> 7492</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07493"></a><span class="lineno"> 7493</span>&#160;    <span class="keywordtype">void</span> RecordFreeMemoryPages(uint32_t frameIndex,</div>
+<div class="line"><a name="l07494"></a><span class="lineno"> 7494</span>&#160;        uint64_t allocationCount,</div>
+<div class="line"><a name="l07495"></a><span class="lineno"> 7495</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
+<div class="line"><a name="l07496"></a><span class="lineno"> 7496</span>&#160;    <span class="keywordtype">void</span> RecordSetAllocationUserData(uint32_t frameIndex,</div>
+<div class="line"><a name="l07497"></a><span class="lineno"> 7497</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l07498"></a><span class="lineno"> 7498</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pUserData);</div>
+<div class="line"><a name="l07499"></a><span class="lineno"> 7499</span>&#160;    <span class="keywordtype">void</span> RecordCreateLostAllocation(uint32_t frameIndex,</div>
+<div class="line"><a name="l07500"></a><span class="lineno"> 7500</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07501"></a><span class="lineno"> 7501</span>&#160;    <span class="keywordtype">void</span> RecordMapMemory(uint32_t frameIndex,</div>
+<div class="line"><a name="l07502"></a><span class="lineno"> 7502</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07503"></a><span class="lineno"> 7503</span>&#160;    <span class="keywordtype">void</span> RecordUnmapMemory(uint32_t frameIndex,</div>
+<div class="line"><a name="l07504"></a><span class="lineno"> 7504</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07505"></a><span class="lineno"> 7505</span>&#160;    <span class="keywordtype">void</span> RecordFlushAllocation(uint32_t frameIndex,</div>
+<div class="line"><a name="l07506"></a><span class="lineno"> 7506</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size);</div>
+<div class="line"><a name="l07507"></a><span class="lineno"> 7507</span>&#160;    <span class="keywordtype">void</span> RecordInvalidateAllocation(uint32_t frameIndex,</div>
+<div class="line"><a name="l07508"></a><span class="lineno"> 7508</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size);</div>
+<div class="line"><a name="l07509"></a><span class="lineno"> 7509</span>&#160;    <span class="keywordtype">void</span> RecordCreateBuffer(uint32_t frameIndex,</div>
+<div class="line"><a name="l07510"></a><span class="lineno"> 7510</span>&#160;        <span class="keyword">const</span> VkBufferCreateInfo&amp; bufCreateInfo,</div>
+<div class="line"><a name="l07511"></a><span class="lineno"> 7511</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; allocCreateInfo,</div>
+<div class="line"><a name="l07512"></a><span class="lineno"> 7512</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07513"></a><span class="lineno"> 7513</span>&#160;    <span class="keywordtype">void</span> RecordCreateImage(uint32_t frameIndex,</div>
+<div class="line"><a name="l07514"></a><span class="lineno"> 7514</span>&#160;        <span class="keyword">const</span> VkImageCreateInfo&amp; imageCreateInfo,</div>
+<div class="line"><a name="l07515"></a><span class="lineno"> 7515</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; allocCreateInfo,</div>
+<div class="line"><a name="l07516"></a><span class="lineno"> 7516</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07517"></a><span class="lineno"> 7517</span>&#160;    <span class="keywordtype">void</span> RecordDestroyBuffer(uint32_t frameIndex,</div>
+<div class="line"><a name="l07518"></a><span class="lineno"> 7518</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07519"></a><span class="lineno"> 7519</span>&#160;    <span class="keywordtype">void</span> RecordDestroyImage(uint32_t frameIndex,</div>
+<div class="line"><a name="l07520"></a><span class="lineno"> 7520</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07521"></a><span class="lineno"> 7521</span>&#160;    <span class="keywordtype">void</span> RecordTouchAllocation(uint32_t frameIndex,</div>
+<div class="line"><a name="l07522"></a><span class="lineno"> 7522</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07523"></a><span class="lineno"> 7523</span>&#160;    <span class="keywordtype">void</span> RecordGetAllocationInfo(uint32_t frameIndex,</div>
+<div class="line"><a name="l07524"></a><span class="lineno"> 7524</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07525"></a><span class="lineno"> 7525</span>&#160;    <span class="keywordtype">void</span> RecordMakePoolAllocationsLost(uint32_t frameIndex,</div>
+<div class="line"><a name="l07526"></a><span class="lineno"> 7526</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
+<div class="line"><a name="l07527"></a><span class="lineno"> 7527</span>&#160;    <span class="keywordtype">void</span> RecordDefragmentationBegin(uint32_t frameIndex,</div>
+<div class="line"><a name="l07528"></a><span class="lineno"> 7528</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>&amp; info,</div>
+<div class="line"><a name="l07529"></a><span class="lineno"> 7529</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx);</div>
+<div class="line"><a name="l07530"></a><span class="lineno"> 7530</span>&#160;    <span class="keywordtype">void</span> RecordDefragmentationEnd(uint32_t frameIndex,</div>
+<div class="line"><a name="l07531"></a><span class="lineno"> 7531</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx);</div>
+<div class="line"><a name="l07532"></a><span class="lineno"> 7532</span>&#160;    <span class="keywordtype">void</span> RecordSetPoolName(uint32_t frameIndex,</div>
+<div class="line"><a name="l07533"></a><span class="lineno"> 7533</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
+<div class="line"><a name="l07534"></a><span class="lineno"> 7534</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">char</span>* name);</div>
+<div class="line"><a name="l07535"></a><span class="lineno"> 7535</span>&#160; </div>
+<div class="line"><a name="l07536"></a><span class="lineno"> 7536</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l07537"></a><span class="lineno"> 7537</span>&#160;    <span class="keyword">struct </span>CallParams</div>
+<div class="line"><a name="l07538"></a><span class="lineno"> 7538</span>&#160;    {</div>
+<div class="line"><a name="l07539"></a><span class="lineno"> 7539</span>&#160;        uint32_t threadId;</div>
+<div class="line"><a name="l07540"></a><span class="lineno"> 7540</span>&#160;        <span class="keywordtype">double</span> time;</div>
+<div class="line"><a name="l07541"></a><span class="lineno"> 7541</span>&#160;    };</div>
+<div class="line"><a name="l07542"></a><span class="lineno"> 7542</span>&#160; </div>
+<div class="line"><a name="l07543"></a><span class="lineno"> 7543</span>&#160;    <span class="keyword">class </span>UserDataString</div>
+<div class="line"><a name="l07544"></a><span class="lineno"> 7544</span>&#160;    {</div>
+<div class="line"><a name="l07545"></a><span class="lineno"> 7545</span>&#160;    <span class="keyword">public</span>:</div>
+<div class="line"><a name="l07546"></a><span class="lineno"> 7546</span>&#160;        UserDataString(<a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlags, <span class="keyword">const</span> <span class="keywordtype">void</span>* pUserData);</div>
+<div class="line"><a name="l07547"></a><span class="lineno"> 7547</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">char</span>* GetString()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Str; }</div>
+<div class="line"><a name="l07548"></a><span class="lineno"> 7548</span>&#160; </div>
+<div class="line"><a name="l07549"></a><span class="lineno"> 7549</span>&#160;    <span class="keyword">private</span>:</div>
+<div class="line"><a name="l07550"></a><span class="lineno"> 7550</span>&#160;        <span class="keywordtype">char</span> m_PtrStr[17];</div>
+<div class="line"><a name="l07551"></a><span class="lineno"> 7551</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">char</span>* m_Str;</div>
+<div class="line"><a name="l07552"></a><span class="lineno"> 7552</span>&#160;    };</div>
 <div class="line"><a name="l07553"></a><span class="lineno"> 7553</span>&#160; </div>
-<div class="line"><a name="l07554"></a><span class="lineno"> 7554</span>&#160;    <span class="keywordtype">void</span> CalculateStats(<a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats);</div>
-<div class="line"><a name="l07555"></a><span class="lineno"> 7555</span>&#160; </div>
-<div class="line"><a name="l07556"></a><span class="lineno"> 7556</span>&#160;    <span class="keywordtype">void</span> GetBudget(</div>
-<div class="line"><a name="l07557"></a><span class="lineno"> 7557</span>&#160;        <a class="code" href="struct_vma_budget.html">VmaBudget</a>* outBudget, uint32_t firstHeap, uint32_t heapCount);</div>
-<div class="line"><a name="l07558"></a><span class="lineno"> 7558</span>&#160; </div>
-<div class="line"><a name="l07559"></a><span class="lineno"> 7559</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l07560"></a><span class="lineno"> 7560</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json);</div>
-<div class="line"><a name="l07561"></a><span class="lineno"> 7561</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l07554"></a><span class="lineno"> 7554</span>&#160;    <span class="keywordtype">bool</span> m_UseMutex;</div>
+<div class="line"><a name="l07555"></a><span class="lineno"> 7555</span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828">VmaRecordFlags</a> m_Flags;</div>
+<div class="line"><a name="l07556"></a><span class="lineno"> 7556</span>&#160;    FILE* m_File;</div>
+<div class="line"><a name="l07557"></a><span class="lineno"> 7557</span>&#160;    VMA_MUTEX m_FileMutex;</div>
+<div class="line"><a name="l07558"></a><span class="lineno"> 7558</span>&#160;    int64_t m_Freq;</div>
+<div class="line"><a name="l07559"></a><span class="lineno"> 7559</span>&#160;    int64_t m_StartCounter;</div>
+<div class="line"><a name="l07560"></a><span class="lineno"> 7560</span>&#160; </div>
+<div class="line"><a name="l07561"></a><span class="lineno"> 7561</span>&#160;    <span class="keywordtype">void</span> GetBasicParams(CallParams&amp; outParams);</div>
 <div class="line"><a name="l07562"></a><span class="lineno"> 7562</span>&#160; </div>
-<div class="line"><a name="l07563"></a><span class="lineno"> 7563</span>&#160;    VkResult DefragmentationBegin(</div>
-<div class="line"><a name="l07564"></a><span class="lineno"> 7564</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>&amp; info,</div>
-<div class="line"><a name="l07565"></a><span class="lineno"> 7565</span>&#160;        <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats,</div>
-<div class="line"><a name="l07566"></a><span class="lineno"> 7566</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a>* pContext);</div>
-<div class="line"><a name="l07567"></a><span class="lineno"> 7567</span>&#160;    VkResult DefragmentationEnd(</div>
-<div class="line"><a name="l07568"></a><span class="lineno"> 7568</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context);</div>
-<div class="line"><a name="l07569"></a><span class="lineno"> 7569</span>&#160; </div>
-<div class="line"><a name="l07570"></a><span class="lineno"> 7570</span>&#160;    VkResult DefragmentationPassBegin(</div>
-<div class="line"><a name="l07571"></a><span class="lineno"> 7571</span>&#160;        <a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* pInfo,</div>
-<div class="line"><a name="l07572"></a><span class="lineno"> 7572</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context);</div>
-<div class="line"><a name="l07573"></a><span class="lineno"> 7573</span>&#160;    VkResult DefragmentationPassEnd(</div>
-<div class="line"><a name="l07574"></a><span class="lineno"> 7574</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context);</div>
-<div class="line"><a name="l07575"></a><span class="lineno"> 7575</span>&#160; </div>
-<div class="line"><a name="l07576"></a><span class="lineno"> 7576</span>&#160;    <span class="keywordtype">void</span> GetAllocationInfo(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo);</div>
-<div class="line"><a name="l07577"></a><span class="lineno"> 7577</span>&#160;    <span class="keywordtype">bool</span> TouchAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
-<div class="line"><a name="l07578"></a><span class="lineno"> 7578</span>&#160; </div>
-<div class="line"><a name="l07579"></a><span class="lineno"> 7579</span>&#160;    VkResult CreatePool(<span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>* pCreateInfo, <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPool);</div>
-<div class="line"><a name="l07580"></a><span class="lineno"> 7580</span>&#160;    <span class="keywordtype">void</span> DestroyPool(<a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
-<div class="line"><a name="l07581"></a><span class="lineno"> 7581</span>&#160;    <span class="keywordtype">void</span> GetPoolStats(<a class="code" href="struct_vma_pool.html">VmaPool</a> pool, <a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pPoolStats);</div>
+<div class="line"><a name="l07563"></a><span class="lineno"> 7563</span>&#160;    <span class="comment">// T must be a pointer type, e.g. VmaAllocation, VmaPool.</span></div>
+<div class="line"><a name="l07564"></a><span class="lineno"> 7564</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l07565"></a><span class="lineno"> 7565</span>&#160;    <span class="keywordtype">void</span> PrintPointerList(uint64_t count, <span class="keyword">const</span> T* pItems)</div>
+<div class="line"><a name="l07566"></a><span class="lineno"> 7566</span>&#160;    {</div>
+<div class="line"><a name="l07567"></a><span class="lineno"> 7567</span>&#160;        <span class="keywordflow">if</span>(count)</div>
+<div class="line"><a name="l07568"></a><span class="lineno"> 7568</span>&#160;        {</div>
+<div class="line"><a name="l07569"></a><span class="lineno"> 7569</span>&#160;            fprintf(m_File, <span class="stringliteral">&quot;%p&quot;</span>, pItems[0]);</div>
+<div class="line"><a name="l07570"></a><span class="lineno"> 7570</span>&#160;            <span class="keywordflow">for</span>(uint64_t i = 1; i &lt; count; ++i)</div>
+<div class="line"><a name="l07571"></a><span class="lineno"> 7571</span>&#160;            {</div>
+<div class="line"><a name="l07572"></a><span class="lineno"> 7572</span>&#160;                fprintf(m_File, <span class="stringliteral">&quot; %p&quot;</span>, pItems[i]);</div>
+<div class="line"><a name="l07573"></a><span class="lineno"> 7573</span>&#160;            }</div>
+<div class="line"><a name="l07574"></a><span class="lineno"> 7574</span>&#160;        }</div>
+<div class="line"><a name="l07575"></a><span class="lineno"> 7575</span>&#160;    }</div>
+<div class="line"><a name="l07576"></a><span class="lineno"> 7576</span>&#160; </div>
+<div class="line"><a name="l07577"></a><span class="lineno"> 7577</span>&#160;    <span class="keywordtype">void</span> PrintPointerList(uint64_t count, <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pItems);</div>
+<div class="line"><a name="l07578"></a><span class="lineno"> 7578</span>&#160;    <span class="keywordtype">void</span> Flush();</div>
+<div class="line"><a name="l07579"></a><span class="lineno"> 7579</span>&#160;};</div>
+<div class="line"><a name="l07580"></a><span class="lineno"> 7580</span>&#160; </div>
+<div class="line"><a name="l07581"></a><span class="lineno"> 7581</span>&#160;<span class="preprocessor">#endif // #if VMA_RECORDING_ENABLED</span></div>
 <div class="line"><a name="l07582"></a><span class="lineno"> 7582</span>&#160; </div>
-<div class="line"><a name="l07583"></a><span class="lineno"> 7583</span>&#160;    <span class="keywordtype">void</span> SetCurrentFrameIndex(uint32_t frameIndex);</div>
-<div class="line"><a name="l07584"></a><span class="lineno"> 7584</span>&#160;    uint32_t GetCurrentFrameIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_CurrentFrameIndex.load(); }</div>
-<div class="line"><a name="l07585"></a><span class="lineno"> 7585</span>&#160; </div>
-<div class="line"><a name="l07586"></a><span class="lineno"> 7586</span>&#160;    <span class="keywordtype">void</span> MakePoolAllocationsLost(</div>
-<div class="line"><a name="l07587"></a><span class="lineno"> 7587</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> hPool,</div>
-<div class="line"><a name="l07588"></a><span class="lineno"> 7588</span>&#160;        <span class="keywordtype">size_t</span>* pLostAllocationCount);</div>
-<div class="line"><a name="l07589"></a><span class="lineno"> 7589</span>&#160;    VkResult CheckPoolCorruption(<a class="code" href="struct_vma_pool.html">VmaPool</a> hPool);</div>
-<div class="line"><a name="l07590"></a><span class="lineno"> 7590</span>&#160;    VkResult CheckCorruption(uint32_t memoryTypeBits);</div>
+<div class="line"><a name="l07583"></a><span class="lineno"> 7583</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l07584"></a><span class="lineno"> 7584</span>&#160;<span class="comment">Thread-safe wrapper over VmaPoolAllocator free list, for allocation of VmaAllocation_T objects.</span></div>
+<div class="line"><a name="l07585"></a><span class="lineno"> 7585</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l07586"></a><span class="lineno"> 7586</span>&#160;<span class="keyword">class </span>VmaAllocationObjectAllocator</div>
+<div class="line"><a name="l07587"></a><span class="lineno"> 7587</span>&#160;{</div>
+<div class="line"><a name="l07588"></a><span class="lineno"> 7588</span>&#160;    VMA_CLASS_NO_COPY(VmaAllocationObjectAllocator)</div>
+<div class="line"><a name="l07589"></a><span class="lineno"> 7589</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l07590"></a><span class="lineno"> 7590</span>&#160;    VmaAllocationObjectAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks);</div>
 <div class="line"><a name="l07591"></a><span class="lineno"> 7591</span>&#160; </div>
-<div class="line"><a name="l07592"></a><span class="lineno"> 7592</span>&#160;    <span class="keywordtype">void</span> CreateLostAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
-<div class="line"><a name="l07593"></a><span class="lineno"> 7593</span>&#160; </div>
-<div class="line"><a name="l07594"></a><span class="lineno"> 7594</span>&#160;    <span class="comment">// Call to Vulkan function vkAllocateMemory with accompanying bookkeeping.</span></div>
-<div class="line"><a name="l07595"></a><span class="lineno"> 7595</span>&#160;    VkResult AllocateVulkanMemory(<span class="keyword">const</span> VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory);</div>
-<div class="line"><a name="l07596"></a><span class="lineno"> 7596</span>&#160;    <span class="comment">// Call to Vulkan function vkFreeMemory with accompanying bookkeeping.</span></div>
-<div class="line"><a name="l07597"></a><span class="lineno"> 7597</span>&#160;    <span class="keywordtype">void</span> FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, VkDeviceMemory hMemory);</div>
-<div class="line"><a name="l07598"></a><span class="lineno"> 7598</span>&#160;    <span class="comment">// Call to Vulkan function vkBindBufferMemory or vkBindBufferMemory2KHR.</span></div>
-<div class="line"><a name="l07599"></a><span class="lineno"> 7599</span>&#160;    VkResult BindVulkanBuffer(</div>
-<div class="line"><a name="l07600"></a><span class="lineno"> 7600</span>&#160;        VkDeviceMemory memory,</div>
-<div class="line"><a name="l07601"></a><span class="lineno"> 7601</span>&#160;        VkDeviceSize memoryOffset,</div>
-<div class="line"><a name="l07602"></a><span class="lineno"> 7602</span>&#160;        VkBuffer buffer,</div>
-<div class="line"><a name="l07603"></a><span class="lineno"> 7603</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
-<div class="line"><a name="l07604"></a><span class="lineno"> 7604</span>&#160;    <span class="comment">// Call to Vulkan function vkBindImageMemory or vkBindImageMemory2KHR.</span></div>
-<div class="line"><a name="l07605"></a><span class="lineno"> 7605</span>&#160;    VkResult BindVulkanImage(</div>
-<div class="line"><a name="l07606"></a><span class="lineno"> 7606</span>&#160;        VkDeviceMemory memory,</div>
-<div class="line"><a name="l07607"></a><span class="lineno"> 7607</span>&#160;        VkDeviceSize memoryOffset,</div>
-<div class="line"><a name="l07608"></a><span class="lineno"> 7608</span>&#160;        VkImage image,</div>
-<div class="line"><a name="l07609"></a><span class="lineno"> 7609</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
-<div class="line"><a name="l07610"></a><span class="lineno"> 7610</span>&#160; </div>
-<div class="line"><a name="l07611"></a><span class="lineno"> 7611</span>&#160;    VkResult Map(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, <span class="keywordtype">void</span>** ppData);</div>
-<div class="line"><a name="l07612"></a><span class="lineno"> 7612</span>&#160;    <span class="keywordtype">void</span> Unmap(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
-<div class="line"><a name="l07613"></a><span class="lineno"> 7613</span>&#160; </div>
-<div class="line"><a name="l07614"></a><span class="lineno"> 7614</span>&#160;    VkResult BindBufferMemory(</div>
-<div class="line"><a name="l07615"></a><span class="lineno"> 7615</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
-<div class="line"><a name="l07616"></a><span class="lineno"> 7616</span>&#160;        VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l07617"></a><span class="lineno"> 7617</span>&#160;        VkBuffer hBuffer,</div>
-<div class="line"><a name="l07618"></a><span class="lineno"> 7618</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
-<div class="line"><a name="l07619"></a><span class="lineno"> 7619</span>&#160;    VkResult BindImageMemory(</div>
-<div class="line"><a name="l07620"></a><span class="lineno"> 7620</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
-<div class="line"><a name="l07621"></a><span class="lineno"> 7621</span>&#160;        VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l07622"></a><span class="lineno"> 7622</span>&#160;        VkImage hImage,</div>
-<div class="line"><a name="l07623"></a><span class="lineno"> 7623</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
-<div class="line"><a name="l07624"></a><span class="lineno"> 7624</span>&#160; </div>
-<div class="line"><a name="l07625"></a><span class="lineno"> 7625</span>&#160;    <span class="keywordtype">void</span> FlushOrInvalidateAllocation(</div>
-<div class="line"><a name="l07626"></a><span class="lineno"> 7626</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
-<div class="line"><a name="l07627"></a><span class="lineno"> 7627</span>&#160;        VkDeviceSize offset, VkDeviceSize size,</div>
-<div class="line"><a name="l07628"></a><span class="lineno"> 7628</span>&#160;        VMA_CACHE_OPERATION op);</div>
-<div class="line"><a name="l07629"></a><span class="lineno"> 7629</span>&#160; </div>
-<div class="line"><a name="l07630"></a><span class="lineno"> 7630</span>&#160;    <span class="keywordtype">void</span> FillAllocation(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, uint8_t pattern);</div>
-<div class="line"><a name="l07631"></a><span class="lineno"> 7631</span>&#160; </div>
-<div class="line"><a name="l07632"></a><span class="lineno"> 7632</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l07633"></a><span class="lineno"> 7633</span>&#160;<span class="comment">    Returns bit mask of memory types that can support defragmentation on GPU as</span></div>
-<div class="line"><a name="l07634"></a><span class="lineno"> 7634</span>&#160;<span class="comment">    they support creation of required buffer for copy operations.</span></div>
-<div class="line"><a name="l07635"></a><span class="lineno"> 7635</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l07636"></a><span class="lineno"> 7636</span>&#160;    uint32_t GetGpuDefragmentationMemoryTypeBits();</div>
-<div class="line"><a name="l07637"></a><span class="lineno"> 7637</span>&#160; </div>
-<div class="line"><a name="l07638"></a><span class="lineno"> 7638</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l07639"></a><span class="lineno"> 7639</span>&#160;    VkDeviceSize m_PreferredLargeHeapBlockSize;</div>
-<div class="line"><a name="l07640"></a><span class="lineno"> 7640</span>&#160; </div>
-<div class="line"><a name="l07641"></a><span class="lineno"> 7641</span>&#160;    VkPhysicalDevice m_PhysicalDevice;</div>
-<div class="line"><a name="l07642"></a><span class="lineno"> 7642</span>&#160;    VMA_ATOMIC_UINT32 m_CurrentFrameIndex;</div>
-<div class="line"><a name="l07643"></a><span class="lineno"> 7643</span>&#160;    VMA_ATOMIC_UINT32 m_GpuDefragmentationMemoryTypeBits; <span class="comment">// UINT32_MAX means uninitialized.</span></div>
-<div class="line"><a name="l07644"></a><span class="lineno"> 7644</span>&#160;    </div>
-<div class="line"><a name="l07645"></a><span class="lineno"> 7645</span>&#160;    VMA_RW_MUTEX m_PoolsMutex;</div>
-<div class="line"><a name="l07646"></a><span class="lineno"> 7646</span>&#160;    <span class="comment">// Protected by m_PoolsMutex. Sorted by pointer value.</span></div>
-<div class="line"><a name="l07647"></a><span class="lineno"> 7647</span>&#160;    VmaVector&lt;VmaPool, VmaStlAllocator&lt;VmaPool&gt; &gt; m_Pools;</div>
-<div class="line"><a name="l07648"></a><span class="lineno"> 7648</span>&#160;    uint32_t m_NextPoolId;</div>
-<div class="line"><a name="l07649"></a><span class="lineno"> 7649</span>&#160; </div>
-<div class="line"><a name="l07650"></a><span class="lineno"> 7650</span>&#160;    <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a> m_VulkanFunctions;</div>
-<div class="line"><a name="l07651"></a><span class="lineno"> 7651</span>&#160; </div>
-<div class="line"><a name="l07652"></a><span class="lineno"> 7652</span>&#160;    <span class="comment">// Global bit mask AND-ed with any memoryTypeBits to disallow certain memory types.</span></div>
-<div class="line"><a name="l07653"></a><span class="lineno"> 7653</span>&#160;    uint32_t m_GlobalMemoryTypeBits;</div>
-<div class="line"><a name="l07654"></a><span class="lineno"> 7654</span>&#160; </div>
-<div class="line"><a name="l07655"></a><span class="lineno"> 7655</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l07656"></a><span class="lineno"> 7656</span>&#160;    VmaRecorder* m_pRecorder;</div>
-<div class="line"><a name="l07657"></a><span class="lineno"> 7657</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l07658"></a><span class="lineno"> 7658</span>&#160; </div>
-<div class="line"><a name="l07659"></a><span class="lineno"> 7659</span>&#160;    <span class="keywordtype">void</span> ImportVulkanFunctions(<span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* pVulkanFunctions);</div>
-<div class="line"><a name="l07660"></a><span class="lineno"> 7660</span>&#160; </div>
-<div class="line"><a name="l07661"></a><span class="lineno"> 7661</span>&#160;<span class="preprocessor">#if VMA_STATIC_VULKAN_FUNCTIONS == 1</span></div>
-<div class="line"><a name="l07662"></a><span class="lineno"> 7662</span>&#160;    <span class="keywordtype">void</span> ImportVulkanFunctions_Static();</div>
-<div class="line"><a name="l07663"></a><span class="lineno"> 7663</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l07664"></a><span class="lineno"> 7664</span>&#160; </div>
-<div class="line"><a name="l07665"></a><span class="lineno"> 7665</span>&#160;    <span class="keywordtype">void</span> ImportVulkanFunctions_Custom(<span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* pVulkanFunctions);</div>
-<div class="line"><a name="l07666"></a><span class="lineno"> 7666</span>&#160; </div>
-<div class="line"><a name="l07667"></a><span class="lineno"> 7667</span>&#160;<span class="preprocessor">#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1</span></div>
-<div class="line"><a name="l07668"></a><span class="lineno"> 7668</span>&#160;    <span class="keywordtype">void</span> ImportVulkanFunctions_Dynamic();</div>
-<div class="line"><a name="l07669"></a><span class="lineno"> 7669</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l07592"></a><span class="lineno"> 7592</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span>... Types&gt; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> Allocate(Types... args);</div>
+<div class="line"><a name="l07593"></a><span class="lineno"> 7593</span>&#160;    <span class="keywordtype">void</span> Free(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc);</div>
+<div class="line"><a name="l07594"></a><span class="lineno"> 7594</span>&#160; </div>
+<div class="line"><a name="l07595"></a><span class="lineno"> 7595</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l07596"></a><span class="lineno"> 7596</span>&#160;    VMA_MUTEX m_Mutex;</div>
+<div class="line"><a name="l07597"></a><span class="lineno"> 7597</span>&#160;    VmaPoolAllocator&lt;VmaAllocation_T&gt; m_Allocator;</div>
+<div class="line"><a name="l07598"></a><span class="lineno"> 7598</span>&#160;};</div>
+<div class="line"><a name="l07599"></a><span class="lineno"> 7599</span>&#160; </div>
+<div class="line"><a name="l07600"></a><span class="lineno"> 7600</span>&#160;<span class="keyword">struct </span>VmaCurrentBudgetData</div>
+<div class="line"><a name="l07601"></a><span class="lineno"> 7601</span>&#160;{</div>
+<div class="line"><a name="l07602"></a><span class="lineno"> 7602</span>&#160;    VMA_ATOMIC_UINT64 m_BlockBytes[VK_MAX_MEMORY_HEAPS];</div>
+<div class="line"><a name="l07603"></a><span class="lineno"> 7603</span>&#160;    VMA_ATOMIC_UINT64 m_AllocationBytes[VK_MAX_MEMORY_HEAPS];</div>
+<div class="line"><a name="l07604"></a><span class="lineno"> 7604</span>&#160; </div>
+<div class="line"><a name="l07605"></a><span class="lineno"> 7605</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l07606"></a><span class="lineno"> 7606</span>&#160;    VMA_ATOMIC_UINT32 m_OperationsSinceBudgetFetch;</div>
+<div class="line"><a name="l07607"></a><span class="lineno"> 7607</span>&#160;    VMA_RW_MUTEX m_BudgetMutex;</div>
+<div class="line"><a name="l07608"></a><span class="lineno"> 7608</span>&#160;    uint64_t m_VulkanUsage[VK_MAX_MEMORY_HEAPS];</div>
+<div class="line"><a name="l07609"></a><span class="lineno"> 7609</span>&#160;    uint64_t m_VulkanBudget[VK_MAX_MEMORY_HEAPS];</div>
+<div class="line"><a name="l07610"></a><span class="lineno"> 7610</span>&#160;    uint64_t m_BlockBytesAtBudgetFetch[VK_MAX_MEMORY_HEAPS];</div>
+<div class="line"><a name="l07611"></a><span class="lineno"> 7611</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l07612"></a><span class="lineno"> 7612</span>&#160; </div>
+<div class="line"><a name="l07613"></a><span class="lineno"> 7613</span>&#160;    VmaCurrentBudgetData()</div>
+<div class="line"><a name="l07614"></a><span class="lineno"> 7614</span>&#160;    {</div>
+<div class="line"><a name="l07615"></a><span class="lineno"> 7615</span>&#160;        <span class="keywordflow">for</span>(uint32_t heapIndex = 0; heapIndex &lt; VK_MAX_MEMORY_HEAPS; ++heapIndex)</div>
+<div class="line"><a name="l07616"></a><span class="lineno"> 7616</span>&#160;        {</div>
+<div class="line"><a name="l07617"></a><span class="lineno"> 7617</span>&#160;            m_BlockBytes[heapIndex] = 0;</div>
+<div class="line"><a name="l07618"></a><span class="lineno"> 7618</span>&#160;            m_AllocationBytes[heapIndex] = 0;</div>
+<div class="line"><a name="l07619"></a><span class="lineno"> 7619</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l07620"></a><span class="lineno"> 7620</span>&#160;            m_VulkanUsage[heapIndex] = 0;</div>
+<div class="line"><a name="l07621"></a><span class="lineno"> 7621</span>&#160;            m_VulkanBudget[heapIndex] = 0;</div>
+<div class="line"><a name="l07622"></a><span class="lineno"> 7622</span>&#160;            m_BlockBytesAtBudgetFetch[heapIndex] = 0;</div>
+<div class="line"><a name="l07623"></a><span class="lineno"> 7623</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l07624"></a><span class="lineno"> 7624</span>&#160;        }</div>
+<div class="line"><a name="l07625"></a><span class="lineno"> 7625</span>&#160; </div>
+<div class="line"><a name="l07626"></a><span class="lineno"> 7626</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l07627"></a><span class="lineno"> 7627</span>&#160;        m_OperationsSinceBudgetFetch = 0;</div>
+<div class="line"><a name="l07628"></a><span class="lineno"> 7628</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l07629"></a><span class="lineno"> 7629</span>&#160;    }</div>
+<div class="line"><a name="l07630"></a><span class="lineno"> 7630</span>&#160; </div>
+<div class="line"><a name="l07631"></a><span class="lineno"> 7631</span>&#160;    <span class="keywordtype">void</span> AddAllocation(uint32_t heapIndex, VkDeviceSize allocationSize)</div>
+<div class="line"><a name="l07632"></a><span class="lineno"> 7632</span>&#160;    {</div>
+<div class="line"><a name="l07633"></a><span class="lineno"> 7633</span>&#160;        m_AllocationBytes[heapIndex] += allocationSize;</div>
+<div class="line"><a name="l07634"></a><span class="lineno"> 7634</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l07635"></a><span class="lineno"> 7635</span>&#160;        ++m_OperationsSinceBudgetFetch;</div>
+<div class="line"><a name="l07636"></a><span class="lineno"> 7636</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l07637"></a><span class="lineno"> 7637</span>&#160;    }</div>
+<div class="line"><a name="l07638"></a><span class="lineno"> 7638</span>&#160; </div>
+<div class="line"><a name="l07639"></a><span class="lineno"> 7639</span>&#160;    <span class="keywordtype">void</span> RemoveAllocation(uint32_t heapIndex, VkDeviceSize allocationSize)</div>
+<div class="line"><a name="l07640"></a><span class="lineno"> 7640</span>&#160;    {</div>
+<div class="line"><a name="l07641"></a><span class="lineno"> 7641</span>&#160;        VMA_ASSERT(m_AllocationBytes[heapIndex] &gt;= allocationSize); <span class="comment">// DELME</span></div>
+<div class="line"><a name="l07642"></a><span class="lineno"> 7642</span>&#160;        m_AllocationBytes[heapIndex] -= allocationSize;</div>
+<div class="line"><a name="l07643"></a><span class="lineno"> 7643</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l07644"></a><span class="lineno"> 7644</span>&#160;        ++m_OperationsSinceBudgetFetch;</div>
+<div class="line"><a name="l07645"></a><span class="lineno"> 7645</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l07646"></a><span class="lineno"> 7646</span>&#160;    }</div>
+<div class="line"><a name="l07647"></a><span class="lineno"> 7647</span>&#160;};</div>
+<div class="line"><a name="l07648"></a><span class="lineno"> 7648</span>&#160; </div>
+<div class="line"><a name="l07649"></a><span class="lineno"> 7649</span>&#160;<span class="comment">// Main allocator object.</span></div>
+<div class="line"><a name="l07650"></a><span class="lineno"> 7650</span>&#160;<span class="keyword">struct </span>VmaAllocator_T</div>
+<div class="line"><a name="l07651"></a><span class="lineno"> 7651</span>&#160;{</div>
+<div class="line"><a name="l07652"></a><span class="lineno"> 7652</span>&#160;    VMA_CLASS_NO_COPY(VmaAllocator_T)</div>
+<div class="line"><a name="l07653"></a><span class="lineno"> 7653</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l07654"></a><span class="lineno"> 7654</span>&#160;    <span class="keywordtype">bool</span> m_UseMutex;</div>
+<div class="line"><a name="l07655"></a><span class="lineno"> 7655</span>&#160;    uint32_t m_VulkanApiVersion;</div>
+<div class="line"><a name="l07656"></a><span class="lineno"> 7656</span>&#160;    <span class="keywordtype">bool</span> m_UseKhrDedicatedAllocation; <span class="comment">// Can be set only if m_VulkanApiVersion &lt; VK_MAKE_VERSION(1, 1, 0).</span></div>
+<div class="line"><a name="l07657"></a><span class="lineno"> 7657</span>&#160;    <span class="keywordtype">bool</span> m_UseKhrBindMemory2; <span class="comment">// Can be set only if m_VulkanApiVersion &lt; VK_MAKE_VERSION(1, 1, 0).</span></div>
+<div class="line"><a name="l07658"></a><span class="lineno"> 7658</span>&#160;    <span class="keywordtype">bool</span> m_UseExtMemoryBudget;</div>
+<div class="line"><a name="l07659"></a><span class="lineno"> 7659</span>&#160;    <span class="keywordtype">bool</span> m_UseAmdDeviceCoherentMemory;</div>
+<div class="line"><a name="l07660"></a><span class="lineno"> 7660</span>&#160;    <span class="keywordtype">bool</span> m_UseKhrBufferDeviceAddress;</div>
+<div class="line"><a name="l07661"></a><span class="lineno"> 7661</span>&#160;    VkDevice m_hDevice;</div>
+<div class="line"><a name="l07662"></a><span class="lineno"> 7662</span>&#160;    VkInstance m_hInstance;</div>
+<div class="line"><a name="l07663"></a><span class="lineno"> 7663</span>&#160;    <span class="keywordtype">bool</span> m_AllocationCallbacksSpecified;</div>
+<div class="line"><a name="l07664"></a><span class="lineno"> 7664</span>&#160;    VkAllocationCallbacks m_AllocationCallbacks;</div>
+<div class="line"><a name="l07665"></a><span class="lineno"> 7665</span>&#160;    <a class="code" href="struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks</a> m_DeviceMemoryCallbacks;</div>
+<div class="line"><a name="l07666"></a><span class="lineno"> 7666</span>&#160;    VmaAllocationObjectAllocator m_AllocationObjectAllocator;</div>
+<div class="line"><a name="l07667"></a><span class="lineno"> 7667</span>&#160;    </div>
+<div class="line"><a name="l07668"></a><span class="lineno"> 7668</span>&#160;    <span class="comment">// Each bit (1 &lt;&lt; i) is set if HeapSizeLimit is enabled for that heap, so cannot allocate more than the heap size.</span></div>
+<div class="line"><a name="l07669"></a><span class="lineno"> 7669</span>&#160;    uint32_t m_HeapSizeLimitMask;</div>
 <div class="line"><a name="l07670"></a><span class="lineno"> 7670</span>&#160; </div>
-<div class="line"><a name="l07671"></a><span class="lineno"> 7671</span>&#160;    <span class="keywordtype">void</span> ValidateVulkanFunctions();</div>
-<div class="line"><a name="l07672"></a><span class="lineno"> 7672</span>&#160; </div>
-<div class="line"><a name="l07673"></a><span class="lineno"> 7673</span>&#160;    VkDeviceSize CalcPreferredBlockSize(uint32_t memTypeIndex);</div>
-<div class="line"><a name="l07674"></a><span class="lineno"> 7674</span>&#160; </div>
-<div class="line"><a name="l07675"></a><span class="lineno"> 7675</span>&#160;    VkResult AllocateMemoryOfType(</div>
-<div class="line"><a name="l07676"></a><span class="lineno"> 7676</span>&#160;        VkDeviceSize size,</div>
-<div class="line"><a name="l07677"></a><span class="lineno"> 7677</span>&#160;        VkDeviceSize alignment,</div>
-<div class="line"><a name="l07678"></a><span class="lineno"> 7678</span>&#160;        <span class="keywordtype">bool</span> dedicatedAllocation,</div>
-<div class="line"><a name="l07679"></a><span class="lineno"> 7679</span>&#160;        VkBuffer dedicatedBuffer,</div>
-<div class="line"><a name="l07680"></a><span class="lineno"> 7680</span>&#160;        VkBufferUsageFlags dedicatedBufferUsage,</div>
-<div class="line"><a name="l07681"></a><span class="lineno"> 7681</span>&#160;        VkImage dedicatedImage,</div>
-<div class="line"><a name="l07682"></a><span class="lineno"> 7682</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l07683"></a><span class="lineno"> 7683</span>&#160;        uint32_t memTypeIndex,</div>
-<div class="line"><a name="l07684"></a><span class="lineno"> 7684</span>&#160;        VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l07685"></a><span class="lineno"> 7685</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l07686"></a><span class="lineno"> 7686</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
+<div class="line"><a name="l07671"></a><span class="lineno"> 7671</span>&#160;    VkPhysicalDeviceProperties m_PhysicalDeviceProperties;</div>
+<div class="line"><a name="l07672"></a><span class="lineno"> 7672</span>&#160;    VkPhysicalDeviceMemoryProperties m_MemProps;</div>
+<div class="line"><a name="l07673"></a><span class="lineno"> 7673</span>&#160; </div>
+<div class="line"><a name="l07674"></a><span class="lineno"> 7674</span>&#160;    <span class="comment">// Default pools.</span></div>
+<div class="line"><a name="l07675"></a><span class="lineno"> 7675</span>&#160;    VmaBlockVector* m_pBlockVectors[VK_MAX_MEMORY_TYPES];</div>
+<div class="line"><a name="l07676"></a><span class="lineno"> 7676</span>&#160; </div>
+<div class="line"><a name="l07677"></a><span class="lineno"> 7677</span>&#160;    <span class="comment">// Each vector is sorted by memory (handle value).</span></div>
+<div class="line"><a name="l07678"></a><span class="lineno"> 7678</span>&#160;    <span class="keyword">typedef</span> VmaVector&lt; VmaAllocation, VmaStlAllocator&lt;VmaAllocation&gt; &gt; AllocationVectorType;</div>
+<div class="line"><a name="l07679"></a><span class="lineno"> 7679</span>&#160;    AllocationVectorType* m_pDedicatedAllocations[VK_MAX_MEMORY_TYPES];</div>
+<div class="line"><a name="l07680"></a><span class="lineno"> 7680</span>&#160;    VMA_RW_MUTEX m_DedicatedAllocationsMutex[VK_MAX_MEMORY_TYPES];</div>
+<div class="line"><a name="l07681"></a><span class="lineno"> 7681</span>&#160; </div>
+<div class="line"><a name="l07682"></a><span class="lineno"> 7682</span>&#160;    VmaCurrentBudgetData m_Budget;</div>
+<div class="line"><a name="l07683"></a><span class="lineno"> 7683</span>&#160; </div>
+<div class="line"><a name="l07684"></a><span class="lineno"> 7684</span>&#160;    VmaAllocator_T(<span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo);</div>
+<div class="line"><a name="l07685"></a><span class="lineno"> 7685</span>&#160;    VkResult Init(<span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo);</div>
+<div class="line"><a name="l07686"></a><span class="lineno"> 7686</span>&#160;    ~VmaAllocator_T();</div>
 <div class="line"><a name="l07687"></a><span class="lineno"> 7687</span>&#160; </div>
-<div class="line"><a name="l07688"></a><span class="lineno"> 7688</span>&#160;    <span class="comment">// Helper function only to be used inside AllocateDedicatedMemory.</span></div>
-<div class="line"><a name="l07689"></a><span class="lineno"> 7689</span>&#160;    VkResult AllocateDedicatedMemoryPage(</div>
-<div class="line"><a name="l07690"></a><span class="lineno"> 7690</span>&#160;        VkDeviceSize size,</div>
-<div class="line"><a name="l07691"></a><span class="lineno"> 7691</span>&#160;        VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l07692"></a><span class="lineno"> 7692</span>&#160;        uint32_t memTypeIndex,</div>
-<div class="line"><a name="l07693"></a><span class="lineno"> 7693</span>&#160;        <span class="keyword">const</span> VkMemoryAllocateInfo&amp; allocInfo,</div>
-<div class="line"><a name="l07694"></a><span class="lineno"> 7694</span>&#160;        <span class="keywordtype">bool</span> map,</div>
-<div class="line"><a name="l07695"></a><span class="lineno"> 7695</span>&#160;        <span class="keywordtype">bool</span> isUserDataString,</div>
-<div class="line"><a name="l07696"></a><span class="lineno"> 7696</span>&#160;        <span class="keywordtype">void</span>* pUserData,</div>
-<div class="line"><a name="l07697"></a><span class="lineno"> 7697</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
+<div class="line"><a name="l07688"></a><span class="lineno"> 7688</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* GetAllocationCallbacks()<span class="keyword"> const</span></div>
+<div class="line"><a name="l07689"></a><span class="lineno"> 7689</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l07690"></a><span class="lineno"> 7690</span>&#160;        <span class="keywordflow">return</span> m_AllocationCallbacksSpecified ? &amp;m_AllocationCallbacks : 0;</div>
+<div class="line"><a name="l07691"></a><span class="lineno"> 7691</span>&#160;    }</div>
+<div class="line"><a name="l07692"></a><span class="lineno"> 7692</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>&amp; GetVulkanFunctions()<span class="keyword"> const</span></div>
+<div class="line"><a name="l07693"></a><span class="lineno"> 7693</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l07694"></a><span class="lineno"> 7694</span>&#160;        <span class="keywordflow">return</span> m_VulkanFunctions;</div>
+<div class="line"><a name="l07695"></a><span class="lineno"> 7695</span>&#160;    }</div>
+<div class="line"><a name="l07696"></a><span class="lineno"> 7696</span>&#160; </div>
+<div class="line"><a name="l07697"></a><span class="lineno"> 7697</span>&#160;    VkPhysicalDevice GetPhysicalDevice()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_PhysicalDevice; }</div>
 <div class="line"><a name="l07698"></a><span class="lineno"> 7698</span>&#160; </div>
-<div class="line"><a name="l07699"></a><span class="lineno"> 7699</span>&#160;    <span class="comment">// Allocates and registers new VkDeviceMemory specifically for dedicated allocations.</span></div>
-<div class="line"><a name="l07700"></a><span class="lineno"> 7700</span>&#160;    VkResult AllocateDedicatedMemory(</div>
-<div class="line"><a name="l07701"></a><span class="lineno"> 7701</span>&#160;        VkDeviceSize size,</div>
-<div class="line"><a name="l07702"></a><span class="lineno"> 7702</span>&#160;        VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l07703"></a><span class="lineno"> 7703</span>&#160;        uint32_t memTypeIndex,</div>
-<div class="line"><a name="l07704"></a><span class="lineno"> 7704</span>&#160;        <span class="keywordtype">bool</span> withinBudget,</div>
-<div class="line"><a name="l07705"></a><span class="lineno"> 7705</span>&#160;        <span class="keywordtype">bool</span> map,</div>
-<div class="line"><a name="l07706"></a><span class="lineno"> 7706</span>&#160;        <span class="keywordtype">bool</span> isUserDataString,</div>
-<div class="line"><a name="l07707"></a><span class="lineno"> 7707</span>&#160;        <span class="keywordtype">void</span>* pUserData,</div>
-<div class="line"><a name="l07708"></a><span class="lineno"> 7708</span>&#160;        VkBuffer dedicatedBuffer,</div>
-<div class="line"><a name="l07709"></a><span class="lineno"> 7709</span>&#160;        VkBufferUsageFlags dedicatedBufferUsage,</div>
-<div class="line"><a name="l07710"></a><span class="lineno"> 7710</span>&#160;        VkImage dedicatedImage,</div>
-<div class="line"><a name="l07711"></a><span class="lineno"> 7711</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l07712"></a><span class="lineno"> 7712</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
-<div class="line"><a name="l07713"></a><span class="lineno"> 7713</span>&#160; </div>
-<div class="line"><a name="l07714"></a><span class="lineno"> 7714</span>&#160;    <span class="keywordtype">void</span> FreeDedicatedMemory(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
-<div class="line"><a name="l07715"></a><span class="lineno"> 7715</span>&#160; </div>
-<div class="line"><a name="l07716"></a><span class="lineno"> 7716</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l07717"></a><span class="lineno"> 7717</span>&#160;<span class="comment">    Calculates and returns bit mask of memory types that can support defragmentation</span></div>
-<div class="line"><a name="l07718"></a><span class="lineno"> 7718</span>&#160;<span class="comment">    on GPU as they support creation of required buffer for copy operations.</span></div>
-<div class="line"><a name="l07719"></a><span class="lineno"> 7719</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l07720"></a><span class="lineno"> 7720</span>&#160;    uint32_t CalculateGpuDefragmentationMemoryTypeBits() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l07721"></a><span class="lineno"> 7721</span>&#160; </div>
-<div class="line"><a name="l07722"></a><span class="lineno"> 7722</span>&#160;    uint32_t CalculateGlobalMemoryTypeBits() <span class="keyword">const</span>;</div>
-<div class="line"><a name="l07723"></a><span class="lineno"> 7723</span>&#160; </div>
-<div class="line"><a name="l07724"></a><span class="lineno"> 7724</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l07725"></a><span class="lineno"> 7725</span>&#160;    <span class="keywordtype">void</span> UpdateVulkanBudget();</div>
-<div class="line"><a name="l07726"></a><span class="lineno"> 7726</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l07727"></a><span class="lineno"> 7727</span>&#160;};</div>
-<div class="line"><a name="l07728"></a><span class="lineno"> 7728</span>&#160; </div>
-<div class="line"><a name="l07730"></a><span class="lineno"> 7730</span>&#160;<span class="comment">// Memory allocation #2 after VmaAllocator_T definition</span></div>
-<div class="line"><a name="l07731"></a><span class="lineno"> 7731</span>&#160; </div>
-<div class="line"><a name="l07732"></a><span class="lineno"> 7732</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span>* VmaMalloc(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">size_t</span> size, <span class="keywordtype">size_t</span> alignment)</div>
-<div class="line"><a name="l07733"></a><span class="lineno"> 7733</span>&#160;{</div>
-<div class="line"><a name="l07734"></a><span class="lineno"> 7734</span>&#160;    <span class="keywordflow">return</span> VmaMalloc(&amp;hAllocator-&gt;m_AllocationCallbacks, size, alignment);</div>
-<div class="line"><a name="l07735"></a><span class="lineno"> 7735</span>&#160;}</div>
-<div class="line"><a name="l07736"></a><span class="lineno"> 7736</span>&#160; </div>
-<div class="line"><a name="l07737"></a><span class="lineno"> 7737</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFree(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>* ptr)</div>
-<div class="line"><a name="l07738"></a><span class="lineno"> 7738</span>&#160;{</div>
-<div class="line"><a name="l07739"></a><span class="lineno"> 7739</span>&#160;    VmaFree(&amp;hAllocator-&gt;m_AllocationCallbacks, ptr);</div>
-<div class="line"><a name="l07740"></a><span class="lineno"> 7740</span>&#160;}</div>
-<div class="line"><a name="l07741"></a><span class="lineno"> 7741</span>&#160; </div>
-<div class="line"><a name="l07742"></a><span class="lineno"> 7742</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l07743"></a><span class="lineno"> 7743</span>&#160;<span class="keyword">static</span> T* VmaAllocate(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator)</div>
-<div class="line"><a name="l07744"></a><span class="lineno"> 7744</span>&#160;{</div>
-<div class="line"><a name="l07745"></a><span class="lineno"> 7745</span>&#160;    <span class="keywordflow">return</span> (T*)VmaMalloc(hAllocator, <span class="keyword">sizeof</span>(T), VMA_ALIGN_OF(T));</div>
-<div class="line"><a name="l07746"></a><span class="lineno"> 7746</span>&#160;}</div>
-<div class="line"><a name="l07747"></a><span class="lineno"> 7747</span>&#160; </div>
-<div class="line"><a name="l07748"></a><span class="lineno"> 7748</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l07749"></a><span class="lineno"> 7749</span>&#160;<span class="keyword">static</span> T* VmaAllocateArray(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">size_t</span> count)</div>
-<div class="line"><a name="l07750"></a><span class="lineno"> 7750</span>&#160;{</div>
-<div class="line"><a name="l07751"></a><span class="lineno"> 7751</span>&#160;    <span class="keywordflow">return</span> (T*)VmaMalloc(hAllocator, <span class="keyword">sizeof</span>(T) * count, VMA_ALIGN_OF(T));</div>
-<div class="line"><a name="l07752"></a><span class="lineno"> 7752</span>&#160;}</div>
-<div class="line"><a name="l07753"></a><span class="lineno"> 7753</span>&#160; </div>
-<div class="line"><a name="l07754"></a><span class="lineno"> 7754</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l07755"></a><span class="lineno"> 7755</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, T* ptr)</div>
-<div class="line"><a name="l07756"></a><span class="lineno"> 7756</span>&#160;{</div>
-<div class="line"><a name="l07757"></a><span class="lineno"> 7757</span>&#160;    <span class="keywordflow">if</span>(ptr != VMA_NULL)</div>
-<div class="line"><a name="l07758"></a><span class="lineno"> 7758</span>&#160;    {</div>
-<div class="line"><a name="l07759"></a><span class="lineno"> 7759</span>&#160;        ptr-&gt;~T();</div>
-<div class="line"><a name="l07760"></a><span class="lineno"> 7760</span>&#160;        VmaFree(hAllocator, ptr);</div>
-<div class="line"><a name="l07761"></a><span class="lineno"> 7761</span>&#160;    }</div>
-<div class="line"><a name="l07762"></a><span class="lineno"> 7762</span>&#160;}</div>
-<div class="line"><a name="l07763"></a><span class="lineno"> 7763</span>&#160; </div>
-<div class="line"><a name="l07764"></a><span class="lineno"> 7764</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
-<div class="line"><a name="l07765"></a><span class="lineno"> 7765</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete_array(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, T* ptr, <span class="keywordtype">size_t</span> count)</div>
-<div class="line"><a name="l07766"></a><span class="lineno"> 7766</span>&#160;{</div>
-<div class="line"><a name="l07767"></a><span class="lineno"> 7767</span>&#160;    <span class="keywordflow">if</span>(ptr != VMA_NULL)</div>
-<div class="line"><a name="l07768"></a><span class="lineno"> 7768</span>&#160;    {</div>
-<div class="line"><a name="l07769"></a><span class="lineno"> 7769</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = count; i--; )</div>
-<div class="line"><a name="l07770"></a><span class="lineno"> 7770</span>&#160;            ptr[i].~T();</div>
-<div class="line"><a name="l07771"></a><span class="lineno"> 7771</span>&#160;        VmaFree(hAllocator, ptr);</div>
-<div class="line"><a name="l07772"></a><span class="lineno"> 7772</span>&#160;    }</div>
-<div class="line"><a name="l07773"></a><span class="lineno"> 7773</span>&#160;}</div>
-<div class="line"><a name="l07774"></a><span class="lineno"> 7774</span>&#160; </div>
-<div class="line"><a name="l07776"></a><span class="lineno"> 7776</span>&#160;<span class="comment">// VmaStringBuilder</span></div>
-<div class="line"><a name="l07777"></a><span class="lineno"> 7777</span>&#160; </div>
-<div class="line"><a name="l07778"></a><span class="lineno"> 7778</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l07779"></a><span class="lineno"> 7779</span>&#160; </div>
-<div class="line"><a name="l07780"></a><span class="lineno"> 7780</span>&#160;<span class="keyword">class </span>VmaStringBuilder</div>
-<div class="line"><a name="l07781"></a><span class="lineno"> 7781</span>&#160;{</div>
-<div class="line"><a name="l07782"></a><span class="lineno"> 7782</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l07783"></a><span class="lineno"> 7783</span>&#160;    VmaStringBuilder(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> alloc) : m_Data(VmaStlAllocator&lt;char&gt;(alloc-&gt;GetAllocationCallbacks())) { }</div>
-<div class="line"><a name="l07784"></a><span class="lineno"> 7784</span>&#160;    <span class="keywordtype">size_t</span> GetLength()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Data.size(); }</div>
-<div class="line"><a name="l07785"></a><span class="lineno"> 7785</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* GetData()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Data.data(); }</div>
-<div class="line"><a name="l07786"></a><span class="lineno"> 7786</span>&#160; </div>
-<div class="line"><a name="l07787"></a><span class="lineno"> 7787</span>&#160;    <span class="keywordtype">void</span> Add(<span class="keywordtype">char</span> ch) { m_Data.push_back(ch); }</div>
-<div class="line"><a name="l07788"></a><span class="lineno"> 7788</span>&#160;    <span class="keywordtype">void</span> Add(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr);</div>
-<div class="line"><a name="l07789"></a><span class="lineno"> 7789</span>&#160;    <span class="keywordtype">void</span> AddNewLine() { Add(<span class="charliteral">&#39;\n&#39;</span>); }</div>
-<div class="line"><a name="l07790"></a><span class="lineno"> 7790</span>&#160;    <span class="keywordtype">void</span> AddNumber(uint32_t num);</div>
-<div class="line"><a name="l07791"></a><span class="lineno"> 7791</span>&#160;    <span class="keywordtype">void</span> AddNumber(uint64_t num);</div>
-<div class="line"><a name="l07792"></a><span class="lineno"> 7792</span>&#160;    <span class="keywordtype">void</span> AddPointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr);</div>
+<div class="line"><a name="l07699"></a><span class="lineno"> 7699</span>&#160;    VkDeviceSize GetBufferImageGranularity()<span class="keyword"> const</span></div>
+<div class="line"><a name="l07700"></a><span class="lineno"> 7700</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l07701"></a><span class="lineno"> 7701</span>&#160;        <span class="keywordflow">return</span> VMA_MAX(</div>
+<div class="line"><a name="l07702"></a><span class="lineno"> 7702</span>&#160;            <span class="keyword">static_cast&lt;</span>VkDeviceSize<span class="keyword">&gt;</span>(VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY),</div>
+<div class="line"><a name="l07703"></a><span class="lineno"> 7703</span>&#160;            m_PhysicalDeviceProperties.limits.bufferImageGranularity);</div>
+<div class="line"><a name="l07704"></a><span class="lineno"> 7704</span>&#160;    }</div>
+<div class="line"><a name="l07705"></a><span class="lineno"> 7705</span>&#160; </div>
+<div class="line"><a name="l07706"></a><span class="lineno"> 7706</span>&#160;    uint32_t GetMemoryHeapCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemProps.memoryHeapCount; }</div>
+<div class="line"><a name="l07707"></a><span class="lineno"> 7707</span>&#160;    uint32_t GetMemoryTypeCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemProps.memoryTypeCount; }</div>
+<div class="line"><a name="l07708"></a><span class="lineno"> 7708</span>&#160; </div>
+<div class="line"><a name="l07709"></a><span class="lineno"> 7709</span>&#160;    uint32_t MemoryTypeIndexToHeapIndex(uint32_t memTypeIndex)<span class="keyword"> const</span></div>
+<div class="line"><a name="l07710"></a><span class="lineno"> 7710</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l07711"></a><span class="lineno"> 7711</span>&#160;        VMA_ASSERT(memTypeIndex &lt; m_MemProps.memoryTypeCount);</div>
+<div class="line"><a name="l07712"></a><span class="lineno"> 7712</span>&#160;        <span class="keywordflow">return</span> m_MemProps.memoryTypes[memTypeIndex].heapIndex;</div>
+<div class="line"><a name="l07713"></a><span class="lineno"> 7713</span>&#160;    }</div>
+<div class="line"><a name="l07714"></a><span class="lineno"> 7714</span>&#160;    <span class="comment">// True when specific memory type is HOST_VISIBLE but not HOST_COHERENT.</span></div>
+<div class="line"><a name="l07715"></a><span class="lineno"> 7715</span>&#160;    <span class="keywordtype">bool</span> IsMemoryTypeNonCoherent(uint32_t memTypeIndex)<span class="keyword"> const</span></div>
+<div class="line"><a name="l07716"></a><span class="lineno"> 7716</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l07717"></a><span class="lineno"> 7717</span>&#160;        <span class="keywordflow">return</span> (m_MemProps.memoryTypes[memTypeIndex].propertyFlags &amp; (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) ==</div>
+<div class="line"><a name="l07718"></a><span class="lineno"> 7718</span>&#160;            VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;</div>
+<div class="line"><a name="l07719"></a><span class="lineno"> 7719</span>&#160;    }</div>
+<div class="line"><a name="l07720"></a><span class="lineno"> 7720</span>&#160;    <span class="comment">// Minimum alignment for all allocations in specific memory type.</span></div>
+<div class="line"><a name="l07721"></a><span class="lineno"> 7721</span>&#160;    VkDeviceSize GetMemoryTypeMinAlignment(uint32_t memTypeIndex)<span class="keyword"> const</span></div>
+<div class="line"><a name="l07722"></a><span class="lineno"> 7722</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l07723"></a><span class="lineno"> 7723</span>&#160;        <span class="keywordflow">return</span> IsMemoryTypeNonCoherent(memTypeIndex) ?</div>
+<div class="line"><a name="l07724"></a><span class="lineno"> 7724</span>&#160;            VMA_MAX((VkDeviceSize)VMA_DEBUG_ALIGNMENT, m_PhysicalDeviceProperties.limits.nonCoherentAtomSize) :</div>
+<div class="line"><a name="l07725"></a><span class="lineno"> 7725</span>&#160;            (VkDeviceSize)VMA_DEBUG_ALIGNMENT;</div>
+<div class="line"><a name="l07726"></a><span class="lineno"> 7726</span>&#160;    }</div>
+<div class="line"><a name="l07727"></a><span class="lineno"> 7727</span>&#160; </div>
+<div class="line"><a name="l07728"></a><span class="lineno"> 7728</span>&#160;    <span class="keywordtype">bool</span> IsIntegratedGpu()<span class="keyword"> const</span></div>
+<div class="line"><a name="l07729"></a><span class="lineno"> 7729</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l07730"></a><span class="lineno"> 7730</span>&#160;        <span class="keywordflow">return</span> m_PhysicalDeviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;</div>
+<div class="line"><a name="l07731"></a><span class="lineno"> 7731</span>&#160;    }</div>
+<div class="line"><a name="l07732"></a><span class="lineno"> 7732</span>&#160; </div>
+<div class="line"><a name="l07733"></a><span class="lineno"> 7733</span>&#160;    uint32_t GetGlobalMemoryTypeBits()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_GlobalMemoryTypeBits; }</div>
+<div class="line"><a name="l07734"></a><span class="lineno"> 7734</span>&#160; </div>
+<div class="line"><a name="l07735"></a><span class="lineno"> 7735</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l07736"></a><span class="lineno"> 7736</span>&#160;    VmaRecorder* GetRecorder()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pRecorder; }</div>
+<div class="line"><a name="l07737"></a><span class="lineno"> 7737</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l07738"></a><span class="lineno"> 7738</span>&#160; </div>
+<div class="line"><a name="l07739"></a><span class="lineno"> 7739</span>&#160;    <span class="keywordtype">void</span> GetBufferMemoryRequirements(</div>
+<div class="line"><a name="l07740"></a><span class="lineno"> 7740</span>&#160;        VkBuffer hBuffer,</div>
+<div class="line"><a name="l07741"></a><span class="lineno"> 7741</span>&#160;        VkMemoryRequirements&amp; memReq,</div>
+<div class="line"><a name="l07742"></a><span class="lineno"> 7742</span>&#160;        <span class="keywordtype">bool</span>&amp; requiresDedicatedAllocation,</div>
+<div class="line"><a name="l07743"></a><span class="lineno"> 7743</span>&#160;        <span class="keywordtype">bool</span>&amp; prefersDedicatedAllocation) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l07744"></a><span class="lineno"> 7744</span>&#160;    <span class="keywordtype">void</span> GetImageMemoryRequirements(</div>
+<div class="line"><a name="l07745"></a><span class="lineno"> 7745</span>&#160;        VkImage hImage,</div>
+<div class="line"><a name="l07746"></a><span class="lineno"> 7746</span>&#160;        VkMemoryRequirements&amp; memReq,</div>
+<div class="line"><a name="l07747"></a><span class="lineno"> 7747</span>&#160;        <span class="keywordtype">bool</span>&amp; requiresDedicatedAllocation,</div>
+<div class="line"><a name="l07748"></a><span class="lineno"> 7748</span>&#160;        <span class="keywordtype">bool</span>&amp; prefersDedicatedAllocation) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l07749"></a><span class="lineno"> 7749</span>&#160; </div>
+<div class="line"><a name="l07750"></a><span class="lineno"> 7750</span>&#160;    <span class="comment">// Main allocation function.</span></div>
+<div class="line"><a name="l07751"></a><span class="lineno"> 7751</span>&#160;    VkResult AllocateMemory(</div>
+<div class="line"><a name="l07752"></a><span class="lineno"> 7752</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
+<div class="line"><a name="l07753"></a><span class="lineno"> 7753</span>&#160;        <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
+<div class="line"><a name="l07754"></a><span class="lineno"> 7754</span>&#160;        <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
+<div class="line"><a name="l07755"></a><span class="lineno"> 7755</span>&#160;        VkBuffer dedicatedBuffer,</div>
+<div class="line"><a name="l07756"></a><span class="lineno"> 7756</span>&#160;        VkBufferUsageFlags dedicatedBufferUsage, <span class="comment">// UINT32_MAX when unknown.</span></div>
+<div class="line"><a name="l07757"></a><span class="lineno"> 7757</span>&#160;        VkImage dedicatedImage,</div>
+<div class="line"><a name="l07758"></a><span class="lineno"> 7758</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l07759"></a><span class="lineno"> 7759</span>&#160;        VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l07760"></a><span class="lineno"> 7760</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l07761"></a><span class="lineno"> 7761</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
+<div class="line"><a name="l07762"></a><span class="lineno"> 7762</span>&#160; </div>
+<div class="line"><a name="l07763"></a><span class="lineno"> 7763</span>&#160;    <span class="comment">// Main deallocation function.</span></div>
+<div class="line"><a name="l07764"></a><span class="lineno"> 7764</span>&#160;    <span class="keywordtype">void</span> FreeMemory(</div>
+<div class="line"><a name="l07765"></a><span class="lineno"> 7765</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l07766"></a><span class="lineno"> 7766</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
+<div class="line"><a name="l07767"></a><span class="lineno"> 7767</span>&#160; </div>
+<div class="line"><a name="l07768"></a><span class="lineno"> 7768</span>&#160;    VkResult ResizeAllocation(</div>
+<div class="line"><a name="l07769"></a><span class="lineno"> 7769</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc,</div>
+<div class="line"><a name="l07770"></a><span class="lineno"> 7770</span>&#160;        VkDeviceSize newSize);</div>
+<div class="line"><a name="l07771"></a><span class="lineno"> 7771</span>&#160; </div>
+<div class="line"><a name="l07772"></a><span class="lineno"> 7772</span>&#160;    <span class="keywordtype">void</span> CalculateStats(<a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats);</div>
+<div class="line"><a name="l07773"></a><span class="lineno"> 7773</span>&#160; </div>
+<div class="line"><a name="l07774"></a><span class="lineno"> 7774</span>&#160;    <span class="keywordtype">void</span> GetBudget(</div>
+<div class="line"><a name="l07775"></a><span class="lineno"> 7775</span>&#160;        <a class="code" href="struct_vma_budget.html">VmaBudget</a>* outBudget, uint32_t firstHeap, uint32_t heapCount);</div>
+<div class="line"><a name="l07776"></a><span class="lineno"> 7776</span>&#160; </div>
+<div class="line"><a name="l07777"></a><span class="lineno"> 7777</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l07778"></a><span class="lineno"> 7778</span>&#160;    <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json);</div>
+<div class="line"><a name="l07779"></a><span class="lineno"> 7779</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l07780"></a><span class="lineno"> 7780</span>&#160; </div>
+<div class="line"><a name="l07781"></a><span class="lineno"> 7781</span>&#160;    VkResult DefragmentationBegin(</div>
+<div class="line"><a name="l07782"></a><span class="lineno"> 7782</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>&amp; info,</div>
+<div class="line"><a name="l07783"></a><span class="lineno"> 7783</span>&#160;        <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats,</div>
+<div class="line"><a name="l07784"></a><span class="lineno"> 7784</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a>* pContext);</div>
+<div class="line"><a name="l07785"></a><span class="lineno"> 7785</span>&#160;    VkResult DefragmentationEnd(</div>
+<div class="line"><a name="l07786"></a><span class="lineno"> 7786</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context);</div>
+<div class="line"><a name="l07787"></a><span class="lineno"> 7787</span>&#160; </div>
+<div class="line"><a name="l07788"></a><span class="lineno"> 7788</span>&#160;    VkResult DefragmentationPassBegin(</div>
+<div class="line"><a name="l07789"></a><span class="lineno"> 7789</span>&#160;        <a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* pInfo,</div>
+<div class="line"><a name="l07790"></a><span class="lineno"> 7790</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context);</div>
+<div class="line"><a name="l07791"></a><span class="lineno"> 7791</span>&#160;    VkResult DefragmentationPassEnd(</div>
+<div class="line"><a name="l07792"></a><span class="lineno"> 7792</span>&#160;        <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context);</div>
 <div class="line"><a name="l07793"></a><span class="lineno"> 7793</span>&#160; </div>
-<div class="line"><a name="l07794"></a><span class="lineno"> 7794</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l07795"></a><span class="lineno"> 7795</span>&#160;    VmaVector&lt; char, VmaStlAllocator&lt;char&gt; &gt; m_Data;</div>
-<div class="line"><a name="l07796"></a><span class="lineno"> 7796</span>&#160;};</div>
-<div class="line"><a name="l07797"></a><span class="lineno"> 7797</span>&#160; </div>
-<div class="line"><a name="l07798"></a><span class="lineno"> 7798</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::Add(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
-<div class="line"><a name="l07799"></a><span class="lineno"> 7799</span>&#160;{</div>
-<div class="line"><a name="l07800"></a><span class="lineno"> 7800</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> strLen = strlen(pStr);</div>
-<div class="line"><a name="l07801"></a><span class="lineno"> 7801</span>&#160;    <span class="keywordflow">if</span>(strLen &gt; 0)</div>
-<div class="line"><a name="l07802"></a><span class="lineno"> 7802</span>&#160;    {</div>
-<div class="line"><a name="l07803"></a><span class="lineno"> 7803</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> oldCount = m_Data.size();</div>
-<div class="line"><a name="l07804"></a><span class="lineno"> 7804</span>&#160;        m_Data.resize(oldCount + strLen);</div>
-<div class="line"><a name="l07805"></a><span class="lineno"> 7805</span>&#160;        memcpy(m_Data.data() + oldCount, pStr, strLen);</div>
-<div class="line"><a name="l07806"></a><span class="lineno"> 7806</span>&#160;    }</div>
-<div class="line"><a name="l07807"></a><span class="lineno"> 7807</span>&#160;}</div>
-<div class="line"><a name="l07808"></a><span class="lineno"> 7808</span>&#160; </div>
-<div class="line"><a name="l07809"></a><span class="lineno"> 7809</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::AddNumber(uint32_t num)</div>
-<div class="line"><a name="l07810"></a><span class="lineno"> 7810</span>&#160;{</div>
-<div class="line"><a name="l07811"></a><span class="lineno"> 7811</span>&#160;    <span class="keywordtype">char</span> buf[11];</div>
-<div class="line"><a name="l07812"></a><span class="lineno"> 7812</span>&#160;    buf[10] = <span class="charliteral">&#39;\0&#39;</span>;</div>
-<div class="line"><a name="l07813"></a><span class="lineno"> 7813</span>&#160;    <span class="keywordtype">char</span> *p = &amp;buf[10];</div>
-<div class="line"><a name="l07814"></a><span class="lineno"> 7814</span>&#160;    <span class="keywordflow">do</span></div>
-<div class="line"><a name="l07815"></a><span class="lineno"> 7815</span>&#160;    {</div>
-<div class="line"><a name="l07816"></a><span class="lineno"> 7816</span>&#160;        *--p = <span class="charliteral">&#39;0&#39;</span> + (num % 10);</div>
-<div class="line"><a name="l07817"></a><span class="lineno"> 7817</span>&#160;        num /= 10;</div>
-<div class="line"><a name="l07818"></a><span class="lineno"> 7818</span>&#160;    }</div>
-<div class="line"><a name="l07819"></a><span class="lineno"> 7819</span>&#160;    <span class="keywordflow">while</span>(num);</div>
-<div class="line"><a name="l07820"></a><span class="lineno"> 7820</span>&#160;    Add(p);</div>
-<div class="line"><a name="l07821"></a><span class="lineno"> 7821</span>&#160;}</div>
-<div class="line"><a name="l07822"></a><span class="lineno"> 7822</span>&#160; </div>
-<div class="line"><a name="l07823"></a><span class="lineno"> 7823</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::AddNumber(uint64_t num)</div>
-<div class="line"><a name="l07824"></a><span class="lineno"> 7824</span>&#160;{</div>
-<div class="line"><a name="l07825"></a><span class="lineno"> 7825</span>&#160;    <span class="keywordtype">char</span> buf[21];</div>
-<div class="line"><a name="l07826"></a><span class="lineno"> 7826</span>&#160;    buf[20] = <span class="charliteral">&#39;\0&#39;</span>;</div>
-<div class="line"><a name="l07827"></a><span class="lineno"> 7827</span>&#160;    <span class="keywordtype">char</span> *p = &amp;buf[20];</div>
-<div class="line"><a name="l07828"></a><span class="lineno"> 7828</span>&#160;    <span class="keywordflow">do</span></div>
-<div class="line"><a name="l07829"></a><span class="lineno"> 7829</span>&#160;    {</div>
-<div class="line"><a name="l07830"></a><span class="lineno"> 7830</span>&#160;        *--p = <span class="charliteral">&#39;0&#39;</span> + (num % 10);</div>
-<div class="line"><a name="l07831"></a><span class="lineno"> 7831</span>&#160;        num /= 10;</div>
-<div class="line"><a name="l07832"></a><span class="lineno"> 7832</span>&#160;    }</div>
-<div class="line"><a name="l07833"></a><span class="lineno"> 7833</span>&#160;    <span class="keywordflow">while</span>(num);</div>
-<div class="line"><a name="l07834"></a><span class="lineno"> 7834</span>&#160;    Add(p);</div>
-<div class="line"><a name="l07835"></a><span class="lineno"> 7835</span>&#160;}</div>
-<div class="line"><a name="l07836"></a><span class="lineno"> 7836</span>&#160; </div>
-<div class="line"><a name="l07837"></a><span class="lineno"> 7837</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::AddPointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr)</div>
-<div class="line"><a name="l07838"></a><span class="lineno"> 7838</span>&#160;{</div>
-<div class="line"><a name="l07839"></a><span class="lineno"> 7839</span>&#160;    <span class="keywordtype">char</span> buf[21];</div>
-<div class="line"><a name="l07840"></a><span class="lineno"> 7840</span>&#160;    VmaPtrToStr(buf, <span class="keyword">sizeof</span>(buf), ptr);</div>
-<div class="line"><a name="l07841"></a><span class="lineno"> 7841</span>&#160;    Add(buf);</div>
-<div class="line"><a name="l07842"></a><span class="lineno"> 7842</span>&#160;}</div>
-<div class="line"><a name="l07843"></a><span class="lineno"> 7843</span>&#160; </div>
-<div class="line"><a name="l07844"></a><span class="lineno"> 7844</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l07845"></a><span class="lineno"> 7845</span>&#160; </div>
-<div class="line"><a name="l07847"></a><span class="lineno"> 7847</span>&#160;<span class="comment">// VmaJsonWriter</span></div>
-<div class="line"><a name="l07848"></a><span class="lineno"> 7848</span>&#160; </div>
-<div class="line"><a name="l07849"></a><span class="lineno"> 7849</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l07850"></a><span class="lineno"> 7850</span>&#160; </div>
-<div class="line"><a name="l07851"></a><span class="lineno"> 7851</span>&#160;<span class="keyword">class </span>VmaJsonWriter</div>
-<div class="line"><a name="l07852"></a><span class="lineno"> 7852</span>&#160;{</div>
-<div class="line"><a name="l07853"></a><span class="lineno"> 7853</span>&#160;    VMA_CLASS_NO_COPY(VmaJsonWriter)</div>
-<div class="line"><a name="l07854"></a><span class="lineno"> 7854</span>&#160;<span class="keyword">public</span>:</div>
-<div class="line"><a name="l07855"></a><span class="lineno"> 7855</span>&#160;    VmaJsonWriter(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder&amp; sb);</div>
-<div class="line"><a name="l07856"></a><span class="lineno"> 7856</span>&#160;    ~VmaJsonWriter();</div>
-<div class="line"><a name="l07857"></a><span class="lineno"> 7857</span>&#160; </div>
-<div class="line"><a name="l07858"></a><span class="lineno"> 7858</span>&#160;    <span class="keywordtype">void</span> BeginObject(<span class="keywordtype">bool</span> singleLine = <span class="keyword">false</span>);</div>
-<div class="line"><a name="l07859"></a><span class="lineno"> 7859</span>&#160;    <span class="keywordtype">void</span> EndObject();</div>
-<div class="line"><a name="l07860"></a><span class="lineno"> 7860</span>&#160;    </div>
-<div class="line"><a name="l07861"></a><span class="lineno"> 7861</span>&#160;    <span class="keywordtype">void</span> BeginArray(<span class="keywordtype">bool</span> singleLine = <span class="keyword">false</span>);</div>
-<div class="line"><a name="l07862"></a><span class="lineno"> 7862</span>&#160;    <span class="keywordtype">void</span> EndArray();</div>
-<div class="line"><a name="l07863"></a><span class="lineno"> 7863</span>&#160;    </div>
-<div class="line"><a name="l07864"></a><span class="lineno"> 7864</span>&#160;    <span class="keywordtype">void</span> WriteString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr);</div>
-<div class="line"><a name="l07865"></a><span class="lineno"> 7865</span>&#160;    <span class="keywordtype">void</span> BeginString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr = VMA_NULL);</div>
-<div class="line"><a name="l07866"></a><span class="lineno"> 7866</span>&#160;    <span class="keywordtype">void</span> ContinueString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr);</div>
-<div class="line"><a name="l07867"></a><span class="lineno"> 7867</span>&#160;    <span class="keywordtype">void</span> ContinueString(uint32_t n);</div>
-<div class="line"><a name="l07868"></a><span class="lineno"> 7868</span>&#160;    <span class="keywordtype">void</span> ContinueString(uint64_t n);</div>
-<div class="line"><a name="l07869"></a><span class="lineno"> 7869</span>&#160;    <span class="keywordtype">void</span> ContinueString_Pointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr);</div>
-<div class="line"><a name="l07870"></a><span class="lineno"> 7870</span>&#160;    <span class="keywordtype">void</span> EndString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr = VMA_NULL);</div>
-<div class="line"><a name="l07871"></a><span class="lineno"> 7871</span>&#160;    </div>
-<div class="line"><a name="l07872"></a><span class="lineno"> 7872</span>&#160;    <span class="keywordtype">void</span> WriteNumber(uint32_t n);</div>
-<div class="line"><a name="l07873"></a><span class="lineno"> 7873</span>&#160;    <span class="keywordtype">void</span> WriteNumber(uint64_t n);</div>
-<div class="line"><a name="l07874"></a><span class="lineno"> 7874</span>&#160;    <span class="keywordtype">void</span> WriteBool(<span class="keywordtype">bool</span> b);</div>
-<div class="line"><a name="l07875"></a><span class="lineno"> 7875</span>&#160;    <span class="keywordtype">void</span> WriteNull();</div>
-<div class="line"><a name="l07876"></a><span class="lineno"> 7876</span>&#160; </div>
-<div class="line"><a name="l07877"></a><span class="lineno"> 7877</span>&#160;<span class="keyword">private</span>:</div>
-<div class="line"><a name="l07878"></a><span class="lineno"> 7878</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> INDENT;</div>
-<div class="line"><a name="l07879"></a><span class="lineno"> 7879</span>&#160; </div>
-<div class="line"><a name="l07880"></a><span class="lineno"> 7880</span>&#160;    <span class="keyword">enum</span> COLLECTION_TYPE</div>
-<div class="line"><a name="l07881"></a><span class="lineno"> 7881</span>&#160;    {</div>
-<div class="line"><a name="l07882"></a><span class="lineno"> 7882</span>&#160;        COLLECTION_TYPE_OBJECT,</div>
-<div class="line"><a name="l07883"></a><span class="lineno"> 7883</span>&#160;        COLLECTION_TYPE_ARRAY,</div>
-<div class="line"><a name="l07884"></a><span class="lineno"> 7884</span>&#160;    };</div>
-<div class="line"><a name="l07885"></a><span class="lineno"> 7885</span>&#160;    <span class="keyword">struct </span>StackItem</div>
-<div class="line"><a name="l07886"></a><span class="lineno"> 7886</span>&#160;    {</div>
-<div class="line"><a name="l07887"></a><span class="lineno"> 7887</span>&#160;        COLLECTION_TYPE type;</div>
-<div class="line"><a name="l07888"></a><span class="lineno"> 7888</span>&#160;        uint32_t valueCount;</div>
-<div class="line"><a name="l07889"></a><span class="lineno"> 7889</span>&#160;        <span class="keywordtype">bool</span> singleLineMode;</div>
-<div class="line"><a name="l07890"></a><span class="lineno"> 7890</span>&#160;    };</div>
-<div class="line"><a name="l07891"></a><span class="lineno"> 7891</span>&#160; </div>
-<div class="line"><a name="l07892"></a><span class="lineno"> 7892</span>&#160;    VmaStringBuilder&amp; m_SB;</div>
-<div class="line"><a name="l07893"></a><span class="lineno"> 7893</span>&#160;    VmaVector&lt; StackItem, VmaStlAllocator&lt;StackItem&gt; &gt; m_Stack;</div>
-<div class="line"><a name="l07894"></a><span class="lineno"> 7894</span>&#160;    <span class="keywordtype">bool</span> m_InsideString;</div>
+<div class="line"><a name="l07794"></a><span class="lineno"> 7794</span>&#160;    <span class="keywordtype">void</span> GetAllocationInfo(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo);</div>
+<div class="line"><a name="l07795"></a><span class="lineno"> 7795</span>&#160;    <span class="keywordtype">bool</span> TouchAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
+<div class="line"><a name="l07796"></a><span class="lineno"> 7796</span>&#160; </div>
+<div class="line"><a name="l07797"></a><span class="lineno"> 7797</span>&#160;    VkResult CreatePool(<span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>* pCreateInfo, <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPool);</div>
+<div class="line"><a name="l07798"></a><span class="lineno"> 7798</span>&#160;    <span class="keywordtype">void</span> DestroyPool(<a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
+<div class="line"><a name="l07799"></a><span class="lineno"> 7799</span>&#160;    <span class="keywordtype">void</span> GetPoolStats(<a class="code" href="struct_vma_pool.html">VmaPool</a> pool, <a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pPoolStats);</div>
+<div class="line"><a name="l07800"></a><span class="lineno"> 7800</span>&#160; </div>
+<div class="line"><a name="l07801"></a><span class="lineno"> 7801</span>&#160;    <span class="keywordtype">void</span> SetCurrentFrameIndex(uint32_t frameIndex);</div>
+<div class="line"><a name="l07802"></a><span class="lineno"> 7802</span>&#160;    uint32_t GetCurrentFrameIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_CurrentFrameIndex.load(); }</div>
+<div class="line"><a name="l07803"></a><span class="lineno"> 7803</span>&#160; </div>
+<div class="line"><a name="l07804"></a><span class="lineno"> 7804</span>&#160;    <span class="keywordtype">void</span> MakePoolAllocationsLost(</div>
+<div class="line"><a name="l07805"></a><span class="lineno"> 7805</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> hPool,</div>
+<div class="line"><a name="l07806"></a><span class="lineno"> 7806</span>&#160;        <span class="keywordtype">size_t</span>* pLostAllocationCount);</div>
+<div class="line"><a name="l07807"></a><span class="lineno"> 7807</span>&#160;    VkResult CheckPoolCorruption(<a class="code" href="struct_vma_pool.html">VmaPool</a> hPool);</div>
+<div class="line"><a name="l07808"></a><span class="lineno"> 7808</span>&#160;    VkResult CheckCorruption(uint32_t memoryTypeBits);</div>
+<div class="line"><a name="l07809"></a><span class="lineno"> 7809</span>&#160; </div>
+<div class="line"><a name="l07810"></a><span class="lineno"> 7810</span>&#160;    <span class="keywordtype">void</span> CreateLostAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
+<div class="line"><a name="l07811"></a><span class="lineno"> 7811</span>&#160; </div>
+<div class="line"><a name="l07812"></a><span class="lineno"> 7812</span>&#160;    <span class="comment">// Call to Vulkan function vkAllocateMemory with accompanying bookkeeping.</span></div>
+<div class="line"><a name="l07813"></a><span class="lineno"> 7813</span>&#160;    VkResult AllocateVulkanMemory(<span class="keyword">const</span> VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory);</div>
+<div class="line"><a name="l07814"></a><span class="lineno"> 7814</span>&#160;    <span class="comment">// Call to Vulkan function vkFreeMemory with accompanying bookkeeping.</span></div>
+<div class="line"><a name="l07815"></a><span class="lineno"> 7815</span>&#160;    <span class="keywordtype">void</span> FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, VkDeviceMemory hMemory);</div>
+<div class="line"><a name="l07816"></a><span class="lineno"> 7816</span>&#160;    <span class="comment">// Call to Vulkan function vkBindBufferMemory or vkBindBufferMemory2KHR.</span></div>
+<div class="line"><a name="l07817"></a><span class="lineno"> 7817</span>&#160;    VkResult BindVulkanBuffer(</div>
+<div class="line"><a name="l07818"></a><span class="lineno"> 7818</span>&#160;        VkDeviceMemory memory,</div>
+<div class="line"><a name="l07819"></a><span class="lineno"> 7819</span>&#160;        VkDeviceSize memoryOffset,</div>
+<div class="line"><a name="l07820"></a><span class="lineno"> 7820</span>&#160;        VkBuffer buffer,</div>
+<div class="line"><a name="l07821"></a><span class="lineno"> 7821</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
+<div class="line"><a name="l07822"></a><span class="lineno"> 7822</span>&#160;    <span class="comment">// Call to Vulkan function vkBindImageMemory or vkBindImageMemory2KHR.</span></div>
+<div class="line"><a name="l07823"></a><span class="lineno"> 7823</span>&#160;    VkResult BindVulkanImage(</div>
+<div class="line"><a name="l07824"></a><span class="lineno"> 7824</span>&#160;        VkDeviceMemory memory,</div>
+<div class="line"><a name="l07825"></a><span class="lineno"> 7825</span>&#160;        VkDeviceSize memoryOffset,</div>
+<div class="line"><a name="l07826"></a><span class="lineno"> 7826</span>&#160;        VkImage image,</div>
+<div class="line"><a name="l07827"></a><span class="lineno"> 7827</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
+<div class="line"><a name="l07828"></a><span class="lineno"> 7828</span>&#160; </div>
+<div class="line"><a name="l07829"></a><span class="lineno"> 7829</span>&#160;    VkResult Map(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, <span class="keywordtype">void</span>** ppData);</div>
+<div class="line"><a name="l07830"></a><span class="lineno"> 7830</span>&#160;    <span class="keywordtype">void</span> Unmap(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
+<div class="line"><a name="l07831"></a><span class="lineno"> 7831</span>&#160; </div>
+<div class="line"><a name="l07832"></a><span class="lineno"> 7832</span>&#160;    VkResult BindBufferMemory(</div>
+<div class="line"><a name="l07833"></a><span class="lineno"> 7833</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
+<div class="line"><a name="l07834"></a><span class="lineno"> 7834</span>&#160;        VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l07835"></a><span class="lineno"> 7835</span>&#160;        VkBuffer hBuffer,</div>
+<div class="line"><a name="l07836"></a><span class="lineno"> 7836</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
+<div class="line"><a name="l07837"></a><span class="lineno"> 7837</span>&#160;    VkResult BindImageMemory(</div>
+<div class="line"><a name="l07838"></a><span class="lineno"> 7838</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
+<div class="line"><a name="l07839"></a><span class="lineno"> 7839</span>&#160;        VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l07840"></a><span class="lineno"> 7840</span>&#160;        VkImage hImage,</div>
+<div class="line"><a name="l07841"></a><span class="lineno"> 7841</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
+<div class="line"><a name="l07842"></a><span class="lineno"> 7842</span>&#160; </div>
+<div class="line"><a name="l07843"></a><span class="lineno"> 7843</span>&#160;    VkResult FlushOrInvalidateAllocation(</div>
+<div class="line"><a name="l07844"></a><span class="lineno"> 7844</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
+<div class="line"><a name="l07845"></a><span class="lineno"> 7845</span>&#160;        VkDeviceSize offset, VkDeviceSize size,</div>
+<div class="line"><a name="l07846"></a><span class="lineno"> 7846</span>&#160;        VMA_CACHE_OPERATION op);</div>
+<div class="line"><a name="l07847"></a><span class="lineno"> 7847</span>&#160;    VkResult FlushOrInvalidateAllocations(</div>
+<div class="line"><a name="l07848"></a><span class="lineno"> 7848</span>&#160;        uint32_t allocationCount,</div>
+<div class="line"><a name="l07849"></a><span class="lineno"> 7849</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* allocations,</div>
+<div class="line"><a name="l07850"></a><span class="lineno"> 7850</span>&#160;        <span class="keyword">const</span> VkDeviceSize* offsets, <span class="keyword">const</span> VkDeviceSize* sizes,</div>
+<div class="line"><a name="l07851"></a><span class="lineno"> 7851</span>&#160;        VMA_CACHE_OPERATION op);</div>
+<div class="line"><a name="l07852"></a><span class="lineno"> 7852</span>&#160; </div>
+<div class="line"><a name="l07853"></a><span class="lineno"> 7853</span>&#160;    <span class="keywordtype">void</span> FillAllocation(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, uint8_t pattern);</div>
+<div class="line"><a name="l07854"></a><span class="lineno"> 7854</span>&#160; </div>
+<div class="line"><a name="l07855"></a><span class="lineno"> 7855</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l07856"></a><span class="lineno"> 7856</span>&#160;<span class="comment">    Returns bit mask of memory types that can support defragmentation on GPU as</span></div>
+<div class="line"><a name="l07857"></a><span class="lineno"> 7857</span>&#160;<span class="comment">    they support creation of required buffer for copy operations.</span></div>
+<div class="line"><a name="l07858"></a><span class="lineno"> 7858</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l07859"></a><span class="lineno"> 7859</span>&#160;    uint32_t GetGpuDefragmentationMemoryTypeBits();</div>
+<div class="line"><a name="l07860"></a><span class="lineno"> 7860</span>&#160; </div>
+<div class="line"><a name="l07861"></a><span class="lineno"> 7861</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l07862"></a><span class="lineno"> 7862</span>&#160;    VkDeviceSize m_PreferredLargeHeapBlockSize;</div>
+<div class="line"><a name="l07863"></a><span class="lineno"> 7863</span>&#160; </div>
+<div class="line"><a name="l07864"></a><span class="lineno"> 7864</span>&#160;    VkPhysicalDevice m_PhysicalDevice;</div>
+<div class="line"><a name="l07865"></a><span class="lineno"> 7865</span>&#160;    VMA_ATOMIC_UINT32 m_CurrentFrameIndex;</div>
+<div class="line"><a name="l07866"></a><span class="lineno"> 7866</span>&#160;    VMA_ATOMIC_UINT32 m_GpuDefragmentationMemoryTypeBits; <span class="comment">// UINT32_MAX means uninitialized.</span></div>
+<div class="line"><a name="l07867"></a><span class="lineno"> 7867</span>&#160;    </div>
+<div class="line"><a name="l07868"></a><span class="lineno"> 7868</span>&#160;    VMA_RW_MUTEX m_PoolsMutex;</div>
+<div class="line"><a name="l07869"></a><span class="lineno"> 7869</span>&#160;    <span class="comment">// Protected by m_PoolsMutex. Sorted by pointer value.</span></div>
+<div class="line"><a name="l07870"></a><span class="lineno"> 7870</span>&#160;    VmaVector&lt;VmaPool, VmaStlAllocator&lt;VmaPool&gt; &gt; m_Pools;</div>
+<div class="line"><a name="l07871"></a><span class="lineno"> 7871</span>&#160;    uint32_t m_NextPoolId;</div>
+<div class="line"><a name="l07872"></a><span class="lineno"> 7872</span>&#160; </div>
+<div class="line"><a name="l07873"></a><span class="lineno"> 7873</span>&#160;    <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a> m_VulkanFunctions;</div>
+<div class="line"><a name="l07874"></a><span class="lineno"> 7874</span>&#160; </div>
+<div class="line"><a name="l07875"></a><span class="lineno"> 7875</span>&#160;    <span class="comment">// Global bit mask AND-ed with any memoryTypeBits to disallow certain memory types.</span></div>
+<div class="line"><a name="l07876"></a><span class="lineno"> 7876</span>&#160;    uint32_t m_GlobalMemoryTypeBits;</div>
+<div class="line"><a name="l07877"></a><span class="lineno"> 7877</span>&#160; </div>
+<div class="line"><a name="l07878"></a><span class="lineno"> 7878</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l07879"></a><span class="lineno"> 7879</span>&#160;    VmaRecorder* m_pRecorder;</div>
+<div class="line"><a name="l07880"></a><span class="lineno"> 7880</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l07881"></a><span class="lineno"> 7881</span>&#160; </div>
+<div class="line"><a name="l07882"></a><span class="lineno"> 7882</span>&#160;    <span class="keywordtype">void</span> ImportVulkanFunctions(<span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* pVulkanFunctions);</div>
+<div class="line"><a name="l07883"></a><span class="lineno"> 7883</span>&#160; </div>
+<div class="line"><a name="l07884"></a><span class="lineno"> 7884</span>&#160;<span class="preprocessor">#if VMA_STATIC_VULKAN_FUNCTIONS == 1</span></div>
+<div class="line"><a name="l07885"></a><span class="lineno"> 7885</span>&#160;    <span class="keywordtype">void</span> ImportVulkanFunctions_Static();</div>
+<div class="line"><a name="l07886"></a><span class="lineno"> 7886</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l07887"></a><span class="lineno"> 7887</span>&#160; </div>
+<div class="line"><a name="l07888"></a><span class="lineno"> 7888</span>&#160;    <span class="keywordtype">void</span> ImportVulkanFunctions_Custom(<span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* pVulkanFunctions);</div>
+<div class="line"><a name="l07889"></a><span class="lineno"> 7889</span>&#160; </div>
+<div class="line"><a name="l07890"></a><span class="lineno"> 7890</span>&#160;<span class="preprocessor">#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1</span></div>
+<div class="line"><a name="l07891"></a><span class="lineno"> 7891</span>&#160;    <span class="keywordtype">void</span> ImportVulkanFunctions_Dynamic();</div>
+<div class="line"><a name="l07892"></a><span class="lineno"> 7892</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l07893"></a><span class="lineno"> 7893</span>&#160; </div>
+<div class="line"><a name="l07894"></a><span class="lineno"> 7894</span>&#160;    <span class="keywordtype">void</span> ValidateVulkanFunctions();</div>
 <div class="line"><a name="l07895"></a><span class="lineno"> 7895</span>&#160; </div>
-<div class="line"><a name="l07896"></a><span class="lineno"> 7896</span>&#160;    <span class="keywordtype">void</span> BeginValue(<span class="keywordtype">bool</span> isString);</div>
-<div class="line"><a name="l07897"></a><span class="lineno"> 7897</span>&#160;    <span class="keywordtype">void</span> WriteIndent(<span class="keywordtype">bool</span> oneLess = <span class="keyword">false</span>);</div>
-<div class="line"><a name="l07898"></a><span class="lineno"> 7898</span>&#160;};</div>
-<div class="line"><a name="l07899"></a><span class="lineno"> 7899</span>&#160; </div>
-<div class="line"><a name="l07900"></a><span class="lineno"> 7900</span>&#160;<span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> VmaJsonWriter::INDENT = <span class="stringliteral">&quot;  &quot;</span>;</div>
-<div class="line"><a name="l07901"></a><span class="lineno"> 7901</span>&#160; </div>
-<div class="line"><a name="l07902"></a><span class="lineno"> 7902</span>&#160;VmaJsonWriter::VmaJsonWriter(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder&amp; sb) :</div>
-<div class="line"><a name="l07903"></a><span class="lineno"> 7903</span>&#160;    m_SB(sb),</div>
-<div class="line"><a name="l07904"></a><span class="lineno"> 7904</span>&#160;    m_Stack(VmaStlAllocator&lt;StackItem&gt;(pAllocationCallbacks)),</div>
-<div class="line"><a name="l07905"></a><span class="lineno"> 7905</span>&#160;    m_InsideString(false)</div>
-<div class="line"><a name="l07906"></a><span class="lineno"> 7906</span>&#160;{</div>
-<div class="line"><a name="l07907"></a><span class="lineno"> 7907</span>&#160;}</div>
-<div class="line"><a name="l07908"></a><span class="lineno"> 7908</span>&#160; </div>
-<div class="line"><a name="l07909"></a><span class="lineno"> 7909</span>&#160;VmaJsonWriter::~VmaJsonWriter()</div>
-<div class="line"><a name="l07910"></a><span class="lineno"> 7910</span>&#160;{</div>
-<div class="line"><a name="l07911"></a><span class="lineno"> 7911</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
-<div class="line"><a name="l07912"></a><span class="lineno"> 7912</span>&#160;    VMA_ASSERT(m_Stack.empty());</div>
-<div class="line"><a name="l07913"></a><span class="lineno"> 7913</span>&#160;}</div>
-<div class="line"><a name="l07914"></a><span class="lineno"> 7914</span>&#160; </div>
-<div class="line"><a name="l07915"></a><span class="lineno"> 7915</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::BeginObject(<span class="keywordtype">bool</span> singleLine)</div>
-<div class="line"><a name="l07916"></a><span class="lineno"> 7916</span>&#160;{</div>
-<div class="line"><a name="l07917"></a><span class="lineno"> 7917</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
-<div class="line"><a name="l07918"></a><span class="lineno"> 7918</span>&#160; </div>
-<div class="line"><a name="l07919"></a><span class="lineno"> 7919</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
-<div class="line"><a name="l07920"></a><span class="lineno"> 7920</span>&#160;    m_SB.Add(<span class="charliteral">&#39;{&#39;</span>);</div>
+<div class="line"><a name="l07896"></a><span class="lineno"> 7896</span>&#160;    VkDeviceSize CalcPreferredBlockSize(uint32_t memTypeIndex);</div>
+<div class="line"><a name="l07897"></a><span class="lineno"> 7897</span>&#160; </div>
+<div class="line"><a name="l07898"></a><span class="lineno"> 7898</span>&#160;    VkResult AllocateMemoryOfType(</div>
+<div class="line"><a name="l07899"></a><span class="lineno"> 7899</span>&#160;        VkDeviceSize size,</div>
+<div class="line"><a name="l07900"></a><span class="lineno"> 7900</span>&#160;        VkDeviceSize alignment,</div>
+<div class="line"><a name="l07901"></a><span class="lineno"> 7901</span>&#160;        <span class="keywordtype">bool</span> dedicatedAllocation,</div>
+<div class="line"><a name="l07902"></a><span class="lineno"> 7902</span>&#160;        VkBuffer dedicatedBuffer,</div>
+<div class="line"><a name="l07903"></a><span class="lineno"> 7903</span>&#160;        VkBufferUsageFlags dedicatedBufferUsage,</div>
+<div class="line"><a name="l07904"></a><span class="lineno"> 7904</span>&#160;        VkImage dedicatedImage,</div>
+<div class="line"><a name="l07905"></a><span class="lineno"> 7905</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l07906"></a><span class="lineno"> 7906</span>&#160;        uint32_t memTypeIndex,</div>
+<div class="line"><a name="l07907"></a><span class="lineno"> 7907</span>&#160;        VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l07908"></a><span class="lineno"> 7908</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l07909"></a><span class="lineno"> 7909</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
+<div class="line"><a name="l07910"></a><span class="lineno"> 7910</span>&#160; </div>
+<div class="line"><a name="l07911"></a><span class="lineno"> 7911</span>&#160;    <span class="comment">// Helper function only to be used inside AllocateDedicatedMemory.</span></div>
+<div class="line"><a name="l07912"></a><span class="lineno"> 7912</span>&#160;    VkResult AllocateDedicatedMemoryPage(</div>
+<div class="line"><a name="l07913"></a><span class="lineno"> 7913</span>&#160;        VkDeviceSize size,</div>
+<div class="line"><a name="l07914"></a><span class="lineno"> 7914</span>&#160;        VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l07915"></a><span class="lineno"> 7915</span>&#160;        uint32_t memTypeIndex,</div>
+<div class="line"><a name="l07916"></a><span class="lineno"> 7916</span>&#160;        <span class="keyword">const</span> VkMemoryAllocateInfo&amp; allocInfo,</div>
+<div class="line"><a name="l07917"></a><span class="lineno"> 7917</span>&#160;        <span class="keywordtype">bool</span> map,</div>
+<div class="line"><a name="l07918"></a><span class="lineno"> 7918</span>&#160;        <span class="keywordtype">bool</span> isUserDataString,</div>
+<div class="line"><a name="l07919"></a><span class="lineno"> 7919</span>&#160;        <span class="keywordtype">void</span>* pUserData,</div>
+<div class="line"><a name="l07920"></a><span class="lineno"> 7920</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
 <div class="line"><a name="l07921"></a><span class="lineno"> 7921</span>&#160; </div>
-<div class="line"><a name="l07922"></a><span class="lineno"> 7922</span>&#160;    StackItem item;</div>
-<div class="line"><a name="l07923"></a><span class="lineno"> 7923</span>&#160;    item.type = COLLECTION_TYPE_OBJECT;</div>
-<div class="line"><a name="l07924"></a><span class="lineno"> 7924</span>&#160;    item.valueCount = 0;</div>
-<div class="line"><a name="l07925"></a><span class="lineno"> 7925</span>&#160;    item.singleLineMode = singleLine;</div>
-<div class="line"><a name="l07926"></a><span class="lineno"> 7926</span>&#160;    m_Stack.push_back(item);</div>
-<div class="line"><a name="l07927"></a><span class="lineno"> 7927</span>&#160;}</div>
-<div class="line"><a name="l07928"></a><span class="lineno"> 7928</span>&#160; </div>
-<div class="line"><a name="l07929"></a><span class="lineno"> 7929</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::EndObject()</div>
-<div class="line"><a name="l07930"></a><span class="lineno"> 7930</span>&#160;{</div>
-<div class="line"><a name="l07931"></a><span class="lineno"> 7931</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
-<div class="line"><a name="l07932"></a><span class="lineno"> 7932</span>&#160; </div>
-<div class="line"><a name="l07933"></a><span class="lineno"> 7933</span>&#160;    WriteIndent(<span class="keyword">true</span>);</div>
-<div class="line"><a name="l07934"></a><span class="lineno"> 7934</span>&#160;    m_SB.Add(<span class="charliteral">&#39;}&#39;</span>);</div>
-<div class="line"><a name="l07935"></a><span class="lineno"> 7935</span>&#160; </div>
-<div class="line"><a name="l07936"></a><span class="lineno"> 7936</span>&#160;    VMA_ASSERT(!m_Stack.empty() &amp;&amp; m_Stack.back().type == COLLECTION_TYPE_OBJECT);</div>
-<div class="line"><a name="l07937"></a><span class="lineno"> 7937</span>&#160;    m_Stack.pop_back();</div>
-<div class="line"><a name="l07938"></a><span class="lineno"> 7938</span>&#160;}</div>
-<div class="line"><a name="l07939"></a><span class="lineno"> 7939</span>&#160; </div>
-<div class="line"><a name="l07940"></a><span class="lineno"> 7940</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::BeginArray(<span class="keywordtype">bool</span> singleLine)</div>
-<div class="line"><a name="l07941"></a><span class="lineno"> 7941</span>&#160;{</div>
-<div class="line"><a name="l07942"></a><span class="lineno"> 7942</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
-<div class="line"><a name="l07943"></a><span class="lineno"> 7943</span>&#160; </div>
-<div class="line"><a name="l07944"></a><span class="lineno"> 7944</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
-<div class="line"><a name="l07945"></a><span class="lineno"> 7945</span>&#160;    m_SB.Add(<span class="charliteral">&#39;[&#39;</span>);</div>
+<div class="line"><a name="l07922"></a><span class="lineno"> 7922</span>&#160;    <span class="comment">// Allocates and registers new VkDeviceMemory specifically for dedicated allocations.</span></div>
+<div class="line"><a name="l07923"></a><span class="lineno"> 7923</span>&#160;    VkResult AllocateDedicatedMemory(</div>
+<div class="line"><a name="l07924"></a><span class="lineno"> 7924</span>&#160;        VkDeviceSize size,</div>
+<div class="line"><a name="l07925"></a><span class="lineno"> 7925</span>&#160;        VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l07926"></a><span class="lineno"> 7926</span>&#160;        uint32_t memTypeIndex,</div>
+<div class="line"><a name="l07927"></a><span class="lineno"> 7927</span>&#160;        <span class="keywordtype">bool</span> withinBudget,</div>
+<div class="line"><a name="l07928"></a><span class="lineno"> 7928</span>&#160;        <span class="keywordtype">bool</span> map,</div>
+<div class="line"><a name="l07929"></a><span class="lineno"> 7929</span>&#160;        <span class="keywordtype">bool</span> isUserDataString,</div>
+<div class="line"><a name="l07930"></a><span class="lineno"> 7930</span>&#160;        <span class="keywordtype">void</span>* pUserData,</div>
+<div class="line"><a name="l07931"></a><span class="lineno"> 7931</span>&#160;        VkBuffer dedicatedBuffer,</div>
+<div class="line"><a name="l07932"></a><span class="lineno"> 7932</span>&#160;        VkBufferUsageFlags dedicatedBufferUsage,</div>
+<div class="line"><a name="l07933"></a><span class="lineno"> 7933</span>&#160;        VkImage dedicatedImage,</div>
+<div class="line"><a name="l07934"></a><span class="lineno"> 7934</span>&#160;        <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l07935"></a><span class="lineno"> 7935</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
+<div class="line"><a name="l07936"></a><span class="lineno"> 7936</span>&#160; </div>
+<div class="line"><a name="l07937"></a><span class="lineno"> 7937</span>&#160;    <span class="keywordtype">void</span> FreeDedicatedMemory(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
+<div class="line"><a name="l07938"></a><span class="lineno"> 7938</span>&#160; </div>
+<div class="line"><a name="l07939"></a><span class="lineno"> 7939</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l07940"></a><span class="lineno"> 7940</span>&#160;<span class="comment">    Calculates and returns bit mask of memory types that can support defragmentation</span></div>
+<div class="line"><a name="l07941"></a><span class="lineno"> 7941</span>&#160;<span class="comment">    on GPU as they support creation of required buffer for copy operations.</span></div>
+<div class="line"><a name="l07942"></a><span class="lineno"> 7942</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l07943"></a><span class="lineno"> 7943</span>&#160;    uint32_t CalculateGpuDefragmentationMemoryTypeBits() <span class="keyword">const</span>;</div>
+<div class="line"><a name="l07944"></a><span class="lineno"> 7944</span>&#160; </div>
+<div class="line"><a name="l07945"></a><span class="lineno"> 7945</span>&#160;    uint32_t CalculateGlobalMemoryTypeBits() <span class="keyword">const</span>;</div>
 <div class="line"><a name="l07946"></a><span class="lineno"> 7946</span>&#160; </div>
-<div class="line"><a name="l07947"></a><span class="lineno"> 7947</span>&#160;    StackItem item;</div>
-<div class="line"><a name="l07948"></a><span class="lineno"> 7948</span>&#160;    item.type = COLLECTION_TYPE_ARRAY;</div>
-<div class="line"><a name="l07949"></a><span class="lineno"> 7949</span>&#160;    item.valueCount = 0;</div>
-<div class="line"><a name="l07950"></a><span class="lineno"> 7950</span>&#160;    item.singleLineMode = singleLine;</div>
-<div class="line"><a name="l07951"></a><span class="lineno"> 7951</span>&#160;    m_Stack.push_back(item);</div>
-<div class="line"><a name="l07952"></a><span class="lineno"> 7952</span>&#160;}</div>
-<div class="line"><a name="l07953"></a><span class="lineno"> 7953</span>&#160; </div>
-<div class="line"><a name="l07954"></a><span class="lineno"> 7954</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::EndArray()</div>
-<div class="line"><a name="l07955"></a><span class="lineno"> 7955</span>&#160;{</div>
-<div class="line"><a name="l07956"></a><span class="lineno"> 7956</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
-<div class="line"><a name="l07957"></a><span class="lineno"> 7957</span>&#160; </div>
-<div class="line"><a name="l07958"></a><span class="lineno"> 7958</span>&#160;    WriteIndent(<span class="keyword">true</span>);</div>
-<div class="line"><a name="l07959"></a><span class="lineno"> 7959</span>&#160;    m_SB.Add(<span class="charliteral">&#39;]&#39;</span>);</div>
-<div class="line"><a name="l07960"></a><span class="lineno"> 7960</span>&#160; </div>
-<div class="line"><a name="l07961"></a><span class="lineno"> 7961</span>&#160;    VMA_ASSERT(!m_Stack.empty() &amp;&amp; m_Stack.back().type == COLLECTION_TYPE_ARRAY);</div>
-<div class="line"><a name="l07962"></a><span class="lineno"> 7962</span>&#160;    m_Stack.pop_back();</div>
+<div class="line"><a name="l07947"></a><span class="lineno"> 7947</span>&#160;    <span class="keywordtype">bool</span> GetFlushOrInvalidateRange(</div>
+<div class="line"><a name="l07948"></a><span class="lineno"> 7948</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l07949"></a><span class="lineno"> 7949</span>&#160;        VkDeviceSize offset, VkDeviceSize size,</div>
+<div class="line"><a name="l07950"></a><span class="lineno"> 7950</span>&#160;        VkMappedMemoryRange&amp; outRange) <span class="keyword">const</span>;</div>
+<div class="line"><a name="l07951"></a><span class="lineno"> 7951</span>&#160; </div>
+<div class="line"><a name="l07952"></a><span class="lineno"> 7952</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l07953"></a><span class="lineno"> 7953</span>&#160;    <span class="keywordtype">void</span> UpdateVulkanBudget();</div>
+<div class="line"><a name="l07954"></a><span class="lineno"> 7954</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l07955"></a><span class="lineno"> 7955</span>&#160;};</div>
+<div class="line"><a name="l07956"></a><span class="lineno"> 7956</span>&#160; </div>
+<div class="line"><a name="l07958"></a><span class="lineno"> 7958</span>&#160;<span class="comment">// Memory allocation #2 after VmaAllocator_T definition</span></div>
+<div class="line"><a name="l07959"></a><span class="lineno"> 7959</span>&#160; </div>
+<div class="line"><a name="l07960"></a><span class="lineno"> 7960</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span>* VmaMalloc(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">size_t</span> size, <span class="keywordtype">size_t</span> alignment)</div>
+<div class="line"><a name="l07961"></a><span class="lineno"> 7961</span>&#160;{</div>
+<div class="line"><a name="l07962"></a><span class="lineno"> 7962</span>&#160;    <span class="keywordflow">return</span> VmaMalloc(&amp;hAllocator-&gt;m_AllocationCallbacks, size, alignment);</div>
 <div class="line"><a name="l07963"></a><span class="lineno"> 7963</span>&#160;}</div>
 <div class="line"><a name="l07964"></a><span class="lineno"> 7964</span>&#160; </div>
-<div class="line"><a name="l07965"></a><span class="lineno"> 7965</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
+<div class="line"><a name="l07965"></a><span class="lineno"> 7965</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFree(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>* ptr)</div>
 <div class="line"><a name="l07966"></a><span class="lineno"> 7966</span>&#160;{</div>
-<div class="line"><a name="l07967"></a><span class="lineno"> 7967</span>&#160;    BeginString(pStr);</div>
-<div class="line"><a name="l07968"></a><span class="lineno"> 7968</span>&#160;    EndString();</div>
-<div class="line"><a name="l07969"></a><span class="lineno"> 7969</span>&#160;}</div>
-<div class="line"><a name="l07970"></a><span class="lineno"> 7970</span>&#160; </div>
-<div class="line"><a name="l07971"></a><span class="lineno"> 7971</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::BeginString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
+<div class="line"><a name="l07967"></a><span class="lineno"> 7967</span>&#160;    VmaFree(&amp;hAllocator-&gt;m_AllocationCallbacks, ptr);</div>
+<div class="line"><a name="l07968"></a><span class="lineno"> 7968</span>&#160;}</div>
+<div class="line"><a name="l07969"></a><span class="lineno"> 7969</span>&#160; </div>
+<div class="line"><a name="l07970"></a><span class="lineno"> 7970</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l07971"></a><span class="lineno"> 7971</span>&#160;<span class="keyword">static</span> T* VmaAllocate(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator)</div>
 <div class="line"><a name="l07972"></a><span class="lineno"> 7972</span>&#160;{</div>
-<div class="line"><a name="l07973"></a><span class="lineno"> 7973</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
-<div class="line"><a name="l07974"></a><span class="lineno"> 7974</span>&#160; </div>
-<div class="line"><a name="l07975"></a><span class="lineno"> 7975</span>&#160;    BeginValue(<span class="keyword">true</span>);</div>
-<div class="line"><a name="l07976"></a><span class="lineno"> 7976</span>&#160;    m_SB.Add(<span class="charliteral">&#39;&quot;&#39;</span>);</div>
-<div class="line"><a name="l07977"></a><span class="lineno"> 7977</span>&#160;    m_InsideString = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l07978"></a><span class="lineno"> 7978</span>&#160;    <span class="keywordflow">if</span>(pStr != VMA_NULL &amp;&amp; pStr[0] != <span class="charliteral">&#39;\0&#39;</span>)</div>
-<div class="line"><a name="l07979"></a><span class="lineno"> 7979</span>&#160;    {</div>
-<div class="line"><a name="l07980"></a><span class="lineno"> 7980</span>&#160;        ContinueString(pStr);</div>
-<div class="line"><a name="l07981"></a><span class="lineno"> 7981</span>&#160;    }</div>
-<div class="line"><a name="l07982"></a><span class="lineno"> 7982</span>&#160;}</div>
-<div class="line"><a name="l07983"></a><span class="lineno"> 7983</span>&#160; </div>
-<div class="line"><a name="l07984"></a><span class="lineno"> 7984</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
-<div class="line"><a name="l07985"></a><span class="lineno"> 7985</span>&#160;{</div>
-<div class="line"><a name="l07986"></a><span class="lineno"> 7986</span>&#160;    VMA_ASSERT(m_InsideString);</div>
-<div class="line"><a name="l07987"></a><span class="lineno"> 7987</span>&#160; </div>
-<div class="line"><a name="l07988"></a><span class="lineno"> 7988</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> strLen = strlen(pStr);</div>
-<div class="line"><a name="l07989"></a><span class="lineno"> 7989</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; strLen; ++i)</div>
-<div class="line"><a name="l07990"></a><span class="lineno"> 7990</span>&#160;    {</div>
-<div class="line"><a name="l07991"></a><span class="lineno"> 7991</span>&#160;        <span class="keywordtype">char</span> ch = pStr[i];</div>
-<div class="line"><a name="l07992"></a><span class="lineno"> 7992</span>&#160;        <span class="keywordflow">if</span>(ch == <span class="charliteral">&#39;\\&#39;</span>)</div>
-<div class="line"><a name="l07993"></a><span class="lineno"> 7993</span>&#160;        {</div>
-<div class="line"><a name="l07994"></a><span class="lineno"> 7994</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\\\&quot;</span>);</div>
-<div class="line"><a name="l07995"></a><span class="lineno"> 7995</span>&#160;        }</div>
-<div class="line"><a name="l07996"></a><span class="lineno"> 7996</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(ch == <span class="charliteral">&#39;&quot;&#39;</span>)</div>
-<div class="line"><a name="l07997"></a><span class="lineno"> 7997</span>&#160;        {</div>
-<div class="line"><a name="l07998"></a><span class="lineno"> 7998</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\\&quot;&quot;</span>);</div>
-<div class="line"><a name="l07999"></a><span class="lineno"> 7999</span>&#160;        }</div>
-<div class="line"><a name="l08000"></a><span class="lineno"> 8000</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(ch &gt;= 32)</div>
-<div class="line"><a name="l08001"></a><span class="lineno"> 8001</span>&#160;        {</div>
-<div class="line"><a name="l08002"></a><span class="lineno"> 8002</span>&#160;            m_SB.Add(ch);</div>
-<div class="line"><a name="l08003"></a><span class="lineno"> 8003</span>&#160;        }</div>
-<div class="line"><a name="l08004"></a><span class="lineno"> 8004</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">switch</span>(ch)</div>
-<div class="line"><a name="l08005"></a><span class="lineno"> 8005</span>&#160;        {</div>
-<div class="line"><a name="l08006"></a><span class="lineno"> 8006</span>&#160;        <span class="keywordflow">case</span> <span class="charliteral">&#39;\b&#39;</span>:</div>
-<div class="line"><a name="l08007"></a><span class="lineno"> 8007</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\b&quot;</span>);</div>
-<div class="line"><a name="l08008"></a><span class="lineno"> 8008</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l08009"></a><span class="lineno"> 8009</span>&#160;        <span class="keywordflow">case</span> <span class="charliteral">&#39;\f&#39;</span>:</div>
-<div class="line"><a name="l08010"></a><span class="lineno"> 8010</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\f&quot;</span>);</div>
-<div class="line"><a name="l08011"></a><span class="lineno"> 8011</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l08012"></a><span class="lineno"> 8012</span>&#160;        <span class="keywordflow">case</span> <span class="charliteral">&#39;\n&#39;</span>:</div>
-<div class="line"><a name="l08013"></a><span class="lineno"> 8013</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\n&quot;</span>);</div>
-<div class="line"><a name="l08014"></a><span class="lineno"> 8014</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l08015"></a><span class="lineno"> 8015</span>&#160;        <span class="keywordflow">case</span> <span class="charliteral">&#39;\r&#39;</span>:</div>
-<div class="line"><a name="l08016"></a><span class="lineno"> 8016</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\r&quot;</span>);</div>
-<div class="line"><a name="l08017"></a><span class="lineno"> 8017</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l08018"></a><span class="lineno"> 8018</span>&#160;        <span class="keywordflow">case</span> <span class="charliteral">&#39;\t&#39;</span>:</div>
-<div class="line"><a name="l08019"></a><span class="lineno"> 8019</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\t&quot;</span>);</div>
-<div class="line"><a name="l08020"></a><span class="lineno"> 8020</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l08021"></a><span class="lineno"> 8021</span>&#160;        <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l08022"></a><span class="lineno"> 8022</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Character not currently supported.&quot;</span>);</div>
-<div class="line"><a name="l08023"></a><span class="lineno"> 8023</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l08024"></a><span class="lineno"> 8024</span>&#160;        }</div>
-<div class="line"><a name="l08025"></a><span class="lineno"> 8025</span>&#160;    }</div>
-<div class="line"><a name="l08026"></a><span class="lineno"> 8026</span>&#160;}</div>
-<div class="line"><a name="l08027"></a><span class="lineno"> 8027</span>&#160; </div>
-<div class="line"><a name="l08028"></a><span class="lineno"> 8028</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString(uint32_t n)</div>
-<div class="line"><a name="l08029"></a><span class="lineno"> 8029</span>&#160;{</div>
-<div class="line"><a name="l08030"></a><span class="lineno"> 8030</span>&#160;    VMA_ASSERT(m_InsideString);</div>
-<div class="line"><a name="l08031"></a><span class="lineno"> 8031</span>&#160;    m_SB.AddNumber(n);</div>
-<div class="line"><a name="l08032"></a><span class="lineno"> 8032</span>&#160;}</div>
-<div class="line"><a name="l08033"></a><span class="lineno"> 8033</span>&#160; </div>
-<div class="line"><a name="l08034"></a><span class="lineno"> 8034</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString(uint64_t n)</div>
-<div class="line"><a name="l08035"></a><span class="lineno"> 8035</span>&#160;{</div>
-<div class="line"><a name="l08036"></a><span class="lineno"> 8036</span>&#160;    VMA_ASSERT(m_InsideString);</div>
-<div class="line"><a name="l08037"></a><span class="lineno"> 8037</span>&#160;    m_SB.AddNumber(n);</div>
-<div class="line"><a name="l08038"></a><span class="lineno"> 8038</span>&#160;}</div>
-<div class="line"><a name="l08039"></a><span class="lineno"> 8039</span>&#160; </div>
-<div class="line"><a name="l08040"></a><span class="lineno"> 8040</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString_Pointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr)</div>
-<div class="line"><a name="l08041"></a><span class="lineno"> 8041</span>&#160;{</div>
-<div class="line"><a name="l08042"></a><span class="lineno"> 8042</span>&#160;    VMA_ASSERT(m_InsideString);</div>
-<div class="line"><a name="l08043"></a><span class="lineno"> 8043</span>&#160;    m_SB.AddPointer(ptr);</div>
-<div class="line"><a name="l08044"></a><span class="lineno"> 8044</span>&#160;}</div>
-<div class="line"><a name="l08045"></a><span class="lineno"> 8045</span>&#160; </div>
-<div class="line"><a name="l08046"></a><span class="lineno"> 8046</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::EndString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
-<div class="line"><a name="l08047"></a><span class="lineno"> 8047</span>&#160;{</div>
-<div class="line"><a name="l08048"></a><span class="lineno"> 8048</span>&#160;    VMA_ASSERT(m_InsideString);</div>
-<div class="line"><a name="l08049"></a><span class="lineno"> 8049</span>&#160;    <span class="keywordflow">if</span>(pStr != VMA_NULL &amp;&amp; pStr[0] != <span class="charliteral">&#39;\0&#39;</span>)</div>
-<div class="line"><a name="l08050"></a><span class="lineno"> 8050</span>&#160;    {</div>
-<div class="line"><a name="l08051"></a><span class="lineno"> 8051</span>&#160;        ContinueString(pStr);</div>
-<div class="line"><a name="l08052"></a><span class="lineno"> 8052</span>&#160;    }</div>
-<div class="line"><a name="l08053"></a><span class="lineno"> 8053</span>&#160;    m_SB.Add(<span class="charliteral">&#39;&quot;&#39;</span>);</div>
-<div class="line"><a name="l08054"></a><span class="lineno"> 8054</span>&#160;    m_InsideString = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l08055"></a><span class="lineno"> 8055</span>&#160;}</div>
-<div class="line"><a name="l08056"></a><span class="lineno"> 8056</span>&#160; </div>
-<div class="line"><a name="l08057"></a><span class="lineno"> 8057</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteNumber(uint32_t n)</div>
-<div class="line"><a name="l08058"></a><span class="lineno"> 8058</span>&#160;{</div>
-<div class="line"><a name="l08059"></a><span class="lineno"> 8059</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
-<div class="line"><a name="l08060"></a><span class="lineno"> 8060</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
-<div class="line"><a name="l08061"></a><span class="lineno"> 8061</span>&#160;    m_SB.AddNumber(n);</div>
-<div class="line"><a name="l08062"></a><span class="lineno"> 8062</span>&#160;}</div>
-<div class="line"><a name="l08063"></a><span class="lineno"> 8063</span>&#160; </div>
-<div class="line"><a name="l08064"></a><span class="lineno"> 8064</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteNumber(uint64_t n)</div>
-<div class="line"><a name="l08065"></a><span class="lineno"> 8065</span>&#160;{</div>
-<div class="line"><a name="l08066"></a><span class="lineno"> 8066</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
-<div class="line"><a name="l08067"></a><span class="lineno"> 8067</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
-<div class="line"><a name="l08068"></a><span class="lineno"> 8068</span>&#160;    m_SB.AddNumber(n);</div>
-<div class="line"><a name="l08069"></a><span class="lineno"> 8069</span>&#160;}</div>
-<div class="line"><a name="l08070"></a><span class="lineno"> 8070</span>&#160; </div>
-<div class="line"><a name="l08071"></a><span class="lineno"> 8071</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteBool(<span class="keywordtype">bool</span> b)</div>
-<div class="line"><a name="l08072"></a><span class="lineno"> 8072</span>&#160;{</div>
-<div class="line"><a name="l08073"></a><span class="lineno"> 8073</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
-<div class="line"><a name="l08074"></a><span class="lineno"> 8074</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
-<div class="line"><a name="l08075"></a><span class="lineno"> 8075</span>&#160;    m_SB.Add(b ? <span class="stringliteral">&quot;true&quot;</span> : <span class="stringliteral">&quot;false&quot;</span>);</div>
-<div class="line"><a name="l08076"></a><span class="lineno"> 8076</span>&#160;}</div>
-<div class="line"><a name="l08077"></a><span class="lineno"> 8077</span>&#160; </div>
-<div class="line"><a name="l08078"></a><span class="lineno"> 8078</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteNull()</div>
-<div class="line"><a name="l08079"></a><span class="lineno"> 8079</span>&#160;{</div>
-<div class="line"><a name="l08080"></a><span class="lineno"> 8080</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
-<div class="line"><a name="l08081"></a><span class="lineno"> 8081</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
-<div class="line"><a name="l08082"></a><span class="lineno"> 8082</span>&#160;    m_SB.Add(<span class="stringliteral">&quot;null&quot;</span>);</div>
-<div class="line"><a name="l08083"></a><span class="lineno"> 8083</span>&#160;}</div>
-<div class="line"><a name="l08084"></a><span class="lineno"> 8084</span>&#160; </div>
-<div class="line"><a name="l08085"></a><span class="lineno"> 8085</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::BeginValue(<span class="keywordtype">bool</span> isString)</div>
-<div class="line"><a name="l08086"></a><span class="lineno"> 8086</span>&#160;{</div>
-<div class="line"><a name="l08087"></a><span class="lineno"> 8087</span>&#160;    <span class="keywordflow">if</span>(!m_Stack.empty())</div>
-<div class="line"><a name="l08088"></a><span class="lineno"> 8088</span>&#160;    {</div>
-<div class="line"><a name="l08089"></a><span class="lineno"> 8089</span>&#160;        StackItem&amp; currItem = m_Stack.back();</div>
-<div class="line"><a name="l08090"></a><span class="lineno"> 8090</span>&#160;        <span class="keywordflow">if</span>(currItem.type == COLLECTION_TYPE_OBJECT &amp;&amp;</div>
-<div class="line"><a name="l08091"></a><span class="lineno"> 8091</span>&#160;            currItem.valueCount % 2 == 0)</div>
-<div class="line"><a name="l08092"></a><span class="lineno"> 8092</span>&#160;        {</div>
-<div class="line"><a name="l08093"></a><span class="lineno"> 8093</span>&#160;            VMA_ASSERT(isString);</div>
-<div class="line"><a name="l08094"></a><span class="lineno"> 8094</span>&#160;        }</div>
-<div class="line"><a name="l08095"></a><span class="lineno"> 8095</span>&#160; </div>
-<div class="line"><a name="l08096"></a><span class="lineno"> 8096</span>&#160;        <span class="keywordflow">if</span>(currItem.type == COLLECTION_TYPE_OBJECT &amp;&amp;</div>
-<div class="line"><a name="l08097"></a><span class="lineno"> 8097</span>&#160;            currItem.valueCount % 2 != 0)</div>
-<div class="line"><a name="l08098"></a><span class="lineno"> 8098</span>&#160;        {</div>
-<div class="line"><a name="l08099"></a><span class="lineno"> 8099</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;: &quot;</span>);</div>
-<div class="line"><a name="l08100"></a><span class="lineno"> 8100</span>&#160;        }</div>
-<div class="line"><a name="l08101"></a><span class="lineno"> 8101</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(currItem.valueCount &gt; 0)</div>
-<div class="line"><a name="l08102"></a><span class="lineno"> 8102</span>&#160;        {</div>
-<div class="line"><a name="l08103"></a><span class="lineno"> 8103</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;, &quot;</span>);</div>
-<div class="line"><a name="l08104"></a><span class="lineno"> 8104</span>&#160;            WriteIndent();</div>
-<div class="line"><a name="l08105"></a><span class="lineno"> 8105</span>&#160;        }</div>
-<div class="line"><a name="l08106"></a><span class="lineno"> 8106</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08107"></a><span class="lineno"> 8107</span>&#160;        {</div>
-<div class="line"><a name="l08108"></a><span class="lineno"> 8108</span>&#160;            WriteIndent();</div>
-<div class="line"><a name="l08109"></a><span class="lineno"> 8109</span>&#160;        }</div>
-<div class="line"><a name="l08110"></a><span class="lineno"> 8110</span>&#160;        ++currItem.valueCount;</div>
-<div class="line"><a name="l08111"></a><span class="lineno"> 8111</span>&#160;    }</div>
-<div class="line"><a name="l08112"></a><span class="lineno"> 8112</span>&#160;}</div>
-<div class="line"><a name="l08113"></a><span class="lineno"> 8113</span>&#160; </div>
-<div class="line"><a name="l08114"></a><span class="lineno"> 8114</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteIndent(<span class="keywordtype">bool</span> oneLess)</div>
-<div class="line"><a name="l08115"></a><span class="lineno"> 8115</span>&#160;{</div>
-<div class="line"><a name="l08116"></a><span class="lineno"> 8116</span>&#160;    <span class="keywordflow">if</span>(!m_Stack.empty() &amp;&amp; !m_Stack.back().singleLineMode)</div>
-<div class="line"><a name="l08117"></a><span class="lineno"> 8117</span>&#160;    {</div>
-<div class="line"><a name="l08118"></a><span class="lineno"> 8118</span>&#160;        m_SB.AddNewLine();</div>
-<div class="line"><a name="l08119"></a><span class="lineno"> 8119</span>&#160;        </div>
-<div class="line"><a name="l08120"></a><span class="lineno"> 8120</span>&#160;        <span class="keywordtype">size_t</span> count = m_Stack.size();</div>
-<div class="line"><a name="l08121"></a><span class="lineno"> 8121</span>&#160;        <span class="keywordflow">if</span>(count &gt; 0 &amp;&amp; oneLess)</div>
-<div class="line"><a name="l08122"></a><span class="lineno"> 8122</span>&#160;        {</div>
-<div class="line"><a name="l08123"></a><span class="lineno"> 8123</span>&#160;            --count;</div>
-<div class="line"><a name="l08124"></a><span class="lineno"> 8124</span>&#160;        }</div>
-<div class="line"><a name="l08125"></a><span class="lineno"> 8125</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; count; ++i)</div>
-<div class="line"><a name="l08126"></a><span class="lineno"> 8126</span>&#160;        {</div>
-<div class="line"><a name="l08127"></a><span class="lineno"> 8127</span>&#160;            m_SB.Add(INDENT);</div>
-<div class="line"><a name="l08128"></a><span class="lineno"> 8128</span>&#160;        }</div>
-<div class="line"><a name="l08129"></a><span class="lineno"> 8129</span>&#160;    }</div>
-<div class="line"><a name="l08130"></a><span class="lineno"> 8130</span>&#160;}</div>
-<div class="line"><a name="l08131"></a><span class="lineno"> 8131</span>&#160; </div>
-<div class="line"><a name="l08132"></a><span class="lineno"> 8132</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l08133"></a><span class="lineno"> 8133</span>&#160; </div>
-<div class="line"><a name="l08135"></a><span class="lineno"> 8135</span>&#160; </div>
-<div class="line"><a name="l08136"></a><span class="lineno"> 8136</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::SetUserData(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>* pUserData)</div>
-<div class="line"><a name="l08137"></a><span class="lineno"> 8137</span>&#160;{</div>
-<div class="line"><a name="l08138"></a><span class="lineno"> 8138</span>&#160;    <span class="keywordflow">if</span>(IsUserDataString())</div>
-<div class="line"><a name="l08139"></a><span class="lineno"> 8139</span>&#160;    {</div>
-<div class="line"><a name="l08140"></a><span class="lineno"> 8140</span>&#160;        VMA_ASSERT(pUserData == VMA_NULL || pUserData != m_pUserData);</div>
-<div class="line"><a name="l08141"></a><span class="lineno"> 8141</span>&#160; </div>
-<div class="line"><a name="l08142"></a><span class="lineno"> 8142</span>&#160;        FreeUserDataString(hAllocator);</div>
-<div class="line"><a name="l08143"></a><span class="lineno"> 8143</span>&#160; </div>
-<div class="line"><a name="l08144"></a><span class="lineno"> 8144</span>&#160;        <span class="keywordflow">if</span>(pUserData != VMA_NULL)</div>
-<div class="line"><a name="l08145"></a><span class="lineno"> 8145</span>&#160;        {</div>
-<div class="line"><a name="l08146"></a><span class="lineno"> 8146</span>&#160;            m_pUserData = VmaCreateStringCopy(hAllocator-&gt;GetAllocationCallbacks(), (<span class="keyword">const</span> <span class="keywordtype">char</span>*)pUserData);</div>
-<div class="line"><a name="l08147"></a><span class="lineno"> 8147</span>&#160;        }</div>
-<div class="line"><a name="l08148"></a><span class="lineno"> 8148</span>&#160;    }</div>
-<div class="line"><a name="l08149"></a><span class="lineno"> 8149</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08150"></a><span class="lineno"> 8150</span>&#160;    {</div>
-<div class="line"><a name="l08151"></a><span class="lineno"> 8151</span>&#160;        m_pUserData = pUserData;</div>
-<div class="line"><a name="l08152"></a><span class="lineno"> 8152</span>&#160;    }</div>
-<div class="line"><a name="l08153"></a><span class="lineno"> 8153</span>&#160;}</div>
-<div class="line"><a name="l08154"></a><span class="lineno"> 8154</span>&#160; </div>
-<div class="line"><a name="l08155"></a><span class="lineno"> 8155</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::ChangeBlockAllocation(</div>
-<div class="line"><a name="l08156"></a><span class="lineno"> 8156</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l08157"></a><span class="lineno"> 8157</span>&#160;    VmaDeviceMemoryBlock* block,</div>
-<div class="line"><a name="l08158"></a><span class="lineno"> 8158</span>&#160;    VkDeviceSize offset)</div>
-<div class="line"><a name="l08159"></a><span class="lineno"> 8159</span>&#160;{</div>
-<div class="line"><a name="l08160"></a><span class="lineno"> 8160</span>&#160;    VMA_ASSERT(block != VMA_NULL);</div>
-<div class="line"><a name="l08161"></a><span class="lineno"> 8161</span>&#160;    VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);</div>
-<div class="line"><a name="l08162"></a><span class="lineno"> 8162</span>&#160; </div>
-<div class="line"><a name="l08163"></a><span class="lineno"> 8163</span>&#160;    <span class="comment">// Move mapping reference counter from old block to new block.</span></div>
-<div class="line"><a name="l08164"></a><span class="lineno"> 8164</span>&#160;    <span class="keywordflow">if</span>(block != m_BlockAllocation.m_Block)</div>
-<div class="line"><a name="l08165"></a><span class="lineno"> 8165</span>&#160;    {</div>
-<div class="line"><a name="l08166"></a><span class="lineno"> 8166</span>&#160;        uint32_t mapRefCount = m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP;</div>
-<div class="line"><a name="l08167"></a><span class="lineno"> 8167</span>&#160;        <span class="keywordflow">if</span>(IsPersistentMap())</div>
-<div class="line"><a name="l08168"></a><span class="lineno"> 8168</span>&#160;            ++mapRefCount;</div>
-<div class="line"><a name="l08169"></a><span class="lineno"> 8169</span>&#160;        m_BlockAllocation.m_Block-&gt;Unmap(hAllocator, mapRefCount);</div>
-<div class="line"><a name="l08170"></a><span class="lineno"> 8170</span>&#160;        block-&gt;Map(hAllocator, mapRefCount, VMA_NULL);</div>
-<div class="line"><a name="l08171"></a><span class="lineno"> 8171</span>&#160;    }</div>
-<div class="line"><a name="l08172"></a><span class="lineno"> 8172</span>&#160; </div>
-<div class="line"><a name="l08173"></a><span class="lineno"> 8173</span>&#160;    m_BlockAllocation.m_Block = block;</div>
-<div class="line"><a name="l08174"></a><span class="lineno"> 8174</span>&#160;    m_BlockAllocation.m_Offset = offset;</div>
-<div class="line"><a name="l08175"></a><span class="lineno"> 8175</span>&#160;}</div>
-<div class="line"><a name="l08176"></a><span class="lineno"> 8176</span>&#160; </div>
-<div class="line"><a name="l08177"></a><span class="lineno"> 8177</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::ChangeOffset(VkDeviceSize newOffset)</div>
-<div class="line"><a name="l08178"></a><span class="lineno"> 8178</span>&#160;{</div>
-<div class="line"><a name="l08179"></a><span class="lineno"> 8179</span>&#160;    VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);</div>
-<div class="line"><a name="l08180"></a><span class="lineno"> 8180</span>&#160;    m_BlockAllocation.m_Offset = newOffset;</div>
-<div class="line"><a name="l08181"></a><span class="lineno"> 8181</span>&#160;}</div>
-<div class="line"><a name="l08182"></a><span class="lineno"> 8182</span>&#160; </div>
-<div class="line"><a name="l08183"></a><span class="lineno"> 8183</span>&#160;VkDeviceSize VmaAllocation_T::GetOffset()<span class="keyword"> const</span></div>
-<div class="line"><a name="l08184"></a><span class="lineno"> 8184</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08185"></a><span class="lineno"> 8185</span>&#160;    <span class="keywordflow">switch</span>(m_Type)</div>
-<div class="line"><a name="l08186"></a><span class="lineno"> 8186</span>&#160;    {</div>
-<div class="line"><a name="l08187"></a><span class="lineno"> 8187</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_BLOCK:</div>
-<div class="line"><a name="l08188"></a><span class="lineno"> 8188</span>&#160;        <span class="keywordflow">return</span> m_BlockAllocation.m_Offset;</div>
-<div class="line"><a name="l08189"></a><span class="lineno"> 8189</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_DEDICATED:</div>
-<div class="line"><a name="l08190"></a><span class="lineno"> 8190</span>&#160;        <span class="keywordflow">return</span> 0;</div>
-<div class="line"><a name="l08191"></a><span class="lineno"> 8191</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l08192"></a><span class="lineno"> 8192</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l08193"></a><span class="lineno"> 8193</span>&#160;        <span class="keywordflow">return</span> 0;</div>
-<div class="line"><a name="l08194"></a><span class="lineno"> 8194</span>&#160;    }</div>
-<div class="line"><a name="l08195"></a><span class="lineno"> 8195</span>&#160;}</div>
-<div class="line"><a name="l08196"></a><span class="lineno"> 8196</span>&#160; </div>
-<div class="line"><a name="l08197"></a><span class="lineno"> 8197</span>&#160;VkDeviceMemory VmaAllocation_T::GetMemory()<span class="keyword"> const</span></div>
-<div class="line"><a name="l08198"></a><span class="lineno"> 8198</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08199"></a><span class="lineno"> 8199</span>&#160;    <span class="keywordflow">switch</span>(m_Type)</div>
-<div class="line"><a name="l08200"></a><span class="lineno"> 8200</span>&#160;    {</div>
-<div class="line"><a name="l08201"></a><span class="lineno"> 8201</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_BLOCK:</div>
-<div class="line"><a name="l08202"></a><span class="lineno"> 8202</span>&#160;        <span class="keywordflow">return</span> m_BlockAllocation.m_Block-&gt;GetDeviceMemory();</div>
-<div class="line"><a name="l08203"></a><span class="lineno"> 8203</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_DEDICATED:</div>
-<div class="line"><a name="l08204"></a><span class="lineno"> 8204</span>&#160;        <span class="keywordflow">return</span> m_DedicatedAllocation.m_hMemory;</div>
-<div class="line"><a name="l08205"></a><span class="lineno"> 8205</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l08206"></a><span class="lineno"> 8206</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l08207"></a><span class="lineno"> 8207</span>&#160;        <span class="keywordflow">return</span> VK_NULL_HANDLE;</div>
-<div class="line"><a name="l08208"></a><span class="lineno"> 8208</span>&#160;    }</div>
-<div class="line"><a name="l08209"></a><span class="lineno"> 8209</span>&#160;}</div>
-<div class="line"><a name="l08210"></a><span class="lineno"> 8210</span>&#160; </div>
-<div class="line"><a name="l08211"></a><span class="lineno"> 8211</span>&#160;<span class="keywordtype">void</span>* VmaAllocation_T::GetMappedData()<span class="keyword"> const</span></div>
-<div class="line"><a name="l08212"></a><span class="lineno"> 8212</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08213"></a><span class="lineno"> 8213</span>&#160;    <span class="keywordflow">switch</span>(m_Type)</div>
-<div class="line"><a name="l08214"></a><span class="lineno"> 8214</span>&#160;    {</div>
-<div class="line"><a name="l08215"></a><span class="lineno"> 8215</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_BLOCK:</div>
-<div class="line"><a name="l08216"></a><span class="lineno"> 8216</span>&#160;        <span class="keywordflow">if</span>(m_MapCount != 0)</div>
-<div class="line"><a name="l08217"></a><span class="lineno"> 8217</span>&#160;        {</div>
-<div class="line"><a name="l08218"></a><span class="lineno"> 8218</span>&#160;            <span class="keywordtype">void</span>* pBlockData = m_BlockAllocation.m_Block-&gt;GetMappedData();</div>
-<div class="line"><a name="l08219"></a><span class="lineno"> 8219</span>&#160;            VMA_ASSERT(pBlockData != VMA_NULL);</div>
-<div class="line"><a name="l08220"></a><span class="lineno"> 8220</span>&#160;            <span class="keywordflow">return</span> (<span class="keywordtype">char</span>*)pBlockData + m_BlockAllocation.m_Offset;</div>
-<div class="line"><a name="l08221"></a><span class="lineno"> 8221</span>&#160;        }</div>
-<div class="line"><a name="l08222"></a><span class="lineno"> 8222</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08223"></a><span class="lineno"> 8223</span>&#160;        {</div>
-<div class="line"><a name="l08224"></a><span class="lineno"> 8224</span>&#160;            <span class="keywordflow">return</span> VMA_NULL;</div>
-<div class="line"><a name="l08225"></a><span class="lineno"> 8225</span>&#160;        }</div>
-<div class="line"><a name="l08226"></a><span class="lineno"> 8226</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l08227"></a><span class="lineno"> 8227</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_DEDICATED:</div>
-<div class="line"><a name="l08228"></a><span class="lineno"> 8228</span>&#160;        VMA_ASSERT((m_DedicatedAllocation.m_pMappedData != VMA_NULL) == (m_MapCount != 0));</div>
-<div class="line"><a name="l08229"></a><span class="lineno"> 8229</span>&#160;        <span class="keywordflow">return</span> m_DedicatedAllocation.m_pMappedData;</div>
-<div class="line"><a name="l08230"></a><span class="lineno"> 8230</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l08231"></a><span class="lineno"> 8231</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l08232"></a><span class="lineno"> 8232</span>&#160;        <span class="keywordflow">return</span> VMA_NULL;</div>
-<div class="line"><a name="l08233"></a><span class="lineno"> 8233</span>&#160;    }</div>
-<div class="line"><a name="l08234"></a><span class="lineno"> 8234</span>&#160;}</div>
-<div class="line"><a name="l08235"></a><span class="lineno"> 8235</span>&#160; </div>
-<div class="line"><a name="l08236"></a><span class="lineno"> 8236</span>&#160;<span class="keywordtype">bool</span> VmaAllocation_T::CanBecomeLost()<span class="keyword"> const</span></div>
-<div class="line"><a name="l08237"></a><span class="lineno"> 8237</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08238"></a><span class="lineno"> 8238</span>&#160;    <span class="keywordflow">switch</span>(m_Type)</div>
-<div class="line"><a name="l08239"></a><span class="lineno"> 8239</span>&#160;    {</div>
-<div class="line"><a name="l08240"></a><span class="lineno"> 8240</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_BLOCK:</div>
-<div class="line"><a name="l08241"></a><span class="lineno"> 8241</span>&#160;        <span class="keywordflow">return</span> m_BlockAllocation.m_CanBecomeLost;</div>
-<div class="line"><a name="l08242"></a><span class="lineno"> 8242</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_DEDICATED:</div>
-<div class="line"><a name="l08243"></a><span class="lineno"> 8243</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l08244"></a><span class="lineno"> 8244</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l08245"></a><span class="lineno"> 8245</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l08246"></a><span class="lineno"> 8246</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l08247"></a><span class="lineno"> 8247</span>&#160;    }</div>
-<div class="line"><a name="l08248"></a><span class="lineno"> 8248</span>&#160;}</div>
-<div class="line"><a name="l08249"></a><span class="lineno"> 8249</span>&#160; </div>
-<div class="line"><a name="l08250"></a><span class="lineno"> 8250</span>&#160;<span class="keywordtype">bool</span> VmaAllocation_T::MakeLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)</div>
-<div class="line"><a name="l08251"></a><span class="lineno"> 8251</span>&#160;{</div>
-<div class="line"><a name="l08252"></a><span class="lineno"> 8252</span>&#160;    VMA_ASSERT(CanBecomeLost());</div>
-<div class="line"><a name="l08253"></a><span class="lineno"> 8253</span>&#160; </div>
-<div class="line"><a name="l08254"></a><span class="lineno"> 8254</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l08255"></a><span class="lineno"> 8255</span>&#160;<span class="comment">    Warning: This is a carefully designed algorithm.</span></div>
-<div class="line"><a name="l08256"></a><span class="lineno"> 8256</span>&#160;<span class="comment">    Do not modify unless you really know what you&#39;re doing :)</span></div>
-<div class="line"><a name="l08257"></a><span class="lineno"> 8257</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l08258"></a><span class="lineno"> 8258</span>&#160;    uint32_t localLastUseFrameIndex = GetLastUseFrameIndex();</div>
-<div class="line"><a name="l08259"></a><span class="lineno"> 8259</span>&#160;    <span class="keywordflow">for</span>(;;)</div>
-<div class="line"><a name="l08260"></a><span class="lineno"> 8260</span>&#160;    {</div>
-<div class="line"><a name="l08261"></a><span class="lineno"> 8261</span>&#160;        <span class="keywordflow">if</span>(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)</div>
-<div class="line"><a name="l08262"></a><span class="lineno"> 8262</span>&#160;        {</div>
-<div class="line"><a name="l08263"></a><span class="lineno"> 8263</span>&#160;            VMA_ASSERT(0);</div>
-<div class="line"><a name="l08264"></a><span class="lineno"> 8264</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l08265"></a><span class="lineno"> 8265</span>&#160;        }</div>
-<div class="line"><a name="l08266"></a><span class="lineno"> 8266</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(localLastUseFrameIndex + frameInUseCount &gt;= currentFrameIndex)</div>
-<div class="line"><a name="l08267"></a><span class="lineno"> 8267</span>&#160;        {</div>
-<div class="line"><a name="l08268"></a><span class="lineno"> 8268</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l08269"></a><span class="lineno"> 8269</span>&#160;        }</div>
-<div class="line"><a name="l08270"></a><span class="lineno"> 8270</span>&#160;        <span class="keywordflow">else</span> <span class="comment">// Last use time earlier than current time.</span></div>
-<div class="line"><a name="l08271"></a><span class="lineno"> 8271</span>&#160;        {</div>
-<div class="line"><a name="l08272"></a><span class="lineno"> 8272</span>&#160;            <span class="keywordflow">if</span>(CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, VMA_FRAME_INDEX_LOST))</div>
-<div class="line"><a name="l08273"></a><span class="lineno"> 8273</span>&#160;            {</div>
-<div class="line"><a name="l08274"></a><span class="lineno"> 8274</span>&#160;                <span class="comment">// Setting hAllocation.LastUseFrameIndex atomic to VMA_FRAME_INDEX_LOST is enough to mark it as LOST.</span></div>
-<div class="line"><a name="l08275"></a><span class="lineno"> 8275</span>&#160;                <span class="comment">// Calling code just needs to unregister this allocation in owning VmaDeviceMemoryBlock.</span></div>
-<div class="line"><a name="l08276"></a><span class="lineno"> 8276</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l08277"></a><span class="lineno"> 8277</span>&#160;            }</div>
-<div class="line"><a name="l08278"></a><span class="lineno"> 8278</span>&#160;        }</div>
-<div class="line"><a name="l08279"></a><span class="lineno"> 8279</span>&#160;    }</div>
-<div class="line"><a name="l08280"></a><span class="lineno"> 8280</span>&#160;}</div>
-<div class="line"><a name="l08281"></a><span class="lineno"> 8281</span>&#160; </div>
-<div class="line"><a name="l08282"></a><span class="lineno"> 8282</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l08283"></a><span class="lineno"> 8283</span>&#160; </div>
-<div class="line"><a name="l08284"></a><span class="lineno"> 8284</span>&#160;<span class="comment">// Correspond to values of enum VmaSuballocationType.</span></div>
-<div class="line"><a name="l08285"></a><span class="lineno"> 8285</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* VMA_SUBALLOCATION_TYPE_NAMES[] = {</div>
-<div class="line"><a name="l08286"></a><span class="lineno"> 8286</span>&#160;    <span class="stringliteral">&quot;FREE&quot;</span>,</div>
-<div class="line"><a name="l08287"></a><span class="lineno"> 8287</span>&#160;    <span class="stringliteral">&quot;UNKNOWN&quot;</span>,</div>
-<div class="line"><a name="l08288"></a><span class="lineno"> 8288</span>&#160;    <span class="stringliteral">&quot;BUFFER&quot;</span>,</div>
-<div class="line"><a name="l08289"></a><span class="lineno"> 8289</span>&#160;    <span class="stringliteral">&quot;IMAGE_UNKNOWN&quot;</span>,</div>
-<div class="line"><a name="l08290"></a><span class="lineno"> 8290</span>&#160;    <span class="stringliteral">&quot;IMAGE_LINEAR&quot;</span>,</div>
-<div class="line"><a name="l08291"></a><span class="lineno"> 8291</span>&#160;    <span class="stringliteral">&quot;IMAGE_OPTIMAL&quot;</span>,</div>
-<div class="line"><a name="l08292"></a><span class="lineno"> 8292</span>&#160;};</div>
-<div class="line"><a name="l08293"></a><span class="lineno"> 8293</span>&#160; </div>
-<div class="line"><a name="l08294"></a><span class="lineno"> 8294</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::PrintParameters(<span class="keyword">class</span> VmaJsonWriter&amp; json)<span class="keyword"> const</span></div>
-<div class="line"><a name="l08295"></a><span class="lineno"> 8295</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08296"></a><span class="lineno"> 8296</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Type&quot;</span>);</div>
-<div class="line"><a name="l08297"></a><span class="lineno"> 8297</span>&#160;    json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[m_SuballocationType]);</div>
+<div class="line"><a name="l07973"></a><span class="lineno"> 7973</span>&#160;    <span class="keywordflow">return</span> (T*)VmaMalloc(hAllocator, <span class="keyword">sizeof</span>(T), VMA_ALIGN_OF(T));</div>
+<div class="line"><a name="l07974"></a><span class="lineno"> 7974</span>&#160;}</div>
+<div class="line"><a name="l07975"></a><span class="lineno"> 7975</span>&#160; </div>
+<div class="line"><a name="l07976"></a><span class="lineno"> 7976</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l07977"></a><span class="lineno"> 7977</span>&#160;<span class="keyword">static</span> T* VmaAllocateArray(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">size_t</span> count)</div>
+<div class="line"><a name="l07978"></a><span class="lineno"> 7978</span>&#160;{</div>
+<div class="line"><a name="l07979"></a><span class="lineno"> 7979</span>&#160;    <span class="keywordflow">return</span> (T*)VmaMalloc(hAllocator, <span class="keyword">sizeof</span>(T) * count, VMA_ALIGN_OF(T));</div>
+<div class="line"><a name="l07980"></a><span class="lineno"> 7980</span>&#160;}</div>
+<div class="line"><a name="l07981"></a><span class="lineno"> 7981</span>&#160; </div>
+<div class="line"><a name="l07982"></a><span class="lineno"> 7982</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l07983"></a><span class="lineno"> 7983</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, T* ptr)</div>
+<div class="line"><a name="l07984"></a><span class="lineno"> 7984</span>&#160;{</div>
+<div class="line"><a name="l07985"></a><span class="lineno"> 7985</span>&#160;    <span class="keywordflow">if</span>(ptr != VMA_NULL)</div>
+<div class="line"><a name="l07986"></a><span class="lineno"> 7986</span>&#160;    {</div>
+<div class="line"><a name="l07987"></a><span class="lineno"> 7987</span>&#160;        ptr-&gt;~T();</div>
+<div class="line"><a name="l07988"></a><span class="lineno"> 7988</span>&#160;        VmaFree(hAllocator, ptr);</div>
+<div class="line"><a name="l07989"></a><span class="lineno"> 7989</span>&#160;    }</div>
+<div class="line"><a name="l07990"></a><span class="lineno"> 7990</span>&#160;}</div>
+<div class="line"><a name="l07991"></a><span class="lineno"> 7991</span>&#160; </div>
+<div class="line"><a name="l07992"></a><span class="lineno"> 7992</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
+<div class="line"><a name="l07993"></a><span class="lineno"> 7993</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete_array(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, T* ptr, <span class="keywordtype">size_t</span> count)</div>
+<div class="line"><a name="l07994"></a><span class="lineno"> 7994</span>&#160;{</div>
+<div class="line"><a name="l07995"></a><span class="lineno"> 7995</span>&#160;    <span class="keywordflow">if</span>(ptr != VMA_NULL)</div>
+<div class="line"><a name="l07996"></a><span class="lineno"> 7996</span>&#160;    {</div>
+<div class="line"><a name="l07997"></a><span class="lineno"> 7997</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = count; i--; )</div>
+<div class="line"><a name="l07998"></a><span class="lineno"> 7998</span>&#160;            ptr[i].~T();</div>
+<div class="line"><a name="l07999"></a><span class="lineno"> 7999</span>&#160;        VmaFree(hAllocator, ptr);</div>
+<div class="line"><a name="l08000"></a><span class="lineno"> 8000</span>&#160;    }</div>
+<div class="line"><a name="l08001"></a><span class="lineno"> 8001</span>&#160;}</div>
+<div class="line"><a name="l08002"></a><span class="lineno"> 8002</span>&#160; </div>
+<div class="line"><a name="l08004"></a><span class="lineno"> 8004</span>&#160;<span class="comment">// VmaStringBuilder</span></div>
+<div class="line"><a name="l08005"></a><span class="lineno"> 8005</span>&#160; </div>
+<div class="line"><a name="l08006"></a><span class="lineno"> 8006</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l08007"></a><span class="lineno"> 8007</span>&#160; </div>
+<div class="line"><a name="l08008"></a><span class="lineno"> 8008</span>&#160;<span class="keyword">class </span>VmaStringBuilder</div>
+<div class="line"><a name="l08009"></a><span class="lineno"> 8009</span>&#160;{</div>
+<div class="line"><a name="l08010"></a><span class="lineno"> 8010</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l08011"></a><span class="lineno"> 8011</span>&#160;    VmaStringBuilder(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> alloc) : m_Data(VmaStlAllocator&lt;char&gt;(alloc-&gt;GetAllocationCallbacks())) { }</div>
+<div class="line"><a name="l08012"></a><span class="lineno"> 8012</span>&#160;    <span class="keywordtype">size_t</span> GetLength()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Data.size(); }</div>
+<div class="line"><a name="l08013"></a><span class="lineno"> 8013</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* GetData()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Data.data(); }</div>
+<div class="line"><a name="l08014"></a><span class="lineno"> 8014</span>&#160; </div>
+<div class="line"><a name="l08015"></a><span class="lineno"> 8015</span>&#160;    <span class="keywordtype">void</span> Add(<span class="keywordtype">char</span> ch) { m_Data.push_back(ch); }</div>
+<div class="line"><a name="l08016"></a><span class="lineno"> 8016</span>&#160;    <span class="keywordtype">void</span> Add(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr);</div>
+<div class="line"><a name="l08017"></a><span class="lineno"> 8017</span>&#160;    <span class="keywordtype">void</span> AddNewLine() { Add(<span class="charliteral">&#39;\n&#39;</span>); }</div>
+<div class="line"><a name="l08018"></a><span class="lineno"> 8018</span>&#160;    <span class="keywordtype">void</span> AddNumber(uint32_t num);</div>
+<div class="line"><a name="l08019"></a><span class="lineno"> 8019</span>&#160;    <span class="keywordtype">void</span> AddNumber(uint64_t num);</div>
+<div class="line"><a name="l08020"></a><span class="lineno"> 8020</span>&#160;    <span class="keywordtype">void</span> AddPointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr);</div>
+<div class="line"><a name="l08021"></a><span class="lineno"> 8021</span>&#160; </div>
+<div class="line"><a name="l08022"></a><span class="lineno"> 8022</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l08023"></a><span class="lineno"> 8023</span>&#160;    VmaVector&lt; char, VmaStlAllocator&lt;char&gt; &gt; m_Data;</div>
+<div class="line"><a name="l08024"></a><span class="lineno"> 8024</span>&#160;};</div>
+<div class="line"><a name="l08025"></a><span class="lineno"> 8025</span>&#160; </div>
+<div class="line"><a name="l08026"></a><span class="lineno"> 8026</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::Add(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
+<div class="line"><a name="l08027"></a><span class="lineno"> 8027</span>&#160;{</div>
+<div class="line"><a name="l08028"></a><span class="lineno"> 8028</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> strLen = strlen(pStr);</div>
+<div class="line"><a name="l08029"></a><span class="lineno"> 8029</span>&#160;    <span class="keywordflow">if</span>(strLen &gt; 0)</div>
+<div class="line"><a name="l08030"></a><span class="lineno"> 8030</span>&#160;    {</div>
+<div class="line"><a name="l08031"></a><span class="lineno"> 8031</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> oldCount = m_Data.size();</div>
+<div class="line"><a name="l08032"></a><span class="lineno"> 8032</span>&#160;        m_Data.resize(oldCount + strLen);</div>
+<div class="line"><a name="l08033"></a><span class="lineno"> 8033</span>&#160;        memcpy(m_Data.data() + oldCount, pStr, strLen);</div>
+<div class="line"><a name="l08034"></a><span class="lineno"> 8034</span>&#160;    }</div>
+<div class="line"><a name="l08035"></a><span class="lineno"> 8035</span>&#160;}</div>
+<div class="line"><a name="l08036"></a><span class="lineno"> 8036</span>&#160; </div>
+<div class="line"><a name="l08037"></a><span class="lineno"> 8037</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::AddNumber(uint32_t num)</div>
+<div class="line"><a name="l08038"></a><span class="lineno"> 8038</span>&#160;{</div>
+<div class="line"><a name="l08039"></a><span class="lineno"> 8039</span>&#160;    <span class="keywordtype">char</span> buf[11];</div>
+<div class="line"><a name="l08040"></a><span class="lineno"> 8040</span>&#160;    buf[10] = <span class="charliteral">&#39;\0&#39;</span>;</div>
+<div class="line"><a name="l08041"></a><span class="lineno"> 8041</span>&#160;    <span class="keywordtype">char</span> *p = &amp;buf[10];</div>
+<div class="line"><a name="l08042"></a><span class="lineno"> 8042</span>&#160;    <span class="keywordflow">do</span></div>
+<div class="line"><a name="l08043"></a><span class="lineno"> 8043</span>&#160;    {</div>
+<div class="line"><a name="l08044"></a><span class="lineno"> 8044</span>&#160;        *--p = <span class="charliteral">&#39;0&#39;</span> + (num % 10);</div>
+<div class="line"><a name="l08045"></a><span class="lineno"> 8045</span>&#160;        num /= 10;</div>
+<div class="line"><a name="l08046"></a><span class="lineno"> 8046</span>&#160;    }</div>
+<div class="line"><a name="l08047"></a><span class="lineno"> 8047</span>&#160;    <span class="keywordflow">while</span>(num);</div>
+<div class="line"><a name="l08048"></a><span class="lineno"> 8048</span>&#160;    Add(p);</div>
+<div class="line"><a name="l08049"></a><span class="lineno"> 8049</span>&#160;}</div>
+<div class="line"><a name="l08050"></a><span class="lineno"> 8050</span>&#160; </div>
+<div class="line"><a name="l08051"></a><span class="lineno"> 8051</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::AddNumber(uint64_t num)</div>
+<div class="line"><a name="l08052"></a><span class="lineno"> 8052</span>&#160;{</div>
+<div class="line"><a name="l08053"></a><span class="lineno"> 8053</span>&#160;    <span class="keywordtype">char</span> buf[21];</div>
+<div class="line"><a name="l08054"></a><span class="lineno"> 8054</span>&#160;    buf[20] = <span class="charliteral">&#39;\0&#39;</span>;</div>
+<div class="line"><a name="l08055"></a><span class="lineno"> 8055</span>&#160;    <span class="keywordtype">char</span> *p = &amp;buf[20];</div>
+<div class="line"><a name="l08056"></a><span class="lineno"> 8056</span>&#160;    <span class="keywordflow">do</span></div>
+<div class="line"><a name="l08057"></a><span class="lineno"> 8057</span>&#160;    {</div>
+<div class="line"><a name="l08058"></a><span class="lineno"> 8058</span>&#160;        *--p = <span class="charliteral">&#39;0&#39;</span> + (num % 10);</div>
+<div class="line"><a name="l08059"></a><span class="lineno"> 8059</span>&#160;        num /= 10;</div>
+<div class="line"><a name="l08060"></a><span class="lineno"> 8060</span>&#160;    }</div>
+<div class="line"><a name="l08061"></a><span class="lineno"> 8061</span>&#160;    <span class="keywordflow">while</span>(num);</div>
+<div class="line"><a name="l08062"></a><span class="lineno"> 8062</span>&#160;    Add(p);</div>
+<div class="line"><a name="l08063"></a><span class="lineno"> 8063</span>&#160;}</div>
+<div class="line"><a name="l08064"></a><span class="lineno"> 8064</span>&#160; </div>
+<div class="line"><a name="l08065"></a><span class="lineno"> 8065</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::AddPointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr)</div>
+<div class="line"><a name="l08066"></a><span class="lineno"> 8066</span>&#160;{</div>
+<div class="line"><a name="l08067"></a><span class="lineno"> 8067</span>&#160;    <span class="keywordtype">char</span> buf[21];</div>
+<div class="line"><a name="l08068"></a><span class="lineno"> 8068</span>&#160;    VmaPtrToStr(buf, <span class="keyword">sizeof</span>(buf), ptr);</div>
+<div class="line"><a name="l08069"></a><span class="lineno"> 8069</span>&#160;    Add(buf);</div>
+<div class="line"><a name="l08070"></a><span class="lineno"> 8070</span>&#160;}</div>
+<div class="line"><a name="l08071"></a><span class="lineno"> 8071</span>&#160; </div>
+<div class="line"><a name="l08072"></a><span class="lineno"> 8072</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l08073"></a><span class="lineno"> 8073</span>&#160; </div>
+<div class="line"><a name="l08075"></a><span class="lineno"> 8075</span>&#160;<span class="comment">// VmaJsonWriter</span></div>
+<div class="line"><a name="l08076"></a><span class="lineno"> 8076</span>&#160; </div>
+<div class="line"><a name="l08077"></a><span class="lineno"> 8077</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l08078"></a><span class="lineno"> 8078</span>&#160; </div>
+<div class="line"><a name="l08079"></a><span class="lineno"> 8079</span>&#160;<span class="keyword">class </span>VmaJsonWriter</div>
+<div class="line"><a name="l08080"></a><span class="lineno"> 8080</span>&#160;{</div>
+<div class="line"><a name="l08081"></a><span class="lineno"> 8081</span>&#160;    VMA_CLASS_NO_COPY(VmaJsonWriter)</div>
+<div class="line"><a name="l08082"></a><span class="lineno"> 8082</span>&#160;<span class="keyword">public</span>:</div>
+<div class="line"><a name="l08083"></a><span class="lineno"> 8083</span>&#160;    VmaJsonWriter(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder&amp; sb);</div>
+<div class="line"><a name="l08084"></a><span class="lineno"> 8084</span>&#160;    ~VmaJsonWriter();</div>
+<div class="line"><a name="l08085"></a><span class="lineno"> 8085</span>&#160; </div>
+<div class="line"><a name="l08086"></a><span class="lineno"> 8086</span>&#160;    <span class="keywordtype">void</span> BeginObject(<span class="keywordtype">bool</span> singleLine = <span class="keyword">false</span>);</div>
+<div class="line"><a name="l08087"></a><span class="lineno"> 8087</span>&#160;    <span class="keywordtype">void</span> EndObject();</div>
+<div class="line"><a name="l08088"></a><span class="lineno"> 8088</span>&#160;    </div>
+<div class="line"><a name="l08089"></a><span class="lineno"> 8089</span>&#160;    <span class="keywordtype">void</span> BeginArray(<span class="keywordtype">bool</span> singleLine = <span class="keyword">false</span>);</div>
+<div class="line"><a name="l08090"></a><span class="lineno"> 8090</span>&#160;    <span class="keywordtype">void</span> EndArray();</div>
+<div class="line"><a name="l08091"></a><span class="lineno"> 8091</span>&#160;    </div>
+<div class="line"><a name="l08092"></a><span class="lineno"> 8092</span>&#160;    <span class="keywordtype">void</span> WriteString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr);</div>
+<div class="line"><a name="l08093"></a><span class="lineno"> 8093</span>&#160;    <span class="keywordtype">void</span> BeginString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr = VMA_NULL);</div>
+<div class="line"><a name="l08094"></a><span class="lineno"> 8094</span>&#160;    <span class="keywordtype">void</span> ContinueString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr);</div>
+<div class="line"><a name="l08095"></a><span class="lineno"> 8095</span>&#160;    <span class="keywordtype">void</span> ContinueString(uint32_t n);</div>
+<div class="line"><a name="l08096"></a><span class="lineno"> 8096</span>&#160;    <span class="keywordtype">void</span> ContinueString(uint64_t n);</div>
+<div class="line"><a name="l08097"></a><span class="lineno"> 8097</span>&#160;    <span class="keywordtype">void</span> ContinueString_Pointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr);</div>
+<div class="line"><a name="l08098"></a><span class="lineno"> 8098</span>&#160;    <span class="keywordtype">void</span> EndString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr = VMA_NULL);</div>
+<div class="line"><a name="l08099"></a><span class="lineno"> 8099</span>&#160;    </div>
+<div class="line"><a name="l08100"></a><span class="lineno"> 8100</span>&#160;    <span class="keywordtype">void</span> WriteNumber(uint32_t n);</div>
+<div class="line"><a name="l08101"></a><span class="lineno"> 8101</span>&#160;    <span class="keywordtype">void</span> WriteNumber(uint64_t n);</div>
+<div class="line"><a name="l08102"></a><span class="lineno"> 8102</span>&#160;    <span class="keywordtype">void</span> WriteBool(<span class="keywordtype">bool</span> b);</div>
+<div class="line"><a name="l08103"></a><span class="lineno"> 8103</span>&#160;    <span class="keywordtype">void</span> WriteNull();</div>
+<div class="line"><a name="l08104"></a><span class="lineno"> 8104</span>&#160; </div>
+<div class="line"><a name="l08105"></a><span class="lineno"> 8105</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l08106"></a><span class="lineno"> 8106</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> INDENT;</div>
+<div class="line"><a name="l08107"></a><span class="lineno"> 8107</span>&#160; </div>
+<div class="line"><a name="l08108"></a><span class="lineno"> 8108</span>&#160;    <span class="keyword">enum</span> COLLECTION_TYPE</div>
+<div class="line"><a name="l08109"></a><span class="lineno"> 8109</span>&#160;    {</div>
+<div class="line"><a name="l08110"></a><span class="lineno"> 8110</span>&#160;        COLLECTION_TYPE_OBJECT,</div>
+<div class="line"><a name="l08111"></a><span class="lineno"> 8111</span>&#160;        COLLECTION_TYPE_ARRAY,</div>
+<div class="line"><a name="l08112"></a><span class="lineno"> 8112</span>&#160;    };</div>
+<div class="line"><a name="l08113"></a><span class="lineno"> 8113</span>&#160;    <span class="keyword">struct </span>StackItem</div>
+<div class="line"><a name="l08114"></a><span class="lineno"> 8114</span>&#160;    {</div>
+<div class="line"><a name="l08115"></a><span class="lineno"> 8115</span>&#160;        COLLECTION_TYPE type;</div>
+<div class="line"><a name="l08116"></a><span class="lineno"> 8116</span>&#160;        uint32_t valueCount;</div>
+<div class="line"><a name="l08117"></a><span class="lineno"> 8117</span>&#160;        <span class="keywordtype">bool</span> singleLineMode;</div>
+<div class="line"><a name="l08118"></a><span class="lineno"> 8118</span>&#160;    };</div>
+<div class="line"><a name="l08119"></a><span class="lineno"> 8119</span>&#160; </div>
+<div class="line"><a name="l08120"></a><span class="lineno"> 8120</span>&#160;    VmaStringBuilder&amp; m_SB;</div>
+<div class="line"><a name="l08121"></a><span class="lineno"> 8121</span>&#160;    VmaVector&lt; StackItem, VmaStlAllocator&lt;StackItem&gt; &gt; m_Stack;</div>
+<div class="line"><a name="l08122"></a><span class="lineno"> 8122</span>&#160;    <span class="keywordtype">bool</span> m_InsideString;</div>
+<div class="line"><a name="l08123"></a><span class="lineno"> 8123</span>&#160; </div>
+<div class="line"><a name="l08124"></a><span class="lineno"> 8124</span>&#160;    <span class="keywordtype">void</span> BeginValue(<span class="keywordtype">bool</span> isString);</div>
+<div class="line"><a name="l08125"></a><span class="lineno"> 8125</span>&#160;    <span class="keywordtype">void</span> WriteIndent(<span class="keywordtype">bool</span> oneLess = <span class="keyword">false</span>);</div>
+<div class="line"><a name="l08126"></a><span class="lineno"> 8126</span>&#160;};</div>
+<div class="line"><a name="l08127"></a><span class="lineno"> 8127</span>&#160; </div>
+<div class="line"><a name="l08128"></a><span class="lineno"> 8128</span>&#160;<span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> VmaJsonWriter::INDENT = <span class="stringliteral">&quot;  &quot;</span>;</div>
+<div class="line"><a name="l08129"></a><span class="lineno"> 8129</span>&#160; </div>
+<div class="line"><a name="l08130"></a><span class="lineno"> 8130</span>&#160;VmaJsonWriter::VmaJsonWriter(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder&amp; sb) :</div>
+<div class="line"><a name="l08131"></a><span class="lineno"> 8131</span>&#160;    m_SB(sb),</div>
+<div class="line"><a name="l08132"></a><span class="lineno"> 8132</span>&#160;    m_Stack(VmaStlAllocator&lt;StackItem&gt;(pAllocationCallbacks)),</div>
+<div class="line"><a name="l08133"></a><span class="lineno"> 8133</span>&#160;    m_InsideString(false)</div>
+<div class="line"><a name="l08134"></a><span class="lineno"> 8134</span>&#160;{</div>
+<div class="line"><a name="l08135"></a><span class="lineno"> 8135</span>&#160;}</div>
+<div class="line"><a name="l08136"></a><span class="lineno"> 8136</span>&#160; </div>
+<div class="line"><a name="l08137"></a><span class="lineno"> 8137</span>&#160;VmaJsonWriter::~VmaJsonWriter()</div>
+<div class="line"><a name="l08138"></a><span class="lineno"> 8138</span>&#160;{</div>
+<div class="line"><a name="l08139"></a><span class="lineno"> 8139</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
+<div class="line"><a name="l08140"></a><span class="lineno"> 8140</span>&#160;    VMA_ASSERT(m_Stack.empty());</div>
+<div class="line"><a name="l08141"></a><span class="lineno"> 8141</span>&#160;}</div>
+<div class="line"><a name="l08142"></a><span class="lineno"> 8142</span>&#160; </div>
+<div class="line"><a name="l08143"></a><span class="lineno"> 8143</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::BeginObject(<span class="keywordtype">bool</span> singleLine)</div>
+<div class="line"><a name="l08144"></a><span class="lineno"> 8144</span>&#160;{</div>
+<div class="line"><a name="l08145"></a><span class="lineno"> 8145</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
+<div class="line"><a name="l08146"></a><span class="lineno"> 8146</span>&#160; </div>
+<div class="line"><a name="l08147"></a><span class="lineno"> 8147</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
+<div class="line"><a name="l08148"></a><span class="lineno"> 8148</span>&#160;    m_SB.Add(<span class="charliteral">&#39;{&#39;</span>);</div>
+<div class="line"><a name="l08149"></a><span class="lineno"> 8149</span>&#160; </div>
+<div class="line"><a name="l08150"></a><span class="lineno"> 8150</span>&#160;    StackItem item;</div>
+<div class="line"><a name="l08151"></a><span class="lineno"> 8151</span>&#160;    item.type = COLLECTION_TYPE_OBJECT;</div>
+<div class="line"><a name="l08152"></a><span class="lineno"> 8152</span>&#160;    item.valueCount = 0;</div>
+<div class="line"><a name="l08153"></a><span class="lineno"> 8153</span>&#160;    item.singleLineMode = singleLine;</div>
+<div class="line"><a name="l08154"></a><span class="lineno"> 8154</span>&#160;    m_Stack.push_back(item);</div>
+<div class="line"><a name="l08155"></a><span class="lineno"> 8155</span>&#160;}</div>
+<div class="line"><a name="l08156"></a><span class="lineno"> 8156</span>&#160; </div>
+<div class="line"><a name="l08157"></a><span class="lineno"> 8157</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::EndObject()</div>
+<div class="line"><a name="l08158"></a><span class="lineno"> 8158</span>&#160;{</div>
+<div class="line"><a name="l08159"></a><span class="lineno"> 8159</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
+<div class="line"><a name="l08160"></a><span class="lineno"> 8160</span>&#160; </div>
+<div class="line"><a name="l08161"></a><span class="lineno"> 8161</span>&#160;    WriteIndent(<span class="keyword">true</span>);</div>
+<div class="line"><a name="l08162"></a><span class="lineno"> 8162</span>&#160;    m_SB.Add(<span class="charliteral">&#39;}&#39;</span>);</div>
+<div class="line"><a name="l08163"></a><span class="lineno"> 8163</span>&#160; </div>
+<div class="line"><a name="l08164"></a><span class="lineno"> 8164</span>&#160;    VMA_ASSERT(!m_Stack.empty() &amp;&amp; m_Stack.back().type == COLLECTION_TYPE_OBJECT);</div>
+<div class="line"><a name="l08165"></a><span class="lineno"> 8165</span>&#160;    m_Stack.pop_back();</div>
+<div class="line"><a name="l08166"></a><span class="lineno"> 8166</span>&#160;}</div>
+<div class="line"><a name="l08167"></a><span class="lineno"> 8167</span>&#160; </div>
+<div class="line"><a name="l08168"></a><span class="lineno"> 8168</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::BeginArray(<span class="keywordtype">bool</span> singleLine)</div>
+<div class="line"><a name="l08169"></a><span class="lineno"> 8169</span>&#160;{</div>
+<div class="line"><a name="l08170"></a><span class="lineno"> 8170</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
+<div class="line"><a name="l08171"></a><span class="lineno"> 8171</span>&#160; </div>
+<div class="line"><a name="l08172"></a><span class="lineno"> 8172</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
+<div class="line"><a name="l08173"></a><span class="lineno"> 8173</span>&#160;    m_SB.Add(<span class="charliteral">&#39;[&#39;</span>);</div>
+<div class="line"><a name="l08174"></a><span class="lineno"> 8174</span>&#160; </div>
+<div class="line"><a name="l08175"></a><span class="lineno"> 8175</span>&#160;    StackItem item;</div>
+<div class="line"><a name="l08176"></a><span class="lineno"> 8176</span>&#160;    item.type = COLLECTION_TYPE_ARRAY;</div>
+<div class="line"><a name="l08177"></a><span class="lineno"> 8177</span>&#160;    item.valueCount = 0;</div>
+<div class="line"><a name="l08178"></a><span class="lineno"> 8178</span>&#160;    item.singleLineMode = singleLine;</div>
+<div class="line"><a name="l08179"></a><span class="lineno"> 8179</span>&#160;    m_Stack.push_back(item);</div>
+<div class="line"><a name="l08180"></a><span class="lineno"> 8180</span>&#160;}</div>
+<div class="line"><a name="l08181"></a><span class="lineno"> 8181</span>&#160; </div>
+<div class="line"><a name="l08182"></a><span class="lineno"> 8182</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::EndArray()</div>
+<div class="line"><a name="l08183"></a><span class="lineno"> 8183</span>&#160;{</div>
+<div class="line"><a name="l08184"></a><span class="lineno"> 8184</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
+<div class="line"><a name="l08185"></a><span class="lineno"> 8185</span>&#160; </div>
+<div class="line"><a name="l08186"></a><span class="lineno"> 8186</span>&#160;    WriteIndent(<span class="keyword">true</span>);</div>
+<div class="line"><a name="l08187"></a><span class="lineno"> 8187</span>&#160;    m_SB.Add(<span class="charliteral">&#39;]&#39;</span>);</div>
+<div class="line"><a name="l08188"></a><span class="lineno"> 8188</span>&#160; </div>
+<div class="line"><a name="l08189"></a><span class="lineno"> 8189</span>&#160;    VMA_ASSERT(!m_Stack.empty() &amp;&amp; m_Stack.back().type == COLLECTION_TYPE_ARRAY);</div>
+<div class="line"><a name="l08190"></a><span class="lineno"> 8190</span>&#160;    m_Stack.pop_back();</div>
+<div class="line"><a name="l08191"></a><span class="lineno"> 8191</span>&#160;}</div>
+<div class="line"><a name="l08192"></a><span class="lineno"> 8192</span>&#160; </div>
+<div class="line"><a name="l08193"></a><span class="lineno"> 8193</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
+<div class="line"><a name="l08194"></a><span class="lineno"> 8194</span>&#160;{</div>
+<div class="line"><a name="l08195"></a><span class="lineno"> 8195</span>&#160;    BeginString(pStr);</div>
+<div class="line"><a name="l08196"></a><span class="lineno"> 8196</span>&#160;    EndString();</div>
+<div class="line"><a name="l08197"></a><span class="lineno"> 8197</span>&#160;}</div>
+<div class="line"><a name="l08198"></a><span class="lineno"> 8198</span>&#160; </div>
+<div class="line"><a name="l08199"></a><span class="lineno"> 8199</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::BeginString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
+<div class="line"><a name="l08200"></a><span class="lineno"> 8200</span>&#160;{</div>
+<div class="line"><a name="l08201"></a><span class="lineno"> 8201</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
+<div class="line"><a name="l08202"></a><span class="lineno"> 8202</span>&#160; </div>
+<div class="line"><a name="l08203"></a><span class="lineno"> 8203</span>&#160;    BeginValue(<span class="keyword">true</span>);</div>
+<div class="line"><a name="l08204"></a><span class="lineno"> 8204</span>&#160;    m_SB.Add(<span class="charliteral">&#39;&quot;&#39;</span>);</div>
+<div class="line"><a name="l08205"></a><span class="lineno"> 8205</span>&#160;    m_InsideString = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l08206"></a><span class="lineno"> 8206</span>&#160;    <span class="keywordflow">if</span>(pStr != VMA_NULL &amp;&amp; pStr[0] != <span class="charliteral">&#39;\0&#39;</span>)</div>
+<div class="line"><a name="l08207"></a><span class="lineno"> 8207</span>&#160;    {</div>
+<div class="line"><a name="l08208"></a><span class="lineno"> 8208</span>&#160;        ContinueString(pStr);</div>
+<div class="line"><a name="l08209"></a><span class="lineno"> 8209</span>&#160;    }</div>
+<div class="line"><a name="l08210"></a><span class="lineno"> 8210</span>&#160;}</div>
+<div class="line"><a name="l08211"></a><span class="lineno"> 8211</span>&#160; </div>
+<div class="line"><a name="l08212"></a><span class="lineno"> 8212</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
+<div class="line"><a name="l08213"></a><span class="lineno"> 8213</span>&#160;{</div>
+<div class="line"><a name="l08214"></a><span class="lineno"> 8214</span>&#160;    VMA_ASSERT(m_InsideString);</div>
+<div class="line"><a name="l08215"></a><span class="lineno"> 8215</span>&#160; </div>
+<div class="line"><a name="l08216"></a><span class="lineno"> 8216</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> strLen = strlen(pStr);</div>
+<div class="line"><a name="l08217"></a><span class="lineno"> 8217</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; strLen; ++i)</div>
+<div class="line"><a name="l08218"></a><span class="lineno"> 8218</span>&#160;    {</div>
+<div class="line"><a name="l08219"></a><span class="lineno"> 8219</span>&#160;        <span class="keywordtype">char</span> ch = pStr[i];</div>
+<div class="line"><a name="l08220"></a><span class="lineno"> 8220</span>&#160;        <span class="keywordflow">if</span>(ch == <span class="charliteral">&#39;\\&#39;</span>)</div>
+<div class="line"><a name="l08221"></a><span class="lineno"> 8221</span>&#160;        {</div>
+<div class="line"><a name="l08222"></a><span class="lineno"> 8222</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\\\&quot;</span>);</div>
+<div class="line"><a name="l08223"></a><span class="lineno"> 8223</span>&#160;        }</div>
+<div class="line"><a name="l08224"></a><span class="lineno"> 8224</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(ch == <span class="charliteral">&#39;&quot;&#39;</span>)</div>
+<div class="line"><a name="l08225"></a><span class="lineno"> 8225</span>&#160;        {</div>
+<div class="line"><a name="l08226"></a><span class="lineno"> 8226</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\\&quot;&quot;</span>);</div>
+<div class="line"><a name="l08227"></a><span class="lineno"> 8227</span>&#160;        }</div>
+<div class="line"><a name="l08228"></a><span class="lineno"> 8228</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(ch &gt;= 32)</div>
+<div class="line"><a name="l08229"></a><span class="lineno"> 8229</span>&#160;        {</div>
+<div class="line"><a name="l08230"></a><span class="lineno"> 8230</span>&#160;            m_SB.Add(ch);</div>
+<div class="line"><a name="l08231"></a><span class="lineno"> 8231</span>&#160;        }</div>
+<div class="line"><a name="l08232"></a><span class="lineno"> 8232</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">switch</span>(ch)</div>
+<div class="line"><a name="l08233"></a><span class="lineno"> 8233</span>&#160;        {</div>
+<div class="line"><a name="l08234"></a><span class="lineno"> 8234</span>&#160;        <span class="keywordflow">case</span> <span class="charliteral">&#39;\b&#39;</span>:</div>
+<div class="line"><a name="l08235"></a><span class="lineno"> 8235</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\b&quot;</span>);</div>
+<div class="line"><a name="l08236"></a><span class="lineno"> 8236</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l08237"></a><span class="lineno"> 8237</span>&#160;        <span class="keywordflow">case</span> <span class="charliteral">&#39;\f&#39;</span>:</div>
+<div class="line"><a name="l08238"></a><span class="lineno"> 8238</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\f&quot;</span>);</div>
+<div class="line"><a name="l08239"></a><span class="lineno"> 8239</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l08240"></a><span class="lineno"> 8240</span>&#160;        <span class="keywordflow">case</span> <span class="charliteral">&#39;\n&#39;</span>:</div>
+<div class="line"><a name="l08241"></a><span class="lineno"> 8241</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\n&quot;</span>);</div>
+<div class="line"><a name="l08242"></a><span class="lineno"> 8242</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l08243"></a><span class="lineno"> 8243</span>&#160;        <span class="keywordflow">case</span> <span class="charliteral">&#39;\r&#39;</span>:</div>
+<div class="line"><a name="l08244"></a><span class="lineno"> 8244</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\r&quot;</span>);</div>
+<div class="line"><a name="l08245"></a><span class="lineno"> 8245</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l08246"></a><span class="lineno"> 8246</span>&#160;        <span class="keywordflow">case</span> <span class="charliteral">&#39;\t&#39;</span>:</div>
+<div class="line"><a name="l08247"></a><span class="lineno"> 8247</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;\\t&quot;</span>);</div>
+<div class="line"><a name="l08248"></a><span class="lineno"> 8248</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l08249"></a><span class="lineno"> 8249</span>&#160;        <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l08250"></a><span class="lineno"> 8250</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Character not currently supported.&quot;</span>);</div>
+<div class="line"><a name="l08251"></a><span class="lineno"> 8251</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l08252"></a><span class="lineno"> 8252</span>&#160;        }</div>
+<div class="line"><a name="l08253"></a><span class="lineno"> 8253</span>&#160;    }</div>
+<div class="line"><a name="l08254"></a><span class="lineno"> 8254</span>&#160;}</div>
+<div class="line"><a name="l08255"></a><span class="lineno"> 8255</span>&#160; </div>
+<div class="line"><a name="l08256"></a><span class="lineno"> 8256</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString(uint32_t n)</div>
+<div class="line"><a name="l08257"></a><span class="lineno"> 8257</span>&#160;{</div>
+<div class="line"><a name="l08258"></a><span class="lineno"> 8258</span>&#160;    VMA_ASSERT(m_InsideString);</div>
+<div class="line"><a name="l08259"></a><span class="lineno"> 8259</span>&#160;    m_SB.AddNumber(n);</div>
+<div class="line"><a name="l08260"></a><span class="lineno"> 8260</span>&#160;}</div>
+<div class="line"><a name="l08261"></a><span class="lineno"> 8261</span>&#160; </div>
+<div class="line"><a name="l08262"></a><span class="lineno"> 8262</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString(uint64_t n)</div>
+<div class="line"><a name="l08263"></a><span class="lineno"> 8263</span>&#160;{</div>
+<div class="line"><a name="l08264"></a><span class="lineno"> 8264</span>&#160;    VMA_ASSERT(m_InsideString);</div>
+<div class="line"><a name="l08265"></a><span class="lineno"> 8265</span>&#160;    m_SB.AddNumber(n);</div>
+<div class="line"><a name="l08266"></a><span class="lineno"> 8266</span>&#160;}</div>
+<div class="line"><a name="l08267"></a><span class="lineno"> 8267</span>&#160; </div>
+<div class="line"><a name="l08268"></a><span class="lineno"> 8268</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString_Pointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr)</div>
+<div class="line"><a name="l08269"></a><span class="lineno"> 8269</span>&#160;{</div>
+<div class="line"><a name="l08270"></a><span class="lineno"> 8270</span>&#160;    VMA_ASSERT(m_InsideString);</div>
+<div class="line"><a name="l08271"></a><span class="lineno"> 8271</span>&#160;    m_SB.AddPointer(ptr);</div>
+<div class="line"><a name="l08272"></a><span class="lineno"> 8272</span>&#160;}</div>
+<div class="line"><a name="l08273"></a><span class="lineno"> 8273</span>&#160; </div>
+<div class="line"><a name="l08274"></a><span class="lineno"> 8274</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::EndString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
+<div class="line"><a name="l08275"></a><span class="lineno"> 8275</span>&#160;{</div>
+<div class="line"><a name="l08276"></a><span class="lineno"> 8276</span>&#160;    VMA_ASSERT(m_InsideString);</div>
+<div class="line"><a name="l08277"></a><span class="lineno"> 8277</span>&#160;    <span class="keywordflow">if</span>(pStr != VMA_NULL &amp;&amp; pStr[0] != <span class="charliteral">&#39;\0&#39;</span>)</div>
+<div class="line"><a name="l08278"></a><span class="lineno"> 8278</span>&#160;    {</div>
+<div class="line"><a name="l08279"></a><span class="lineno"> 8279</span>&#160;        ContinueString(pStr);</div>
+<div class="line"><a name="l08280"></a><span class="lineno"> 8280</span>&#160;    }</div>
+<div class="line"><a name="l08281"></a><span class="lineno"> 8281</span>&#160;    m_SB.Add(<span class="charliteral">&#39;&quot;&#39;</span>);</div>
+<div class="line"><a name="l08282"></a><span class="lineno"> 8282</span>&#160;    m_InsideString = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l08283"></a><span class="lineno"> 8283</span>&#160;}</div>
+<div class="line"><a name="l08284"></a><span class="lineno"> 8284</span>&#160; </div>
+<div class="line"><a name="l08285"></a><span class="lineno"> 8285</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteNumber(uint32_t n)</div>
+<div class="line"><a name="l08286"></a><span class="lineno"> 8286</span>&#160;{</div>
+<div class="line"><a name="l08287"></a><span class="lineno"> 8287</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
+<div class="line"><a name="l08288"></a><span class="lineno"> 8288</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
+<div class="line"><a name="l08289"></a><span class="lineno"> 8289</span>&#160;    m_SB.AddNumber(n);</div>
+<div class="line"><a name="l08290"></a><span class="lineno"> 8290</span>&#160;}</div>
+<div class="line"><a name="l08291"></a><span class="lineno"> 8291</span>&#160; </div>
+<div class="line"><a name="l08292"></a><span class="lineno"> 8292</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteNumber(uint64_t n)</div>
+<div class="line"><a name="l08293"></a><span class="lineno"> 8293</span>&#160;{</div>
+<div class="line"><a name="l08294"></a><span class="lineno"> 8294</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
+<div class="line"><a name="l08295"></a><span class="lineno"> 8295</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
+<div class="line"><a name="l08296"></a><span class="lineno"> 8296</span>&#160;    m_SB.AddNumber(n);</div>
+<div class="line"><a name="l08297"></a><span class="lineno"> 8297</span>&#160;}</div>
 <div class="line"><a name="l08298"></a><span class="lineno"> 8298</span>&#160; </div>
-<div class="line"><a name="l08299"></a><span class="lineno"> 8299</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Size&quot;</span>);</div>
-<div class="line"><a name="l08300"></a><span class="lineno"> 8300</span>&#160;    json.WriteNumber(m_Size);</div>
-<div class="line"><a name="l08301"></a><span class="lineno"> 8301</span>&#160; </div>
-<div class="line"><a name="l08302"></a><span class="lineno"> 8302</span>&#160;    <span class="keywordflow">if</span>(m_pUserData != VMA_NULL)</div>
-<div class="line"><a name="l08303"></a><span class="lineno"> 8303</span>&#160;    {</div>
-<div class="line"><a name="l08304"></a><span class="lineno"> 8304</span>&#160;        json.WriteString(<span class="stringliteral">&quot;UserData&quot;</span>);</div>
-<div class="line"><a name="l08305"></a><span class="lineno"> 8305</span>&#160;        <span class="keywordflow">if</span>(IsUserDataString())</div>
-<div class="line"><a name="l08306"></a><span class="lineno"> 8306</span>&#160;        {</div>
-<div class="line"><a name="l08307"></a><span class="lineno"> 8307</span>&#160;            json.WriteString((<span class="keyword">const</span> <span class="keywordtype">char</span>*)m_pUserData);</div>
-<div class="line"><a name="l08308"></a><span class="lineno"> 8308</span>&#160;        }</div>
-<div class="line"><a name="l08309"></a><span class="lineno"> 8309</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08310"></a><span class="lineno"> 8310</span>&#160;        {</div>
-<div class="line"><a name="l08311"></a><span class="lineno"> 8311</span>&#160;            json.BeginString();</div>
-<div class="line"><a name="l08312"></a><span class="lineno"> 8312</span>&#160;            json.ContinueString_Pointer(m_pUserData);</div>
-<div class="line"><a name="l08313"></a><span class="lineno"> 8313</span>&#160;            json.EndString();</div>
-<div class="line"><a name="l08314"></a><span class="lineno"> 8314</span>&#160;        }</div>
-<div class="line"><a name="l08315"></a><span class="lineno"> 8315</span>&#160;    }</div>
-<div class="line"><a name="l08316"></a><span class="lineno"> 8316</span>&#160; </div>
-<div class="line"><a name="l08317"></a><span class="lineno"> 8317</span>&#160;    json.WriteString(<span class="stringliteral">&quot;CreationFrameIndex&quot;</span>);</div>
-<div class="line"><a name="l08318"></a><span class="lineno"> 8318</span>&#160;    json.WriteNumber(m_CreationFrameIndex);</div>
-<div class="line"><a name="l08319"></a><span class="lineno"> 8319</span>&#160; </div>
-<div class="line"><a name="l08320"></a><span class="lineno"> 8320</span>&#160;    json.WriteString(<span class="stringliteral">&quot;LastUseFrameIndex&quot;</span>);</div>
-<div class="line"><a name="l08321"></a><span class="lineno"> 8321</span>&#160;    json.WriteNumber(GetLastUseFrameIndex());</div>
-<div class="line"><a name="l08322"></a><span class="lineno"> 8322</span>&#160; </div>
-<div class="line"><a name="l08323"></a><span class="lineno"> 8323</span>&#160;    <span class="keywordflow">if</span>(m_BufferImageUsage != 0)</div>
-<div class="line"><a name="l08324"></a><span class="lineno"> 8324</span>&#160;    {</div>
-<div class="line"><a name="l08325"></a><span class="lineno"> 8325</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Usage&quot;</span>);</div>
-<div class="line"><a name="l08326"></a><span class="lineno"> 8326</span>&#160;        json.WriteNumber(m_BufferImageUsage);</div>
-<div class="line"><a name="l08327"></a><span class="lineno"> 8327</span>&#160;    }</div>
-<div class="line"><a name="l08328"></a><span class="lineno"> 8328</span>&#160;}</div>
-<div class="line"><a name="l08329"></a><span class="lineno"> 8329</span>&#160; </div>
-<div class="line"><a name="l08330"></a><span class="lineno"> 8330</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l08331"></a><span class="lineno"> 8331</span>&#160; </div>
-<div class="line"><a name="l08332"></a><span class="lineno"> 8332</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::FreeUserDataString(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator)</div>
-<div class="line"><a name="l08333"></a><span class="lineno"> 8333</span>&#160;{</div>
-<div class="line"><a name="l08334"></a><span class="lineno"> 8334</span>&#160;    VMA_ASSERT(IsUserDataString());</div>
-<div class="line"><a name="l08335"></a><span class="lineno"> 8335</span>&#160;    VmaFreeString(hAllocator-&gt;GetAllocationCallbacks(), (<span class="keywordtype">char</span>*)m_pUserData);</div>
-<div class="line"><a name="l08336"></a><span class="lineno"> 8336</span>&#160;    m_pUserData = VMA_NULL;</div>
-<div class="line"><a name="l08337"></a><span class="lineno"> 8337</span>&#160;}</div>
-<div class="line"><a name="l08338"></a><span class="lineno"> 8338</span>&#160; </div>
-<div class="line"><a name="l08339"></a><span class="lineno"> 8339</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::BlockAllocMap()</div>
-<div class="line"><a name="l08340"></a><span class="lineno"> 8340</span>&#160;{</div>
-<div class="line"><a name="l08341"></a><span class="lineno"> 8341</span>&#160;    VMA_ASSERT(GetType() == ALLOCATION_TYPE_BLOCK);</div>
-<div class="line"><a name="l08342"></a><span class="lineno"> 8342</span>&#160; </div>
-<div class="line"><a name="l08343"></a><span class="lineno"> 8343</span>&#160;    <span class="keywordflow">if</span>((m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP) &lt; 0x7F)</div>
-<div class="line"><a name="l08344"></a><span class="lineno"> 8344</span>&#160;    {</div>
-<div class="line"><a name="l08345"></a><span class="lineno"> 8345</span>&#160;        ++m_MapCount;</div>
-<div class="line"><a name="l08346"></a><span class="lineno"> 8346</span>&#160;    }</div>
-<div class="line"><a name="l08347"></a><span class="lineno"> 8347</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08348"></a><span class="lineno"> 8348</span>&#160;    {</div>
-<div class="line"><a name="l08349"></a><span class="lineno"> 8349</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Allocation mapped too many times simultaneously.&quot;</span>);</div>
-<div class="line"><a name="l08350"></a><span class="lineno"> 8350</span>&#160;    }</div>
-<div class="line"><a name="l08351"></a><span class="lineno"> 8351</span>&#160;}</div>
-<div class="line"><a name="l08352"></a><span class="lineno"> 8352</span>&#160; </div>
-<div class="line"><a name="l08353"></a><span class="lineno"> 8353</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::BlockAllocUnmap()</div>
-<div class="line"><a name="l08354"></a><span class="lineno"> 8354</span>&#160;{</div>
-<div class="line"><a name="l08355"></a><span class="lineno"> 8355</span>&#160;    VMA_ASSERT(GetType() == ALLOCATION_TYPE_BLOCK);</div>
-<div class="line"><a name="l08356"></a><span class="lineno"> 8356</span>&#160; </div>
-<div class="line"><a name="l08357"></a><span class="lineno"> 8357</span>&#160;    <span class="keywordflow">if</span>((m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP) != 0)</div>
-<div class="line"><a name="l08358"></a><span class="lineno"> 8358</span>&#160;    {</div>
-<div class="line"><a name="l08359"></a><span class="lineno"> 8359</span>&#160;        --m_MapCount;</div>
-<div class="line"><a name="l08360"></a><span class="lineno"> 8360</span>&#160;    }</div>
-<div class="line"><a name="l08361"></a><span class="lineno"> 8361</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08362"></a><span class="lineno"> 8362</span>&#160;    {</div>
-<div class="line"><a name="l08363"></a><span class="lineno"> 8363</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Unmapping allocation not previously mapped.&quot;</span>);</div>
-<div class="line"><a name="l08364"></a><span class="lineno"> 8364</span>&#160;    }</div>
-<div class="line"><a name="l08365"></a><span class="lineno"> 8365</span>&#160;}</div>
-<div class="line"><a name="l08366"></a><span class="lineno"> 8366</span>&#160; </div>
-<div class="line"><a name="l08367"></a><span class="lineno"> 8367</span>&#160;VkResult VmaAllocation_T::DedicatedAllocMap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>** ppData)</div>
-<div class="line"><a name="l08368"></a><span class="lineno"> 8368</span>&#160;{</div>
-<div class="line"><a name="l08369"></a><span class="lineno"> 8369</span>&#160;    VMA_ASSERT(GetType() == ALLOCATION_TYPE_DEDICATED);</div>
-<div class="line"><a name="l08370"></a><span class="lineno"> 8370</span>&#160; </div>
-<div class="line"><a name="l08371"></a><span class="lineno"> 8371</span>&#160;    <span class="keywordflow">if</span>(m_MapCount != 0)</div>
-<div class="line"><a name="l08372"></a><span class="lineno"> 8372</span>&#160;    {</div>
-<div class="line"><a name="l08373"></a><span class="lineno"> 8373</span>&#160;        <span class="keywordflow">if</span>((m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP) &lt; 0x7F)</div>
-<div class="line"><a name="l08374"></a><span class="lineno"> 8374</span>&#160;        {</div>
-<div class="line"><a name="l08375"></a><span class="lineno"> 8375</span>&#160;            VMA_ASSERT(m_DedicatedAllocation.m_pMappedData != VMA_NULL);</div>
-<div class="line"><a name="l08376"></a><span class="lineno"> 8376</span>&#160;            *ppData = m_DedicatedAllocation.m_pMappedData;</div>
-<div class="line"><a name="l08377"></a><span class="lineno"> 8377</span>&#160;            ++m_MapCount;</div>
-<div class="line"><a name="l08378"></a><span class="lineno"> 8378</span>&#160;            <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l08379"></a><span class="lineno"> 8379</span>&#160;        }</div>
-<div class="line"><a name="l08380"></a><span class="lineno"> 8380</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08381"></a><span class="lineno"> 8381</span>&#160;        {</div>
-<div class="line"><a name="l08382"></a><span class="lineno"> 8382</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Dedicated allocation mapped too many times simultaneously.&quot;</span>);</div>
-<div class="line"><a name="l08383"></a><span class="lineno"> 8383</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_MEMORY_MAP_FAILED;</div>
-<div class="line"><a name="l08384"></a><span class="lineno"> 8384</span>&#160;        }</div>
-<div class="line"><a name="l08385"></a><span class="lineno"> 8385</span>&#160;    }</div>
-<div class="line"><a name="l08386"></a><span class="lineno"> 8386</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08387"></a><span class="lineno"> 8387</span>&#160;    {</div>
-<div class="line"><a name="l08388"></a><span class="lineno"> 8388</span>&#160;        VkResult result = (*hAllocator-&gt;GetVulkanFunctions().vkMapMemory)(</div>
-<div class="line"><a name="l08389"></a><span class="lineno"> 8389</span>&#160;            hAllocator-&gt;m_hDevice,</div>
-<div class="line"><a name="l08390"></a><span class="lineno"> 8390</span>&#160;            m_DedicatedAllocation.m_hMemory,</div>
-<div class="line"><a name="l08391"></a><span class="lineno"> 8391</span>&#160;            0, <span class="comment">// offset</span></div>
-<div class="line"><a name="l08392"></a><span class="lineno"> 8392</span>&#160;            VK_WHOLE_SIZE,</div>
-<div class="line"><a name="l08393"></a><span class="lineno"> 8393</span>&#160;            0, <span class="comment">// flags</span></div>
-<div class="line"><a name="l08394"></a><span class="lineno"> 8394</span>&#160;            ppData);</div>
-<div class="line"><a name="l08395"></a><span class="lineno"> 8395</span>&#160;        <span class="keywordflow">if</span>(result == VK_SUCCESS)</div>
-<div class="line"><a name="l08396"></a><span class="lineno"> 8396</span>&#160;        {</div>
-<div class="line"><a name="l08397"></a><span class="lineno"> 8397</span>&#160;            m_DedicatedAllocation.m_pMappedData = *ppData;</div>
-<div class="line"><a name="l08398"></a><span class="lineno"> 8398</span>&#160;            m_MapCount = 1;</div>
-<div class="line"><a name="l08399"></a><span class="lineno"> 8399</span>&#160;        }</div>
-<div class="line"><a name="l08400"></a><span class="lineno"> 8400</span>&#160;        <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l08401"></a><span class="lineno"> 8401</span>&#160;    }</div>
-<div class="line"><a name="l08402"></a><span class="lineno"> 8402</span>&#160;}</div>
-<div class="line"><a name="l08403"></a><span class="lineno"> 8403</span>&#160; </div>
-<div class="line"><a name="l08404"></a><span class="lineno"> 8404</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::DedicatedAllocUnmap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator)</div>
-<div class="line"><a name="l08405"></a><span class="lineno"> 8405</span>&#160;{</div>
-<div class="line"><a name="l08406"></a><span class="lineno"> 8406</span>&#160;    VMA_ASSERT(GetType() == ALLOCATION_TYPE_DEDICATED);</div>
-<div class="line"><a name="l08407"></a><span class="lineno"> 8407</span>&#160; </div>
-<div class="line"><a name="l08408"></a><span class="lineno"> 8408</span>&#160;    <span class="keywordflow">if</span>((m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP) != 0)</div>
-<div class="line"><a name="l08409"></a><span class="lineno"> 8409</span>&#160;    {</div>
-<div class="line"><a name="l08410"></a><span class="lineno"> 8410</span>&#160;        --m_MapCount;</div>
-<div class="line"><a name="l08411"></a><span class="lineno"> 8411</span>&#160;        <span class="keywordflow">if</span>(m_MapCount == 0)</div>
-<div class="line"><a name="l08412"></a><span class="lineno"> 8412</span>&#160;        {</div>
-<div class="line"><a name="l08413"></a><span class="lineno"> 8413</span>&#160;            m_DedicatedAllocation.m_pMappedData = VMA_NULL;</div>
-<div class="line"><a name="l08414"></a><span class="lineno"> 8414</span>&#160;            (*hAllocator-&gt;GetVulkanFunctions().vkUnmapMemory)(</div>
-<div class="line"><a name="l08415"></a><span class="lineno"> 8415</span>&#160;                hAllocator-&gt;m_hDevice,</div>
-<div class="line"><a name="l08416"></a><span class="lineno"> 8416</span>&#160;                m_DedicatedAllocation.m_hMemory);</div>
-<div class="line"><a name="l08417"></a><span class="lineno"> 8417</span>&#160;        }</div>
-<div class="line"><a name="l08418"></a><span class="lineno"> 8418</span>&#160;    }</div>
-<div class="line"><a name="l08419"></a><span class="lineno"> 8419</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08420"></a><span class="lineno"> 8420</span>&#160;    {</div>
-<div class="line"><a name="l08421"></a><span class="lineno"> 8421</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Unmapping dedicated allocation not previously mapped.&quot;</span>);</div>
+<div class="line"><a name="l08299"></a><span class="lineno"> 8299</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteBool(<span class="keywordtype">bool</span> b)</div>
+<div class="line"><a name="l08300"></a><span class="lineno"> 8300</span>&#160;{</div>
+<div class="line"><a name="l08301"></a><span class="lineno"> 8301</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
+<div class="line"><a name="l08302"></a><span class="lineno"> 8302</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
+<div class="line"><a name="l08303"></a><span class="lineno"> 8303</span>&#160;    m_SB.Add(b ? <span class="stringliteral">&quot;true&quot;</span> : <span class="stringliteral">&quot;false&quot;</span>);</div>
+<div class="line"><a name="l08304"></a><span class="lineno"> 8304</span>&#160;}</div>
+<div class="line"><a name="l08305"></a><span class="lineno"> 8305</span>&#160; </div>
+<div class="line"><a name="l08306"></a><span class="lineno"> 8306</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteNull()</div>
+<div class="line"><a name="l08307"></a><span class="lineno"> 8307</span>&#160;{</div>
+<div class="line"><a name="l08308"></a><span class="lineno"> 8308</span>&#160;    VMA_ASSERT(!m_InsideString);</div>
+<div class="line"><a name="l08309"></a><span class="lineno"> 8309</span>&#160;    BeginValue(<span class="keyword">false</span>);</div>
+<div class="line"><a name="l08310"></a><span class="lineno"> 8310</span>&#160;    m_SB.Add(<span class="stringliteral">&quot;null&quot;</span>);</div>
+<div class="line"><a name="l08311"></a><span class="lineno"> 8311</span>&#160;}</div>
+<div class="line"><a name="l08312"></a><span class="lineno"> 8312</span>&#160; </div>
+<div class="line"><a name="l08313"></a><span class="lineno"> 8313</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::BeginValue(<span class="keywordtype">bool</span> isString)</div>
+<div class="line"><a name="l08314"></a><span class="lineno"> 8314</span>&#160;{</div>
+<div class="line"><a name="l08315"></a><span class="lineno"> 8315</span>&#160;    <span class="keywordflow">if</span>(!m_Stack.empty())</div>
+<div class="line"><a name="l08316"></a><span class="lineno"> 8316</span>&#160;    {</div>
+<div class="line"><a name="l08317"></a><span class="lineno"> 8317</span>&#160;        StackItem&amp; currItem = m_Stack.back();</div>
+<div class="line"><a name="l08318"></a><span class="lineno"> 8318</span>&#160;        <span class="keywordflow">if</span>(currItem.type == COLLECTION_TYPE_OBJECT &amp;&amp;</div>
+<div class="line"><a name="l08319"></a><span class="lineno"> 8319</span>&#160;            currItem.valueCount % 2 == 0)</div>
+<div class="line"><a name="l08320"></a><span class="lineno"> 8320</span>&#160;        {</div>
+<div class="line"><a name="l08321"></a><span class="lineno"> 8321</span>&#160;            VMA_ASSERT(isString);</div>
+<div class="line"><a name="l08322"></a><span class="lineno"> 8322</span>&#160;        }</div>
+<div class="line"><a name="l08323"></a><span class="lineno"> 8323</span>&#160; </div>
+<div class="line"><a name="l08324"></a><span class="lineno"> 8324</span>&#160;        <span class="keywordflow">if</span>(currItem.type == COLLECTION_TYPE_OBJECT &amp;&amp;</div>
+<div class="line"><a name="l08325"></a><span class="lineno"> 8325</span>&#160;            currItem.valueCount % 2 != 0)</div>
+<div class="line"><a name="l08326"></a><span class="lineno"> 8326</span>&#160;        {</div>
+<div class="line"><a name="l08327"></a><span class="lineno"> 8327</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;: &quot;</span>);</div>
+<div class="line"><a name="l08328"></a><span class="lineno"> 8328</span>&#160;        }</div>
+<div class="line"><a name="l08329"></a><span class="lineno"> 8329</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(currItem.valueCount &gt; 0)</div>
+<div class="line"><a name="l08330"></a><span class="lineno"> 8330</span>&#160;        {</div>
+<div class="line"><a name="l08331"></a><span class="lineno"> 8331</span>&#160;            m_SB.Add(<span class="stringliteral">&quot;, &quot;</span>);</div>
+<div class="line"><a name="l08332"></a><span class="lineno"> 8332</span>&#160;            WriteIndent();</div>
+<div class="line"><a name="l08333"></a><span class="lineno"> 8333</span>&#160;        }</div>
+<div class="line"><a name="l08334"></a><span class="lineno"> 8334</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08335"></a><span class="lineno"> 8335</span>&#160;        {</div>
+<div class="line"><a name="l08336"></a><span class="lineno"> 8336</span>&#160;            WriteIndent();</div>
+<div class="line"><a name="l08337"></a><span class="lineno"> 8337</span>&#160;        }</div>
+<div class="line"><a name="l08338"></a><span class="lineno"> 8338</span>&#160;        ++currItem.valueCount;</div>
+<div class="line"><a name="l08339"></a><span class="lineno"> 8339</span>&#160;    }</div>
+<div class="line"><a name="l08340"></a><span class="lineno"> 8340</span>&#160;}</div>
+<div class="line"><a name="l08341"></a><span class="lineno"> 8341</span>&#160; </div>
+<div class="line"><a name="l08342"></a><span class="lineno"> 8342</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteIndent(<span class="keywordtype">bool</span> oneLess)</div>
+<div class="line"><a name="l08343"></a><span class="lineno"> 8343</span>&#160;{</div>
+<div class="line"><a name="l08344"></a><span class="lineno"> 8344</span>&#160;    <span class="keywordflow">if</span>(!m_Stack.empty() &amp;&amp; !m_Stack.back().singleLineMode)</div>
+<div class="line"><a name="l08345"></a><span class="lineno"> 8345</span>&#160;    {</div>
+<div class="line"><a name="l08346"></a><span class="lineno"> 8346</span>&#160;        m_SB.AddNewLine();</div>
+<div class="line"><a name="l08347"></a><span class="lineno"> 8347</span>&#160;        </div>
+<div class="line"><a name="l08348"></a><span class="lineno"> 8348</span>&#160;        <span class="keywordtype">size_t</span> count = m_Stack.size();</div>
+<div class="line"><a name="l08349"></a><span class="lineno"> 8349</span>&#160;        <span class="keywordflow">if</span>(count &gt; 0 &amp;&amp; oneLess)</div>
+<div class="line"><a name="l08350"></a><span class="lineno"> 8350</span>&#160;        {</div>
+<div class="line"><a name="l08351"></a><span class="lineno"> 8351</span>&#160;            --count;</div>
+<div class="line"><a name="l08352"></a><span class="lineno"> 8352</span>&#160;        }</div>
+<div class="line"><a name="l08353"></a><span class="lineno"> 8353</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; count; ++i)</div>
+<div class="line"><a name="l08354"></a><span class="lineno"> 8354</span>&#160;        {</div>
+<div class="line"><a name="l08355"></a><span class="lineno"> 8355</span>&#160;            m_SB.Add(INDENT);</div>
+<div class="line"><a name="l08356"></a><span class="lineno"> 8356</span>&#160;        }</div>
+<div class="line"><a name="l08357"></a><span class="lineno"> 8357</span>&#160;    }</div>
+<div class="line"><a name="l08358"></a><span class="lineno"> 8358</span>&#160;}</div>
+<div class="line"><a name="l08359"></a><span class="lineno"> 8359</span>&#160; </div>
+<div class="line"><a name="l08360"></a><span class="lineno"> 8360</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l08361"></a><span class="lineno"> 8361</span>&#160; </div>
+<div class="line"><a name="l08363"></a><span class="lineno"> 8363</span>&#160; </div>
+<div class="line"><a name="l08364"></a><span class="lineno"> 8364</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::SetUserData(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>* pUserData)</div>
+<div class="line"><a name="l08365"></a><span class="lineno"> 8365</span>&#160;{</div>
+<div class="line"><a name="l08366"></a><span class="lineno"> 8366</span>&#160;    <span class="keywordflow">if</span>(IsUserDataString())</div>
+<div class="line"><a name="l08367"></a><span class="lineno"> 8367</span>&#160;    {</div>
+<div class="line"><a name="l08368"></a><span class="lineno"> 8368</span>&#160;        VMA_ASSERT(pUserData == VMA_NULL || pUserData != m_pUserData);</div>
+<div class="line"><a name="l08369"></a><span class="lineno"> 8369</span>&#160; </div>
+<div class="line"><a name="l08370"></a><span class="lineno"> 8370</span>&#160;        FreeUserDataString(hAllocator);</div>
+<div class="line"><a name="l08371"></a><span class="lineno"> 8371</span>&#160; </div>
+<div class="line"><a name="l08372"></a><span class="lineno"> 8372</span>&#160;        <span class="keywordflow">if</span>(pUserData != VMA_NULL)</div>
+<div class="line"><a name="l08373"></a><span class="lineno"> 8373</span>&#160;        {</div>
+<div class="line"><a name="l08374"></a><span class="lineno"> 8374</span>&#160;            m_pUserData = VmaCreateStringCopy(hAllocator-&gt;GetAllocationCallbacks(), (<span class="keyword">const</span> <span class="keywordtype">char</span>*)pUserData);</div>
+<div class="line"><a name="l08375"></a><span class="lineno"> 8375</span>&#160;        }</div>
+<div class="line"><a name="l08376"></a><span class="lineno"> 8376</span>&#160;    }</div>
+<div class="line"><a name="l08377"></a><span class="lineno"> 8377</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08378"></a><span class="lineno"> 8378</span>&#160;    {</div>
+<div class="line"><a name="l08379"></a><span class="lineno"> 8379</span>&#160;        m_pUserData = pUserData;</div>
+<div class="line"><a name="l08380"></a><span class="lineno"> 8380</span>&#160;    }</div>
+<div class="line"><a name="l08381"></a><span class="lineno"> 8381</span>&#160;}</div>
+<div class="line"><a name="l08382"></a><span class="lineno"> 8382</span>&#160; </div>
+<div class="line"><a name="l08383"></a><span class="lineno"> 8383</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::ChangeBlockAllocation(</div>
+<div class="line"><a name="l08384"></a><span class="lineno"> 8384</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l08385"></a><span class="lineno"> 8385</span>&#160;    VmaDeviceMemoryBlock* block,</div>
+<div class="line"><a name="l08386"></a><span class="lineno"> 8386</span>&#160;    VkDeviceSize offset)</div>
+<div class="line"><a name="l08387"></a><span class="lineno"> 8387</span>&#160;{</div>
+<div class="line"><a name="l08388"></a><span class="lineno"> 8388</span>&#160;    VMA_ASSERT(block != VMA_NULL);</div>
+<div class="line"><a name="l08389"></a><span class="lineno"> 8389</span>&#160;    VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);</div>
+<div class="line"><a name="l08390"></a><span class="lineno"> 8390</span>&#160; </div>
+<div class="line"><a name="l08391"></a><span class="lineno"> 8391</span>&#160;    <span class="comment">// Move mapping reference counter from old block to new block.</span></div>
+<div class="line"><a name="l08392"></a><span class="lineno"> 8392</span>&#160;    <span class="keywordflow">if</span>(block != m_BlockAllocation.m_Block)</div>
+<div class="line"><a name="l08393"></a><span class="lineno"> 8393</span>&#160;    {</div>
+<div class="line"><a name="l08394"></a><span class="lineno"> 8394</span>&#160;        uint32_t mapRefCount = m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP;</div>
+<div class="line"><a name="l08395"></a><span class="lineno"> 8395</span>&#160;        <span class="keywordflow">if</span>(IsPersistentMap())</div>
+<div class="line"><a name="l08396"></a><span class="lineno"> 8396</span>&#160;            ++mapRefCount;</div>
+<div class="line"><a name="l08397"></a><span class="lineno"> 8397</span>&#160;        m_BlockAllocation.m_Block-&gt;Unmap(hAllocator, mapRefCount);</div>
+<div class="line"><a name="l08398"></a><span class="lineno"> 8398</span>&#160;        block-&gt;Map(hAllocator, mapRefCount, VMA_NULL);</div>
+<div class="line"><a name="l08399"></a><span class="lineno"> 8399</span>&#160;    }</div>
+<div class="line"><a name="l08400"></a><span class="lineno"> 8400</span>&#160; </div>
+<div class="line"><a name="l08401"></a><span class="lineno"> 8401</span>&#160;    m_BlockAllocation.m_Block = block;</div>
+<div class="line"><a name="l08402"></a><span class="lineno"> 8402</span>&#160;    m_BlockAllocation.m_Offset = offset;</div>
+<div class="line"><a name="l08403"></a><span class="lineno"> 8403</span>&#160;}</div>
+<div class="line"><a name="l08404"></a><span class="lineno"> 8404</span>&#160; </div>
+<div class="line"><a name="l08405"></a><span class="lineno"> 8405</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::ChangeOffset(VkDeviceSize newOffset)</div>
+<div class="line"><a name="l08406"></a><span class="lineno"> 8406</span>&#160;{</div>
+<div class="line"><a name="l08407"></a><span class="lineno"> 8407</span>&#160;    VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);</div>
+<div class="line"><a name="l08408"></a><span class="lineno"> 8408</span>&#160;    m_BlockAllocation.m_Offset = newOffset;</div>
+<div class="line"><a name="l08409"></a><span class="lineno"> 8409</span>&#160;}</div>
+<div class="line"><a name="l08410"></a><span class="lineno"> 8410</span>&#160; </div>
+<div class="line"><a name="l08411"></a><span class="lineno"> 8411</span>&#160;VkDeviceSize VmaAllocation_T::GetOffset()<span class="keyword"> const</span></div>
+<div class="line"><a name="l08412"></a><span class="lineno"> 8412</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08413"></a><span class="lineno"> 8413</span>&#160;    <span class="keywordflow">switch</span>(m_Type)</div>
+<div class="line"><a name="l08414"></a><span class="lineno"> 8414</span>&#160;    {</div>
+<div class="line"><a name="l08415"></a><span class="lineno"> 8415</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_BLOCK:</div>
+<div class="line"><a name="l08416"></a><span class="lineno"> 8416</span>&#160;        <span class="keywordflow">return</span> m_BlockAllocation.m_Offset;</div>
+<div class="line"><a name="l08417"></a><span class="lineno"> 8417</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_DEDICATED:</div>
+<div class="line"><a name="l08418"></a><span class="lineno"> 8418</span>&#160;        <span class="keywordflow">return</span> 0;</div>
+<div class="line"><a name="l08419"></a><span class="lineno"> 8419</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l08420"></a><span class="lineno"> 8420</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l08421"></a><span class="lineno"> 8421</span>&#160;        <span class="keywordflow">return</span> 0;</div>
 <div class="line"><a name="l08422"></a><span class="lineno"> 8422</span>&#160;    }</div>
 <div class="line"><a name="l08423"></a><span class="lineno"> 8423</span>&#160;}</div>
 <div class="line"><a name="l08424"></a><span class="lineno"> 8424</span>&#160; </div>
-<div class="line"><a name="l08425"></a><span class="lineno"> 8425</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l08426"></a><span class="lineno"> 8426</span>&#160; </div>
-<div class="line"><a name="l08427"></a><span class="lineno"> 8427</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaPrintStatInfo(VmaJsonWriter&amp; json, <span class="keyword">const</span> <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; stat)</div>
-<div class="line"><a name="l08428"></a><span class="lineno"> 8428</span>&#160;{</div>
-<div class="line"><a name="l08429"></a><span class="lineno"> 8429</span>&#160;    json.BeginObject();</div>
-<div class="line"><a name="l08430"></a><span class="lineno"> 8430</span>&#160; </div>
-<div class="line"><a name="l08431"></a><span class="lineno"> 8431</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Blocks&quot;</span>);</div>
-<div class="line"><a name="l08432"></a><span class="lineno"> 8432</span>&#160;    json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a>);</div>
-<div class="line"><a name="l08433"></a><span class="lineno"> 8433</span>&#160; </div>
-<div class="line"><a name="l08434"></a><span class="lineno"> 8434</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Allocations&quot;</span>);</div>
-<div class="line"><a name="l08435"></a><span class="lineno"> 8435</span>&#160;    json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>);</div>
-<div class="line"><a name="l08436"></a><span class="lineno"> 8436</span>&#160; </div>
-<div class="line"><a name="l08437"></a><span class="lineno"> 8437</span>&#160;    json.WriteString(<span class="stringliteral">&quot;UnusedRanges&quot;</span>);</div>
-<div class="line"><a name="l08438"></a><span class="lineno"> 8438</span>&#160;    json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>);</div>
-<div class="line"><a name="l08439"></a><span class="lineno"> 8439</span>&#160; </div>
-<div class="line"><a name="l08440"></a><span class="lineno"> 8440</span>&#160;    json.WriteString(<span class="stringliteral">&quot;UsedBytes&quot;</span>);</div>
-<div class="line"><a name="l08441"></a><span class="lineno"> 8441</span>&#160;    json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a>);</div>
-<div class="line"><a name="l08442"></a><span class="lineno"> 8442</span>&#160; </div>
-<div class="line"><a name="l08443"></a><span class="lineno"> 8443</span>&#160;    json.WriteString(<span class="stringliteral">&quot;UnusedBytes&quot;</span>);</div>
-<div class="line"><a name="l08444"></a><span class="lineno"> 8444</span>&#160;    json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>);</div>
-<div class="line"><a name="l08445"></a><span class="lineno"> 8445</span>&#160; </div>
-<div class="line"><a name="l08446"></a><span class="lineno"> 8446</span>&#160;    <span class="keywordflow">if</span>(stat.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> &gt; 1)</div>
-<div class="line"><a name="l08447"></a><span class="lineno"> 8447</span>&#160;    {</div>
-<div class="line"><a name="l08448"></a><span class="lineno"> 8448</span>&#160;        json.WriteString(<span class="stringliteral">&quot;AllocationSize&quot;</span>);</div>
-<div class="line"><a name="l08449"></a><span class="lineno"> 8449</span>&#160;        json.BeginObject(<span class="keyword">true</span>);</div>
-<div class="line"><a name="l08450"></a><span class="lineno"> 8450</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Min&quot;</span>);</div>
-<div class="line"><a name="l08451"></a><span class="lineno"> 8451</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>);</div>
-<div class="line"><a name="l08452"></a><span class="lineno"> 8452</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Avg&quot;</span>);</div>
-<div class="line"><a name="l08453"></a><span class="lineno"> 8453</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a1081a039964e566c672e7a2347f9e599">allocationSizeAvg</a>);</div>
-<div class="line"><a name="l08454"></a><span class="lineno"> 8454</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Max&quot;</span>);</div>
-<div class="line"><a name="l08455"></a><span class="lineno"> 8455</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>);</div>
-<div class="line"><a name="l08456"></a><span class="lineno"> 8456</span>&#160;        json.EndObject();</div>
-<div class="line"><a name="l08457"></a><span class="lineno"> 8457</span>&#160;    }</div>
-<div class="line"><a name="l08458"></a><span class="lineno"> 8458</span>&#160; </div>
-<div class="line"><a name="l08459"></a><span class="lineno"> 8459</span>&#160;    <span class="keywordflow">if</span>(stat.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> &gt; 1)</div>
-<div class="line"><a name="l08460"></a><span class="lineno"> 8460</span>&#160;    {</div>
-<div class="line"><a name="l08461"></a><span class="lineno"> 8461</span>&#160;        json.WriteString(<span class="stringliteral">&quot;UnusedRangeSize&quot;</span>);</div>
-<div class="line"><a name="l08462"></a><span class="lineno"> 8462</span>&#160;        json.BeginObject(<span class="keyword">true</span>);</div>
-<div class="line"><a name="l08463"></a><span class="lineno"> 8463</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Min&quot;</span>);</div>
-<div class="line"><a name="l08464"></a><span class="lineno"> 8464</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>);</div>
-<div class="line"><a name="l08465"></a><span class="lineno"> 8465</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Avg&quot;</span>);</div>
-<div class="line"><a name="l08466"></a><span class="lineno"> 8466</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a2f9b3452af90c9768a30b7fb6ae194fc">unusedRangeSizeAvg</a>);</div>
-<div class="line"><a name="l08467"></a><span class="lineno"> 8467</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Max&quot;</span>);</div>
-<div class="line"><a name="l08468"></a><span class="lineno"> 8468</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>);</div>
-<div class="line"><a name="l08469"></a><span class="lineno"> 8469</span>&#160;        json.EndObject();</div>
-<div class="line"><a name="l08470"></a><span class="lineno"> 8470</span>&#160;    }</div>
-<div class="line"><a name="l08471"></a><span class="lineno"> 8471</span>&#160; </div>
-<div class="line"><a name="l08472"></a><span class="lineno"> 8472</span>&#160;    json.EndObject();</div>
-<div class="line"><a name="l08473"></a><span class="lineno"> 8473</span>&#160;}</div>
-<div class="line"><a name="l08474"></a><span class="lineno"> 8474</span>&#160; </div>
-<div class="line"><a name="l08475"></a><span class="lineno"> 8475</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l08476"></a><span class="lineno"> 8476</span>&#160; </div>
-<div class="line"><a name="l08477"></a><span class="lineno"> 8477</span>&#160;<span class="keyword">struct </span>VmaSuballocationItemSizeLess</div>
-<div class="line"><a name="l08478"></a><span class="lineno"> 8478</span>&#160;{</div>
-<div class="line"><a name="l08479"></a><span class="lineno"> 8479</span>&#160;    <span class="keywordtype">bool</span> operator()(</div>
-<div class="line"><a name="l08480"></a><span class="lineno"> 8480</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator lhs,</div>
-<div class="line"><a name="l08481"></a><span class="lineno"> 8481</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator rhs)<span class="keyword"> const</span></div>
-<div class="line"><a name="l08482"></a><span class="lineno"> 8482</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l08483"></a><span class="lineno"> 8483</span>&#160;        <span class="keywordflow">return</span> lhs-&gt;size &lt; rhs-&gt;size;</div>
-<div class="line"><a name="l08484"></a><span class="lineno"> 8484</span>&#160;    }</div>
-<div class="line"><a name="l08485"></a><span class="lineno"> 8485</span>&#160;    <span class="keywordtype">bool</span> operator()(</div>
-<div class="line"><a name="l08486"></a><span class="lineno"> 8486</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator lhs,</div>
-<div class="line"><a name="l08487"></a><span class="lineno"> 8487</span>&#160;        VkDeviceSize rhsSize)<span class="keyword"> const</span></div>
-<div class="line"><a name="l08488"></a><span class="lineno"> 8488</span>&#160;<span class="keyword">    </span>{</div>
-<div class="line"><a name="l08489"></a><span class="lineno"> 8489</span>&#160;        <span class="keywordflow">return</span> lhs-&gt;size &lt; rhsSize;</div>
-<div class="line"><a name="l08490"></a><span class="lineno"> 8490</span>&#160;    }</div>
-<div class="line"><a name="l08491"></a><span class="lineno"> 8491</span>&#160;};</div>
-<div class="line"><a name="l08492"></a><span class="lineno"> 8492</span>&#160; </div>
-<div class="line"><a name="l08493"></a><span class="lineno"> 8493</span>&#160; </div>
-<div class="line"><a name="l08495"></a><span class="lineno"> 8495</span>&#160;<span class="comment">// class VmaBlockMetadata</span></div>
-<div class="line"><a name="l08496"></a><span class="lineno"> 8496</span>&#160; </div>
-<div class="line"><a name="l08497"></a><span class="lineno"> 8497</span>&#160;VmaBlockMetadata::VmaBlockMetadata(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator) :</div>
-<div class="line"><a name="l08498"></a><span class="lineno"> 8498</span>&#160;    m_Size(0),</div>
-<div class="line"><a name="l08499"></a><span class="lineno"> 8499</span>&#160;    m_pAllocationCallbacks(hAllocator-&gt;GetAllocationCallbacks())</div>
-<div class="line"><a name="l08500"></a><span class="lineno"> 8500</span>&#160;{</div>
-<div class="line"><a name="l08501"></a><span class="lineno"> 8501</span>&#160;}</div>
-<div class="line"><a name="l08502"></a><span class="lineno"> 8502</span>&#160; </div>
-<div class="line"><a name="l08503"></a><span class="lineno"> 8503</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l08504"></a><span class="lineno"> 8504</span>&#160; </div>
-<div class="line"><a name="l08505"></a><span class="lineno"> 8505</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata::PrintDetailedMap_Begin(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
-<div class="line"><a name="l08506"></a><span class="lineno"> 8506</span>&#160;    VkDeviceSize unusedBytes,</div>
-<div class="line"><a name="l08507"></a><span class="lineno"> 8507</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l08508"></a><span class="lineno"> 8508</span>&#160;    <span class="keywordtype">size_t</span> unusedRangeCount)<span class="keyword"> const</span></div>
-<div class="line"><a name="l08509"></a><span class="lineno"> 8509</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08510"></a><span class="lineno"> 8510</span>&#160;    json.BeginObject();</div>
+<div class="line"><a name="l08425"></a><span class="lineno"> 8425</span>&#160;VkDeviceMemory VmaAllocation_T::GetMemory()<span class="keyword"> const</span></div>
+<div class="line"><a name="l08426"></a><span class="lineno"> 8426</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08427"></a><span class="lineno"> 8427</span>&#160;    <span class="keywordflow">switch</span>(m_Type)</div>
+<div class="line"><a name="l08428"></a><span class="lineno"> 8428</span>&#160;    {</div>
+<div class="line"><a name="l08429"></a><span class="lineno"> 8429</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_BLOCK:</div>
+<div class="line"><a name="l08430"></a><span class="lineno"> 8430</span>&#160;        <span class="keywordflow">return</span> m_BlockAllocation.m_Block-&gt;GetDeviceMemory();</div>
+<div class="line"><a name="l08431"></a><span class="lineno"> 8431</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_DEDICATED:</div>
+<div class="line"><a name="l08432"></a><span class="lineno"> 8432</span>&#160;        <span class="keywordflow">return</span> m_DedicatedAllocation.m_hMemory;</div>
+<div class="line"><a name="l08433"></a><span class="lineno"> 8433</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l08434"></a><span class="lineno"> 8434</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l08435"></a><span class="lineno"> 8435</span>&#160;        <span class="keywordflow">return</span> VK_NULL_HANDLE;</div>
+<div class="line"><a name="l08436"></a><span class="lineno"> 8436</span>&#160;    }</div>
+<div class="line"><a name="l08437"></a><span class="lineno"> 8437</span>&#160;}</div>
+<div class="line"><a name="l08438"></a><span class="lineno"> 8438</span>&#160; </div>
+<div class="line"><a name="l08439"></a><span class="lineno"> 8439</span>&#160;<span class="keywordtype">void</span>* VmaAllocation_T::GetMappedData()<span class="keyword"> const</span></div>
+<div class="line"><a name="l08440"></a><span class="lineno"> 8440</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08441"></a><span class="lineno"> 8441</span>&#160;    <span class="keywordflow">switch</span>(m_Type)</div>
+<div class="line"><a name="l08442"></a><span class="lineno"> 8442</span>&#160;    {</div>
+<div class="line"><a name="l08443"></a><span class="lineno"> 8443</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_BLOCK:</div>
+<div class="line"><a name="l08444"></a><span class="lineno"> 8444</span>&#160;        <span class="keywordflow">if</span>(m_MapCount != 0)</div>
+<div class="line"><a name="l08445"></a><span class="lineno"> 8445</span>&#160;        {</div>
+<div class="line"><a name="l08446"></a><span class="lineno"> 8446</span>&#160;            <span class="keywordtype">void</span>* pBlockData = m_BlockAllocation.m_Block-&gt;GetMappedData();</div>
+<div class="line"><a name="l08447"></a><span class="lineno"> 8447</span>&#160;            VMA_ASSERT(pBlockData != VMA_NULL);</div>
+<div class="line"><a name="l08448"></a><span class="lineno"> 8448</span>&#160;            <span class="keywordflow">return</span> (<span class="keywordtype">char</span>*)pBlockData + m_BlockAllocation.m_Offset;</div>
+<div class="line"><a name="l08449"></a><span class="lineno"> 8449</span>&#160;        }</div>
+<div class="line"><a name="l08450"></a><span class="lineno"> 8450</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08451"></a><span class="lineno"> 8451</span>&#160;        {</div>
+<div class="line"><a name="l08452"></a><span class="lineno"> 8452</span>&#160;            <span class="keywordflow">return</span> VMA_NULL;</div>
+<div class="line"><a name="l08453"></a><span class="lineno"> 8453</span>&#160;        }</div>
+<div class="line"><a name="l08454"></a><span class="lineno"> 8454</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l08455"></a><span class="lineno"> 8455</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_DEDICATED:</div>
+<div class="line"><a name="l08456"></a><span class="lineno"> 8456</span>&#160;        VMA_ASSERT((m_DedicatedAllocation.m_pMappedData != VMA_NULL) == (m_MapCount != 0));</div>
+<div class="line"><a name="l08457"></a><span class="lineno"> 8457</span>&#160;        <span class="keywordflow">return</span> m_DedicatedAllocation.m_pMappedData;</div>
+<div class="line"><a name="l08458"></a><span class="lineno"> 8458</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l08459"></a><span class="lineno"> 8459</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l08460"></a><span class="lineno"> 8460</span>&#160;        <span class="keywordflow">return</span> VMA_NULL;</div>
+<div class="line"><a name="l08461"></a><span class="lineno"> 8461</span>&#160;    }</div>
+<div class="line"><a name="l08462"></a><span class="lineno"> 8462</span>&#160;}</div>
+<div class="line"><a name="l08463"></a><span class="lineno"> 8463</span>&#160; </div>
+<div class="line"><a name="l08464"></a><span class="lineno"> 8464</span>&#160;<span class="keywordtype">bool</span> VmaAllocation_T::CanBecomeLost()<span class="keyword"> const</span></div>
+<div class="line"><a name="l08465"></a><span class="lineno"> 8465</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08466"></a><span class="lineno"> 8466</span>&#160;    <span class="keywordflow">switch</span>(m_Type)</div>
+<div class="line"><a name="l08467"></a><span class="lineno"> 8467</span>&#160;    {</div>
+<div class="line"><a name="l08468"></a><span class="lineno"> 8468</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_BLOCK:</div>
+<div class="line"><a name="l08469"></a><span class="lineno"> 8469</span>&#160;        <span class="keywordflow">return</span> m_BlockAllocation.m_CanBecomeLost;</div>
+<div class="line"><a name="l08470"></a><span class="lineno"> 8470</span>&#160;    <span class="keywordflow">case</span> ALLOCATION_TYPE_DEDICATED:</div>
+<div class="line"><a name="l08471"></a><span class="lineno"> 8471</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l08472"></a><span class="lineno"> 8472</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l08473"></a><span class="lineno"> 8473</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l08474"></a><span class="lineno"> 8474</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l08475"></a><span class="lineno"> 8475</span>&#160;    }</div>
+<div class="line"><a name="l08476"></a><span class="lineno"> 8476</span>&#160;}</div>
+<div class="line"><a name="l08477"></a><span class="lineno"> 8477</span>&#160; </div>
+<div class="line"><a name="l08478"></a><span class="lineno"> 8478</span>&#160;<span class="keywordtype">bool</span> VmaAllocation_T::MakeLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)</div>
+<div class="line"><a name="l08479"></a><span class="lineno"> 8479</span>&#160;{</div>
+<div class="line"><a name="l08480"></a><span class="lineno"> 8480</span>&#160;    VMA_ASSERT(CanBecomeLost());</div>
+<div class="line"><a name="l08481"></a><span class="lineno"> 8481</span>&#160; </div>
+<div class="line"><a name="l08482"></a><span class="lineno"> 8482</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l08483"></a><span class="lineno"> 8483</span>&#160;<span class="comment">    Warning: This is a carefully designed algorithm.</span></div>
+<div class="line"><a name="l08484"></a><span class="lineno"> 8484</span>&#160;<span class="comment">    Do not modify unless you really know what you&#39;re doing :)</span></div>
+<div class="line"><a name="l08485"></a><span class="lineno"> 8485</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l08486"></a><span class="lineno"> 8486</span>&#160;    uint32_t localLastUseFrameIndex = GetLastUseFrameIndex();</div>
+<div class="line"><a name="l08487"></a><span class="lineno"> 8487</span>&#160;    <span class="keywordflow">for</span>(;;)</div>
+<div class="line"><a name="l08488"></a><span class="lineno"> 8488</span>&#160;    {</div>
+<div class="line"><a name="l08489"></a><span class="lineno"> 8489</span>&#160;        <span class="keywordflow">if</span>(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)</div>
+<div class="line"><a name="l08490"></a><span class="lineno"> 8490</span>&#160;        {</div>
+<div class="line"><a name="l08491"></a><span class="lineno"> 8491</span>&#160;            VMA_ASSERT(0);</div>
+<div class="line"><a name="l08492"></a><span class="lineno"> 8492</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l08493"></a><span class="lineno"> 8493</span>&#160;        }</div>
+<div class="line"><a name="l08494"></a><span class="lineno"> 8494</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(localLastUseFrameIndex + frameInUseCount &gt;= currentFrameIndex)</div>
+<div class="line"><a name="l08495"></a><span class="lineno"> 8495</span>&#160;        {</div>
+<div class="line"><a name="l08496"></a><span class="lineno"> 8496</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l08497"></a><span class="lineno"> 8497</span>&#160;        }</div>
+<div class="line"><a name="l08498"></a><span class="lineno"> 8498</span>&#160;        <span class="keywordflow">else</span> <span class="comment">// Last use time earlier than current time.</span></div>
+<div class="line"><a name="l08499"></a><span class="lineno"> 8499</span>&#160;        {</div>
+<div class="line"><a name="l08500"></a><span class="lineno"> 8500</span>&#160;            <span class="keywordflow">if</span>(CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, VMA_FRAME_INDEX_LOST))</div>
+<div class="line"><a name="l08501"></a><span class="lineno"> 8501</span>&#160;            {</div>
+<div class="line"><a name="l08502"></a><span class="lineno"> 8502</span>&#160;                <span class="comment">// Setting hAllocation.LastUseFrameIndex atomic to VMA_FRAME_INDEX_LOST is enough to mark it as LOST.</span></div>
+<div class="line"><a name="l08503"></a><span class="lineno"> 8503</span>&#160;                <span class="comment">// Calling code just needs to unregister this allocation in owning VmaDeviceMemoryBlock.</span></div>
+<div class="line"><a name="l08504"></a><span class="lineno"> 8504</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l08505"></a><span class="lineno"> 8505</span>&#160;            }</div>
+<div class="line"><a name="l08506"></a><span class="lineno"> 8506</span>&#160;        }</div>
+<div class="line"><a name="l08507"></a><span class="lineno"> 8507</span>&#160;    }</div>
+<div class="line"><a name="l08508"></a><span class="lineno"> 8508</span>&#160;}</div>
+<div class="line"><a name="l08509"></a><span class="lineno"> 8509</span>&#160; </div>
+<div class="line"><a name="l08510"></a><span class="lineno"> 8510</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
 <div class="line"><a name="l08511"></a><span class="lineno"> 8511</span>&#160; </div>
-<div class="line"><a name="l08512"></a><span class="lineno"> 8512</span>&#160;    json.WriteString(<span class="stringliteral">&quot;TotalBytes&quot;</span>);</div>
-<div class="line"><a name="l08513"></a><span class="lineno"> 8513</span>&#160;    json.WriteNumber(GetSize());</div>
-<div class="line"><a name="l08514"></a><span class="lineno"> 8514</span>&#160; </div>
-<div class="line"><a name="l08515"></a><span class="lineno"> 8515</span>&#160;    json.WriteString(<span class="stringliteral">&quot;UnusedBytes&quot;</span>);</div>
-<div class="line"><a name="l08516"></a><span class="lineno"> 8516</span>&#160;    json.WriteNumber(unusedBytes);</div>
-<div class="line"><a name="l08517"></a><span class="lineno"> 8517</span>&#160; </div>
-<div class="line"><a name="l08518"></a><span class="lineno"> 8518</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Allocations&quot;</span>);</div>
-<div class="line"><a name="l08519"></a><span class="lineno"> 8519</span>&#160;    json.WriteNumber((uint64_t)allocationCount);</div>
-<div class="line"><a name="l08520"></a><span class="lineno"> 8520</span>&#160; </div>
-<div class="line"><a name="l08521"></a><span class="lineno"> 8521</span>&#160;    json.WriteString(<span class="stringliteral">&quot;UnusedRanges&quot;</span>);</div>
-<div class="line"><a name="l08522"></a><span class="lineno"> 8522</span>&#160;    json.WriteNumber((uint64_t)unusedRangeCount);</div>
-<div class="line"><a name="l08523"></a><span class="lineno"> 8523</span>&#160; </div>
-<div class="line"><a name="l08524"></a><span class="lineno"> 8524</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Suballocations&quot;</span>);</div>
-<div class="line"><a name="l08525"></a><span class="lineno"> 8525</span>&#160;    json.BeginArray();</div>
-<div class="line"><a name="l08526"></a><span class="lineno"> 8526</span>&#160;}</div>
-<div class="line"><a name="l08527"></a><span class="lineno"> 8527</span>&#160; </div>
-<div class="line"><a name="l08528"></a><span class="lineno"> 8528</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata::PrintDetailedMap_Allocation(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
-<div class="line"><a name="l08529"></a><span class="lineno"> 8529</span>&#160;    VkDeviceSize offset,</div>
-<div class="line"><a name="l08530"></a><span class="lineno"> 8530</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)<span class="keyword"> const</span></div>
-<div class="line"><a name="l08531"></a><span class="lineno"> 8531</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08532"></a><span class="lineno"> 8532</span>&#160;    json.BeginObject(<span class="keyword">true</span>);</div>
-<div class="line"><a name="l08533"></a><span class="lineno"> 8533</span>&#160;        </div>
-<div class="line"><a name="l08534"></a><span class="lineno"> 8534</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Offset&quot;</span>);</div>
-<div class="line"><a name="l08535"></a><span class="lineno"> 8535</span>&#160;    json.WriteNumber(offset);</div>
-<div class="line"><a name="l08536"></a><span class="lineno"> 8536</span>&#160; </div>
-<div class="line"><a name="l08537"></a><span class="lineno"> 8537</span>&#160;    hAllocation-&gt;PrintParameters(json);</div>
-<div class="line"><a name="l08538"></a><span class="lineno"> 8538</span>&#160; </div>
-<div class="line"><a name="l08539"></a><span class="lineno"> 8539</span>&#160;    json.EndObject();</div>
-<div class="line"><a name="l08540"></a><span class="lineno"> 8540</span>&#160;}</div>
-<div class="line"><a name="l08541"></a><span class="lineno"> 8541</span>&#160; </div>
-<div class="line"><a name="l08542"></a><span class="lineno"> 8542</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata::PrintDetailedMap_UnusedRange(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
-<div class="line"><a name="l08543"></a><span class="lineno"> 8543</span>&#160;    VkDeviceSize offset,</div>
-<div class="line"><a name="l08544"></a><span class="lineno"> 8544</span>&#160;    VkDeviceSize size)<span class="keyword"> const</span></div>
-<div class="line"><a name="l08545"></a><span class="lineno"> 8545</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08546"></a><span class="lineno"> 8546</span>&#160;    json.BeginObject(<span class="keyword">true</span>);</div>
-<div class="line"><a name="l08547"></a><span class="lineno"> 8547</span>&#160;        </div>
-<div class="line"><a name="l08548"></a><span class="lineno"> 8548</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Offset&quot;</span>);</div>
-<div class="line"><a name="l08549"></a><span class="lineno"> 8549</span>&#160;    json.WriteNumber(offset);</div>
+<div class="line"><a name="l08512"></a><span class="lineno"> 8512</span>&#160;<span class="comment">// Correspond to values of enum VmaSuballocationType.</span></div>
+<div class="line"><a name="l08513"></a><span class="lineno"> 8513</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* VMA_SUBALLOCATION_TYPE_NAMES[] = {</div>
+<div class="line"><a name="l08514"></a><span class="lineno"> 8514</span>&#160;    <span class="stringliteral">&quot;FREE&quot;</span>,</div>
+<div class="line"><a name="l08515"></a><span class="lineno"> 8515</span>&#160;    <span class="stringliteral">&quot;UNKNOWN&quot;</span>,</div>
+<div class="line"><a name="l08516"></a><span class="lineno"> 8516</span>&#160;    <span class="stringliteral">&quot;BUFFER&quot;</span>,</div>
+<div class="line"><a name="l08517"></a><span class="lineno"> 8517</span>&#160;    <span class="stringliteral">&quot;IMAGE_UNKNOWN&quot;</span>,</div>
+<div class="line"><a name="l08518"></a><span class="lineno"> 8518</span>&#160;    <span class="stringliteral">&quot;IMAGE_LINEAR&quot;</span>,</div>
+<div class="line"><a name="l08519"></a><span class="lineno"> 8519</span>&#160;    <span class="stringliteral">&quot;IMAGE_OPTIMAL&quot;</span>,</div>
+<div class="line"><a name="l08520"></a><span class="lineno"> 8520</span>&#160;};</div>
+<div class="line"><a name="l08521"></a><span class="lineno"> 8521</span>&#160; </div>
+<div class="line"><a name="l08522"></a><span class="lineno"> 8522</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::PrintParameters(<span class="keyword">class</span> VmaJsonWriter&amp; json)<span class="keyword"> const</span></div>
+<div class="line"><a name="l08523"></a><span class="lineno"> 8523</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08524"></a><span class="lineno"> 8524</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Type&quot;</span>);</div>
+<div class="line"><a name="l08525"></a><span class="lineno"> 8525</span>&#160;    json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[m_SuballocationType]);</div>
+<div class="line"><a name="l08526"></a><span class="lineno"> 8526</span>&#160; </div>
+<div class="line"><a name="l08527"></a><span class="lineno"> 8527</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Size&quot;</span>);</div>
+<div class="line"><a name="l08528"></a><span class="lineno"> 8528</span>&#160;    json.WriteNumber(m_Size);</div>
+<div class="line"><a name="l08529"></a><span class="lineno"> 8529</span>&#160; </div>
+<div class="line"><a name="l08530"></a><span class="lineno"> 8530</span>&#160;    <span class="keywordflow">if</span>(m_pUserData != VMA_NULL)</div>
+<div class="line"><a name="l08531"></a><span class="lineno"> 8531</span>&#160;    {</div>
+<div class="line"><a name="l08532"></a><span class="lineno"> 8532</span>&#160;        json.WriteString(<span class="stringliteral">&quot;UserData&quot;</span>);</div>
+<div class="line"><a name="l08533"></a><span class="lineno"> 8533</span>&#160;        <span class="keywordflow">if</span>(IsUserDataString())</div>
+<div class="line"><a name="l08534"></a><span class="lineno"> 8534</span>&#160;        {</div>
+<div class="line"><a name="l08535"></a><span class="lineno"> 8535</span>&#160;            json.WriteString((<span class="keyword">const</span> <span class="keywordtype">char</span>*)m_pUserData);</div>
+<div class="line"><a name="l08536"></a><span class="lineno"> 8536</span>&#160;        }</div>
+<div class="line"><a name="l08537"></a><span class="lineno"> 8537</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08538"></a><span class="lineno"> 8538</span>&#160;        {</div>
+<div class="line"><a name="l08539"></a><span class="lineno"> 8539</span>&#160;            json.BeginString();</div>
+<div class="line"><a name="l08540"></a><span class="lineno"> 8540</span>&#160;            json.ContinueString_Pointer(m_pUserData);</div>
+<div class="line"><a name="l08541"></a><span class="lineno"> 8541</span>&#160;            json.EndString();</div>
+<div class="line"><a name="l08542"></a><span class="lineno"> 8542</span>&#160;        }</div>
+<div class="line"><a name="l08543"></a><span class="lineno"> 8543</span>&#160;    }</div>
+<div class="line"><a name="l08544"></a><span class="lineno"> 8544</span>&#160; </div>
+<div class="line"><a name="l08545"></a><span class="lineno"> 8545</span>&#160;    json.WriteString(<span class="stringliteral">&quot;CreationFrameIndex&quot;</span>);</div>
+<div class="line"><a name="l08546"></a><span class="lineno"> 8546</span>&#160;    json.WriteNumber(m_CreationFrameIndex);</div>
+<div class="line"><a name="l08547"></a><span class="lineno"> 8547</span>&#160; </div>
+<div class="line"><a name="l08548"></a><span class="lineno"> 8548</span>&#160;    json.WriteString(<span class="stringliteral">&quot;LastUseFrameIndex&quot;</span>);</div>
+<div class="line"><a name="l08549"></a><span class="lineno"> 8549</span>&#160;    json.WriteNumber(GetLastUseFrameIndex());</div>
 <div class="line"><a name="l08550"></a><span class="lineno"> 8550</span>&#160; </div>
-<div class="line"><a name="l08551"></a><span class="lineno"> 8551</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Type&quot;</span>);</div>
-<div class="line"><a name="l08552"></a><span class="lineno"> 8552</span>&#160;    json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[VMA_SUBALLOCATION_TYPE_FREE]);</div>
-<div class="line"><a name="l08553"></a><span class="lineno"> 8553</span>&#160; </div>
-<div class="line"><a name="l08554"></a><span class="lineno"> 8554</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Size&quot;</span>);</div>
-<div class="line"><a name="l08555"></a><span class="lineno"> 8555</span>&#160;    json.WriteNumber(size);</div>
-<div class="line"><a name="l08556"></a><span class="lineno"> 8556</span>&#160; </div>
-<div class="line"><a name="l08557"></a><span class="lineno"> 8557</span>&#160;    json.EndObject();</div>
-<div class="line"><a name="l08558"></a><span class="lineno"> 8558</span>&#160;}</div>
+<div class="line"><a name="l08551"></a><span class="lineno"> 8551</span>&#160;    <span class="keywordflow">if</span>(m_BufferImageUsage != 0)</div>
+<div class="line"><a name="l08552"></a><span class="lineno"> 8552</span>&#160;    {</div>
+<div class="line"><a name="l08553"></a><span class="lineno"> 8553</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Usage&quot;</span>);</div>
+<div class="line"><a name="l08554"></a><span class="lineno"> 8554</span>&#160;        json.WriteNumber(m_BufferImageUsage);</div>
+<div class="line"><a name="l08555"></a><span class="lineno"> 8555</span>&#160;    }</div>
+<div class="line"><a name="l08556"></a><span class="lineno"> 8556</span>&#160;}</div>
+<div class="line"><a name="l08557"></a><span class="lineno"> 8557</span>&#160; </div>
+<div class="line"><a name="l08558"></a><span class="lineno"> 8558</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l08559"></a><span class="lineno"> 8559</span>&#160; </div>
-<div class="line"><a name="l08560"></a><span class="lineno"> 8560</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata::PrintDetailedMap_End(<span class="keyword">class</span> VmaJsonWriter&amp; json)<span class="keyword"> const</span></div>
-<div class="line"><a name="l08561"></a><span class="lineno"> 8561</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08562"></a><span class="lineno"> 8562</span>&#160;    json.EndArray();</div>
-<div class="line"><a name="l08563"></a><span class="lineno"> 8563</span>&#160;    json.EndObject();</div>
-<div class="line"><a name="l08564"></a><span class="lineno"> 8564</span>&#160;}</div>
-<div class="line"><a name="l08565"></a><span class="lineno"> 8565</span>&#160; </div>
-<div class="line"><a name="l08566"></a><span class="lineno"> 8566</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l08567"></a><span class="lineno"> 8567</span>&#160; </div>
-<div class="line"><a name="l08569"></a><span class="lineno"> 8569</span>&#160;<span class="comment">// class VmaBlockMetadata_Generic</span></div>
+<div class="line"><a name="l08560"></a><span class="lineno"> 8560</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::FreeUserDataString(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator)</div>
+<div class="line"><a name="l08561"></a><span class="lineno"> 8561</span>&#160;{</div>
+<div class="line"><a name="l08562"></a><span class="lineno"> 8562</span>&#160;    VMA_ASSERT(IsUserDataString());</div>
+<div class="line"><a name="l08563"></a><span class="lineno"> 8563</span>&#160;    VmaFreeString(hAllocator-&gt;GetAllocationCallbacks(), (<span class="keywordtype">char</span>*)m_pUserData);</div>
+<div class="line"><a name="l08564"></a><span class="lineno"> 8564</span>&#160;    m_pUserData = VMA_NULL;</div>
+<div class="line"><a name="l08565"></a><span class="lineno"> 8565</span>&#160;}</div>
+<div class="line"><a name="l08566"></a><span class="lineno"> 8566</span>&#160; </div>
+<div class="line"><a name="l08567"></a><span class="lineno"> 8567</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::BlockAllocMap()</div>
+<div class="line"><a name="l08568"></a><span class="lineno"> 8568</span>&#160;{</div>
+<div class="line"><a name="l08569"></a><span class="lineno"> 8569</span>&#160;    VMA_ASSERT(GetType() == ALLOCATION_TYPE_BLOCK);</div>
 <div class="line"><a name="l08570"></a><span class="lineno"> 8570</span>&#160; </div>
-<div class="line"><a name="l08571"></a><span class="lineno"> 8571</span>&#160;VmaBlockMetadata_Generic::VmaBlockMetadata_Generic(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator) :</div>
-<div class="line"><a name="l08572"></a><span class="lineno"> 8572</span>&#160;    VmaBlockMetadata(hAllocator),</div>
-<div class="line"><a name="l08573"></a><span class="lineno"> 8573</span>&#160;    m_FreeCount(0),</div>
-<div class="line"><a name="l08574"></a><span class="lineno"> 8574</span>&#160;    m_SumFreeSize(0),</div>
-<div class="line"><a name="l08575"></a><span class="lineno"> 8575</span>&#160;    m_Suballocations(VmaStlAllocator&lt;VmaSuballocation&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
-<div class="line"><a name="l08576"></a><span class="lineno"> 8576</span>&#160;    m_FreeSuballocationsBySize(VmaStlAllocator&lt;VmaSuballocationList::iterator&gt;(hAllocator-&gt;GetAllocationCallbacks()))</div>
-<div class="line"><a name="l08577"></a><span class="lineno"> 8577</span>&#160;{</div>
-<div class="line"><a name="l08578"></a><span class="lineno"> 8578</span>&#160;}</div>
-<div class="line"><a name="l08579"></a><span class="lineno"> 8579</span>&#160; </div>
-<div class="line"><a name="l08580"></a><span class="lineno"> 8580</span>&#160;VmaBlockMetadata_Generic::~VmaBlockMetadata_Generic()</div>
-<div class="line"><a name="l08581"></a><span class="lineno"> 8581</span>&#160;{</div>
-<div class="line"><a name="l08582"></a><span class="lineno"> 8582</span>&#160;}</div>
-<div class="line"><a name="l08583"></a><span class="lineno"> 8583</span>&#160; </div>
-<div class="line"><a name="l08584"></a><span class="lineno"> 8584</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::Init(VkDeviceSize size)</div>
-<div class="line"><a name="l08585"></a><span class="lineno"> 8585</span>&#160;{</div>
-<div class="line"><a name="l08586"></a><span class="lineno"> 8586</span>&#160;    VmaBlockMetadata::Init(size);</div>
-<div class="line"><a name="l08587"></a><span class="lineno"> 8587</span>&#160; </div>
-<div class="line"><a name="l08588"></a><span class="lineno"> 8588</span>&#160;    m_FreeCount = 1;</div>
-<div class="line"><a name="l08589"></a><span class="lineno"> 8589</span>&#160;    m_SumFreeSize = size;</div>
-<div class="line"><a name="l08590"></a><span class="lineno"> 8590</span>&#160; </div>
-<div class="line"><a name="l08591"></a><span class="lineno"> 8591</span>&#160;    VmaSuballocation suballoc = {};</div>
-<div class="line"><a name="l08592"></a><span class="lineno"> 8592</span>&#160;    suballoc.offset = 0;</div>
-<div class="line"><a name="l08593"></a><span class="lineno"> 8593</span>&#160;    suballoc.size = size;</div>
-<div class="line"><a name="l08594"></a><span class="lineno"> 8594</span>&#160;    suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
-<div class="line"><a name="l08595"></a><span class="lineno"> 8595</span>&#160;    suballoc.hAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l08596"></a><span class="lineno"> 8596</span>&#160; </div>
-<div class="line"><a name="l08597"></a><span class="lineno"> 8597</span>&#160;    VMA_ASSERT(size &gt; VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER);</div>
-<div class="line"><a name="l08598"></a><span class="lineno"> 8598</span>&#160;    m_Suballocations.push_back(suballoc);</div>
-<div class="line"><a name="l08599"></a><span class="lineno"> 8599</span>&#160;    VmaSuballocationList::iterator suballocItem = m_Suballocations.end();</div>
-<div class="line"><a name="l08600"></a><span class="lineno"> 8600</span>&#160;    --suballocItem;</div>
-<div class="line"><a name="l08601"></a><span class="lineno"> 8601</span>&#160;    m_FreeSuballocationsBySize.push_back(suballocItem);</div>
-<div class="line"><a name="l08602"></a><span class="lineno"> 8602</span>&#160;}</div>
-<div class="line"><a name="l08603"></a><span class="lineno"> 8603</span>&#160; </div>
-<div class="line"><a name="l08604"></a><span class="lineno"> 8604</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::Validate()<span class="keyword"> const</span></div>
-<div class="line"><a name="l08605"></a><span class="lineno"> 8605</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08606"></a><span class="lineno"> 8606</span>&#160;    VMA_VALIDATE(!m_Suballocations.empty());</div>
-<div class="line"><a name="l08607"></a><span class="lineno"> 8607</span>&#160;    </div>
-<div class="line"><a name="l08608"></a><span class="lineno"> 8608</span>&#160;    <span class="comment">// Expected offset of new suballocation as calculated from previous ones.</span></div>
-<div class="line"><a name="l08609"></a><span class="lineno"> 8609</span>&#160;    VkDeviceSize calculatedOffset = 0;</div>
-<div class="line"><a name="l08610"></a><span class="lineno"> 8610</span>&#160;    <span class="comment">// Expected number of free suballocations as calculated from traversing their list.</span></div>
-<div class="line"><a name="l08611"></a><span class="lineno"> 8611</span>&#160;    uint32_t calculatedFreeCount = 0;</div>
-<div class="line"><a name="l08612"></a><span class="lineno"> 8612</span>&#160;    <span class="comment">// Expected sum size of free suballocations as calculated from traversing their list.</span></div>
-<div class="line"><a name="l08613"></a><span class="lineno"> 8613</span>&#160;    VkDeviceSize calculatedSumFreeSize = 0;</div>
-<div class="line"><a name="l08614"></a><span class="lineno"> 8614</span>&#160;    <span class="comment">// Expected number of free suballocations that should be registered in</span></div>
-<div class="line"><a name="l08615"></a><span class="lineno"> 8615</span>&#160;    <span class="comment">// m_FreeSuballocationsBySize calculated from traversing their list.</span></div>
-<div class="line"><a name="l08616"></a><span class="lineno"> 8616</span>&#160;    <span class="keywordtype">size_t</span> freeSuballocationsToRegister = 0;</div>
-<div class="line"><a name="l08617"></a><span class="lineno"> 8617</span>&#160;    <span class="comment">// True if previous visited suballocation was free.</span></div>
-<div class="line"><a name="l08618"></a><span class="lineno"> 8618</span>&#160;    <span class="keywordtype">bool</span> prevFree = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l08619"></a><span class="lineno"> 8619</span>&#160; </div>
-<div class="line"><a name="l08620"></a><span class="lineno"> 8620</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();</div>
-<div class="line"><a name="l08621"></a><span class="lineno"> 8621</span>&#160;        suballocItem != m_Suballocations.cend();</div>
-<div class="line"><a name="l08622"></a><span class="lineno"> 8622</span>&#160;        ++suballocItem)</div>
-<div class="line"><a name="l08623"></a><span class="lineno"> 8623</span>&#160;    {</div>
-<div class="line"><a name="l08624"></a><span class="lineno"> 8624</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; subAlloc = *suballocItem;</div>
-<div class="line"><a name="l08625"></a><span class="lineno"> 8625</span>&#160;        </div>
-<div class="line"><a name="l08626"></a><span class="lineno"> 8626</span>&#160;        <span class="comment">// Actual offset of this suballocation doesn&#39;t match expected one.</span></div>
-<div class="line"><a name="l08627"></a><span class="lineno"> 8627</span>&#160;        VMA_VALIDATE(subAlloc.offset == calculatedOffset);</div>
-<div class="line"><a name="l08628"></a><span class="lineno"> 8628</span>&#160; </div>
-<div class="line"><a name="l08629"></a><span class="lineno"> 8629</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">bool</span> currFree = (subAlloc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l08630"></a><span class="lineno"> 8630</span>&#160;        <span class="comment">// Two adjacent free suballocations are invalid. They should be merged.</span></div>
-<div class="line"><a name="l08631"></a><span class="lineno"> 8631</span>&#160;        VMA_VALIDATE(!prevFree || !currFree);</div>
-<div class="line"><a name="l08632"></a><span class="lineno"> 8632</span>&#160; </div>
-<div class="line"><a name="l08633"></a><span class="lineno"> 8633</span>&#160;        VMA_VALIDATE(currFree == (subAlloc.hAllocation == VK_NULL_HANDLE));</div>
-<div class="line"><a name="l08634"></a><span class="lineno"> 8634</span>&#160; </div>
-<div class="line"><a name="l08635"></a><span class="lineno"> 8635</span>&#160;        <span class="keywordflow">if</span>(currFree)</div>
-<div class="line"><a name="l08636"></a><span class="lineno"> 8636</span>&#160;        {</div>
-<div class="line"><a name="l08637"></a><span class="lineno"> 8637</span>&#160;            calculatedSumFreeSize += subAlloc.size;</div>
-<div class="line"><a name="l08638"></a><span class="lineno"> 8638</span>&#160;            ++calculatedFreeCount;</div>
-<div class="line"><a name="l08639"></a><span class="lineno"> 8639</span>&#160;            <span class="keywordflow">if</span>(subAlloc.size &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
-<div class="line"><a name="l08640"></a><span class="lineno"> 8640</span>&#160;            {</div>
-<div class="line"><a name="l08641"></a><span class="lineno"> 8641</span>&#160;                ++freeSuballocationsToRegister;</div>
-<div class="line"><a name="l08642"></a><span class="lineno"> 8642</span>&#160;            }</div>
-<div class="line"><a name="l08643"></a><span class="lineno"> 8643</span>&#160; </div>
-<div class="line"><a name="l08644"></a><span class="lineno"> 8644</span>&#160;            <span class="comment">// Margin required between allocations - every free space must be at least that large.</span></div>
-<div class="line"><a name="l08645"></a><span class="lineno"> 8645</span>&#160;            VMA_VALIDATE(subAlloc.size &gt;= VMA_DEBUG_MARGIN);</div>
-<div class="line"><a name="l08646"></a><span class="lineno"> 8646</span>&#160;        }</div>
-<div class="line"><a name="l08647"></a><span class="lineno"> 8647</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08648"></a><span class="lineno"> 8648</span>&#160;        {</div>
-<div class="line"><a name="l08649"></a><span class="lineno"> 8649</span>&#160;            VMA_VALIDATE(subAlloc.hAllocation-&gt;GetOffset() == subAlloc.offset);</div>
-<div class="line"><a name="l08650"></a><span class="lineno"> 8650</span>&#160;            VMA_VALIDATE(subAlloc.hAllocation-&gt;GetSize() == subAlloc.size);</div>
-<div class="line"><a name="l08651"></a><span class="lineno"> 8651</span>&#160; </div>
-<div class="line"><a name="l08652"></a><span class="lineno"> 8652</span>&#160;            <span class="comment">// Margin required between allocations - previous allocation must be free.</span></div>
-<div class="line"><a name="l08653"></a><span class="lineno"> 8653</span>&#160;            VMA_VALIDATE(VMA_DEBUG_MARGIN == 0 || prevFree);</div>
-<div class="line"><a name="l08654"></a><span class="lineno"> 8654</span>&#160;        }</div>
-<div class="line"><a name="l08655"></a><span class="lineno"> 8655</span>&#160; </div>
-<div class="line"><a name="l08656"></a><span class="lineno"> 8656</span>&#160;        calculatedOffset += subAlloc.size;</div>
-<div class="line"><a name="l08657"></a><span class="lineno"> 8657</span>&#160;        prevFree = currFree;</div>
-<div class="line"><a name="l08658"></a><span class="lineno"> 8658</span>&#160;    }</div>
-<div class="line"><a name="l08659"></a><span class="lineno"> 8659</span>&#160; </div>
-<div class="line"><a name="l08660"></a><span class="lineno"> 8660</span>&#160;    <span class="comment">// Number of free suballocations registered in m_FreeSuballocationsBySize doesn&#39;t</span></div>
-<div class="line"><a name="l08661"></a><span class="lineno"> 8661</span>&#160;    <span class="comment">// match expected one.</span></div>
-<div class="line"><a name="l08662"></a><span class="lineno"> 8662</span>&#160;    VMA_VALIDATE(m_FreeSuballocationsBySize.size() == freeSuballocationsToRegister);</div>
-<div class="line"><a name="l08663"></a><span class="lineno"> 8663</span>&#160; </div>
-<div class="line"><a name="l08664"></a><span class="lineno"> 8664</span>&#160;    VkDeviceSize lastSize = 0;</div>
-<div class="line"><a name="l08665"></a><span class="lineno"> 8665</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_FreeSuballocationsBySize.size(); ++i)</div>
-<div class="line"><a name="l08666"></a><span class="lineno"> 8666</span>&#160;    {</div>
-<div class="line"><a name="l08667"></a><span class="lineno"> 8667</span>&#160;        VmaSuballocationList::iterator suballocItem = m_FreeSuballocationsBySize[i];</div>
-<div class="line"><a name="l08668"></a><span class="lineno"> 8668</span>&#160;        </div>
-<div class="line"><a name="l08669"></a><span class="lineno"> 8669</span>&#160;        <span class="comment">// Only free suballocations can be registered in m_FreeSuballocationsBySize.</span></div>
-<div class="line"><a name="l08670"></a><span class="lineno"> 8670</span>&#160;        VMA_VALIDATE(suballocItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l08671"></a><span class="lineno"> 8671</span>&#160;        <span class="comment">// They must be sorted by size ascending.</span></div>
-<div class="line"><a name="l08672"></a><span class="lineno"> 8672</span>&#160;        VMA_VALIDATE(suballocItem-&gt;size &gt;= lastSize);</div>
+<div class="line"><a name="l08571"></a><span class="lineno"> 8571</span>&#160;    <span class="keywordflow">if</span>((m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP) &lt; 0x7F)</div>
+<div class="line"><a name="l08572"></a><span class="lineno"> 8572</span>&#160;    {</div>
+<div class="line"><a name="l08573"></a><span class="lineno"> 8573</span>&#160;        ++m_MapCount;</div>
+<div class="line"><a name="l08574"></a><span class="lineno"> 8574</span>&#160;    }</div>
+<div class="line"><a name="l08575"></a><span class="lineno"> 8575</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08576"></a><span class="lineno"> 8576</span>&#160;    {</div>
+<div class="line"><a name="l08577"></a><span class="lineno"> 8577</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Allocation mapped too many times simultaneously.&quot;</span>);</div>
+<div class="line"><a name="l08578"></a><span class="lineno"> 8578</span>&#160;    }</div>
+<div class="line"><a name="l08579"></a><span class="lineno"> 8579</span>&#160;}</div>
+<div class="line"><a name="l08580"></a><span class="lineno"> 8580</span>&#160; </div>
+<div class="line"><a name="l08581"></a><span class="lineno"> 8581</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::BlockAllocUnmap()</div>
+<div class="line"><a name="l08582"></a><span class="lineno"> 8582</span>&#160;{</div>
+<div class="line"><a name="l08583"></a><span class="lineno"> 8583</span>&#160;    VMA_ASSERT(GetType() == ALLOCATION_TYPE_BLOCK);</div>
+<div class="line"><a name="l08584"></a><span class="lineno"> 8584</span>&#160; </div>
+<div class="line"><a name="l08585"></a><span class="lineno"> 8585</span>&#160;    <span class="keywordflow">if</span>((m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP) != 0)</div>
+<div class="line"><a name="l08586"></a><span class="lineno"> 8586</span>&#160;    {</div>
+<div class="line"><a name="l08587"></a><span class="lineno"> 8587</span>&#160;        --m_MapCount;</div>
+<div class="line"><a name="l08588"></a><span class="lineno"> 8588</span>&#160;    }</div>
+<div class="line"><a name="l08589"></a><span class="lineno"> 8589</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08590"></a><span class="lineno"> 8590</span>&#160;    {</div>
+<div class="line"><a name="l08591"></a><span class="lineno"> 8591</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Unmapping allocation not previously mapped.&quot;</span>);</div>
+<div class="line"><a name="l08592"></a><span class="lineno"> 8592</span>&#160;    }</div>
+<div class="line"><a name="l08593"></a><span class="lineno"> 8593</span>&#160;}</div>
+<div class="line"><a name="l08594"></a><span class="lineno"> 8594</span>&#160; </div>
+<div class="line"><a name="l08595"></a><span class="lineno"> 8595</span>&#160;VkResult VmaAllocation_T::DedicatedAllocMap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>** ppData)</div>
+<div class="line"><a name="l08596"></a><span class="lineno"> 8596</span>&#160;{</div>
+<div class="line"><a name="l08597"></a><span class="lineno"> 8597</span>&#160;    VMA_ASSERT(GetType() == ALLOCATION_TYPE_DEDICATED);</div>
+<div class="line"><a name="l08598"></a><span class="lineno"> 8598</span>&#160; </div>
+<div class="line"><a name="l08599"></a><span class="lineno"> 8599</span>&#160;    <span class="keywordflow">if</span>(m_MapCount != 0)</div>
+<div class="line"><a name="l08600"></a><span class="lineno"> 8600</span>&#160;    {</div>
+<div class="line"><a name="l08601"></a><span class="lineno"> 8601</span>&#160;        <span class="keywordflow">if</span>((m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP) &lt; 0x7F)</div>
+<div class="line"><a name="l08602"></a><span class="lineno"> 8602</span>&#160;        {</div>
+<div class="line"><a name="l08603"></a><span class="lineno"> 8603</span>&#160;            VMA_ASSERT(m_DedicatedAllocation.m_pMappedData != VMA_NULL);</div>
+<div class="line"><a name="l08604"></a><span class="lineno"> 8604</span>&#160;            *ppData = m_DedicatedAllocation.m_pMappedData;</div>
+<div class="line"><a name="l08605"></a><span class="lineno"> 8605</span>&#160;            ++m_MapCount;</div>
+<div class="line"><a name="l08606"></a><span class="lineno"> 8606</span>&#160;            <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l08607"></a><span class="lineno"> 8607</span>&#160;        }</div>
+<div class="line"><a name="l08608"></a><span class="lineno"> 8608</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08609"></a><span class="lineno"> 8609</span>&#160;        {</div>
+<div class="line"><a name="l08610"></a><span class="lineno"> 8610</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Dedicated allocation mapped too many times simultaneously.&quot;</span>);</div>
+<div class="line"><a name="l08611"></a><span class="lineno"> 8611</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_MEMORY_MAP_FAILED;</div>
+<div class="line"><a name="l08612"></a><span class="lineno"> 8612</span>&#160;        }</div>
+<div class="line"><a name="l08613"></a><span class="lineno"> 8613</span>&#160;    }</div>
+<div class="line"><a name="l08614"></a><span class="lineno"> 8614</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08615"></a><span class="lineno"> 8615</span>&#160;    {</div>
+<div class="line"><a name="l08616"></a><span class="lineno"> 8616</span>&#160;        VkResult result = (*hAllocator-&gt;GetVulkanFunctions().vkMapMemory)(</div>
+<div class="line"><a name="l08617"></a><span class="lineno"> 8617</span>&#160;            hAllocator-&gt;m_hDevice,</div>
+<div class="line"><a name="l08618"></a><span class="lineno"> 8618</span>&#160;            m_DedicatedAllocation.m_hMemory,</div>
+<div class="line"><a name="l08619"></a><span class="lineno"> 8619</span>&#160;            0, <span class="comment">// offset</span></div>
+<div class="line"><a name="l08620"></a><span class="lineno"> 8620</span>&#160;            VK_WHOLE_SIZE,</div>
+<div class="line"><a name="l08621"></a><span class="lineno"> 8621</span>&#160;            0, <span class="comment">// flags</span></div>
+<div class="line"><a name="l08622"></a><span class="lineno"> 8622</span>&#160;            ppData);</div>
+<div class="line"><a name="l08623"></a><span class="lineno"> 8623</span>&#160;        <span class="keywordflow">if</span>(result == VK_SUCCESS)</div>
+<div class="line"><a name="l08624"></a><span class="lineno"> 8624</span>&#160;        {</div>
+<div class="line"><a name="l08625"></a><span class="lineno"> 8625</span>&#160;            m_DedicatedAllocation.m_pMappedData = *ppData;</div>
+<div class="line"><a name="l08626"></a><span class="lineno"> 8626</span>&#160;            m_MapCount = 1;</div>
+<div class="line"><a name="l08627"></a><span class="lineno"> 8627</span>&#160;        }</div>
+<div class="line"><a name="l08628"></a><span class="lineno"> 8628</span>&#160;        <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l08629"></a><span class="lineno"> 8629</span>&#160;    }</div>
+<div class="line"><a name="l08630"></a><span class="lineno"> 8630</span>&#160;}</div>
+<div class="line"><a name="l08631"></a><span class="lineno"> 8631</span>&#160; </div>
+<div class="line"><a name="l08632"></a><span class="lineno"> 8632</span>&#160;<span class="keywordtype">void</span> VmaAllocation_T::DedicatedAllocUnmap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator)</div>
+<div class="line"><a name="l08633"></a><span class="lineno"> 8633</span>&#160;{</div>
+<div class="line"><a name="l08634"></a><span class="lineno"> 8634</span>&#160;    VMA_ASSERT(GetType() == ALLOCATION_TYPE_DEDICATED);</div>
+<div class="line"><a name="l08635"></a><span class="lineno"> 8635</span>&#160; </div>
+<div class="line"><a name="l08636"></a><span class="lineno"> 8636</span>&#160;    <span class="keywordflow">if</span>((m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP) != 0)</div>
+<div class="line"><a name="l08637"></a><span class="lineno"> 8637</span>&#160;    {</div>
+<div class="line"><a name="l08638"></a><span class="lineno"> 8638</span>&#160;        --m_MapCount;</div>
+<div class="line"><a name="l08639"></a><span class="lineno"> 8639</span>&#160;        <span class="keywordflow">if</span>(m_MapCount == 0)</div>
+<div class="line"><a name="l08640"></a><span class="lineno"> 8640</span>&#160;        {</div>
+<div class="line"><a name="l08641"></a><span class="lineno"> 8641</span>&#160;            m_DedicatedAllocation.m_pMappedData = VMA_NULL;</div>
+<div class="line"><a name="l08642"></a><span class="lineno"> 8642</span>&#160;            (*hAllocator-&gt;GetVulkanFunctions().vkUnmapMemory)(</div>
+<div class="line"><a name="l08643"></a><span class="lineno"> 8643</span>&#160;                hAllocator-&gt;m_hDevice,</div>
+<div class="line"><a name="l08644"></a><span class="lineno"> 8644</span>&#160;                m_DedicatedAllocation.m_hMemory);</div>
+<div class="line"><a name="l08645"></a><span class="lineno"> 8645</span>&#160;        }</div>
+<div class="line"><a name="l08646"></a><span class="lineno"> 8646</span>&#160;    }</div>
+<div class="line"><a name="l08647"></a><span class="lineno"> 8647</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08648"></a><span class="lineno"> 8648</span>&#160;    {</div>
+<div class="line"><a name="l08649"></a><span class="lineno"> 8649</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Unmapping dedicated allocation not previously mapped.&quot;</span>);</div>
+<div class="line"><a name="l08650"></a><span class="lineno"> 8650</span>&#160;    }</div>
+<div class="line"><a name="l08651"></a><span class="lineno"> 8651</span>&#160;}</div>
+<div class="line"><a name="l08652"></a><span class="lineno"> 8652</span>&#160; </div>
+<div class="line"><a name="l08653"></a><span class="lineno"> 8653</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l08654"></a><span class="lineno"> 8654</span>&#160; </div>
+<div class="line"><a name="l08655"></a><span class="lineno"> 8655</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaPrintStatInfo(VmaJsonWriter&amp; json, <span class="keyword">const</span> <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; stat)</div>
+<div class="line"><a name="l08656"></a><span class="lineno"> 8656</span>&#160;{</div>
+<div class="line"><a name="l08657"></a><span class="lineno"> 8657</span>&#160;    json.BeginObject();</div>
+<div class="line"><a name="l08658"></a><span class="lineno"> 8658</span>&#160; </div>
+<div class="line"><a name="l08659"></a><span class="lineno"> 8659</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Blocks&quot;</span>);</div>
+<div class="line"><a name="l08660"></a><span class="lineno"> 8660</span>&#160;    json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a>);</div>
+<div class="line"><a name="l08661"></a><span class="lineno"> 8661</span>&#160; </div>
+<div class="line"><a name="l08662"></a><span class="lineno"> 8662</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Allocations&quot;</span>);</div>
+<div class="line"><a name="l08663"></a><span class="lineno"> 8663</span>&#160;    json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>);</div>
+<div class="line"><a name="l08664"></a><span class="lineno"> 8664</span>&#160; </div>
+<div class="line"><a name="l08665"></a><span class="lineno"> 8665</span>&#160;    json.WriteString(<span class="stringliteral">&quot;UnusedRanges&quot;</span>);</div>
+<div class="line"><a name="l08666"></a><span class="lineno"> 8666</span>&#160;    json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>);</div>
+<div class="line"><a name="l08667"></a><span class="lineno"> 8667</span>&#160; </div>
+<div class="line"><a name="l08668"></a><span class="lineno"> 8668</span>&#160;    json.WriteString(<span class="stringliteral">&quot;UsedBytes&quot;</span>);</div>
+<div class="line"><a name="l08669"></a><span class="lineno"> 8669</span>&#160;    json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a>);</div>
+<div class="line"><a name="l08670"></a><span class="lineno"> 8670</span>&#160; </div>
+<div class="line"><a name="l08671"></a><span class="lineno"> 8671</span>&#160;    json.WriteString(<span class="stringliteral">&quot;UnusedBytes&quot;</span>);</div>
+<div class="line"><a name="l08672"></a><span class="lineno"> 8672</span>&#160;    json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>);</div>
 <div class="line"><a name="l08673"></a><span class="lineno"> 8673</span>&#160; </div>
-<div class="line"><a name="l08674"></a><span class="lineno"> 8674</span>&#160;        lastSize = suballocItem-&gt;size;</div>
-<div class="line"><a name="l08675"></a><span class="lineno"> 8675</span>&#160;    }</div>
-<div class="line"><a name="l08676"></a><span class="lineno"> 8676</span>&#160; </div>
-<div class="line"><a name="l08677"></a><span class="lineno"> 8677</span>&#160;    <span class="comment">// Check if totals match calculacted values.</span></div>
-<div class="line"><a name="l08678"></a><span class="lineno"> 8678</span>&#160;    VMA_VALIDATE(ValidateFreeSuballocationList());</div>
-<div class="line"><a name="l08679"></a><span class="lineno"> 8679</span>&#160;    VMA_VALIDATE(calculatedOffset == GetSize());</div>
-<div class="line"><a name="l08680"></a><span class="lineno"> 8680</span>&#160;    VMA_VALIDATE(calculatedSumFreeSize == m_SumFreeSize);</div>
-<div class="line"><a name="l08681"></a><span class="lineno"> 8681</span>&#160;    VMA_VALIDATE(calculatedFreeCount == m_FreeCount);</div>
-<div class="line"><a name="l08682"></a><span class="lineno"> 8682</span>&#160; </div>
-<div class="line"><a name="l08683"></a><span class="lineno"> 8683</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l08684"></a><span class="lineno"> 8684</span>&#160;}</div>
-<div class="line"><a name="l08685"></a><span class="lineno"> 8685</span>&#160; </div>
-<div class="line"><a name="l08686"></a><span class="lineno"> 8686</span>&#160;VkDeviceSize VmaBlockMetadata_Generic::GetUnusedRangeSizeMax()<span class="keyword"> const</span></div>
-<div class="line"><a name="l08687"></a><span class="lineno"> 8687</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08688"></a><span class="lineno"> 8688</span>&#160;    <span class="keywordflow">if</span>(!m_FreeSuballocationsBySize.empty())</div>
-<div class="line"><a name="l08689"></a><span class="lineno"> 8689</span>&#160;    {</div>
-<div class="line"><a name="l08690"></a><span class="lineno"> 8690</span>&#160;        <span class="keywordflow">return</span> m_FreeSuballocationsBySize.back()-&gt;size;</div>
-<div class="line"><a name="l08691"></a><span class="lineno"> 8691</span>&#160;    }</div>
-<div class="line"><a name="l08692"></a><span class="lineno"> 8692</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08693"></a><span class="lineno"> 8693</span>&#160;    {</div>
-<div class="line"><a name="l08694"></a><span class="lineno"> 8694</span>&#160;        <span class="keywordflow">return</span> 0;</div>
-<div class="line"><a name="l08695"></a><span class="lineno"> 8695</span>&#160;    }</div>
-<div class="line"><a name="l08696"></a><span class="lineno"> 8696</span>&#160;}</div>
-<div class="line"><a name="l08697"></a><span class="lineno"> 8697</span>&#160; </div>
-<div class="line"><a name="l08698"></a><span class="lineno"> 8698</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::IsEmpty()<span class="keyword"> const</span></div>
-<div class="line"><a name="l08699"></a><span class="lineno"> 8699</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08700"></a><span class="lineno"> 8700</span>&#160;    <span class="keywordflow">return</span> (m_Suballocations.size() == 1) &amp;&amp; (m_FreeCount == 1);</div>
+<div class="line"><a name="l08674"></a><span class="lineno"> 8674</span>&#160;    <span class="keywordflow">if</span>(stat.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> &gt; 1)</div>
+<div class="line"><a name="l08675"></a><span class="lineno"> 8675</span>&#160;    {</div>
+<div class="line"><a name="l08676"></a><span class="lineno"> 8676</span>&#160;        json.WriteString(<span class="stringliteral">&quot;AllocationSize&quot;</span>);</div>
+<div class="line"><a name="l08677"></a><span class="lineno"> 8677</span>&#160;        json.BeginObject(<span class="keyword">true</span>);</div>
+<div class="line"><a name="l08678"></a><span class="lineno"> 8678</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Min&quot;</span>);</div>
+<div class="line"><a name="l08679"></a><span class="lineno"> 8679</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>);</div>
+<div class="line"><a name="l08680"></a><span class="lineno"> 8680</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Avg&quot;</span>);</div>
+<div class="line"><a name="l08681"></a><span class="lineno"> 8681</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a1081a039964e566c672e7a2347f9e599">allocationSizeAvg</a>);</div>
+<div class="line"><a name="l08682"></a><span class="lineno"> 8682</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Max&quot;</span>);</div>
+<div class="line"><a name="l08683"></a><span class="lineno"> 8683</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>);</div>
+<div class="line"><a name="l08684"></a><span class="lineno"> 8684</span>&#160;        json.EndObject();</div>
+<div class="line"><a name="l08685"></a><span class="lineno"> 8685</span>&#160;    }</div>
+<div class="line"><a name="l08686"></a><span class="lineno"> 8686</span>&#160; </div>
+<div class="line"><a name="l08687"></a><span class="lineno"> 8687</span>&#160;    <span class="keywordflow">if</span>(stat.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> &gt; 1)</div>
+<div class="line"><a name="l08688"></a><span class="lineno"> 8688</span>&#160;    {</div>
+<div class="line"><a name="l08689"></a><span class="lineno"> 8689</span>&#160;        json.WriteString(<span class="stringliteral">&quot;UnusedRangeSize&quot;</span>);</div>
+<div class="line"><a name="l08690"></a><span class="lineno"> 8690</span>&#160;        json.BeginObject(<span class="keyword">true</span>);</div>
+<div class="line"><a name="l08691"></a><span class="lineno"> 8691</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Min&quot;</span>);</div>
+<div class="line"><a name="l08692"></a><span class="lineno"> 8692</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>);</div>
+<div class="line"><a name="l08693"></a><span class="lineno"> 8693</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Avg&quot;</span>);</div>
+<div class="line"><a name="l08694"></a><span class="lineno"> 8694</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a2f9b3452af90c9768a30b7fb6ae194fc">unusedRangeSizeAvg</a>);</div>
+<div class="line"><a name="l08695"></a><span class="lineno"> 8695</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Max&quot;</span>);</div>
+<div class="line"><a name="l08696"></a><span class="lineno"> 8696</span>&#160;        json.WriteNumber(stat.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>);</div>
+<div class="line"><a name="l08697"></a><span class="lineno"> 8697</span>&#160;        json.EndObject();</div>
+<div class="line"><a name="l08698"></a><span class="lineno"> 8698</span>&#160;    }</div>
+<div class="line"><a name="l08699"></a><span class="lineno"> 8699</span>&#160; </div>
+<div class="line"><a name="l08700"></a><span class="lineno"> 8700</span>&#160;    json.EndObject();</div>
 <div class="line"><a name="l08701"></a><span class="lineno"> 8701</span>&#160;}</div>
 <div class="line"><a name="l08702"></a><span class="lineno"> 8702</span>&#160; </div>
-<div class="line"><a name="l08703"></a><span class="lineno"> 8703</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo)<span class="keyword"> const</span></div>
-<div class="line"><a name="l08704"></a><span class="lineno"> 8704</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08705"></a><span class="lineno"> 8705</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> = 1;</div>
-<div class="line"><a name="l08706"></a><span class="lineno"> 8706</span>&#160; </div>
-<div class="line"><a name="l08707"></a><span class="lineno"> 8707</span>&#160;    <span class="keyword">const</span> uint32_t rangeCount = (uint32_t)m_Suballocations.size();</div>
-<div class="line"><a name="l08708"></a><span class="lineno"> 8708</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> = rangeCount - m_FreeCount;</div>
-<div class="line"><a name="l08709"></a><span class="lineno"> 8709</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> = m_FreeCount;</div>
-<div class="line"><a name="l08710"></a><span class="lineno"> 8710</span>&#160;    </div>
-<div class="line"><a name="l08711"></a><span class="lineno"> 8711</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> = m_SumFreeSize;</div>
-<div class="line"><a name="l08712"></a><span class="lineno"> 8712</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> = GetSize() - outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>;</div>
-<div class="line"><a name="l08713"></a><span class="lineno"> 8713</span>&#160; </div>
-<div class="line"><a name="l08714"></a><span class="lineno"> 8714</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = UINT64_MAX;</div>
-<div class="line"><a name="l08715"></a><span class="lineno"> 8715</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = 0;</div>
-<div class="line"><a name="l08716"></a><span class="lineno"> 8716</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = UINT64_MAX;</div>
-<div class="line"><a name="l08717"></a><span class="lineno"> 8717</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = 0;</div>
-<div class="line"><a name="l08718"></a><span class="lineno"> 8718</span>&#160; </div>
-<div class="line"><a name="l08719"></a><span class="lineno"> 8719</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();</div>
-<div class="line"><a name="l08720"></a><span class="lineno"> 8720</span>&#160;        suballocItem != m_Suballocations.cend();</div>
-<div class="line"><a name="l08721"></a><span class="lineno"> 8721</span>&#160;        ++suballocItem)</div>
-<div class="line"><a name="l08722"></a><span class="lineno"> 8722</span>&#160;    {</div>
-<div class="line"><a name="l08723"></a><span class="lineno"> 8723</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = *suballocItem;</div>
-<div class="line"><a name="l08724"></a><span class="lineno"> 8724</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l08725"></a><span class="lineno"> 8725</span>&#160;        {</div>
-<div class="line"><a name="l08726"></a><span class="lineno"> 8726</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, suballoc.size);</div>
-<div class="line"><a name="l08727"></a><span class="lineno"> 8727</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, suballoc.size);</div>
-<div class="line"><a name="l08728"></a><span class="lineno"> 8728</span>&#160;        }</div>
-<div class="line"><a name="l08729"></a><span class="lineno"> 8729</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08730"></a><span class="lineno"> 8730</span>&#160;        {</div>
-<div class="line"><a name="l08731"></a><span class="lineno"> 8731</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, suballoc.size);</div>
-<div class="line"><a name="l08732"></a><span class="lineno"> 8732</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, suballoc.size);</div>
-<div class="line"><a name="l08733"></a><span class="lineno"> 8733</span>&#160;        }</div>
-<div class="line"><a name="l08734"></a><span class="lineno"> 8734</span>&#160;    }</div>
-<div class="line"><a name="l08735"></a><span class="lineno"> 8735</span>&#160;}</div>
-<div class="line"><a name="l08736"></a><span class="lineno"> 8736</span>&#160; </div>
-<div class="line"><a name="l08737"></a><span class="lineno"> 8737</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats)<span class="keyword"> const</span></div>
-<div class="line"><a name="l08738"></a><span class="lineno"> 8738</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08739"></a><span class="lineno"> 8739</span>&#160;    <span class="keyword">const</span> uint32_t rangeCount = (uint32_t)m_Suballocations.size();</div>
-<div class="line"><a name="l08740"></a><span class="lineno"> 8740</span>&#160; </div>
-<div class="line"><a name="l08741"></a><span class="lineno"> 8741</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a> += GetSize();</div>
-<div class="line"><a name="l08742"></a><span class="lineno"> 8742</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += m_SumFreeSize;</div>
-<div class="line"><a name="l08743"></a><span class="lineno"> 8743</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a> += rangeCount - m_FreeCount;</div>
-<div class="line"><a name="l08744"></a><span class="lineno"> 8744</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a> += m_FreeCount;</div>
-<div class="line"><a name="l08745"></a><span class="lineno"> 8745</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, GetUnusedRangeSizeMax());</div>
-<div class="line"><a name="l08746"></a><span class="lineno"> 8746</span>&#160;}</div>
-<div class="line"><a name="l08747"></a><span class="lineno"> 8747</span>&#160; </div>
-<div class="line"><a name="l08748"></a><span class="lineno"> 8748</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l08749"></a><span class="lineno"> 8749</span>&#160; </div>
-<div class="line"><a name="l08750"></a><span class="lineno"> 8750</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json)<span class="keyword"> const</span></div>
-<div class="line"><a name="l08751"></a><span class="lineno"> 8751</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l08752"></a><span class="lineno"> 8752</span>&#160;    PrintDetailedMap_Begin(json,</div>
-<div class="line"><a name="l08753"></a><span class="lineno"> 8753</span>&#160;        m_SumFreeSize, <span class="comment">// unusedBytes</span></div>
-<div class="line"><a name="l08754"></a><span class="lineno"> 8754</span>&#160;        m_Suballocations.size() - (<span class="keywordtype">size_t</span>)m_FreeCount, <span class="comment">// allocationCount</span></div>
-<div class="line"><a name="l08755"></a><span class="lineno"> 8755</span>&#160;        m_FreeCount); <span class="comment">// unusedRangeCount</span></div>
-<div class="line"><a name="l08756"></a><span class="lineno"> 8756</span>&#160; </div>
-<div class="line"><a name="l08757"></a><span class="lineno"> 8757</span>&#160;    <span class="keywordtype">size_t</span> i = 0;</div>
-<div class="line"><a name="l08758"></a><span class="lineno"> 8758</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();</div>
-<div class="line"><a name="l08759"></a><span class="lineno"> 8759</span>&#160;        suballocItem != m_Suballocations.cend();</div>
-<div class="line"><a name="l08760"></a><span class="lineno"> 8760</span>&#160;        ++suballocItem, ++i)</div>
-<div class="line"><a name="l08761"></a><span class="lineno"> 8761</span>&#160;    {</div>
-<div class="line"><a name="l08762"></a><span class="lineno"> 8762</span>&#160;        <span class="keywordflow">if</span>(suballocItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l08763"></a><span class="lineno"> 8763</span>&#160;        {</div>
-<div class="line"><a name="l08764"></a><span class="lineno"> 8764</span>&#160;            PrintDetailedMap_UnusedRange(json, suballocItem-&gt;offset, suballocItem-&gt;size);</div>
-<div class="line"><a name="l08765"></a><span class="lineno"> 8765</span>&#160;        }</div>
-<div class="line"><a name="l08766"></a><span class="lineno"> 8766</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08767"></a><span class="lineno"> 8767</span>&#160;        {</div>
-<div class="line"><a name="l08768"></a><span class="lineno"> 8768</span>&#160;            PrintDetailedMap_Allocation(json, suballocItem-&gt;offset, suballocItem-&gt;hAllocation);</div>
-<div class="line"><a name="l08769"></a><span class="lineno"> 8769</span>&#160;        }</div>
-<div class="line"><a name="l08770"></a><span class="lineno"> 8770</span>&#160;    }</div>
-<div class="line"><a name="l08771"></a><span class="lineno"> 8771</span>&#160; </div>
-<div class="line"><a name="l08772"></a><span class="lineno"> 8772</span>&#160;    PrintDetailedMap_End(json);</div>
-<div class="line"><a name="l08773"></a><span class="lineno"> 8773</span>&#160;}</div>
-<div class="line"><a name="l08774"></a><span class="lineno"> 8774</span>&#160; </div>
-<div class="line"><a name="l08775"></a><span class="lineno"> 8775</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l08776"></a><span class="lineno"> 8776</span>&#160; </div>
-<div class="line"><a name="l08777"></a><span class="lineno"> 8777</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::CreateAllocationRequest(</div>
-<div class="line"><a name="l08778"></a><span class="lineno"> 8778</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l08779"></a><span class="lineno"> 8779</span>&#160;    uint32_t frameInUseCount,</div>
-<div class="line"><a name="l08780"></a><span class="lineno"> 8780</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l08781"></a><span class="lineno"> 8781</span>&#160;    VkDeviceSize allocSize,</div>
-<div class="line"><a name="l08782"></a><span class="lineno"> 8782</span>&#160;    VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l08783"></a><span class="lineno"> 8783</span>&#160;    <span class="keywordtype">bool</span> upperAddress,</div>
-<div class="line"><a name="l08784"></a><span class="lineno"> 8784</span>&#160;    VmaSuballocationType allocType,</div>
-<div class="line"><a name="l08785"></a><span class="lineno"> 8785</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l08786"></a><span class="lineno"> 8786</span>&#160;    uint32_t strategy,</div>
-<div class="line"><a name="l08787"></a><span class="lineno"> 8787</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
-<div class="line"><a name="l08788"></a><span class="lineno"> 8788</span>&#160;{</div>
-<div class="line"><a name="l08789"></a><span class="lineno"> 8789</span>&#160;    VMA_ASSERT(allocSize &gt; 0);</div>
-<div class="line"><a name="l08790"></a><span class="lineno"> 8790</span>&#160;    VMA_ASSERT(!upperAddress);</div>
-<div class="line"><a name="l08791"></a><span class="lineno"> 8791</span>&#160;    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l08792"></a><span class="lineno"> 8792</span>&#160;    VMA_ASSERT(pAllocationRequest != VMA_NULL);</div>
-<div class="line"><a name="l08793"></a><span class="lineno"> 8793</span>&#160;    VMA_HEAVY_ASSERT(Validate());</div>
-<div class="line"><a name="l08794"></a><span class="lineno"> 8794</span>&#160; </div>
-<div class="line"><a name="l08795"></a><span class="lineno"> 8795</span>&#160;    pAllocationRequest-&gt;type = VmaAllocationRequestType::Normal;</div>
-<div class="line"><a name="l08796"></a><span class="lineno"> 8796</span>&#160; </div>
-<div class="line"><a name="l08797"></a><span class="lineno"> 8797</span>&#160;    <span class="comment">// There is not enough total free space in this block to fullfill the request: Early return.</span></div>
-<div class="line"><a name="l08798"></a><span class="lineno"> 8798</span>&#160;    <span class="keywordflow">if</span>(canMakeOtherLost == <span class="keyword">false</span> &amp;&amp;</div>
-<div class="line"><a name="l08799"></a><span class="lineno"> 8799</span>&#160;        m_SumFreeSize &lt; allocSize + 2 * VMA_DEBUG_MARGIN)</div>
-<div class="line"><a name="l08800"></a><span class="lineno"> 8800</span>&#160;    {</div>
-<div class="line"><a name="l08801"></a><span class="lineno"> 8801</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l08802"></a><span class="lineno"> 8802</span>&#160;    }</div>
-<div class="line"><a name="l08803"></a><span class="lineno"> 8803</span>&#160; </div>
-<div class="line"><a name="l08804"></a><span class="lineno"> 8804</span>&#160;    <span class="comment">// New algorithm, efficiently searching freeSuballocationsBySize.</span></div>
-<div class="line"><a name="l08805"></a><span class="lineno"> 8805</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> freeSuballocCount = m_FreeSuballocationsBySize.size();</div>
-<div class="line"><a name="l08806"></a><span class="lineno"> 8806</span>&#160;    <span class="keywordflow">if</span>(freeSuballocCount &gt; 0)</div>
-<div class="line"><a name="l08807"></a><span class="lineno"> 8807</span>&#160;    {</div>
-<div class="line"><a name="l08808"></a><span class="lineno"> 8808</span>&#160;        <span class="keywordflow">if</span>(strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>)</div>
-<div class="line"><a name="l08809"></a><span class="lineno"> 8809</span>&#160;        {</div>
-<div class="line"><a name="l08810"></a><span class="lineno"> 8810</span>&#160;            <span class="comment">// Find first free suballocation with size not less than allocSize + 2 * VMA_DEBUG_MARGIN.</span></div>
-<div class="line"><a name="l08811"></a><span class="lineno"> 8811</span>&#160;            VmaSuballocationList::iterator* <span class="keyword">const</span> it = VmaBinaryFindFirstNotLess(</div>
-<div class="line"><a name="l08812"></a><span class="lineno"> 8812</span>&#160;                m_FreeSuballocationsBySize.data(),</div>
-<div class="line"><a name="l08813"></a><span class="lineno"> 8813</span>&#160;                m_FreeSuballocationsBySize.data() + freeSuballocCount,</div>
-<div class="line"><a name="l08814"></a><span class="lineno"> 8814</span>&#160;                allocSize + 2 * VMA_DEBUG_MARGIN,</div>
-<div class="line"><a name="l08815"></a><span class="lineno"> 8815</span>&#160;                VmaSuballocationItemSizeLess());</div>
-<div class="line"><a name="l08816"></a><span class="lineno"> 8816</span>&#160;            <span class="keywordtype">size_t</span> index = it - m_FreeSuballocationsBySize.data();</div>
-<div class="line"><a name="l08817"></a><span class="lineno"> 8817</span>&#160;            <span class="keywordflow">for</span>(; index &lt; freeSuballocCount; ++index)</div>
-<div class="line"><a name="l08818"></a><span class="lineno"> 8818</span>&#160;            {</div>
-<div class="line"><a name="l08819"></a><span class="lineno"> 8819</span>&#160;                <span class="keywordflow">if</span>(CheckAllocation(</div>
-<div class="line"><a name="l08820"></a><span class="lineno"> 8820</span>&#160;                    currentFrameIndex,</div>
-<div class="line"><a name="l08821"></a><span class="lineno"> 8821</span>&#160;                    frameInUseCount,</div>
-<div class="line"><a name="l08822"></a><span class="lineno"> 8822</span>&#160;                    bufferImageGranularity,</div>
-<div class="line"><a name="l08823"></a><span class="lineno"> 8823</span>&#160;                    allocSize,</div>
-<div class="line"><a name="l08824"></a><span class="lineno"> 8824</span>&#160;                    allocAlignment,</div>
-<div class="line"><a name="l08825"></a><span class="lineno"> 8825</span>&#160;                    allocType,</div>
-<div class="line"><a name="l08826"></a><span class="lineno"> 8826</span>&#160;                    m_FreeSuballocationsBySize[index],</div>
-<div class="line"><a name="l08827"></a><span class="lineno"> 8827</span>&#160;                    <span class="keyword">false</span>, <span class="comment">// canMakeOtherLost</span></div>
-<div class="line"><a name="l08828"></a><span class="lineno"> 8828</span>&#160;                    &amp;pAllocationRequest-&gt;offset,</div>
-<div class="line"><a name="l08829"></a><span class="lineno"> 8829</span>&#160;                    &amp;pAllocationRequest-&gt;itemsToMakeLostCount,</div>
-<div class="line"><a name="l08830"></a><span class="lineno"> 8830</span>&#160;                    &amp;pAllocationRequest-&gt;sumFreeSize,</div>
-<div class="line"><a name="l08831"></a><span class="lineno"> 8831</span>&#160;                    &amp;pAllocationRequest-&gt;sumItemSize))</div>
-<div class="line"><a name="l08832"></a><span class="lineno"> 8832</span>&#160;                {</div>
-<div class="line"><a name="l08833"></a><span class="lineno"> 8833</span>&#160;                    pAllocationRequest-&gt;item = m_FreeSuballocationsBySize[index];</div>
-<div class="line"><a name="l08834"></a><span class="lineno"> 8834</span>&#160;                    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l08835"></a><span class="lineno"> 8835</span>&#160;                }</div>
-<div class="line"><a name="l08836"></a><span class="lineno"> 8836</span>&#160;            }</div>
-<div class="line"><a name="l08837"></a><span class="lineno"> 8837</span>&#160;        }</div>
-<div class="line"><a name="l08838"></a><span class="lineno"> 8838</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(strategy == VMA_ALLOCATION_INTERNAL_STRATEGY_MIN_OFFSET)</div>
-<div class="line"><a name="l08839"></a><span class="lineno"> 8839</span>&#160;        {</div>
-<div class="line"><a name="l08840"></a><span class="lineno"> 8840</span>&#160;            <span class="keywordflow">for</span>(VmaSuballocationList::iterator it = m_Suballocations.begin();</div>
-<div class="line"><a name="l08841"></a><span class="lineno"> 8841</span>&#160;                it != m_Suballocations.end();</div>
-<div class="line"><a name="l08842"></a><span class="lineno"> 8842</span>&#160;                ++it)</div>
-<div class="line"><a name="l08843"></a><span class="lineno"> 8843</span>&#160;            {</div>
-<div class="line"><a name="l08844"></a><span class="lineno"> 8844</span>&#160;                <span class="keywordflow">if</span>(it-&gt;type == VMA_SUBALLOCATION_TYPE_FREE &amp;&amp; CheckAllocation(</div>
-<div class="line"><a name="l08845"></a><span class="lineno"> 8845</span>&#160;                    currentFrameIndex,</div>
-<div class="line"><a name="l08846"></a><span class="lineno"> 8846</span>&#160;                    frameInUseCount,</div>
-<div class="line"><a name="l08847"></a><span class="lineno"> 8847</span>&#160;                    bufferImageGranularity,</div>
-<div class="line"><a name="l08848"></a><span class="lineno"> 8848</span>&#160;                    allocSize,</div>
-<div class="line"><a name="l08849"></a><span class="lineno"> 8849</span>&#160;                    allocAlignment,</div>
-<div class="line"><a name="l08850"></a><span class="lineno"> 8850</span>&#160;                    allocType,</div>
-<div class="line"><a name="l08851"></a><span class="lineno"> 8851</span>&#160;                    it,</div>
-<div class="line"><a name="l08852"></a><span class="lineno"> 8852</span>&#160;                    <span class="keyword">false</span>, <span class="comment">// canMakeOtherLost</span></div>
-<div class="line"><a name="l08853"></a><span class="lineno"> 8853</span>&#160;                    &amp;pAllocationRequest-&gt;offset,</div>
-<div class="line"><a name="l08854"></a><span class="lineno"> 8854</span>&#160;                    &amp;pAllocationRequest-&gt;itemsToMakeLostCount,</div>
-<div class="line"><a name="l08855"></a><span class="lineno"> 8855</span>&#160;                    &amp;pAllocationRequest-&gt;sumFreeSize,</div>
-<div class="line"><a name="l08856"></a><span class="lineno"> 8856</span>&#160;                    &amp;pAllocationRequest-&gt;sumItemSize))</div>
-<div class="line"><a name="l08857"></a><span class="lineno"> 8857</span>&#160;                {</div>
-<div class="line"><a name="l08858"></a><span class="lineno"> 8858</span>&#160;                    pAllocationRequest-&gt;item = it;</div>
-<div class="line"><a name="l08859"></a><span class="lineno"> 8859</span>&#160;                    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l08860"></a><span class="lineno"> 8860</span>&#160;                }</div>
-<div class="line"><a name="l08861"></a><span class="lineno"> 8861</span>&#160;            }</div>
-<div class="line"><a name="l08862"></a><span class="lineno"> 8862</span>&#160;        }</div>
-<div class="line"><a name="l08863"></a><span class="lineno"> 8863</span>&#160;        <span class="keywordflow">else</span> <span class="comment">// WORST_FIT, FIRST_FIT</span></div>
+<div class="line"><a name="l08703"></a><span class="lineno"> 8703</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l08704"></a><span class="lineno"> 8704</span>&#160; </div>
+<div class="line"><a name="l08705"></a><span class="lineno"> 8705</span>&#160;<span class="keyword">struct </span>VmaSuballocationItemSizeLess</div>
+<div class="line"><a name="l08706"></a><span class="lineno"> 8706</span>&#160;{</div>
+<div class="line"><a name="l08707"></a><span class="lineno"> 8707</span>&#160;    <span class="keywordtype">bool</span> operator()(</div>
+<div class="line"><a name="l08708"></a><span class="lineno"> 8708</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator lhs,</div>
+<div class="line"><a name="l08709"></a><span class="lineno"> 8709</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator rhs)<span class="keyword"> const</span></div>
+<div class="line"><a name="l08710"></a><span class="lineno"> 8710</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l08711"></a><span class="lineno"> 8711</span>&#160;        <span class="keywordflow">return</span> lhs-&gt;size &lt; rhs-&gt;size;</div>
+<div class="line"><a name="l08712"></a><span class="lineno"> 8712</span>&#160;    }</div>
+<div class="line"><a name="l08713"></a><span class="lineno"> 8713</span>&#160;    <span class="keywordtype">bool</span> operator()(</div>
+<div class="line"><a name="l08714"></a><span class="lineno"> 8714</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator lhs,</div>
+<div class="line"><a name="l08715"></a><span class="lineno"> 8715</span>&#160;        VkDeviceSize rhsSize)<span class="keyword"> const</span></div>
+<div class="line"><a name="l08716"></a><span class="lineno"> 8716</span>&#160;<span class="keyword">    </span>{</div>
+<div class="line"><a name="l08717"></a><span class="lineno"> 8717</span>&#160;        <span class="keywordflow">return</span> lhs-&gt;size &lt; rhsSize;</div>
+<div class="line"><a name="l08718"></a><span class="lineno"> 8718</span>&#160;    }</div>
+<div class="line"><a name="l08719"></a><span class="lineno"> 8719</span>&#160;};</div>
+<div class="line"><a name="l08720"></a><span class="lineno"> 8720</span>&#160; </div>
+<div class="line"><a name="l08721"></a><span class="lineno"> 8721</span>&#160; </div>
+<div class="line"><a name="l08723"></a><span class="lineno"> 8723</span>&#160;<span class="comment">// class VmaBlockMetadata</span></div>
+<div class="line"><a name="l08724"></a><span class="lineno"> 8724</span>&#160; </div>
+<div class="line"><a name="l08725"></a><span class="lineno"> 8725</span>&#160;VmaBlockMetadata::VmaBlockMetadata(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator) :</div>
+<div class="line"><a name="l08726"></a><span class="lineno"> 8726</span>&#160;    m_Size(0),</div>
+<div class="line"><a name="l08727"></a><span class="lineno"> 8727</span>&#160;    m_pAllocationCallbacks(hAllocator-&gt;GetAllocationCallbacks())</div>
+<div class="line"><a name="l08728"></a><span class="lineno"> 8728</span>&#160;{</div>
+<div class="line"><a name="l08729"></a><span class="lineno"> 8729</span>&#160;}</div>
+<div class="line"><a name="l08730"></a><span class="lineno"> 8730</span>&#160; </div>
+<div class="line"><a name="l08731"></a><span class="lineno"> 8731</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l08732"></a><span class="lineno"> 8732</span>&#160; </div>
+<div class="line"><a name="l08733"></a><span class="lineno"> 8733</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata::PrintDetailedMap_Begin(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
+<div class="line"><a name="l08734"></a><span class="lineno"> 8734</span>&#160;    VkDeviceSize unusedBytes,</div>
+<div class="line"><a name="l08735"></a><span class="lineno"> 8735</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l08736"></a><span class="lineno"> 8736</span>&#160;    <span class="keywordtype">size_t</span> unusedRangeCount)<span class="keyword"> const</span></div>
+<div class="line"><a name="l08737"></a><span class="lineno"> 8737</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08738"></a><span class="lineno"> 8738</span>&#160;    json.BeginObject();</div>
+<div class="line"><a name="l08739"></a><span class="lineno"> 8739</span>&#160; </div>
+<div class="line"><a name="l08740"></a><span class="lineno"> 8740</span>&#160;    json.WriteString(<span class="stringliteral">&quot;TotalBytes&quot;</span>);</div>
+<div class="line"><a name="l08741"></a><span class="lineno"> 8741</span>&#160;    json.WriteNumber(GetSize());</div>
+<div class="line"><a name="l08742"></a><span class="lineno"> 8742</span>&#160; </div>
+<div class="line"><a name="l08743"></a><span class="lineno"> 8743</span>&#160;    json.WriteString(<span class="stringliteral">&quot;UnusedBytes&quot;</span>);</div>
+<div class="line"><a name="l08744"></a><span class="lineno"> 8744</span>&#160;    json.WriteNumber(unusedBytes);</div>
+<div class="line"><a name="l08745"></a><span class="lineno"> 8745</span>&#160; </div>
+<div class="line"><a name="l08746"></a><span class="lineno"> 8746</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Allocations&quot;</span>);</div>
+<div class="line"><a name="l08747"></a><span class="lineno"> 8747</span>&#160;    json.WriteNumber((uint64_t)allocationCount);</div>
+<div class="line"><a name="l08748"></a><span class="lineno"> 8748</span>&#160; </div>
+<div class="line"><a name="l08749"></a><span class="lineno"> 8749</span>&#160;    json.WriteString(<span class="stringliteral">&quot;UnusedRanges&quot;</span>);</div>
+<div class="line"><a name="l08750"></a><span class="lineno"> 8750</span>&#160;    json.WriteNumber((uint64_t)unusedRangeCount);</div>
+<div class="line"><a name="l08751"></a><span class="lineno"> 8751</span>&#160; </div>
+<div class="line"><a name="l08752"></a><span class="lineno"> 8752</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Suballocations&quot;</span>);</div>
+<div class="line"><a name="l08753"></a><span class="lineno"> 8753</span>&#160;    json.BeginArray();</div>
+<div class="line"><a name="l08754"></a><span class="lineno"> 8754</span>&#160;}</div>
+<div class="line"><a name="l08755"></a><span class="lineno"> 8755</span>&#160; </div>
+<div class="line"><a name="l08756"></a><span class="lineno"> 8756</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata::PrintDetailedMap_Allocation(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
+<div class="line"><a name="l08757"></a><span class="lineno"> 8757</span>&#160;    VkDeviceSize offset,</div>
+<div class="line"><a name="l08758"></a><span class="lineno"> 8758</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)<span class="keyword"> const</span></div>
+<div class="line"><a name="l08759"></a><span class="lineno"> 8759</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08760"></a><span class="lineno"> 8760</span>&#160;    json.BeginObject(<span class="keyword">true</span>);</div>
+<div class="line"><a name="l08761"></a><span class="lineno"> 8761</span>&#160;        </div>
+<div class="line"><a name="l08762"></a><span class="lineno"> 8762</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Offset&quot;</span>);</div>
+<div class="line"><a name="l08763"></a><span class="lineno"> 8763</span>&#160;    json.WriteNumber(offset);</div>
+<div class="line"><a name="l08764"></a><span class="lineno"> 8764</span>&#160; </div>
+<div class="line"><a name="l08765"></a><span class="lineno"> 8765</span>&#160;    hAllocation-&gt;PrintParameters(json);</div>
+<div class="line"><a name="l08766"></a><span class="lineno"> 8766</span>&#160; </div>
+<div class="line"><a name="l08767"></a><span class="lineno"> 8767</span>&#160;    json.EndObject();</div>
+<div class="line"><a name="l08768"></a><span class="lineno"> 8768</span>&#160;}</div>
+<div class="line"><a name="l08769"></a><span class="lineno"> 8769</span>&#160; </div>
+<div class="line"><a name="l08770"></a><span class="lineno"> 8770</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata::PrintDetailedMap_UnusedRange(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
+<div class="line"><a name="l08771"></a><span class="lineno"> 8771</span>&#160;    VkDeviceSize offset,</div>
+<div class="line"><a name="l08772"></a><span class="lineno"> 8772</span>&#160;    VkDeviceSize size)<span class="keyword"> const</span></div>
+<div class="line"><a name="l08773"></a><span class="lineno"> 8773</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08774"></a><span class="lineno"> 8774</span>&#160;    json.BeginObject(<span class="keyword">true</span>);</div>
+<div class="line"><a name="l08775"></a><span class="lineno"> 8775</span>&#160;        </div>
+<div class="line"><a name="l08776"></a><span class="lineno"> 8776</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Offset&quot;</span>);</div>
+<div class="line"><a name="l08777"></a><span class="lineno"> 8777</span>&#160;    json.WriteNumber(offset);</div>
+<div class="line"><a name="l08778"></a><span class="lineno"> 8778</span>&#160; </div>
+<div class="line"><a name="l08779"></a><span class="lineno"> 8779</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Type&quot;</span>);</div>
+<div class="line"><a name="l08780"></a><span class="lineno"> 8780</span>&#160;    json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[VMA_SUBALLOCATION_TYPE_FREE]);</div>
+<div class="line"><a name="l08781"></a><span class="lineno"> 8781</span>&#160; </div>
+<div class="line"><a name="l08782"></a><span class="lineno"> 8782</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Size&quot;</span>);</div>
+<div class="line"><a name="l08783"></a><span class="lineno"> 8783</span>&#160;    json.WriteNumber(size);</div>
+<div class="line"><a name="l08784"></a><span class="lineno"> 8784</span>&#160; </div>
+<div class="line"><a name="l08785"></a><span class="lineno"> 8785</span>&#160;    json.EndObject();</div>
+<div class="line"><a name="l08786"></a><span class="lineno"> 8786</span>&#160;}</div>
+<div class="line"><a name="l08787"></a><span class="lineno"> 8787</span>&#160; </div>
+<div class="line"><a name="l08788"></a><span class="lineno"> 8788</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata::PrintDetailedMap_End(<span class="keyword">class</span> VmaJsonWriter&amp; json)<span class="keyword"> const</span></div>
+<div class="line"><a name="l08789"></a><span class="lineno"> 8789</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08790"></a><span class="lineno"> 8790</span>&#160;    json.EndArray();</div>
+<div class="line"><a name="l08791"></a><span class="lineno"> 8791</span>&#160;    json.EndObject();</div>
+<div class="line"><a name="l08792"></a><span class="lineno"> 8792</span>&#160;}</div>
+<div class="line"><a name="l08793"></a><span class="lineno"> 8793</span>&#160; </div>
+<div class="line"><a name="l08794"></a><span class="lineno"> 8794</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l08795"></a><span class="lineno"> 8795</span>&#160; </div>
+<div class="line"><a name="l08797"></a><span class="lineno"> 8797</span>&#160;<span class="comment">// class VmaBlockMetadata_Generic</span></div>
+<div class="line"><a name="l08798"></a><span class="lineno"> 8798</span>&#160; </div>
+<div class="line"><a name="l08799"></a><span class="lineno"> 8799</span>&#160;VmaBlockMetadata_Generic::VmaBlockMetadata_Generic(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator) :</div>
+<div class="line"><a name="l08800"></a><span class="lineno"> 8800</span>&#160;    VmaBlockMetadata(hAllocator),</div>
+<div class="line"><a name="l08801"></a><span class="lineno"> 8801</span>&#160;    m_FreeCount(0),</div>
+<div class="line"><a name="l08802"></a><span class="lineno"> 8802</span>&#160;    m_SumFreeSize(0),</div>
+<div class="line"><a name="l08803"></a><span class="lineno"> 8803</span>&#160;    m_Suballocations(VmaStlAllocator&lt;VmaSuballocation&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
+<div class="line"><a name="l08804"></a><span class="lineno"> 8804</span>&#160;    m_FreeSuballocationsBySize(VmaStlAllocator&lt;VmaSuballocationList::iterator&gt;(hAllocator-&gt;GetAllocationCallbacks()))</div>
+<div class="line"><a name="l08805"></a><span class="lineno"> 8805</span>&#160;{</div>
+<div class="line"><a name="l08806"></a><span class="lineno"> 8806</span>&#160;}</div>
+<div class="line"><a name="l08807"></a><span class="lineno"> 8807</span>&#160; </div>
+<div class="line"><a name="l08808"></a><span class="lineno"> 8808</span>&#160;VmaBlockMetadata_Generic::~VmaBlockMetadata_Generic()</div>
+<div class="line"><a name="l08809"></a><span class="lineno"> 8809</span>&#160;{</div>
+<div class="line"><a name="l08810"></a><span class="lineno"> 8810</span>&#160;}</div>
+<div class="line"><a name="l08811"></a><span class="lineno"> 8811</span>&#160; </div>
+<div class="line"><a name="l08812"></a><span class="lineno"> 8812</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::Init(VkDeviceSize size)</div>
+<div class="line"><a name="l08813"></a><span class="lineno"> 8813</span>&#160;{</div>
+<div class="line"><a name="l08814"></a><span class="lineno"> 8814</span>&#160;    VmaBlockMetadata::Init(size);</div>
+<div class="line"><a name="l08815"></a><span class="lineno"> 8815</span>&#160; </div>
+<div class="line"><a name="l08816"></a><span class="lineno"> 8816</span>&#160;    m_FreeCount = 1;</div>
+<div class="line"><a name="l08817"></a><span class="lineno"> 8817</span>&#160;    m_SumFreeSize = size;</div>
+<div class="line"><a name="l08818"></a><span class="lineno"> 8818</span>&#160; </div>
+<div class="line"><a name="l08819"></a><span class="lineno"> 8819</span>&#160;    VmaSuballocation suballoc = {};</div>
+<div class="line"><a name="l08820"></a><span class="lineno"> 8820</span>&#160;    suballoc.offset = 0;</div>
+<div class="line"><a name="l08821"></a><span class="lineno"> 8821</span>&#160;    suballoc.size = size;</div>
+<div class="line"><a name="l08822"></a><span class="lineno"> 8822</span>&#160;    suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
+<div class="line"><a name="l08823"></a><span class="lineno"> 8823</span>&#160;    suballoc.hAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l08824"></a><span class="lineno"> 8824</span>&#160; </div>
+<div class="line"><a name="l08825"></a><span class="lineno"> 8825</span>&#160;    VMA_ASSERT(size &gt; VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER);</div>
+<div class="line"><a name="l08826"></a><span class="lineno"> 8826</span>&#160;    m_Suballocations.push_back(suballoc);</div>
+<div class="line"><a name="l08827"></a><span class="lineno"> 8827</span>&#160;    VmaSuballocationList::iterator suballocItem = m_Suballocations.end();</div>
+<div class="line"><a name="l08828"></a><span class="lineno"> 8828</span>&#160;    --suballocItem;</div>
+<div class="line"><a name="l08829"></a><span class="lineno"> 8829</span>&#160;    m_FreeSuballocationsBySize.push_back(suballocItem);</div>
+<div class="line"><a name="l08830"></a><span class="lineno"> 8830</span>&#160;}</div>
+<div class="line"><a name="l08831"></a><span class="lineno"> 8831</span>&#160; </div>
+<div class="line"><a name="l08832"></a><span class="lineno"> 8832</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::Validate()<span class="keyword"> const</span></div>
+<div class="line"><a name="l08833"></a><span class="lineno"> 8833</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08834"></a><span class="lineno"> 8834</span>&#160;    VMA_VALIDATE(!m_Suballocations.empty());</div>
+<div class="line"><a name="l08835"></a><span class="lineno"> 8835</span>&#160;    </div>
+<div class="line"><a name="l08836"></a><span class="lineno"> 8836</span>&#160;    <span class="comment">// Expected offset of new suballocation as calculated from previous ones.</span></div>
+<div class="line"><a name="l08837"></a><span class="lineno"> 8837</span>&#160;    VkDeviceSize calculatedOffset = 0;</div>
+<div class="line"><a name="l08838"></a><span class="lineno"> 8838</span>&#160;    <span class="comment">// Expected number of free suballocations as calculated from traversing their list.</span></div>
+<div class="line"><a name="l08839"></a><span class="lineno"> 8839</span>&#160;    uint32_t calculatedFreeCount = 0;</div>
+<div class="line"><a name="l08840"></a><span class="lineno"> 8840</span>&#160;    <span class="comment">// Expected sum size of free suballocations as calculated from traversing their list.</span></div>
+<div class="line"><a name="l08841"></a><span class="lineno"> 8841</span>&#160;    VkDeviceSize calculatedSumFreeSize = 0;</div>
+<div class="line"><a name="l08842"></a><span class="lineno"> 8842</span>&#160;    <span class="comment">// Expected number of free suballocations that should be registered in</span></div>
+<div class="line"><a name="l08843"></a><span class="lineno"> 8843</span>&#160;    <span class="comment">// m_FreeSuballocationsBySize calculated from traversing their list.</span></div>
+<div class="line"><a name="l08844"></a><span class="lineno"> 8844</span>&#160;    <span class="keywordtype">size_t</span> freeSuballocationsToRegister = 0;</div>
+<div class="line"><a name="l08845"></a><span class="lineno"> 8845</span>&#160;    <span class="comment">// True if previous visited suballocation was free.</span></div>
+<div class="line"><a name="l08846"></a><span class="lineno"> 8846</span>&#160;    <span class="keywordtype">bool</span> prevFree = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l08847"></a><span class="lineno"> 8847</span>&#160; </div>
+<div class="line"><a name="l08848"></a><span class="lineno"> 8848</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();</div>
+<div class="line"><a name="l08849"></a><span class="lineno"> 8849</span>&#160;        suballocItem != m_Suballocations.cend();</div>
+<div class="line"><a name="l08850"></a><span class="lineno"> 8850</span>&#160;        ++suballocItem)</div>
+<div class="line"><a name="l08851"></a><span class="lineno"> 8851</span>&#160;    {</div>
+<div class="line"><a name="l08852"></a><span class="lineno"> 8852</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; subAlloc = *suballocItem;</div>
+<div class="line"><a name="l08853"></a><span class="lineno"> 8853</span>&#160;        </div>
+<div class="line"><a name="l08854"></a><span class="lineno"> 8854</span>&#160;        <span class="comment">// Actual offset of this suballocation doesn&#39;t match expected one.</span></div>
+<div class="line"><a name="l08855"></a><span class="lineno"> 8855</span>&#160;        VMA_VALIDATE(subAlloc.offset == calculatedOffset);</div>
+<div class="line"><a name="l08856"></a><span class="lineno"> 8856</span>&#160; </div>
+<div class="line"><a name="l08857"></a><span class="lineno"> 8857</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">bool</span> currFree = (subAlloc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l08858"></a><span class="lineno"> 8858</span>&#160;        <span class="comment">// Two adjacent free suballocations are invalid. They should be merged.</span></div>
+<div class="line"><a name="l08859"></a><span class="lineno"> 8859</span>&#160;        VMA_VALIDATE(!prevFree || !currFree);</div>
+<div class="line"><a name="l08860"></a><span class="lineno"> 8860</span>&#160; </div>
+<div class="line"><a name="l08861"></a><span class="lineno"> 8861</span>&#160;        VMA_VALIDATE(currFree == (subAlloc.hAllocation == VK_NULL_HANDLE));</div>
+<div class="line"><a name="l08862"></a><span class="lineno"> 8862</span>&#160; </div>
+<div class="line"><a name="l08863"></a><span class="lineno"> 8863</span>&#160;        <span class="keywordflow">if</span>(currFree)</div>
 <div class="line"><a name="l08864"></a><span class="lineno"> 8864</span>&#160;        {</div>
-<div class="line"><a name="l08865"></a><span class="lineno"> 8865</span>&#160;            <span class="comment">// Search staring from biggest suballocations.</span></div>
-<div class="line"><a name="l08866"></a><span class="lineno"> 8866</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> index = freeSuballocCount; index--; )</div>
-<div class="line"><a name="l08867"></a><span class="lineno"> 8867</span>&#160;            {</div>
-<div class="line"><a name="l08868"></a><span class="lineno"> 8868</span>&#160;                <span class="keywordflow">if</span>(CheckAllocation(</div>
-<div class="line"><a name="l08869"></a><span class="lineno"> 8869</span>&#160;                    currentFrameIndex,</div>
-<div class="line"><a name="l08870"></a><span class="lineno"> 8870</span>&#160;                    frameInUseCount,</div>
-<div class="line"><a name="l08871"></a><span class="lineno"> 8871</span>&#160;                    bufferImageGranularity,</div>
-<div class="line"><a name="l08872"></a><span class="lineno"> 8872</span>&#160;                    allocSize,</div>
-<div class="line"><a name="l08873"></a><span class="lineno"> 8873</span>&#160;                    allocAlignment,</div>
-<div class="line"><a name="l08874"></a><span class="lineno"> 8874</span>&#160;                    allocType,</div>
-<div class="line"><a name="l08875"></a><span class="lineno"> 8875</span>&#160;                    m_FreeSuballocationsBySize[index],</div>
-<div class="line"><a name="l08876"></a><span class="lineno"> 8876</span>&#160;                    <span class="keyword">false</span>, <span class="comment">// canMakeOtherLost</span></div>
-<div class="line"><a name="l08877"></a><span class="lineno"> 8877</span>&#160;                    &amp;pAllocationRequest-&gt;offset,</div>
-<div class="line"><a name="l08878"></a><span class="lineno"> 8878</span>&#160;                    &amp;pAllocationRequest-&gt;itemsToMakeLostCount,</div>
-<div class="line"><a name="l08879"></a><span class="lineno"> 8879</span>&#160;                    &amp;pAllocationRequest-&gt;sumFreeSize,</div>
-<div class="line"><a name="l08880"></a><span class="lineno"> 8880</span>&#160;                    &amp;pAllocationRequest-&gt;sumItemSize))</div>
-<div class="line"><a name="l08881"></a><span class="lineno"> 8881</span>&#160;                {</div>
-<div class="line"><a name="l08882"></a><span class="lineno"> 8882</span>&#160;                    pAllocationRequest-&gt;item = m_FreeSuballocationsBySize[index];</div>
-<div class="line"><a name="l08883"></a><span class="lineno"> 8883</span>&#160;                    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l08884"></a><span class="lineno"> 8884</span>&#160;                }</div>
-<div class="line"><a name="l08885"></a><span class="lineno"> 8885</span>&#160;            }</div>
-<div class="line"><a name="l08886"></a><span class="lineno"> 8886</span>&#160;        }</div>
-<div class="line"><a name="l08887"></a><span class="lineno"> 8887</span>&#160;    }</div>
-<div class="line"><a name="l08888"></a><span class="lineno"> 8888</span>&#160; </div>
-<div class="line"><a name="l08889"></a><span class="lineno"> 8889</span>&#160;    <span class="keywordflow">if</span>(canMakeOtherLost)</div>
-<div class="line"><a name="l08890"></a><span class="lineno"> 8890</span>&#160;    {</div>
-<div class="line"><a name="l08891"></a><span class="lineno"> 8891</span>&#160;        <span class="comment">// Brute-force algorithm. TODO: Come up with something better.</span></div>
-<div class="line"><a name="l08892"></a><span class="lineno"> 8892</span>&#160; </div>
-<div class="line"><a name="l08893"></a><span class="lineno"> 8893</span>&#160;        <span class="keywordtype">bool</span> found = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l08894"></a><span class="lineno"> 8894</span>&#160;        VmaAllocationRequest tmpAllocRequest = {};</div>
-<div class="line"><a name="l08895"></a><span class="lineno"> 8895</span>&#160;        tmpAllocRequest.type = VmaAllocationRequestType::Normal;</div>
-<div class="line"><a name="l08896"></a><span class="lineno"> 8896</span>&#160;        <span class="keywordflow">for</span>(VmaSuballocationList::iterator suballocIt = m_Suballocations.begin();</div>
-<div class="line"><a name="l08897"></a><span class="lineno"> 8897</span>&#160;            suballocIt != m_Suballocations.end();</div>
-<div class="line"><a name="l08898"></a><span class="lineno"> 8898</span>&#160;            ++suballocIt)</div>
-<div class="line"><a name="l08899"></a><span class="lineno"> 8899</span>&#160;        {</div>
-<div class="line"><a name="l08900"></a><span class="lineno"> 8900</span>&#160;            <span class="keywordflow">if</span>(suballocIt-&gt;type == VMA_SUBALLOCATION_TYPE_FREE ||</div>
-<div class="line"><a name="l08901"></a><span class="lineno"> 8901</span>&#160;                suballocIt-&gt;hAllocation-&gt;CanBecomeLost())</div>
-<div class="line"><a name="l08902"></a><span class="lineno"> 8902</span>&#160;            {</div>
-<div class="line"><a name="l08903"></a><span class="lineno"> 8903</span>&#160;                <span class="keywordflow">if</span>(CheckAllocation(</div>
-<div class="line"><a name="l08904"></a><span class="lineno"> 8904</span>&#160;                    currentFrameIndex,</div>
-<div class="line"><a name="l08905"></a><span class="lineno"> 8905</span>&#160;                    frameInUseCount,</div>
-<div class="line"><a name="l08906"></a><span class="lineno"> 8906</span>&#160;                    bufferImageGranularity,</div>
-<div class="line"><a name="l08907"></a><span class="lineno"> 8907</span>&#160;                    allocSize,</div>
-<div class="line"><a name="l08908"></a><span class="lineno"> 8908</span>&#160;                    allocAlignment,</div>
-<div class="line"><a name="l08909"></a><span class="lineno"> 8909</span>&#160;                    allocType,</div>
-<div class="line"><a name="l08910"></a><span class="lineno"> 8910</span>&#160;                    suballocIt,</div>
-<div class="line"><a name="l08911"></a><span class="lineno"> 8911</span>&#160;                    canMakeOtherLost,</div>
-<div class="line"><a name="l08912"></a><span class="lineno"> 8912</span>&#160;                    &amp;tmpAllocRequest.offset,</div>
-<div class="line"><a name="l08913"></a><span class="lineno"> 8913</span>&#160;                    &amp;tmpAllocRequest.itemsToMakeLostCount,</div>
-<div class="line"><a name="l08914"></a><span class="lineno"> 8914</span>&#160;                    &amp;tmpAllocRequest.sumFreeSize,</div>
-<div class="line"><a name="l08915"></a><span class="lineno"> 8915</span>&#160;                    &amp;tmpAllocRequest.sumItemSize))</div>
-<div class="line"><a name="l08916"></a><span class="lineno"> 8916</span>&#160;                {</div>
-<div class="line"><a name="l08917"></a><span class="lineno"> 8917</span>&#160;                    <span class="keywordflow">if</span>(strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>)</div>
-<div class="line"><a name="l08918"></a><span class="lineno"> 8918</span>&#160;                    {</div>
-<div class="line"><a name="l08919"></a><span class="lineno"> 8919</span>&#160;                        *pAllocationRequest = tmpAllocRequest;</div>
-<div class="line"><a name="l08920"></a><span class="lineno"> 8920</span>&#160;                        pAllocationRequest-&gt;item = suballocIt;</div>
-<div class="line"><a name="l08921"></a><span class="lineno"> 8921</span>&#160;                        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l08922"></a><span class="lineno"> 8922</span>&#160;                    }</div>
-<div class="line"><a name="l08923"></a><span class="lineno"> 8923</span>&#160;                    <span class="keywordflow">if</span>(!found || tmpAllocRequest.CalcCost() &lt; pAllocationRequest-&gt;CalcCost())</div>
-<div class="line"><a name="l08924"></a><span class="lineno"> 8924</span>&#160;                    {</div>
-<div class="line"><a name="l08925"></a><span class="lineno"> 8925</span>&#160;                        *pAllocationRequest = tmpAllocRequest;</div>
-<div class="line"><a name="l08926"></a><span class="lineno"> 8926</span>&#160;                        pAllocationRequest-&gt;item = suballocIt;</div>
-<div class="line"><a name="l08927"></a><span class="lineno"> 8927</span>&#160;                        found = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l08928"></a><span class="lineno"> 8928</span>&#160;                    }</div>
-<div class="line"><a name="l08929"></a><span class="lineno"> 8929</span>&#160;                }</div>
-<div class="line"><a name="l08930"></a><span class="lineno"> 8930</span>&#160;            }</div>
-<div class="line"><a name="l08931"></a><span class="lineno"> 8931</span>&#160;        }</div>
-<div class="line"><a name="l08932"></a><span class="lineno"> 8932</span>&#160; </div>
-<div class="line"><a name="l08933"></a><span class="lineno"> 8933</span>&#160;        <span class="keywordflow">return</span> found;</div>
-<div class="line"><a name="l08934"></a><span class="lineno"> 8934</span>&#160;    }</div>
-<div class="line"><a name="l08935"></a><span class="lineno"> 8935</span>&#160; </div>
-<div class="line"><a name="l08936"></a><span class="lineno"> 8936</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l08937"></a><span class="lineno"> 8937</span>&#160;}</div>
-<div class="line"><a name="l08938"></a><span class="lineno"> 8938</span>&#160; </div>
-<div class="line"><a name="l08939"></a><span class="lineno"> 8939</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::MakeRequestedAllocationsLost(</div>
-<div class="line"><a name="l08940"></a><span class="lineno"> 8940</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l08941"></a><span class="lineno"> 8941</span>&#160;    uint32_t frameInUseCount,</div>
-<div class="line"><a name="l08942"></a><span class="lineno"> 8942</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
-<div class="line"><a name="l08943"></a><span class="lineno"> 8943</span>&#160;{</div>
-<div class="line"><a name="l08944"></a><span class="lineno"> 8944</span>&#160;    VMA_ASSERT(pAllocationRequest &amp;&amp; pAllocationRequest-&gt;type == VmaAllocationRequestType::Normal);</div>
-<div class="line"><a name="l08945"></a><span class="lineno"> 8945</span>&#160; </div>
-<div class="line"><a name="l08946"></a><span class="lineno"> 8946</span>&#160;    <span class="keywordflow">while</span>(pAllocationRequest-&gt;itemsToMakeLostCount &gt; 0)</div>
-<div class="line"><a name="l08947"></a><span class="lineno"> 8947</span>&#160;    {</div>
-<div class="line"><a name="l08948"></a><span class="lineno"> 8948</span>&#160;        <span class="keywordflow">if</span>(pAllocationRequest-&gt;item-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l08949"></a><span class="lineno"> 8949</span>&#160;        {</div>
-<div class="line"><a name="l08950"></a><span class="lineno"> 8950</span>&#160;            ++pAllocationRequest-&gt;item;</div>
-<div class="line"><a name="l08951"></a><span class="lineno"> 8951</span>&#160;        }</div>
-<div class="line"><a name="l08952"></a><span class="lineno"> 8952</span>&#160;        VMA_ASSERT(pAllocationRequest-&gt;item != m_Suballocations.end());</div>
-<div class="line"><a name="l08953"></a><span class="lineno"> 8953</span>&#160;        VMA_ASSERT(pAllocationRequest-&gt;item-&gt;hAllocation != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l08954"></a><span class="lineno"> 8954</span>&#160;        VMA_ASSERT(pAllocationRequest-&gt;item-&gt;hAllocation-&gt;CanBecomeLost());</div>
-<div class="line"><a name="l08955"></a><span class="lineno"> 8955</span>&#160;        <span class="keywordflow">if</span>(pAllocationRequest-&gt;item-&gt;hAllocation-&gt;MakeLost(currentFrameIndex, frameInUseCount))</div>
-<div class="line"><a name="l08956"></a><span class="lineno"> 8956</span>&#160;        {</div>
-<div class="line"><a name="l08957"></a><span class="lineno"> 8957</span>&#160;            pAllocationRequest-&gt;item = FreeSuballocation(pAllocationRequest-&gt;item);</div>
-<div class="line"><a name="l08958"></a><span class="lineno"> 8958</span>&#160;            --pAllocationRequest-&gt;itemsToMakeLostCount;</div>
-<div class="line"><a name="l08959"></a><span class="lineno"> 8959</span>&#160;        }</div>
-<div class="line"><a name="l08960"></a><span class="lineno"> 8960</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l08961"></a><span class="lineno"> 8961</span>&#160;        {</div>
-<div class="line"><a name="l08962"></a><span class="lineno"> 8962</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l08963"></a><span class="lineno"> 8963</span>&#160;        }</div>
-<div class="line"><a name="l08964"></a><span class="lineno"> 8964</span>&#160;    }</div>
-<div class="line"><a name="l08965"></a><span class="lineno"> 8965</span>&#160; </div>
-<div class="line"><a name="l08966"></a><span class="lineno"> 8966</span>&#160;    VMA_HEAVY_ASSERT(Validate());</div>
-<div class="line"><a name="l08967"></a><span class="lineno"> 8967</span>&#160;    VMA_ASSERT(pAllocationRequest-&gt;item != m_Suballocations.end());</div>
-<div class="line"><a name="l08968"></a><span class="lineno"> 8968</span>&#160;    VMA_ASSERT(pAllocationRequest-&gt;item-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l08969"></a><span class="lineno"> 8969</span>&#160;    </div>
-<div class="line"><a name="l08970"></a><span class="lineno"> 8970</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l08971"></a><span class="lineno"> 8971</span>&#160;}</div>
-<div class="line"><a name="l08972"></a><span class="lineno"> 8972</span>&#160; </div>
-<div class="line"><a name="l08973"></a><span class="lineno"> 8973</span>&#160;uint32_t VmaBlockMetadata_Generic::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)</div>
-<div class="line"><a name="l08974"></a><span class="lineno"> 8974</span>&#160;{</div>
-<div class="line"><a name="l08975"></a><span class="lineno"> 8975</span>&#160;    uint32_t lostAllocationCount = 0;</div>
-<div class="line"><a name="l08976"></a><span class="lineno"> 8976</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::iterator it = m_Suballocations.begin();</div>
-<div class="line"><a name="l08977"></a><span class="lineno"> 8977</span>&#160;        it != m_Suballocations.end();</div>
-<div class="line"><a name="l08978"></a><span class="lineno"> 8978</span>&#160;        ++it)</div>
-<div class="line"><a name="l08979"></a><span class="lineno"> 8979</span>&#160;    {</div>
-<div class="line"><a name="l08980"></a><span class="lineno"> 8980</span>&#160;        <span class="keywordflow">if</span>(it-&gt;type != VMA_SUBALLOCATION_TYPE_FREE &amp;&amp;</div>
-<div class="line"><a name="l08981"></a><span class="lineno"> 8981</span>&#160;            it-&gt;hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
-<div class="line"><a name="l08982"></a><span class="lineno"> 8982</span>&#160;            it-&gt;hAllocation-&gt;MakeLost(currentFrameIndex, frameInUseCount))</div>
-<div class="line"><a name="l08983"></a><span class="lineno"> 8983</span>&#160;        {</div>
-<div class="line"><a name="l08984"></a><span class="lineno"> 8984</span>&#160;            it = FreeSuballocation(it);</div>
-<div class="line"><a name="l08985"></a><span class="lineno"> 8985</span>&#160;            ++lostAllocationCount;</div>
-<div class="line"><a name="l08986"></a><span class="lineno"> 8986</span>&#160;        }</div>
-<div class="line"><a name="l08987"></a><span class="lineno"> 8987</span>&#160;    }</div>
-<div class="line"><a name="l08988"></a><span class="lineno"> 8988</span>&#160;    <span class="keywordflow">return</span> lostAllocationCount;</div>
-<div class="line"><a name="l08989"></a><span class="lineno"> 8989</span>&#160;}</div>
-<div class="line"><a name="l08990"></a><span class="lineno"> 8990</span>&#160; </div>
-<div class="line"><a name="l08991"></a><span class="lineno"> 8991</span>&#160;VkResult VmaBlockMetadata_Generic::CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData)</div>
-<div class="line"><a name="l08992"></a><span class="lineno"> 8992</span>&#160;{</div>
-<div class="line"><a name="l08993"></a><span class="lineno"> 8993</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::iterator it = m_Suballocations.begin();</div>
-<div class="line"><a name="l08994"></a><span class="lineno"> 8994</span>&#160;        it != m_Suballocations.end();</div>
-<div class="line"><a name="l08995"></a><span class="lineno"> 8995</span>&#160;        ++it)</div>
-<div class="line"><a name="l08996"></a><span class="lineno"> 8996</span>&#160;    {</div>
-<div class="line"><a name="l08997"></a><span class="lineno"> 8997</span>&#160;        <span class="keywordflow">if</span>(it-&gt;type != VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l08998"></a><span class="lineno"> 8998</span>&#160;        {</div>
-<div class="line"><a name="l08999"></a><span class="lineno"> 8999</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, it-&gt;offset - VMA_DEBUG_MARGIN))</div>
-<div class="line"><a name="l09000"></a><span class="lineno"> 9000</span>&#160;            {</div>
-<div class="line"><a name="l09001"></a><span class="lineno"> 9001</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!&quot;</span>);</div>
-<div class="line"><a name="l09002"></a><span class="lineno"> 9002</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
-<div class="line"><a name="l09003"></a><span class="lineno"> 9003</span>&#160;            }</div>
-<div class="line"><a name="l09004"></a><span class="lineno"> 9004</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, it-&gt;offset + it-&gt;size))</div>
-<div class="line"><a name="l09005"></a><span class="lineno"> 9005</span>&#160;            {</div>
-<div class="line"><a name="l09006"></a><span class="lineno"> 9006</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!&quot;</span>);</div>
-<div class="line"><a name="l09007"></a><span class="lineno"> 9007</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
-<div class="line"><a name="l09008"></a><span class="lineno"> 9008</span>&#160;            }</div>
-<div class="line"><a name="l09009"></a><span class="lineno"> 9009</span>&#160;        }</div>
-<div class="line"><a name="l09010"></a><span class="lineno"> 9010</span>&#160;    }</div>
-<div class="line"><a name="l09011"></a><span class="lineno"> 9011</span>&#160; </div>
-<div class="line"><a name="l09012"></a><span class="lineno"> 9012</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l09013"></a><span class="lineno"> 9013</span>&#160;}</div>
-<div class="line"><a name="l09014"></a><span class="lineno"> 9014</span>&#160; </div>
-<div class="line"><a name="l09015"></a><span class="lineno"> 9015</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::Alloc(</div>
-<div class="line"><a name="l09016"></a><span class="lineno"> 9016</span>&#160;    <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
-<div class="line"><a name="l09017"></a><span class="lineno"> 9017</span>&#160;    VmaSuballocationType type,</div>
-<div class="line"><a name="l09018"></a><span class="lineno"> 9018</span>&#160;    VkDeviceSize allocSize,</div>
-<div class="line"><a name="l09019"></a><span class="lineno"> 9019</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
-<div class="line"><a name="l09020"></a><span class="lineno"> 9020</span>&#160;{</div>
-<div class="line"><a name="l09021"></a><span class="lineno"> 9021</span>&#160;    VMA_ASSERT(request.type == VmaAllocationRequestType::Normal);</div>
-<div class="line"><a name="l09022"></a><span class="lineno"> 9022</span>&#160;    VMA_ASSERT(request.item != m_Suballocations.end());</div>
-<div class="line"><a name="l09023"></a><span class="lineno"> 9023</span>&#160;    VmaSuballocation&amp; suballoc = *request.item;</div>
-<div class="line"><a name="l09024"></a><span class="lineno"> 9024</span>&#160;    <span class="comment">// Given suballocation is a free block.</span></div>
-<div class="line"><a name="l09025"></a><span class="lineno"> 9025</span>&#160;    VMA_ASSERT(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l09026"></a><span class="lineno"> 9026</span>&#160;    <span class="comment">// Given offset is inside this suballocation.</span></div>
-<div class="line"><a name="l09027"></a><span class="lineno"> 9027</span>&#160;    VMA_ASSERT(request.offset &gt;= suballoc.offset);</div>
-<div class="line"><a name="l09028"></a><span class="lineno"> 9028</span>&#160;    <span class="keyword">const</span> VkDeviceSize paddingBegin = request.offset - suballoc.offset;</div>
-<div class="line"><a name="l09029"></a><span class="lineno"> 9029</span>&#160;    VMA_ASSERT(suballoc.size &gt;= paddingBegin + allocSize);</div>
-<div class="line"><a name="l09030"></a><span class="lineno"> 9030</span>&#160;    <span class="keyword">const</span> VkDeviceSize paddingEnd = suballoc.size - paddingBegin - allocSize;</div>
+<div class="line"><a name="l08865"></a><span class="lineno"> 8865</span>&#160;            calculatedSumFreeSize += subAlloc.size;</div>
+<div class="line"><a name="l08866"></a><span class="lineno"> 8866</span>&#160;            ++calculatedFreeCount;</div>
+<div class="line"><a name="l08867"></a><span class="lineno"> 8867</span>&#160;            <span class="keywordflow">if</span>(subAlloc.size &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
+<div class="line"><a name="l08868"></a><span class="lineno"> 8868</span>&#160;            {</div>
+<div class="line"><a name="l08869"></a><span class="lineno"> 8869</span>&#160;                ++freeSuballocationsToRegister;</div>
+<div class="line"><a name="l08870"></a><span class="lineno"> 8870</span>&#160;            }</div>
+<div class="line"><a name="l08871"></a><span class="lineno"> 8871</span>&#160; </div>
+<div class="line"><a name="l08872"></a><span class="lineno"> 8872</span>&#160;            <span class="comment">// Margin required between allocations - every free space must be at least that large.</span></div>
+<div class="line"><a name="l08873"></a><span class="lineno"> 8873</span>&#160;            VMA_VALIDATE(subAlloc.size &gt;= VMA_DEBUG_MARGIN);</div>
+<div class="line"><a name="l08874"></a><span class="lineno"> 8874</span>&#160;        }</div>
+<div class="line"><a name="l08875"></a><span class="lineno"> 8875</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08876"></a><span class="lineno"> 8876</span>&#160;        {</div>
+<div class="line"><a name="l08877"></a><span class="lineno"> 8877</span>&#160;            VMA_VALIDATE(subAlloc.hAllocation-&gt;GetOffset() == subAlloc.offset);</div>
+<div class="line"><a name="l08878"></a><span class="lineno"> 8878</span>&#160;            VMA_VALIDATE(subAlloc.hAllocation-&gt;GetSize() == subAlloc.size);</div>
+<div class="line"><a name="l08879"></a><span class="lineno"> 8879</span>&#160; </div>
+<div class="line"><a name="l08880"></a><span class="lineno"> 8880</span>&#160;            <span class="comment">// Margin required between allocations - previous allocation must be free.</span></div>
+<div class="line"><a name="l08881"></a><span class="lineno"> 8881</span>&#160;            VMA_VALIDATE(VMA_DEBUG_MARGIN == 0 || prevFree);</div>
+<div class="line"><a name="l08882"></a><span class="lineno"> 8882</span>&#160;        }</div>
+<div class="line"><a name="l08883"></a><span class="lineno"> 8883</span>&#160; </div>
+<div class="line"><a name="l08884"></a><span class="lineno"> 8884</span>&#160;        calculatedOffset += subAlloc.size;</div>
+<div class="line"><a name="l08885"></a><span class="lineno"> 8885</span>&#160;        prevFree = currFree;</div>
+<div class="line"><a name="l08886"></a><span class="lineno"> 8886</span>&#160;    }</div>
+<div class="line"><a name="l08887"></a><span class="lineno"> 8887</span>&#160; </div>
+<div class="line"><a name="l08888"></a><span class="lineno"> 8888</span>&#160;    <span class="comment">// Number of free suballocations registered in m_FreeSuballocationsBySize doesn&#39;t</span></div>
+<div class="line"><a name="l08889"></a><span class="lineno"> 8889</span>&#160;    <span class="comment">// match expected one.</span></div>
+<div class="line"><a name="l08890"></a><span class="lineno"> 8890</span>&#160;    VMA_VALIDATE(m_FreeSuballocationsBySize.size() == freeSuballocationsToRegister);</div>
+<div class="line"><a name="l08891"></a><span class="lineno"> 8891</span>&#160; </div>
+<div class="line"><a name="l08892"></a><span class="lineno"> 8892</span>&#160;    VkDeviceSize lastSize = 0;</div>
+<div class="line"><a name="l08893"></a><span class="lineno"> 8893</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_FreeSuballocationsBySize.size(); ++i)</div>
+<div class="line"><a name="l08894"></a><span class="lineno"> 8894</span>&#160;    {</div>
+<div class="line"><a name="l08895"></a><span class="lineno"> 8895</span>&#160;        VmaSuballocationList::iterator suballocItem = m_FreeSuballocationsBySize[i];</div>
+<div class="line"><a name="l08896"></a><span class="lineno"> 8896</span>&#160;        </div>
+<div class="line"><a name="l08897"></a><span class="lineno"> 8897</span>&#160;        <span class="comment">// Only free suballocations can be registered in m_FreeSuballocationsBySize.</span></div>
+<div class="line"><a name="l08898"></a><span class="lineno"> 8898</span>&#160;        VMA_VALIDATE(suballocItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l08899"></a><span class="lineno"> 8899</span>&#160;        <span class="comment">// They must be sorted by size ascending.</span></div>
+<div class="line"><a name="l08900"></a><span class="lineno"> 8900</span>&#160;        VMA_VALIDATE(suballocItem-&gt;size &gt;= lastSize);</div>
+<div class="line"><a name="l08901"></a><span class="lineno"> 8901</span>&#160; </div>
+<div class="line"><a name="l08902"></a><span class="lineno"> 8902</span>&#160;        lastSize = suballocItem-&gt;size;</div>
+<div class="line"><a name="l08903"></a><span class="lineno"> 8903</span>&#160;    }</div>
+<div class="line"><a name="l08904"></a><span class="lineno"> 8904</span>&#160; </div>
+<div class="line"><a name="l08905"></a><span class="lineno"> 8905</span>&#160;    <span class="comment">// Check if totals match calculacted values.</span></div>
+<div class="line"><a name="l08906"></a><span class="lineno"> 8906</span>&#160;    VMA_VALIDATE(ValidateFreeSuballocationList());</div>
+<div class="line"><a name="l08907"></a><span class="lineno"> 8907</span>&#160;    VMA_VALIDATE(calculatedOffset == GetSize());</div>
+<div class="line"><a name="l08908"></a><span class="lineno"> 8908</span>&#160;    VMA_VALIDATE(calculatedSumFreeSize == m_SumFreeSize);</div>
+<div class="line"><a name="l08909"></a><span class="lineno"> 8909</span>&#160;    VMA_VALIDATE(calculatedFreeCount == m_FreeCount);</div>
+<div class="line"><a name="l08910"></a><span class="lineno"> 8910</span>&#160; </div>
+<div class="line"><a name="l08911"></a><span class="lineno"> 8911</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l08912"></a><span class="lineno"> 8912</span>&#160;}</div>
+<div class="line"><a name="l08913"></a><span class="lineno"> 8913</span>&#160; </div>
+<div class="line"><a name="l08914"></a><span class="lineno"> 8914</span>&#160;VkDeviceSize VmaBlockMetadata_Generic::GetUnusedRangeSizeMax()<span class="keyword"> const</span></div>
+<div class="line"><a name="l08915"></a><span class="lineno"> 8915</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08916"></a><span class="lineno"> 8916</span>&#160;    <span class="keywordflow">if</span>(!m_FreeSuballocationsBySize.empty())</div>
+<div class="line"><a name="l08917"></a><span class="lineno"> 8917</span>&#160;    {</div>
+<div class="line"><a name="l08918"></a><span class="lineno"> 8918</span>&#160;        <span class="keywordflow">return</span> m_FreeSuballocationsBySize.back()-&gt;size;</div>
+<div class="line"><a name="l08919"></a><span class="lineno"> 8919</span>&#160;    }</div>
+<div class="line"><a name="l08920"></a><span class="lineno"> 8920</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08921"></a><span class="lineno"> 8921</span>&#160;    {</div>
+<div class="line"><a name="l08922"></a><span class="lineno"> 8922</span>&#160;        <span class="keywordflow">return</span> 0;</div>
+<div class="line"><a name="l08923"></a><span class="lineno"> 8923</span>&#160;    }</div>
+<div class="line"><a name="l08924"></a><span class="lineno"> 8924</span>&#160;}</div>
+<div class="line"><a name="l08925"></a><span class="lineno"> 8925</span>&#160; </div>
+<div class="line"><a name="l08926"></a><span class="lineno"> 8926</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::IsEmpty()<span class="keyword"> const</span></div>
+<div class="line"><a name="l08927"></a><span class="lineno"> 8927</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08928"></a><span class="lineno"> 8928</span>&#160;    <span class="keywordflow">return</span> (m_Suballocations.size() == 1) &amp;&amp; (m_FreeCount == 1);</div>
+<div class="line"><a name="l08929"></a><span class="lineno"> 8929</span>&#160;}</div>
+<div class="line"><a name="l08930"></a><span class="lineno"> 8930</span>&#160; </div>
+<div class="line"><a name="l08931"></a><span class="lineno"> 8931</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo)<span class="keyword"> const</span></div>
+<div class="line"><a name="l08932"></a><span class="lineno"> 8932</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08933"></a><span class="lineno"> 8933</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> = 1;</div>
+<div class="line"><a name="l08934"></a><span class="lineno"> 8934</span>&#160; </div>
+<div class="line"><a name="l08935"></a><span class="lineno"> 8935</span>&#160;    <span class="keyword">const</span> uint32_t rangeCount = (uint32_t)m_Suballocations.size();</div>
+<div class="line"><a name="l08936"></a><span class="lineno"> 8936</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> = rangeCount - m_FreeCount;</div>
+<div class="line"><a name="l08937"></a><span class="lineno"> 8937</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> = m_FreeCount;</div>
+<div class="line"><a name="l08938"></a><span class="lineno"> 8938</span>&#160;    </div>
+<div class="line"><a name="l08939"></a><span class="lineno"> 8939</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> = m_SumFreeSize;</div>
+<div class="line"><a name="l08940"></a><span class="lineno"> 8940</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> = GetSize() - outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>;</div>
+<div class="line"><a name="l08941"></a><span class="lineno"> 8941</span>&#160; </div>
+<div class="line"><a name="l08942"></a><span class="lineno"> 8942</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = UINT64_MAX;</div>
+<div class="line"><a name="l08943"></a><span class="lineno"> 8943</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = 0;</div>
+<div class="line"><a name="l08944"></a><span class="lineno"> 8944</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = UINT64_MAX;</div>
+<div class="line"><a name="l08945"></a><span class="lineno"> 8945</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = 0;</div>
+<div class="line"><a name="l08946"></a><span class="lineno"> 8946</span>&#160; </div>
+<div class="line"><a name="l08947"></a><span class="lineno"> 8947</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();</div>
+<div class="line"><a name="l08948"></a><span class="lineno"> 8948</span>&#160;        suballocItem != m_Suballocations.cend();</div>
+<div class="line"><a name="l08949"></a><span class="lineno"> 8949</span>&#160;        ++suballocItem)</div>
+<div class="line"><a name="l08950"></a><span class="lineno"> 8950</span>&#160;    {</div>
+<div class="line"><a name="l08951"></a><span class="lineno"> 8951</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = *suballocItem;</div>
+<div class="line"><a name="l08952"></a><span class="lineno"> 8952</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l08953"></a><span class="lineno"> 8953</span>&#160;        {</div>
+<div class="line"><a name="l08954"></a><span class="lineno"> 8954</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, suballoc.size);</div>
+<div class="line"><a name="l08955"></a><span class="lineno"> 8955</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, suballoc.size);</div>
+<div class="line"><a name="l08956"></a><span class="lineno"> 8956</span>&#160;        }</div>
+<div class="line"><a name="l08957"></a><span class="lineno"> 8957</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08958"></a><span class="lineno"> 8958</span>&#160;        {</div>
+<div class="line"><a name="l08959"></a><span class="lineno"> 8959</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, suballoc.size);</div>
+<div class="line"><a name="l08960"></a><span class="lineno"> 8960</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, suballoc.size);</div>
+<div class="line"><a name="l08961"></a><span class="lineno"> 8961</span>&#160;        }</div>
+<div class="line"><a name="l08962"></a><span class="lineno"> 8962</span>&#160;    }</div>
+<div class="line"><a name="l08963"></a><span class="lineno"> 8963</span>&#160;}</div>
+<div class="line"><a name="l08964"></a><span class="lineno"> 8964</span>&#160; </div>
+<div class="line"><a name="l08965"></a><span class="lineno"> 8965</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats)<span class="keyword"> const</span></div>
+<div class="line"><a name="l08966"></a><span class="lineno"> 8966</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08967"></a><span class="lineno"> 8967</span>&#160;    <span class="keyword">const</span> uint32_t rangeCount = (uint32_t)m_Suballocations.size();</div>
+<div class="line"><a name="l08968"></a><span class="lineno"> 8968</span>&#160; </div>
+<div class="line"><a name="l08969"></a><span class="lineno"> 8969</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a> += GetSize();</div>
+<div class="line"><a name="l08970"></a><span class="lineno"> 8970</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += m_SumFreeSize;</div>
+<div class="line"><a name="l08971"></a><span class="lineno"> 8971</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a> += rangeCount - m_FreeCount;</div>
+<div class="line"><a name="l08972"></a><span class="lineno"> 8972</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a> += m_FreeCount;</div>
+<div class="line"><a name="l08973"></a><span class="lineno"> 8973</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, GetUnusedRangeSizeMax());</div>
+<div class="line"><a name="l08974"></a><span class="lineno"> 8974</span>&#160;}</div>
+<div class="line"><a name="l08975"></a><span class="lineno"> 8975</span>&#160; </div>
+<div class="line"><a name="l08976"></a><span class="lineno"> 8976</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l08977"></a><span class="lineno"> 8977</span>&#160; </div>
+<div class="line"><a name="l08978"></a><span class="lineno"> 8978</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json)<span class="keyword"> const</span></div>
+<div class="line"><a name="l08979"></a><span class="lineno"> 8979</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l08980"></a><span class="lineno"> 8980</span>&#160;    PrintDetailedMap_Begin(json,</div>
+<div class="line"><a name="l08981"></a><span class="lineno"> 8981</span>&#160;        m_SumFreeSize, <span class="comment">// unusedBytes</span></div>
+<div class="line"><a name="l08982"></a><span class="lineno"> 8982</span>&#160;        m_Suballocations.size() - (<span class="keywordtype">size_t</span>)m_FreeCount, <span class="comment">// allocationCount</span></div>
+<div class="line"><a name="l08983"></a><span class="lineno"> 8983</span>&#160;        m_FreeCount); <span class="comment">// unusedRangeCount</span></div>
+<div class="line"><a name="l08984"></a><span class="lineno"> 8984</span>&#160; </div>
+<div class="line"><a name="l08985"></a><span class="lineno"> 8985</span>&#160;    <span class="keywordtype">size_t</span> i = 0;</div>
+<div class="line"><a name="l08986"></a><span class="lineno"> 8986</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();</div>
+<div class="line"><a name="l08987"></a><span class="lineno"> 8987</span>&#160;        suballocItem != m_Suballocations.cend();</div>
+<div class="line"><a name="l08988"></a><span class="lineno"> 8988</span>&#160;        ++suballocItem, ++i)</div>
+<div class="line"><a name="l08989"></a><span class="lineno"> 8989</span>&#160;    {</div>
+<div class="line"><a name="l08990"></a><span class="lineno"> 8990</span>&#160;        <span class="keywordflow">if</span>(suballocItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l08991"></a><span class="lineno"> 8991</span>&#160;        {</div>
+<div class="line"><a name="l08992"></a><span class="lineno"> 8992</span>&#160;            PrintDetailedMap_UnusedRange(json, suballocItem-&gt;offset, suballocItem-&gt;size);</div>
+<div class="line"><a name="l08993"></a><span class="lineno"> 8993</span>&#160;        }</div>
+<div class="line"><a name="l08994"></a><span class="lineno"> 8994</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l08995"></a><span class="lineno"> 8995</span>&#160;        {</div>
+<div class="line"><a name="l08996"></a><span class="lineno"> 8996</span>&#160;            PrintDetailedMap_Allocation(json, suballocItem-&gt;offset, suballocItem-&gt;hAllocation);</div>
+<div class="line"><a name="l08997"></a><span class="lineno"> 8997</span>&#160;        }</div>
+<div class="line"><a name="l08998"></a><span class="lineno"> 8998</span>&#160;    }</div>
+<div class="line"><a name="l08999"></a><span class="lineno"> 8999</span>&#160; </div>
+<div class="line"><a name="l09000"></a><span class="lineno"> 9000</span>&#160;    PrintDetailedMap_End(json);</div>
+<div class="line"><a name="l09001"></a><span class="lineno"> 9001</span>&#160;}</div>
+<div class="line"><a name="l09002"></a><span class="lineno"> 9002</span>&#160; </div>
+<div class="line"><a name="l09003"></a><span class="lineno"> 9003</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l09004"></a><span class="lineno"> 9004</span>&#160; </div>
+<div class="line"><a name="l09005"></a><span class="lineno"> 9005</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::CreateAllocationRequest(</div>
+<div class="line"><a name="l09006"></a><span class="lineno"> 9006</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l09007"></a><span class="lineno"> 9007</span>&#160;    uint32_t frameInUseCount,</div>
+<div class="line"><a name="l09008"></a><span class="lineno"> 9008</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l09009"></a><span class="lineno"> 9009</span>&#160;    VkDeviceSize allocSize,</div>
+<div class="line"><a name="l09010"></a><span class="lineno"> 9010</span>&#160;    VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l09011"></a><span class="lineno"> 9011</span>&#160;    <span class="keywordtype">bool</span> upperAddress,</div>
+<div class="line"><a name="l09012"></a><span class="lineno"> 9012</span>&#160;    VmaSuballocationType allocType,</div>
+<div class="line"><a name="l09013"></a><span class="lineno"> 9013</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l09014"></a><span class="lineno"> 9014</span>&#160;    uint32_t strategy,</div>
+<div class="line"><a name="l09015"></a><span class="lineno"> 9015</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
+<div class="line"><a name="l09016"></a><span class="lineno"> 9016</span>&#160;{</div>
+<div class="line"><a name="l09017"></a><span class="lineno"> 9017</span>&#160;    VMA_ASSERT(allocSize &gt; 0);</div>
+<div class="line"><a name="l09018"></a><span class="lineno"> 9018</span>&#160;    VMA_ASSERT(!upperAddress);</div>
+<div class="line"><a name="l09019"></a><span class="lineno"> 9019</span>&#160;    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09020"></a><span class="lineno"> 9020</span>&#160;    VMA_ASSERT(pAllocationRequest != VMA_NULL);</div>
+<div class="line"><a name="l09021"></a><span class="lineno"> 9021</span>&#160;    VMA_HEAVY_ASSERT(Validate());</div>
+<div class="line"><a name="l09022"></a><span class="lineno"> 9022</span>&#160; </div>
+<div class="line"><a name="l09023"></a><span class="lineno"> 9023</span>&#160;    pAllocationRequest-&gt;type = VmaAllocationRequestType::Normal;</div>
+<div class="line"><a name="l09024"></a><span class="lineno"> 9024</span>&#160; </div>
+<div class="line"><a name="l09025"></a><span class="lineno"> 9025</span>&#160;    <span class="comment">// There is not enough total free space in this block to fullfill the request: Early return.</span></div>
+<div class="line"><a name="l09026"></a><span class="lineno"> 9026</span>&#160;    <span class="keywordflow">if</span>(canMakeOtherLost == <span class="keyword">false</span> &amp;&amp;</div>
+<div class="line"><a name="l09027"></a><span class="lineno"> 9027</span>&#160;        m_SumFreeSize &lt; allocSize + 2 * VMA_DEBUG_MARGIN)</div>
+<div class="line"><a name="l09028"></a><span class="lineno"> 9028</span>&#160;    {</div>
+<div class="line"><a name="l09029"></a><span class="lineno"> 9029</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09030"></a><span class="lineno"> 9030</span>&#160;    }</div>
 <div class="line"><a name="l09031"></a><span class="lineno"> 9031</span>&#160; </div>
-<div class="line"><a name="l09032"></a><span class="lineno"> 9032</span>&#160;    <span class="comment">// Unregister this free suballocation from m_FreeSuballocationsBySize and update</span></div>
-<div class="line"><a name="l09033"></a><span class="lineno"> 9033</span>&#160;    <span class="comment">// it to become used.</span></div>
-<div class="line"><a name="l09034"></a><span class="lineno"> 9034</span>&#160;    UnregisterFreeSuballocation(request.item);</div>
-<div class="line"><a name="l09035"></a><span class="lineno"> 9035</span>&#160; </div>
-<div class="line"><a name="l09036"></a><span class="lineno"> 9036</span>&#160;    suballoc.offset = request.offset;</div>
-<div class="line"><a name="l09037"></a><span class="lineno"> 9037</span>&#160;    suballoc.size = allocSize;</div>
-<div class="line"><a name="l09038"></a><span class="lineno"> 9038</span>&#160;    suballoc.type = type;</div>
-<div class="line"><a name="l09039"></a><span class="lineno"> 9039</span>&#160;    suballoc.hAllocation = hAllocation;</div>
-<div class="line"><a name="l09040"></a><span class="lineno"> 9040</span>&#160; </div>
-<div class="line"><a name="l09041"></a><span class="lineno"> 9041</span>&#160;    <span class="comment">// If there are any free bytes remaining at the end, insert new free suballocation after current one.</span></div>
-<div class="line"><a name="l09042"></a><span class="lineno"> 9042</span>&#160;    <span class="keywordflow">if</span>(paddingEnd)</div>
-<div class="line"><a name="l09043"></a><span class="lineno"> 9043</span>&#160;    {</div>
-<div class="line"><a name="l09044"></a><span class="lineno"> 9044</span>&#160;        VmaSuballocation paddingSuballoc = {};</div>
-<div class="line"><a name="l09045"></a><span class="lineno"> 9045</span>&#160;        paddingSuballoc.offset = request.offset + allocSize;</div>
-<div class="line"><a name="l09046"></a><span class="lineno"> 9046</span>&#160;        paddingSuballoc.size = paddingEnd;</div>
-<div class="line"><a name="l09047"></a><span class="lineno"> 9047</span>&#160;        paddingSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
-<div class="line"><a name="l09048"></a><span class="lineno"> 9048</span>&#160;        VmaSuballocationList::iterator next = request.item;</div>
-<div class="line"><a name="l09049"></a><span class="lineno"> 9049</span>&#160;        ++next;</div>
-<div class="line"><a name="l09050"></a><span class="lineno"> 9050</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator paddingEndItem =</div>
-<div class="line"><a name="l09051"></a><span class="lineno"> 9051</span>&#160;            m_Suballocations.insert(next, paddingSuballoc);</div>
-<div class="line"><a name="l09052"></a><span class="lineno"> 9052</span>&#160;        RegisterFreeSuballocation(paddingEndItem);</div>
-<div class="line"><a name="l09053"></a><span class="lineno"> 9053</span>&#160;    }</div>
-<div class="line"><a name="l09054"></a><span class="lineno"> 9054</span>&#160; </div>
-<div class="line"><a name="l09055"></a><span class="lineno"> 9055</span>&#160;    <span class="comment">// If there are any free bytes remaining at the beginning, insert new free suballocation before current one.</span></div>
-<div class="line"><a name="l09056"></a><span class="lineno"> 9056</span>&#160;    <span class="keywordflow">if</span>(paddingBegin)</div>
-<div class="line"><a name="l09057"></a><span class="lineno"> 9057</span>&#160;    {</div>
-<div class="line"><a name="l09058"></a><span class="lineno"> 9058</span>&#160;        VmaSuballocation paddingSuballoc = {};</div>
-<div class="line"><a name="l09059"></a><span class="lineno"> 9059</span>&#160;        paddingSuballoc.offset = request.offset - paddingBegin;</div>
-<div class="line"><a name="l09060"></a><span class="lineno"> 9060</span>&#160;        paddingSuballoc.size = paddingBegin;</div>
-<div class="line"><a name="l09061"></a><span class="lineno"> 9061</span>&#160;        paddingSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
-<div class="line"><a name="l09062"></a><span class="lineno"> 9062</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator paddingBeginItem =</div>
-<div class="line"><a name="l09063"></a><span class="lineno"> 9063</span>&#160;            m_Suballocations.insert(request.item, paddingSuballoc);</div>
-<div class="line"><a name="l09064"></a><span class="lineno"> 9064</span>&#160;        RegisterFreeSuballocation(paddingBeginItem);</div>
-<div class="line"><a name="l09065"></a><span class="lineno"> 9065</span>&#160;    }</div>
-<div class="line"><a name="l09066"></a><span class="lineno"> 9066</span>&#160; </div>
-<div class="line"><a name="l09067"></a><span class="lineno"> 9067</span>&#160;    <span class="comment">// Update totals.</span></div>
-<div class="line"><a name="l09068"></a><span class="lineno"> 9068</span>&#160;    m_FreeCount = m_FreeCount - 1;</div>
-<div class="line"><a name="l09069"></a><span class="lineno"> 9069</span>&#160;    <span class="keywordflow">if</span>(paddingBegin &gt; 0)</div>
-<div class="line"><a name="l09070"></a><span class="lineno"> 9070</span>&#160;    {</div>
-<div class="line"><a name="l09071"></a><span class="lineno"> 9071</span>&#160;        ++m_FreeCount;</div>
-<div class="line"><a name="l09072"></a><span class="lineno"> 9072</span>&#160;    }</div>
-<div class="line"><a name="l09073"></a><span class="lineno"> 9073</span>&#160;    <span class="keywordflow">if</span>(paddingEnd &gt; 0)</div>
-<div class="line"><a name="l09074"></a><span class="lineno"> 9074</span>&#160;    {</div>
-<div class="line"><a name="l09075"></a><span class="lineno"> 9075</span>&#160;        ++m_FreeCount;</div>
-<div class="line"><a name="l09076"></a><span class="lineno"> 9076</span>&#160;    }</div>
-<div class="line"><a name="l09077"></a><span class="lineno"> 9077</span>&#160;    m_SumFreeSize -= allocSize;</div>
-<div class="line"><a name="l09078"></a><span class="lineno"> 9078</span>&#160;}</div>
-<div class="line"><a name="l09079"></a><span class="lineno"> 9079</span>&#160; </div>
-<div class="line"><a name="l09080"></a><span class="lineno"> 9080</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l09081"></a><span class="lineno"> 9081</span>&#160;{</div>
-<div class="line"><a name="l09082"></a><span class="lineno"> 9082</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();</div>
-<div class="line"><a name="l09083"></a><span class="lineno"> 9083</span>&#160;        suballocItem != m_Suballocations.end();</div>
-<div class="line"><a name="l09084"></a><span class="lineno"> 9084</span>&#160;        ++suballocItem)</div>
-<div class="line"><a name="l09085"></a><span class="lineno"> 9085</span>&#160;    {</div>
-<div class="line"><a name="l09086"></a><span class="lineno"> 9086</span>&#160;        VmaSuballocation&amp; suballoc = *suballocItem;</div>
-<div class="line"><a name="l09087"></a><span class="lineno"> 9087</span>&#160;        <span class="keywordflow">if</span>(suballoc.hAllocation == allocation)</div>
-<div class="line"><a name="l09088"></a><span class="lineno"> 9088</span>&#160;        {</div>
-<div class="line"><a name="l09089"></a><span class="lineno"> 9089</span>&#160;            FreeSuballocation(suballocItem);</div>
-<div class="line"><a name="l09090"></a><span class="lineno"> 9090</span>&#160;            VMA_HEAVY_ASSERT(Validate());</div>
-<div class="line"><a name="l09091"></a><span class="lineno"> 9091</span>&#160;            <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l09092"></a><span class="lineno"> 9092</span>&#160;        }</div>
-<div class="line"><a name="l09093"></a><span class="lineno"> 9093</span>&#160;    }</div>
-<div class="line"><a name="l09094"></a><span class="lineno"> 9094</span>&#160;    VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Not found!&quot;</span>);</div>
-<div class="line"><a name="l09095"></a><span class="lineno"> 9095</span>&#160;}</div>
-<div class="line"><a name="l09096"></a><span class="lineno"> 9096</span>&#160; </div>
-<div class="line"><a name="l09097"></a><span class="lineno"> 9097</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::FreeAtOffset(VkDeviceSize offset)</div>
-<div class="line"><a name="l09098"></a><span class="lineno"> 9098</span>&#160;{</div>
-<div class="line"><a name="l09099"></a><span class="lineno"> 9099</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();</div>
-<div class="line"><a name="l09100"></a><span class="lineno"> 9100</span>&#160;        suballocItem != m_Suballocations.end();</div>
-<div class="line"><a name="l09101"></a><span class="lineno"> 9101</span>&#160;        ++suballocItem)</div>
-<div class="line"><a name="l09102"></a><span class="lineno"> 9102</span>&#160;    {</div>
-<div class="line"><a name="l09103"></a><span class="lineno"> 9103</span>&#160;        VmaSuballocation&amp; suballoc = *suballocItem;</div>
-<div class="line"><a name="l09104"></a><span class="lineno"> 9104</span>&#160;        <span class="keywordflow">if</span>(suballoc.offset == offset)</div>
-<div class="line"><a name="l09105"></a><span class="lineno"> 9105</span>&#160;        {</div>
-<div class="line"><a name="l09106"></a><span class="lineno"> 9106</span>&#160;            FreeSuballocation(suballocItem);</div>
-<div class="line"><a name="l09107"></a><span class="lineno"> 9107</span>&#160;            <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l09108"></a><span class="lineno"> 9108</span>&#160;        }</div>
-<div class="line"><a name="l09109"></a><span class="lineno"> 9109</span>&#160;    }</div>
-<div class="line"><a name="l09110"></a><span class="lineno"> 9110</span>&#160;    VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Not found!&quot;</span>);</div>
-<div class="line"><a name="l09111"></a><span class="lineno"> 9111</span>&#160;}</div>
-<div class="line"><a name="l09112"></a><span class="lineno"> 9112</span>&#160; </div>
-<div class="line"><a name="l09113"></a><span class="lineno"> 9113</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::ValidateFreeSuballocationList()<span class="keyword"> const</span></div>
-<div class="line"><a name="l09114"></a><span class="lineno"> 9114</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l09115"></a><span class="lineno"> 9115</span>&#160;    VkDeviceSize lastSize = 0;</div>
-<div class="line"><a name="l09116"></a><span class="lineno"> 9116</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0, count = m_FreeSuballocationsBySize.size(); i &lt; count; ++i)</div>
-<div class="line"><a name="l09117"></a><span class="lineno"> 9117</span>&#160;    {</div>
-<div class="line"><a name="l09118"></a><span class="lineno"> 9118</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator it = m_FreeSuballocationsBySize[i];</div>
-<div class="line"><a name="l09119"></a><span class="lineno"> 9119</span>&#160; </div>
-<div class="line"><a name="l09120"></a><span class="lineno"> 9120</span>&#160;        VMA_VALIDATE(it-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l09121"></a><span class="lineno"> 9121</span>&#160;        VMA_VALIDATE(it-&gt;size &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER);</div>
-<div class="line"><a name="l09122"></a><span class="lineno"> 9122</span>&#160;        VMA_VALIDATE(it-&gt;size &gt;= lastSize);</div>
-<div class="line"><a name="l09123"></a><span class="lineno"> 9123</span>&#160;        lastSize = it-&gt;size;</div>
-<div class="line"><a name="l09124"></a><span class="lineno"> 9124</span>&#160;    }</div>
-<div class="line"><a name="l09125"></a><span class="lineno"> 9125</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l09126"></a><span class="lineno"> 9126</span>&#160;}</div>
-<div class="line"><a name="l09127"></a><span class="lineno"> 9127</span>&#160; </div>
-<div class="line"><a name="l09128"></a><span class="lineno"> 9128</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::CheckAllocation(</div>
-<div class="line"><a name="l09129"></a><span class="lineno"> 9129</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l09130"></a><span class="lineno"> 9130</span>&#160;    uint32_t frameInUseCount,</div>
-<div class="line"><a name="l09131"></a><span class="lineno"> 9131</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l09132"></a><span class="lineno"> 9132</span>&#160;    VkDeviceSize allocSize,</div>
-<div class="line"><a name="l09133"></a><span class="lineno"> 9133</span>&#160;    VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l09134"></a><span class="lineno"> 9134</span>&#160;    VmaSuballocationType allocType,</div>
-<div class="line"><a name="l09135"></a><span class="lineno"> 9135</span>&#160;    VmaSuballocationList::const_iterator suballocItem,</div>
-<div class="line"><a name="l09136"></a><span class="lineno"> 9136</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l09137"></a><span class="lineno"> 9137</span>&#160;    VkDeviceSize* pOffset,</div>
-<div class="line"><a name="l09138"></a><span class="lineno"> 9138</span>&#160;    <span class="keywordtype">size_t</span>* itemsToMakeLostCount,</div>
-<div class="line"><a name="l09139"></a><span class="lineno"> 9139</span>&#160;    VkDeviceSize* pSumFreeSize,</div>
-<div class="line"><a name="l09140"></a><span class="lineno"> 9140</span>&#160;    VkDeviceSize* pSumItemSize)<span class="keyword"> const</span></div>
-<div class="line"><a name="l09141"></a><span class="lineno"> 9141</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l09142"></a><span class="lineno"> 9142</span>&#160;    VMA_ASSERT(allocSize &gt; 0);</div>
-<div class="line"><a name="l09143"></a><span class="lineno"> 9143</span>&#160;    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l09144"></a><span class="lineno"> 9144</span>&#160;    VMA_ASSERT(suballocItem != m_Suballocations.cend());</div>
-<div class="line"><a name="l09145"></a><span class="lineno"> 9145</span>&#160;    VMA_ASSERT(pOffset != VMA_NULL);</div>
-<div class="line"><a name="l09146"></a><span class="lineno"> 9146</span>&#160;    </div>
-<div class="line"><a name="l09147"></a><span class="lineno"> 9147</span>&#160;    *itemsToMakeLostCount = 0;</div>
-<div class="line"><a name="l09148"></a><span class="lineno"> 9148</span>&#160;    *pSumFreeSize = 0;</div>
-<div class="line"><a name="l09149"></a><span class="lineno"> 9149</span>&#160;    *pSumItemSize = 0;</div>
-<div class="line"><a name="l09150"></a><span class="lineno"> 9150</span>&#160; </div>
-<div class="line"><a name="l09151"></a><span class="lineno"> 9151</span>&#160;    <span class="keywordflow">if</span>(canMakeOtherLost)</div>
-<div class="line"><a name="l09152"></a><span class="lineno"> 9152</span>&#160;    {</div>
-<div class="line"><a name="l09153"></a><span class="lineno"> 9153</span>&#160;        <span class="keywordflow">if</span>(suballocItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l09154"></a><span class="lineno"> 9154</span>&#160;        {</div>
-<div class="line"><a name="l09155"></a><span class="lineno"> 9155</span>&#160;            *pSumFreeSize = suballocItem-&gt;size;</div>
-<div class="line"><a name="l09156"></a><span class="lineno"> 9156</span>&#160;        }</div>
-<div class="line"><a name="l09157"></a><span class="lineno"> 9157</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09158"></a><span class="lineno"> 9158</span>&#160;        {</div>
-<div class="line"><a name="l09159"></a><span class="lineno"> 9159</span>&#160;            <span class="keywordflow">if</span>(suballocItem-&gt;hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
-<div class="line"><a name="l09160"></a><span class="lineno"> 9160</span>&#160;                suballocItem-&gt;hAllocation-&gt;GetLastUseFrameIndex() + frameInUseCount &lt; currentFrameIndex)</div>
-<div class="line"><a name="l09161"></a><span class="lineno"> 9161</span>&#160;            {</div>
-<div class="line"><a name="l09162"></a><span class="lineno"> 9162</span>&#160;                ++*itemsToMakeLostCount;</div>
-<div class="line"><a name="l09163"></a><span class="lineno"> 9163</span>&#160;                *pSumItemSize = suballocItem-&gt;size;</div>
-<div class="line"><a name="l09164"></a><span class="lineno"> 9164</span>&#160;            }</div>
-<div class="line"><a name="l09165"></a><span class="lineno"> 9165</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09166"></a><span class="lineno"> 9166</span>&#160;            {</div>
-<div class="line"><a name="l09167"></a><span class="lineno"> 9167</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09168"></a><span class="lineno"> 9168</span>&#160;            }</div>
-<div class="line"><a name="l09169"></a><span class="lineno"> 9169</span>&#160;        }</div>
-<div class="line"><a name="l09170"></a><span class="lineno"> 9170</span>&#160; </div>
-<div class="line"><a name="l09171"></a><span class="lineno"> 9171</span>&#160;        <span class="comment">// Remaining size is too small for this request: Early return.</span></div>
-<div class="line"><a name="l09172"></a><span class="lineno"> 9172</span>&#160;        <span class="keywordflow">if</span>(GetSize() - suballocItem-&gt;offset &lt; allocSize)</div>
-<div class="line"><a name="l09173"></a><span class="lineno"> 9173</span>&#160;        {</div>
-<div class="line"><a name="l09174"></a><span class="lineno"> 9174</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09175"></a><span class="lineno"> 9175</span>&#160;        }</div>
-<div class="line"><a name="l09176"></a><span class="lineno"> 9176</span>&#160; </div>
-<div class="line"><a name="l09177"></a><span class="lineno"> 9177</span>&#160;        <span class="comment">// Start from offset equal to beginning of this suballocation.</span></div>
-<div class="line"><a name="l09178"></a><span class="lineno"> 9178</span>&#160;        *pOffset = suballocItem-&gt;offset;</div>
-<div class="line"><a name="l09179"></a><span class="lineno"> 9179</span>&#160;    </div>
-<div class="line"><a name="l09180"></a><span class="lineno"> 9180</span>&#160;        <span class="comment">// Apply VMA_DEBUG_MARGIN at the beginning.</span></div>
-<div class="line"><a name="l09181"></a><span class="lineno"> 9181</span>&#160;        <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN &gt; 0)</div>
-<div class="line"><a name="l09182"></a><span class="lineno"> 9182</span>&#160;        {</div>
-<div class="line"><a name="l09183"></a><span class="lineno"> 9183</span>&#160;            *pOffset += VMA_DEBUG_MARGIN;</div>
-<div class="line"><a name="l09184"></a><span class="lineno"> 9184</span>&#160;        }</div>
-<div class="line"><a name="l09185"></a><span class="lineno"> 9185</span>&#160;    </div>
-<div class="line"><a name="l09186"></a><span class="lineno"> 9186</span>&#160;        <span class="comment">// Apply alignment.</span></div>
-<div class="line"><a name="l09187"></a><span class="lineno"> 9187</span>&#160;        *pOffset = VmaAlignUp(*pOffset, allocAlignment);</div>
-<div class="line"><a name="l09188"></a><span class="lineno"> 9188</span>&#160; </div>
-<div class="line"><a name="l09189"></a><span class="lineno"> 9189</span>&#160;        <span class="comment">// Check previous suballocations for BufferImageGranularity conflicts.</span></div>
-<div class="line"><a name="l09190"></a><span class="lineno"> 9190</span>&#160;        <span class="comment">// Make bigger alignment if necessary.</span></div>
-<div class="line"><a name="l09191"></a><span class="lineno"> 9191</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
-<div class="line"><a name="l09192"></a><span class="lineno"> 9192</span>&#160;        {</div>
-<div class="line"><a name="l09193"></a><span class="lineno"> 9193</span>&#160;            <span class="keywordtype">bool</span> bufferImageGranularityConflict = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09194"></a><span class="lineno"> 9194</span>&#160;            VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;</div>
-<div class="line"><a name="l09195"></a><span class="lineno"> 9195</span>&#160;            <span class="keywordflow">while</span>(prevSuballocItem != m_Suballocations.cbegin())</div>
-<div class="line"><a name="l09196"></a><span class="lineno"> 9196</span>&#160;            {</div>
-<div class="line"><a name="l09197"></a><span class="lineno"> 9197</span>&#160;                --prevSuballocItem;</div>
-<div class="line"><a name="l09198"></a><span class="lineno"> 9198</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; prevSuballoc = *prevSuballocItem;</div>
-<div class="line"><a name="l09199"></a><span class="lineno"> 9199</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, *pOffset, bufferImageGranularity))</div>
-<div class="line"><a name="l09200"></a><span class="lineno"> 9200</span>&#160;                {</div>
-<div class="line"><a name="l09201"></a><span class="lineno"> 9201</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))</div>
-<div class="line"><a name="l09202"></a><span class="lineno"> 9202</span>&#160;                    {</div>
-<div class="line"><a name="l09203"></a><span class="lineno"> 9203</span>&#160;                        bufferImageGranularityConflict = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l09204"></a><span class="lineno"> 9204</span>&#160;                        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l09205"></a><span class="lineno"> 9205</span>&#160;                    }</div>
-<div class="line"><a name="l09206"></a><span class="lineno"> 9206</span>&#160;                }</div>
-<div class="line"><a name="l09207"></a><span class="lineno"> 9207</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09208"></a><span class="lineno"> 9208</span>&#160;                    <span class="comment">// Already on previous page.</span></div>
-<div class="line"><a name="l09209"></a><span class="lineno"> 9209</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l09210"></a><span class="lineno"> 9210</span>&#160;            }</div>
-<div class="line"><a name="l09211"></a><span class="lineno"> 9211</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularityConflict)</div>
-<div class="line"><a name="l09212"></a><span class="lineno"> 9212</span>&#160;            {</div>
-<div class="line"><a name="l09213"></a><span class="lineno"> 9213</span>&#160;                *pOffset = VmaAlignUp(*pOffset, bufferImageGranularity);</div>
-<div class="line"><a name="l09214"></a><span class="lineno"> 9214</span>&#160;            }</div>
-<div class="line"><a name="l09215"></a><span class="lineno"> 9215</span>&#160;        }</div>
-<div class="line"><a name="l09216"></a><span class="lineno"> 9216</span>&#160;    </div>
-<div class="line"><a name="l09217"></a><span class="lineno"> 9217</span>&#160;        <span class="comment">// Now that we have final *pOffset, check if we are past suballocItem.</span></div>
-<div class="line"><a name="l09218"></a><span class="lineno"> 9218</span>&#160;        <span class="comment">// If yes, return false - this function should be called for another suballocItem as starting point.</span></div>
-<div class="line"><a name="l09219"></a><span class="lineno"> 9219</span>&#160;        <span class="keywordflow">if</span>(*pOffset &gt;= suballocItem-&gt;offset + suballocItem-&gt;size)</div>
-<div class="line"><a name="l09220"></a><span class="lineno"> 9220</span>&#160;        {</div>
-<div class="line"><a name="l09221"></a><span class="lineno"> 9221</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09222"></a><span class="lineno"> 9222</span>&#160;        }</div>
-<div class="line"><a name="l09223"></a><span class="lineno"> 9223</span>&#160;    </div>
-<div class="line"><a name="l09224"></a><span class="lineno"> 9224</span>&#160;        <span class="comment">// Calculate padding at the beginning based on current offset.</span></div>
-<div class="line"><a name="l09225"></a><span class="lineno"> 9225</span>&#160;        <span class="keyword">const</span> VkDeviceSize paddingBegin = *pOffset - suballocItem-&gt;offset;</div>
-<div class="line"><a name="l09226"></a><span class="lineno"> 9226</span>&#160; </div>
-<div class="line"><a name="l09227"></a><span class="lineno"> 9227</span>&#160;        <span class="comment">// Calculate required margin at the end.</span></div>
-<div class="line"><a name="l09228"></a><span class="lineno"> 9228</span>&#160;        <span class="keyword">const</span> VkDeviceSize requiredEndMargin = VMA_DEBUG_MARGIN;</div>
-<div class="line"><a name="l09229"></a><span class="lineno"> 9229</span>&#160; </div>
-<div class="line"><a name="l09230"></a><span class="lineno"> 9230</span>&#160;        <span class="keyword">const</span> VkDeviceSize totalSize = paddingBegin + allocSize + requiredEndMargin;</div>
-<div class="line"><a name="l09231"></a><span class="lineno"> 9231</span>&#160;        <span class="comment">// Another early return check.</span></div>
-<div class="line"><a name="l09232"></a><span class="lineno"> 9232</span>&#160;        <span class="keywordflow">if</span>(suballocItem-&gt;offset + totalSize &gt; GetSize())</div>
-<div class="line"><a name="l09233"></a><span class="lineno"> 9233</span>&#160;        {</div>
-<div class="line"><a name="l09234"></a><span class="lineno"> 9234</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09235"></a><span class="lineno"> 9235</span>&#160;        }</div>
-<div class="line"><a name="l09236"></a><span class="lineno"> 9236</span>&#160; </div>
-<div class="line"><a name="l09237"></a><span class="lineno"> 9237</span>&#160;        <span class="comment">// Advance lastSuballocItem until desired size is reached.</span></div>
-<div class="line"><a name="l09238"></a><span class="lineno"> 9238</span>&#160;        <span class="comment">// Update itemsToMakeLostCount.</span></div>
-<div class="line"><a name="l09239"></a><span class="lineno"> 9239</span>&#160;        VmaSuballocationList::const_iterator lastSuballocItem = suballocItem;</div>
-<div class="line"><a name="l09240"></a><span class="lineno"> 9240</span>&#160;        <span class="keywordflow">if</span>(totalSize &gt; suballocItem-&gt;size)</div>
-<div class="line"><a name="l09241"></a><span class="lineno"> 9241</span>&#160;        {</div>
-<div class="line"><a name="l09242"></a><span class="lineno"> 9242</span>&#160;            VkDeviceSize remainingSize = totalSize - suballocItem-&gt;size;</div>
-<div class="line"><a name="l09243"></a><span class="lineno"> 9243</span>&#160;            <span class="keywordflow">while</span>(remainingSize &gt; 0)</div>
-<div class="line"><a name="l09244"></a><span class="lineno"> 9244</span>&#160;            {</div>
-<div class="line"><a name="l09245"></a><span class="lineno"> 9245</span>&#160;                ++lastSuballocItem;</div>
-<div class="line"><a name="l09246"></a><span class="lineno"> 9246</span>&#160;                <span class="keywordflow">if</span>(lastSuballocItem == m_Suballocations.cend())</div>
-<div class="line"><a name="l09247"></a><span class="lineno"> 9247</span>&#160;                {</div>
-<div class="line"><a name="l09248"></a><span class="lineno"> 9248</span>&#160;                    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09249"></a><span class="lineno"> 9249</span>&#160;                }</div>
-<div class="line"><a name="l09250"></a><span class="lineno"> 9250</span>&#160;                <span class="keywordflow">if</span>(lastSuballocItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l09251"></a><span class="lineno"> 9251</span>&#160;                {</div>
-<div class="line"><a name="l09252"></a><span class="lineno"> 9252</span>&#160;                    *pSumFreeSize += lastSuballocItem-&gt;size;</div>
-<div class="line"><a name="l09253"></a><span class="lineno"> 9253</span>&#160;                }</div>
-<div class="line"><a name="l09254"></a><span class="lineno"> 9254</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09255"></a><span class="lineno"> 9255</span>&#160;                {</div>
-<div class="line"><a name="l09256"></a><span class="lineno"> 9256</span>&#160;                    VMA_ASSERT(lastSuballocItem-&gt;hAllocation != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l09257"></a><span class="lineno"> 9257</span>&#160;                    <span class="keywordflow">if</span>(lastSuballocItem-&gt;hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
-<div class="line"><a name="l09258"></a><span class="lineno"> 9258</span>&#160;                        lastSuballocItem-&gt;hAllocation-&gt;GetLastUseFrameIndex() + frameInUseCount &lt; currentFrameIndex)</div>
-<div class="line"><a name="l09259"></a><span class="lineno"> 9259</span>&#160;                    {</div>
-<div class="line"><a name="l09260"></a><span class="lineno"> 9260</span>&#160;                        ++*itemsToMakeLostCount;</div>
-<div class="line"><a name="l09261"></a><span class="lineno"> 9261</span>&#160;                        *pSumItemSize += lastSuballocItem-&gt;size;</div>
-<div class="line"><a name="l09262"></a><span class="lineno"> 9262</span>&#160;                    }</div>
-<div class="line"><a name="l09263"></a><span class="lineno"> 9263</span>&#160;                    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09264"></a><span class="lineno"> 9264</span>&#160;                    {</div>
-<div class="line"><a name="l09265"></a><span class="lineno"> 9265</span>&#160;                        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09266"></a><span class="lineno"> 9266</span>&#160;                    }</div>
-<div class="line"><a name="l09267"></a><span class="lineno"> 9267</span>&#160;                }</div>
-<div class="line"><a name="l09268"></a><span class="lineno"> 9268</span>&#160;                remainingSize = (lastSuballocItem-&gt;size &lt; remainingSize) ?</div>
-<div class="line"><a name="l09269"></a><span class="lineno"> 9269</span>&#160;                    remainingSize - lastSuballocItem-&gt;size : 0;</div>
-<div class="line"><a name="l09270"></a><span class="lineno"> 9270</span>&#160;            }</div>
-<div class="line"><a name="l09271"></a><span class="lineno"> 9271</span>&#160;        }</div>
-<div class="line"><a name="l09272"></a><span class="lineno"> 9272</span>&#160; </div>
-<div class="line"><a name="l09273"></a><span class="lineno"> 9273</span>&#160;        <span class="comment">// Check next suballocations for BufferImageGranularity conflicts.</span></div>
-<div class="line"><a name="l09274"></a><span class="lineno"> 9274</span>&#160;        <span class="comment">// If conflict exists, we must mark more allocations lost or fail.</span></div>
-<div class="line"><a name="l09275"></a><span class="lineno"> 9275</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
-<div class="line"><a name="l09276"></a><span class="lineno"> 9276</span>&#160;        {</div>
-<div class="line"><a name="l09277"></a><span class="lineno"> 9277</span>&#160;            VmaSuballocationList::const_iterator nextSuballocItem = lastSuballocItem;</div>
-<div class="line"><a name="l09278"></a><span class="lineno"> 9278</span>&#160;            ++nextSuballocItem;</div>
-<div class="line"><a name="l09279"></a><span class="lineno"> 9279</span>&#160;            <span class="keywordflow">while</span>(nextSuballocItem != m_Suballocations.cend())</div>
-<div class="line"><a name="l09280"></a><span class="lineno"> 9280</span>&#160;            {</div>
-<div class="line"><a name="l09281"></a><span class="lineno"> 9281</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; nextSuballoc = *nextSuballocItem;</div>
-<div class="line"><a name="l09282"></a><span class="lineno"> 9282</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(*pOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))</div>
-<div class="line"><a name="l09283"></a><span class="lineno"> 9283</span>&#160;                {</div>
-<div class="line"><a name="l09284"></a><span class="lineno"> 9284</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))</div>
-<div class="line"><a name="l09285"></a><span class="lineno"> 9285</span>&#160;                    {</div>
-<div class="line"><a name="l09286"></a><span class="lineno"> 9286</span>&#160;                        VMA_ASSERT(nextSuballoc.hAllocation != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l09287"></a><span class="lineno"> 9287</span>&#160;                        <span class="keywordflow">if</span>(nextSuballoc.hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
-<div class="line"><a name="l09288"></a><span class="lineno"> 9288</span>&#160;                            nextSuballoc.hAllocation-&gt;GetLastUseFrameIndex() + frameInUseCount &lt; currentFrameIndex)</div>
-<div class="line"><a name="l09289"></a><span class="lineno"> 9289</span>&#160;                        {</div>
-<div class="line"><a name="l09290"></a><span class="lineno"> 9290</span>&#160;                            ++*itemsToMakeLostCount;</div>
-<div class="line"><a name="l09291"></a><span class="lineno"> 9291</span>&#160;                        }</div>
-<div class="line"><a name="l09292"></a><span class="lineno"> 9292</span>&#160;                        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09293"></a><span class="lineno"> 9293</span>&#160;                        {</div>
-<div class="line"><a name="l09294"></a><span class="lineno"> 9294</span>&#160;                            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09295"></a><span class="lineno"> 9295</span>&#160;                        }</div>
-<div class="line"><a name="l09296"></a><span class="lineno"> 9296</span>&#160;                    }</div>
-<div class="line"><a name="l09297"></a><span class="lineno"> 9297</span>&#160;                }</div>
-<div class="line"><a name="l09298"></a><span class="lineno"> 9298</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09299"></a><span class="lineno"> 9299</span>&#160;                {</div>
-<div class="line"><a name="l09300"></a><span class="lineno"> 9300</span>&#160;                    <span class="comment">// Already on next page.</span></div>
-<div class="line"><a name="l09301"></a><span class="lineno"> 9301</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l09302"></a><span class="lineno"> 9302</span>&#160;                }</div>
-<div class="line"><a name="l09303"></a><span class="lineno"> 9303</span>&#160;                ++nextSuballocItem;</div>
-<div class="line"><a name="l09304"></a><span class="lineno"> 9304</span>&#160;            }</div>
-<div class="line"><a name="l09305"></a><span class="lineno"> 9305</span>&#160;        }</div>
-<div class="line"><a name="l09306"></a><span class="lineno"> 9306</span>&#160;    }</div>
-<div class="line"><a name="l09307"></a><span class="lineno"> 9307</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09308"></a><span class="lineno"> 9308</span>&#160;    {</div>
-<div class="line"><a name="l09309"></a><span class="lineno"> 9309</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = *suballocItem;</div>
-<div class="line"><a name="l09310"></a><span class="lineno"> 9310</span>&#160;        VMA_ASSERT(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l09311"></a><span class="lineno"> 9311</span>&#160; </div>
-<div class="line"><a name="l09312"></a><span class="lineno"> 9312</span>&#160;        *pSumFreeSize = suballoc.size;</div>
-<div class="line"><a name="l09313"></a><span class="lineno"> 9313</span>&#160; </div>
-<div class="line"><a name="l09314"></a><span class="lineno"> 9314</span>&#160;        <span class="comment">// Size of this suballocation is too small for this request: Early return.</span></div>
-<div class="line"><a name="l09315"></a><span class="lineno"> 9315</span>&#160;        <span class="keywordflow">if</span>(suballoc.size &lt; allocSize)</div>
+<div class="line"><a name="l09032"></a><span class="lineno"> 9032</span>&#160;    <span class="comment">// New algorithm, efficiently searching freeSuballocationsBySize.</span></div>
+<div class="line"><a name="l09033"></a><span class="lineno"> 9033</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> freeSuballocCount = m_FreeSuballocationsBySize.size();</div>
+<div class="line"><a name="l09034"></a><span class="lineno"> 9034</span>&#160;    <span class="keywordflow">if</span>(freeSuballocCount &gt; 0)</div>
+<div class="line"><a name="l09035"></a><span class="lineno"> 9035</span>&#160;    {</div>
+<div class="line"><a name="l09036"></a><span class="lineno"> 9036</span>&#160;        <span class="keywordflow">if</span>(strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>)</div>
+<div class="line"><a name="l09037"></a><span class="lineno"> 9037</span>&#160;        {</div>
+<div class="line"><a name="l09038"></a><span class="lineno"> 9038</span>&#160;            <span class="comment">// Find first free suballocation with size not less than allocSize + 2 * VMA_DEBUG_MARGIN.</span></div>
+<div class="line"><a name="l09039"></a><span class="lineno"> 9039</span>&#160;            VmaSuballocationList::iterator* <span class="keyword">const</span> it = VmaBinaryFindFirstNotLess(</div>
+<div class="line"><a name="l09040"></a><span class="lineno"> 9040</span>&#160;                m_FreeSuballocationsBySize.data(),</div>
+<div class="line"><a name="l09041"></a><span class="lineno"> 9041</span>&#160;                m_FreeSuballocationsBySize.data() + freeSuballocCount,</div>
+<div class="line"><a name="l09042"></a><span class="lineno"> 9042</span>&#160;                allocSize + 2 * VMA_DEBUG_MARGIN,</div>
+<div class="line"><a name="l09043"></a><span class="lineno"> 9043</span>&#160;                VmaSuballocationItemSizeLess());</div>
+<div class="line"><a name="l09044"></a><span class="lineno"> 9044</span>&#160;            <span class="keywordtype">size_t</span> index = it - m_FreeSuballocationsBySize.data();</div>
+<div class="line"><a name="l09045"></a><span class="lineno"> 9045</span>&#160;            <span class="keywordflow">for</span>(; index &lt; freeSuballocCount; ++index)</div>
+<div class="line"><a name="l09046"></a><span class="lineno"> 9046</span>&#160;            {</div>
+<div class="line"><a name="l09047"></a><span class="lineno"> 9047</span>&#160;                <span class="keywordflow">if</span>(CheckAllocation(</div>
+<div class="line"><a name="l09048"></a><span class="lineno"> 9048</span>&#160;                    currentFrameIndex,</div>
+<div class="line"><a name="l09049"></a><span class="lineno"> 9049</span>&#160;                    frameInUseCount,</div>
+<div class="line"><a name="l09050"></a><span class="lineno"> 9050</span>&#160;                    bufferImageGranularity,</div>
+<div class="line"><a name="l09051"></a><span class="lineno"> 9051</span>&#160;                    allocSize,</div>
+<div class="line"><a name="l09052"></a><span class="lineno"> 9052</span>&#160;                    allocAlignment,</div>
+<div class="line"><a name="l09053"></a><span class="lineno"> 9053</span>&#160;                    allocType,</div>
+<div class="line"><a name="l09054"></a><span class="lineno"> 9054</span>&#160;                    m_FreeSuballocationsBySize[index],</div>
+<div class="line"><a name="l09055"></a><span class="lineno"> 9055</span>&#160;                    <span class="keyword">false</span>, <span class="comment">// canMakeOtherLost</span></div>
+<div class="line"><a name="l09056"></a><span class="lineno"> 9056</span>&#160;                    &amp;pAllocationRequest-&gt;offset,</div>
+<div class="line"><a name="l09057"></a><span class="lineno"> 9057</span>&#160;                    &amp;pAllocationRequest-&gt;itemsToMakeLostCount,</div>
+<div class="line"><a name="l09058"></a><span class="lineno"> 9058</span>&#160;                    &amp;pAllocationRequest-&gt;sumFreeSize,</div>
+<div class="line"><a name="l09059"></a><span class="lineno"> 9059</span>&#160;                    &amp;pAllocationRequest-&gt;sumItemSize))</div>
+<div class="line"><a name="l09060"></a><span class="lineno"> 9060</span>&#160;                {</div>
+<div class="line"><a name="l09061"></a><span class="lineno"> 9061</span>&#160;                    pAllocationRequest-&gt;item = m_FreeSuballocationsBySize[index];</div>
+<div class="line"><a name="l09062"></a><span class="lineno"> 9062</span>&#160;                    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09063"></a><span class="lineno"> 9063</span>&#160;                }</div>
+<div class="line"><a name="l09064"></a><span class="lineno"> 9064</span>&#160;            }</div>
+<div class="line"><a name="l09065"></a><span class="lineno"> 9065</span>&#160;        }</div>
+<div class="line"><a name="l09066"></a><span class="lineno"> 9066</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(strategy == VMA_ALLOCATION_INTERNAL_STRATEGY_MIN_OFFSET)</div>
+<div class="line"><a name="l09067"></a><span class="lineno"> 9067</span>&#160;        {</div>
+<div class="line"><a name="l09068"></a><span class="lineno"> 9068</span>&#160;            <span class="keywordflow">for</span>(VmaSuballocationList::iterator it = m_Suballocations.begin();</div>
+<div class="line"><a name="l09069"></a><span class="lineno"> 9069</span>&#160;                it != m_Suballocations.end();</div>
+<div class="line"><a name="l09070"></a><span class="lineno"> 9070</span>&#160;                ++it)</div>
+<div class="line"><a name="l09071"></a><span class="lineno"> 9071</span>&#160;            {</div>
+<div class="line"><a name="l09072"></a><span class="lineno"> 9072</span>&#160;                <span class="keywordflow">if</span>(it-&gt;type == VMA_SUBALLOCATION_TYPE_FREE &amp;&amp; CheckAllocation(</div>
+<div class="line"><a name="l09073"></a><span class="lineno"> 9073</span>&#160;                    currentFrameIndex,</div>
+<div class="line"><a name="l09074"></a><span class="lineno"> 9074</span>&#160;                    frameInUseCount,</div>
+<div class="line"><a name="l09075"></a><span class="lineno"> 9075</span>&#160;                    bufferImageGranularity,</div>
+<div class="line"><a name="l09076"></a><span class="lineno"> 9076</span>&#160;                    allocSize,</div>
+<div class="line"><a name="l09077"></a><span class="lineno"> 9077</span>&#160;                    allocAlignment,</div>
+<div class="line"><a name="l09078"></a><span class="lineno"> 9078</span>&#160;                    allocType,</div>
+<div class="line"><a name="l09079"></a><span class="lineno"> 9079</span>&#160;                    it,</div>
+<div class="line"><a name="l09080"></a><span class="lineno"> 9080</span>&#160;                    <span class="keyword">false</span>, <span class="comment">// canMakeOtherLost</span></div>
+<div class="line"><a name="l09081"></a><span class="lineno"> 9081</span>&#160;                    &amp;pAllocationRequest-&gt;offset,</div>
+<div class="line"><a name="l09082"></a><span class="lineno"> 9082</span>&#160;                    &amp;pAllocationRequest-&gt;itemsToMakeLostCount,</div>
+<div class="line"><a name="l09083"></a><span class="lineno"> 9083</span>&#160;                    &amp;pAllocationRequest-&gt;sumFreeSize,</div>
+<div class="line"><a name="l09084"></a><span class="lineno"> 9084</span>&#160;                    &amp;pAllocationRequest-&gt;sumItemSize))</div>
+<div class="line"><a name="l09085"></a><span class="lineno"> 9085</span>&#160;                {</div>
+<div class="line"><a name="l09086"></a><span class="lineno"> 9086</span>&#160;                    pAllocationRequest-&gt;item = it;</div>
+<div class="line"><a name="l09087"></a><span class="lineno"> 9087</span>&#160;                    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09088"></a><span class="lineno"> 9088</span>&#160;                }</div>
+<div class="line"><a name="l09089"></a><span class="lineno"> 9089</span>&#160;            }</div>
+<div class="line"><a name="l09090"></a><span class="lineno"> 9090</span>&#160;        }</div>
+<div class="line"><a name="l09091"></a><span class="lineno"> 9091</span>&#160;        <span class="keywordflow">else</span> <span class="comment">// WORST_FIT, FIRST_FIT</span></div>
+<div class="line"><a name="l09092"></a><span class="lineno"> 9092</span>&#160;        {</div>
+<div class="line"><a name="l09093"></a><span class="lineno"> 9093</span>&#160;            <span class="comment">// Search staring from biggest suballocations.</span></div>
+<div class="line"><a name="l09094"></a><span class="lineno"> 9094</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> index = freeSuballocCount; index--; )</div>
+<div class="line"><a name="l09095"></a><span class="lineno"> 9095</span>&#160;            {</div>
+<div class="line"><a name="l09096"></a><span class="lineno"> 9096</span>&#160;                <span class="keywordflow">if</span>(CheckAllocation(</div>
+<div class="line"><a name="l09097"></a><span class="lineno"> 9097</span>&#160;                    currentFrameIndex,</div>
+<div class="line"><a name="l09098"></a><span class="lineno"> 9098</span>&#160;                    frameInUseCount,</div>
+<div class="line"><a name="l09099"></a><span class="lineno"> 9099</span>&#160;                    bufferImageGranularity,</div>
+<div class="line"><a name="l09100"></a><span class="lineno"> 9100</span>&#160;                    allocSize,</div>
+<div class="line"><a name="l09101"></a><span class="lineno"> 9101</span>&#160;                    allocAlignment,</div>
+<div class="line"><a name="l09102"></a><span class="lineno"> 9102</span>&#160;                    allocType,</div>
+<div class="line"><a name="l09103"></a><span class="lineno"> 9103</span>&#160;                    m_FreeSuballocationsBySize[index],</div>
+<div class="line"><a name="l09104"></a><span class="lineno"> 9104</span>&#160;                    <span class="keyword">false</span>, <span class="comment">// canMakeOtherLost</span></div>
+<div class="line"><a name="l09105"></a><span class="lineno"> 9105</span>&#160;                    &amp;pAllocationRequest-&gt;offset,</div>
+<div class="line"><a name="l09106"></a><span class="lineno"> 9106</span>&#160;                    &amp;pAllocationRequest-&gt;itemsToMakeLostCount,</div>
+<div class="line"><a name="l09107"></a><span class="lineno"> 9107</span>&#160;                    &amp;pAllocationRequest-&gt;sumFreeSize,</div>
+<div class="line"><a name="l09108"></a><span class="lineno"> 9108</span>&#160;                    &amp;pAllocationRequest-&gt;sumItemSize))</div>
+<div class="line"><a name="l09109"></a><span class="lineno"> 9109</span>&#160;                {</div>
+<div class="line"><a name="l09110"></a><span class="lineno"> 9110</span>&#160;                    pAllocationRequest-&gt;item = m_FreeSuballocationsBySize[index];</div>
+<div class="line"><a name="l09111"></a><span class="lineno"> 9111</span>&#160;                    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09112"></a><span class="lineno"> 9112</span>&#160;                }</div>
+<div class="line"><a name="l09113"></a><span class="lineno"> 9113</span>&#160;            }</div>
+<div class="line"><a name="l09114"></a><span class="lineno"> 9114</span>&#160;        }</div>
+<div class="line"><a name="l09115"></a><span class="lineno"> 9115</span>&#160;    }</div>
+<div class="line"><a name="l09116"></a><span class="lineno"> 9116</span>&#160; </div>
+<div class="line"><a name="l09117"></a><span class="lineno"> 9117</span>&#160;    <span class="keywordflow">if</span>(canMakeOtherLost)</div>
+<div class="line"><a name="l09118"></a><span class="lineno"> 9118</span>&#160;    {</div>
+<div class="line"><a name="l09119"></a><span class="lineno"> 9119</span>&#160;        <span class="comment">// Brute-force algorithm. TODO: Come up with something better.</span></div>
+<div class="line"><a name="l09120"></a><span class="lineno"> 9120</span>&#160; </div>
+<div class="line"><a name="l09121"></a><span class="lineno"> 9121</span>&#160;        <span class="keywordtype">bool</span> found = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09122"></a><span class="lineno"> 9122</span>&#160;        VmaAllocationRequest tmpAllocRequest = {};</div>
+<div class="line"><a name="l09123"></a><span class="lineno"> 9123</span>&#160;        tmpAllocRequest.type = VmaAllocationRequestType::Normal;</div>
+<div class="line"><a name="l09124"></a><span class="lineno"> 9124</span>&#160;        <span class="keywordflow">for</span>(VmaSuballocationList::iterator suballocIt = m_Suballocations.begin();</div>
+<div class="line"><a name="l09125"></a><span class="lineno"> 9125</span>&#160;            suballocIt != m_Suballocations.end();</div>
+<div class="line"><a name="l09126"></a><span class="lineno"> 9126</span>&#160;            ++suballocIt)</div>
+<div class="line"><a name="l09127"></a><span class="lineno"> 9127</span>&#160;        {</div>
+<div class="line"><a name="l09128"></a><span class="lineno"> 9128</span>&#160;            <span class="keywordflow">if</span>(suballocIt-&gt;type == VMA_SUBALLOCATION_TYPE_FREE ||</div>
+<div class="line"><a name="l09129"></a><span class="lineno"> 9129</span>&#160;                suballocIt-&gt;hAllocation-&gt;CanBecomeLost())</div>
+<div class="line"><a name="l09130"></a><span class="lineno"> 9130</span>&#160;            {</div>
+<div class="line"><a name="l09131"></a><span class="lineno"> 9131</span>&#160;                <span class="keywordflow">if</span>(CheckAllocation(</div>
+<div class="line"><a name="l09132"></a><span class="lineno"> 9132</span>&#160;                    currentFrameIndex,</div>
+<div class="line"><a name="l09133"></a><span class="lineno"> 9133</span>&#160;                    frameInUseCount,</div>
+<div class="line"><a name="l09134"></a><span class="lineno"> 9134</span>&#160;                    bufferImageGranularity,</div>
+<div class="line"><a name="l09135"></a><span class="lineno"> 9135</span>&#160;                    allocSize,</div>
+<div class="line"><a name="l09136"></a><span class="lineno"> 9136</span>&#160;                    allocAlignment,</div>
+<div class="line"><a name="l09137"></a><span class="lineno"> 9137</span>&#160;                    allocType,</div>
+<div class="line"><a name="l09138"></a><span class="lineno"> 9138</span>&#160;                    suballocIt,</div>
+<div class="line"><a name="l09139"></a><span class="lineno"> 9139</span>&#160;                    canMakeOtherLost,</div>
+<div class="line"><a name="l09140"></a><span class="lineno"> 9140</span>&#160;                    &amp;tmpAllocRequest.offset,</div>
+<div class="line"><a name="l09141"></a><span class="lineno"> 9141</span>&#160;                    &amp;tmpAllocRequest.itemsToMakeLostCount,</div>
+<div class="line"><a name="l09142"></a><span class="lineno"> 9142</span>&#160;                    &amp;tmpAllocRequest.sumFreeSize,</div>
+<div class="line"><a name="l09143"></a><span class="lineno"> 9143</span>&#160;                    &amp;tmpAllocRequest.sumItemSize))</div>
+<div class="line"><a name="l09144"></a><span class="lineno"> 9144</span>&#160;                {</div>
+<div class="line"><a name="l09145"></a><span class="lineno"> 9145</span>&#160;                    <span class="keywordflow">if</span>(strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>)</div>
+<div class="line"><a name="l09146"></a><span class="lineno"> 9146</span>&#160;                    {</div>
+<div class="line"><a name="l09147"></a><span class="lineno"> 9147</span>&#160;                        *pAllocationRequest = tmpAllocRequest;</div>
+<div class="line"><a name="l09148"></a><span class="lineno"> 9148</span>&#160;                        pAllocationRequest-&gt;item = suballocIt;</div>
+<div class="line"><a name="l09149"></a><span class="lineno"> 9149</span>&#160;                        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l09150"></a><span class="lineno"> 9150</span>&#160;                    }</div>
+<div class="line"><a name="l09151"></a><span class="lineno"> 9151</span>&#160;                    <span class="keywordflow">if</span>(!found || tmpAllocRequest.CalcCost() &lt; pAllocationRequest-&gt;CalcCost())</div>
+<div class="line"><a name="l09152"></a><span class="lineno"> 9152</span>&#160;                    {</div>
+<div class="line"><a name="l09153"></a><span class="lineno"> 9153</span>&#160;                        *pAllocationRequest = tmpAllocRequest;</div>
+<div class="line"><a name="l09154"></a><span class="lineno"> 9154</span>&#160;                        pAllocationRequest-&gt;item = suballocIt;</div>
+<div class="line"><a name="l09155"></a><span class="lineno"> 9155</span>&#160;                        found = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09156"></a><span class="lineno"> 9156</span>&#160;                    }</div>
+<div class="line"><a name="l09157"></a><span class="lineno"> 9157</span>&#160;                }</div>
+<div class="line"><a name="l09158"></a><span class="lineno"> 9158</span>&#160;            }</div>
+<div class="line"><a name="l09159"></a><span class="lineno"> 9159</span>&#160;        }</div>
+<div class="line"><a name="l09160"></a><span class="lineno"> 9160</span>&#160; </div>
+<div class="line"><a name="l09161"></a><span class="lineno"> 9161</span>&#160;        <span class="keywordflow">return</span> found;</div>
+<div class="line"><a name="l09162"></a><span class="lineno"> 9162</span>&#160;    }</div>
+<div class="line"><a name="l09163"></a><span class="lineno"> 9163</span>&#160; </div>
+<div class="line"><a name="l09164"></a><span class="lineno"> 9164</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09165"></a><span class="lineno"> 9165</span>&#160;}</div>
+<div class="line"><a name="l09166"></a><span class="lineno"> 9166</span>&#160; </div>
+<div class="line"><a name="l09167"></a><span class="lineno"> 9167</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::MakeRequestedAllocationsLost(</div>
+<div class="line"><a name="l09168"></a><span class="lineno"> 9168</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l09169"></a><span class="lineno"> 9169</span>&#160;    uint32_t frameInUseCount,</div>
+<div class="line"><a name="l09170"></a><span class="lineno"> 9170</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
+<div class="line"><a name="l09171"></a><span class="lineno"> 9171</span>&#160;{</div>
+<div class="line"><a name="l09172"></a><span class="lineno"> 9172</span>&#160;    VMA_ASSERT(pAllocationRequest &amp;&amp; pAllocationRequest-&gt;type == VmaAllocationRequestType::Normal);</div>
+<div class="line"><a name="l09173"></a><span class="lineno"> 9173</span>&#160; </div>
+<div class="line"><a name="l09174"></a><span class="lineno"> 9174</span>&#160;    <span class="keywordflow">while</span>(pAllocationRequest-&gt;itemsToMakeLostCount &gt; 0)</div>
+<div class="line"><a name="l09175"></a><span class="lineno"> 9175</span>&#160;    {</div>
+<div class="line"><a name="l09176"></a><span class="lineno"> 9176</span>&#160;        <span class="keywordflow">if</span>(pAllocationRequest-&gt;item-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l09177"></a><span class="lineno"> 9177</span>&#160;        {</div>
+<div class="line"><a name="l09178"></a><span class="lineno"> 9178</span>&#160;            ++pAllocationRequest-&gt;item;</div>
+<div class="line"><a name="l09179"></a><span class="lineno"> 9179</span>&#160;        }</div>
+<div class="line"><a name="l09180"></a><span class="lineno"> 9180</span>&#160;        VMA_ASSERT(pAllocationRequest-&gt;item != m_Suballocations.end());</div>
+<div class="line"><a name="l09181"></a><span class="lineno"> 9181</span>&#160;        VMA_ASSERT(pAllocationRequest-&gt;item-&gt;hAllocation != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l09182"></a><span class="lineno"> 9182</span>&#160;        VMA_ASSERT(pAllocationRequest-&gt;item-&gt;hAllocation-&gt;CanBecomeLost());</div>
+<div class="line"><a name="l09183"></a><span class="lineno"> 9183</span>&#160;        <span class="keywordflow">if</span>(pAllocationRequest-&gt;item-&gt;hAllocation-&gt;MakeLost(currentFrameIndex, frameInUseCount))</div>
+<div class="line"><a name="l09184"></a><span class="lineno"> 9184</span>&#160;        {</div>
+<div class="line"><a name="l09185"></a><span class="lineno"> 9185</span>&#160;            pAllocationRequest-&gt;item = FreeSuballocation(pAllocationRequest-&gt;item);</div>
+<div class="line"><a name="l09186"></a><span class="lineno"> 9186</span>&#160;            --pAllocationRequest-&gt;itemsToMakeLostCount;</div>
+<div class="line"><a name="l09187"></a><span class="lineno"> 9187</span>&#160;        }</div>
+<div class="line"><a name="l09188"></a><span class="lineno"> 9188</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09189"></a><span class="lineno"> 9189</span>&#160;        {</div>
+<div class="line"><a name="l09190"></a><span class="lineno"> 9190</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09191"></a><span class="lineno"> 9191</span>&#160;        }</div>
+<div class="line"><a name="l09192"></a><span class="lineno"> 9192</span>&#160;    }</div>
+<div class="line"><a name="l09193"></a><span class="lineno"> 9193</span>&#160; </div>
+<div class="line"><a name="l09194"></a><span class="lineno"> 9194</span>&#160;    VMA_HEAVY_ASSERT(Validate());</div>
+<div class="line"><a name="l09195"></a><span class="lineno"> 9195</span>&#160;    VMA_ASSERT(pAllocationRequest-&gt;item != m_Suballocations.end());</div>
+<div class="line"><a name="l09196"></a><span class="lineno"> 9196</span>&#160;    VMA_ASSERT(pAllocationRequest-&gt;item-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09197"></a><span class="lineno"> 9197</span>&#160;    </div>
+<div class="line"><a name="l09198"></a><span class="lineno"> 9198</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09199"></a><span class="lineno"> 9199</span>&#160;}</div>
+<div class="line"><a name="l09200"></a><span class="lineno"> 9200</span>&#160; </div>
+<div class="line"><a name="l09201"></a><span class="lineno"> 9201</span>&#160;uint32_t VmaBlockMetadata_Generic::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)</div>
+<div class="line"><a name="l09202"></a><span class="lineno"> 9202</span>&#160;{</div>
+<div class="line"><a name="l09203"></a><span class="lineno"> 9203</span>&#160;    uint32_t lostAllocationCount = 0;</div>
+<div class="line"><a name="l09204"></a><span class="lineno"> 9204</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::iterator it = m_Suballocations.begin();</div>
+<div class="line"><a name="l09205"></a><span class="lineno"> 9205</span>&#160;        it != m_Suballocations.end();</div>
+<div class="line"><a name="l09206"></a><span class="lineno"> 9206</span>&#160;        ++it)</div>
+<div class="line"><a name="l09207"></a><span class="lineno"> 9207</span>&#160;    {</div>
+<div class="line"><a name="l09208"></a><span class="lineno"> 9208</span>&#160;        <span class="keywordflow">if</span>(it-&gt;type != VMA_SUBALLOCATION_TYPE_FREE &amp;&amp;</div>
+<div class="line"><a name="l09209"></a><span class="lineno"> 9209</span>&#160;            it-&gt;hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
+<div class="line"><a name="l09210"></a><span class="lineno"> 9210</span>&#160;            it-&gt;hAllocation-&gt;MakeLost(currentFrameIndex, frameInUseCount))</div>
+<div class="line"><a name="l09211"></a><span class="lineno"> 9211</span>&#160;        {</div>
+<div class="line"><a name="l09212"></a><span class="lineno"> 9212</span>&#160;            it = FreeSuballocation(it);</div>
+<div class="line"><a name="l09213"></a><span class="lineno"> 9213</span>&#160;            ++lostAllocationCount;</div>
+<div class="line"><a name="l09214"></a><span class="lineno"> 9214</span>&#160;        }</div>
+<div class="line"><a name="l09215"></a><span class="lineno"> 9215</span>&#160;    }</div>
+<div class="line"><a name="l09216"></a><span class="lineno"> 9216</span>&#160;    <span class="keywordflow">return</span> lostAllocationCount;</div>
+<div class="line"><a name="l09217"></a><span class="lineno"> 9217</span>&#160;}</div>
+<div class="line"><a name="l09218"></a><span class="lineno"> 9218</span>&#160; </div>
+<div class="line"><a name="l09219"></a><span class="lineno"> 9219</span>&#160;VkResult VmaBlockMetadata_Generic::CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData)</div>
+<div class="line"><a name="l09220"></a><span class="lineno"> 9220</span>&#160;{</div>
+<div class="line"><a name="l09221"></a><span class="lineno"> 9221</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::iterator it = m_Suballocations.begin();</div>
+<div class="line"><a name="l09222"></a><span class="lineno"> 9222</span>&#160;        it != m_Suballocations.end();</div>
+<div class="line"><a name="l09223"></a><span class="lineno"> 9223</span>&#160;        ++it)</div>
+<div class="line"><a name="l09224"></a><span class="lineno"> 9224</span>&#160;    {</div>
+<div class="line"><a name="l09225"></a><span class="lineno"> 9225</span>&#160;        <span class="keywordflow">if</span>(it-&gt;type != VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l09226"></a><span class="lineno"> 9226</span>&#160;        {</div>
+<div class="line"><a name="l09227"></a><span class="lineno"> 9227</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, it-&gt;offset - VMA_DEBUG_MARGIN))</div>
+<div class="line"><a name="l09228"></a><span class="lineno"> 9228</span>&#160;            {</div>
+<div class="line"><a name="l09229"></a><span class="lineno"> 9229</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!&quot;</span>);</div>
+<div class="line"><a name="l09230"></a><span class="lineno"> 9230</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
+<div class="line"><a name="l09231"></a><span class="lineno"> 9231</span>&#160;            }</div>
+<div class="line"><a name="l09232"></a><span class="lineno"> 9232</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, it-&gt;offset + it-&gt;size))</div>
+<div class="line"><a name="l09233"></a><span class="lineno"> 9233</span>&#160;            {</div>
+<div class="line"><a name="l09234"></a><span class="lineno"> 9234</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!&quot;</span>);</div>
+<div class="line"><a name="l09235"></a><span class="lineno"> 9235</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
+<div class="line"><a name="l09236"></a><span class="lineno"> 9236</span>&#160;            }</div>
+<div class="line"><a name="l09237"></a><span class="lineno"> 9237</span>&#160;        }</div>
+<div class="line"><a name="l09238"></a><span class="lineno"> 9238</span>&#160;    }</div>
+<div class="line"><a name="l09239"></a><span class="lineno"> 9239</span>&#160; </div>
+<div class="line"><a name="l09240"></a><span class="lineno"> 9240</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l09241"></a><span class="lineno"> 9241</span>&#160;}</div>
+<div class="line"><a name="l09242"></a><span class="lineno"> 9242</span>&#160; </div>
+<div class="line"><a name="l09243"></a><span class="lineno"> 9243</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::Alloc(</div>
+<div class="line"><a name="l09244"></a><span class="lineno"> 9244</span>&#160;    <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
+<div class="line"><a name="l09245"></a><span class="lineno"> 9245</span>&#160;    VmaSuballocationType type,</div>
+<div class="line"><a name="l09246"></a><span class="lineno"> 9246</span>&#160;    VkDeviceSize allocSize,</div>
+<div class="line"><a name="l09247"></a><span class="lineno"> 9247</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
+<div class="line"><a name="l09248"></a><span class="lineno"> 9248</span>&#160;{</div>
+<div class="line"><a name="l09249"></a><span class="lineno"> 9249</span>&#160;    VMA_ASSERT(request.type == VmaAllocationRequestType::Normal);</div>
+<div class="line"><a name="l09250"></a><span class="lineno"> 9250</span>&#160;    VMA_ASSERT(request.item != m_Suballocations.end());</div>
+<div class="line"><a name="l09251"></a><span class="lineno"> 9251</span>&#160;    VmaSuballocation&amp; suballoc = *request.item;</div>
+<div class="line"><a name="l09252"></a><span class="lineno"> 9252</span>&#160;    <span class="comment">// Given suballocation is a free block.</span></div>
+<div class="line"><a name="l09253"></a><span class="lineno"> 9253</span>&#160;    VMA_ASSERT(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09254"></a><span class="lineno"> 9254</span>&#160;    <span class="comment">// Given offset is inside this suballocation.</span></div>
+<div class="line"><a name="l09255"></a><span class="lineno"> 9255</span>&#160;    VMA_ASSERT(request.offset &gt;= suballoc.offset);</div>
+<div class="line"><a name="l09256"></a><span class="lineno"> 9256</span>&#160;    <span class="keyword">const</span> VkDeviceSize paddingBegin = request.offset - suballoc.offset;</div>
+<div class="line"><a name="l09257"></a><span class="lineno"> 9257</span>&#160;    VMA_ASSERT(suballoc.size &gt;= paddingBegin + allocSize);</div>
+<div class="line"><a name="l09258"></a><span class="lineno"> 9258</span>&#160;    <span class="keyword">const</span> VkDeviceSize paddingEnd = suballoc.size - paddingBegin - allocSize;</div>
+<div class="line"><a name="l09259"></a><span class="lineno"> 9259</span>&#160; </div>
+<div class="line"><a name="l09260"></a><span class="lineno"> 9260</span>&#160;    <span class="comment">// Unregister this free suballocation from m_FreeSuballocationsBySize and update</span></div>
+<div class="line"><a name="l09261"></a><span class="lineno"> 9261</span>&#160;    <span class="comment">// it to become used.</span></div>
+<div class="line"><a name="l09262"></a><span class="lineno"> 9262</span>&#160;    UnregisterFreeSuballocation(request.item);</div>
+<div class="line"><a name="l09263"></a><span class="lineno"> 9263</span>&#160; </div>
+<div class="line"><a name="l09264"></a><span class="lineno"> 9264</span>&#160;    suballoc.offset = request.offset;</div>
+<div class="line"><a name="l09265"></a><span class="lineno"> 9265</span>&#160;    suballoc.size = allocSize;</div>
+<div class="line"><a name="l09266"></a><span class="lineno"> 9266</span>&#160;    suballoc.type = type;</div>
+<div class="line"><a name="l09267"></a><span class="lineno"> 9267</span>&#160;    suballoc.hAllocation = hAllocation;</div>
+<div class="line"><a name="l09268"></a><span class="lineno"> 9268</span>&#160; </div>
+<div class="line"><a name="l09269"></a><span class="lineno"> 9269</span>&#160;    <span class="comment">// If there are any free bytes remaining at the end, insert new free suballocation after current one.</span></div>
+<div class="line"><a name="l09270"></a><span class="lineno"> 9270</span>&#160;    <span class="keywordflow">if</span>(paddingEnd)</div>
+<div class="line"><a name="l09271"></a><span class="lineno"> 9271</span>&#160;    {</div>
+<div class="line"><a name="l09272"></a><span class="lineno"> 9272</span>&#160;        VmaSuballocation paddingSuballoc = {};</div>
+<div class="line"><a name="l09273"></a><span class="lineno"> 9273</span>&#160;        paddingSuballoc.offset = request.offset + allocSize;</div>
+<div class="line"><a name="l09274"></a><span class="lineno"> 9274</span>&#160;        paddingSuballoc.size = paddingEnd;</div>
+<div class="line"><a name="l09275"></a><span class="lineno"> 9275</span>&#160;        paddingSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
+<div class="line"><a name="l09276"></a><span class="lineno"> 9276</span>&#160;        VmaSuballocationList::iterator next = request.item;</div>
+<div class="line"><a name="l09277"></a><span class="lineno"> 9277</span>&#160;        ++next;</div>
+<div class="line"><a name="l09278"></a><span class="lineno"> 9278</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator paddingEndItem =</div>
+<div class="line"><a name="l09279"></a><span class="lineno"> 9279</span>&#160;            m_Suballocations.insert(next, paddingSuballoc);</div>
+<div class="line"><a name="l09280"></a><span class="lineno"> 9280</span>&#160;        RegisterFreeSuballocation(paddingEndItem);</div>
+<div class="line"><a name="l09281"></a><span class="lineno"> 9281</span>&#160;    }</div>
+<div class="line"><a name="l09282"></a><span class="lineno"> 9282</span>&#160; </div>
+<div class="line"><a name="l09283"></a><span class="lineno"> 9283</span>&#160;    <span class="comment">// If there are any free bytes remaining at the beginning, insert new free suballocation before current one.</span></div>
+<div class="line"><a name="l09284"></a><span class="lineno"> 9284</span>&#160;    <span class="keywordflow">if</span>(paddingBegin)</div>
+<div class="line"><a name="l09285"></a><span class="lineno"> 9285</span>&#160;    {</div>
+<div class="line"><a name="l09286"></a><span class="lineno"> 9286</span>&#160;        VmaSuballocation paddingSuballoc = {};</div>
+<div class="line"><a name="l09287"></a><span class="lineno"> 9287</span>&#160;        paddingSuballoc.offset = request.offset - paddingBegin;</div>
+<div class="line"><a name="l09288"></a><span class="lineno"> 9288</span>&#160;        paddingSuballoc.size = paddingBegin;</div>
+<div class="line"><a name="l09289"></a><span class="lineno"> 9289</span>&#160;        paddingSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
+<div class="line"><a name="l09290"></a><span class="lineno"> 9290</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator paddingBeginItem =</div>
+<div class="line"><a name="l09291"></a><span class="lineno"> 9291</span>&#160;            m_Suballocations.insert(request.item, paddingSuballoc);</div>
+<div class="line"><a name="l09292"></a><span class="lineno"> 9292</span>&#160;        RegisterFreeSuballocation(paddingBeginItem);</div>
+<div class="line"><a name="l09293"></a><span class="lineno"> 9293</span>&#160;    }</div>
+<div class="line"><a name="l09294"></a><span class="lineno"> 9294</span>&#160; </div>
+<div class="line"><a name="l09295"></a><span class="lineno"> 9295</span>&#160;    <span class="comment">// Update totals.</span></div>
+<div class="line"><a name="l09296"></a><span class="lineno"> 9296</span>&#160;    m_FreeCount = m_FreeCount - 1;</div>
+<div class="line"><a name="l09297"></a><span class="lineno"> 9297</span>&#160;    <span class="keywordflow">if</span>(paddingBegin &gt; 0)</div>
+<div class="line"><a name="l09298"></a><span class="lineno"> 9298</span>&#160;    {</div>
+<div class="line"><a name="l09299"></a><span class="lineno"> 9299</span>&#160;        ++m_FreeCount;</div>
+<div class="line"><a name="l09300"></a><span class="lineno"> 9300</span>&#160;    }</div>
+<div class="line"><a name="l09301"></a><span class="lineno"> 9301</span>&#160;    <span class="keywordflow">if</span>(paddingEnd &gt; 0)</div>
+<div class="line"><a name="l09302"></a><span class="lineno"> 9302</span>&#160;    {</div>
+<div class="line"><a name="l09303"></a><span class="lineno"> 9303</span>&#160;        ++m_FreeCount;</div>
+<div class="line"><a name="l09304"></a><span class="lineno"> 9304</span>&#160;    }</div>
+<div class="line"><a name="l09305"></a><span class="lineno"> 9305</span>&#160;    m_SumFreeSize -= allocSize;</div>
+<div class="line"><a name="l09306"></a><span class="lineno"> 9306</span>&#160;}</div>
+<div class="line"><a name="l09307"></a><span class="lineno"> 9307</span>&#160; </div>
+<div class="line"><a name="l09308"></a><span class="lineno"> 9308</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l09309"></a><span class="lineno"> 9309</span>&#160;{</div>
+<div class="line"><a name="l09310"></a><span class="lineno"> 9310</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();</div>
+<div class="line"><a name="l09311"></a><span class="lineno"> 9311</span>&#160;        suballocItem != m_Suballocations.end();</div>
+<div class="line"><a name="l09312"></a><span class="lineno"> 9312</span>&#160;        ++suballocItem)</div>
+<div class="line"><a name="l09313"></a><span class="lineno"> 9313</span>&#160;    {</div>
+<div class="line"><a name="l09314"></a><span class="lineno"> 9314</span>&#160;        VmaSuballocation&amp; suballoc = *suballocItem;</div>
+<div class="line"><a name="l09315"></a><span class="lineno"> 9315</span>&#160;        <span class="keywordflow">if</span>(suballoc.hAllocation == allocation)</div>
 <div class="line"><a name="l09316"></a><span class="lineno"> 9316</span>&#160;        {</div>
-<div class="line"><a name="l09317"></a><span class="lineno"> 9317</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09318"></a><span class="lineno"> 9318</span>&#160;        }</div>
-<div class="line"><a name="l09319"></a><span class="lineno"> 9319</span>&#160; </div>
-<div class="line"><a name="l09320"></a><span class="lineno"> 9320</span>&#160;        <span class="comment">// Start from offset equal to beginning of this suballocation.</span></div>
-<div class="line"><a name="l09321"></a><span class="lineno"> 9321</span>&#160;        *pOffset = suballoc.offset;</div>
-<div class="line"><a name="l09322"></a><span class="lineno"> 9322</span>&#160;    </div>
-<div class="line"><a name="l09323"></a><span class="lineno"> 9323</span>&#160;        <span class="comment">// Apply VMA_DEBUG_MARGIN at the beginning.</span></div>
-<div class="line"><a name="l09324"></a><span class="lineno"> 9324</span>&#160;        <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN &gt; 0)</div>
-<div class="line"><a name="l09325"></a><span class="lineno"> 9325</span>&#160;        {</div>
-<div class="line"><a name="l09326"></a><span class="lineno"> 9326</span>&#160;            *pOffset += VMA_DEBUG_MARGIN;</div>
-<div class="line"><a name="l09327"></a><span class="lineno"> 9327</span>&#160;        }</div>
-<div class="line"><a name="l09328"></a><span class="lineno"> 9328</span>&#160;    </div>
-<div class="line"><a name="l09329"></a><span class="lineno"> 9329</span>&#160;        <span class="comment">// Apply alignment.</span></div>
-<div class="line"><a name="l09330"></a><span class="lineno"> 9330</span>&#160;        *pOffset = VmaAlignUp(*pOffset, allocAlignment);</div>
-<div class="line"><a name="l09331"></a><span class="lineno"> 9331</span>&#160;    </div>
-<div class="line"><a name="l09332"></a><span class="lineno"> 9332</span>&#160;        <span class="comment">// Check previous suballocations for BufferImageGranularity conflicts.</span></div>
-<div class="line"><a name="l09333"></a><span class="lineno"> 9333</span>&#160;        <span class="comment">// Make bigger alignment if necessary.</span></div>
-<div class="line"><a name="l09334"></a><span class="lineno"> 9334</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
-<div class="line"><a name="l09335"></a><span class="lineno"> 9335</span>&#160;        {</div>
-<div class="line"><a name="l09336"></a><span class="lineno"> 9336</span>&#160;            <span class="keywordtype">bool</span> bufferImageGranularityConflict = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09337"></a><span class="lineno"> 9337</span>&#160;            VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;</div>
-<div class="line"><a name="l09338"></a><span class="lineno"> 9338</span>&#160;            <span class="keywordflow">while</span>(prevSuballocItem != m_Suballocations.cbegin())</div>
-<div class="line"><a name="l09339"></a><span class="lineno"> 9339</span>&#160;            {</div>
-<div class="line"><a name="l09340"></a><span class="lineno"> 9340</span>&#160;                --prevSuballocItem;</div>
-<div class="line"><a name="l09341"></a><span class="lineno"> 9341</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; prevSuballoc = *prevSuballocItem;</div>
-<div class="line"><a name="l09342"></a><span class="lineno"> 9342</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, *pOffset, bufferImageGranularity))</div>
-<div class="line"><a name="l09343"></a><span class="lineno"> 9343</span>&#160;                {</div>
-<div class="line"><a name="l09344"></a><span class="lineno"> 9344</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))</div>
-<div class="line"><a name="l09345"></a><span class="lineno"> 9345</span>&#160;                    {</div>
-<div class="line"><a name="l09346"></a><span class="lineno"> 9346</span>&#160;                        bufferImageGranularityConflict = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l09347"></a><span class="lineno"> 9347</span>&#160;                        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l09348"></a><span class="lineno"> 9348</span>&#160;                    }</div>
-<div class="line"><a name="l09349"></a><span class="lineno"> 9349</span>&#160;                }</div>
-<div class="line"><a name="l09350"></a><span class="lineno"> 9350</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09351"></a><span class="lineno"> 9351</span>&#160;                    <span class="comment">// Already on previous page.</span></div>
-<div class="line"><a name="l09352"></a><span class="lineno"> 9352</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l09353"></a><span class="lineno"> 9353</span>&#160;            }</div>
-<div class="line"><a name="l09354"></a><span class="lineno"> 9354</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularityConflict)</div>
-<div class="line"><a name="l09355"></a><span class="lineno"> 9355</span>&#160;            {</div>
-<div class="line"><a name="l09356"></a><span class="lineno"> 9356</span>&#160;                *pOffset = VmaAlignUp(*pOffset, bufferImageGranularity);</div>
-<div class="line"><a name="l09357"></a><span class="lineno"> 9357</span>&#160;            }</div>
-<div class="line"><a name="l09358"></a><span class="lineno"> 9358</span>&#160;        }</div>
-<div class="line"><a name="l09359"></a><span class="lineno"> 9359</span>&#160;    </div>
-<div class="line"><a name="l09360"></a><span class="lineno"> 9360</span>&#160;        <span class="comment">// Calculate padding at the beginning based on current offset.</span></div>
-<div class="line"><a name="l09361"></a><span class="lineno"> 9361</span>&#160;        <span class="keyword">const</span> VkDeviceSize paddingBegin = *pOffset - suballoc.offset;</div>
-<div class="line"><a name="l09362"></a><span class="lineno"> 9362</span>&#160; </div>
-<div class="line"><a name="l09363"></a><span class="lineno"> 9363</span>&#160;        <span class="comment">// Calculate required margin at the end.</span></div>
-<div class="line"><a name="l09364"></a><span class="lineno"> 9364</span>&#160;        <span class="keyword">const</span> VkDeviceSize requiredEndMargin = VMA_DEBUG_MARGIN;</div>
-<div class="line"><a name="l09365"></a><span class="lineno"> 9365</span>&#160; </div>
-<div class="line"><a name="l09366"></a><span class="lineno"> 9366</span>&#160;        <span class="comment">// Fail if requested size plus margin before and after is bigger than size of this suballocation.</span></div>
-<div class="line"><a name="l09367"></a><span class="lineno"> 9367</span>&#160;        <span class="keywordflow">if</span>(paddingBegin + allocSize + requiredEndMargin &gt; suballoc.size)</div>
-<div class="line"><a name="l09368"></a><span class="lineno"> 9368</span>&#160;        {</div>
-<div class="line"><a name="l09369"></a><span class="lineno"> 9369</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09370"></a><span class="lineno"> 9370</span>&#160;        }</div>
-<div class="line"><a name="l09371"></a><span class="lineno"> 9371</span>&#160; </div>
-<div class="line"><a name="l09372"></a><span class="lineno"> 9372</span>&#160;        <span class="comment">// Check next suballocations for BufferImageGranularity conflicts.</span></div>
-<div class="line"><a name="l09373"></a><span class="lineno"> 9373</span>&#160;        <span class="comment">// If conflict exists, allocation cannot be made here.</span></div>
-<div class="line"><a name="l09374"></a><span class="lineno"> 9374</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
-<div class="line"><a name="l09375"></a><span class="lineno"> 9375</span>&#160;        {</div>
-<div class="line"><a name="l09376"></a><span class="lineno"> 9376</span>&#160;            VmaSuballocationList::const_iterator nextSuballocItem = suballocItem;</div>
-<div class="line"><a name="l09377"></a><span class="lineno"> 9377</span>&#160;            ++nextSuballocItem;</div>
-<div class="line"><a name="l09378"></a><span class="lineno"> 9378</span>&#160;            <span class="keywordflow">while</span>(nextSuballocItem != m_Suballocations.cend())</div>
-<div class="line"><a name="l09379"></a><span class="lineno"> 9379</span>&#160;            {</div>
-<div class="line"><a name="l09380"></a><span class="lineno"> 9380</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; nextSuballoc = *nextSuballocItem;</div>
-<div class="line"><a name="l09381"></a><span class="lineno"> 9381</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(*pOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))</div>
-<div class="line"><a name="l09382"></a><span class="lineno"> 9382</span>&#160;                {</div>
-<div class="line"><a name="l09383"></a><span class="lineno"> 9383</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))</div>
-<div class="line"><a name="l09384"></a><span class="lineno"> 9384</span>&#160;                    {</div>
-<div class="line"><a name="l09385"></a><span class="lineno"> 9385</span>&#160;                        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09386"></a><span class="lineno"> 9386</span>&#160;                    }</div>
-<div class="line"><a name="l09387"></a><span class="lineno"> 9387</span>&#160;                }</div>
-<div class="line"><a name="l09388"></a><span class="lineno"> 9388</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09389"></a><span class="lineno"> 9389</span>&#160;                {</div>
-<div class="line"><a name="l09390"></a><span class="lineno"> 9390</span>&#160;                    <span class="comment">// Already on next page.</span></div>
-<div class="line"><a name="l09391"></a><span class="lineno"> 9391</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l09392"></a><span class="lineno"> 9392</span>&#160;                }</div>
-<div class="line"><a name="l09393"></a><span class="lineno"> 9393</span>&#160;                ++nextSuballocItem;</div>
-<div class="line"><a name="l09394"></a><span class="lineno"> 9394</span>&#160;            }</div>
-<div class="line"><a name="l09395"></a><span class="lineno"> 9395</span>&#160;        }</div>
-<div class="line"><a name="l09396"></a><span class="lineno"> 9396</span>&#160;    }</div>
-<div class="line"><a name="l09397"></a><span class="lineno"> 9397</span>&#160; </div>
-<div class="line"><a name="l09398"></a><span class="lineno"> 9398</span>&#160;    <span class="comment">// All tests passed: Success. pOffset is already filled.</span></div>
-<div class="line"><a name="l09399"></a><span class="lineno"> 9399</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l09400"></a><span class="lineno"> 9400</span>&#160;}</div>
-<div class="line"><a name="l09401"></a><span class="lineno"> 9401</span>&#160; </div>
-<div class="line"><a name="l09402"></a><span class="lineno"> 9402</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::MergeFreeWithNext(VmaSuballocationList::iterator item)</div>
-<div class="line"><a name="l09403"></a><span class="lineno"> 9403</span>&#160;{</div>
-<div class="line"><a name="l09404"></a><span class="lineno"> 9404</span>&#160;    VMA_ASSERT(item != m_Suballocations.end());</div>
-<div class="line"><a name="l09405"></a><span class="lineno"> 9405</span>&#160;    VMA_ASSERT(item-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l09406"></a><span class="lineno"> 9406</span>&#160;    </div>
-<div class="line"><a name="l09407"></a><span class="lineno"> 9407</span>&#160;    VmaSuballocationList::iterator nextItem = item;</div>
-<div class="line"><a name="l09408"></a><span class="lineno"> 9408</span>&#160;    ++nextItem;</div>
-<div class="line"><a name="l09409"></a><span class="lineno"> 9409</span>&#160;    VMA_ASSERT(nextItem != m_Suballocations.end());</div>
-<div class="line"><a name="l09410"></a><span class="lineno"> 9410</span>&#160;    VMA_ASSERT(nextItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l09411"></a><span class="lineno"> 9411</span>&#160; </div>
-<div class="line"><a name="l09412"></a><span class="lineno"> 9412</span>&#160;    item-&gt;size += nextItem-&gt;size;</div>
-<div class="line"><a name="l09413"></a><span class="lineno"> 9413</span>&#160;    --m_FreeCount;</div>
-<div class="line"><a name="l09414"></a><span class="lineno"> 9414</span>&#160;    m_Suballocations.erase(nextItem);</div>
-<div class="line"><a name="l09415"></a><span class="lineno"> 9415</span>&#160;}</div>
+<div class="line"><a name="l09317"></a><span class="lineno"> 9317</span>&#160;            FreeSuballocation(suballocItem);</div>
+<div class="line"><a name="l09318"></a><span class="lineno"> 9318</span>&#160;            VMA_HEAVY_ASSERT(Validate());</div>
+<div class="line"><a name="l09319"></a><span class="lineno"> 9319</span>&#160;            <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l09320"></a><span class="lineno"> 9320</span>&#160;        }</div>
+<div class="line"><a name="l09321"></a><span class="lineno"> 9321</span>&#160;    }</div>
+<div class="line"><a name="l09322"></a><span class="lineno"> 9322</span>&#160;    VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Not found!&quot;</span>);</div>
+<div class="line"><a name="l09323"></a><span class="lineno"> 9323</span>&#160;}</div>
+<div class="line"><a name="l09324"></a><span class="lineno"> 9324</span>&#160; </div>
+<div class="line"><a name="l09325"></a><span class="lineno"> 9325</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::FreeAtOffset(VkDeviceSize offset)</div>
+<div class="line"><a name="l09326"></a><span class="lineno"> 9326</span>&#160;{</div>
+<div class="line"><a name="l09327"></a><span class="lineno"> 9327</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();</div>
+<div class="line"><a name="l09328"></a><span class="lineno"> 9328</span>&#160;        suballocItem != m_Suballocations.end();</div>
+<div class="line"><a name="l09329"></a><span class="lineno"> 9329</span>&#160;        ++suballocItem)</div>
+<div class="line"><a name="l09330"></a><span class="lineno"> 9330</span>&#160;    {</div>
+<div class="line"><a name="l09331"></a><span class="lineno"> 9331</span>&#160;        VmaSuballocation&amp; suballoc = *suballocItem;</div>
+<div class="line"><a name="l09332"></a><span class="lineno"> 9332</span>&#160;        <span class="keywordflow">if</span>(suballoc.offset == offset)</div>
+<div class="line"><a name="l09333"></a><span class="lineno"> 9333</span>&#160;        {</div>
+<div class="line"><a name="l09334"></a><span class="lineno"> 9334</span>&#160;            FreeSuballocation(suballocItem);</div>
+<div class="line"><a name="l09335"></a><span class="lineno"> 9335</span>&#160;            <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l09336"></a><span class="lineno"> 9336</span>&#160;        }</div>
+<div class="line"><a name="l09337"></a><span class="lineno"> 9337</span>&#160;    }</div>
+<div class="line"><a name="l09338"></a><span class="lineno"> 9338</span>&#160;    VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Not found!&quot;</span>);</div>
+<div class="line"><a name="l09339"></a><span class="lineno"> 9339</span>&#160;}</div>
+<div class="line"><a name="l09340"></a><span class="lineno"> 9340</span>&#160; </div>
+<div class="line"><a name="l09341"></a><span class="lineno"> 9341</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::ValidateFreeSuballocationList()<span class="keyword"> const</span></div>
+<div class="line"><a name="l09342"></a><span class="lineno"> 9342</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l09343"></a><span class="lineno"> 9343</span>&#160;    VkDeviceSize lastSize = 0;</div>
+<div class="line"><a name="l09344"></a><span class="lineno"> 9344</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0, count = m_FreeSuballocationsBySize.size(); i &lt; count; ++i)</div>
+<div class="line"><a name="l09345"></a><span class="lineno"> 9345</span>&#160;    {</div>
+<div class="line"><a name="l09346"></a><span class="lineno"> 9346</span>&#160;        <span class="keyword">const</span> VmaSuballocationList::iterator it = m_FreeSuballocationsBySize[i];</div>
+<div class="line"><a name="l09347"></a><span class="lineno"> 9347</span>&#160; </div>
+<div class="line"><a name="l09348"></a><span class="lineno"> 9348</span>&#160;        VMA_VALIDATE(it-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09349"></a><span class="lineno"> 9349</span>&#160;        VMA_VALIDATE(it-&gt;size &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER);</div>
+<div class="line"><a name="l09350"></a><span class="lineno"> 9350</span>&#160;        VMA_VALIDATE(it-&gt;size &gt;= lastSize);</div>
+<div class="line"><a name="l09351"></a><span class="lineno"> 9351</span>&#160;        lastSize = it-&gt;size;</div>
+<div class="line"><a name="l09352"></a><span class="lineno"> 9352</span>&#160;    }</div>
+<div class="line"><a name="l09353"></a><span class="lineno"> 9353</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09354"></a><span class="lineno"> 9354</span>&#160;}</div>
+<div class="line"><a name="l09355"></a><span class="lineno"> 9355</span>&#160; </div>
+<div class="line"><a name="l09356"></a><span class="lineno"> 9356</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::CheckAllocation(</div>
+<div class="line"><a name="l09357"></a><span class="lineno"> 9357</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l09358"></a><span class="lineno"> 9358</span>&#160;    uint32_t frameInUseCount,</div>
+<div class="line"><a name="l09359"></a><span class="lineno"> 9359</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l09360"></a><span class="lineno"> 9360</span>&#160;    VkDeviceSize allocSize,</div>
+<div class="line"><a name="l09361"></a><span class="lineno"> 9361</span>&#160;    VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l09362"></a><span class="lineno"> 9362</span>&#160;    VmaSuballocationType allocType,</div>
+<div class="line"><a name="l09363"></a><span class="lineno"> 9363</span>&#160;    VmaSuballocationList::const_iterator suballocItem,</div>
+<div class="line"><a name="l09364"></a><span class="lineno"> 9364</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l09365"></a><span class="lineno"> 9365</span>&#160;    VkDeviceSize* pOffset,</div>
+<div class="line"><a name="l09366"></a><span class="lineno"> 9366</span>&#160;    <span class="keywordtype">size_t</span>* itemsToMakeLostCount,</div>
+<div class="line"><a name="l09367"></a><span class="lineno"> 9367</span>&#160;    VkDeviceSize* pSumFreeSize,</div>
+<div class="line"><a name="l09368"></a><span class="lineno"> 9368</span>&#160;    VkDeviceSize* pSumItemSize)<span class="keyword"> const</span></div>
+<div class="line"><a name="l09369"></a><span class="lineno"> 9369</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l09370"></a><span class="lineno"> 9370</span>&#160;    VMA_ASSERT(allocSize &gt; 0);</div>
+<div class="line"><a name="l09371"></a><span class="lineno"> 9371</span>&#160;    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09372"></a><span class="lineno"> 9372</span>&#160;    VMA_ASSERT(suballocItem != m_Suballocations.cend());</div>
+<div class="line"><a name="l09373"></a><span class="lineno"> 9373</span>&#160;    VMA_ASSERT(pOffset != VMA_NULL);</div>
+<div class="line"><a name="l09374"></a><span class="lineno"> 9374</span>&#160;    </div>
+<div class="line"><a name="l09375"></a><span class="lineno"> 9375</span>&#160;    *itemsToMakeLostCount = 0;</div>
+<div class="line"><a name="l09376"></a><span class="lineno"> 9376</span>&#160;    *pSumFreeSize = 0;</div>
+<div class="line"><a name="l09377"></a><span class="lineno"> 9377</span>&#160;    *pSumItemSize = 0;</div>
+<div class="line"><a name="l09378"></a><span class="lineno"> 9378</span>&#160; </div>
+<div class="line"><a name="l09379"></a><span class="lineno"> 9379</span>&#160;    <span class="keywordflow">if</span>(canMakeOtherLost)</div>
+<div class="line"><a name="l09380"></a><span class="lineno"> 9380</span>&#160;    {</div>
+<div class="line"><a name="l09381"></a><span class="lineno"> 9381</span>&#160;        <span class="keywordflow">if</span>(suballocItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l09382"></a><span class="lineno"> 9382</span>&#160;        {</div>
+<div class="line"><a name="l09383"></a><span class="lineno"> 9383</span>&#160;            *pSumFreeSize = suballocItem-&gt;size;</div>
+<div class="line"><a name="l09384"></a><span class="lineno"> 9384</span>&#160;        }</div>
+<div class="line"><a name="l09385"></a><span class="lineno"> 9385</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09386"></a><span class="lineno"> 9386</span>&#160;        {</div>
+<div class="line"><a name="l09387"></a><span class="lineno"> 9387</span>&#160;            <span class="keywordflow">if</span>(suballocItem-&gt;hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
+<div class="line"><a name="l09388"></a><span class="lineno"> 9388</span>&#160;                suballocItem-&gt;hAllocation-&gt;GetLastUseFrameIndex() + frameInUseCount &lt; currentFrameIndex)</div>
+<div class="line"><a name="l09389"></a><span class="lineno"> 9389</span>&#160;            {</div>
+<div class="line"><a name="l09390"></a><span class="lineno"> 9390</span>&#160;                ++*itemsToMakeLostCount;</div>
+<div class="line"><a name="l09391"></a><span class="lineno"> 9391</span>&#160;                *pSumItemSize = suballocItem-&gt;size;</div>
+<div class="line"><a name="l09392"></a><span class="lineno"> 9392</span>&#160;            }</div>
+<div class="line"><a name="l09393"></a><span class="lineno"> 9393</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09394"></a><span class="lineno"> 9394</span>&#160;            {</div>
+<div class="line"><a name="l09395"></a><span class="lineno"> 9395</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09396"></a><span class="lineno"> 9396</span>&#160;            }</div>
+<div class="line"><a name="l09397"></a><span class="lineno"> 9397</span>&#160;        }</div>
+<div class="line"><a name="l09398"></a><span class="lineno"> 9398</span>&#160; </div>
+<div class="line"><a name="l09399"></a><span class="lineno"> 9399</span>&#160;        <span class="comment">// Remaining size is too small for this request: Early return.</span></div>
+<div class="line"><a name="l09400"></a><span class="lineno"> 9400</span>&#160;        <span class="keywordflow">if</span>(GetSize() - suballocItem-&gt;offset &lt; allocSize)</div>
+<div class="line"><a name="l09401"></a><span class="lineno"> 9401</span>&#160;        {</div>
+<div class="line"><a name="l09402"></a><span class="lineno"> 9402</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09403"></a><span class="lineno"> 9403</span>&#160;        }</div>
+<div class="line"><a name="l09404"></a><span class="lineno"> 9404</span>&#160; </div>
+<div class="line"><a name="l09405"></a><span class="lineno"> 9405</span>&#160;        <span class="comment">// Start from offset equal to beginning of this suballocation.</span></div>
+<div class="line"><a name="l09406"></a><span class="lineno"> 9406</span>&#160;        *pOffset = suballocItem-&gt;offset;</div>
+<div class="line"><a name="l09407"></a><span class="lineno"> 9407</span>&#160;    </div>
+<div class="line"><a name="l09408"></a><span class="lineno"> 9408</span>&#160;        <span class="comment">// Apply VMA_DEBUG_MARGIN at the beginning.</span></div>
+<div class="line"><a name="l09409"></a><span class="lineno"> 9409</span>&#160;        <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN &gt; 0)</div>
+<div class="line"><a name="l09410"></a><span class="lineno"> 9410</span>&#160;        {</div>
+<div class="line"><a name="l09411"></a><span class="lineno"> 9411</span>&#160;            *pOffset += VMA_DEBUG_MARGIN;</div>
+<div class="line"><a name="l09412"></a><span class="lineno"> 9412</span>&#160;        }</div>
+<div class="line"><a name="l09413"></a><span class="lineno"> 9413</span>&#160;    </div>
+<div class="line"><a name="l09414"></a><span class="lineno"> 9414</span>&#160;        <span class="comment">// Apply alignment.</span></div>
+<div class="line"><a name="l09415"></a><span class="lineno"> 9415</span>&#160;        *pOffset = VmaAlignUp(*pOffset, allocAlignment);</div>
 <div class="line"><a name="l09416"></a><span class="lineno"> 9416</span>&#160; </div>
-<div class="line"><a name="l09417"></a><span class="lineno"> 9417</span>&#160;VmaSuballocationList::iterator VmaBlockMetadata_Generic::FreeSuballocation(VmaSuballocationList::iterator suballocItem)</div>
-<div class="line"><a name="l09418"></a><span class="lineno"> 9418</span>&#160;{</div>
-<div class="line"><a name="l09419"></a><span class="lineno"> 9419</span>&#160;    <span class="comment">// Change this suballocation to be marked as free.</span></div>
-<div class="line"><a name="l09420"></a><span class="lineno"> 9420</span>&#160;    VmaSuballocation&amp; suballoc = *suballocItem;</div>
-<div class="line"><a name="l09421"></a><span class="lineno"> 9421</span>&#160;    suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
-<div class="line"><a name="l09422"></a><span class="lineno"> 9422</span>&#160;    suballoc.hAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l09423"></a><span class="lineno"> 9423</span>&#160;    </div>
-<div class="line"><a name="l09424"></a><span class="lineno"> 9424</span>&#160;    <span class="comment">// Update totals.</span></div>
-<div class="line"><a name="l09425"></a><span class="lineno"> 9425</span>&#160;    ++m_FreeCount;</div>
-<div class="line"><a name="l09426"></a><span class="lineno"> 9426</span>&#160;    m_SumFreeSize += suballoc.size;</div>
-<div class="line"><a name="l09427"></a><span class="lineno"> 9427</span>&#160; </div>
-<div class="line"><a name="l09428"></a><span class="lineno"> 9428</span>&#160;    <span class="comment">// Merge with previous and/or next suballocation if it&#39;s also free.</span></div>
-<div class="line"><a name="l09429"></a><span class="lineno"> 9429</span>&#160;    <span class="keywordtype">bool</span> mergeWithNext = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09430"></a><span class="lineno"> 9430</span>&#160;    <span class="keywordtype">bool</span> mergeWithPrev = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09431"></a><span class="lineno"> 9431</span>&#160;    </div>
-<div class="line"><a name="l09432"></a><span class="lineno"> 9432</span>&#160;    VmaSuballocationList::iterator nextItem = suballocItem;</div>
-<div class="line"><a name="l09433"></a><span class="lineno"> 9433</span>&#160;    ++nextItem;</div>
-<div class="line"><a name="l09434"></a><span class="lineno"> 9434</span>&#160;    <span class="keywordflow">if</span>((nextItem != m_Suballocations.end()) &amp;&amp; (nextItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE))</div>
-<div class="line"><a name="l09435"></a><span class="lineno"> 9435</span>&#160;    {</div>
-<div class="line"><a name="l09436"></a><span class="lineno"> 9436</span>&#160;        mergeWithNext = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l09437"></a><span class="lineno"> 9437</span>&#160;    }</div>
-<div class="line"><a name="l09438"></a><span class="lineno"> 9438</span>&#160; </div>
-<div class="line"><a name="l09439"></a><span class="lineno"> 9439</span>&#160;    VmaSuballocationList::iterator prevItem = suballocItem;</div>
-<div class="line"><a name="l09440"></a><span class="lineno"> 9440</span>&#160;    <span class="keywordflow">if</span>(suballocItem != m_Suballocations.begin())</div>
-<div class="line"><a name="l09441"></a><span class="lineno"> 9441</span>&#160;    {</div>
-<div class="line"><a name="l09442"></a><span class="lineno"> 9442</span>&#160;        --prevItem;</div>
-<div class="line"><a name="l09443"></a><span class="lineno"> 9443</span>&#160;        <span class="keywordflow">if</span>(prevItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l09444"></a><span class="lineno"> 9444</span>&#160;        {</div>
-<div class="line"><a name="l09445"></a><span class="lineno"> 9445</span>&#160;            mergeWithPrev = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l09446"></a><span class="lineno"> 9446</span>&#160;        }</div>
-<div class="line"><a name="l09447"></a><span class="lineno"> 9447</span>&#160;    }</div>
-<div class="line"><a name="l09448"></a><span class="lineno"> 9448</span>&#160; </div>
-<div class="line"><a name="l09449"></a><span class="lineno"> 9449</span>&#160;    <span class="keywordflow">if</span>(mergeWithNext)</div>
-<div class="line"><a name="l09450"></a><span class="lineno"> 9450</span>&#160;    {</div>
-<div class="line"><a name="l09451"></a><span class="lineno"> 9451</span>&#160;        UnregisterFreeSuballocation(nextItem);</div>
-<div class="line"><a name="l09452"></a><span class="lineno"> 9452</span>&#160;        MergeFreeWithNext(suballocItem);</div>
-<div class="line"><a name="l09453"></a><span class="lineno"> 9453</span>&#160;    }</div>
+<div class="line"><a name="l09417"></a><span class="lineno"> 9417</span>&#160;        <span class="comment">// Check previous suballocations for BufferImageGranularity conflicts.</span></div>
+<div class="line"><a name="l09418"></a><span class="lineno"> 9418</span>&#160;        <span class="comment">// Make bigger alignment if necessary.</span></div>
+<div class="line"><a name="l09419"></a><span class="lineno"> 9419</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
+<div class="line"><a name="l09420"></a><span class="lineno"> 9420</span>&#160;        {</div>
+<div class="line"><a name="l09421"></a><span class="lineno"> 9421</span>&#160;            <span class="keywordtype">bool</span> bufferImageGranularityConflict = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09422"></a><span class="lineno"> 9422</span>&#160;            VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;</div>
+<div class="line"><a name="l09423"></a><span class="lineno"> 9423</span>&#160;            <span class="keywordflow">while</span>(prevSuballocItem != m_Suballocations.cbegin())</div>
+<div class="line"><a name="l09424"></a><span class="lineno"> 9424</span>&#160;            {</div>
+<div class="line"><a name="l09425"></a><span class="lineno"> 9425</span>&#160;                --prevSuballocItem;</div>
+<div class="line"><a name="l09426"></a><span class="lineno"> 9426</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; prevSuballoc = *prevSuballocItem;</div>
+<div class="line"><a name="l09427"></a><span class="lineno"> 9427</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, *pOffset, bufferImageGranularity))</div>
+<div class="line"><a name="l09428"></a><span class="lineno"> 9428</span>&#160;                {</div>
+<div class="line"><a name="l09429"></a><span class="lineno"> 9429</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))</div>
+<div class="line"><a name="l09430"></a><span class="lineno"> 9430</span>&#160;                    {</div>
+<div class="line"><a name="l09431"></a><span class="lineno"> 9431</span>&#160;                        bufferImageGranularityConflict = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09432"></a><span class="lineno"> 9432</span>&#160;                        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l09433"></a><span class="lineno"> 9433</span>&#160;                    }</div>
+<div class="line"><a name="l09434"></a><span class="lineno"> 9434</span>&#160;                }</div>
+<div class="line"><a name="l09435"></a><span class="lineno"> 9435</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09436"></a><span class="lineno"> 9436</span>&#160;                    <span class="comment">// Already on previous page.</span></div>
+<div class="line"><a name="l09437"></a><span class="lineno"> 9437</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l09438"></a><span class="lineno"> 9438</span>&#160;            }</div>
+<div class="line"><a name="l09439"></a><span class="lineno"> 9439</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularityConflict)</div>
+<div class="line"><a name="l09440"></a><span class="lineno"> 9440</span>&#160;            {</div>
+<div class="line"><a name="l09441"></a><span class="lineno"> 9441</span>&#160;                *pOffset = VmaAlignUp(*pOffset, bufferImageGranularity);</div>
+<div class="line"><a name="l09442"></a><span class="lineno"> 9442</span>&#160;            }</div>
+<div class="line"><a name="l09443"></a><span class="lineno"> 9443</span>&#160;        }</div>
+<div class="line"><a name="l09444"></a><span class="lineno"> 9444</span>&#160;    </div>
+<div class="line"><a name="l09445"></a><span class="lineno"> 9445</span>&#160;        <span class="comment">// Now that we have final *pOffset, check if we are past suballocItem.</span></div>
+<div class="line"><a name="l09446"></a><span class="lineno"> 9446</span>&#160;        <span class="comment">// If yes, return false - this function should be called for another suballocItem as starting point.</span></div>
+<div class="line"><a name="l09447"></a><span class="lineno"> 9447</span>&#160;        <span class="keywordflow">if</span>(*pOffset &gt;= suballocItem-&gt;offset + suballocItem-&gt;size)</div>
+<div class="line"><a name="l09448"></a><span class="lineno"> 9448</span>&#160;        {</div>
+<div class="line"><a name="l09449"></a><span class="lineno"> 9449</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09450"></a><span class="lineno"> 9450</span>&#160;        }</div>
+<div class="line"><a name="l09451"></a><span class="lineno"> 9451</span>&#160;    </div>
+<div class="line"><a name="l09452"></a><span class="lineno"> 9452</span>&#160;        <span class="comment">// Calculate padding at the beginning based on current offset.</span></div>
+<div class="line"><a name="l09453"></a><span class="lineno"> 9453</span>&#160;        <span class="keyword">const</span> VkDeviceSize paddingBegin = *pOffset - suballocItem-&gt;offset;</div>
 <div class="line"><a name="l09454"></a><span class="lineno"> 9454</span>&#160; </div>
-<div class="line"><a name="l09455"></a><span class="lineno"> 9455</span>&#160;    <span class="keywordflow">if</span>(mergeWithPrev)</div>
-<div class="line"><a name="l09456"></a><span class="lineno"> 9456</span>&#160;    {</div>
-<div class="line"><a name="l09457"></a><span class="lineno"> 9457</span>&#160;        UnregisterFreeSuballocation(prevItem);</div>
-<div class="line"><a name="l09458"></a><span class="lineno"> 9458</span>&#160;        MergeFreeWithNext(prevItem);</div>
-<div class="line"><a name="l09459"></a><span class="lineno"> 9459</span>&#160;        RegisterFreeSuballocation(prevItem);</div>
-<div class="line"><a name="l09460"></a><span class="lineno"> 9460</span>&#160;        <span class="keywordflow">return</span> prevItem;</div>
-<div class="line"><a name="l09461"></a><span class="lineno"> 9461</span>&#160;    }</div>
-<div class="line"><a name="l09462"></a><span class="lineno"> 9462</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09463"></a><span class="lineno"> 9463</span>&#160;    {</div>
-<div class="line"><a name="l09464"></a><span class="lineno"> 9464</span>&#160;        RegisterFreeSuballocation(suballocItem);</div>
-<div class="line"><a name="l09465"></a><span class="lineno"> 9465</span>&#160;        <span class="keywordflow">return</span> suballocItem;</div>
-<div class="line"><a name="l09466"></a><span class="lineno"> 9466</span>&#160;    }</div>
-<div class="line"><a name="l09467"></a><span class="lineno"> 9467</span>&#160;}</div>
-<div class="line"><a name="l09468"></a><span class="lineno"> 9468</span>&#160; </div>
-<div class="line"><a name="l09469"></a><span class="lineno"> 9469</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::RegisterFreeSuballocation(VmaSuballocationList::iterator item)</div>
-<div class="line"><a name="l09470"></a><span class="lineno"> 9470</span>&#160;{</div>
-<div class="line"><a name="l09471"></a><span class="lineno"> 9471</span>&#160;    VMA_ASSERT(item-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l09472"></a><span class="lineno"> 9472</span>&#160;    VMA_ASSERT(item-&gt;size &gt; 0);</div>
-<div class="line"><a name="l09473"></a><span class="lineno"> 9473</span>&#160; </div>
-<div class="line"><a name="l09474"></a><span class="lineno"> 9474</span>&#160;    <span class="comment">// You may want to enable this validation at the beginning or at the end of</span></div>
-<div class="line"><a name="l09475"></a><span class="lineno"> 9475</span>&#160;    <span class="comment">// this function, depending on what do you want to check.</span></div>
-<div class="line"><a name="l09476"></a><span class="lineno"> 9476</span>&#160;    VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());</div>
-<div class="line"><a name="l09477"></a><span class="lineno"> 9477</span>&#160; </div>
-<div class="line"><a name="l09478"></a><span class="lineno"> 9478</span>&#160;    <span class="keywordflow">if</span>(item-&gt;size &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
-<div class="line"><a name="l09479"></a><span class="lineno"> 9479</span>&#160;    {</div>
-<div class="line"><a name="l09480"></a><span class="lineno"> 9480</span>&#160;        <span class="keywordflow">if</span>(m_FreeSuballocationsBySize.empty())</div>
-<div class="line"><a name="l09481"></a><span class="lineno"> 9481</span>&#160;        {</div>
-<div class="line"><a name="l09482"></a><span class="lineno"> 9482</span>&#160;            m_FreeSuballocationsBySize.push_back(item);</div>
-<div class="line"><a name="l09483"></a><span class="lineno"> 9483</span>&#160;        }</div>
-<div class="line"><a name="l09484"></a><span class="lineno"> 9484</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09485"></a><span class="lineno"> 9485</span>&#160;        {</div>
-<div class="line"><a name="l09486"></a><span class="lineno"> 9486</span>&#160;            VmaVectorInsertSorted&lt;VmaSuballocationItemSizeLess&gt;(m_FreeSuballocationsBySize, item);</div>
-<div class="line"><a name="l09487"></a><span class="lineno"> 9487</span>&#160;        }</div>
-<div class="line"><a name="l09488"></a><span class="lineno"> 9488</span>&#160;    }</div>
-<div class="line"><a name="l09489"></a><span class="lineno"> 9489</span>&#160; </div>
-<div class="line"><a name="l09490"></a><span class="lineno"> 9490</span>&#160;    <span class="comment">//VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());</span></div>
-<div class="line"><a name="l09491"></a><span class="lineno"> 9491</span>&#160;}</div>
-<div class="line"><a name="l09492"></a><span class="lineno"> 9492</span>&#160; </div>
-<div class="line"><a name="l09493"></a><span class="lineno"> 9493</span>&#160; </div>
-<div class="line"><a name="l09494"></a><span class="lineno"> 9494</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::UnregisterFreeSuballocation(VmaSuballocationList::iterator item)</div>
-<div class="line"><a name="l09495"></a><span class="lineno"> 9495</span>&#160;{</div>
-<div class="line"><a name="l09496"></a><span class="lineno"> 9496</span>&#160;    VMA_ASSERT(item-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l09497"></a><span class="lineno"> 9497</span>&#160;    VMA_ASSERT(item-&gt;size &gt; 0);</div>
-<div class="line"><a name="l09498"></a><span class="lineno"> 9498</span>&#160; </div>
-<div class="line"><a name="l09499"></a><span class="lineno"> 9499</span>&#160;    <span class="comment">// You may want to enable this validation at the beginning or at the end of</span></div>
-<div class="line"><a name="l09500"></a><span class="lineno"> 9500</span>&#160;    <span class="comment">// this function, depending on what do you want to check.</span></div>
-<div class="line"><a name="l09501"></a><span class="lineno"> 9501</span>&#160;    VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());</div>
-<div class="line"><a name="l09502"></a><span class="lineno"> 9502</span>&#160; </div>
-<div class="line"><a name="l09503"></a><span class="lineno"> 9503</span>&#160;    <span class="keywordflow">if</span>(item-&gt;size &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
-<div class="line"><a name="l09504"></a><span class="lineno"> 9504</span>&#160;    {</div>
-<div class="line"><a name="l09505"></a><span class="lineno"> 9505</span>&#160;        VmaSuballocationList::iterator* <span class="keyword">const</span> it = VmaBinaryFindFirstNotLess(</div>
-<div class="line"><a name="l09506"></a><span class="lineno"> 9506</span>&#160;            m_FreeSuballocationsBySize.data(),</div>
-<div class="line"><a name="l09507"></a><span class="lineno"> 9507</span>&#160;            m_FreeSuballocationsBySize.data() + m_FreeSuballocationsBySize.size(),</div>
-<div class="line"><a name="l09508"></a><span class="lineno"> 9508</span>&#160;            item,</div>
-<div class="line"><a name="l09509"></a><span class="lineno"> 9509</span>&#160;            VmaSuballocationItemSizeLess());</div>
-<div class="line"><a name="l09510"></a><span class="lineno"> 9510</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> index = it - m_FreeSuballocationsBySize.data();</div>
-<div class="line"><a name="l09511"></a><span class="lineno"> 9511</span>&#160;            index &lt; m_FreeSuballocationsBySize.size();</div>
-<div class="line"><a name="l09512"></a><span class="lineno"> 9512</span>&#160;            ++index)</div>
-<div class="line"><a name="l09513"></a><span class="lineno"> 9513</span>&#160;        {</div>
-<div class="line"><a name="l09514"></a><span class="lineno"> 9514</span>&#160;            <span class="keywordflow">if</span>(m_FreeSuballocationsBySize[index] == item)</div>
-<div class="line"><a name="l09515"></a><span class="lineno"> 9515</span>&#160;            {</div>
-<div class="line"><a name="l09516"></a><span class="lineno"> 9516</span>&#160;                VmaVectorRemove(m_FreeSuballocationsBySize, index);</div>
-<div class="line"><a name="l09517"></a><span class="lineno"> 9517</span>&#160;                <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l09518"></a><span class="lineno"> 9518</span>&#160;            }</div>
-<div class="line"><a name="l09519"></a><span class="lineno"> 9519</span>&#160;            VMA_ASSERT((m_FreeSuballocationsBySize[index]-&gt;size == item-&gt;size) &amp;&amp; <span class="stringliteral">&quot;Not found.&quot;</span>);</div>
-<div class="line"><a name="l09520"></a><span class="lineno"> 9520</span>&#160;        }</div>
-<div class="line"><a name="l09521"></a><span class="lineno"> 9521</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Not found.&quot;</span>);</div>
-<div class="line"><a name="l09522"></a><span class="lineno"> 9522</span>&#160;    }</div>
-<div class="line"><a name="l09523"></a><span class="lineno"> 9523</span>&#160; </div>
-<div class="line"><a name="l09524"></a><span class="lineno"> 9524</span>&#160;    <span class="comment">//VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());</span></div>
-<div class="line"><a name="l09525"></a><span class="lineno"> 9525</span>&#160;}</div>
-<div class="line"><a name="l09526"></a><span class="lineno"> 9526</span>&#160; </div>
-<div class="line"><a name="l09527"></a><span class="lineno"> 9527</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::IsBufferImageGranularityConflictPossible(</div>
-<div class="line"><a name="l09528"></a><span class="lineno"> 9528</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l09529"></a><span class="lineno"> 9529</span>&#160;    VmaSuballocationType&amp; inOutPrevSuballocType)<span class="keyword"> const</span></div>
-<div class="line"><a name="l09530"></a><span class="lineno"> 9530</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l09531"></a><span class="lineno"> 9531</span>&#160;    <span class="keywordflow">if</span>(bufferImageGranularity == 1 || IsEmpty())</div>
-<div class="line"><a name="l09532"></a><span class="lineno"> 9532</span>&#160;    {</div>
-<div class="line"><a name="l09533"></a><span class="lineno"> 9533</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09455"></a><span class="lineno"> 9455</span>&#160;        <span class="comment">// Calculate required margin at the end.</span></div>
+<div class="line"><a name="l09456"></a><span class="lineno"> 9456</span>&#160;        <span class="keyword">const</span> VkDeviceSize requiredEndMargin = VMA_DEBUG_MARGIN;</div>
+<div class="line"><a name="l09457"></a><span class="lineno"> 9457</span>&#160; </div>
+<div class="line"><a name="l09458"></a><span class="lineno"> 9458</span>&#160;        <span class="keyword">const</span> VkDeviceSize totalSize = paddingBegin + allocSize + requiredEndMargin;</div>
+<div class="line"><a name="l09459"></a><span class="lineno"> 9459</span>&#160;        <span class="comment">// Another early return check.</span></div>
+<div class="line"><a name="l09460"></a><span class="lineno"> 9460</span>&#160;        <span class="keywordflow">if</span>(suballocItem-&gt;offset + totalSize &gt; GetSize())</div>
+<div class="line"><a name="l09461"></a><span class="lineno"> 9461</span>&#160;        {</div>
+<div class="line"><a name="l09462"></a><span class="lineno"> 9462</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09463"></a><span class="lineno"> 9463</span>&#160;        }</div>
+<div class="line"><a name="l09464"></a><span class="lineno"> 9464</span>&#160; </div>
+<div class="line"><a name="l09465"></a><span class="lineno"> 9465</span>&#160;        <span class="comment">// Advance lastSuballocItem until desired size is reached.</span></div>
+<div class="line"><a name="l09466"></a><span class="lineno"> 9466</span>&#160;        <span class="comment">// Update itemsToMakeLostCount.</span></div>
+<div class="line"><a name="l09467"></a><span class="lineno"> 9467</span>&#160;        VmaSuballocationList::const_iterator lastSuballocItem = suballocItem;</div>
+<div class="line"><a name="l09468"></a><span class="lineno"> 9468</span>&#160;        <span class="keywordflow">if</span>(totalSize &gt; suballocItem-&gt;size)</div>
+<div class="line"><a name="l09469"></a><span class="lineno"> 9469</span>&#160;        {</div>
+<div class="line"><a name="l09470"></a><span class="lineno"> 9470</span>&#160;            VkDeviceSize remainingSize = totalSize - suballocItem-&gt;size;</div>
+<div class="line"><a name="l09471"></a><span class="lineno"> 9471</span>&#160;            <span class="keywordflow">while</span>(remainingSize &gt; 0)</div>
+<div class="line"><a name="l09472"></a><span class="lineno"> 9472</span>&#160;            {</div>
+<div class="line"><a name="l09473"></a><span class="lineno"> 9473</span>&#160;                ++lastSuballocItem;</div>
+<div class="line"><a name="l09474"></a><span class="lineno"> 9474</span>&#160;                <span class="keywordflow">if</span>(lastSuballocItem == m_Suballocations.cend())</div>
+<div class="line"><a name="l09475"></a><span class="lineno"> 9475</span>&#160;                {</div>
+<div class="line"><a name="l09476"></a><span class="lineno"> 9476</span>&#160;                    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09477"></a><span class="lineno"> 9477</span>&#160;                }</div>
+<div class="line"><a name="l09478"></a><span class="lineno"> 9478</span>&#160;                <span class="keywordflow">if</span>(lastSuballocItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l09479"></a><span class="lineno"> 9479</span>&#160;                {</div>
+<div class="line"><a name="l09480"></a><span class="lineno"> 9480</span>&#160;                    *pSumFreeSize += lastSuballocItem-&gt;size;</div>
+<div class="line"><a name="l09481"></a><span class="lineno"> 9481</span>&#160;                }</div>
+<div class="line"><a name="l09482"></a><span class="lineno"> 9482</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09483"></a><span class="lineno"> 9483</span>&#160;                {</div>
+<div class="line"><a name="l09484"></a><span class="lineno"> 9484</span>&#160;                    VMA_ASSERT(lastSuballocItem-&gt;hAllocation != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l09485"></a><span class="lineno"> 9485</span>&#160;                    <span class="keywordflow">if</span>(lastSuballocItem-&gt;hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
+<div class="line"><a name="l09486"></a><span class="lineno"> 9486</span>&#160;                        lastSuballocItem-&gt;hAllocation-&gt;GetLastUseFrameIndex() + frameInUseCount &lt; currentFrameIndex)</div>
+<div class="line"><a name="l09487"></a><span class="lineno"> 9487</span>&#160;                    {</div>
+<div class="line"><a name="l09488"></a><span class="lineno"> 9488</span>&#160;                        ++*itemsToMakeLostCount;</div>
+<div class="line"><a name="l09489"></a><span class="lineno"> 9489</span>&#160;                        *pSumItemSize += lastSuballocItem-&gt;size;</div>
+<div class="line"><a name="l09490"></a><span class="lineno"> 9490</span>&#160;                    }</div>
+<div class="line"><a name="l09491"></a><span class="lineno"> 9491</span>&#160;                    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09492"></a><span class="lineno"> 9492</span>&#160;                    {</div>
+<div class="line"><a name="l09493"></a><span class="lineno"> 9493</span>&#160;                        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09494"></a><span class="lineno"> 9494</span>&#160;                    }</div>
+<div class="line"><a name="l09495"></a><span class="lineno"> 9495</span>&#160;                }</div>
+<div class="line"><a name="l09496"></a><span class="lineno"> 9496</span>&#160;                remainingSize = (lastSuballocItem-&gt;size &lt; remainingSize) ?</div>
+<div class="line"><a name="l09497"></a><span class="lineno"> 9497</span>&#160;                    remainingSize - lastSuballocItem-&gt;size : 0;</div>
+<div class="line"><a name="l09498"></a><span class="lineno"> 9498</span>&#160;            }</div>
+<div class="line"><a name="l09499"></a><span class="lineno"> 9499</span>&#160;        }</div>
+<div class="line"><a name="l09500"></a><span class="lineno"> 9500</span>&#160; </div>
+<div class="line"><a name="l09501"></a><span class="lineno"> 9501</span>&#160;        <span class="comment">// Check next suballocations for BufferImageGranularity conflicts.</span></div>
+<div class="line"><a name="l09502"></a><span class="lineno"> 9502</span>&#160;        <span class="comment">// If conflict exists, we must mark more allocations lost or fail.</span></div>
+<div class="line"><a name="l09503"></a><span class="lineno"> 9503</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
+<div class="line"><a name="l09504"></a><span class="lineno"> 9504</span>&#160;        {</div>
+<div class="line"><a name="l09505"></a><span class="lineno"> 9505</span>&#160;            VmaSuballocationList::const_iterator nextSuballocItem = lastSuballocItem;</div>
+<div class="line"><a name="l09506"></a><span class="lineno"> 9506</span>&#160;            ++nextSuballocItem;</div>
+<div class="line"><a name="l09507"></a><span class="lineno"> 9507</span>&#160;            <span class="keywordflow">while</span>(nextSuballocItem != m_Suballocations.cend())</div>
+<div class="line"><a name="l09508"></a><span class="lineno"> 9508</span>&#160;            {</div>
+<div class="line"><a name="l09509"></a><span class="lineno"> 9509</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; nextSuballoc = *nextSuballocItem;</div>
+<div class="line"><a name="l09510"></a><span class="lineno"> 9510</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(*pOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))</div>
+<div class="line"><a name="l09511"></a><span class="lineno"> 9511</span>&#160;                {</div>
+<div class="line"><a name="l09512"></a><span class="lineno"> 9512</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))</div>
+<div class="line"><a name="l09513"></a><span class="lineno"> 9513</span>&#160;                    {</div>
+<div class="line"><a name="l09514"></a><span class="lineno"> 9514</span>&#160;                        VMA_ASSERT(nextSuballoc.hAllocation != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l09515"></a><span class="lineno"> 9515</span>&#160;                        <span class="keywordflow">if</span>(nextSuballoc.hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
+<div class="line"><a name="l09516"></a><span class="lineno"> 9516</span>&#160;                            nextSuballoc.hAllocation-&gt;GetLastUseFrameIndex() + frameInUseCount &lt; currentFrameIndex)</div>
+<div class="line"><a name="l09517"></a><span class="lineno"> 9517</span>&#160;                        {</div>
+<div class="line"><a name="l09518"></a><span class="lineno"> 9518</span>&#160;                            ++*itemsToMakeLostCount;</div>
+<div class="line"><a name="l09519"></a><span class="lineno"> 9519</span>&#160;                        }</div>
+<div class="line"><a name="l09520"></a><span class="lineno"> 9520</span>&#160;                        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09521"></a><span class="lineno"> 9521</span>&#160;                        {</div>
+<div class="line"><a name="l09522"></a><span class="lineno"> 9522</span>&#160;                            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09523"></a><span class="lineno"> 9523</span>&#160;                        }</div>
+<div class="line"><a name="l09524"></a><span class="lineno"> 9524</span>&#160;                    }</div>
+<div class="line"><a name="l09525"></a><span class="lineno"> 9525</span>&#160;                }</div>
+<div class="line"><a name="l09526"></a><span class="lineno"> 9526</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09527"></a><span class="lineno"> 9527</span>&#160;                {</div>
+<div class="line"><a name="l09528"></a><span class="lineno"> 9528</span>&#160;                    <span class="comment">// Already on next page.</span></div>
+<div class="line"><a name="l09529"></a><span class="lineno"> 9529</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l09530"></a><span class="lineno"> 9530</span>&#160;                }</div>
+<div class="line"><a name="l09531"></a><span class="lineno"> 9531</span>&#160;                ++nextSuballocItem;</div>
+<div class="line"><a name="l09532"></a><span class="lineno"> 9532</span>&#160;            }</div>
+<div class="line"><a name="l09533"></a><span class="lineno"> 9533</span>&#160;        }</div>
 <div class="line"><a name="l09534"></a><span class="lineno"> 9534</span>&#160;    }</div>
-<div class="line"><a name="l09535"></a><span class="lineno"> 9535</span>&#160; </div>
-<div class="line"><a name="l09536"></a><span class="lineno"> 9536</span>&#160;    VkDeviceSize minAlignment = VK_WHOLE_SIZE;</div>
-<div class="line"><a name="l09537"></a><span class="lineno"> 9537</span>&#160;    <span class="keywordtype">bool</span> typeConflictFound = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l09538"></a><span class="lineno"> 9538</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::const_iterator it = m_Suballocations.cbegin();</div>
-<div class="line"><a name="l09539"></a><span class="lineno"> 9539</span>&#160;        it != m_Suballocations.cend();</div>
-<div class="line"><a name="l09540"></a><span class="lineno"> 9540</span>&#160;        ++it)</div>
-<div class="line"><a name="l09541"></a><span class="lineno"> 9541</span>&#160;    {</div>
-<div class="line"><a name="l09542"></a><span class="lineno"> 9542</span>&#160;        <span class="keyword">const</span> VmaSuballocationType suballocType = it-&gt;type;</div>
-<div class="line"><a name="l09543"></a><span class="lineno"> 9543</span>&#160;        <span class="keywordflow">if</span>(suballocType != VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l09535"></a><span class="lineno"> 9535</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09536"></a><span class="lineno"> 9536</span>&#160;    {</div>
+<div class="line"><a name="l09537"></a><span class="lineno"> 9537</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = *suballocItem;</div>
+<div class="line"><a name="l09538"></a><span class="lineno"> 9538</span>&#160;        VMA_ASSERT(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09539"></a><span class="lineno"> 9539</span>&#160; </div>
+<div class="line"><a name="l09540"></a><span class="lineno"> 9540</span>&#160;        *pSumFreeSize = suballoc.size;</div>
+<div class="line"><a name="l09541"></a><span class="lineno"> 9541</span>&#160; </div>
+<div class="line"><a name="l09542"></a><span class="lineno"> 9542</span>&#160;        <span class="comment">// Size of this suballocation is too small for this request: Early return.</span></div>
+<div class="line"><a name="l09543"></a><span class="lineno"> 9543</span>&#160;        <span class="keywordflow">if</span>(suballoc.size &lt; allocSize)</div>
 <div class="line"><a name="l09544"></a><span class="lineno"> 9544</span>&#160;        {</div>
-<div class="line"><a name="l09545"></a><span class="lineno"> 9545</span>&#160;            minAlignment = VMA_MIN(minAlignment, it-&gt;hAllocation-&gt;GetAlignment());</div>
-<div class="line"><a name="l09546"></a><span class="lineno"> 9546</span>&#160;            <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(inOutPrevSuballocType, suballocType))</div>
-<div class="line"><a name="l09547"></a><span class="lineno"> 9547</span>&#160;            {</div>
-<div class="line"><a name="l09548"></a><span class="lineno"> 9548</span>&#160;                typeConflictFound = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l09549"></a><span class="lineno"> 9549</span>&#160;            }</div>
-<div class="line"><a name="l09550"></a><span class="lineno"> 9550</span>&#160;            inOutPrevSuballocType = suballocType;</div>
-<div class="line"><a name="l09551"></a><span class="lineno"> 9551</span>&#160;        }</div>
-<div class="line"><a name="l09552"></a><span class="lineno"> 9552</span>&#160;    }</div>
-<div class="line"><a name="l09553"></a><span class="lineno"> 9553</span>&#160; </div>
-<div class="line"><a name="l09554"></a><span class="lineno"> 9554</span>&#160;    <span class="keywordflow">return</span> typeConflictFound || minAlignment &gt;= bufferImageGranularity;</div>
-<div class="line"><a name="l09555"></a><span class="lineno"> 9555</span>&#160;}</div>
-<div class="line"><a name="l09556"></a><span class="lineno"> 9556</span>&#160; </div>
-<div class="line"><a name="l09558"></a><span class="lineno"> 9558</span>&#160;<span class="comment">// class VmaBlockMetadata_Linear</span></div>
-<div class="line"><a name="l09559"></a><span class="lineno"> 9559</span>&#160; </div>
-<div class="line"><a name="l09560"></a><span class="lineno"> 9560</span>&#160;VmaBlockMetadata_Linear::VmaBlockMetadata_Linear(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator) :</div>
-<div class="line"><a name="l09561"></a><span class="lineno"> 9561</span>&#160;    VmaBlockMetadata(hAllocator),</div>
-<div class="line"><a name="l09562"></a><span class="lineno"> 9562</span>&#160;    m_SumFreeSize(0),</div>
-<div class="line"><a name="l09563"></a><span class="lineno"> 9563</span>&#160;    m_Suballocations0(VmaStlAllocator&lt;VmaSuballocation&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
-<div class="line"><a name="l09564"></a><span class="lineno"> 9564</span>&#160;    m_Suballocations1(VmaStlAllocator&lt;VmaSuballocation&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
-<div class="line"><a name="l09565"></a><span class="lineno"> 9565</span>&#160;    m_1stVectorIndex(0),</div>
-<div class="line"><a name="l09566"></a><span class="lineno"> 9566</span>&#160;    m_2ndVectorMode(SECOND_VECTOR_EMPTY),</div>
-<div class="line"><a name="l09567"></a><span class="lineno"> 9567</span>&#160;    m_1stNullItemsBeginCount(0),</div>
-<div class="line"><a name="l09568"></a><span class="lineno"> 9568</span>&#160;    m_1stNullItemsMiddleCount(0),</div>
-<div class="line"><a name="l09569"></a><span class="lineno"> 9569</span>&#160;    m_2ndNullItemsCount(0)</div>
-<div class="line"><a name="l09570"></a><span class="lineno"> 9570</span>&#160;{</div>
-<div class="line"><a name="l09571"></a><span class="lineno"> 9571</span>&#160;}</div>
-<div class="line"><a name="l09572"></a><span class="lineno"> 9572</span>&#160; </div>
-<div class="line"><a name="l09573"></a><span class="lineno"> 9573</span>&#160;VmaBlockMetadata_Linear::~VmaBlockMetadata_Linear()</div>
-<div class="line"><a name="l09574"></a><span class="lineno"> 9574</span>&#160;{</div>
-<div class="line"><a name="l09575"></a><span class="lineno"> 9575</span>&#160;}</div>
-<div class="line"><a name="l09576"></a><span class="lineno"> 9576</span>&#160; </div>
-<div class="line"><a name="l09577"></a><span class="lineno"> 9577</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::Init(VkDeviceSize size)</div>
-<div class="line"><a name="l09578"></a><span class="lineno"> 9578</span>&#160;{</div>
-<div class="line"><a name="l09579"></a><span class="lineno"> 9579</span>&#160;    VmaBlockMetadata::Init(size);</div>
-<div class="line"><a name="l09580"></a><span class="lineno"> 9580</span>&#160;    m_SumFreeSize = size;</div>
-<div class="line"><a name="l09581"></a><span class="lineno"> 9581</span>&#160;}</div>
-<div class="line"><a name="l09582"></a><span class="lineno"> 9582</span>&#160; </div>
-<div class="line"><a name="l09583"></a><span class="lineno"> 9583</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::Validate()<span class="keyword"> const</span></div>
-<div class="line"><a name="l09584"></a><span class="lineno"> 9584</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l09585"></a><span class="lineno"> 9585</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l09586"></a><span class="lineno"> 9586</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l09587"></a><span class="lineno"> 9587</span>&#160; </div>
-<div class="line"><a name="l09588"></a><span class="lineno"> 9588</span>&#160;    VMA_VALIDATE(suballocations2nd.empty() == (m_2ndVectorMode == SECOND_VECTOR_EMPTY));</div>
-<div class="line"><a name="l09589"></a><span class="lineno"> 9589</span>&#160;    VMA_VALIDATE(!suballocations1st.empty() ||</div>
-<div class="line"><a name="l09590"></a><span class="lineno"> 9590</span>&#160;        suballocations2nd.empty() ||</div>
-<div class="line"><a name="l09591"></a><span class="lineno"> 9591</span>&#160;        m_2ndVectorMode != SECOND_VECTOR_RING_BUFFER);</div>
-<div class="line"><a name="l09592"></a><span class="lineno"> 9592</span>&#160; </div>
-<div class="line"><a name="l09593"></a><span class="lineno"> 9593</span>&#160;    <span class="keywordflow">if</span>(!suballocations1st.empty())</div>
-<div class="line"><a name="l09594"></a><span class="lineno"> 9594</span>&#160;    {</div>
-<div class="line"><a name="l09595"></a><span class="lineno"> 9595</span>&#160;        <span class="comment">// Null item at the beginning should be accounted into m_1stNullItemsBeginCount.</span></div>
-<div class="line"><a name="l09596"></a><span class="lineno"> 9596</span>&#160;        VMA_VALIDATE(suballocations1st[m_1stNullItemsBeginCount].hAllocation != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l09597"></a><span class="lineno"> 9597</span>&#160;        <span class="comment">// Null item at the end should be just pop_back().</span></div>
-<div class="line"><a name="l09598"></a><span class="lineno"> 9598</span>&#160;        VMA_VALIDATE(suballocations1st.back().hAllocation != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l09599"></a><span class="lineno"> 9599</span>&#160;    }</div>
-<div class="line"><a name="l09600"></a><span class="lineno"> 9600</span>&#160;    <span class="keywordflow">if</span>(!suballocations2nd.empty())</div>
-<div class="line"><a name="l09601"></a><span class="lineno"> 9601</span>&#160;    {</div>
-<div class="line"><a name="l09602"></a><span class="lineno"> 9602</span>&#160;        <span class="comment">// Null item at the end should be just pop_back().</span></div>
-<div class="line"><a name="l09603"></a><span class="lineno"> 9603</span>&#160;        VMA_VALIDATE(suballocations2nd.back().hAllocation != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l09604"></a><span class="lineno"> 9604</span>&#160;    }</div>
-<div class="line"><a name="l09605"></a><span class="lineno"> 9605</span>&#160; </div>
-<div class="line"><a name="l09606"></a><span class="lineno"> 9606</span>&#160;    VMA_VALIDATE(m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount &lt;= suballocations1st.size());</div>
-<div class="line"><a name="l09607"></a><span class="lineno"> 9607</span>&#160;    VMA_VALIDATE(m_2ndNullItemsCount &lt;= suballocations2nd.size());</div>
-<div class="line"><a name="l09608"></a><span class="lineno"> 9608</span>&#160; </div>
-<div class="line"><a name="l09609"></a><span class="lineno"> 9609</span>&#160;    VkDeviceSize sumUsedSize = 0;</div>
-<div class="line"><a name="l09610"></a><span class="lineno"> 9610</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc1stCount = suballocations1st.size();</div>
-<div class="line"><a name="l09611"></a><span class="lineno"> 9611</span>&#160;    VkDeviceSize offset = VMA_DEBUG_MARGIN;</div>
-<div class="line"><a name="l09612"></a><span class="lineno"> 9612</span>&#160; </div>
-<div class="line"><a name="l09613"></a><span class="lineno"> 9613</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
-<div class="line"><a name="l09614"></a><span class="lineno"> 9614</span>&#160;    {</div>
-<div class="line"><a name="l09615"></a><span class="lineno"> 9615</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc2ndCount = suballocations2nd.size();</div>
-<div class="line"><a name="l09616"></a><span class="lineno"> 9616</span>&#160;        <span class="keywordtype">size_t</span> nullItem2ndCount = 0;</div>
-<div class="line"><a name="l09617"></a><span class="lineno"> 9617</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; suballoc2ndCount; ++i)</div>
-<div class="line"><a name="l09618"></a><span class="lineno"> 9618</span>&#160;        {</div>
-<div class="line"><a name="l09619"></a><span class="lineno"> 9619</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[i];</div>
-<div class="line"><a name="l09620"></a><span class="lineno"> 9620</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">bool</span> currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l09621"></a><span class="lineno"> 9621</span>&#160; </div>
-<div class="line"><a name="l09622"></a><span class="lineno"> 9622</span>&#160;            VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));</div>
-<div class="line"><a name="l09623"></a><span class="lineno"> 9623</span>&#160;            VMA_VALIDATE(suballoc.offset &gt;= offset);</div>
-<div class="line"><a name="l09624"></a><span class="lineno"> 9624</span>&#160; </div>
-<div class="line"><a name="l09625"></a><span class="lineno"> 9625</span>&#160;            <span class="keywordflow">if</span>(!currFree)</div>
-<div class="line"><a name="l09626"></a><span class="lineno"> 9626</span>&#160;            {</div>
-<div class="line"><a name="l09627"></a><span class="lineno"> 9627</span>&#160;                VMA_VALIDATE(suballoc.hAllocation-&gt;GetOffset() == suballoc.offset);</div>
-<div class="line"><a name="l09628"></a><span class="lineno"> 9628</span>&#160;                VMA_VALIDATE(suballoc.hAllocation-&gt;GetSize() == suballoc.size);</div>
-<div class="line"><a name="l09629"></a><span class="lineno"> 9629</span>&#160;                sumUsedSize += suballoc.size;</div>
-<div class="line"><a name="l09630"></a><span class="lineno"> 9630</span>&#160;            }</div>
-<div class="line"><a name="l09631"></a><span class="lineno"> 9631</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09632"></a><span class="lineno"> 9632</span>&#160;            {</div>
-<div class="line"><a name="l09633"></a><span class="lineno"> 9633</span>&#160;                ++nullItem2ndCount;</div>
-<div class="line"><a name="l09634"></a><span class="lineno"> 9634</span>&#160;            }</div>
-<div class="line"><a name="l09635"></a><span class="lineno"> 9635</span>&#160; </div>
-<div class="line"><a name="l09636"></a><span class="lineno"> 9636</span>&#160;            offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;</div>
-<div class="line"><a name="l09637"></a><span class="lineno"> 9637</span>&#160;        }</div>
-<div class="line"><a name="l09638"></a><span class="lineno"> 9638</span>&#160; </div>
-<div class="line"><a name="l09639"></a><span class="lineno"> 9639</span>&#160;        VMA_VALIDATE(nullItem2ndCount == m_2ndNullItemsCount);</div>
-<div class="line"><a name="l09640"></a><span class="lineno"> 9640</span>&#160;    }</div>
-<div class="line"><a name="l09641"></a><span class="lineno"> 9641</span>&#160; </div>
-<div class="line"><a name="l09642"></a><span class="lineno"> 9642</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_1stNullItemsBeginCount; ++i)</div>
-<div class="line"><a name="l09643"></a><span class="lineno"> 9643</span>&#160;    {</div>
-<div class="line"><a name="l09644"></a><span class="lineno"> 9644</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[i];</div>
-<div class="line"><a name="l09645"></a><span class="lineno"> 9645</span>&#160;        VMA_VALIDATE(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE &amp;&amp;</div>
-<div class="line"><a name="l09646"></a><span class="lineno"> 9646</span>&#160;            suballoc.hAllocation == VK_NULL_HANDLE);</div>
-<div class="line"><a name="l09647"></a><span class="lineno"> 9647</span>&#160;    }</div>
-<div class="line"><a name="l09648"></a><span class="lineno"> 9648</span>&#160; </div>
-<div class="line"><a name="l09649"></a><span class="lineno"> 9649</span>&#160;    <span class="keywordtype">size_t</span> nullItem1stCount = m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l09650"></a><span class="lineno"> 9650</span>&#160; </div>
-<div class="line"><a name="l09651"></a><span class="lineno"> 9651</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_1stNullItemsBeginCount; i &lt; suballoc1stCount; ++i)</div>
-<div class="line"><a name="l09652"></a><span class="lineno"> 9652</span>&#160;    {</div>
-<div class="line"><a name="l09653"></a><span class="lineno"> 9653</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[i];</div>
-<div class="line"><a name="l09654"></a><span class="lineno"> 9654</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">bool</span> currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09545"></a><span class="lineno"> 9545</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09546"></a><span class="lineno"> 9546</span>&#160;        }</div>
+<div class="line"><a name="l09547"></a><span class="lineno"> 9547</span>&#160; </div>
+<div class="line"><a name="l09548"></a><span class="lineno"> 9548</span>&#160;        <span class="comment">// Start from offset equal to beginning of this suballocation.</span></div>
+<div class="line"><a name="l09549"></a><span class="lineno"> 9549</span>&#160;        *pOffset = suballoc.offset;</div>
+<div class="line"><a name="l09550"></a><span class="lineno"> 9550</span>&#160;    </div>
+<div class="line"><a name="l09551"></a><span class="lineno"> 9551</span>&#160;        <span class="comment">// Apply VMA_DEBUG_MARGIN at the beginning.</span></div>
+<div class="line"><a name="l09552"></a><span class="lineno"> 9552</span>&#160;        <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN &gt; 0)</div>
+<div class="line"><a name="l09553"></a><span class="lineno"> 9553</span>&#160;        {</div>
+<div class="line"><a name="l09554"></a><span class="lineno"> 9554</span>&#160;            *pOffset += VMA_DEBUG_MARGIN;</div>
+<div class="line"><a name="l09555"></a><span class="lineno"> 9555</span>&#160;        }</div>
+<div class="line"><a name="l09556"></a><span class="lineno"> 9556</span>&#160;    </div>
+<div class="line"><a name="l09557"></a><span class="lineno"> 9557</span>&#160;        <span class="comment">// Apply alignment.</span></div>
+<div class="line"><a name="l09558"></a><span class="lineno"> 9558</span>&#160;        *pOffset = VmaAlignUp(*pOffset, allocAlignment);</div>
+<div class="line"><a name="l09559"></a><span class="lineno"> 9559</span>&#160;    </div>
+<div class="line"><a name="l09560"></a><span class="lineno"> 9560</span>&#160;        <span class="comment">// Check previous suballocations for BufferImageGranularity conflicts.</span></div>
+<div class="line"><a name="l09561"></a><span class="lineno"> 9561</span>&#160;        <span class="comment">// Make bigger alignment if necessary.</span></div>
+<div class="line"><a name="l09562"></a><span class="lineno"> 9562</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
+<div class="line"><a name="l09563"></a><span class="lineno"> 9563</span>&#160;        {</div>
+<div class="line"><a name="l09564"></a><span class="lineno"> 9564</span>&#160;            <span class="keywordtype">bool</span> bufferImageGranularityConflict = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09565"></a><span class="lineno"> 9565</span>&#160;            VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;</div>
+<div class="line"><a name="l09566"></a><span class="lineno"> 9566</span>&#160;            <span class="keywordflow">while</span>(prevSuballocItem != m_Suballocations.cbegin())</div>
+<div class="line"><a name="l09567"></a><span class="lineno"> 9567</span>&#160;            {</div>
+<div class="line"><a name="l09568"></a><span class="lineno"> 9568</span>&#160;                --prevSuballocItem;</div>
+<div class="line"><a name="l09569"></a><span class="lineno"> 9569</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; prevSuballoc = *prevSuballocItem;</div>
+<div class="line"><a name="l09570"></a><span class="lineno"> 9570</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, *pOffset, bufferImageGranularity))</div>
+<div class="line"><a name="l09571"></a><span class="lineno"> 9571</span>&#160;                {</div>
+<div class="line"><a name="l09572"></a><span class="lineno"> 9572</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))</div>
+<div class="line"><a name="l09573"></a><span class="lineno"> 9573</span>&#160;                    {</div>
+<div class="line"><a name="l09574"></a><span class="lineno"> 9574</span>&#160;                        bufferImageGranularityConflict = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09575"></a><span class="lineno"> 9575</span>&#160;                        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l09576"></a><span class="lineno"> 9576</span>&#160;                    }</div>
+<div class="line"><a name="l09577"></a><span class="lineno"> 9577</span>&#160;                }</div>
+<div class="line"><a name="l09578"></a><span class="lineno"> 9578</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09579"></a><span class="lineno"> 9579</span>&#160;                    <span class="comment">// Already on previous page.</span></div>
+<div class="line"><a name="l09580"></a><span class="lineno"> 9580</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l09581"></a><span class="lineno"> 9581</span>&#160;            }</div>
+<div class="line"><a name="l09582"></a><span class="lineno"> 9582</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularityConflict)</div>
+<div class="line"><a name="l09583"></a><span class="lineno"> 9583</span>&#160;            {</div>
+<div class="line"><a name="l09584"></a><span class="lineno"> 9584</span>&#160;                *pOffset = VmaAlignUp(*pOffset, bufferImageGranularity);</div>
+<div class="line"><a name="l09585"></a><span class="lineno"> 9585</span>&#160;            }</div>
+<div class="line"><a name="l09586"></a><span class="lineno"> 9586</span>&#160;        }</div>
+<div class="line"><a name="l09587"></a><span class="lineno"> 9587</span>&#160;    </div>
+<div class="line"><a name="l09588"></a><span class="lineno"> 9588</span>&#160;        <span class="comment">// Calculate padding at the beginning based on current offset.</span></div>
+<div class="line"><a name="l09589"></a><span class="lineno"> 9589</span>&#160;        <span class="keyword">const</span> VkDeviceSize paddingBegin = *pOffset - suballoc.offset;</div>
+<div class="line"><a name="l09590"></a><span class="lineno"> 9590</span>&#160; </div>
+<div class="line"><a name="l09591"></a><span class="lineno"> 9591</span>&#160;        <span class="comment">// Calculate required margin at the end.</span></div>
+<div class="line"><a name="l09592"></a><span class="lineno"> 9592</span>&#160;        <span class="keyword">const</span> VkDeviceSize requiredEndMargin = VMA_DEBUG_MARGIN;</div>
+<div class="line"><a name="l09593"></a><span class="lineno"> 9593</span>&#160; </div>
+<div class="line"><a name="l09594"></a><span class="lineno"> 9594</span>&#160;        <span class="comment">// Fail if requested size plus margin before and after is bigger than size of this suballocation.</span></div>
+<div class="line"><a name="l09595"></a><span class="lineno"> 9595</span>&#160;        <span class="keywordflow">if</span>(paddingBegin + allocSize + requiredEndMargin &gt; suballoc.size)</div>
+<div class="line"><a name="l09596"></a><span class="lineno"> 9596</span>&#160;        {</div>
+<div class="line"><a name="l09597"></a><span class="lineno"> 9597</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09598"></a><span class="lineno"> 9598</span>&#160;        }</div>
+<div class="line"><a name="l09599"></a><span class="lineno"> 9599</span>&#160; </div>
+<div class="line"><a name="l09600"></a><span class="lineno"> 9600</span>&#160;        <span class="comment">// Check next suballocations for BufferImageGranularity conflicts.</span></div>
+<div class="line"><a name="l09601"></a><span class="lineno"> 9601</span>&#160;        <span class="comment">// If conflict exists, allocation cannot be made here.</span></div>
+<div class="line"><a name="l09602"></a><span class="lineno"> 9602</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
+<div class="line"><a name="l09603"></a><span class="lineno"> 9603</span>&#160;        {</div>
+<div class="line"><a name="l09604"></a><span class="lineno"> 9604</span>&#160;            VmaSuballocationList::const_iterator nextSuballocItem = suballocItem;</div>
+<div class="line"><a name="l09605"></a><span class="lineno"> 9605</span>&#160;            ++nextSuballocItem;</div>
+<div class="line"><a name="l09606"></a><span class="lineno"> 9606</span>&#160;            <span class="keywordflow">while</span>(nextSuballocItem != m_Suballocations.cend())</div>
+<div class="line"><a name="l09607"></a><span class="lineno"> 9607</span>&#160;            {</div>
+<div class="line"><a name="l09608"></a><span class="lineno"> 9608</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; nextSuballoc = *nextSuballocItem;</div>
+<div class="line"><a name="l09609"></a><span class="lineno"> 9609</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(*pOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))</div>
+<div class="line"><a name="l09610"></a><span class="lineno"> 9610</span>&#160;                {</div>
+<div class="line"><a name="l09611"></a><span class="lineno"> 9611</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))</div>
+<div class="line"><a name="l09612"></a><span class="lineno"> 9612</span>&#160;                    {</div>
+<div class="line"><a name="l09613"></a><span class="lineno"> 9613</span>&#160;                        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09614"></a><span class="lineno"> 9614</span>&#160;                    }</div>
+<div class="line"><a name="l09615"></a><span class="lineno"> 9615</span>&#160;                }</div>
+<div class="line"><a name="l09616"></a><span class="lineno"> 9616</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09617"></a><span class="lineno"> 9617</span>&#160;                {</div>
+<div class="line"><a name="l09618"></a><span class="lineno"> 9618</span>&#160;                    <span class="comment">// Already on next page.</span></div>
+<div class="line"><a name="l09619"></a><span class="lineno"> 9619</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l09620"></a><span class="lineno"> 9620</span>&#160;                }</div>
+<div class="line"><a name="l09621"></a><span class="lineno"> 9621</span>&#160;                ++nextSuballocItem;</div>
+<div class="line"><a name="l09622"></a><span class="lineno"> 9622</span>&#160;            }</div>
+<div class="line"><a name="l09623"></a><span class="lineno"> 9623</span>&#160;        }</div>
+<div class="line"><a name="l09624"></a><span class="lineno"> 9624</span>&#160;    }</div>
+<div class="line"><a name="l09625"></a><span class="lineno"> 9625</span>&#160; </div>
+<div class="line"><a name="l09626"></a><span class="lineno"> 9626</span>&#160;    <span class="comment">// All tests passed: Success. pOffset is already filled.</span></div>
+<div class="line"><a name="l09627"></a><span class="lineno"> 9627</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09628"></a><span class="lineno"> 9628</span>&#160;}</div>
+<div class="line"><a name="l09629"></a><span class="lineno"> 9629</span>&#160; </div>
+<div class="line"><a name="l09630"></a><span class="lineno"> 9630</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::MergeFreeWithNext(VmaSuballocationList::iterator item)</div>
+<div class="line"><a name="l09631"></a><span class="lineno"> 9631</span>&#160;{</div>
+<div class="line"><a name="l09632"></a><span class="lineno"> 9632</span>&#160;    VMA_ASSERT(item != m_Suballocations.end());</div>
+<div class="line"><a name="l09633"></a><span class="lineno"> 9633</span>&#160;    VMA_ASSERT(item-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09634"></a><span class="lineno"> 9634</span>&#160;    </div>
+<div class="line"><a name="l09635"></a><span class="lineno"> 9635</span>&#160;    VmaSuballocationList::iterator nextItem = item;</div>
+<div class="line"><a name="l09636"></a><span class="lineno"> 9636</span>&#160;    ++nextItem;</div>
+<div class="line"><a name="l09637"></a><span class="lineno"> 9637</span>&#160;    VMA_ASSERT(nextItem != m_Suballocations.end());</div>
+<div class="line"><a name="l09638"></a><span class="lineno"> 9638</span>&#160;    VMA_ASSERT(nextItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09639"></a><span class="lineno"> 9639</span>&#160; </div>
+<div class="line"><a name="l09640"></a><span class="lineno"> 9640</span>&#160;    item-&gt;size += nextItem-&gt;size;</div>
+<div class="line"><a name="l09641"></a><span class="lineno"> 9641</span>&#160;    --m_FreeCount;</div>
+<div class="line"><a name="l09642"></a><span class="lineno"> 9642</span>&#160;    m_Suballocations.erase(nextItem);</div>
+<div class="line"><a name="l09643"></a><span class="lineno"> 9643</span>&#160;}</div>
+<div class="line"><a name="l09644"></a><span class="lineno"> 9644</span>&#160; </div>
+<div class="line"><a name="l09645"></a><span class="lineno"> 9645</span>&#160;VmaSuballocationList::iterator VmaBlockMetadata_Generic::FreeSuballocation(VmaSuballocationList::iterator suballocItem)</div>
+<div class="line"><a name="l09646"></a><span class="lineno"> 9646</span>&#160;{</div>
+<div class="line"><a name="l09647"></a><span class="lineno"> 9647</span>&#160;    <span class="comment">// Change this suballocation to be marked as free.</span></div>
+<div class="line"><a name="l09648"></a><span class="lineno"> 9648</span>&#160;    VmaSuballocation&amp; suballoc = *suballocItem;</div>
+<div class="line"><a name="l09649"></a><span class="lineno"> 9649</span>&#160;    suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
+<div class="line"><a name="l09650"></a><span class="lineno"> 9650</span>&#160;    suballoc.hAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l09651"></a><span class="lineno"> 9651</span>&#160;    </div>
+<div class="line"><a name="l09652"></a><span class="lineno"> 9652</span>&#160;    <span class="comment">// Update totals.</span></div>
+<div class="line"><a name="l09653"></a><span class="lineno"> 9653</span>&#160;    ++m_FreeCount;</div>
+<div class="line"><a name="l09654"></a><span class="lineno"> 9654</span>&#160;    m_SumFreeSize += suballoc.size;</div>
 <div class="line"><a name="l09655"></a><span class="lineno"> 9655</span>&#160; </div>
-<div class="line"><a name="l09656"></a><span class="lineno"> 9656</span>&#160;        VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));</div>
-<div class="line"><a name="l09657"></a><span class="lineno"> 9657</span>&#160;        VMA_VALIDATE(suballoc.offset &gt;= offset);</div>
-<div class="line"><a name="l09658"></a><span class="lineno"> 9658</span>&#160;        VMA_VALIDATE(i &gt;= m_1stNullItemsBeginCount || currFree);</div>
-<div class="line"><a name="l09659"></a><span class="lineno"> 9659</span>&#160; </div>
-<div class="line"><a name="l09660"></a><span class="lineno"> 9660</span>&#160;        <span class="keywordflow">if</span>(!currFree)</div>
-<div class="line"><a name="l09661"></a><span class="lineno"> 9661</span>&#160;        {</div>
-<div class="line"><a name="l09662"></a><span class="lineno"> 9662</span>&#160;            VMA_VALIDATE(suballoc.hAllocation-&gt;GetOffset() == suballoc.offset);</div>
-<div class="line"><a name="l09663"></a><span class="lineno"> 9663</span>&#160;            VMA_VALIDATE(suballoc.hAllocation-&gt;GetSize() == suballoc.size);</div>
-<div class="line"><a name="l09664"></a><span class="lineno"> 9664</span>&#160;            sumUsedSize += suballoc.size;</div>
-<div class="line"><a name="l09665"></a><span class="lineno"> 9665</span>&#160;        }</div>
-<div class="line"><a name="l09666"></a><span class="lineno"> 9666</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09667"></a><span class="lineno"> 9667</span>&#160;        {</div>
-<div class="line"><a name="l09668"></a><span class="lineno"> 9668</span>&#160;            ++nullItem1stCount;</div>
-<div class="line"><a name="l09669"></a><span class="lineno"> 9669</span>&#160;        }</div>
-<div class="line"><a name="l09670"></a><span class="lineno"> 9670</span>&#160; </div>
-<div class="line"><a name="l09671"></a><span class="lineno"> 9671</span>&#160;        offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;</div>
-<div class="line"><a name="l09672"></a><span class="lineno"> 9672</span>&#160;    }</div>
-<div class="line"><a name="l09673"></a><span class="lineno"> 9673</span>&#160;    VMA_VALIDATE(nullItem1stCount == m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount);</div>
-<div class="line"><a name="l09674"></a><span class="lineno"> 9674</span>&#160; </div>
-<div class="line"><a name="l09675"></a><span class="lineno"> 9675</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
-<div class="line"><a name="l09676"></a><span class="lineno"> 9676</span>&#160;    {</div>
-<div class="line"><a name="l09677"></a><span class="lineno"> 9677</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc2ndCount = suballocations2nd.size();</div>
-<div class="line"><a name="l09678"></a><span class="lineno"> 9678</span>&#160;        <span class="keywordtype">size_t</span> nullItem2ndCount = 0;</div>
-<div class="line"><a name="l09679"></a><span class="lineno"> 9679</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = suballoc2ndCount; i--; )</div>
-<div class="line"><a name="l09680"></a><span class="lineno"> 9680</span>&#160;        {</div>
-<div class="line"><a name="l09681"></a><span class="lineno"> 9681</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[i];</div>
-<div class="line"><a name="l09682"></a><span class="lineno"> 9682</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">bool</span> currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l09683"></a><span class="lineno"> 9683</span>&#160; </div>
-<div class="line"><a name="l09684"></a><span class="lineno"> 9684</span>&#160;            VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));</div>
-<div class="line"><a name="l09685"></a><span class="lineno"> 9685</span>&#160;            VMA_VALIDATE(suballoc.offset &gt;= offset);</div>
-<div class="line"><a name="l09686"></a><span class="lineno"> 9686</span>&#160; </div>
-<div class="line"><a name="l09687"></a><span class="lineno"> 9687</span>&#160;            <span class="keywordflow">if</span>(!currFree)</div>
-<div class="line"><a name="l09688"></a><span class="lineno"> 9688</span>&#160;            {</div>
-<div class="line"><a name="l09689"></a><span class="lineno"> 9689</span>&#160;                VMA_VALIDATE(suballoc.hAllocation-&gt;GetOffset() == suballoc.offset);</div>
-<div class="line"><a name="l09690"></a><span class="lineno"> 9690</span>&#160;                VMA_VALIDATE(suballoc.hAllocation-&gt;GetSize() == suballoc.size);</div>
-<div class="line"><a name="l09691"></a><span class="lineno"> 9691</span>&#160;                sumUsedSize += suballoc.size;</div>
-<div class="line"><a name="l09692"></a><span class="lineno"> 9692</span>&#160;            }</div>
-<div class="line"><a name="l09693"></a><span class="lineno"> 9693</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09694"></a><span class="lineno"> 9694</span>&#160;            {</div>
-<div class="line"><a name="l09695"></a><span class="lineno"> 9695</span>&#160;                ++nullItem2ndCount;</div>
-<div class="line"><a name="l09696"></a><span class="lineno"> 9696</span>&#160;            }</div>
-<div class="line"><a name="l09697"></a><span class="lineno"> 9697</span>&#160; </div>
-<div class="line"><a name="l09698"></a><span class="lineno"> 9698</span>&#160;            offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;</div>
-<div class="line"><a name="l09699"></a><span class="lineno"> 9699</span>&#160;        }</div>
-<div class="line"><a name="l09700"></a><span class="lineno"> 9700</span>&#160; </div>
-<div class="line"><a name="l09701"></a><span class="lineno"> 9701</span>&#160;        VMA_VALIDATE(nullItem2ndCount == m_2ndNullItemsCount);</div>
-<div class="line"><a name="l09702"></a><span class="lineno"> 9702</span>&#160;    }</div>
-<div class="line"><a name="l09703"></a><span class="lineno"> 9703</span>&#160; </div>
-<div class="line"><a name="l09704"></a><span class="lineno"> 9704</span>&#160;    VMA_VALIDATE(offset &lt;= GetSize());</div>
-<div class="line"><a name="l09705"></a><span class="lineno"> 9705</span>&#160;    VMA_VALIDATE(m_SumFreeSize == GetSize() - sumUsedSize);</div>
-<div class="line"><a name="l09706"></a><span class="lineno"> 9706</span>&#160; </div>
-<div class="line"><a name="l09707"></a><span class="lineno"> 9707</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l09708"></a><span class="lineno"> 9708</span>&#160;}</div>
-<div class="line"><a name="l09709"></a><span class="lineno"> 9709</span>&#160; </div>
-<div class="line"><a name="l09710"></a><span class="lineno"> 9710</span>&#160;<span class="keywordtype">size_t</span> VmaBlockMetadata_Linear::GetAllocationCount()<span class="keyword"> const</span></div>
-<div class="line"><a name="l09711"></a><span class="lineno"> 9711</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l09712"></a><span class="lineno"> 9712</span>&#160;    <span class="keywordflow">return</span> AccessSuballocations1st().size() - (m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount) +</div>
-<div class="line"><a name="l09713"></a><span class="lineno"> 9713</span>&#160;        AccessSuballocations2nd().size() - m_2ndNullItemsCount;</div>
-<div class="line"><a name="l09714"></a><span class="lineno"> 9714</span>&#160;}</div>
-<div class="line"><a name="l09715"></a><span class="lineno"> 9715</span>&#160; </div>
-<div class="line"><a name="l09716"></a><span class="lineno"> 9716</span>&#160;VkDeviceSize VmaBlockMetadata_Linear::GetUnusedRangeSizeMax()<span class="keyword"> const</span></div>
-<div class="line"><a name="l09717"></a><span class="lineno"> 9717</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l09718"></a><span class="lineno"> 9718</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
-<div class="line"><a name="l09719"></a><span class="lineno"> 9719</span>&#160; </div>
-<div class="line"><a name="l09720"></a><span class="lineno"> 9720</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l09721"></a><span class="lineno"> 9721</span>&#160;<span class="comment">    We don&#39;t consider gaps inside allocation vectors with freed allocations because</span></div>
-<div class="line"><a name="l09722"></a><span class="lineno"> 9722</span>&#160;<span class="comment">    they are not suitable for reuse in linear allocator. We consider only space that</span></div>
-<div class="line"><a name="l09723"></a><span class="lineno"> 9723</span>&#160;<span class="comment">    is available for new allocations.</span></div>
-<div class="line"><a name="l09724"></a><span class="lineno"> 9724</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l09725"></a><span class="lineno"> 9725</span>&#160;    <span class="keywordflow">if</span>(IsEmpty())</div>
-<div class="line"><a name="l09726"></a><span class="lineno"> 9726</span>&#160;    {</div>
-<div class="line"><a name="l09727"></a><span class="lineno"> 9727</span>&#160;        <span class="keywordflow">return</span> size;</div>
-<div class="line"><a name="l09728"></a><span class="lineno"> 9728</span>&#160;    }</div>
-<div class="line"><a name="l09729"></a><span class="lineno"> 9729</span>&#160;    </div>
-<div class="line"><a name="l09730"></a><span class="lineno"> 9730</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l09731"></a><span class="lineno"> 9731</span>&#160; </div>
-<div class="line"><a name="l09732"></a><span class="lineno"> 9732</span>&#160;    <span class="keywordflow">switch</span>(m_2ndVectorMode)</div>
-<div class="line"><a name="l09733"></a><span class="lineno"> 9733</span>&#160;    {</div>
-<div class="line"><a name="l09734"></a><span class="lineno"> 9734</span>&#160;    <span class="keywordflow">case</span> SECOND_VECTOR_EMPTY:</div>
-<div class="line"><a name="l09735"></a><span class="lineno"> 9735</span>&#160;        <span class="comment">/*</span></div>
-<div class="line"><a name="l09736"></a><span class="lineno"> 9736</span>&#160;<span class="comment">        Available space is after end of 1st, as well as before beginning of 1st (which</span></div>
-<div class="line"><a name="l09737"></a><span class="lineno"> 9737</span>&#160;<span class="comment">        whould make it a ring buffer).</span></div>
-<div class="line"><a name="l09738"></a><span class="lineno"> 9738</span>&#160;<span class="comment">        */</span></div>
-<div class="line"><a name="l09739"></a><span class="lineno"> 9739</span>&#160;        {</div>
-<div class="line"><a name="l09740"></a><span class="lineno"> 9740</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballocations1stCount = suballocations1st.size();</div>
-<div class="line"><a name="l09741"></a><span class="lineno"> 9741</span>&#160;            VMA_ASSERT(suballocations1stCount &gt; m_1stNullItemsBeginCount);</div>
-<div class="line"><a name="l09742"></a><span class="lineno"> 9742</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; firstSuballoc = suballocations1st[m_1stNullItemsBeginCount];</div>
-<div class="line"><a name="l09743"></a><span class="lineno"> 9743</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc  = suballocations1st[suballocations1stCount - 1];</div>
-<div class="line"><a name="l09744"></a><span class="lineno"> 9744</span>&#160;            <span class="keywordflow">return</span> VMA_MAX(</div>
-<div class="line"><a name="l09745"></a><span class="lineno"> 9745</span>&#160;                firstSuballoc.offset,</div>
-<div class="line"><a name="l09746"></a><span class="lineno"> 9746</span>&#160;                size - (lastSuballoc.offset + lastSuballoc.size));</div>
-<div class="line"><a name="l09747"></a><span class="lineno"> 9747</span>&#160;        }</div>
-<div class="line"><a name="l09748"></a><span class="lineno"> 9748</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l09749"></a><span class="lineno"> 9749</span>&#160; </div>
-<div class="line"><a name="l09750"></a><span class="lineno"> 9750</span>&#160;    <span class="keywordflow">case</span> SECOND_VECTOR_RING_BUFFER:</div>
-<div class="line"><a name="l09751"></a><span class="lineno"> 9751</span>&#160;        <span class="comment">/*</span></div>
-<div class="line"><a name="l09752"></a><span class="lineno"> 9752</span>&#160;<span class="comment">        Available space is only between end of 2nd and beginning of 1st.</span></div>
-<div class="line"><a name="l09753"></a><span class="lineno"> 9753</span>&#160;<span class="comment">        */</span></div>
-<div class="line"><a name="l09754"></a><span class="lineno"> 9754</span>&#160;        {</div>
-<div class="line"><a name="l09755"></a><span class="lineno"> 9755</span>&#160;            <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l09756"></a><span class="lineno"> 9756</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc2nd = suballocations2nd.back();</div>
-<div class="line"><a name="l09757"></a><span class="lineno"> 9757</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; firstSuballoc1st = suballocations1st[m_1stNullItemsBeginCount];</div>
-<div class="line"><a name="l09758"></a><span class="lineno"> 9758</span>&#160;            <span class="keywordflow">return</span> firstSuballoc1st.offset - (lastSuballoc2nd.offset + lastSuballoc2nd.size);</div>
-<div class="line"><a name="l09759"></a><span class="lineno"> 9759</span>&#160;        }</div>
-<div class="line"><a name="l09760"></a><span class="lineno"> 9760</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l09761"></a><span class="lineno"> 9761</span>&#160; </div>
-<div class="line"><a name="l09762"></a><span class="lineno"> 9762</span>&#160;    <span class="keywordflow">case</span> SECOND_VECTOR_DOUBLE_STACK:</div>
-<div class="line"><a name="l09763"></a><span class="lineno"> 9763</span>&#160;        <span class="comment">/*</span></div>
-<div class="line"><a name="l09764"></a><span class="lineno"> 9764</span>&#160;<span class="comment">        Available space is only between end of 1st and top of 2nd.</span></div>
-<div class="line"><a name="l09765"></a><span class="lineno"> 9765</span>&#160;<span class="comment">        */</span></div>
-<div class="line"><a name="l09766"></a><span class="lineno"> 9766</span>&#160;        {</div>
-<div class="line"><a name="l09767"></a><span class="lineno"> 9767</span>&#160;            <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l09768"></a><span class="lineno"> 9768</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; topSuballoc2nd = suballocations2nd.back();</div>
-<div class="line"><a name="l09769"></a><span class="lineno"> 9769</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc1st = suballocations1st.back();</div>
-<div class="line"><a name="l09770"></a><span class="lineno"> 9770</span>&#160;            <span class="keywordflow">return</span> topSuballoc2nd.offset - (lastSuballoc1st.offset + lastSuballoc1st.size);</div>
-<div class="line"><a name="l09771"></a><span class="lineno"> 9771</span>&#160;        }</div>
-<div class="line"><a name="l09772"></a><span class="lineno"> 9772</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l09773"></a><span class="lineno"> 9773</span>&#160; </div>
-<div class="line"><a name="l09774"></a><span class="lineno"> 9774</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l09775"></a><span class="lineno"> 9775</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l09776"></a><span class="lineno"> 9776</span>&#160;        <span class="keywordflow">return</span> 0;</div>
-<div class="line"><a name="l09777"></a><span class="lineno"> 9777</span>&#160;    }</div>
-<div class="line"><a name="l09778"></a><span class="lineno"> 9778</span>&#160;}</div>
-<div class="line"><a name="l09779"></a><span class="lineno"> 9779</span>&#160; </div>
-<div class="line"><a name="l09780"></a><span class="lineno"> 9780</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo)<span class="keyword"> const</span></div>
-<div class="line"><a name="l09781"></a><span class="lineno"> 9781</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l09782"></a><span class="lineno"> 9782</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
-<div class="line"><a name="l09783"></a><span class="lineno"> 9783</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l09784"></a><span class="lineno"> 9784</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l09785"></a><span class="lineno"> 9785</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc1stCount = suballocations1st.size();</div>
-<div class="line"><a name="l09786"></a><span class="lineno"> 9786</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc2ndCount = suballocations2nd.size();</div>
+<div class="line"><a name="l09656"></a><span class="lineno"> 9656</span>&#160;    <span class="comment">// Merge with previous and/or next suballocation if it&#39;s also free.</span></div>
+<div class="line"><a name="l09657"></a><span class="lineno"> 9657</span>&#160;    <span class="keywordtype">bool</span> mergeWithNext = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09658"></a><span class="lineno"> 9658</span>&#160;    <span class="keywordtype">bool</span> mergeWithPrev = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09659"></a><span class="lineno"> 9659</span>&#160;    </div>
+<div class="line"><a name="l09660"></a><span class="lineno"> 9660</span>&#160;    VmaSuballocationList::iterator nextItem = suballocItem;</div>
+<div class="line"><a name="l09661"></a><span class="lineno"> 9661</span>&#160;    ++nextItem;</div>
+<div class="line"><a name="l09662"></a><span class="lineno"> 9662</span>&#160;    <span class="keywordflow">if</span>((nextItem != m_Suballocations.end()) &amp;&amp; (nextItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE))</div>
+<div class="line"><a name="l09663"></a><span class="lineno"> 9663</span>&#160;    {</div>
+<div class="line"><a name="l09664"></a><span class="lineno"> 9664</span>&#160;        mergeWithNext = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09665"></a><span class="lineno"> 9665</span>&#160;    }</div>
+<div class="line"><a name="l09666"></a><span class="lineno"> 9666</span>&#160; </div>
+<div class="line"><a name="l09667"></a><span class="lineno"> 9667</span>&#160;    VmaSuballocationList::iterator prevItem = suballocItem;</div>
+<div class="line"><a name="l09668"></a><span class="lineno"> 9668</span>&#160;    <span class="keywordflow">if</span>(suballocItem != m_Suballocations.begin())</div>
+<div class="line"><a name="l09669"></a><span class="lineno"> 9669</span>&#160;    {</div>
+<div class="line"><a name="l09670"></a><span class="lineno"> 9670</span>&#160;        --prevItem;</div>
+<div class="line"><a name="l09671"></a><span class="lineno"> 9671</span>&#160;        <span class="keywordflow">if</span>(prevItem-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l09672"></a><span class="lineno"> 9672</span>&#160;        {</div>
+<div class="line"><a name="l09673"></a><span class="lineno"> 9673</span>&#160;            mergeWithPrev = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09674"></a><span class="lineno"> 9674</span>&#160;        }</div>
+<div class="line"><a name="l09675"></a><span class="lineno"> 9675</span>&#160;    }</div>
+<div class="line"><a name="l09676"></a><span class="lineno"> 9676</span>&#160; </div>
+<div class="line"><a name="l09677"></a><span class="lineno"> 9677</span>&#160;    <span class="keywordflow">if</span>(mergeWithNext)</div>
+<div class="line"><a name="l09678"></a><span class="lineno"> 9678</span>&#160;    {</div>
+<div class="line"><a name="l09679"></a><span class="lineno"> 9679</span>&#160;        UnregisterFreeSuballocation(nextItem);</div>
+<div class="line"><a name="l09680"></a><span class="lineno"> 9680</span>&#160;        MergeFreeWithNext(suballocItem);</div>
+<div class="line"><a name="l09681"></a><span class="lineno"> 9681</span>&#160;    }</div>
+<div class="line"><a name="l09682"></a><span class="lineno"> 9682</span>&#160; </div>
+<div class="line"><a name="l09683"></a><span class="lineno"> 9683</span>&#160;    <span class="keywordflow">if</span>(mergeWithPrev)</div>
+<div class="line"><a name="l09684"></a><span class="lineno"> 9684</span>&#160;    {</div>
+<div class="line"><a name="l09685"></a><span class="lineno"> 9685</span>&#160;        UnregisterFreeSuballocation(prevItem);</div>
+<div class="line"><a name="l09686"></a><span class="lineno"> 9686</span>&#160;        MergeFreeWithNext(prevItem);</div>
+<div class="line"><a name="l09687"></a><span class="lineno"> 9687</span>&#160;        RegisterFreeSuballocation(prevItem);</div>
+<div class="line"><a name="l09688"></a><span class="lineno"> 9688</span>&#160;        <span class="keywordflow">return</span> prevItem;</div>
+<div class="line"><a name="l09689"></a><span class="lineno"> 9689</span>&#160;    }</div>
+<div class="line"><a name="l09690"></a><span class="lineno"> 9690</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09691"></a><span class="lineno"> 9691</span>&#160;    {</div>
+<div class="line"><a name="l09692"></a><span class="lineno"> 9692</span>&#160;        RegisterFreeSuballocation(suballocItem);</div>
+<div class="line"><a name="l09693"></a><span class="lineno"> 9693</span>&#160;        <span class="keywordflow">return</span> suballocItem;</div>
+<div class="line"><a name="l09694"></a><span class="lineno"> 9694</span>&#160;    }</div>
+<div class="line"><a name="l09695"></a><span class="lineno"> 9695</span>&#160;}</div>
+<div class="line"><a name="l09696"></a><span class="lineno"> 9696</span>&#160; </div>
+<div class="line"><a name="l09697"></a><span class="lineno"> 9697</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::RegisterFreeSuballocation(VmaSuballocationList::iterator item)</div>
+<div class="line"><a name="l09698"></a><span class="lineno"> 9698</span>&#160;{</div>
+<div class="line"><a name="l09699"></a><span class="lineno"> 9699</span>&#160;    VMA_ASSERT(item-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09700"></a><span class="lineno"> 9700</span>&#160;    VMA_ASSERT(item-&gt;size &gt; 0);</div>
+<div class="line"><a name="l09701"></a><span class="lineno"> 9701</span>&#160; </div>
+<div class="line"><a name="l09702"></a><span class="lineno"> 9702</span>&#160;    <span class="comment">// You may want to enable this validation at the beginning or at the end of</span></div>
+<div class="line"><a name="l09703"></a><span class="lineno"> 9703</span>&#160;    <span class="comment">// this function, depending on what do you want to check.</span></div>
+<div class="line"><a name="l09704"></a><span class="lineno"> 9704</span>&#160;    VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());</div>
+<div class="line"><a name="l09705"></a><span class="lineno"> 9705</span>&#160; </div>
+<div class="line"><a name="l09706"></a><span class="lineno"> 9706</span>&#160;    <span class="keywordflow">if</span>(item-&gt;size &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
+<div class="line"><a name="l09707"></a><span class="lineno"> 9707</span>&#160;    {</div>
+<div class="line"><a name="l09708"></a><span class="lineno"> 9708</span>&#160;        <span class="keywordflow">if</span>(m_FreeSuballocationsBySize.empty())</div>
+<div class="line"><a name="l09709"></a><span class="lineno"> 9709</span>&#160;        {</div>
+<div class="line"><a name="l09710"></a><span class="lineno"> 9710</span>&#160;            m_FreeSuballocationsBySize.push_back(item);</div>
+<div class="line"><a name="l09711"></a><span class="lineno"> 9711</span>&#160;        }</div>
+<div class="line"><a name="l09712"></a><span class="lineno"> 9712</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09713"></a><span class="lineno"> 9713</span>&#160;        {</div>
+<div class="line"><a name="l09714"></a><span class="lineno"> 9714</span>&#160;            VmaVectorInsertSorted&lt;VmaSuballocationItemSizeLess&gt;(m_FreeSuballocationsBySize, item);</div>
+<div class="line"><a name="l09715"></a><span class="lineno"> 9715</span>&#160;        }</div>
+<div class="line"><a name="l09716"></a><span class="lineno"> 9716</span>&#160;    }</div>
+<div class="line"><a name="l09717"></a><span class="lineno"> 9717</span>&#160; </div>
+<div class="line"><a name="l09718"></a><span class="lineno"> 9718</span>&#160;    <span class="comment">//VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());</span></div>
+<div class="line"><a name="l09719"></a><span class="lineno"> 9719</span>&#160;}</div>
+<div class="line"><a name="l09720"></a><span class="lineno"> 9720</span>&#160; </div>
+<div class="line"><a name="l09721"></a><span class="lineno"> 9721</span>&#160; </div>
+<div class="line"><a name="l09722"></a><span class="lineno"> 9722</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Generic::UnregisterFreeSuballocation(VmaSuballocationList::iterator item)</div>
+<div class="line"><a name="l09723"></a><span class="lineno"> 9723</span>&#160;{</div>
+<div class="line"><a name="l09724"></a><span class="lineno"> 9724</span>&#160;    VMA_ASSERT(item-&gt;type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09725"></a><span class="lineno"> 9725</span>&#160;    VMA_ASSERT(item-&gt;size &gt; 0);</div>
+<div class="line"><a name="l09726"></a><span class="lineno"> 9726</span>&#160; </div>
+<div class="line"><a name="l09727"></a><span class="lineno"> 9727</span>&#160;    <span class="comment">// You may want to enable this validation at the beginning or at the end of</span></div>
+<div class="line"><a name="l09728"></a><span class="lineno"> 9728</span>&#160;    <span class="comment">// this function, depending on what do you want to check.</span></div>
+<div class="line"><a name="l09729"></a><span class="lineno"> 9729</span>&#160;    VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());</div>
+<div class="line"><a name="l09730"></a><span class="lineno"> 9730</span>&#160; </div>
+<div class="line"><a name="l09731"></a><span class="lineno"> 9731</span>&#160;    <span class="keywordflow">if</span>(item-&gt;size &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
+<div class="line"><a name="l09732"></a><span class="lineno"> 9732</span>&#160;    {</div>
+<div class="line"><a name="l09733"></a><span class="lineno"> 9733</span>&#160;        VmaSuballocationList::iterator* <span class="keyword">const</span> it = VmaBinaryFindFirstNotLess(</div>
+<div class="line"><a name="l09734"></a><span class="lineno"> 9734</span>&#160;            m_FreeSuballocationsBySize.data(),</div>
+<div class="line"><a name="l09735"></a><span class="lineno"> 9735</span>&#160;            m_FreeSuballocationsBySize.data() + m_FreeSuballocationsBySize.size(),</div>
+<div class="line"><a name="l09736"></a><span class="lineno"> 9736</span>&#160;            item,</div>
+<div class="line"><a name="l09737"></a><span class="lineno"> 9737</span>&#160;            VmaSuballocationItemSizeLess());</div>
+<div class="line"><a name="l09738"></a><span class="lineno"> 9738</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> index = it - m_FreeSuballocationsBySize.data();</div>
+<div class="line"><a name="l09739"></a><span class="lineno"> 9739</span>&#160;            index &lt; m_FreeSuballocationsBySize.size();</div>
+<div class="line"><a name="l09740"></a><span class="lineno"> 9740</span>&#160;            ++index)</div>
+<div class="line"><a name="l09741"></a><span class="lineno"> 9741</span>&#160;        {</div>
+<div class="line"><a name="l09742"></a><span class="lineno"> 9742</span>&#160;            <span class="keywordflow">if</span>(m_FreeSuballocationsBySize[index] == item)</div>
+<div class="line"><a name="l09743"></a><span class="lineno"> 9743</span>&#160;            {</div>
+<div class="line"><a name="l09744"></a><span class="lineno"> 9744</span>&#160;                VmaVectorRemove(m_FreeSuballocationsBySize, index);</div>
+<div class="line"><a name="l09745"></a><span class="lineno"> 9745</span>&#160;                <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l09746"></a><span class="lineno"> 9746</span>&#160;            }</div>
+<div class="line"><a name="l09747"></a><span class="lineno"> 9747</span>&#160;            VMA_ASSERT((m_FreeSuballocationsBySize[index]-&gt;size == item-&gt;size) &amp;&amp; <span class="stringliteral">&quot;Not found.&quot;</span>);</div>
+<div class="line"><a name="l09748"></a><span class="lineno"> 9748</span>&#160;        }</div>
+<div class="line"><a name="l09749"></a><span class="lineno"> 9749</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Not found.&quot;</span>);</div>
+<div class="line"><a name="l09750"></a><span class="lineno"> 9750</span>&#160;    }</div>
+<div class="line"><a name="l09751"></a><span class="lineno"> 9751</span>&#160; </div>
+<div class="line"><a name="l09752"></a><span class="lineno"> 9752</span>&#160;    <span class="comment">//VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());</span></div>
+<div class="line"><a name="l09753"></a><span class="lineno"> 9753</span>&#160;}</div>
+<div class="line"><a name="l09754"></a><span class="lineno"> 9754</span>&#160; </div>
+<div class="line"><a name="l09755"></a><span class="lineno"> 9755</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Generic::IsBufferImageGranularityConflictPossible(</div>
+<div class="line"><a name="l09756"></a><span class="lineno"> 9756</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l09757"></a><span class="lineno"> 9757</span>&#160;    VmaSuballocationType&amp; inOutPrevSuballocType)<span class="keyword"> const</span></div>
+<div class="line"><a name="l09758"></a><span class="lineno"> 9758</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l09759"></a><span class="lineno"> 9759</span>&#160;    <span class="keywordflow">if</span>(bufferImageGranularity == 1 || IsEmpty())</div>
+<div class="line"><a name="l09760"></a><span class="lineno"> 9760</span>&#160;    {</div>
+<div class="line"><a name="l09761"></a><span class="lineno"> 9761</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09762"></a><span class="lineno"> 9762</span>&#160;    }</div>
+<div class="line"><a name="l09763"></a><span class="lineno"> 9763</span>&#160; </div>
+<div class="line"><a name="l09764"></a><span class="lineno"> 9764</span>&#160;    VkDeviceSize minAlignment = VK_WHOLE_SIZE;</div>
+<div class="line"><a name="l09765"></a><span class="lineno"> 9765</span>&#160;    <span class="keywordtype">bool</span> typeConflictFound = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l09766"></a><span class="lineno"> 9766</span>&#160;    <span class="keywordflow">for</span>(VmaSuballocationList::const_iterator it = m_Suballocations.cbegin();</div>
+<div class="line"><a name="l09767"></a><span class="lineno"> 9767</span>&#160;        it != m_Suballocations.cend();</div>
+<div class="line"><a name="l09768"></a><span class="lineno"> 9768</span>&#160;        ++it)</div>
+<div class="line"><a name="l09769"></a><span class="lineno"> 9769</span>&#160;    {</div>
+<div class="line"><a name="l09770"></a><span class="lineno"> 9770</span>&#160;        <span class="keyword">const</span> VmaSuballocationType suballocType = it-&gt;type;</div>
+<div class="line"><a name="l09771"></a><span class="lineno"> 9771</span>&#160;        <span class="keywordflow">if</span>(suballocType != VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l09772"></a><span class="lineno"> 9772</span>&#160;        {</div>
+<div class="line"><a name="l09773"></a><span class="lineno"> 9773</span>&#160;            minAlignment = VMA_MIN(minAlignment, it-&gt;hAllocation-&gt;GetAlignment());</div>
+<div class="line"><a name="l09774"></a><span class="lineno"> 9774</span>&#160;            <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(inOutPrevSuballocType, suballocType))</div>
+<div class="line"><a name="l09775"></a><span class="lineno"> 9775</span>&#160;            {</div>
+<div class="line"><a name="l09776"></a><span class="lineno"> 9776</span>&#160;                typeConflictFound = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09777"></a><span class="lineno"> 9777</span>&#160;            }</div>
+<div class="line"><a name="l09778"></a><span class="lineno"> 9778</span>&#160;            inOutPrevSuballocType = suballocType;</div>
+<div class="line"><a name="l09779"></a><span class="lineno"> 9779</span>&#160;        }</div>
+<div class="line"><a name="l09780"></a><span class="lineno"> 9780</span>&#160;    }</div>
+<div class="line"><a name="l09781"></a><span class="lineno"> 9781</span>&#160; </div>
+<div class="line"><a name="l09782"></a><span class="lineno"> 9782</span>&#160;    <span class="keywordflow">return</span> typeConflictFound || minAlignment &gt;= bufferImageGranularity;</div>
+<div class="line"><a name="l09783"></a><span class="lineno"> 9783</span>&#160;}</div>
+<div class="line"><a name="l09784"></a><span class="lineno"> 9784</span>&#160; </div>
+<div class="line"><a name="l09786"></a><span class="lineno"> 9786</span>&#160;<span class="comment">// class VmaBlockMetadata_Linear</span></div>
 <div class="line"><a name="l09787"></a><span class="lineno"> 9787</span>&#160; </div>
-<div class="line"><a name="l09788"></a><span class="lineno"> 9788</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> = 1;</div>
-<div class="line"><a name="l09789"></a><span class="lineno"> 9789</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> = (uint32_t)GetAllocationCount();</div>
-<div class="line"><a name="l09790"></a><span class="lineno"> 9790</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> = 0;</div>
-<div class="line"><a name="l09791"></a><span class="lineno"> 9791</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> = 0;</div>
-<div class="line"><a name="l09792"></a><span class="lineno"> 9792</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = UINT64_MAX;</div>
-<div class="line"><a name="l09793"></a><span class="lineno"> 9793</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = 0;</div>
-<div class="line"><a name="l09794"></a><span class="lineno"> 9794</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = UINT64_MAX;</div>
-<div class="line"><a name="l09795"></a><span class="lineno"> 9795</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = 0;</div>
-<div class="line"><a name="l09796"></a><span class="lineno"> 9796</span>&#160; </div>
-<div class="line"><a name="l09797"></a><span class="lineno"> 9797</span>&#160;    VkDeviceSize lastOffset = 0;</div>
-<div class="line"><a name="l09798"></a><span class="lineno"> 9798</span>&#160; </div>
-<div class="line"><a name="l09799"></a><span class="lineno"> 9799</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
-<div class="line"><a name="l09800"></a><span class="lineno"> 9800</span>&#160;    {</div>
-<div class="line"><a name="l09801"></a><span class="lineno"> 9801</span>&#160;        <span class="keyword">const</span> VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;</div>
-<div class="line"><a name="l09802"></a><span class="lineno"> 9802</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = 0;</div>
-<div class="line"><a name="l09803"></a><span class="lineno"> 9803</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
-<div class="line"><a name="l09804"></a><span class="lineno"> 9804</span>&#160;        {</div>
-<div class="line"><a name="l09805"></a><span class="lineno"> 9805</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
-<div class="line"><a name="l09806"></a><span class="lineno"> 9806</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex &lt; suballoc2ndCount &amp;&amp;</div>
-<div class="line"><a name="l09807"></a><span class="lineno"> 9807</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l09808"></a><span class="lineno"> 9808</span>&#160;            {</div>
-<div class="line"><a name="l09809"></a><span class="lineno"> 9809</span>&#160;                ++nextAlloc2ndIndex;</div>
-<div class="line"><a name="l09810"></a><span class="lineno"> 9810</span>&#160;            }</div>
-<div class="line"><a name="l09811"></a><span class="lineno"> 9811</span>&#160; </div>
-<div class="line"><a name="l09812"></a><span class="lineno"> 9812</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l09813"></a><span class="lineno"> 9813</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex &lt; suballoc2ndCount)</div>
-<div class="line"><a name="l09814"></a><span class="lineno"> 9814</span>&#160;            {</div>
-<div class="line"><a name="l09815"></a><span class="lineno"> 9815</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
-<div class="line"><a name="l09816"></a><span class="lineno"> 9816</span>&#160;            </div>
-<div class="line"><a name="l09817"></a><span class="lineno"> 9817</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l09818"></a><span class="lineno"> 9818</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
-<div class="line"><a name="l09819"></a><span class="lineno"> 9819</span>&#160;                {</div>
-<div class="line"><a name="l09820"></a><span class="lineno"> 9820</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l09821"></a><span class="lineno"> 9821</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
-<div class="line"><a name="l09822"></a><span class="lineno"> 9822</span>&#160;                    ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
-<div class="line"><a name="l09823"></a><span class="lineno"> 9823</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
-<div class="line"><a name="l09824"></a><span class="lineno"> 9824</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09825"></a><span class="lineno"> 9825</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09826"></a><span class="lineno"> 9826</span>&#160;                }</div>
-<div class="line"><a name="l09827"></a><span class="lineno"> 9827</span>&#160;            </div>
-<div class="line"><a name="l09828"></a><span class="lineno"> 9828</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l09829"></a><span class="lineno"> 9829</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l09830"></a><span class="lineno"> 9830</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> += suballoc.size;</div>
-<div class="line"><a name="l09831"></a><span class="lineno"> 9831</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, suballoc.size);</div>
-<div class="line"><a name="l09832"></a><span class="lineno"> 9832</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, suballoc.size);</div>
-<div class="line"><a name="l09833"></a><span class="lineno"> 9833</span>&#160;            </div>
-<div class="line"><a name="l09834"></a><span class="lineno"> 9834</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l09835"></a><span class="lineno"> 9835</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l09836"></a><span class="lineno"> 9836</span>&#160;                ++nextAlloc2ndIndex;</div>
-<div class="line"><a name="l09837"></a><span class="lineno"> 9837</span>&#160;            }</div>
-<div class="line"><a name="l09838"></a><span class="lineno"> 9838</span>&#160;            <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l09839"></a><span class="lineno"> 9839</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09840"></a><span class="lineno"> 9840</span>&#160;            {</div>
-<div class="line"><a name="l09841"></a><span class="lineno"> 9841</span>&#160;                <span class="comment">// There is free space from lastOffset to freeSpace2ndTo1stEnd.</span></div>
-<div class="line"><a name="l09842"></a><span class="lineno"> 9842</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
-<div class="line"><a name="l09843"></a><span class="lineno"> 9843</span>&#160;                {</div>
-<div class="line"><a name="l09844"></a><span class="lineno"> 9844</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;</div>
-<div class="line"><a name="l09845"></a><span class="lineno"> 9845</span>&#160;                    ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
-<div class="line"><a name="l09846"></a><span class="lineno"> 9846</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
-<div class="line"><a name="l09847"></a><span class="lineno"> 9847</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09848"></a><span class="lineno"> 9848</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09849"></a><span class="lineno"> 9849</span>&#160;               }</div>
-<div class="line"><a name="l09850"></a><span class="lineno"> 9850</span>&#160; </div>
-<div class="line"><a name="l09851"></a><span class="lineno"> 9851</span>&#160;                <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l09852"></a><span class="lineno"> 9852</span>&#160;                lastOffset = freeSpace2ndTo1stEnd;</div>
-<div class="line"><a name="l09853"></a><span class="lineno"> 9853</span>&#160;            }</div>
-<div class="line"><a name="l09854"></a><span class="lineno"> 9854</span>&#160;        }</div>
-<div class="line"><a name="l09855"></a><span class="lineno"> 9855</span>&#160;    }</div>
-<div class="line"><a name="l09856"></a><span class="lineno"> 9856</span>&#160; </div>
-<div class="line"><a name="l09857"></a><span class="lineno"> 9857</span>&#160;    <span class="keywordtype">size_t</span> nextAlloc1stIndex = m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l09858"></a><span class="lineno"> 9858</span>&#160;    <span class="keyword">const</span> VkDeviceSize freeSpace1stTo2ndEnd =</div>
-<div class="line"><a name="l09859"></a><span class="lineno"> 9859</span>&#160;        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;</div>
-<div class="line"><a name="l09860"></a><span class="lineno"> 9860</span>&#160;    <span class="keywordflow">while</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
-<div class="line"><a name="l09861"></a><span class="lineno"> 9861</span>&#160;    {</div>
-<div class="line"><a name="l09862"></a><span class="lineno"> 9862</span>&#160;        <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
-<div class="line"><a name="l09863"></a><span class="lineno"> 9863</span>&#160;        <span class="keywordflow">while</span>(nextAlloc1stIndex &lt; suballoc1stCount &amp;&amp;</div>
-<div class="line"><a name="l09864"></a><span class="lineno"> 9864</span>&#160;            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l09865"></a><span class="lineno"> 9865</span>&#160;        {</div>
-<div class="line"><a name="l09866"></a><span class="lineno"> 9866</span>&#160;            ++nextAlloc1stIndex;</div>
-<div class="line"><a name="l09867"></a><span class="lineno"> 9867</span>&#160;        }</div>
-<div class="line"><a name="l09868"></a><span class="lineno"> 9868</span>&#160; </div>
-<div class="line"><a name="l09869"></a><span class="lineno"> 9869</span>&#160;        <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l09870"></a><span class="lineno"> 9870</span>&#160;        <span class="keywordflow">if</span>(nextAlloc1stIndex &lt; suballoc1stCount)</div>
-<div class="line"><a name="l09871"></a><span class="lineno"> 9871</span>&#160;        {</div>
-<div class="line"><a name="l09872"></a><span class="lineno"> 9872</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[nextAlloc1stIndex];</div>
-<div class="line"><a name="l09873"></a><span class="lineno"> 9873</span>&#160;            </div>
-<div class="line"><a name="l09874"></a><span class="lineno"> 9874</span>&#160;            <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l09875"></a><span class="lineno"> 9875</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
-<div class="line"><a name="l09876"></a><span class="lineno"> 9876</span>&#160;            {</div>
-<div class="line"><a name="l09877"></a><span class="lineno"> 9877</span>&#160;                <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l09878"></a><span class="lineno"> 9878</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
-<div class="line"><a name="l09879"></a><span class="lineno"> 9879</span>&#160;                ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
-<div class="line"><a name="l09880"></a><span class="lineno"> 9880</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
-<div class="line"><a name="l09881"></a><span class="lineno"> 9881</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09882"></a><span class="lineno"> 9882</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09883"></a><span class="lineno"> 9883</span>&#160;            }</div>
-<div class="line"><a name="l09884"></a><span class="lineno"> 9884</span>&#160;            </div>
-<div class="line"><a name="l09885"></a><span class="lineno"> 9885</span>&#160;            <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l09886"></a><span class="lineno"> 9886</span>&#160;            <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l09887"></a><span class="lineno"> 9887</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> += suballoc.size;</div>
-<div class="line"><a name="l09888"></a><span class="lineno"> 9888</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, suballoc.size);</div>
-<div class="line"><a name="l09889"></a><span class="lineno"> 9889</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, suballoc.size);</div>
-<div class="line"><a name="l09890"></a><span class="lineno"> 9890</span>&#160;            </div>
-<div class="line"><a name="l09891"></a><span class="lineno"> 9891</span>&#160;            <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l09892"></a><span class="lineno"> 9892</span>&#160;            lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l09893"></a><span class="lineno"> 9893</span>&#160;            ++nextAlloc1stIndex;</div>
-<div class="line"><a name="l09894"></a><span class="lineno"> 9894</span>&#160;        }</div>
-<div class="line"><a name="l09895"></a><span class="lineno"> 9895</span>&#160;        <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l09896"></a><span class="lineno"> 9896</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09897"></a><span class="lineno"> 9897</span>&#160;        {</div>
-<div class="line"><a name="l09898"></a><span class="lineno"> 9898</span>&#160;            <span class="comment">// There is free space from lastOffset to freeSpace1stTo2ndEnd.</span></div>
-<div class="line"><a name="l09899"></a><span class="lineno"> 9899</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
-<div class="line"><a name="l09900"></a><span class="lineno"> 9900</span>&#160;            {</div>
-<div class="line"><a name="l09901"></a><span class="lineno"> 9901</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;</div>
-<div class="line"><a name="l09902"></a><span class="lineno"> 9902</span>&#160;                ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
-<div class="line"><a name="l09903"></a><span class="lineno"> 9903</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
-<div class="line"><a name="l09904"></a><span class="lineno"> 9904</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09905"></a><span class="lineno"> 9905</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09906"></a><span class="lineno"> 9906</span>&#160;           }</div>
-<div class="line"><a name="l09907"></a><span class="lineno"> 9907</span>&#160; </div>
-<div class="line"><a name="l09908"></a><span class="lineno"> 9908</span>&#160;            <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l09909"></a><span class="lineno"> 9909</span>&#160;            lastOffset = freeSpace1stTo2ndEnd;</div>
-<div class="line"><a name="l09910"></a><span class="lineno"> 9910</span>&#160;        }</div>
-<div class="line"><a name="l09911"></a><span class="lineno"> 9911</span>&#160;    }</div>
-<div class="line"><a name="l09912"></a><span class="lineno"> 9912</span>&#160; </div>
-<div class="line"><a name="l09913"></a><span class="lineno"> 9913</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
-<div class="line"><a name="l09914"></a><span class="lineno"> 9914</span>&#160;    {</div>
-<div class="line"><a name="l09915"></a><span class="lineno"> 9915</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = suballocations2nd.size() - 1;</div>
-<div class="line"><a name="l09916"></a><span class="lineno"> 9916</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; size)</div>
-<div class="line"><a name="l09917"></a><span class="lineno"> 9917</span>&#160;        {</div>
-<div class="line"><a name="l09918"></a><span class="lineno"> 9918</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
-<div class="line"><a name="l09919"></a><span class="lineno"> 9919</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex != SIZE_MAX &amp;&amp;</div>
-<div class="line"><a name="l09920"></a><span class="lineno"> 9920</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l09921"></a><span class="lineno"> 9921</span>&#160;            {</div>
-<div class="line"><a name="l09922"></a><span class="lineno"> 9922</span>&#160;                --nextAlloc2ndIndex;</div>
-<div class="line"><a name="l09923"></a><span class="lineno"> 9923</span>&#160;            }</div>
-<div class="line"><a name="l09924"></a><span class="lineno"> 9924</span>&#160; </div>
-<div class="line"><a name="l09925"></a><span class="lineno"> 9925</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l09926"></a><span class="lineno"> 9926</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex != SIZE_MAX)</div>
-<div class="line"><a name="l09927"></a><span class="lineno"> 9927</span>&#160;            {</div>
-<div class="line"><a name="l09928"></a><span class="lineno"> 9928</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
-<div class="line"><a name="l09929"></a><span class="lineno"> 9929</span>&#160;            </div>
-<div class="line"><a name="l09930"></a><span class="lineno"> 9930</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l09931"></a><span class="lineno"> 9931</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
-<div class="line"><a name="l09932"></a><span class="lineno"> 9932</span>&#160;                {</div>
-<div class="line"><a name="l09933"></a><span class="lineno"> 9933</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l09934"></a><span class="lineno"> 9934</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
-<div class="line"><a name="l09935"></a><span class="lineno"> 9935</span>&#160;                    ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
-<div class="line"><a name="l09936"></a><span class="lineno"> 9936</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
-<div class="line"><a name="l09937"></a><span class="lineno"> 9937</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09938"></a><span class="lineno"> 9938</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09939"></a><span class="lineno"> 9939</span>&#160;                }</div>
-<div class="line"><a name="l09940"></a><span class="lineno"> 9940</span>&#160;            </div>
-<div class="line"><a name="l09941"></a><span class="lineno"> 9941</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l09942"></a><span class="lineno"> 9942</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l09943"></a><span class="lineno"> 9943</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> += suballoc.size;</div>
-<div class="line"><a name="l09944"></a><span class="lineno"> 9944</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, suballoc.size);</div>
-<div class="line"><a name="l09945"></a><span class="lineno"> 9945</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, suballoc.size);</div>
-<div class="line"><a name="l09946"></a><span class="lineno"> 9946</span>&#160;            </div>
-<div class="line"><a name="l09947"></a><span class="lineno"> 9947</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l09948"></a><span class="lineno"> 9948</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l09949"></a><span class="lineno"> 9949</span>&#160;                --nextAlloc2ndIndex;</div>
-<div class="line"><a name="l09950"></a><span class="lineno"> 9950</span>&#160;            }</div>
-<div class="line"><a name="l09951"></a><span class="lineno"> 9951</span>&#160;            <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l09952"></a><span class="lineno"> 9952</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l09953"></a><span class="lineno"> 9953</span>&#160;            {</div>
-<div class="line"><a name="l09954"></a><span class="lineno"> 9954</span>&#160;                <span class="comment">// There is free space from lastOffset to size.</span></div>
-<div class="line"><a name="l09955"></a><span class="lineno"> 9955</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; size)</div>
-<div class="line"><a name="l09956"></a><span class="lineno"> 9956</span>&#160;                {</div>
-<div class="line"><a name="l09957"></a><span class="lineno"> 9957</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = size - lastOffset;</div>
-<div class="line"><a name="l09958"></a><span class="lineno"> 9958</span>&#160;                    ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
-<div class="line"><a name="l09959"></a><span class="lineno"> 9959</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
-<div class="line"><a name="l09960"></a><span class="lineno"> 9960</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09961"></a><span class="lineno"> 9961</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l09962"></a><span class="lineno"> 9962</span>&#160;               }</div>
-<div class="line"><a name="l09963"></a><span class="lineno"> 9963</span>&#160; </div>
-<div class="line"><a name="l09964"></a><span class="lineno"> 9964</span>&#160;                <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l09965"></a><span class="lineno"> 9965</span>&#160;                lastOffset = size;</div>
-<div class="line"><a name="l09966"></a><span class="lineno"> 9966</span>&#160;            }</div>
-<div class="line"><a name="l09967"></a><span class="lineno"> 9967</span>&#160;        }</div>
-<div class="line"><a name="l09968"></a><span class="lineno"> 9968</span>&#160;    }</div>
-<div class="line"><a name="l09969"></a><span class="lineno"> 9969</span>&#160; </div>
-<div class="line"><a name="l09970"></a><span class="lineno"> 9970</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> = size - outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a>;</div>
-<div class="line"><a name="l09971"></a><span class="lineno"> 9971</span>&#160;}</div>
-<div class="line"><a name="l09972"></a><span class="lineno"> 9972</span>&#160; </div>
-<div class="line"><a name="l09973"></a><span class="lineno"> 9973</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats)<span class="keyword"> const</span></div>
-<div class="line"><a name="l09974"></a><span class="lineno"> 9974</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l09975"></a><span class="lineno"> 9975</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l09976"></a><span class="lineno"> 9976</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l09977"></a><span class="lineno"> 9977</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
-<div class="line"><a name="l09978"></a><span class="lineno"> 9978</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc1stCount = suballocations1st.size();</div>
-<div class="line"><a name="l09979"></a><span class="lineno"> 9979</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc2ndCount = suballocations2nd.size();</div>
-<div class="line"><a name="l09980"></a><span class="lineno"> 9980</span>&#160; </div>
-<div class="line"><a name="l09981"></a><span class="lineno"> 9981</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a> += size;</div>
-<div class="line"><a name="l09982"></a><span class="lineno"> 9982</span>&#160; </div>
-<div class="line"><a name="l09983"></a><span class="lineno"> 9983</span>&#160;    VkDeviceSize lastOffset = 0;</div>
-<div class="line"><a name="l09984"></a><span class="lineno"> 9984</span>&#160; </div>
-<div class="line"><a name="l09985"></a><span class="lineno"> 9985</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
-<div class="line"><a name="l09986"></a><span class="lineno"> 9986</span>&#160;    {</div>
-<div class="line"><a name="l09987"></a><span class="lineno"> 9987</span>&#160;        <span class="keyword">const</span> VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;</div>
-<div class="line"><a name="l09988"></a><span class="lineno"> 9988</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l09989"></a><span class="lineno"> 9989</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
-<div class="line"><a name="l09990"></a><span class="lineno"> 9990</span>&#160;        {</div>
-<div class="line"><a name="l09991"></a><span class="lineno"> 9991</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
-<div class="line"><a name="l09992"></a><span class="lineno"> 9992</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex &lt; suballoc2ndCount &amp;&amp;</div>
-<div class="line"><a name="l09993"></a><span class="lineno"> 9993</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l09994"></a><span class="lineno"> 9994</span>&#160;            {</div>
-<div class="line"><a name="l09995"></a><span class="lineno"> 9995</span>&#160;                ++nextAlloc2ndIndex;</div>
-<div class="line"><a name="l09996"></a><span class="lineno"> 9996</span>&#160;            }</div>
-<div class="line"><a name="l09997"></a><span class="lineno"> 9997</span>&#160; </div>
-<div class="line"><a name="l09998"></a><span class="lineno"> 9998</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l09999"></a><span class="lineno"> 9999</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex &lt; suballoc2ndCount)</div>
-<div class="line"><a name="l10000"></a><span class="lineno">10000</span>&#160;            {</div>
-<div class="line"><a name="l10001"></a><span class="lineno">10001</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
-<div class="line"><a name="l10002"></a><span class="lineno">10002</span>&#160;            </div>
-<div class="line"><a name="l10003"></a><span class="lineno">10003</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l10004"></a><span class="lineno">10004</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
-<div class="line"><a name="l10005"></a><span class="lineno">10005</span>&#160;                {</div>
-<div class="line"><a name="l10006"></a><span class="lineno">10006</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l10007"></a><span class="lineno">10007</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
-<div class="line"><a name="l10008"></a><span class="lineno">10008</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
-<div class="line"><a name="l10009"></a><span class="lineno">10009</span>&#160;                    ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
-<div class="line"><a name="l10010"></a><span class="lineno">10010</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l10011"></a><span class="lineno">10011</span>&#160;                }</div>
-<div class="line"><a name="l10012"></a><span class="lineno">10012</span>&#160;            </div>
-<div class="line"><a name="l10013"></a><span class="lineno">10013</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l10014"></a><span class="lineno">10014</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l10015"></a><span class="lineno">10015</span>&#160;                ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a>;</div>
-<div class="line"><a name="l10016"></a><span class="lineno">10016</span>&#160;            </div>
-<div class="line"><a name="l10017"></a><span class="lineno">10017</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l10018"></a><span class="lineno">10018</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l10019"></a><span class="lineno">10019</span>&#160;                ++nextAlloc2ndIndex;</div>
-<div class="line"><a name="l10020"></a><span class="lineno">10020</span>&#160;            }</div>
-<div class="line"><a name="l10021"></a><span class="lineno">10021</span>&#160;            <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l10022"></a><span class="lineno">10022</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10023"></a><span class="lineno">10023</span>&#160;            {</div>
-<div class="line"><a name="l10024"></a><span class="lineno">10024</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
-<div class="line"><a name="l10025"></a><span class="lineno">10025</span>&#160;                {</div>
-<div class="line"><a name="l10026"></a><span class="lineno">10026</span>&#160;                    <span class="comment">// There is free space from lastOffset to freeSpace2ndTo1stEnd.</span></div>
-<div class="line"><a name="l10027"></a><span class="lineno">10027</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;</div>
-<div class="line"><a name="l10028"></a><span class="lineno">10028</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
-<div class="line"><a name="l10029"></a><span class="lineno">10029</span>&#160;                    ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
-<div class="line"><a name="l10030"></a><span class="lineno">10030</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l10031"></a><span class="lineno">10031</span>&#160;                }</div>
-<div class="line"><a name="l10032"></a><span class="lineno">10032</span>&#160; </div>
-<div class="line"><a name="l10033"></a><span class="lineno">10033</span>&#160;                <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l10034"></a><span class="lineno">10034</span>&#160;                lastOffset = freeSpace2ndTo1stEnd;</div>
-<div class="line"><a name="l10035"></a><span class="lineno">10035</span>&#160;            }</div>
-<div class="line"><a name="l10036"></a><span class="lineno">10036</span>&#160;        }</div>
-<div class="line"><a name="l10037"></a><span class="lineno">10037</span>&#160;    }</div>
-<div class="line"><a name="l10038"></a><span class="lineno">10038</span>&#160; </div>
-<div class="line"><a name="l10039"></a><span class="lineno">10039</span>&#160;    <span class="keywordtype">size_t</span> nextAlloc1stIndex = m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l10040"></a><span class="lineno">10040</span>&#160;    <span class="keyword">const</span> VkDeviceSize freeSpace1stTo2ndEnd =</div>
-<div class="line"><a name="l10041"></a><span class="lineno">10041</span>&#160;        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;</div>
-<div class="line"><a name="l10042"></a><span class="lineno">10042</span>&#160;    <span class="keywordflow">while</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
-<div class="line"><a name="l10043"></a><span class="lineno">10043</span>&#160;    {</div>
-<div class="line"><a name="l10044"></a><span class="lineno">10044</span>&#160;        <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
-<div class="line"><a name="l10045"></a><span class="lineno">10045</span>&#160;        <span class="keywordflow">while</span>(nextAlloc1stIndex &lt; suballoc1stCount &amp;&amp;</div>
-<div class="line"><a name="l10046"></a><span class="lineno">10046</span>&#160;            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l10047"></a><span class="lineno">10047</span>&#160;        {</div>
-<div class="line"><a name="l10048"></a><span class="lineno">10048</span>&#160;            ++nextAlloc1stIndex;</div>
-<div class="line"><a name="l10049"></a><span class="lineno">10049</span>&#160;        }</div>
-<div class="line"><a name="l10050"></a><span class="lineno">10050</span>&#160; </div>
-<div class="line"><a name="l10051"></a><span class="lineno">10051</span>&#160;        <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l10052"></a><span class="lineno">10052</span>&#160;        <span class="keywordflow">if</span>(nextAlloc1stIndex &lt; suballoc1stCount)</div>
-<div class="line"><a name="l10053"></a><span class="lineno">10053</span>&#160;        {</div>
-<div class="line"><a name="l10054"></a><span class="lineno">10054</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[nextAlloc1stIndex];</div>
+<div class="line"><a name="l09788"></a><span class="lineno"> 9788</span>&#160;VmaBlockMetadata_Linear::VmaBlockMetadata_Linear(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator) :</div>
+<div class="line"><a name="l09789"></a><span class="lineno"> 9789</span>&#160;    VmaBlockMetadata(hAllocator),</div>
+<div class="line"><a name="l09790"></a><span class="lineno"> 9790</span>&#160;    m_SumFreeSize(0),</div>
+<div class="line"><a name="l09791"></a><span class="lineno"> 9791</span>&#160;    m_Suballocations0(VmaStlAllocator&lt;VmaSuballocation&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
+<div class="line"><a name="l09792"></a><span class="lineno"> 9792</span>&#160;    m_Suballocations1(VmaStlAllocator&lt;VmaSuballocation&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
+<div class="line"><a name="l09793"></a><span class="lineno"> 9793</span>&#160;    m_1stVectorIndex(0),</div>
+<div class="line"><a name="l09794"></a><span class="lineno"> 9794</span>&#160;    m_2ndVectorMode(SECOND_VECTOR_EMPTY),</div>
+<div class="line"><a name="l09795"></a><span class="lineno"> 9795</span>&#160;    m_1stNullItemsBeginCount(0),</div>
+<div class="line"><a name="l09796"></a><span class="lineno"> 9796</span>&#160;    m_1stNullItemsMiddleCount(0),</div>
+<div class="line"><a name="l09797"></a><span class="lineno"> 9797</span>&#160;    m_2ndNullItemsCount(0)</div>
+<div class="line"><a name="l09798"></a><span class="lineno"> 9798</span>&#160;{</div>
+<div class="line"><a name="l09799"></a><span class="lineno"> 9799</span>&#160;}</div>
+<div class="line"><a name="l09800"></a><span class="lineno"> 9800</span>&#160; </div>
+<div class="line"><a name="l09801"></a><span class="lineno"> 9801</span>&#160;VmaBlockMetadata_Linear::~VmaBlockMetadata_Linear()</div>
+<div class="line"><a name="l09802"></a><span class="lineno"> 9802</span>&#160;{</div>
+<div class="line"><a name="l09803"></a><span class="lineno"> 9803</span>&#160;}</div>
+<div class="line"><a name="l09804"></a><span class="lineno"> 9804</span>&#160; </div>
+<div class="line"><a name="l09805"></a><span class="lineno"> 9805</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::Init(VkDeviceSize size)</div>
+<div class="line"><a name="l09806"></a><span class="lineno"> 9806</span>&#160;{</div>
+<div class="line"><a name="l09807"></a><span class="lineno"> 9807</span>&#160;    VmaBlockMetadata::Init(size);</div>
+<div class="line"><a name="l09808"></a><span class="lineno"> 9808</span>&#160;    m_SumFreeSize = size;</div>
+<div class="line"><a name="l09809"></a><span class="lineno"> 9809</span>&#160;}</div>
+<div class="line"><a name="l09810"></a><span class="lineno"> 9810</span>&#160; </div>
+<div class="line"><a name="l09811"></a><span class="lineno"> 9811</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::Validate()<span class="keyword"> const</span></div>
+<div class="line"><a name="l09812"></a><span class="lineno"> 9812</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l09813"></a><span class="lineno"> 9813</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l09814"></a><span class="lineno"> 9814</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l09815"></a><span class="lineno"> 9815</span>&#160; </div>
+<div class="line"><a name="l09816"></a><span class="lineno"> 9816</span>&#160;    VMA_VALIDATE(suballocations2nd.empty() == (m_2ndVectorMode == SECOND_VECTOR_EMPTY));</div>
+<div class="line"><a name="l09817"></a><span class="lineno"> 9817</span>&#160;    VMA_VALIDATE(!suballocations1st.empty() ||</div>
+<div class="line"><a name="l09818"></a><span class="lineno"> 9818</span>&#160;        suballocations2nd.empty() ||</div>
+<div class="line"><a name="l09819"></a><span class="lineno"> 9819</span>&#160;        m_2ndVectorMode != SECOND_VECTOR_RING_BUFFER);</div>
+<div class="line"><a name="l09820"></a><span class="lineno"> 9820</span>&#160; </div>
+<div class="line"><a name="l09821"></a><span class="lineno"> 9821</span>&#160;    <span class="keywordflow">if</span>(!suballocations1st.empty())</div>
+<div class="line"><a name="l09822"></a><span class="lineno"> 9822</span>&#160;    {</div>
+<div class="line"><a name="l09823"></a><span class="lineno"> 9823</span>&#160;        <span class="comment">// Null item at the beginning should be accounted into m_1stNullItemsBeginCount.</span></div>
+<div class="line"><a name="l09824"></a><span class="lineno"> 9824</span>&#160;        VMA_VALIDATE(suballocations1st[m_1stNullItemsBeginCount].hAllocation != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l09825"></a><span class="lineno"> 9825</span>&#160;        <span class="comment">// Null item at the end should be just pop_back().</span></div>
+<div class="line"><a name="l09826"></a><span class="lineno"> 9826</span>&#160;        VMA_VALIDATE(suballocations1st.back().hAllocation != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l09827"></a><span class="lineno"> 9827</span>&#160;    }</div>
+<div class="line"><a name="l09828"></a><span class="lineno"> 9828</span>&#160;    <span class="keywordflow">if</span>(!suballocations2nd.empty())</div>
+<div class="line"><a name="l09829"></a><span class="lineno"> 9829</span>&#160;    {</div>
+<div class="line"><a name="l09830"></a><span class="lineno"> 9830</span>&#160;        <span class="comment">// Null item at the end should be just pop_back().</span></div>
+<div class="line"><a name="l09831"></a><span class="lineno"> 9831</span>&#160;        VMA_VALIDATE(suballocations2nd.back().hAllocation != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l09832"></a><span class="lineno"> 9832</span>&#160;    }</div>
+<div class="line"><a name="l09833"></a><span class="lineno"> 9833</span>&#160; </div>
+<div class="line"><a name="l09834"></a><span class="lineno"> 9834</span>&#160;    VMA_VALIDATE(m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount &lt;= suballocations1st.size());</div>
+<div class="line"><a name="l09835"></a><span class="lineno"> 9835</span>&#160;    VMA_VALIDATE(m_2ndNullItemsCount &lt;= suballocations2nd.size());</div>
+<div class="line"><a name="l09836"></a><span class="lineno"> 9836</span>&#160; </div>
+<div class="line"><a name="l09837"></a><span class="lineno"> 9837</span>&#160;    VkDeviceSize sumUsedSize = 0;</div>
+<div class="line"><a name="l09838"></a><span class="lineno"> 9838</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc1stCount = suballocations1st.size();</div>
+<div class="line"><a name="l09839"></a><span class="lineno"> 9839</span>&#160;    VkDeviceSize offset = VMA_DEBUG_MARGIN;</div>
+<div class="line"><a name="l09840"></a><span class="lineno"> 9840</span>&#160; </div>
+<div class="line"><a name="l09841"></a><span class="lineno"> 9841</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
+<div class="line"><a name="l09842"></a><span class="lineno"> 9842</span>&#160;    {</div>
+<div class="line"><a name="l09843"></a><span class="lineno"> 9843</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc2ndCount = suballocations2nd.size();</div>
+<div class="line"><a name="l09844"></a><span class="lineno"> 9844</span>&#160;        <span class="keywordtype">size_t</span> nullItem2ndCount = 0;</div>
+<div class="line"><a name="l09845"></a><span class="lineno"> 9845</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; suballoc2ndCount; ++i)</div>
+<div class="line"><a name="l09846"></a><span class="lineno"> 9846</span>&#160;        {</div>
+<div class="line"><a name="l09847"></a><span class="lineno"> 9847</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[i];</div>
+<div class="line"><a name="l09848"></a><span class="lineno"> 9848</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">bool</span> currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09849"></a><span class="lineno"> 9849</span>&#160; </div>
+<div class="line"><a name="l09850"></a><span class="lineno"> 9850</span>&#160;            VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));</div>
+<div class="line"><a name="l09851"></a><span class="lineno"> 9851</span>&#160;            VMA_VALIDATE(suballoc.offset &gt;= offset);</div>
+<div class="line"><a name="l09852"></a><span class="lineno"> 9852</span>&#160; </div>
+<div class="line"><a name="l09853"></a><span class="lineno"> 9853</span>&#160;            <span class="keywordflow">if</span>(!currFree)</div>
+<div class="line"><a name="l09854"></a><span class="lineno"> 9854</span>&#160;            {</div>
+<div class="line"><a name="l09855"></a><span class="lineno"> 9855</span>&#160;                VMA_VALIDATE(suballoc.hAllocation-&gt;GetOffset() == suballoc.offset);</div>
+<div class="line"><a name="l09856"></a><span class="lineno"> 9856</span>&#160;                VMA_VALIDATE(suballoc.hAllocation-&gt;GetSize() == suballoc.size);</div>
+<div class="line"><a name="l09857"></a><span class="lineno"> 9857</span>&#160;                sumUsedSize += suballoc.size;</div>
+<div class="line"><a name="l09858"></a><span class="lineno"> 9858</span>&#160;            }</div>
+<div class="line"><a name="l09859"></a><span class="lineno"> 9859</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09860"></a><span class="lineno"> 9860</span>&#160;            {</div>
+<div class="line"><a name="l09861"></a><span class="lineno"> 9861</span>&#160;                ++nullItem2ndCount;</div>
+<div class="line"><a name="l09862"></a><span class="lineno"> 9862</span>&#160;            }</div>
+<div class="line"><a name="l09863"></a><span class="lineno"> 9863</span>&#160; </div>
+<div class="line"><a name="l09864"></a><span class="lineno"> 9864</span>&#160;            offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;</div>
+<div class="line"><a name="l09865"></a><span class="lineno"> 9865</span>&#160;        }</div>
+<div class="line"><a name="l09866"></a><span class="lineno"> 9866</span>&#160; </div>
+<div class="line"><a name="l09867"></a><span class="lineno"> 9867</span>&#160;        VMA_VALIDATE(nullItem2ndCount == m_2ndNullItemsCount);</div>
+<div class="line"><a name="l09868"></a><span class="lineno"> 9868</span>&#160;    }</div>
+<div class="line"><a name="l09869"></a><span class="lineno"> 9869</span>&#160; </div>
+<div class="line"><a name="l09870"></a><span class="lineno"> 9870</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_1stNullItemsBeginCount; ++i)</div>
+<div class="line"><a name="l09871"></a><span class="lineno"> 9871</span>&#160;    {</div>
+<div class="line"><a name="l09872"></a><span class="lineno"> 9872</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[i];</div>
+<div class="line"><a name="l09873"></a><span class="lineno"> 9873</span>&#160;        VMA_VALIDATE(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE &amp;&amp;</div>
+<div class="line"><a name="l09874"></a><span class="lineno"> 9874</span>&#160;            suballoc.hAllocation == VK_NULL_HANDLE);</div>
+<div class="line"><a name="l09875"></a><span class="lineno"> 9875</span>&#160;    }</div>
+<div class="line"><a name="l09876"></a><span class="lineno"> 9876</span>&#160; </div>
+<div class="line"><a name="l09877"></a><span class="lineno"> 9877</span>&#160;    <span class="keywordtype">size_t</span> nullItem1stCount = m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l09878"></a><span class="lineno"> 9878</span>&#160; </div>
+<div class="line"><a name="l09879"></a><span class="lineno"> 9879</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_1stNullItemsBeginCount; i &lt; suballoc1stCount; ++i)</div>
+<div class="line"><a name="l09880"></a><span class="lineno"> 9880</span>&#160;    {</div>
+<div class="line"><a name="l09881"></a><span class="lineno"> 9881</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[i];</div>
+<div class="line"><a name="l09882"></a><span class="lineno"> 9882</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">bool</span> currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09883"></a><span class="lineno"> 9883</span>&#160; </div>
+<div class="line"><a name="l09884"></a><span class="lineno"> 9884</span>&#160;        VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));</div>
+<div class="line"><a name="l09885"></a><span class="lineno"> 9885</span>&#160;        VMA_VALIDATE(suballoc.offset &gt;= offset);</div>
+<div class="line"><a name="l09886"></a><span class="lineno"> 9886</span>&#160;        VMA_VALIDATE(i &gt;= m_1stNullItemsBeginCount || currFree);</div>
+<div class="line"><a name="l09887"></a><span class="lineno"> 9887</span>&#160; </div>
+<div class="line"><a name="l09888"></a><span class="lineno"> 9888</span>&#160;        <span class="keywordflow">if</span>(!currFree)</div>
+<div class="line"><a name="l09889"></a><span class="lineno"> 9889</span>&#160;        {</div>
+<div class="line"><a name="l09890"></a><span class="lineno"> 9890</span>&#160;            VMA_VALIDATE(suballoc.hAllocation-&gt;GetOffset() == suballoc.offset);</div>
+<div class="line"><a name="l09891"></a><span class="lineno"> 9891</span>&#160;            VMA_VALIDATE(suballoc.hAllocation-&gt;GetSize() == suballoc.size);</div>
+<div class="line"><a name="l09892"></a><span class="lineno"> 9892</span>&#160;            sumUsedSize += suballoc.size;</div>
+<div class="line"><a name="l09893"></a><span class="lineno"> 9893</span>&#160;        }</div>
+<div class="line"><a name="l09894"></a><span class="lineno"> 9894</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09895"></a><span class="lineno"> 9895</span>&#160;        {</div>
+<div class="line"><a name="l09896"></a><span class="lineno"> 9896</span>&#160;            ++nullItem1stCount;</div>
+<div class="line"><a name="l09897"></a><span class="lineno"> 9897</span>&#160;        }</div>
+<div class="line"><a name="l09898"></a><span class="lineno"> 9898</span>&#160; </div>
+<div class="line"><a name="l09899"></a><span class="lineno"> 9899</span>&#160;        offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;</div>
+<div class="line"><a name="l09900"></a><span class="lineno"> 9900</span>&#160;    }</div>
+<div class="line"><a name="l09901"></a><span class="lineno"> 9901</span>&#160;    VMA_VALIDATE(nullItem1stCount == m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount);</div>
+<div class="line"><a name="l09902"></a><span class="lineno"> 9902</span>&#160; </div>
+<div class="line"><a name="l09903"></a><span class="lineno"> 9903</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
+<div class="line"><a name="l09904"></a><span class="lineno"> 9904</span>&#160;    {</div>
+<div class="line"><a name="l09905"></a><span class="lineno"> 9905</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc2ndCount = suballocations2nd.size();</div>
+<div class="line"><a name="l09906"></a><span class="lineno"> 9906</span>&#160;        <span class="keywordtype">size_t</span> nullItem2ndCount = 0;</div>
+<div class="line"><a name="l09907"></a><span class="lineno"> 9907</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = suballoc2ndCount; i--; )</div>
+<div class="line"><a name="l09908"></a><span class="lineno"> 9908</span>&#160;        {</div>
+<div class="line"><a name="l09909"></a><span class="lineno"> 9909</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[i];</div>
+<div class="line"><a name="l09910"></a><span class="lineno"> 9910</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">bool</span> currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l09911"></a><span class="lineno"> 9911</span>&#160; </div>
+<div class="line"><a name="l09912"></a><span class="lineno"> 9912</span>&#160;            VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));</div>
+<div class="line"><a name="l09913"></a><span class="lineno"> 9913</span>&#160;            VMA_VALIDATE(suballoc.offset &gt;= offset);</div>
+<div class="line"><a name="l09914"></a><span class="lineno"> 9914</span>&#160; </div>
+<div class="line"><a name="l09915"></a><span class="lineno"> 9915</span>&#160;            <span class="keywordflow">if</span>(!currFree)</div>
+<div class="line"><a name="l09916"></a><span class="lineno"> 9916</span>&#160;            {</div>
+<div class="line"><a name="l09917"></a><span class="lineno"> 9917</span>&#160;                VMA_VALIDATE(suballoc.hAllocation-&gt;GetOffset() == suballoc.offset);</div>
+<div class="line"><a name="l09918"></a><span class="lineno"> 9918</span>&#160;                VMA_VALIDATE(suballoc.hAllocation-&gt;GetSize() == suballoc.size);</div>
+<div class="line"><a name="l09919"></a><span class="lineno"> 9919</span>&#160;                sumUsedSize += suballoc.size;</div>
+<div class="line"><a name="l09920"></a><span class="lineno"> 9920</span>&#160;            }</div>
+<div class="line"><a name="l09921"></a><span class="lineno"> 9921</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l09922"></a><span class="lineno"> 9922</span>&#160;            {</div>
+<div class="line"><a name="l09923"></a><span class="lineno"> 9923</span>&#160;                ++nullItem2ndCount;</div>
+<div class="line"><a name="l09924"></a><span class="lineno"> 9924</span>&#160;            }</div>
+<div class="line"><a name="l09925"></a><span class="lineno"> 9925</span>&#160; </div>
+<div class="line"><a name="l09926"></a><span class="lineno"> 9926</span>&#160;            offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;</div>
+<div class="line"><a name="l09927"></a><span class="lineno"> 9927</span>&#160;        }</div>
+<div class="line"><a name="l09928"></a><span class="lineno"> 9928</span>&#160; </div>
+<div class="line"><a name="l09929"></a><span class="lineno"> 9929</span>&#160;        VMA_VALIDATE(nullItem2ndCount == m_2ndNullItemsCount);</div>
+<div class="line"><a name="l09930"></a><span class="lineno"> 9930</span>&#160;    }</div>
+<div class="line"><a name="l09931"></a><span class="lineno"> 9931</span>&#160; </div>
+<div class="line"><a name="l09932"></a><span class="lineno"> 9932</span>&#160;    VMA_VALIDATE(offset &lt;= GetSize());</div>
+<div class="line"><a name="l09933"></a><span class="lineno"> 9933</span>&#160;    VMA_VALIDATE(m_SumFreeSize == GetSize() - sumUsedSize);</div>
+<div class="line"><a name="l09934"></a><span class="lineno"> 9934</span>&#160; </div>
+<div class="line"><a name="l09935"></a><span class="lineno"> 9935</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l09936"></a><span class="lineno"> 9936</span>&#160;}</div>
+<div class="line"><a name="l09937"></a><span class="lineno"> 9937</span>&#160; </div>
+<div class="line"><a name="l09938"></a><span class="lineno"> 9938</span>&#160;<span class="keywordtype">size_t</span> VmaBlockMetadata_Linear::GetAllocationCount()<span class="keyword"> const</span></div>
+<div class="line"><a name="l09939"></a><span class="lineno"> 9939</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l09940"></a><span class="lineno"> 9940</span>&#160;    <span class="keywordflow">return</span> AccessSuballocations1st().size() - (m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount) +</div>
+<div class="line"><a name="l09941"></a><span class="lineno"> 9941</span>&#160;        AccessSuballocations2nd().size() - m_2ndNullItemsCount;</div>
+<div class="line"><a name="l09942"></a><span class="lineno"> 9942</span>&#160;}</div>
+<div class="line"><a name="l09943"></a><span class="lineno"> 9943</span>&#160; </div>
+<div class="line"><a name="l09944"></a><span class="lineno"> 9944</span>&#160;VkDeviceSize VmaBlockMetadata_Linear::GetUnusedRangeSizeMax()<span class="keyword"> const</span></div>
+<div class="line"><a name="l09945"></a><span class="lineno"> 9945</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l09946"></a><span class="lineno"> 9946</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
+<div class="line"><a name="l09947"></a><span class="lineno"> 9947</span>&#160; </div>
+<div class="line"><a name="l09948"></a><span class="lineno"> 9948</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l09949"></a><span class="lineno"> 9949</span>&#160;<span class="comment">    We don&#39;t consider gaps inside allocation vectors with freed allocations because</span></div>
+<div class="line"><a name="l09950"></a><span class="lineno"> 9950</span>&#160;<span class="comment">    they are not suitable for reuse in linear allocator. We consider only space that</span></div>
+<div class="line"><a name="l09951"></a><span class="lineno"> 9951</span>&#160;<span class="comment">    is available for new allocations.</span></div>
+<div class="line"><a name="l09952"></a><span class="lineno"> 9952</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l09953"></a><span class="lineno"> 9953</span>&#160;    <span class="keywordflow">if</span>(IsEmpty())</div>
+<div class="line"><a name="l09954"></a><span class="lineno"> 9954</span>&#160;    {</div>
+<div class="line"><a name="l09955"></a><span class="lineno"> 9955</span>&#160;        <span class="keywordflow">return</span> size;</div>
+<div class="line"><a name="l09956"></a><span class="lineno"> 9956</span>&#160;    }</div>
+<div class="line"><a name="l09957"></a><span class="lineno"> 9957</span>&#160;    </div>
+<div class="line"><a name="l09958"></a><span class="lineno"> 9958</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l09959"></a><span class="lineno"> 9959</span>&#160; </div>
+<div class="line"><a name="l09960"></a><span class="lineno"> 9960</span>&#160;    <span class="keywordflow">switch</span>(m_2ndVectorMode)</div>
+<div class="line"><a name="l09961"></a><span class="lineno"> 9961</span>&#160;    {</div>
+<div class="line"><a name="l09962"></a><span class="lineno"> 9962</span>&#160;    <span class="keywordflow">case</span> SECOND_VECTOR_EMPTY:</div>
+<div class="line"><a name="l09963"></a><span class="lineno"> 9963</span>&#160;        <span class="comment">/*</span></div>
+<div class="line"><a name="l09964"></a><span class="lineno"> 9964</span>&#160;<span class="comment">        Available space is after end of 1st, as well as before beginning of 1st (which</span></div>
+<div class="line"><a name="l09965"></a><span class="lineno"> 9965</span>&#160;<span class="comment">        whould make it a ring buffer).</span></div>
+<div class="line"><a name="l09966"></a><span class="lineno"> 9966</span>&#160;<span class="comment">        */</span></div>
+<div class="line"><a name="l09967"></a><span class="lineno"> 9967</span>&#160;        {</div>
+<div class="line"><a name="l09968"></a><span class="lineno"> 9968</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballocations1stCount = suballocations1st.size();</div>
+<div class="line"><a name="l09969"></a><span class="lineno"> 9969</span>&#160;            VMA_ASSERT(suballocations1stCount &gt; m_1stNullItemsBeginCount);</div>
+<div class="line"><a name="l09970"></a><span class="lineno"> 9970</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; firstSuballoc = suballocations1st[m_1stNullItemsBeginCount];</div>
+<div class="line"><a name="l09971"></a><span class="lineno"> 9971</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc  = suballocations1st[suballocations1stCount - 1];</div>
+<div class="line"><a name="l09972"></a><span class="lineno"> 9972</span>&#160;            <span class="keywordflow">return</span> VMA_MAX(</div>
+<div class="line"><a name="l09973"></a><span class="lineno"> 9973</span>&#160;                firstSuballoc.offset,</div>
+<div class="line"><a name="l09974"></a><span class="lineno"> 9974</span>&#160;                size - (lastSuballoc.offset + lastSuballoc.size));</div>
+<div class="line"><a name="l09975"></a><span class="lineno"> 9975</span>&#160;        }</div>
+<div class="line"><a name="l09976"></a><span class="lineno"> 9976</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l09977"></a><span class="lineno"> 9977</span>&#160; </div>
+<div class="line"><a name="l09978"></a><span class="lineno"> 9978</span>&#160;    <span class="keywordflow">case</span> SECOND_VECTOR_RING_BUFFER:</div>
+<div class="line"><a name="l09979"></a><span class="lineno"> 9979</span>&#160;        <span class="comment">/*</span></div>
+<div class="line"><a name="l09980"></a><span class="lineno"> 9980</span>&#160;<span class="comment">        Available space is only between end of 2nd and beginning of 1st.</span></div>
+<div class="line"><a name="l09981"></a><span class="lineno"> 9981</span>&#160;<span class="comment">        */</span></div>
+<div class="line"><a name="l09982"></a><span class="lineno"> 9982</span>&#160;        {</div>
+<div class="line"><a name="l09983"></a><span class="lineno"> 9983</span>&#160;            <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l09984"></a><span class="lineno"> 9984</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc2nd = suballocations2nd.back();</div>
+<div class="line"><a name="l09985"></a><span class="lineno"> 9985</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; firstSuballoc1st = suballocations1st[m_1stNullItemsBeginCount];</div>
+<div class="line"><a name="l09986"></a><span class="lineno"> 9986</span>&#160;            <span class="keywordflow">return</span> firstSuballoc1st.offset - (lastSuballoc2nd.offset + lastSuballoc2nd.size);</div>
+<div class="line"><a name="l09987"></a><span class="lineno"> 9987</span>&#160;        }</div>
+<div class="line"><a name="l09988"></a><span class="lineno"> 9988</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l09989"></a><span class="lineno"> 9989</span>&#160; </div>
+<div class="line"><a name="l09990"></a><span class="lineno"> 9990</span>&#160;    <span class="keywordflow">case</span> SECOND_VECTOR_DOUBLE_STACK:</div>
+<div class="line"><a name="l09991"></a><span class="lineno"> 9991</span>&#160;        <span class="comment">/*</span></div>
+<div class="line"><a name="l09992"></a><span class="lineno"> 9992</span>&#160;<span class="comment">        Available space is only between end of 1st and top of 2nd.</span></div>
+<div class="line"><a name="l09993"></a><span class="lineno"> 9993</span>&#160;<span class="comment">        */</span></div>
+<div class="line"><a name="l09994"></a><span class="lineno"> 9994</span>&#160;        {</div>
+<div class="line"><a name="l09995"></a><span class="lineno"> 9995</span>&#160;            <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l09996"></a><span class="lineno"> 9996</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; topSuballoc2nd = suballocations2nd.back();</div>
+<div class="line"><a name="l09997"></a><span class="lineno"> 9997</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc1st = suballocations1st.back();</div>
+<div class="line"><a name="l09998"></a><span class="lineno"> 9998</span>&#160;            <span class="keywordflow">return</span> topSuballoc2nd.offset - (lastSuballoc1st.offset + lastSuballoc1st.size);</div>
+<div class="line"><a name="l09999"></a><span class="lineno"> 9999</span>&#160;        }</div>
+<div class="line"><a name="l10000"></a><span class="lineno">10000</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l10001"></a><span class="lineno">10001</span>&#160; </div>
+<div class="line"><a name="l10002"></a><span class="lineno">10002</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l10003"></a><span class="lineno">10003</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l10004"></a><span class="lineno">10004</span>&#160;        <span class="keywordflow">return</span> 0;</div>
+<div class="line"><a name="l10005"></a><span class="lineno">10005</span>&#160;    }</div>
+<div class="line"><a name="l10006"></a><span class="lineno">10006</span>&#160;}</div>
+<div class="line"><a name="l10007"></a><span class="lineno">10007</span>&#160; </div>
+<div class="line"><a name="l10008"></a><span class="lineno">10008</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo)<span class="keyword"> const</span></div>
+<div class="line"><a name="l10009"></a><span class="lineno">10009</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l10010"></a><span class="lineno">10010</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
+<div class="line"><a name="l10011"></a><span class="lineno">10011</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l10012"></a><span class="lineno">10012</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l10013"></a><span class="lineno">10013</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc1stCount = suballocations1st.size();</div>
+<div class="line"><a name="l10014"></a><span class="lineno">10014</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc2ndCount = suballocations2nd.size();</div>
+<div class="line"><a name="l10015"></a><span class="lineno">10015</span>&#160; </div>
+<div class="line"><a name="l10016"></a><span class="lineno">10016</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> = 1;</div>
+<div class="line"><a name="l10017"></a><span class="lineno">10017</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> = (uint32_t)GetAllocationCount();</div>
+<div class="line"><a name="l10018"></a><span class="lineno">10018</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> = 0;</div>
+<div class="line"><a name="l10019"></a><span class="lineno">10019</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> = 0;</div>
+<div class="line"><a name="l10020"></a><span class="lineno">10020</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = UINT64_MAX;</div>
+<div class="line"><a name="l10021"></a><span class="lineno">10021</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = 0;</div>
+<div class="line"><a name="l10022"></a><span class="lineno">10022</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = UINT64_MAX;</div>
+<div class="line"><a name="l10023"></a><span class="lineno">10023</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = 0;</div>
+<div class="line"><a name="l10024"></a><span class="lineno">10024</span>&#160; </div>
+<div class="line"><a name="l10025"></a><span class="lineno">10025</span>&#160;    VkDeviceSize lastOffset = 0;</div>
+<div class="line"><a name="l10026"></a><span class="lineno">10026</span>&#160; </div>
+<div class="line"><a name="l10027"></a><span class="lineno">10027</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
+<div class="line"><a name="l10028"></a><span class="lineno">10028</span>&#160;    {</div>
+<div class="line"><a name="l10029"></a><span class="lineno">10029</span>&#160;        <span class="keyword">const</span> VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;</div>
+<div class="line"><a name="l10030"></a><span class="lineno">10030</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = 0;</div>
+<div class="line"><a name="l10031"></a><span class="lineno">10031</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
+<div class="line"><a name="l10032"></a><span class="lineno">10032</span>&#160;        {</div>
+<div class="line"><a name="l10033"></a><span class="lineno">10033</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
+<div class="line"><a name="l10034"></a><span class="lineno">10034</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex &lt; suballoc2ndCount &amp;&amp;</div>
+<div class="line"><a name="l10035"></a><span class="lineno">10035</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10036"></a><span class="lineno">10036</span>&#160;            {</div>
+<div class="line"><a name="l10037"></a><span class="lineno">10037</span>&#160;                ++nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10038"></a><span class="lineno">10038</span>&#160;            }</div>
+<div class="line"><a name="l10039"></a><span class="lineno">10039</span>&#160; </div>
+<div class="line"><a name="l10040"></a><span class="lineno">10040</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10041"></a><span class="lineno">10041</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex &lt; suballoc2ndCount)</div>
+<div class="line"><a name="l10042"></a><span class="lineno">10042</span>&#160;            {</div>
+<div class="line"><a name="l10043"></a><span class="lineno">10043</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
+<div class="line"><a name="l10044"></a><span class="lineno">10044</span>&#160;            </div>
+<div class="line"><a name="l10045"></a><span class="lineno">10045</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10046"></a><span class="lineno">10046</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10047"></a><span class="lineno">10047</span>&#160;                {</div>
+<div class="line"><a name="l10048"></a><span class="lineno">10048</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10049"></a><span class="lineno">10049</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
+<div class="line"><a name="l10050"></a><span class="lineno">10050</span>&#160;                    ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10051"></a><span class="lineno">10051</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10052"></a><span class="lineno">10052</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10053"></a><span class="lineno">10053</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10054"></a><span class="lineno">10054</span>&#160;                }</div>
 <div class="line"><a name="l10055"></a><span class="lineno">10055</span>&#160;            </div>
-<div class="line"><a name="l10056"></a><span class="lineno">10056</span>&#160;            <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l10057"></a><span class="lineno">10057</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
-<div class="line"><a name="l10058"></a><span class="lineno">10058</span>&#160;            {</div>
-<div class="line"><a name="l10059"></a><span class="lineno">10059</span>&#160;                <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l10060"></a><span class="lineno">10060</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
-<div class="line"><a name="l10061"></a><span class="lineno">10061</span>&#160;                inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
-<div class="line"><a name="l10062"></a><span class="lineno">10062</span>&#160;                ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
-<div class="line"><a name="l10063"></a><span class="lineno">10063</span>&#160;                inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l10064"></a><span class="lineno">10064</span>&#160;            }</div>
-<div class="line"><a name="l10065"></a><span class="lineno">10065</span>&#160;            </div>
-<div class="line"><a name="l10066"></a><span class="lineno">10066</span>&#160;            <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l10067"></a><span class="lineno">10067</span>&#160;            <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l10068"></a><span class="lineno">10068</span>&#160;            ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a>;</div>
-<div class="line"><a name="l10069"></a><span class="lineno">10069</span>&#160;            </div>
-<div class="line"><a name="l10070"></a><span class="lineno">10070</span>&#160;            <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l10071"></a><span class="lineno">10071</span>&#160;            lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l10072"></a><span class="lineno">10072</span>&#160;            ++nextAlloc1stIndex;</div>
-<div class="line"><a name="l10073"></a><span class="lineno">10073</span>&#160;        }</div>
-<div class="line"><a name="l10074"></a><span class="lineno">10074</span>&#160;        <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l10075"></a><span class="lineno">10075</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10076"></a><span class="lineno">10076</span>&#160;        {</div>
-<div class="line"><a name="l10077"></a><span class="lineno">10077</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
-<div class="line"><a name="l10078"></a><span class="lineno">10078</span>&#160;            {</div>
-<div class="line"><a name="l10079"></a><span class="lineno">10079</span>&#160;                <span class="comment">// There is free space from lastOffset to freeSpace1stTo2ndEnd.</span></div>
-<div class="line"><a name="l10080"></a><span class="lineno">10080</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;</div>
-<div class="line"><a name="l10081"></a><span class="lineno">10081</span>&#160;                inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
-<div class="line"><a name="l10082"></a><span class="lineno">10082</span>&#160;                ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
-<div class="line"><a name="l10083"></a><span class="lineno">10083</span>&#160;                inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l10084"></a><span class="lineno">10084</span>&#160;            }</div>
-<div class="line"><a name="l10085"></a><span class="lineno">10085</span>&#160; </div>
-<div class="line"><a name="l10086"></a><span class="lineno">10086</span>&#160;            <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l10087"></a><span class="lineno">10087</span>&#160;            lastOffset = freeSpace1stTo2ndEnd;</div>
-<div class="line"><a name="l10088"></a><span class="lineno">10088</span>&#160;        }</div>
-<div class="line"><a name="l10089"></a><span class="lineno">10089</span>&#160;    }</div>
-<div class="line"><a name="l10090"></a><span class="lineno">10090</span>&#160; </div>
-<div class="line"><a name="l10091"></a><span class="lineno">10091</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
-<div class="line"><a name="l10092"></a><span class="lineno">10092</span>&#160;    {</div>
-<div class="line"><a name="l10093"></a><span class="lineno">10093</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = suballocations2nd.size() - 1;</div>
-<div class="line"><a name="l10094"></a><span class="lineno">10094</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; size)</div>
-<div class="line"><a name="l10095"></a><span class="lineno">10095</span>&#160;        {</div>
-<div class="line"><a name="l10096"></a><span class="lineno">10096</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
-<div class="line"><a name="l10097"></a><span class="lineno">10097</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex != SIZE_MAX &amp;&amp;</div>
-<div class="line"><a name="l10098"></a><span class="lineno">10098</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l10099"></a><span class="lineno">10099</span>&#160;            {</div>
-<div class="line"><a name="l10100"></a><span class="lineno">10100</span>&#160;                --nextAlloc2ndIndex;</div>
-<div class="line"><a name="l10101"></a><span class="lineno">10101</span>&#160;            }</div>
-<div class="line"><a name="l10102"></a><span class="lineno">10102</span>&#160; </div>
-<div class="line"><a name="l10103"></a><span class="lineno">10103</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l10104"></a><span class="lineno">10104</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex != SIZE_MAX)</div>
-<div class="line"><a name="l10105"></a><span class="lineno">10105</span>&#160;            {</div>
-<div class="line"><a name="l10106"></a><span class="lineno">10106</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
-<div class="line"><a name="l10107"></a><span class="lineno">10107</span>&#160;            </div>
-<div class="line"><a name="l10108"></a><span class="lineno">10108</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l10109"></a><span class="lineno">10109</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
-<div class="line"><a name="l10110"></a><span class="lineno">10110</span>&#160;                {</div>
-<div class="line"><a name="l10111"></a><span class="lineno">10111</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l10112"></a><span class="lineno">10112</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
-<div class="line"><a name="l10113"></a><span class="lineno">10113</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
-<div class="line"><a name="l10114"></a><span class="lineno">10114</span>&#160;                    ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
-<div class="line"><a name="l10115"></a><span class="lineno">10115</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l10116"></a><span class="lineno">10116</span>&#160;                }</div>
-<div class="line"><a name="l10117"></a><span class="lineno">10117</span>&#160;            </div>
-<div class="line"><a name="l10118"></a><span class="lineno">10118</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l10119"></a><span class="lineno">10119</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l10120"></a><span class="lineno">10120</span>&#160;                ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a>;</div>
-<div class="line"><a name="l10121"></a><span class="lineno">10121</span>&#160;            </div>
-<div class="line"><a name="l10122"></a><span class="lineno">10122</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l10123"></a><span class="lineno">10123</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l10124"></a><span class="lineno">10124</span>&#160;                --nextAlloc2ndIndex;</div>
-<div class="line"><a name="l10125"></a><span class="lineno">10125</span>&#160;            }</div>
-<div class="line"><a name="l10126"></a><span class="lineno">10126</span>&#160;            <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l10127"></a><span class="lineno">10127</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10056"></a><span class="lineno">10056</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10057"></a><span class="lineno">10057</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10058"></a><span class="lineno">10058</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> += suballoc.size;</div>
+<div class="line"><a name="l10059"></a><span class="lineno">10059</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, suballoc.size);</div>
+<div class="line"><a name="l10060"></a><span class="lineno">10060</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, suballoc.size);</div>
+<div class="line"><a name="l10061"></a><span class="lineno">10061</span>&#160;            </div>
+<div class="line"><a name="l10062"></a><span class="lineno">10062</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10063"></a><span class="lineno">10063</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10064"></a><span class="lineno">10064</span>&#160;                ++nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10065"></a><span class="lineno">10065</span>&#160;            }</div>
+<div class="line"><a name="l10066"></a><span class="lineno">10066</span>&#160;            <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10067"></a><span class="lineno">10067</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10068"></a><span class="lineno">10068</span>&#160;            {</div>
+<div class="line"><a name="l10069"></a><span class="lineno">10069</span>&#160;                <span class="comment">// There is free space from lastOffset to freeSpace2ndTo1stEnd.</span></div>
+<div class="line"><a name="l10070"></a><span class="lineno">10070</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
+<div class="line"><a name="l10071"></a><span class="lineno">10071</span>&#160;                {</div>
+<div class="line"><a name="l10072"></a><span class="lineno">10072</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;</div>
+<div class="line"><a name="l10073"></a><span class="lineno">10073</span>&#160;                    ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10074"></a><span class="lineno">10074</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10075"></a><span class="lineno">10075</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10076"></a><span class="lineno">10076</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10077"></a><span class="lineno">10077</span>&#160;               }</div>
+<div class="line"><a name="l10078"></a><span class="lineno">10078</span>&#160; </div>
+<div class="line"><a name="l10079"></a><span class="lineno">10079</span>&#160;                <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10080"></a><span class="lineno">10080</span>&#160;                lastOffset = freeSpace2ndTo1stEnd;</div>
+<div class="line"><a name="l10081"></a><span class="lineno">10081</span>&#160;            }</div>
+<div class="line"><a name="l10082"></a><span class="lineno">10082</span>&#160;        }</div>
+<div class="line"><a name="l10083"></a><span class="lineno">10083</span>&#160;    }</div>
+<div class="line"><a name="l10084"></a><span class="lineno">10084</span>&#160; </div>
+<div class="line"><a name="l10085"></a><span class="lineno">10085</span>&#160;    <span class="keywordtype">size_t</span> nextAlloc1stIndex = m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l10086"></a><span class="lineno">10086</span>&#160;    <span class="keyword">const</span> VkDeviceSize freeSpace1stTo2ndEnd =</div>
+<div class="line"><a name="l10087"></a><span class="lineno">10087</span>&#160;        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;</div>
+<div class="line"><a name="l10088"></a><span class="lineno">10088</span>&#160;    <span class="keywordflow">while</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
+<div class="line"><a name="l10089"></a><span class="lineno">10089</span>&#160;    {</div>
+<div class="line"><a name="l10090"></a><span class="lineno">10090</span>&#160;        <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
+<div class="line"><a name="l10091"></a><span class="lineno">10091</span>&#160;        <span class="keywordflow">while</span>(nextAlloc1stIndex &lt; suballoc1stCount &amp;&amp;</div>
+<div class="line"><a name="l10092"></a><span class="lineno">10092</span>&#160;            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10093"></a><span class="lineno">10093</span>&#160;        {</div>
+<div class="line"><a name="l10094"></a><span class="lineno">10094</span>&#160;            ++nextAlloc1stIndex;</div>
+<div class="line"><a name="l10095"></a><span class="lineno">10095</span>&#160;        }</div>
+<div class="line"><a name="l10096"></a><span class="lineno">10096</span>&#160; </div>
+<div class="line"><a name="l10097"></a><span class="lineno">10097</span>&#160;        <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10098"></a><span class="lineno">10098</span>&#160;        <span class="keywordflow">if</span>(nextAlloc1stIndex &lt; suballoc1stCount)</div>
+<div class="line"><a name="l10099"></a><span class="lineno">10099</span>&#160;        {</div>
+<div class="line"><a name="l10100"></a><span class="lineno">10100</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[nextAlloc1stIndex];</div>
+<div class="line"><a name="l10101"></a><span class="lineno">10101</span>&#160;            </div>
+<div class="line"><a name="l10102"></a><span class="lineno">10102</span>&#160;            <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10103"></a><span class="lineno">10103</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10104"></a><span class="lineno">10104</span>&#160;            {</div>
+<div class="line"><a name="l10105"></a><span class="lineno">10105</span>&#160;                <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10106"></a><span class="lineno">10106</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
+<div class="line"><a name="l10107"></a><span class="lineno">10107</span>&#160;                ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10108"></a><span class="lineno">10108</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10109"></a><span class="lineno">10109</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10110"></a><span class="lineno">10110</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10111"></a><span class="lineno">10111</span>&#160;            }</div>
+<div class="line"><a name="l10112"></a><span class="lineno">10112</span>&#160;            </div>
+<div class="line"><a name="l10113"></a><span class="lineno">10113</span>&#160;            <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10114"></a><span class="lineno">10114</span>&#160;            <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10115"></a><span class="lineno">10115</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> += suballoc.size;</div>
+<div class="line"><a name="l10116"></a><span class="lineno">10116</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, suballoc.size);</div>
+<div class="line"><a name="l10117"></a><span class="lineno">10117</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, suballoc.size);</div>
+<div class="line"><a name="l10118"></a><span class="lineno">10118</span>&#160;            </div>
+<div class="line"><a name="l10119"></a><span class="lineno">10119</span>&#160;            <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10120"></a><span class="lineno">10120</span>&#160;            lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10121"></a><span class="lineno">10121</span>&#160;            ++nextAlloc1stIndex;</div>
+<div class="line"><a name="l10122"></a><span class="lineno">10122</span>&#160;        }</div>
+<div class="line"><a name="l10123"></a><span class="lineno">10123</span>&#160;        <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10124"></a><span class="lineno">10124</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10125"></a><span class="lineno">10125</span>&#160;        {</div>
+<div class="line"><a name="l10126"></a><span class="lineno">10126</span>&#160;            <span class="comment">// There is free space from lastOffset to freeSpace1stTo2ndEnd.</span></div>
+<div class="line"><a name="l10127"></a><span class="lineno">10127</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
 <div class="line"><a name="l10128"></a><span class="lineno">10128</span>&#160;            {</div>
-<div class="line"><a name="l10129"></a><span class="lineno">10129</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; size)</div>
-<div class="line"><a name="l10130"></a><span class="lineno">10130</span>&#160;                {</div>
-<div class="line"><a name="l10131"></a><span class="lineno">10131</span>&#160;                    <span class="comment">// There is free space from lastOffset to size.</span></div>
-<div class="line"><a name="l10132"></a><span class="lineno">10132</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = size - lastOffset;</div>
-<div class="line"><a name="l10133"></a><span class="lineno">10133</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
-<div class="line"><a name="l10134"></a><span class="lineno">10134</span>&#160;                    ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
-<div class="line"><a name="l10135"></a><span class="lineno">10135</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l10136"></a><span class="lineno">10136</span>&#160;                }</div>
-<div class="line"><a name="l10137"></a><span class="lineno">10137</span>&#160; </div>
-<div class="line"><a name="l10138"></a><span class="lineno">10138</span>&#160;                <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l10139"></a><span class="lineno">10139</span>&#160;                lastOffset = size;</div>
-<div class="line"><a name="l10140"></a><span class="lineno">10140</span>&#160;            }</div>
-<div class="line"><a name="l10141"></a><span class="lineno">10141</span>&#160;        }</div>
-<div class="line"><a name="l10142"></a><span class="lineno">10142</span>&#160;    }</div>
-<div class="line"><a name="l10143"></a><span class="lineno">10143</span>&#160;}</div>
-<div class="line"><a name="l10144"></a><span class="lineno">10144</span>&#160; </div>
-<div class="line"><a name="l10145"></a><span class="lineno">10145</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l10146"></a><span class="lineno">10146</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json)<span class="keyword"> const</span></div>
-<div class="line"><a name="l10147"></a><span class="lineno">10147</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l10148"></a><span class="lineno">10148</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
-<div class="line"><a name="l10149"></a><span class="lineno">10149</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l10150"></a><span class="lineno">10150</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l10151"></a><span class="lineno">10151</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc1stCount = suballocations1st.size();</div>
-<div class="line"><a name="l10152"></a><span class="lineno">10152</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc2ndCount = suballocations2nd.size();</div>
-<div class="line"><a name="l10153"></a><span class="lineno">10153</span>&#160; </div>
-<div class="line"><a name="l10154"></a><span class="lineno">10154</span>&#160;    <span class="comment">// FIRST PASS</span></div>
-<div class="line"><a name="l10155"></a><span class="lineno">10155</span>&#160; </div>
-<div class="line"><a name="l10156"></a><span class="lineno">10156</span>&#160;    <span class="keywordtype">size_t</span> unusedRangeCount = 0;</div>
-<div class="line"><a name="l10157"></a><span class="lineno">10157</span>&#160;    VkDeviceSize usedBytes = 0;</div>
-<div class="line"><a name="l10158"></a><span class="lineno">10158</span>&#160; </div>
-<div class="line"><a name="l10159"></a><span class="lineno">10159</span>&#160;    VkDeviceSize lastOffset = 0;</div>
-<div class="line"><a name="l10160"></a><span class="lineno">10160</span>&#160; </div>
-<div class="line"><a name="l10161"></a><span class="lineno">10161</span>&#160;    <span class="keywordtype">size_t</span> alloc2ndCount = 0;</div>
-<div class="line"><a name="l10162"></a><span class="lineno">10162</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
-<div class="line"><a name="l10163"></a><span class="lineno">10163</span>&#160;    {</div>
-<div class="line"><a name="l10164"></a><span class="lineno">10164</span>&#160;        <span class="keyword">const</span> VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;</div>
-<div class="line"><a name="l10165"></a><span class="lineno">10165</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = 0;</div>
-<div class="line"><a name="l10166"></a><span class="lineno">10166</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
-<div class="line"><a name="l10167"></a><span class="lineno">10167</span>&#160;        {</div>
-<div class="line"><a name="l10168"></a><span class="lineno">10168</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
-<div class="line"><a name="l10169"></a><span class="lineno">10169</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex &lt; suballoc2ndCount &amp;&amp;</div>
-<div class="line"><a name="l10170"></a><span class="lineno">10170</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l10171"></a><span class="lineno">10171</span>&#160;            {</div>
-<div class="line"><a name="l10172"></a><span class="lineno">10172</span>&#160;                ++nextAlloc2ndIndex;</div>
-<div class="line"><a name="l10173"></a><span class="lineno">10173</span>&#160;            }</div>
-<div class="line"><a name="l10174"></a><span class="lineno">10174</span>&#160; </div>
-<div class="line"><a name="l10175"></a><span class="lineno">10175</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l10176"></a><span class="lineno">10176</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex &lt; suballoc2ndCount)</div>
-<div class="line"><a name="l10177"></a><span class="lineno">10177</span>&#160;            {</div>
-<div class="line"><a name="l10178"></a><span class="lineno">10178</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
-<div class="line"><a name="l10179"></a><span class="lineno">10179</span>&#160;            </div>
-<div class="line"><a name="l10180"></a><span class="lineno">10180</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l10181"></a><span class="lineno">10181</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
-<div class="line"><a name="l10182"></a><span class="lineno">10182</span>&#160;                {</div>
-<div class="line"><a name="l10183"></a><span class="lineno">10183</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l10184"></a><span class="lineno">10184</span>&#160;                    ++unusedRangeCount;</div>
-<div class="line"><a name="l10185"></a><span class="lineno">10185</span>&#160;                }</div>
-<div class="line"><a name="l10186"></a><span class="lineno">10186</span>&#160;            </div>
-<div class="line"><a name="l10187"></a><span class="lineno">10187</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l10188"></a><span class="lineno">10188</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l10189"></a><span class="lineno">10189</span>&#160;                ++alloc2ndCount;</div>
-<div class="line"><a name="l10190"></a><span class="lineno">10190</span>&#160;                usedBytes += suballoc.size;</div>
-<div class="line"><a name="l10191"></a><span class="lineno">10191</span>&#160;            </div>
-<div class="line"><a name="l10192"></a><span class="lineno">10192</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l10193"></a><span class="lineno">10193</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l10194"></a><span class="lineno">10194</span>&#160;                ++nextAlloc2ndIndex;</div>
-<div class="line"><a name="l10195"></a><span class="lineno">10195</span>&#160;            }</div>
-<div class="line"><a name="l10196"></a><span class="lineno">10196</span>&#160;            <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l10197"></a><span class="lineno">10197</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10198"></a><span class="lineno">10198</span>&#160;            {</div>
-<div class="line"><a name="l10199"></a><span class="lineno">10199</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
-<div class="line"><a name="l10200"></a><span class="lineno">10200</span>&#160;                {</div>
-<div class="line"><a name="l10201"></a><span class="lineno">10201</span>&#160;                    <span class="comment">// There is free space from lastOffset to freeSpace2ndTo1stEnd.</span></div>
-<div class="line"><a name="l10202"></a><span class="lineno">10202</span>&#160;                    ++unusedRangeCount;</div>
-<div class="line"><a name="l10203"></a><span class="lineno">10203</span>&#160;                }</div>
-<div class="line"><a name="l10204"></a><span class="lineno">10204</span>&#160; </div>
-<div class="line"><a name="l10205"></a><span class="lineno">10205</span>&#160;                <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l10206"></a><span class="lineno">10206</span>&#160;                lastOffset = freeSpace2ndTo1stEnd;</div>
-<div class="line"><a name="l10207"></a><span class="lineno">10207</span>&#160;            }</div>
-<div class="line"><a name="l10208"></a><span class="lineno">10208</span>&#160;        }</div>
-<div class="line"><a name="l10209"></a><span class="lineno">10209</span>&#160;    }</div>
+<div class="line"><a name="l10129"></a><span class="lineno">10129</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;</div>
+<div class="line"><a name="l10130"></a><span class="lineno">10130</span>&#160;                ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10131"></a><span class="lineno">10131</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10132"></a><span class="lineno">10132</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10133"></a><span class="lineno">10133</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10134"></a><span class="lineno">10134</span>&#160;           }</div>
+<div class="line"><a name="l10135"></a><span class="lineno">10135</span>&#160; </div>
+<div class="line"><a name="l10136"></a><span class="lineno">10136</span>&#160;            <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10137"></a><span class="lineno">10137</span>&#160;            lastOffset = freeSpace1stTo2ndEnd;</div>
+<div class="line"><a name="l10138"></a><span class="lineno">10138</span>&#160;        }</div>
+<div class="line"><a name="l10139"></a><span class="lineno">10139</span>&#160;    }</div>
+<div class="line"><a name="l10140"></a><span class="lineno">10140</span>&#160; </div>
+<div class="line"><a name="l10141"></a><span class="lineno">10141</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
+<div class="line"><a name="l10142"></a><span class="lineno">10142</span>&#160;    {</div>
+<div class="line"><a name="l10143"></a><span class="lineno">10143</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = suballocations2nd.size() - 1;</div>
+<div class="line"><a name="l10144"></a><span class="lineno">10144</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; size)</div>
+<div class="line"><a name="l10145"></a><span class="lineno">10145</span>&#160;        {</div>
+<div class="line"><a name="l10146"></a><span class="lineno">10146</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
+<div class="line"><a name="l10147"></a><span class="lineno">10147</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex != SIZE_MAX &amp;&amp;</div>
+<div class="line"><a name="l10148"></a><span class="lineno">10148</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10149"></a><span class="lineno">10149</span>&#160;            {</div>
+<div class="line"><a name="l10150"></a><span class="lineno">10150</span>&#160;                --nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10151"></a><span class="lineno">10151</span>&#160;            }</div>
+<div class="line"><a name="l10152"></a><span class="lineno">10152</span>&#160; </div>
+<div class="line"><a name="l10153"></a><span class="lineno">10153</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10154"></a><span class="lineno">10154</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex != SIZE_MAX)</div>
+<div class="line"><a name="l10155"></a><span class="lineno">10155</span>&#160;            {</div>
+<div class="line"><a name="l10156"></a><span class="lineno">10156</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
+<div class="line"><a name="l10157"></a><span class="lineno">10157</span>&#160;            </div>
+<div class="line"><a name="l10158"></a><span class="lineno">10158</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10159"></a><span class="lineno">10159</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10160"></a><span class="lineno">10160</span>&#160;                {</div>
+<div class="line"><a name="l10161"></a><span class="lineno">10161</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10162"></a><span class="lineno">10162</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
+<div class="line"><a name="l10163"></a><span class="lineno">10163</span>&#160;                    ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10164"></a><span class="lineno">10164</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10165"></a><span class="lineno">10165</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10166"></a><span class="lineno">10166</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10167"></a><span class="lineno">10167</span>&#160;                }</div>
+<div class="line"><a name="l10168"></a><span class="lineno">10168</span>&#160;            </div>
+<div class="line"><a name="l10169"></a><span class="lineno">10169</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10170"></a><span class="lineno">10170</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10171"></a><span class="lineno">10171</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> += suballoc.size;</div>
+<div class="line"><a name="l10172"></a><span class="lineno">10172</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, suballoc.size);</div>
+<div class="line"><a name="l10173"></a><span class="lineno">10173</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, suballoc.size);</div>
+<div class="line"><a name="l10174"></a><span class="lineno">10174</span>&#160;            </div>
+<div class="line"><a name="l10175"></a><span class="lineno">10175</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10176"></a><span class="lineno">10176</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10177"></a><span class="lineno">10177</span>&#160;                --nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10178"></a><span class="lineno">10178</span>&#160;            }</div>
+<div class="line"><a name="l10179"></a><span class="lineno">10179</span>&#160;            <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10180"></a><span class="lineno">10180</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10181"></a><span class="lineno">10181</span>&#160;            {</div>
+<div class="line"><a name="l10182"></a><span class="lineno">10182</span>&#160;                <span class="comment">// There is free space from lastOffset to size.</span></div>
+<div class="line"><a name="l10183"></a><span class="lineno">10183</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; size)</div>
+<div class="line"><a name="l10184"></a><span class="lineno">10184</span>&#160;                {</div>
+<div class="line"><a name="l10185"></a><span class="lineno">10185</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = size - lastOffset;</div>
+<div class="line"><a name="l10186"></a><span class="lineno">10186</span>&#160;                    ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10187"></a><span class="lineno">10187</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10188"></a><span class="lineno">10188</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10189"></a><span class="lineno">10189</span>&#160;                    outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10190"></a><span class="lineno">10190</span>&#160;               }</div>
+<div class="line"><a name="l10191"></a><span class="lineno">10191</span>&#160; </div>
+<div class="line"><a name="l10192"></a><span class="lineno">10192</span>&#160;                <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10193"></a><span class="lineno">10193</span>&#160;                lastOffset = size;</div>
+<div class="line"><a name="l10194"></a><span class="lineno">10194</span>&#160;            }</div>
+<div class="line"><a name="l10195"></a><span class="lineno">10195</span>&#160;        }</div>
+<div class="line"><a name="l10196"></a><span class="lineno">10196</span>&#160;    }</div>
+<div class="line"><a name="l10197"></a><span class="lineno">10197</span>&#160; </div>
+<div class="line"><a name="l10198"></a><span class="lineno">10198</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> = size - outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a>;</div>
+<div class="line"><a name="l10199"></a><span class="lineno">10199</span>&#160;}</div>
+<div class="line"><a name="l10200"></a><span class="lineno">10200</span>&#160; </div>
+<div class="line"><a name="l10201"></a><span class="lineno">10201</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats)<span class="keyword"> const</span></div>
+<div class="line"><a name="l10202"></a><span class="lineno">10202</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l10203"></a><span class="lineno">10203</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l10204"></a><span class="lineno">10204</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l10205"></a><span class="lineno">10205</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
+<div class="line"><a name="l10206"></a><span class="lineno">10206</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc1stCount = suballocations1st.size();</div>
+<div class="line"><a name="l10207"></a><span class="lineno">10207</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc2ndCount = suballocations2nd.size();</div>
+<div class="line"><a name="l10208"></a><span class="lineno">10208</span>&#160; </div>
+<div class="line"><a name="l10209"></a><span class="lineno">10209</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a> += size;</div>
 <div class="line"><a name="l10210"></a><span class="lineno">10210</span>&#160; </div>
-<div class="line"><a name="l10211"></a><span class="lineno">10211</span>&#160;    <span class="keywordtype">size_t</span> nextAlloc1stIndex = m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l10212"></a><span class="lineno">10212</span>&#160;    <span class="keywordtype">size_t</span> alloc1stCount = 0;</div>
-<div class="line"><a name="l10213"></a><span class="lineno">10213</span>&#160;    <span class="keyword">const</span> VkDeviceSize freeSpace1stTo2ndEnd =</div>
-<div class="line"><a name="l10214"></a><span class="lineno">10214</span>&#160;        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;</div>
-<div class="line"><a name="l10215"></a><span class="lineno">10215</span>&#160;    <span class="keywordflow">while</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
-<div class="line"><a name="l10216"></a><span class="lineno">10216</span>&#160;    {</div>
-<div class="line"><a name="l10217"></a><span class="lineno">10217</span>&#160;        <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
-<div class="line"><a name="l10218"></a><span class="lineno">10218</span>&#160;        <span class="keywordflow">while</span>(nextAlloc1stIndex &lt; suballoc1stCount &amp;&amp;</div>
-<div class="line"><a name="l10219"></a><span class="lineno">10219</span>&#160;            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l10220"></a><span class="lineno">10220</span>&#160;        {</div>
-<div class="line"><a name="l10221"></a><span class="lineno">10221</span>&#160;            ++nextAlloc1stIndex;</div>
-<div class="line"><a name="l10222"></a><span class="lineno">10222</span>&#160;        }</div>
-<div class="line"><a name="l10223"></a><span class="lineno">10223</span>&#160; </div>
-<div class="line"><a name="l10224"></a><span class="lineno">10224</span>&#160;        <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l10225"></a><span class="lineno">10225</span>&#160;        <span class="keywordflow">if</span>(nextAlloc1stIndex &lt; suballoc1stCount)</div>
-<div class="line"><a name="l10226"></a><span class="lineno">10226</span>&#160;        {</div>
-<div class="line"><a name="l10227"></a><span class="lineno">10227</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[nextAlloc1stIndex];</div>
-<div class="line"><a name="l10228"></a><span class="lineno">10228</span>&#160;            </div>
-<div class="line"><a name="l10229"></a><span class="lineno">10229</span>&#160;            <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l10230"></a><span class="lineno">10230</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
-<div class="line"><a name="l10231"></a><span class="lineno">10231</span>&#160;            {</div>
-<div class="line"><a name="l10232"></a><span class="lineno">10232</span>&#160;                <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l10233"></a><span class="lineno">10233</span>&#160;                ++unusedRangeCount;</div>
-<div class="line"><a name="l10234"></a><span class="lineno">10234</span>&#160;            }</div>
-<div class="line"><a name="l10235"></a><span class="lineno">10235</span>&#160;            </div>
-<div class="line"><a name="l10236"></a><span class="lineno">10236</span>&#160;            <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l10237"></a><span class="lineno">10237</span>&#160;            <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l10238"></a><span class="lineno">10238</span>&#160;            ++alloc1stCount;</div>
-<div class="line"><a name="l10239"></a><span class="lineno">10239</span>&#160;            usedBytes += suballoc.size;</div>
+<div class="line"><a name="l10211"></a><span class="lineno">10211</span>&#160;    VkDeviceSize lastOffset = 0;</div>
+<div class="line"><a name="l10212"></a><span class="lineno">10212</span>&#160; </div>
+<div class="line"><a name="l10213"></a><span class="lineno">10213</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
+<div class="line"><a name="l10214"></a><span class="lineno">10214</span>&#160;    {</div>
+<div class="line"><a name="l10215"></a><span class="lineno">10215</span>&#160;        <span class="keyword">const</span> VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;</div>
+<div class="line"><a name="l10216"></a><span class="lineno">10216</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l10217"></a><span class="lineno">10217</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
+<div class="line"><a name="l10218"></a><span class="lineno">10218</span>&#160;        {</div>
+<div class="line"><a name="l10219"></a><span class="lineno">10219</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
+<div class="line"><a name="l10220"></a><span class="lineno">10220</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex &lt; suballoc2ndCount &amp;&amp;</div>
+<div class="line"><a name="l10221"></a><span class="lineno">10221</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10222"></a><span class="lineno">10222</span>&#160;            {</div>
+<div class="line"><a name="l10223"></a><span class="lineno">10223</span>&#160;                ++nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10224"></a><span class="lineno">10224</span>&#160;            }</div>
+<div class="line"><a name="l10225"></a><span class="lineno">10225</span>&#160; </div>
+<div class="line"><a name="l10226"></a><span class="lineno">10226</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10227"></a><span class="lineno">10227</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex &lt; suballoc2ndCount)</div>
+<div class="line"><a name="l10228"></a><span class="lineno">10228</span>&#160;            {</div>
+<div class="line"><a name="l10229"></a><span class="lineno">10229</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
+<div class="line"><a name="l10230"></a><span class="lineno">10230</span>&#160;            </div>
+<div class="line"><a name="l10231"></a><span class="lineno">10231</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10232"></a><span class="lineno">10232</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10233"></a><span class="lineno">10233</span>&#160;                {</div>
+<div class="line"><a name="l10234"></a><span class="lineno">10234</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10235"></a><span class="lineno">10235</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
+<div class="line"><a name="l10236"></a><span class="lineno">10236</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10237"></a><span class="lineno">10237</span>&#160;                    ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10238"></a><span class="lineno">10238</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10239"></a><span class="lineno">10239</span>&#160;                }</div>
 <div class="line"><a name="l10240"></a><span class="lineno">10240</span>&#160;            </div>
-<div class="line"><a name="l10241"></a><span class="lineno">10241</span>&#160;            <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l10242"></a><span class="lineno">10242</span>&#160;            lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l10243"></a><span class="lineno">10243</span>&#160;            ++nextAlloc1stIndex;</div>
-<div class="line"><a name="l10244"></a><span class="lineno">10244</span>&#160;        }</div>
-<div class="line"><a name="l10245"></a><span class="lineno">10245</span>&#160;        <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l10246"></a><span class="lineno">10246</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10247"></a><span class="lineno">10247</span>&#160;        {</div>
-<div class="line"><a name="l10248"></a><span class="lineno">10248</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; size)</div>
-<div class="line"><a name="l10249"></a><span class="lineno">10249</span>&#160;            {</div>
-<div class="line"><a name="l10250"></a><span class="lineno">10250</span>&#160;                <span class="comment">// There is free space from lastOffset to freeSpace1stTo2ndEnd.</span></div>
-<div class="line"><a name="l10251"></a><span class="lineno">10251</span>&#160;                ++unusedRangeCount;</div>
-<div class="line"><a name="l10252"></a><span class="lineno">10252</span>&#160;            }</div>
-<div class="line"><a name="l10253"></a><span class="lineno">10253</span>&#160; </div>
-<div class="line"><a name="l10254"></a><span class="lineno">10254</span>&#160;            <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l10255"></a><span class="lineno">10255</span>&#160;            lastOffset = freeSpace1stTo2ndEnd;</div>
-<div class="line"><a name="l10256"></a><span class="lineno">10256</span>&#160;        }</div>
-<div class="line"><a name="l10257"></a><span class="lineno">10257</span>&#160;    }</div>
-<div class="line"><a name="l10258"></a><span class="lineno">10258</span>&#160; </div>
-<div class="line"><a name="l10259"></a><span class="lineno">10259</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
-<div class="line"><a name="l10260"></a><span class="lineno">10260</span>&#160;    {</div>
-<div class="line"><a name="l10261"></a><span class="lineno">10261</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = suballocations2nd.size() - 1;</div>
-<div class="line"><a name="l10262"></a><span class="lineno">10262</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; size)</div>
-<div class="line"><a name="l10263"></a><span class="lineno">10263</span>&#160;        {</div>
-<div class="line"><a name="l10264"></a><span class="lineno">10264</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
-<div class="line"><a name="l10265"></a><span class="lineno">10265</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex != SIZE_MAX &amp;&amp;</div>
-<div class="line"><a name="l10266"></a><span class="lineno">10266</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l10267"></a><span class="lineno">10267</span>&#160;            {</div>
-<div class="line"><a name="l10268"></a><span class="lineno">10268</span>&#160;                --nextAlloc2ndIndex;</div>
-<div class="line"><a name="l10269"></a><span class="lineno">10269</span>&#160;            }</div>
-<div class="line"><a name="l10270"></a><span class="lineno">10270</span>&#160; </div>
-<div class="line"><a name="l10271"></a><span class="lineno">10271</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l10272"></a><span class="lineno">10272</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex != SIZE_MAX)</div>
-<div class="line"><a name="l10273"></a><span class="lineno">10273</span>&#160;            {</div>
-<div class="line"><a name="l10274"></a><span class="lineno">10274</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
-<div class="line"><a name="l10275"></a><span class="lineno">10275</span>&#160;            </div>
-<div class="line"><a name="l10276"></a><span class="lineno">10276</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l10277"></a><span class="lineno">10277</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
-<div class="line"><a name="l10278"></a><span class="lineno">10278</span>&#160;                {</div>
-<div class="line"><a name="l10279"></a><span class="lineno">10279</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l10280"></a><span class="lineno">10280</span>&#160;                    ++unusedRangeCount;</div>
-<div class="line"><a name="l10281"></a><span class="lineno">10281</span>&#160;                }</div>
-<div class="line"><a name="l10282"></a><span class="lineno">10282</span>&#160;            </div>
-<div class="line"><a name="l10283"></a><span class="lineno">10283</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l10284"></a><span class="lineno">10284</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l10285"></a><span class="lineno">10285</span>&#160;                ++alloc2ndCount;</div>
-<div class="line"><a name="l10286"></a><span class="lineno">10286</span>&#160;                usedBytes += suballoc.size;</div>
-<div class="line"><a name="l10287"></a><span class="lineno">10287</span>&#160;            </div>
-<div class="line"><a name="l10288"></a><span class="lineno">10288</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l10289"></a><span class="lineno">10289</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l10290"></a><span class="lineno">10290</span>&#160;                --nextAlloc2ndIndex;</div>
-<div class="line"><a name="l10291"></a><span class="lineno">10291</span>&#160;            }</div>
-<div class="line"><a name="l10292"></a><span class="lineno">10292</span>&#160;            <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l10293"></a><span class="lineno">10293</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10294"></a><span class="lineno">10294</span>&#160;            {</div>
-<div class="line"><a name="l10295"></a><span class="lineno">10295</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; size)</div>
-<div class="line"><a name="l10296"></a><span class="lineno">10296</span>&#160;                {</div>
-<div class="line"><a name="l10297"></a><span class="lineno">10297</span>&#160;                    <span class="comment">// There is free space from lastOffset to size.</span></div>
-<div class="line"><a name="l10298"></a><span class="lineno">10298</span>&#160;                    ++unusedRangeCount;</div>
-<div class="line"><a name="l10299"></a><span class="lineno">10299</span>&#160;                }</div>
-<div class="line"><a name="l10300"></a><span class="lineno">10300</span>&#160; </div>
-<div class="line"><a name="l10301"></a><span class="lineno">10301</span>&#160;                <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l10302"></a><span class="lineno">10302</span>&#160;                lastOffset = size;</div>
-<div class="line"><a name="l10303"></a><span class="lineno">10303</span>&#160;            }</div>
-<div class="line"><a name="l10304"></a><span class="lineno">10304</span>&#160;        }</div>
-<div class="line"><a name="l10305"></a><span class="lineno">10305</span>&#160;    }</div>
-<div class="line"><a name="l10306"></a><span class="lineno">10306</span>&#160; </div>
-<div class="line"><a name="l10307"></a><span class="lineno">10307</span>&#160;    <span class="keyword">const</span> VkDeviceSize unusedBytes = size - usedBytes;</div>
-<div class="line"><a name="l10308"></a><span class="lineno">10308</span>&#160;    PrintDetailedMap_Begin(json, unusedBytes, alloc1stCount + alloc2ndCount, unusedRangeCount);</div>
-<div class="line"><a name="l10309"></a><span class="lineno">10309</span>&#160; </div>
-<div class="line"><a name="l10310"></a><span class="lineno">10310</span>&#160;    <span class="comment">// SECOND PASS</span></div>
-<div class="line"><a name="l10311"></a><span class="lineno">10311</span>&#160;    lastOffset = 0;</div>
-<div class="line"><a name="l10312"></a><span class="lineno">10312</span>&#160; </div>
-<div class="line"><a name="l10313"></a><span class="lineno">10313</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
-<div class="line"><a name="l10314"></a><span class="lineno">10314</span>&#160;    {</div>
-<div class="line"><a name="l10315"></a><span class="lineno">10315</span>&#160;        <span class="keyword">const</span> VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;</div>
-<div class="line"><a name="l10316"></a><span class="lineno">10316</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = 0;</div>
-<div class="line"><a name="l10317"></a><span class="lineno">10317</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
-<div class="line"><a name="l10318"></a><span class="lineno">10318</span>&#160;        {</div>
-<div class="line"><a name="l10319"></a><span class="lineno">10319</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
-<div class="line"><a name="l10320"></a><span class="lineno">10320</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex &lt; suballoc2ndCount &amp;&amp;</div>
-<div class="line"><a name="l10321"></a><span class="lineno">10321</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l10322"></a><span class="lineno">10322</span>&#160;            {</div>
-<div class="line"><a name="l10323"></a><span class="lineno">10323</span>&#160;                ++nextAlloc2ndIndex;</div>
-<div class="line"><a name="l10324"></a><span class="lineno">10324</span>&#160;            }</div>
-<div class="line"><a name="l10325"></a><span class="lineno">10325</span>&#160; </div>
-<div class="line"><a name="l10326"></a><span class="lineno">10326</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l10327"></a><span class="lineno">10327</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex &lt; suballoc2ndCount)</div>
-<div class="line"><a name="l10328"></a><span class="lineno">10328</span>&#160;            {</div>
-<div class="line"><a name="l10329"></a><span class="lineno">10329</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
-<div class="line"><a name="l10330"></a><span class="lineno">10330</span>&#160;            </div>
-<div class="line"><a name="l10331"></a><span class="lineno">10331</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l10332"></a><span class="lineno">10332</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
-<div class="line"><a name="l10333"></a><span class="lineno">10333</span>&#160;                {</div>
-<div class="line"><a name="l10334"></a><span class="lineno">10334</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l10335"></a><span class="lineno">10335</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
-<div class="line"><a name="l10336"></a><span class="lineno">10336</span>&#160;                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
-<div class="line"><a name="l10337"></a><span class="lineno">10337</span>&#160;                }</div>
-<div class="line"><a name="l10338"></a><span class="lineno">10338</span>&#160;            </div>
-<div class="line"><a name="l10339"></a><span class="lineno">10339</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l10340"></a><span class="lineno">10340</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l10341"></a><span class="lineno">10341</span>&#160;                PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);</div>
-<div class="line"><a name="l10342"></a><span class="lineno">10342</span>&#160;            </div>
-<div class="line"><a name="l10343"></a><span class="lineno">10343</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l10344"></a><span class="lineno">10344</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l10345"></a><span class="lineno">10345</span>&#160;                ++nextAlloc2ndIndex;</div>
-<div class="line"><a name="l10346"></a><span class="lineno">10346</span>&#160;            }</div>
-<div class="line"><a name="l10347"></a><span class="lineno">10347</span>&#160;            <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l10348"></a><span class="lineno">10348</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10349"></a><span class="lineno">10349</span>&#160;            {</div>
-<div class="line"><a name="l10350"></a><span class="lineno">10350</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
-<div class="line"><a name="l10351"></a><span class="lineno">10351</span>&#160;                {</div>
-<div class="line"><a name="l10352"></a><span class="lineno">10352</span>&#160;                    <span class="comment">// There is free space from lastOffset to freeSpace2ndTo1stEnd.</span></div>
-<div class="line"><a name="l10353"></a><span class="lineno">10353</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;</div>
-<div class="line"><a name="l10354"></a><span class="lineno">10354</span>&#160;                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
-<div class="line"><a name="l10355"></a><span class="lineno">10355</span>&#160;                }</div>
-<div class="line"><a name="l10356"></a><span class="lineno">10356</span>&#160; </div>
-<div class="line"><a name="l10357"></a><span class="lineno">10357</span>&#160;                <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l10358"></a><span class="lineno">10358</span>&#160;                lastOffset = freeSpace2ndTo1stEnd;</div>
-<div class="line"><a name="l10359"></a><span class="lineno">10359</span>&#160;            }</div>
-<div class="line"><a name="l10360"></a><span class="lineno">10360</span>&#160;        }</div>
-<div class="line"><a name="l10361"></a><span class="lineno">10361</span>&#160;    }</div>
-<div class="line"><a name="l10362"></a><span class="lineno">10362</span>&#160; </div>
-<div class="line"><a name="l10363"></a><span class="lineno">10363</span>&#160;    nextAlloc1stIndex = m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l10364"></a><span class="lineno">10364</span>&#160;    <span class="keywordflow">while</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
-<div class="line"><a name="l10365"></a><span class="lineno">10365</span>&#160;    {</div>
-<div class="line"><a name="l10366"></a><span class="lineno">10366</span>&#160;        <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
-<div class="line"><a name="l10367"></a><span class="lineno">10367</span>&#160;        <span class="keywordflow">while</span>(nextAlloc1stIndex &lt; suballoc1stCount &amp;&amp;</div>
-<div class="line"><a name="l10368"></a><span class="lineno">10368</span>&#160;            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l10369"></a><span class="lineno">10369</span>&#160;        {</div>
-<div class="line"><a name="l10370"></a><span class="lineno">10370</span>&#160;            ++nextAlloc1stIndex;</div>
-<div class="line"><a name="l10371"></a><span class="lineno">10371</span>&#160;        }</div>
+<div class="line"><a name="l10241"></a><span class="lineno">10241</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10242"></a><span class="lineno">10242</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10243"></a><span class="lineno">10243</span>&#160;                ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a>;</div>
+<div class="line"><a name="l10244"></a><span class="lineno">10244</span>&#160;            </div>
+<div class="line"><a name="l10245"></a><span class="lineno">10245</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10246"></a><span class="lineno">10246</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10247"></a><span class="lineno">10247</span>&#160;                ++nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10248"></a><span class="lineno">10248</span>&#160;            }</div>
+<div class="line"><a name="l10249"></a><span class="lineno">10249</span>&#160;            <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10250"></a><span class="lineno">10250</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10251"></a><span class="lineno">10251</span>&#160;            {</div>
+<div class="line"><a name="l10252"></a><span class="lineno">10252</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
+<div class="line"><a name="l10253"></a><span class="lineno">10253</span>&#160;                {</div>
+<div class="line"><a name="l10254"></a><span class="lineno">10254</span>&#160;                    <span class="comment">// There is free space from lastOffset to freeSpace2ndTo1stEnd.</span></div>
+<div class="line"><a name="l10255"></a><span class="lineno">10255</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;</div>
+<div class="line"><a name="l10256"></a><span class="lineno">10256</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10257"></a><span class="lineno">10257</span>&#160;                    ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10258"></a><span class="lineno">10258</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10259"></a><span class="lineno">10259</span>&#160;                }</div>
+<div class="line"><a name="l10260"></a><span class="lineno">10260</span>&#160; </div>
+<div class="line"><a name="l10261"></a><span class="lineno">10261</span>&#160;                <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10262"></a><span class="lineno">10262</span>&#160;                lastOffset = freeSpace2ndTo1stEnd;</div>
+<div class="line"><a name="l10263"></a><span class="lineno">10263</span>&#160;            }</div>
+<div class="line"><a name="l10264"></a><span class="lineno">10264</span>&#160;        }</div>
+<div class="line"><a name="l10265"></a><span class="lineno">10265</span>&#160;    }</div>
+<div class="line"><a name="l10266"></a><span class="lineno">10266</span>&#160; </div>
+<div class="line"><a name="l10267"></a><span class="lineno">10267</span>&#160;    <span class="keywordtype">size_t</span> nextAlloc1stIndex = m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l10268"></a><span class="lineno">10268</span>&#160;    <span class="keyword">const</span> VkDeviceSize freeSpace1stTo2ndEnd =</div>
+<div class="line"><a name="l10269"></a><span class="lineno">10269</span>&#160;        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;</div>
+<div class="line"><a name="l10270"></a><span class="lineno">10270</span>&#160;    <span class="keywordflow">while</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
+<div class="line"><a name="l10271"></a><span class="lineno">10271</span>&#160;    {</div>
+<div class="line"><a name="l10272"></a><span class="lineno">10272</span>&#160;        <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
+<div class="line"><a name="l10273"></a><span class="lineno">10273</span>&#160;        <span class="keywordflow">while</span>(nextAlloc1stIndex &lt; suballoc1stCount &amp;&amp;</div>
+<div class="line"><a name="l10274"></a><span class="lineno">10274</span>&#160;            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10275"></a><span class="lineno">10275</span>&#160;        {</div>
+<div class="line"><a name="l10276"></a><span class="lineno">10276</span>&#160;            ++nextAlloc1stIndex;</div>
+<div class="line"><a name="l10277"></a><span class="lineno">10277</span>&#160;        }</div>
+<div class="line"><a name="l10278"></a><span class="lineno">10278</span>&#160; </div>
+<div class="line"><a name="l10279"></a><span class="lineno">10279</span>&#160;        <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10280"></a><span class="lineno">10280</span>&#160;        <span class="keywordflow">if</span>(nextAlloc1stIndex &lt; suballoc1stCount)</div>
+<div class="line"><a name="l10281"></a><span class="lineno">10281</span>&#160;        {</div>
+<div class="line"><a name="l10282"></a><span class="lineno">10282</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[nextAlloc1stIndex];</div>
+<div class="line"><a name="l10283"></a><span class="lineno">10283</span>&#160;            </div>
+<div class="line"><a name="l10284"></a><span class="lineno">10284</span>&#160;            <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10285"></a><span class="lineno">10285</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10286"></a><span class="lineno">10286</span>&#160;            {</div>
+<div class="line"><a name="l10287"></a><span class="lineno">10287</span>&#160;                <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10288"></a><span class="lineno">10288</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
+<div class="line"><a name="l10289"></a><span class="lineno">10289</span>&#160;                inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10290"></a><span class="lineno">10290</span>&#160;                ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10291"></a><span class="lineno">10291</span>&#160;                inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10292"></a><span class="lineno">10292</span>&#160;            }</div>
+<div class="line"><a name="l10293"></a><span class="lineno">10293</span>&#160;            </div>
+<div class="line"><a name="l10294"></a><span class="lineno">10294</span>&#160;            <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10295"></a><span class="lineno">10295</span>&#160;            <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10296"></a><span class="lineno">10296</span>&#160;            ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a>;</div>
+<div class="line"><a name="l10297"></a><span class="lineno">10297</span>&#160;            </div>
+<div class="line"><a name="l10298"></a><span class="lineno">10298</span>&#160;            <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10299"></a><span class="lineno">10299</span>&#160;            lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10300"></a><span class="lineno">10300</span>&#160;            ++nextAlloc1stIndex;</div>
+<div class="line"><a name="l10301"></a><span class="lineno">10301</span>&#160;        }</div>
+<div class="line"><a name="l10302"></a><span class="lineno">10302</span>&#160;        <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10303"></a><span class="lineno">10303</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10304"></a><span class="lineno">10304</span>&#160;        {</div>
+<div class="line"><a name="l10305"></a><span class="lineno">10305</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
+<div class="line"><a name="l10306"></a><span class="lineno">10306</span>&#160;            {</div>
+<div class="line"><a name="l10307"></a><span class="lineno">10307</span>&#160;                <span class="comment">// There is free space from lastOffset to freeSpace1stTo2ndEnd.</span></div>
+<div class="line"><a name="l10308"></a><span class="lineno">10308</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;</div>
+<div class="line"><a name="l10309"></a><span class="lineno">10309</span>&#160;                inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10310"></a><span class="lineno">10310</span>&#160;                ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10311"></a><span class="lineno">10311</span>&#160;                inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10312"></a><span class="lineno">10312</span>&#160;            }</div>
+<div class="line"><a name="l10313"></a><span class="lineno">10313</span>&#160; </div>
+<div class="line"><a name="l10314"></a><span class="lineno">10314</span>&#160;            <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10315"></a><span class="lineno">10315</span>&#160;            lastOffset = freeSpace1stTo2ndEnd;</div>
+<div class="line"><a name="l10316"></a><span class="lineno">10316</span>&#160;        }</div>
+<div class="line"><a name="l10317"></a><span class="lineno">10317</span>&#160;    }</div>
+<div class="line"><a name="l10318"></a><span class="lineno">10318</span>&#160; </div>
+<div class="line"><a name="l10319"></a><span class="lineno">10319</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
+<div class="line"><a name="l10320"></a><span class="lineno">10320</span>&#160;    {</div>
+<div class="line"><a name="l10321"></a><span class="lineno">10321</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = suballocations2nd.size() - 1;</div>
+<div class="line"><a name="l10322"></a><span class="lineno">10322</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; size)</div>
+<div class="line"><a name="l10323"></a><span class="lineno">10323</span>&#160;        {</div>
+<div class="line"><a name="l10324"></a><span class="lineno">10324</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
+<div class="line"><a name="l10325"></a><span class="lineno">10325</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex != SIZE_MAX &amp;&amp;</div>
+<div class="line"><a name="l10326"></a><span class="lineno">10326</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10327"></a><span class="lineno">10327</span>&#160;            {</div>
+<div class="line"><a name="l10328"></a><span class="lineno">10328</span>&#160;                --nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10329"></a><span class="lineno">10329</span>&#160;            }</div>
+<div class="line"><a name="l10330"></a><span class="lineno">10330</span>&#160; </div>
+<div class="line"><a name="l10331"></a><span class="lineno">10331</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10332"></a><span class="lineno">10332</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex != SIZE_MAX)</div>
+<div class="line"><a name="l10333"></a><span class="lineno">10333</span>&#160;            {</div>
+<div class="line"><a name="l10334"></a><span class="lineno">10334</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
+<div class="line"><a name="l10335"></a><span class="lineno">10335</span>&#160;            </div>
+<div class="line"><a name="l10336"></a><span class="lineno">10336</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10337"></a><span class="lineno">10337</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10338"></a><span class="lineno">10338</span>&#160;                {</div>
+<div class="line"><a name="l10339"></a><span class="lineno">10339</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10340"></a><span class="lineno">10340</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
+<div class="line"><a name="l10341"></a><span class="lineno">10341</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10342"></a><span class="lineno">10342</span>&#160;                    ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10343"></a><span class="lineno">10343</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10344"></a><span class="lineno">10344</span>&#160;                }</div>
+<div class="line"><a name="l10345"></a><span class="lineno">10345</span>&#160;            </div>
+<div class="line"><a name="l10346"></a><span class="lineno">10346</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10347"></a><span class="lineno">10347</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10348"></a><span class="lineno">10348</span>&#160;                ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a>;</div>
+<div class="line"><a name="l10349"></a><span class="lineno">10349</span>&#160;            </div>
+<div class="line"><a name="l10350"></a><span class="lineno">10350</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10351"></a><span class="lineno">10351</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10352"></a><span class="lineno">10352</span>&#160;                --nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10353"></a><span class="lineno">10353</span>&#160;            }</div>
+<div class="line"><a name="l10354"></a><span class="lineno">10354</span>&#160;            <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10355"></a><span class="lineno">10355</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10356"></a><span class="lineno">10356</span>&#160;            {</div>
+<div class="line"><a name="l10357"></a><span class="lineno">10357</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; size)</div>
+<div class="line"><a name="l10358"></a><span class="lineno">10358</span>&#160;                {</div>
+<div class="line"><a name="l10359"></a><span class="lineno">10359</span>&#160;                    <span class="comment">// There is free space from lastOffset to size.</span></div>
+<div class="line"><a name="l10360"></a><span class="lineno">10360</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = size - lastOffset;</div>
+<div class="line"><a name="l10361"></a><span class="lineno">10361</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += unusedRangeSize;</div>
+<div class="line"><a name="l10362"></a><span class="lineno">10362</span>&#160;                    ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
+<div class="line"><a name="l10363"></a><span class="lineno">10363</span>&#160;                    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l10364"></a><span class="lineno">10364</span>&#160;                }</div>
+<div class="line"><a name="l10365"></a><span class="lineno">10365</span>&#160; </div>
+<div class="line"><a name="l10366"></a><span class="lineno">10366</span>&#160;                <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10367"></a><span class="lineno">10367</span>&#160;                lastOffset = size;</div>
+<div class="line"><a name="l10368"></a><span class="lineno">10368</span>&#160;            }</div>
+<div class="line"><a name="l10369"></a><span class="lineno">10369</span>&#160;        }</div>
+<div class="line"><a name="l10370"></a><span class="lineno">10370</span>&#160;    }</div>
+<div class="line"><a name="l10371"></a><span class="lineno">10371</span>&#160;}</div>
 <div class="line"><a name="l10372"></a><span class="lineno">10372</span>&#160; </div>
-<div class="line"><a name="l10373"></a><span class="lineno">10373</span>&#160;        <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l10374"></a><span class="lineno">10374</span>&#160;        <span class="keywordflow">if</span>(nextAlloc1stIndex &lt; suballoc1stCount)</div>
-<div class="line"><a name="l10375"></a><span class="lineno">10375</span>&#160;        {</div>
-<div class="line"><a name="l10376"></a><span class="lineno">10376</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[nextAlloc1stIndex];</div>
-<div class="line"><a name="l10377"></a><span class="lineno">10377</span>&#160;            </div>
-<div class="line"><a name="l10378"></a><span class="lineno">10378</span>&#160;            <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l10379"></a><span class="lineno">10379</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
-<div class="line"><a name="l10380"></a><span class="lineno">10380</span>&#160;            {</div>
-<div class="line"><a name="l10381"></a><span class="lineno">10381</span>&#160;                <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l10382"></a><span class="lineno">10382</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
-<div class="line"><a name="l10383"></a><span class="lineno">10383</span>&#160;                PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
-<div class="line"><a name="l10384"></a><span class="lineno">10384</span>&#160;            }</div>
-<div class="line"><a name="l10385"></a><span class="lineno">10385</span>&#160;            </div>
-<div class="line"><a name="l10386"></a><span class="lineno">10386</span>&#160;            <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l10387"></a><span class="lineno">10387</span>&#160;            <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l10388"></a><span class="lineno">10388</span>&#160;            PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);</div>
-<div class="line"><a name="l10389"></a><span class="lineno">10389</span>&#160;            </div>
-<div class="line"><a name="l10390"></a><span class="lineno">10390</span>&#160;            <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l10391"></a><span class="lineno">10391</span>&#160;            lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l10392"></a><span class="lineno">10392</span>&#160;            ++nextAlloc1stIndex;</div>
-<div class="line"><a name="l10393"></a><span class="lineno">10393</span>&#160;        }</div>
-<div class="line"><a name="l10394"></a><span class="lineno">10394</span>&#160;        <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l10395"></a><span class="lineno">10395</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10396"></a><span class="lineno">10396</span>&#160;        {</div>
-<div class="line"><a name="l10397"></a><span class="lineno">10397</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
-<div class="line"><a name="l10398"></a><span class="lineno">10398</span>&#160;            {</div>
-<div class="line"><a name="l10399"></a><span class="lineno">10399</span>&#160;                <span class="comment">// There is free space from lastOffset to freeSpace1stTo2ndEnd.</span></div>
-<div class="line"><a name="l10400"></a><span class="lineno">10400</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;</div>
-<div class="line"><a name="l10401"></a><span class="lineno">10401</span>&#160;                PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
-<div class="line"><a name="l10402"></a><span class="lineno">10402</span>&#160;            }</div>
-<div class="line"><a name="l10403"></a><span class="lineno">10403</span>&#160; </div>
-<div class="line"><a name="l10404"></a><span class="lineno">10404</span>&#160;            <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l10405"></a><span class="lineno">10405</span>&#160;            lastOffset = freeSpace1stTo2ndEnd;</div>
-<div class="line"><a name="l10406"></a><span class="lineno">10406</span>&#160;        }</div>
-<div class="line"><a name="l10407"></a><span class="lineno">10407</span>&#160;    }</div>
-<div class="line"><a name="l10408"></a><span class="lineno">10408</span>&#160; </div>
-<div class="line"><a name="l10409"></a><span class="lineno">10409</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
-<div class="line"><a name="l10410"></a><span class="lineno">10410</span>&#160;    {</div>
-<div class="line"><a name="l10411"></a><span class="lineno">10411</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = suballocations2nd.size() - 1;</div>
-<div class="line"><a name="l10412"></a><span class="lineno">10412</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; size)</div>
-<div class="line"><a name="l10413"></a><span class="lineno">10413</span>&#160;        {</div>
-<div class="line"><a name="l10414"></a><span class="lineno">10414</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
-<div class="line"><a name="l10415"></a><span class="lineno">10415</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex != SIZE_MAX &amp;&amp;</div>
-<div class="line"><a name="l10416"></a><span class="lineno">10416</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l10417"></a><span class="lineno">10417</span>&#160;            {</div>
-<div class="line"><a name="l10418"></a><span class="lineno">10418</span>&#160;                --nextAlloc2ndIndex;</div>
-<div class="line"><a name="l10419"></a><span class="lineno">10419</span>&#160;            }</div>
-<div class="line"><a name="l10420"></a><span class="lineno">10420</span>&#160; </div>
-<div class="line"><a name="l10421"></a><span class="lineno">10421</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
-<div class="line"><a name="l10422"></a><span class="lineno">10422</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex != SIZE_MAX)</div>
-<div class="line"><a name="l10423"></a><span class="lineno">10423</span>&#160;            {</div>
-<div class="line"><a name="l10424"></a><span class="lineno">10424</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
-<div class="line"><a name="l10425"></a><span class="lineno">10425</span>&#160;            </div>
-<div class="line"><a name="l10426"></a><span class="lineno">10426</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
-<div class="line"><a name="l10427"></a><span class="lineno">10427</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10373"></a><span class="lineno">10373</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l10374"></a><span class="lineno">10374</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json)<span class="keyword"> const</span></div>
+<div class="line"><a name="l10375"></a><span class="lineno">10375</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l10376"></a><span class="lineno">10376</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
+<div class="line"><a name="l10377"></a><span class="lineno">10377</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l10378"></a><span class="lineno">10378</span>&#160;    <span class="keyword">const</span> SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l10379"></a><span class="lineno">10379</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc1stCount = suballocations1st.size();</div>
+<div class="line"><a name="l10380"></a><span class="lineno">10380</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc2ndCount = suballocations2nd.size();</div>
+<div class="line"><a name="l10381"></a><span class="lineno">10381</span>&#160; </div>
+<div class="line"><a name="l10382"></a><span class="lineno">10382</span>&#160;    <span class="comment">// FIRST PASS</span></div>
+<div class="line"><a name="l10383"></a><span class="lineno">10383</span>&#160; </div>
+<div class="line"><a name="l10384"></a><span class="lineno">10384</span>&#160;    <span class="keywordtype">size_t</span> unusedRangeCount = 0;</div>
+<div class="line"><a name="l10385"></a><span class="lineno">10385</span>&#160;    VkDeviceSize usedBytes = 0;</div>
+<div class="line"><a name="l10386"></a><span class="lineno">10386</span>&#160; </div>
+<div class="line"><a name="l10387"></a><span class="lineno">10387</span>&#160;    VkDeviceSize lastOffset = 0;</div>
+<div class="line"><a name="l10388"></a><span class="lineno">10388</span>&#160; </div>
+<div class="line"><a name="l10389"></a><span class="lineno">10389</span>&#160;    <span class="keywordtype">size_t</span> alloc2ndCount = 0;</div>
+<div class="line"><a name="l10390"></a><span class="lineno">10390</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
+<div class="line"><a name="l10391"></a><span class="lineno">10391</span>&#160;    {</div>
+<div class="line"><a name="l10392"></a><span class="lineno">10392</span>&#160;        <span class="keyword">const</span> VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;</div>
+<div class="line"><a name="l10393"></a><span class="lineno">10393</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = 0;</div>
+<div class="line"><a name="l10394"></a><span class="lineno">10394</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
+<div class="line"><a name="l10395"></a><span class="lineno">10395</span>&#160;        {</div>
+<div class="line"><a name="l10396"></a><span class="lineno">10396</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
+<div class="line"><a name="l10397"></a><span class="lineno">10397</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex &lt; suballoc2ndCount &amp;&amp;</div>
+<div class="line"><a name="l10398"></a><span class="lineno">10398</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10399"></a><span class="lineno">10399</span>&#160;            {</div>
+<div class="line"><a name="l10400"></a><span class="lineno">10400</span>&#160;                ++nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10401"></a><span class="lineno">10401</span>&#160;            }</div>
+<div class="line"><a name="l10402"></a><span class="lineno">10402</span>&#160; </div>
+<div class="line"><a name="l10403"></a><span class="lineno">10403</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10404"></a><span class="lineno">10404</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex &lt; suballoc2ndCount)</div>
+<div class="line"><a name="l10405"></a><span class="lineno">10405</span>&#160;            {</div>
+<div class="line"><a name="l10406"></a><span class="lineno">10406</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
+<div class="line"><a name="l10407"></a><span class="lineno">10407</span>&#160;            </div>
+<div class="line"><a name="l10408"></a><span class="lineno">10408</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10409"></a><span class="lineno">10409</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10410"></a><span class="lineno">10410</span>&#160;                {</div>
+<div class="line"><a name="l10411"></a><span class="lineno">10411</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10412"></a><span class="lineno">10412</span>&#160;                    ++unusedRangeCount;</div>
+<div class="line"><a name="l10413"></a><span class="lineno">10413</span>&#160;                }</div>
+<div class="line"><a name="l10414"></a><span class="lineno">10414</span>&#160;            </div>
+<div class="line"><a name="l10415"></a><span class="lineno">10415</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10416"></a><span class="lineno">10416</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10417"></a><span class="lineno">10417</span>&#160;                ++alloc2ndCount;</div>
+<div class="line"><a name="l10418"></a><span class="lineno">10418</span>&#160;                usedBytes += suballoc.size;</div>
+<div class="line"><a name="l10419"></a><span class="lineno">10419</span>&#160;            </div>
+<div class="line"><a name="l10420"></a><span class="lineno">10420</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10421"></a><span class="lineno">10421</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10422"></a><span class="lineno">10422</span>&#160;                ++nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10423"></a><span class="lineno">10423</span>&#160;            }</div>
+<div class="line"><a name="l10424"></a><span class="lineno">10424</span>&#160;            <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10425"></a><span class="lineno">10425</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10426"></a><span class="lineno">10426</span>&#160;            {</div>
+<div class="line"><a name="l10427"></a><span class="lineno">10427</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
 <div class="line"><a name="l10428"></a><span class="lineno">10428</span>&#160;                {</div>
-<div class="line"><a name="l10429"></a><span class="lineno">10429</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
-<div class="line"><a name="l10430"></a><span class="lineno">10430</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
-<div class="line"><a name="l10431"></a><span class="lineno">10431</span>&#160;                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
-<div class="line"><a name="l10432"></a><span class="lineno">10432</span>&#160;                }</div>
-<div class="line"><a name="l10433"></a><span class="lineno">10433</span>&#160;            </div>
-<div class="line"><a name="l10434"></a><span class="lineno">10434</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
-<div class="line"><a name="l10435"></a><span class="lineno">10435</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
-<div class="line"><a name="l10436"></a><span class="lineno">10436</span>&#160;                PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);</div>
-<div class="line"><a name="l10437"></a><span class="lineno">10437</span>&#160;            </div>
-<div class="line"><a name="l10438"></a><span class="lineno">10438</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
-<div class="line"><a name="l10439"></a><span class="lineno">10439</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
-<div class="line"><a name="l10440"></a><span class="lineno">10440</span>&#160;                --nextAlloc2ndIndex;</div>
-<div class="line"><a name="l10441"></a><span class="lineno">10441</span>&#160;            }</div>
-<div class="line"><a name="l10442"></a><span class="lineno">10442</span>&#160;            <span class="comment">// We are at the end.</span></div>
-<div class="line"><a name="l10443"></a><span class="lineno">10443</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10444"></a><span class="lineno">10444</span>&#160;            {</div>
-<div class="line"><a name="l10445"></a><span class="lineno">10445</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; size)</div>
-<div class="line"><a name="l10446"></a><span class="lineno">10446</span>&#160;                {</div>
-<div class="line"><a name="l10447"></a><span class="lineno">10447</span>&#160;                    <span class="comment">// There is free space from lastOffset to size.</span></div>
-<div class="line"><a name="l10448"></a><span class="lineno">10448</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = size - lastOffset;</div>
-<div class="line"><a name="l10449"></a><span class="lineno">10449</span>&#160;                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
-<div class="line"><a name="l10450"></a><span class="lineno">10450</span>&#160;                }</div>
+<div class="line"><a name="l10429"></a><span class="lineno">10429</span>&#160;                    <span class="comment">// There is free space from lastOffset to freeSpace2ndTo1stEnd.</span></div>
+<div class="line"><a name="l10430"></a><span class="lineno">10430</span>&#160;                    ++unusedRangeCount;</div>
+<div class="line"><a name="l10431"></a><span class="lineno">10431</span>&#160;                }</div>
+<div class="line"><a name="l10432"></a><span class="lineno">10432</span>&#160; </div>
+<div class="line"><a name="l10433"></a><span class="lineno">10433</span>&#160;                <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10434"></a><span class="lineno">10434</span>&#160;                lastOffset = freeSpace2ndTo1stEnd;</div>
+<div class="line"><a name="l10435"></a><span class="lineno">10435</span>&#160;            }</div>
+<div class="line"><a name="l10436"></a><span class="lineno">10436</span>&#160;        }</div>
+<div class="line"><a name="l10437"></a><span class="lineno">10437</span>&#160;    }</div>
+<div class="line"><a name="l10438"></a><span class="lineno">10438</span>&#160; </div>
+<div class="line"><a name="l10439"></a><span class="lineno">10439</span>&#160;    <span class="keywordtype">size_t</span> nextAlloc1stIndex = m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l10440"></a><span class="lineno">10440</span>&#160;    <span class="keywordtype">size_t</span> alloc1stCount = 0;</div>
+<div class="line"><a name="l10441"></a><span class="lineno">10441</span>&#160;    <span class="keyword">const</span> VkDeviceSize freeSpace1stTo2ndEnd =</div>
+<div class="line"><a name="l10442"></a><span class="lineno">10442</span>&#160;        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;</div>
+<div class="line"><a name="l10443"></a><span class="lineno">10443</span>&#160;    <span class="keywordflow">while</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
+<div class="line"><a name="l10444"></a><span class="lineno">10444</span>&#160;    {</div>
+<div class="line"><a name="l10445"></a><span class="lineno">10445</span>&#160;        <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
+<div class="line"><a name="l10446"></a><span class="lineno">10446</span>&#160;        <span class="keywordflow">while</span>(nextAlloc1stIndex &lt; suballoc1stCount &amp;&amp;</div>
+<div class="line"><a name="l10447"></a><span class="lineno">10447</span>&#160;            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10448"></a><span class="lineno">10448</span>&#160;        {</div>
+<div class="line"><a name="l10449"></a><span class="lineno">10449</span>&#160;            ++nextAlloc1stIndex;</div>
+<div class="line"><a name="l10450"></a><span class="lineno">10450</span>&#160;        }</div>
 <div class="line"><a name="l10451"></a><span class="lineno">10451</span>&#160; </div>
-<div class="line"><a name="l10452"></a><span class="lineno">10452</span>&#160;                <span class="comment">// End of loop.</span></div>
-<div class="line"><a name="l10453"></a><span class="lineno">10453</span>&#160;                lastOffset = size;</div>
-<div class="line"><a name="l10454"></a><span class="lineno">10454</span>&#160;            }</div>
-<div class="line"><a name="l10455"></a><span class="lineno">10455</span>&#160;        }</div>
-<div class="line"><a name="l10456"></a><span class="lineno">10456</span>&#160;    }</div>
-<div class="line"><a name="l10457"></a><span class="lineno">10457</span>&#160; </div>
-<div class="line"><a name="l10458"></a><span class="lineno">10458</span>&#160;    PrintDetailedMap_End(json);</div>
-<div class="line"><a name="l10459"></a><span class="lineno">10459</span>&#160;}</div>
-<div class="line"><a name="l10460"></a><span class="lineno">10460</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l10461"></a><span class="lineno">10461</span>&#160; </div>
-<div class="line"><a name="l10462"></a><span class="lineno">10462</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::CreateAllocationRequest(</div>
-<div class="line"><a name="l10463"></a><span class="lineno">10463</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l10464"></a><span class="lineno">10464</span>&#160;    uint32_t frameInUseCount,</div>
-<div class="line"><a name="l10465"></a><span class="lineno">10465</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l10466"></a><span class="lineno">10466</span>&#160;    VkDeviceSize allocSize,</div>
-<div class="line"><a name="l10467"></a><span class="lineno">10467</span>&#160;    VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l10468"></a><span class="lineno">10468</span>&#160;    <span class="keywordtype">bool</span> upperAddress,</div>
-<div class="line"><a name="l10469"></a><span class="lineno">10469</span>&#160;    VmaSuballocationType allocType,</div>
-<div class="line"><a name="l10470"></a><span class="lineno">10470</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l10471"></a><span class="lineno">10471</span>&#160;    uint32_t strategy,</div>
-<div class="line"><a name="l10472"></a><span class="lineno">10472</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
-<div class="line"><a name="l10473"></a><span class="lineno">10473</span>&#160;{</div>
-<div class="line"><a name="l10474"></a><span class="lineno">10474</span>&#160;    VMA_ASSERT(allocSize &gt; 0);</div>
-<div class="line"><a name="l10475"></a><span class="lineno">10475</span>&#160;    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l10476"></a><span class="lineno">10476</span>&#160;    VMA_ASSERT(pAllocationRequest != VMA_NULL);</div>
-<div class="line"><a name="l10477"></a><span class="lineno">10477</span>&#160;    VMA_HEAVY_ASSERT(Validate());</div>
-<div class="line"><a name="l10478"></a><span class="lineno">10478</span>&#160;    <span class="keywordflow">return</span> upperAddress ?</div>
-<div class="line"><a name="l10479"></a><span class="lineno">10479</span>&#160;        CreateAllocationRequest_UpperAddress(</div>
-<div class="line"><a name="l10480"></a><span class="lineno">10480</span>&#160;            currentFrameIndex, frameInUseCount, bufferImageGranularity,</div>
-<div class="line"><a name="l10481"></a><span class="lineno">10481</span>&#160;            allocSize, allocAlignment, allocType, canMakeOtherLost, strategy, pAllocationRequest) :</div>
-<div class="line"><a name="l10482"></a><span class="lineno">10482</span>&#160;        CreateAllocationRequest_LowerAddress(</div>
-<div class="line"><a name="l10483"></a><span class="lineno">10483</span>&#160;            currentFrameIndex, frameInUseCount, bufferImageGranularity,</div>
-<div class="line"><a name="l10484"></a><span class="lineno">10484</span>&#160;            allocSize, allocAlignment, allocType, canMakeOtherLost, strategy, pAllocationRequest);</div>
-<div class="line"><a name="l10485"></a><span class="lineno">10485</span>&#160;}</div>
+<div class="line"><a name="l10452"></a><span class="lineno">10452</span>&#160;        <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10453"></a><span class="lineno">10453</span>&#160;        <span class="keywordflow">if</span>(nextAlloc1stIndex &lt; suballoc1stCount)</div>
+<div class="line"><a name="l10454"></a><span class="lineno">10454</span>&#160;        {</div>
+<div class="line"><a name="l10455"></a><span class="lineno">10455</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[nextAlloc1stIndex];</div>
+<div class="line"><a name="l10456"></a><span class="lineno">10456</span>&#160;            </div>
+<div class="line"><a name="l10457"></a><span class="lineno">10457</span>&#160;            <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10458"></a><span class="lineno">10458</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10459"></a><span class="lineno">10459</span>&#160;            {</div>
+<div class="line"><a name="l10460"></a><span class="lineno">10460</span>&#160;                <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10461"></a><span class="lineno">10461</span>&#160;                ++unusedRangeCount;</div>
+<div class="line"><a name="l10462"></a><span class="lineno">10462</span>&#160;            }</div>
+<div class="line"><a name="l10463"></a><span class="lineno">10463</span>&#160;            </div>
+<div class="line"><a name="l10464"></a><span class="lineno">10464</span>&#160;            <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10465"></a><span class="lineno">10465</span>&#160;            <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10466"></a><span class="lineno">10466</span>&#160;            ++alloc1stCount;</div>
+<div class="line"><a name="l10467"></a><span class="lineno">10467</span>&#160;            usedBytes += suballoc.size;</div>
+<div class="line"><a name="l10468"></a><span class="lineno">10468</span>&#160;            </div>
+<div class="line"><a name="l10469"></a><span class="lineno">10469</span>&#160;            <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10470"></a><span class="lineno">10470</span>&#160;            lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10471"></a><span class="lineno">10471</span>&#160;            ++nextAlloc1stIndex;</div>
+<div class="line"><a name="l10472"></a><span class="lineno">10472</span>&#160;        }</div>
+<div class="line"><a name="l10473"></a><span class="lineno">10473</span>&#160;        <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10474"></a><span class="lineno">10474</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10475"></a><span class="lineno">10475</span>&#160;        {</div>
+<div class="line"><a name="l10476"></a><span class="lineno">10476</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; size)</div>
+<div class="line"><a name="l10477"></a><span class="lineno">10477</span>&#160;            {</div>
+<div class="line"><a name="l10478"></a><span class="lineno">10478</span>&#160;                <span class="comment">// There is free space from lastOffset to freeSpace1stTo2ndEnd.</span></div>
+<div class="line"><a name="l10479"></a><span class="lineno">10479</span>&#160;                ++unusedRangeCount;</div>
+<div class="line"><a name="l10480"></a><span class="lineno">10480</span>&#160;            }</div>
+<div class="line"><a name="l10481"></a><span class="lineno">10481</span>&#160; </div>
+<div class="line"><a name="l10482"></a><span class="lineno">10482</span>&#160;            <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10483"></a><span class="lineno">10483</span>&#160;            lastOffset = freeSpace1stTo2ndEnd;</div>
+<div class="line"><a name="l10484"></a><span class="lineno">10484</span>&#160;        }</div>
+<div class="line"><a name="l10485"></a><span class="lineno">10485</span>&#160;    }</div>
 <div class="line"><a name="l10486"></a><span class="lineno">10486</span>&#160; </div>
-<div class="line"><a name="l10487"></a><span class="lineno">10487</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::CreateAllocationRequest_UpperAddress(</div>
-<div class="line"><a name="l10488"></a><span class="lineno">10488</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l10489"></a><span class="lineno">10489</span>&#160;    uint32_t frameInUseCount,</div>
-<div class="line"><a name="l10490"></a><span class="lineno">10490</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l10491"></a><span class="lineno">10491</span>&#160;    VkDeviceSize allocSize,</div>
-<div class="line"><a name="l10492"></a><span class="lineno">10492</span>&#160;    VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l10493"></a><span class="lineno">10493</span>&#160;    VmaSuballocationType allocType,</div>
-<div class="line"><a name="l10494"></a><span class="lineno">10494</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l10495"></a><span class="lineno">10495</span>&#160;    uint32_t strategy,</div>
-<div class="line"><a name="l10496"></a><span class="lineno">10496</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
-<div class="line"><a name="l10497"></a><span class="lineno">10497</span>&#160;{</div>
-<div class="line"><a name="l10498"></a><span class="lineno">10498</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
-<div class="line"><a name="l10499"></a><span class="lineno">10499</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l10500"></a><span class="lineno">10500</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l10501"></a><span class="lineno">10501</span>&#160; </div>
-<div class="line"><a name="l10502"></a><span class="lineno">10502</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
-<div class="line"><a name="l10503"></a><span class="lineno">10503</span>&#160;    {</div>
-<div class="line"><a name="l10504"></a><span class="lineno">10504</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Trying to use pool with linear algorithm as double stack, while it is already being used as ring buffer.&quot;</span>);</div>
-<div class="line"><a name="l10505"></a><span class="lineno">10505</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10506"></a><span class="lineno">10506</span>&#160;    }</div>
-<div class="line"><a name="l10507"></a><span class="lineno">10507</span>&#160; </div>
-<div class="line"><a name="l10508"></a><span class="lineno">10508</span>&#160;    <span class="comment">// Try to allocate before 2nd.back(), or end of block if 2nd.empty().</span></div>
-<div class="line"><a name="l10509"></a><span class="lineno">10509</span>&#160;    <span class="keywordflow">if</span>(allocSize &gt; size)</div>
-<div class="line"><a name="l10510"></a><span class="lineno">10510</span>&#160;    {</div>
-<div class="line"><a name="l10511"></a><span class="lineno">10511</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10512"></a><span class="lineno">10512</span>&#160;    }</div>
-<div class="line"><a name="l10513"></a><span class="lineno">10513</span>&#160;    VkDeviceSize resultBaseOffset = size - allocSize;</div>
-<div class="line"><a name="l10514"></a><span class="lineno">10514</span>&#160;    <span class="keywordflow">if</span>(!suballocations2nd.empty())</div>
-<div class="line"><a name="l10515"></a><span class="lineno">10515</span>&#160;    {</div>
-<div class="line"><a name="l10516"></a><span class="lineno">10516</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc = suballocations2nd.back();</div>
-<div class="line"><a name="l10517"></a><span class="lineno">10517</span>&#160;        resultBaseOffset = lastSuballoc.offset - allocSize;</div>
-<div class="line"><a name="l10518"></a><span class="lineno">10518</span>&#160;        <span class="keywordflow">if</span>(allocSize &gt; lastSuballoc.offset)</div>
-<div class="line"><a name="l10519"></a><span class="lineno">10519</span>&#160;        {</div>
-<div class="line"><a name="l10520"></a><span class="lineno">10520</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10521"></a><span class="lineno">10521</span>&#160;        }</div>
-<div class="line"><a name="l10522"></a><span class="lineno">10522</span>&#160;    }</div>
-<div class="line"><a name="l10523"></a><span class="lineno">10523</span>&#160; </div>
-<div class="line"><a name="l10524"></a><span class="lineno">10524</span>&#160;    <span class="comment">// Start from offset equal to end of free space.</span></div>
-<div class="line"><a name="l10525"></a><span class="lineno">10525</span>&#160;    VkDeviceSize resultOffset = resultBaseOffset;</div>
-<div class="line"><a name="l10526"></a><span class="lineno">10526</span>&#160; </div>
-<div class="line"><a name="l10527"></a><span class="lineno">10527</span>&#160;    <span class="comment">// Apply VMA_DEBUG_MARGIN at the end.</span></div>
-<div class="line"><a name="l10528"></a><span class="lineno">10528</span>&#160;    <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN &gt; 0)</div>
-<div class="line"><a name="l10529"></a><span class="lineno">10529</span>&#160;    {</div>
-<div class="line"><a name="l10530"></a><span class="lineno">10530</span>&#160;        <span class="keywordflow">if</span>(resultOffset &lt; VMA_DEBUG_MARGIN)</div>
-<div class="line"><a name="l10531"></a><span class="lineno">10531</span>&#160;        {</div>
-<div class="line"><a name="l10532"></a><span class="lineno">10532</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10533"></a><span class="lineno">10533</span>&#160;        }</div>
-<div class="line"><a name="l10534"></a><span class="lineno">10534</span>&#160;        resultOffset -= VMA_DEBUG_MARGIN;</div>
-<div class="line"><a name="l10535"></a><span class="lineno">10535</span>&#160;    }</div>
-<div class="line"><a name="l10536"></a><span class="lineno">10536</span>&#160; </div>
-<div class="line"><a name="l10537"></a><span class="lineno">10537</span>&#160;    <span class="comment">// Apply alignment.</span></div>
-<div class="line"><a name="l10538"></a><span class="lineno">10538</span>&#160;    resultOffset = VmaAlignDown(resultOffset, allocAlignment);</div>
-<div class="line"><a name="l10539"></a><span class="lineno">10539</span>&#160; </div>
-<div class="line"><a name="l10540"></a><span class="lineno">10540</span>&#160;    <span class="comment">// Check next suballocations from 2nd for BufferImageGranularity conflicts.</span></div>
-<div class="line"><a name="l10541"></a><span class="lineno">10541</span>&#160;    <span class="comment">// Make bigger alignment if necessary.</span></div>
-<div class="line"><a name="l10542"></a><span class="lineno">10542</span>&#160;    <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1 &amp;&amp; !suballocations2nd.empty())</div>
-<div class="line"><a name="l10543"></a><span class="lineno">10543</span>&#160;    {</div>
-<div class="line"><a name="l10544"></a><span class="lineno">10544</span>&#160;        <span class="keywordtype">bool</span> bufferImageGranularityConflict = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10545"></a><span class="lineno">10545</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> nextSuballocIndex = suballocations2nd.size(); nextSuballocIndex--; )</div>
+<div class="line"><a name="l10487"></a><span class="lineno">10487</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
+<div class="line"><a name="l10488"></a><span class="lineno">10488</span>&#160;    {</div>
+<div class="line"><a name="l10489"></a><span class="lineno">10489</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = suballocations2nd.size() - 1;</div>
+<div class="line"><a name="l10490"></a><span class="lineno">10490</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; size)</div>
+<div class="line"><a name="l10491"></a><span class="lineno">10491</span>&#160;        {</div>
+<div class="line"><a name="l10492"></a><span class="lineno">10492</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
+<div class="line"><a name="l10493"></a><span class="lineno">10493</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex != SIZE_MAX &amp;&amp;</div>
+<div class="line"><a name="l10494"></a><span class="lineno">10494</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10495"></a><span class="lineno">10495</span>&#160;            {</div>
+<div class="line"><a name="l10496"></a><span class="lineno">10496</span>&#160;                --nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10497"></a><span class="lineno">10497</span>&#160;            }</div>
+<div class="line"><a name="l10498"></a><span class="lineno">10498</span>&#160; </div>
+<div class="line"><a name="l10499"></a><span class="lineno">10499</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10500"></a><span class="lineno">10500</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex != SIZE_MAX)</div>
+<div class="line"><a name="l10501"></a><span class="lineno">10501</span>&#160;            {</div>
+<div class="line"><a name="l10502"></a><span class="lineno">10502</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
+<div class="line"><a name="l10503"></a><span class="lineno">10503</span>&#160;            </div>
+<div class="line"><a name="l10504"></a><span class="lineno">10504</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10505"></a><span class="lineno">10505</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10506"></a><span class="lineno">10506</span>&#160;                {</div>
+<div class="line"><a name="l10507"></a><span class="lineno">10507</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10508"></a><span class="lineno">10508</span>&#160;                    ++unusedRangeCount;</div>
+<div class="line"><a name="l10509"></a><span class="lineno">10509</span>&#160;                }</div>
+<div class="line"><a name="l10510"></a><span class="lineno">10510</span>&#160;            </div>
+<div class="line"><a name="l10511"></a><span class="lineno">10511</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10512"></a><span class="lineno">10512</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10513"></a><span class="lineno">10513</span>&#160;                ++alloc2ndCount;</div>
+<div class="line"><a name="l10514"></a><span class="lineno">10514</span>&#160;                usedBytes += suballoc.size;</div>
+<div class="line"><a name="l10515"></a><span class="lineno">10515</span>&#160;            </div>
+<div class="line"><a name="l10516"></a><span class="lineno">10516</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10517"></a><span class="lineno">10517</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10518"></a><span class="lineno">10518</span>&#160;                --nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10519"></a><span class="lineno">10519</span>&#160;            }</div>
+<div class="line"><a name="l10520"></a><span class="lineno">10520</span>&#160;            <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10521"></a><span class="lineno">10521</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10522"></a><span class="lineno">10522</span>&#160;            {</div>
+<div class="line"><a name="l10523"></a><span class="lineno">10523</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; size)</div>
+<div class="line"><a name="l10524"></a><span class="lineno">10524</span>&#160;                {</div>
+<div class="line"><a name="l10525"></a><span class="lineno">10525</span>&#160;                    <span class="comment">// There is free space from lastOffset to size.</span></div>
+<div class="line"><a name="l10526"></a><span class="lineno">10526</span>&#160;                    ++unusedRangeCount;</div>
+<div class="line"><a name="l10527"></a><span class="lineno">10527</span>&#160;                }</div>
+<div class="line"><a name="l10528"></a><span class="lineno">10528</span>&#160; </div>
+<div class="line"><a name="l10529"></a><span class="lineno">10529</span>&#160;                <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10530"></a><span class="lineno">10530</span>&#160;                lastOffset = size;</div>
+<div class="line"><a name="l10531"></a><span class="lineno">10531</span>&#160;            }</div>
+<div class="line"><a name="l10532"></a><span class="lineno">10532</span>&#160;        }</div>
+<div class="line"><a name="l10533"></a><span class="lineno">10533</span>&#160;    }</div>
+<div class="line"><a name="l10534"></a><span class="lineno">10534</span>&#160; </div>
+<div class="line"><a name="l10535"></a><span class="lineno">10535</span>&#160;    <span class="keyword">const</span> VkDeviceSize unusedBytes = size - usedBytes;</div>
+<div class="line"><a name="l10536"></a><span class="lineno">10536</span>&#160;    PrintDetailedMap_Begin(json, unusedBytes, alloc1stCount + alloc2ndCount, unusedRangeCount);</div>
+<div class="line"><a name="l10537"></a><span class="lineno">10537</span>&#160; </div>
+<div class="line"><a name="l10538"></a><span class="lineno">10538</span>&#160;    <span class="comment">// SECOND PASS</span></div>
+<div class="line"><a name="l10539"></a><span class="lineno">10539</span>&#160;    lastOffset = 0;</div>
+<div class="line"><a name="l10540"></a><span class="lineno">10540</span>&#160; </div>
+<div class="line"><a name="l10541"></a><span class="lineno">10541</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
+<div class="line"><a name="l10542"></a><span class="lineno">10542</span>&#160;    {</div>
+<div class="line"><a name="l10543"></a><span class="lineno">10543</span>&#160;        <span class="keyword">const</span> VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;</div>
+<div class="line"><a name="l10544"></a><span class="lineno">10544</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = 0;</div>
+<div class="line"><a name="l10545"></a><span class="lineno">10545</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
 <div class="line"><a name="l10546"></a><span class="lineno">10546</span>&#160;        {</div>
-<div class="line"><a name="l10547"></a><span class="lineno">10547</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; nextSuballoc = suballocations2nd[nextSuballocIndex];</div>
-<div class="line"><a name="l10548"></a><span class="lineno">10548</span>&#160;            <span class="keywordflow">if</span>(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))</div>
-<div class="line"><a name="l10549"></a><span class="lineno">10549</span>&#160;            {</div>
-<div class="line"><a name="l10550"></a><span class="lineno">10550</span>&#160;                <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(nextSuballoc.type, allocType))</div>
-<div class="line"><a name="l10551"></a><span class="lineno">10551</span>&#160;                {</div>
-<div class="line"><a name="l10552"></a><span class="lineno">10552</span>&#160;                    bufferImageGranularityConflict = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l10553"></a><span class="lineno">10553</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l10554"></a><span class="lineno">10554</span>&#160;                }</div>
-<div class="line"><a name="l10555"></a><span class="lineno">10555</span>&#160;            }</div>
-<div class="line"><a name="l10556"></a><span class="lineno">10556</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10557"></a><span class="lineno">10557</span>&#160;                <span class="comment">// Already on previous page.</span></div>
-<div class="line"><a name="l10558"></a><span class="lineno">10558</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l10559"></a><span class="lineno">10559</span>&#160;        }</div>
-<div class="line"><a name="l10560"></a><span class="lineno">10560</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularityConflict)</div>
-<div class="line"><a name="l10561"></a><span class="lineno">10561</span>&#160;        {</div>
-<div class="line"><a name="l10562"></a><span class="lineno">10562</span>&#160;            resultOffset = VmaAlignDown(resultOffset, bufferImageGranularity);</div>
-<div class="line"><a name="l10563"></a><span class="lineno">10563</span>&#160;        }</div>
-<div class="line"><a name="l10564"></a><span class="lineno">10564</span>&#160;    }</div>
-<div class="line"><a name="l10565"></a><span class="lineno">10565</span>&#160; </div>
-<div class="line"><a name="l10566"></a><span class="lineno">10566</span>&#160;    <span class="comment">// There is enough free space.</span></div>
-<div class="line"><a name="l10567"></a><span class="lineno">10567</span>&#160;    <span class="keyword">const</span> VkDeviceSize endOf1st = !suballocations1st.empty() ?</div>
-<div class="line"><a name="l10568"></a><span class="lineno">10568</span>&#160;        suballocations1st.back().offset + suballocations1st.back().size :</div>
-<div class="line"><a name="l10569"></a><span class="lineno">10569</span>&#160;        0;</div>
-<div class="line"><a name="l10570"></a><span class="lineno">10570</span>&#160;    <span class="keywordflow">if</span>(endOf1st + VMA_DEBUG_MARGIN &lt;= resultOffset)</div>
-<div class="line"><a name="l10571"></a><span class="lineno">10571</span>&#160;    {</div>
-<div class="line"><a name="l10572"></a><span class="lineno">10572</span>&#160;        <span class="comment">// Check previous suballocations for BufferImageGranularity conflicts.</span></div>
-<div class="line"><a name="l10573"></a><span class="lineno">10573</span>&#160;        <span class="comment">// If conflict exists, allocation cannot be made here.</span></div>
-<div class="line"><a name="l10574"></a><span class="lineno">10574</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
-<div class="line"><a name="l10575"></a><span class="lineno">10575</span>&#160;        {</div>
-<div class="line"><a name="l10576"></a><span class="lineno">10576</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> prevSuballocIndex = suballocations1st.size(); prevSuballocIndex--; )</div>
+<div class="line"><a name="l10547"></a><span class="lineno">10547</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
+<div class="line"><a name="l10548"></a><span class="lineno">10548</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex &lt; suballoc2ndCount &amp;&amp;</div>
+<div class="line"><a name="l10549"></a><span class="lineno">10549</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10550"></a><span class="lineno">10550</span>&#160;            {</div>
+<div class="line"><a name="l10551"></a><span class="lineno">10551</span>&#160;                ++nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10552"></a><span class="lineno">10552</span>&#160;            }</div>
+<div class="line"><a name="l10553"></a><span class="lineno">10553</span>&#160; </div>
+<div class="line"><a name="l10554"></a><span class="lineno">10554</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10555"></a><span class="lineno">10555</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex &lt; suballoc2ndCount)</div>
+<div class="line"><a name="l10556"></a><span class="lineno">10556</span>&#160;            {</div>
+<div class="line"><a name="l10557"></a><span class="lineno">10557</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
+<div class="line"><a name="l10558"></a><span class="lineno">10558</span>&#160;            </div>
+<div class="line"><a name="l10559"></a><span class="lineno">10559</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10560"></a><span class="lineno">10560</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10561"></a><span class="lineno">10561</span>&#160;                {</div>
+<div class="line"><a name="l10562"></a><span class="lineno">10562</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10563"></a><span class="lineno">10563</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
+<div class="line"><a name="l10564"></a><span class="lineno">10564</span>&#160;                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
+<div class="line"><a name="l10565"></a><span class="lineno">10565</span>&#160;                }</div>
+<div class="line"><a name="l10566"></a><span class="lineno">10566</span>&#160;            </div>
+<div class="line"><a name="l10567"></a><span class="lineno">10567</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10568"></a><span class="lineno">10568</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10569"></a><span class="lineno">10569</span>&#160;                PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);</div>
+<div class="line"><a name="l10570"></a><span class="lineno">10570</span>&#160;            </div>
+<div class="line"><a name="l10571"></a><span class="lineno">10571</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10572"></a><span class="lineno">10572</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10573"></a><span class="lineno">10573</span>&#160;                ++nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10574"></a><span class="lineno">10574</span>&#160;            }</div>
+<div class="line"><a name="l10575"></a><span class="lineno">10575</span>&#160;            <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10576"></a><span class="lineno">10576</span>&#160;            <span class="keywordflow">else</span></div>
 <div class="line"><a name="l10577"></a><span class="lineno">10577</span>&#160;            {</div>
-<div class="line"><a name="l10578"></a><span class="lineno">10578</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; prevSuballoc = suballocations1st[prevSuballocIndex];</div>
-<div class="line"><a name="l10579"></a><span class="lineno">10579</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))</div>
-<div class="line"><a name="l10580"></a><span class="lineno">10580</span>&#160;                {</div>
-<div class="line"><a name="l10581"></a><span class="lineno">10581</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(allocType, prevSuballoc.type))</div>
-<div class="line"><a name="l10582"></a><span class="lineno">10582</span>&#160;                    {</div>
-<div class="line"><a name="l10583"></a><span class="lineno">10583</span>&#160;                        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10584"></a><span class="lineno">10584</span>&#160;                    }</div>
-<div class="line"><a name="l10585"></a><span class="lineno">10585</span>&#160;                }</div>
-<div class="line"><a name="l10586"></a><span class="lineno">10586</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10587"></a><span class="lineno">10587</span>&#160;                {</div>
-<div class="line"><a name="l10588"></a><span class="lineno">10588</span>&#160;                    <span class="comment">// Already on next page.</span></div>
-<div class="line"><a name="l10589"></a><span class="lineno">10589</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l10590"></a><span class="lineno">10590</span>&#160;                }</div>
-<div class="line"><a name="l10591"></a><span class="lineno">10591</span>&#160;            }</div>
-<div class="line"><a name="l10592"></a><span class="lineno">10592</span>&#160;        }</div>
-<div class="line"><a name="l10593"></a><span class="lineno">10593</span>&#160; </div>
-<div class="line"><a name="l10594"></a><span class="lineno">10594</span>&#160;        <span class="comment">// All tests passed: Success.</span></div>
-<div class="line"><a name="l10595"></a><span class="lineno">10595</span>&#160;        pAllocationRequest-&gt;offset = resultOffset;</div>
-<div class="line"><a name="l10596"></a><span class="lineno">10596</span>&#160;        pAllocationRequest-&gt;sumFreeSize = resultBaseOffset + allocSize - endOf1st;</div>
-<div class="line"><a name="l10597"></a><span class="lineno">10597</span>&#160;        pAllocationRequest-&gt;sumItemSize = 0;</div>
-<div class="line"><a name="l10598"></a><span class="lineno">10598</span>&#160;        <span class="comment">// pAllocationRequest-&gt;item unused.</span></div>
-<div class="line"><a name="l10599"></a><span class="lineno">10599</span>&#160;        pAllocationRequest-&gt;itemsToMakeLostCount = 0;</div>
-<div class="line"><a name="l10600"></a><span class="lineno">10600</span>&#160;        pAllocationRequest-&gt;type = VmaAllocationRequestType::UpperAddress;</div>
-<div class="line"><a name="l10601"></a><span class="lineno">10601</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l10602"></a><span class="lineno">10602</span>&#160;    }</div>
-<div class="line"><a name="l10603"></a><span class="lineno">10603</span>&#160; </div>
-<div class="line"><a name="l10604"></a><span class="lineno">10604</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10605"></a><span class="lineno">10605</span>&#160;}</div>
-<div class="line"><a name="l10606"></a><span class="lineno">10606</span>&#160; </div>
-<div class="line"><a name="l10607"></a><span class="lineno">10607</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::CreateAllocationRequest_LowerAddress(</div>
-<div class="line"><a name="l10608"></a><span class="lineno">10608</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l10609"></a><span class="lineno">10609</span>&#160;    uint32_t frameInUseCount,</div>
-<div class="line"><a name="l10610"></a><span class="lineno">10610</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l10611"></a><span class="lineno">10611</span>&#160;    VkDeviceSize allocSize,</div>
-<div class="line"><a name="l10612"></a><span class="lineno">10612</span>&#160;    VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l10613"></a><span class="lineno">10613</span>&#160;    VmaSuballocationType allocType,</div>
-<div class="line"><a name="l10614"></a><span class="lineno">10614</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l10615"></a><span class="lineno">10615</span>&#160;    uint32_t strategy,</div>
-<div class="line"><a name="l10616"></a><span class="lineno">10616</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
-<div class="line"><a name="l10617"></a><span class="lineno">10617</span>&#160;{</div>
-<div class="line"><a name="l10618"></a><span class="lineno">10618</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
-<div class="line"><a name="l10619"></a><span class="lineno">10619</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l10620"></a><span class="lineno">10620</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l10621"></a><span class="lineno">10621</span>&#160; </div>
-<div class="line"><a name="l10622"></a><span class="lineno">10622</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
-<div class="line"><a name="l10623"></a><span class="lineno">10623</span>&#160;    {</div>
-<div class="line"><a name="l10624"></a><span class="lineno">10624</span>&#160;        <span class="comment">// Try to allocate at the end of 1st vector.</span></div>
-<div class="line"><a name="l10625"></a><span class="lineno">10625</span>&#160; </div>
-<div class="line"><a name="l10626"></a><span class="lineno">10626</span>&#160;        VkDeviceSize resultBaseOffset = 0;</div>
-<div class="line"><a name="l10627"></a><span class="lineno">10627</span>&#160;        <span class="keywordflow">if</span>(!suballocations1st.empty())</div>
-<div class="line"><a name="l10628"></a><span class="lineno">10628</span>&#160;        {</div>
-<div class="line"><a name="l10629"></a><span class="lineno">10629</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc = suballocations1st.back();</div>
-<div class="line"><a name="l10630"></a><span class="lineno">10630</span>&#160;            resultBaseOffset = lastSuballoc.offset + lastSuballoc.size;</div>
-<div class="line"><a name="l10631"></a><span class="lineno">10631</span>&#160;        }</div>
-<div class="line"><a name="l10632"></a><span class="lineno">10632</span>&#160; </div>
-<div class="line"><a name="l10633"></a><span class="lineno">10633</span>&#160;        <span class="comment">// Start from offset equal to beginning of free space.</span></div>
-<div class="line"><a name="l10634"></a><span class="lineno">10634</span>&#160;        VkDeviceSize resultOffset = resultBaseOffset;</div>
-<div class="line"><a name="l10635"></a><span class="lineno">10635</span>&#160; </div>
-<div class="line"><a name="l10636"></a><span class="lineno">10636</span>&#160;        <span class="comment">// Apply VMA_DEBUG_MARGIN at the beginning.</span></div>
-<div class="line"><a name="l10637"></a><span class="lineno">10637</span>&#160;        <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN &gt; 0)</div>
-<div class="line"><a name="l10638"></a><span class="lineno">10638</span>&#160;        {</div>
-<div class="line"><a name="l10639"></a><span class="lineno">10639</span>&#160;            resultOffset += VMA_DEBUG_MARGIN;</div>
-<div class="line"><a name="l10640"></a><span class="lineno">10640</span>&#160;        }</div>
-<div class="line"><a name="l10641"></a><span class="lineno">10641</span>&#160; </div>
-<div class="line"><a name="l10642"></a><span class="lineno">10642</span>&#160;        <span class="comment">// Apply alignment.</span></div>
-<div class="line"><a name="l10643"></a><span class="lineno">10643</span>&#160;        resultOffset = VmaAlignUp(resultOffset, allocAlignment);</div>
-<div class="line"><a name="l10644"></a><span class="lineno">10644</span>&#160; </div>
-<div class="line"><a name="l10645"></a><span class="lineno">10645</span>&#160;        <span class="comment">// Check previous suballocations for BufferImageGranularity conflicts.</span></div>
-<div class="line"><a name="l10646"></a><span class="lineno">10646</span>&#160;        <span class="comment">// Make bigger alignment if necessary.</span></div>
-<div class="line"><a name="l10647"></a><span class="lineno">10647</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1 &amp;&amp; !suballocations1st.empty())</div>
-<div class="line"><a name="l10648"></a><span class="lineno">10648</span>&#160;        {</div>
-<div class="line"><a name="l10649"></a><span class="lineno">10649</span>&#160;            <span class="keywordtype">bool</span> bufferImageGranularityConflict = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10650"></a><span class="lineno">10650</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> prevSuballocIndex = suballocations1st.size(); prevSuballocIndex--; )</div>
+<div class="line"><a name="l10578"></a><span class="lineno">10578</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; freeSpace2ndTo1stEnd)</div>
+<div class="line"><a name="l10579"></a><span class="lineno">10579</span>&#160;                {</div>
+<div class="line"><a name="l10580"></a><span class="lineno">10580</span>&#160;                    <span class="comment">// There is free space from lastOffset to freeSpace2ndTo1stEnd.</span></div>
+<div class="line"><a name="l10581"></a><span class="lineno">10581</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;</div>
+<div class="line"><a name="l10582"></a><span class="lineno">10582</span>&#160;                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
+<div class="line"><a name="l10583"></a><span class="lineno">10583</span>&#160;                }</div>
+<div class="line"><a name="l10584"></a><span class="lineno">10584</span>&#160; </div>
+<div class="line"><a name="l10585"></a><span class="lineno">10585</span>&#160;                <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10586"></a><span class="lineno">10586</span>&#160;                lastOffset = freeSpace2ndTo1stEnd;</div>
+<div class="line"><a name="l10587"></a><span class="lineno">10587</span>&#160;            }</div>
+<div class="line"><a name="l10588"></a><span class="lineno">10588</span>&#160;        }</div>
+<div class="line"><a name="l10589"></a><span class="lineno">10589</span>&#160;    }</div>
+<div class="line"><a name="l10590"></a><span class="lineno">10590</span>&#160; </div>
+<div class="line"><a name="l10591"></a><span class="lineno">10591</span>&#160;    nextAlloc1stIndex = m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l10592"></a><span class="lineno">10592</span>&#160;    <span class="keywordflow">while</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
+<div class="line"><a name="l10593"></a><span class="lineno">10593</span>&#160;    {</div>
+<div class="line"><a name="l10594"></a><span class="lineno">10594</span>&#160;        <span class="comment">// Find next non-null allocation or move nextAllocIndex to the end.</span></div>
+<div class="line"><a name="l10595"></a><span class="lineno">10595</span>&#160;        <span class="keywordflow">while</span>(nextAlloc1stIndex &lt; suballoc1stCount &amp;&amp;</div>
+<div class="line"><a name="l10596"></a><span class="lineno">10596</span>&#160;            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10597"></a><span class="lineno">10597</span>&#160;        {</div>
+<div class="line"><a name="l10598"></a><span class="lineno">10598</span>&#160;            ++nextAlloc1stIndex;</div>
+<div class="line"><a name="l10599"></a><span class="lineno">10599</span>&#160;        }</div>
+<div class="line"><a name="l10600"></a><span class="lineno">10600</span>&#160; </div>
+<div class="line"><a name="l10601"></a><span class="lineno">10601</span>&#160;        <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10602"></a><span class="lineno">10602</span>&#160;        <span class="keywordflow">if</span>(nextAlloc1stIndex &lt; suballoc1stCount)</div>
+<div class="line"><a name="l10603"></a><span class="lineno">10603</span>&#160;        {</div>
+<div class="line"><a name="l10604"></a><span class="lineno">10604</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[nextAlloc1stIndex];</div>
+<div class="line"><a name="l10605"></a><span class="lineno">10605</span>&#160;            </div>
+<div class="line"><a name="l10606"></a><span class="lineno">10606</span>&#160;            <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10607"></a><span class="lineno">10607</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10608"></a><span class="lineno">10608</span>&#160;            {</div>
+<div class="line"><a name="l10609"></a><span class="lineno">10609</span>&#160;                <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10610"></a><span class="lineno">10610</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
+<div class="line"><a name="l10611"></a><span class="lineno">10611</span>&#160;                PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
+<div class="line"><a name="l10612"></a><span class="lineno">10612</span>&#160;            }</div>
+<div class="line"><a name="l10613"></a><span class="lineno">10613</span>&#160;            </div>
+<div class="line"><a name="l10614"></a><span class="lineno">10614</span>&#160;            <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10615"></a><span class="lineno">10615</span>&#160;            <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10616"></a><span class="lineno">10616</span>&#160;            PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);</div>
+<div class="line"><a name="l10617"></a><span class="lineno">10617</span>&#160;            </div>
+<div class="line"><a name="l10618"></a><span class="lineno">10618</span>&#160;            <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10619"></a><span class="lineno">10619</span>&#160;            lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10620"></a><span class="lineno">10620</span>&#160;            ++nextAlloc1stIndex;</div>
+<div class="line"><a name="l10621"></a><span class="lineno">10621</span>&#160;        }</div>
+<div class="line"><a name="l10622"></a><span class="lineno">10622</span>&#160;        <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10623"></a><span class="lineno">10623</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10624"></a><span class="lineno">10624</span>&#160;        {</div>
+<div class="line"><a name="l10625"></a><span class="lineno">10625</span>&#160;            <span class="keywordflow">if</span>(lastOffset &lt; freeSpace1stTo2ndEnd)</div>
+<div class="line"><a name="l10626"></a><span class="lineno">10626</span>&#160;            {</div>
+<div class="line"><a name="l10627"></a><span class="lineno">10627</span>&#160;                <span class="comment">// There is free space from lastOffset to freeSpace1stTo2ndEnd.</span></div>
+<div class="line"><a name="l10628"></a><span class="lineno">10628</span>&#160;                <span class="keyword">const</span> VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;</div>
+<div class="line"><a name="l10629"></a><span class="lineno">10629</span>&#160;                PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
+<div class="line"><a name="l10630"></a><span class="lineno">10630</span>&#160;            }</div>
+<div class="line"><a name="l10631"></a><span class="lineno">10631</span>&#160; </div>
+<div class="line"><a name="l10632"></a><span class="lineno">10632</span>&#160;            <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10633"></a><span class="lineno">10633</span>&#160;            lastOffset = freeSpace1stTo2ndEnd;</div>
+<div class="line"><a name="l10634"></a><span class="lineno">10634</span>&#160;        }</div>
+<div class="line"><a name="l10635"></a><span class="lineno">10635</span>&#160;    }</div>
+<div class="line"><a name="l10636"></a><span class="lineno">10636</span>&#160; </div>
+<div class="line"><a name="l10637"></a><span class="lineno">10637</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
+<div class="line"><a name="l10638"></a><span class="lineno">10638</span>&#160;    {</div>
+<div class="line"><a name="l10639"></a><span class="lineno">10639</span>&#160;        <span class="keywordtype">size_t</span> nextAlloc2ndIndex = suballocations2nd.size() - 1;</div>
+<div class="line"><a name="l10640"></a><span class="lineno">10640</span>&#160;        <span class="keywordflow">while</span>(lastOffset &lt; size)</div>
+<div class="line"><a name="l10641"></a><span class="lineno">10641</span>&#160;        {</div>
+<div class="line"><a name="l10642"></a><span class="lineno">10642</span>&#160;            <span class="comment">// Find next non-null allocation or move nextAlloc2ndIndex to the end.</span></div>
+<div class="line"><a name="l10643"></a><span class="lineno">10643</span>&#160;            <span class="keywordflow">while</span>(nextAlloc2ndIndex != SIZE_MAX &amp;&amp;</div>
+<div class="line"><a name="l10644"></a><span class="lineno">10644</span>&#160;                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l10645"></a><span class="lineno">10645</span>&#160;            {</div>
+<div class="line"><a name="l10646"></a><span class="lineno">10646</span>&#160;                --nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10647"></a><span class="lineno">10647</span>&#160;            }</div>
+<div class="line"><a name="l10648"></a><span class="lineno">10648</span>&#160; </div>
+<div class="line"><a name="l10649"></a><span class="lineno">10649</span>&#160;            <span class="comment">// Found non-null allocation.</span></div>
+<div class="line"><a name="l10650"></a><span class="lineno">10650</span>&#160;            <span class="keywordflow">if</span>(nextAlloc2ndIndex != SIZE_MAX)</div>
 <div class="line"><a name="l10651"></a><span class="lineno">10651</span>&#160;            {</div>
-<div class="line"><a name="l10652"></a><span class="lineno">10652</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; prevSuballoc = suballocations1st[prevSuballocIndex];</div>
-<div class="line"><a name="l10653"></a><span class="lineno">10653</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))</div>
-<div class="line"><a name="l10654"></a><span class="lineno">10654</span>&#160;                {</div>
-<div class="line"><a name="l10655"></a><span class="lineno">10655</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))</div>
-<div class="line"><a name="l10656"></a><span class="lineno">10656</span>&#160;                    {</div>
-<div class="line"><a name="l10657"></a><span class="lineno">10657</span>&#160;                        bufferImageGranularityConflict = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l10658"></a><span class="lineno">10658</span>&#160;                        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l10659"></a><span class="lineno">10659</span>&#160;                    }</div>
+<div class="line"><a name="l10652"></a><span class="lineno">10652</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[nextAlloc2ndIndex];</div>
+<div class="line"><a name="l10653"></a><span class="lineno">10653</span>&#160;            </div>
+<div class="line"><a name="l10654"></a><span class="lineno">10654</span>&#160;                <span class="comment">// 1. Process free space before this allocation.</span></div>
+<div class="line"><a name="l10655"></a><span class="lineno">10655</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; suballoc.offset)</div>
+<div class="line"><a name="l10656"></a><span class="lineno">10656</span>&#160;                {</div>
+<div class="line"><a name="l10657"></a><span class="lineno">10657</span>&#160;                    <span class="comment">// There is free space from lastOffset to suballoc.offset.</span></div>
+<div class="line"><a name="l10658"></a><span class="lineno">10658</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;</div>
+<div class="line"><a name="l10659"></a><span class="lineno">10659</span>&#160;                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
 <div class="line"><a name="l10660"></a><span class="lineno">10660</span>&#160;                }</div>
-<div class="line"><a name="l10661"></a><span class="lineno">10661</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10662"></a><span class="lineno">10662</span>&#160;                    <span class="comment">// Already on previous page.</span></div>
-<div class="line"><a name="l10663"></a><span class="lineno">10663</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l10664"></a><span class="lineno">10664</span>&#160;            }</div>
-<div class="line"><a name="l10665"></a><span class="lineno">10665</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularityConflict)</div>
-<div class="line"><a name="l10666"></a><span class="lineno">10666</span>&#160;            {</div>
-<div class="line"><a name="l10667"></a><span class="lineno">10667</span>&#160;                resultOffset = VmaAlignUp(resultOffset, bufferImageGranularity);</div>
-<div class="line"><a name="l10668"></a><span class="lineno">10668</span>&#160;            }</div>
-<div class="line"><a name="l10669"></a><span class="lineno">10669</span>&#160;        }</div>
-<div class="line"><a name="l10670"></a><span class="lineno">10670</span>&#160; </div>
-<div class="line"><a name="l10671"></a><span class="lineno">10671</span>&#160;        <span class="keyword">const</span> VkDeviceSize freeSpaceEnd = m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ?</div>
-<div class="line"><a name="l10672"></a><span class="lineno">10672</span>&#160;            suballocations2nd.back().offset : size;</div>
-<div class="line"><a name="l10673"></a><span class="lineno">10673</span>&#160; </div>
-<div class="line"><a name="l10674"></a><span class="lineno">10674</span>&#160;        <span class="comment">// There is enough free space at the end after alignment.</span></div>
-<div class="line"><a name="l10675"></a><span class="lineno">10675</span>&#160;        <span class="keywordflow">if</span>(resultOffset + allocSize + VMA_DEBUG_MARGIN &lt;= freeSpaceEnd)</div>
-<div class="line"><a name="l10676"></a><span class="lineno">10676</span>&#160;        {</div>
-<div class="line"><a name="l10677"></a><span class="lineno">10677</span>&#160;            <span class="comment">// Check next suballocations for BufferImageGranularity conflicts.</span></div>
-<div class="line"><a name="l10678"></a><span class="lineno">10678</span>&#160;            <span class="comment">// If conflict exists, allocation cannot be made here.</span></div>
-<div class="line"><a name="l10679"></a><span class="lineno">10679</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1 &amp;&amp; m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
-<div class="line"><a name="l10680"></a><span class="lineno">10680</span>&#160;            {</div>
-<div class="line"><a name="l10681"></a><span class="lineno">10681</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> nextSuballocIndex = suballocations2nd.size(); nextSuballocIndex--; )</div>
-<div class="line"><a name="l10682"></a><span class="lineno">10682</span>&#160;                {</div>
-<div class="line"><a name="l10683"></a><span class="lineno">10683</span>&#160;                    <span class="keyword">const</span> VmaSuballocation&amp; nextSuballoc = suballocations2nd[nextSuballocIndex];</div>
-<div class="line"><a name="l10684"></a><span class="lineno">10684</span>&#160;                    <span class="keywordflow">if</span>(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))</div>
-<div class="line"><a name="l10685"></a><span class="lineno">10685</span>&#160;                    {</div>
-<div class="line"><a name="l10686"></a><span class="lineno">10686</span>&#160;                        <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))</div>
-<div class="line"><a name="l10687"></a><span class="lineno">10687</span>&#160;                        {</div>
-<div class="line"><a name="l10688"></a><span class="lineno">10688</span>&#160;                            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10689"></a><span class="lineno">10689</span>&#160;                        }</div>
-<div class="line"><a name="l10690"></a><span class="lineno">10690</span>&#160;                    }</div>
-<div class="line"><a name="l10691"></a><span class="lineno">10691</span>&#160;                    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10692"></a><span class="lineno">10692</span>&#160;                    {</div>
-<div class="line"><a name="l10693"></a><span class="lineno">10693</span>&#160;                        <span class="comment">// Already on previous page.</span></div>
-<div class="line"><a name="l10694"></a><span class="lineno">10694</span>&#160;                        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l10695"></a><span class="lineno">10695</span>&#160;                    }</div>
-<div class="line"><a name="l10696"></a><span class="lineno">10696</span>&#160;                }</div>
-<div class="line"><a name="l10697"></a><span class="lineno">10697</span>&#160;            }</div>
-<div class="line"><a name="l10698"></a><span class="lineno">10698</span>&#160; </div>
-<div class="line"><a name="l10699"></a><span class="lineno">10699</span>&#160;            <span class="comment">// All tests passed: Success.</span></div>
-<div class="line"><a name="l10700"></a><span class="lineno">10700</span>&#160;            pAllocationRequest-&gt;offset = resultOffset;</div>
-<div class="line"><a name="l10701"></a><span class="lineno">10701</span>&#160;            pAllocationRequest-&gt;sumFreeSize = freeSpaceEnd - resultBaseOffset;</div>
-<div class="line"><a name="l10702"></a><span class="lineno">10702</span>&#160;            pAllocationRequest-&gt;sumItemSize = 0;</div>
-<div class="line"><a name="l10703"></a><span class="lineno">10703</span>&#160;            <span class="comment">// pAllocationRequest-&gt;item, customData unused.</span></div>
-<div class="line"><a name="l10704"></a><span class="lineno">10704</span>&#160;            pAllocationRequest-&gt;type = VmaAllocationRequestType::EndOf1st;</div>
-<div class="line"><a name="l10705"></a><span class="lineno">10705</span>&#160;            pAllocationRequest-&gt;itemsToMakeLostCount = 0;</div>
-<div class="line"><a name="l10706"></a><span class="lineno">10706</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l10707"></a><span class="lineno">10707</span>&#160;        }</div>
-<div class="line"><a name="l10708"></a><span class="lineno">10708</span>&#160;    }</div>
-<div class="line"><a name="l10709"></a><span class="lineno">10709</span>&#160; </div>
-<div class="line"><a name="l10710"></a><span class="lineno">10710</span>&#160;    <span class="comment">// Wrap-around to end of 2nd vector. Try to allocate there, watching for the</span></div>
-<div class="line"><a name="l10711"></a><span class="lineno">10711</span>&#160;    <span class="comment">// beginning of 1st vector as the end of free space.</span></div>
-<div class="line"><a name="l10712"></a><span class="lineno">10712</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
-<div class="line"><a name="l10713"></a><span class="lineno">10713</span>&#160;    {</div>
-<div class="line"><a name="l10714"></a><span class="lineno">10714</span>&#160;        VMA_ASSERT(!suballocations1st.empty());</div>
-<div class="line"><a name="l10715"></a><span class="lineno">10715</span>&#160; </div>
-<div class="line"><a name="l10716"></a><span class="lineno">10716</span>&#160;        VkDeviceSize resultBaseOffset = 0;</div>
-<div class="line"><a name="l10717"></a><span class="lineno">10717</span>&#160;        <span class="keywordflow">if</span>(!suballocations2nd.empty())</div>
-<div class="line"><a name="l10718"></a><span class="lineno">10718</span>&#160;        {</div>
-<div class="line"><a name="l10719"></a><span class="lineno">10719</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc = suballocations2nd.back();</div>
-<div class="line"><a name="l10720"></a><span class="lineno">10720</span>&#160;            resultBaseOffset = lastSuballoc.offset + lastSuballoc.size;</div>
-<div class="line"><a name="l10721"></a><span class="lineno">10721</span>&#160;        }</div>
-<div class="line"><a name="l10722"></a><span class="lineno">10722</span>&#160; </div>
-<div class="line"><a name="l10723"></a><span class="lineno">10723</span>&#160;        <span class="comment">// Start from offset equal to beginning of free space.</span></div>
-<div class="line"><a name="l10724"></a><span class="lineno">10724</span>&#160;        VkDeviceSize resultOffset = resultBaseOffset;</div>
-<div class="line"><a name="l10725"></a><span class="lineno">10725</span>&#160; </div>
-<div class="line"><a name="l10726"></a><span class="lineno">10726</span>&#160;        <span class="comment">// Apply VMA_DEBUG_MARGIN at the beginning.</span></div>
-<div class="line"><a name="l10727"></a><span class="lineno">10727</span>&#160;        <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN &gt; 0)</div>
-<div class="line"><a name="l10728"></a><span class="lineno">10728</span>&#160;        {</div>
-<div class="line"><a name="l10729"></a><span class="lineno">10729</span>&#160;            resultOffset += VMA_DEBUG_MARGIN;</div>
-<div class="line"><a name="l10730"></a><span class="lineno">10730</span>&#160;        }</div>
-<div class="line"><a name="l10731"></a><span class="lineno">10731</span>&#160; </div>
-<div class="line"><a name="l10732"></a><span class="lineno">10732</span>&#160;        <span class="comment">// Apply alignment.</span></div>
-<div class="line"><a name="l10733"></a><span class="lineno">10733</span>&#160;        resultOffset = VmaAlignUp(resultOffset, allocAlignment);</div>
-<div class="line"><a name="l10734"></a><span class="lineno">10734</span>&#160; </div>
-<div class="line"><a name="l10735"></a><span class="lineno">10735</span>&#160;        <span class="comment">// Check previous suballocations for BufferImageGranularity conflicts.</span></div>
-<div class="line"><a name="l10736"></a><span class="lineno">10736</span>&#160;        <span class="comment">// Make bigger alignment if necessary.</span></div>
-<div class="line"><a name="l10737"></a><span class="lineno">10737</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1 &amp;&amp; !suballocations2nd.empty())</div>
-<div class="line"><a name="l10738"></a><span class="lineno">10738</span>&#160;        {</div>
-<div class="line"><a name="l10739"></a><span class="lineno">10739</span>&#160;            <span class="keywordtype">bool</span> bufferImageGranularityConflict = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10740"></a><span class="lineno">10740</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> prevSuballocIndex = suballocations2nd.size(); prevSuballocIndex--; )</div>
-<div class="line"><a name="l10741"></a><span class="lineno">10741</span>&#160;            {</div>
-<div class="line"><a name="l10742"></a><span class="lineno">10742</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; prevSuballoc = suballocations2nd[prevSuballocIndex];</div>
-<div class="line"><a name="l10743"></a><span class="lineno">10743</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))</div>
-<div class="line"><a name="l10744"></a><span class="lineno">10744</span>&#160;                {</div>
-<div class="line"><a name="l10745"></a><span class="lineno">10745</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))</div>
-<div class="line"><a name="l10746"></a><span class="lineno">10746</span>&#160;                    {</div>
-<div class="line"><a name="l10747"></a><span class="lineno">10747</span>&#160;                        bufferImageGranularityConflict = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l10748"></a><span class="lineno">10748</span>&#160;                        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l10749"></a><span class="lineno">10749</span>&#160;                    }</div>
-<div class="line"><a name="l10750"></a><span class="lineno">10750</span>&#160;                }</div>
-<div class="line"><a name="l10751"></a><span class="lineno">10751</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10752"></a><span class="lineno">10752</span>&#160;                    <span class="comment">// Already on previous page.</span></div>
-<div class="line"><a name="l10753"></a><span class="lineno">10753</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l10754"></a><span class="lineno">10754</span>&#160;            }</div>
-<div class="line"><a name="l10755"></a><span class="lineno">10755</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularityConflict)</div>
-<div class="line"><a name="l10756"></a><span class="lineno">10756</span>&#160;            {</div>
-<div class="line"><a name="l10757"></a><span class="lineno">10757</span>&#160;                resultOffset = VmaAlignUp(resultOffset, bufferImageGranularity);</div>
-<div class="line"><a name="l10758"></a><span class="lineno">10758</span>&#160;            }</div>
-<div class="line"><a name="l10759"></a><span class="lineno">10759</span>&#160;        }</div>
-<div class="line"><a name="l10760"></a><span class="lineno">10760</span>&#160; </div>
-<div class="line"><a name="l10761"></a><span class="lineno">10761</span>&#160;        pAllocationRequest-&gt;itemsToMakeLostCount = 0;</div>
-<div class="line"><a name="l10762"></a><span class="lineno">10762</span>&#160;        pAllocationRequest-&gt;sumItemSize = 0;</div>
-<div class="line"><a name="l10763"></a><span class="lineno">10763</span>&#160;        <span class="keywordtype">size_t</span> index1st = m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l10661"></a><span class="lineno">10661</span>&#160;            </div>
+<div class="line"><a name="l10662"></a><span class="lineno">10662</span>&#160;                <span class="comment">// 2. Process this allocation.</span></div>
+<div class="line"><a name="l10663"></a><span class="lineno">10663</span>&#160;                <span class="comment">// There is allocation with suballoc.offset, suballoc.size.</span></div>
+<div class="line"><a name="l10664"></a><span class="lineno">10664</span>&#160;                PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);</div>
+<div class="line"><a name="l10665"></a><span class="lineno">10665</span>&#160;            </div>
+<div class="line"><a name="l10666"></a><span class="lineno">10666</span>&#160;                <span class="comment">// 3. Prepare for next iteration.</span></div>
+<div class="line"><a name="l10667"></a><span class="lineno">10667</span>&#160;                lastOffset = suballoc.offset + suballoc.size;</div>
+<div class="line"><a name="l10668"></a><span class="lineno">10668</span>&#160;                --nextAlloc2ndIndex;</div>
+<div class="line"><a name="l10669"></a><span class="lineno">10669</span>&#160;            }</div>
+<div class="line"><a name="l10670"></a><span class="lineno">10670</span>&#160;            <span class="comment">// We are at the end.</span></div>
+<div class="line"><a name="l10671"></a><span class="lineno">10671</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10672"></a><span class="lineno">10672</span>&#160;            {</div>
+<div class="line"><a name="l10673"></a><span class="lineno">10673</span>&#160;                <span class="keywordflow">if</span>(lastOffset &lt; size)</div>
+<div class="line"><a name="l10674"></a><span class="lineno">10674</span>&#160;                {</div>
+<div class="line"><a name="l10675"></a><span class="lineno">10675</span>&#160;                    <span class="comment">// There is free space from lastOffset to size.</span></div>
+<div class="line"><a name="l10676"></a><span class="lineno">10676</span>&#160;                    <span class="keyword">const</span> VkDeviceSize unusedRangeSize = size - lastOffset;</div>
+<div class="line"><a name="l10677"></a><span class="lineno">10677</span>&#160;                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);</div>
+<div class="line"><a name="l10678"></a><span class="lineno">10678</span>&#160;                }</div>
+<div class="line"><a name="l10679"></a><span class="lineno">10679</span>&#160; </div>
+<div class="line"><a name="l10680"></a><span class="lineno">10680</span>&#160;                <span class="comment">// End of loop.</span></div>
+<div class="line"><a name="l10681"></a><span class="lineno">10681</span>&#160;                lastOffset = size;</div>
+<div class="line"><a name="l10682"></a><span class="lineno">10682</span>&#160;            }</div>
+<div class="line"><a name="l10683"></a><span class="lineno">10683</span>&#160;        }</div>
+<div class="line"><a name="l10684"></a><span class="lineno">10684</span>&#160;    }</div>
+<div class="line"><a name="l10685"></a><span class="lineno">10685</span>&#160; </div>
+<div class="line"><a name="l10686"></a><span class="lineno">10686</span>&#160;    PrintDetailedMap_End(json);</div>
+<div class="line"><a name="l10687"></a><span class="lineno">10687</span>&#160;}</div>
+<div class="line"><a name="l10688"></a><span class="lineno">10688</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l10689"></a><span class="lineno">10689</span>&#160; </div>
+<div class="line"><a name="l10690"></a><span class="lineno">10690</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::CreateAllocationRequest(</div>
+<div class="line"><a name="l10691"></a><span class="lineno">10691</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l10692"></a><span class="lineno">10692</span>&#160;    uint32_t frameInUseCount,</div>
+<div class="line"><a name="l10693"></a><span class="lineno">10693</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l10694"></a><span class="lineno">10694</span>&#160;    VkDeviceSize allocSize,</div>
+<div class="line"><a name="l10695"></a><span class="lineno">10695</span>&#160;    VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l10696"></a><span class="lineno">10696</span>&#160;    <span class="keywordtype">bool</span> upperAddress,</div>
+<div class="line"><a name="l10697"></a><span class="lineno">10697</span>&#160;    VmaSuballocationType allocType,</div>
+<div class="line"><a name="l10698"></a><span class="lineno">10698</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l10699"></a><span class="lineno">10699</span>&#160;    uint32_t strategy,</div>
+<div class="line"><a name="l10700"></a><span class="lineno">10700</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
+<div class="line"><a name="l10701"></a><span class="lineno">10701</span>&#160;{</div>
+<div class="line"><a name="l10702"></a><span class="lineno">10702</span>&#160;    VMA_ASSERT(allocSize &gt; 0);</div>
+<div class="line"><a name="l10703"></a><span class="lineno">10703</span>&#160;    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l10704"></a><span class="lineno">10704</span>&#160;    VMA_ASSERT(pAllocationRequest != VMA_NULL);</div>
+<div class="line"><a name="l10705"></a><span class="lineno">10705</span>&#160;    VMA_HEAVY_ASSERT(Validate());</div>
+<div class="line"><a name="l10706"></a><span class="lineno">10706</span>&#160;    <span class="keywordflow">return</span> upperAddress ?</div>
+<div class="line"><a name="l10707"></a><span class="lineno">10707</span>&#160;        CreateAllocationRequest_UpperAddress(</div>
+<div class="line"><a name="l10708"></a><span class="lineno">10708</span>&#160;            currentFrameIndex, frameInUseCount, bufferImageGranularity,</div>
+<div class="line"><a name="l10709"></a><span class="lineno">10709</span>&#160;            allocSize, allocAlignment, allocType, canMakeOtherLost, strategy, pAllocationRequest) :</div>
+<div class="line"><a name="l10710"></a><span class="lineno">10710</span>&#160;        CreateAllocationRequest_LowerAddress(</div>
+<div class="line"><a name="l10711"></a><span class="lineno">10711</span>&#160;            currentFrameIndex, frameInUseCount, bufferImageGranularity,</div>
+<div class="line"><a name="l10712"></a><span class="lineno">10712</span>&#160;            allocSize, allocAlignment, allocType, canMakeOtherLost, strategy, pAllocationRequest);</div>
+<div class="line"><a name="l10713"></a><span class="lineno">10713</span>&#160;}</div>
+<div class="line"><a name="l10714"></a><span class="lineno">10714</span>&#160; </div>
+<div class="line"><a name="l10715"></a><span class="lineno">10715</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::CreateAllocationRequest_UpperAddress(</div>
+<div class="line"><a name="l10716"></a><span class="lineno">10716</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l10717"></a><span class="lineno">10717</span>&#160;    uint32_t frameInUseCount,</div>
+<div class="line"><a name="l10718"></a><span class="lineno">10718</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l10719"></a><span class="lineno">10719</span>&#160;    VkDeviceSize allocSize,</div>
+<div class="line"><a name="l10720"></a><span class="lineno">10720</span>&#160;    VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l10721"></a><span class="lineno">10721</span>&#160;    VmaSuballocationType allocType,</div>
+<div class="line"><a name="l10722"></a><span class="lineno">10722</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l10723"></a><span class="lineno">10723</span>&#160;    uint32_t strategy,</div>
+<div class="line"><a name="l10724"></a><span class="lineno">10724</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
+<div class="line"><a name="l10725"></a><span class="lineno">10725</span>&#160;{</div>
+<div class="line"><a name="l10726"></a><span class="lineno">10726</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
+<div class="line"><a name="l10727"></a><span class="lineno">10727</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l10728"></a><span class="lineno">10728</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l10729"></a><span class="lineno">10729</span>&#160; </div>
+<div class="line"><a name="l10730"></a><span class="lineno">10730</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
+<div class="line"><a name="l10731"></a><span class="lineno">10731</span>&#160;    {</div>
+<div class="line"><a name="l10732"></a><span class="lineno">10732</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Trying to use pool with linear algorithm as double stack, while it is already being used as ring buffer.&quot;</span>);</div>
+<div class="line"><a name="l10733"></a><span class="lineno">10733</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l10734"></a><span class="lineno">10734</span>&#160;    }</div>
+<div class="line"><a name="l10735"></a><span class="lineno">10735</span>&#160; </div>
+<div class="line"><a name="l10736"></a><span class="lineno">10736</span>&#160;    <span class="comment">// Try to allocate before 2nd.back(), or end of block if 2nd.empty().</span></div>
+<div class="line"><a name="l10737"></a><span class="lineno">10737</span>&#160;    <span class="keywordflow">if</span>(allocSize &gt; size)</div>
+<div class="line"><a name="l10738"></a><span class="lineno">10738</span>&#160;    {</div>
+<div class="line"><a name="l10739"></a><span class="lineno">10739</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l10740"></a><span class="lineno">10740</span>&#160;    }</div>
+<div class="line"><a name="l10741"></a><span class="lineno">10741</span>&#160;    VkDeviceSize resultBaseOffset = size - allocSize;</div>
+<div class="line"><a name="l10742"></a><span class="lineno">10742</span>&#160;    <span class="keywordflow">if</span>(!suballocations2nd.empty())</div>
+<div class="line"><a name="l10743"></a><span class="lineno">10743</span>&#160;    {</div>
+<div class="line"><a name="l10744"></a><span class="lineno">10744</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc = suballocations2nd.back();</div>
+<div class="line"><a name="l10745"></a><span class="lineno">10745</span>&#160;        resultBaseOffset = lastSuballoc.offset - allocSize;</div>
+<div class="line"><a name="l10746"></a><span class="lineno">10746</span>&#160;        <span class="keywordflow">if</span>(allocSize &gt; lastSuballoc.offset)</div>
+<div class="line"><a name="l10747"></a><span class="lineno">10747</span>&#160;        {</div>
+<div class="line"><a name="l10748"></a><span class="lineno">10748</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l10749"></a><span class="lineno">10749</span>&#160;        }</div>
+<div class="line"><a name="l10750"></a><span class="lineno">10750</span>&#160;    }</div>
+<div class="line"><a name="l10751"></a><span class="lineno">10751</span>&#160; </div>
+<div class="line"><a name="l10752"></a><span class="lineno">10752</span>&#160;    <span class="comment">// Start from offset equal to end of free space.</span></div>
+<div class="line"><a name="l10753"></a><span class="lineno">10753</span>&#160;    VkDeviceSize resultOffset = resultBaseOffset;</div>
+<div class="line"><a name="l10754"></a><span class="lineno">10754</span>&#160; </div>
+<div class="line"><a name="l10755"></a><span class="lineno">10755</span>&#160;    <span class="comment">// Apply VMA_DEBUG_MARGIN at the end.</span></div>
+<div class="line"><a name="l10756"></a><span class="lineno">10756</span>&#160;    <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN &gt; 0)</div>
+<div class="line"><a name="l10757"></a><span class="lineno">10757</span>&#160;    {</div>
+<div class="line"><a name="l10758"></a><span class="lineno">10758</span>&#160;        <span class="keywordflow">if</span>(resultOffset &lt; VMA_DEBUG_MARGIN)</div>
+<div class="line"><a name="l10759"></a><span class="lineno">10759</span>&#160;        {</div>
+<div class="line"><a name="l10760"></a><span class="lineno">10760</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l10761"></a><span class="lineno">10761</span>&#160;        }</div>
+<div class="line"><a name="l10762"></a><span class="lineno">10762</span>&#160;        resultOffset -= VMA_DEBUG_MARGIN;</div>
+<div class="line"><a name="l10763"></a><span class="lineno">10763</span>&#160;    }</div>
 <div class="line"><a name="l10764"></a><span class="lineno">10764</span>&#160; </div>
-<div class="line"><a name="l10765"></a><span class="lineno">10765</span>&#160;        <span class="keywordflow">if</span>(canMakeOtherLost)</div>
-<div class="line"><a name="l10766"></a><span class="lineno">10766</span>&#160;        {</div>
-<div class="line"><a name="l10767"></a><span class="lineno">10767</span>&#160;            <span class="keywordflow">while</span>(index1st &lt; suballocations1st.size() &amp;&amp;</div>
-<div class="line"><a name="l10768"></a><span class="lineno">10768</span>&#160;                resultOffset + allocSize + VMA_DEBUG_MARGIN &gt; suballocations1st[index1st].offset)</div>
-<div class="line"><a name="l10769"></a><span class="lineno">10769</span>&#160;            {</div>
-<div class="line"><a name="l10770"></a><span class="lineno">10770</span>&#160;                <span class="comment">// Next colliding allocation at the beginning of 1st vector found. Try to make it lost.</span></div>
-<div class="line"><a name="l10771"></a><span class="lineno">10771</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[index1st];</div>
-<div class="line"><a name="l10772"></a><span class="lineno">10772</span>&#160;                <span class="keywordflow">if</span>(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l10773"></a><span class="lineno">10773</span>&#160;                {</div>
-<div class="line"><a name="l10774"></a><span class="lineno">10774</span>&#160;                    <span class="comment">// No problem.</span></div>
-<div class="line"><a name="l10775"></a><span class="lineno">10775</span>&#160;                }</div>
-<div class="line"><a name="l10776"></a><span class="lineno">10776</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10777"></a><span class="lineno">10777</span>&#160;                {</div>
-<div class="line"><a name="l10778"></a><span class="lineno">10778</span>&#160;                    VMA_ASSERT(suballoc.hAllocation != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l10779"></a><span class="lineno">10779</span>&#160;                    <span class="keywordflow">if</span>(suballoc.hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
-<div class="line"><a name="l10780"></a><span class="lineno">10780</span>&#160;                        suballoc.hAllocation-&gt;GetLastUseFrameIndex() + frameInUseCount &lt; currentFrameIndex)</div>
-<div class="line"><a name="l10781"></a><span class="lineno">10781</span>&#160;                    {</div>
-<div class="line"><a name="l10782"></a><span class="lineno">10782</span>&#160;                        ++pAllocationRequest-&gt;itemsToMakeLostCount;</div>
-<div class="line"><a name="l10783"></a><span class="lineno">10783</span>&#160;                        pAllocationRequest-&gt;sumItemSize += suballoc.size;</div>
-<div class="line"><a name="l10784"></a><span class="lineno">10784</span>&#160;                    }</div>
-<div class="line"><a name="l10785"></a><span class="lineno">10785</span>&#160;                    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10786"></a><span class="lineno">10786</span>&#160;                    {</div>
-<div class="line"><a name="l10787"></a><span class="lineno">10787</span>&#160;                        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10788"></a><span class="lineno">10788</span>&#160;                    }</div>
-<div class="line"><a name="l10789"></a><span class="lineno">10789</span>&#160;                }</div>
-<div class="line"><a name="l10790"></a><span class="lineno">10790</span>&#160;                ++index1st;</div>
-<div class="line"><a name="l10791"></a><span class="lineno">10791</span>&#160;            }</div>
-<div class="line"><a name="l10792"></a><span class="lineno">10792</span>&#160; </div>
-<div class="line"><a name="l10793"></a><span class="lineno">10793</span>&#160;            <span class="comment">// Check next suballocations for BufferImageGranularity conflicts.</span></div>
-<div class="line"><a name="l10794"></a><span class="lineno">10794</span>&#160;            <span class="comment">// If conflict exists, we must mark more allocations lost or fail.</span></div>
-<div class="line"><a name="l10795"></a><span class="lineno">10795</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
-<div class="line"><a name="l10796"></a><span class="lineno">10796</span>&#160;            {</div>
-<div class="line"><a name="l10797"></a><span class="lineno">10797</span>&#160;                <span class="keywordflow">while</span>(index1st &lt; suballocations1st.size())</div>
-<div class="line"><a name="l10798"></a><span class="lineno">10798</span>&#160;                {</div>
-<div class="line"><a name="l10799"></a><span class="lineno">10799</span>&#160;                    <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[index1st];</div>
-<div class="line"><a name="l10800"></a><span class="lineno">10800</span>&#160;                    <span class="keywordflow">if</span>(VmaBlocksOnSamePage(resultOffset, allocSize, suballoc.offset, bufferImageGranularity))</div>
-<div class="line"><a name="l10801"></a><span class="lineno">10801</span>&#160;                    {</div>
-<div class="line"><a name="l10802"></a><span class="lineno">10802</span>&#160;                        <span class="keywordflow">if</span>(suballoc.hAllocation != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l10803"></a><span class="lineno">10803</span>&#160;                        {</div>
-<div class="line"><a name="l10804"></a><span class="lineno">10804</span>&#160;                            <span class="comment">// Not checking actual VmaIsBufferImageGranularityConflict(allocType, suballoc.type).</span></div>
-<div class="line"><a name="l10805"></a><span class="lineno">10805</span>&#160;                            <span class="keywordflow">if</span>(suballoc.hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
-<div class="line"><a name="l10806"></a><span class="lineno">10806</span>&#160;                                suballoc.hAllocation-&gt;GetLastUseFrameIndex() + frameInUseCount &lt; currentFrameIndex)</div>
-<div class="line"><a name="l10807"></a><span class="lineno">10807</span>&#160;                            {</div>
-<div class="line"><a name="l10808"></a><span class="lineno">10808</span>&#160;                                ++pAllocationRequest-&gt;itemsToMakeLostCount;</div>
-<div class="line"><a name="l10809"></a><span class="lineno">10809</span>&#160;                                pAllocationRequest-&gt;sumItemSize += suballoc.size;</div>
-<div class="line"><a name="l10810"></a><span class="lineno">10810</span>&#160;                            }</div>
-<div class="line"><a name="l10811"></a><span class="lineno">10811</span>&#160;                            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10812"></a><span class="lineno">10812</span>&#160;                            {</div>
-<div class="line"><a name="l10813"></a><span class="lineno">10813</span>&#160;                                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10814"></a><span class="lineno">10814</span>&#160;                            }</div>
-<div class="line"><a name="l10815"></a><span class="lineno">10815</span>&#160;                        }</div>
-<div class="line"><a name="l10816"></a><span class="lineno">10816</span>&#160;                    }</div>
-<div class="line"><a name="l10817"></a><span class="lineno">10817</span>&#160;                    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10818"></a><span class="lineno">10818</span>&#160;                    {</div>
-<div class="line"><a name="l10819"></a><span class="lineno">10819</span>&#160;                        <span class="comment">// Already on next page.</span></div>
-<div class="line"><a name="l10820"></a><span class="lineno">10820</span>&#160;                        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l10821"></a><span class="lineno">10821</span>&#160;                    }</div>
-<div class="line"><a name="l10822"></a><span class="lineno">10822</span>&#160;                    ++index1st;</div>
-<div class="line"><a name="l10823"></a><span class="lineno">10823</span>&#160;                }</div>
-<div class="line"><a name="l10824"></a><span class="lineno">10824</span>&#160;            }</div>
-<div class="line"><a name="l10825"></a><span class="lineno">10825</span>&#160; </div>
-<div class="line"><a name="l10826"></a><span class="lineno">10826</span>&#160;            <span class="comment">// Special case: There is not enough room at the end for this allocation, even after making all from the 1st lost.</span></div>
-<div class="line"><a name="l10827"></a><span class="lineno">10827</span>&#160;            <span class="keywordflow">if</span>(index1st == suballocations1st.size() &amp;&amp;</div>
-<div class="line"><a name="l10828"></a><span class="lineno">10828</span>&#160;                resultOffset + allocSize + VMA_DEBUG_MARGIN &gt; size)</div>
-<div class="line"><a name="l10829"></a><span class="lineno">10829</span>&#160;            {</div>
-<div class="line"><a name="l10830"></a><span class="lineno">10830</span>&#160;                <span class="comment">// TODO: This is a known bug that it&#39;s not yet implemented and the allocation is failing.</span></div>
-<div class="line"><a name="l10831"></a><span class="lineno">10831</span>&#160;                VMA_DEBUG_LOG(<span class="stringliteral">&quot;Unsupported special case in custom pool with linear allocation algorithm used as ring buffer with allocations that can be lost.&quot;</span>);</div>
-<div class="line"><a name="l10832"></a><span class="lineno">10832</span>&#160;            }</div>
-<div class="line"><a name="l10833"></a><span class="lineno">10833</span>&#160;        }</div>
+<div class="line"><a name="l10765"></a><span class="lineno">10765</span>&#160;    <span class="comment">// Apply alignment.</span></div>
+<div class="line"><a name="l10766"></a><span class="lineno">10766</span>&#160;    resultOffset = VmaAlignDown(resultOffset, allocAlignment);</div>
+<div class="line"><a name="l10767"></a><span class="lineno">10767</span>&#160; </div>
+<div class="line"><a name="l10768"></a><span class="lineno">10768</span>&#160;    <span class="comment">// Check next suballocations from 2nd for BufferImageGranularity conflicts.</span></div>
+<div class="line"><a name="l10769"></a><span class="lineno">10769</span>&#160;    <span class="comment">// Make bigger alignment if necessary.</span></div>
+<div class="line"><a name="l10770"></a><span class="lineno">10770</span>&#160;    <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1 &amp;&amp; !suballocations2nd.empty())</div>
+<div class="line"><a name="l10771"></a><span class="lineno">10771</span>&#160;    {</div>
+<div class="line"><a name="l10772"></a><span class="lineno">10772</span>&#160;        <span class="keywordtype">bool</span> bufferImageGranularityConflict = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l10773"></a><span class="lineno">10773</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> nextSuballocIndex = suballocations2nd.size(); nextSuballocIndex--; )</div>
+<div class="line"><a name="l10774"></a><span class="lineno">10774</span>&#160;        {</div>
+<div class="line"><a name="l10775"></a><span class="lineno">10775</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; nextSuballoc = suballocations2nd[nextSuballocIndex];</div>
+<div class="line"><a name="l10776"></a><span class="lineno">10776</span>&#160;            <span class="keywordflow">if</span>(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))</div>
+<div class="line"><a name="l10777"></a><span class="lineno">10777</span>&#160;            {</div>
+<div class="line"><a name="l10778"></a><span class="lineno">10778</span>&#160;                <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(nextSuballoc.type, allocType))</div>
+<div class="line"><a name="l10779"></a><span class="lineno">10779</span>&#160;                {</div>
+<div class="line"><a name="l10780"></a><span class="lineno">10780</span>&#160;                    bufferImageGranularityConflict = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l10781"></a><span class="lineno">10781</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l10782"></a><span class="lineno">10782</span>&#160;                }</div>
+<div class="line"><a name="l10783"></a><span class="lineno">10783</span>&#160;            }</div>
+<div class="line"><a name="l10784"></a><span class="lineno">10784</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10785"></a><span class="lineno">10785</span>&#160;                <span class="comment">// Already on previous page.</span></div>
+<div class="line"><a name="l10786"></a><span class="lineno">10786</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l10787"></a><span class="lineno">10787</span>&#160;        }</div>
+<div class="line"><a name="l10788"></a><span class="lineno">10788</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularityConflict)</div>
+<div class="line"><a name="l10789"></a><span class="lineno">10789</span>&#160;        {</div>
+<div class="line"><a name="l10790"></a><span class="lineno">10790</span>&#160;            resultOffset = VmaAlignDown(resultOffset, bufferImageGranularity);</div>
+<div class="line"><a name="l10791"></a><span class="lineno">10791</span>&#160;        }</div>
+<div class="line"><a name="l10792"></a><span class="lineno">10792</span>&#160;    }</div>
+<div class="line"><a name="l10793"></a><span class="lineno">10793</span>&#160; </div>
+<div class="line"><a name="l10794"></a><span class="lineno">10794</span>&#160;    <span class="comment">// There is enough free space.</span></div>
+<div class="line"><a name="l10795"></a><span class="lineno">10795</span>&#160;    <span class="keyword">const</span> VkDeviceSize endOf1st = !suballocations1st.empty() ?</div>
+<div class="line"><a name="l10796"></a><span class="lineno">10796</span>&#160;        suballocations1st.back().offset + suballocations1st.back().size :</div>
+<div class="line"><a name="l10797"></a><span class="lineno">10797</span>&#160;        0;</div>
+<div class="line"><a name="l10798"></a><span class="lineno">10798</span>&#160;    <span class="keywordflow">if</span>(endOf1st + VMA_DEBUG_MARGIN &lt;= resultOffset)</div>
+<div class="line"><a name="l10799"></a><span class="lineno">10799</span>&#160;    {</div>
+<div class="line"><a name="l10800"></a><span class="lineno">10800</span>&#160;        <span class="comment">// Check previous suballocations for BufferImageGranularity conflicts.</span></div>
+<div class="line"><a name="l10801"></a><span class="lineno">10801</span>&#160;        <span class="comment">// If conflict exists, allocation cannot be made here.</span></div>
+<div class="line"><a name="l10802"></a><span class="lineno">10802</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
+<div class="line"><a name="l10803"></a><span class="lineno">10803</span>&#160;        {</div>
+<div class="line"><a name="l10804"></a><span class="lineno">10804</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> prevSuballocIndex = suballocations1st.size(); prevSuballocIndex--; )</div>
+<div class="line"><a name="l10805"></a><span class="lineno">10805</span>&#160;            {</div>
+<div class="line"><a name="l10806"></a><span class="lineno">10806</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; prevSuballoc = suballocations1st[prevSuballocIndex];</div>
+<div class="line"><a name="l10807"></a><span class="lineno">10807</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))</div>
+<div class="line"><a name="l10808"></a><span class="lineno">10808</span>&#160;                {</div>
+<div class="line"><a name="l10809"></a><span class="lineno">10809</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(allocType, prevSuballoc.type))</div>
+<div class="line"><a name="l10810"></a><span class="lineno">10810</span>&#160;                    {</div>
+<div class="line"><a name="l10811"></a><span class="lineno">10811</span>&#160;                        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l10812"></a><span class="lineno">10812</span>&#160;                    }</div>
+<div class="line"><a name="l10813"></a><span class="lineno">10813</span>&#160;                }</div>
+<div class="line"><a name="l10814"></a><span class="lineno">10814</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10815"></a><span class="lineno">10815</span>&#160;                {</div>
+<div class="line"><a name="l10816"></a><span class="lineno">10816</span>&#160;                    <span class="comment">// Already on next page.</span></div>
+<div class="line"><a name="l10817"></a><span class="lineno">10817</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l10818"></a><span class="lineno">10818</span>&#160;                }</div>
+<div class="line"><a name="l10819"></a><span class="lineno">10819</span>&#160;            }</div>
+<div class="line"><a name="l10820"></a><span class="lineno">10820</span>&#160;        }</div>
+<div class="line"><a name="l10821"></a><span class="lineno">10821</span>&#160; </div>
+<div class="line"><a name="l10822"></a><span class="lineno">10822</span>&#160;        <span class="comment">// All tests passed: Success.</span></div>
+<div class="line"><a name="l10823"></a><span class="lineno">10823</span>&#160;        pAllocationRequest-&gt;offset = resultOffset;</div>
+<div class="line"><a name="l10824"></a><span class="lineno">10824</span>&#160;        pAllocationRequest-&gt;sumFreeSize = resultBaseOffset + allocSize - endOf1st;</div>
+<div class="line"><a name="l10825"></a><span class="lineno">10825</span>&#160;        pAllocationRequest-&gt;sumItemSize = 0;</div>
+<div class="line"><a name="l10826"></a><span class="lineno">10826</span>&#160;        <span class="comment">// pAllocationRequest-&gt;item unused.</span></div>
+<div class="line"><a name="l10827"></a><span class="lineno">10827</span>&#160;        pAllocationRequest-&gt;itemsToMakeLostCount = 0;</div>
+<div class="line"><a name="l10828"></a><span class="lineno">10828</span>&#160;        pAllocationRequest-&gt;type = VmaAllocationRequestType::UpperAddress;</div>
+<div class="line"><a name="l10829"></a><span class="lineno">10829</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l10830"></a><span class="lineno">10830</span>&#160;    }</div>
+<div class="line"><a name="l10831"></a><span class="lineno">10831</span>&#160; </div>
+<div class="line"><a name="l10832"></a><span class="lineno">10832</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l10833"></a><span class="lineno">10833</span>&#160;}</div>
 <div class="line"><a name="l10834"></a><span class="lineno">10834</span>&#160; </div>
-<div class="line"><a name="l10835"></a><span class="lineno">10835</span>&#160;        <span class="comment">// There is enough free space at the end after alignment.</span></div>
-<div class="line"><a name="l10836"></a><span class="lineno">10836</span>&#160;        <span class="keywordflow">if</span>((index1st == suballocations1st.size() &amp;&amp; resultOffset + allocSize + VMA_DEBUG_MARGIN &lt;= size) ||</div>
-<div class="line"><a name="l10837"></a><span class="lineno">10837</span>&#160;            (index1st &lt; suballocations1st.size() &amp;&amp; resultOffset + allocSize + VMA_DEBUG_MARGIN &lt;= suballocations1st[index1st].offset))</div>
-<div class="line"><a name="l10838"></a><span class="lineno">10838</span>&#160;        {</div>
-<div class="line"><a name="l10839"></a><span class="lineno">10839</span>&#160;            <span class="comment">// Check next suballocations for BufferImageGranularity conflicts.</span></div>
-<div class="line"><a name="l10840"></a><span class="lineno">10840</span>&#160;            <span class="comment">// If conflict exists, allocation cannot be made here.</span></div>
-<div class="line"><a name="l10841"></a><span class="lineno">10841</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
-<div class="line"><a name="l10842"></a><span class="lineno">10842</span>&#160;            {</div>
-<div class="line"><a name="l10843"></a><span class="lineno">10843</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> nextSuballocIndex = index1st;</div>
-<div class="line"><a name="l10844"></a><span class="lineno">10844</span>&#160;                    nextSuballocIndex &lt; suballocations1st.size();</div>
-<div class="line"><a name="l10845"></a><span class="lineno">10845</span>&#160;                    nextSuballocIndex++)</div>
-<div class="line"><a name="l10846"></a><span class="lineno">10846</span>&#160;                {</div>
-<div class="line"><a name="l10847"></a><span class="lineno">10847</span>&#160;                    <span class="keyword">const</span> VmaSuballocation&amp; nextSuballoc = suballocations1st[nextSuballocIndex];</div>
-<div class="line"><a name="l10848"></a><span class="lineno">10848</span>&#160;                    <span class="keywordflow">if</span>(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))</div>
-<div class="line"><a name="l10849"></a><span class="lineno">10849</span>&#160;                    {</div>
-<div class="line"><a name="l10850"></a><span class="lineno">10850</span>&#160;                        <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))</div>
-<div class="line"><a name="l10851"></a><span class="lineno">10851</span>&#160;                        {</div>
-<div class="line"><a name="l10852"></a><span class="lineno">10852</span>&#160;                            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10853"></a><span class="lineno">10853</span>&#160;                        }</div>
-<div class="line"><a name="l10854"></a><span class="lineno">10854</span>&#160;                    }</div>
-<div class="line"><a name="l10855"></a><span class="lineno">10855</span>&#160;                    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10856"></a><span class="lineno">10856</span>&#160;                    {</div>
-<div class="line"><a name="l10857"></a><span class="lineno">10857</span>&#160;                        <span class="comment">// Already on next page.</span></div>
-<div class="line"><a name="l10858"></a><span class="lineno">10858</span>&#160;                        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l10859"></a><span class="lineno">10859</span>&#160;                    }</div>
-<div class="line"><a name="l10860"></a><span class="lineno">10860</span>&#160;                }</div>
-<div class="line"><a name="l10861"></a><span class="lineno">10861</span>&#160;            }</div>
-<div class="line"><a name="l10862"></a><span class="lineno">10862</span>&#160; </div>
-<div class="line"><a name="l10863"></a><span class="lineno">10863</span>&#160;            <span class="comment">// All tests passed: Success.</span></div>
-<div class="line"><a name="l10864"></a><span class="lineno">10864</span>&#160;            pAllocationRequest-&gt;offset = resultOffset;</div>
-<div class="line"><a name="l10865"></a><span class="lineno">10865</span>&#160;            pAllocationRequest-&gt;sumFreeSize =</div>
-<div class="line"><a name="l10866"></a><span class="lineno">10866</span>&#160;                (index1st &lt; suballocations1st.size() ? suballocations1st[index1st].offset : size)</div>
-<div class="line"><a name="l10867"></a><span class="lineno">10867</span>&#160;                - resultBaseOffset</div>
-<div class="line"><a name="l10868"></a><span class="lineno">10868</span>&#160;                - pAllocationRequest-&gt;sumItemSize;</div>
-<div class="line"><a name="l10869"></a><span class="lineno">10869</span>&#160;            pAllocationRequest-&gt;type = VmaAllocationRequestType::EndOf2nd;</div>
-<div class="line"><a name="l10870"></a><span class="lineno">10870</span>&#160;            <span class="comment">// pAllocationRequest-&gt;item, customData unused.</span></div>
-<div class="line"><a name="l10871"></a><span class="lineno">10871</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l10872"></a><span class="lineno">10872</span>&#160;        }</div>
-<div class="line"><a name="l10873"></a><span class="lineno">10873</span>&#160;    }</div>
-<div class="line"><a name="l10874"></a><span class="lineno">10874</span>&#160; </div>
-<div class="line"><a name="l10875"></a><span class="lineno">10875</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10876"></a><span class="lineno">10876</span>&#160;}</div>
-<div class="line"><a name="l10877"></a><span class="lineno">10877</span>&#160; </div>
-<div class="line"><a name="l10878"></a><span class="lineno">10878</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::MakeRequestedAllocationsLost(</div>
-<div class="line"><a name="l10879"></a><span class="lineno">10879</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l10880"></a><span class="lineno">10880</span>&#160;    uint32_t frameInUseCount,</div>
-<div class="line"><a name="l10881"></a><span class="lineno">10881</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
-<div class="line"><a name="l10882"></a><span class="lineno">10882</span>&#160;{</div>
-<div class="line"><a name="l10883"></a><span class="lineno">10883</span>&#160;    <span class="keywordflow">if</span>(pAllocationRequest-&gt;itemsToMakeLostCount == 0)</div>
-<div class="line"><a name="l10884"></a><span class="lineno">10884</span>&#160;    {</div>
-<div class="line"><a name="l10885"></a><span class="lineno">10885</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l10886"></a><span class="lineno">10886</span>&#160;    }</div>
-<div class="line"><a name="l10887"></a><span class="lineno">10887</span>&#160; </div>
-<div class="line"><a name="l10888"></a><span class="lineno">10888</span>&#160;    VMA_ASSERT(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER);</div>
-<div class="line"><a name="l10889"></a><span class="lineno">10889</span>&#160;    </div>
-<div class="line"><a name="l10890"></a><span class="lineno">10890</span>&#160;    <span class="comment">// We always start from 1st.</span></div>
-<div class="line"><a name="l10891"></a><span class="lineno">10891</span>&#160;    SuballocationVectorType* suballocations = &amp;AccessSuballocations1st();</div>
-<div class="line"><a name="l10892"></a><span class="lineno">10892</span>&#160;    <span class="keywordtype">size_t</span> index = m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l10893"></a><span class="lineno">10893</span>&#160;    <span class="keywordtype">size_t</span> madeLostCount = 0;</div>
-<div class="line"><a name="l10894"></a><span class="lineno">10894</span>&#160;    <span class="keywordflow">while</span>(madeLostCount &lt; pAllocationRequest-&gt;itemsToMakeLostCount)</div>
-<div class="line"><a name="l10895"></a><span class="lineno">10895</span>&#160;    {</div>
-<div class="line"><a name="l10896"></a><span class="lineno">10896</span>&#160;        <span class="keywordflow">if</span>(index == suballocations-&gt;size())</div>
-<div class="line"><a name="l10897"></a><span class="lineno">10897</span>&#160;        {</div>
-<div class="line"><a name="l10898"></a><span class="lineno">10898</span>&#160;            index = 0;</div>
-<div class="line"><a name="l10899"></a><span class="lineno">10899</span>&#160;            <span class="comment">// If we get to the end of 1st, we wrap around to beginning of 2nd of 1st.</span></div>
-<div class="line"><a name="l10900"></a><span class="lineno">10900</span>&#160;            <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
-<div class="line"><a name="l10901"></a><span class="lineno">10901</span>&#160;            {</div>
-<div class="line"><a name="l10902"></a><span class="lineno">10902</span>&#160;                suballocations = &amp;AccessSuballocations2nd();</div>
-<div class="line"><a name="l10903"></a><span class="lineno">10903</span>&#160;            }</div>
-<div class="line"><a name="l10904"></a><span class="lineno">10904</span>&#160;            <span class="comment">// else: m_2ndVectorMode == SECOND_VECTOR_EMPTY:</span></div>
-<div class="line"><a name="l10905"></a><span class="lineno">10905</span>&#160;            <span class="comment">// suballocations continues pointing at AccessSuballocations1st().</span></div>
-<div class="line"><a name="l10906"></a><span class="lineno">10906</span>&#160;            VMA_ASSERT(!suballocations-&gt;empty());</div>
-<div class="line"><a name="l10907"></a><span class="lineno">10907</span>&#160;        }</div>
-<div class="line"><a name="l10908"></a><span class="lineno">10908</span>&#160;        VmaSuballocation&amp; suballoc = (*suballocations)[index];</div>
-<div class="line"><a name="l10909"></a><span class="lineno">10909</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l10910"></a><span class="lineno">10910</span>&#160;        {</div>
-<div class="line"><a name="l10911"></a><span class="lineno">10911</span>&#160;            VMA_ASSERT(suballoc.hAllocation != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l10912"></a><span class="lineno">10912</span>&#160;            VMA_ASSERT(suballoc.hAllocation-&gt;CanBecomeLost());</div>
-<div class="line"><a name="l10913"></a><span class="lineno">10913</span>&#160;            <span class="keywordflow">if</span>(suballoc.hAllocation-&gt;MakeLost(currentFrameIndex, frameInUseCount))</div>
-<div class="line"><a name="l10914"></a><span class="lineno">10914</span>&#160;            {</div>
-<div class="line"><a name="l10915"></a><span class="lineno">10915</span>&#160;                suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
-<div class="line"><a name="l10916"></a><span class="lineno">10916</span>&#160;                suballoc.hAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l10917"></a><span class="lineno">10917</span>&#160;                m_SumFreeSize += suballoc.size;</div>
-<div class="line"><a name="l10918"></a><span class="lineno">10918</span>&#160;                <span class="keywordflow">if</span>(suballocations == &amp;AccessSuballocations1st())</div>
-<div class="line"><a name="l10919"></a><span class="lineno">10919</span>&#160;                {</div>
-<div class="line"><a name="l10920"></a><span class="lineno">10920</span>&#160;                    ++m_1stNullItemsMiddleCount;</div>
-<div class="line"><a name="l10921"></a><span class="lineno">10921</span>&#160;                }</div>
-<div class="line"><a name="l10922"></a><span class="lineno">10922</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10923"></a><span class="lineno">10923</span>&#160;                {</div>
-<div class="line"><a name="l10924"></a><span class="lineno">10924</span>&#160;                    ++m_2ndNullItemsCount;</div>
-<div class="line"><a name="l10925"></a><span class="lineno">10925</span>&#160;                }</div>
-<div class="line"><a name="l10926"></a><span class="lineno">10926</span>&#160;                ++madeLostCount;</div>
-<div class="line"><a name="l10927"></a><span class="lineno">10927</span>&#160;            }</div>
-<div class="line"><a name="l10928"></a><span class="lineno">10928</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l10929"></a><span class="lineno">10929</span>&#160;            {</div>
-<div class="line"><a name="l10930"></a><span class="lineno">10930</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l10931"></a><span class="lineno">10931</span>&#160;            }</div>
-<div class="line"><a name="l10932"></a><span class="lineno">10932</span>&#160;        }</div>
-<div class="line"><a name="l10933"></a><span class="lineno">10933</span>&#160;        ++index;</div>
-<div class="line"><a name="l10934"></a><span class="lineno">10934</span>&#160;    }</div>
-<div class="line"><a name="l10935"></a><span class="lineno">10935</span>&#160; </div>
-<div class="line"><a name="l10936"></a><span class="lineno">10936</span>&#160;    CleanupAfterFree();</div>
-<div class="line"><a name="l10937"></a><span class="lineno">10937</span>&#160;    <span class="comment">//VMA_HEAVY_ASSERT(Validate()); // Already called by ClanupAfterFree().</span></div>
-<div class="line"><a name="l10938"></a><span class="lineno">10938</span>&#160;    </div>
-<div class="line"><a name="l10939"></a><span class="lineno">10939</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l10940"></a><span class="lineno">10940</span>&#160;}</div>
-<div class="line"><a name="l10941"></a><span class="lineno">10941</span>&#160; </div>
-<div class="line"><a name="l10942"></a><span class="lineno">10942</span>&#160;uint32_t VmaBlockMetadata_Linear::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)</div>
-<div class="line"><a name="l10943"></a><span class="lineno">10943</span>&#160;{</div>
-<div class="line"><a name="l10944"></a><span class="lineno">10944</span>&#160;    uint32_t lostAllocationCount = 0;</div>
-<div class="line"><a name="l10945"></a><span class="lineno">10945</span>&#160;    </div>
-<div class="line"><a name="l10946"></a><span class="lineno">10946</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l10947"></a><span class="lineno">10947</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_1stNullItemsBeginCount, count = suballocations1st.size(); i &lt; count; ++i)</div>
-<div class="line"><a name="l10948"></a><span class="lineno">10948</span>&#160;    {</div>
-<div class="line"><a name="l10949"></a><span class="lineno">10949</span>&#160;        VmaSuballocation&amp; suballoc = suballocations1st[i];</div>
-<div class="line"><a name="l10950"></a><span class="lineno">10950</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE &amp;&amp;</div>
-<div class="line"><a name="l10951"></a><span class="lineno">10951</span>&#160;            suballoc.hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
-<div class="line"><a name="l10952"></a><span class="lineno">10952</span>&#160;            suballoc.hAllocation-&gt;MakeLost(currentFrameIndex, frameInUseCount))</div>
-<div class="line"><a name="l10953"></a><span class="lineno">10953</span>&#160;        {</div>
-<div class="line"><a name="l10954"></a><span class="lineno">10954</span>&#160;            suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
-<div class="line"><a name="l10955"></a><span class="lineno">10955</span>&#160;            suballoc.hAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l10956"></a><span class="lineno">10956</span>&#160;            ++m_1stNullItemsMiddleCount;</div>
-<div class="line"><a name="l10957"></a><span class="lineno">10957</span>&#160;            m_SumFreeSize += suballoc.size;</div>
-<div class="line"><a name="l10958"></a><span class="lineno">10958</span>&#160;            ++lostAllocationCount;</div>
-<div class="line"><a name="l10959"></a><span class="lineno">10959</span>&#160;        }</div>
-<div class="line"><a name="l10960"></a><span class="lineno">10960</span>&#160;    }</div>
-<div class="line"><a name="l10961"></a><span class="lineno">10961</span>&#160; </div>
-<div class="line"><a name="l10962"></a><span class="lineno">10962</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l10963"></a><span class="lineno">10963</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0, count = suballocations2nd.size(); i &lt; count; ++i)</div>
-<div class="line"><a name="l10964"></a><span class="lineno">10964</span>&#160;    {</div>
-<div class="line"><a name="l10965"></a><span class="lineno">10965</span>&#160;        VmaSuballocation&amp; suballoc = suballocations2nd[i];</div>
-<div class="line"><a name="l10966"></a><span class="lineno">10966</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE &amp;&amp;</div>
-<div class="line"><a name="l10967"></a><span class="lineno">10967</span>&#160;            suballoc.hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
-<div class="line"><a name="l10968"></a><span class="lineno">10968</span>&#160;            suballoc.hAllocation-&gt;MakeLost(currentFrameIndex, frameInUseCount))</div>
-<div class="line"><a name="l10969"></a><span class="lineno">10969</span>&#160;        {</div>
-<div class="line"><a name="l10970"></a><span class="lineno">10970</span>&#160;            suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
-<div class="line"><a name="l10971"></a><span class="lineno">10971</span>&#160;            suballoc.hAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l10972"></a><span class="lineno">10972</span>&#160;            ++m_2ndNullItemsCount;</div>
-<div class="line"><a name="l10973"></a><span class="lineno">10973</span>&#160;            m_SumFreeSize += suballoc.size;</div>
-<div class="line"><a name="l10974"></a><span class="lineno">10974</span>&#160;            ++lostAllocationCount;</div>
-<div class="line"><a name="l10975"></a><span class="lineno">10975</span>&#160;        }</div>
-<div class="line"><a name="l10976"></a><span class="lineno">10976</span>&#160;    }</div>
-<div class="line"><a name="l10977"></a><span class="lineno">10977</span>&#160; </div>
-<div class="line"><a name="l10978"></a><span class="lineno">10978</span>&#160;    <span class="keywordflow">if</span>(lostAllocationCount)</div>
-<div class="line"><a name="l10979"></a><span class="lineno">10979</span>&#160;    {</div>
-<div class="line"><a name="l10980"></a><span class="lineno">10980</span>&#160;        CleanupAfterFree();</div>
-<div class="line"><a name="l10981"></a><span class="lineno">10981</span>&#160;    }</div>
-<div class="line"><a name="l10982"></a><span class="lineno">10982</span>&#160; </div>
-<div class="line"><a name="l10983"></a><span class="lineno">10983</span>&#160;    <span class="keywordflow">return</span> lostAllocationCount;</div>
-<div class="line"><a name="l10984"></a><span class="lineno">10984</span>&#160;}</div>
-<div class="line"><a name="l10985"></a><span class="lineno">10985</span>&#160; </div>
-<div class="line"><a name="l10986"></a><span class="lineno">10986</span>&#160;VkResult VmaBlockMetadata_Linear::CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData)</div>
-<div class="line"><a name="l10987"></a><span class="lineno">10987</span>&#160;{</div>
-<div class="line"><a name="l10988"></a><span class="lineno">10988</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l10989"></a><span class="lineno">10989</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_1stNullItemsBeginCount, count = suballocations1st.size(); i &lt; count; ++i)</div>
-<div class="line"><a name="l10990"></a><span class="lineno">10990</span>&#160;    {</div>
-<div class="line"><a name="l10991"></a><span class="lineno">10991</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[i];</div>
-<div class="line"><a name="l10992"></a><span class="lineno">10992</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l10993"></a><span class="lineno">10993</span>&#160;        {</div>
-<div class="line"><a name="l10994"></a><span class="lineno">10994</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, suballoc.offset - VMA_DEBUG_MARGIN))</div>
-<div class="line"><a name="l10995"></a><span class="lineno">10995</span>&#160;            {</div>
-<div class="line"><a name="l10996"></a><span class="lineno">10996</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!&quot;</span>);</div>
-<div class="line"><a name="l10997"></a><span class="lineno">10997</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
-<div class="line"><a name="l10998"></a><span class="lineno">10998</span>&#160;            }</div>
-<div class="line"><a name="l10999"></a><span class="lineno">10999</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, suballoc.offset + suballoc.size))</div>
-<div class="line"><a name="l11000"></a><span class="lineno">11000</span>&#160;            {</div>
-<div class="line"><a name="l11001"></a><span class="lineno">11001</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!&quot;</span>);</div>
-<div class="line"><a name="l11002"></a><span class="lineno">11002</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
-<div class="line"><a name="l11003"></a><span class="lineno">11003</span>&#160;            }</div>
-<div class="line"><a name="l11004"></a><span class="lineno">11004</span>&#160;        }</div>
-<div class="line"><a name="l11005"></a><span class="lineno">11005</span>&#160;    }</div>
-<div class="line"><a name="l11006"></a><span class="lineno">11006</span>&#160; </div>
-<div class="line"><a name="l11007"></a><span class="lineno">11007</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l11008"></a><span class="lineno">11008</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0, count = suballocations2nd.size(); i &lt; count; ++i)</div>
-<div class="line"><a name="l11009"></a><span class="lineno">11009</span>&#160;    {</div>
-<div class="line"><a name="l11010"></a><span class="lineno">11010</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[i];</div>
-<div class="line"><a name="l11011"></a><span class="lineno">11011</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l11012"></a><span class="lineno">11012</span>&#160;        {</div>
-<div class="line"><a name="l11013"></a><span class="lineno">11013</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, suballoc.offset - VMA_DEBUG_MARGIN))</div>
-<div class="line"><a name="l11014"></a><span class="lineno">11014</span>&#160;            {</div>
-<div class="line"><a name="l11015"></a><span class="lineno">11015</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!&quot;</span>);</div>
-<div class="line"><a name="l11016"></a><span class="lineno">11016</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
-<div class="line"><a name="l11017"></a><span class="lineno">11017</span>&#160;            }</div>
-<div class="line"><a name="l11018"></a><span class="lineno">11018</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, suballoc.offset + suballoc.size))</div>
-<div class="line"><a name="l11019"></a><span class="lineno">11019</span>&#160;            {</div>
-<div class="line"><a name="l11020"></a><span class="lineno">11020</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!&quot;</span>);</div>
-<div class="line"><a name="l11021"></a><span class="lineno">11021</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
-<div class="line"><a name="l11022"></a><span class="lineno">11022</span>&#160;            }</div>
-<div class="line"><a name="l11023"></a><span class="lineno">11023</span>&#160;        }</div>
-<div class="line"><a name="l11024"></a><span class="lineno">11024</span>&#160;    }</div>
-<div class="line"><a name="l11025"></a><span class="lineno">11025</span>&#160; </div>
-<div class="line"><a name="l11026"></a><span class="lineno">11026</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l11027"></a><span class="lineno">11027</span>&#160;}</div>
-<div class="line"><a name="l11028"></a><span class="lineno">11028</span>&#160; </div>
-<div class="line"><a name="l11029"></a><span class="lineno">11029</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::Alloc(</div>
-<div class="line"><a name="l11030"></a><span class="lineno">11030</span>&#160;    <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
-<div class="line"><a name="l11031"></a><span class="lineno">11031</span>&#160;    VmaSuballocationType type,</div>
-<div class="line"><a name="l11032"></a><span class="lineno">11032</span>&#160;    VkDeviceSize allocSize,</div>
-<div class="line"><a name="l11033"></a><span class="lineno">11033</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
-<div class="line"><a name="l11034"></a><span class="lineno">11034</span>&#160;{</div>
-<div class="line"><a name="l11035"></a><span class="lineno">11035</span>&#160;    <span class="keyword">const</span> VmaSuballocation newSuballoc = { request.offset, allocSize, hAllocation, type };</div>
-<div class="line"><a name="l11036"></a><span class="lineno">11036</span>&#160; </div>
-<div class="line"><a name="l11037"></a><span class="lineno">11037</span>&#160;    <span class="keywordflow">switch</span>(request.type)</div>
-<div class="line"><a name="l11038"></a><span class="lineno">11038</span>&#160;    {</div>
-<div class="line"><a name="l11039"></a><span class="lineno">11039</span>&#160;    <span class="keywordflow">case</span> VmaAllocationRequestType::UpperAddress:</div>
-<div class="line"><a name="l11040"></a><span class="lineno">11040</span>&#160;        {</div>
-<div class="line"><a name="l11041"></a><span class="lineno">11041</span>&#160;            VMA_ASSERT(m_2ndVectorMode != SECOND_VECTOR_RING_BUFFER &amp;&amp;</div>
-<div class="line"><a name="l11042"></a><span class="lineno">11042</span>&#160;                <span class="stringliteral">&quot;CRITICAL ERROR: Trying to use linear allocator as double stack while it was already used as ring buffer.&quot;</span>);</div>
-<div class="line"><a name="l11043"></a><span class="lineno">11043</span>&#160;            SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l11044"></a><span class="lineno">11044</span>&#160;            suballocations2nd.push_back(newSuballoc);</div>
-<div class="line"><a name="l11045"></a><span class="lineno">11045</span>&#160;            m_2ndVectorMode = SECOND_VECTOR_DOUBLE_STACK;</div>
-<div class="line"><a name="l11046"></a><span class="lineno">11046</span>&#160;        }</div>
-<div class="line"><a name="l11047"></a><span class="lineno">11047</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11048"></a><span class="lineno">11048</span>&#160;    <span class="keywordflow">case</span> VmaAllocationRequestType::EndOf1st:</div>
-<div class="line"><a name="l11049"></a><span class="lineno">11049</span>&#160;        {</div>
-<div class="line"><a name="l11050"></a><span class="lineno">11050</span>&#160;            SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l11051"></a><span class="lineno">11051</span>&#160; </div>
-<div class="line"><a name="l11052"></a><span class="lineno">11052</span>&#160;            VMA_ASSERT(suballocations1st.empty() ||</div>
-<div class="line"><a name="l11053"></a><span class="lineno">11053</span>&#160;                request.offset &gt;= suballocations1st.back().offset + suballocations1st.back().size);</div>
-<div class="line"><a name="l11054"></a><span class="lineno">11054</span>&#160;            <span class="comment">// Check if it fits before the end of the block.</span></div>
-<div class="line"><a name="l11055"></a><span class="lineno">11055</span>&#160;            VMA_ASSERT(request.offset + allocSize &lt;= GetSize());</div>
-<div class="line"><a name="l11056"></a><span class="lineno">11056</span>&#160; </div>
-<div class="line"><a name="l11057"></a><span class="lineno">11057</span>&#160;            suballocations1st.push_back(newSuballoc);</div>
-<div class="line"><a name="l11058"></a><span class="lineno">11058</span>&#160;        }</div>
-<div class="line"><a name="l11059"></a><span class="lineno">11059</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11060"></a><span class="lineno">11060</span>&#160;    <span class="keywordflow">case</span> VmaAllocationRequestType::EndOf2nd:</div>
-<div class="line"><a name="l11061"></a><span class="lineno">11061</span>&#160;        {</div>
-<div class="line"><a name="l11062"></a><span class="lineno">11062</span>&#160;            SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l11063"></a><span class="lineno">11063</span>&#160;            <span class="comment">// New allocation at the end of 2-part ring buffer, so before first allocation from 1st vector.</span></div>
-<div class="line"><a name="l11064"></a><span class="lineno">11064</span>&#160;            VMA_ASSERT(!suballocations1st.empty() &amp;&amp;</div>
-<div class="line"><a name="l11065"></a><span class="lineno">11065</span>&#160;                request.offset + allocSize &lt;= suballocations1st[m_1stNullItemsBeginCount].offset);</div>
-<div class="line"><a name="l11066"></a><span class="lineno">11066</span>&#160;            SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l11067"></a><span class="lineno">11067</span>&#160; </div>
-<div class="line"><a name="l11068"></a><span class="lineno">11068</span>&#160;            <span class="keywordflow">switch</span>(m_2ndVectorMode)</div>
-<div class="line"><a name="l11069"></a><span class="lineno">11069</span>&#160;            {</div>
-<div class="line"><a name="l11070"></a><span class="lineno">11070</span>&#160;            <span class="keywordflow">case</span> SECOND_VECTOR_EMPTY:</div>
-<div class="line"><a name="l11071"></a><span class="lineno">11071</span>&#160;                <span class="comment">// First allocation from second part ring buffer.</span></div>
-<div class="line"><a name="l11072"></a><span class="lineno">11072</span>&#160;                VMA_ASSERT(suballocations2nd.empty());</div>
-<div class="line"><a name="l11073"></a><span class="lineno">11073</span>&#160;                m_2ndVectorMode = SECOND_VECTOR_RING_BUFFER;</div>
-<div class="line"><a name="l11074"></a><span class="lineno">11074</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11075"></a><span class="lineno">11075</span>&#160;            <span class="keywordflow">case</span> SECOND_VECTOR_RING_BUFFER:</div>
-<div class="line"><a name="l11076"></a><span class="lineno">11076</span>&#160;                <span class="comment">// 2-part ring buffer is already started.</span></div>
-<div class="line"><a name="l11077"></a><span class="lineno">11077</span>&#160;                VMA_ASSERT(!suballocations2nd.empty());</div>
-<div class="line"><a name="l11078"></a><span class="lineno">11078</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11079"></a><span class="lineno">11079</span>&#160;            <span class="keywordflow">case</span> SECOND_VECTOR_DOUBLE_STACK:</div>
-<div class="line"><a name="l11080"></a><span class="lineno">11080</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;CRITICAL ERROR: Trying to use linear allocator as ring buffer while it was already used as double stack.&quot;</span>);</div>
-<div class="line"><a name="l11081"></a><span class="lineno">11081</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11082"></a><span class="lineno">11082</span>&#160;            <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l11083"></a><span class="lineno">11083</span>&#160;                VMA_ASSERT(0);</div>
-<div class="line"><a name="l11084"></a><span class="lineno">11084</span>&#160;            }</div>
-<div class="line"><a name="l11085"></a><span class="lineno">11085</span>&#160; </div>
-<div class="line"><a name="l11086"></a><span class="lineno">11086</span>&#160;            suballocations2nd.push_back(newSuballoc);</div>
-<div class="line"><a name="l11087"></a><span class="lineno">11087</span>&#160;        }</div>
-<div class="line"><a name="l11088"></a><span class="lineno">11088</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11089"></a><span class="lineno">11089</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l11090"></a><span class="lineno">11090</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;CRITICAL INTERNAL ERROR.&quot;</span>);</div>
-<div class="line"><a name="l11091"></a><span class="lineno">11091</span>&#160;    }</div>
-<div class="line"><a name="l11092"></a><span class="lineno">11092</span>&#160; </div>
-<div class="line"><a name="l11093"></a><span class="lineno">11093</span>&#160;    m_SumFreeSize -= newSuballoc.size;</div>
-<div class="line"><a name="l11094"></a><span class="lineno">11094</span>&#160;}</div>
-<div class="line"><a name="l11095"></a><span class="lineno">11095</span>&#160; </div>
-<div class="line"><a name="l11096"></a><span class="lineno">11096</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l11097"></a><span class="lineno">11097</span>&#160;{</div>
-<div class="line"><a name="l11098"></a><span class="lineno">11098</span>&#160;    FreeAtOffset(allocation-&gt;GetOffset());</div>
-<div class="line"><a name="l11099"></a><span class="lineno">11099</span>&#160;}</div>
-<div class="line"><a name="l11100"></a><span class="lineno">11100</span>&#160; </div>
-<div class="line"><a name="l11101"></a><span class="lineno">11101</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::FreeAtOffset(VkDeviceSize offset)</div>
-<div class="line"><a name="l11102"></a><span class="lineno">11102</span>&#160;{</div>
-<div class="line"><a name="l11103"></a><span class="lineno">11103</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l11104"></a><span class="lineno">11104</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l10835"></a><span class="lineno">10835</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::CreateAllocationRequest_LowerAddress(</div>
+<div class="line"><a name="l10836"></a><span class="lineno">10836</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l10837"></a><span class="lineno">10837</span>&#160;    uint32_t frameInUseCount,</div>
+<div class="line"><a name="l10838"></a><span class="lineno">10838</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l10839"></a><span class="lineno">10839</span>&#160;    VkDeviceSize allocSize,</div>
+<div class="line"><a name="l10840"></a><span class="lineno">10840</span>&#160;    VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l10841"></a><span class="lineno">10841</span>&#160;    VmaSuballocationType allocType,</div>
+<div class="line"><a name="l10842"></a><span class="lineno">10842</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l10843"></a><span class="lineno">10843</span>&#160;    uint32_t strategy,</div>
+<div class="line"><a name="l10844"></a><span class="lineno">10844</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
+<div class="line"><a name="l10845"></a><span class="lineno">10845</span>&#160;{</div>
+<div class="line"><a name="l10846"></a><span class="lineno">10846</span>&#160;    <span class="keyword">const</span> VkDeviceSize size = GetSize();</div>
+<div class="line"><a name="l10847"></a><span class="lineno">10847</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l10848"></a><span class="lineno">10848</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l10849"></a><span class="lineno">10849</span>&#160; </div>
+<div class="line"><a name="l10850"></a><span class="lineno">10850</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
+<div class="line"><a name="l10851"></a><span class="lineno">10851</span>&#160;    {</div>
+<div class="line"><a name="l10852"></a><span class="lineno">10852</span>&#160;        <span class="comment">// Try to allocate at the end of 1st vector.</span></div>
+<div class="line"><a name="l10853"></a><span class="lineno">10853</span>&#160; </div>
+<div class="line"><a name="l10854"></a><span class="lineno">10854</span>&#160;        VkDeviceSize resultBaseOffset = 0;</div>
+<div class="line"><a name="l10855"></a><span class="lineno">10855</span>&#160;        <span class="keywordflow">if</span>(!suballocations1st.empty())</div>
+<div class="line"><a name="l10856"></a><span class="lineno">10856</span>&#160;        {</div>
+<div class="line"><a name="l10857"></a><span class="lineno">10857</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc = suballocations1st.back();</div>
+<div class="line"><a name="l10858"></a><span class="lineno">10858</span>&#160;            resultBaseOffset = lastSuballoc.offset + lastSuballoc.size;</div>
+<div class="line"><a name="l10859"></a><span class="lineno">10859</span>&#160;        }</div>
+<div class="line"><a name="l10860"></a><span class="lineno">10860</span>&#160; </div>
+<div class="line"><a name="l10861"></a><span class="lineno">10861</span>&#160;        <span class="comment">// Start from offset equal to beginning of free space.</span></div>
+<div class="line"><a name="l10862"></a><span class="lineno">10862</span>&#160;        VkDeviceSize resultOffset = resultBaseOffset;</div>
+<div class="line"><a name="l10863"></a><span class="lineno">10863</span>&#160; </div>
+<div class="line"><a name="l10864"></a><span class="lineno">10864</span>&#160;        <span class="comment">// Apply VMA_DEBUG_MARGIN at the beginning.</span></div>
+<div class="line"><a name="l10865"></a><span class="lineno">10865</span>&#160;        <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN &gt; 0)</div>
+<div class="line"><a name="l10866"></a><span class="lineno">10866</span>&#160;        {</div>
+<div class="line"><a name="l10867"></a><span class="lineno">10867</span>&#160;            resultOffset += VMA_DEBUG_MARGIN;</div>
+<div class="line"><a name="l10868"></a><span class="lineno">10868</span>&#160;        }</div>
+<div class="line"><a name="l10869"></a><span class="lineno">10869</span>&#160; </div>
+<div class="line"><a name="l10870"></a><span class="lineno">10870</span>&#160;        <span class="comment">// Apply alignment.</span></div>
+<div class="line"><a name="l10871"></a><span class="lineno">10871</span>&#160;        resultOffset = VmaAlignUp(resultOffset, allocAlignment);</div>
+<div class="line"><a name="l10872"></a><span class="lineno">10872</span>&#160; </div>
+<div class="line"><a name="l10873"></a><span class="lineno">10873</span>&#160;        <span class="comment">// Check previous suballocations for BufferImageGranularity conflicts.</span></div>
+<div class="line"><a name="l10874"></a><span class="lineno">10874</span>&#160;        <span class="comment">// Make bigger alignment if necessary.</span></div>
+<div class="line"><a name="l10875"></a><span class="lineno">10875</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1 &amp;&amp; !suballocations1st.empty())</div>
+<div class="line"><a name="l10876"></a><span class="lineno">10876</span>&#160;        {</div>
+<div class="line"><a name="l10877"></a><span class="lineno">10877</span>&#160;            <span class="keywordtype">bool</span> bufferImageGranularityConflict = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l10878"></a><span class="lineno">10878</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> prevSuballocIndex = suballocations1st.size(); prevSuballocIndex--; )</div>
+<div class="line"><a name="l10879"></a><span class="lineno">10879</span>&#160;            {</div>
+<div class="line"><a name="l10880"></a><span class="lineno">10880</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; prevSuballoc = suballocations1st[prevSuballocIndex];</div>
+<div class="line"><a name="l10881"></a><span class="lineno">10881</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))</div>
+<div class="line"><a name="l10882"></a><span class="lineno">10882</span>&#160;                {</div>
+<div class="line"><a name="l10883"></a><span class="lineno">10883</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))</div>
+<div class="line"><a name="l10884"></a><span class="lineno">10884</span>&#160;                    {</div>
+<div class="line"><a name="l10885"></a><span class="lineno">10885</span>&#160;                        bufferImageGranularityConflict = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l10886"></a><span class="lineno">10886</span>&#160;                        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l10887"></a><span class="lineno">10887</span>&#160;                    }</div>
+<div class="line"><a name="l10888"></a><span class="lineno">10888</span>&#160;                }</div>
+<div class="line"><a name="l10889"></a><span class="lineno">10889</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10890"></a><span class="lineno">10890</span>&#160;                    <span class="comment">// Already on previous page.</span></div>
+<div class="line"><a name="l10891"></a><span class="lineno">10891</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l10892"></a><span class="lineno">10892</span>&#160;            }</div>
+<div class="line"><a name="l10893"></a><span class="lineno">10893</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularityConflict)</div>
+<div class="line"><a name="l10894"></a><span class="lineno">10894</span>&#160;            {</div>
+<div class="line"><a name="l10895"></a><span class="lineno">10895</span>&#160;                resultOffset = VmaAlignUp(resultOffset, bufferImageGranularity);</div>
+<div class="line"><a name="l10896"></a><span class="lineno">10896</span>&#160;            }</div>
+<div class="line"><a name="l10897"></a><span class="lineno">10897</span>&#160;        }</div>
+<div class="line"><a name="l10898"></a><span class="lineno">10898</span>&#160; </div>
+<div class="line"><a name="l10899"></a><span class="lineno">10899</span>&#160;        <span class="keyword">const</span> VkDeviceSize freeSpaceEnd = m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ?</div>
+<div class="line"><a name="l10900"></a><span class="lineno">10900</span>&#160;            suballocations2nd.back().offset : size;</div>
+<div class="line"><a name="l10901"></a><span class="lineno">10901</span>&#160; </div>
+<div class="line"><a name="l10902"></a><span class="lineno">10902</span>&#160;        <span class="comment">// There is enough free space at the end after alignment.</span></div>
+<div class="line"><a name="l10903"></a><span class="lineno">10903</span>&#160;        <span class="keywordflow">if</span>(resultOffset + allocSize + VMA_DEBUG_MARGIN &lt;= freeSpaceEnd)</div>
+<div class="line"><a name="l10904"></a><span class="lineno">10904</span>&#160;        {</div>
+<div class="line"><a name="l10905"></a><span class="lineno">10905</span>&#160;            <span class="comment">// Check next suballocations for BufferImageGranularity conflicts.</span></div>
+<div class="line"><a name="l10906"></a><span class="lineno">10906</span>&#160;            <span class="comment">// If conflict exists, allocation cannot be made here.</span></div>
+<div class="line"><a name="l10907"></a><span class="lineno">10907</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1 &amp;&amp; m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
+<div class="line"><a name="l10908"></a><span class="lineno">10908</span>&#160;            {</div>
+<div class="line"><a name="l10909"></a><span class="lineno">10909</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> nextSuballocIndex = suballocations2nd.size(); nextSuballocIndex--; )</div>
+<div class="line"><a name="l10910"></a><span class="lineno">10910</span>&#160;                {</div>
+<div class="line"><a name="l10911"></a><span class="lineno">10911</span>&#160;                    <span class="keyword">const</span> VmaSuballocation&amp; nextSuballoc = suballocations2nd[nextSuballocIndex];</div>
+<div class="line"><a name="l10912"></a><span class="lineno">10912</span>&#160;                    <span class="keywordflow">if</span>(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))</div>
+<div class="line"><a name="l10913"></a><span class="lineno">10913</span>&#160;                    {</div>
+<div class="line"><a name="l10914"></a><span class="lineno">10914</span>&#160;                        <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))</div>
+<div class="line"><a name="l10915"></a><span class="lineno">10915</span>&#160;                        {</div>
+<div class="line"><a name="l10916"></a><span class="lineno">10916</span>&#160;                            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l10917"></a><span class="lineno">10917</span>&#160;                        }</div>
+<div class="line"><a name="l10918"></a><span class="lineno">10918</span>&#160;                    }</div>
+<div class="line"><a name="l10919"></a><span class="lineno">10919</span>&#160;                    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10920"></a><span class="lineno">10920</span>&#160;                    {</div>
+<div class="line"><a name="l10921"></a><span class="lineno">10921</span>&#160;                        <span class="comment">// Already on previous page.</span></div>
+<div class="line"><a name="l10922"></a><span class="lineno">10922</span>&#160;                        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l10923"></a><span class="lineno">10923</span>&#160;                    }</div>
+<div class="line"><a name="l10924"></a><span class="lineno">10924</span>&#160;                }</div>
+<div class="line"><a name="l10925"></a><span class="lineno">10925</span>&#160;            }</div>
+<div class="line"><a name="l10926"></a><span class="lineno">10926</span>&#160; </div>
+<div class="line"><a name="l10927"></a><span class="lineno">10927</span>&#160;            <span class="comment">// All tests passed: Success.</span></div>
+<div class="line"><a name="l10928"></a><span class="lineno">10928</span>&#160;            pAllocationRequest-&gt;offset = resultOffset;</div>
+<div class="line"><a name="l10929"></a><span class="lineno">10929</span>&#160;            pAllocationRequest-&gt;sumFreeSize = freeSpaceEnd - resultBaseOffset;</div>
+<div class="line"><a name="l10930"></a><span class="lineno">10930</span>&#160;            pAllocationRequest-&gt;sumItemSize = 0;</div>
+<div class="line"><a name="l10931"></a><span class="lineno">10931</span>&#160;            <span class="comment">// pAllocationRequest-&gt;item, customData unused.</span></div>
+<div class="line"><a name="l10932"></a><span class="lineno">10932</span>&#160;            pAllocationRequest-&gt;type = VmaAllocationRequestType::EndOf1st;</div>
+<div class="line"><a name="l10933"></a><span class="lineno">10933</span>&#160;            pAllocationRequest-&gt;itemsToMakeLostCount = 0;</div>
+<div class="line"><a name="l10934"></a><span class="lineno">10934</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l10935"></a><span class="lineno">10935</span>&#160;        }</div>
+<div class="line"><a name="l10936"></a><span class="lineno">10936</span>&#160;    }</div>
+<div class="line"><a name="l10937"></a><span class="lineno">10937</span>&#160; </div>
+<div class="line"><a name="l10938"></a><span class="lineno">10938</span>&#160;    <span class="comment">// Wrap-around to end of 2nd vector. Try to allocate there, watching for the</span></div>
+<div class="line"><a name="l10939"></a><span class="lineno">10939</span>&#160;    <span class="comment">// beginning of 1st vector as the end of free space.</span></div>
+<div class="line"><a name="l10940"></a><span class="lineno">10940</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
+<div class="line"><a name="l10941"></a><span class="lineno">10941</span>&#160;    {</div>
+<div class="line"><a name="l10942"></a><span class="lineno">10942</span>&#160;        VMA_ASSERT(!suballocations1st.empty());</div>
+<div class="line"><a name="l10943"></a><span class="lineno">10943</span>&#160; </div>
+<div class="line"><a name="l10944"></a><span class="lineno">10944</span>&#160;        VkDeviceSize resultBaseOffset = 0;</div>
+<div class="line"><a name="l10945"></a><span class="lineno">10945</span>&#160;        <span class="keywordflow">if</span>(!suballocations2nd.empty())</div>
+<div class="line"><a name="l10946"></a><span class="lineno">10946</span>&#160;        {</div>
+<div class="line"><a name="l10947"></a><span class="lineno">10947</span>&#160;            <span class="keyword">const</span> VmaSuballocation&amp; lastSuballoc = suballocations2nd.back();</div>
+<div class="line"><a name="l10948"></a><span class="lineno">10948</span>&#160;            resultBaseOffset = lastSuballoc.offset + lastSuballoc.size;</div>
+<div class="line"><a name="l10949"></a><span class="lineno">10949</span>&#160;        }</div>
+<div class="line"><a name="l10950"></a><span class="lineno">10950</span>&#160; </div>
+<div class="line"><a name="l10951"></a><span class="lineno">10951</span>&#160;        <span class="comment">// Start from offset equal to beginning of free space.</span></div>
+<div class="line"><a name="l10952"></a><span class="lineno">10952</span>&#160;        VkDeviceSize resultOffset = resultBaseOffset;</div>
+<div class="line"><a name="l10953"></a><span class="lineno">10953</span>&#160; </div>
+<div class="line"><a name="l10954"></a><span class="lineno">10954</span>&#160;        <span class="comment">// Apply VMA_DEBUG_MARGIN at the beginning.</span></div>
+<div class="line"><a name="l10955"></a><span class="lineno">10955</span>&#160;        <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN &gt; 0)</div>
+<div class="line"><a name="l10956"></a><span class="lineno">10956</span>&#160;        {</div>
+<div class="line"><a name="l10957"></a><span class="lineno">10957</span>&#160;            resultOffset += VMA_DEBUG_MARGIN;</div>
+<div class="line"><a name="l10958"></a><span class="lineno">10958</span>&#160;        }</div>
+<div class="line"><a name="l10959"></a><span class="lineno">10959</span>&#160; </div>
+<div class="line"><a name="l10960"></a><span class="lineno">10960</span>&#160;        <span class="comment">// Apply alignment.</span></div>
+<div class="line"><a name="l10961"></a><span class="lineno">10961</span>&#160;        resultOffset = VmaAlignUp(resultOffset, allocAlignment);</div>
+<div class="line"><a name="l10962"></a><span class="lineno">10962</span>&#160; </div>
+<div class="line"><a name="l10963"></a><span class="lineno">10963</span>&#160;        <span class="comment">// Check previous suballocations for BufferImageGranularity conflicts.</span></div>
+<div class="line"><a name="l10964"></a><span class="lineno">10964</span>&#160;        <span class="comment">// Make bigger alignment if necessary.</span></div>
+<div class="line"><a name="l10965"></a><span class="lineno">10965</span>&#160;        <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1 &amp;&amp; !suballocations2nd.empty())</div>
+<div class="line"><a name="l10966"></a><span class="lineno">10966</span>&#160;        {</div>
+<div class="line"><a name="l10967"></a><span class="lineno">10967</span>&#160;            <span class="keywordtype">bool</span> bufferImageGranularityConflict = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l10968"></a><span class="lineno">10968</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> prevSuballocIndex = suballocations2nd.size(); prevSuballocIndex--; )</div>
+<div class="line"><a name="l10969"></a><span class="lineno">10969</span>&#160;            {</div>
+<div class="line"><a name="l10970"></a><span class="lineno">10970</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; prevSuballoc = suballocations2nd[prevSuballocIndex];</div>
+<div class="line"><a name="l10971"></a><span class="lineno">10971</span>&#160;                <span class="keywordflow">if</span>(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))</div>
+<div class="line"><a name="l10972"></a><span class="lineno">10972</span>&#160;                {</div>
+<div class="line"><a name="l10973"></a><span class="lineno">10973</span>&#160;                    <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))</div>
+<div class="line"><a name="l10974"></a><span class="lineno">10974</span>&#160;                    {</div>
+<div class="line"><a name="l10975"></a><span class="lineno">10975</span>&#160;                        bufferImageGranularityConflict = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l10976"></a><span class="lineno">10976</span>&#160;                        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l10977"></a><span class="lineno">10977</span>&#160;                    }</div>
+<div class="line"><a name="l10978"></a><span class="lineno">10978</span>&#160;                }</div>
+<div class="line"><a name="l10979"></a><span class="lineno">10979</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l10980"></a><span class="lineno">10980</span>&#160;                    <span class="comment">// Already on previous page.</span></div>
+<div class="line"><a name="l10981"></a><span class="lineno">10981</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l10982"></a><span class="lineno">10982</span>&#160;            }</div>
+<div class="line"><a name="l10983"></a><span class="lineno">10983</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularityConflict)</div>
+<div class="line"><a name="l10984"></a><span class="lineno">10984</span>&#160;            {</div>
+<div class="line"><a name="l10985"></a><span class="lineno">10985</span>&#160;                resultOffset = VmaAlignUp(resultOffset, bufferImageGranularity);</div>
+<div class="line"><a name="l10986"></a><span class="lineno">10986</span>&#160;            }</div>
+<div class="line"><a name="l10987"></a><span class="lineno">10987</span>&#160;        }</div>
+<div class="line"><a name="l10988"></a><span class="lineno">10988</span>&#160; </div>
+<div class="line"><a name="l10989"></a><span class="lineno">10989</span>&#160;        pAllocationRequest-&gt;itemsToMakeLostCount = 0;</div>
+<div class="line"><a name="l10990"></a><span class="lineno">10990</span>&#160;        pAllocationRequest-&gt;sumItemSize = 0;</div>
+<div class="line"><a name="l10991"></a><span class="lineno">10991</span>&#160;        <span class="keywordtype">size_t</span> index1st = m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l10992"></a><span class="lineno">10992</span>&#160; </div>
+<div class="line"><a name="l10993"></a><span class="lineno">10993</span>&#160;        <span class="keywordflow">if</span>(canMakeOtherLost)</div>
+<div class="line"><a name="l10994"></a><span class="lineno">10994</span>&#160;        {</div>
+<div class="line"><a name="l10995"></a><span class="lineno">10995</span>&#160;            <span class="keywordflow">while</span>(index1st &lt; suballocations1st.size() &amp;&amp;</div>
+<div class="line"><a name="l10996"></a><span class="lineno">10996</span>&#160;                resultOffset + allocSize + VMA_DEBUG_MARGIN &gt; suballocations1st[index1st].offset)</div>
+<div class="line"><a name="l10997"></a><span class="lineno">10997</span>&#160;            {</div>
+<div class="line"><a name="l10998"></a><span class="lineno">10998</span>&#160;                <span class="comment">// Next colliding allocation at the beginning of 1st vector found. Try to make it lost.</span></div>
+<div class="line"><a name="l10999"></a><span class="lineno">10999</span>&#160;                <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[index1st];</div>
+<div class="line"><a name="l11000"></a><span class="lineno">11000</span>&#160;                <span class="keywordflow">if</span>(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l11001"></a><span class="lineno">11001</span>&#160;                {</div>
+<div class="line"><a name="l11002"></a><span class="lineno">11002</span>&#160;                    <span class="comment">// No problem.</span></div>
+<div class="line"><a name="l11003"></a><span class="lineno">11003</span>&#160;                }</div>
+<div class="line"><a name="l11004"></a><span class="lineno">11004</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l11005"></a><span class="lineno">11005</span>&#160;                {</div>
+<div class="line"><a name="l11006"></a><span class="lineno">11006</span>&#160;                    VMA_ASSERT(suballoc.hAllocation != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l11007"></a><span class="lineno">11007</span>&#160;                    <span class="keywordflow">if</span>(suballoc.hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
+<div class="line"><a name="l11008"></a><span class="lineno">11008</span>&#160;                        suballoc.hAllocation-&gt;GetLastUseFrameIndex() + frameInUseCount &lt; currentFrameIndex)</div>
+<div class="line"><a name="l11009"></a><span class="lineno">11009</span>&#160;                    {</div>
+<div class="line"><a name="l11010"></a><span class="lineno">11010</span>&#160;                        ++pAllocationRequest-&gt;itemsToMakeLostCount;</div>
+<div class="line"><a name="l11011"></a><span class="lineno">11011</span>&#160;                        pAllocationRequest-&gt;sumItemSize += suballoc.size;</div>
+<div class="line"><a name="l11012"></a><span class="lineno">11012</span>&#160;                    }</div>
+<div class="line"><a name="l11013"></a><span class="lineno">11013</span>&#160;                    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l11014"></a><span class="lineno">11014</span>&#160;                    {</div>
+<div class="line"><a name="l11015"></a><span class="lineno">11015</span>&#160;                        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l11016"></a><span class="lineno">11016</span>&#160;                    }</div>
+<div class="line"><a name="l11017"></a><span class="lineno">11017</span>&#160;                }</div>
+<div class="line"><a name="l11018"></a><span class="lineno">11018</span>&#160;                ++index1st;</div>
+<div class="line"><a name="l11019"></a><span class="lineno">11019</span>&#160;            }</div>
+<div class="line"><a name="l11020"></a><span class="lineno">11020</span>&#160; </div>
+<div class="line"><a name="l11021"></a><span class="lineno">11021</span>&#160;            <span class="comment">// Check next suballocations for BufferImageGranularity conflicts.</span></div>
+<div class="line"><a name="l11022"></a><span class="lineno">11022</span>&#160;            <span class="comment">// If conflict exists, we must mark more allocations lost or fail.</span></div>
+<div class="line"><a name="l11023"></a><span class="lineno">11023</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
+<div class="line"><a name="l11024"></a><span class="lineno">11024</span>&#160;            {</div>
+<div class="line"><a name="l11025"></a><span class="lineno">11025</span>&#160;                <span class="keywordflow">while</span>(index1st &lt; suballocations1st.size())</div>
+<div class="line"><a name="l11026"></a><span class="lineno">11026</span>&#160;                {</div>
+<div class="line"><a name="l11027"></a><span class="lineno">11027</span>&#160;                    <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[index1st];</div>
+<div class="line"><a name="l11028"></a><span class="lineno">11028</span>&#160;                    <span class="keywordflow">if</span>(VmaBlocksOnSamePage(resultOffset, allocSize, suballoc.offset, bufferImageGranularity))</div>
+<div class="line"><a name="l11029"></a><span class="lineno">11029</span>&#160;                    {</div>
+<div class="line"><a name="l11030"></a><span class="lineno">11030</span>&#160;                        <span class="keywordflow">if</span>(suballoc.hAllocation != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l11031"></a><span class="lineno">11031</span>&#160;                        {</div>
+<div class="line"><a name="l11032"></a><span class="lineno">11032</span>&#160;                            <span class="comment">// Not checking actual VmaIsBufferImageGranularityConflict(allocType, suballoc.type).</span></div>
+<div class="line"><a name="l11033"></a><span class="lineno">11033</span>&#160;                            <span class="keywordflow">if</span>(suballoc.hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
+<div class="line"><a name="l11034"></a><span class="lineno">11034</span>&#160;                                suballoc.hAllocation-&gt;GetLastUseFrameIndex() + frameInUseCount &lt; currentFrameIndex)</div>
+<div class="line"><a name="l11035"></a><span class="lineno">11035</span>&#160;                            {</div>
+<div class="line"><a name="l11036"></a><span class="lineno">11036</span>&#160;                                ++pAllocationRequest-&gt;itemsToMakeLostCount;</div>
+<div class="line"><a name="l11037"></a><span class="lineno">11037</span>&#160;                                pAllocationRequest-&gt;sumItemSize += suballoc.size;</div>
+<div class="line"><a name="l11038"></a><span class="lineno">11038</span>&#160;                            }</div>
+<div class="line"><a name="l11039"></a><span class="lineno">11039</span>&#160;                            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l11040"></a><span class="lineno">11040</span>&#160;                            {</div>
+<div class="line"><a name="l11041"></a><span class="lineno">11041</span>&#160;                                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l11042"></a><span class="lineno">11042</span>&#160;                            }</div>
+<div class="line"><a name="l11043"></a><span class="lineno">11043</span>&#160;                        }</div>
+<div class="line"><a name="l11044"></a><span class="lineno">11044</span>&#160;                    }</div>
+<div class="line"><a name="l11045"></a><span class="lineno">11045</span>&#160;                    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l11046"></a><span class="lineno">11046</span>&#160;                    {</div>
+<div class="line"><a name="l11047"></a><span class="lineno">11047</span>&#160;                        <span class="comment">// Already on next page.</span></div>
+<div class="line"><a name="l11048"></a><span class="lineno">11048</span>&#160;                        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11049"></a><span class="lineno">11049</span>&#160;                    }</div>
+<div class="line"><a name="l11050"></a><span class="lineno">11050</span>&#160;                    ++index1st;</div>
+<div class="line"><a name="l11051"></a><span class="lineno">11051</span>&#160;                }</div>
+<div class="line"><a name="l11052"></a><span class="lineno">11052</span>&#160;            }</div>
+<div class="line"><a name="l11053"></a><span class="lineno">11053</span>&#160; </div>
+<div class="line"><a name="l11054"></a><span class="lineno">11054</span>&#160;            <span class="comment">// Special case: There is not enough room at the end for this allocation, even after making all from the 1st lost.</span></div>
+<div class="line"><a name="l11055"></a><span class="lineno">11055</span>&#160;            <span class="keywordflow">if</span>(index1st == suballocations1st.size() &amp;&amp;</div>
+<div class="line"><a name="l11056"></a><span class="lineno">11056</span>&#160;                resultOffset + allocSize + VMA_DEBUG_MARGIN &gt; size)</div>
+<div class="line"><a name="l11057"></a><span class="lineno">11057</span>&#160;            {</div>
+<div class="line"><a name="l11058"></a><span class="lineno">11058</span>&#160;                <span class="comment">// TODO: This is a known bug that it&#39;s not yet implemented and the allocation is failing.</span></div>
+<div class="line"><a name="l11059"></a><span class="lineno">11059</span>&#160;                VMA_DEBUG_LOG(<span class="stringliteral">&quot;Unsupported special case in custom pool with linear allocation algorithm used as ring buffer with allocations that can be lost.&quot;</span>);</div>
+<div class="line"><a name="l11060"></a><span class="lineno">11060</span>&#160;            }</div>
+<div class="line"><a name="l11061"></a><span class="lineno">11061</span>&#160;        }</div>
+<div class="line"><a name="l11062"></a><span class="lineno">11062</span>&#160; </div>
+<div class="line"><a name="l11063"></a><span class="lineno">11063</span>&#160;        <span class="comment">// There is enough free space at the end after alignment.</span></div>
+<div class="line"><a name="l11064"></a><span class="lineno">11064</span>&#160;        <span class="keywordflow">if</span>((index1st == suballocations1st.size() &amp;&amp; resultOffset + allocSize + VMA_DEBUG_MARGIN &lt;= size) ||</div>
+<div class="line"><a name="l11065"></a><span class="lineno">11065</span>&#160;            (index1st &lt; suballocations1st.size() &amp;&amp; resultOffset + allocSize + VMA_DEBUG_MARGIN &lt;= suballocations1st[index1st].offset))</div>
+<div class="line"><a name="l11066"></a><span class="lineno">11066</span>&#160;        {</div>
+<div class="line"><a name="l11067"></a><span class="lineno">11067</span>&#160;            <span class="comment">// Check next suballocations for BufferImageGranularity conflicts.</span></div>
+<div class="line"><a name="l11068"></a><span class="lineno">11068</span>&#160;            <span class="comment">// If conflict exists, allocation cannot be made here.</span></div>
+<div class="line"><a name="l11069"></a><span class="lineno">11069</span>&#160;            <span class="keywordflow">if</span>(bufferImageGranularity &gt; 1)</div>
+<div class="line"><a name="l11070"></a><span class="lineno">11070</span>&#160;            {</div>
+<div class="line"><a name="l11071"></a><span class="lineno">11071</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> nextSuballocIndex = index1st;</div>
+<div class="line"><a name="l11072"></a><span class="lineno">11072</span>&#160;                    nextSuballocIndex &lt; suballocations1st.size();</div>
+<div class="line"><a name="l11073"></a><span class="lineno">11073</span>&#160;                    nextSuballocIndex++)</div>
+<div class="line"><a name="l11074"></a><span class="lineno">11074</span>&#160;                {</div>
+<div class="line"><a name="l11075"></a><span class="lineno">11075</span>&#160;                    <span class="keyword">const</span> VmaSuballocation&amp; nextSuballoc = suballocations1st[nextSuballocIndex];</div>
+<div class="line"><a name="l11076"></a><span class="lineno">11076</span>&#160;                    <span class="keywordflow">if</span>(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))</div>
+<div class="line"><a name="l11077"></a><span class="lineno">11077</span>&#160;                    {</div>
+<div class="line"><a name="l11078"></a><span class="lineno">11078</span>&#160;                        <span class="keywordflow">if</span>(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))</div>
+<div class="line"><a name="l11079"></a><span class="lineno">11079</span>&#160;                        {</div>
+<div class="line"><a name="l11080"></a><span class="lineno">11080</span>&#160;                            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l11081"></a><span class="lineno">11081</span>&#160;                        }</div>
+<div class="line"><a name="l11082"></a><span class="lineno">11082</span>&#160;                    }</div>
+<div class="line"><a name="l11083"></a><span class="lineno">11083</span>&#160;                    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l11084"></a><span class="lineno">11084</span>&#160;                    {</div>
+<div class="line"><a name="l11085"></a><span class="lineno">11085</span>&#160;                        <span class="comment">// Already on next page.</span></div>
+<div class="line"><a name="l11086"></a><span class="lineno">11086</span>&#160;                        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11087"></a><span class="lineno">11087</span>&#160;                    }</div>
+<div class="line"><a name="l11088"></a><span class="lineno">11088</span>&#160;                }</div>
+<div class="line"><a name="l11089"></a><span class="lineno">11089</span>&#160;            }</div>
+<div class="line"><a name="l11090"></a><span class="lineno">11090</span>&#160; </div>
+<div class="line"><a name="l11091"></a><span class="lineno">11091</span>&#160;            <span class="comment">// All tests passed: Success.</span></div>
+<div class="line"><a name="l11092"></a><span class="lineno">11092</span>&#160;            pAllocationRequest-&gt;offset = resultOffset;</div>
+<div class="line"><a name="l11093"></a><span class="lineno">11093</span>&#160;            pAllocationRequest-&gt;sumFreeSize =</div>
+<div class="line"><a name="l11094"></a><span class="lineno">11094</span>&#160;                (index1st &lt; suballocations1st.size() ? suballocations1st[index1st].offset : size)</div>
+<div class="line"><a name="l11095"></a><span class="lineno">11095</span>&#160;                - resultBaseOffset</div>
+<div class="line"><a name="l11096"></a><span class="lineno">11096</span>&#160;                - pAllocationRequest-&gt;sumItemSize;</div>
+<div class="line"><a name="l11097"></a><span class="lineno">11097</span>&#160;            pAllocationRequest-&gt;type = VmaAllocationRequestType::EndOf2nd;</div>
+<div class="line"><a name="l11098"></a><span class="lineno">11098</span>&#160;            <span class="comment">// pAllocationRequest-&gt;item, customData unused.</span></div>
+<div class="line"><a name="l11099"></a><span class="lineno">11099</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l11100"></a><span class="lineno">11100</span>&#160;        }</div>
+<div class="line"><a name="l11101"></a><span class="lineno">11101</span>&#160;    }</div>
+<div class="line"><a name="l11102"></a><span class="lineno">11102</span>&#160; </div>
+<div class="line"><a name="l11103"></a><span class="lineno">11103</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l11104"></a><span class="lineno">11104</span>&#160;}</div>
 <div class="line"><a name="l11105"></a><span class="lineno">11105</span>&#160; </div>
-<div class="line"><a name="l11106"></a><span class="lineno">11106</span>&#160;    <span class="keywordflow">if</span>(!suballocations1st.empty())</div>
-<div class="line"><a name="l11107"></a><span class="lineno">11107</span>&#160;    {</div>
-<div class="line"><a name="l11108"></a><span class="lineno">11108</span>&#160;        <span class="comment">// First allocation: Mark it as next empty at the beginning.</span></div>
-<div class="line"><a name="l11109"></a><span class="lineno">11109</span>&#160;        VmaSuballocation&amp; firstSuballoc = suballocations1st[m_1stNullItemsBeginCount];</div>
-<div class="line"><a name="l11110"></a><span class="lineno">11110</span>&#160;        <span class="keywordflow">if</span>(firstSuballoc.offset == offset)</div>
-<div class="line"><a name="l11111"></a><span class="lineno">11111</span>&#160;        {</div>
-<div class="line"><a name="l11112"></a><span class="lineno">11112</span>&#160;            firstSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
-<div class="line"><a name="l11113"></a><span class="lineno">11113</span>&#160;            firstSuballoc.hAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l11114"></a><span class="lineno">11114</span>&#160;            m_SumFreeSize += firstSuballoc.size;</div>
-<div class="line"><a name="l11115"></a><span class="lineno">11115</span>&#160;            ++m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l11116"></a><span class="lineno">11116</span>&#160;            CleanupAfterFree();</div>
-<div class="line"><a name="l11117"></a><span class="lineno">11117</span>&#160;            <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l11118"></a><span class="lineno">11118</span>&#160;        }</div>
-<div class="line"><a name="l11119"></a><span class="lineno">11119</span>&#160;    }</div>
-<div class="line"><a name="l11120"></a><span class="lineno">11120</span>&#160; </div>
-<div class="line"><a name="l11121"></a><span class="lineno">11121</span>&#160;    <span class="comment">// Last allocation in 2-part ring buffer or top of upper stack (same logic).</span></div>
-<div class="line"><a name="l11122"></a><span class="lineno">11122</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER ||</div>
-<div class="line"><a name="l11123"></a><span class="lineno">11123</span>&#160;        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
-<div class="line"><a name="l11124"></a><span class="lineno">11124</span>&#160;    {</div>
-<div class="line"><a name="l11125"></a><span class="lineno">11125</span>&#160;        VmaSuballocation&amp; lastSuballoc = suballocations2nd.back();</div>
-<div class="line"><a name="l11126"></a><span class="lineno">11126</span>&#160;        <span class="keywordflow">if</span>(lastSuballoc.offset == offset)</div>
-<div class="line"><a name="l11127"></a><span class="lineno">11127</span>&#160;        {</div>
-<div class="line"><a name="l11128"></a><span class="lineno">11128</span>&#160;            m_SumFreeSize += lastSuballoc.size;</div>
-<div class="line"><a name="l11129"></a><span class="lineno">11129</span>&#160;            suballocations2nd.pop_back();</div>
-<div class="line"><a name="l11130"></a><span class="lineno">11130</span>&#160;            CleanupAfterFree();</div>
-<div class="line"><a name="l11131"></a><span class="lineno">11131</span>&#160;            <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l11132"></a><span class="lineno">11132</span>&#160;        }</div>
-<div class="line"><a name="l11133"></a><span class="lineno">11133</span>&#160;    }</div>
-<div class="line"><a name="l11134"></a><span class="lineno">11134</span>&#160;    <span class="comment">// Last allocation in 1st vector.</span></div>
-<div class="line"><a name="l11135"></a><span class="lineno">11135</span>&#160;    <span class="keywordflow">else</span> <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_EMPTY)</div>
-<div class="line"><a name="l11136"></a><span class="lineno">11136</span>&#160;    {</div>
-<div class="line"><a name="l11137"></a><span class="lineno">11137</span>&#160;        VmaSuballocation&amp; lastSuballoc = suballocations1st.back();</div>
-<div class="line"><a name="l11138"></a><span class="lineno">11138</span>&#160;        <span class="keywordflow">if</span>(lastSuballoc.offset == offset)</div>
-<div class="line"><a name="l11139"></a><span class="lineno">11139</span>&#160;        {</div>
-<div class="line"><a name="l11140"></a><span class="lineno">11140</span>&#160;            m_SumFreeSize += lastSuballoc.size;</div>
-<div class="line"><a name="l11141"></a><span class="lineno">11141</span>&#160;            suballocations1st.pop_back();</div>
-<div class="line"><a name="l11142"></a><span class="lineno">11142</span>&#160;            CleanupAfterFree();</div>
-<div class="line"><a name="l11143"></a><span class="lineno">11143</span>&#160;            <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l11144"></a><span class="lineno">11144</span>&#160;        }</div>
-<div class="line"><a name="l11145"></a><span class="lineno">11145</span>&#160;    }</div>
-<div class="line"><a name="l11146"></a><span class="lineno">11146</span>&#160; </div>
-<div class="line"><a name="l11147"></a><span class="lineno">11147</span>&#160;    <span class="comment">// Item from the middle of 1st vector.</span></div>
-<div class="line"><a name="l11148"></a><span class="lineno">11148</span>&#160;    {</div>
-<div class="line"><a name="l11149"></a><span class="lineno">11149</span>&#160;        VmaSuballocation refSuballoc;</div>
-<div class="line"><a name="l11150"></a><span class="lineno">11150</span>&#160;        refSuballoc.offset = offset;</div>
-<div class="line"><a name="l11151"></a><span class="lineno">11151</span>&#160;        <span class="comment">// Rest of members stays uninitialized intentionally for better performance.</span></div>
-<div class="line"><a name="l11152"></a><span class="lineno">11152</span>&#160;        SuballocationVectorType::iterator it = VmaBinaryFindSorted(</div>
-<div class="line"><a name="l11153"></a><span class="lineno">11153</span>&#160;            suballocations1st.begin() + m_1stNullItemsBeginCount,</div>
-<div class="line"><a name="l11154"></a><span class="lineno">11154</span>&#160;            suballocations1st.end(),</div>
-<div class="line"><a name="l11155"></a><span class="lineno">11155</span>&#160;            refSuballoc,</div>
-<div class="line"><a name="l11156"></a><span class="lineno">11156</span>&#160;            VmaSuballocationOffsetLess());</div>
-<div class="line"><a name="l11157"></a><span class="lineno">11157</span>&#160;        <span class="keywordflow">if</span>(it != suballocations1st.end())</div>
-<div class="line"><a name="l11158"></a><span class="lineno">11158</span>&#160;        {</div>
-<div class="line"><a name="l11159"></a><span class="lineno">11159</span>&#160;            it-&gt;type = VMA_SUBALLOCATION_TYPE_FREE;</div>
-<div class="line"><a name="l11160"></a><span class="lineno">11160</span>&#160;            it-&gt;hAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l11161"></a><span class="lineno">11161</span>&#160;            ++m_1stNullItemsMiddleCount;</div>
-<div class="line"><a name="l11162"></a><span class="lineno">11162</span>&#160;            m_SumFreeSize += it-&gt;size;</div>
-<div class="line"><a name="l11163"></a><span class="lineno">11163</span>&#160;            CleanupAfterFree();</div>
-<div class="line"><a name="l11164"></a><span class="lineno">11164</span>&#160;            <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l11165"></a><span class="lineno">11165</span>&#160;        }</div>
-<div class="line"><a name="l11166"></a><span class="lineno">11166</span>&#160;    }</div>
-<div class="line"><a name="l11167"></a><span class="lineno">11167</span>&#160; </div>
-<div class="line"><a name="l11168"></a><span class="lineno">11168</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode != SECOND_VECTOR_EMPTY)</div>
-<div class="line"><a name="l11169"></a><span class="lineno">11169</span>&#160;    {</div>
-<div class="line"><a name="l11170"></a><span class="lineno">11170</span>&#160;        <span class="comment">// Item from the middle of 2nd vector.</span></div>
-<div class="line"><a name="l11171"></a><span class="lineno">11171</span>&#160;        VmaSuballocation refSuballoc;</div>
-<div class="line"><a name="l11172"></a><span class="lineno">11172</span>&#160;        refSuballoc.offset = offset;</div>
-<div class="line"><a name="l11173"></a><span class="lineno">11173</span>&#160;        <span class="comment">// Rest of members stays uninitialized intentionally for better performance.</span></div>
-<div class="line"><a name="l11174"></a><span class="lineno">11174</span>&#160;        SuballocationVectorType::iterator it = m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER ?</div>
-<div class="line"><a name="l11175"></a><span class="lineno">11175</span>&#160;            VmaBinaryFindSorted(suballocations2nd.begin(), suballocations2nd.end(), refSuballoc, VmaSuballocationOffsetLess()) :</div>
-<div class="line"><a name="l11176"></a><span class="lineno">11176</span>&#160;            VmaBinaryFindSorted(suballocations2nd.begin(), suballocations2nd.end(), refSuballoc, VmaSuballocationOffsetGreater());</div>
-<div class="line"><a name="l11177"></a><span class="lineno">11177</span>&#160;        <span class="keywordflow">if</span>(it != suballocations2nd.end())</div>
-<div class="line"><a name="l11178"></a><span class="lineno">11178</span>&#160;        {</div>
-<div class="line"><a name="l11179"></a><span class="lineno">11179</span>&#160;            it-&gt;type = VMA_SUBALLOCATION_TYPE_FREE;</div>
-<div class="line"><a name="l11180"></a><span class="lineno">11180</span>&#160;            it-&gt;hAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l11181"></a><span class="lineno">11181</span>&#160;            ++m_2ndNullItemsCount;</div>
-<div class="line"><a name="l11182"></a><span class="lineno">11182</span>&#160;            m_SumFreeSize += it-&gt;size;</div>
-<div class="line"><a name="l11183"></a><span class="lineno">11183</span>&#160;            CleanupAfterFree();</div>
-<div class="line"><a name="l11184"></a><span class="lineno">11184</span>&#160;            <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l11185"></a><span class="lineno">11185</span>&#160;        }</div>
-<div class="line"><a name="l11186"></a><span class="lineno">11186</span>&#160;    }</div>
-<div class="line"><a name="l11187"></a><span class="lineno">11187</span>&#160; </div>
-<div class="line"><a name="l11188"></a><span class="lineno">11188</span>&#160;    VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Allocation to free not found in linear allocator!&quot;</span>);</div>
-<div class="line"><a name="l11189"></a><span class="lineno">11189</span>&#160;}</div>
-<div class="line"><a name="l11190"></a><span class="lineno">11190</span>&#160; </div>
-<div class="line"><a name="l11191"></a><span class="lineno">11191</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::ShouldCompact1st()<span class="keyword"> const</span></div>
-<div class="line"><a name="l11192"></a><span class="lineno">11192</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l11193"></a><span class="lineno">11193</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> nullItemCount = m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount;</div>
-<div class="line"><a name="l11194"></a><span class="lineno">11194</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballocCount = AccessSuballocations1st().size();</div>
-<div class="line"><a name="l11195"></a><span class="lineno">11195</span>&#160;    <span class="keywordflow">return</span> suballocCount &gt; 32 &amp;&amp; nullItemCount * 2 &gt;= (suballocCount - nullItemCount) * 3;</div>
-<div class="line"><a name="l11196"></a><span class="lineno">11196</span>&#160;}</div>
-<div class="line"><a name="l11197"></a><span class="lineno">11197</span>&#160; </div>
-<div class="line"><a name="l11198"></a><span class="lineno">11198</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::CleanupAfterFree()</div>
-<div class="line"><a name="l11199"></a><span class="lineno">11199</span>&#160;{</div>
-<div class="line"><a name="l11200"></a><span class="lineno">11200</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
-<div class="line"><a name="l11201"></a><span class="lineno">11201</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
-<div class="line"><a name="l11202"></a><span class="lineno">11202</span>&#160; </div>
-<div class="line"><a name="l11203"></a><span class="lineno">11203</span>&#160;    <span class="keywordflow">if</span>(IsEmpty())</div>
-<div class="line"><a name="l11204"></a><span class="lineno">11204</span>&#160;    {</div>
-<div class="line"><a name="l11205"></a><span class="lineno">11205</span>&#160;        suballocations1st.clear();</div>
-<div class="line"><a name="l11206"></a><span class="lineno">11206</span>&#160;        suballocations2nd.clear();</div>
-<div class="line"><a name="l11207"></a><span class="lineno">11207</span>&#160;        m_1stNullItemsBeginCount = 0;</div>
-<div class="line"><a name="l11208"></a><span class="lineno">11208</span>&#160;        m_1stNullItemsMiddleCount = 0;</div>
-<div class="line"><a name="l11209"></a><span class="lineno">11209</span>&#160;        m_2ndNullItemsCount = 0;</div>
-<div class="line"><a name="l11210"></a><span class="lineno">11210</span>&#160;        m_2ndVectorMode = SECOND_VECTOR_EMPTY;</div>
-<div class="line"><a name="l11211"></a><span class="lineno">11211</span>&#160;    }</div>
-<div class="line"><a name="l11212"></a><span class="lineno">11212</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l11213"></a><span class="lineno">11213</span>&#160;    {</div>
-<div class="line"><a name="l11214"></a><span class="lineno">11214</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc1stCount = suballocations1st.size();</div>
-<div class="line"><a name="l11215"></a><span class="lineno">11215</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> nullItem1stCount = m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount;</div>
-<div class="line"><a name="l11216"></a><span class="lineno">11216</span>&#160;        VMA_ASSERT(nullItem1stCount &lt;= suballoc1stCount);</div>
-<div class="line"><a name="l11217"></a><span class="lineno">11217</span>&#160; </div>
-<div class="line"><a name="l11218"></a><span class="lineno">11218</span>&#160;        <span class="comment">// Find more null items at the beginning of 1st vector.</span></div>
-<div class="line"><a name="l11219"></a><span class="lineno">11219</span>&#160;        <span class="keywordflow">while</span>(m_1stNullItemsBeginCount &lt; suballoc1stCount &amp;&amp;</div>
-<div class="line"><a name="l11220"></a><span class="lineno">11220</span>&#160;            suballocations1st[m_1stNullItemsBeginCount].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l11106"></a><span class="lineno">11106</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::MakeRequestedAllocationsLost(</div>
+<div class="line"><a name="l11107"></a><span class="lineno">11107</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l11108"></a><span class="lineno">11108</span>&#160;    uint32_t frameInUseCount,</div>
+<div class="line"><a name="l11109"></a><span class="lineno">11109</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
+<div class="line"><a name="l11110"></a><span class="lineno">11110</span>&#160;{</div>
+<div class="line"><a name="l11111"></a><span class="lineno">11111</span>&#160;    <span class="keywordflow">if</span>(pAllocationRequest-&gt;itemsToMakeLostCount == 0)</div>
+<div class="line"><a name="l11112"></a><span class="lineno">11112</span>&#160;    {</div>
+<div class="line"><a name="l11113"></a><span class="lineno">11113</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l11114"></a><span class="lineno">11114</span>&#160;    }</div>
+<div class="line"><a name="l11115"></a><span class="lineno">11115</span>&#160; </div>
+<div class="line"><a name="l11116"></a><span class="lineno">11116</span>&#160;    VMA_ASSERT(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER);</div>
+<div class="line"><a name="l11117"></a><span class="lineno">11117</span>&#160;    </div>
+<div class="line"><a name="l11118"></a><span class="lineno">11118</span>&#160;    <span class="comment">// We always start from 1st.</span></div>
+<div class="line"><a name="l11119"></a><span class="lineno">11119</span>&#160;    SuballocationVectorType* suballocations = &amp;AccessSuballocations1st();</div>
+<div class="line"><a name="l11120"></a><span class="lineno">11120</span>&#160;    <span class="keywordtype">size_t</span> index = m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l11121"></a><span class="lineno">11121</span>&#160;    <span class="keywordtype">size_t</span> madeLostCount = 0;</div>
+<div class="line"><a name="l11122"></a><span class="lineno">11122</span>&#160;    <span class="keywordflow">while</span>(madeLostCount &lt; pAllocationRequest-&gt;itemsToMakeLostCount)</div>
+<div class="line"><a name="l11123"></a><span class="lineno">11123</span>&#160;    {</div>
+<div class="line"><a name="l11124"></a><span class="lineno">11124</span>&#160;        <span class="keywordflow">if</span>(index == suballocations-&gt;size())</div>
+<div class="line"><a name="l11125"></a><span class="lineno">11125</span>&#160;        {</div>
+<div class="line"><a name="l11126"></a><span class="lineno">11126</span>&#160;            index = 0;</div>
+<div class="line"><a name="l11127"></a><span class="lineno">11127</span>&#160;            <span class="comment">// If we get to the end of 1st, we wrap around to beginning of 2nd of 1st.</span></div>
+<div class="line"><a name="l11128"></a><span class="lineno">11128</span>&#160;            <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
+<div class="line"><a name="l11129"></a><span class="lineno">11129</span>&#160;            {</div>
+<div class="line"><a name="l11130"></a><span class="lineno">11130</span>&#160;                suballocations = &amp;AccessSuballocations2nd();</div>
+<div class="line"><a name="l11131"></a><span class="lineno">11131</span>&#160;            }</div>
+<div class="line"><a name="l11132"></a><span class="lineno">11132</span>&#160;            <span class="comment">// else: m_2ndVectorMode == SECOND_VECTOR_EMPTY:</span></div>
+<div class="line"><a name="l11133"></a><span class="lineno">11133</span>&#160;            <span class="comment">// suballocations continues pointing at AccessSuballocations1st().</span></div>
+<div class="line"><a name="l11134"></a><span class="lineno">11134</span>&#160;            VMA_ASSERT(!suballocations-&gt;empty());</div>
+<div class="line"><a name="l11135"></a><span class="lineno">11135</span>&#160;        }</div>
+<div class="line"><a name="l11136"></a><span class="lineno">11136</span>&#160;        VmaSuballocation&amp; suballoc = (*suballocations)[index];</div>
+<div class="line"><a name="l11137"></a><span class="lineno">11137</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l11138"></a><span class="lineno">11138</span>&#160;        {</div>
+<div class="line"><a name="l11139"></a><span class="lineno">11139</span>&#160;            VMA_ASSERT(suballoc.hAllocation != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l11140"></a><span class="lineno">11140</span>&#160;            VMA_ASSERT(suballoc.hAllocation-&gt;CanBecomeLost());</div>
+<div class="line"><a name="l11141"></a><span class="lineno">11141</span>&#160;            <span class="keywordflow">if</span>(suballoc.hAllocation-&gt;MakeLost(currentFrameIndex, frameInUseCount))</div>
+<div class="line"><a name="l11142"></a><span class="lineno">11142</span>&#160;            {</div>
+<div class="line"><a name="l11143"></a><span class="lineno">11143</span>&#160;                suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
+<div class="line"><a name="l11144"></a><span class="lineno">11144</span>&#160;                suballoc.hAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l11145"></a><span class="lineno">11145</span>&#160;                m_SumFreeSize += suballoc.size;</div>
+<div class="line"><a name="l11146"></a><span class="lineno">11146</span>&#160;                <span class="keywordflow">if</span>(suballocations == &amp;AccessSuballocations1st())</div>
+<div class="line"><a name="l11147"></a><span class="lineno">11147</span>&#160;                {</div>
+<div class="line"><a name="l11148"></a><span class="lineno">11148</span>&#160;                    ++m_1stNullItemsMiddleCount;</div>
+<div class="line"><a name="l11149"></a><span class="lineno">11149</span>&#160;                }</div>
+<div class="line"><a name="l11150"></a><span class="lineno">11150</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l11151"></a><span class="lineno">11151</span>&#160;                {</div>
+<div class="line"><a name="l11152"></a><span class="lineno">11152</span>&#160;                    ++m_2ndNullItemsCount;</div>
+<div class="line"><a name="l11153"></a><span class="lineno">11153</span>&#160;                }</div>
+<div class="line"><a name="l11154"></a><span class="lineno">11154</span>&#160;                ++madeLostCount;</div>
+<div class="line"><a name="l11155"></a><span class="lineno">11155</span>&#160;            }</div>
+<div class="line"><a name="l11156"></a><span class="lineno">11156</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l11157"></a><span class="lineno">11157</span>&#160;            {</div>
+<div class="line"><a name="l11158"></a><span class="lineno">11158</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l11159"></a><span class="lineno">11159</span>&#160;            }</div>
+<div class="line"><a name="l11160"></a><span class="lineno">11160</span>&#160;        }</div>
+<div class="line"><a name="l11161"></a><span class="lineno">11161</span>&#160;        ++index;</div>
+<div class="line"><a name="l11162"></a><span class="lineno">11162</span>&#160;    }</div>
+<div class="line"><a name="l11163"></a><span class="lineno">11163</span>&#160; </div>
+<div class="line"><a name="l11164"></a><span class="lineno">11164</span>&#160;    CleanupAfterFree();</div>
+<div class="line"><a name="l11165"></a><span class="lineno">11165</span>&#160;    <span class="comment">//VMA_HEAVY_ASSERT(Validate()); // Already called by ClanupAfterFree().</span></div>
+<div class="line"><a name="l11166"></a><span class="lineno">11166</span>&#160;    </div>
+<div class="line"><a name="l11167"></a><span class="lineno">11167</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l11168"></a><span class="lineno">11168</span>&#160;}</div>
+<div class="line"><a name="l11169"></a><span class="lineno">11169</span>&#160; </div>
+<div class="line"><a name="l11170"></a><span class="lineno">11170</span>&#160;uint32_t VmaBlockMetadata_Linear::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)</div>
+<div class="line"><a name="l11171"></a><span class="lineno">11171</span>&#160;{</div>
+<div class="line"><a name="l11172"></a><span class="lineno">11172</span>&#160;    uint32_t lostAllocationCount = 0;</div>
+<div class="line"><a name="l11173"></a><span class="lineno">11173</span>&#160;    </div>
+<div class="line"><a name="l11174"></a><span class="lineno">11174</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l11175"></a><span class="lineno">11175</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_1stNullItemsBeginCount, count = suballocations1st.size(); i &lt; count; ++i)</div>
+<div class="line"><a name="l11176"></a><span class="lineno">11176</span>&#160;    {</div>
+<div class="line"><a name="l11177"></a><span class="lineno">11177</span>&#160;        VmaSuballocation&amp; suballoc = suballocations1st[i];</div>
+<div class="line"><a name="l11178"></a><span class="lineno">11178</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE &amp;&amp;</div>
+<div class="line"><a name="l11179"></a><span class="lineno">11179</span>&#160;            suballoc.hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
+<div class="line"><a name="l11180"></a><span class="lineno">11180</span>&#160;            suballoc.hAllocation-&gt;MakeLost(currentFrameIndex, frameInUseCount))</div>
+<div class="line"><a name="l11181"></a><span class="lineno">11181</span>&#160;        {</div>
+<div class="line"><a name="l11182"></a><span class="lineno">11182</span>&#160;            suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
+<div class="line"><a name="l11183"></a><span class="lineno">11183</span>&#160;            suballoc.hAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l11184"></a><span class="lineno">11184</span>&#160;            ++m_1stNullItemsMiddleCount;</div>
+<div class="line"><a name="l11185"></a><span class="lineno">11185</span>&#160;            m_SumFreeSize += suballoc.size;</div>
+<div class="line"><a name="l11186"></a><span class="lineno">11186</span>&#160;            ++lostAllocationCount;</div>
+<div class="line"><a name="l11187"></a><span class="lineno">11187</span>&#160;        }</div>
+<div class="line"><a name="l11188"></a><span class="lineno">11188</span>&#160;    }</div>
+<div class="line"><a name="l11189"></a><span class="lineno">11189</span>&#160; </div>
+<div class="line"><a name="l11190"></a><span class="lineno">11190</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l11191"></a><span class="lineno">11191</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0, count = suballocations2nd.size(); i &lt; count; ++i)</div>
+<div class="line"><a name="l11192"></a><span class="lineno">11192</span>&#160;    {</div>
+<div class="line"><a name="l11193"></a><span class="lineno">11193</span>&#160;        VmaSuballocation&amp; suballoc = suballocations2nd[i];</div>
+<div class="line"><a name="l11194"></a><span class="lineno">11194</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE &amp;&amp;</div>
+<div class="line"><a name="l11195"></a><span class="lineno">11195</span>&#160;            suballoc.hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
+<div class="line"><a name="l11196"></a><span class="lineno">11196</span>&#160;            suballoc.hAllocation-&gt;MakeLost(currentFrameIndex, frameInUseCount))</div>
+<div class="line"><a name="l11197"></a><span class="lineno">11197</span>&#160;        {</div>
+<div class="line"><a name="l11198"></a><span class="lineno">11198</span>&#160;            suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
+<div class="line"><a name="l11199"></a><span class="lineno">11199</span>&#160;            suballoc.hAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l11200"></a><span class="lineno">11200</span>&#160;            ++m_2ndNullItemsCount;</div>
+<div class="line"><a name="l11201"></a><span class="lineno">11201</span>&#160;            m_SumFreeSize += suballoc.size;</div>
+<div class="line"><a name="l11202"></a><span class="lineno">11202</span>&#160;            ++lostAllocationCount;</div>
+<div class="line"><a name="l11203"></a><span class="lineno">11203</span>&#160;        }</div>
+<div class="line"><a name="l11204"></a><span class="lineno">11204</span>&#160;    }</div>
+<div class="line"><a name="l11205"></a><span class="lineno">11205</span>&#160; </div>
+<div class="line"><a name="l11206"></a><span class="lineno">11206</span>&#160;    <span class="keywordflow">if</span>(lostAllocationCount)</div>
+<div class="line"><a name="l11207"></a><span class="lineno">11207</span>&#160;    {</div>
+<div class="line"><a name="l11208"></a><span class="lineno">11208</span>&#160;        CleanupAfterFree();</div>
+<div class="line"><a name="l11209"></a><span class="lineno">11209</span>&#160;    }</div>
+<div class="line"><a name="l11210"></a><span class="lineno">11210</span>&#160; </div>
+<div class="line"><a name="l11211"></a><span class="lineno">11211</span>&#160;    <span class="keywordflow">return</span> lostAllocationCount;</div>
+<div class="line"><a name="l11212"></a><span class="lineno">11212</span>&#160;}</div>
+<div class="line"><a name="l11213"></a><span class="lineno">11213</span>&#160; </div>
+<div class="line"><a name="l11214"></a><span class="lineno">11214</span>&#160;VkResult VmaBlockMetadata_Linear::CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData)</div>
+<div class="line"><a name="l11215"></a><span class="lineno">11215</span>&#160;{</div>
+<div class="line"><a name="l11216"></a><span class="lineno">11216</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l11217"></a><span class="lineno">11217</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_1stNullItemsBeginCount, count = suballocations1st.size(); i &lt; count; ++i)</div>
+<div class="line"><a name="l11218"></a><span class="lineno">11218</span>&#160;    {</div>
+<div class="line"><a name="l11219"></a><span class="lineno">11219</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations1st[i];</div>
+<div class="line"><a name="l11220"></a><span class="lineno">11220</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)</div>
 <div class="line"><a name="l11221"></a><span class="lineno">11221</span>&#160;        {</div>
-<div class="line"><a name="l11222"></a><span class="lineno">11222</span>&#160;            ++m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l11223"></a><span class="lineno">11223</span>&#160;            --m_1stNullItemsMiddleCount;</div>
-<div class="line"><a name="l11224"></a><span class="lineno">11224</span>&#160;        }</div>
-<div class="line"><a name="l11225"></a><span class="lineno">11225</span>&#160; </div>
-<div class="line"><a name="l11226"></a><span class="lineno">11226</span>&#160;        <span class="comment">// Find more null items at the end of 1st vector.</span></div>
-<div class="line"><a name="l11227"></a><span class="lineno">11227</span>&#160;        <span class="keywordflow">while</span>(m_1stNullItemsMiddleCount &gt; 0 &amp;&amp;</div>
-<div class="line"><a name="l11228"></a><span class="lineno">11228</span>&#160;            suballocations1st.back().hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l11229"></a><span class="lineno">11229</span>&#160;        {</div>
-<div class="line"><a name="l11230"></a><span class="lineno">11230</span>&#160;            --m_1stNullItemsMiddleCount;</div>
-<div class="line"><a name="l11231"></a><span class="lineno">11231</span>&#160;            suballocations1st.pop_back();</div>
+<div class="line"><a name="l11222"></a><span class="lineno">11222</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, suballoc.offset - VMA_DEBUG_MARGIN))</div>
+<div class="line"><a name="l11223"></a><span class="lineno">11223</span>&#160;            {</div>
+<div class="line"><a name="l11224"></a><span class="lineno">11224</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!&quot;</span>);</div>
+<div class="line"><a name="l11225"></a><span class="lineno">11225</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
+<div class="line"><a name="l11226"></a><span class="lineno">11226</span>&#160;            }</div>
+<div class="line"><a name="l11227"></a><span class="lineno">11227</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, suballoc.offset + suballoc.size))</div>
+<div class="line"><a name="l11228"></a><span class="lineno">11228</span>&#160;            {</div>
+<div class="line"><a name="l11229"></a><span class="lineno">11229</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!&quot;</span>);</div>
+<div class="line"><a name="l11230"></a><span class="lineno">11230</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
+<div class="line"><a name="l11231"></a><span class="lineno">11231</span>&#160;            }</div>
 <div class="line"><a name="l11232"></a><span class="lineno">11232</span>&#160;        }</div>
-<div class="line"><a name="l11233"></a><span class="lineno">11233</span>&#160; </div>
-<div class="line"><a name="l11234"></a><span class="lineno">11234</span>&#160;        <span class="comment">// Find more null items at the end of 2nd vector.</span></div>
-<div class="line"><a name="l11235"></a><span class="lineno">11235</span>&#160;        <span class="keywordflow">while</span>(m_2ndNullItemsCount &gt; 0 &amp;&amp;</div>
-<div class="line"><a name="l11236"></a><span class="lineno">11236</span>&#160;            suballocations2nd.back().hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l11237"></a><span class="lineno">11237</span>&#160;        {</div>
-<div class="line"><a name="l11238"></a><span class="lineno">11238</span>&#160;            --m_2ndNullItemsCount;</div>
-<div class="line"><a name="l11239"></a><span class="lineno">11239</span>&#160;            suballocations2nd.pop_back();</div>
-<div class="line"><a name="l11240"></a><span class="lineno">11240</span>&#160;        }</div>
-<div class="line"><a name="l11241"></a><span class="lineno">11241</span>&#160; </div>
-<div class="line"><a name="l11242"></a><span class="lineno">11242</span>&#160;        <span class="comment">// Find more null items at the beginning of 2nd vector.</span></div>
-<div class="line"><a name="l11243"></a><span class="lineno">11243</span>&#160;        <span class="keywordflow">while</span>(m_2ndNullItemsCount &gt; 0 &amp;&amp;</div>
-<div class="line"><a name="l11244"></a><span class="lineno">11244</span>&#160;            suballocations2nd[0].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l11245"></a><span class="lineno">11245</span>&#160;        {</div>
-<div class="line"><a name="l11246"></a><span class="lineno">11246</span>&#160;            --m_2ndNullItemsCount;</div>
-<div class="line"><a name="l11247"></a><span class="lineno">11247</span>&#160;            VmaVectorRemove(suballocations2nd, 0);</div>
-<div class="line"><a name="l11248"></a><span class="lineno">11248</span>&#160;        }</div>
-<div class="line"><a name="l11249"></a><span class="lineno">11249</span>&#160; </div>
-<div class="line"><a name="l11250"></a><span class="lineno">11250</span>&#160;        <span class="keywordflow">if</span>(ShouldCompact1st())</div>
-<div class="line"><a name="l11251"></a><span class="lineno">11251</span>&#160;        {</div>
-<div class="line"><a name="l11252"></a><span class="lineno">11252</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> nonNullItemCount = suballoc1stCount - nullItem1stCount;</div>
-<div class="line"><a name="l11253"></a><span class="lineno">11253</span>&#160;            <span class="keywordtype">size_t</span> srcIndex = m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l11254"></a><span class="lineno">11254</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> dstIndex = 0; dstIndex &lt; nonNullItemCount; ++dstIndex)</div>
-<div class="line"><a name="l11255"></a><span class="lineno">11255</span>&#160;            {</div>
-<div class="line"><a name="l11256"></a><span class="lineno">11256</span>&#160;                <span class="keywordflow">while</span>(suballocations1st[srcIndex].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l11257"></a><span class="lineno">11257</span>&#160;                {</div>
-<div class="line"><a name="l11258"></a><span class="lineno">11258</span>&#160;                    ++srcIndex;</div>
-<div class="line"><a name="l11259"></a><span class="lineno">11259</span>&#160;                }</div>
-<div class="line"><a name="l11260"></a><span class="lineno">11260</span>&#160;                <span class="keywordflow">if</span>(dstIndex != srcIndex)</div>
-<div class="line"><a name="l11261"></a><span class="lineno">11261</span>&#160;                {</div>
-<div class="line"><a name="l11262"></a><span class="lineno">11262</span>&#160;                    suballocations1st[dstIndex] = suballocations1st[srcIndex];</div>
-<div class="line"><a name="l11263"></a><span class="lineno">11263</span>&#160;                }</div>
-<div class="line"><a name="l11264"></a><span class="lineno">11264</span>&#160;                ++srcIndex;</div>
-<div class="line"><a name="l11265"></a><span class="lineno">11265</span>&#160;            }</div>
-<div class="line"><a name="l11266"></a><span class="lineno">11266</span>&#160;            suballocations1st.resize(nonNullItemCount);</div>
-<div class="line"><a name="l11267"></a><span class="lineno">11267</span>&#160;            m_1stNullItemsBeginCount = 0;</div>
-<div class="line"><a name="l11268"></a><span class="lineno">11268</span>&#160;            m_1stNullItemsMiddleCount = 0;</div>
-<div class="line"><a name="l11269"></a><span class="lineno">11269</span>&#160;        }</div>
-<div class="line"><a name="l11270"></a><span class="lineno">11270</span>&#160; </div>
-<div class="line"><a name="l11271"></a><span class="lineno">11271</span>&#160;        <span class="comment">// 2nd vector became empty.</span></div>
-<div class="line"><a name="l11272"></a><span class="lineno">11272</span>&#160;        <span class="keywordflow">if</span>(suballocations2nd.empty())</div>
-<div class="line"><a name="l11273"></a><span class="lineno">11273</span>&#160;        {</div>
-<div class="line"><a name="l11274"></a><span class="lineno">11274</span>&#160;            m_2ndVectorMode = SECOND_VECTOR_EMPTY;</div>
-<div class="line"><a name="l11275"></a><span class="lineno">11275</span>&#160;        }</div>
-<div class="line"><a name="l11276"></a><span class="lineno">11276</span>&#160; </div>
-<div class="line"><a name="l11277"></a><span class="lineno">11277</span>&#160;        <span class="comment">// 1st vector became empty.</span></div>
-<div class="line"><a name="l11278"></a><span class="lineno">11278</span>&#160;        <span class="keywordflow">if</span>(suballocations1st.size() - m_1stNullItemsBeginCount == 0)</div>
-<div class="line"><a name="l11279"></a><span class="lineno">11279</span>&#160;        {</div>
-<div class="line"><a name="l11280"></a><span class="lineno">11280</span>&#160;            suballocations1st.clear();</div>
-<div class="line"><a name="l11281"></a><span class="lineno">11281</span>&#160;            m_1stNullItemsBeginCount = 0;</div>
-<div class="line"><a name="l11282"></a><span class="lineno">11282</span>&#160; </div>
-<div class="line"><a name="l11283"></a><span class="lineno">11283</span>&#160;            <span class="keywordflow">if</span>(!suballocations2nd.empty() &amp;&amp; m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
-<div class="line"><a name="l11284"></a><span class="lineno">11284</span>&#160;            {</div>
-<div class="line"><a name="l11285"></a><span class="lineno">11285</span>&#160;                <span class="comment">// Swap 1st with 2nd. Now 2nd is empty.</span></div>
-<div class="line"><a name="l11286"></a><span class="lineno">11286</span>&#160;                m_2ndVectorMode = SECOND_VECTOR_EMPTY;</div>
-<div class="line"><a name="l11287"></a><span class="lineno">11287</span>&#160;                m_1stNullItemsMiddleCount = m_2ndNullItemsCount;</div>
-<div class="line"><a name="l11288"></a><span class="lineno">11288</span>&#160;                <span class="keywordflow">while</span>(m_1stNullItemsBeginCount &lt; suballocations2nd.size() &amp;&amp;</div>
-<div class="line"><a name="l11289"></a><span class="lineno">11289</span>&#160;                    suballocations2nd[m_1stNullItemsBeginCount].hAllocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l11290"></a><span class="lineno">11290</span>&#160;                {</div>
-<div class="line"><a name="l11291"></a><span class="lineno">11291</span>&#160;                    ++m_1stNullItemsBeginCount;</div>
-<div class="line"><a name="l11292"></a><span class="lineno">11292</span>&#160;                    --m_1stNullItemsMiddleCount;</div>
-<div class="line"><a name="l11293"></a><span class="lineno">11293</span>&#160;                }</div>
-<div class="line"><a name="l11294"></a><span class="lineno">11294</span>&#160;                m_2ndNullItemsCount = 0;</div>
-<div class="line"><a name="l11295"></a><span class="lineno">11295</span>&#160;                m_1stVectorIndex ^= 1;</div>
-<div class="line"><a name="l11296"></a><span class="lineno">11296</span>&#160;            }</div>
-<div class="line"><a name="l11297"></a><span class="lineno">11297</span>&#160;        }</div>
-<div class="line"><a name="l11298"></a><span class="lineno">11298</span>&#160;    }</div>
-<div class="line"><a name="l11299"></a><span class="lineno">11299</span>&#160; </div>
-<div class="line"><a name="l11300"></a><span class="lineno">11300</span>&#160;    VMA_HEAVY_ASSERT(Validate());</div>
-<div class="line"><a name="l11301"></a><span class="lineno">11301</span>&#160;}</div>
-<div class="line"><a name="l11302"></a><span class="lineno">11302</span>&#160; </div>
-<div class="line"><a name="l11303"></a><span class="lineno">11303</span>&#160; </div>
-<div class="line"><a name="l11305"></a><span class="lineno">11305</span>&#160;<span class="comment">// class VmaBlockMetadata_Buddy</span></div>
-<div class="line"><a name="l11306"></a><span class="lineno">11306</span>&#160; </div>
-<div class="line"><a name="l11307"></a><span class="lineno">11307</span>&#160;VmaBlockMetadata_Buddy::VmaBlockMetadata_Buddy(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator) :</div>
-<div class="line"><a name="l11308"></a><span class="lineno">11308</span>&#160;    VmaBlockMetadata(hAllocator),</div>
-<div class="line"><a name="l11309"></a><span class="lineno">11309</span>&#160;    m_Root(VMA_NULL),</div>
-<div class="line"><a name="l11310"></a><span class="lineno">11310</span>&#160;    m_AllocationCount(0),</div>
-<div class="line"><a name="l11311"></a><span class="lineno">11311</span>&#160;    m_FreeCount(1),</div>
-<div class="line"><a name="l11312"></a><span class="lineno">11312</span>&#160;    m_SumFreeSize(0)</div>
-<div class="line"><a name="l11313"></a><span class="lineno">11313</span>&#160;{</div>
-<div class="line"><a name="l11314"></a><span class="lineno">11314</span>&#160;    memset(m_FreeList, 0, <span class="keyword">sizeof</span>(m_FreeList));</div>
-<div class="line"><a name="l11315"></a><span class="lineno">11315</span>&#160;}</div>
-<div class="line"><a name="l11316"></a><span class="lineno">11316</span>&#160; </div>
-<div class="line"><a name="l11317"></a><span class="lineno">11317</span>&#160;VmaBlockMetadata_Buddy::~VmaBlockMetadata_Buddy()</div>
-<div class="line"><a name="l11318"></a><span class="lineno">11318</span>&#160;{</div>
-<div class="line"><a name="l11319"></a><span class="lineno">11319</span>&#160;    DeleteNode(m_Root);</div>
-<div class="line"><a name="l11320"></a><span class="lineno">11320</span>&#160;}</div>
-<div class="line"><a name="l11321"></a><span class="lineno">11321</span>&#160; </div>
-<div class="line"><a name="l11322"></a><span class="lineno">11322</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::Init(VkDeviceSize size)</div>
-<div class="line"><a name="l11323"></a><span class="lineno">11323</span>&#160;{</div>
-<div class="line"><a name="l11324"></a><span class="lineno">11324</span>&#160;    VmaBlockMetadata::Init(size);</div>
-<div class="line"><a name="l11325"></a><span class="lineno">11325</span>&#160; </div>
-<div class="line"><a name="l11326"></a><span class="lineno">11326</span>&#160;    m_UsableSize = VmaPrevPow2(size);</div>
-<div class="line"><a name="l11327"></a><span class="lineno">11327</span>&#160;    m_SumFreeSize = m_UsableSize;</div>
+<div class="line"><a name="l11233"></a><span class="lineno">11233</span>&#160;    }</div>
+<div class="line"><a name="l11234"></a><span class="lineno">11234</span>&#160; </div>
+<div class="line"><a name="l11235"></a><span class="lineno">11235</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l11236"></a><span class="lineno">11236</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0, count = suballocations2nd.size(); i &lt; count; ++i)</div>
+<div class="line"><a name="l11237"></a><span class="lineno">11237</span>&#160;    {</div>
+<div class="line"><a name="l11238"></a><span class="lineno">11238</span>&#160;        <span class="keyword">const</span> VmaSuballocation&amp; suballoc = suballocations2nd[i];</div>
+<div class="line"><a name="l11239"></a><span class="lineno">11239</span>&#160;        <span class="keywordflow">if</span>(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l11240"></a><span class="lineno">11240</span>&#160;        {</div>
+<div class="line"><a name="l11241"></a><span class="lineno">11241</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, suballoc.offset - VMA_DEBUG_MARGIN))</div>
+<div class="line"><a name="l11242"></a><span class="lineno">11242</span>&#160;            {</div>
+<div class="line"><a name="l11243"></a><span class="lineno">11243</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!&quot;</span>);</div>
+<div class="line"><a name="l11244"></a><span class="lineno">11244</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
+<div class="line"><a name="l11245"></a><span class="lineno">11245</span>&#160;            }</div>
+<div class="line"><a name="l11246"></a><span class="lineno">11246</span>&#160;            <span class="keywordflow">if</span>(!VmaValidateMagicValue(pBlockData, suballoc.offset + suballoc.size))</div>
+<div class="line"><a name="l11247"></a><span class="lineno">11247</span>&#160;            {</div>
+<div class="line"><a name="l11248"></a><span class="lineno">11248</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!&quot;</span>);</div>
+<div class="line"><a name="l11249"></a><span class="lineno">11249</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
+<div class="line"><a name="l11250"></a><span class="lineno">11250</span>&#160;            }</div>
+<div class="line"><a name="l11251"></a><span class="lineno">11251</span>&#160;        }</div>
+<div class="line"><a name="l11252"></a><span class="lineno">11252</span>&#160;    }</div>
+<div class="line"><a name="l11253"></a><span class="lineno">11253</span>&#160; </div>
+<div class="line"><a name="l11254"></a><span class="lineno">11254</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l11255"></a><span class="lineno">11255</span>&#160;}</div>
+<div class="line"><a name="l11256"></a><span class="lineno">11256</span>&#160; </div>
+<div class="line"><a name="l11257"></a><span class="lineno">11257</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::Alloc(</div>
+<div class="line"><a name="l11258"></a><span class="lineno">11258</span>&#160;    <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
+<div class="line"><a name="l11259"></a><span class="lineno">11259</span>&#160;    VmaSuballocationType type,</div>
+<div class="line"><a name="l11260"></a><span class="lineno">11260</span>&#160;    VkDeviceSize allocSize,</div>
+<div class="line"><a name="l11261"></a><span class="lineno">11261</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
+<div class="line"><a name="l11262"></a><span class="lineno">11262</span>&#160;{</div>
+<div class="line"><a name="l11263"></a><span class="lineno">11263</span>&#160;    <span class="keyword">const</span> VmaSuballocation newSuballoc = { request.offset, allocSize, hAllocation, type };</div>
+<div class="line"><a name="l11264"></a><span class="lineno">11264</span>&#160; </div>
+<div class="line"><a name="l11265"></a><span class="lineno">11265</span>&#160;    <span class="keywordflow">switch</span>(request.type)</div>
+<div class="line"><a name="l11266"></a><span class="lineno">11266</span>&#160;    {</div>
+<div class="line"><a name="l11267"></a><span class="lineno">11267</span>&#160;    <span class="keywordflow">case</span> VmaAllocationRequestType::UpperAddress:</div>
+<div class="line"><a name="l11268"></a><span class="lineno">11268</span>&#160;        {</div>
+<div class="line"><a name="l11269"></a><span class="lineno">11269</span>&#160;            VMA_ASSERT(m_2ndVectorMode != SECOND_VECTOR_RING_BUFFER &amp;&amp;</div>
+<div class="line"><a name="l11270"></a><span class="lineno">11270</span>&#160;                <span class="stringliteral">&quot;CRITICAL ERROR: Trying to use linear allocator as double stack while it was already used as ring buffer.&quot;</span>);</div>
+<div class="line"><a name="l11271"></a><span class="lineno">11271</span>&#160;            SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l11272"></a><span class="lineno">11272</span>&#160;            suballocations2nd.push_back(newSuballoc);</div>
+<div class="line"><a name="l11273"></a><span class="lineno">11273</span>&#160;            m_2ndVectorMode = SECOND_VECTOR_DOUBLE_STACK;</div>
+<div class="line"><a name="l11274"></a><span class="lineno">11274</span>&#160;        }</div>
+<div class="line"><a name="l11275"></a><span class="lineno">11275</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11276"></a><span class="lineno">11276</span>&#160;    <span class="keywordflow">case</span> VmaAllocationRequestType::EndOf1st:</div>
+<div class="line"><a name="l11277"></a><span class="lineno">11277</span>&#160;        {</div>
+<div class="line"><a name="l11278"></a><span class="lineno">11278</span>&#160;            SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l11279"></a><span class="lineno">11279</span>&#160; </div>
+<div class="line"><a name="l11280"></a><span class="lineno">11280</span>&#160;            VMA_ASSERT(suballocations1st.empty() ||</div>
+<div class="line"><a name="l11281"></a><span class="lineno">11281</span>&#160;                request.offset &gt;= suballocations1st.back().offset + suballocations1st.back().size);</div>
+<div class="line"><a name="l11282"></a><span class="lineno">11282</span>&#160;            <span class="comment">// Check if it fits before the end of the block.</span></div>
+<div class="line"><a name="l11283"></a><span class="lineno">11283</span>&#160;            VMA_ASSERT(request.offset + allocSize &lt;= GetSize());</div>
+<div class="line"><a name="l11284"></a><span class="lineno">11284</span>&#160; </div>
+<div class="line"><a name="l11285"></a><span class="lineno">11285</span>&#160;            suballocations1st.push_back(newSuballoc);</div>
+<div class="line"><a name="l11286"></a><span class="lineno">11286</span>&#160;        }</div>
+<div class="line"><a name="l11287"></a><span class="lineno">11287</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11288"></a><span class="lineno">11288</span>&#160;    <span class="keywordflow">case</span> VmaAllocationRequestType::EndOf2nd:</div>
+<div class="line"><a name="l11289"></a><span class="lineno">11289</span>&#160;        {</div>
+<div class="line"><a name="l11290"></a><span class="lineno">11290</span>&#160;            SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l11291"></a><span class="lineno">11291</span>&#160;            <span class="comment">// New allocation at the end of 2-part ring buffer, so before first allocation from 1st vector.</span></div>
+<div class="line"><a name="l11292"></a><span class="lineno">11292</span>&#160;            VMA_ASSERT(!suballocations1st.empty() &amp;&amp;</div>
+<div class="line"><a name="l11293"></a><span class="lineno">11293</span>&#160;                request.offset + allocSize &lt;= suballocations1st[m_1stNullItemsBeginCount].offset);</div>
+<div class="line"><a name="l11294"></a><span class="lineno">11294</span>&#160;            SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l11295"></a><span class="lineno">11295</span>&#160; </div>
+<div class="line"><a name="l11296"></a><span class="lineno">11296</span>&#160;            <span class="keywordflow">switch</span>(m_2ndVectorMode)</div>
+<div class="line"><a name="l11297"></a><span class="lineno">11297</span>&#160;            {</div>
+<div class="line"><a name="l11298"></a><span class="lineno">11298</span>&#160;            <span class="keywordflow">case</span> SECOND_VECTOR_EMPTY:</div>
+<div class="line"><a name="l11299"></a><span class="lineno">11299</span>&#160;                <span class="comment">// First allocation from second part ring buffer.</span></div>
+<div class="line"><a name="l11300"></a><span class="lineno">11300</span>&#160;                VMA_ASSERT(suballocations2nd.empty());</div>
+<div class="line"><a name="l11301"></a><span class="lineno">11301</span>&#160;                m_2ndVectorMode = SECOND_VECTOR_RING_BUFFER;</div>
+<div class="line"><a name="l11302"></a><span class="lineno">11302</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11303"></a><span class="lineno">11303</span>&#160;            <span class="keywordflow">case</span> SECOND_VECTOR_RING_BUFFER:</div>
+<div class="line"><a name="l11304"></a><span class="lineno">11304</span>&#160;                <span class="comment">// 2-part ring buffer is already started.</span></div>
+<div class="line"><a name="l11305"></a><span class="lineno">11305</span>&#160;                VMA_ASSERT(!suballocations2nd.empty());</div>
+<div class="line"><a name="l11306"></a><span class="lineno">11306</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11307"></a><span class="lineno">11307</span>&#160;            <span class="keywordflow">case</span> SECOND_VECTOR_DOUBLE_STACK:</div>
+<div class="line"><a name="l11308"></a><span class="lineno">11308</span>&#160;                VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;CRITICAL ERROR: Trying to use linear allocator as ring buffer while it was already used as double stack.&quot;</span>);</div>
+<div class="line"><a name="l11309"></a><span class="lineno">11309</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11310"></a><span class="lineno">11310</span>&#160;            <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l11311"></a><span class="lineno">11311</span>&#160;                VMA_ASSERT(0);</div>
+<div class="line"><a name="l11312"></a><span class="lineno">11312</span>&#160;            }</div>
+<div class="line"><a name="l11313"></a><span class="lineno">11313</span>&#160; </div>
+<div class="line"><a name="l11314"></a><span class="lineno">11314</span>&#160;            suballocations2nd.push_back(newSuballoc);</div>
+<div class="line"><a name="l11315"></a><span class="lineno">11315</span>&#160;        }</div>
+<div class="line"><a name="l11316"></a><span class="lineno">11316</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11317"></a><span class="lineno">11317</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l11318"></a><span class="lineno">11318</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;CRITICAL INTERNAL ERROR.&quot;</span>);</div>
+<div class="line"><a name="l11319"></a><span class="lineno">11319</span>&#160;    }</div>
+<div class="line"><a name="l11320"></a><span class="lineno">11320</span>&#160; </div>
+<div class="line"><a name="l11321"></a><span class="lineno">11321</span>&#160;    m_SumFreeSize -= newSuballoc.size;</div>
+<div class="line"><a name="l11322"></a><span class="lineno">11322</span>&#160;}</div>
+<div class="line"><a name="l11323"></a><span class="lineno">11323</span>&#160; </div>
+<div class="line"><a name="l11324"></a><span class="lineno">11324</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l11325"></a><span class="lineno">11325</span>&#160;{</div>
+<div class="line"><a name="l11326"></a><span class="lineno">11326</span>&#160;    FreeAtOffset(allocation-&gt;GetOffset());</div>
+<div class="line"><a name="l11327"></a><span class="lineno">11327</span>&#160;}</div>
 <div class="line"><a name="l11328"></a><span class="lineno">11328</span>&#160; </div>
-<div class="line"><a name="l11329"></a><span class="lineno">11329</span>&#160;    <span class="comment">// Calculate m_LevelCount.</span></div>
-<div class="line"><a name="l11330"></a><span class="lineno">11330</span>&#160;    m_LevelCount = 1;</div>
-<div class="line"><a name="l11331"></a><span class="lineno">11331</span>&#160;    <span class="keywordflow">while</span>(m_LevelCount &lt; MAX_LEVELS &amp;&amp;</div>
-<div class="line"><a name="l11332"></a><span class="lineno">11332</span>&#160;        LevelToNodeSize(m_LevelCount) &gt;= MIN_NODE_SIZE)</div>
-<div class="line"><a name="l11333"></a><span class="lineno">11333</span>&#160;    {</div>
-<div class="line"><a name="l11334"></a><span class="lineno">11334</span>&#160;        ++m_LevelCount;</div>
-<div class="line"><a name="l11335"></a><span class="lineno">11335</span>&#160;    }</div>
-<div class="line"><a name="l11336"></a><span class="lineno">11336</span>&#160; </div>
-<div class="line"><a name="l11337"></a><span class="lineno">11337</span>&#160;    Node* rootNode = vma_new(GetAllocationCallbacks(), Node)();</div>
-<div class="line"><a name="l11338"></a><span class="lineno">11338</span>&#160;    rootNode-&gt;offset = 0;</div>
-<div class="line"><a name="l11339"></a><span class="lineno">11339</span>&#160;    rootNode-&gt;type = Node::TYPE_FREE;</div>
-<div class="line"><a name="l11340"></a><span class="lineno">11340</span>&#160;    rootNode-&gt;parent = VMA_NULL;</div>
-<div class="line"><a name="l11341"></a><span class="lineno">11341</span>&#160;    rootNode-&gt;buddy = VMA_NULL;</div>
-<div class="line"><a name="l11342"></a><span class="lineno">11342</span>&#160; </div>
-<div class="line"><a name="l11343"></a><span class="lineno">11343</span>&#160;    m_Root = rootNode;</div>
-<div class="line"><a name="l11344"></a><span class="lineno">11344</span>&#160;    AddToFreeListFront(0, rootNode);</div>
-<div class="line"><a name="l11345"></a><span class="lineno">11345</span>&#160;}</div>
-<div class="line"><a name="l11346"></a><span class="lineno">11346</span>&#160; </div>
-<div class="line"><a name="l11347"></a><span class="lineno">11347</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Buddy::Validate()<span class="keyword"> const</span></div>
-<div class="line"><a name="l11348"></a><span class="lineno">11348</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l11349"></a><span class="lineno">11349</span>&#160;    <span class="comment">// Validate tree.</span></div>
-<div class="line"><a name="l11350"></a><span class="lineno">11350</span>&#160;    ValidationContext ctx;</div>
-<div class="line"><a name="l11351"></a><span class="lineno">11351</span>&#160;    <span class="keywordflow">if</span>(!ValidateNode(ctx, VMA_NULL, m_Root, 0, LevelToNodeSize(0)))</div>
+<div class="line"><a name="l11329"></a><span class="lineno">11329</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::FreeAtOffset(VkDeviceSize offset)</div>
+<div class="line"><a name="l11330"></a><span class="lineno">11330</span>&#160;{</div>
+<div class="line"><a name="l11331"></a><span class="lineno">11331</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l11332"></a><span class="lineno">11332</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l11333"></a><span class="lineno">11333</span>&#160; </div>
+<div class="line"><a name="l11334"></a><span class="lineno">11334</span>&#160;    <span class="keywordflow">if</span>(!suballocations1st.empty())</div>
+<div class="line"><a name="l11335"></a><span class="lineno">11335</span>&#160;    {</div>
+<div class="line"><a name="l11336"></a><span class="lineno">11336</span>&#160;        <span class="comment">// First allocation: Mark it as next empty at the beginning.</span></div>
+<div class="line"><a name="l11337"></a><span class="lineno">11337</span>&#160;        VmaSuballocation&amp; firstSuballoc = suballocations1st[m_1stNullItemsBeginCount];</div>
+<div class="line"><a name="l11338"></a><span class="lineno">11338</span>&#160;        <span class="keywordflow">if</span>(firstSuballoc.offset == offset)</div>
+<div class="line"><a name="l11339"></a><span class="lineno">11339</span>&#160;        {</div>
+<div class="line"><a name="l11340"></a><span class="lineno">11340</span>&#160;            firstSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;</div>
+<div class="line"><a name="l11341"></a><span class="lineno">11341</span>&#160;            firstSuballoc.hAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l11342"></a><span class="lineno">11342</span>&#160;            m_SumFreeSize += firstSuballoc.size;</div>
+<div class="line"><a name="l11343"></a><span class="lineno">11343</span>&#160;            ++m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l11344"></a><span class="lineno">11344</span>&#160;            CleanupAfterFree();</div>
+<div class="line"><a name="l11345"></a><span class="lineno">11345</span>&#160;            <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l11346"></a><span class="lineno">11346</span>&#160;        }</div>
+<div class="line"><a name="l11347"></a><span class="lineno">11347</span>&#160;    }</div>
+<div class="line"><a name="l11348"></a><span class="lineno">11348</span>&#160; </div>
+<div class="line"><a name="l11349"></a><span class="lineno">11349</span>&#160;    <span class="comment">// Last allocation in 2-part ring buffer or top of upper stack (same logic).</span></div>
+<div class="line"><a name="l11350"></a><span class="lineno">11350</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER ||</div>
+<div class="line"><a name="l11351"></a><span class="lineno">11351</span>&#160;        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)</div>
 <div class="line"><a name="l11352"></a><span class="lineno">11352</span>&#160;    {</div>
-<div class="line"><a name="l11353"></a><span class="lineno">11353</span>&#160;        VMA_VALIDATE(<span class="keyword">false</span> &amp;&amp; <span class="stringliteral">&quot;ValidateNode failed.&quot;</span>);</div>
-<div class="line"><a name="l11354"></a><span class="lineno">11354</span>&#160;    }</div>
-<div class="line"><a name="l11355"></a><span class="lineno">11355</span>&#160;    VMA_VALIDATE(m_AllocationCount == ctx.calculatedAllocationCount);</div>
-<div class="line"><a name="l11356"></a><span class="lineno">11356</span>&#160;    VMA_VALIDATE(m_SumFreeSize == ctx.calculatedSumFreeSize);</div>
-<div class="line"><a name="l11357"></a><span class="lineno">11357</span>&#160; </div>
-<div class="line"><a name="l11358"></a><span class="lineno">11358</span>&#160;    <span class="comment">// Validate free node lists.</span></div>
-<div class="line"><a name="l11359"></a><span class="lineno">11359</span>&#160;    <span class="keywordflow">for</span>(uint32_t level = 0; level &lt; m_LevelCount; ++level)</div>
-<div class="line"><a name="l11360"></a><span class="lineno">11360</span>&#160;    {</div>
-<div class="line"><a name="l11361"></a><span class="lineno">11361</span>&#160;        VMA_VALIDATE(m_FreeList[level].front == VMA_NULL ||</div>
-<div class="line"><a name="l11362"></a><span class="lineno">11362</span>&#160;            m_FreeList[level].front-&gt;free.prev == VMA_NULL);</div>
-<div class="line"><a name="l11363"></a><span class="lineno">11363</span>&#160; </div>
-<div class="line"><a name="l11364"></a><span class="lineno">11364</span>&#160;        <span class="keywordflow">for</span>(Node* node = m_FreeList[level].front;</div>
-<div class="line"><a name="l11365"></a><span class="lineno">11365</span>&#160;            node != VMA_NULL;</div>
-<div class="line"><a name="l11366"></a><span class="lineno">11366</span>&#160;            node = node-&gt;free.next)</div>
+<div class="line"><a name="l11353"></a><span class="lineno">11353</span>&#160;        VmaSuballocation&amp; lastSuballoc = suballocations2nd.back();</div>
+<div class="line"><a name="l11354"></a><span class="lineno">11354</span>&#160;        <span class="keywordflow">if</span>(lastSuballoc.offset == offset)</div>
+<div class="line"><a name="l11355"></a><span class="lineno">11355</span>&#160;        {</div>
+<div class="line"><a name="l11356"></a><span class="lineno">11356</span>&#160;            m_SumFreeSize += lastSuballoc.size;</div>
+<div class="line"><a name="l11357"></a><span class="lineno">11357</span>&#160;            suballocations2nd.pop_back();</div>
+<div class="line"><a name="l11358"></a><span class="lineno">11358</span>&#160;            CleanupAfterFree();</div>
+<div class="line"><a name="l11359"></a><span class="lineno">11359</span>&#160;            <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l11360"></a><span class="lineno">11360</span>&#160;        }</div>
+<div class="line"><a name="l11361"></a><span class="lineno">11361</span>&#160;    }</div>
+<div class="line"><a name="l11362"></a><span class="lineno">11362</span>&#160;    <span class="comment">// Last allocation in 1st vector.</span></div>
+<div class="line"><a name="l11363"></a><span class="lineno">11363</span>&#160;    <span class="keywordflow">else</span> <span class="keywordflow">if</span>(m_2ndVectorMode == SECOND_VECTOR_EMPTY)</div>
+<div class="line"><a name="l11364"></a><span class="lineno">11364</span>&#160;    {</div>
+<div class="line"><a name="l11365"></a><span class="lineno">11365</span>&#160;        VmaSuballocation&amp; lastSuballoc = suballocations1st.back();</div>
+<div class="line"><a name="l11366"></a><span class="lineno">11366</span>&#160;        <span class="keywordflow">if</span>(lastSuballoc.offset == offset)</div>
 <div class="line"><a name="l11367"></a><span class="lineno">11367</span>&#160;        {</div>
-<div class="line"><a name="l11368"></a><span class="lineno">11368</span>&#160;            VMA_VALIDATE(node-&gt;type == Node::TYPE_FREE);</div>
-<div class="line"><a name="l11369"></a><span class="lineno">11369</span>&#160;            </div>
-<div class="line"><a name="l11370"></a><span class="lineno">11370</span>&#160;            <span class="keywordflow">if</span>(node-&gt;free.next == VMA_NULL)</div>
-<div class="line"><a name="l11371"></a><span class="lineno">11371</span>&#160;            {</div>
-<div class="line"><a name="l11372"></a><span class="lineno">11372</span>&#160;                VMA_VALIDATE(m_FreeList[level].back == node);</div>
-<div class="line"><a name="l11373"></a><span class="lineno">11373</span>&#160;            }</div>
-<div class="line"><a name="l11374"></a><span class="lineno">11374</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l11375"></a><span class="lineno">11375</span>&#160;            {</div>
-<div class="line"><a name="l11376"></a><span class="lineno">11376</span>&#160;                VMA_VALIDATE(node-&gt;free.next-&gt;free.prev == node);</div>
-<div class="line"><a name="l11377"></a><span class="lineno">11377</span>&#160;            }</div>
-<div class="line"><a name="l11378"></a><span class="lineno">11378</span>&#160;        }</div>
-<div class="line"><a name="l11379"></a><span class="lineno">11379</span>&#160;    }</div>
-<div class="line"><a name="l11380"></a><span class="lineno">11380</span>&#160; </div>
-<div class="line"><a name="l11381"></a><span class="lineno">11381</span>&#160;    <span class="comment">// Validate that free lists ar higher levels are empty.</span></div>
-<div class="line"><a name="l11382"></a><span class="lineno">11382</span>&#160;    <span class="keywordflow">for</span>(uint32_t level = m_LevelCount; level &lt; MAX_LEVELS; ++level)</div>
-<div class="line"><a name="l11383"></a><span class="lineno">11383</span>&#160;    {</div>
-<div class="line"><a name="l11384"></a><span class="lineno">11384</span>&#160;        VMA_VALIDATE(m_FreeList[level].front == VMA_NULL &amp;&amp; m_FreeList[level].back == VMA_NULL);</div>
-<div class="line"><a name="l11385"></a><span class="lineno">11385</span>&#160;    }</div>
-<div class="line"><a name="l11386"></a><span class="lineno">11386</span>&#160; </div>
-<div class="line"><a name="l11387"></a><span class="lineno">11387</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l11388"></a><span class="lineno">11388</span>&#160;}</div>
-<div class="line"><a name="l11389"></a><span class="lineno">11389</span>&#160; </div>
-<div class="line"><a name="l11390"></a><span class="lineno">11390</span>&#160;VkDeviceSize VmaBlockMetadata_Buddy::GetUnusedRangeSizeMax()<span class="keyword"> const</span></div>
-<div class="line"><a name="l11391"></a><span class="lineno">11391</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l11392"></a><span class="lineno">11392</span>&#160;    <span class="keywordflow">for</span>(uint32_t level = 0; level &lt; m_LevelCount; ++level)</div>
-<div class="line"><a name="l11393"></a><span class="lineno">11393</span>&#160;    {</div>
-<div class="line"><a name="l11394"></a><span class="lineno">11394</span>&#160;        <span class="keywordflow">if</span>(m_FreeList[level].front != VMA_NULL)</div>
-<div class="line"><a name="l11395"></a><span class="lineno">11395</span>&#160;        {</div>
-<div class="line"><a name="l11396"></a><span class="lineno">11396</span>&#160;            <span class="keywordflow">return</span> LevelToNodeSize(level);</div>
-<div class="line"><a name="l11397"></a><span class="lineno">11397</span>&#160;        }</div>
-<div class="line"><a name="l11398"></a><span class="lineno">11398</span>&#160;    }</div>
-<div class="line"><a name="l11399"></a><span class="lineno">11399</span>&#160;    <span class="keywordflow">return</span> 0;</div>
-<div class="line"><a name="l11400"></a><span class="lineno">11400</span>&#160;}</div>
-<div class="line"><a name="l11401"></a><span class="lineno">11401</span>&#160; </div>
-<div class="line"><a name="l11402"></a><span class="lineno">11402</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo)<span class="keyword"> const</span></div>
-<div class="line"><a name="l11403"></a><span class="lineno">11403</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l11404"></a><span class="lineno">11404</span>&#160;    <span class="keyword">const</span> VkDeviceSize unusableSize = GetUnusableSize();</div>
-<div class="line"><a name="l11405"></a><span class="lineno">11405</span>&#160; </div>
-<div class="line"><a name="l11406"></a><span class="lineno">11406</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> = 1;</div>
-<div class="line"><a name="l11407"></a><span class="lineno">11407</span>&#160; </div>
-<div class="line"><a name="l11408"></a><span class="lineno">11408</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> = 0;</div>
-<div class="line"><a name="l11409"></a><span class="lineno">11409</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> = 0;</div>
-<div class="line"><a name="l11410"></a><span class="lineno">11410</span>&#160; </div>
-<div class="line"><a name="l11411"></a><span class="lineno">11411</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = 0;</div>
-<div class="line"><a name="l11412"></a><span class="lineno">11412</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = UINT64_MAX;</div>
-<div class="line"><a name="l11413"></a><span class="lineno">11413</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a1081a039964e566c672e7a2347f9e599">allocationSizeAvg</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#a2f9b3452af90c9768a30b7fb6ae194fc">unusedRangeSizeAvg</a> = 0; <span class="comment">// Unused.</span></div>
-<div class="line"><a name="l11414"></a><span class="lineno">11414</span>&#160; </div>
-<div class="line"><a name="l11415"></a><span class="lineno">11415</span>&#160;    CalcAllocationStatInfoNode(outInfo, m_Root, LevelToNodeSize(0));</div>
-<div class="line"><a name="l11416"></a><span class="lineno">11416</span>&#160; </div>
-<div class="line"><a name="l11417"></a><span class="lineno">11417</span>&#160;    <span class="keywordflow">if</span>(unusableSize &gt; 0)</div>
-<div class="line"><a name="l11418"></a><span class="lineno">11418</span>&#160;    {</div>
-<div class="line"><a name="l11419"></a><span class="lineno">11419</span>&#160;        ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
-<div class="line"><a name="l11420"></a><span class="lineno">11420</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusableSize;</div>
-<div class="line"><a name="l11421"></a><span class="lineno">11421</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusableSize);</div>
-<div class="line"><a name="l11422"></a><span class="lineno">11422</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusableSize);</div>
-<div class="line"><a name="l11423"></a><span class="lineno">11423</span>&#160;    }</div>
+<div class="line"><a name="l11368"></a><span class="lineno">11368</span>&#160;            m_SumFreeSize += lastSuballoc.size;</div>
+<div class="line"><a name="l11369"></a><span class="lineno">11369</span>&#160;            suballocations1st.pop_back();</div>
+<div class="line"><a name="l11370"></a><span class="lineno">11370</span>&#160;            CleanupAfterFree();</div>
+<div class="line"><a name="l11371"></a><span class="lineno">11371</span>&#160;            <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l11372"></a><span class="lineno">11372</span>&#160;        }</div>
+<div class="line"><a name="l11373"></a><span class="lineno">11373</span>&#160;    }</div>
+<div class="line"><a name="l11374"></a><span class="lineno">11374</span>&#160; </div>
+<div class="line"><a name="l11375"></a><span class="lineno">11375</span>&#160;    <span class="comment">// Item from the middle of 1st vector.</span></div>
+<div class="line"><a name="l11376"></a><span class="lineno">11376</span>&#160;    {</div>
+<div class="line"><a name="l11377"></a><span class="lineno">11377</span>&#160;        VmaSuballocation refSuballoc;</div>
+<div class="line"><a name="l11378"></a><span class="lineno">11378</span>&#160;        refSuballoc.offset = offset;</div>
+<div class="line"><a name="l11379"></a><span class="lineno">11379</span>&#160;        <span class="comment">// Rest of members stays uninitialized intentionally for better performance.</span></div>
+<div class="line"><a name="l11380"></a><span class="lineno">11380</span>&#160;        SuballocationVectorType::iterator it = VmaBinaryFindSorted(</div>
+<div class="line"><a name="l11381"></a><span class="lineno">11381</span>&#160;            suballocations1st.begin() + m_1stNullItemsBeginCount,</div>
+<div class="line"><a name="l11382"></a><span class="lineno">11382</span>&#160;            suballocations1st.end(),</div>
+<div class="line"><a name="l11383"></a><span class="lineno">11383</span>&#160;            refSuballoc,</div>
+<div class="line"><a name="l11384"></a><span class="lineno">11384</span>&#160;            VmaSuballocationOffsetLess());</div>
+<div class="line"><a name="l11385"></a><span class="lineno">11385</span>&#160;        <span class="keywordflow">if</span>(it != suballocations1st.end())</div>
+<div class="line"><a name="l11386"></a><span class="lineno">11386</span>&#160;        {</div>
+<div class="line"><a name="l11387"></a><span class="lineno">11387</span>&#160;            it-&gt;type = VMA_SUBALLOCATION_TYPE_FREE;</div>
+<div class="line"><a name="l11388"></a><span class="lineno">11388</span>&#160;            it-&gt;hAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l11389"></a><span class="lineno">11389</span>&#160;            ++m_1stNullItemsMiddleCount;</div>
+<div class="line"><a name="l11390"></a><span class="lineno">11390</span>&#160;            m_SumFreeSize += it-&gt;size;</div>
+<div class="line"><a name="l11391"></a><span class="lineno">11391</span>&#160;            CleanupAfterFree();</div>
+<div class="line"><a name="l11392"></a><span class="lineno">11392</span>&#160;            <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l11393"></a><span class="lineno">11393</span>&#160;        }</div>
+<div class="line"><a name="l11394"></a><span class="lineno">11394</span>&#160;    }</div>
+<div class="line"><a name="l11395"></a><span class="lineno">11395</span>&#160; </div>
+<div class="line"><a name="l11396"></a><span class="lineno">11396</span>&#160;    <span class="keywordflow">if</span>(m_2ndVectorMode != SECOND_VECTOR_EMPTY)</div>
+<div class="line"><a name="l11397"></a><span class="lineno">11397</span>&#160;    {</div>
+<div class="line"><a name="l11398"></a><span class="lineno">11398</span>&#160;        <span class="comment">// Item from the middle of 2nd vector.</span></div>
+<div class="line"><a name="l11399"></a><span class="lineno">11399</span>&#160;        VmaSuballocation refSuballoc;</div>
+<div class="line"><a name="l11400"></a><span class="lineno">11400</span>&#160;        refSuballoc.offset = offset;</div>
+<div class="line"><a name="l11401"></a><span class="lineno">11401</span>&#160;        <span class="comment">// Rest of members stays uninitialized intentionally for better performance.</span></div>
+<div class="line"><a name="l11402"></a><span class="lineno">11402</span>&#160;        SuballocationVectorType::iterator it = m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER ?</div>
+<div class="line"><a name="l11403"></a><span class="lineno">11403</span>&#160;            VmaBinaryFindSorted(suballocations2nd.begin(), suballocations2nd.end(), refSuballoc, VmaSuballocationOffsetLess()) :</div>
+<div class="line"><a name="l11404"></a><span class="lineno">11404</span>&#160;            VmaBinaryFindSorted(suballocations2nd.begin(), suballocations2nd.end(), refSuballoc, VmaSuballocationOffsetGreater());</div>
+<div class="line"><a name="l11405"></a><span class="lineno">11405</span>&#160;        <span class="keywordflow">if</span>(it != suballocations2nd.end())</div>
+<div class="line"><a name="l11406"></a><span class="lineno">11406</span>&#160;        {</div>
+<div class="line"><a name="l11407"></a><span class="lineno">11407</span>&#160;            it-&gt;type = VMA_SUBALLOCATION_TYPE_FREE;</div>
+<div class="line"><a name="l11408"></a><span class="lineno">11408</span>&#160;            it-&gt;hAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l11409"></a><span class="lineno">11409</span>&#160;            ++m_2ndNullItemsCount;</div>
+<div class="line"><a name="l11410"></a><span class="lineno">11410</span>&#160;            m_SumFreeSize += it-&gt;size;</div>
+<div class="line"><a name="l11411"></a><span class="lineno">11411</span>&#160;            CleanupAfterFree();</div>
+<div class="line"><a name="l11412"></a><span class="lineno">11412</span>&#160;            <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l11413"></a><span class="lineno">11413</span>&#160;        }</div>
+<div class="line"><a name="l11414"></a><span class="lineno">11414</span>&#160;    }</div>
+<div class="line"><a name="l11415"></a><span class="lineno">11415</span>&#160; </div>
+<div class="line"><a name="l11416"></a><span class="lineno">11416</span>&#160;    VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Allocation to free not found in linear allocator!&quot;</span>);</div>
+<div class="line"><a name="l11417"></a><span class="lineno">11417</span>&#160;}</div>
+<div class="line"><a name="l11418"></a><span class="lineno">11418</span>&#160; </div>
+<div class="line"><a name="l11419"></a><span class="lineno">11419</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Linear::ShouldCompact1st()<span class="keyword"> const</span></div>
+<div class="line"><a name="l11420"></a><span class="lineno">11420</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l11421"></a><span class="lineno">11421</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> nullItemCount = m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount;</div>
+<div class="line"><a name="l11422"></a><span class="lineno">11422</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballocCount = AccessSuballocations1st().size();</div>
+<div class="line"><a name="l11423"></a><span class="lineno">11423</span>&#160;    <span class="keywordflow">return</span> suballocCount &gt; 32 &amp;&amp; nullItemCount * 2 &gt;= (suballocCount - nullItemCount) * 3;</div>
 <div class="line"><a name="l11424"></a><span class="lineno">11424</span>&#160;}</div>
 <div class="line"><a name="l11425"></a><span class="lineno">11425</span>&#160; </div>
-<div class="line"><a name="l11426"></a><span class="lineno">11426</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats)<span class="keyword"> const</span></div>
-<div class="line"><a name="l11427"></a><span class="lineno">11427</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l11428"></a><span class="lineno">11428</span>&#160;    <span class="keyword">const</span> VkDeviceSize unusableSize = GetUnusableSize();</div>
-<div class="line"><a name="l11429"></a><span class="lineno">11429</span>&#160; </div>
-<div class="line"><a name="l11430"></a><span class="lineno">11430</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a> += GetSize();</div>
-<div class="line"><a name="l11431"></a><span class="lineno">11431</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += m_SumFreeSize + unusableSize;</div>
-<div class="line"><a name="l11432"></a><span class="lineno">11432</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a> += m_AllocationCount;</div>
-<div class="line"><a name="l11433"></a><span class="lineno">11433</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a> += m_FreeCount;</div>
-<div class="line"><a name="l11434"></a><span class="lineno">11434</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, GetUnusedRangeSizeMax());</div>
-<div class="line"><a name="l11435"></a><span class="lineno">11435</span>&#160; </div>
-<div class="line"><a name="l11436"></a><span class="lineno">11436</span>&#160;    <span class="keywordflow">if</span>(unusableSize &gt; 0)</div>
-<div class="line"><a name="l11437"></a><span class="lineno">11437</span>&#160;    {</div>
-<div class="line"><a name="l11438"></a><span class="lineno">11438</span>&#160;        ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
-<div class="line"><a name="l11439"></a><span class="lineno">11439</span>&#160;        <span class="comment">// Not updating inoutStats.unusedRangeSizeMax with unusableSize because this space is not available for allocations.</span></div>
-<div class="line"><a name="l11440"></a><span class="lineno">11440</span>&#160;    }</div>
-<div class="line"><a name="l11441"></a><span class="lineno">11441</span>&#160;}</div>
-<div class="line"><a name="l11442"></a><span class="lineno">11442</span>&#160; </div>
-<div class="line"><a name="l11443"></a><span class="lineno">11443</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l11444"></a><span class="lineno">11444</span>&#160; </div>
-<div class="line"><a name="l11445"></a><span class="lineno">11445</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json)<span class="keyword"> const</span></div>
-<div class="line"><a name="l11446"></a><span class="lineno">11446</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l11447"></a><span class="lineno">11447</span>&#160;    <span class="comment">// TODO optimize</span></div>
-<div class="line"><a name="l11448"></a><span class="lineno">11448</span>&#160;    <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> stat;</div>
-<div class="line"><a name="l11449"></a><span class="lineno">11449</span>&#160;    CalcAllocationStatInfo(stat);</div>
-<div class="line"><a name="l11450"></a><span class="lineno">11450</span>&#160; </div>
-<div class="line"><a name="l11451"></a><span class="lineno">11451</span>&#160;    PrintDetailedMap_Begin(</div>
-<div class="line"><a name="l11452"></a><span class="lineno">11452</span>&#160;        json,</div>
-<div class="line"><a name="l11453"></a><span class="lineno">11453</span>&#160;        stat.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>,</div>
-<div class="line"><a name="l11454"></a><span class="lineno">11454</span>&#160;        stat.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>,</div>
-<div class="line"><a name="l11455"></a><span class="lineno">11455</span>&#160;        stat.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>);</div>
-<div class="line"><a name="l11456"></a><span class="lineno">11456</span>&#160; </div>
-<div class="line"><a name="l11457"></a><span class="lineno">11457</span>&#160;    PrintDetailedMapNode(json, m_Root, LevelToNodeSize(0));</div>
-<div class="line"><a name="l11458"></a><span class="lineno">11458</span>&#160; </div>
-<div class="line"><a name="l11459"></a><span class="lineno">11459</span>&#160;    <span class="keyword">const</span> VkDeviceSize unusableSize = GetUnusableSize();</div>
-<div class="line"><a name="l11460"></a><span class="lineno">11460</span>&#160;    <span class="keywordflow">if</span>(unusableSize &gt; 0)</div>
-<div class="line"><a name="l11461"></a><span class="lineno">11461</span>&#160;    {</div>
-<div class="line"><a name="l11462"></a><span class="lineno">11462</span>&#160;        PrintDetailedMap_UnusedRange(json,</div>
-<div class="line"><a name="l11463"></a><span class="lineno">11463</span>&#160;            m_UsableSize, <span class="comment">// offset</span></div>
-<div class="line"><a name="l11464"></a><span class="lineno">11464</span>&#160;            unusableSize); <span class="comment">// size</span></div>
-<div class="line"><a name="l11465"></a><span class="lineno">11465</span>&#160;    }</div>
-<div class="line"><a name="l11466"></a><span class="lineno">11466</span>&#160; </div>
-<div class="line"><a name="l11467"></a><span class="lineno">11467</span>&#160;    PrintDetailedMap_End(json);</div>
-<div class="line"><a name="l11468"></a><span class="lineno">11468</span>&#160;}</div>
+<div class="line"><a name="l11426"></a><span class="lineno">11426</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Linear::CleanupAfterFree()</div>
+<div class="line"><a name="l11427"></a><span class="lineno">11427</span>&#160;{</div>
+<div class="line"><a name="l11428"></a><span class="lineno">11428</span>&#160;    SuballocationVectorType&amp; suballocations1st = AccessSuballocations1st();</div>
+<div class="line"><a name="l11429"></a><span class="lineno">11429</span>&#160;    SuballocationVectorType&amp; suballocations2nd = AccessSuballocations2nd();</div>
+<div class="line"><a name="l11430"></a><span class="lineno">11430</span>&#160; </div>
+<div class="line"><a name="l11431"></a><span class="lineno">11431</span>&#160;    <span class="keywordflow">if</span>(IsEmpty())</div>
+<div class="line"><a name="l11432"></a><span class="lineno">11432</span>&#160;    {</div>
+<div class="line"><a name="l11433"></a><span class="lineno">11433</span>&#160;        suballocations1st.clear();</div>
+<div class="line"><a name="l11434"></a><span class="lineno">11434</span>&#160;        suballocations2nd.clear();</div>
+<div class="line"><a name="l11435"></a><span class="lineno">11435</span>&#160;        m_1stNullItemsBeginCount = 0;</div>
+<div class="line"><a name="l11436"></a><span class="lineno">11436</span>&#160;        m_1stNullItemsMiddleCount = 0;</div>
+<div class="line"><a name="l11437"></a><span class="lineno">11437</span>&#160;        m_2ndNullItemsCount = 0;</div>
+<div class="line"><a name="l11438"></a><span class="lineno">11438</span>&#160;        m_2ndVectorMode = SECOND_VECTOR_EMPTY;</div>
+<div class="line"><a name="l11439"></a><span class="lineno">11439</span>&#160;    }</div>
+<div class="line"><a name="l11440"></a><span class="lineno">11440</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l11441"></a><span class="lineno">11441</span>&#160;    {</div>
+<div class="line"><a name="l11442"></a><span class="lineno">11442</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> suballoc1stCount = suballocations1st.size();</div>
+<div class="line"><a name="l11443"></a><span class="lineno">11443</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> nullItem1stCount = m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount;</div>
+<div class="line"><a name="l11444"></a><span class="lineno">11444</span>&#160;        VMA_ASSERT(nullItem1stCount &lt;= suballoc1stCount);</div>
+<div class="line"><a name="l11445"></a><span class="lineno">11445</span>&#160; </div>
+<div class="line"><a name="l11446"></a><span class="lineno">11446</span>&#160;        <span class="comment">// Find more null items at the beginning of 1st vector.</span></div>
+<div class="line"><a name="l11447"></a><span class="lineno">11447</span>&#160;        <span class="keywordflow">while</span>(m_1stNullItemsBeginCount &lt; suballoc1stCount &amp;&amp;</div>
+<div class="line"><a name="l11448"></a><span class="lineno">11448</span>&#160;            suballocations1st[m_1stNullItemsBeginCount].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l11449"></a><span class="lineno">11449</span>&#160;        {</div>
+<div class="line"><a name="l11450"></a><span class="lineno">11450</span>&#160;            ++m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l11451"></a><span class="lineno">11451</span>&#160;            --m_1stNullItemsMiddleCount;</div>
+<div class="line"><a name="l11452"></a><span class="lineno">11452</span>&#160;        }</div>
+<div class="line"><a name="l11453"></a><span class="lineno">11453</span>&#160; </div>
+<div class="line"><a name="l11454"></a><span class="lineno">11454</span>&#160;        <span class="comment">// Find more null items at the end of 1st vector.</span></div>
+<div class="line"><a name="l11455"></a><span class="lineno">11455</span>&#160;        <span class="keywordflow">while</span>(m_1stNullItemsMiddleCount &gt; 0 &amp;&amp;</div>
+<div class="line"><a name="l11456"></a><span class="lineno">11456</span>&#160;            suballocations1st.back().hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l11457"></a><span class="lineno">11457</span>&#160;        {</div>
+<div class="line"><a name="l11458"></a><span class="lineno">11458</span>&#160;            --m_1stNullItemsMiddleCount;</div>
+<div class="line"><a name="l11459"></a><span class="lineno">11459</span>&#160;            suballocations1st.pop_back();</div>
+<div class="line"><a name="l11460"></a><span class="lineno">11460</span>&#160;        }</div>
+<div class="line"><a name="l11461"></a><span class="lineno">11461</span>&#160; </div>
+<div class="line"><a name="l11462"></a><span class="lineno">11462</span>&#160;        <span class="comment">// Find more null items at the end of 2nd vector.</span></div>
+<div class="line"><a name="l11463"></a><span class="lineno">11463</span>&#160;        <span class="keywordflow">while</span>(m_2ndNullItemsCount &gt; 0 &amp;&amp;</div>
+<div class="line"><a name="l11464"></a><span class="lineno">11464</span>&#160;            suballocations2nd.back().hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l11465"></a><span class="lineno">11465</span>&#160;        {</div>
+<div class="line"><a name="l11466"></a><span class="lineno">11466</span>&#160;            --m_2ndNullItemsCount;</div>
+<div class="line"><a name="l11467"></a><span class="lineno">11467</span>&#160;            suballocations2nd.pop_back();</div>
+<div class="line"><a name="l11468"></a><span class="lineno">11468</span>&#160;        }</div>
 <div class="line"><a name="l11469"></a><span class="lineno">11469</span>&#160; </div>
-<div class="line"><a name="l11470"></a><span class="lineno">11470</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l11471"></a><span class="lineno">11471</span>&#160; </div>
-<div class="line"><a name="l11472"></a><span class="lineno">11472</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Buddy::CreateAllocationRequest(</div>
-<div class="line"><a name="l11473"></a><span class="lineno">11473</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l11474"></a><span class="lineno">11474</span>&#160;    uint32_t frameInUseCount,</div>
-<div class="line"><a name="l11475"></a><span class="lineno">11475</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l11476"></a><span class="lineno">11476</span>&#160;    VkDeviceSize allocSize,</div>
-<div class="line"><a name="l11477"></a><span class="lineno">11477</span>&#160;    VkDeviceSize allocAlignment,</div>
-<div class="line"><a name="l11478"></a><span class="lineno">11478</span>&#160;    <span class="keywordtype">bool</span> upperAddress,</div>
-<div class="line"><a name="l11479"></a><span class="lineno">11479</span>&#160;    VmaSuballocationType allocType,</div>
-<div class="line"><a name="l11480"></a><span class="lineno">11480</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
-<div class="line"><a name="l11481"></a><span class="lineno">11481</span>&#160;    uint32_t strategy,</div>
-<div class="line"><a name="l11482"></a><span class="lineno">11482</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
-<div class="line"><a name="l11483"></a><span class="lineno">11483</span>&#160;{</div>
-<div class="line"><a name="l11484"></a><span class="lineno">11484</span>&#160;    VMA_ASSERT(!upperAddress &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT can be used only with linear algorithm.&quot;</span>);</div>
-<div class="line"><a name="l11485"></a><span class="lineno">11485</span>&#160; </div>
-<div class="line"><a name="l11486"></a><span class="lineno">11486</span>&#160;    <span class="comment">// Simple way to respect bufferImageGranularity. May be optimized some day.</span></div>
-<div class="line"><a name="l11487"></a><span class="lineno">11487</span>&#160;    <span class="comment">// Whenever it might be an OPTIMAL image...</span></div>
-<div class="line"><a name="l11488"></a><span class="lineno">11488</span>&#160;    <span class="keywordflow">if</span>(allocType == VMA_SUBALLOCATION_TYPE_UNKNOWN ||</div>
-<div class="line"><a name="l11489"></a><span class="lineno">11489</span>&#160;        allocType == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||</div>
-<div class="line"><a name="l11490"></a><span class="lineno">11490</span>&#160;        allocType == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL)</div>
-<div class="line"><a name="l11491"></a><span class="lineno">11491</span>&#160;    {</div>
-<div class="line"><a name="l11492"></a><span class="lineno">11492</span>&#160;        allocAlignment = VMA_MAX(allocAlignment, bufferImageGranularity);</div>
-<div class="line"><a name="l11493"></a><span class="lineno">11493</span>&#160;        allocSize = VMA_MAX(allocSize, bufferImageGranularity);</div>
-<div class="line"><a name="l11494"></a><span class="lineno">11494</span>&#160;    }</div>
-<div class="line"><a name="l11495"></a><span class="lineno">11495</span>&#160; </div>
-<div class="line"><a name="l11496"></a><span class="lineno">11496</span>&#160;    <span class="keywordflow">if</span>(allocSize &gt; m_UsableSize)</div>
-<div class="line"><a name="l11497"></a><span class="lineno">11497</span>&#160;    {</div>
-<div class="line"><a name="l11498"></a><span class="lineno">11498</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l11499"></a><span class="lineno">11499</span>&#160;    }</div>
-<div class="line"><a name="l11500"></a><span class="lineno">11500</span>&#160; </div>
-<div class="line"><a name="l11501"></a><span class="lineno">11501</span>&#160;    <span class="keyword">const</span> uint32_t targetLevel = AllocSizeToLevel(allocSize);</div>
-<div class="line"><a name="l11502"></a><span class="lineno">11502</span>&#160;    <span class="keywordflow">for</span>(uint32_t level = targetLevel + 1; level--; )</div>
-<div class="line"><a name="l11503"></a><span class="lineno">11503</span>&#160;    {</div>
-<div class="line"><a name="l11504"></a><span class="lineno">11504</span>&#160;        <span class="keywordflow">for</span>(Node* freeNode = m_FreeList[level].front;</div>
-<div class="line"><a name="l11505"></a><span class="lineno">11505</span>&#160;            freeNode != VMA_NULL;</div>
-<div class="line"><a name="l11506"></a><span class="lineno">11506</span>&#160;            freeNode = freeNode-&gt;free.next)</div>
+<div class="line"><a name="l11470"></a><span class="lineno">11470</span>&#160;        <span class="comment">// Find more null items at the beginning of 2nd vector.</span></div>
+<div class="line"><a name="l11471"></a><span class="lineno">11471</span>&#160;        <span class="keywordflow">while</span>(m_2ndNullItemsCount &gt; 0 &amp;&amp;</div>
+<div class="line"><a name="l11472"></a><span class="lineno">11472</span>&#160;            suballocations2nd[0].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l11473"></a><span class="lineno">11473</span>&#160;        {</div>
+<div class="line"><a name="l11474"></a><span class="lineno">11474</span>&#160;            --m_2ndNullItemsCount;</div>
+<div class="line"><a name="l11475"></a><span class="lineno">11475</span>&#160;            VmaVectorRemove(suballocations2nd, 0);</div>
+<div class="line"><a name="l11476"></a><span class="lineno">11476</span>&#160;        }</div>
+<div class="line"><a name="l11477"></a><span class="lineno">11477</span>&#160; </div>
+<div class="line"><a name="l11478"></a><span class="lineno">11478</span>&#160;        <span class="keywordflow">if</span>(ShouldCompact1st())</div>
+<div class="line"><a name="l11479"></a><span class="lineno">11479</span>&#160;        {</div>
+<div class="line"><a name="l11480"></a><span class="lineno">11480</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> nonNullItemCount = suballoc1stCount - nullItem1stCount;</div>
+<div class="line"><a name="l11481"></a><span class="lineno">11481</span>&#160;            <span class="keywordtype">size_t</span> srcIndex = m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l11482"></a><span class="lineno">11482</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> dstIndex = 0; dstIndex &lt; nonNullItemCount; ++dstIndex)</div>
+<div class="line"><a name="l11483"></a><span class="lineno">11483</span>&#160;            {</div>
+<div class="line"><a name="l11484"></a><span class="lineno">11484</span>&#160;                <span class="keywordflow">while</span>(suballocations1st[srcIndex].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l11485"></a><span class="lineno">11485</span>&#160;                {</div>
+<div class="line"><a name="l11486"></a><span class="lineno">11486</span>&#160;                    ++srcIndex;</div>
+<div class="line"><a name="l11487"></a><span class="lineno">11487</span>&#160;                }</div>
+<div class="line"><a name="l11488"></a><span class="lineno">11488</span>&#160;                <span class="keywordflow">if</span>(dstIndex != srcIndex)</div>
+<div class="line"><a name="l11489"></a><span class="lineno">11489</span>&#160;                {</div>
+<div class="line"><a name="l11490"></a><span class="lineno">11490</span>&#160;                    suballocations1st[dstIndex] = suballocations1st[srcIndex];</div>
+<div class="line"><a name="l11491"></a><span class="lineno">11491</span>&#160;                }</div>
+<div class="line"><a name="l11492"></a><span class="lineno">11492</span>&#160;                ++srcIndex;</div>
+<div class="line"><a name="l11493"></a><span class="lineno">11493</span>&#160;            }</div>
+<div class="line"><a name="l11494"></a><span class="lineno">11494</span>&#160;            suballocations1st.resize(nonNullItemCount);</div>
+<div class="line"><a name="l11495"></a><span class="lineno">11495</span>&#160;            m_1stNullItemsBeginCount = 0;</div>
+<div class="line"><a name="l11496"></a><span class="lineno">11496</span>&#160;            m_1stNullItemsMiddleCount = 0;</div>
+<div class="line"><a name="l11497"></a><span class="lineno">11497</span>&#160;        }</div>
+<div class="line"><a name="l11498"></a><span class="lineno">11498</span>&#160; </div>
+<div class="line"><a name="l11499"></a><span class="lineno">11499</span>&#160;        <span class="comment">// 2nd vector became empty.</span></div>
+<div class="line"><a name="l11500"></a><span class="lineno">11500</span>&#160;        <span class="keywordflow">if</span>(suballocations2nd.empty())</div>
+<div class="line"><a name="l11501"></a><span class="lineno">11501</span>&#160;        {</div>
+<div class="line"><a name="l11502"></a><span class="lineno">11502</span>&#160;            m_2ndVectorMode = SECOND_VECTOR_EMPTY;</div>
+<div class="line"><a name="l11503"></a><span class="lineno">11503</span>&#160;        }</div>
+<div class="line"><a name="l11504"></a><span class="lineno">11504</span>&#160; </div>
+<div class="line"><a name="l11505"></a><span class="lineno">11505</span>&#160;        <span class="comment">// 1st vector became empty.</span></div>
+<div class="line"><a name="l11506"></a><span class="lineno">11506</span>&#160;        <span class="keywordflow">if</span>(suballocations1st.size() - m_1stNullItemsBeginCount == 0)</div>
 <div class="line"><a name="l11507"></a><span class="lineno">11507</span>&#160;        {</div>
-<div class="line"><a name="l11508"></a><span class="lineno">11508</span>&#160;            <span class="keywordflow">if</span>(freeNode-&gt;offset % allocAlignment == 0)</div>
-<div class="line"><a name="l11509"></a><span class="lineno">11509</span>&#160;            {</div>
-<div class="line"><a name="l11510"></a><span class="lineno">11510</span>&#160;                pAllocationRequest-&gt;type = VmaAllocationRequestType::Normal;</div>
-<div class="line"><a name="l11511"></a><span class="lineno">11511</span>&#160;                pAllocationRequest-&gt;offset = freeNode-&gt;offset;</div>
-<div class="line"><a name="l11512"></a><span class="lineno">11512</span>&#160;                pAllocationRequest-&gt;sumFreeSize = LevelToNodeSize(level);</div>
-<div class="line"><a name="l11513"></a><span class="lineno">11513</span>&#160;                pAllocationRequest-&gt;sumItemSize = 0;</div>
-<div class="line"><a name="l11514"></a><span class="lineno">11514</span>&#160;                pAllocationRequest-&gt;itemsToMakeLostCount = 0;</div>
-<div class="line"><a name="l11515"></a><span class="lineno">11515</span>&#160;                pAllocationRequest-&gt;customData = (<span class="keywordtype">void</span>*)(uintptr_t)level;</div>
-<div class="line"><a name="l11516"></a><span class="lineno">11516</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l11517"></a><span class="lineno">11517</span>&#160;            }</div>
-<div class="line"><a name="l11518"></a><span class="lineno">11518</span>&#160;        }</div>
-<div class="line"><a name="l11519"></a><span class="lineno">11519</span>&#160;    }</div>
-<div class="line"><a name="l11520"></a><span class="lineno">11520</span>&#160; </div>
-<div class="line"><a name="l11521"></a><span class="lineno">11521</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l11522"></a><span class="lineno">11522</span>&#160;}</div>
-<div class="line"><a name="l11523"></a><span class="lineno">11523</span>&#160; </div>
-<div class="line"><a name="l11524"></a><span class="lineno">11524</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Buddy::MakeRequestedAllocationsLost(</div>
-<div class="line"><a name="l11525"></a><span class="lineno">11525</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l11526"></a><span class="lineno">11526</span>&#160;    uint32_t frameInUseCount,</div>
-<div class="line"><a name="l11527"></a><span class="lineno">11527</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
-<div class="line"><a name="l11528"></a><span class="lineno">11528</span>&#160;{</div>
-<div class="line"><a name="l11529"></a><span class="lineno">11529</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l11530"></a><span class="lineno">11530</span>&#160;<span class="comment">    Lost allocations are not supported in buddy allocator at the moment.</span></div>
-<div class="line"><a name="l11531"></a><span class="lineno">11531</span>&#160;<span class="comment">    Support might be added in the future.</span></div>
-<div class="line"><a name="l11532"></a><span class="lineno">11532</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l11533"></a><span class="lineno">11533</span>&#160;    <span class="keywordflow">return</span> pAllocationRequest-&gt;itemsToMakeLostCount == 0;</div>
-<div class="line"><a name="l11534"></a><span class="lineno">11534</span>&#160;}</div>
-<div class="line"><a name="l11535"></a><span class="lineno">11535</span>&#160; </div>
-<div class="line"><a name="l11536"></a><span class="lineno">11536</span>&#160;uint32_t VmaBlockMetadata_Buddy::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)</div>
-<div class="line"><a name="l11537"></a><span class="lineno">11537</span>&#160;{</div>
-<div class="line"><a name="l11538"></a><span class="lineno">11538</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l11539"></a><span class="lineno">11539</span>&#160;<span class="comment">    Lost allocations are not supported in buddy allocator at the moment.</span></div>
-<div class="line"><a name="l11540"></a><span class="lineno">11540</span>&#160;<span class="comment">    Support might be added in the future.</span></div>
-<div class="line"><a name="l11541"></a><span class="lineno">11541</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l11542"></a><span class="lineno">11542</span>&#160;    <span class="keywordflow">return</span> 0;</div>
+<div class="line"><a name="l11508"></a><span class="lineno">11508</span>&#160;            suballocations1st.clear();</div>
+<div class="line"><a name="l11509"></a><span class="lineno">11509</span>&#160;            m_1stNullItemsBeginCount = 0;</div>
+<div class="line"><a name="l11510"></a><span class="lineno">11510</span>&#160; </div>
+<div class="line"><a name="l11511"></a><span class="lineno">11511</span>&#160;            <span class="keywordflow">if</span>(!suballocations2nd.empty() &amp;&amp; m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)</div>
+<div class="line"><a name="l11512"></a><span class="lineno">11512</span>&#160;            {</div>
+<div class="line"><a name="l11513"></a><span class="lineno">11513</span>&#160;                <span class="comment">// Swap 1st with 2nd. Now 2nd is empty.</span></div>
+<div class="line"><a name="l11514"></a><span class="lineno">11514</span>&#160;                m_2ndVectorMode = SECOND_VECTOR_EMPTY;</div>
+<div class="line"><a name="l11515"></a><span class="lineno">11515</span>&#160;                m_1stNullItemsMiddleCount = m_2ndNullItemsCount;</div>
+<div class="line"><a name="l11516"></a><span class="lineno">11516</span>&#160;                <span class="keywordflow">while</span>(m_1stNullItemsBeginCount &lt; suballocations2nd.size() &amp;&amp;</div>
+<div class="line"><a name="l11517"></a><span class="lineno">11517</span>&#160;                    suballocations2nd[m_1stNullItemsBeginCount].hAllocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l11518"></a><span class="lineno">11518</span>&#160;                {</div>
+<div class="line"><a name="l11519"></a><span class="lineno">11519</span>&#160;                    ++m_1stNullItemsBeginCount;</div>
+<div class="line"><a name="l11520"></a><span class="lineno">11520</span>&#160;                    --m_1stNullItemsMiddleCount;</div>
+<div class="line"><a name="l11521"></a><span class="lineno">11521</span>&#160;                }</div>
+<div class="line"><a name="l11522"></a><span class="lineno">11522</span>&#160;                m_2ndNullItemsCount = 0;</div>
+<div class="line"><a name="l11523"></a><span class="lineno">11523</span>&#160;                m_1stVectorIndex ^= 1;</div>
+<div class="line"><a name="l11524"></a><span class="lineno">11524</span>&#160;            }</div>
+<div class="line"><a name="l11525"></a><span class="lineno">11525</span>&#160;        }</div>
+<div class="line"><a name="l11526"></a><span class="lineno">11526</span>&#160;    }</div>
+<div class="line"><a name="l11527"></a><span class="lineno">11527</span>&#160; </div>
+<div class="line"><a name="l11528"></a><span class="lineno">11528</span>&#160;    VMA_HEAVY_ASSERT(Validate());</div>
+<div class="line"><a name="l11529"></a><span class="lineno">11529</span>&#160;}</div>
+<div class="line"><a name="l11530"></a><span class="lineno">11530</span>&#160; </div>
+<div class="line"><a name="l11531"></a><span class="lineno">11531</span>&#160; </div>
+<div class="line"><a name="l11533"></a><span class="lineno">11533</span>&#160;<span class="comment">// class VmaBlockMetadata_Buddy</span></div>
+<div class="line"><a name="l11534"></a><span class="lineno">11534</span>&#160; </div>
+<div class="line"><a name="l11535"></a><span class="lineno">11535</span>&#160;VmaBlockMetadata_Buddy::VmaBlockMetadata_Buddy(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator) :</div>
+<div class="line"><a name="l11536"></a><span class="lineno">11536</span>&#160;    VmaBlockMetadata(hAllocator),</div>
+<div class="line"><a name="l11537"></a><span class="lineno">11537</span>&#160;    m_Root(VMA_NULL),</div>
+<div class="line"><a name="l11538"></a><span class="lineno">11538</span>&#160;    m_AllocationCount(0),</div>
+<div class="line"><a name="l11539"></a><span class="lineno">11539</span>&#160;    m_FreeCount(1),</div>
+<div class="line"><a name="l11540"></a><span class="lineno">11540</span>&#160;    m_SumFreeSize(0)</div>
+<div class="line"><a name="l11541"></a><span class="lineno">11541</span>&#160;{</div>
+<div class="line"><a name="l11542"></a><span class="lineno">11542</span>&#160;    memset(m_FreeList, 0, <span class="keyword">sizeof</span>(m_FreeList));</div>
 <div class="line"><a name="l11543"></a><span class="lineno">11543</span>&#160;}</div>
 <div class="line"><a name="l11544"></a><span class="lineno">11544</span>&#160; </div>
-<div class="line"><a name="l11545"></a><span class="lineno">11545</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::Alloc(</div>
-<div class="line"><a name="l11546"></a><span class="lineno">11546</span>&#160;    <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
-<div class="line"><a name="l11547"></a><span class="lineno">11547</span>&#160;    VmaSuballocationType type,</div>
-<div class="line"><a name="l11548"></a><span class="lineno">11548</span>&#160;    VkDeviceSize allocSize,</div>
-<div class="line"><a name="l11549"></a><span class="lineno">11549</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
-<div class="line"><a name="l11550"></a><span class="lineno">11550</span>&#160;{</div>
-<div class="line"><a name="l11551"></a><span class="lineno">11551</span>&#160;    VMA_ASSERT(request.type == VmaAllocationRequestType::Normal);</div>
-<div class="line"><a name="l11552"></a><span class="lineno">11552</span>&#160; </div>
-<div class="line"><a name="l11553"></a><span class="lineno">11553</span>&#160;    <span class="keyword">const</span> uint32_t targetLevel = AllocSizeToLevel(allocSize);</div>
-<div class="line"><a name="l11554"></a><span class="lineno">11554</span>&#160;    uint32_t currLevel = (uint32_t)(uintptr_t)request.customData;</div>
-<div class="line"><a name="l11555"></a><span class="lineno">11555</span>&#160;    </div>
-<div class="line"><a name="l11556"></a><span class="lineno">11556</span>&#160;    Node* currNode = m_FreeList[currLevel].front;</div>
-<div class="line"><a name="l11557"></a><span class="lineno">11557</span>&#160;    VMA_ASSERT(currNode != VMA_NULL &amp;&amp; currNode-&gt;type == Node::TYPE_FREE);</div>
-<div class="line"><a name="l11558"></a><span class="lineno">11558</span>&#160;    <span class="keywordflow">while</span>(currNode-&gt;offset != request.offset)</div>
-<div class="line"><a name="l11559"></a><span class="lineno">11559</span>&#160;    {</div>
-<div class="line"><a name="l11560"></a><span class="lineno">11560</span>&#160;        currNode = currNode-&gt;free.next;</div>
-<div class="line"><a name="l11561"></a><span class="lineno">11561</span>&#160;        VMA_ASSERT(currNode != VMA_NULL &amp;&amp; currNode-&gt;type == Node::TYPE_FREE);</div>
-<div class="line"><a name="l11562"></a><span class="lineno">11562</span>&#160;    }</div>
-<div class="line"><a name="l11563"></a><span class="lineno">11563</span>&#160;    </div>
-<div class="line"><a name="l11564"></a><span class="lineno">11564</span>&#160;    <span class="comment">// Go down, splitting free nodes.</span></div>
-<div class="line"><a name="l11565"></a><span class="lineno">11565</span>&#160;    <span class="keywordflow">while</span>(currLevel &lt; targetLevel)</div>
-<div class="line"><a name="l11566"></a><span class="lineno">11566</span>&#160;    {</div>
-<div class="line"><a name="l11567"></a><span class="lineno">11567</span>&#160;        <span class="comment">// currNode is already first free node at currLevel.</span></div>
-<div class="line"><a name="l11568"></a><span class="lineno">11568</span>&#160;        <span class="comment">// Remove it from list of free nodes at this currLevel.</span></div>
-<div class="line"><a name="l11569"></a><span class="lineno">11569</span>&#160;        RemoveFromFreeList(currLevel, currNode);</div>
-<div class="line"><a name="l11570"></a><span class="lineno">11570</span>&#160;         </div>
-<div class="line"><a name="l11571"></a><span class="lineno">11571</span>&#160;        <span class="keyword">const</span> uint32_t childrenLevel = currLevel + 1;</div>
-<div class="line"><a name="l11572"></a><span class="lineno">11572</span>&#160; </div>
-<div class="line"><a name="l11573"></a><span class="lineno">11573</span>&#160;        <span class="comment">// Create two free sub-nodes.</span></div>
-<div class="line"><a name="l11574"></a><span class="lineno">11574</span>&#160;        Node* leftChild = vma_new(GetAllocationCallbacks(), Node)();</div>
-<div class="line"><a name="l11575"></a><span class="lineno">11575</span>&#160;        Node* rightChild = vma_new(GetAllocationCallbacks(), Node)();</div>
-<div class="line"><a name="l11576"></a><span class="lineno">11576</span>&#160; </div>
-<div class="line"><a name="l11577"></a><span class="lineno">11577</span>&#160;        leftChild-&gt;offset = currNode-&gt;offset;</div>
-<div class="line"><a name="l11578"></a><span class="lineno">11578</span>&#160;        leftChild-&gt;type = Node::TYPE_FREE;</div>
-<div class="line"><a name="l11579"></a><span class="lineno">11579</span>&#160;        leftChild-&gt;parent = currNode;</div>
-<div class="line"><a name="l11580"></a><span class="lineno">11580</span>&#160;        leftChild-&gt;buddy = rightChild;</div>
-<div class="line"><a name="l11581"></a><span class="lineno">11581</span>&#160; </div>
-<div class="line"><a name="l11582"></a><span class="lineno">11582</span>&#160;        rightChild-&gt;offset = currNode-&gt;offset + LevelToNodeSize(childrenLevel);</div>
-<div class="line"><a name="l11583"></a><span class="lineno">11583</span>&#160;        rightChild-&gt;type = Node::TYPE_FREE;</div>
-<div class="line"><a name="l11584"></a><span class="lineno">11584</span>&#160;        rightChild-&gt;parent = currNode;</div>
-<div class="line"><a name="l11585"></a><span class="lineno">11585</span>&#160;        rightChild-&gt;buddy = leftChild;</div>
-<div class="line"><a name="l11586"></a><span class="lineno">11586</span>&#160; </div>
-<div class="line"><a name="l11587"></a><span class="lineno">11587</span>&#160;        <span class="comment">// Convert current currNode to split type.</span></div>
-<div class="line"><a name="l11588"></a><span class="lineno">11588</span>&#160;        currNode-&gt;type = Node::TYPE_SPLIT;</div>
-<div class="line"><a name="l11589"></a><span class="lineno">11589</span>&#160;        currNode-&gt;split.leftChild = leftChild;</div>
-<div class="line"><a name="l11590"></a><span class="lineno">11590</span>&#160; </div>
-<div class="line"><a name="l11591"></a><span class="lineno">11591</span>&#160;        <span class="comment">// Add child nodes to free list. Order is important!</span></div>
-<div class="line"><a name="l11592"></a><span class="lineno">11592</span>&#160;        AddToFreeListFront(childrenLevel, rightChild);</div>
-<div class="line"><a name="l11593"></a><span class="lineno">11593</span>&#160;        AddToFreeListFront(childrenLevel, leftChild);</div>
-<div class="line"><a name="l11594"></a><span class="lineno">11594</span>&#160; </div>
-<div class="line"><a name="l11595"></a><span class="lineno">11595</span>&#160;        ++m_FreeCount;</div>
-<div class="line"><a name="l11596"></a><span class="lineno">11596</span>&#160;        <span class="comment">//m_SumFreeSize -= LevelToNodeSize(currLevel) % 2; // Useful only when level node sizes can be non power of 2.</span></div>
-<div class="line"><a name="l11597"></a><span class="lineno">11597</span>&#160;        ++currLevel;</div>
-<div class="line"><a name="l11598"></a><span class="lineno">11598</span>&#160;        currNode = m_FreeList[currLevel].front;</div>
-<div class="line"><a name="l11599"></a><span class="lineno">11599</span>&#160; </div>
-<div class="line"><a name="l11600"></a><span class="lineno">11600</span>&#160;        <span class="comment">/*</span></div>
-<div class="line"><a name="l11601"></a><span class="lineno">11601</span>&#160;<span class="comment">        We can be sure that currNode, as left child of node previously split,</span></div>
-<div class="line"><a name="l11602"></a><span class="lineno">11602</span>&#160;<span class="comment">        also fullfills the alignment requirement.</span></div>
-<div class="line"><a name="l11603"></a><span class="lineno">11603</span>&#160;<span class="comment">        */</span></div>
-<div class="line"><a name="l11604"></a><span class="lineno">11604</span>&#160;    }</div>
-<div class="line"><a name="l11605"></a><span class="lineno">11605</span>&#160; </div>
-<div class="line"><a name="l11606"></a><span class="lineno">11606</span>&#160;    <span class="comment">// Remove from free list.</span></div>
-<div class="line"><a name="l11607"></a><span class="lineno">11607</span>&#160;    VMA_ASSERT(currLevel == targetLevel &amp;&amp;</div>
-<div class="line"><a name="l11608"></a><span class="lineno">11608</span>&#160;        currNode != VMA_NULL &amp;&amp;</div>
-<div class="line"><a name="l11609"></a><span class="lineno">11609</span>&#160;        currNode-&gt;type == Node::TYPE_FREE);</div>
-<div class="line"><a name="l11610"></a><span class="lineno">11610</span>&#160;    RemoveFromFreeList(currLevel, currNode);</div>
-<div class="line"><a name="l11611"></a><span class="lineno">11611</span>&#160; </div>
-<div class="line"><a name="l11612"></a><span class="lineno">11612</span>&#160;    <span class="comment">// Convert to allocation node.</span></div>
-<div class="line"><a name="l11613"></a><span class="lineno">11613</span>&#160;    currNode-&gt;type = Node::TYPE_ALLOCATION;</div>
-<div class="line"><a name="l11614"></a><span class="lineno">11614</span>&#160;    currNode-&gt;allocation.alloc = hAllocation;</div>
-<div class="line"><a name="l11615"></a><span class="lineno">11615</span>&#160; </div>
-<div class="line"><a name="l11616"></a><span class="lineno">11616</span>&#160;    ++m_AllocationCount;</div>
-<div class="line"><a name="l11617"></a><span class="lineno">11617</span>&#160;    --m_FreeCount;</div>
-<div class="line"><a name="l11618"></a><span class="lineno">11618</span>&#160;    m_SumFreeSize -= allocSize;</div>
-<div class="line"><a name="l11619"></a><span class="lineno">11619</span>&#160;}</div>
-<div class="line"><a name="l11620"></a><span class="lineno">11620</span>&#160; </div>
-<div class="line"><a name="l11621"></a><span class="lineno">11621</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::DeleteNode(Node* node)</div>
-<div class="line"><a name="l11622"></a><span class="lineno">11622</span>&#160;{</div>
-<div class="line"><a name="l11623"></a><span class="lineno">11623</span>&#160;    <span class="keywordflow">if</span>(node-&gt;type == Node::TYPE_SPLIT)</div>
-<div class="line"><a name="l11624"></a><span class="lineno">11624</span>&#160;    {</div>
-<div class="line"><a name="l11625"></a><span class="lineno">11625</span>&#160;        DeleteNode(node-&gt;split.leftChild-&gt;buddy);</div>
-<div class="line"><a name="l11626"></a><span class="lineno">11626</span>&#160;        DeleteNode(node-&gt;split.leftChild);</div>
-<div class="line"><a name="l11627"></a><span class="lineno">11627</span>&#160;    }</div>
-<div class="line"><a name="l11628"></a><span class="lineno">11628</span>&#160; </div>
-<div class="line"><a name="l11629"></a><span class="lineno">11629</span>&#160;    vma_delete(GetAllocationCallbacks(), node);</div>
-<div class="line"><a name="l11630"></a><span class="lineno">11630</span>&#160;}</div>
-<div class="line"><a name="l11631"></a><span class="lineno">11631</span>&#160; </div>
-<div class="line"><a name="l11632"></a><span class="lineno">11632</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Buddy::ValidateNode(ValidationContext&amp; ctx, <span class="keyword">const</span> Node* parent, <span class="keyword">const</span> Node* curr, uint32_t level, VkDeviceSize levelNodeSize)<span class="keyword"> const</span></div>
-<div class="line"><a name="l11633"></a><span class="lineno">11633</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l11634"></a><span class="lineno">11634</span>&#160;    VMA_VALIDATE(level &lt; m_LevelCount);</div>
-<div class="line"><a name="l11635"></a><span class="lineno">11635</span>&#160;    VMA_VALIDATE(curr-&gt;parent == parent);</div>
-<div class="line"><a name="l11636"></a><span class="lineno">11636</span>&#160;    VMA_VALIDATE((curr-&gt;buddy == VMA_NULL) == (parent == VMA_NULL));</div>
-<div class="line"><a name="l11637"></a><span class="lineno">11637</span>&#160;    VMA_VALIDATE(curr-&gt;buddy == VMA_NULL || curr-&gt;buddy-&gt;buddy == curr);</div>
-<div class="line"><a name="l11638"></a><span class="lineno">11638</span>&#160;    <span class="keywordflow">switch</span>(curr-&gt;type)</div>
-<div class="line"><a name="l11639"></a><span class="lineno">11639</span>&#160;    {</div>
-<div class="line"><a name="l11640"></a><span class="lineno">11640</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_FREE:</div>
-<div class="line"><a name="l11641"></a><span class="lineno">11641</span>&#160;        <span class="comment">// curr-&gt;free.prev, next are validated separately.</span></div>
-<div class="line"><a name="l11642"></a><span class="lineno">11642</span>&#160;        ctx.calculatedSumFreeSize += levelNodeSize;</div>
-<div class="line"><a name="l11643"></a><span class="lineno">11643</span>&#160;        ++ctx.calculatedFreeCount;</div>
-<div class="line"><a name="l11644"></a><span class="lineno">11644</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11645"></a><span class="lineno">11645</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_ALLOCATION:</div>
-<div class="line"><a name="l11646"></a><span class="lineno">11646</span>&#160;        ++ctx.calculatedAllocationCount;</div>
-<div class="line"><a name="l11647"></a><span class="lineno">11647</span>&#160;        ctx.calculatedSumFreeSize += levelNodeSize - curr-&gt;allocation.alloc-&gt;GetSize();</div>
-<div class="line"><a name="l11648"></a><span class="lineno">11648</span>&#160;        VMA_VALIDATE(curr-&gt;allocation.alloc != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l11649"></a><span class="lineno">11649</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11650"></a><span class="lineno">11650</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_SPLIT:</div>
-<div class="line"><a name="l11651"></a><span class="lineno">11651</span>&#160;        {</div>
-<div class="line"><a name="l11652"></a><span class="lineno">11652</span>&#160;            <span class="keyword">const</span> uint32_t childrenLevel = level + 1;</div>
-<div class="line"><a name="l11653"></a><span class="lineno">11653</span>&#160;            <span class="keyword">const</span> VkDeviceSize childrenLevelNodeSize = levelNodeSize / 2;</div>
-<div class="line"><a name="l11654"></a><span class="lineno">11654</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> leftChild = curr-&gt;split.leftChild;</div>
-<div class="line"><a name="l11655"></a><span class="lineno">11655</span>&#160;            VMA_VALIDATE(leftChild != VMA_NULL);</div>
-<div class="line"><a name="l11656"></a><span class="lineno">11656</span>&#160;            VMA_VALIDATE(leftChild-&gt;offset == curr-&gt;offset);</div>
-<div class="line"><a name="l11657"></a><span class="lineno">11657</span>&#160;            <span class="keywordflow">if</span>(!ValidateNode(ctx, curr, leftChild, childrenLevel, childrenLevelNodeSize))</div>
-<div class="line"><a name="l11658"></a><span class="lineno">11658</span>&#160;            {</div>
-<div class="line"><a name="l11659"></a><span class="lineno">11659</span>&#160;                VMA_VALIDATE(<span class="keyword">false</span> &amp;&amp; <span class="stringliteral">&quot;ValidateNode for left child failed.&quot;</span>);</div>
-<div class="line"><a name="l11660"></a><span class="lineno">11660</span>&#160;            }</div>
-<div class="line"><a name="l11661"></a><span class="lineno">11661</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> rightChild = leftChild-&gt;buddy;</div>
-<div class="line"><a name="l11662"></a><span class="lineno">11662</span>&#160;            VMA_VALIDATE(rightChild-&gt;offset == curr-&gt;offset + childrenLevelNodeSize);</div>
-<div class="line"><a name="l11663"></a><span class="lineno">11663</span>&#160;            <span class="keywordflow">if</span>(!ValidateNode(ctx, curr, rightChild, childrenLevel, childrenLevelNodeSize))</div>
-<div class="line"><a name="l11664"></a><span class="lineno">11664</span>&#160;            {</div>
-<div class="line"><a name="l11665"></a><span class="lineno">11665</span>&#160;                VMA_VALIDATE(<span class="keyword">false</span> &amp;&amp; <span class="stringliteral">&quot;ValidateNode for right child failed.&quot;</span>);</div>
-<div class="line"><a name="l11666"></a><span class="lineno">11666</span>&#160;            }</div>
-<div class="line"><a name="l11667"></a><span class="lineno">11667</span>&#160;        }</div>
-<div class="line"><a name="l11668"></a><span class="lineno">11668</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11669"></a><span class="lineno">11669</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l11670"></a><span class="lineno">11670</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l11671"></a><span class="lineno">11671</span>&#160;    }</div>
+<div class="line"><a name="l11545"></a><span class="lineno">11545</span>&#160;VmaBlockMetadata_Buddy::~VmaBlockMetadata_Buddy()</div>
+<div class="line"><a name="l11546"></a><span class="lineno">11546</span>&#160;{</div>
+<div class="line"><a name="l11547"></a><span class="lineno">11547</span>&#160;    DeleteNode(m_Root);</div>
+<div class="line"><a name="l11548"></a><span class="lineno">11548</span>&#160;}</div>
+<div class="line"><a name="l11549"></a><span class="lineno">11549</span>&#160; </div>
+<div class="line"><a name="l11550"></a><span class="lineno">11550</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::Init(VkDeviceSize size)</div>
+<div class="line"><a name="l11551"></a><span class="lineno">11551</span>&#160;{</div>
+<div class="line"><a name="l11552"></a><span class="lineno">11552</span>&#160;    VmaBlockMetadata::Init(size);</div>
+<div class="line"><a name="l11553"></a><span class="lineno">11553</span>&#160; </div>
+<div class="line"><a name="l11554"></a><span class="lineno">11554</span>&#160;    m_UsableSize = VmaPrevPow2(size);</div>
+<div class="line"><a name="l11555"></a><span class="lineno">11555</span>&#160;    m_SumFreeSize = m_UsableSize;</div>
+<div class="line"><a name="l11556"></a><span class="lineno">11556</span>&#160; </div>
+<div class="line"><a name="l11557"></a><span class="lineno">11557</span>&#160;    <span class="comment">// Calculate m_LevelCount.</span></div>
+<div class="line"><a name="l11558"></a><span class="lineno">11558</span>&#160;    m_LevelCount = 1;</div>
+<div class="line"><a name="l11559"></a><span class="lineno">11559</span>&#160;    <span class="keywordflow">while</span>(m_LevelCount &lt; MAX_LEVELS &amp;&amp;</div>
+<div class="line"><a name="l11560"></a><span class="lineno">11560</span>&#160;        LevelToNodeSize(m_LevelCount) &gt;= MIN_NODE_SIZE)</div>
+<div class="line"><a name="l11561"></a><span class="lineno">11561</span>&#160;    {</div>
+<div class="line"><a name="l11562"></a><span class="lineno">11562</span>&#160;        ++m_LevelCount;</div>
+<div class="line"><a name="l11563"></a><span class="lineno">11563</span>&#160;    }</div>
+<div class="line"><a name="l11564"></a><span class="lineno">11564</span>&#160; </div>
+<div class="line"><a name="l11565"></a><span class="lineno">11565</span>&#160;    Node* rootNode = vma_new(GetAllocationCallbacks(), Node)();</div>
+<div class="line"><a name="l11566"></a><span class="lineno">11566</span>&#160;    rootNode-&gt;offset = 0;</div>
+<div class="line"><a name="l11567"></a><span class="lineno">11567</span>&#160;    rootNode-&gt;type = Node::TYPE_FREE;</div>
+<div class="line"><a name="l11568"></a><span class="lineno">11568</span>&#160;    rootNode-&gt;parent = VMA_NULL;</div>
+<div class="line"><a name="l11569"></a><span class="lineno">11569</span>&#160;    rootNode-&gt;buddy = VMA_NULL;</div>
+<div class="line"><a name="l11570"></a><span class="lineno">11570</span>&#160; </div>
+<div class="line"><a name="l11571"></a><span class="lineno">11571</span>&#160;    m_Root = rootNode;</div>
+<div class="line"><a name="l11572"></a><span class="lineno">11572</span>&#160;    AddToFreeListFront(0, rootNode);</div>
+<div class="line"><a name="l11573"></a><span class="lineno">11573</span>&#160;}</div>
+<div class="line"><a name="l11574"></a><span class="lineno">11574</span>&#160; </div>
+<div class="line"><a name="l11575"></a><span class="lineno">11575</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Buddy::Validate()<span class="keyword"> const</span></div>
+<div class="line"><a name="l11576"></a><span class="lineno">11576</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l11577"></a><span class="lineno">11577</span>&#160;    <span class="comment">// Validate tree.</span></div>
+<div class="line"><a name="l11578"></a><span class="lineno">11578</span>&#160;    ValidationContext ctx;</div>
+<div class="line"><a name="l11579"></a><span class="lineno">11579</span>&#160;    <span class="keywordflow">if</span>(!ValidateNode(ctx, VMA_NULL, m_Root, 0, LevelToNodeSize(0)))</div>
+<div class="line"><a name="l11580"></a><span class="lineno">11580</span>&#160;    {</div>
+<div class="line"><a name="l11581"></a><span class="lineno">11581</span>&#160;        VMA_VALIDATE(<span class="keyword">false</span> &amp;&amp; <span class="stringliteral">&quot;ValidateNode failed.&quot;</span>);</div>
+<div class="line"><a name="l11582"></a><span class="lineno">11582</span>&#160;    }</div>
+<div class="line"><a name="l11583"></a><span class="lineno">11583</span>&#160;    VMA_VALIDATE(m_AllocationCount == ctx.calculatedAllocationCount);</div>
+<div class="line"><a name="l11584"></a><span class="lineno">11584</span>&#160;    VMA_VALIDATE(m_SumFreeSize == ctx.calculatedSumFreeSize);</div>
+<div class="line"><a name="l11585"></a><span class="lineno">11585</span>&#160; </div>
+<div class="line"><a name="l11586"></a><span class="lineno">11586</span>&#160;    <span class="comment">// Validate free node lists.</span></div>
+<div class="line"><a name="l11587"></a><span class="lineno">11587</span>&#160;    <span class="keywordflow">for</span>(uint32_t level = 0; level &lt; m_LevelCount; ++level)</div>
+<div class="line"><a name="l11588"></a><span class="lineno">11588</span>&#160;    {</div>
+<div class="line"><a name="l11589"></a><span class="lineno">11589</span>&#160;        VMA_VALIDATE(m_FreeList[level].front == VMA_NULL ||</div>
+<div class="line"><a name="l11590"></a><span class="lineno">11590</span>&#160;            m_FreeList[level].front-&gt;free.prev == VMA_NULL);</div>
+<div class="line"><a name="l11591"></a><span class="lineno">11591</span>&#160; </div>
+<div class="line"><a name="l11592"></a><span class="lineno">11592</span>&#160;        <span class="keywordflow">for</span>(Node* node = m_FreeList[level].front;</div>
+<div class="line"><a name="l11593"></a><span class="lineno">11593</span>&#160;            node != VMA_NULL;</div>
+<div class="line"><a name="l11594"></a><span class="lineno">11594</span>&#160;            node = node-&gt;free.next)</div>
+<div class="line"><a name="l11595"></a><span class="lineno">11595</span>&#160;        {</div>
+<div class="line"><a name="l11596"></a><span class="lineno">11596</span>&#160;            VMA_VALIDATE(node-&gt;type == Node::TYPE_FREE);</div>
+<div class="line"><a name="l11597"></a><span class="lineno">11597</span>&#160;            </div>
+<div class="line"><a name="l11598"></a><span class="lineno">11598</span>&#160;            <span class="keywordflow">if</span>(node-&gt;free.next == VMA_NULL)</div>
+<div class="line"><a name="l11599"></a><span class="lineno">11599</span>&#160;            {</div>
+<div class="line"><a name="l11600"></a><span class="lineno">11600</span>&#160;                VMA_VALIDATE(m_FreeList[level].back == node);</div>
+<div class="line"><a name="l11601"></a><span class="lineno">11601</span>&#160;            }</div>
+<div class="line"><a name="l11602"></a><span class="lineno">11602</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l11603"></a><span class="lineno">11603</span>&#160;            {</div>
+<div class="line"><a name="l11604"></a><span class="lineno">11604</span>&#160;                VMA_VALIDATE(node-&gt;free.next-&gt;free.prev == node);</div>
+<div class="line"><a name="l11605"></a><span class="lineno">11605</span>&#160;            }</div>
+<div class="line"><a name="l11606"></a><span class="lineno">11606</span>&#160;        }</div>
+<div class="line"><a name="l11607"></a><span class="lineno">11607</span>&#160;    }</div>
+<div class="line"><a name="l11608"></a><span class="lineno">11608</span>&#160; </div>
+<div class="line"><a name="l11609"></a><span class="lineno">11609</span>&#160;    <span class="comment">// Validate that free lists ar higher levels are empty.</span></div>
+<div class="line"><a name="l11610"></a><span class="lineno">11610</span>&#160;    <span class="keywordflow">for</span>(uint32_t level = m_LevelCount; level &lt; MAX_LEVELS; ++level)</div>
+<div class="line"><a name="l11611"></a><span class="lineno">11611</span>&#160;    {</div>
+<div class="line"><a name="l11612"></a><span class="lineno">11612</span>&#160;        VMA_VALIDATE(m_FreeList[level].front == VMA_NULL &amp;&amp; m_FreeList[level].back == VMA_NULL);</div>
+<div class="line"><a name="l11613"></a><span class="lineno">11613</span>&#160;    }</div>
+<div class="line"><a name="l11614"></a><span class="lineno">11614</span>&#160; </div>
+<div class="line"><a name="l11615"></a><span class="lineno">11615</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l11616"></a><span class="lineno">11616</span>&#160;}</div>
+<div class="line"><a name="l11617"></a><span class="lineno">11617</span>&#160; </div>
+<div class="line"><a name="l11618"></a><span class="lineno">11618</span>&#160;VkDeviceSize VmaBlockMetadata_Buddy::GetUnusedRangeSizeMax()<span class="keyword"> const</span></div>
+<div class="line"><a name="l11619"></a><span class="lineno">11619</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l11620"></a><span class="lineno">11620</span>&#160;    <span class="keywordflow">for</span>(uint32_t level = 0; level &lt; m_LevelCount; ++level)</div>
+<div class="line"><a name="l11621"></a><span class="lineno">11621</span>&#160;    {</div>
+<div class="line"><a name="l11622"></a><span class="lineno">11622</span>&#160;        <span class="keywordflow">if</span>(m_FreeList[level].front != VMA_NULL)</div>
+<div class="line"><a name="l11623"></a><span class="lineno">11623</span>&#160;        {</div>
+<div class="line"><a name="l11624"></a><span class="lineno">11624</span>&#160;            <span class="keywordflow">return</span> LevelToNodeSize(level);</div>
+<div class="line"><a name="l11625"></a><span class="lineno">11625</span>&#160;        }</div>
+<div class="line"><a name="l11626"></a><span class="lineno">11626</span>&#160;    }</div>
+<div class="line"><a name="l11627"></a><span class="lineno">11627</span>&#160;    <span class="keywordflow">return</span> 0;</div>
+<div class="line"><a name="l11628"></a><span class="lineno">11628</span>&#160;}</div>
+<div class="line"><a name="l11629"></a><span class="lineno">11629</span>&#160; </div>
+<div class="line"><a name="l11630"></a><span class="lineno">11630</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo)<span class="keyword"> const</span></div>
+<div class="line"><a name="l11631"></a><span class="lineno">11631</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l11632"></a><span class="lineno">11632</span>&#160;    <span class="keyword">const</span> VkDeviceSize unusableSize = GetUnusableSize();</div>
+<div class="line"><a name="l11633"></a><span class="lineno">11633</span>&#160; </div>
+<div class="line"><a name="l11634"></a><span class="lineno">11634</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> = 1;</div>
+<div class="line"><a name="l11635"></a><span class="lineno">11635</span>&#160; </div>
+<div class="line"><a name="l11636"></a><span class="lineno">11636</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> = 0;</div>
+<div class="line"><a name="l11637"></a><span class="lineno">11637</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> = 0;</div>
+<div class="line"><a name="l11638"></a><span class="lineno">11638</span>&#160; </div>
+<div class="line"><a name="l11639"></a><span class="lineno">11639</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = 0;</div>
+<div class="line"><a name="l11640"></a><span class="lineno">11640</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = UINT64_MAX;</div>
+<div class="line"><a name="l11641"></a><span class="lineno">11641</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#a1081a039964e566c672e7a2347f9e599">allocationSizeAvg</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#a2f9b3452af90c9768a30b7fb6ae194fc">unusedRangeSizeAvg</a> = 0; <span class="comment">// Unused.</span></div>
+<div class="line"><a name="l11642"></a><span class="lineno">11642</span>&#160; </div>
+<div class="line"><a name="l11643"></a><span class="lineno">11643</span>&#160;    CalcAllocationStatInfoNode(outInfo, m_Root, LevelToNodeSize(0));</div>
+<div class="line"><a name="l11644"></a><span class="lineno">11644</span>&#160; </div>
+<div class="line"><a name="l11645"></a><span class="lineno">11645</span>&#160;    <span class="keywordflow">if</span>(unusableSize &gt; 0)</div>
+<div class="line"><a name="l11646"></a><span class="lineno">11646</span>&#160;    {</div>
+<div class="line"><a name="l11647"></a><span class="lineno">11647</span>&#160;        ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
+<div class="line"><a name="l11648"></a><span class="lineno">11648</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusableSize;</div>
+<div class="line"><a name="l11649"></a><span class="lineno">11649</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusableSize);</div>
+<div class="line"><a name="l11650"></a><span class="lineno">11650</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusableSize);</div>
+<div class="line"><a name="l11651"></a><span class="lineno">11651</span>&#160;    }</div>
+<div class="line"><a name="l11652"></a><span class="lineno">11652</span>&#160;}</div>
+<div class="line"><a name="l11653"></a><span class="lineno">11653</span>&#160; </div>
+<div class="line"><a name="l11654"></a><span class="lineno">11654</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats)<span class="keyword"> const</span></div>
+<div class="line"><a name="l11655"></a><span class="lineno">11655</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l11656"></a><span class="lineno">11656</span>&#160;    <span class="keyword">const</span> VkDeviceSize unusableSize = GetUnusableSize();</div>
+<div class="line"><a name="l11657"></a><span class="lineno">11657</span>&#160; </div>
+<div class="line"><a name="l11658"></a><span class="lineno">11658</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a> += GetSize();</div>
+<div class="line"><a name="l11659"></a><span class="lineno">11659</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> += m_SumFreeSize + unusableSize;</div>
+<div class="line"><a name="l11660"></a><span class="lineno">11660</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a> += m_AllocationCount;</div>
+<div class="line"><a name="l11661"></a><span class="lineno">11661</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a> += m_FreeCount;</div>
+<div class="line"><a name="l11662"></a><span class="lineno">11662</span>&#160;    inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = VMA_MAX(inoutStats.<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>, GetUnusedRangeSizeMax());</div>
+<div class="line"><a name="l11663"></a><span class="lineno">11663</span>&#160; </div>
+<div class="line"><a name="l11664"></a><span class="lineno">11664</span>&#160;    <span class="keywordflow">if</span>(unusableSize &gt; 0)</div>
+<div class="line"><a name="l11665"></a><span class="lineno">11665</span>&#160;    {</div>
+<div class="line"><a name="l11666"></a><span class="lineno">11666</span>&#160;        ++inoutStats.<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
+<div class="line"><a name="l11667"></a><span class="lineno">11667</span>&#160;        <span class="comment">// Not updating inoutStats.unusedRangeSizeMax with unusableSize because this space is not available for allocations.</span></div>
+<div class="line"><a name="l11668"></a><span class="lineno">11668</span>&#160;    }</div>
+<div class="line"><a name="l11669"></a><span class="lineno">11669</span>&#160;}</div>
+<div class="line"><a name="l11670"></a><span class="lineno">11670</span>&#160; </div>
+<div class="line"><a name="l11671"></a><span class="lineno">11671</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
 <div class="line"><a name="l11672"></a><span class="lineno">11672</span>&#160; </div>
-<div class="line"><a name="l11673"></a><span class="lineno">11673</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l11674"></a><span class="lineno">11674</span>&#160;}</div>
-<div class="line"><a name="l11675"></a><span class="lineno">11675</span>&#160; </div>
-<div class="line"><a name="l11676"></a><span class="lineno">11676</span>&#160;uint32_t VmaBlockMetadata_Buddy::AllocSizeToLevel(VkDeviceSize allocSize)<span class="keyword"> const</span></div>
-<div class="line"><a name="l11677"></a><span class="lineno">11677</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l11678"></a><span class="lineno">11678</span>&#160;    <span class="comment">// I know this could be optimized somehow e.g. by using std::log2p1 from C++20.</span></div>
-<div class="line"><a name="l11679"></a><span class="lineno">11679</span>&#160;    uint32_t level = 0;</div>
-<div class="line"><a name="l11680"></a><span class="lineno">11680</span>&#160;    VkDeviceSize currLevelNodeSize = m_UsableSize;</div>
-<div class="line"><a name="l11681"></a><span class="lineno">11681</span>&#160;    VkDeviceSize nextLevelNodeSize = currLevelNodeSize &gt;&gt; 1;</div>
-<div class="line"><a name="l11682"></a><span class="lineno">11682</span>&#160;    <span class="keywordflow">while</span>(allocSize &lt;= nextLevelNodeSize &amp;&amp; level + 1 &lt; m_LevelCount)</div>
-<div class="line"><a name="l11683"></a><span class="lineno">11683</span>&#160;    {</div>
-<div class="line"><a name="l11684"></a><span class="lineno">11684</span>&#160;        ++level;</div>
-<div class="line"><a name="l11685"></a><span class="lineno">11685</span>&#160;        currLevelNodeSize = nextLevelNodeSize;</div>
-<div class="line"><a name="l11686"></a><span class="lineno">11686</span>&#160;        nextLevelNodeSize = currLevelNodeSize &gt;&gt; 1;</div>
-<div class="line"><a name="l11687"></a><span class="lineno">11687</span>&#160;    }</div>
-<div class="line"><a name="l11688"></a><span class="lineno">11688</span>&#160;    <span class="keywordflow">return</span> level;</div>
-<div class="line"><a name="l11689"></a><span class="lineno">11689</span>&#160;}</div>
-<div class="line"><a name="l11690"></a><span class="lineno">11690</span>&#160; </div>
-<div class="line"><a name="l11691"></a><span class="lineno">11691</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::FreeAtOffset(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc, VkDeviceSize offset)</div>
-<div class="line"><a name="l11692"></a><span class="lineno">11692</span>&#160;{</div>
-<div class="line"><a name="l11693"></a><span class="lineno">11693</span>&#160;    <span class="comment">// Find node and level.</span></div>
-<div class="line"><a name="l11694"></a><span class="lineno">11694</span>&#160;    Node* node = m_Root;</div>
-<div class="line"><a name="l11695"></a><span class="lineno">11695</span>&#160;    VkDeviceSize nodeOffset = 0;</div>
-<div class="line"><a name="l11696"></a><span class="lineno">11696</span>&#160;    uint32_t level = 0;</div>
-<div class="line"><a name="l11697"></a><span class="lineno">11697</span>&#160;    VkDeviceSize levelNodeSize = LevelToNodeSize(0);</div>
-<div class="line"><a name="l11698"></a><span class="lineno">11698</span>&#160;    <span class="keywordflow">while</span>(node-&gt;type == Node::TYPE_SPLIT)</div>
-<div class="line"><a name="l11699"></a><span class="lineno">11699</span>&#160;    {</div>
-<div class="line"><a name="l11700"></a><span class="lineno">11700</span>&#160;        <span class="keyword">const</span> VkDeviceSize nextLevelSize = levelNodeSize &gt;&gt; 1;</div>
-<div class="line"><a name="l11701"></a><span class="lineno">11701</span>&#160;        <span class="keywordflow">if</span>(offset &lt; nodeOffset + nextLevelSize)</div>
-<div class="line"><a name="l11702"></a><span class="lineno">11702</span>&#160;        {</div>
-<div class="line"><a name="l11703"></a><span class="lineno">11703</span>&#160;            node = node-&gt;split.leftChild;</div>
-<div class="line"><a name="l11704"></a><span class="lineno">11704</span>&#160;        }</div>
-<div class="line"><a name="l11705"></a><span class="lineno">11705</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l11706"></a><span class="lineno">11706</span>&#160;        {</div>
-<div class="line"><a name="l11707"></a><span class="lineno">11707</span>&#160;            node = node-&gt;split.leftChild-&gt;buddy;</div>
-<div class="line"><a name="l11708"></a><span class="lineno">11708</span>&#160;            nodeOffset += nextLevelSize;</div>
-<div class="line"><a name="l11709"></a><span class="lineno">11709</span>&#160;        }</div>
-<div class="line"><a name="l11710"></a><span class="lineno">11710</span>&#160;        ++level;</div>
-<div class="line"><a name="l11711"></a><span class="lineno">11711</span>&#160;        levelNodeSize = nextLevelSize;</div>
-<div class="line"><a name="l11712"></a><span class="lineno">11712</span>&#160;    }</div>
+<div class="line"><a name="l11673"></a><span class="lineno">11673</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json)<span class="keyword"> const</span></div>
+<div class="line"><a name="l11674"></a><span class="lineno">11674</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l11675"></a><span class="lineno">11675</span>&#160;    <span class="comment">// TODO optimize</span></div>
+<div class="line"><a name="l11676"></a><span class="lineno">11676</span>&#160;    <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> stat;</div>
+<div class="line"><a name="l11677"></a><span class="lineno">11677</span>&#160;    CalcAllocationStatInfo(stat);</div>
+<div class="line"><a name="l11678"></a><span class="lineno">11678</span>&#160; </div>
+<div class="line"><a name="l11679"></a><span class="lineno">11679</span>&#160;    PrintDetailedMap_Begin(</div>
+<div class="line"><a name="l11680"></a><span class="lineno">11680</span>&#160;        json,</div>
+<div class="line"><a name="l11681"></a><span class="lineno">11681</span>&#160;        stat.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>,</div>
+<div class="line"><a name="l11682"></a><span class="lineno">11682</span>&#160;        stat.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>,</div>
+<div class="line"><a name="l11683"></a><span class="lineno">11683</span>&#160;        stat.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>);</div>
+<div class="line"><a name="l11684"></a><span class="lineno">11684</span>&#160; </div>
+<div class="line"><a name="l11685"></a><span class="lineno">11685</span>&#160;    PrintDetailedMapNode(json, m_Root, LevelToNodeSize(0));</div>
+<div class="line"><a name="l11686"></a><span class="lineno">11686</span>&#160; </div>
+<div class="line"><a name="l11687"></a><span class="lineno">11687</span>&#160;    <span class="keyword">const</span> VkDeviceSize unusableSize = GetUnusableSize();</div>
+<div class="line"><a name="l11688"></a><span class="lineno">11688</span>&#160;    <span class="keywordflow">if</span>(unusableSize &gt; 0)</div>
+<div class="line"><a name="l11689"></a><span class="lineno">11689</span>&#160;    {</div>
+<div class="line"><a name="l11690"></a><span class="lineno">11690</span>&#160;        PrintDetailedMap_UnusedRange(json,</div>
+<div class="line"><a name="l11691"></a><span class="lineno">11691</span>&#160;            m_UsableSize, <span class="comment">// offset</span></div>
+<div class="line"><a name="l11692"></a><span class="lineno">11692</span>&#160;            unusableSize); <span class="comment">// size</span></div>
+<div class="line"><a name="l11693"></a><span class="lineno">11693</span>&#160;    }</div>
+<div class="line"><a name="l11694"></a><span class="lineno">11694</span>&#160; </div>
+<div class="line"><a name="l11695"></a><span class="lineno">11695</span>&#160;    PrintDetailedMap_End(json);</div>
+<div class="line"><a name="l11696"></a><span class="lineno">11696</span>&#160;}</div>
+<div class="line"><a name="l11697"></a><span class="lineno">11697</span>&#160; </div>
+<div class="line"><a name="l11698"></a><span class="lineno">11698</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l11699"></a><span class="lineno">11699</span>&#160; </div>
+<div class="line"><a name="l11700"></a><span class="lineno">11700</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Buddy::CreateAllocationRequest(</div>
+<div class="line"><a name="l11701"></a><span class="lineno">11701</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l11702"></a><span class="lineno">11702</span>&#160;    uint32_t frameInUseCount,</div>
+<div class="line"><a name="l11703"></a><span class="lineno">11703</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l11704"></a><span class="lineno">11704</span>&#160;    VkDeviceSize allocSize,</div>
+<div class="line"><a name="l11705"></a><span class="lineno">11705</span>&#160;    VkDeviceSize allocAlignment,</div>
+<div class="line"><a name="l11706"></a><span class="lineno">11706</span>&#160;    <span class="keywordtype">bool</span> upperAddress,</div>
+<div class="line"><a name="l11707"></a><span class="lineno">11707</span>&#160;    VmaSuballocationType allocType,</div>
+<div class="line"><a name="l11708"></a><span class="lineno">11708</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost,</div>
+<div class="line"><a name="l11709"></a><span class="lineno">11709</span>&#160;    uint32_t strategy,</div>
+<div class="line"><a name="l11710"></a><span class="lineno">11710</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
+<div class="line"><a name="l11711"></a><span class="lineno">11711</span>&#160;{</div>
+<div class="line"><a name="l11712"></a><span class="lineno">11712</span>&#160;    VMA_ASSERT(!upperAddress &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT can be used only with linear algorithm.&quot;</span>);</div>
 <div class="line"><a name="l11713"></a><span class="lineno">11713</span>&#160; </div>
-<div class="line"><a name="l11714"></a><span class="lineno">11714</span>&#160;    VMA_ASSERT(node != VMA_NULL &amp;&amp; node-&gt;type == Node::TYPE_ALLOCATION);</div>
-<div class="line"><a name="l11715"></a><span class="lineno">11715</span>&#160;    VMA_ASSERT(alloc == VK_NULL_HANDLE || node-&gt;allocation.alloc == alloc);</div>
-<div class="line"><a name="l11716"></a><span class="lineno">11716</span>&#160; </div>
-<div class="line"><a name="l11717"></a><span class="lineno">11717</span>&#160;    ++m_FreeCount;</div>
-<div class="line"><a name="l11718"></a><span class="lineno">11718</span>&#160;    --m_AllocationCount;</div>
-<div class="line"><a name="l11719"></a><span class="lineno">11719</span>&#160;    m_SumFreeSize += alloc-&gt;GetSize();</div>
-<div class="line"><a name="l11720"></a><span class="lineno">11720</span>&#160; </div>
-<div class="line"><a name="l11721"></a><span class="lineno">11721</span>&#160;    node-&gt;type = Node::TYPE_FREE;</div>
-<div class="line"><a name="l11722"></a><span class="lineno">11722</span>&#160; </div>
-<div class="line"><a name="l11723"></a><span class="lineno">11723</span>&#160;    <span class="comment">// Join free nodes if possible.</span></div>
-<div class="line"><a name="l11724"></a><span class="lineno">11724</span>&#160;    <span class="keywordflow">while</span>(level &gt; 0 &amp;&amp; node-&gt;buddy-&gt;type == Node::TYPE_FREE)</div>
+<div class="line"><a name="l11714"></a><span class="lineno">11714</span>&#160;    <span class="comment">// Simple way to respect bufferImageGranularity. May be optimized some day.</span></div>
+<div class="line"><a name="l11715"></a><span class="lineno">11715</span>&#160;    <span class="comment">// Whenever it might be an OPTIMAL image...</span></div>
+<div class="line"><a name="l11716"></a><span class="lineno">11716</span>&#160;    <span class="keywordflow">if</span>(allocType == VMA_SUBALLOCATION_TYPE_UNKNOWN ||</div>
+<div class="line"><a name="l11717"></a><span class="lineno">11717</span>&#160;        allocType == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||</div>
+<div class="line"><a name="l11718"></a><span class="lineno">11718</span>&#160;        allocType == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL)</div>
+<div class="line"><a name="l11719"></a><span class="lineno">11719</span>&#160;    {</div>
+<div class="line"><a name="l11720"></a><span class="lineno">11720</span>&#160;        allocAlignment = VMA_MAX(allocAlignment, bufferImageGranularity);</div>
+<div class="line"><a name="l11721"></a><span class="lineno">11721</span>&#160;        allocSize = VMA_MAX(allocSize, bufferImageGranularity);</div>
+<div class="line"><a name="l11722"></a><span class="lineno">11722</span>&#160;    }</div>
+<div class="line"><a name="l11723"></a><span class="lineno">11723</span>&#160; </div>
+<div class="line"><a name="l11724"></a><span class="lineno">11724</span>&#160;    <span class="keywordflow">if</span>(allocSize &gt; m_UsableSize)</div>
 <div class="line"><a name="l11725"></a><span class="lineno">11725</span>&#160;    {</div>
-<div class="line"><a name="l11726"></a><span class="lineno">11726</span>&#160;        RemoveFromFreeList(level, node-&gt;buddy);</div>
-<div class="line"><a name="l11727"></a><span class="lineno">11727</span>&#160;        Node* <span class="keyword">const</span> parent = node-&gt;parent;</div>
+<div class="line"><a name="l11726"></a><span class="lineno">11726</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l11727"></a><span class="lineno">11727</span>&#160;    }</div>
 <div class="line"><a name="l11728"></a><span class="lineno">11728</span>&#160; </div>
-<div class="line"><a name="l11729"></a><span class="lineno">11729</span>&#160;        vma_delete(GetAllocationCallbacks(), node-&gt;buddy);</div>
-<div class="line"><a name="l11730"></a><span class="lineno">11730</span>&#160;        vma_delete(GetAllocationCallbacks(), node);</div>
-<div class="line"><a name="l11731"></a><span class="lineno">11731</span>&#160;        parent-&gt;type = Node::TYPE_FREE;</div>
-<div class="line"><a name="l11732"></a><span class="lineno">11732</span>&#160;        </div>
-<div class="line"><a name="l11733"></a><span class="lineno">11733</span>&#160;        node = parent;</div>
-<div class="line"><a name="l11734"></a><span class="lineno">11734</span>&#160;        --level;</div>
-<div class="line"><a name="l11735"></a><span class="lineno">11735</span>&#160;        <span class="comment">//m_SumFreeSize += LevelToNodeSize(level) % 2; // Useful only when level node sizes can be non power of 2.</span></div>
-<div class="line"><a name="l11736"></a><span class="lineno">11736</span>&#160;        --m_FreeCount;</div>
-<div class="line"><a name="l11737"></a><span class="lineno">11737</span>&#160;    }</div>
-<div class="line"><a name="l11738"></a><span class="lineno">11738</span>&#160; </div>
-<div class="line"><a name="l11739"></a><span class="lineno">11739</span>&#160;    AddToFreeListFront(level, node);</div>
-<div class="line"><a name="l11740"></a><span class="lineno">11740</span>&#160;}</div>
-<div class="line"><a name="l11741"></a><span class="lineno">11741</span>&#160; </div>
-<div class="line"><a name="l11742"></a><span class="lineno">11742</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::CalcAllocationStatInfoNode(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo, <span class="keyword">const</span> Node* node, VkDeviceSize levelNodeSize)<span class="keyword"> const</span></div>
-<div class="line"><a name="l11743"></a><span class="lineno">11743</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l11744"></a><span class="lineno">11744</span>&#160;    <span class="keywordflow">switch</span>(node-&gt;type)</div>
-<div class="line"><a name="l11745"></a><span class="lineno">11745</span>&#160;    {</div>
-<div class="line"><a name="l11746"></a><span class="lineno">11746</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_FREE:</div>
-<div class="line"><a name="l11747"></a><span class="lineno">11747</span>&#160;        ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
-<div class="line"><a name="l11748"></a><span class="lineno">11748</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += levelNodeSize;</div>
-<div class="line"><a name="l11749"></a><span class="lineno">11749</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, levelNodeSize);</div>
-<div class="line"><a name="l11750"></a><span class="lineno">11750</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, levelNodeSize);</div>
-<div class="line"><a name="l11751"></a><span class="lineno">11751</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11752"></a><span class="lineno">11752</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_ALLOCATION:</div>
-<div class="line"><a name="l11753"></a><span class="lineno">11753</span>&#160;        {</div>
-<div class="line"><a name="l11754"></a><span class="lineno">11754</span>&#160;            <span class="keyword">const</span> VkDeviceSize allocSize = node-&gt;allocation.alloc-&gt;GetSize();</div>
-<div class="line"><a name="l11755"></a><span class="lineno">11755</span>&#160;            ++outInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>;</div>
-<div class="line"><a name="l11756"></a><span class="lineno">11756</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> += allocSize;</div>
-<div class="line"><a name="l11757"></a><span class="lineno">11757</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, allocSize);</div>
-<div class="line"><a name="l11758"></a><span class="lineno">11758</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, allocSize);</div>
-<div class="line"><a name="l11759"></a><span class="lineno">11759</span>&#160; </div>
-<div class="line"><a name="l11760"></a><span class="lineno">11760</span>&#160;            <span class="keyword">const</span> VkDeviceSize unusedRangeSize = levelNodeSize - allocSize;</div>
-<div class="line"><a name="l11761"></a><span class="lineno">11761</span>&#160;            <span class="keywordflow">if</span>(unusedRangeSize &gt; 0)</div>
-<div class="line"><a name="l11762"></a><span class="lineno">11762</span>&#160;            {</div>
-<div class="line"><a name="l11763"></a><span class="lineno">11763</span>&#160;                ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
-<div class="line"><a name="l11764"></a><span class="lineno">11764</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
-<div class="line"><a name="l11765"></a><span class="lineno">11765</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
-<div class="line"><a name="l11766"></a><span class="lineno">11766</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
-<div class="line"><a name="l11767"></a><span class="lineno">11767</span>&#160;            }</div>
-<div class="line"><a name="l11768"></a><span class="lineno">11768</span>&#160;        }</div>
-<div class="line"><a name="l11769"></a><span class="lineno">11769</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11770"></a><span class="lineno">11770</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_SPLIT:</div>
-<div class="line"><a name="l11771"></a><span class="lineno">11771</span>&#160;        {</div>
-<div class="line"><a name="l11772"></a><span class="lineno">11772</span>&#160;            <span class="keyword">const</span> VkDeviceSize childrenNodeSize = levelNodeSize / 2;</div>
-<div class="line"><a name="l11773"></a><span class="lineno">11773</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> leftChild = node-&gt;split.leftChild;</div>
-<div class="line"><a name="l11774"></a><span class="lineno">11774</span>&#160;            CalcAllocationStatInfoNode(outInfo, leftChild, childrenNodeSize);</div>
-<div class="line"><a name="l11775"></a><span class="lineno">11775</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> rightChild = leftChild-&gt;buddy;</div>
-<div class="line"><a name="l11776"></a><span class="lineno">11776</span>&#160;            CalcAllocationStatInfoNode(outInfo, rightChild, childrenNodeSize);</div>
-<div class="line"><a name="l11777"></a><span class="lineno">11777</span>&#160;        }</div>
-<div class="line"><a name="l11778"></a><span class="lineno">11778</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11779"></a><span class="lineno">11779</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l11780"></a><span class="lineno">11780</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l11781"></a><span class="lineno">11781</span>&#160;    }</div>
-<div class="line"><a name="l11782"></a><span class="lineno">11782</span>&#160;}</div>
-<div class="line"><a name="l11783"></a><span class="lineno">11783</span>&#160; </div>
-<div class="line"><a name="l11784"></a><span class="lineno">11784</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::AddToFreeListFront(uint32_t level, Node* node)</div>
-<div class="line"><a name="l11785"></a><span class="lineno">11785</span>&#160;{</div>
-<div class="line"><a name="l11786"></a><span class="lineno">11786</span>&#160;    VMA_ASSERT(node-&gt;type == Node::TYPE_FREE);</div>
-<div class="line"><a name="l11787"></a><span class="lineno">11787</span>&#160; </div>
-<div class="line"><a name="l11788"></a><span class="lineno">11788</span>&#160;    <span class="comment">// List is empty.</span></div>
-<div class="line"><a name="l11789"></a><span class="lineno">11789</span>&#160;    Node* <span class="keyword">const</span> frontNode = m_FreeList[level].front;</div>
-<div class="line"><a name="l11790"></a><span class="lineno">11790</span>&#160;    <span class="keywordflow">if</span>(frontNode == VMA_NULL)</div>
-<div class="line"><a name="l11791"></a><span class="lineno">11791</span>&#160;    {</div>
-<div class="line"><a name="l11792"></a><span class="lineno">11792</span>&#160;        VMA_ASSERT(m_FreeList[level].back == VMA_NULL);</div>
-<div class="line"><a name="l11793"></a><span class="lineno">11793</span>&#160;        node-&gt;free.prev = node-&gt;free.next = VMA_NULL;</div>
-<div class="line"><a name="l11794"></a><span class="lineno">11794</span>&#160;        m_FreeList[level].front = m_FreeList[level].back = node;</div>
-<div class="line"><a name="l11795"></a><span class="lineno">11795</span>&#160;    }</div>
-<div class="line"><a name="l11796"></a><span class="lineno">11796</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l11797"></a><span class="lineno">11797</span>&#160;    {</div>
-<div class="line"><a name="l11798"></a><span class="lineno">11798</span>&#160;        VMA_ASSERT(frontNode-&gt;free.prev == VMA_NULL);</div>
-<div class="line"><a name="l11799"></a><span class="lineno">11799</span>&#160;        node-&gt;free.prev = VMA_NULL;</div>
-<div class="line"><a name="l11800"></a><span class="lineno">11800</span>&#160;        node-&gt;free.next = frontNode;</div>
-<div class="line"><a name="l11801"></a><span class="lineno">11801</span>&#160;        frontNode-&gt;free.prev = node;</div>
-<div class="line"><a name="l11802"></a><span class="lineno">11802</span>&#160;        m_FreeList[level].front = node;</div>
-<div class="line"><a name="l11803"></a><span class="lineno">11803</span>&#160;    }</div>
-<div class="line"><a name="l11804"></a><span class="lineno">11804</span>&#160;}</div>
-<div class="line"><a name="l11805"></a><span class="lineno">11805</span>&#160; </div>
-<div class="line"><a name="l11806"></a><span class="lineno">11806</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::RemoveFromFreeList(uint32_t level, Node* node)</div>
-<div class="line"><a name="l11807"></a><span class="lineno">11807</span>&#160;{</div>
-<div class="line"><a name="l11808"></a><span class="lineno">11808</span>&#160;    VMA_ASSERT(m_FreeList[level].front != VMA_NULL);</div>
+<div class="line"><a name="l11729"></a><span class="lineno">11729</span>&#160;    <span class="keyword">const</span> uint32_t targetLevel = AllocSizeToLevel(allocSize);</div>
+<div class="line"><a name="l11730"></a><span class="lineno">11730</span>&#160;    <span class="keywordflow">for</span>(uint32_t level = targetLevel + 1; level--; )</div>
+<div class="line"><a name="l11731"></a><span class="lineno">11731</span>&#160;    {</div>
+<div class="line"><a name="l11732"></a><span class="lineno">11732</span>&#160;        <span class="keywordflow">for</span>(Node* freeNode = m_FreeList[level].front;</div>
+<div class="line"><a name="l11733"></a><span class="lineno">11733</span>&#160;            freeNode != VMA_NULL;</div>
+<div class="line"><a name="l11734"></a><span class="lineno">11734</span>&#160;            freeNode = freeNode-&gt;free.next)</div>
+<div class="line"><a name="l11735"></a><span class="lineno">11735</span>&#160;        {</div>
+<div class="line"><a name="l11736"></a><span class="lineno">11736</span>&#160;            <span class="keywordflow">if</span>(freeNode-&gt;offset % allocAlignment == 0)</div>
+<div class="line"><a name="l11737"></a><span class="lineno">11737</span>&#160;            {</div>
+<div class="line"><a name="l11738"></a><span class="lineno">11738</span>&#160;                pAllocationRequest-&gt;type = VmaAllocationRequestType::Normal;</div>
+<div class="line"><a name="l11739"></a><span class="lineno">11739</span>&#160;                pAllocationRequest-&gt;offset = freeNode-&gt;offset;</div>
+<div class="line"><a name="l11740"></a><span class="lineno">11740</span>&#160;                pAllocationRequest-&gt;sumFreeSize = LevelToNodeSize(level);</div>
+<div class="line"><a name="l11741"></a><span class="lineno">11741</span>&#160;                pAllocationRequest-&gt;sumItemSize = 0;</div>
+<div class="line"><a name="l11742"></a><span class="lineno">11742</span>&#160;                pAllocationRequest-&gt;itemsToMakeLostCount = 0;</div>
+<div class="line"><a name="l11743"></a><span class="lineno">11743</span>&#160;                pAllocationRequest-&gt;customData = (<span class="keywordtype">void</span>*)(uintptr_t)level;</div>
+<div class="line"><a name="l11744"></a><span class="lineno">11744</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l11745"></a><span class="lineno">11745</span>&#160;            }</div>
+<div class="line"><a name="l11746"></a><span class="lineno">11746</span>&#160;        }</div>
+<div class="line"><a name="l11747"></a><span class="lineno">11747</span>&#160;    }</div>
+<div class="line"><a name="l11748"></a><span class="lineno">11748</span>&#160; </div>
+<div class="line"><a name="l11749"></a><span class="lineno">11749</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l11750"></a><span class="lineno">11750</span>&#160;}</div>
+<div class="line"><a name="l11751"></a><span class="lineno">11751</span>&#160; </div>
+<div class="line"><a name="l11752"></a><span class="lineno">11752</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Buddy::MakeRequestedAllocationsLost(</div>
+<div class="line"><a name="l11753"></a><span class="lineno">11753</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l11754"></a><span class="lineno">11754</span>&#160;    uint32_t frameInUseCount,</div>
+<div class="line"><a name="l11755"></a><span class="lineno">11755</span>&#160;    VmaAllocationRequest* pAllocationRequest)</div>
+<div class="line"><a name="l11756"></a><span class="lineno">11756</span>&#160;{</div>
+<div class="line"><a name="l11757"></a><span class="lineno">11757</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l11758"></a><span class="lineno">11758</span>&#160;<span class="comment">    Lost allocations are not supported in buddy allocator at the moment.</span></div>
+<div class="line"><a name="l11759"></a><span class="lineno">11759</span>&#160;<span class="comment">    Support might be added in the future.</span></div>
+<div class="line"><a name="l11760"></a><span class="lineno">11760</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l11761"></a><span class="lineno">11761</span>&#160;    <span class="keywordflow">return</span> pAllocationRequest-&gt;itemsToMakeLostCount == 0;</div>
+<div class="line"><a name="l11762"></a><span class="lineno">11762</span>&#160;}</div>
+<div class="line"><a name="l11763"></a><span class="lineno">11763</span>&#160; </div>
+<div class="line"><a name="l11764"></a><span class="lineno">11764</span>&#160;uint32_t VmaBlockMetadata_Buddy::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)</div>
+<div class="line"><a name="l11765"></a><span class="lineno">11765</span>&#160;{</div>
+<div class="line"><a name="l11766"></a><span class="lineno">11766</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l11767"></a><span class="lineno">11767</span>&#160;<span class="comment">    Lost allocations are not supported in buddy allocator at the moment.</span></div>
+<div class="line"><a name="l11768"></a><span class="lineno">11768</span>&#160;<span class="comment">    Support might be added in the future.</span></div>
+<div class="line"><a name="l11769"></a><span class="lineno">11769</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l11770"></a><span class="lineno">11770</span>&#160;    <span class="keywordflow">return</span> 0;</div>
+<div class="line"><a name="l11771"></a><span class="lineno">11771</span>&#160;}</div>
+<div class="line"><a name="l11772"></a><span class="lineno">11772</span>&#160; </div>
+<div class="line"><a name="l11773"></a><span class="lineno">11773</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::Alloc(</div>
+<div class="line"><a name="l11774"></a><span class="lineno">11774</span>&#160;    <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
+<div class="line"><a name="l11775"></a><span class="lineno">11775</span>&#160;    VmaSuballocationType type,</div>
+<div class="line"><a name="l11776"></a><span class="lineno">11776</span>&#160;    VkDeviceSize allocSize,</div>
+<div class="line"><a name="l11777"></a><span class="lineno">11777</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
+<div class="line"><a name="l11778"></a><span class="lineno">11778</span>&#160;{</div>
+<div class="line"><a name="l11779"></a><span class="lineno">11779</span>&#160;    VMA_ASSERT(request.type == VmaAllocationRequestType::Normal);</div>
+<div class="line"><a name="l11780"></a><span class="lineno">11780</span>&#160; </div>
+<div class="line"><a name="l11781"></a><span class="lineno">11781</span>&#160;    <span class="keyword">const</span> uint32_t targetLevel = AllocSizeToLevel(allocSize);</div>
+<div class="line"><a name="l11782"></a><span class="lineno">11782</span>&#160;    uint32_t currLevel = (uint32_t)(uintptr_t)request.customData;</div>
+<div class="line"><a name="l11783"></a><span class="lineno">11783</span>&#160;    </div>
+<div class="line"><a name="l11784"></a><span class="lineno">11784</span>&#160;    Node* currNode = m_FreeList[currLevel].front;</div>
+<div class="line"><a name="l11785"></a><span class="lineno">11785</span>&#160;    VMA_ASSERT(currNode != VMA_NULL &amp;&amp; currNode-&gt;type == Node::TYPE_FREE);</div>
+<div class="line"><a name="l11786"></a><span class="lineno">11786</span>&#160;    <span class="keywordflow">while</span>(currNode-&gt;offset != request.offset)</div>
+<div class="line"><a name="l11787"></a><span class="lineno">11787</span>&#160;    {</div>
+<div class="line"><a name="l11788"></a><span class="lineno">11788</span>&#160;        currNode = currNode-&gt;free.next;</div>
+<div class="line"><a name="l11789"></a><span class="lineno">11789</span>&#160;        VMA_ASSERT(currNode != VMA_NULL &amp;&amp; currNode-&gt;type == Node::TYPE_FREE);</div>
+<div class="line"><a name="l11790"></a><span class="lineno">11790</span>&#160;    }</div>
+<div class="line"><a name="l11791"></a><span class="lineno">11791</span>&#160;    </div>
+<div class="line"><a name="l11792"></a><span class="lineno">11792</span>&#160;    <span class="comment">// Go down, splitting free nodes.</span></div>
+<div class="line"><a name="l11793"></a><span class="lineno">11793</span>&#160;    <span class="keywordflow">while</span>(currLevel &lt; targetLevel)</div>
+<div class="line"><a name="l11794"></a><span class="lineno">11794</span>&#160;    {</div>
+<div class="line"><a name="l11795"></a><span class="lineno">11795</span>&#160;        <span class="comment">// currNode is already first free node at currLevel.</span></div>
+<div class="line"><a name="l11796"></a><span class="lineno">11796</span>&#160;        <span class="comment">// Remove it from list of free nodes at this currLevel.</span></div>
+<div class="line"><a name="l11797"></a><span class="lineno">11797</span>&#160;        RemoveFromFreeList(currLevel, currNode);</div>
+<div class="line"><a name="l11798"></a><span class="lineno">11798</span>&#160;         </div>
+<div class="line"><a name="l11799"></a><span class="lineno">11799</span>&#160;        <span class="keyword">const</span> uint32_t childrenLevel = currLevel + 1;</div>
+<div class="line"><a name="l11800"></a><span class="lineno">11800</span>&#160; </div>
+<div class="line"><a name="l11801"></a><span class="lineno">11801</span>&#160;        <span class="comment">// Create two free sub-nodes.</span></div>
+<div class="line"><a name="l11802"></a><span class="lineno">11802</span>&#160;        Node* leftChild = vma_new(GetAllocationCallbacks(), Node)();</div>
+<div class="line"><a name="l11803"></a><span class="lineno">11803</span>&#160;        Node* rightChild = vma_new(GetAllocationCallbacks(), Node)();</div>
+<div class="line"><a name="l11804"></a><span class="lineno">11804</span>&#160; </div>
+<div class="line"><a name="l11805"></a><span class="lineno">11805</span>&#160;        leftChild-&gt;offset = currNode-&gt;offset;</div>
+<div class="line"><a name="l11806"></a><span class="lineno">11806</span>&#160;        leftChild-&gt;type = Node::TYPE_FREE;</div>
+<div class="line"><a name="l11807"></a><span class="lineno">11807</span>&#160;        leftChild-&gt;parent = currNode;</div>
+<div class="line"><a name="l11808"></a><span class="lineno">11808</span>&#160;        leftChild-&gt;buddy = rightChild;</div>
 <div class="line"><a name="l11809"></a><span class="lineno">11809</span>&#160; </div>
-<div class="line"><a name="l11810"></a><span class="lineno">11810</span>&#160;    <span class="comment">// It is at the front.</span></div>
-<div class="line"><a name="l11811"></a><span class="lineno">11811</span>&#160;    <span class="keywordflow">if</span>(node-&gt;free.prev == VMA_NULL)</div>
-<div class="line"><a name="l11812"></a><span class="lineno">11812</span>&#160;    {</div>
-<div class="line"><a name="l11813"></a><span class="lineno">11813</span>&#160;        VMA_ASSERT(m_FreeList[level].front == node);</div>
-<div class="line"><a name="l11814"></a><span class="lineno">11814</span>&#160;        m_FreeList[level].front = node-&gt;free.next;</div>
-<div class="line"><a name="l11815"></a><span class="lineno">11815</span>&#160;    }</div>
-<div class="line"><a name="l11816"></a><span class="lineno">11816</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l11817"></a><span class="lineno">11817</span>&#160;    {</div>
-<div class="line"><a name="l11818"></a><span class="lineno">11818</span>&#160;        Node* <span class="keyword">const</span> prevFreeNode = node-&gt;free.prev;</div>
-<div class="line"><a name="l11819"></a><span class="lineno">11819</span>&#160;        VMA_ASSERT(prevFreeNode-&gt;free.next == node);</div>
-<div class="line"><a name="l11820"></a><span class="lineno">11820</span>&#160;        prevFreeNode-&gt;free.next = node-&gt;free.next;</div>
-<div class="line"><a name="l11821"></a><span class="lineno">11821</span>&#160;    }</div>
+<div class="line"><a name="l11810"></a><span class="lineno">11810</span>&#160;        rightChild-&gt;offset = currNode-&gt;offset + LevelToNodeSize(childrenLevel);</div>
+<div class="line"><a name="l11811"></a><span class="lineno">11811</span>&#160;        rightChild-&gt;type = Node::TYPE_FREE;</div>
+<div class="line"><a name="l11812"></a><span class="lineno">11812</span>&#160;        rightChild-&gt;parent = currNode;</div>
+<div class="line"><a name="l11813"></a><span class="lineno">11813</span>&#160;        rightChild-&gt;buddy = leftChild;</div>
+<div class="line"><a name="l11814"></a><span class="lineno">11814</span>&#160; </div>
+<div class="line"><a name="l11815"></a><span class="lineno">11815</span>&#160;        <span class="comment">// Convert current currNode to split type.</span></div>
+<div class="line"><a name="l11816"></a><span class="lineno">11816</span>&#160;        currNode-&gt;type = Node::TYPE_SPLIT;</div>
+<div class="line"><a name="l11817"></a><span class="lineno">11817</span>&#160;        currNode-&gt;split.leftChild = leftChild;</div>
+<div class="line"><a name="l11818"></a><span class="lineno">11818</span>&#160; </div>
+<div class="line"><a name="l11819"></a><span class="lineno">11819</span>&#160;        <span class="comment">// Add child nodes to free list. Order is important!</span></div>
+<div class="line"><a name="l11820"></a><span class="lineno">11820</span>&#160;        AddToFreeListFront(childrenLevel, rightChild);</div>
+<div class="line"><a name="l11821"></a><span class="lineno">11821</span>&#160;        AddToFreeListFront(childrenLevel, leftChild);</div>
 <div class="line"><a name="l11822"></a><span class="lineno">11822</span>&#160; </div>
-<div class="line"><a name="l11823"></a><span class="lineno">11823</span>&#160;    <span class="comment">// It is at the back.</span></div>
-<div class="line"><a name="l11824"></a><span class="lineno">11824</span>&#160;    <span class="keywordflow">if</span>(node-&gt;free.next == VMA_NULL)</div>
-<div class="line"><a name="l11825"></a><span class="lineno">11825</span>&#160;    {</div>
-<div class="line"><a name="l11826"></a><span class="lineno">11826</span>&#160;        VMA_ASSERT(m_FreeList[level].back == node);</div>
-<div class="line"><a name="l11827"></a><span class="lineno">11827</span>&#160;        m_FreeList[level].back = node-&gt;free.prev;</div>
-<div class="line"><a name="l11828"></a><span class="lineno">11828</span>&#160;    }</div>
-<div class="line"><a name="l11829"></a><span class="lineno">11829</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l11830"></a><span class="lineno">11830</span>&#160;    {</div>
-<div class="line"><a name="l11831"></a><span class="lineno">11831</span>&#160;        Node* <span class="keyword">const</span> nextFreeNode = node-&gt;free.next;</div>
-<div class="line"><a name="l11832"></a><span class="lineno">11832</span>&#160;        VMA_ASSERT(nextFreeNode-&gt;free.prev == node);</div>
-<div class="line"><a name="l11833"></a><span class="lineno">11833</span>&#160;        nextFreeNode-&gt;free.prev = node-&gt;free.prev;</div>
-<div class="line"><a name="l11834"></a><span class="lineno">11834</span>&#160;    }</div>
-<div class="line"><a name="l11835"></a><span class="lineno">11835</span>&#160;}</div>
-<div class="line"><a name="l11836"></a><span class="lineno">11836</span>&#160; </div>
-<div class="line"><a name="l11837"></a><span class="lineno">11837</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l11838"></a><span class="lineno">11838</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::PrintDetailedMapNode(<span class="keyword">class</span> VmaJsonWriter&amp; json, <span class="keyword">const</span> Node* node, VkDeviceSize levelNodeSize)<span class="keyword"> const</span></div>
-<div class="line"><a name="l11839"></a><span class="lineno">11839</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l11840"></a><span class="lineno">11840</span>&#160;    <span class="keywordflow">switch</span>(node-&gt;type)</div>
-<div class="line"><a name="l11841"></a><span class="lineno">11841</span>&#160;    {</div>
-<div class="line"><a name="l11842"></a><span class="lineno">11842</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_FREE:</div>
-<div class="line"><a name="l11843"></a><span class="lineno">11843</span>&#160;        PrintDetailedMap_UnusedRange(json, node-&gt;offset, levelNodeSize);</div>
-<div class="line"><a name="l11844"></a><span class="lineno">11844</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11845"></a><span class="lineno">11845</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_ALLOCATION:</div>
-<div class="line"><a name="l11846"></a><span class="lineno">11846</span>&#160;        {   </div>
-<div class="line"><a name="l11847"></a><span class="lineno">11847</span>&#160;            PrintDetailedMap_Allocation(json, node-&gt;offset, node-&gt;allocation.alloc);</div>
-<div class="line"><a name="l11848"></a><span class="lineno">11848</span>&#160;            <span class="keyword">const</span> VkDeviceSize allocSize = node-&gt;allocation.alloc-&gt;GetSize();</div>
-<div class="line"><a name="l11849"></a><span class="lineno">11849</span>&#160;            <span class="keywordflow">if</span>(allocSize &lt; levelNodeSize)</div>
-<div class="line"><a name="l11850"></a><span class="lineno">11850</span>&#160;            {</div>
-<div class="line"><a name="l11851"></a><span class="lineno">11851</span>&#160;                PrintDetailedMap_UnusedRange(json, node-&gt;offset + allocSize, levelNodeSize - allocSize);</div>
-<div class="line"><a name="l11852"></a><span class="lineno">11852</span>&#160;            }</div>
-<div class="line"><a name="l11853"></a><span class="lineno">11853</span>&#160;        }</div>
-<div class="line"><a name="l11854"></a><span class="lineno">11854</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11855"></a><span class="lineno">11855</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_SPLIT:</div>
-<div class="line"><a name="l11856"></a><span class="lineno">11856</span>&#160;        {</div>
-<div class="line"><a name="l11857"></a><span class="lineno">11857</span>&#160;            <span class="keyword">const</span> VkDeviceSize childrenNodeSize = levelNodeSize / 2;</div>
-<div class="line"><a name="l11858"></a><span class="lineno">11858</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> leftChild = node-&gt;split.leftChild;</div>
-<div class="line"><a name="l11859"></a><span class="lineno">11859</span>&#160;            PrintDetailedMapNode(json, leftChild, childrenNodeSize);</div>
-<div class="line"><a name="l11860"></a><span class="lineno">11860</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> rightChild = leftChild-&gt;buddy;</div>
-<div class="line"><a name="l11861"></a><span class="lineno">11861</span>&#160;            PrintDetailedMapNode(json, rightChild, childrenNodeSize);</div>
-<div class="line"><a name="l11862"></a><span class="lineno">11862</span>&#160;        }</div>
-<div class="line"><a name="l11863"></a><span class="lineno">11863</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11864"></a><span class="lineno">11864</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l11865"></a><span class="lineno">11865</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l11866"></a><span class="lineno">11866</span>&#160;    }</div>
-<div class="line"><a name="l11867"></a><span class="lineno">11867</span>&#160;}</div>
-<div class="line"><a name="l11868"></a><span class="lineno">11868</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l11869"></a><span class="lineno">11869</span>&#160; </div>
-<div class="line"><a name="l11870"></a><span class="lineno">11870</span>&#160; </div>
-<div class="line"><a name="l11872"></a><span class="lineno">11872</span>&#160;<span class="comment">// class VmaDeviceMemoryBlock</span></div>
-<div class="line"><a name="l11873"></a><span class="lineno">11873</span>&#160; </div>
-<div class="line"><a name="l11874"></a><span class="lineno">11874</span>&#160;VmaDeviceMemoryBlock::VmaDeviceMemoryBlock(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator) :</div>
-<div class="line"><a name="l11875"></a><span class="lineno">11875</span>&#160;    m_pMetadata(VMA_NULL),</div>
-<div class="line"><a name="l11876"></a><span class="lineno">11876</span>&#160;    m_MemoryTypeIndex(UINT32_MAX),</div>
-<div class="line"><a name="l11877"></a><span class="lineno">11877</span>&#160;    m_Id(0),</div>
-<div class="line"><a name="l11878"></a><span class="lineno">11878</span>&#160;    m_hMemory(VK_NULL_HANDLE),</div>
-<div class="line"><a name="l11879"></a><span class="lineno">11879</span>&#160;    m_MapCount(0),</div>
-<div class="line"><a name="l11880"></a><span class="lineno">11880</span>&#160;    m_pMappedData(VMA_NULL)</div>
-<div class="line"><a name="l11881"></a><span class="lineno">11881</span>&#160;{</div>
-<div class="line"><a name="l11882"></a><span class="lineno">11882</span>&#160;}</div>
-<div class="line"><a name="l11883"></a><span class="lineno">11883</span>&#160; </div>
-<div class="line"><a name="l11884"></a><span class="lineno">11884</span>&#160;<span class="keywordtype">void</span> VmaDeviceMemoryBlock::Init(</div>
-<div class="line"><a name="l11885"></a><span class="lineno">11885</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l11886"></a><span class="lineno">11886</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> hParentPool,</div>
-<div class="line"><a name="l11887"></a><span class="lineno">11887</span>&#160;    uint32_t newMemoryTypeIndex,</div>
-<div class="line"><a name="l11888"></a><span class="lineno">11888</span>&#160;    VkDeviceMemory newMemory,</div>
-<div class="line"><a name="l11889"></a><span class="lineno">11889</span>&#160;    VkDeviceSize newSize,</div>
-<div class="line"><a name="l11890"></a><span class="lineno">11890</span>&#160;    uint32_t <span class="keywordtype">id</span>,</div>
-<div class="line"><a name="l11891"></a><span class="lineno">11891</span>&#160;    uint32_t algorithm)</div>
-<div class="line"><a name="l11892"></a><span class="lineno">11892</span>&#160;{</div>
-<div class="line"><a name="l11893"></a><span class="lineno">11893</span>&#160;    VMA_ASSERT(m_hMemory == VK_NULL_HANDLE);</div>
-<div class="line"><a name="l11894"></a><span class="lineno">11894</span>&#160; </div>
-<div class="line"><a name="l11895"></a><span class="lineno">11895</span>&#160;    m_hParentPool = hParentPool;</div>
-<div class="line"><a name="l11896"></a><span class="lineno">11896</span>&#160;    m_MemoryTypeIndex = newMemoryTypeIndex;</div>
-<div class="line"><a name="l11897"></a><span class="lineno">11897</span>&#160;    m_Id = id;</div>
-<div class="line"><a name="l11898"></a><span class="lineno">11898</span>&#160;    m_hMemory = newMemory;</div>
-<div class="line"><a name="l11899"></a><span class="lineno">11899</span>&#160; </div>
-<div class="line"><a name="l11900"></a><span class="lineno">11900</span>&#160;    <span class="keywordflow">switch</span>(algorithm)</div>
-<div class="line"><a name="l11901"></a><span class="lineno">11901</span>&#160;    {</div>
-<div class="line"><a name="l11902"></a><span class="lineno">11902</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>:</div>
-<div class="line"><a name="l11903"></a><span class="lineno">11903</span>&#160;        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Linear)(hAllocator);</div>
-<div class="line"><a name="l11904"></a><span class="lineno">11904</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11905"></a><span class="lineno">11905</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a>:</div>
-<div class="line"><a name="l11906"></a><span class="lineno">11906</span>&#160;        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Buddy)(hAllocator);</div>
-<div class="line"><a name="l11907"></a><span class="lineno">11907</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l11908"></a><span class="lineno">11908</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l11909"></a><span class="lineno">11909</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l11910"></a><span class="lineno">11910</span>&#160;        <span class="comment">// Fall-through.</span></div>
-<div class="line"><a name="l11911"></a><span class="lineno">11911</span>&#160;    <span class="keywordflow">case</span> 0:</div>
-<div class="line"><a name="l11912"></a><span class="lineno">11912</span>&#160;        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Generic)(hAllocator);</div>
-<div class="line"><a name="l11913"></a><span class="lineno">11913</span>&#160;    }</div>
-<div class="line"><a name="l11914"></a><span class="lineno">11914</span>&#160;    m_pMetadata-&gt;Init(newSize);</div>
-<div class="line"><a name="l11915"></a><span class="lineno">11915</span>&#160;}</div>
-<div class="line"><a name="l11916"></a><span class="lineno">11916</span>&#160; </div>
-<div class="line"><a name="l11917"></a><span class="lineno">11917</span>&#160;<span class="keywordtype">void</span> VmaDeviceMemoryBlock::Destroy(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator)</div>
-<div class="line"><a name="l11918"></a><span class="lineno">11918</span>&#160;{</div>
-<div class="line"><a name="l11919"></a><span class="lineno">11919</span>&#160;    <span class="comment">// This is the most important assert in the entire library.</span></div>
-<div class="line"><a name="l11920"></a><span class="lineno">11920</span>&#160;    <span class="comment">// Hitting it means you have some memory leak - unreleased VmaAllocation objects.</span></div>
-<div class="line"><a name="l11921"></a><span class="lineno">11921</span>&#160;    VMA_ASSERT(m_pMetadata-&gt;IsEmpty() &amp;&amp; <span class="stringliteral">&quot;Some allocations were not freed before destruction of this memory block!&quot;</span>);</div>
-<div class="line"><a name="l11922"></a><span class="lineno">11922</span>&#160; </div>
-<div class="line"><a name="l11923"></a><span class="lineno">11923</span>&#160;    VMA_ASSERT(m_hMemory != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l11924"></a><span class="lineno">11924</span>&#160;    allocator-&gt;FreeVulkanMemory(m_MemoryTypeIndex, m_pMetadata-&gt;GetSize(), m_hMemory);</div>
-<div class="line"><a name="l11925"></a><span class="lineno">11925</span>&#160;    m_hMemory = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l11926"></a><span class="lineno">11926</span>&#160; </div>
-<div class="line"><a name="l11927"></a><span class="lineno">11927</span>&#160;    vma_delete(allocator, m_pMetadata);</div>
-<div class="line"><a name="l11928"></a><span class="lineno">11928</span>&#160;    m_pMetadata = VMA_NULL;</div>
-<div class="line"><a name="l11929"></a><span class="lineno">11929</span>&#160;}</div>
-<div class="line"><a name="l11930"></a><span class="lineno">11930</span>&#160; </div>
-<div class="line"><a name="l11931"></a><span class="lineno">11931</span>&#160;<span class="keywordtype">bool</span> VmaDeviceMemoryBlock::Validate()<span class="keyword"> const</span></div>
-<div class="line"><a name="l11932"></a><span class="lineno">11932</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l11933"></a><span class="lineno">11933</span>&#160;    VMA_VALIDATE((m_hMemory != VK_NULL_HANDLE) &amp;&amp;</div>
-<div class="line"><a name="l11934"></a><span class="lineno">11934</span>&#160;        (m_pMetadata-&gt;GetSize() != 0));</div>
-<div class="line"><a name="l11935"></a><span class="lineno">11935</span>&#160;    </div>
-<div class="line"><a name="l11936"></a><span class="lineno">11936</span>&#160;    <span class="keywordflow">return</span> m_pMetadata-&gt;Validate();</div>
-<div class="line"><a name="l11937"></a><span class="lineno">11937</span>&#160;}</div>
-<div class="line"><a name="l11938"></a><span class="lineno">11938</span>&#160; </div>
-<div class="line"><a name="l11939"></a><span class="lineno">11939</span>&#160;VkResult VmaDeviceMemoryBlock::CheckCorruption(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator)</div>
-<div class="line"><a name="l11940"></a><span class="lineno">11940</span>&#160;{</div>
-<div class="line"><a name="l11941"></a><span class="lineno">11941</span>&#160;    <span class="keywordtype">void</span>* pData = <span class="keyword">nullptr</span>;</div>
-<div class="line"><a name="l11942"></a><span class="lineno">11942</span>&#160;    VkResult res = Map(hAllocator, 1, &amp;pData);</div>
-<div class="line"><a name="l11943"></a><span class="lineno">11943</span>&#160;    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
-<div class="line"><a name="l11944"></a><span class="lineno">11944</span>&#160;    {</div>
-<div class="line"><a name="l11945"></a><span class="lineno">11945</span>&#160;        <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l11946"></a><span class="lineno">11946</span>&#160;    }</div>
-<div class="line"><a name="l11947"></a><span class="lineno">11947</span>&#160; </div>
-<div class="line"><a name="l11948"></a><span class="lineno">11948</span>&#160;    res = m_pMetadata-&gt;CheckCorruption(pData);</div>
-<div class="line"><a name="l11949"></a><span class="lineno">11949</span>&#160; </div>
-<div class="line"><a name="l11950"></a><span class="lineno">11950</span>&#160;    Unmap(hAllocator, 1);</div>
-<div class="line"><a name="l11951"></a><span class="lineno">11951</span>&#160; </div>
-<div class="line"><a name="l11952"></a><span class="lineno">11952</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l11953"></a><span class="lineno">11953</span>&#160;}</div>
-<div class="line"><a name="l11954"></a><span class="lineno">11954</span>&#160; </div>
-<div class="line"><a name="l11955"></a><span class="lineno">11955</span>&#160;VkResult VmaDeviceMemoryBlock::Map(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, uint32_t count, <span class="keywordtype">void</span>** ppData)</div>
-<div class="line"><a name="l11956"></a><span class="lineno">11956</span>&#160;{</div>
-<div class="line"><a name="l11957"></a><span class="lineno">11957</span>&#160;    <span class="keywordflow">if</span>(count == 0)</div>
-<div class="line"><a name="l11958"></a><span class="lineno">11958</span>&#160;    {</div>
-<div class="line"><a name="l11959"></a><span class="lineno">11959</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l11960"></a><span class="lineno">11960</span>&#160;    }</div>
-<div class="line"><a name="l11961"></a><span class="lineno">11961</span>&#160; </div>
-<div class="line"><a name="l11962"></a><span class="lineno">11962</span>&#160;    VmaMutexLock lock(m_Mutex, hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l11963"></a><span class="lineno">11963</span>&#160;    <span class="keywordflow">if</span>(m_MapCount != 0)</div>
-<div class="line"><a name="l11964"></a><span class="lineno">11964</span>&#160;    {</div>
-<div class="line"><a name="l11965"></a><span class="lineno">11965</span>&#160;        m_MapCount += count;</div>
-<div class="line"><a name="l11966"></a><span class="lineno">11966</span>&#160;        VMA_ASSERT(m_pMappedData != VMA_NULL);</div>
-<div class="line"><a name="l11967"></a><span class="lineno">11967</span>&#160;        <span class="keywordflow">if</span>(ppData != VMA_NULL)</div>
-<div class="line"><a name="l11968"></a><span class="lineno">11968</span>&#160;        {</div>
-<div class="line"><a name="l11969"></a><span class="lineno">11969</span>&#160;            *ppData = m_pMappedData;</div>
-<div class="line"><a name="l11970"></a><span class="lineno">11970</span>&#160;        }</div>
-<div class="line"><a name="l11971"></a><span class="lineno">11971</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l11972"></a><span class="lineno">11972</span>&#160;    }</div>
-<div class="line"><a name="l11973"></a><span class="lineno">11973</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l11974"></a><span class="lineno">11974</span>&#160;    {</div>
-<div class="line"><a name="l11975"></a><span class="lineno">11975</span>&#160;        VkResult result = (*hAllocator-&gt;GetVulkanFunctions().vkMapMemory)(</div>
-<div class="line"><a name="l11976"></a><span class="lineno">11976</span>&#160;            hAllocator-&gt;m_hDevice,</div>
-<div class="line"><a name="l11977"></a><span class="lineno">11977</span>&#160;            m_hMemory,</div>
-<div class="line"><a name="l11978"></a><span class="lineno">11978</span>&#160;            0, <span class="comment">// offset</span></div>
-<div class="line"><a name="l11979"></a><span class="lineno">11979</span>&#160;            VK_WHOLE_SIZE,</div>
-<div class="line"><a name="l11980"></a><span class="lineno">11980</span>&#160;            0, <span class="comment">// flags</span></div>
-<div class="line"><a name="l11981"></a><span class="lineno">11981</span>&#160;            &amp;m_pMappedData);</div>
-<div class="line"><a name="l11982"></a><span class="lineno">11982</span>&#160;        <span class="keywordflow">if</span>(result == VK_SUCCESS)</div>
-<div class="line"><a name="l11983"></a><span class="lineno">11983</span>&#160;        {</div>
-<div class="line"><a name="l11984"></a><span class="lineno">11984</span>&#160;            <span class="keywordflow">if</span>(ppData != VMA_NULL)</div>
-<div class="line"><a name="l11985"></a><span class="lineno">11985</span>&#160;            {</div>
-<div class="line"><a name="l11986"></a><span class="lineno">11986</span>&#160;                *ppData = m_pMappedData;</div>
-<div class="line"><a name="l11987"></a><span class="lineno">11987</span>&#160;            }</div>
-<div class="line"><a name="l11988"></a><span class="lineno">11988</span>&#160;            m_MapCount = count;</div>
-<div class="line"><a name="l11989"></a><span class="lineno">11989</span>&#160;        }</div>
-<div class="line"><a name="l11990"></a><span class="lineno">11990</span>&#160;        <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l11991"></a><span class="lineno">11991</span>&#160;    }</div>
-<div class="line"><a name="l11992"></a><span class="lineno">11992</span>&#160;}</div>
-<div class="line"><a name="l11993"></a><span class="lineno">11993</span>&#160; </div>
-<div class="line"><a name="l11994"></a><span class="lineno">11994</span>&#160;<span class="keywordtype">void</span> VmaDeviceMemoryBlock::Unmap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, uint32_t count)</div>
-<div class="line"><a name="l11995"></a><span class="lineno">11995</span>&#160;{</div>
-<div class="line"><a name="l11996"></a><span class="lineno">11996</span>&#160;    <span class="keywordflow">if</span>(count == 0)</div>
-<div class="line"><a name="l11997"></a><span class="lineno">11997</span>&#160;    {</div>
-<div class="line"><a name="l11998"></a><span class="lineno">11998</span>&#160;        <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l11999"></a><span class="lineno">11999</span>&#160;    }</div>
-<div class="line"><a name="l12000"></a><span class="lineno">12000</span>&#160; </div>
-<div class="line"><a name="l12001"></a><span class="lineno">12001</span>&#160;    VmaMutexLock lock(m_Mutex, hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l12002"></a><span class="lineno">12002</span>&#160;    <span class="keywordflow">if</span>(m_MapCount &gt;= count)</div>
-<div class="line"><a name="l12003"></a><span class="lineno">12003</span>&#160;    {</div>
-<div class="line"><a name="l12004"></a><span class="lineno">12004</span>&#160;        m_MapCount -= count;</div>
-<div class="line"><a name="l12005"></a><span class="lineno">12005</span>&#160;        <span class="keywordflow">if</span>(m_MapCount == 0)</div>
-<div class="line"><a name="l12006"></a><span class="lineno">12006</span>&#160;        {</div>
-<div class="line"><a name="l12007"></a><span class="lineno">12007</span>&#160;            m_pMappedData = VMA_NULL;</div>
-<div class="line"><a name="l12008"></a><span class="lineno">12008</span>&#160;            (*hAllocator-&gt;GetVulkanFunctions().vkUnmapMemory)(hAllocator-&gt;m_hDevice, m_hMemory);</div>
-<div class="line"><a name="l12009"></a><span class="lineno">12009</span>&#160;        }</div>
-<div class="line"><a name="l12010"></a><span class="lineno">12010</span>&#160;    }</div>
-<div class="line"><a name="l12011"></a><span class="lineno">12011</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l12012"></a><span class="lineno">12012</span>&#160;    {</div>
-<div class="line"><a name="l12013"></a><span class="lineno">12013</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VkDeviceMemory block is being unmapped while it was not previously mapped.&quot;</span>);</div>
-<div class="line"><a name="l12014"></a><span class="lineno">12014</span>&#160;    }</div>
-<div class="line"><a name="l12015"></a><span class="lineno">12015</span>&#160;}</div>
-<div class="line"><a name="l12016"></a><span class="lineno">12016</span>&#160; </div>
-<div class="line"><a name="l12017"></a><span class="lineno">12017</span>&#160;VkResult VmaDeviceMemoryBlock::WriteMagicValueAroundAllocation(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize)</div>
-<div class="line"><a name="l12018"></a><span class="lineno">12018</span>&#160;{</div>
-<div class="line"><a name="l12019"></a><span class="lineno">12019</span>&#160;    VMA_ASSERT(VMA_DEBUG_MARGIN &gt; 0 &amp;&amp; VMA_DEBUG_MARGIN % 4 == 0 &amp;&amp; VMA_DEBUG_DETECT_CORRUPTION);</div>
-<div class="line"><a name="l12020"></a><span class="lineno">12020</span>&#160;    VMA_ASSERT(allocOffset &gt;= VMA_DEBUG_MARGIN);</div>
-<div class="line"><a name="l12021"></a><span class="lineno">12021</span>&#160; </div>
-<div class="line"><a name="l12022"></a><span class="lineno">12022</span>&#160;    <span class="keywordtype">void</span>* pData;</div>
-<div class="line"><a name="l12023"></a><span class="lineno">12023</span>&#160;    VkResult res = Map(hAllocator, 1, &amp;pData);</div>
-<div class="line"><a name="l12024"></a><span class="lineno">12024</span>&#160;    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l11823"></a><span class="lineno">11823</span>&#160;        ++m_FreeCount;</div>
+<div class="line"><a name="l11824"></a><span class="lineno">11824</span>&#160;        <span class="comment">//m_SumFreeSize -= LevelToNodeSize(currLevel) % 2; // Useful only when level node sizes can be non power of 2.</span></div>
+<div class="line"><a name="l11825"></a><span class="lineno">11825</span>&#160;        ++currLevel;</div>
+<div class="line"><a name="l11826"></a><span class="lineno">11826</span>&#160;        currNode = m_FreeList[currLevel].front;</div>
+<div class="line"><a name="l11827"></a><span class="lineno">11827</span>&#160; </div>
+<div class="line"><a name="l11828"></a><span class="lineno">11828</span>&#160;        <span class="comment">/*</span></div>
+<div class="line"><a name="l11829"></a><span class="lineno">11829</span>&#160;<span class="comment">        We can be sure that currNode, as left child of node previously split,</span></div>
+<div class="line"><a name="l11830"></a><span class="lineno">11830</span>&#160;<span class="comment">        also fullfills the alignment requirement.</span></div>
+<div class="line"><a name="l11831"></a><span class="lineno">11831</span>&#160;<span class="comment">        */</span></div>
+<div class="line"><a name="l11832"></a><span class="lineno">11832</span>&#160;    }</div>
+<div class="line"><a name="l11833"></a><span class="lineno">11833</span>&#160; </div>
+<div class="line"><a name="l11834"></a><span class="lineno">11834</span>&#160;    <span class="comment">// Remove from free list.</span></div>
+<div class="line"><a name="l11835"></a><span class="lineno">11835</span>&#160;    VMA_ASSERT(currLevel == targetLevel &amp;&amp;</div>
+<div class="line"><a name="l11836"></a><span class="lineno">11836</span>&#160;        currNode != VMA_NULL &amp;&amp;</div>
+<div class="line"><a name="l11837"></a><span class="lineno">11837</span>&#160;        currNode-&gt;type == Node::TYPE_FREE);</div>
+<div class="line"><a name="l11838"></a><span class="lineno">11838</span>&#160;    RemoveFromFreeList(currLevel, currNode);</div>
+<div class="line"><a name="l11839"></a><span class="lineno">11839</span>&#160; </div>
+<div class="line"><a name="l11840"></a><span class="lineno">11840</span>&#160;    <span class="comment">// Convert to allocation node.</span></div>
+<div class="line"><a name="l11841"></a><span class="lineno">11841</span>&#160;    currNode-&gt;type = Node::TYPE_ALLOCATION;</div>
+<div class="line"><a name="l11842"></a><span class="lineno">11842</span>&#160;    currNode-&gt;allocation.alloc = hAllocation;</div>
+<div class="line"><a name="l11843"></a><span class="lineno">11843</span>&#160; </div>
+<div class="line"><a name="l11844"></a><span class="lineno">11844</span>&#160;    ++m_AllocationCount;</div>
+<div class="line"><a name="l11845"></a><span class="lineno">11845</span>&#160;    --m_FreeCount;</div>
+<div class="line"><a name="l11846"></a><span class="lineno">11846</span>&#160;    m_SumFreeSize -= allocSize;</div>
+<div class="line"><a name="l11847"></a><span class="lineno">11847</span>&#160;}</div>
+<div class="line"><a name="l11848"></a><span class="lineno">11848</span>&#160; </div>
+<div class="line"><a name="l11849"></a><span class="lineno">11849</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::DeleteNode(Node* node)</div>
+<div class="line"><a name="l11850"></a><span class="lineno">11850</span>&#160;{</div>
+<div class="line"><a name="l11851"></a><span class="lineno">11851</span>&#160;    <span class="keywordflow">if</span>(node-&gt;type == Node::TYPE_SPLIT)</div>
+<div class="line"><a name="l11852"></a><span class="lineno">11852</span>&#160;    {</div>
+<div class="line"><a name="l11853"></a><span class="lineno">11853</span>&#160;        DeleteNode(node-&gt;split.leftChild-&gt;buddy);</div>
+<div class="line"><a name="l11854"></a><span class="lineno">11854</span>&#160;        DeleteNode(node-&gt;split.leftChild);</div>
+<div class="line"><a name="l11855"></a><span class="lineno">11855</span>&#160;    }</div>
+<div class="line"><a name="l11856"></a><span class="lineno">11856</span>&#160; </div>
+<div class="line"><a name="l11857"></a><span class="lineno">11857</span>&#160;    vma_delete(GetAllocationCallbacks(), node);</div>
+<div class="line"><a name="l11858"></a><span class="lineno">11858</span>&#160;}</div>
+<div class="line"><a name="l11859"></a><span class="lineno">11859</span>&#160; </div>
+<div class="line"><a name="l11860"></a><span class="lineno">11860</span>&#160;<span class="keywordtype">bool</span> VmaBlockMetadata_Buddy::ValidateNode(ValidationContext&amp; ctx, <span class="keyword">const</span> Node* parent, <span class="keyword">const</span> Node* curr, uint32_t level, VkDeviceSize levelNodeSize)<span class="keyword"> const</span></div>
+<div class="line"><a name="l11861"></a><span class="lineno">11861</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l11862"></a><span class="lineno">11862</span>&#160;    VMA_VALIDATE(level &lt; m_LevelCount);</div>
+<div class="line"><a name="l11863"></a><span class="lineno">11863</span>&#160;    VMA_VALIDATE(curr-&gt;parent == parent);</div>
+<div class="line"><a name="l11864"></a><span class="lineno">11864</span>&#160;    VMA_VALIDATE((curr-&gt;buddy == VMA_NULL) == (parent == VMA_NULL));</div>
+<div class="line"><a name="l11865"></a><span class="lineno">11865</span>&#160;    VMA_VALIDATE(curr-&gt;buddy == VMA_NULL || curr-&gt;buddy-&gt;buddy == curr);</div>
+<div class="line"><a name="l11866"></a><span class="lineno">11866</span>&#160;    <span class="keywordflow">switch</span>(curr-&gt;type)</div>
+<div class="line"><a name="l11867"></a><span class="lineno">11867</span>&#160;    {</div>
+<div class="line"><a name="l11868"></a><span class="lineno">11868</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_FREE:</div>
+<div class="line"><a name="l11869"></a><span class="lineno">11869</span>&#160;        <span class="comment">// curr-&gt;free.prev, next are validated separately.</span></div>
+<div class="line"><a name="l11870"></a><span class="lineno">11870</span>&#160;        ctx.calculatedSumFreeSize += levelNodeSize;</div>
+<div class="line"><a name="l11871"></a><span class="lineno">11871</span>&#160;        ++ctx.calculatedFreeCount;</div>
+<div class="line"><a name="l11872"></a><span class="lineno">11872</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11873"></a><span class="lineno">11873</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_ALLOCATION:</div>
+<div class="line"><a name="l11874"></a><span class="lineno">11874</span>&#160;        ++ctx.calculatedAllocationCount;</div>
+<div class="line"><a name="l11875"></a><span class="lineno">11875</span>&#160;        ctx.calculatedSumFreeSize += levelNodeSize - curr-&gt;allocation.alloc-&gt;GetSize();</div>
+<div class="line"><a name="l11876"></a><span class="lineno">11876</span>&#160;        VMA_VALIDATE(curr-&gt;allocation.alloc != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l11877"></a><span class="lineno">11877</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11878"></a><span class="lineno">11878</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_SPLIT:</div>
+<div class="line"><a name="l11879"></a><span class="lineno">11879</span>&#160;        {</div>
+<div class="line"><a name="l11880"></a><span class="lineno">11880</span>&#160;            <span class="keyword">const</span> uint32_t childrenLevel = level + 1;</div>
+<div class="line"><a name="l11881"></a><span class="lineno">11881</span>&#160;            <span class="keyword">const</span> VkDeviceSize childrenLevelNodeSize = levelNodeSize / 2;</div>
+<div class="line"><a name="l11882"></a><span class="lineno">11882</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> leftChild = curr-&gt;split.leftChild;</div>
+<div class="line"><a name="l11883"></a><span class="lineno">11883</span>&#160;            VMA_VALIDATE(leftChild != VMA_NULL);</div>
+<div class="line"><a name="l11884"></a><span class="lineno">11884</span>&#160;            VMA_VALIDATE(leftChild-&gt;offset == curr-&gt;offset);</div>
+<div class="line"><a name="l11885"></a><span class="lineno">11885</span>&#160;            <span class="keywordflow">if</span>(!ValidateNode(ctx, curr, leftChild, childrenLevel, childrenLevelNodeSize))</div>
+<div class="line"><a name="l11886"></a><span class="lineno">11886</span>&#160;            {</div>
+<div class="line"><a name="l11887"></a><span class="lineno">11887</span>&#160;                VMA_VALIDATE(<span class="keyword">false</span> &amp;&amp; <span class="stringliteral">&quot;ValidateNode for left child failed.&quot;</span>);</div>
+<div class="line"><a name="l11888"></a><span class="lineno">11888</span>&#160;            }</div>
+<div class="line"><a name="l11889"></a><span class="lineno">11889</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> rightChild = leftChild-&gt;buddy;</div>
+<div class="line"><a name="l11890"></a><span class="lineno">11890</span>&#160;            VMA_VALIDATE(rightChild-&gt;offset == curr-&gt;offset + childrenLevelNodeSize);</div>
+<div class="line"><a name="l11891"></a><span class="lineno">11891</span>&#160;            <span class="keywordflow">if</span>(!ValidateNode(ctx, curr, rightChild, childrenLevel, childrenLevelNodeSize))</div>
+<div class="line"><a name="l11892"></a><span class="lineno">11892</span>&#160;            {</div>
+<div class="line"><a name="l11893"></a><span class="lineno">11893</span>&#160;                VMA_VALIDATE(<span class="keyword">false</span> &amp;&amp; <span class="stringliteral">&quot;ValidateNode for right child failed.&quot;</span>);</div>
+<div class="line"><a name="l11894"></a><span class="lineno">11894</span>&#160;            }</div>
+<div class="line"><a name="l11895"></a><span class="lineno">11895</span>&#160;        }</div>
+<div class="line"><a name="l11896"></a><span class="lineno">11896</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11897"></a><span class="lineno">11897</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l11898"></a><span class="lineno">11898</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l11899"></a><span class="lineno">11899</span>&#160;    }</div>
+<div class="line"><a name="l11900"></a><span class="lineno">11900</span>&#160; </div>
+<div class="line"><a name="l11901"></a><span class="lineno">11901</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l11902"></a><span class="lineno">11902</span>&#160;}</div>
+<div class="line"><a name="l11903"></a><span class="lineno">11903</span>&#160; </div>
+<div class="line"><a name="l11904"></a><span class="lineno">11904</span>&#160;uint32_t VmaBlockMetadata_Buddy::AllocSizeToLevel(VkDeviceSize allocSize)<span class="keyword"> const</span></div>
+<div class="line"><a name="l11905"></a><span class="lineno">11905</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l11906"></a><span class="lineno">11906</span>&#160;    <span class="comment">// I know this could be optimized somehow e.g. by using std::log2p1 from C++20.</span></div>
+<div class="line"><a name="l11907"></a><span class="lineno">11907</span>&#160;    uint32_t level = 0;</div>
+<div class="line"><a name="l11908"></a><span class="lineno">11908</span>&#160;    VkDeviceSize currLevelNodeSize = m_UsableSize;</div>
+<div class="line"><a name="l11909"></a><span class="lineno">11909</span>&#160;    VkDeviceSize nextLevelNodeSize = currLevelNodeSize &gt;&gt; 1;</div>
+<div class="line"><a name="l11910"></a><span class="lineno">11910</span>&#160;    <span class="keywordflow">while</span>(allocSize &lt;= nextLevelNodeSize &amp;&amp; level + 1 &lt; m_LevelCount)</div>
+<div class="line"><a name="l11911"></a><span class="lineno">11911</span>&#160;    {</div>
+<div class="line"><a name="l11912"></a><span class="lineno">11912</span>&#160;        ++level;</div>
+<div class="line"><a name="l11913"></a><span class="lineno">11913</span>&#160;        currLevelNodeSize = nextLevelNodeSize;</div>
+<div class="line"><a name="l11914"></a><span class="lineno">11914</span>&#160;        nextLevelNodeSize = currLevelNodeSize &gt;&gt; 1;</div>
+<div class="line"><a name="l11915"></a><span class="lineno">11915</span>&#160;    }</div>
+<div class="line"><a name="l11916"></a><span class="lineno">11916</span>&#160;    <span class="keywordflow">return</span> level;</div>
+<div class="line"><a name="l11917"></a><span class="lineno">11917</span>&#160;}</div>
+<div class="line"><a name="l11918"></a><span class="lineno">11918</span>&#160; </div>
+<div class="line"><a name="l11919"></a><span class="lineno">11919</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::FreeAtOffset(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc, VkDeviceSize offset)</div>
+<div class="line"><a name="l11920"></a><span class="lineno">11920</span>&#160;{</div>
+<div class="line"><a name="l11921"></a><span class="lineno">11921</span>&#160;    <span class="comment">// Find node and level.</span></div>
+<div class="line"><a name="l11922"></a><span class="lineno">11922</span>&#160;    Node* node = m_Root;</div>
+<div class="line"><a name="l11923"></a><span class="lineno">11923</span>&#160;    VkDeviceSize nodeOffset = 0;</div>
+<div class="line"><a name="l11924"></a><span class="lineno">11924</span>&#160;    uint32_t level = 0;</div>
+<div class="line"><a name="l11925"></a><span class="lineno">11925</span>&#160;    VkDeviceSize levelNodeSize = LevelToNodeSize(0);</div>
+<div class="line"><a name="l11926"></a><span class="lineno">11926</span>&#160;    <span class="keywordflow">while</span>(node-&gt;type == Node::TYPE_SPLIT)</div>
+<div class="line"><a name="l11927"></a><span class="lineno">11927</span>&#160;    {</div>
+<div class="line"><a name="l11928"></a><span class="lineno">11928</span>&#160;        <span class="keyword">const</span> VkDeviceSize nextLevelSize = levelNodeSize &gt;&gt; 1;</div>
+<div class="line"><a name="l11929"></a><span class="lineno">11929</span>&#160;        <span class="keywordflow">if</span>(offset &lt; nodeOffset + nextLevelSize)</div>
+<div class="line"><a name="l11930"></a><span class="lineno">11930</span>&#160;        {</div>
+<div class="line"><a name="l11931"></a><span class="lineno">11931</span>&#160;            node = node-&gt;split.leftChild;</div>
+<div class="line"><a name="l11932"></a><span class="lineno">11932</span>&#160;        }</div>
+<div class="line"><a name="l11933"></a><span class="lineno">11933</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l11934"></a><span class="lineno">11934</span>&#160;        {</div>
+<div class="line"><a name="l11935"></a><span class="lineno">11935</span>&#160;            node = node-&gt;split.leftChild-&gt;buddy;</div>
+<div class="line"><a name="l11936"></a><span class="lineno">11936</span>&#160;            nodeOffset += nextLevelSize;</div>
+<div class="line"><a name="l11937"></a><span class="lineno">11937</span>&#160;        }</div>
+<div class="line"><a name="l11938"></a><span class="lineno">11938</span>&#160;        ++level;</div>
+<div class="line"><a name="l11939"></a><span class="lineno">11939</span>&#160;        levelNodeSize = nextLevelSize;</div>
+<div class="line"><a name="l11940"></a><span class="lineno">11940</span>&#160;    }</div>
+<div class="line"><a name="l11941"></a><span class="lineno">11941</span>&#160; </div>
+<div class="line"><a name="l11942"></a><span class="lineno">11942</span>&#160;    VMA_ASSERT(node != VMA_NULL &amp;&amp; node-&gt;type == Node::TYPE_ALLOCATION);</div>
+<div class="line"><a name="l11943"></a><span class="lineno">11943</span>&#160;    VMA_ASSERT(alloc == VK_NULL_HANDLE || node-&gt;allocation.alloc == alloc);</div>
+<div class="line"><a name="l11944"></a><span class="lineno">11944</span>&#160; </div>
+<div class="line"><a name="l11945"></a><span class="lineno">11945</span>&#160;    ++m_FreeCount;</div>
+<div class="line"><a name="l11946"></a><span class="lineno">11946</span>&#160;    --m_AllocationCount;</div>
+<div class="line"><a name="l11947"></a><span class="lineno">11947</span>&#160;    m_SumFreeSize += alloc-&gt;GetSize();</div>
+<div class="line"><a name="l11948"></a><span class="lineno">11948</span>&#160; </div>
+<div class="line"><a name="l11949"></a><span class="lineno">11949</span>&#160;    node-&gt;type = Node::TYPE_FREE;</div>
+<div class="line"><a name="l11950"></a><span class="lineno">11950</span>&#160; </div>
+<div class="line"><a name="l11951"></a><span class="lineno">11951</span>&#160;    <span class="comment">// Join free nodes if possible.</span></div>
+<div class="line"><a name="l11952"></a><span class="lineno">11952</span>&#160;    <span class="keywordflow">while</span>(level &gt; 0 &amp;&amp; node-&gt;buddy-&gt;type == Node::TYPE_FREE)</div>
+<div class="line"><a name="l11953"></a><span class="lineno">11953</span>&#160;    {</div>
+<div class="line"><a name="l11954"></a><span class="lineno">11954</span>&#160;        RemoveFromFreeList(level, node-&gt;buddy);</div>
+<div class="line"><a name="l11955"></a><span class="lineno">11955</span>&#160;        Node* <span class="keyword">const</span> parent = node-&gt;parent;</div>
+<div class="line"><a name="l11956"></a><span class="lineno">11956</span>&#160; </div>
+<div class="line"><a name="l11957"></a><span class="lineno">11957</span>&#160;        vma_delete(GetAllocationCallbacks(), node-&gt;buddy);</div>
+<div class="line"><a name="l11958"></a><span class="lineno">11958</span>&#160;        vma_delete(GetAllocationCallbacks(), node);</div>
+<div class="line"><a name="l11959"></a><span class="lineno">11959</span>&#160;        parent-&gt;type = Node::TYPE_FREE;</div>
+<div class="line"><a name="l11960"></a><span class="lineno">11960</span>&#160;        </div>
+<div class="line"><a name="l11961"></a><span class="lineno">11961</span>&#160;        node = parent;</div>
+<div class="line"><a name="l11962"></a><span class="lineno">11962</span>&#160;        --level;</div>
+<div class="line"><a name="l11963"></a><span class="lineno">11963</span>&#160;        <span class="comment">//m_SumFreeSize += LevelToNodeSize(level) % 2; // Useful only when level node sizes can be non power of 2.</span></div>
+<div class="line"><a name="l11964"></a><span class="lineno">11964</span>&#160;        --m_FreeCount;</div>
+<div class="line"><a name="l11965"></a><span class="lineno">11965</span>&#160;    }</div>
+<div class="line"><a name="l11966"></a><span class="lineno">11966</span>&#160; </div>
+<div class="line"><a name="l11967"></a><span class="lineno">11967</span>&#160;    AddToFreeListFront(level, node);</div>
+<div class="line"><a name="l11968"></a><span class="lineno">11968</span>&#160;}</div>
+<div class="line"><a name="l11969"></a><span class="lineno">11969</span>&#160; </div>
+<div class="line"><a name="l11970"></a><span class="lineno">11970</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::CalcAllocationStatInfoNode(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo, <span class="keyword">const</span> Node* node, VkDeviceSize levelNodeSize)<span class="keyword"> const</span></div>
+<div class="line"><a name="l11971"></a><span class="lineno">11971</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l11972"></a><span class="lineno">11972</span>&#160;    <span class="keywordflow">switch</span>(node-&gt;type)</div>
+<div class="line"><a name="l11973"></a><span class="lineno">11973</span>&#160;    {</div>
+<div class="line"><a name="l11974"></a><span class="lineno">11974</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_FREE:</div>
+<div class="line"><a name="l11975"></a><span class="lineno">11975</span>&#160;        ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
+<div class="line"><a name="l11976"></a><span class="lineno">11976</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += levelNodeSize;</div>
+<div class="line"><a name="l11977"></a><span class="lineno">11977</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, levelNodeSize);</div>
+<div class="line"><a name="l11978"></a><span class="lineno">11978</span>&#160;        outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, levelNodeSize);</div>
+<div class="line"><a name="l11979"></a><span class="lineno">11979</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11980"></a><span class="lineno">11980</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_ALLOCATION:</div>
+<div class="line"><a name="l11981"></a><span class="lineno">11981</span>&#160;        {</div>
+<div class="line"><a name="l11982"></a><span class="lineno">11982</span>&#160;            <span class="keyword">const</span> VkDeviceSize allocSize = node-&gt;allocation.alloc-&gt;GetSize();</div>
+<div class="line"><a name="l11983"></a><span class="lineno">11983</span>&#160;            ++outInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>;</div>
+<div class="line"><a name="l11984"></a><span class="lineno">11984</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> += allocSize;</div>
+<div class="line"><a name="l11985"></a><span class="lineno">11985</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, allocSize);</div>
+<div class="line"><a name="l11986"></a><span class="lineno">11986</span>&#160;            outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, allocSize);</div>
+<div class="line"><a name="l11987"></a><span class="lineno">11987</span>&#160; </div>
+<div class="line"><a name="l11988"></a><span class="lineno">11988</span>&#160;            <span class="keyword">const</span> VkDeviceSize unusedRangeSize = levelNodeSize - allocSize;</div>
+<div class="line"><a name="l11989"></a><span class="lineno">11989</span>&#160;            <span class="keywordflow">if</span>(unusedRangeSize &gt; 0)</div>
+<div class="line"><a name="l11990"></a><span class="lineno">11990</span>&#160;            {</div>
+<div class="line"><a name="l11991"></a><span class="lineno">11991</span>&#160;                ++outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
+<div class="line"><a name="l11992"></a><span class="lineno">11992</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += unusedRangeSize;</div>
+<div class="line"><a name="l11993"></a><span class="lineno">11993</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, unusedRangeSize);</div>
+<div class="line"><a name="l11994"></a><span class="lineno">11994</span>&#160;                outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MAX(outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, unusedRangeSize);</div>
+<div class="line"><a name="l11995"></a><span class="lineno">11995</span>&#160;            }</div>
+<div class="line"><a name="l11996"></a><span class="lineno">11996</span>&#160;        }</div>
+<div class="line"><a name="l11997"></a><span class="lineno">11997</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l11998"></a><span class="lineno">11998</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_SPLIT:</div>
+<div class="line"><a name="l11999"></a><span class="lineno">11999</span>&#160;        {</div>
+<div class="line"><a name="l12000"></a><span class="lineno">12000</span>&#160;            <span class="keyword">const</span> VkDeviceSize childrenNodeSize = levelNodeSize / 2;</div>
+<div class="line"><a name="l12001"></a><span class="lineno">12001</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> leftChild = node-&gt;split.leftChild;</div>
+<div class="line"><a name="l12002"></a><span class="lineno">12002</span>&#160;            CalcAllocationStatInfoNode(outInfo, leftChild, childrenNodeSize);</div>
+<div class="line"><a name="l12003"></a><span class="lineno">12003</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> rightChild = leftChild-&gt;buddy;</div>
+<div class="line"><a name="l12004"></a><span class="lineno">12004</span>&#160;            CalcAllocationStatInfoNode(outInfo, rightChild, childrenNodeSize);</div>
+<div class="line"><a name="l12005"></a><span class="lineno">12005</span>&#160;        }</div>
+<div class="line"><a name="l12006"></a><span class="lineno">12006</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12007"></a><span class="lineno">12007</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l12008"></a><span class="lineno">12008</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l12009"></a><span class="lineno">12009</span>&#160;    }</div>
+<div class="line"><a name="l12010"></a><span class="lineno">12010</span>&#160;}</div>
+<div class="line"><a name="l12011"></a><span class="lineno">12011</span>&#160; </div>
+<div class="line"><a name="l12012"></a><span class="lineno">12012</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::AddToFreeListFront(uint32_t level, Node* node)</div>
+<div class="line"><a name="l12013"></a><span class="lineno">12013</span>&#160;{</div>
+<div class="line"><a name="l12014"></a><span class="lineno">12014</span>&#160;    VMA_ASSERT(node-&gt;type == Node::TYPE_FREE);</div>
+<div class="line"><a name="l12015"></a><span class="lineno">12015</span>&#160; </div>
+<div class="line"><a name="l12016"></a><span class="lineno">12016</span>&#160;    <span class="comment">// List is empty.</span></div>
+<div class="line"><a name="l12017"></a><span class="lineno">12017</span>&#160;    Node* <span class="keyword">const</span> frontNode = m_FreeList[level].front;</div>
+<div class="line"><a name="l12018"></a><span class="lineno">12018</span>&#160;    <span class="keywordflow">if</span>(frontNode == VMA_NULL)</div>
+<div class="line"><a name="l12019"></a><span class="lineno">12019</span>&#160;    {</div>
+<div class="line"><a name="l12020"></a><span class="lineno">12020</span>&#160;        VMA_ASSERT(m_FreeList[level].back == VMA_NULL);</div>
+<div class="line"><a name="l12021"></a><span class="lineno">12021</span>&#160;        node-&gt;free.prev = node-&gt;free.next = VMA_NULL;</div>
+<div class="line"><a name="l12022"></a><span class="lineno">12022</span>&#160;        m_FreeList[level].front = m_FreeList[level].back = node;</div>
+<div class="line"><a name="l12023"></a><span class="lineno">12023</span>&#160;    }</div>
+<div class="line"><a name="l12024"></a><span class="lineno">12024</span>&#160;    <span class="keywordflow">else</span></div>
 <div class="line"><a name="l12025"></a><span class="lineno">12025</span>&#160;    {</div>
-<div class="line"><a name="l12026"></a><span class="lineno">12026</span>&#160;        <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l12027"></a><span class="lineno">12027</span>&#160;    }</div>
-<div class="line"><a name="l12028"></a><span class="lineno">12028</span>&#160; </div>
-<div class="line"><a name="l12029"></a><span class="lineno">12029</span>&#160;    VmaWriteMagicValue(pData, allocOffset - VMA_DEBUG_MARGIN);</div>
-<div class="line"><a name="l12030"></a><span class="lineno">12030</span>&#160;    VmaWriteMagicValue(pData, allocOffset + allocSize);</div>
-<div class="line"><a name="l12031"></a><span class="lineno">12031</span>&#160; </div>
-<div class="line"><a name="l12032"></a><span class="lineno">12032</span>&#160;    Unmap(hAllocator, 1);</div>
+<div class="line"><a name="l12026"></a><span class="lineno">12026</span>&#160;        VMA_ASSERT(frontNode-&gt;free.prev == VMA_NULL);</div>
+<div class="line"><a name="l12027"></a><span class="lineno">12027</span>&#160;        node-&gt;free.prev = VMA_NULL;</div>
+<div class="line"><a name="l12028"></a><span class="lineno">12028</span>&#160;        node-&gt;free.next = frontNode;</div>
+<div class="line"><a name="l12029"></a><span class="lineno">12029</span>&#160;        frontNode-&gt;free.prev = node;</div>
+<div class="line"><a name="l12030"></a><span class="lineno">12030</span>&#160;        m_FreeList[level].front = node;</div>
+<div class="line"><a name="l12031"></a><span class="lineno">12031</span>&#160;    }</div>
+<div class="line"><a name="l12032"></a><span class="lineno">12032</span>&#160;}</div>
 <div class="line"><a name="l12033"></a><span class="lineno">12033</span>&#160; </div>
-<div class="line"><a name="l12034"></a><span class="lineno">12034</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l12035"></a><span class="lineno">12035</span>&#160;}</div>
-<div class="line"><a name="l12036"></a><span class="lineno">12036</span>&#160; </div>
-<div class="line"><a name="l12037"></a><span class="lineno">12037</span>&#160;VkResult VmaDeviceMemoryBlock::ValidateMagicValueAroundAllocation(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize)</div>
-<div class="line"><a name="l12038"></a><span class="lineno">12038</span>&#160;{</div>
-<div class="line"><a name="l12039"></a><span class="lineno">12039</span>&#160;    VMA_ASSERT(VMA_DEBUG_MARGIN &gt; 0 &amp;&amp; VMA_DEBUG_MARGIN % 4 == 0 &amp;&amp; VMA_DEBUG_DETECT_CORRUPTION);</div>
-<div class="line"><a name="l12040"></a><span class="lineno">12040</span>&#160;    VMA_ASSERT(allocOffset &gt;= VMA_DEBUG_MARGIN);</div>
-<div class="line"><a name="l12041"></a><span class="lineno">12041</span>&#160; </div>
-<div class="line"><a name="l12042"></a><span class="lineno">12042</span>&#160;    <span class="keywordtype">void</span>* pData;</div>
-<div class="line"><a name="l12043"></a><span class="lineno">12043</span>&#160;    VkResult res = Map(hAllocator, 1, &amp;pData);</div>
-<div class="line"><a name="l12044"></a><span class="lineno">12044</span>&#160;    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l12034"></a><span class="lineno">12034</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::RemoveFromFreeList(uint32_t level, Node* node)</div>
+<div class="line"><a name="l12035"></a><span class="lineno">12035</span>&#160;{</div>
+<div class="line"><a name="l12036"></a><span class="lineno">12036</span>&#160;    VMA_ASSERT(m_FreeList[level].front != VMA_NULL);</div>
+<div class="line"><a name="l12037"></a><span class="lineno">12037</span>&#160; </div>
+<div class="line"><a name="l12038"></a><span class="lineno">12038</span>&#160;    <span class="comment">// It is at the front.</span></div>
+<div class="line"><a name="l12039"></a><span class="lineno">12039</span>&#160;    <span class="keywordflow">if</span>(node-&gt;free.prev == VMA_NULL)</div>
+<div class="line"><a name="l12040"></a><span class="lineno">12040</span>&#160;    {</div>
+<div class="line"><a name="l12041"></a><span class="lineno">12041</span>&#160;        VMA_ASSERT(m_FreeList[level].front == node);</div>
+<div class="line"><a name="l12042"></a><span class="lineno">12042</span>&#160;        m_FreeList[level].front = node-&gt;free.next;</div>
+<div class="line"><a name="l12043"></a><span class="lineno">12043</span>&#160;    }</div>
+<div class="line"><a name="l12044"></a><span class="lineno">12044</span>&#160;    <span class="keywordflow">else</span></div>
 <div class="line"><a name="l12045"></a><span class="lineno">12045</span>&#160;    {</div>
-<div class="line"><a name="l12046"></a><span class="lineno">12046</span>&#160;        <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l12047"></a><span class="lineno">12047</span>&#160;    }</div>
-<div class="line"><a name="l12048"></a><span class="lineno">12048</span>&#160; </div>
-<div class="line"><a name="l12049"></a><span class="lineno">12049</span>&#160;    <span class="keywordflow">if</span>(!VmaValidateMagicValue(pData, allocOffset - VMA_DEBUG_MARGIN))</div>
-<div class="line"><a name="l12050"></a><span class="lineno">12050</span>&#160;    {</div>
-<div class="line"><a name="l12051"></a><span class="lineno">12051</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED BEFORE FREED ALLOCATION!&quot;</span>);</div>
-<div class="line"><a name="l12052"></a><span class="lineno">12052</span>&#160;    }</div>
-<div class="line"><a name="l12053"></a><span class="lineno">12053</span>&#160;    <span class="keywordflow">else</span> <span class="keywordflow">if</span>(!VmaValidateMagicValue(pData, allocOffset + allocSize))</div>
-<div class="line"><a name="l12054"></a><span class="lineno">12054</span>&#160;    {</div>
-<div class="line"><a name="l12055"></a><span class="lineno">12055</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED AFTER FREED ALLOCATION!&quot;</span>);</div>
+<div class="line"><a name="l12046"></a><span class="lineno">12046</span>&#160;        Node* <span class="keyword">const</span> prevFreeNode = node-&gt;free.prev;</div>
+<div class="line"><a name="l12047"></a><span class="lineno">12047</span>&#160;        VMA_ASSERT(prevFreeNode-&gt;free.next == node);</div>
+<div class="line"><a name="l12048"></a><span class="lineno">12048</span>&#160;        prevFreeNode-&gt;free.next = node-&gt;free.next;</div>
+<div class="line"><a name="l12049"></a><span class="lineno">12049</span>&#160;    }</div>
+<div class="line"><a name="l12050"></a><span class="lineno">12050</span>&#160; </div>
+<div class="line"><a name="l12051"></a><span class="lineno">12051</span>&#160;    <span class="comment">// It is at the back.</span></div>
+<div class="line"><a name="l12052"></a><span class="lineno">12052</span>&#160;    <span class="keywordflow">if</span>(node-&gt;free.next == VMA_NULL)</div>
+<div class="line"><a name="l12053"></a><span class="lineno">12053</span>&#160;    {</div>
+<div class="line"><a name="l12054"></a><span class="lineno">12054</span>&#160;        VMA_ASSERT(m_FreeList[level].back == node);</div>
+<div class="line"><a name="l12055"></a><span class="lineno">12055</span>&#160;        m_FreeList[level].back = node-&gt;free.prev;</div>
 <div class="line"><a name="l12056"></a><span class="lineno">12056</span>&#160;    }</div>
-<div class="line"><a name="l12057"></a><span class="lineno">12057</span>&#160; </div>
-<div class="line"><a name="l12058"></a><span class="lineno">12058</span>&#160;    Unmap(hAllocator, 1);</div>
-<div class="line"><a name="l12059"></a><span class="lineno">12059</span>&#160; </div>
-<div class="line"><a name="l12060"></a><span class="lineno">12060</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l12061"></a><span class="lineno">12061</span>&#160;}</div>
-<div class="line"><a name="l12062"></a><span class="lineno">12062</span>&#160; </div>
-<div class="line"><a name="l12063"></a><span class="lineno">12063</span>&#160;VkResult VmaDeviceMemoryBlock::BindBufferMemory(</div>
-<div class="line"><a name="l12064"></a><span class="lineno">12064</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l12065"></a><span class="lineno">12065</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
-<div class="line"><a name="l12066"></a><span class="lineno">12066</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l12067"></a><span class="lineno">12067</span>&#160;    VkBuffer hBuffer,</div>
-<div class="line"><a name="l12068"></a><span class="lineno">12068</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
-<div class="line"><a name="l12069"></a><span class="lineno">12069</span>&#160;{</div>
-<div class="line"><a name="l12070"></a><span class="lineno">12070</span>&#160;    VMA_ASSERT(hAllocation-&gt;GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK &amp;&amp;</div>
-<div class="line"><a name="l12071"></a><span class="lineno">12071</span>&#160;        hAllocation-&gt;GetBlock() == <span class="keyword">this</span>);</div>
-<div class="line"><a name="l12072"></a><span class="lineno">12072</span>&#160;    VMA_ASSERT(allocationLocalOffset &lt; hAllocation-&gt;GetSize() &amp;&amp;</div>
-<div class="line"><a name="l12073"></a><span class="lineno">12073</span>&#160;        <span class="stringliteral">&quot;Invalid allocationLocalOffset. Did you forget that this offset is relative to the beginning of the allocation, not the whole memory block?&quot;</span>);</div>
-<div class="line"><a name="l12074"></a><span class="lineno">12074</span>&#160;    <span class="keyword">const</span> VkDeviceSize memoryOffset = hAllocation-&gt;GetOffset() + allocationLocalOffset;</div>
-<div class="line"><a name="l12075"></a><span class="lineno">12075</span>&#160;    <span class="comment">// This lock is important so that we don&#39;t call vkBind... and/or vkMap... simultaneously on the same VkDeviceMemory from multiple threads.</span></div>
-<div class="line"><a name="l12076"></a><span class="lineno">12076</span>&#160;    VmaMutexLock lock(m_Mutex, hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l12077"></a><span class="lineno">12077</span>&#160;    <span class="keywordflow">return</span> hAllocator-&gt;BindVulkanBuffer(m_hMemory, memoryOffset, hBuffer, pNext);</div>
-<div class="line"><a name="l12078"></a><span class="lineno">12078</span>&#160;}</div>
-<div class="line"><a name="l12079"></a><span class="lineno">12079</span>&#160; </div>
-<div class="line"><a name="l12080"></a><span class="lineno">12080</span>&#160;VkResult VmaDeviceMemoryBlock::BindImageMemory(</div>
-<div class="line"><a name="l12081"></a><span class="lineno">12081</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l12082"></a><span class="lineno">12082</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
-<div class="line"><a name="l12083"></a><span class="lineno">12083</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l12084"></a><span class="lineno">12084</span>&#160;    VkImage hImage,</div>
-<div class="line"><a name="l12085"></a><span class="lineno">12085</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
-<div class="line"><a name="l12086"></a><span class="lineno">12086</span>&#160;{</div>
-<div class="line"><a name="l12087"></a><span class="lineno">12087</span>&#160;    VMA_ASSERT(hAllocation-&gt;GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK &amp;&amp;</div>
-<div class="line"><a name="l12088"></a><span class="lineno">12088</span>&#160;        hAllocation-&gt;GetBlock() == <span class="keyword">this</span>);</div>
-<div class="line"><a name="l12089"></a><span class="lineno">12089</span>&#160;    VMA_ASSERT(allocationLocalOffset &lt; hAllocation-&gt;GetSize() &amp;&amp;</div>
-<div class="line"><a name="l12090"></a><span class="lineno">12090</span>&#160;        <span class="stringliteral">&quot;Invalid allocationLocalOffset. Did you forget that this offset is relative to the beginning of the allocation, not the whole memory block?&quot;</span>);</div>
-<div class="line"><a name="l12091"></a><span class="lineno">12091</span>&#160;    <span class="keyword">const</span> VkDeviceSize memoryOffset = hAllocation-&gt;GetOffset() + allocationLocalOffset;</div>
-<div class="line"><a name="l12092"></a><span class="lineno">12092</span>&#160;    <span class="comment">// This lock is important so that we don&#39;t call vkBind... and/or vkMap... simultaneously on the same VkDeviceMemory from multiple threads.</span></div>
-<div class="line"><a name="l12093"></a><span class="lineno">12093</span>&#160;    VmaMutexLock lock(m_Mutex, hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l12094"></a><span class="lineno">12094</span>&#160;    <span class="keywordflow">return</span> hAllocator-&gt;BindVulkanImage(m_hMemory, memoryOffset, hImage, pNext);</div>
+<div class="line"><a name="l12057"></a><span class="lineno">12057</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l12058"></a><span class="lineno">12058</span>&#160;    {</div>
+<div class="line"><a name="l12059"></a><span class="lineno">12059</span>&#160;        Node* <span class="keyword">const</span> nextFreeNode = node-&gt;free.next;</div>
+<div class="line"><a name="l12060"></a><span class="lineno">12060</span>&#160;        VMA_ASSERT(nextFreeNode-&gt;free.prev == node);</div>
+<div class="line"><a name="l12061"></a><span class="lineno">12061</span>&#160;        nextFreeNode-&gt;free.prev = node-&gt;free.prev;</div>
+<div class="line"><a name="l12062"></a><span class="lineno">12062</span>&#160;    }</div>
+<div class="line"><a name="l12063"></a><span class="lineno">12063</span>&#160;}</div>
+<div class="line"><a name="l12064"></a><span class="lineno">12064</span>&#160; </div>
+<div class="line"><a name="l12065"></a><span class="lineno">12065</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l12066"></a><span class="lineno">12066</span>&#160;<span class="keywordtype">void</span> VmaBlockMetadata_Buddy::PrintDetailedMapNode(<span class="keyword">class</span> VmaJsonWriter&amp; json, <span class="keyword">const</span> Node* node, VkDeviceSize levelNodeSize)<span class="keyword"> const</span></div>
+<div class="line"><a name="l12067"></a><span class="lineno">12067</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l12068"></a><span class="lineno">12068</span>&#160;    <span class="keywordflow">switch</span>(node-&gt;type)</div>
+<div class="line"><a name="l12069"></a><span class="lineno">12069</span>&#160;    {</div>
+<div class="line"><a name="l12070"></a><span class="lineno">12070</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_FREE:</div>
+<div class="line"><a name="l12071"></a><span class="lineno">12071</span>&#160;        PrintDetailedMap_UnusedRange(json, node-&gt;offset, levelNodeSize);</div>
+<div class="line"><a name="l12072"></a><span class="lineno">12072</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12073"></a><span class="lineno">12073</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_ALLOCATION:</div>
+<div class="line"><a name="l12074"></a><span class="lineno">12074</span>&#160;        {   </div>
+<div class="line"><a name="l12075"></a><span class="lineno">12075</span>&#160;            PrintDetailedMap_Allocation(json, node-&gt;offset, node-&gt;allocation.alloc);</div>
+<div class="line"><a name="l12076"></a><span class="lineno">12076</span>&#160;            <span class="keyword">const</span> VkDeviceSize allocSize = node-&gt;allocation.alloc-&gt;GetSize();</div>
+<div class="line"><a name="l12077"></a><span class="lineno">12077</span>&#160;            <span class="keywordflow">if</span>(allocSize &lt; levelNodeSize)</div>
+<div class="line"><a name="l12078"></a><span class="lineno">12078</span>&#160;            {</div>
+<div class="line"><a name="l12079"></a><span class="lineno">12079</span>&#160;                PrintDetailedMap_UnusedRange(json, node-&gt;offset + allocSize, levelNodeSize - allocSize);</div>
+<div class="line"><a name="l12080"></a><span class="lineno">12080</span>&#160;            }</div>
+<div class="line"><a name="l12081"></a><span class="lineno">12081</span>&#160;        }</div>
+<div class="line"><a name="l12082"></a><span class="lineno">12082</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12083"></a><span class="lineno">12083</span>&#160;    <span class="keywordflow">case</span> Node::TYPE_SPLIT:</div>
+<div class="line"><a name="l12084"></a><span class="lineno">12084</span>&#160;        {</div>
+<div class="line"><a name="l12085"></a><span class="lineno">12085</span>&#160;            <span class="keyword">const</span> VkDeviceSize childrenNodeSize = levelNodeSize / 2;</div>
+<div class="line"><a name="l12086"></a><span class="lineno">12086</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> leftChild = node-&gt;split.leftChild;</div>
+<div class="line"><a name="l12087"></a><span class="lineno">12087</span>&#160;            PrintDetailedMapNode(json, leftChild, childrenNodeSize);</div>
+<div class="line"><a name="l12088"></a><span class="lineno">12088</span>&#160;            <span class="keyword">const</span> Node* <span class="keyword">const</span> rightChild = leftChild-&gt;buddy;</div>
+<div class="line"><a name="l12089"></a><span class="lineno">12089</span>&#160;            PrintDetailedMapNode(json, rightChild, childrenNodeSize);</div>
+<div class="line"><a name="l12090"></a><span class="lineno">12090</span>&#160;        }</div>
+<div class="line"><a name="l12091"></a><span class="lineno">12091</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12092"></a><span class="lineno">12092</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l12093"></a><span class="lineno">12093</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l12094"></a><span class="lineno">12094</span>&#160;    }</div>
 <div class="line"><a name="l12095"></a><span class="lineno">12095</span>&#160;}</div>
-<div class="line"><a name="l12096"></a><span class="lineno">12096</span>&#160; </div>
-<div class="line"><a name="l12097"></a><span class="lineno">12097</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> InitStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo)</div>
-<div class="line"><a name="l12098"></a><span class="lineno">12098</span>&#160;{</div>
-<div class="line"><a name="l12099"></a><span class="lineno">12099</span>&#160;    memset(&amp;outInfo, 0, <span class="keyword">sizeof</span>(outInfo));</div>
-<div class="line"><a name="l12100"></a><span class="lineno">12100</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = UINT64_MAX;</div>
-<div class="line"><a name="l12101"></a><span class="lineno">12101</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = UINT64_MAX;</div>
-<div class="line"><a name="l12102"></a><span class="lineno">12102</span>&#160;}</div>
-<div class="line"><a name="l12103"></a><span class="lineno">12103</span>&#160; </div>
-<div class="line"><a name="l12104"></a><span class="lineno">12104</span>&#160;<span class="comment">// Adds statistics srcInfo into inoutInfo, like: inoutInfo += srcInfo.</span></div>
-<div class="line"><a name="l12105"></a><span class="lineno">12105</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaAddStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; inoutInfo, <span class="keyword">const</span> <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; srcInfo)</div>
-<div class="line"><a name="l12106"></a><span class="lineno">12106</span>&#160;{</div>
-<div class="line"><a name="l12107"></a><span class="lineno">12107</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> += srcInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a>;</div>
-<div class="line"><a name="l12108"></a><span class="lineno">12108</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> += srcInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>;</div>
-<div class="line"><a name="l12109"></a><span class="lineno">12109</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> += srcInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
-<div class="line"><a name="l12110"></a><span class="lineno">12110</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> += srcInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a>;</div>
-<div class="line"><a name="l12111"></a><span class="lineno">12111</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += srcInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>;</div>
-<div class="line"><a name="l12112"></a><span class="lineno">12112</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MIN(inoutInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, srcInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>);</div>
-<div class="line"><a name="l12113"></a><span class="lineno">12113</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MAX(inoutInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, srcInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>);</div>
-<div class="line"><a name="l12114"></a><span class="lineno">12114</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(inoutInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, srcInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>);</div>
-<div class="line"><a name="l12115"></a><span class="lineno">12115</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MAX(inoutInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, srcInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>);</div>
-<div class="line"><a name="l12116"></a><span class="lineno">12116</span>&#160;}</div>
-<div class="line"><a name="l12117"></a><span class="lineno">12117</span>&#160; </div>
-<div class="line"><a name="l12118"></a><span class="lineno">12118</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaPostprocessCalcStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; inoutInfo)</div>
-<div class="line"><a name="l12119"></a><span class="lineno">12119</span>&#160;{</div>
-<div class="line"><a name="l12120"></a><span class="lineno">12120</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a1081a039964e566c672e7a2347f9e599">allocationSizeAvg</a> = (inoutInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> &gt; 0) ?</div>
-<div class="line"><a name="l12121"></a><span class="lineno">12121</span>&#160;        VmaRoundDiv&lt;VkDeviceSize&gt;(inoutInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a>, inoutInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>) : 0;</div>
-<div class="line"><a name="l12122"></a><span class="lineno">12122</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a2f9b3452af90c9768a30b7fb6ae194fc">unusedRangeSizeAvg</a> = (inoutInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> &gt; 0) ?</div>
-<div class="line"><a name="l12123"></a><span class="lineno">12123</span>&#160;        VmaRoundDiv&lt;VkDeviceSize&gt;(inoutInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>, inoutInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>) : 0;</div>
-<div class="line"><a name="l12124"></a><span class="lineno">12124</span>&#160;}</div>
-<div class="line"><a name="l12125"></a><span class="lineno">12125</span>&#160; </div>
-<div class="line"><a name="l12126"></a><span class="lineno">12126</span>&#160;VmaPool_T::VmaPool_T(</div>
-<div class="line"><a name="l12127"></a><span class="lineno">12127</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l12128"></a><span class="lineno">12128</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l12129"></a><span class="lineno">12129</span>&#160;    VkDeviceSize preferredBlockSize) :</div>
-<div class="line"><a name="l12130"></a><span class="lineno">12130</span>&#160;    m_BlockVector(</div>
-<div class="line"><a name="l12131"></a><span class="lineno">12131</span>&#160;        hAllocator,</div>
-<div class="line"><a name="l12132"></a><span class="lineno">12132</span>&#160;        this, <span class="comment">// hParentPool</span></div>
-<div class="line"><a name="l12133"></a><span class="lineno">12133</span>&#160;        createInfo.memoryTypeIndex,</div>
-<div class="line"><a name="l12134"></a><span class="lineno">12134</span>&#160;        createInfo.blockSize != 0 ? createInfo.blockSize : preferredBlockSize,</div>
-<div class="line"><a name="l12135"></a><span class="lineno">12135</span>&#160;        createInfo.minBlockCount,</div>
-<div class="line"><a name="l12136"></a><span class="lineno">12136</span>&#160;        createInfo.maxBlockCount,</div>
-<div class="line"><a name="l12137"></a><span class="lineno">12137</span>&#160;        (createInfo.flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2">VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT</a>) != 0 ? 1 : hAllocator-&gt;GetBufferImageGranularity(),</div>
-<div class="line"><a name="l12138"></a><span class="lineno">12138</span>&#160;        createInfo.frameInUseCount,</div>
-<div class="line"><a name="l12139"></a><span class="lineno">12139</span>&#160;        createInfo.blockSize != 0, <span class="comment">// explicitBlockSize</span></div>
-<div class="line"><a name="l12140"></a><span class="lineno">12140</span>&#160;        createInfo.flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c">VMA_POOL_CREATE_ALGORITHM_MASK</a>), <span class="comment">// algorithm</span></div>
-<div class="line"><a name="l12141"></a><span class="lineno">12141</span>&#160;    m_Id(0),</div>
-<div class="line"><a name="l12142"></a><span class="lineno">12142</span>&#160;    m_Name(VMA_NULL)</div>
-<div class="line"><a name="l12143"></a><span class="lineno">12143</span>&#160;{</div>
-<div class="line"><a name="l12144"></a><span class="lineno">12144</span>&#160;}</div>
-<div class="line"><a name="l12145"></a><span class="lineno">12145</span>&#160; </div>
-<div class="line"><a name="l12146"></a><span class="lineno">12146</span>&#160;VmaPool_T::~VmaPool_T()</div>
-<div class="line"><a name="l12147"></a><span class="lineno">12147</span>&#160;{</div>
-<div class="line"><a name="l12148"></a><span class="lineno">12148</span>&#160;}</div>
-<div class="line"><a name="l12149"></a><span class="lineno">12149</span>&#160; </div>
-<div class="line"><a name="l12150"></a><span class="lineno">12150</span>&#160;<span class="keywordtype">void</span> VmaPool_T::SetName(<span class="keyword">const</span> <span class="keywordtype">char</span>* pName)</div>
-<div class="line"><a name="l12151"></a><span class="lineno">12151</span>&#160;{</div>
-<div class="line"><a name="l12152"></a><span class="lineno">12152</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* allocs = m_BlockVector.GetAllocator()-&gt;GetAllocationCallbacks();</div>
-<div class="line"><a name="l12153"></a><span class="lineno">12153</span>&#160;    VmaFreeString(allocs, m_Name);</div>
-<div class="line"><a name="l12154"></a><span class="lineno">12154</span>&#160;    </div>
-<div class="line"><a name="l12155"></a><span class="lineno">12155</span>&#160;    <span class="keywordflow">if</span>(pName != VMA_NULL)</div>
-<div class="line"><a name="l12156"></a><span class="lineno">12156</span>&#160;    {</div>
-<div class="line"><a name="l12157"></a><span class="lineno">12157</span>&#160;        m_Name = VmaCreateStringCopy(allocs, pName);</div>
-<div class="line"><a name="l12158"></a><span class="lineno">12158</span>&#160;    }</div>
-<div class="line"><a name="l12159"></a><span class="lineno">12159</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l12160"></a><span class="lineno">12160</span>&#160;    {</div>
-<div class="line"><a name="l12161"></a><span class="lineno">12161</span>&#160;        m_Name = VMA_NULL;</div>
-<div class="line"><a name="l12162"></a><span class="lineno">12162</span>&#160;    }</div>
-<div class="line"><a name="l12163"></a><span class="lineno">12163</span>&#160;}</div>
-<div class="line"><a name="l12164"></a><span class="lineno">12164</span>&#160; </div>
-<div class="line"><a name="l12165"></a><span class="lineno">12165</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l12096"></a><span class="lineno">12096</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l12097"></a><span class="lineno">12097</span>&#160; </div>
+<div class="line"><a name="l12098"></a><span class="lineno">12098</span>&#160; </div>
+<div class="line"><a name="l12100"></a><span class="lineno">12100</span>&#160;<span class="comment">// class VmaDeviceMemoryBlock</span></div>
+<div class="line"><a name="l12101"></a><span class="lineno">12101</span>&#160; </div>
+<div class="line"><a name="l12102"></a><span class="lineno">12102</span>&#160;VmaDeviceMemoryBlock::VmaDeviceMemoryBlock(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator) :</div>
+<div class="line"><a name="l12103"></a><span class="lineno">12103</span>&#160;    m_pMetadata(VMA_NULL),</div>
+<div class="line"><a name="l12104"></a><span class="lineno">12104</span>&#160;    m_MemoryTypeIndex(UINT32_MAX),</div>
+<div class="line"><a name="l12105"></a><span class="lineno">12105</span>&#160;    m_Id(0),</div>
+<div class="line"><a name="l12106"></a><span class="lineno">12106</span>&#160;    m_hMemory(VK_NULL_HANDLE),</div>
+<div class="line"><a name="l12107"></a><span class="lineno">12107</span>&#160;    m_MapCount(0),</div>
+<div class="line"><a name="l12108"></a><span class="lineno">12108</span>&#160;    m_pMappedData(VMA_NULL)</div>
+<div class="line"><a name="l12109"></a><span class="lineno">12109</span>&#160;{</div>
+<div class="line"><a name="l12110"></a><span class="lineno">12110</span>&#160;}</div>
+<div class="line"><a name="l12111"></a><span class="lineno">12111</span>&#160; </div>
+<div class="line"><a name="l12112"></a><span class="lineno">12112</span>&#160;<span class="keywordtype">void</span> VmaDeviceMemoryBlock::Init(</div>
+<div class="line"><a name="l12113"></a><span class="lineno">12113</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l12114"></a><span class="lineno">12114</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> hParentPool,</div>
+<div class="line"><a name="l12115"></a><span class="lineno">12115</span>&#160;    uint32_t newMemoryTypeIndex,</div>
+<div class="line"><a name="l12116"></a><span class="lineno">12116</span>&#160;    VkDeviceMemory newMemory,</div>
+<div class="line"><a name="l12117"></a><span class="lineno">12117</span>&#160;    VkDeviceSize newSize,</div>
+<div class="line"><a name="l12118"></a><span class="lineno">12118</span>&#160;    uint32_t <span class="keywordtype">id</span>,</div>
+<div class="line"><a name="l12119"></a><span class="lineno">12119</span>&#160;    uint32_t algorithm)</div>
+<div class="line"><a name="l12120"></a><span class="lineno">12120</span>&#160;{</div>
+<div class="line"><a name="l12121"></a><span class="lineno">12121</span>&#160;    VMA_ASSERT(m_hMemory == VK_NULL_HANDLE);</div>
+<div class="line"><a name="l12122"></a><span class="lineno">12122</span>&#160; </div>
+<div class="line"><a name="l12123"></a><span class="lineno">12123</span>&#160;    m_hParentPool = hParentPool;</div>
+<div class="line"><a name="l12124"></a><span class="lineno">12124</span>&#160;    m_MemoryTypeIndex = newMemoryTypeIndex;</div>
+<div class="line"><a name="l12125"></a><span class="lineno">12125</span>&#160;    m_Id = id;</div>
+<div class="line"><a name="l12126"></a><span class="lineno">12126</span>&#160;    m_hMemory = newMemory;</div>
+<div class="line"><a name="l12127"></a><span class="lineno">12127</span>&#160; </div>
+<div class="line"><a name="l12128"></a><span class="lineno">12128</span>&#160;    <span class="keywordflow">switch</span>(algorithm)</div>
+<div class="line"><a name="l12129"></a><span class="lineno">12129</span>&#160;    {</div>
+<div class="line"><a name="l12130"></a><span class="lineno">12130</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>:</div>
+<div class="line"><a name="l12131"></a><span class="lineno">12131</span>&#160;        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Linear)(hAllocator);</div>
+<div class="line"><a name="l12132"></a><span class="lineno">12132</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12133"></a><span class="lineno">12133</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a>:</div>
+<div class="line"><a name="l12134"></a><span class="lineno">12134</span>&#160;        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Buddy)(hAllocator);</div>
+<div class="line"><a name="l12135"></a><span class="lineno">12135</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12136"></a><span class="lineno">12136</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l12137"></a><span class="lineno">12137</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l12138"></a><span class="lineno">12138</span>&#160;        <span class="comment">// Fall-through.</span></div>
+<div class="line"><a name="l12139"></a><span class="lineno">12139</span>&#160;    <span class="keywordflow">case</span> 0:</div>
+<div class="line"><a name="l12140"></a><span class="lineno">12140</span>&#160;        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Generic)(hAllocator);</div>
+<div class="line"><a name="l12141"></a><span class="lineno">12141</span>&#160;    }</div>
+<div class="line"><a name="l12142"></a><span class="lineno">12142</span>&#160;    m_pMetadata-&gt;Init(newSize);</div>
+<div class="line"><a name="l12143"></a><span class="lineno">12143</span>&#160;}</div>
+<div class="line"><a name="l12144"></a><span class="lineno">12144</span>&#160; </div>
+<div class="line"><a name="l12145"></a><span class="lineno">12145</span>&#160;<span class="keywordtype">void</span> VmaDeviceMemoryBlock::Destroy(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator)</div>
+<div class="line"><a name="l12146"></a><span class="lineno">12146</span>&#160;{</div>
+<div class="line"><a name="l12147"></a><span class="lineno">12147</span>&#160;    <span class="comment">// This is the most important assert in the entire library.</span></div>
+<div class="line"><a name="l12148"></a><span class="lineno">12148</span>&#160;    <span class="comment">// Hitting it means you have some memory leak - unreleased VmaAllocation objects.</span></div>
+<div class="line"><a name="l12149"></a><span class="lineno">12149</span>&#160;    VMA_ASSERT(m_pMetadata-&gt;IsEmpty() &amp;&amp; <span class="stringliteral">&quot;Some allocations were not freed before destruction of this memory block!&quot;</span>);</div>
+<div class="line"><a name="l12150"></a><span class="lineno">12150</span>&#160; </div>
+<div class="line"><a name="l12151"></a><span class="lineno">12151</span>&#160;    VMA_ASSERT(m_hMemory != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l12152"></a><span class="lineno">12152</span>&#160;    allocator-&gt;FreeVulkanMemory(m_MemoryTypeIndex, m_pMetadata-&gt;GetSize(), m_hMemory);</div>
+<div class="line"><a name="l12153"></a><span class="lineno">12153</span>&#160;    m_hMemory = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l12154"></a><span class="lineno">12154</span>&#160; </div>
+<div class="line"><a name="l12155"></a><span class="lineno">12155</span>&#160;    vma_delete(allocator, m_pMetadata);</div>
+<div class="line"><a name="l12156"></a><span class="lineno">12156</span>&#160;    m_pMetadata = VMA_NULL;</div>
+<div class="line"><a name="l12157"></a><span class="lineno">12157</span>&#160;}</div>
+<div class="line"><a name="l12158"></a><span class="lineno">12158</span>&#160; </div>
+<div class="line"><a name="l12159"></a><span class="lineno">12159</span>&#160;<span class="keywordtype">bool</span> VmaDeviceMemoryBlock::Validate()<span class="keyword"> const</span></div>
+<div class="line"><a name="l12160"></a><span class="lineno">12160</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l12161"></a><span class="lineno">12161</span>&#160;    VMA_VALIDATE((m_hMemory != VK_NULL_HANDLE) &amp;&amp;</div>
+<div class="line"><a name="l12162"></a><span class="lineno">12162</span>&#160;        (m_pMetadata-&gt;GetSize() != 0));</div>
+<div class="line"><a name="l12163"></a><span class="lineno">12163</span>&#160;    </div>
+<div class="line"><a name="l12164"></a><span class="lineno">12164</span>&#160;    <span class="keywordflow">return</span> m_pMetadata-&gt;Validate();</div>
+<div class="line"><a name="l12165"></a><span class="lineno">12165</span>&#160;}</div>
 <div class="line"><a name="l12166"></a><span class="lineno">12166</span>&#160; </div>
-<div class="line"><a name="l12167"></a><span class="lineno">12167</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l12168"></a><span class="lineno">12168</span>&#160; </div>
-<div class="line"><a name="l12169"></a><span class="lineno">12169</span>&#160;VmaBlockVector::VmaBlockVector(</div>
-<div class="line"><a name="l12170"></a><span class="lineno">12170</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l12171"></a><span class="lineno">12171</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> hParentPool,</div>
-<div class="line"><a name="l12172"></a><span class="lineno">12172</span>&#160;    uint32_t memoryTypeIndex,</div>
-<div class="line"><a name="l12173"></a><span class="lineno">12173</span>&#160;    VkDeviceSize preferredBlockSize,</div>
-<div class="line"><a name="l12174"></a><span class="lineno">12174</span>&#160;    <span class="keywordtype">size_t</span> minBlockCount,</div>
-<div class="line"><a name="l12175"></a><span class="lineno">12175</span>&#160;    <span class="keywordtype">size_t</span> maxBlockCount,</div>
-<div class="line"><a name="l12176"></a><span class="lineno">12176</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
-<div class="line"><a name="l12177"></a><span class="lineno">12177</span>&#160;    uint32_t frameInUseCount,</div>
-<div class="line"><a name="l12178"></a><span class="lineno">12178</span>&#160;    <span class="keywordtype">bool</span> explicitBlockSize,</div>
-<div class="line"><a name="l12179"></a><span class="lineno">12179</span>&#160;    uint32_t algorithm) :</div>
-<div class="line"><a name="l12180"></a><span class="lineno">12180</span>&#160;    m_hAllocator(hAllocator),</div>
-<div class="line"><a name="l12181"></a><span class="lineno">12181</span>&#160;    m_hParentPool(hParentPool),</div>
-<div class="line"><a name="l12182"></a><span class="lineno">12182</span>&#160;    m_MemoryTypeIndex(memoryTypeIndex),</div>
-<div class="line"><a name="l12183"></a><span class="lineno">12183</span>&#160;    m_PreferredBlockSize(preferredBlockSize),</div>
-<div class="line"><a name="l12184"></a><span class="lineno">12184</span>&#160;    m_MinBlockCount(minBlockCount),</div>
-<div class="line"><a name="l12185"></a><span class="lineno">12185</span>&#160;    m_MaxBlockCount(maxBlockCount),</div>
-<div class="line"><a name="l12186"></a><span class="lineno">12186</span>&#160;    m_BufferImageGranularity(bufferImageGranularity),</div>
-<div class="line"><a name="l12187"></a><span class="lineno">12187</span>&#160;    m_FrameInUseCount(frameInUseCount),</div>
-<div class="line"><a name="l12188"></a><span class="lineno">12188</span>&#160;    m_ExplicitBlockSize(explicitBlockSize),</div>
-<div class="line"><a name="l12189"></a><span class="lineno">12189</span>&#160;    m_Algorithm(algorithm),</div>
-<div class="line"><a name="l12190"></a><span class="lineno">12190</span>&#160;    m_HasEmptyBlock(false),</div>
-<div class="line"><a name="l12191"></a><span class="lineno">12191</span>&#160;    m_Blocks(VmaStlAllocator&lt;VmaDeviceMemoryBlock*&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
-<div class="line"><a name="l12192"></a><span class="lineno">12192</span>&#160;    m_NextBlockId(0)</div>
-<div class="line"><a name="l12193"></a><span class="lineno">12193</span>&#160;{</div>
-<div class="line"><a name="l12194"></a><span class="lineno">12194</span>&#160;}</div>
-<div class="line"><a name="l12195"></a><span class="lineno">12195</span>&#160; </div>
-<div class="line"><a name="l12196"></a><span class="lineno">12196</span>&#160;VmaBlockVector::~VmaBlockVector()</div>
-<div class="line"><a name="l12197"></a><span class="lineno">12197</span>&#160;{</div>
-<div class="line"><a name="l12198"></a><span class="lineno">12198</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_Blocks.size(); i--; )</div>
-<div class="line"><a name="l12199"></a><span class="lineno">12199</span>&#160;    {</div>
-<div class="line"><a name="l12200"></a><span class="lineno">12200</span>&#160;        m_Blocks[i]-&gt;Destroy(m_hAllocator);</div>
-<div class="line"><a name="l12201"></a><span class="lineno">12201</span>&#160;        vma_delete(m_hAllocator, m_Blocks[i]);</div>
-<div class="line"><a name="l12202"></a><span class="lineno">12202</span>&#160;    }</div>
-<div class="line"><a name="l12203"></a><span class="lineno">12203</span>&#160;}</div>
-<div class="line"><a name="l12204"></a><span class="lineno">12204</span>&#160; </div>
-<div class="line"><a name="l12205"></a><span class="lineno">12205</span>&#160;VkResult VmaBlockVector::CreateMinBlocks()</div>
-<div class="line"><a name="l12206"></a><span class="lineno">12206</span>&#160;{</div>
-<div class="line"><a name="l12207"></a><span class="lineno">12207</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_MinBlockCount; ++i)</div>
-<div class="line"><a name="l12208"></a><span class="lineno">12208</span>&#160;    {</div>
-<div class="line"><a name="l12209"></a><span class="lineno">12209</span>&#160;        VkResult res = CreateBlock(m_PreferredBlockSize, VMA_NULL);</div>
-<div class="line"><a name="l12210"></a><span class="lineno">12210</span>&#160;        <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l12167"></a><span class="lineno">12167</span>&#160;VkResult VmaDeviceMemoryBlock::CheckCorruption(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator)</div>
+<div class="line"><a name="l12168"></a><span class="lineno">12168</span>&#160;{</div>
+<div class="line"><a name="l12169"></a><span class="lineno">12169</span>&#160;    <span class="keywordtype">void</span>* pData = <span class="keyword">nullptr</span>;</div>
+<div class="line"><a name="l12170"></a><span class="lineno">12170</span>&#160;    VkResult res = Map(hAllocator, 1, &amp;pData);</div>
+<div class="line"><a name="l12171"></a><span class="lineno">12171</span>&#160;    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l12172"></a><span class="lineno">12172</span>&#160;    {</div>
+<div class="line"><a name="l12173"></a><span class="lineno">12173</span>&#160;        <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l12174"></a><span class="lineno">12174</span>&#160;    }</div>
+<div class="line"><a name="l12175"></a><span class="lineno">12175</span>&#160; </div>
+<div class="line"><a name="l12176"></a><span class="lineno">12176</span>&#160;    res = m_pMetadata-&gt;CheckCorruption(pData);</div>
+<div class="line"><a name="l12177"></a><span class="lineno">12177</span>&#160; </div>
+<div class="line"><a name="l12178"></a><span class="lineno">12178</span>&#160;    Unmap(hAllocator, 1);</div>
+<div class="line"><a name="l12179"></a><span class="lineno">12179</span>&#160; </div>
+<div class="line"><a name="l12180"></a><span class="lineno">12180</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l12181"></a><span class="lineno">12181</span>&#160;}</div>
+<div class="line"><a name="l12182"></a><span class="lineno">12182</span>&#160; </div>
+<div class="line"><a name="l12183"></a><span class="lineno">12183</span>&#160;VkResult VmaDeviceMemoryBlock::Map(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, uint32_t count, <span class="keywordtype">void</span>** ppData)</div>
+<div class="line"><a name="l12184"></a><span class="lineno">12184</span>&#160;{</div>
+<div class="line"><a name="l12185"></a><span class="lineno">12185</span>&#160;    <span class="keywordflow">if</span>(count == 0)</div>
+<div class="line"><a name="l12186"></a><span class="lineno">12186</span>&#160;    {</div>
+<div class="line"><a name="l12187"></a><span class="lineno">12187</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l12188"></a><span class="lineno">12188</span>&#160;    }</div>
+<div class="line"><a name="l12189"></a><span class="lineno">12189</span>&#160; </div>
+<div class="line"><a name="l12190"></a><span class="lineno">12190</span>&#160;    VmaMutexLock lock(m_Mutex, hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l12191"></a><span class="lineno">12191</span>&#160;    <span class="keywordflow">if</span>(m_MapCount != 0)</div>
+<div class="line"><a name="l12192"></a><span class="lineno">12192</span>&#160;    {</div>
+<div class="line"><a name="l12193"></a><span class="lineno">12193</span>&#160;        m_MapCount += count;</div>
+<div class="line"><a name="l12194"></a><span class="lineno">12194</span>&#160;        VMA_ASSERT(m_pMappedData != VMA_NULL);</div>
+<div class="line"><a name="l12195"></a><span class="lineno">12195</span>&#160;        <span class="keywordflow">if</span>(ppData != VMA_NULL)</div>
+<div class="line"><a name="l12196"></a><span class="lineno">12196</span>&#160;        {</div>
+<div class="line"><a name="l12197"></a><span class="lineno">12197</span>&#160;            *ppData = m_pMappedData;</div>
+<div class="line"><a name="l12198"></a><span class="lineno">12198</span>&#160;        }</div>
+<div class="line"><a name="l12199"></a><span class="lineno">12199</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l12200"></a><span class="lineno">12200</span>&#160;    }</div>
+<div class="line"><a name="l12201"></a><span class="lineno">12201</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l12202"></a><span class="lineno">12202</span>&#160;    {</div>
+<div class="line"><a name="l12203"></a><span class="lineno">12203</span>&#160;        VkResult result = (*hAllocator-&gt;GetVulkanFunctions().vkMapMemory)(</div>
+<div class="line"><a name="l12204"></a><span class="lineno">12204</span>&#160;            hAllocator-&gt;m_hDevice,</div>
+<div class="line"><a name="l12205"></a><span class="lineno">12205</span>&#160;            m_hMemory,</div>
+<div class="line"><a name="l12206"></a><span class="lineno">12206</span>&#160;            0, <span class="comment">// offset</span></div>
+<div class="line"><a name="l12207"></a><span class="lineno">12207</span>&#160;            VK_WHOLE_SIZE,</div>
+<div class="line"><a name="l12208"></a><span class="lineno">12208</span>&#160;            0, <span class="comment">// flags</span></div>
+<div class="line"><a name="l12209"></a><span class="lineno">12209</span>&#160;            &amp;m_pMappedData);</div>
+<div class="line"><a name="l12210"></a><span class="lineno">12210</span>&#160;        <span class="keywordflow">if</span>(result == VK_SUCCESS)</div>
 <div class="line"><a name="l12211"></a><span class="lineno">12211</span>&#160;        {</div>
-<div class="line"><a name="l12212"></a><span class="lineno">12212</span>&#160;            <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l12213"></a><span class="lineno">12213</span>&#160;        }</div>
-<div class="line"><a name="l12214"></a><span class="lineno">12214</span>&#160;    }</div>
-<div class="line"><a name="l12215"></a><span class="lineno">12215</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l12216"></a><span class="lineno">12216</span>&#160;}</div>
-<div class="line"><a name="l12217"></a><span class="lineno">12217</span>&#160; </div>
-<div class="line"><a name="l12218"></a><span class="lineno">12218</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::GetPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pStats)</div>
-<div class="line"><a name="l12219"></a><span class="lineno">12219</span>&#160;{</div>
-<div class="line"><a name="l12220"></a><span class="lineno">12220</span>&#160;    VmaMutexLockRead lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l12212"></a><span class="lineno">12212</span>&#160;            <span class="keywordflow">if</span>(ppData != VMA_NULL)</div>
+<div class="line"><a name="l12213"></a><span class="lineno">12213</span>&#160;            {</div>
+<div class="line"><a name="l12214"></a><span class="lineno">12214</span>&#160;                *ppData = m_pMappedData;</div>
+<div class="line"><a name="l12215"></a><span class="lineno">12215</span>&#160;            }</div>
+<div class="line"><a name="l12216"></a><span class="lineno">12216</span>&#160;            m_MapCount = count;</div>
+<div class="line"><a name="l12217"></a><span class="lineno">12217</span>&#160;        }</div>
+<div class="line"><a name="l12218"></a><span class="lineno">12218</span>&#160;        <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l12219"></a><span class="lineno">12219</span>&#160;    }</div>
+<div class="line"><a name="l12220"></a><span class="lineno">12220</span>&#160;}</div>
 <div class="line"><a name="l12221"></a><span class="lineno">12221</span>&#160; </div>
-<div class="line"><a name="l12222"></a><span class="lineno">12222</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_Blocks.size();</div>
-<div class="line"><a name="l12223"></a><span class="lineno">12223</span>&#160; </div>
-<div class="line"><a name="l12224"></a><span class="lineno">12224</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a> = 0;</div>
-<div class="line"><a name="l12225"></a><span class="lineno">12225</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> = 0;</div>
-<div class="line"><a name="l12226"></a><span class="lineno">12226</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a> = 0;</div>
-<div class="line"><a name="l12227"></a><span class="lineno">12227</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a> = 0;</div>
-<div class="line"><a name="l12228"></a><span class="lineno">12228</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = 0;</div>
-<div class="line"><a name="l12229"></a><span class="lineno">12229</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7">blockCount</a> = blockCount;</div>
-<div class="line"><a name="l12230"></a><span class="lineno">12230</span>&#160; </div>
-<div class="line"><a name="l12231"></a><span class="lineno">12231</span>&#160;    <span class="keywordflow">for</span>(uint32_t blockIndex = 0; blockIndex &lt; blockCount; ++blockIndex)</div>
-<div class="line"><a name="l12232"></a><span class="lineno">12232</span>&#160;    {</div>
-<div class="line"><a name="l12233"></a><span class="lineno">12233</span>&#160;        <span class="keyword">const</span> VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l12234"></a><span class="lineno">12234</span>&#160;        VMA_ASSERT(pBlock);</div>
-<div class="line"><a name="l12235"></a><span class="lineno">12235</span>&#160;        VMA_HEAVY_ASSERT(pBlock-&gt;Validate());</div>
-<div class="line"><a name="l12236"></a><span class="lineno">12236</span>&#160;        pBlock-&gt;m_pMetadata-&gt;AddPoolStats(*pStats);</div>
-<div class="line"><a name="l12237"></a><span class="lineno">12237</span>&#160;    }</div>
-<div class="line"><a name="l12238"></a><span class="lineno">12238</span>&#160;}</div>
-<div class="line"><a name="l12239"></a><span class="lineno">12239</span>&#160; </div>
-<div class="line"><a name="l12240"></a><span class="lineno">12240</span>&#160;<span class="keywordtype">bool</span> VmaBlockVector::IsEmpty()</div>
-<div class="line"><a name="l12241"></a><span class="lineno">12241</span>&#160;{</div>
-<div class="line"><a name="l12242"></a><span class="lineno">12242</span>&#160;    VmaMutexLockRead lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l12243"></a><span class="lineno">12243</span>&#160;    <span class="keywordflow">return</span> m_Blocks.empty();</div>
-<div class="line"><a name="l12244"></a><span class="lineno">12244</span>&#160;}</div>
-<div class="line"><a name="l12245"></a><span class="lineno">12245</span>&#160; </div>
-<div class="line"><a name="l12246"></a><span class="lineno">12246</span>&#160;<span class="keywordtype">bool</span> VmaBlockVector::IsCorruptionDetectionEnabled()<span class="keyword"> const</span></div>
-<div class="line"><a name="l12247"></a><span class="lineno">12247</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l12248"></a><span class="lineno">12248</span>&#160;    <span class="keyword">const</span> uint32_t requiredMemFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;</div>
-<div class="line"><a name="l12249"></a><span class="lineno">12249</span>&#160;    <span class="keywordflow">return</span> (VMA_DEBUG_DETECT_CORRUPTION != 0) &amp;&amp;</div>
-<div class="line"><a name="l12250"></a><span class="lineno">12250</span>&#160;        (VMA_DEBUG_MARGIN &gt; 0) &amp;&amp;</div>
-<div class="line"><a name="l12251"></a><span class="lineno">12251</span>&#160;        (m_Algorithm == 0 || m_Algorithm == <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>) &amp;&amp;</div>
-<div class="line"><a name="l12252"></a><span class="lineno">12252</span>&#160;        (m_hAllocator-&gt;m_MemProps.memoryTypes[m_MemoryTypeIndex].propertyFlags &amp; requiredMemFlags) == requiredMemFlags;</div>
-<div class="line"><a name="l12253"></a><span class="lineno">12253</span>&#160;}</div>
-<div class="line"><a name="l12254"></a><span class="lineno">12254</span>&#160; </div>
-<div class="line"><a name="l12255"></a><span class="lineno">12255</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_ALLOCATION_TRY_COUNT = 32;</div>
+<div class="line"><a name="l12222"></a><span class="lineno">12222</span>&#160;<span class="keywordtype">void</span> VmaDeviceMemoryBlock::Unmap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, uint32_t count)</div>
+<div class="line"><a name="l12223"></a><span class="lineno">12223</span>&#160;{</div>
+<div class="line"><a name="l12224"></a><span class="lineno">12224</span>&#160;    <span class="keywordflow">if</span>(count == 0)</div>
+<div class="line"><a name="l12225"></a><span class="lineno">12225</span>&#160;    {</div>
+<div class="line"><a name="l12226"></a><span class="lineno">12226</span>&#160;        <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l12227"></a><span class="lineno">12227</span>&#160;    }</div>
+<div class="line"><a name="l12228"></a><span class="lineno">12228</span>&#160; </div>
+<div class="line"><a name="l12229"></a><span class="lineno">12229</span>&#160;    VmaMutexLock lock(m_Mutex, hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l12230"></a><span class="lineno">12230</span>&#160;    <span class="keywordflow">if</span>(m_MapCount &gt;= count)</div>
+<div class="line"><a name="l12231"></a><span class="lineno">12231</span>&#160;    {</div>
+<div class="line"><a name="l12232"></a><span class="lineno">12232</span>&#160;        m_MapCount -= count;</div>
+<div class="line"><a name="l12233"></a><span class="lineno">12233</span>&#160;        <span class="keywordflow">if</span>(m_MapCount == 0)</div>
+<div class="line"><a name="l12234"></a><span class="lineno">12234</span>&#160;        {</div>
+<div class="line"><a name="l12235"></a><span class="lineno">12235</span>&#160;            m_pMappedData = VMA_NULL;</div>
+<div class="line"><a name="l12236"></a><span class="lineno">12236</span>&#160;            (*hAllocator-&gt;GetVulkanFunctions().vkUnmapMemory)(hAllocator-&gt;m_hDevice, m_hMemory);</div>
+<div class="line"><a name="l12237"></a><span class="lineno">12237</span>&#160;        }</div>
+<div class="line"><a name="l12238"></a><span class="lineno">12238</span>&#160;    }</div>
+<div class="line"><a name="l12239"></a><span class="lineno">12239</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l12240"></a><span class="lineno">12240</span>&#160;    {</div>
+<div class="line"><a name="l12241"></a><span class="lineno">12241</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VkDeviceMemory block is being unmapped while it was not previously mapped.&quot;</span>);</div>
+<div class="line"><a name="l12242"></a><span class="lineno">12242</span>&#160;    }</div>
+<div class="line"><a name="l12243"></a><span class="lineno">12243</span>&#160;}</div>
+<div class="line"><a name="l12244"></a><span class="lineno">12244</span>&#160; </div>
+<div class="line"><a name="l12245"></a><span class="lineno">12245</span>&#160;VkResult VmaDeviceMemoryBlock::WriteMagicValueAroundAllocation(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize)</div>
+<div class="line"><a name="l12246"></a><span class="lineno">12246</span>&#160;{</div>
+<div class="line"><a name="l12247"></a><span class="lineno">12247</span>&#160;    VMA_ASSERT(VMA_DEBUG_MARGIN &gt; 0 &amp;&amp; VMA_DEBUG_MARGIN % 4 == 0 &amp;&amp; VMA_DEBUG_DETECT_CORRUPTION);</div>
+<div class="line"><a name="l12248"></a><span class="lineno">12248</span>&#160;    VMA_ASSERT(allocOffset &gt;= VMA_DEBUG_MARGIN);</div>
+<div class="line"><a name="l12249"></a><span class="lineno">12249</span>&#160; </div>
+<div class="line"><a name="l12250"></a><span class="lineno">12250</span>&#160;    <span class="keywordtype">void</span>* pData;</div>
+<div class="line"><a name="l12251"></a><span class="lineno">12251</span>&#160;    VkResult res = Map(hAllocator, 1, &amp;pData);</div>
+<div class="line"><a name="l12252"></a><span class="lineno">12252</span>&#160;    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l12253"></a><span class="lineno">12253</span>&#160;    {</div>
+<div class="line"><a name="l12254"></a><span class="lineno">12254</span>&#160;        <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l12255"></a><span class="lineno">12255</span>&#160;    }</div>
 <div class="line"><a name="l12256"></a><span class="lineno">12256</span>&#160; </div>
-<div class="line"><a name="l12257"></a><span class="lineno">12257</span>&#160;VkResult VmaBlockVector::Allocate(</div>
-<div class="line"><a name="l12258"></a><span class="lineno">12258</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l12259"></a><span class="lineno">12259</span>&#160;    VkDeviceSize size,</div>
-<div class="line"><a name="l12260"></a><span class="lineno">12260</span>&#160;    VkDeviceSize alignment,</div>
-<div class="line"><a name="l12261"></a><span class="lineno">12261</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l12262"></a><span class="lineno">12262</span>&#160;    VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l12263"></a><span class="lineno">12263</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l12264"></a><span class="lineno">12264</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
-<div class="line"><a name="l12265"></a><span class="lineno">12265</span>&#160;{</div>
-<div class="line"><a name="l12266"></a><span class="lineno">12266</span>&#160;    <span class="keywordtype">size_t</span> allocIndex;</div>
-<div class="line"><a name="l12267"></a><span class="lineno">12267</span>&#160;    VkResult res = VK_SUCCESS;</div>
-<div class="line"><a name="l12268"></a><span class="lineno">12268</span>&#160; </div>
-<div class="line"><a name="l12269"></a><span class="lineno">12269</span>&#160;    <span class="keywordflow">if</span>(IsCorruptionDetectionEnabled())</div>
-<div class="line"><a name="l12270"></a><span class="lineno">12270</span>&#160;    {</div>
-<div class="line"><a name="l12271"></a><span class="lineno">12271</span>&#160;        size = VmaAlignUp&lt;VkDeviceSize&gt;(size, <span class="keyword">sizeof</span>(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));</div>
-<div class="line"><a name="l12272"></a><span class="lineno">12272</span>&#160;        alignment = VmaAlignUp&lt;VkDeviceSize&gt;(alignment, <span class="keyword">sizeof</span>(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));</div>
-<div class="line"><a name="l12273"></a><span class="lineno">12273</span>&#160;    }</div>
-<div class="line"><a name="l12274"></a><span class="lineno">12274</span>&#160; </div>
-<div class="line"><a name="l12275"></a><span class="lineno">12275</span>&#160;    {</div>
-<div class="line"><a name="l12276"></a><span class="lineno">12276</span>&#160;        VmaMutexLockWrite lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l12277"></a><span class="lineno">12277</span>&#160;        <span class="keywordflow">for</span>(allocIndex = 0; allocIndex &lt; allocationCount; ++allocIndex)</div>
-<div class="line"><a name="l12278"></a><span class="lineno">12278</span>&#160;        {</div>
-<div class="line"><a name="l12279"></a><span class="lineno">12279</span>&#160;            res = AllocatePage(</div>
-<div class="line"><a name="l12280"></a><span class="lineno">12280</span>&#160;                currentFrameIndex,</div>
-<div class="line"><a name="l12281"></a><span class="lineno">12281</span>&#160;                size,</div>
-<div class="line"><a name="l12282"></a><span class="lineno">12282</span>&#160;                alignment,</div>
-<div class="line"><a name="l12283"></a><span class="lineno">12283</span>&#160;                createInfo,</div>
-<div class="line"><a name="l12284"></a><span class="lineno">12284</span>&#160;                suballocType,</div>
-<div class="line"><a name="l12285"></a><span class="lineno">12285</span>&#160;                pAllocations + allocIndex);</div>
-<div class="line"><a name="l12286"></a><span class="lineno">12286</span>&#160;            <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
-<div class="line"><a name="l12287"></a><span class="lineno">12287</span>&#160;            {</div>
-<div class="line"><a name="l12288"></a><span class="lineno">12288</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l12289"></a><span class="lineno">12289</span>&#160;            }</div>
-<div class="line"><a name="l12290"></a><span class="lineno">12290</span>&#160;        }</div>
-<div class="line"><a name="l12291"></a><span class="lineno">12291</span>&#160;    }</div>
-<div class="line"><a name="l12292"></a><span class="lineno">12292</span>&#160; </div>
-<div class="line"><a name="l12293"></a><span class="lineno">12293</span>&#160;    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
-<div class="line"><a name="l12294"></a><span class="lineno">12294</span>&#160;    {</div>
-<div class="line"><a name="l12295"></a><span class="lineno">12295</span>&#160;        <span class="comment">// Free all already created allocations.</span></div>
-<div class="line"><a name="l12296"></a><span class="lineno">12296</span>&#160;        <span class="keywordflow">while</span>(allocIndex--)</div>
-<div class="line"><a name="l12297"></a><span class="lineno">12297</span>&#160;        {</div>
-<div class="line"><a name="l12298"></a><span class="lineno">12298</span>&#160;            Free(pAllocations[allocIndex]);</div>
-<div class="line"><a name="l12299"></a><span class="lineno">12299</span>&#160;        }</div>
-<div class="line"><a name="l12300"></a><span class="lineno">12300</span>&#160;        memset(pAllocations, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>) * allocationCount);</div>
-<div class="line"><a name="l12301"></a><span class="lineno">12301</span>&#160;    }</div>
-<div class="line"><a name="l12302"></a><span class="lineno">12302</span>&#160; </div>
-<div class="line"><a name="l12303"></a><span class="lineno">12303</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l12304"></a><span class="lineno">12304</span>&#160;}</div>
-<div class="line"><a name="l12305"></a><span class="lineno">12305</span>&#160; </div>
-<div class="line"><a name="l12306"></a><span class="lineno">12306</span>&#160;VkResult VmaBlockVector::AllocatePage(</div>
-<div class="line"><a name="l12307"></a><span class="lineno">12307</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l12308"></a><span class="lineno">12308</span>&#160;    VkDeviceSize size,</div>
-<div class="line"><a name="l12309"></a><span class="lineno">12309</span>&#160;    VkDeviceSize alignment,</div>
-<div class="line"><a name="l12310"></a><span class="lineno">12310</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l12311"></a><span class="lineno">12311</span>&#160;    VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l12312"></a><span class="lineno">12312</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation)</div>
-<div class="line"><a name="l12313"></a><span class="lineno">12313</span>&#160;{</div>
-<div class="line"><a name="l12314"></a><span class="lineno">12314</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isUpperAddress = (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a>) != 0;</div>
-<div class="line"><a name="l12315"></a><span class="lineno">12315</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost = (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a>) != 0;</div>
-<div class="line"><a name="l12316"></a><span class="lineno">12316</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> mapped = (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0;</div>
-<div class="line"><a name="l12317"></a><span class="lineno">12317</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isUserDataString = (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a>) != 0;</div>
-<div class="line"><a name="l12318"></a><span class="lineno">12318</span>&#160;    </div>
-<div class="line"><a name="l12319"></a><span class="lineno">12319</span>&#160;    VkDeviceSize freeMemory;</div>
-<div class="line"><a name="l12320"></a><span class="lineno">12320</span>&#160;    {</div>
-<div class="line"><a name="l12321"></a><span class="lineno">12321</span>&#160;        <span class="keyword">const</span> uint32_t heapIndex = m_hAllocator-&gt;MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex);</div>
-<div class="line"><a name="l12322"></a><span class="lineno">12322</span>&#160;        <a class="code" href="struct_vma_budget.html">VmaBudget</a> heapBudget = {};</div>
-<div class="line"><a name="l12323"></a><span class="lineno">12323</span>&#160;        m_hAllocator-&gt;GetBudget(&amp;heapBudget, heapIndex, 1);</div>
-<div class="line"><a name="l12324"></a><span class="lineno">12324</span>&#160;        freeMemory = (heapBudget.<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> &lt; heapBudget.<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a>) ? (heapBudget.<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a> - heapBudget.<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a>) : 0;</div>
-<div class="line"><a name="l12325"></a><span class="lineno">12325</span>&#160;    }</div>
-<div class="line"><a name="l12326"></a><span class="lineno">12326</span>&#160;    </div>
-<div class="line"><a name="l12327"></a><span class="lineno">12327</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> canFallbackToDedicated = !IsCustomPool();</div>
-<div class="line"><a name="l12328"></a><span class="lineno">12328</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> canCreateNewBlock =</div>
-<div class="line"><a name="l12329"></a><span class="lineno">12329</span>&#160;        ((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) == 0) &amp;&amp;</div>
-<div class="line"><a name="l12330"></a><span class="lineno">12330</span>&#160;        (m_Blocks.size() &lt; m_MaxBlockCount) &amp;&amp;</div>
-<div class="line"><a name="l12331"></a><span class="lineno">12331</span>&#160;        (freeMemory &gt;= size || !canFallbackToDedicated);</div>
-<div class="line"><a name="l12332"></a><span class="lineno">12332</span>&#160;    uint32_t strategy = createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e">VMA_ALLOCATION_CREATE_STRATEGY_MASK</a>;</div>
-<div class="line"><a name="l12333"></a><span class="lineno">12333</span>&#160; </div>
-<div class="line"><a name="l12334"></a><span class="lineno">12334</span>&#160;    <span class="comment">// If linearAlgorithm is used, canMakeOtherLost is available only when used as ring buffer.</span></div>
-<div class="line"><a name="l12335"></a><span class="lineno">12335</span>&#160;    <span class="comment">// Which in turn is available only when maxBlockCount = 1.</span></div>
-<div class="line"><a name="l12336"></a><span class="lineno">12336</span>&#160;    <span class="keywordflow">if</span>(m_Algorithm == <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a> &amp;&amp; m_MaxBlockCount &gt; 1)</div>
-<div class="line"><a name="l12337"></a><span class="lineno">12337</span>&#160;    {</div>
-<div class="line"><a name="l12338"></a><span class="lineno">12338</span>&#160;        canMakeOtherLost = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l12339"></a><span class="lineno">12339</span>&#160;    }</div>
-<div class="line"><a name="l12340"></a><span class="lineno">12340</span>&#160; </div>
-<div class="line"><a name="l12341"></a><span class="lineno">12341</span>&#160;    <span class="comment">// Upper address can only be used with linear allocator and within single memory block.</span></div>
-<div class="line"><a name="l12342"></a><span class="lineno">12342</span>&#160;    <span class="keywordflow">if</span>(isUpperAddress &amp;&amp;</div>
-<div class="line"><a name="l12343"></a><span class="lineno">12343</span>&#160;        (m_Algorithm != <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a> || m_MaxBlockCount &gt; 1))</div>
-<div class="line"><a name="l12344"></a><span class="lineno">12344</span>&#160;    {</div>
-<div class="line"><a name="l12345"></a><span class="lineno">12345</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT;</div>
-<div class="line"><a name="l12346"></a><span class="lineno">12346</span>&#160;    }</div>
-<div class="line"><a name="l12347"></a><span class="lineno">12347</span>&#160; </div>
-<div class="line"><a name="l12348"></a><span class="lineno">12348</span>&#160;    <span class="comment">// Validate strategy.</span></div>
-<div class="line"><a name="l12349"></a><span class="lineno">12349</span>&#160;    <span class="keywordflow">switch</span>(strategy)</div>
-<div class="line"><a name="l12350"></a><span class="lineno">12350</span>&#160;    {</div>
-<div class="line"><a name="l12351"></a><span class="lineno">12351</span>&#160;    <span class="keywordflow">case</span> 0:</div>
-<div class="line"><a name="l12352"></a><span class="lineno">12352</span>&#160;        strategy = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>;</div>
-<div class="line"><a name="l12353"></a><span class="lineno">12353</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l12354"></a><span class="lineno">12354</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>:</div>
-<div class="line"><a name="l12355"></a><span class="lineno">12355</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a>:</div>
-<div class="line"><a name="l12356"></a><span class="lineno">12356</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>:</div>
-<div class="line"><a name="l12357"></a><span class="lineno">12357</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l12358"></a><span class="lineno">12358</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l12359"></a><span class="lineno">12359</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT;</div>
-<div class="line"><a name="l12360"></a><span class="lineno">12360</span>&#160;    }</div>
-<div class="line"><a name="l12361"></a><span class="lineno">12361</span>&#160; </div>
-<div class="line"><a name="l12362"></a><span class="lineno">12362</span>&#160;    <span class="comment">// Early reject: requested allocation size is larger that maximum block size for this block vector.</span></div>
-<div class="line"><a name="l12363"></a><span class="lineno">12363</span>&#160;    <span class="keywordflow">if</span>(size + 2 * VMA_DEBUG_MARGIN &gt; m_PreferredBlockSize)</div>
-<div class="line"><a name="l12364"></a><span class="lineno">12364</span>&#160;    {</div>
-<div class="line"><a name="l12365"></a><span class="lineno">12365</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l12366"></a><span class="lineno">12366</span>&#160;    }</div>
-<div class="line"><a name="l12367"></a><span class="lineno">12367</span>&#160; </div>
-<div class="line"><a name="l12368"></a><span class="lineno">12368</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l12369"></a><span class="lineno">12369</span>&#160;<span class="comment">    Under certain condition, this whole section can be skipped for optimization, so</span></div>
-<div class="line"><a name="l12370"></a><span class="lineno">12370</span>&#160;<span class="comment">    we move on directly to trying to allocate with canMakeOtherLost. That&#39;s the case</span></div>
-<div class="line"><a name="l12371"></a><span class="lineno">12371</span>&#160;<span class="comment">    e.g. for custom pools with linear algorithm.</span></div>
-<div class="line"><a name="l12372"></a><span class="lineno">12372</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l12373"></a><span class="lineno">12373</span>&#160;    <span class="keywordflow">if</span>(!canMakeOtherLost || canCreateNewBlock)</div>
-<div class="line"><a name="l12374"></a><span class="lineno">12374</span>&#160;    {</div>
-<div class="line"><a name="l12375"></a><span class="lineno">12375</span>&#160;        <span class="comment">// 1. Search existing allocations. Try to allocate without making other allocations lost.</span></div>
-<div class="line"><a name="l12376"></a><span class="lineno">12376</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlagsCopy = createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>;</div>
-<div class="line"><a name="l12377"></a><span class="lineno">12377</span>&#160;        allocFlagsCopy &amp;= ~<a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a>;</div>
-<div class="line"><a name="l12378"></a><span class="lineno">12378</span>&#160; </div>
-<div class="line"><a name="l12379"></a><span class="lineno">12379</span>&#160;        <span class="keywordflow">if</span>(m_Algorithm == <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>)</div>
-<div class="line"><a name="l12380"></a><span class="lineno">12380</span>&#160;        {</div>
-<div class="line"><a name="l12381"></a><span class="lineno">12381</span>&#160;            <span class="comment">// Use only last block.</span></div>
-<div class="line"><a name="l12382"></a><span class="lineno">12382</span>&#160;            <span class="keywordflow">if</span>(!m_Blocks.empty())</div>
-<div class="line"><a name="l12383"></a><span class="lineno">12383</span>&#160;            {</div>
-<div class="line"><a name="l12384"></a><span class="lineno">12384</span>&#160;                VmaDeviceMemoryBlock* <span class="keyword">const</span> pCurrBlock = m_Blocks.back();</div>
-<div class="line"><a name="l12385"></a><span class="lineno">12385</span>&#160;                VMA_ASSERT(pCurrBlock);</div>
-<div class="line"><a name="l12386"></a><span class="lineno">12386</span>&#160;                VkResult res = AllocateFromBlock(</div>
-<div class="line"><a name="l12387"></a><span class="lineno">12387</span>&#160;                    pCurrBlock,</div>
-<div class="line"><a name="l12388"></a><span class="lineno">12388</span>&#160;                    currentFrameIndex,</div>
-<div class="line"><a name="l12389"></a><span class="lineno">12389</span>&#160;                    size,</div>
-<div class="line"><a name="l12390"></a><span class="lineno">12390</span>&#160;                    alignment,</div>
-<div class="line"><a name="l12391"></a><span class="lineno">12391</span>&#160;                    allocFlagsCopy,</div>
-<div class="line"><a name="l12392"></a><span class="lineno">12392</span>&#160;                    createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
-<div class="line"><a name="l12393"></a><span class="lineno">12393</span>&#160;                    suballocType,</div>
-<div class="line"><a name="l12394"></a><span class="lineno">12394</span>&#160;                    strategy,</div>
-<div class="line"><a name="l12395"></a><span class="lineno">12395</span>&#160;                    pAllocation);</div>
-<div class="line"><a name="l12396"></a><span class="lineno">12396</span>&#160;                <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l12397"></a><span class="lineno">12397</span>&#160;                {</div>
-<div class="line"><a name="l12398"></a><span class="lineno">12398</span>&#160;                    VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Returned from last block #%u&quot;</span>, pCurrBlock-&gt;GetId());</div>
-<div class="line"><a name="l12399"></a><span class="lineno">12399</span>&#160;                    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l12400"></a><span class="lineno">12400</span>&#160;                }</div>
-<div class="line"><a name="l12401"></a><span class="lineno">12401</span>&#160;            }</div>
-<div class="line"><a name="l12402"></a><span class="lineno">12402</span>&#160;        }</div>
-<div class="line"><a name="l12403"></a><span class="lineno">12403</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l12404"></a><span class="lineno">12404</span>&#160;        {</div>
-<div class="line"><a name="l12405"></a><span class="lineno">12405</span>&#160;            <span class="keywordflow">if</span>(strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>)</div>
-<div class="line"><a name="l12406"></a><span class="lineno">12406</span>&#160;            {</div>
-<div class="line"><a name="l12407"></a><span class="lineno">12407</span>&#160;                <span class="comment">// Forward order in m_Blocks - prefer blocks with smallest amount of free space.</span></div>
-<div class="line"><a name="l12408"></a><span class="lineno">12408</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex )</div>
-<div class="line"><a name="l12409"></a><span class="lineno">12409</span>&#160;                {</div>
-<div class="line"><a name="l12410"></a><span class="lineno">12410</span>&#160;                    VmaDeviceMemoryBlock* <span class="keyword">const</span> pCurrBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l12411"></a><span class="lineno">12411</span>&#160;                    VMA_ASSERT(pCurrBlock);</div>
-<div class="line"><a name="l12412"></a><span class="lineno">12412</span>&#160;                    VkResult res = AllocateFromBlock(</div>
-<div class="line"><a name="l12413"></a><span class="lineno">12413</span>&#160;                        pCurrBlock,</div>
-<div class="line"><a name="l12414"></a><span class="lineno">12414</span>&#160;                        currentFrameIndex,</div>
-<div class="line"><a name="l12415"></a><span class="lineno">12415</span>&#160;                        size,</div>
-<div class="line"><a name="l12416"></a><span class="lineno">12416</span>&#160;                        alignment,</div>
-<div class="line"><a name="l12417"></a><span class="lineno">12417</span>&#160;                        allocFlagsCopy,</div>
-<div class="line"><a name="l12418"></a><span class="lineno">12418</span>&#160;                        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
-<div class="line"><a name="l12419"></a><span class="lineno">12419</span>&#160;                        suballocType,</div>
-<div class="line"><a name="l12420"></a><span class="lineno">12420</span>&#160;                        strategy,</div>
-<div class="line"><a name="l12421"></a><span class="lineno">12421</span>&#160;                        pAllocation);</div>
-<div class="line"><a name="l12422"></a><span class="lineno">12422</span>&#160;                    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l12423"></a><span class="lineno">12423</span>&#160;                    {</div>
-<div class="line"><a name="l12424"></a><span class="lineno">12424</span>&#160;                        VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Returned from existing block #%u&quot;</span>, pCurrBlock-&gt;GetId());</div>
-<div class="line"><a name="l12425"></a><span class="lineno">12425</span>&#160;                        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l12426"></a><span class="lineno">12426</span>&#160;                    }</div>
-<div class="line"><a name="l12427"></a><span class="lineno">12427</span>&#160;                }</div>
-<div class="line"><a name="l12428"></a><span class="lineno">12428</span>&#160;            }</div>
-<div class="line"><a name="l12429"></a><span class="lineno">12429</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// WORST_FIT, FIRST_FIT</span></div>
-<div class="line"><a name="l12430"></a><span class="lineno">12430</span>&#160;            {</div>
-<div class="line"><a name="l12431"></a><span class="lineno">12431</span>&#160;                <span class="comment">// Backward order in m_Blocks - prefer blocks with largest amount of free space.</span></div>
-<div class="line"><a name="l12432"></a><span class="lineno">12432</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = m_Blocks.size(); blockIndex--; )</div>
-<div class="line"><a name="l12433"></a><span class="lineno">12433</span>&#160;                {</div>
-<div class="line"><a name="l12434"></a><span class="lineno">12434</span>&#160;                    VmaDeviceMemoryBlock* <span class="keyword">const</span> pCurrBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l12435"></a><span class="lineno">12435</span>&#160;                    VMA_ASSERT(pCurrBlock);</div>
-<div class="line"><a name="l12436"></a><span class="lineno">12436</span>&#160;                    VkResult res = AllocateFromBlock(</div>
-<div class="line"><a name="l12437"></a><span class="lineno">12437</span>&#160;                        pCurrBlock,</div>
-<div class="line"><a name="l12438"></a><span class="lineno">12438</span>&#160;                        currentFrameIndex,</div>
-<div class="line"><a name="l12439"></a><span class="lineno">12439</span>&#160;                        size,</div>
-<div class="line"><a name="l12440"></a><span class="lineno">12440</span>&#160;                        alignment,</div>
-<div class="line"><a name="l12441"></a><span class="lineno">12441</span>&#160;                        allocFlagsCopy,</div>
-<div class="line"><a name="l12442"></a><span class="lineno">12442</span>&#160;                        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
-<div class="line"><a name="l12443"></a><span class="lineno">12443</span>&#160;                        suballocType,</div>
-<div class="line"><a name="l12444"></a><span class="lineno">12444</span>&#160;                        strategy,</div>
-<div class="line"><a name="l12445"></a><span class="lineno">12445</span>&#160;                        pAllocation);</div>
-<div class="line"><a name="l12446"></a><span class="lineno">12446</span>&#160;                    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l12447"></a><span class="lineno">12447</span>&#160;                    {</div>
-<div class="line"><a name="l12448"></a><span class="lineno">12448</span>&#160;                        VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Returned from existing block #%u&quot;</span>, pCurrBlock-&gt;GetId());</div>
-<div class="line"><a name="l12449"></a><span class="lineno">12449</span>&#160;                        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l12450"></a><span class="lineno">12450</span>&#160;                    }</div>
-<div class="line"><a name="l12451"></a><span class="lineno">12451</span>&#160;                }</div>
-<div class="line"><a name="l12452"></a><span class="lineno">12452</span>&#160;            }</div>
-<div class="line"><a name="l12453"></a><span class="lineno">12453</span>&#160;        }</div>
-<div class="line"><a name="l12454"></a><span class="lineno">12454</span>&#160; </div>
-<div class="line"><a name="l12455"></a><span class="lineno">12455</span>&#160;        <span class="comment">// 2. Try to create new block.</span></div>
-<div class="line"><a name="l12456"></a><span class="lineno">12456</span>&#160;        <span class="keywordflow">if</span>(canCreateNewBlock)</div>
-<div class="line"><a name="l12457"></a><span class="lineno">12457</span>&#160;        {</div>
-<div class="line"><a name="l12458"></a><span class="lineno">12458</span>&#160;            <span class="comment">// Calculate optimal size for new block.</span></div>
-<div class="line"><a name="l12459"></a><span class="lineno">12459</span>&#160;            VkDeviceSize newBlockSize = m_PreferredBlockSize;</div>
-<div class="line"><a name="l12460"></a><span class="lineno">12460</span>&#160;            uint32_t newBlockSizeShift = 0;</div>
-<div class="line"><a name="l12461"></a><span class="lineno">12461</span>&#160;            <span class="keyword">const</span> uint32_t NEW_BLOCK_SIZE_SHIFT_MAX = 3;</div>
-<div class="line"><a name="l12462"></a><span class="lineno">12462</span>&#160; </div>
-<div class="line"><a name="l12463"></a><span class="lineno">12463</span>&#160;            <span class="keywordflow">if</span>(!m_ExplicitBlockSize)</div>
-<div class="line"><a name="l12464"></a><span class="lineno">12464</span>&#160;            {</div>
-<div class="line"><a name="l12465"></a><span class="lineno">12465</span>&#160;                <span class="comment">// Allocate 1/8, 1/4, 1/2 as first blocks.</span></div>
-<div class="line"><a name="l12466"></a><span class="lineno">12466</span>&#160;                <span class="keyword">const</span> VkDeviceSize maxExistingBlockSize = CalcMaxBlockSize();</div>
-<div class="line"><a name="l12467"></a><span class="lineno">12467</span>&#160;                <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; NEW_BLOCK_SIZE_SHIFT_MAX; ++i)</div>
-<div class="line"><a name="l12468"></a><span class="lineno">12468</span>&#160;                {</div>
-<div class="line"><a name="l12469"></a><span class="lineno">12469</span>&#160;                    <span class="keyword">const</span> VkDeviceSize smallerNewBlockSize = newBlockSize / 2;</div>
-<div class="line"><a name="l12470"></a><span class="lineno">12470</span>&#160;                    <span class="keywordflow">if</span>(smallerNewBlockSize &gt; maxExistingBlockSize &amp;&amp; smallerNewBlockSize &gt;= size * 2)</div>
-<div class="line"><a name="l12471"></a><span class="lineno">12471</span>&#160;                    {</div>
-<div class="line"><a name="l12472"></a><span class="lineno">12472</span>&#160;                        newBlockSize = smallerNewBlockSize;</div>
-<div class="line"><a name="l12473"></a><span class="lineno">12473</span>&#160;                        ++newBlockSizeShift;</div>
-<div class="line"><a name="l12474"></a><span class="lineno">12474</span>&#160;                    }</div>
-<div class="line"><a name="l12475"></a><span class="lineno">12475</span>&#160;                    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l12476"></a><span class="lineno">12476</span>&#160;                    {</div>
-<div class="line"><a name="l12477"></a><span class="lineno">12477</span>&#160;                        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l12478"></a><span class="lineno">12478</span>&#160;                    }</div>
-<div class="line"><a name="l12479"></a><span class="lineno">12479</span>&#160;                }</div>
-<div class="line"><a name="l12480"></a><span class="lineno">12480</span>&#160;            }</div>
-<div class="line"><a name="l12481"></a><span class="lineno">12481</span>&#160; </div>
-<div class="line"><a name="l12482"></a><span class="lineno">12482</span>&#160;            <span class="keywordtype">size_t</span> newBlockIndex = 0;</div>
-<div class="line"><a name="l12483"></a><span class="lineno">12483</span>&#160;            VkResult res = (newBlockSize &lt;= freeMemory || !canFallbackToDedicated) ?</div>
-<div class="line"><a name="l12484"></a><span class="lineno">12484</span>&#160;                CreateBlock(newBlockSize, &amp;newBlockIndex) : VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l12485"></a><span class="lineno">12485</span>&#160;            <span class="comment">// Allocation of this size failed? Try 1/2, 1/4, 1/8 of m_PreferredBlockSize.</span></div>
-<div class="line"><a name="l12486"></a><span class="lineno">12486</span>&#160;            <span class="keywordflow">if</span>(!m_ExplicitBlockSize)</div>
-<div class="line"><a name="l12487"></a><span class="lineno">12487</span>&#160;            {</div>
-<div class="line"><a name="l12488"></a><span class="lineno">12488</span>&#160;                <span class="keywordflow">while</span>(res &lt; 0 &amp;&amp; newBlockSizeShift &lt; NEW_BLOCK_SIZE_SHIFT_MAX)</div>
-<div class="line"><a name="l12489"></a><span class="lineno">12489</span>&#160;                {</div>
-<div class="line"><a name="l12490"></a><span class="lineno">12490</span>&#160;                    <span class="keyword">const</span> VkDeviceSize smallerNewBlockSize = newBlockSize / 2;</div>
-<div class="line"><a name="l12491"></a><span class="lineno">12491</span>&#160;                    <span class="keywordflow">if</span>(smallerNewBlockSize &gt;= size)</div>
-<div class="line"><a name="l12492"></a><span class="lineno">12492</span>&#160;                    {</div>
-<div class="line"><a name="l12493"></a><span class="lineno">12493</span>&#160;                        newBlockSize = smallerNewBlockSize;</div>
-<div class="line"><a name="l12494"></a><span class="lineno">12494</span>&#160;                        ++newBlockSizeShift;</div>
-<div class="line"><a name="l12495"></a><span class="lineno">12495</span>&#160;                        res = (newBlockSize &lt;= freeMemory || !canFallbackToDedicated) ?</div>
-<div class="line"><a name="l12496"></a><span class="lineno">12496</span>&#160;                            CreateBlock(newBlockSize, &amp;newBlockIndex) : VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l12497"></a><span class="lineno">12497</span>&#160;                    }</div>
-<div class="line"><a name="l12498"></a><span class="lineno">12498</span>&#160;                    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l12499"></a><span class="lineno">12499</span>&#160;                    {</div>
-<div class="line"><a name="l12500"></a><span class="lineno">12500</span>&#160;                        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l12501"></a><span class="lineno">12501</span>&#160;                    }</div>
-<div class="line"><a name="l12502"></a><span class="lineno">12502</span>&#160;                }</div>
-<div class="line"><a name="l12503"></a><span class="lineno">12503</span>&#160;            }</div>
-<div class="line"><a name="l12504"></a><span class="lineno">12504</span>&#160; </div>
-<div class="line"><a name="l12505"></a><span class="lineno">12505</span>&#160;            <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l12506"></a><span class="lineno">12506</span>&#160;            {</div>
-<div class="line"><a name="l12507"></a><span class="lineno">12507</span>&#160;                VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[newBlockIndex];</div>
-<div class="line"><a name="l12508"></a><span class="lineno">12508</span>&#160;                VMA_ASSERT(pBlock-&gt;m_pMetadata-&gt;GetSize() &gt;= size);</div>
-<div class="line"><a name="l12509"></a><span class="lineno">12509</span>&#160; </div>
-<div class="line"><a name="l12510"></a><span class="lineno">12510</span>&#160;                res = AllocateFromBlock(</div>
-<div class="line"><a name="l12511"></a><span class="lineno">12511</span>&#160;                    pBlock,</div>
-<div class="line"><a name="l12512"></a><span class="lineno">12512</span>&#160;                    currentFrameIndex,</div>
-<div class="line"><a name="l12513"></a><span class="lineno">12513</span>&#160;                    size,</div>
-<div class="line"><a name="l12514"></a><span class="lineno">12514</span>&#160;                    alignment,</div>
-<div class="line"><a name="l12515"></a><span class="lineno">12515</span>&#160;                    allocFlagsCopy,</div>
-<div class="line"><a name="l12516"></a><span class="lineno">12516</span>&#160;                    createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
-<div class="line"><a name="l12517"></a><span class="lineno">12517</span>&#160;                    suballocType,</div>
-<div class="line"><a name="l12518"></a><span class="lineno">12518</span>&#160;                    strategy,</div>
-<div class="line"><a name="l12519"></a><span class="lineno">12519</span>&#160;                    pAllocation);</div>
-<div class="line"><a name="l12520"></a><span class="lineno">12520</span>&#160;                <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l12521"></a><span class="lineno">12521</span>&#160;                {</div>
-<div class="line"><a name="l12522"></a><span class="lineno">12522</span>&#160;                    VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Created new block #%u Size=%llu&quot;</span>, pBlock-&gt;GetId(), newBlockSize);</div>
-<div class="line"><a name="l12523"></a><span class="lineno">12523</span>&#160;                    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l12524"></a><span class="lineno">12524</span>&#160;                }</div>
-<div class="line"><a name="l12525"></a><span class="lineno">12525</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l12526"></a><span class="lineno">12526</span>&#160;                {</div>
-<div class="line"><a name="l12527"></a><span class="lineno">12527</span>&#160;                    <span class="comment">// Allocation from new block failed, possibly due to VMA_DEBUG_MARGIN or alignment.</span></div>
-<div class="line"><a name="l12528"></a><span class="lineno">12528</span>&#160;                    <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l12529"></a><span class="lineno">12529</span>&#160;                }</div>
-<div class="line"><a name="l12530"></a><span class="lineno">12530</span>&#160;            }</div>
-<div class="line"><a name="l12531"></a><span class="lineno">12531</span>&#160;        }</div>
-<div class="line"><a name="l12532"></a><span class="lineno">12532</span>&#160;    }</div>
+<div class="line"><a name="l12257"></a><span class="lineno">12257</span>&#160;    VmaWriteMagicValue(pData, allocOffset - VMA_DEBUG_MARGIN);</div>
+<div class="line"><a name="l12258"></a><span class="lineno">12258</span>&#160;    VmaWriteMagicValue(pData, allocOffset + allocSize);</div>
+<div class="line"><a name="l12259"></a><span class="lineno">12259</span>&#160; </div>
+<div class="line"><a name="l12260"></a><span class="lineno">12260</span>&#160;    Unmap(hAllocator, 1);</div>
+<div class="line"><a name="l12261"></a><span class="lineno">12261</span>&#160; </div>
+<div class="line"><a name="l12262"></a><span class="lineno">12262</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l12263"></a><span class="lineno">12263</span>&#160;}</div>
+<div class="line"><a name="l12264"></a><span class="lineno">12264</span>&#160; </div>
+<div class="line"><a name="l12265"></a><span class="lineno">12265</span>&#160;VkResult VmaDeviceMemoryBlock::ValidateMagicValueAroundAllocation(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize)</div>
+<div class="line"><a name="l12266"></a><span class="lineno">12266</span>&#160;{</div>
+<div class="line"><a name="l12267"></a><span class="lineno">12267</span>&#160;    VMA_ASSERT(VMA_DEBUG_MARGIN &gt; 0 &amp;&amp; VMA_DEBUG_MARGIN % 4 == 0 &amp;&amp; VMA_DEBUG_DETECT_CORRUPTION);</div>
+<div class="line"><a name="l12268"></a><span class="lineno">12268</span>&#160;    VMA_ASSERT(allocOffset &gt;= VMA_DEBUG_MARGIN);</div>
+<div class="line"><a name="l12269"></a><span class="lineno">12269</span>&#160; </div>
+<div class="line"><a name="l12270"></a><span class="lineno">12270</span>&#160;    <span class="keywordtype">void</span>* pData;</div>
+<div class="line"><a name="l12271"></a><span class="lineno">12271</span>&#160;    VkResult res = Map(hAllocator, 1, &amp;pData);</div>
+<div class="line"><a name="l12272"></a><span class="lineno">12272</span>&#160;    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l12273"></a><span class="lineno">12273</span>&#160;    {</div>
+<div class="line"><a name="l12274"></a><span class="lineno">12274</span>&#160;        <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l12275"></a><span class="lineno">12275</span>&#160;    }</div>
+<div class="line"><a name="l12276"></a><span class="lineno">12276</span>&#160; </div>
+<div class="line"><a name="l12277"></a><span class="lineno">12277</span>&#160;    <span class="keywordflow">if</span>(!VmaValidateMagicValue(pData, allocOffset - VMA_DEBUG_MARGIN))</div>
+<div class="line"><a name="l12278"></a><span class="lineno">12278</span>&#160;    {</div>
+<div class="line"><a name="l12279"></a><span class="lineno">12279</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED BEFORE FREED ALLOCATION!&quot;</span>);</div>
+<div class="line"><a name="l12280"></a><span class="lineno">12280</span>&#160;    }</div>
+<div class="line"><a name="l12281"></a><span class="lineno">12281</span>&#160;    <span class="keywordflow">else</span> <span class="keywordflow">if</span>(!VmaValidateMagicValue(pData, allocOffset + allocSize))</div>
+<div class="line"><a name="l12282"></a><span class="lineno">12282</span>&#160;    {</div>
+<div class="line"><a name="l12283"></a><span class="lineno">12283</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;MEMORY CORRUPTION DETECTED AFTER FREED ALLOCATION!&quot;</span>);</div>
+<div class="line"><a name="l12284"></a><span class="lineno">12284</span>&#160;    }</div>
+<div class="line"><a name="l12285"></a><span class="lineno">12285</span>&#160; </div>
+<div class="line"><a name="l12286"></a><span class="lineno">12286</span>&#160;    Unmap(hAllocator, 1);</div>
+<div class="line"><a name="l12287"></a><span class="lineno">12287</span>&#160; </div>
+<div class="line"><a name="l12288"></a><span class="lineno">12288</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l12289"></a><span class="lineno">12289</span>&#160;}</div>
+<div class="line"><a name="l12290"></a><span class="lineno">12290</span>&#160; </div>
+<div class="line"><a name="l12291"></a><span class="lineno">12291</span>&#160;VkResult VmaDeviceMemoryBlock::BindBufferMemory(</div>
+<div class="line"><a name="l12292"></a><span class="lineno">12292</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l12293"></a><span class="lineno">12293</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
+<div class="line"><a name="l12294"></a><span class="lineno">12294</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l12295"></a><span class="lineno">12295</span>&#160;    VkBuffer hBuffer,</div>
+<div class="line"><a name="l12296"></a><span class="lineno">12296</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
+<div class="line"><a name="l12297"></a><span class="lineno">12297</span>&#160;{</div>
+<div class="line"><a name="l12298"></a><span class="lineno">12298</span>&#160;    VMA_ASSERT(hAllocation-&gt;GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK &amp;&amp;</div>
+<div class="line"><a name="l12299"></a><span class="lineno">12299</span>&#160;        hAllocation-&gt;GetBlock() == <span class="keyword">this</span>);</div>
+<div class="line"><a name="l12300"></a><span class="lineno">12300</span>&#160;    VMA_ASSERT(allocationLocalOffset &lt; hAllocation-&gt;GetSize() &amp;&amp;</div>
+<div class="line"><a name="l12301"></a><span class="lineno">12301</span>&#160;        <span class="stringliteral">&quot;Invalid allocationLocalOffset. Did you forget that this offset is relative to the beginning of the allocation, not the whole memory block?&quot;</span>);</div>
+<div class="line"><a name="l12302"></a><span class="lineno">12302</span>&#160;    <span class="keyword">const</span> VkDeviceSize memoryOffset = hAllocation-&gt;GetOffset() + allocationLocalOffset;</div>
+<div class="line"><a name="l12303"></a><span class="lineno">12303</span>&#160;    <span class="comment">// This lock is important so that we don&#39;t call vkBind... and/or vkMap... simultaneously on the same VkDeviceMemory from multiple threads.</span></div>
+<div class="line"><a name="l12304"></a><span class="lineno">12304</span>&#160;    VmaMutexLock lock(m_Mutex, hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l12305"></a><span class="lineno">12305</span>&#160;    <span class="keywordflow">return</span> hAllocator-&gt;BindVulkanBuffer(m_hMemory, memoryOffset, hBuffer, pNext);</div>
+<div class="line"><a name="l12306"></a><span class="lineno">12306</span>&#160;}</div>
+<div class="line"><a name="l12307"></a><span class="lineno">12307</span>&#160; </div>
+<div class="line"><a name="l12308"></a><span class="lineno">12308</span>&#160;VkResult VmaDeviceMemoryBlock::BindImageMemory(</div>
+<div class="line"><a name="l12309"></a><span class="lineno">12309</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l12310"></a><span class="lineno">12310</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
+<div class="line"><a name="l12311"></a><span class="lineno">12311</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l12312"></a><span class="lineno">12312</span>&#160;    VkImage hImage,</div>
+<div class="line"><a name="l12313"></a><span class="lineno">12313</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
+<div class="line"><a name="l12314"></a><span class="lineno">12314</span>&#160;{</div>
+<div class="line"><a name="l12315"></a><span class="lineno">12315</span>&#160;    VMA_ASSERT(hAllocation-&gt;GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK &amp;&amp;</div>
+<div class="line"><a name="l12316"></a><span class="lineno">12316</span>&#160;        hAllocation-&gt;GetBlock() == <span class="keyword">this</span>);</div>
+<div class="line"><a name="l12317"></a><span class="lineno">12317</span>&#160;    VMA_ASSERT(allocationLocalOffset &lt; hAllocation-&gt;GetSize() &amp;&amp;</div>
+<div class="line"><a name="l12318"></a><span class="lineno">12318</span>&#160;        <span class="stringliteral">&quot;Invalid allocationLocalOffset. Did you forget that this offset is relative to the beginning of the allocation, not the whole memory block?&quot;</span>);</div>
+<div class="line"><a name="l12319"></a><span class="lineno">12319</span>&#160;    <span class="keyword">const</span> VkDeviceSize memoryOffset = hAllocation-&gt;GetOffset() + allocationLocalOffset;</div>
+<div class="line"><a name="l12320"></a><span class="lineno">12320</span>&#160;    <span class="comment">// This lock is important so that we don&#39;t call vkBind... and/or vkMap... simultaneously on the same VkDeviceMemory from multiple threads.</span></div>
+<div class="line"><a name="l12321"></a><span class="lineno">12321</span>&#160;    VmaMutexLock lock(m_Mutex, hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l12322"></a><span class="lineno">12322</span>&#160;    <span class="keywordflow">return</span> hAllocator-&gt;BindVulkanImage(m_hMemory, memoryOffset, hImage, pNext);</div>
+<div class="line"><a name="l12323"></a><span class="lineno">12323</span>&#160;}</div>
+<div class="line"><a name="l12324"></a><span class="lineno">12324</span>&#160; </div>
+<div class="line"><a name="l12325"></a><span class="lineno">12325</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> InitStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo)</div>
+<div class="line"><a name="l12326"></a><span class="lineno">12326</span>&#160;{</div>
+<div class="line"><a name="l12327"></a><span class="lineno">12327</span>&#160;    memset(&amp;outInfo, 0, <span class="keyword">sizeof</span>(outInfo));</div>
+<div class="line"><a name="l12328"></a><span class="lineno">12328</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = UINT64_MAX;</div>
+<div class="line"><a name="l12329"></a><span class="lineno">12329</span>&#160;    outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = UINT64_MAX;</div>
+<div class="line"><a name="l12330"></a><span class="lineno">12330</span>&#160;}</div>
+<div class="line"><a name="l12331"></a><span class="lineno">12331</span>&#160; </div>
+<div class="line"><a name="l12332"></a><span class="lineno">12332</span>&#160;<span class="comment">// Adds statistics srcInfo into inoutInfo, like: inoutInfo += srcInfo.</span></div>
+<div class="line"><a name="l12333"></a><span class="lineno">12333</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaAddStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; inoutInfo, <span class="keyword">const</span> <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; srcInfo)</div>
+<div class="line"><a name="l12334"></a><span class="lineno">12334</span>&#160;{</div>
+<div class="line"><a name="l12335"></a><span class="lineno">12335</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> += srcInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a>;</div>
+<div class="line"><a name="l12336"></a><span class="lineno">12336</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> += srcInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>;</div>
+<div class="line"><a name="l12337"></a><span class="lineno">12337</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> += srcInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
+<div class="line"><a name="l12338"></a><span class="lineno">12338</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> += srcInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a>;</div>
+<div class="line"><a name="l12339"></a><span class="lineno">12339</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> += srcInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>;</div>
+<div class="line"><a name="l12340"></a><span class="lineno">12340</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = VMA_MIN(inoutInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, srcInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>);</div>
+<div class="line"><a name="l12341"></a><span class="lineno">12341</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = VMA_MAX(inoutInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>, srcInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>);</div>
+<div class="line"><a name="l12342"></a><span class="lineno">12342</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = VMA_MIN(inoutInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, srcInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>);</div>
+<div class="line"><a name="l12343"></a><span class="lineno">12343</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = VMA_MAX(inoutInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>, srcInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>);</div>
+<div class="line"><a name="l12344"></a><span class="lineno">12344</span>&#160;}</div>
+<div class="line"><a name="l12345"></a><span class="lineno">12345</span>&#160; </div>
+<div class="line"><a name="l12346"></a><span class="lineno">12346</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaPostprocessCalcStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; inoutInfo)</div>
+<div class="line"><a name="l12347"></a><span class="lineno">12347</span>&#160;{</div>
+<div class="line"><a name="l12348"></a><span class="lineno">12348</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a1081a039964e566c672e7a2347f9e599">allocationSizeAvg</a> = (inoutInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> &gt; 0) ?</div>
+<div class="line"><a name="l12349"></a><span class="lineno">12349</span>&#160;        VmaRoundDiv&lt;VkDeviceSize&gt;(inoutInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a>, inoutInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>) : 0;</div>
+<div class="line"><a name="l12350"></a><span class="lineno">12350</span>&#160;    inoutInfo.<a class="code" href="struct_vma_stat_info.html#a2f9b3452af90c9768a30b7fb6ae194fc">unusedRangeSizeAvg</a> = (inoutInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> &gt; 0) ?</div>
+<div class="line"><a name="l12351"></a><span class="lineno">12351</span>&#160;        VmaRoundDiv&lt;VkDeviceSize&gt;(inoutInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>, inoutInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>) : 0;</div>
+<div class="line"><a name="l12352"></a><span class="lineno">12352</span>&#160;}</div>
+<div class="line"><a name="l12353"></a><span class="lineno">12353</span>&#160; </div>
+<div class="line"><a name="l12354"></a><span class="lineno">12354</span>&#160;VmaPool_T::VmaPool_T(</div>
+<div class="line"><a name="l12355"></a><span class="lineno">12355</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l12356"></a><span class="lineno">12356</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l12357"></a><span class="lineno">12357</span>&#160;    VkDeviceSize preferredBlockSize) :</div>
+<div class="line"><a name="l12358"></a><span class="lineno">12358</span>&#160;    m_BlockVector(</div>
+<div class="line"><a name="l12359"></a><span class="lineno">12359</span>&#160;        hAllocator,</div>
+<div class="line"><a name="l12360"></a><span class="lineno">12360</span>&#160;        this, <span class="comment">// hParentPool</span></div>
+<div class="line"><a name="l12361"></a><span class="lineno">12361</span>&#160;        createInfo.memoryTypeIndex,</div>
+<div class="line"><a name="l12362"></a><span class="lineno">12362</span>&#160;        createInfo.blockSize != 0 ? createInfo.blockSize : preferredBlockSize,</div>
+<div class="line"><a name="l12363"></a><span class="lineno">12363</span>&#160;        createInfo.minBlockCount,</div>
+<div class="line"><a name="l12364"></a><span class="lineno">12364</span>&#160;        createInfo.maxBlockCount,</div>
+<div class="line"><a name="l12365"></a><span class="lineno">12365</span>&#160;        (createInfo.flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2">VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT</a>) != 0 ? 1 : hAllocator-&gt;GetBufferImageGranularity(),</div>
+<div class="line"><a name="l12366"></a><span class="lineno">12366</span>&#160;        createInfo.frameInUseCount,</div>
+<div class="line"><a name="l12367"></a><span class="lineno">12367</span>&#160;        createInfo.blockSize != 0, <span class="comment">// explicitBlockSize</span></div>
+<div class="line"><a name="l12368"></a><span class="lineno">12368</span>&#160;        createInfo.flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c">VMA_POOL_CREATE_ALGORITHM_MASK</a>), <span class="comment">// algorithm</span></div>
+<div class="line"><a name="l12369"></a><span class="lineno">12369</span>&#160;    m_Id(0),</div>
+<div class="line"><a name="l12370"></a><span class="lineno">12370</span>&#160;    m_Name(VMA_NULL)</div>
+<div class="line"><a name="l12371"></a><span class="lineno">12371</span>&#160;{</div>
+<div class="line"><a name="l12372"></a><span class="lineno">12372</span>&#160;}</div>
+<div class="line"><a name="l12373"></a><span class="lineno">12373</span>&#160; </div>
+<div class="line"><a name="l12374"></a><span class="lineno">12374</span>&#160;VmaPool_T::~VmaPool_T()</div>
+<div class="line"><a name="l12375"></a><span class="lineno">12375</span>&#160;{</div>
+<div class="line"><a name="l12376"></a><span class="lineno">12376</span>&#160;}</div>
+<div class="line"><a name="l12377"></a><span class="lineno">12377</span>&#160; </div>
+<div class="line"><a name="l12378"></a><span class="lineno">12378</span>&#160;<span class="keywordtype">void</span> VmaPool_T::SetName(<span class="keyword">const</span> <span class="keywordtype">char</span>* pName)</div>
+<div class="line"><a name="l12379"></a><span class="lineno">12379</span>&#160;{</div>
+<div class="line"><a name="l12380"></a><span class="lineno">12380</span>&#160;    <span class="keyword">const</span> VkAllocationCallbacks* allocs = m_BlockVector.GetAllocator()-&gt;GetAllocationCallbacks();</div>
+<div class="line"><a name="l12381"></a><span class="lineno">12381</span>&#160;    VmaFreeString(allocs, m_Name);</div>
+<div class="line"><a name="l12382"></a><span class="lineno">12382</span>&#160;    </div>
+<div class="line"><a name="l12383"></a><span class="lineno">12383</span>&#160;    <span class="keywordflow">if</span>(pName != VMA_NULL)</div>
+<div class="line"><a name="l12384"></a><span class="lineno">12384</span>&#160;    {</div>
+<div class="line"><a name="l12385"></a><span class="lineno">12385</span>&#160;        m_Name = VmaCreateStringCopy(allocs, pName);</div>
+<div class="line"><a name="l12386"></a><span class="lineno">12386</span>&#160;    }</div>
+<div class="line"><a name="l12387"></a><span class="lineno">12387</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l12388"></a><span class="lineno">12388</span>&#160;    {</div>
+<div class="line"><a name="l12389"></a><span class="lineno">12389</span>&#160;        m_Name = VMA_NULL;</div>
+<div class="line"><a name="l12390"></a><span class="lineno">12390</span>&#160;    }</div>
+<div class="line"><a name="l12391"></a><span class="lineno">12391</span>&#160;}</div>
+<div class="line"><a name="l12392"></a><span class="lineno">12392</span>&#160; </div>
+<div class="line"><a name="l12393"></a><span class="lineno">12393</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l12394"></a><span class="lineno">12394</span>&#160; </div>
+<div class="line"><a name="l12395"></a><span class="lineno">12395</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l12396"></a><span class="lineno">12396</span>&#160; </div>
+<div class="line"><a name="l12397"></a><span class="lineno">12397</span>&#160;VmaBlockVector::VmaBlockVector(</div>
+<div class="line"><a name="l12398"></a><span class="lineno">12398</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l12399"></a><span class="lineno">12399</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> hParentPool,</div>
+<div class="line"><a name="l12400"></a><span class="lineno">12400</span>&#160;    uint32_t memoryTypeIndex,</div>
+<div class="line"><a name="l12401"></a><span class="lineno">12401</span>&#160;    VkDeviceSize preferredBlockSize,</div>
+<div class="line"><a name="l12402"></a><span class="lineno">12402</span>&#160;    <span class="keywordtype">size_t</span> minBlockCount,</div>
+<div class="line"><a name="l12403"></a><span class="lineno">12403</span>&#160;    <span class="keywordtype">size_t</span> maxBlockCount,</div>
+<div class="line"><a name="l12404"></a><span class="lineno">12404</span>&#160;    VkDeviceSize bufferImageGranularity,</div>
+<div class="line"><a name="l12405"></a><span class="lineno">12405</span>&#160;    uint32_t frameInUseCount,</div>
+<div class="line"><a name="l12406"></a><span class="lineno">12406</span>&#160;    <span class="keywordtype">bool</span> explicitBlockSize,</div>
+<div class="line"><a name="l12407"></a><span class="lineno">12407</span>&#160;    uint32_t algorithm) :</div>
+<div class="line"><a name="l12408"></a><span class="lineno">12408</span>&#160;    m_hAllocator(hAllocator),</div>
+<div class="line"><a name="l12409"></a><span class="lineno">12409</span>&#160;    m_hParentPool(hParentPool),</div>
+<div class="line"><a name="l12410"></a><span class="lineno">12410</span>&#160;    m_MemoryTypeIndex(memoryTypeIndex),</div>
+<div class="line"><a name="l12411"></a><span class="lineno">12411</span>&#160;    m_PreferredBlockSize(preferredBlockSize),</div>
+<div class="line"><a name="l12412"></a><span class="lineno">12412</span>&#160;    m_MinBlockCount(minBlockCount),</div>
+<div class="line"><a name="l12413"></a><span class="lineno">12413</span>&#160;    m_MaxBlockCount(maxBlockCount),</div>
+<div class="line"><a name="l12414"></a><span class="lineno">12414</span>&#160;    m_BufferImageGranularity(bufferImageGranularity),</div>
+<div class="line"><a name="l12415"></a><span class="lineno">12415</span>&#160;    m_FrameInUseCount(frameInUseCount),</div>
+<div class="line"><a name="l12416"></a><span class="lineno">12416</span>&#160;    m_ExplicitBlockSize(explicitBlockSize),</div>
+<div class="line"><a name="l12417"></a><span class="lineno">12417</span>&#160;    m_Algorithm(algorithm),</div>
+<div class="line"><a name="l12418"></a><span class="lineno">12418</span>&#160;    m_HasEmptyBlock(false),</div>
+<div class="line"><a name="l12419"></a><span class="lineno">12419</span>&#160;    m_Blocks(VmaStlAllocator&lt;VmaDeviceMemoryBlock*&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
+<div class="line"><a name="l12420"></a><span class="lineno">12420</span>&#160;    m_NextBlockId(0)</div>
+<div class="line"><a name="l12421"></a><span class="lineno">12421</span>&#160;{</div>
+<div class="line"><a name="l12422"></a><span class="lineno">12422</span>&#160;}</div>
+<div class="line"><a name="l12423"></a><span class="lineno">12423</span>&#160; </div>
+<div class="line"><a name="l12424"></a><span class="lineno">12424</span>&#160;VmaBlockVector::~VmaBlockVector()</div>
+<div class="line"><a name="l12425"></a><span class="lineno">12425</span>&#160;{</div>
+<div class="line"><a name="l12426"></a><span class="lineno">12426</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_Blocks.size(); i--; )</div>
+<div class="line"><a name="l12427"></a><span class="lineno">12427</span>&#160;    {</div>
+<div class="line"><a name="l12428"></a><span class="lineno">12428</span>&#160;        m_Blocks[i]-&gt;Destroy(m_hAllocator);</div>
+<div class="line"><a name="l12429"></a><span class="lineno">12429</span>&#160;        vma_delete(m_hAllocator, m_Blocks[i]);</div>
+<div class="line"><a name="l12430"></a><span class="lineno">12430</span>&#160;    }</div>
+<div class="line"><a name="l12431"></a><span class="lineno">12431</span>&#160;}</div>
+<div class="line"><a name="l12432"></a><span class="lineno">12432</span>&#160; </div>
+<div class="line"><a name="l12433"></a><span class="lineno">12433</span>&#160;VkResult VmaBlockVector::CreateMinBlocks()</div>
+<div class="line"><a name="l12434"></a><span class="lineno">12434</span>&#160;{</div>
+<div class="line"><a name="l12435"></a><span class="lineno">12435</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_MinBlockCount; ++i)</div>
+<div class="line"><a name="l12436"></a><span class="lineno">12436</span>&#160;    {</div>
+<div class="line"><a name="l12437"></a><span class="lineno">12437</span>&#160;        VkResult res = CreateBlock(m_PreferredBlockSize, VMA_NULL);</div>
+<div class="line"><a name="l12438"></a><span class="lineno">12438</span>&#160;        <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l12439"></a><span class="lineno">12439</span>&#160;        {</div>
+<div class="line"><a name="l12440"></a><span class="lineno">12440</span>&#160;            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l12441"></a><span class="lineno">12441</span>&#160;        }</div>
+<div class="line"><a name="l12442"></a><span class="lineno">12442</span>&#160;    }</div>
+<div class="line"><a name="l12443"></a><span class="lineno">12443</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l12444"></a><span class="lineno">12444</span>&#160;}</div>
+<div class="line"><a name="l12445"></a><span class="lineno">12445</span>&#160; </div>
+<div class="line"><a name="l12446"></a><span class="lineno">12446</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::GetPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pStats)</div>
+<div class="line"><a name="l12447"></a><span class="lineno">12447</span>&#160;{</div>
+<div class="line"><a name="l12448"></a><span class="lineno">12448</span>&#160;    VmaMutexLockRead lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l12449"></a><span class="lineno">12449</span>&#160; </div>
+<div class="line"><a name="l12450"></a><span class="lineno">12450</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_Blocks.size();</div>
+<div class="line"><a name="l12451"></a><span class="lineno">12451</span>&#160; </div>
+<div class="line"><a name="l12452"></a><span class="lineno">12452</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a> = 0;</div>
+<div class="line"><a name="l12453"></a><span class="lineno">12453</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a> = 0;</div>
+<div class="line"><a name="l12454"></a><span class="lineno">12454</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a> = 0;</div>
+<div class="line"><a name="l12455"></a><span class="lineno">12455</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a> = 0;</div>
+<div class="line"><a name="l12456"></a><span class="lineno">12456</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a> = 0;</div>
+<div class="line"><a name="l12457"></a><span class="lineno">12457</span>&#160;    pStats-&gt;<a class="code" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7">blockCount</a> = blockCount;</div>
+<div class="line"><a name="l12458"></a><span class="lineno">12458</span>&#160; </div>
+<div class="line"><a name="l12459"></a><span class="lineno">12459</span>&#160;    <span class="keywordflow">for</span>(uint32_t blockIndex = 0; blockIndex &lt; blockCount; ++blockIndex)</div>
+<div class="line"><a name="l12460"></a><span class="lineno">12460</span>&#160;    {</div>
+<div class="line"><a name="l12461"></a><span class="lineno">12461</span>&#160;        <span class="keyword">const</span> VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l12462"></a><span class="lineno">12462</span>&#160;        VMA_ASSERT(pBlock);</div>
+<div class="line"><a name="l12463"></a><span class="lineno">12463</span>&#160;        VMA_HEAVY_ASSERT(pBlock-&gt;Validate());</div>
+<div class="line"><a name="l12464"></a><span class="lineno">12464</span>&#160;        pBlock-&gt;m_pMetadata-&gt;AddPoolStats(*pStats);</div>
+<div class="line"><a name="l12465"></a><span class="lineno">12465</span>&#160;    }</div>
+<div class="line"><a name="l12466"></a><span class="lineno">12466</span>&#160;}</div>
+<div class="line"><a name="l12467"></a><span class="lineno">12467</span>&#160; </div>
+<div class="line"><a name="l12468"></a><span class="lineno">12468</span>&#160;<span class="keywordtype">bool</span> VmaBlockVector::IsEmpty()</div>
+<div class="line"><a name="l12469"></a><span class="lineno">12469</span>&#160;{</div>
+<div class="line"><a name="l12470"></a><span class="lineno">12470</span>&#160;    VmaMutexLockRead lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l12471"></a><span class="lineno">12471</span>&#160;    <span class="keywordflow">return</span> m_Blocks.empty();</div>
+<div class="line"><a name="l12472"></a><span class="lineno">12472</span>&#160;}</div>
+<div class="line"><a name="l12473"></a><span class="lineno">12473</span>&#160; </div>
+<div class="line"><a name="l12474"></a><span class="lineno">12474</span>&#160;<span class="keywordtype">bool</span> VmaBlockVector::IsCorruptionDetectionEnabled()<span class="keyword"> const</span></div>
+<div class="line"><a name="l12475"></a><span class="lineno">12475</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l12476"></a><span class="lineno">12476</span>&#160;    <span class="keyword">const</span> uint32_t requiredMemFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;</div>
+<div class="line"><a name="l12477"></a><span class="lineno">12477</span>&#160;    <span class="keywordflow">return</span> (VMA_DEBUG_DETECT_CORRUPTION != 0) &amp;&amp;</div>
+<div class="line"><a name="l12478"></a><span class="lineno">12478</span>&#160;        (VMA_DEBUG_MARGIN &gt; 0) &amp;&amp;</div>
+<div class="line"><a name="l12479"></a><span class="lineno">12479</span>&#160;        (m_Algorithm == 0 || m_Algorithm == <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>) &amp;&amp;</div>
+<div class="line"><a name="l12480"></a><span class="lineno">12480</span>&#160;        (m_hAllocator-&gt;m_MemProps.memoryTypes[m_MemoryTypeIndex].propertyFlags &amp; requiredMemFlags) == requiredMemFlags;</div>
+<div class="line"><a name="l12481"></a><span class="lineno">12481</span>&#160;}</div>
+<div class="line"><a name="l12482"></a><span class="lineno">12482</span>&#160; </div>
+<div class="line"><a name="l12483"></a><span class="lineno">12483</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_ALLOCATION_TRY_COUNT = 32;</div>
+<div class="line"><a name="l12484"></a><span class="lineno">12484</span>&#160; </div>
+<div class="line"><a name="l12485"></a><span class="lineno">12485</span>&#160;VkResult VmaBlockVector::Allocate(</div>
+<div class="line"><a name="l12486"></a><span class="lineno">12486</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l12487"></a><span class="lineno">12487</span>&#160;    VkDeviceSize size,</div>
+<div class="line"><a name="l12488"></a><span class="lineno">12488</span>&#160;    VkDeviceSize alignment,</div>
+<div class="line"><a name="l12489"></a><span class="lineno">12489</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l12490"></a><span class="lineno">12490</span>&#160;    VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l12491"></a><span class="lineno">12491</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l12492"></a><span class="lineno">12492</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
+<div class="line"><a name="l12493"></a><span class="lineno">12493</span>&#160;{</div>
+<div class="line"><a name="l12494"></a><span class="lineno">12494</span>&#160;    <span class="keywordtype">size_t</span> allocIndex;</div>
+<div class="line"><a name="l12495"></a><span class="lineno">12495</span>&#160;    VkResult res = VK_SUCCESS;</div>
+<div class="line"><a name="l12496"></a><span class="lineno">12496</span>&#160; </div>
+<div class="line"><a name="l12497"></a><span class="lineno">12497</span>&#160;    <span class="keywordflow">if</span>(IsCorruptionDetectionEnabled())</div>
+<div class="line"><a name="l12498"></a><span class="lineno">12498</span>&#160;    {</div>
+<div class="line"><a name="l12499"></a><span class="lineno">12499</span>&#160;        size = VmaAlignUp&lt;VkDeviceSize&gt;(size, <span class="keyword">sizeof</span>(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));</div>
+<div class="line"><a name="l12500"></a><span class="lineno">12500</span>&#160;        alignment = VmaAlignUp&lt;VkDeviceSize&gt;(alignment, <span class="keyword">sizeof</span>(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));</div>
+<div class="line"><a name="l12501"></a><span class="lineno">12501</span>&#160;    }</div>
+<div class="line"><a name="l12502"></a><span class="lineno">12502</span>&#160; </div>
+<div class="line"><a name="l12503"></a><span class="lineno">12503</span>&#160;    {</div>
+<div class="line"><a name="l12504"></a><span class="lineno">12504</span>&#160;        VmaMutexLockWrite lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l12505"></a><span class="lineno">12505</span>&#160;        <span class="keywordflow">for</span>(allocIndex = 0; allocIndex &lt; allocationCount; ++allocIndex)</div>
+<div class="line"><a name="l12506"></a><span class="lineno">12506</span>&#160;        {</div>
+<div class="line"><a name="l12507"></a><span class="lineno">12507</span>&#160;            res = AllocatePage(</div>
+<div class="line"><a name="l12508"></a><span class="lineno">12508</span>&#160;                currentFrameIndex,</div>
+<div class="line"><a name="l12509"></a><span class="lineno">12509</span>&#160;                size,</div>
+<div class="line"><a name="l12510"></a><span class="lineno">12510</span>&#160;                alignment,</div>
+<div class="line"><a name="l12511"></a><span class="lineno">12511</span>&#160;                createInfo,</div>
+<div class="line"><a name="l12512"></a><span class="lineno">12512</span>&#160;                suballocType,</div>
+<div class="line"><a name="l12513"></a><span class="lineno">12513</span>&#160;                pAllocations + allocIndex);</div>
+<div class="line"><a name="l12514"></a><span class="lineno">12514</span>&#160;            <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l12515"></a><span class="lineno">12515</span>&#160;            {</div>
+<div class="line"><a name="l12516"></a><span class="lineno">12516</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12517"></a><span class="lineno">12517</span>&#160;            }</div>
+<div class="line"><a name="l12518"></a><span class="lineno">12518</span>&#160;        }</div>
+<div class="line"><a name="l12519"></a><span class="lineno">12519</span>&#160;    }</div>
+<div class="line"><a name="l12520"></a><span class="lineno">12520</span>&#160; </div>
+<div class="line"><a name="l12521"></a><span class="lineno">12521</span>&#160;    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l12522"></a><span class="lineno">12522</span>&#160;    {</div>
+<div class="line"><a name="l12523"></a><span class="lineno">12523</span>&#160;        <span class="comment">// Free all already created allocations.</span></div>
+<div class="line"><a name="l12524"></a><span class="lineno">12524</span>&#160;        <span class="keywordflow">while</span>(allocIndex--)</div>
+<div class="line"><a name="l12525"></a><span class="lineno">12525</span>&#160;        {</div>
+<div class="line"><a name="l12526"></a><span class="lineno">12526</span>&#160;            Free(pAllocations[allocIndex]);</div>
+<div class="line"><a name="l12527"></a><span class="lineno">12527</span>&#160;        }</div>
+<div class="line"><a name="l12528"></a><span class="lineno">12528</span>&#160;        memset(pAllocations, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>) * allocationCount);</div>
+<div class="line"><a name="l12529"></a><span class="lineno">12529</span>&#160;    }</div>
+<div class="line"><a name="l12530"></a><span class="lineno">12530</span>&#160; </div>
+<div class="line"><a name="l12531"></a><span class="lineno">12531</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l12532"></a><span class="lineno">12532</span>&#160;}</div>
 <div class="line"><a name="l12533"></a><span class="lineno">12533</span>&#160; </div>
-<div class="line"><a name="l12534"></a><span class="lineno">12534</span>&#160;    <span class="comment">// 3. Try to allocate from existing blocks with making other allocations lost.</span></div>
-<div class="line"><a name="l12535"></a><span class="lineno">12535</span>&#160;    <span class="keywordflow">if</span>(canMakeOtherLost)</div>
-<div class="line"><a name="l12536"></a><span class="lineno">12536</span>&#160;    {</div>
-<div class="line"><a name="l12537"></a><span class="lineno">12537</span>&#160;        uint32_t tryIndex = 0;</div>
-<div class="line"><a name="l12538"></a><span class="lineno">12538</span>&#160;        <span class="keywordflow">for</span>(; tryIndex &lt; VMA_ALLOCATION_TRY_COUNT; ++tryIndex)</div>
-<div class="line"><a name="l12539"></a><span class="lineno">12539</span>&#160;        {</div>
-<div class="line"><a name="l12540"></a><span class="lineno">12540</span>&#160;            VmaDeviceMemoryBlock* pBestRequestBlock = VMA_NULL;</div>
-<div class="line"><a name="l12541"></a><span class="lineno">12541</span>&#160;            VmaAllocationRequest bestRequest = {};</div>
-<div class="line"><a name="l12542"></a><span class="lineno">12542</span>&#160;            VkDeviceSize bestRequestCost = VK_WHOLE_SIZE;</div>
-<div class="line"><a name="l12543"></a><span class="lineno">12543</span>&#160; </div>
-<div class="line"><a name="l12544"></a><span class="lineno">12544</span>&#160;            <span class="comment">// 1. Search existing allocations.</span></div>
-<div class="line"><a name="l12545"></a><span class="lineno">12545</span>&#160;            <span class="keywordflow">if</span>(strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>)</div>
-<div class="line"><a name="l12546"></a><span class="lineno">12546</span>&#160;            {</div>
-<div class="line"><a name="l12547"></a><span class="lineno">12547</span>&#160;                <span class="comment">// Forward order in m_Blocks - prefer blocks with smallest amount of free space.</span></div>
-<div class="line"><a name="l12548"></a><span class="lineno">12548</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex )</div>
-<div class="line"><a name="l12549"></a><span class="lineno">12549</span>&#160;                {</div>
-<div class="line"><a name="l12550"></a><span class="lineno">12550</span>&#160;                    VmaDeviceMemoryBlock* <span class="keyword">const</span> pCurrBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l12551"></a><span class="lineno">12551</span>&#160;                    VMA_ASSERT(pCurrBlock);</div>
-<div class="line"><a name="l12552"></a><span class="lineno">12552</span>&#160;                    VmaAllocationRequest currRequest = {};</div>
-<div class="line"><a name="l12553"></a><span class="lineno">12553</span>&#160;                    <span class="keywordflow">if</span>(pCurrBlock-&gt;m_pMetadata-&gt;CreateAllocationRequest(</div>
-<div class="line"><a name="l12554"></a><span class="lineno">12554</span>&#160;                        currentFrameIndex,</div>
-<div class="line"><a name="l12555"></a><span class="lineno">12555</span>&#160;                        m_FrameInUseCount,</div>
-<div class="line"><a name="l12556"></a><span class="lineno">12556</span>&#160;                        m_BufferImageGranularity,</div>
-<div class="line"><a name="l12557"></a><span class="lineno">12557</span>&#160;                        size,</div>
-<div class="line"><a name="l12558"></a><span class="lineno">12558</span>&#160;                        alignment,</div>
-<div class="line"><a name="l12559"></a><span class="lineno">12559</span>&#160;                        (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a>) != 0,</div>
-<div class="line"><a name="l12560"></a><span class="lineno">12560</span>&#160;                        suballocType,</div>
-<div class="line"><a name="l12561"></a><span class="lineno">12561</span>&#160;                        canMakeOtherLost,</div>
-<div class="line"><a name="l12562"></a><span class="lineno">12562</span>&#160;                        strategy,</div>
-<div class="line"><a name="l12563"></a><span class="lineno">12563</span>&#160;                        &amp;currRequest))</div>
-<div class="line"><a name="l12564"></a><span class="lineno">12564</span>&#160;                    {</div>
-<div class="line"><a name="l12565"></a><span class="lineno">12565</span>&#160;                        <span class="keyword">const</span> VkDeviceSize currRequestCost = currRequest.CalcCost();</div>
-<div class="line"><a name="l12566"></a><span class="lineno">12566</span>&#160;                        <span class="keywordflow">if</span>(pBestRequestBlock == VMA_NULL ||</div>
-<div class="line"><a name="l12567"></a><span class="lineno">12567</span>&#160;                            currRequestCost &lt; bestRequestCost)</div>
-<div class="line"><a name="l12568"></a><span class="lineno">12568</span>&#160;                        {</div>
-<div class="line"><a name="l12569"></a><span class="lineno">12569</span>&#160;                            pBestRequestBlock = pCurrBlock;</div>
-<div class="line"><a name="l12570"></a><span class="lineno">12570</span>&#160;                            bestRequest = currRequest;</div>
-<div class="line"><a name="l12571"></a><span class="lineno">12571</span>&#160;                            bestRequestCost = currRequestCost;</div>
-<div class="line"><a name="l12572"></a><span class="lineno">12572</span>&#160; </div>
-<div class="line"><a name="l12573"></a><span class="lineno">12573</span>&#160;                            <span class="keywordflow">if</span>(bestRequestCost == 0)</div>
-<div class="line"><a name="l12574"></a><span class="lineno">12574</span>&#160;                            {</div>
-<div class="line"><a name="l12575"></a><span class="lineno">12575</span>&#160;                                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l12576"></a><span class="lineno">12576</span>&#160;                            }</div>
-<div class="line"><a name="l12577"></a><span class="lineno">12577</span>&#160;                        }</div>
-<div class="line"><a name="l12578"></a><span class="lineno">12578</span>&#160;                    }</div>
-<div class="line"><a name="l12579"></a><span class="lineno">12579</span>&#160;                }</div>
-<div class="line"><a name="l12580"></a><span class="lineno">12580</span>&#160;            }</div>
-<div class="line"><a name="l12581"></a><span class="lineno">12581</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// WORST_FIT, FIRST_FIT</span></div>
-<div class="line"><a name="l12582"></a><span class="lineno">12582</span>&#160;            {</div>
-<div class="line"><a name="l12583"></a><span class="lineno">12583</span>&#160;                <span class="comment">// Backward order in m_Blocks - prefer blocks with largest amount of free space.</span></div>
-<div class="line"><a name="l12584"></a><span class="lineno">12584</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = m_Blocks.size(); blockIndex--; )</div>
-<div class="line"><a name="l12585"></a><span class="lineno">12585</span>&#160;                {</div>
-<div class="line"><a name="l12586"></a><span class="lineno">12586</span>&#160;                    VmaDeviceMemoryBlock* <span class="keyword">const</span> pCurrBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l12587"></a><span class="lineno">12587</span>&#160;                    VMA_ASSERT(pCurrBlock);</div>
-<div class="line"><a name="l12588"></a><span class="lineno">12588</span>&#160;                    VmaAllocationRequest currRequest = {};</div>
-<div class="line"><a name="l12589"></a><span class="lineno">12589</span>&#160;                    <span class="keywordflow">if</span>(pCurrBlock-&gt;m_pMetadata-&gt;CreateAllocationRequest(</div>
-<div class="line"><a name="l12590"></a><span class="lineno">12590</span>&#160;                        currentFrameIndex,</div>
-<div class="line"><a name="l12591"></a><span class="lineno">12591</span>&#160;                        m_FrameInUseCount,</div>
-<div class="line"><a name="l12592"></a><span class="lineno">12592</span>&#160;                        m_BufferImageGranularity,</div>
-<div class="line"><a name="l12593"></a><span class="lineno">12593</span>&#160;                        size,</div>
-<div class="line"><a name="l12594"></a><span class="lineno">12594</span>&#160;                        alignment,</div>
-<div class="line"><a name="l12595"></a><span class="lineno">12595</span>&#160;                        (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a>) != 0,</div>
-<div class="line"><a name="l12596"></a><span class="lineno">12596</span>&#160;                        suballocType,</div>
-<div class="line"><a name="l12597"></a><span class="lineno">12597</span>&#160;                        canMakeOtherLost,</div>
-<div class="line"><a name="l12598"></a><span class="lineno">12598</span>&#160;                        strategy,</div>
-<div class="line"><a name="l12599"></a><span class="lineno">12599</span>&#160;                        &amp;currRequest))</div>
-<div class="line"><a name="l12600"></a><span class="lineno">12600</span>&#160;                    {</div>
-<div class="line"><a name="l12601"></a><span class="lineno">12601</span>&#160;                        <span class="keyword">const</span> VkDeviceSize currRequestCost = currRequest.CalcCost();</div>
-<div class="line"><a name="l12602"></a><span class="lineno">12602</span>&#160;                        <span class="keywordflow">if</span>(pBestRequestBlock == VMA_NULL ||</div>
-<div class="line"><a name="l12603"></a><span class="lineno">12603</span>&#160;                            currRequestCost &lt; bestRequestCost ||</div>
-<div class="line"><a name="l12604"></a><span class="lineno">12604</span>&#160;                            strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>)</div>
-<div class="line"><a name="l12605"></a><span class="lineno">12605</span>&#160;                        {</div>
-<div class="line"><a name="l12606"></a><span class="lineno">12606</span>&#160;                            pBestRequestBlock = pCurrBlock;</div>
-<div class="line"><a name="l12607"></a><span class="lineno">12607</span>&#160;                            bestRequest = currRequest;</div>
-<div class="line"><a name="l12608"></a><span class="lineno">12608</span>&#160;                            bestRequestCost = currRequestCost;</div>
-<div class="line"><a name="l12609"></a><span class="lineno">12609</span>&#160; </div>
-<div class="line"><a name="l12610"></a><span class="lineno">12610</span>&#160;                            <span class="keywordflow">if</span>(bestRequestCost == 0 ||</div>
-<div class="line"><a name="l12611"></a><span class="lineno">12611</span>&#160;                                strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>)</div>
-<div class="line"><a name="l12612"></a><span class="lineno">12612</span>&#160;                            {</div>
-<div class="line"><a name="l12613"></a><span class="lineno">12613</span>&#160;                                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l12614"></a><span class="lineno">12614</span>&#160;                            }</div>
-<div class="line"><a name="l12615"></a><span class="lineno">12615</span>&#160;                        }</div>
-<div class="line"><a name="l12616"></a><span class="lineno">12616</span>&#160;                    }</div>
-<div class="line"><a name="l12617"></a><span class="lineno">12617</span>&#160;                }</div>
-<div class="line"><a name="l12618"></a><span class="lineno">12618</span>&#160;            }</div>
-<div class="line"><a name="l12619"></a><span class="lineno">12619</span>&#160; </div>
-<div class="line"><a name="l12620"></a><span class="lineno">12620</span>&#160;            <span class="keywordflow">if</span>(pBestRequestBlock != VMA_NULL)</div>
-<div class="line"><a name="l12621"></a><span class="lineno">12621</span>&#160;            {</div>
-<div class="line"><a name="l12622"></a><span class="lineno">12622</span>&#160;                <span class="keywordflow">if</span>(mapped)</div>
-<div class="line"><a name="l12623"></a><span class="lineno">12623</span>&#160;                {</div>
-<div class="line"><a name="l12624"></a><span class="lineno">12624</span>&#160;                    VkResult res = pBestRequestBlock-&gt;Map(m_hAllocator, 1, VMA_NULL);</div>
-<div class="line"><a name="l12625"></a><span class="lineno">12625</span>&#160;                    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
-<div class="line"><a name="l12626"></a><span class="lineno">12626</span>&#160;                    {</div>
-<div class="line"><a name="l12627"></a><span class="lineno">12627</span>&#160;                        <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l12628"></a><span class="lineno">12628</span>&#160;                    }</div>
-<div class="line"><a name="l12629"></a><span class="lineno">12629</span>&#160;                }</div>
-<div class="line"><a name="l12630"></a><span class="lineno">12630</span>&#160; </div>
-<div class="line"><a name="l12631"></a><span class="lineno">12631</span>&#160;                <span class="keywordflow">if</span>(pBestRequestBlock-&gt;m_pMetadata-&gt;MakeRequestedAllocationsLost(</div>
-<div class="line"><a name="l12632"></a><span class="lineno">12632</span>&#160;                    currentFrameIndex,</div>
-<div class="line"><a name="l12633"></a><span class="lineno">12633</span>&#160;                    m_FrameInUseCount,</div>
-<div class="line"><a name="l12634"></a><span class="lineno">12634</span>&#160;                    &amp;bestRequest))</div>
-<div class="line"><a name="l12635"></a><span class="lineno">12635</span>&#160;                {</div>
-<div class="line"><a name="l12636"></a><span class="lineno">12636</span>&#160;                    <span class="comment">// Allocate from this pBlock.</span></div>
-<div class="line"><a name="l12637"></a><span class="lineno">12637</span>&#160;                    *pAllocation = m_hAllocator-&gt;m_AllocationObjectAllocator.Allocate(currentFrameIndex, isUserDataString);</div>
-<div class="line"><a name="l12638"></a><span class="lineno">12638</span>&#160;                    pBestRequestBlock-&gt;m_pMetadata-&gt;Alloc(bestRequest, suballocType, size, *pAllocation);</div>
-<div class="line"><a name="l12639"></a><span class="lineno">12639</span>&#160;                    UpdateHasEmptyBlock();</div>
-<div class="line"><a name="l12640"></a><span class="lineno">12640</span>&#160;                    (*pAllocation)-&gt;InitBlockAllocation(</div>
-<div class="line"><a name="l12641"></a><span class="lineno">12641</span>&#160;                        pBestRequestBlock,</div>
-<div class="line"><a name="l12642"></a><span class="lineno">12642</span>&#160;                        bestRequest.offset,</div>
-<div class="line"><a name="l12643"></a><span class="lineno">12643</span>&#160;                        alignment,</div>
-<div class="line"><a name="l12644"></a><span class="lineno">12644</span>&#160;                        size,</div>
-<div class="line"><a name="l12645"></a><span class="lineno">12645</span>&#160;                        m_MemoryTypeIndex,</div>
-<div class="line"><a name="l12646"></a><span class="lineno">12646</span>&#160;                        suballocType,</div>
-<div class="line"><a name="l12647"></a><span class="lineno">12647</span>&#160;                        mapped,</div>
-<div class="line"><a name="l12648"></a><span class="lineno">12648</span>&#160;                        (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a>) != 0);</div>
-<div class="line"><a name="l12649"></a><span class="lineno">12649</span>&#160;                    VMA_HEAVY_ASSERT(pBestRequestBlock-&gt;Validate());</div>
-<div class="line"><a name="l12650"></a><span class="lineno">12650</span>&#160;                    VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Returned from existing block&quot;</span>);</div>
-<div class="line"><a name="l12651"></a><span class="lineno">12651</span>&#160;                    (*pAllocation)-&gt;SetUserData(m_hAllocator, createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
-<div class="line"><a name="l12652"></a><span class="lineno">12652</span>&#160;                    m_hAllocator-&gt;m_Budget.AddAllocation(m_hAllocator-&gt;MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex), size);</div>
-<div class="line"><a name="l12653"></a><span class="lineno">12653</span>&#160;                    <span class="keywordflow">if</span>(VMA_DEBUG_INITIALIZE_ALLOCATIONS)</div>
-<div class="line"><a name="l12654"></a><span class="lineno">12654</span>&#160;                    {</div>
-<div class="line"><a name="l12655"></a><span class="lineno">12655</span>&#160;                        m_hAllocator-&gt;FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);</div>
-<div class="line"><a name="l12656"></a><span class="lineno">12656</span>&#160;                    }</div>
-<div class="line"><a name="l12657"></a><span class="lineno">12657</span>&#160;                    <span class="keywordflow">if</span>(IsCorruptionDetectionEnabled())</div>
-<div class="line"><a name="l12658"></a><span class="lineno">12658</span>&#160;                    {</div>
-<div class="line"><a name="l12659"></a><span class="lineno">12659</span>&#160;                        VkResult res = pBestRequestBlock-&gt;WriteMagicValueAroundAllocation(m_hAllocator, bestRequest.offset, size);</div>
-<div class="line"><a name="l12660"></a><span class="lineno">12660</span>&#160;                        VMA_ASSERT(res == VK_SUCCESS &amp;&amp; <span class="stringliteral">&quot;Couldn&#39;t map block memory to write magic value.&quot;</span>);</div>
-<div class="line"><a name="l12661"></a><span class="lineno">12661</span>&#160;                    }</div>
-<div class="line"><a name="l12662"></a><span class="lineno">12662</span>&#160;                    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l12663"></a><span class="lineno">12663</span>&#160;                }</div>
-<div class="line"><a name="l12664"></a><span class="lineno">12664</span>&#160;                <span class="comment">// else: Some allocations must have been touched while we are here. Next try.</span></div>
-<div class="line"><a name="l12665"></a><span class="lineno">12665</span>&#160;            }</div>
-<div class="line"><a name="l12666"></a><span class="lineno">12666</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l12667"></a><span class="lineno">12667</span>&#160;            {</div>
-<div class="line"><a name="l12668"></a><span class="lineno">12668</span>&#160;                <span class="comment">// Could not find place in any of the blocks - break outer loop.</span></div>
-<div class="line"><a name="l12669"></a><span class="lineno">12669</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l12670"></a><span class="lineno">12670</span>&#160;            }</div>
-<div class="line"><a name="l12671"></a><span class="lineno">12671</span>&#160;        }</div>
-<div class="line"><a name="l12672"></a><span class="lineno">12672</span>&#160;        <span class="comment">/* Maximum number of tries exceeded - a very unlike event when many other</span></div>
-<div class="line"><a name="l12673"></a><span class="lineno">12673</span>&#160;<span class="comment">        threads are simultaneously touching allocations making it impossible to make</span></div>
-<div class="line"><a name="l12674"></a><span class="lineno">12674</span>&#160;<span class="comment">        lost at the same time as we try to allocate. */</span></div>
-<div class="line"><a name="l12675"></a><span class="lineno">12675</span>&#160;        <span class="keywordflow">if</span>(tryIndex == VMA_ALLOCATION_TRY_COUNT)</div>
-<div class="line"><a name="l12676"></a><span class="lineno">12676</span>&#160;        {</div>
-<div class="line"><a name="l12677"></a><span class="lineno">12677</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_TOO_MANY_OBJECTS;</div>
-<div class="line"><a name="l12678"></a><span class="lineno">12678</span>&#160;        }</div>
-<div class="line"><a name="l12679"></a><span class="lineno">12679</span>&#160;    }</div>
-<div class="line"><a name="l12680"></a><span class="lineno">12680</span>&#160; </div>
-<div class="line"><a name="l12681"></a><span class="lineno">12681</span>&#160;    <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l12682"></a><span class="lineno">12682</span>&#160;}</div>
-<div class="line"><a name="l12683"></a><span class="lineno">12683</span>&#160; </div>
-<div class="line"><a name="l12684"></a><span class="lineno">12684</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::Free(</div>
-<div class="line"><a name="l12685"></a><span class="lineno">12685</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
-<div class="line"><a name="l12686"></a><span class="lineno">12686</span>&#160;{</div>
-<div class="line"><a name="l12687"></a><span class="lineno">12687</span>&#160;    VmaDeviceMemoryBlock* pBlockToDelete = VMA_NULL;</div>
-<div class="line"><a name="l12688"></a><span class="lineno">12688</span>&#160; </div>
-<div class="line"><a name="l12689"></a><span class="lineno">12689</span>&#160;    <span class="keywordtype">bool</span> budgetExceeded = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l12690"></a><span class="lineno">12690</span>&#160;    {</div>
-<div class="line"><a name="l12691"></a><span class="lineno">12691</span>&#160;        <span class="keyword">const</span> uint32_t heapIndex = m_hAllocator-&gt;MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex);</div>
-<div class="line"><a name="l12692"></a><span class="lineno">12692</span>&#160;        <a class="code" href="struct_vma_budget.html">VmaBudget</a> heapBudget = {};</div>
-<div class="line"><a name="l12693"></a><span class="lineno">12693</span>&#160;        m_hAllocator-&gt;GetBudget(&amp;heapBudget, heapIndex, 1);</div>
-<div class="line"><a name="l12694"></a><span class="lineno">12694</span>&#160;        budgetExceeded = heapBudget.<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> &gt;= heapBudget.<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a>;</div>
-<div class="line"><a name="l12695"></a><span class="lineno">12695</span>&#160;    }</div>
-<div class="line"><a name="l12696"></a><span class="lineno">12696</span>&#160; </div>
-<div class="line"><a name="l12697"></a><span class="lineno">12697</span>&#160;    <span class="comment">// Scope for lock.</span></div>
-<div class="line"><a name="l12698"></a><span class="lineno">12698</span>&#160;    {</div>
-<div class="line"><a name="l12699"></a><span class="lineno">12699</span>&#160;        VmaMutexLockWrite lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l12700"></a><span class="lineno">12700</span>&#160; </div>
-<div class="line"><a name="l12701"></a><span class="lineno">12701</span>&#160;        VmaDeviceMemoryBlock* pBlock = hAllocation-&gt;GetBlock();</div>
-<div class="line"><a name="l12702"></a><span class="lineno">12702</span>&#160; </div>
-<div class="line"><a name="l12703"></a><span class="lineno">12703</span>&#160;        <span class="keywordflow">if</span>(IsCorruptionDetectionEnabled())</div>
-<div class="line"><a name="l12704"></a><span class="lineno">12704</span>&#160;        {</div>
-<div class="line"><a name="l12705"></a><span class="lineno">12705</span>&#160;            VkResult res = pBlock-&gt;ValidateMagicValueAroundAllocation(m_hAllocator, hAllocation-&gt;GetOffset(), hAllocation-&gt;GetSize());</div>
-<div class="line"><a name="l12706"></a><span class="lineno">12706</span>&#160;            VMA_ASSERT(res == VK_SUCCESS &amp;&amp; <span class="stringliteral">&quot;Couldn&#39;t map block memory to validate magic value.&quot;</span>);</div>
-<div class="line"><a name="l12707"></a><span class="lineno">12707</span>&#160;        }</div>
-<div class="line"><a name="l12708"></a><span class="lineno">12708</span>&#160; </div>
-<div class="line"><a name="l12709"></a><span class="lineno">12709</span>&#160;        <span class="keywordflow">if</span>(hAllocation-&gt;IsPersistentMap())</div>
-<div class="line"><a name="l12710"></a><span class="lineno">12710</span>&#160;        {</div>
-<div class="line"><a name="l12711"></a><span class="lineno">12711</span>&#160;            pBlock-&gt;Unmap(m_hAllocator, 1);</div>
-<div class="line"><a name="l12712"></a><span class="lineno">12712</span>&#160;        }</div>
-<div class="line"><a name="l12713"></a><span class="lineno">12713</span>&#160; </div>
-<div class="line"><a name="l12714"></a><span class="lineno">12714</span>&#160;        pBlock-&gt;m_pMetadata-&gt;Free(hAllocation);</div>
-<div class="line"><a name="l12715"></a><span class="lineno">12715</span>&#160;        VMA_HEAVY_ASSERT(pBlock-&gt;Validate());</div>
-<div class="line"><a name="l12716"></a><span class="lineno">12716</span>&#160; </div>
-<div class="line"><a name="l12717"></a><span class="lineno">12717</span>&#160;        VMA_DEBUG_LOG(<span class="stringliteral">&quot;  Freed from MemoryTypeIndex=%u&quot;</span>, m_MemoryTypeIndex);</div>
-<div class="line"><a name="l12718"></a><span class="lineno">12718</span>&#160; </div>
-<div class="line"><a name="l12719"></a><span class="lineno">12719</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">bool</span> canDeleteBlock = m_Blocks.size() &gt; m_MinBlockCount;</div>
-<div class="line"><a name="l12720"></a><span class="lineno">12720</span>&#160;        <span class="comment">// pBlock became empty after this deallocation.</span></div>
-<div class="line"><a name="l12721"></a><span class="lineno">12721</span>&#160;        <span class="keywordflow">if</span>(pBlock-&gt;m_pMetadata-&gt;IsEmpty())</div>
-<div class="line"><a name="l12722"></a><span class="lineno">12722</span>&#160;        {</div>
-<div class="line"><a name="l12723"></a><span class="lineno">12723</span>&#160;            <span class="comment">// Already has empty block. We don&#39;t want to have two, so delete this one.</span></div>
-<div class="line"><a name="l12724"></a><span class="lineno">12724</span>&#160;            <span class="keywordflow">if</span>((m_HasEmptyBlock || budgetExceeded) &amp;&amp; canDeleteBlock)</div>
-<div class="line"><a name="l12725"></a><span class="lineno">12725</span>&#160;            {</div>
-<div class="line"><a name="l12726"></a><span class="lineno">12726</span>&#160;                pBlockToDelete = pBlock;</div>
-<div class="line"><a name="l12727"></a><span class="lineno">12727</span>&#160;                Remove(pBlock);</div>
-<div class="line"><a name="l12728"></a><span class="lineno">12728</span>&#160;            }</div>
-<div class="line"><a name="l12729"></a><span class="lineno">12729</span>&#160;            <span class="comment">// else: We now have an empty block - leave it.</span></div>
-<div class="line"><a name="l12730"></a><span class="lineno">12730</span>&#160;        }</div>
-<div class="line"><a name="l12731"></a><span class="lineno">12731</span>&#160;        <span class="comment">// pBlock didn&#39;t become empty, but we have another empty block - find and free that one.</span></div>
-<div class="line"><a name="l12732"></a><span class="lineno">12732</span>&#160;        <span class="comment">// (This is optional, heuristics.)</span></div>
-<div class="line"><a name="l12733"></a><span class="lineno">12733</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(m_HasEmptyBlock &amp;&amp; canDeleteBlock)</div>
-<div class="line"><a name="l12734"></a><span class="lineno">12734</span>&#160;        {</div>
-<div class="line"><a name="l12735"></a><span class="lineno">12735</span>&#160;            VmaDeviceMemoryBlock* pLastBlock = m_Blocks.back();</div>
-<div class="line"><a name="l12736"></a><span class="lineno">12736</span>&#160;            <span class="keywordflow">if</span>(pLastBlock-&gt;m_pMetadata-&gt;IsEmpty())</div>
-<div class="line"><a name="l12737"></a><span class="lineno">12737</span>&#160;            {</div>
-<div class="line"><a name="l12738"></a><span class="lineno">12738</span>&#160;                pBlockToDelete = pLastBlock;</div>
-<div class="line"><a name="l12739"></a><span class="lineno">12739</span>&#160;                m_Blocks.pop_back();</div>
-<div class="line"><a name="l12740"></a><span class="lineno">12740</span>&#160;            }</div>
-<div class="line"><a name="l12741"></a><span class="lineno">12741</span>&#160;        }</div>
-<div class="line"><a name="l12742"></a><span class="lineno">12742</span>&#160; </div>
-<div class="line"><a name="l12743"></a><span class="lineno">12743</span>&#160;        UpdateHasEmptyBlock();</div>
-<div class="line"><a name="l12744"></a><span class="lineno">12744</span>&#160;        IncrementallySortBlocks();</div>
-<div class="line"><a name="l12745"></a><span class="lineno">12745</span>&#160;    }</div>
-<div class="line"><a name="l12746"></a><span class="lineno">12746</span>&#160; </div>
-<div class="line"><a name="l12747"></a><span class="lineno">12747</span>&#160;    <span class="comment">// Destruction of a free block. Deferred until this point, outside of mutex</span></div>
-<div class="line"><a name="l12748"></a><span class="lineno">12748</span>&#160;    <span class="comment">// lock, for performance reason.</span></div>
-<div class="line"><a name="l12749"></a><span class="lineno">12749</span>&#160;    <span class="keywordflow">if</span>(pBlockToDelete != VMA_NULL)</div>
-<div class="line"><a name="l12750"></a><span class="lineno">12750</span>&#160;    {</div>
-<div class="line"><a name="l12751"></a><span class="lineno">12751</span>&#160;        VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Deleted empty block&quot;</span>);</div>
-<div class="line"><a name="l12752"></a><span class="lineno">12752</span>&#160;        pBlockToDelete-&gt;Destroy(m_hAllocator);</div>
-<div class="line"><a name="l12753"></a><span class="lineno">12753</span>&#160;        vma_delete(m_hAllocator, pBlockToDelete);</div>
-<div class="line"><a name="l12754"></a><span class="lineno">12754</span>&#160;    }</div>
-<div class="line"><a name="l12755"></a><span class="lineno">12755</span>&#160;}</div>
-<div class="line"><a name="l12756"></a><span class="lineno">12756</span>&#160; </div>
-<div class="line"><a name="l12757"></a><span class="lineno">12757</span>&#160;VkDeviceSize VmaBlockVector::CalcMaxBlockSize()<span class="keyword"> const</span></div>
-<div class="line"><a name="l12758"></a><span class="lineno">12758</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l12759"></a><span class="lineno">12759</span>&#160;    VkDeviceSize result = 0;</div>
-<div class="line"><a name="l12760"></a><span class="lineno">12760</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_Blocks.size(); i--; )</div>
-<div class="line"><a name="l12761"></a><span class="lineno">12761</span>&#160;    {</div>
-<div class="line"><a name="l12762"></a><span class="lineno">12762</span>&#160;        result = VMA_MAX(result, m_Blocks[i]-&gt;m_pMetadata-&gt;GetSize());</div>
-<div class="line"><a name="l12763"></a><span class="lineno">12763</span>&#160;        <span class="keywordflow">if</span>(result &gt;= m_PreferredBlockSize)</div>
-<div class="line"><a name="l12764"></a><span class="lineno">12764</span>&#160;        {</div>
-<div class="line"><a name="l12765"></a><span class="lineno">12765</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l12766"></a><span class="lineno">12766</span>&#160;        }</div>
-<div class="line"><a name="l12767"></a><span class="lineno">12767</span>&#160;    }</div>
-<div class="line"><a name="l12768"></a><span class="lineno">12768</span>&#160;    <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l12769"></a><span class="lineno">12769</span>&#160;}</div>
-<div class="line"><a name="l12770"></a><span class="lineno">12770</span>&#160; </div>
-<div class="line"><a name="l12771"></a><span class="lineno">12771</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::Remove(VmaDeviceMemoryBlock* pBlock)</div>
-<div class="line"><a name="l12772"></a><span class="lineno">12772</span>&#160;{</div>
-<div class="line"><a name="l12773"></a><span class="lineno">12773</span>&#160;    <span class="keywordflow">for</span>(uint32_t blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex)</div>
-<div class="line"><a name="l12774"></a><span class="lineno">12774</span>&#160;    {</div>
-<div class="line"><a name="l12775"></a><span class="lineno">12775</span>&#160;        <span class="keywordflow">if</span>(m_Blocks[blockIndex] == pBlock)</div>
-<div class="line"><a name="l12776"></a><span class="lineno">12776</span>&#160;        {</div>
-<div class="line"><a name="l12777"></a><span class="lineno">12777</span>&#160;            VmaVectorRemove(m_Blocks, blockIndex);</div>
-<div class="line"><a name="l12778"></a><span class="lineno">12778</span>&#160;            <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l12779"></a><span class="lineno">12779</span>&#160;        }</div>
-<div class="line"><a name="l12780"></a><span class="lineno">12780</span>&#160;    }</div>
-<div class="line"><a name="l12781"></a><span class="lineno">12781</span>&#160;    VMA_ASSERT(0);</div>
-<div class="line"><a name="l12782"></a><span class="lineno">12782</span>&#160;}</div>
-<div class="line"><a name="l12783"></a><span class="lineno">12783</span>&#160; </div>
-<div class="line"><a name="l12784"></a><span class="lineno">12784</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::IncrementallySortBlocks()</div>
-<div class="line"><a name="l12785"></a><span class="lineno">12785</span>&#160;{</div>
-<div class="line"><a name="l12786"></a><span class="lineno">12786</span>&#160;    <span class="keywordflow">if</span>(m_Algorithm != <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>)</div>
-<div class="line"><a name="l12787"></a><span class="lineno">12787</span>&#160;    {</div>
-<div class="line"><a name="l12788"></a><span class="lineno">12788</span>&#160;        <span class="comment">// Bubble sort only until first swap.</span></div>
-<div class="line"><a name="l12789"></a><span class="lineno">12789</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 1; i &lt; m_Blocks.size(); ++i)</div>
-<div class="line"><a name="l12790"></a><span class="lineno">12790</span>&#160;        {</div>
-<div class="line"><a name="l12791"></a><span class="lineno">12791</span>&#160;            <span class="keywordflow">if</span>(m_Blocks[i - 1]-&gt;m_pMetadata-&gt;GetSumFreeSize() &gt; m_Blocks[i]-&gt;m_pMetadata-&gt;GetSumFreeSize())</div>
-<div class="line"><a name="l12792"></a><span class="lineno">12792</span>&#160;            {</div>
-<div class="line"><a name="l12793"></a><span class="lineno">12793</span>&#160;                VMA_SWAP(m_Blocks[i - 1], m_Blocks[i]);</div>
-<div class="line"><a name="l12794"></a><span class="lineno">12794</span>&#160;                <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l12795"></a><span class="lineno">12795</span>&#160;            }</div>
-<div class="line"><a name="l12796"></a><span class="lineno">12796</span>&#160;        }</div>
-<div class="line"><a name="l12797"></a><span class="lineno">12797</span>&#160;    }</div>
-<div class="line"><a name="l12798"></a><span class="lineno">12798</span>&#160;}</div>
-<div class="line"><a name="l12799"></a><span class="lineno">12799</span>&#160; </div>
-<div class="line"><a name="l12800"></a><span class="lineno">12800</span>&#160;VkResult VmaBlockVector::AllocateFromBlock(</div>
-<div class="line"><a name="l12801"></a><span class="lineno">12801</span>&#160;    VmaDeviceMemoryBlock* pBlock,</div>
-<div class="line"><a name="l12802"></a><span class="lineno">12802</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l12803"></a><span class="lineno">12803</span>&#160;    VkDeviceSize size,</div>
-<div class="line"><a name="l12804"></a><span class="lineno">12804</span>&#160;    VkDeviceSize alignment,</div>
-<div class="line"><a name="l12805"></a><span class="lineno">12805</span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlags,</div>
-<div class="line"><a name="l12806"></a><span class="lineno">12806</span>&#160;    <span class="keywordtype">void</span>* pUserData,</div>
-<div class="line"><a name="l12807"></a><span class="lineno">12807</span>&#160;    VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l12808"></a><span class="lineno">12808</span>&#160;    uint32_t strategy,</div>
-<div class="line"><a name="l12809"></a><span class="lineno">12809</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation)</div>
-<div class="line"><a name="l12810"></a><span class="lineno">12810</span>&#160;{</div>
-<div class="line"><a name="l12811"></a><span class="lineno">12811</span>&#160;    VMA_ASSERT((allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a>) == 0);</div>
-<div class="line"><a name="l12812"></a><span class="lineno">12812</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isUpperAddress = (allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a>) != 0;</div>
-<div class="line"><a name="l12813"></a><span class="lineno">12813</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> mapped = (allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0;</div>
-<div class="line"><a name="l12814"></a><span class="lineno">12814</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isUserDataString = (allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a>) != 0;</div>
-<div class="line"><a name="l12815"></a><span class="lineno">12815</span>&#160; </div>
-<div class="line"><a name="l12816"></a><span class="lineno">12816</span>&#160;    VmaAllocationRequest currRequest = {};</div>
-<div class="line"><a name="l12817"></a><span class="lineno">12817</span>&#160;    <span class="keywordflow">if</span>(pBlock-&gt;m_pMetadata-&gt;CreateAllocationRequest(</div>
-<div class="line"><a name="l12818"></a><span class="lineno">12818</span>&#160;        currentFrameIndex,</div>
-<div class="line"><a name="l12819"></a><span class="lineno">12819</span>&#160;        m_FrameInUseCount,</div>
-<div class="line"><a name="l12820"></a><span class="lineno">12820</span>&#160;        m_BufferImageGranularity,</div>
-<div class="line"><a name="l12821"></a><span class="lineno">12821</span>&#160;        size,</div>
-<div class="line"><a name="l12822"></a><span class="lineno">12822</span>&#160;        alignment,</div>
-<div class="line"><a name="l12823"></a><span class="lineno">12823</span>&#160;        isUpperAddress,</div>
-<div class="line"><a name="l12824"></a><span class="lineno">12824</span>&#160;        suballocType,</div>
-<div class="line"><a name="l12825"></a><span class="lineno">12825</span>&#160;        <span class="keyword">false</span>, <span class="comment">// canMakeOtherLost</span></div>
-<div class="line"><a name="l12826"></a><span class="lineno">12826</span>&#160;        strategy,</div>
-<div class="line"><a name="l12827"></a><span class="lineno">12827</span>&#160;        &amp;currRequest))</div>
-<div class="line"><a name="l12828"></a><span class="lineno">12828</span>&#160;    {</div>
-<div class="line"><a name="l12829"></a><span class="lineno">12829</span>&#160;        <span class="comment">// Allocate from pCurrBlock.</span></div>
-<div class="line"><a name="l12830"></a><span class="lineno">12830</span>&#160;        VMA_ASSERT(currRequest.itemsToMakeLostCount == 0);</div>
-<div class="line"><a name="l12831"></a><span class="lineno">12831</span>&#160; </div>
-<div class="line"><a name="l12832"></a><span class="lineno">12832</span>&#160;        <span class="keywordflow">if</span>(mapped)</div>
-<div class="line"><a name="l12833"></a><span class="lineno">12833</span>&#160;        {</div>
-<div class="line"><a name="l12834"></a><span class="lineno">12834</span>&#160;            VkResult res = pBlock-&gt;Map(m_hAllocator, 1, VMA_NULL);</div>
-<div class="line"><a name="l12835"></a><span class="lineno">12835</span>&#160;            <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
-<div class="line"><a name="l12836"></a><span class="lineno">12836</span>&#160;            {</div>
-<div class="line"><a name="l12837"></a><span class="lineno">12837</span>&#160;                <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l12838"></a><span class="lineno">12838</span>&#160;            }</div>
-<div class="line"><a name="l12839"></a><span class="lineno">12839</span>&#160;        }</div>
-<div class="line"><a name="l12840"></a><span class="lineno">12840</span>&#160;            </div>
-<div class="line"><a name="l12841"></a><span class="lineno">12841</span>&#160;        *pAllocation = m_hAllocator-&gt;m_AllocationObjectAllocator.Allocate(currentFrameIndex, isUserDataString);</div>
-<div class="line"><a name="l12842"></a><span class="lineno">12842</span>&#160;        pBlock-&gt;m_pMetadata-&gt;Alloc(currRequest, suballocType, size, *pAllocation);</div>
-<div class="line"><a name="l12843"></a><span class="lineno">12843</span>&#160;        UpdateHasEmptyBlock();</div>
-<div class="line"><a name="l12844"></a><span class="lineno">12844</span>&#160;        (*pAllocation)-&gt;InitBlockAllocation(</div>
-<div class="line"><a name="l12845"></a><span class="lineno">12845</span>&#160;            pBlock,</div>
-<div class="line"><a name="l12846"></a><span class="lineno">12846</span>&#160;            currRequest.offset,</div>
-<div class="line"><a name="l12847"></a><span class="lineno">12847</span>&#160;            alignment,</div>
-<div class="line"><a name="l12848"></a><span class="lineno">12848</span>&#160;            size,</div>
-<div class="line"><a name="l12849"></a><span class="lineno">12849</span>&#160;            m_MemoryTypeIndex,</div>
-<div class="line"><a name="l12850"></a><span class="lineno">12850</span>&#160;            suballocType,</div>
-<div class="line"><a name="l12851"></a><span class="lineno">12851</span>&#160;            mapped,</div>
-<div class="line"><a name="l12852"></a><span class="lineno">12852</span>&#160;            (allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a>) != 0);</div>
-<div class="line"><a name="l12853"></a><span class="lineno">12853</span>&#160;        VMA_HEAVY_ASSERT(pBlock-&gt;Validate());</div>
-<div class="line"><a name="l12854"></a><span class="lineno">12854</span>&#160;        (*pAllocation)-&gt;SetUserData(m_hAllocator, pUserData);</div>
-<div class="line"><a name="l12855"></a><span class="lineno">12855</span>&#160;        m_hAllocator-&gt;m_Budget.AddAllocation(m_hAllocator-&gt;MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex), size);</div>
-<div class="line"><a name="l12856"></a><span class="lineno">12856</span>&#160;        <span class="keywordflow">if</span>(VMA_DEBUG_INITIALIZE_ALLOCATIONS)</div>
-<div class="line"><a name="l12857"></a><span class="lineno">12857</span>&#160;        {</div>
-<div class="line"><a name="l12858"></a><span class="lineno">12858</span>&#160;            m_hAllocator-&gt;FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);</div>
-<div class="line"><a name="l12859"></a><span class="lineno">12859</span>&#160;        }</div>
-<div class="line"><a name="l12860"></a><span class="lineno">12860</span>&#160;        <span class="keywordflow">if</span>(IsCorruptionDetectionEnabled())</div>
-<div class="line"><a name="l12861"></a><span class="lineno">12861</span>&#160;        {</div>
-<div class="line"><a name="l12862"></a><span class="lineno">12862</span>&#160;            VkResult res = pBlock-&gt;WriteMagicValueAroundAllocation(m_hAllocator, currRequest.offset, size);</div>
-<div class="line"><a name="l12863"></a><span class="lineno">12863</span>&#160;            VMA_ASSERT(res == VK_SUCCESS &amp;&amp; <span class="stringliteral">&quot;Couldn&#39;t map block memory to write magic value.&quot;</span>);</div>
-<div class="line"><a name="l12864"></a><span class="lineno">12864</span>&#160;        }</div>
-<div class="line"><a name="l12865"></a><span class="lineno">12865</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l12866"></a><span class="lineno">12866</span>&#160;    }</div>
-<div class="line"><a name="l12867"></a><span class="lineno">12867</span>&#160;    <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l12868"></a><span class="lineno">12868</span>&#160;}</div>
-<div class="line"><a name="l12869"></a><span class="lineno">12869</span>&#160; </div>
-<div class="line"><a name="l12870"></a><span class="lineno">12870</span>&#160;VkResult VmaBlockVector::CreateBlock(VkDeviceSize blockSize, <span class="keywordtype">size_t</span>* pNewBlockIndex)</div>
-<div class="line"><a name="l12871"></a><span class="lineno">12871</span>&#160;{</div>
-<div class="line"><a name="l12872"></a><span class="lineno">12872</span>&#160;    VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };</div>
-<div class="line"><a name="l12873"></a><span class="lineno">12873</span>&#160;    allocInfo.memoryTypeIndex = m_MemoryTypeIndex;</div>
-<div class="line"><a name="l12874"></a><span class="lineno">12874</span>&#160;    allocInfo.allocationSize = blockSize;</div>
-<div class="line"><a name="l12875"></a><span class="lineno">12875</span>&#160; </div>
-<div class="line"><a name="l12876"></a><span class="lineno">12876</span>&#160;<span class="preprocessor">#if VMA_BUFFER_DEVICE_ADDRESS</span></div>
-<div class="line"><a name="l12877"></a><span class="lineno">12877</span>&#160;    <span class="comment">// Every standalone block can potentially contain a buffer with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT - always enable the feature.</span></div>
-<div class="line"><a name="l12878"></a><span class="lineno">12878</span>&#160;    VkMemoryAllocateFlagsInfoKHR allocFlagsInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR };</div>
-<div class="line"><a name="l12879"></a><span class="lineno">12879</span>&#160;    <span class="keywordflow">if</span>(m_hAllocator-&gt;m_UseKhrBufferDeviceAddress)</div>
-<div class="line"><a name="l12880"></a><span class="lineno">12880</span>&#160;    {</div>
-<div class="line"><a name="l12881"></a><span class="lineno">12881</span>&#160;        allocFlagsInfo.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;</div>
-<div class="line"><a name="l12882"></a><span class="lineno">12882</span>&#160;        VmaPnextChainPushFront(&amp;allocInfo, &amp;allocFlagsInfo);</div>
-<div class="line"><a name="l12883"></a><span class="lineno">12883</span>&#160;    }</div>
-<div class="line"><a name="l12884"></a><span class="lineno">12884</span>&#160;<span class="preprocessor">#endif // #if VMA_BUFFER_DEVICE_ADDRESS</span></div>
-<div class="line"><a name="l12885"></a><span class="lineno">12885</span>&#160; </div>
-<div class="line"><a name="l12886"></a><span class="lineno">12886</span>&#160;    VkDeviceMemory mem = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l12887"></a><span class="lineno">12887</span>&#160;    VkResult res = m_hAllocator-&gt;AllocateVulkanMemory(&amp;allocInfo, &amp;mem);</div>
-<div class="line"><a name="l12888"></a><span class="lineno">12888</span>&#160;    <span class="keywordflow">if</span>(res &lt; 0)</div>
-<div class="line"><a name="l12889"></a><span class="lineno">12889</span>&#160;    {</div>
-<div class="line"><a name="l12890"></a><span class="lineno">12890</span>&#160;        <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l12891"></a><span class="lineno">12891</span>&#160;    }</div>
-<div class="line"><a name="l12892"></a><span class="lineno">12892</span>&#160; </div>
-<div class="line"><a name="l12893"></a><span class="lineno">12893</span>&#160;    <span class="comment">// New VkDeviceMemory successfully created.</span></div>
-<div class="line"><a name="l12894"></a><span class="lineno">12894</span>&#160; </div>
-<div class="line"><a name="l12895"></a><span class="lineno">12895</span>&#160;    <span class="comment">// Create new Allocation for it.</span></div>
-<div class="line"><a name="l12896"></a><span class="lineno">12896</span>&#160;    VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = vma_new(m_hAllocator, VmaDeviceMemoryBlock)(m_hAllocator);</div>
-<div class="line"><a name="l12897"></a><span class="lineno">12897</span>&#160;    pBlock-&gt;Init(</div>
-<div class="line"><a name="l12898"></a><span class="lineno">12898</span>&#160;        m_hAllocator,</div>
-<div class="line"><a name="l12899"></a><span class="lineno">12899</span>&#160;        m_hParentPool,</div>
-<div class="line"><a name="l12900"></a><span class="lineno">12900</span>&#160;        m_MemoryTypeIndex,</div>
-<div class="line"><a name="l12901"></a><span class="lineno">12901</span>&#160;        mem,</div>
-<div class="line"><a name="l12902"></a><span class="lineno">12902</span>&#160;        allocInfo.allocationSize,</div>
-<div class="line"><a name="l12903"></a><span class="lineno">12903</span>&#160;        m_NextBlockId++,</div>
-<div class="line"><a name="l12904"></a><span class="lineno">12904</span>&#160;        m_Algorithm);</div>
-<div class="line"><a name="l12905"></a><span class="lineno">12905</span>&#160; </div>
-<div class="line"><a name="l12906"></a><span class="lineno">12906</span>&#160;    m_Blocks.push_back(pBlock);</div>
-<div class="line"><a name="l12907"></a><span class="lineno">12907</span>&#160;    <span class="keywordflow">if</span>(pNewBlockIndex != VMA_NULL)</div>
-<div class="line"><a name="l12908"></a><span class="lineno">12908</span>&#160;    {</div>
-<div class="line"><a name="l12909"></a><span class="lineno">12909</span>&#160;        *pNewBlockIndex = m_Blocks.size() - 1;</div>
-<div class="line"><a name="l12910"></a><span class="lineno">12910</span>&#160;    }</div>
+<div class="line"><a name="l12534"></a><span class="lineno">12534</span>&#160;VkResult VmaBlockVector::AllocatePage(</div>
+<div class="line"><a name="l12535"></a><span class="lineno">12535</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l12536"></a><span class="lineno">12536</span>&#160;    VkDeviceSize size,</div>
+<div class="line"><a name="l12537"></a><span class="lineno">12537</span>&#160;    VkDeviceSize alignment,</div>
+<div class="line"><a name="l12538"></a><span class="lineno">12538</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l12539"></a><span class="lineno">12539</span>&#160;    VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l12540"></a><span class="lineno">12540</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation)</div>
+<div class="line"><a name="l12541"></a><span class="lineno">12541</span>&#160;{</div>
+<div class="line"><a name="l12542"></a><span class="lineno">12542</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isUpperAddress = (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a>) != 0;</div>
+<div class="line"><a name="l12543"></a><span class="lineno">12543</span>&#160;    <span class="keywordtype">bool</span> canMakeOtherLost = (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a>) != 0;</div>
+<div class="line"><a name="l12544"></a><span class="lineno">12544</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> mapped = (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0;</div>
+<div class="line"><a name="l12545"></a><span class="lineno">12545</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isUserDataString = (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a>) != 0;</div>
+<div class="line"><a name="l12546"></a><span class="lineno">12546</span>&#160;    </div>
+<div class="line"><a name="l12547"></a><span class="lineno">12547</span>&#160;    VkDeviceSize freeMemory;</div>
+<div class="line"><a name="l12548"></a><span class="lineno">12548</span>&#160;    {</div>
+<div class="line"><a name="l12549"></a><span class="lineno">12549</span>&#160;        <span class="keyword">const</span> uint32_t heapIndex = m_hAllocator-&gt;MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex);</div>
+<div class="line"><a name="l12550"></a><span class="lineno">12550</span>&#160;        <a class="code" href="struct_vma_budget.html">VmaBudget</a> heapBudget = {};</div>
+<div class="line"><a name="l12551"></a><span class="lineno">12551</span>&#160;        m_hAllocator-&gt;GetBudget(&amp;heapBudget, heapIndex, 1);</div>
+<div class="line"><a name="l12552"></a><span class="lineno">12552</span>&#160;        freeMemory = (heapBudget.<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> &lt; heapBudget.<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a>) ? (heapBudget.<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a> - heapBudget.<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a>) : 0;</div>
+<div class="line"><a name="l12553"></a><span class="lineno">12553</span>&#160;    }</div>
+<div class="line"><a name="l12554"></a><span class="lineno">12554</span>&#160;    </div>
+<div class="line"><a name="l12555"></a><span class="lineno">12555</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> canFallbackToDedicated = !IsCustomPool();</div>
+<div class="line"><a name="l12556"></a><span class="lineno">12556</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> canCreateNewBlock =</div>
+<div class="line"><a name="l12557"></a><span class="lineno">12557</span>&#160;        ((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) == 0) &amp;&amp;</div>
+<div class="line"><a name="l12558"></a><span class="lineno">12558</span>&#160;        (m_Blocks.size() &lt; m_MaxBlockCount) &amp;&amp;</div>
+<div class="line"><a name="l12559"></a><span class="lineno">12559</span>&#160;        (freeMemory &gt;= size || !canFallbackToDedicated);</div>
+<div class="line"><a name="l12560"></a><span class="lineno">12560</span>&#160;    uint32_t strategy = createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e">VMA_ALLOCATION_CREATE_STRATEGY_MASK</a>;</div>
+<div class="line"><a name="l12561"></a><span class="lineno">12561</span>&#160; </div>
+<div class="line"><a name="l12562"></a><span class="lineno">12562</span>&#160;    <span class="comment">// If linearAlgorithm is used, canMakeOtherLost is available only when used as ring buffer.</span></div>
+<div class="line"><a name="l12563"></a><span class="lineno">12563</span>&#160;    <span class="comment">// Which in turn is available only when maxBlockCount = 1.</span></div>
+<div class="line"><a name="l12564"></a><span class="lineno">12564</span>&#160;    <span class="keywordflow">if</span>(m_Algorithm == <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a> &amp;&amp; m_MaxBlockCount &gt; 1)</div>
+<div class="line"><a name="l12565"></a><span class="lineno">12565</span>&#160;    {</div>
+<div class="line"><a name="l12566"></a><span class="lineno">12566</span>&#160;        canMakeOtherLost = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l12567"></a><span class="lineno">12567</span>&#160;    }</div>
+<div class="line"><a name="l12568"></a><span class="lineno">12568</span>&#160; </div>
+<div class="line"><a name="l12569"></a><span class="lineno">12569</span>&#160;    <span class="comment">// Upper address can only be used with linear allocator and within single memory block.</span></div>
+<div class="line"><a name="l12570"></a><span class="lineno">12570</span>&#160;    <span class="keywordflow">if</span>(isUpperAddress &amp;&amp;</div>
+<div class="line"><a name="l12571"></a><span class="lineno">12571</span>&#160;        (m_Algorithm != <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a> || m_MaxBlockCount &gt; 1))</div>
+<div class="line"><a name="l12572"></a><span class="lineno">12572</span>&#160;    {</div>
+<div class="line"><a name="l12573"></a><span class="lineno">12573</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT;</div>
+<div class="line"><a name="l12574"></a><span class="lineno">12574</span>&#160;    }</div>
+<div class="line"><a name="l12575"></a><span class="lineno">12575</span>&#160; </div>
+<div class="line"><a name="l12576"></a><span class="lineno">12576</span>&#160;    <span class="comment">// Validate strategy.</span></div>
+<div class="line"><a name="l12577"></a><span class="lineno">12577</span>&#160;    <span class="keywordflow">switch</span>(strategy)</div>
+<div class="line"><a name="l12578"></a><span class="lineno">12578</span>&#160;    {</div>
+<div class="line"><a name="l12579"></a><span class="lineno">12579</span>&#160;    <span class="keywordflow">case</span> 0:</div>
+<div class="line"><a name="l12580"></a><span class="lineno">12580</span>&#160;        strategy = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>;</div>
+<div class="line"><a name="l12581"></a><span class="lineno">12581</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12582"></a><span class="lineno">12582</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>:</div>
+<div class="line"><a name="l12583"></a><span class="lineno">12583</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a>:</div>
+<div class="line"><a name="l12584"></a><span class="lineno">12584</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>:</div>
+<div class="line"><a name="l12585"></a><span class="lineno">12585</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12586"></a><span class="lineno">12586</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l12587"></a><span class="lineno">12587</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT;</div>
+<div class="line"><a name="l12588"></a><span class="lineno">12588</span>&#160;    }</div>
+<div class="line"><a name="l12589"></a><span class="lineno">12589</span>&#160; </div>
+<div class="line"><a name="l12590"></a><span class="lineno">12590</span>&#160;    <span class="comment">// Early reject: requested allocation size is larger that maximum block size for this block vector.</span></div>
+<div class="line"><a name="l12591"></a><span class="lineno">12591</span>&#160;    <span class="keywordflow">if</span>(size + 2 * VMA_DEBUG_MARGIN &gt; m_PreferredBlockSize)</div>
+<div class="line"><a name="l12592"></a><span class="lineno">12592</span>&#160;    {</div>
+<div class="line"><a name="l12593"></a><span class="lineno">12593</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l12594"></a><span class="lineno">12594</span>&#160;    }</div>
+<div class="line"><a name="l12595"></a><span class="lineno">12595</span>&#160; </div>
+<div class="line"><a name="l12596"></a><span class="lineno">12596</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l12597"></a><span class="lineno">12597</span>&#160;<span class="comment">    Under certain condition, this whole section can be skipped for optimization, so</span></div>
+<div class="line"><a name="l12598"></a><span class="lineno">12598</span>&#160;<span class="comment">    we move on directly to trying to allocate with canMakeOtherLost. That&#39;s the case</span></div>
+<div class="line"><a name="l12599"></a><span class="lineno">12599</span>&#160;<span class="comment">    e.g. for custom pools with linear algorithm.</span></div>
+<div class="line"><a name="l12600"></a><span class="lineno">12600</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l12601"></a><span class="lineno">12601</span>&#160;    <span class="keywordflow">if</span>(!canMakeOtherLost || canCreateNewBlock)</div>
+<div class="line"><a name="l12602"></a><span class="lineno">12602</span>&#160;    {</div>
+<div class="line"><a name="l12603"></a><span class="lineno">12603</span>&#160;        <span class="comment">// 1. Search existing allocations. Try to allocate without making other allocations lost.</span></div>
+<div class="line"><a name="l12604"></a><span class="lineno">12604</span>&#160;        <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlagsCopy = createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>;</div>
+<div class="line"><a name="l12605"></a><span class="lineno">12605</span>&#160;        allocFlagsCopy &amp;= ~<a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a>;</div>
+<div class="line"><a name="l12606"></a><span class="lineno">12606</span>&#160; </div>
+<div class="line"><a name="l12607"></a><span class="lineno">12607</span>&#160;        <span class="keywordflow">if</span>(m_Algorithm == <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>)</div>
+<div class="line"><a name="l12608"></a><span class="lineno">12608</span>&#160;        {</div>
+<div class="line"><a name="l12609"></a><span class="lineno">12609</span>&#160;            <span class="comment">// Use only last block.</span></div>
+<div class="line"><a name="l12610"></a><span class="lineno">12610</span>&#160;            <span class="keywordflow">if</span>(!m_Blocks.empty())</div>
+<div class="line"><a name="l12611"></a><span class="lineno">12611</span>&#160;            {</div>
+<div class="line"><a name="l12612"></a><span class="lineno">12612</span>&#160;                VmaDeviceMemoryBlock* <span class="keyword">const</span> pCurrBlock = m_Blocks.back();</div>
+<div class="line"><a name="l12613"></a><span class="lineno">12613</span>&#160;                VMA_ASSERT(pCurrBlock);</div>
+<div class="line"><a name="l12614"></a><span class="lineno">12614</span>&#160;                VkResult res = AllocateFromBlock(</div>
+<div class="line"><a name="l12615"></a><span class="lineno">12615</span>&#160;                    pCurrBlock,</div>
+<div class="line"><a name="l12616"></a><span class="lineno">12616</span>&#160;                    currentFrameIndex,</div>
+<div class="line"><a name="l12617"></a><span class="lineno">12617</span>&#160;                    size,</div>
+<div class="line"><a name="l12618"></a><span class="lineno">12618</span>&#160;                    alignment,</div>
+<div class="line"><a name="l12619"></a><span class="lineno">12619</span>&#160;                    allocFlagsCopy,</div>
+<div class="line"><a name="l12620"></a><span class="lineno">12620</span>&#160;                    createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
+<div class="line"><a name="l12621"></a><span class="lineno">12621</span>&#160;                    suballocType,</div>
+<div class="line"><a name="l12622"></a><span class="lineno">12622</span>&#160;                    strategy,</div>
+<div class="line"><a name="l12623"></a><span class="lineno">12623</span>&#160;                    pAllocation);</div>
+<div class="line"><a name="l12624"></a><span class="lineno">12624</span>&#160;                <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l12625"></a><span class="lineno">12625</span>&#160;                {</div>
+<div class="line"><a name="l12626"></a><span class="lineno">12626</span>&#160;                    VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Returned from last block #%u&quot;</span>, pCurrBlock-&gt;GetId());</div>
+<div class="line"><a name="l12627"></a><span class="lineno">12627</span>&#160;                    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l12628"></a><span class="lineno">12628</span>&#160;                }</div>
+<div class="line"><a name="l12629"></a><span class="lineno">12629</span>&#160;            }</div>
+<div class="line"><a name="l12630"></a><span class="lineno">12630</span>&#160;        }</div>
+<div class="line"><a name="l12631"></a><span class="lineno">12631</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l12632"></a><span class="lineno">12632</span>&#160;        {</div>
+<div class="line"><a name="l12633"></a><span class="lineno">12633</span>&#160;            <span class="keywordflow">if</span>(strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>)</div>
+<div class="line"><a name="l12634"></a><span class="lineno">12634</span>&#160;            {</div>
+<div class="line"><a name="l12635"></a><span class="lineno">12635</span>&#160;                <span class="comment">// Forward order in m_Blocks - prefer blocks with smallest amount of free space.</span></div>
+<div class="line"><a name="l12636"></a><span class="lineno">12636</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex )</div>
+<div class="line"><a name="l12637"></a><span class="lineno">12637</span>&#160;                {</div>
+<div class="line"><a name="l12638"></a><span class="lineno">12638</span>&#160;                    VmaDeviceMemoryBlock* <span class="keyword">const</span> pCurrBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l12639"></a><span class="lineno">12639</span>&#160;                    VMA_ASSERT(pCurrBlock);</div>
+<div class="line"><a name="l12640"></a><span class="lineno">12640</span>&#160;                    VkResult res = AllocateFromBlock(</div>
+<div class="line"><a name="l12641"></a><span class="lineno">12641</span>&#160;                        pCurrBlock,</div>
+<div class="line"><a name="l12642"></a><span class="lineno">12642</span>&#160;                        currentFrameIndex,</div>
+<div class="line"><a name="l12643"></a><span class="lineno">12643</span>&#160;                        size,</div>
+<div class="line"><a name="l12644"></a><span class="lineno">12644</span>&#160;                        alignment,</div>
+<div class="line"><a name="l12645"></a><span class="lineno">12645</span>&#160;                        allocFlagsCopy,</div>
+<div class="line"><a name="l12646"></a><span class="lineno">12646</span>&#160;                        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
+<div class="line"><a name="l12647"></a><span class="lineno">12647</span>&#160;                        suballocType,</div>
+<div class="line"><a name="l12648"></a><span class="lineno">12648</span>&#160;                        strategy,</div>
+<div class="line"><a name="l12649"></a><span class="lineno">12649</span>&#160;                        pAllocation);</div>
+<div class="line"><a name="l12650"></a><span class="lineno">12650</span>&#160;                    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l12651"></a><span class="lineno">12651</span>&#160;                    {</div>
+<div class="line"><a name="l12652"></a><span class="lineno">12652</span>&#160;                        VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Returned from existing block #%u&quot;</span>, pCurrBlock-&gt;GetId());</div>
+<div class="line"><a name="l12653"></a><span class="lineno">12653</span>&#160;                        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l12654"></a><span class="lineno">12654</span>&#160;                    }</div>
+<div class="line"><a name="l12655"></a><span class="lineno">12655</span>&#160;                }</div>
+<div class="line"><a name="l12656"></a><span class="lineno">12656</span>&#160;            }</div>
+<div class="line"><a name="l12657"></a><span class="lineno">12657</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// WORST_FIT, FIRST_FIT</span></div>
+<div class="line"><a name="l12658"></a><span class="lineno">12658</span>&#160;            {</div>
+<div class="line"><a name="l12659"></a><span class="lineno">12659</span>&#160;                <span class="comment">// Backward order in m_Blocks - prefer blocks with largest amount of free space.</span></div>
+<div class="line"><a name="l12660"></a><span class="lineno">12660</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = m_Blocks.size(); blockIndex--; )</div>
+<div class="line"><a name="l12661"></a><span class="lineno">12661</span>&#160;                {</div>
+<div class="line"><a name="l12662"></a><span class="lineno">12662</span>&#160;                    VmaDeviceMemoryBlock* <span class="keyword">const</span> pCurrBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l12663"></a><span class="lineno">12663</span>&#160;                    VMA_ASSERT(pCurrBlock);</div>
+<div class="line"><a name="l12664"></a><span class="lineno">12664</span>&#160;                    VkResult res = AllocateFromBlock(</div>
+<div class="line"><a name="l12665"></a><span class="lineno">12665</span>&#160;                        pCurrBlock,</div>
+<div class="line"><a name="l12666"></a><span class="lineno">12666</span>&#160;                        currentFrameIndex,</div>
+<div class="line"><a name="l12667"></a><span class="lineno">12667</span>&#160;                        size,</div>
+<div class="line"><a name="l12668"></a><span class="lineno">12668</span>&#160;                        alignment,</div>
+<div class="line"><a name="l12669"></a><span class="lineno">12669</span>&#160;                        allocFlagsCopy,</div>
+<div class="line"><a name="l12670"></a><span class="lineno">12670</span>&#160;                        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
+<div class="line"><a name="l12671"></a><span class="lineno">12671</span>&#160;                        suballocType,</div>
+<div class="line"><a name="l12672"></a><span class="lineno">12672</span>&#160;                        strategy,</div>
+<div class="line"><a name="l12673"></a><span class="lineno">12673</span>&#160;                        pAllocation);</div>
+<div class="line"><a name="l12674"></a><span class="lineno">12674</span>&#160;                    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l12675"></a><span class="lineno">12675</span>&#160;                    {</div>
+<div class="line"><a name="l12676"></a><span class="lineno">12676</span>&#160;                        VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Returned from existing block #%u&quot;</span>, pCurrBlock-&gt;GetId());</div>
+<div class="line"><a name="l12677"></a><span class="lineno">12677</span>&#160;                        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l12678"></a><span class="lineno">12678</span>&#160;                    }</div>
+<div class="line"><a name="l12679"></a><span class="lineno">12679</span>&#160;                }</div>
+<div class="line"><a name="l12680"></a><span class="lineno">12680</span>&#160;            }</div>
+<div class="line"><a name="l12681"></a><span class="lineno">12681</span>&#160;        }</div>
+<div class="line"><a name="l12682"></a><span class="lineno">12682</span>&#160; </div>
+<div class="line"><a name="l12683"></a><span class="lineno">12683</span>&#160;        <span class="comment">// 2. Try to create new block.</span></div>
+<div class="line"><a name="l12684"></a><span class="lineno">12684</span>&#160;        <span class="keywordflow">if</span>(canCreateNewBlock)</div>
+<div class="line"><a name="l12685"></a><span class="lineno">12685</span>&#160;        {</div>
+<div class="line"><a name="l12686"></a><span class="lineno">12686</span>&#160;            <span class="comment">// Calculate optimal size for new block.</span></div>
+<div class="line"><a name="l12687"></a><span class="lineno">12687</span>&#160;            VkDeviceSize newBlockSize = m_PreferredBlockSize;</div>
+<div class="line"><a name="l12688"></a><span class="lineno">12688</span>&#160;            uint32_t newBlockSizeShift = 0;</div>
+<div class="line"><a name="l12689"></a><span class="lineno">12689</span>&#160;            <span class="keyword">const</span> uint32_t NEW_BLOCK_SIZE_SHIFT_MAX = 3;</div>
+<div class="line"><a name="l12690"></a><span class="lineno">12690</span>&#160; </div>
+<div class="line"><a name="l12691"></a><span class="lineno">12691</span>&#160;            <span class="keywordflow">if</span>(!m_ExplicitBlockSize)</div>
+<div class="line"><a name="l12692"></a><span class="lineno">12692</span>&#160;            {</div>
+<div class="line"><a name="l12693"></a><span class="lineno">12693</span>&#160;                <span class="comment">// Allocate 1/8, 1/4, 1/2 as first blocks.</span></div>
+<div class="line"><a name="l12694"></a><span class="lineno">12694</span>&#160;                <span class="keyword">const</span> VkDeviceSize maxExistingBlockSize = CalcMaxBlockSize();</div>
+<div class="line"><a name="l12695"></a><span class="lineno">12695</span>&#160;                <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; NEW_BLOCK_SIZE_SHIFT_MAX; ++i)</div>
+<div class="line"><a name="l12696"></a><span class="lineno">12696</span>&#160;                {</div>
+<div class="line"><a name="l12697"></a><span class="lineno">12697</span>&#160;                    <span class="keyword">const</span> VkDeviceSize smallerNewBlockSize = newBlockSize / 2;</div>
+<div class="line"><a name="l12698"></a><span class="lineno">12698</span>&#160;                    <span class="keywordflow">if</span>(smallerNewBlockSize &gt; maxExistingBlockSize &amp;&amp; smallerNewBlockSize &gt;= size * 2)</div>
+<div class="line"><a name="l12699"></a><span class="lineno">12699</span>&#160;                    {</div>
+<div class="line"><a name="l12700"></a><span class="lineno">12700</span>&#160;                        newBlockSize = smallerNewBlockSize;</div>
+<div class="line"><a name="l12701"></a><span class="lineno">12701</span>&#160;                        ++newBlockSizeShift;</div>
+<div class="line"><a name="l12702"></a><span class="lineno">12702</span>&#160;                    }</div>
+<div class="line"><a name="l12703"></a><span class="lineno">12703</span>&#160;                    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l12704"></a><span class="lineno">12704</span>&#160;                    {</div>
+<div class="line"><a name="l12705"></a><span class="lineno">12705</span>&#160;                        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12706"></a><span class="lineno">12706</span>&#160;                    }</div>
+<div class="line"><a name="l12707"></a><span class="lineno">12707</span>&#160;                }</div>
+<div class="line"><a name="l12708"></a><span class="lineno">12708</span>&#160;            }</div>
+<div class="line"><a name="l12709"></a><span class="lineno">12709</span>&#160; </div>
+<div class="line"><a name="l12710"></a><span class="lineno">12710</span>&#160;            <span class="keywordtype">size_t</span> newBlockIndex = 0;</div>
+<div class="line"><a name="l12711"></a><span class="lineno">12711</span>&#160;            VkResult res = (newBlockSize &lt;= freeMemory || !canFallbackToDedicated) ?</div>
+<div class="line"><a name="l12712"></a><span class="lineno">12712</span>&#160;                CreateBlock(newBlockSize, &amp;newBlockIndex) : VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l12713"></a><span class="lineno">12713</span>&#160;            <span class="comment">// Allocation of this size failed? Try 1/2, 1/4, 1/8 of m_PreferredBlockSize.</span></div>
+<div class="line"><a name="l12714"></a><span class="lineno">12714</span>&#160;            <span class="keywordflow">if</span>(!m_ExplicitBlockSize)</div>
+<div class="line"><a name="l12715"></a><span class="lineno">12715</span>&#160;            {</div>
+<div class="line"><a name="l12716"></a><span class="lineno">12716</span>&#160;                <span class="keywordflow">while</span>(res &lt; 0 &amp;&amp; newBlockSizeShift &lt; NEW_BLOCK_SIZE_SHIFT_MAX)</div>
+<div class="line"><a name="l12717"></a><span class="lineno">12717</span>&#160;                {</div>
+<div class="line"><a name="l12718"></a><span class="lineno">12718</span>&#160;                    <span class="keyword">const</span> VkDeviceSize smallerNewBlockSize = newBlockSize / 2;</div>
+<div class="line"><a name="l12719"></a><span class="lineno">12719</span>&#160;                    <span class="keywordflow">if</span>(smallerNewBlockSize &gt;= size)</div>
+<div class="line"><a name="l12720"></a><span class="lineno">12720</span>&#160;                    {</div>
+<div class="line"><a name="l12721"></a><span class="lineno">12721</span>&#160;                        newBlockSize = smallerNewBlockSize;</div>
+<div class="line"><a name="l12722"></a><span class="lineno">12722</span>&#160;                        ++newBlockSizeShift;</div>
+<div class="line"><a name="l12723"></a><span class="lineno">12723</span>&#160;                        res = (newBlockSize &lt;= freeMemory || !canFallbackToDedicated) ?</div>
+<div class="line"><a name="l12724"></a><span class="lineno">12724</span>&#160;                            CreateBlock(newBlockSize, &amp;newBlockIndex) : VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l12725"></a><span class="lineno">12725</span>&#160;                    }</div>
+<div class="line"><a name="l12726"></a><span class="lineno">12726</span>&#160;                    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l12727"></a><span class="lineno">12727</span>&#160;                    {</div>
+<div class="line"><a name="l12728"></a><span class="lineno">12728</span>&#160;                        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12729"></a><span class="lineno">12729</span>&#160;                    }</div>
+<div class="line"><a name="l12730"></a><span class="lineno">12730</span>&#160;                }</div>
+<div class="line"><a name="l12731"></a><span class="lineno">12731</span>&#160;            }</div>
+<div class="line"><a name="l12732"></a><span class="lineno">12732</span>&#160; </div>
+<div class="line"><a name="l12733"></a><span class="lineno">12733</span>&#160;            <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l12734"></a><span class="lineno">12734</span>&#160;            {</div>
+<div class="line"><a name="l12735"></a><span class="lineno">12735</span>&#160;                VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[newBlockIndex];</div>
+<div class="line"><a name="l12736"></a><span class="lineno">12736</span>&#160;                VMA_ASSERT(pBlock-&gt;m_pMetadata-&gt;GetSize() &gt;= size);</div>
+<div class="line"><a name="l12737"></a><span class="lineno">12737</span>&#160; </div>
+<div class="line"><a name="l12738"></a><span class="lineno">12738</span>&#160;                res = AllocateFromBlock(</div>
+<div class="line"><a name="l12739"></a><span class="lineno">12739</span>&#160;                    pBlock,</div>
+<div class="line"><a name="l12740"></a><span class="lineno">12740</span>&#160;                    currentFrameIndex,</div>
+<div class="line"><a name="l12741"></a><span class="lineno">12741</span>&#160;                    size,</div>
+<div class="line"><a name="l12742"></a><span class="lineno">12742</span>&#160;                    alignment,</div>
+<div class="line"><a name="l12743"></a><span class="lineno">12743</span>&#160;                    allocFlagsCopy,</div>
+<div class="line"><a name="l12744"></a><span class="lineno">12744</span>&#160;                    createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
+<div class="line"><a name="l12745"></a><span class="lineno">12745</span>&#160;                    suballocType,</div>
+<div class="line"><a name="l12746"></a><span class="lineno">12746</span>&#160;                    strategy,</div>
+<div class="line"><a name="l12747"></a><span class="lineno">12747</span>&#160;                    pAllocation);</div>
+<div class="line"><a name="l12748"></a><span class="lineno">12748</span>&#160;                <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l12749"></a><span class="lineno">12749</span>&#160;                {</div>
+<div class="line"><a name="l12750"></a><span class="lineno">12750</span>&#160;                    VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Created new block #%u Size=%llu&quot;</span>, pBlock-&gt;GetId(), newBlockSize);</div>
+<div class="line"><a name="l12751"></a><span class="lineno">12751</span>&#160;                    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l12752"></a><span class="lineno">12752</span>&#160;                }</div>
+<div class="line"><a name="l12753"></a><span class="lineno">12753</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l12754"></a><span class="lineno">12754</span>&#160;                {</div>
+<div class="line"><a name="l12755"></a><span class="lineno">12755</span>&#160;                    <span class="comment">// Allocation from new block failed, possibly due to VMA_DEBUG_MARGIN or alignment.</span></div>
+<div class="line"><a name="l12756"></a><span class="lineno">12756</span>&#160;                    <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l12757"></a><span class="lineno">12757</span>&#160;                }</div>
+<div class="line"><a name="l12758"></a><span class="lineno">12758</span>&#160;            }</div>
+<div class="line"><a name="l12759"></a><span class="lineno">12759</span>&#160;        }</div>
+<div class="line"><a name="l12760"></a><span class="lineno">12760</span>&#160;    }</div>
+<div class="line"><a name="l12761"></a><span class="lineno">12761</span>&#160; </div>
+<div class="line"><a name="l12762"></a><span class="lineno">12762</span>&#160;    <span class="comment">// 3. Try to allocate from existing blocks with making other allocations lost.</span></div>
+<div class="line"><a name="l12763"></a><span class="lineno">12763</span>&#160;    <span class="keywordflow">if</span>(canMakeOtherLost)</div>
+<div class="line"><a name="l12764"></a><span class="lineno">12764</span>&#160;    {</div>
+<div class="line"><a name="l12765"></a><span class="lineno">12765</span>&#160;        uint32_t tryIndex = 0;</div>
+<div class="line"><a name="l12766"></a><span class="lineno">12766</span>&#160;        <span class="keywordflow">for</span>(; tryIndex &lt; VMA_ALLOCATION_TRY_COUNT; ++tryIndex)</div>
+<div class="line"><a name="l12767"></a><span class="lineno">12767</span>&#160;        {</div>
+<div class="line"><a name="l12768"></a><span class="lineno">12768</span>&#160;            VmaDeviceMemoryBlock* pBestRequestBlock = VMA_NULL;</div>
+<div class="line"><a name="l12769"></a><span class="lineno">12769</span>&#160;            VmaAllocationRequest bestRequest = {};</div>
+<div class="line"><a name="l12770"></a><span class="lineno">12770</span>&#160;            VkDeviceSize bestRequestCost = VK_WHOLE_SIZE;</div>
+<div class="line"><a name="l12771"></a><span class="lineno">12771</span>&#160; </div>
+<div class="line"><a name="l12772"></a><span class="lineno">12772</span>&#160;            <span class="comment">// 1. Search existing allocations.</span></div>
+<div class="line"><a name="l12773"></a><span class="lineno">12773</span>&#160;            <span class="keywordflow">if</span>(strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>)</div>
+<div class="line"><a name="l12774"></a><span class="lineno">12774</span>&#160;            {</div>
+<div class="line"><a name="l12775"></a><span class="lineno">12775</span>&#160;                <span class="comment">// Forward order in m_Blocks - prefer blocks with smallest amount of free space.</span></div>
+<div class="line"><a name="l12776"></a><span class="lineno">12776</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex )</div>
+<div class="line"><a name="l12777"></a><span class="lineno">12777</span>&#160;                {</div>
+<div class="line"><a name="l12778"></a><span class="lineno">12778</span>&#160;                    VmaDeviceMemoryBlock* <span class="keyword">const</span> pCurrBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l12779"></a><span class="lineno">12779</span>&#160;                    VMA_ASSERT(pCurrBlock);</div>
+<div class="line"><a name="l12780"></a><span class="lineno">12780</span>&#160;                    VmaAllocationRequest currRequest = {};</div>
+<div class="line"><a name="l12781"></a><span class="lineno">12781</span>&#160;                    <span class="keywordflow">if</span>(pCurrBlock-&gt;m_pMetadata-&gt;CreateAllocationRequest(</div>
+<div class="line"><a name="l12782"></a><span class="lineno">12782</span>&#160;                        currentFrameIndex,</div>
+<div class="line"><a name="l12783"></a><span class="lineno">12783</span>&#160;                        m_FrameInUseCount,</div>
+<div class="line"><a name="l12784"></a><span class="lineno">12784</span>&#160;                        m_BufferImageGranularity,</div>
+<div class="line"><a name="l12785"></a><span class="lineno">12785</span>&#160;                        size,</div>
+<div class="line"><a name="l12786"></a><span class="lineno">12786</span>&#160;                        alignment,</div>
+<div class="line"><a name="l12787"></a><span class="lineno">12787</span>&#160;                        (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a>) != 0,</div>
+<div class="line"><a name="l12788"></a><span class="lineno">12788</span>&#160;                        suballocType,</div>
+<div class="line"><a name="l12789"></a><span class="lineno">12789</span>&#160;                        canMakeOtherLost,</div>
+<div class="line"><a name="l12790"></a><span class="lineno">12790</span>&#160;                        strategy,</div>
+<div class="line"><a name="l12791"></a><span class="lineno">12791</span>&#160;                        &amp;currRequest))</div>
+<div class="line"><a name="l12792"></a><span class="lineno">12792</span>&#160;                    {</div>
+<div class="line"><a name="l12793"></a><span class="lineno">12793</span>&#160;                        <span class="keyword">const</span> VkDeviceSize currRequestCost = currRequest.CalcCost();</div>
+<div class="line"><a name="l12794"></a><span class="lineno">12794</span>&#160;                        <span class="keywordflow">if</span>(pBestRequestBlock == VMA_NULL ||</div>
+<div class="line"><a name="l12795"></a><span class="lineno">12795</span>&#160;                            currRequestCost &lt; bestRequestCost)</div>
+<div class="line"><a name="l12796"></a><span class="lineno">12796</span>&#160;                        {</div>
+<div class="line"><a name="l12797"></a><span class="lineno">12797</span>&#160;                            pBestRequestBlock = pCurrBlock;</div>
+<div class="line"><a name="l12798"></a><span class="lineno">12798</span>&#160;                            bestRequest = currRequest;</div>
+<div class="line"><a name="l12799"></a><span class="lineno">12799</span>&#160;                            bestRequestCost = currRequestCost;</div>
+<div class="line"><a name="l12800"></a><span class="lineno">12800</span>&#160; </div>
+<div class="line"><a name="l12801"></a><span class="lineno">12801</span>&#160;                            <span class="keywordflow">if</span>(bestRequestCost == 0)</div>
+<div class="line"><a name="l12802"></a><span class="lineno">12802</span>&#160;                            {</div>
+<div class="line"><a name="l12803"></a><span class="lineno">12803</span>&#160;                                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12804"></a><span class="lineno">12804</span>&#160;                            }</div>
+<div class="line"><a name="l12805"></a><span class="lineno">12805</span>&#160;                        }</div>
+<div class="line"><a name="l12806"></a><span class="lineno">12806</span>&#160;                    }</div>
+<div class="line"><a name="l12807"></a><span class="lineno">12807</span>&#160;                }</div>
+<div class="line"><a name="l12808"></a><span class="lineno">12808</span>&#160;            }</div>
+<div class="line"><a name="l12809"></a><span class="lineno">12809</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// WORST_FIT, FIRST_FIT</span></div>
+<div class="line"><a name="l12810"></a><span class="lineno">12810</span>&#160;            {</div>
+<div class="line"><a name="l12811"></a><span class="lineno">12811</span>&#160;                <span class="comment">// Backward order in m_Blocks - prefer blocks with largest amount of free space.</span></div>
+<div class="line"><a name="l12812"></a><span class="lineno">12812</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = m_Blocks.size(); blockIndex--; )</div>
+<div class="line"><a name="l12813"></a><span class="lineno">12813</span>&#160;                {</div>
+<div class="line"><a name="l12814"></a><span class="lineno">12814</span>&#160;                    VmaDeviceMemoryBlock* <span class="keyword">const</span> pCurrBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l12815"></a><span class="lineno">12815</span>&#160;                    VMA_ASSERT(pCurrBlock);</div>
+<div class="line"><a name="l12816"></a><span class="lineno">12816</span>&#160;                    VmaAllocationRequest currRequest = {};</div>
+<div class="line"><a name="l12817"></a><span class="lineno">12817</span>&#160;                    <span class="keywordflow">if</span>(pCurrBlock-&gt;m_pMetadata-&gt;CreateAllocationRequest(</div>
+<div class="line"><a name="l12818"></a><span class="lineno">12818</span>&#160;                        currentFrameIndex,</div>
+<div class="line"><a name="l12819"></a><span class="lineno">12819</span>&#160;                        m_FrameInUseCount,</div>
+<div class="line"><a name="l12820"></a><span class="lineno">12820</span>&#160;                        m_BufferImageGranularity,</div>
+<div class="line"><a name="l12821"></a><span class="lineno">12821</span>&#160;                        size,</div>
+<div class="line"><a name="l12822"></a><span class="lineno">12822</span>&#160;                        alignment,</div>
+<div class="line"><a name="l12823"></a><span class="lineno">12823</span>&#160;                        (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a>) != 0,</div>
+<div class="line"><a name="l12824"></a><span class="lineno">12824</span>&#160;                        suballocType,</div>
+<div class="line"><a name="l12825"></a><span class="lineno">12825</span>&#160;                        canMakeOtherLost,</div>
+<div class="line"><a name="l12826"></a><span class="lineno">12826</span>&#160;                        strategy,</div>
+<div class="line"><a name="l12827"></a><span class="lineno">12827</span>&#160;                        &amp;currRequest))</div>
+<div class="line"><a name="l12828"></a><span class="lineno">12828</span>&#160;                    {</div>
+<div class="line"><a name="l12829"></a><span class="lineno">12829</span>&#160;                        <span class="keyword">const</span> VkDeviceSize currRequestCost = currRequest.CalcCost();</div>
+<div class="line"><a name="l12830"></a><span class="lineno">12830</span>&#160;                        <span class="keywordflow">if</span>(pBestRequestBlock == VMA_NULL ||</div>
+<div class="line"><a name="l12831"></a><span class="lineno">12831</span>&#160;                            currRequestCost &lt; bestRequestCost ||</div>
+<div class="line"><a name="l12832"></a><span class="lineno">12832</span>&#160;                            strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>)</div>
+<div class="line"><a name="l12833"></a><span class="lineno">12833</span>&#160;                        {</div>
+<div class="line"><a name="l12834"></a><span class="lineno">12834</span>&#160;                            pBestRequestBlock = pCurrBlock;</div>
+<div class="line"><a name="l12835"></a><span class="lineno">12835</span>&#160;                            bestRequest = currRequest;</div>
+<div class="line"><a name="l12836"></a><span class="lineno">12836</span>&#160;                            bestRequestCost = currRequestCost;</div>
+<div class="line"><a name="l12837"></a><span class="lineno">12837</span>&#160; </div>
+<div class="line"><a name="l12838"></a><span class="lineno">12838</span>&#160;                            <span class="keywordflow">if</span>(bestRequestCost == 0 ||</div>
+<div class="line"><a name="l12839"></a><span class="lineno">12839</span>&#160;                                strategy == <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>)</div>
+<div class="line"><a name="l12840"></a><span class="lineno">12840</span>&#160;                            {</div>
+<div class="line"><a name="l12841"></a><span class="lineno">12841</span>&#160;                                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12842"></a><span class="lineno">12842</span>&#160;                            }</div>
+<div class="line"><a name="l12843"></a><span class="lineno">12843</span>&#160;                        }</div>
+<div class="line"><a name="l12844"></a><span class="lineno">12844</span>&#160;                    }</div>
+<div class="line"><a name="l12845"></a><span class="lineno">12845</span>&#160;                }</div>
+<div class="line"><a name="l12846"></a><span class="lineno">12846</span>&#160;            }</div>
+<div class="line"><a name="l12847"></a><span class="lineno">12847</span>&#160; </div>
+<div class="line"><a name="l12848"></a><span class="lineno">12848</span>&#160;            <span class="keywordflow">if</span>(pBestRequestBlock != VMA_NULL)</div>
+<div class="line"><a name="l12849"></a><span class="lineno">12849</span>&#160;            {</div>
+<div class="line"><a name="l12850"></a><span class="lineno">12850</span>&#160;                <span class="keywordflow">if</span>(mapped)</div>
+<div class="line"><a name="l12851"></a><span class="lineno">12851</span>&#160;                {</div>
+<div class="line"><a name="l12852"></a><span class="lineno">12852</span>&#160;                    VkResult res = pBestRequestBlock-&gt;Map(m_hAllocator, 1, VMA_NULL);</div>
+<div class="line"><a name="l12853"></a><span class="lineno">12853</span>&#160;                    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l12854"></a><span class="lineno">12854</span>&#160;                    {</div>
+<div class="line"><a name="l12855"></a><span class="lineno">12855</span>&#160;                        <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l12856"></a><span class="lineno">12856</span>&#160;                    }</div>
+<div class="line"><a name="l12857"></a><span class="lineno">12857</span>&#160;                }</div>
+<div class="line"><a name="l12858"></a><span class="lineno">12858</span>&#160; </div>
+<div class="line"><a name="l12859"></a><span class="lineno">12859</span>&#160;                <span class="keywordflow">if</span>(pBestRequestBlock-&gt;m_pMetadata-&gt;MakeRequestedAllocationsLost(</div>
+<div class="line"><a name="l12860"></a><span class="lineno">12860</span>&#160;                    currentFrameIndex,</div>
+<div class="line"><a name="l12861"></a><span class="lineno">12861</span>&#160;                    m_FrameInUseCount,</div>
+<div class="line"><a name="l12862"></a><span class="lineno">12862</span>&#160;                    &amp;bestRequest))</div>
+<div class="line"><a name="l12863"></a><span class="lineno">12863</span>&#160;                {</div>
+<div class="line"><a name="l12864"></a><span class="lineno">12864</span>&#160;                    <span class="comment">// Allocate from this pBlock.</span></div>
+<div class="line"><a name="l12865"></a><span class="lineno">12865</span>&#160;                    *pAllocation = m_hAllocator-&gt;m_AllocationObjectAllocator.Allocate(currentFrameIndex, isUserDataString);</div>
+<div class="line"><a name="l12866"></a><span class="lineno">12866</span>&#160;                    pBestRequestBlock-&gt;m_pMetadata-&gt;Alloc(bestRequest, suballocType, size, *pAllocation);</div>
+<div class="line"><a name="l12867"></a><span class="lineno">12867</span>&#160;                    UpdateHasEmptyBlock();</div>
+<div class="line"><a name="l12868"></a><span class="lineno">12868</span>&#160;                    (*pAllocation)-&gt;InitBlockAllocation(</div>
+<div class="line"><a name="l12869"></a><span class="lineno">12869</span>&#160;                        pBestRequestBlock,</div>
+<div class="line"><a name="l12870"></a><span class="lineno">12870</span>&#160;                        bestRequest.offset,</div>
+<div class="line"><a name="l12871"></a><span class="lineno">12871</span>&#160;                        alignment,</div>
+<div class="line"><a name="l12872"></a><span class="lineno">12872</span>&#160;                        size,</div>
+<div class="line"><a name="l12873"></a><span class="lineno">12873</span>&#160;                        m_MemoryTypeIndex,</div>
+<div class="line"><a name="l12874"></a><span class="lineno">12874</span>&#160;                        suballocType,</div>
+<div class="line"><a name="l12875"></a><span class="lineno">12875</span>&#160;                        mapped,</div>
+<div class="line"><a name="l12876"></a><span class="lineno">12876</span>&#160;                        (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a>) != 0);</div>
+<div class="line"><a name="l12877"></a><span class="lineno">12877</span>&#160;                    VMA_HEAVY_ASSERT(pBestRequestBlock-&gt;Validate());</div>
+<div class="line"><a name="l12878"></a><span class="lineno">12878</span>&#160;                    VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Returned from existing block&quot;</span>);</div>
+<div class="line"><a name="l12879"></a><span class="lineno">12879</span>&#160;                    (*pAllocation)-&gt;SetUserData(m_hAllocator, createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
+<div class="line"><a name="l12880"></a><span class="lineno">12880</span>&#160;                    m_hAllocator-&gt;m_Budget.AddAllocation(m_hAllocator-&gt;MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex), size);</div>
+<div class="line"><a name="l12881"></a><span class="lineno">12881</span>&#160;                    <span class="keywordflow">if</span>(VMA_DEBUG_INITIALIZE_ALLOCATIONS)</div>
+<div class="line"><a name="l12882"></a><span class="lineno">12882</span>&#160;                    {</div>
+<div class="line"><a name="l12883"></a><span class="lineno">12883</span>&#160;                        m_hAllocator-&gt;FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);</div>
+<div class="line"><a name="l12884"></a><span class="lineno">12884</span>&#160;                    }</div>
+<div class="line"><a name="l12885"></a><span class="lineno">12885</span>&#160;                    <span class="keywordflow">if</span>(IsCorruptionDetectionEnabled())</div>
+<div class="line"><a name="l12886"></a><span class="lineno">12886</span>&#160;                    {</div>
+<div class="line"><a name="l12887"></a><span class="lineno">12887</span>&#160;                        VkResult res = pBestRequestBlock-&gt;WriteMagicValueAroundAllocation(m_hAllocator, bestRequest.offset, size);</div>
+<div class="line"><a name="l12888"></a><span class="lineno">12888</span>&#160;                        VMA_ASSERT(res == VK_SUCCESS &amp;&amp; <span class="stringliteral">&quot;Couldn&#39;t map block memory to write magic value.&quot;</span>);</div>
+<div class="line"><a name="l12889"></a><span class="lineno">12889</span>&#160;                    }</div>
+<div class="line"><a name="l12890"></a><span class="lineno">12890</span>&#160;                    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l12891"></a><span class="lineno">12891</span>&#160;                }</div>
+<div class="line"><a name="l12892"></a><span class="lineno">12892</span>&#160;                <span class="comment">// else: Some allocations must have been touched while we are here. Next try.</span></div>
+<div class="line"><a name="l12893"></a><span class="lineno">12893</span>&#160;            }</div>
+<div class="line"><a name="l12894"></a><span class="lineno">12894</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l12895"></a><span class="lineno">12895</span>&#160;            {</div>
+<div class="line"><a name="l12896"></a><span class="lineno">12896</span>&#160;                <span class="comment">// Could not find place in any of the blocks - break outer loop.</span></div>
+<div class="line"><a name="l12897"></a><span class="lineno">12897</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12898"></a><span class="lineno">12898</span>&#160;            }</div>
+<div class="line"><a name="l12899"></a><span class="lineno">12899</span>&#160;        }</div>
+<div class="line"><a name="l12900"></a><span class="lineno">12900</span>&#160;        <span class="comment">/* Maximum number of tries exceeded - a very unlike event when many other</span></div>
+<div class="line"><a name="l12901"></a><span class="lineno">12901</span>&#160;<span class="comment">        threads are simultaneously touching allocations making it impossible to make</span></div>
+<div class="line"><a name="l12902"></a><span class="lineno">12902</span>&#160;<span class="comment">        lost at the same time as we try to allocate. */</span></div>
+<div class="line"><a name="l12903"></a><span class="lineno">12903</span>&#160;        <span class="keywordflow">if</span>(tryIndex == VMA_ALLOCATION_TRY_COUNT)</div>
+<div class="line"><a name="l12904"></a><span class="lineno">12904</span>&#160;        {</div>
+<div class="line"><a name="l12905"></a><span class="lineno">12905</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_TOO_MANY_OBJECTS;</div>
+<div class="line"><a name="l12906"></a><span class="lineno">12906</span>&#160;        }</div>
+<div class="line"><a name="l12907"></a><span class="lineno">12907</span>&#160;    }</div>
+<div class="line"><a name="l12908"></a><span class="lineno">12908</span>&#160; </div>
+<div class="line"><a name="l12909"></a><span class="lineno">12909</span>&#160;    <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l12910"></a><span class="lineno">12910</span>&#160;}</div>
 <div class="line"><a name="l12911"></a><span class="lineno">12911</span>&#160; </div>
-<div class="line"><a name="l12912"></a><span class="lineno">12912</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l12913"></a><span class="lineno">12913</span>&#160;}</div>
-<div class="line"><a name="l12914"></a><span class="lineno">12914</span>&#160; </div>
-<div class="line"><a name="l12915"></a><span class="lineno">12915</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::ApplyDefragmentationMovesCpu(</div>
-<div class="line"><a name="l12916"></a><span class="lineno">12916</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pDefragCtx,</div>
-<div class="line"><a name="l12917"></a><span class="lineno">12917</span>&#160;    <span class="keyword">const</span> VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves)</div>
-<div class="line"><a name="l12918"></a><span class="lineno">12918</span>&#160;{</div>
-<div class="line"><a name="l12919"></a><span class="lineno">12919</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_Blocks.size();</div>
-<div class="line"><a name="l12920"></a><span class="lineno">12920</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isNonCoherent = m_hAllocator-&gt;IsMemoryTypeNonCoherent(m_MemoryTypeIndex);</div>
-<div class="line"><a name="l12921"></a><span class="lineno">12921</span>&#160; </div>
-<div class="line"><a name="l12922"></a><span class="lineno">12922</span>&#160;    <span class="keyword">enum</span> BLOCK_FLAG</div>
-<div class="line"><a name="l12923"></a><span class="lineno">12923</span>&#160;    {</div>
-<div class="line"><a name="l12924"></a><span class="lineno">12924</span>&#160;        BLOCK_FLAG_USED = 0x00000001,</div>
-<div class="line"><a name="l12925"></a><span class="lineno">12925</span>&#160;        BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION = 0x00000002,</div>
-<div class="line"><a name="l12926"></a><span class="lineno">12926</span>&#160;    };</div>
-<div class="line"><a name="l12927"></a><span class="lineno">12927</span>&#160; </div>
-<div class="line"><a name="l12928"></a><span class="lineno">12928</span>&#160;    <span class="keyword">struct </span>BlockInfo</div>
-<div class="line"><a name="l12929"></a><span class="lineno">12929</span>&#160;    {</div>
-<div class="line"><a name="l12930"></a><span class="lineno">12930</span>&#160;        uint32_t flags;</div>
-<div class="line"><a name="l12931"></a><span class="lineno">12931</span>&#160;        <span class="keywordtype">void</span>* pMappedData;</div>
-<div class="line"><a name="l12932"></a><span class="lineno">12932</span>&#160;    };</div>
-<div class="line"><a name="l12933"></a><span class="lineno">12933</span>&#160;    VmaVector&lt; BlockInfo, VmaStlAllocator&lt;BlockInfo&gt; &gt;</div>
-<div class="line"><a name="l12934"></a><span class="lineno">12934</span>&#160;        blockInfo(blockCount, BlockInfo(), VmaStlAllocator&lt;BlockInfo&gt;(m_hAllocator-&gt;GetAllocationCallbacks()));</div>
-<div class="line"><a name="l12935"></a><span class="lineno">12935</span>&#160;    memset(blockInfo.data(), 0, blockCount * <span class="keyword">sizeof</span>(BlockInfo));</div>
+<div class="line"><a name="l12912"></a><span class="lineno">12912</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::Free(</div>
+<div class="line"><a name="l12913"></a><span class="lineno">12913</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
+<div class="line"><a name="l12914"></a><span class="lineno">12914</span>&#160;{</div>
+<div class="line"><a name="l12915"></a><span class="lineno">12915</span>&#160;    VmaDeviceMemoryBlock* pBlockToDelete = VMA_NULL;</div>
+<div class="line"><a name="l12916"></a><span class="lineno">12916</span>&#160; </div>
+<div class="line"><a name="l12917"></a><span class="lineno">12917</span>&#160;    <span class="keywordtype">bool</span> budgetExceeded = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l12918"></a><span class="lineno">12918</span>&#160;    {</div>
+<div class="line"><a name="l12919"></a><span class="lineno">12919</span>&#160;        <span class="keyword">const</span> uint32_t heapIndex = m_hAllocator-&gt;MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex);</div>
+<div class="line"><a name="l12920"></a><span class="lineno">12920</span>&#160;        <a class="code" href="struct_vma_budget.html">VmaBudget</a> heapBudget = {};</div>
+<div class="line"><a name="l12921"></a><span class="lineno">12921</span>&#160;        m_hAllocator-&gt;GetBudget(&amp;heapBudget, heapIndex, 1);</div>
+<div class="line"><a name="l12922"></a><span class="lineno">12922</span>&#160;        budgetExceeded = heapBudget.<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> &gt;= heapBudget.<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a>;</div>
+<div class="line"><a name="l12923"></a><span class="lineno">12923</span>&#160;    }</div>
+<div class="line"><a name="l12924"></a><span class="lineno">12924</span>&#160; </div>
+<div class="line"><a name="l12925"></a><span class="lineno">12925</span>&#160;    <span class="comment">// Scope for lock.</span></div>
+<div class="line"><a name="l12926"></a><span class="lineno">12926</span>&#160;    {</div>
+<div class="line"><a name="l12927"></a><span class="lineno">12927</span>&#160;        VmaMutexLockWrite lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l12928"></a><span class="lineno">12928</span>&#160; </div>
+<div class="line"><a name="l12929"></a><span class="lineno">12929</span>&#160;        VmaDeviceMemoryBlock* pBlock = hAllocation-&gt;GetBlock();</div>
+<div class="line"><a name="l12930"></a><span class="lineno">12930</span>&#160; </div>
+<div class="line"><a name="l12931"></a><span class="lineno">12931</span>&#160;        <span class="keywordflow">if</span>(IsCorruptionDetectionEnabled())</div>
+<div class="line"><a name="l12932"></a><span class="lineno">12932</span>&#160;        {</div>
+<div class="line"><a name="l12933"></a><span class="lineno">12933</span>&#160;            VkResult res = pBlock-&gt;ValidateMagicValueAroundAllocation(m_hAllocator, hAllocation-&gt;GetOffset(), hAllocation-&gt;GetSize());</div>
+<div class="line"><a name="l12934"></a><span class="lineno">12934</span>&#160;            VMA_ASSERT(res == VK_SUCCESS &amp;&amp; <span class="stringliteral">&quot;Couldn&#39;t map block memory to validate magic value.&quot;</span>);</div>
+<div class="line"><a name="l12935"></a><span class="lineno">12935</span>&#160;        }</div>
 <div class="line"><a name="l12936"></a><span class="lineno">12936</span>&#160; </div>
-<div class="line"><a name="l12937"></a><span class="lineno">12937</span>&#160;    <span class="comment">// Go over all moves. Mark blocks that are used with BLOCK_FLAG_USED.</span></div>
-<div class="line"><a name="l12938"></a><span class="lineno">12938</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> moveCount = moves.size();</div>
-<div class="line"><a name="l12939"></a><span class="lineno">12939</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> moveIndex = 0; moveIndex &lt; moveCount; ++moveIndex)</div>
-<div class="line"><a name="l12940"></a><span class="lineno">12940</span>&#160;    {</div>
-<div class="line"><a name="l12941"></a><span class="lineno">12941</span>&#160;        <span class="keyword">const</span> VmaDefragmentationMove&amp; move = moves[moveIndex];</div>
-<div class="line"><a name="l12942"></a><span class="lineno">12942</span>&#160;        blockInfo[move.srcBlockIndex].flags |= BLOCK_FLAG_USED;</div>
-<div class="line"><a name="l12943"></a><span class="lineno">12943</span>&#160;        blockInfo[move.dstBlockIndex].flags |= BLOCK_FLAG_USED;</div>
-<div class="line"><a name="l12944"></a><span class="lineno">12944</span>&#160;    }</div>
-<div class="line"><a name="l12945"></a><span class="lineno">12945</span>&#160; </div>
-<div class="line"><a name="l12946"></a><span class="lineno">12946</span>&#160;    VMA_ASSERT(pDefragCtx-&gt;res == VK_SUCCESS);</div>
-<div class="line"><a name="l12947"></a><span class="lineno">12947</span>&#160; </div>
-<div class="line"><a name="l12948"></a><span class="lineno">12948</span>&#160;    <span class="comment">// Go over all blocks. Get mapped pointer or map if necessary.</span></div>
-<div class="line"><a name="l12949"></a><span class="lineno">12949</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; pDefragCtx-&gt;res == VK_SUCCESS &amp;&amp; blockIndex &lt; blockCount; ++blockIndex)</div>
-<div class="line"><a name="l12950"></a><span class="lineno">12950</span>&#160;    {</div>
-<div class="line"><a name="l12951"></a><span class="lineno">12951</span>&#160;        BlockInfo&amp; currBlockInfo = blockInfo[blockIndex];</div>
-<div class="line"><a name="l12952"></a><span class="lineno">12952</span>&#160;        VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l12953"></a><span class="lineno">12953</span>&#160;        <span class="keywordflow">if</span>((currBlockInfo.flags &amp; BLOCK_FLAG_USED) != 0)</div>
-<div class="line"><a name="l12954"></a><span class="lineno">12954</span>&#160;        {</div>
-<div class="line"><a name="l12955"></a><span class="lineno">12955</span>&#160;            currBlockInfo.pMappedData = pBlock-&gt;GetMappedData();</div>
-<div class="line"><a name="l12956"></a><span class="lineno">12956</span>&#160;            <span class="comment">// It is not originally mapped - map it.</span></div>
-<div class="line"><a name="l12957"></a><span class="lineno">12957</span>&#160;            <span class="keywordflow">if</span>(currBlockInfo.pMappedData == VMA_NULL)</div>
-<div class="line"><a name="l12958"></a><span class="lineno">12958</span>&#160;            {</div>
-<div class="line"><a name="l12959"></a><span class="lineno">12959</span>&#160;                pDefragCtx-&gt;res = pBlock-&gt;Map(m_hAllocator, 1, &amp;currBlockInfo.pMappedData);</div>
-<div class="line"><a name="l12960"></a><span class="lineno">12960</span>&#160;                <span class="keywordflow">if</span>(pDefragCtx-&gt;res == VK_SUCCESS)</div>
-<div class="line"><a name="l12961"></a><span class="lineno">12961</span>&#160;                {</div>
-<div class="line"><a name="l12962"></a><span class="lineno">12962</span>&#160;                    currBlockInfo.flags |= BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION;</div>
-<div class="line"><a name="l12963"></a><span class="lineno">12963</span>&#160;                }</div>
-<div class="line"><a name="l12964"></a><span class="lineno">12964</span>&#160;            }</div>
-<div class="line"><a name="l12965"></a><span class="lineno">12965</span>&#160;        }</div>
-<div class="line"><a name="l12966"></a><span class="lineno">12966</span>&#160;    }</div>
-<div class="line"><a name="l12967"></a><span class="lineno">12967</span>&#160; </div>
-<div class="line"><a name="l12968"></a><span class="lineno">12968</span>&#160;    <span class="comment">// Go over all moves. Do actual data transfer.</span></div>
-<div class="line"><a name="l12969"></a><span class="lineno">12969</span>&#160;    <span class="keywordflow">if</span>(pDefragCtx-&gt;res == VK_SUCCESS)</div>
-<div class="line"><a name="l12970"></a><span class="lineno">12970</span>&#160;    {</div>
-<div class="line"><a name="l12971"></a><span class="lineno">12971</span>&#160;        <span class="keyword">const</span> VkDeviceSize nonCoherentAtomSize = m_hAllocator-&gt;m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;</div>
-<div class="line"><a name="l12972"></a><span class="lineno">12972</span>&#160;        VkMappedMemoryRange memRange = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE };</div>
-<div class="line"><a name="l12973"></a><span class="lineno">12973</span>&#160; </div>
-<div class="line"><a name="l12974"></a><span class="lineno">12974</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> moveIndex = 0; moveIndex &lt; moveCount; ++moveIndex)</div>
-<div class="line"><a name="l12975"></a><span class="lineno">12975</span>&#160;        {</div>
-<div class="line"><a name="l12976"></a><span class="lineno">12976</span>&#160;            <span class="keyword">const</span> VmaDefragmentationMove&amp; move = moves[moveIndex];</div>
-<div class="line"><a name="l12977"></a><span class="lineno">12977</span>&#160; </div>
-<div class="line"><a name="l12978"></a><span class="lineno">12978</span>&#160;            <span class="keyword">const</span> BlockInfo&amp; srcBlockInfo = blockInfo[move.srcBlockIndex];</div>
-<div class="line"><a name="l12979"></a><span class="lineno">12979</span>&#160;            <span class="keyword">const</span> BlockInfo&amp; dstBlockInfo = blockInfo[move.dstBlockIndex];</div>
-<div class="line"><a name="l12980"></a><span class="lineno">12980</span>&#160; </div>
-<div class="line"><a name="l12981"></a><span class="lineno">12981</span>&#160;            VMA_ASSERT(srcBlockInfo.pMappedData &amp;&amp; dstBlockInfo.pMappedData);</div>
-<div class="line"><a name="l12982"></a><span class="lineno">12982</span>&#160; </div>
-<div class="line"><a name="l12983"></a><span class="lineno">12983</span>&#160;            <span class="comment">// Invalidate source.</span></div>
-<div class="line"><a name="l12984"></a><span class="lineno">12984</span>&#160;            <span class="keywordflow">if</span>(isNonCoherent)</div>
-<div class="line"><a name="l12985"></a><span class="lineno">12985</span>&#160;            {</div>
-<div class="line"><a name="l12986"></a><span class="lineno">12986</span>&#160;                VmaDeviceMemoryBlock* <span class="keyword">const</span> pSrcBlock = m_Blocks[move.srcBlockIndex];</div>
-<div class="line"><a name="l12987"></a><span class="lineno">12987</span>&#160;                memRange.memory = pSrcBlock-&gt;GetDeviceMemory();</div>
-<div class="line"><a name="l12988"></a><span class="lineno">12988</span>&#160;                memRange.offset = VmaAlignDown(move.srcOffset, nonCoherentAtomSize);</div>
-<div class="line"><a name="l12989"></a><span class="lineno">12989</span>&#160;                memRange.size = VMA_MIN(</div>
-<div class="line"><a name="l12990"></a><span class="lineno">12990</span>&#160;                    VmaAlignUp(move.size + (move.srcOffset - memRange.offset), nonCoherentAtomSize),</div>
-<div class="line"><a name="l12991"></a><span class="lineno">12991</span>&#160;                    pSrcBlock-&gt;m_pMetadata-&gt;GetSize() - memRange.offset);</div>
-<div class="line"><a name="l12992"></a><span class="lineno">12992</span>&#160;                (*m_hAllocator-&gt;GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hAllocator-&gt;m_hDevice, 1, &amp;memRange);</div>
-<div class="line"><a name="l12993"></a><span class="lineno">12993</span>&#160;            }</div>
-<div class="line"><a name="l12994"></a><span class="lineno">12994</span>&#160; </div>
-<div class="line"><a name="l12995"></a><span class="lineno">12995</span>&#160;            <span class="comment">// THE PLACE WHERE ACTUAL DATA COPY HAPPENS.</span></div>
-<div class="line"><a name="l12996"></a><span class="lineno">12996</span>&#160;            memmove(</div>
-<div class="line"><a name="l12997"></a><span class="lineno">12997</span>&#160;                <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">char</span>*<span class="keyword">&gt;</span>(dstBlockInfo.pMappedData) + move.dstOffset,</div>
-<div class="line"><a name="l12998"></a><span class="lineno">12998</span>&#160;                <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">char</span>*<span class="keyword">&gt;</span>(srcBlockInfo.pMappedData) + move.srcOffset,</div>
-<div class="line"><a name="l12999"></a><span class="lineno">12999</span>&#160;                <span class="keyword">static_cast&lt;</span><span class="keywordtype">size_t</span><span class="keyword">&gt;</span>(move.size));</div>
-<div class="line"><a name="l13000"></a><span class="lineno">13000</span>&#160; </div>
-<div class="line"><a name="l13001"></a><span class="lineno">13001</span>&#160;            <span class="keywordflow">if</span>(IsCorruptionDetectionEnabled())</div>
-<div class="line"><a name="l13002"></a><span class="lineno">13002</span>&#160;            {</div>
-<div class="line"><a name="l13003"></a><span class="lineno">13003</span>&#160;                VmaWriteMagicValue(dstBlockInfo.pMappedData, move.dstOffset - VMA_DEBUG_MARGIN);</div>
-<div class="line"><a name="l13004"></a><span class="lineno">13004</span>&#160;                VmaWriteMagicValue(dstBlockInfo.pMappedData, move.dstOffset + move.size);</div>
-<div class="line"><a name="l13005"></a><span class="lineno">13005</span>&#160;            }</div>
-<div class="line"><a name="l13006"></a><span class="lineno">13006</span>&#160; </div>
-<div class="line"><a name="l13007"></a><span class="lineno">13007</span>&#160;            <span class="comment">// Flush destination.</span></div>
-<div class="line"><a name="l13008"></a><span class="lineno">13008</span>&#160;            <span class="keywordflow">if</span>(isNonCoherent)</div>
-<div class="line"><a name="l13009"></a><span class="lineno">13009</span>&#160;            {</div>
-<div class="line"><a name="l13010"></a><span class="lineno">13010</span>&#160;                VmaDeviceMemoryBlock* <span class="keyword">const</span> pDstBlock = m_Blocks[move.dstBlockIndex];</div>
-<div class="line"><a name="l13011"></a><span class="lineno">13011</span>&#160;                memRange.memory = pDstBlock-&gt;GetDeviceMemory();</div>
-<div class="line"><a name="l13012"></a><span class="lineno">13012</span>&#160;                memRange.offset = VmaAlignDown(move.dstOffset, nonCoherentAtomSize);</div>
-<div class="line"><a name="l13013"></a><span class="lineno">13013</span>&#160;                memRange.size = VMA_MIN(</div>
-<div class="line"><a name="l13014"></a><span class="lineno">13014</span>&#160;                    VmaAlignUp(move.size + (move.dstOffset - memRange.offset), nonCoherentAtomSize),</div>
-<div class="line"><a name="l13015"></a><span class="lineno">13015</span>&#160;                    pDstBlock-&gt;m_pMetadata-&gt;GetSize() - memRange.offset);</div>
-<div class="line"><a name="l13016"></a><span class="lineno">13016</span>&#160;                (*m_hAllocator-&gt;GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hAllocator-&gt;m_hDevice, 1, &amp;memRange);</div>
-<div class="line"><a name="l13017"></a><span class="lineno">13017</span>&#160;            }</div>
-<div class="line"><a name="l13018"></a><span class="lineno">13018</span>&#160;        }</div>
-<div class="line"><a name="l13019"></a><span class="lineno">13019</span>&#160;    }</div>
-<div class="line"><a name="l13020"></a><span class="lineno">13020</span>&#160; </div>
-<div class="line"><a name="l13021"></a><span class="lineno">13021</span>&#160;    <span class="comment">// Go over all blocks in reverse order. Unmap those that were mapped just for defragmentation.</span></div>
-<div class="line"><a name="l13022"></a><span class="lineno">13022</span>&#160;    <span class="comment">// Regardless of pCtx-&gt;res == VK_SUCCESS.</span></div>
-<div class="line"><a name="l13023"></a><span class="lineno">13023</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = blockCount; blockIndex--; )</div>
-<div class="line"><a name="l13024"></a><span class="lineno">13024</span>&#160;    {</div>
-<div class="line"><a name="l13025"></a><span class="lineno">13025</span>&#160;        <span class="keyword">const</span> BlockInfo&amp; currBlockInfo = blockInfo[blockIndex];</div>
-<div class="line"><a name="l13026"></a><span class="lineno">13026</span>&#160;        <span class="keywordflow">if</span>((currBlockInfo.flags &amp; BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION) != 0)</div>
-<div class="line"><a name="l13027"></a><span class="lineno">13027</span>&#160;        {</div>
-<div class="line"><a name="l13028"></a><span class="lineno">13028</span>&#160;            VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l13029"></a><span class="lineno">13029</span>&#160;            pBlock-&gt;Unmap(m_hAllocator, 1);</div>
-<div class="line"><a name="l13030"></a><span class="lineno">13030</span>&#160;        }</div>
-<div class="line"><a name="l13031"></a><span class="lineno">13031</span>&#160;    }</div>
-<div class="line"><a name="l13032"></a><span class="lineno">13032</span>&#160;}</div>
-<div class="line"><a name="l13033"></a><span class="lineno">13033</span>&#160; </div>
-<div class="line"><a name="l13034"></a><span class="lineno">13034</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::ApplyDefragmentationMovesGpu(</div>
-<div class="line"><a name="l13035"></a><span class="lineno">13035</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pDefragCtx,</div>
-<div class="line"><a name="l13036"></a><span class="lineno">13036</span>&#160;    VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
-<div class="line"><a name="l13037"></a><span class="lineno">13037</span>&#160;    VkCommandBuffer commandBuffer)</div>
+<div class="line"><a name="l12937"></a><span class="lineno">12937</span>&#160;        <span class="keywordflow">if</span>(hAllocation-&gt;IsPersistentMap())</div>
+<div class="line"><a name="l12938"></a><span class="lineno">12938</span>&#160;        {</div>
+<div class="line"><a name="l12939"></a><span class="lineno">12939</span>&#160;            pBlock-&gt;Unmap(m_hAllocator, 1);</div>
+<div class="line"><a name="l12940"></a><span class="lineno">12940</span>&#160;        }</div>
+<div class="line"><a name="l12941"></a><span class="lineno">12941</span>&#160; </div>
+<div class="line"><a name="l12942"></a><span class="lineno">12942</span>&#160;        pBlock-&gt;m_pMetadata-&gt;Free(hAllocation);</div>
+<div class="line"><a name="l12943"></a><span class="lineno">12943</span>&#160;        VMA_HEAVY_ASSERT(pBlock-&gt;Validate());</div>
+<div class="line"><a name="l12944"></a><span class="lineno">12944</span>&#160; </div>
+<div class="line"><a name="l12945"></a><span class="lineno">12945</span>&#160;        VMA_DEBUG_LOG(<span class="stringliteral">&quot;  Freed from MemoryTypeIndex=%u&quot;</span>, m_MemoryTypeIndex);</div>
+<div class="line"><a name="l12946"></a><span class="lineno">12946</span>&#160; </div>
+<div class="line"><a name="l12947"></a><span class="lineno">12947</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">bool</span> canDeleteBlock = m_Blocks.size() &gt; m_MinBlockCount;</div>
+<div class="line"><a name="l12948"></a><span class="lineno">12948</span>&#160;        <span class="comment">// pBlock became empty after this deallocation.</span></div>
+<div class="line"><a name="l12949"></a><span class="lineno">12949</span>&#160;        <span class="keywordflow">if</span>(pBlock-&gt;m_pMetadata-&gt;IsEmpty())</div>
+<div class="line"><a name="l12950"></a><span class="lineno">12950</span>&#160;        {</div>
+<div class="line"><a name="l12951"></a><span class="lineno">12951</span>&#160;            <span class="comment">// Already has empty block. We don&#39;t want to have two, so delete this one.</span></div>
+<div class="line"><a name="l12952"></a><span class="lineno">12952</span>&#160;            <span class="keywordflow">if</span>((m_HasEmptyBlock || budgetExceeded) &amp;&amp; canDeleteBlock)</div>
+<div class="line"><a name="l12953"></a><span class="lineno">12953</span>&#160;            {</div>
+<div class="line"><a name="l12954"></a><span class="lineno">12954</span>&#160;                pBlockToDelete = pBlock;</div>
+<div class="line"><a name="l12955"></a><span class="lineno">12955</span>&#160;                Remove(pBlock);</div>
+<div class="line"><a name="l12956"></a><span class="lineno">12956</span>&#160;            }</div>
+<div class="line"><a name="l12957"></a><span class="lineno">12957</span>&#160;            <span class="comment">// else: We now have an empty block - leave it.</span></div>
+<div class="line"><a name="l12958"></a><span class="lineno">12958</span>&#160;        }</div>
+<div class="line"><a name="l12959"></a><span class="lineno">12959</span>&#160;        <span class="comment">// pBlock didn&#39;t become empty, but we have another empty block - find and free that one.</span></div>
+<div class="line"><a name="l12960"></a><span class="lineno">12960</span>&#160;        <span class="comment">// (This is optional, heuristics.)</span></div>
+<div class="line"><a name="l12961"></a><span class="lineno">12961</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(m_HasEmptyBlock &amp;&amp; canDeleteBlock)</div>
+<div class="line"><a name="l12962"></a><span class="lineno">12962</span>&#160;        {</div>
+<div class="line"><a name="l12963"></a><span class="lineno">12963</span>&#160;            VmaDeviceMemoryBlock* pLastBlock = m_Blocks.back();</div>
+<div class="line"><a name="l12964"></a><span class="lineno">12964</span>&#160;            <span class="keywordflow">if</span>(pLastBlock-&gt;m_pMetadata-&gt;IsEmpty())</div>
+<div class="line"><a name="l12965"></a><span class="lineno">12965</span>&#160;            {</div>
+<div class="line"><a name="l12966"></a><span class="lineno">12966</span>&#160;                pBlockToDelete = pLastBlock;</div>
+<div class="line"><a name="l12967"></a><span class="lineno">12967</span>&#160;                m_Blocks.pop_back();</div>
+<div class="line"><a name="l12968"></a><span class="lineno">12968</span>&#160;            }</div>
+<div class="line"><a name="l12969"></a><span class="lineno">12969</span>&#160;        }</div>
+<div class="line"><a name="l12970"></a><span class="lineno">12970</span>&#160; </div>
+<div class="line"><a name="l12971"></a><span class="lineno">12971</span>&#160;        UpdateHasEmptyBlock();</div>
+<div class="line"><a name="l12972"></a><span class="lineno">12972</span>&#160;        IncrementallySortBlocks();</div>
+<div class="line"><a name="l12973"></a><span class="lineno">12973</span>&#160;    }</div>
+<div class="line"><a name="l12974"></a><span class="lineno">12974</span>&#160; </div>
+<div class="line"><a name="l12975"></a><span class="lineno">12975</span>&#160;    <span class="comment">// Destruction of a free block. Deferred until this point, outside of mutex</span></div>
+<div class="line"><a name="l12976"></a><span class="lineno">12976</span>&#160;    <span class="comment">// lock, for performance reason.</span></div>
+<div class="line"><a name="l12977"></a><span class="lineno">12977</span>&#160;    <span class="keywordflow">if</span>(pBlockToDelete != VMA_NULL)</div>
+<div class="line"><a name="l12978"></a><span class="lineno">12978</span>&#160;    {</div>
+<div class="line"><a name="l12979"></a><span class="lineno">12979</span>&#160;        VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Deleted empty block&quot;</span>);</div>
+<div class="line"><a name="l12980"></a><span class="lineno">12980</span>&#160;        pBlockToDelete-&gt;Destroy(m_hAllocator);</div>
+<div class="line"><a name="l12981"></a><span class="lineno">12981</span>&#160;        vma_delete(m_hAllocator, pBlockToDelete);</div>
+<div class="line"><a name="l12982"></a><span class="lineno">12982</span>&#160;    }</div>
+<div class="line"><a name="l12983"></a><span class="lineno">12983</span>&#160;}</div>
+<div class="line"><a name="l12984"></a><span class="lineno">12984</span>&#160; </div>
+<div class="line"><a name="l12985"></a><span class="lineno">12985</span>&#160;VkDeviceSize VmaBlockVector::CalcMaxBlockSize()<span class="keyword"> const</span></div>
+<div class="line"><a name="l12986"></a><span class="lineno">12986</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l12987"></a><span class="lineno">12987</span>&#160;    VkDeviceSize result = 0;</div>
+<div class="line"><a name="l12988"></a><span class="lineno">12988</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_Blocks.size(); i--; )</div>
+<div class="line"><a name="l12989"></a><span class="lineno">12989</span>&#160;    {</div>
+<div class="line"><a name="l12990"></a><span class="lineno">12990</span>&#160;        result = VMA_MAX(result, m_Blocks[i]-&gt;m_pMetadata-&gt;GetSize());</div>
+<div class="line"><a name="l12991"></a><span class="lineno">12991</span>&#160;        <span class="keywordflow">if</span>(result &gt;= m_PreferredBlockSize)</div>
+<div class="line"><a name="l12992"></a><span class="lineno">12992</span>&#160;        {</div>
+<div class="line"><a name="l12993"></a><span class="lineno">12993</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l12994"></a><span class="lineno">12994</span>&#160;        }</div>
+<div class="line"><a name="l12995"></a><span class="lineno">12995</span>&#160;    }</div>
+<div class="line"><a name="l12996"></a><span class="lineno">12996</span>&#160;    <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l12997"></a><span class="lineno">12997</span>&#160;}</div>
+<div class="line"><a name="l12998"></a><span class="lineno">12998</span>&#160; </div>
+<div class="line"><a name="l12999"></a><span class="lineno">12999</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::Remove(VmaDeviceMemoryBlock* pBlock)</div>
+<div class="line"><a name="l13000"></a><span class="lineno">13000</span>&#160;{</div>
+<div class="line"><a name="l13001"></a><span class="lineno">13001</span>&#160;    <span class="keywordflow">for</span>(uint32_t blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex)</div>
+<div class="line"><a name="l13002"></a><span class="lineno">13002</span>&#160;    {</div>
+<div class="line"><a name="l13003"></a><span class="lineno">13003</span>&#160;        <span class="keywordflow">if</span>(m_Blocks[blockIndex] == pBlock)</div>
+<div class="line"><a name="l13004"></a><span class="lineno">13004</span>&#160;        {</div>
+<div class="line"><a name="l13005"></a><span class="lineno">13005</span>&#160;            VmaVectorRemove(m_Blocks, blockIndex);</div>
+<div class="line"><a name="l13006"></a><span class="lineno">13006</span>&#160;            <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l13007"></a><span class="lineno">13007</span>&#160;        }</div>
+<div class="line"><a name="l13008"></a><span class="lineno">13008</span>&#160;    }</div>
+<div class="line"><a name="l13009"></a><span class="lineno">13009</span>&#160;    VMA_ASSERT(0);</div>
+<div class="line"><a name="l13010"></a><span class="lineno">13010</span>&#160;}</div>
+<div class="line"><a name="l13011"></a><span class="lineno">13011</span>&#160; </div>
+<div class="line"><a name="l13012"></a><span class="lineno">13012</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::IncrementallySortBlocks()</div>
+<div class="line"><a name="l13013"></a><span class="lineno">13013</span>&#160;{</div>
+<div class="line"><a name="l13014"></a><span class="lineno">13014</span>&#160;    <span class="keywordflow">if</span>(m_Algorithm != <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>)</div>
+<div class="line"><a name="l13015"></a><span class="lineno">13015</span>&#160;    {</div>
+<div class="line"><a name="l13016"></a><span class="lineno">13016</span>&#160;        <span class="comment">// Bubble sort only until first swap.</span></div>
+<div class="line"><a name="l13017"></a><span class="lineno">13017</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 1; i &lt; m_Blocks.size(); ++i)</div>
+<div class="line"><a name="l13018"></a><span class="lineno">13018</span>&#160;        {</div>
+<div class="line"><a name="l13019"></a><span class="lineno">13019</span>&#160;            <span class="keywordflow">if</span>(m_Blocks[i - 1]-&gt;m_pMetadata-&gt;GetSumFreeSize() &gt; m_Blocks[i]-&gt;m_pMetadata-&gt;GetSumFreeSize())</div>
+<div class="line"><a name="l13020"></a><span class="lineno">13020</span>&#160;            {</div>
+<div class="line"><a name="l13021"></a><span class="lineno">13021</span>&#160;                VMA_SWAP(m_Blocks[i - 1], m_Blocks[i]);</div>
+<div class="line"><a name="l13022"></a><span class="lineno">13022</span>&#160;                <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l13023"></a><span class="lineno">13023</span>&#160;            }</div>
+<div class="line"><a name="l13024"></a><span class="lineno">13024</span>&#160;        }</div>
+<div class="line"><a name="l13025"></a><span class="lineno">13025</span>&#160;    }</div>
+<div class="line"><a name="l13026"></a><span class="lineno">13026</span>&#160;}</div>
+<div class="line"><a name="l13027"></a><span class="lineno">13027</span>&#160; </div>
+<div class="line"><a name="l13028"></a><span class="lineno">13028</span>&#160;VkResult VmaBlockVector::AllocateFromBlock(</div>
+<div class="line"><a name="l13029"></a><span class="lineno">13029</span>&#160;    VmaDeviceMemoryBlock* pBlock,</div>
+<div class="line"><a name="l13030"></a><span class="lineno">13030</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l13031"></a><span class="lineno">13031</span>&#160;    VkDeviceSize size,</div>
+<div class="line"><a name="l13032"></a><span class="lineno">13032</span>&#160;    VkDeviceSize alignment,</div>
+<div class="line"><a name="l13033"></a><span class="lineno">13033</span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlags,</div>
+<div class="line"><a name="l13034"></a><span class="lineno">13034</span>&#160;    <span class="keywordtype">void</span>* pUserData,</div>
+<div class="line"><a name="l13035"></a><span class="lineno">13035</span>&#160;    VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l13036"></a><span class="lineno">13036</span>&#160;    uint32_t strategy,</div>
+<div class="line"><a name="l13037"></a><span class="lineno">13037</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation)</div>
 <div class="line"><a name="l13038"></a><span class="lineno">13038</span>&#160;{</div>
-<div class="line"><a name="l13039"></a><span class="lineno">13039</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_Blocks.size();</div>
-<div class="line"><a name="l13040"></a><span class="lineno">13040</span>&#160; </div>
-<div class="line"><a name="l13041"></a><span class="lineno">13041</span>&#160;    pDefragCtx-&gt;blockContexts.resize(blockCount);</div>
-<div class="line"><a name="l13042"></a><span class="lineno">13042</span>&#160;    memset(pDefragCtx-&gt;blockContexts.data(), 0, blockCount * <span class="keyword">sizeof</span>(VmaBlockDefragmentationContext));</div>
+<div class="line"><a name="l13039"></a><span class="lineno">13039</span>&#160;    VMA_ASSERT((allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a>) == 0);</div>
+<div class="line"><a name="l13040"></a><span class="lineno">13040</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isUpperAddress = (allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a>) != 0;</div>
+<div class="line"><a name="l13041"></a><span class="lineno">13041</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> mapped = (allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0;</div>
+<div class="line"><a name="l13042"></a><span class="lineno">13042</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isUserDataString = (allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a>) != 0;</div>
 <div class="line"><a name="l13043"></a><span class="lineno">13043</span>&#160; </div>
-<div class="line"><a name="l13044"></a><span class="lineno">13044</span>&#160;    <span class="comment">// Go over all moves. Mark blocks that are used with BLOCK_FLAG_USED.</span></div>
-<div class="line"><a name="l13045"></a><span class="lineno">13045</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> moveCount = moves.size();</div>
-<div class="line"><a name="l13046"></a><span class="lineno">13046</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> moveIndex = 0; moveIndex &lt; moveCount; ++moveIndex)</div>
-<div class="line"><a name="l13047"></a><span class="lineno">13047</span>&#160;    {</div>
-<div class="line"><a name="l13048"></a><span class="lineno">13048</span>&#160;        <span class="keyword">const</span> VmaDefragmentationMove&amp; move = moves[moveIndex];</div>
-<div class="line"><a name="l13049"></a><span class="lineno">13049</span>&#160; </div>
-<div class="line"><a name="l13050"></a><span class="lineno">13050</span>&#160;        <span class="comment">//if(move.type == VMA_ALLOCATION_TYPE_UNKNOWN)</span></div>
-<div class="line"><a name="l13051"></a><span class="lineno">13051</span>&#160;        {</div>
-<div class="line"><a name="l13052"></a><span class="lineno">13052</span>&#160;            <span class="comment">// Old school move still require us to map the whole block</span></div>
-<div class="line"><a name="l13053"></a><span class="lineno">13053</span>&#160;            pDefragCtx-&gt;blockContexts[move.srcBlockIndex].flags |= VmaBlockDefragmentationContext::BLOCK_FLAG_USED;</div>
-<div class="line"><a name="l13054"></a><span class="lineno">13054</span>&#160;            pDefragCtx-&gt;blockContexts[move.dstBlockIndex].flags |= VmaBlockDefragmentationContext::BLOCK_FLAG_USED;</div>
-<div class="line"><a name="l13055"></a><span class="lineno">13055</span>&#160;        }</div>
-<div class="line"><a name="l13056"></a><span class="lineno">13056</span>&#160;    }</div>
-<div class="line"><a name="l13057"></a><span class="lineno">13057</span>&#160; </div>
-<div class="line"><a name="l13058"></a><span class="lineno">13058</span>&#160;    VMA_ASSERT(pDefragCtx-&gt;res == VK_SUCCESS);</div>
+<div class="line"><a name="l13044"></a><span class="lineno">13044</span>&#160;    VmaAllocationRequest currRequest = {};</div>
+<div class="line"><a name="l13045"></a><span class="lineno">13045</span>&#160;    <span class="keywordflow">if</span>(pBlock-&gt;m_pMetadata-&gt;CreateAllocationRequest(</div>
+<div class="line"><a name="l13046"></a><span class="lineno">13046</span>&#160;        currentFrameIndex,</div>
+<div class="line"><a name="l13047"></a><span class="lineno">13047</span>&#160;        m_FrameInUseCount,</div>
+<div class="line"><a name="l13048"></a><span class="lineno">13048</span>&#160;        m_BufferImageGranularity,</div>
+<div class="line"><a name="l13049"></a><span class="lineno">13049</span>&#160;        size,</div>
+<div class="line"><a name="l13050"></a><span class="lineno">13050</span>&#160;        alignment,</div>
+<div class="line"><a name="l13051"></a><span class="lineno">13051</span>&#160;        isUpperAddress,</div>
+<div class="line"><a name="l13052"></a><span class="lineno">13052</span>&#160;        suballocType,</div>
+<div class="line"><a name="l13053"></a><span class="lineno">13053</span>&#160;        <span class="keyword">false</span>, <span class="comment">// canMakeOtherLost</span></div>
+<div class="line"><a name="l13054"></a><span class="lineno">13054</span>&#160;        strategy,</div>
+<div class="line"><a name="l13055"></a><span class="lineno">13055</span>&#160;        &amp;currRequest))</div>
+<div class="line"><a name="l13056"></a><span class="lineno">13056</span>&#160;    {</div>
+<div class="line"><a name="l13057"></a><span class="lineno">13057</span>&#160;        <span class="comment">// Allocate from pCurrBlock.</span></div>
+<div class="line"><a name="l13058"></a><span class="lineno">13058</span>&#160;        VMA_ASSERT(currRequest.itemsToMakeLostCount == 0);</div>
 <div class="line"><a name="l13059"></a><span class="lineno">13059</span>&#160; </div>
-<div class="line"><a name="l13060"></a><span class="lineno">13060</span>&#160;    <span class="comment">// Go over all blocks. Create and bind buffer for whole block if necessary.</span></div>
-<div class="line"><a name="l13061"></a><span class="lineno">13061</span>&#160;    {</div>
-<div class="line"><a name="l13062"></a><span class="lineno">13062</span>&#160;        VkBufferCreateInfo bufCreateInfo;</div>
-<div class="line"><a name="l13063"></a><span class="lineno">13063</span>&#160;        VmaFillGpuDefragmentationBufferCreateInfo(bufCreateInfo);</div>
-<div class="line"><a name="l13064"></a><span class="lineno">13064</span>&#160; </div>
-<div class="line"><a name="l13065"></a><span class="lineno">13065</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; pDefragCtx-&gt;res == VK_SUCCESS &amp;&amp; blockIndex &lt; blockCount; ++blockIndex)</div>
-<div class="line"><a name="l13066"></a><span class="lineno">13066</span>&#160;        {</div>
-<div class="line"><a name="l13067"></a><span class="lineno">13067</span>&#160;            VmaBlockDefragmentationContext&amp; currBlockCtx = pDefragCtx-&gt;blockContexts[blockIndex];</div>
-<div class="line"><a name="l13068"></a><span class="lineno">13068</span>&#160;            VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l13069"></a><span class="lineno">13069</span>&#160;            <span class="keywordflow">if</span>((currBlockCtx.flags &amp; VmaBlockDefragmentationContext::BLOCK_FLAG_USED) != 0)</div>
-<div class="line"><a name="l13070"></a><span class="lineno">13070</span>&#160;            {</div>
-<div class="line"><a name="l13071"></a><span class="lineno">13071</span>&#160;                bufCreateInfo.size = pBlock-&gt;m_pMetadata-&gt;GetSize();</div>
-<div class="line"><a name="l13072"></a><span class="lineno">13072</span>&#160;                pDefragCtx-&gt;res = (*m_hAllocator-&gt;GetVulkanFunctions().vkCreateBuffer)(</div>
-<div class="line"><a name="l13073"></a><span class="lineno">13073</span>&#160;                    m_hAllocator-&gt;m_hDevice, &amp;bufCreateInfo, m_hAllocator-&gt;GetAllocationCallbacks(), &amp;currBlockCtx.hBuffer);</div>
-<div class="line"><a name="l13074"></a><span class="lineno">13074</span>&#160;                <span class="keywordflow">if</span>(pDefragCtx-&gt;res == VK_SUCCESS)</div>
-<div class="line"><a name="l13075"></a><span class="lineno">13075</span>&#160;                {</div>
-<div class="line"><a name="l13076"></a><span class="lineno">13076</span>&#160;                    pDefragCtx-&gt;res = (*m_hAllocator-&gt;GetVulkanFunctions().vkBindBufferMemory)(</div>
-<div class="line"><a name="l13077"></a><span class="lineno">13077</span>&#160;                        m_hAllocator-&gt;m_hDevice, currBlockCtx.hBuffer, pBlock-&gt;GetDeviceMemory(), 0);</div>
-<div class="line"><a name="l13078"></a><span class="lineno">13078</span>&#160;                }</div>
-<div class="line"><a name="l13079"></a><span class="lineno">13079</span>&#160;            }</div>
-<div class="line"><a name="l13080"></a><span class="lineno">13080</span>&#160;        }</div>
-<div class="line"><a name="l13081"></a><span class="lineno">13081</span>&#160;    }</div>
-<div class="line"><a name="l13082"></a><span class="lineno">13082</span>&#160; </div>
-<div class="line"><a name="l13083"></a><span class="lineno">13083</span>&#160;    <span class="comment">// Go over all moves. Post data transfer commands to command buffer.</span></div>
-<div class="line"><a name="l13084"></a><span class="lineno">13084</span>&#160;    <span class="keywordflow">if</span>(pDefragCtx-&gt;res == VK_SUCCESS)</div>
-<div class="line"><a name="l13085"></a><span class="lineno">13085</span>&#160;    {</div>
-<div class="line"><a name="l13086"></a><span class="lineno">13086</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> moveIndex = 0; moveIndex &lt; moveCount; ++moveIndex)</div>
-<div class="line"><a name="l13087"></a><span class="lineno">13087</span>&#160;        {</div>
-<div class="line"><a name="l13088"></a><span class="lineno">13088</span>&#160;            <span class="keyword">const</span> VmaDefragmentationMove&amp; move = moves[moveIndex];</div>
-<div class="line"><a name="l13089"></a><span class="lineno">13089</span>&#160; </div>
-<div class="line"><a name="l13090"></a><span class="lineno">13090</span>&#160;            <span class="keyword">const</span> VmaBlockDefragmentationContext&amp; srcBlockCtx = pDefragCtx-&gt;blockContexts[move.srcBlockIndex];</div>
-<div class="line"><a name="l13091"></a><span class="lineno">13091</span>&#160;            <span class="keyword">const</span> VmaBlockDefragmentationContext&amp; dstBlockCtx = pDefragCtx-&gt;blockContexts[move.dstBlockIndex];</div>
-<div class="line"><a name="l13092"></a><span class="lineno">13092</span>&#160; </div>
-<div class="line"><a name="l13093"></a><span class="lineno">13093</span>&#160;            VMA_ASSERT(srcBlockCtx.hBuffer &amp;&amp; dstBlockCtx.hBuffer);</div>
-<div class="line"><a name="l13094"></a><span class="lineno">13094</span>&#160; </div>
-<div class="line"><a name="l13095"></a><span class="lineno">13095</span>&#160;            VkBufferCopy region = {</div>
-<div class="line"><a name="l13096"></a><span class="lineno">13096</span>&#160;                move.srcOffset,</div>
-<div class="line"><a name="l13097"></a><span class="lineno">13097</span>&#160;                move.dstOffset,</div>
-<div class="line"><a name="l13098"></a><span class="lineno">13098</span>&#160;                move.size };</div>
-<div class="line"><a name="l13099"></a><span class="lineno">13099</span>&#160;            (*m_hAllocator-&gt;GetVulkanFunctions().vkCmdCopyBuffer)(</div>
-<div class="line"><a name="l13100"></a><span class="lineno">13100</span>&#160;                commandBuffer, srcBlockCtx.hBuffer, dstBlockCtx.hBuffer, 1, &amp;region);</div>
-<div class="line"><a name="l13101"></a><span class="lineno">13101</span>&#160;        }</div>
-<div class="line"><a name="l13102"></a><span class="lineno">13102</span>&#160;    }</div>
+<div class="line"><a name="l13060"></a><span class="lineno">13060</span>&#160;        <span class="keywordflow">if</span>(mapped)</div>
+<div class="line"><a name="l13061"></a><span class="lineno">13061</span>&#160;        {</div>
+<div class="line"><a name="l13062"></a><span class="lineno">13062</span>&#160;            VkResult res = pBlock-&gt;Map(m_hAllocator, 1, VMA_NULL);</div>
+<div class="line"><a name="l13063"></a><span class="lineno">13063</span>&#160;            <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l13064"></a><span class="lineno">13064</span>&#160;            {</div>
+<div class="line"><a name="l13065"></a><span class="lineno">13065</span>&#160;                <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l13066"></a><span class="lineno">13066</span>&#160;            }</div>
+<div class="line"><a name="l13067"></a><span class="lineno">13067</span>&#160;        }</div>
+<div class="line"><a name="l13068"></a><span class="lineno">13068</span>&#160;            </div>
+<div class="line"><a name="l13069"></a><span class="lineno">13069</span>&#160;        *pAllocation = m_hAllocator-&gt;m_AllocationObjectAllocator.Allocate(currentFrameIndex, isUserDataString);</div>
+<div class="line"><a name="l13070"></a><span class="lineno">13070</span>&#160;        pBlock-&gt;m_pMetadata-&gt;Alloc(currRequest, suballocType, size, *pAllocation);</div>
+<div class="line"><a name="l13071"></a><span class="lineno">13071</span>&#160;        UpdateHasEmptyBlock();</div>
+<div class="line"><a name="l13072"></a><span class="lineno">13072</span>&#160;        (*pAllocation)-&gt;InitBlockAllocation(</div>
+<div class="line"><a name="l13073"></a><span class="lineno">13073</span>&#160;            pBlock,</div>
+<div class="line"><a name="l13074"></a><span class="lineno">13074</span>&#160;            currRequest.offset,</div>
+<div class="line"><a name="l13075"></a><span class="lineno">13075</span>&#160;            alignment,</div>
+<div class="line"><a name="l13076"></a><span class="lineno">13076</span>&#160;            size,</div>
+<div class="line"><a name="l13077"></a><span class="lineno">13077</span>&#160;            m_MemoryTypeIndex,</div>
+<div class="line"><a name="l13078"></a><span class="lineno">13078</span>&#160;            suballocType,</div>
+<div class="line"><a name="l13079"></a><span class="lineno">13079</span>&#160;            mapped,</div>
+<div class="line"><a name="l13080"></a><span class="lineno">13080</span>&#160;            (allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a>) != 0);</div>
+<div class="line"><a name="l13081"></a><span class="lineno">13081</span>&#160;        VMA_HEAVY_ASSERT(pBlock-&gt;Validate());</div>
+<div class="line"><a name="l13082"></a><span class="lineno">13082</span>&#160;        (*pAllocation)-&gt;SetUserData(m_hAllocator, pUserData);</div>
+<div class="line"><a name="l13083"></a><span class="lineno">13083</span>&#160;        m_hAllocator-&gt;m_Budget.AddAllocation(m_hAllocator-&gt;MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex), size);</div>
+<div class="line"><a name="l13084"></a><span class="lineno">13084</span>&#160;        <span class="keywordflow">if</span>(VMA_DEBUG_INITIALIZE_ALLOCATIONS)</div>
+<div class="line"><a name="l13085"></a><span class="lineno">13085</span>&#160;        {</div>
+<div class="line"><a name="l13086"></a><span class="lineno">13086</span>&#160;            m_hAllocator-&gt;FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);</div>
+<div class="line"><a name="l13087"></a><span class="lineno">13087</span>&#160;        }</div>
+<div class="line"><a name="l13088"></a><span class="lineno">13088</span>&#160;        <span class="keywordflow">if</span>(IsCorruptionDetectionEnabled())</div>
+<div class="line"><a name="l13089"></a><span class="lineno">13089</span>&#160;        {</div>
+<div class="line"><a name="l13090"></a><span class="lineno">13090</span>&#160;            VkResult res = pBlock-&gt;WriteMagicValueAroundAllocation(m_hAllocator, currRequest.offset, size);</div>
+<div class="line"><a name="l13091"></a><span class="lineno">13091</span>&#160;            VMA_ASSERT(res == VK_SUCCESS &amp;&amp; <span class="stringliteral">&quot;Couldn&#39;t map block memory to write magic value.&quot;</span>);</div>
+<div class="line"><a name="l13092"></a><span class="lineno">13092</span>&#160;        }</div>
+<div class="line"><a name="l13093"></a><span class="lineno">13093</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l13094"></a><span class="lineno">13094</span>&#160;    }</div>
+<div class="line"><a name="l13095"></a><span class="lineno">13095</span>&#160;    <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l13096"></a><span class="lineno">13096</span>&#160;}</div>
+<div class="line"><a name="l13097"></a><span class="lineno">13097</span>&#160; </div>
+<div class="line"><a name="l13098"></a><span class="lineno">13098</span>&#160;VkResult VmaBlockVector::CreateBlock(VkDeviceSize blockSize, <span class="keywordtype">size_t</span>* pNewBlockIndex)</div>
+<div class="line"><a name="l13099"></a><span class="lineno">13099</span>&#160;{</div>
+<div class="line"><a name="l13100"></a><span class="lineno">13100</span>&#160;    VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };</div>
+<div class="line"><a name="l13101"></a><span class="lineno">13101</span>&#160;    allocInfo.memoryTypeIndex = m_MemoryTypeIndex;</div>
+<div class="line"><a name="l13102"></a><span class="lineno">13102</span>&#160;    allocInfo.allocationSize = blockSize;</div>
 <div class="line"><a name="l13103"></a><span class="lineno">13103</span>&#160; </div>
-<div class="line"><a name="l13104"></a><span class="lineno">13104</span>&#160;    <span class="comment">// Save buffers to defrag context for later destruction.</span></div>
-<div class="line"><a name="l13105"></a><span class="lineno">13105</span>&#160;    <span class="keywordflow">if</span>(pDefragCtx-&gt;res == VK_SUCCESS &amp;&amp; moveCount &gt; 0)</div>
-<div class="line"><a name="l13106"></a><span class="lineno">13106</span>&#160;    {</div>
-<div class="line"><a name="l13107"></a><span class="lineno">13107</span>&#160;        pDefragCtx-&gt;res = VK_NOT_READY;</div>
-<div class="line"><a name="l13108"></a><span class="lineno">13108</span>&#160;    }</div>
-<div class="line"><a name="l13109"></a><span class="lineno">13109</span>&#160;}</div>
-<div class="line"><a name="l13110"></a><span class="lineno">13110</span>&#160; </div>
-<div class="line"><a name="l13111"></a><span class="lineno">13111</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::FreeEmptyBlocks(<a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pDefragmentationStats)</div>
-<div class="line"><a name="l13112"></a><span class="lineno">13112</span>&#160;{</div>
-<div class="line"><a name="l13113"></a><span class="lineno">13113</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = m_Blocks.size(); blockIndex--; )</div>
-<div class="line"><a name="l13114"></a><span class="lineno">13114</span>&#160;    {</div>
-<div class="line"><a name="l13115"></a><span class="lineno">13115</span>&#160;        VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l13116"></a><span class="lineno">13116</span>&#160;        <span class="keywordflow">if</span>(pBlock-&gt;m_pMetadata-&gt;IsEmpty())</div>
-<div class="line"><a name="l13117"></a><span class="lineno">13117</span>&#160;        {</div>
-<div class="line"><a name="l13118"></a><span class="lineno">13118</span>&#160;            <span class="keywordflow">if</span>(m_Blocks.size() &gt; m_MinBlockCount)</div>
-<div class="line"><a name="l13119"></a><span class="lineno">13119</span>&#160;            {</div>
-<div class="line"><a name="l13120"></a><span class="lineno">13120</span>&#160;                <span class="keywordflow">if</span>(pDefragmentationStats != VMA_NULL)</div>
-<div class="line"><a name="l13121"></a><span class="lineno">13121</span>&#160;                {</div>
-<div class="line"><a name="l13122"></a><span class="lineno">13122</span>&#160;                    ++pDefragmentationStats-&gt;<a class="code" href="struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b">deviceMemoryBlocksFreed</a>;</div>
-<div class="line"><a name="l13123"></a><span class="lineno">13123</span>&#160;                    pDefragmentationStats-&gt;<a class="code" href="struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28">bytesFreed</a> += pBlock-&gt;m_pMetadata-&gt;GetSize();</div>
-<div class="line"><a name="l13124"></a><span class="lineno">13124</span>&#160;                }</div>
-<div class="line"><a name="l13125"></a><span class="lineno">13125</span>&#160; </div>
-<div class="line"><a name="l13126"></a><span class="lineno">13126</span>&#160;                VmaVectorRemove(m_Blocks, blockIndex);</div>
-<div class="line"><a name="l13127"></a><span class="lineno">13127</span>&#160;                pBlock-&gt;Destroy(m_hAllocator);</div>
-<div class="line"><a name="l13128"></a><span class="lineno">13128</span>&#160;                vma_delete(m_hAllocator, pBlock);</div>
-<div class="line"><a name="l13129"></a><span class="lineno">13129</span>&#160;            }</div>
-<div class="line"><a name="l13130"></a><span class="lineno">13130</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13131"></a><span class="lineno">13131</span>&#160;            {</div>
-<div class="line"><a name="l13132"></a><span class="lineno">13132</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l13133"></a><span class="lineno">13133</span>&#160;            }</div>
-<div class="line"><a name="l13134"></a><span class="lineno">13134</span>&#160;        }</div>
-<div class="line"><a name="l13135"></a><span class="lineno">13135</span>&#160;    }</div>
-<div class="line"><a name="l13136"></a><span class="lineno">13136</span>&#160;    UpdateHasEmptyBlock();</div>
-<div class="line"><a name="l13137"></a><span class="lineno">13137</span>&#160;}</div>
-<div class="line"><a name="l13138"></a><span class="lineno">13138</span>&#160; </div>
-<div class="line"><a name="l13139"></a><span class="lineno">13139</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::UpdateHasEmptyBlock()</div>
-<div class="line"><a name="l13140"></a><span class="lineno">13140</span>&#160;{</div>
-<div class="line"><a name="l13141"></a><span class="lineno">13141</span>&#160;    m_HasEmptyBlock = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l13142"></a><span class="lineno">13142</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> index = 0, count = m_Blocks.size(); index &lt; count; ++index)</div>
-<div class="line"><a name="l13143"></a><span class="lineno">13143</span>&#160;    {</div>
-<div class="line"><a name="l13144"></a><span class="lineno">13144</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[index];</div>
-<div class="line"><a name="l13145"></a><span class="lineno">13145</span>&#160;        <span class="keywordflow">if</span>(pBlock-&gt;m_pMetadata-&gt;IsEmpty())</div>
-<div class="line"><a name="l13146"></a><span class="lineno">13146</span>&#160;        {</div>
-<div class="line"><a name="l13147"></a><span class="lineno">13147</span>&#160;            m_HasEmptyBlock = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l13148"></a><span class="lineno">13148</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l13149"></a><span class="lineno">13149</span>&#160;        }</div>
-<div class="line"><a name="l13150"></a><span class="lineno">13150</span>&#160;    }</div>
-<div class="line"><a name="l13151"></a><span class="lineno">13151</span>&#160;}</div>
-<div class="line"><a name="l13152"></a><span class="lineno">13152</span>&#160; </div>
-<div class="line"><a name="l13153"></a><span class="lineno">13153</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l13154"></a><span class="lineno">13154</span>&#160; </div>
-<div class="line"><a name="l13155"></a><span class="lineno">13155</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json)</div>
-<div class="line"><a name="l13156"></a><span class="lineno">13156</span>&#160;{</div>
-<div class="line"><a name="l13157"></a><span class="lineno">13157</span>&#160;    VmaMutexLockRead lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l13158"></a><span class="lineno">13158</span>&#160; </div>
-<div class="line"><a name="l13159"></a><span class="lineno">13159</span>&#160;    json.BeginObject();</div>
-<div class="line"><a name="l13160"></a><span class="lineno">13160</span>&#160; </div>
-<div class="line"><a name="l13161"></a><span class="lineno">13161</span>&#160;    <span class="keywordflow">if</span>(IsCustomPool())</div>
-<div class="line"><a name="l13162"></a><span class="lineno">13162</span>&#160;    {</div>
-<div class="line"><a name="l13163"></a><span class="lineno">13163</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">char</span>* poolName = m_hParentPool-&gt;GetName();</div>
-<div class="line"><a name="l13164"></a><span class="lineno">13164</span>&#160;        <span class="keywordflow">if</span>(poolName != VMA_NULL &amp;&amp; poolName[0] != <span class="charliteral">&#39;\0&#39;</span>)</div>
-<div class="line"><a name="l13165"></a><span class="lineno">13165</span>&#160;        {</div>
-<div class="line"><a name="l13166"></a><span class="lineno">13166</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Name&quot;</span>);</div>
-<div class="line"><a name="l13167"></a><span class="lineno">13167</span>&#160;            json.WriteString(poolName);</div>
-<div class="line"><a name="l13168"></a><span class="lineno">13168</span>&#160;        }</div>
-<div class="line"><a name="l13169"></a><span class="lineno">13169</span>&#160; </div>
-<div class="line"><a name="l13170"></a><span class="lineno">13170</span>&#160;        json.WriteString(<span class="stringliteral">&quot;MemoryTypeIndex&quot;</span>);</div>
-<div class="line"><a name="l13171"></a><span class="lineno">13171</span>&#160;        json.WriteNumber(m_MemoryTypeIndex);</div>
-<div class="line"><a name="l13172"></a><span class="lineno">13172</span>&#160; </div>
-<div class="line"><a name="l13173"></a><span class="lineno">13173</span>&#160;        json.WriteString(<span class="stringliteral">&quot;BlockSize&quot;</span>);</div>
-<div class="line"><a name="l13174"></a><span class="lineno">13174</span>&#160;        json.WriteNumber(m_PreferredBlockSize);</div>
+<div class="line"><a name="l13104"></a><span class="lineno">13104</span>&#160;<span class="preprocessor">#if VMA_BUFFER_DEVICE_ADDRESS</span></div>
+<div class="line"><a name="l13105"></a><span class="lineno">13105</span>&#160;    <span class="comment">// Every standalone block can potentially contain a buffer with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT - always enable the feature.</span></div>
+<div class="line"><a name="l13106"></a><span class="lineno">13106</span>&#160;    VkMemoryAllocateFlagsInfoKHR allocFlagsInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR };</div>
+<div class="line"><a name="l13107"></a><span class="lineno">13107</span>&#160;    <span class="keywordflow">if</span>(m_hAllocator-&gt;m_UseKhrBufferDeviceAddress)</div>
+<div class="line"><a name="l13108"></a><span class="lineno">13108</span>&#160;    {</div>
+<div class="line"><a name="l13109"></a><span class="lineno">13109</span>&#160;        allocFlagsInfo.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;</div>
+<div class="line"><a name="l13110"></a><span class="lineno">13110</span>&#160;        VmaPnextChainPushFront(&amp;allocInfo, &amp;allocFlagsInfo);</div>
+<div class="line"><a name="l13111"></a><span class="lineno">13111</span>&#160;    }</div>
+<div class="line"><a name="l13112"></a><span class="lineno">13112</span>&#160;<span class="preprocessor">#endif // #if VMA_BUFFER_DEVICE_ADDRESS</span></div>
+<div class="line"><a name="l13113"></a><span class="lineno">13113</span>&#160; </div>
+<div class="line"><a name="l13114"></a><span class="lineno">13114</span>&#160;    VkDeviceMemory mem = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l13115"></a><span class="lineno">13115</span>&#160;    VkResult res = m_hAllocator-&gt;AllocateVulkanMemory(&amp;allocInfo, &amp;mem);</div>
+<div class="line"><a name="l13116"></a><span class="lineno">13116</span>&#160;    <span class="keywordflow">if</span>(res &lt; 0)</div>
+<div class="line"><a name="l13117"></a><span class="lineno">13117</span>&#160;    {</div>
+<div class="line"><a name="l13118"></a><span class="lineno">13118</span>&#160;        <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l13119"></a><span class="lineno">13119</span>&#160;    }</div>
+<div class="line"><a name="l13120"></a><span class="lineno">13120</span>&#160; </div>
+<div class="line"><a name="l13121"></a><span class="lineno">13121</span>&#160;    <span class="comment">// New VkDeviceMemory successfully created.</span></div>
+<div class="line"><a name="l13122"></a><span class="lineno">13122</span>&#160; </div>
+<div class="line"><a name="l13123"></a><span class="lineno">13123</span>&#160;    <span class="comment">// Create new Allocation for it.</span></div>
+<div class="line"><a name="l13124"></a><span class="lineno">13124</span>&#160;    VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = vma_new(m_hAllocator, VmaDeviceMemoryBlock)(m_hAllocator);</div>
+<div class="line"><a name="l13125"></a><span class="lineno">13125</span>&#160;    pBlock-&gt;Init(</div>
+<div class="line"><a name="l13126"></a><span class="lineno">13126</span>&#160;        m_hAllocator,</div>
+<div class="line"><a name="l13127"></a><span class="lineno">13127</span>&#160;        m_hParentPool,</div>
+<div class="line"><a name="l13128"></a><span class="lineno">13128</span>&#160;        m_MemoryTypeIndex,</div>
+<div class="line"><a name="l13129"></a><span class="lineno">13129</span>&#160;        mem,</div>
+<div class="line"><a name="l13130"></a><span class="lineno">13130</span>&#160;        allocInfo.allocationSize,</div>
+<div class="line"><a name="l13131"></a><span class="lineno">13131</span>&#160;        m_NextBlockId++,</div>
+<div class="line"><a name="l13132"></a><span class="lineno">13132</span>&#160;        m_Algorithm);</div>
+<div class="line"><a name="l13133"></a><span class="lineno">13133</span>&#160; </div>
+<div class="line"><a name="l13134"></a><span class="lineno">13134</span>&#160;    m_Blocks.push_back(pBlock);</div>
+<div class="line"><a name="l13135"></a><span class="lineno">13135</span>&#160;    <span class="keywordflow">if</span>(pNewBlockIndex != VMA_NULL)</div>
+<div class="line"><a name="l13136"></a><span class="lineno">13136</span>&#160;    {</div>
+<div class="line"><a name="l13137"></a><span class="lineno">13137</span>&#160;        *pNewBlockIndex = m_Blocks.size() - 1;</div>
+<div class="line"><a name="l13138"></a><span class="lineno">13138</span>&#160;    }</div>
+<div class="line"><a name="l13139"></a><span class="lineno">13139</span>&#160; </div>
+<div class="line"><a name="l13140"></a><span class="lineno">13140</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l13141"></a><span class="lineno">13141</span>&#160;}</div>
+<div class="line"><a name="l13142"></a><span class="lineno">13142</span>&#160; </div>
+<div class="line"><a name="l13143"></a><span class="lineno">13143</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::ApplyDefragmentationMovesCpu(</div>
+<div class="line"><a name="l13144"></a><span class="lineno">13144</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pDefragCtx,</div>
+<div class="line"><a name="l13145"></a><span class="lineno">13145</span>&#160;    <span class="keyword">const</span> VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves)</div>
+<div class="line"><a name="l13146"></a><span class="lineno">13146</span>&#160;{</div>
+<div class="line"><a name="l13147"></a><span class="lineno">13147</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_Blocks.size();</div>
+<div class="line"><a name="l13148"></a><span class="lineno">13148</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isNonCoherent = m_hAllocator-&gt;IsMemoryTypeNonCoherent(m_MemoryTypeIndex);</div>
+<div class="line"><a name="l13149"></a><span class="lineno">13149</span>&#160; </div>
+<div class="line"><a name="l13150"></a><span class="lineno">13150</span>&#160;    <span class="keyword">enum</span> BLOCK_FLAG</div>
+<div class="line"><a name="l13151"></a><span class="lineno">13151</span>&#160;    {</div>
+<div class="line"><a name="l13152"></a><span class="lineno">13152</span>&#160;        BLOCK_FLAG_USED = 0x00000001,</div>
+<div class="line"><a name="l13153"></a><span class="lineno">13153</span>&#160;        BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION = 0x00000002,</div>
+<div class="line"><a name="l13154"></a><span class="lineno">13154</span>&#160;    };</div>
+<div class="line"><a name="l13155"></a><span class="lineno">13155</span>&#160; </div>
+<div class="line"><a name="l13156"></a><span class="lineno">13156</span>&#160;    <span class="keyword">struct </span>BlockInfo</div>
+<div class="line"><a name="l13157"></a><span class="lineno">13157</span>&#160;    {</div>
+<div class="line"><a name="l13158"></a><span class="lineno">13158</span>&#160;        uint32_t flags;</div>
+<div class="line"><a name="l13159"></a><span class="lineno">13159</span>&#160;        <span class="keywordtype">void</span>* pMappedData;</div>
+<div class="line"><a name="l13160"></a><span class="lineno">13160</span>&#160;    };</div>
+<div class="line"><a name="l13161"></a><span class="lineno">13161</span>&#160;    VmaVector&lt; BlockInfo, VmaStlAllocator&lt;BlockInfo&gt; &gt;</div>
+<div class="line"><a name="l13162"></a><span class="lineno">13162</span>&#160;        blockInfo(blockCount, BlockInfo(), VmaStlAllocator&lt;BlockInfo&gt;(m_hAllocator-&gt;GetAllocationCallbacks()));</div>
+<div class="line"><a name="l13163"></a><span class="lineno">13163</span>&#160;    memset(blockInfo.data(), 0, blockCount * <span class="keyword">sizeof</span>(BlockInfo));</div>
+<div class="line"><a name="l13164"></a><span class="lineno">13164</span>&#160; </div>
+<div class="line"><a name="l13165"></a><span class="lineno">13165</span>&#160;    <span class="comment">// Go over all moves. Mark blocks that are used with BLOCK_FLAG_USED.</span></div>
+<div class="line"><a name="l13166"></a><span class="lineno">13166</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> moveCount = moves.size();</div>
+<div class="line"><a name="l13167"></a><span class="lineno">13167</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> moveIndex = 0; moveIndex &lt; moveCount; ++moveIndex)</div>
+<div class="line"><a name="l13168"></a><span class="lineno">13168</span>&#160;    {</div>
+<div class="line"><a name="l13169"></a><span class="lineno">13169</span>&#160;        <span class="keyword">const</span> VmaDefragmentationMove&amp; move = moves[moveIndex];</div>
+<div class="line"><a name="l13170"></a><span class="lineno">13170</span>&#160;        blockInfo[move.srcBlockIndex].flags |= BLOCK_FLAG_USED;</div>
+<div class="line"><a name="l13171"></a><span class="lineno">13171</span>&#160;        blockInfo[move.dstBlockIndex].flags |= BLOCK_FLAG_USED;</div>
+<div class="line"><a name="l13172"></a><span class="lineno">13172</span>&#160;    }</div>
+<div class="line"><a name="l13173"></a><span class="lineno">13173</span>&#160; </div>
+<div class="line"><a name="l13174"></a><span class="lineno">13174</span>&#160;    VMA_ASSERT(pDefragCtx-&gt;res == VK_SUCCESS);</div>
 <div class="line"><a name="l13175"></a><span class="lineno">13175</span>&#160; </div>
-<div class="line"><a name="l13176"></a><span class="lineno">13176</span>&#160;        json.WriteString(<span class="stringliteral">&quot;BlockCount&quot;</span>);</div>
-<div class="line"><a name="l13177"></a><span class="lineno">13177</span>&#160;        json.BeginObject(<span class="keyword">true</span>);</div>
-<div class="line"><a name="l13178"></a><span class="lineno">13178</span>&#160;        <span class="keywordflow">if</span>(m_MinBlockCount &gt; 0)</div>
-<div class="line"><a name="l13179"></a><span class="lineno">13179</span>&#160;        {</div>
-<div class="line"><a name="l13180"></a><span class="lineno">13180</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Min&quot;</span>);</div>
-<div class="line"><a name="l13181"></a><span class="lineno">13181</span>&#160;            json.WriteNumber((uint64_t)m_MinBlockCount);</div>
-<div class="line"><a name="l13182"></a><span class="lineno">13182</span>&#160;        }</div>
-<div class="line"><a name="l13183"></a><span class="lineno">13183</span>&#160;        <span class="keywordflow">if</span>(m_MaxBlockCount &lt; SIZE_MAX)</div>
-<div class="line"><a name="l13184"></a><span class="lineno">13184</span>&#160;        {</div>
-<div class="line"><a name="l13185"></a><span class="lineno">13185</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Max&quot;</span>);</div>
-<div class="line"><a name="l13186"></a><span class="lineno">13186</span>&#160;            json.WriteNumber((uint64_t)m_MaxBlockCount);</div>
-<div class="line"><a name="l13187"></a><span class="lineno">13187</span>&#160;        }</div>
-<div class="line"><a name="l13188"></a><span class="lineno">13188</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Cur&quot;</span>);</div>
-<div class="line"><a name="l13189"></a><span class="lineno">13189</span>&#160;        json.WriteNumber((uint64_t)m_Blocks.size());</div>
-<div class="line"><a name="l13190"></a><span class="lineno">13190</span>&#160;        json.EndObject();</div>
-<div class="line"><a name="l13191"></a><span class="lineno">13191</span>&#160; </div>
-<div class="line"><a name="l13192"></a><span class="lineno">13192</span>&#160;        <span class="keywordflow">if</span>(m_FrameInUseCount &gt; 0)</div>
-<div class="line"><a name="l13193"></a><span class="lineno">13193</span>&#160;        {</div>
-<div class="line"><a name="l13194"></a><span class="lineno">13194</span>&#160;            json.WriteString(<span class="stringliteral">&quot;FrameInUseCount&quot;</span>);</div>
-<div class="line"><a name="l13195"></a><span class="lineno">13195</span>&#160;            json.WriteNumber(m_FrameInUseCount);</div>
-<div class="line"><a name="l13196"></a><span class="lineno">13196</span>&#160;        }</div>
-<div class="line"><a name="l13197"></a><span class="lineno">13197</span>&#160; </div>
-<div class="line"><a name="l13198"></a><span class="lineno">13198</span>&#160;        <span class="keywordflow">if</span>(m_Algorithm != 0)</div>
-<div class="line"><a name="l13199"></a><span class="lineno">13199</span>&#160;        {</div>
-<div class="line"><a name="l13200"></a><span class="lineno">13200</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Algorithm&quot;</span>);</div>
-<div class="line"><a name="l13201"></a><span class="lineno">13201</span>&#160;            json.WriteString(VmaAlgorithmToStr(m_Algorithm));</div>
-<div class="line"><a name="l13202"></a><span class="lineno">13202</span>&#160;        }</div>
-<div class="line"><a name="l13203"></a><span class="lineno">13203</span>&#160;    }</div>
-<div class="line"><a name="l13204"></a><span class="lineno">13204</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13205"></a><span class="lineno">13205</span>&#160;    {</div>
-<div class="line"><a name="l13206"></a><span class="lineno">13206</span>&#160;        json.WriteString(<span class="stringliteral">&quot;PreferredBlockSize&quot;</span>);</div>
-<div class="line"><a name="l13207"></a><span class="lineno">13207</span>&#160;        json.WriteNumber(m_PreferredBlockSize);</div>
-<div class="line"><a name="l13208"></a><span class="lineno">13208</span>&#160;    }</div>
-<div class="line"><a name="l13209"></a><span class="lineno">13209</span>&#160; </div>
-<div class="line"><a name="l13210"></a><span class="lineno">13210</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Blocks&quot;</span>);</div>
-<div class="line"><a name="l13211"></a><span class="lineno">13211</span>&#160;    json.BeginObject();</div>
-<div class="line"><a name="l13212"></a><span class="lineno">13212</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_Blocks.size(); ++i)</div>
-<div class="line"><a name="l13213"></a><span class="lineno">13213</span>&#160;    {</div>
-<div class="line"><a name="l13214"></a><span class="lineno">13214</span>&#160;        json.BeginString();</div>
-<div class="line"><a name="l13215"></a><span class="lineno">13215</span>&#160;        json.ContinueString(m_Blocks[i]-&gt;GetId());</div>
-<div class="line"><a name="l13216"></a><span class="lineno">13216</span>&#160;        json.EndString();</div>
-<div class="line"><a name="l13217"></a><span class="lineno">13217</span>&#160; </div>
-<div class="line"><a name="l13218"></a><span class="lineno">13218</span>&#160;        m_Blocks[i]-&gt;m_pMetadata-&gt;PrintDetailedMap(json);</div>
-<div class="line"><a name="l13219"></a><span class="lineno">13219</span>&#160;    }</div>
-<div class="line"><a name="l13220"></a><span class="lineno">13220</span>&#160;    json.EndObject();</div>
-<div class="line"><a name="l13221"></a><span class="lineno">13221</span>&#160; </div>
-<div class="line"><a name="l13222"></a><span class="lineno">13222</span>&#160;    json.EndObject();</div>
-<div class="line"><a name="l13223"></a><span class="lineno">13223</span>&#160;}</div>
-<div class="line"><a name="l13224"></a><span class="lineno">13224</span>&#160; </div>
-<div class="line"><a name="l13225"></a><span class="lineno">13225</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l13226"></a><span class="lineno">13226</span>&#160; </div>
-<div class="line"><a name="l13227"></a><span class="lineno">13227</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::Defragment(</div>
-<div class="line"><a name="l13228"></a><span class="lineno">13228</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pCtx,</div>
-<div class="line"><a name="l13229"></a><span class="lineno">13229</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags,</div>
-<div class="line"><a name="l13230"></a><span class="lineno">13230</span>&#160;    VkDeviceSize&amp; maxCpuBytesToMove, uint32_t&amp; maxCpuAllocationsToMove,</div>
-<div class="line"><a name="l13231"></a><span class="lineno">13231</span>&#160;    VkDeviceSize&amp; maxGpuBytesToMove, uint32_t&amp; maxGpuAllocationsToMove,</div>
-<div class="line"><a name="l13232"></a><span class="lineno">13232</span>&#160;    VkCommandBuffer commandBuffer)</div>
-<div class="line"><a name="l13233"></a><span class="lineno">13233</span>&#160;{</div>
-<div class="line"><a name="l13234"></a><span class="lineno">13234</span>&#160;    pCtx-&gt;res = VK_SUCCESS;</div>
-<div class="line"><a name="l13235"></a><span class="lineno">13235</span>&#160;    </div>
-<div class="line"><a name="l13236"></a><span class="lineno">13236</span>&#160;    <span class="keyword">const</span> VkMemoryPropertyFlags memPropFlags =</div>
-<div class="line"><a name="l13237"></a><span class="lineno">13237</span>&#160;        m_hAllocator-&gt;m_MemProps.memoryTypes[m_MemoryTypeIndex].propertyFlags;</div>
-<div class="line"><a name="l13238"></a><span class="lineno">13238</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isHostVisible = (memPropFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0;</div>
-<div class="line"><a name="l13239"></a><span class="lineno">13239</span>&#160; </div>
-<div class="line"><a name="l13240"></a><span class="lineno">13240</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> canDefragmentOnCpu = maxCpuBytesToMove &gt; 0 &amp;&amp; maxCpuAllocationsToMove &gt; 0 &amp;&amp;</div>
-<div class="line"><a name="l13241"></a><span class="lineno">13241</span>&#160;        isHostVisible;</div>
-<div class="line"><a name="l13242"></a><span class="lineno">13242</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> canDefragmentOnGpu = maxGpuBytesToMove &gt; 0 &amp;&amp; maxGpuAllocationsToMove &gt; 0 &amp;&amp;</div>
-<div class="line"><a name="l13243"></a><span class="lineno">13243</span>&#160;        !IsCorruptionDetectionEnabled() &amp;&amp;</div>
-<div class="line"><a name="l13244"></a><span class="lineno">13244</span>&#160;        ((1u &lt;&lt; m_MemoryTypeIndex) &amp; m_hAllocator-&gt;GetGpuDefragmentationMemoryTypeBits()) != 0;</div>
-<div class="line"><a name="l13245"></a><span class="lineno">13245</span>&#160; </div>
-<div class="line"><a name="l13246"></a><span class="lineno">13246</span>&#160;    <span class="comment">// There are options to defragment this memory type.</span></div>
-<div class="line"><a name="l13247"></a><span class="lineno">13247</span>&#160;    <span class="keywordflow">if</span>(canDefragmentOnCpu || canDefragmentOnGpu)</div>
-<div class="line"><a name="l13248"></a><span class="lineno">13248</span>&#160;    {</div>
-<div class="line"><a name="l13249"></a><span class="lineno">13249</span>&#160;        <span class="keywordtype">bool</span> defragmentOnGpu;</div>
-<div class="line"><a name="l13250"></a><span class="lineno">13250</span>&#160;        <span class="comment">// There is only one option to defragment this memory type.</span></div>
-<div class="line"><a name="l13251"></a><span class="lineno">13251</span>&#160;        <span class="keywordflow">if</span>(canDefragmentOnGpu != canDefragmentOnCpu)</div>
-<div class="line"><a name="l13252"></a><span class="lineno">13252</span>&#160;        {</div>
-<div class="line"><a name="l13253"></a><span class="lineno">13253</span>&#160;            defragmentOnGpu = canDefragmentOnGpu;</div>
-<div class="line"><a name="l13254"></a><span class="lineno">13254</span>&#160;        }</div>
-<div class="line"><a name="l13255"></a><span class="lineno">13255</span>&#160;        <span class="comment">// Both options are available: Heuristics to choose the best one.</span></div>
-<div class="line"><a name="l13256"></a><span class="lineno">13256</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13257"></a><span class="lineno">13257</span>&#160;        {</div>
-<div class="line"><a name="l13258"></a><span class="lineno">13258</span>&#160;            defragmentOnGpu = (memPropFlags &amp; VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0 ||</div>
-<div class="line"><a name="l13259"></a><span class="lineno">13259</span>&#160;                m_hAllocator-&gt;IsIntegratedGpu();</div>
-<div class="line"><a name="l13260"></a><span class="lineno">13260</span>&#160;        }</div>
+<div class="line"><a name="l13176"></a><span class="lineno">13176</span>&#160;    <span class="comment">// Go over all blocks. Get mapped pointer or map if necessary.</span></div>
+<div class="line"><a name="l13177"></a><span class="lineno">13177</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; pDefragCtx-&gt;res == VK_SUCCESS &amp;&amp; blockIndex &lt; blockCount; ++blockIndex)</div>
+<div class="line"><a name="l13178"></a><span class="lineno">13178</span>&#160;    {</div>
+<div class="line"><a name="l13179"></a><span class="lineno">13179</span>&#160;        BlockInfo&amp; currBlockInfo = blockInfo[blockIndex];</div>
+<div class="line"><a name="l13180"></a><span class="lineno">13180</span>&#160;        VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l13181"></a><span class="lineno">13181</span>&#160;        <span class="keywordflow">if</span>((currBlockInfo.flags &amp; BLOCK_FLAG_USED) != 0)</div>
+<div class="line"><a name="l13182"></a><span class="lineno">13182</span>&#160;        {</div>
+<div class="line"><a name="l13183"></a><span class="lineno">13183</span>&#160;            currBlockInfo.pMappedData = pBlock-&gt;GetMappedData();</div>
+<div class="line"><a name="l13184"></a><span class="lineno">13184</span>&#160;            <span class="comment">// It is not originally mapped - map it.</span></div>
+<div class="line"><a name="l13185"></a><span class="lineno">13185</span>&#160;            <span class="keywordflow">if</span>(currBlockInfo.pMappedData == VMA_NULL)</div>
+<div class="line"><a name="l13186"></a><span class="lineno">13186</span>&#160;            {</div>
+<div class="line"><a name="l13187"></a><span class="lineno">13187</span>&#160;                pDefragCtx-&gt;res = pBlock-&gt;Map(m_hAllocator, 1, &amp;currBlockInfo.pMappedData);</div>
+<div class="line"><a name="l13188"></a><span class="lineno">13188</span>&#160;                <span class="keywordflow">if</span>(pDefragCtx-&gt;res == VK_SUCCESS)</div>
+<div class="line"><a name="l13189"></a><span class="lineno">13189</span>&#160;                {</div>
+<div class="line"><a name="l13190"></a><span class="lineno">13190</span>&#160;                    currBlockInfo.flags |= BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION;</div>
+<div class="line"><a name="l13191"></a><span class="lineno">13191</span>&#160;                }</div>
+<div class="line"><a name="l13192"></a><span class="lineno">13192</span>&#160;            }</div>
+<div class="line"><a name="l13193"></a><span class="lineno">13193</span>&#160;        }</div>
+<div class="line"><a name="l13194"></a><span class="lineno">13194</span>&#160;    }</div>
+<div class="line"><a name="l13195"></a><span class="lineno">13195</span>&#160; </div>
+<div class="line"><a name="l13196"></a><span class="lineno">13196</span>&#160;    <span class="comment">// Go over all moves. Do actual data transfer.</span></div>
+<div class="line"><a name="l13197"></a><span class="lineno">13197</span>&#160;    <span class="keywordflow">if</span>(pDefragCtx-&gt;res == VK_SUCCESS)</div>
+<div class="line"><a name="l13198"></a><span class="lineno">13198</span>&#160;    {</div>
+<div class="line"><a name="l13199"></a><span class="lineno">13199</span>&#160;        <span class="keyword">const</span> VkDeviceSize nonCoherentAtomSize = m_hAllocator-&gt;m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;</div>
+<div class="line"><a name="l13200"></a><span class="lineno">13200</span>&#160;        VkMappedMemoryRange memRange = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE };</div>
+<div class="line"><a name="l13201"></a><span class="lineno">13201</span>&#160; </div>
+<div class="line"><a name="l13202"></a><span class="lineno">13202</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> moveIndex = 0; moveIndex &lt; moveCount; ++moveIndex)</div>
+<div class="line"><a name="l13203"></a><span class="lineno">13203</span>&#160;        {</div>
+<div class="line"><a name="l13204"></a><span class="lineno">13204</span>&#160;            <span class="keyword">const</span> VmaDefragmentationMove&amp; move = moves[moveIndex];</div>
+<div class="line"><a name="l13205"></a><span class="lineno">13205</span>&#160; </div>
+<div class="line"><a name="l13206"></a><span class="lineno">13206</span>&#160;            <span class="keyword">const</span> BlockInfo&amp; srcBlockInfo = blockInfo[move.srcBlockIndex];</div>
+<div class="line"><a name="l13207"></a><span class="lineno">13207</span>&#160;            <span class="keyword">const</span> BlockInfo&amp; dstBlockInfo = blockInfo[move.dstBlockIndex];</div>
+<div class="line"><a name="l13208"></a><span class="lineno">13208</span>&#160; </div>
+<div class="line"><a name="l13209"></a><span class="lineno">13209</span>&#160;            VMA_ASSERT(srcBlockInfo.pMappedData &amp;&amp; dstBlockInfo.pMappedData);</div>
+<div class="line"><a name="l13210"></a><span class="lineno">13210</span>&#160; </div>
+<div class="line"><a name="l13211"></a><span class="lineno">13211</span>&#160;            <span class="comment">// Invalidate source.</span></div>
+<div class="line"><a name="l13212"></a><span class="lineno">13212</span>&#160;            <span class="keywordflow">if</span>(isNonCoherent)</div>
+<div class="line"><a name="l13213"></a><span class="lineno">13213</span>&#160;            {</div>
+<div class="line"><a name="l13214"></a><span class="lineno">13214</span>&#160;                VmaDeviceMemoryBlock* <span class="keyword">const</span> pSrcBlock = m_Blocks[move.srcBlockIndex];</div>
+<div class="line"><a name="l13215"></a><span class="lineno">13215</span>&#160;                memRange.memory = pSrcBlock-&gt;GetDeviceMemory();</div>
+<div class="line"><a name="l13216"></a><span class="lineno">13216</span>&#160;                memRange.offset = VmaAlignDown(move.srcOffset, nonCoherentAtomSize);</div>
+<div class="line"><a name="l13217"></a><span class="lineno">13217</span>&#160;                memRange.size = VMA_MIN(</div>
+<div class="line"><a name="l13218"></a><span class="lineno">13218</span>&#160;                    VmaAlignUp(move.size + (move.srcOffset - memRange.offset), nonCoherentAtomSize),</div>
+<div class="line"><a name="l13219"></a><span class="lineno">13219</span>&#160;                    pSrcBlock-&gt;m_pMetadata-&gt;GetSize() - memRange.offset);</div>
+<div class="line"><a name="l13220"></a><span class="lineno">13220</span>&#160;                (*m_hAllocator-&gt;GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hAllocator-&gt;m_hDevice, 1, &amp;memRange);</div>
+<div class="line"><a name="l13221"></a><span class="lineno">13221</span>&#160;            }</div>
+<div class="line"><a name="l13222"></a><span class="lineno">13222</span>&#160; </div>
+<div class="line"><a name="l13223"></a><span class="lineno">13223</span>&#160;            <span class="comment">// THE PLACE WHERE ACTUAL DATA COPY HAPPENS.</span></div>
+<div class="line"><a name="l13224"></a><span class="lineno">13224</span>&#160;            memmove(</div>
+<div class="line"><a name="l13225"></a><span class="lineno">13225</span>&#160;                <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">char</span>*<span class="keyword">&gt;</span>(dstBlockInfo.pMappedData) + move.dstOffset,</div>
+<div class="line"><a name="l13226"></a><span class="lineno">13226</span>&#160;                <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">char</span>*<span class="keyword">&gt;</span>(srcBlockInfo.pMappedData) + move.srcOffset,</div>
+<div class="line"><a name="l13227"></a><span class="lineno">13227</span>&#160;                <span class="keyword">static_cast&lt;</span><span class="keywordtype">size_t</span><span class="keyword">&gt;</span>(move.size));</div>
+<div class="line"><a name="l13228"></a><span class="lineno">13228</span>&#160; </div>
+<div class="line"><a name="l13229"></a><span class="lineno">13229</span>&#160;            <span class="keywordflow">if</span>(IsCorruptionDetectionEnabled())</div>
+<div class="line"><a name="l13230"></a><span class="lineno">13230</span>&#160;            {</div>
+<div class="line"><a name="l13231"></a><span class="lineno">13231</span>&#160;                VmaWriteMagicValue(dstBlockInfo.pMappedData, move.dstOffset - VMA_DEBUG_MARGIN);</div>
+<div class="line"><a name="l13232"></a><span class="lineno">13232</span>&#160;                VmaWriteMagicValue(dstBlockInfo.pMappedData, move.dstOffset + move.size);</div>
+<div class="line"><a name="l13233"></a><span class="lineno">13233</span>&#160;            }</div>
+<div class="line"><a name="l13234"></a><span class="lineno">13234</span>&#160; </div>
+<div class="line"><a name="l13235"></a><span class="lineno">13235</span>&#160;            <span class="comment">// Flush destination.</span></div>
+<div class="line"><a name="l13236"></a><span class="lineno">13236</span>&#160;            <span class="keywordflow">if</span>(isNonCoherent)</div>
+<div class="line"><a name="l13237"></a><span class="lineno">13237</span>&#160;            {</div>
+<div class="line"><a name="l13238"></a><span class="lineno">13238</span>&#160;                VmaDeviceMemoryBlock* <span class="keyword">const</span> pDstBlock = m_Blocks[move.dstBlockIndex];</div>
+<div class="line"><a name="l13239"></a><span class="lineno">13239</span>&#160;                memRange.memory = pDstBlock-&gt;GetDeviceMemory();</div>
+<div class="line"><a name="l13240"></a><span class="lineno">13240</span>&#160;                memRange.offset = VmaAlignDown(move.dstOffset, nonCoherentAtomSize);</div>
+<div class="line"><a name="l13241"></a><span class="lineno">13241</span>&#160;                memRange.size = VMA_MIN(</div>
+<div class="line"><a name="l13242"></a><span class="lineno">13242</span>&#160;                    VmaAlignUp(move.size + (move.dstOffset - memRange.offset), nonCoherentAtomSize),</div>
+<div class="line"><a name="l13243"></a><span class="lineno">13243</span>&#160;                    pDstBlock-&gt;m_pMetadata-&gt;GetSize() - memRange.offset);</div>
+<div class="line"><a name="l13244"></a><span class="lineno">13244</span>&#160;                (*m_hAllocator-&gt;GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hAllocator-&gt;m_hDevice, 1, &amp;memRange);</div>
+<div class="line"><a name="l13245"></a><span class="lineno">13245</span>&#160;            }</div>
+<div class="line"><a name="l13246"></a><span class="lineno">13246</span>&#160;        }</div>
+<div class="line"><a name="l13247"></a><span class="lineno">13247</span>&#160;    }</div>
+<div class="line"><a name="l13248"></a><span class="lineno">13248</span>&#160; </div>
+<div class="line"><a name="l13249"></a><span class="lineno">13249</span>&#160;    <span class="comment">// Go over all blocks in reverse order. Unmap those that were mapped just for defragmentation.</span></div>
+<div class="line"><a name="l13250"></a><span class="lineno">13250</span>&#160;    <span class="comment">// Regardless of pCtx-&gt;res == VK_SUCCESS.</span></div>
+<div class="line"><a name="l13251"></a><span class="lineno">13251</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = blockCount; blockIndex--; )</div>
+<div class="line"><a name="l13252"></a><span class="lineno">13252</span>&#160;    {</div>
+<div class="line"><a name="l13253"></a><span class="lineno">13253</span>&#160;        <span class="keyword">const</span> BlockInfo&amp; currBlockInfo = blockInfo[blockIndex];</div>
+<div class="line"><a name="l13254"></a><span class="lineno">13254</span>&#160;        <span class="keywordflow">if</span>((currBlockInfo.flags &amp; BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION) != 0)</div>
+<div class="line"><a name="l13255"></a><span class="lineno">13255</span>&#160;        {</div>
+<div class="line"><a name="l13256"></a><span class="lineno">13256</span>&#160;            VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l13257"></a><span class="lineno">13257</span>&#160;            pBlock-&gt;Unmap(m_hAllocator, 1);</div>
+<div class="line"><a name="l13258"></a><span class="lineno">13258</span>&#160;        }</div>
+<div class="line"><a name="l13259"></a><span class="lineno">13259</span>&#160;    }</div>
+<div class="line"><a name="l13260"></a><span class="lineno">13260</span>&#160;}</div>
 <div class="line"><a name="l13261"></a><span class="lineno">13261</span>&#160; </div>
-<div class="line"><a name="l13262"></a><span class="lineno">13262</span>&#160;        <span class="keywordtype">bool</span> overlappingMoveSupported = !defragmentOnGpu;</div>
-<div class="line"><a name="l13263"></a><span class="lineno">13263</span>&#160; </div>
-<div class="line"><a name="l13264"></a><span class="lineno">13264</span>&#160;        <span class="keywordflow">if</span>(m_hAllocator-&gt;m_UseMutex)</div>
-<div class="line"><a name="l13265"></a><span class="lineno">13265</span>&#160;        {</div>
-<div class="line"><a name="l13266"></a><span class="lineno">13266</span>&#160;            <span class="keywordflow">if</span>(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a>)</div>
-<div class="line"><a name="l13267"></a><span class="lineno">13267</span>&#160;            {</div>
-<div class="line"><a name="l13268"></a><span class="lineno">13268</span>&#160;                <span class="keywordflow">if</span>(!m_Mutex.TryLockWrite())</div>
-<div class="line"><a name="l13269"></a><span class="lineno">13269</span>&#160;                {</div>
-<div class="line"><a name="l13270"></a><span class="lineno">13270</span>&#160;                    pCtx-&gt;res = VK_ERROR_INITIALIZATION_FAILED;</div>
-<div class="line"><a name="l13271"></a><span class="lineno">13271</span>&#160;                    <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l13272"></a><span class="lineno">13272</span>&#160;                }</div>
-<div class="line"><a name="l13273"></a><span class="lineno">13273</span>&#160;            }</div>
-<div class="line"><a name="l13274"></a><span class="lineno">13274</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13275"></a><span class="lineno">13275</span>&#160;            {</div>
-<div class="line"><a name="l13276"></a><span class="lineno">13276</span>&#160;                m_Mutex.LockWrite();</div>
-<div class="line"><a name="l13277"></a><span class="lineno">13277</span>&#160;                pCtx-&gt;mutexLocked = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l13278"></a><span class="lineno">13278</span>&#160;            }</div>
-<div class="line"><a name="l13279"></a><span class="lineno">13279</span>&#160;        }</div>
-<div class="line"><a name="l13280"></a><span class="lineno">13280</span>&#160; </div>
-<div class="line"><a name="l13281"></a><span class="lineno">13281</span>&#160;        pCtx-&gt;Begin(overlappingMoveSupported, flags);</div>
-<div class="line"><a name="l13282"></a><span class="lineno">13282</span>&#160; </div>
-<div class="line"><a name="l13283"></a><span class="lineno">13283</span>&#160;        <span class="comment">// Defragment.</span></div>
-<div class="line"><a name="l13284"></a><span class="lineno">13284</span>&#160; </div>
-<div class="line"><a name="l13285"></a><span class="lineno">13285</span>&#160;        <span class="keyword">const</span> VkDeviceSize maxBytesToMove = defragmentOnGpu ? maxGpuBytesToMove : maxCpuBytesToMove;</div>
-<div class="line"><a name="l13286"></a><span class="lineno">13286</span>&#160;        <span class="keyword">const</span> uint32_t maxAllocationsToMove = defragmentOnGpu ? maxGpuAllocationsToMove : maxCpuAllocationsToMove;</div>
-<div class="line"><a name="l13287"></a><span class="lineno">13287</span>&#160;        pCtx-&gt;res = pCtx-&gt;GetAlgorithm()-&gt;Defragment(pCtx-&gt;defragmentationMoves, maxBytesToMove, maxAllocationsToMove, flags);</div>
-<div class="line"><a name="l13288"></a><span class="lineno">13288</span>&#160; </div>
-<div class="line"><a name="l13289"></a><span class="lineno">13289</span>&#160;        <span class="comment">// Accumulate statistics.</span></div>
-<div class="line"><a name="l13290"></a><span class="lineno">13290</span>&#160;        <span class="keywordflow">if</span>(pStats != VMA_NULL)</div>
-<div class="line"><a name="l13291"></a><span class="lineno">13291</span>&#160;        {</div>
-<div class="line"><a name="l13292"></a><span class="lineno">13292</span>&#160;            <span class="keyword">const</span> VkDeviceSize bytesMoved = pCtx-&gt;GetAlgorithm()-&gt;GetBytesMoved();</div>
-<div class="line"><a name="l13293"></a><span class="lineno">13293</span>&#160;            <span class="keyword">const</span> uint32_t allocationsMoved = pCtx-&gt;GetAlgorithm()-&gt;GetAllocationsMoved();</div>
-<div class="line"><a name="l13294"></a><span class="lineno">13294</span>&#160;            pStats-&gt;<a class="code" href="struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d">bytesMoved</a> += bytesMoved;</div>
-<div class="line"><a name="l13295"></a><span class="lineno">13295</span>&#160;            pStats-&gt;<a class="code" href="struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9">allocationsMoved</a> += allocationsMoved;</div>
-<div class="line"><a name="l13296"></a><span class="lineno">13296</span>&#160;            VMA_ASSERT(bytesMoved &lt;= maxBytesToMove);</div>
-<div class="line"><a name="l13297"></a><span class="lineno">13297</span>&#160;            VMA_ASSERT(allocationsMoved &lt;= maxAllocationsToMove);</div>
-<div class="line"><a name="l13298"></a><span class="lineno">13298</span>&#160;            <span class="keywordflow">if</span>(defragmentOnGpu)</div>
-<div class="line"><a name="l13299"></a><span class="lineno">13299</span>&#160;            {</div>
-<div class="line"><a name="l13300"></a><span class="lineno">13300</span>&#160;                maxGpuBytesToMove -= bytesMoved;</div>
-<div class="line"><a name="l13301"></a><span class="lineno">13301</span>&#160;                maxGpuAllocationsToMove -= allocationsMoved;</div>
-<div class="line"><a name="l13302"></a><span class="lineno">13302</span>&#160;            }</div>
-<div class="line"><a name="l13303"></a><span class="lineno">13303</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13304"></a><span class="lineno">13304</span>&#160;            {</div>
-<div class="line"><a name="l13305"></a><span class="lineno">13305</span>&#160;                maxCpuBytesToMove -= bytesMoved;</div>
-<div class="line"><a name="l13306"></a><span class="lineno">13306</span>&#160;                maxCpuAllocationsToMove -= allocationsMoved;</div>
+<div class="line"><a name="l13262"></a><span class="lineno">13262</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::ApplyDefragmentationMovesGpu(</div>
+<div class="line"><a name="l13263"></a><span class="lineno">13263</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pDefragCtx,</div>
+<div class="line"><a name="l13264"></a><span class="lineno">13264</span>&#160;    VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
+<div class="line"><a name="l13265"></a><span class="lineno">13265</span>&#160;    VkCommandBuffer commandBuffer)</div>
+<div class="line"><a name="l13266"></a><span class="lineno">13266</span>&#160;{</div>
+<div class="line"><a name="l13267"></a><span class="lineno">13267</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_Blocks.size();</div>
+<div class="line"><a name="l13268"></a><span class="lineno">13268</span>&#160; </div>
+<div class="line"><a name="l13269"></a><span class="lineno">13269</span>&#160;    pDefragCtx-&gt;blockContexts.resize(blockCount);</div>
+<div class="line"><a name="l13270"></a><span class="lineno">13270</span>&#160;    memset(pDefragCtx-&gt;blockContexts.data(), 0, blockCount * <span class="keyword">sizeof</span>(VmaBlockDefragmentationContext));</div>
+<div class="line"><a name="l13271"></a><span class="lineno">13271</span>&#160; </div>
+<div class="line"><a name="l13272"></a><span class="lineno">13272</span>&#160;    <span class="comment">// Go over all moves. Mark blocks that are used with BLOCK_FLAG_USED.</span></div>
+<div class="line"><a name="l13273"></a><span class="lineno">13273</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> moveCount = moves.size();</div>
+<div class="line"><a name="l13274"></a><span class="lineno">13274</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> moveIndex = 0; moveIndex &lt; moveCount; ++moveIndex)</div>
+<div class="line"><a name="l13275"></a><span class="lineno">13275</span>&#160;    {</div>
+<div class="line"><a name="l13276"></a><span class="lineno">13276</span>&#160;        <span class="keyword">const</span> VmaDefragmentationMove&amp; move = moves[moveIndex];</div>
+<div class="line"><a name="l13277"></a><span class="lineno">13277</span>&#160; </div>
+<div class="line"><a name="l13278"></a><span class="lineno">13278</span>&#160;        <span class="comment">//if(move.type == VMA_ALLOCATION_TYPE_UNKNOWN)</span></div>
+<div class="line"><a name="l13279"></a><span class="lineno">13279</span>&#160;        {</div>
+<div class="line"><a name="l13280"></a><span class="lineno">13280</span>&#160;            <span class="comment">// Old school move still require us to map the whole block</span></div>
+<div class="line"><a name="l13281"></a><span class="lineno">13281</span>&#160;            pDefragCtx-&gt;blockContexts[move.srcBlockIndex].flags |= VmaBlockDefragmentationContext::BLOCK_FLAG_USED;</div>
+<div class="line"><a name="l13282"></a><span class="lineno">13282</span>&#160;            pDefragCtx-&gt;blockContexts[move.dstBlockIndex].flags |= VmaBlockDefragmentationContext::BLOCK_FLAG_USED;</div>
+<div class="line"><a name="l13283"></a><span class="lineno">13283</span>&#160;        }</div>
+<div class="line"><a name="l13284"></a><span class="lineno">13284</span>&#160;    }</div>
+<div class="line"><a name="l13285"></a><span class="lineno">13285</span>&#160; </div>
+<div class="line"><a name="l13286"></a><span class="lineno">13286</span>&#160;    VMA_ASSERT(pDefragCtx-&gt;res == VK_SUCCESS);</div>
+<div class="line"><a name="l13287"></a><span class="lineno">13287</span>&#160; </div>
+<div class="line"><a name="l13288"></a><span class="lineno">13288</span>&#160;    <span class="comment">// Go over all blocks. Create and bind buffer for whole block if necessary.</span></div>
+<div class="line"><a name="l13289"></a><span class="lineno">13289</span>&#160;    {</div>
+<div class="line"><a name="l13290"></a><span class="lineno">13290</span>&#160;        VkBufferCreateInfo bufCreateInfo;</div>
+<div class="line"><a name="l13291"></a><span class="lineno">13291</span>&#160;        VmaFillGpuDefragmentationBufferCreateInfo(bufCreateInfo);</div>
+<div class="line"><a name="l13292"></a><span class="lineno">13292</span>&#160; </div>
+<div class="line"><a name="l13293"></a><span class="lineno">13293</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; pDefragCtx-&gt;res == VK_SUCCESS &amp;&amp; blockIndex &lt; blockCount; ++blockIndex)</div>
+<div class="line"><a name="l13294"></a><span class="lineno">13294</span>&#160;        {</div>
+<div class="line"><a name="l13295"></a><span class="lineno">13295</span>&#160;            VmaBlockDefragmentationContext&amp; currBlockCtx = pDefragCtx-&gt;blockContexts[blockIndex];</div>
+<div class="line"><a name="l13296"></a><span class="lineno">13296</span>&#160;            VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l13297"></a><span class="lineno">13297</span>&#160;            <span class="keywordflow">if</span>((currBlockCtx.flags &amp; VmaBlockDefragmentationContext::BLOCK_FLAG_USED) != 0)</div>
+<div class="line"><a name="l13298"></a><span class="lineno">13298</span>&#160;            {</div>
+<div class="line"><a name="l13299"></a><span class="lineno">13299</span>&#160;                bufCreateInfo.size = pBlock-&gt;m_pMetadata-&gt;GetSize();</div>
+<div class="line"><a name="l13300"></a><span class="lineno">13300</span>&#160;                pDefragCtx-&gt;res = (*m_hAllocator-&gt;GetVulkanFunctions().vkCreateBuffer)(</div>
+<div class="line"><a name="l13301"></a><span class="lineno">13301</span>&#160;                    m_hAllocator-&gt;m_hDevice, &amp;bufCreateInfo, m_hAllocator-&gt;GetAllocationCallbacks(), &amp;currBlockCtx.hBuffer);</div>
+<div class="line"><a name="l13302"></a><span class="lineno">13302</span>&#160;                <span class="keywordflow">if</span>(pDefragCtx-&gt;res == VK_SUCCESS)</div>
+<div class="line"><a name="l13303"></a><span class="lineno">13303</span>&#160;                {</div>
+<div class="line"><a name="l13304"></a><span class="lineno">13304</span>&#160;                    pDefragCtx-&gt;res = (*m_hAllocator-&gt;GetVulkanFunctions().vkBindBufferMemory)(</div>
+<div class="line"><a name="l13305"></a><span class="lineno">13305</span>&#160;                        m_hAllocator-&gt;m_hDevice, currBlockCtx.hBuffer, pBlock-&gt;GetDeviceMemory(), 0);</div>
+<div class="line"><a name="l13306"></a><span class="lineno">13306</span>&#160;                }</div>
 <div class="line"><a name="l13307"></a><span class="lineno">13307</span>&#160;            }</div>
 <div class="line"><a name="l13308"></a><span class="lineno">13308</span>&#160;        }</div>
-<div class="line"><a name="l13309"></a><span class="lineno">13309</span>&#160; </div>
-<div class="line"><a name="l13310"></a><span class="lineno">13310</span>&#160;        <span class="keywordflow">if</span>(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a>)</div>
-<div class="line"><a name="l13311"></a><span class="lineno">13311</span>&#160;        {</div>
-<div class="line"><a name="l13312"></a><span class="lineno">13312</span>&#160;            <span class="keywordflow">if</span>(m_hAllocator-&gt;m_UseMutex)</div>
-<div class="line"><a name="l13313"></a><span class="lineno">13313</span>&#160;                m_Mutex.UnlockWrite();</div>
-<div class="line"><a name="l13314"></a><span class="lineno">13314</span>&#160;            </div>
-<div class="line"><a name="l13315"></a><span class="lineno">13315</span>&#160;            <span class="keywordflow">if</span>(pCtx-&gt;res &gt;= VK_SUCCESS &amp;&amp; !pCtx-&gt;defragmentationMoves.empty())</div>
-<div class="line"><a name="l13316"></a><span class="lineno">13316</span>&#160;                pCtx-&gt;res = VK_NOT_READY;</div>
+<div class="line"><a name="l13309"></a><span class="lineno">13309</span>&#160;    }</div>
+<div class="line"><a name="l13310"></a><span class="lineno">13310</span>&#160; </div>
+<div class="line"><a name="l13311"></a><span class="lineno">13311</span>&#160;    <span class="comment">// Go over all moves. Post data transfer commands to command buffer.</span></div>
+<div class="line"><a name="l13312"></a><span class="lineno">13312</span>&#160;    <span class="keywordflow">if</span>(pDefragCtx-&gt;res == VK_SUCCESS)</div>
+<div class="line"><a name="l13313"></a><span class="lineno">13313</span>&#160;    {</div>
+<div class="line"><a name="l13314"></a><span class="lineno">13314</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> moveIndex = 0; moveIndex &lt; moveCount; ++moveIndex)</div>
+<div class="line"><a name="l13315"></a><span class="lineno">13315</span>&#160;        {</div>
+<div class="line"><a name="l13316"></a><span class="lineno">13316</span>&#160;            <span class="keyword">const</span> VmaDefragmentationMove&amp; move = moves[moveIndex];</div>
 <div class="line"><a name="l13317"></a><span class="lineno">13317</span>&#160; </div>
-<div class="line"><a name="l13318"></a><span class="lineno">13318</span>&#160;            <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l13319"></a><span class="lineno">13319</span>&#160;        }</div>
-<div class="line"><a name="l13320"></a><span class="lineno">13320</span>&#160;    </div>
-<div class="line"><a name="l13321"></a><span class="lineno">13321</span>&#160;        <span class="keywordflow">if</span>(pCtx-&gt;res &gt;= VK_SUCCESS)</div>
-<div class="line"><a name="l13322"></a><span class="lineno">13322</span>&#160;        {</div>
-<div class="line"><a name="l13323"></a><span class="lineno">13323</span>&#160;            <span class="keywordflow">if</span>(defragmentOnGpu)</div>
-<div class="line"><a name="l13324"></a><span class="lineno">13324</span>&#160;            {</div>
-<div class="line"><a name="l13325"></a><span class="lineno">13325</span>&#160;                ApplyDefragmentationMovesGpu(pCtx, pCtx-&gt;defragmentationMoves, commandBuffer);</div>
-<div class="line"><a name="l13326"></a><span class="lineno">13326</span>&#160;            }</div>
-<div class="line"><a name="l13327"></a><span class="lineno">13327</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13328"></a><span class="lineno">13328</span>&#160;            {</div>
-<div class="line"><a name="l13329"></a><span class="lineno">13329</span>&#160;                ApplyDefragmentationMovesCpu(pCtx, pCtx-&gt;defragmentationMoves);</div>
-<div class="line"><a name="l13330"></a><span class="lineno">13330</span>&#160;            }</div>
-<div class="line"><a name="l13331"></a><span class="lineno">13331</span>&#160;        }</div>
-<div class="line"><a name="l13332"></a><span class="lineno">13332</span>&#160;    }</div>
-<div class="line"><a name="l13333"></a><span class="lineno">13333</span>&#160;}</div>
-<div class="line"><a name="l13334"></a><span class="lineno">13334</span>&#160; </div>
-<div class="line"><a name="l13335"></a><span class="lineno">13335</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::DefragmentationEnd(</div>
-<div class="line"><a name="l13336"></a><span class="lineno">13336</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pCtx,</div>
-<div class="line"><a name="l13337"></a><span class="lineno">13337</span>&#160;    uint32_t flags,</div>
-<div class="line"><a name="l13338"></a><span class="lineno">13338</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats)</div>
-<div class="line"><a name="l13339"></a><span class="lineno">13339</span>&#160;{</div>
-<div class="line"><a name="l13340"></a><span class="lineno">13340</span>&#160;    <span class="keywordflow">if</span>(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a> &amp;&amp; m_hAllocator-&gt;m_UseMutex)</div>
-<div class="line"><a name="l13341"></a><span class="lineno">13341</span>&#160;    {</div>
-<div class="line"><a name="l13342"></a><span class="lineno">13342</span>&#160;        VMA_ASSERT(pCtx-&gt;mutexLocked == <span class="keyword">false</span>);</div>
-<div class="line"><a name="l13343"></a><span class="lineno">13343</span>&#160; </div>
-<div class="line"><a name="l13344"></a><span class="lineno">13344</span>&#160;        <span class="comment">// Incremental defragmentation doesn&#39;t hold the lock, so when we enter here we don&#39;t actually have any</span></div>
-<div class="line"><a name="l13345"></a><span class="lineno">13345</span>&#160;        <span class="comment">// lock protecting us. Since we mutate state here, we have to take the lock out now</span></div>
-<div class="line"><a name="l13346"></a><span class="lineno">13346</span>&#160;        m_Mutex.LockWrite();</div>
-<div class="line"><a name="l13347"></a><span class="lineno">13347</span>&#160;        pCtx-&gt;mutexLocked = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l13348"></a><span class="lineno">13348</span>&#160;    }</div>
-<div class="line"><a name="l13349"></a><span class="lineno">13349</span>&#160; </div>
-<div class="line"><a name="l13350"></a><span class="lineno">13350</span>&#160;    <span class="comment">// If the mutex isn&#39;t locked we didn&#39;t do any work and there is nothing to delete.</span></div>
-<div class="line"><a name="l13351"></a><span class="lineno">13351</span>&#160;    <span class="keywordflow">if</span>(pCtx-&gt;mutexLocked || !m_hAllocator-&gt;m_UseMutex)</div>
-<div class="line"><a name="l13352"></a><span class="lineno">13352</span>&#160;    {</div>
-<div class="line"><a name="l13353"></a><span class="lineno">13353</span>&#160;        <span class="comment">// Destroy buffers.</span></div>
-<div class="line"><a name="l13354"></a><span class="lineno">13354</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = pCtx-&gt;blockContexts.size(); blockIndex--;)</div>
-<div class="line"><a name="l13355"></a><span class="lineno">13355</span>&#160;        {</div>
-<div class="line"><a name="l13356"></a><span class="lineno">13356</span>&#160;            VmaBlockDefragmentationContext &amp;blockCtx = pCtx-&gt;blockContexts[blockIndex];</div>
-<div class="line"><a name="l13357"></a><span class="lineno">13357</span>&#160;            <span class="keywordflow">if</span>(blockCtx.hBuffer)</div>
-<div class="line"><a name="l13358"></a><span class="lineno">13358</span>&#160;            {</div>
-<div class="line"><a name="l13359"></a><span class="lineno">13359</span>&#160;                (*m_hAllocator-&gt;GetVulkanFunctions().vkDestroyBuffer)(m_hAllocator-&gt;m_hDevice, blockCtx.hBuffer, m_hAllocator-&gt;GetAllocationCallbacks());</div>
-<div class="line"><a name="l13360"></a><span class="lineno">13360</span>&#160;            }</div>
-<div class="line"><a name="l13361"></a><span class="lineno">13361</span>&#160;        }</div>
-<div class="line"><a name="l13362"></a><span class="lineno">13362</span>&#160; </div>
-<div class="line"><a name="l13363"></a><span class="lineno">13363</span>&#160;        <span class="keywordflow">if</span>(pCtx-&gt;res &gt;= VK_SUCCESS)</div>
-<div class="line"><a name="l13364"></a><span class="lineno">13364</span>&#160;        {</div>
-<div class="line"><a name="l13365"></a><span class="lineno">13365</span>&#160;            FreeEmptyBlocks(pStats);</div>
-<div class="line"><a name="l13366"></a><span class="lineno">13366</span>&#160;        }</div>
-<div class="line"><a name="l13367"></a><span class="lineno">13367</span>&#160;    }</div>
-<div class="line"><a name="l13368"></a><span class="lineno">13368</span>&#160; </div>
-<div class="line"><a name="l13369"></a><span class="lineno">13369</span>&#160;    <span class="keywordflow">if</span>(pCtx-&gt;mutexLocked)</div>
-<div class="line"><a name="l13370"></a><span class="lineno">13370</span>&#160;    {</div>
-<div class="line"><a name="l13371"></a><span class="lineno">13371</span>&#160;        VMA_ASSERT(m_hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l13372"></a><span class="lineno">13372</span>&#160;        m_Mutex.UnlockWrite();</div>
-<div class="line"><a name="l13373"></a><span class="lineno">13373</span>&#160;    }</div>
-<div class="line"><a name="l13374"></a><span class="lineno">13374</span>&#160;}</div>
-<div class="line"><a name="l13375"></a><span class="lineno">13375</span>&#160; </div>
-<div class="line"><a name="l13376"></a><span class="lineno">13376</span>&#160;uint32_t VmaBlockVector::ProcessDefragmentations(</div>
-<div class="line"><a name="l13377"></a><span class="lineno">13377</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext *pCtx,</div>
-<div class="line"><a name="l13378"></a><span class="lineno">13378</span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a>* pMove, uint32_t maxMoves)</div>
-<div class="line"><a name="l13379"></a><span class="lineno">13379</span>&#160;{</div>
-<div class="line"><a name="l13380"></a><span class="lineno">13380</span>&#160;    VmaMutexLockWrite lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l13381"></a><span class="lineno">13381</span>&#160;    </div>
-<div class="line"><a name="l13382"></a><span class="lineno">13382</span>&#160;    <span class="keyword">const</span> uint32_t moveCount = std::min(uint32_t(pCtx-&gt;defragmentationMoves.size()) - pCtx-&gt;defragmentationMovesProcessed, maxMoves);</div>
-<div class="line"><a name="l13383"></a><span class="lineno">13383</span>&#160; </div>
-<div class="line"><a name="l13384"></a><span class="lineno">13384</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; moveCount; ++ i)</div>
-<div class="line"><a name="l13385"></a><span class="lineno">13385</span>&#160;    {</div>
-<div class="line"><a name="l13386"></a><span class="lineno">13386</span>&#160;        VmaDefragmentationMove&amp; move = pCtx-&gt;defragmentationMoves[pCtx-&gt;defragmentationMovesProcessed + i];</div>
-<div class="line"><a name="l13387"></a><span class="lineno">13387</span>&#160; </div>
-<div class="line"><a name="l13388"></a><span class="lineno">13388</span>&#160;        pMove-&gt;<a class="code" href="struct_vma_defragmentation_pass_move_info.html#ae885c861c2dd8d622e6c19e281d035cc">allocation</a> = move.hAllocation;</div>
-<div class="line"><a name="l13389"></a><span class="lineno">13389</span>&#160;        pMove-&gt;<a class="code" href="struct_vma_defragmentation_pass_move_info.html#a06eb0c8690aa0d3478a036753492e769">memory</a> = move.pDstBlock-&gt;GetDeviceMemory();</div>
-<div class="line"><a name="l13390"></a><span class="lineno">13390</span>&#160;        pMove-&gt;<a class="code" href="struct_vma_defragmentation_pass_move_info.html#a8ab4508bc03625b0653c880576be96c6">offset</a> = move.dstOffset;</div>
-<div class="line"><a name="l13391"></a><span class="lineno">13391</span>&#160; </div>
-<div class="line"><a name="l13392"></a><span class="lineno">13392</span>&#160;        ++ pMove;</div>
-<div class="line"><a name="l13393"></a><span class="lineno">13393</span>&#160;    }</div>
-<div class="line"><a name="l13394"></a><span class="lineno">13394</span>&#160; </div>
-<div class="line"><a name="l13395"></a><span class="lineno">13395</span>&#160;    pCtx-&gt;defragmentationMovesProcessed += moveCount;</div>
-<div class="line"><a name="l13396"></a><span class="lineno">13396</span>&#160; </div>
-<div class="line"><a name="l13397"></a><span class="lineno">13397</span>&#160;    <span class="keywordflow">return</span> moveCount;</div>
-<div class="line"><a name="l13398"></a><span class="lineno">13398</span>&#160;}</div>
-<div class="line"><a name="l13399"></a><span class="lineno">13399</span>&#160; </div>
-<div class="line"><a name="l13400"></a><span class="lineno">13400</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::CommitDefragmentations(</div>
-<div class="line"><a name="l13401"></a><span class="lineno">13401</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext *pCtx,</div>
-<div class="line"><a name="l13402"></a><span class="lineno">13402</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats)</div>
-<div class="line"><a name="l13403"></a><span class="lineno">13403</span>&#160;{</div>
-<div class="line"><a name="l13404"></a><span class="lineno">13404</span>&#160;    VmaMutexLockWrite lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l13405"></a><span class="lineno">13405</span>&#160;    </div>
-<div class="line"><a name="l13406"></a><span class="lineno">13406</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = pCtx-&gt;defragmentationMovesCommitted; i &lt; pCtx-&gt;defragmentationMovesProcessed; ++ i)</div>
-<div class="line"><a name="l13407"></a><span class="lineno">13407</span>&#160;    {</div>
-<div class="line"><a name="l13408"></a><span class="lineno">13408</span>&#160;        <span class="keyword">const</span> VmaDefragmentationMove &amp;move = pCtx-&gt;defragmentationMoves[i];</div>
-<div class="line"><a name="l13409"></a><span class="lineno">13409</span>&#160; </div>
-<div class="line"><a name="l13410"></a><span class="lineno">13410</span>&#160;        move.pSrcBlock-&gt;m_pMetadata-&gt;FreeAtOffset(move.srcOffset);</div>
-<div class="line"><a name="l13411"></a><span class="lineno">13411</span>&#160;        move.hAllocation-&gt;ChangeBlockAllocation(m_hAllocator, move.pDstBlock, move.dstOffset);</div>
-<div class="line"><a name="l13412"></a><span class="lineno">13412</span>&#160;    }</div>
-<div class="line"><a name="l13413"></a><span class="lineno">13413</span>&#160; </div>
-<div class="line"><a name="l13414"></a><span class="lineno">13414</span>&#160;    pCtx-&gt;defragmentationMovesCommitted = pCtx-&gt;defragmentationMovesProcessed;</div>
-<div class="line"><a name="l13415"></a><span class="lineno">13415</span>&#160;    FreeEmptyBlocks(pStats);</div>
-<div class="line"><a name="l13416"></a><span class="lineno">13416</span>&#160;}</div>
-<div class="line"><a name="l13417"></a><span class="lineno">13417</span>&#160; </div>
-<div class="line"><a name="l13418"></a><span class="lineno">13418</span>&#160;<span class="keywordtype">size_t</span> VmaBlockVector::CalcAllocationCount()<span class="keyword"> const</span></div>
-<div class="line"><a name="l13419"></a><span class="lineno">13419</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l13420"></a><span class="lineno">13420</span>&#160;    <span class="keywordtype">size_t</span> result = 0;</div>
-<div class="line"><a name="l13421"></a><span class="lineno">13421</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_Blocks.size(); ++i)</div>
-<div class="line"><a name="l13422"></a><span class="lineno">13422</span>&#160;    {</div>
-<div class="line"><a name="l13423"></a><span class="lineno">13423</span>&#160;        result += m_Blocks[i]-&gt;m_pMetadata-&gt;GetAllocationCount();</div>
-<div class="line"><a name="l13424"></a><span class="lineno">13424</span>&#160;    }</div>
-<div class="line"><a name="l13425"></a><span class="lineno">13425</span>&#160;    <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l13426"></a><span class="lineno">13426</span>&#160;}</div>
-<div class="line"><a name="l13427"></a><span class="lineno">13427</span>&#160; </div>
-<div class="line"><a name="l13428"></a><span class="lineno">13428</span>&#160;<span class="keywordtype">bool</span> VmaBlockVector::IsBufferImageGranularityConflictPossible()<span class="keyword"> const</span></div>
-<div class="line"><a name="l13429"></a><span class="lineno">13429</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l13430"></a><span class="lineno">13430</span>&#160;    <span class="keywordflow">if</span>(m_BufferImageGranularity == 1)</div>
-<div class="line"><a name="l13431"></a><span class="lineno">13431</span>&#160;    {</div>
-<div class="line"><a name="l13432"></a><span class="lineno">13432</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l13433"></a><span class="lineno">13433</span>&#160;    }</div>
-<div class="line"><a name="l13434"></a><span class="lineno">13434</span>&#160;    VmaSuballocationType lastSuballocType = VMA_SUBALLOCATION_TYPE_FREE;</div>
-<div class="line"><a name="l13435"></a><span class="lineno">13435</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0, count = m_Blocks.size(); i &lt; count; ++i)</div>
-<div class="line"><a name="l13436"></a><span class="lineno">13436</span>&#160;    {</div>
-<div class="line"><a name="l13437"></a><span class="lineno">13437</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[i];</div>
-<div class="line"><a name="l13438"></a><span class="lineno">13438</span>&#160;        VMA_ASSERT(m_Algorithm == 0);</div>
-<div class="line"><a name="l13439"></a><span class="lineno">13439</span>&#160;        VmaBlockMetadata_Generic* <span class="keyword">const</span> pMetadata = (VmaBlockMetadata_Generic*)pBlock-&gt;m_pMetadata;</div>
-<div class="line"><a name="l13440"></a><span class="lineno">13440</span>&#160;        <span class="keywordflow">if</span>(pMetadata-&gt;IsBufferImageGranularityConflictPossible(m_BufferImageGranularity, lastSuballocType))</div>
-<div class="line"><a name="l13441"></a><span class="lineno">13441</span>&#160;        {</div>
-<div class="line"><a name="l13442"></a><span class="lineno">13442</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l13443"></a><span class="lineno">13443</span>&#160;        }</div>
-<div class="line"><a name="l13444"></a><span class="lineno">13444</span>&#160;    }</div>
-<div class="line"><a name="l13445"></a><span class="lineno">13445</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l13446"></a><span class="lineno">13446</span>&#160;}</div>
-<div class="line"><a name="l13447"></a><span class="lineno">13447</span>&#160; </div>
-<div class="line"><a name="l13448"></a><span class="lineno">13448</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::MakePoolAllocationsLost(</div>
-<div class="line"><a name="l13449"></a><span class="lineno">13449</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l13450"></a><span class="lineno">13450</span>&#160;    <span class="keywordtype">size_t</span>* pLostAllocationCount)</div>
-<div class="line"><a name="l13451"></a><span class="lineno">13451</span>&#160;{</div>
-<div class="line"><a name="l13452"></a><span class="lineno">13452</span>&#160;    VmaMutexLockWrite lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l13453"></a><span class="lineno">13453</span>&#160;    <span class="keywordtype">size_t</span> lostAllocationCount = 0;</div>
-<div class="line"><a name="l13454"></a><span class="lineno">13454</span>&#160;    <span class="keywordflow">for</span>(uint32_t blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex)</div>
-<div class="line"><a name="l13455"></a><span class="lineno">13455</span>&#160;    {</div>
-<div class="line"><a name="l13456"></a><span class="lineno">13456</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l13457"></a><span class="lineno">13457</span>&#160;        VMA_ASSERT(pBlock);</div>
-<div class="line"><a name="l13458"></a><span class="lineno">13458</span>&#160;        lostAllocationCount += pBlock-&gt;m_pMetadata-&gt;MakeAllocationsLost(currentFrameIndex, m_FrameInUseCount);</div>
-<div class="line"><a name="l13459"></a><span class="lineno">13459</span>&#160;    }</div>
-<div class="line"><a name="l13460"></a><span class="lineno">13460</span>&#160;    <span class="keywordflow">if</span>(pLostAllocationCount != VMA_NULL)</div>
-<div class="line"><a name="l13461"></a><span class="lineno">13461</span>&#160;    {</div>
-<div class="line"><a name="l13462"></a><span class="lineno">13462</span>&#160;        *pLostAllocationCount = lostAllocationCount;</div>
-<div class="line"><a name="l13463"></a><span class="lineno">13463</span>&#160;    }</div>
-<div class="line"><a name="l13464"></a><span class="lineno">13464</span>&#160;}</div>
-<div class="line"><a name="l13465"></a><span class="lineno">13465</span>&#160; </div>
-<div class="line"><a name="l13466"></a><span class="lineno">13466</span>&#160;VkResult VmaBlockVector::CheckCorruption()</div>
-<div class="line"><a name="l13467"></a><span class="lineno">13467</span>&#160;{</div>
-<div class="line"><a name="l13468"></a><span class="lineno">13468</span>&#160;    <span class="keywordflow">if</span>(!IsCorruptionDetectionEnabled())</div>
-<div class="line"><a name="l13469"></a><span class="lineno">13469</span>&#160;    {</div>
-<div class="line"><a name="l13470"></a><span class="lineno">13470</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT;</div>
-<div class="line"><a name="l13471"></a><span class="lineno">13471</span>&#160;    }</div>
-<div class="line"><a name="l13472"></a><span class="lineno">13472</span>&#160; </div>
-<div class="line"><a name="l13473"></a><span class="lineno">13473</span>&#160;    VmaMutexLockRead lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l13474"></a><span class="lineno">13474</span>&#160;    <span class="keywordflow">for</span>(uint32_t blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex)</div>
-<div class="line"><a name="l13475"></a><span class="lineno">13475</span>&#160;    {</div>
-<div class="line"><a name="l13476"></a><span class="lineno">13476</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l13477"></a><span class="lineno">13477</span>&#160;        VMA_ASSERT(pBlock);</div>
-<div class="line"><a name="l13478"></a><span class="lineno">13478</span>&#160;        VkResult res = pBlock-&gt;CheckCorruption(m_hAllocator);</div>
-<div class="line"><a name="l13479"></a><span class="lineno">13479</span>&#160;        <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l13318"></a><span class="lineno">13318</span>&#160;            <span class="keyword">const</span> VmaBlockDefragmentationContext&amp; srcBlockCtx = pDefragCtx-&gt;blockContexts[move.srcBlockIndex];</div>
+<div class="line"><a name="l13319"></a><span class="lineno">13319</span>&#160;            <span class="keyword">const</span> VmaBlockDefragmentationContext&amp; dstBlockCtx = pDefragCtx-&gt;blockContexts[move.dstBlockIndex];</div>
+<div class="line"><a name="l13320"></a><span class="lineno">13320</span>&#160; </div>
+<div class="line"><a name="l13321"></a><span class="lineno">13321</span>&#160;            VMA_ASSERT(srcBlockCtx.hBuffer &amp;&amp; dstBlockCtx.hBuffer);</div>
+<div class="line"><a name="l13322"></a><span class="lineno">13322</span>&#160; </div>
+<div class="line"><a name="l13323"></a><span class="lineno">13323</span>&#160;            VkBufferCopy region = {</div>
+<div class="line"><a name="l13324"></a><span class="lineno">13324</span>&#160;                move.srcOffset,</div>
+<div class="line"><a name="l13325"></a><span class="lineno">13325</span>&#160;                move.dstOffset,</div>
+<div class="line"><a name="l13326"></a><span class="lineno">13326</span>&#160;                move.size };</div>
+<div class="line"><a name="l13327"></a><span class="lineno">13327</span>&#160;            (*m_hAllocator-&gt;GetVulkanFunctions().vkCmdCopyBuffer)(</div>
+<div class="line"><a name="l13328"></a><span class="lineno">13328</span>&#160;                commandBuffer, srcBlockCtx.hBuffer, dstBlockCtx.hBuffer, 1, &amp;region);</div>
+<div class="line"><a name="l13329"></a><span class="lineno">13329</span>&#160;        }</div>
+<div class="line"><a name="l13330"></a><span class="lineno">13330</span>&#160;    }</div>
+<div class="line"><a name="l13331"></a><span class="lineno">13331</span>&#160; </div>
+<div class="line"><a name="l13332"></a><span class="lineno">13332</span>&#160;    <span class="comment">// Save buffers to defrag context for later destruction.</span></div>
+<div class="line"><a name="l13333"></a><span class="lineno">13333</span>&#160;    <span class="keywordflow">if</span>(pDefragCtx-&gt;res == VK_SUCCESS &amp;&amp; moveCount &gt; 0)</div>
+<div class="line"><a name="l13334"></a><span class="lineno">13334</span>&#160;    {</div>
+<div class="line"><a name="l13335"></a><span class="lineno">13335</span>&#160;        pDefragCtx-&gt;res = VK_NOT_READY;</div>
+<div class="line"><a name="l13336"></a><span class="lineno">13336</span>&#160;    }</div>
+<div class="line"><a name="l13337"></a><span class="lineno">13337</span>&#160;}</div>
+<div class="line"><a name="l13338"></a><span class="lineno">13338</span>&#160; </div>
+<div class="line"><a name="l13339"></a><span class="lineno">13339</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::FreeEmptyBlocks(<a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pDefragmentationStats)</div>
+<div class="line"><a name="l13340"></a><span class="lineno">13340</span>&#160;{</div>
+<div class="line"><a name="l13341"></a><span class="lineno">13341</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = m_Blocks.size(); blockIndex--; )</div>
+<div class="line"><a name="l13342"></a><span class="lineno">13342</span>&#160;    {</div>
+<div class="line"><a name="l13343"></a><span class="lineno">13343</span>&#160;        VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l13344"></a><span class="lineno">13344</span>&#160;        <span class="keywordflow">if</span>(pBlock-&gt;m_pMetadata-&gt;IsEmpty())</div>
+<div class="line"><a name="l13345"></a><span class="lineno">13345</span>&#160;        {</div>
+<div class="line"><a name="l13346"></a><span class="lineno">13346</span>&#160;            <span class="keywordflow">if</span>(m_Blocks.size() &gt; m_MinBlockCount)</div>
+<div class="line"><a name="l13347"></a><span class="lineno">13347</span>&#160;            {</div>
+<div class="line"><a name="l13348"></a><span class="lineno">13348</span>&#160;                <span class="keywordflow">if</span>(pDefragmentationStats != VMA_NULL)</div>
+<div class="line"><a name="l13349"></a><span class="lineno">13349</span>&#160;                {</div>
+<div class="line"><a name="l13350"></a><span class="lineno">13350</span>&#160;                    ++pDefragmentationStats-&gt;<a class="code" href="struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b">deviceMemoryBlocksFreed</a>;</div>
+<div class="line"><a name="l13351"></a><span class="lineno">13351</span>&#160;                    pDefragmentationStats-&gt;<a class="code" href="struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28">bytesFreed</a> += pBlock-&gt;m_pMetadata-&gt;GetSize();</div>
+<div class="line"><a name="l13352"></a><span class="lineno">13352</span>&#160;                }</div>
+<div class="line"><a name="l13353"></a><span class="lineno">13353</span>&#160; </div>
+<div class="line"><a name="l13354"></a><span class="lineno">13354</span>&#160;                VmaVectorRemove(m_Blocks, blockIndex);</div>
+<div class="line"><a name="l13355"></a><span class="lineno">13355</span>&#160;                pBlock-&gt;Destroy(m_hAllocator);</div>
+<div class="line"><a name="l13356"></a><span class="lineno">13356</span>&#160;                vma_delete(m_hAllocator, pBlock);</div>
+<div class="line"><a name="l13357"></a><span class="lineno">13357</span>&#160;            }</div>
+<div class="line"><a name="l13358"></a><span class="lineno">13358</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l13359"></a><span class="lineno">13359</span>&#160;            {</div>
+<div class="line"><a name="l13360"></a><span class="lineno">13360</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l13361"></a><span class="lineno">13361</span>&#160;            }</div>
+<div class="line"><a name="l13362"></a><span class="lineno">13362</span>&#160;        }</div>
+<div class="line"><a name="l13363"></a><span class="lineno">13363</span>&#160;    }</div>
+<div class="line"><a name="l13364"></a><span class="lineno">13364</span>&#160;    UpdateHasEmptyBlock();</div>
+<div class="line"><a name="l13365"></a><span class="lineno">13365</span>&#160;}</div>
+<div class="line"><a name="l13366"></a><span class="lineno">13366</span>&#160; </div>
+<div class="line"><a name="l13367"></a><span class="lineno">13367</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::UpdateHasEmptyBlock()</div>
+<div class="line"><a name="l13368"></a><span class="lineno">13368</span>&#160;{</div>
+<div class="line"><a name="l13369"></a><span class="lineno">13369</span>&#160;    m_HasEmptyBlock = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l13370"></a><span class="lineno">13370</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> index = 0, count = m_Blocks.size(); index &lt; count; ++index)</div>
+<div class="line"><a name="l13371"></a><span class="lineno">13371</span>&#160;    {</div>
+<div class="line"><a name="l13372"></a><span class="lineno">13372</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[index];</div>
+<div class="line"><a name="l13373"></a><span class="lineno">13373</span>&#160;        <span class="keywordflow">if</span>(pBlock-&gt;m_pMetadata-&gt;IsEmpty())</div>
+<div class="line"><a name="l13374"></a><span class="lineno">13374</span>&#160;        {</div>
+<div class="line"><a name="l13375"></a><span class="lineno">13375</span>&#160;            m_HasEmptyBlock = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l13376"></a><span class="lineno">13376</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l13377"></a><span class="lineno">13377</span>&#160;        }</div>
+<div class="line"><a name="l13378"></a><span class="lineno">13378</span>&#160;    }</div>
+<div class="line"><a name="l13379"></a><span class="lineno">13379</span>&#160;}</div>
+<div class="line"><a name="l13380"></a><span class="lineno">13380</span>&#160; </div>
+<div class="line"><a name="l13381"></a><span class="lineno">13381</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l13382"></a><span class="lineno">13382</span>&#160; </div>
+<div class="line"><a name="l13383"></a><span class="lineno">13383</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json)</div>
+<div class="line"><a name="l13384"></a><span class="lineno">13384</span>&#160;{</div>
+<div class="line"><a name="l13385"></a><span class="lineno">13385</span>&#160;    VmaMutexLockRead lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l13386"></a><span class="lineno">13386</span>&#160; </div>
+<div class="line"><a name="l13387"></a><span class="lineno">13387</span>&#160;    json.BeginObject();</div>
+<div class="line"><a name="l13388"></a><span class="lineno">13388</span>&#160; </div>
+<div class="line"><a name="l13389"></a><span class="lineno">13389</span>&#160;    <span class="keywordflow">if</span>(IsCustomPool())</div>
+<div class="line"><a name="l13390"></a><span class="lineno">13390</span>&#160;    {</div>
+<div class="line"><a name="l13391"></a><span class="lineno">13391</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">char</span>* poolName = m_hParentPool-&gt;GetName();</div>
+<div class="line"><a name="l13392"></a><span class="lineno">13392</span>&#160;        <span class="keywordflow">if</span>(poolName != VMA_NULL &amp;&amp; poolName[0] != <span class="charliteral">&#39;\0&#39;</span>)</div>
+<div class="line"><a name="l13393"></a><span class="lineno">13393</span>&#160;        {</div>
+<div class="line"><a name="l13394"></a><span class="lineno">13394</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Name&quot;</span>);</div>
+<div class="line"><a name="l13395"></a><span class="lineno">13395</span>&#160;            json.WriteString(poolName);</div>
+<div class="line"><a name="l13396"></a><span class="lineno">13396</span>&#160;        }</div>
+<div class="line"><a name="l13397"></a><span class="lineno">13397</span>&#160; </div>
+<div class="line"><a name="l13398"></a><span class="lineno">13398</span>&#160;        json.WriteString(<span class="stringliteral">&quot;MemoryTypeIndex&quot;</span>);</div>
+<div class="line"><a name="l13399"></a><span class="lineno">13399</span>&#160;        json.WriteNumber(m_MemoryTypeIndex);</div>
+<div class="line"><a name="l13400"></a><span class="lineno">13400</span>&#160; </div>
+<div class="line"><a name="l13401"></a><span class="lineno">13401</span>&#160;        json.WriteString(<span class="stringliteral">&quot;BlockSize&quot;</span>);</div>
+<div class="line"><a name="l13402"></a><span class="lineno">13402</span>&#160;        json.WriteNumber(m_PreferredBlockSize);</div>
+<div class="line"><a name="l13403"></a><span class="lineno">13403</span>&#160; </div>
+<div class="line"><a name="l13404"></a><span class="lineno">13404</span>&#160;        json.WriteString(<span class="stringliteral">&quot;BlockCount&quot;</span>);</div>
+<div class="line"><a name="l13405"></a><span class="lineno">13405</span>&#160;        json.BeginObject(<span class="keyword">true</span>);</div>
+<div class="line"><a name="l13406"></a><span class="lineno">13406</span>&#160;        <span class="keywordflow">if</span>(m_MinBlockCount &gt; 0)</div>
+<div class="line"><a name="l13407"></a><span class="lineno">13407</span>&#160;        {</div>
+<div class="line"><a name="l13408"></a><span class="lineno">13408</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Min&quot;</span>);</div>
+<div class="line"><a name="l13409"></a><span class="lineno">13409</span>&#160;            json.WriteNumber((uint64_t)m_MinBlockCount);</div>
+<div class="line"><a name="l13410"></a><span class="lineno">13410</span>&#160;        }</div>
+<div class="line"><a name="l13411"></a><span class="lineno">13411</span>&#160;        <span class="keywordflow">if</span>(m_MaxBlockCount &lt; SIZE_MAX)</div>
+<div class="line"><a name="l13412"></a><span class="lineno">13412</span>&#160;        {</div>
+<div class="line"><a name="l13413"></a><span class="lineno">13413</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Max&quot;</span>);</div>
+<div class="line"><a name="l13414"></a><span class="lineno">13414</span>&#160;            json.WriteNumber((uint64_t)m_MaxBlockCount);</div>
+<div class="line"><a name="l13415"></a><span class="lineno">13415</span>&#160;        }</div>
+<div class="line"><a name="l13416"></a><span class="lineno">13416</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Cur&quot;</span>);</div>
+<div class="line"><a name="l13417"></a><span class="lineno">13417</span>&#160;        json.WriteNumber((uint64_t)m_Blocks.size());</div>
+<div class="line"><a name="l13418"></a><span class="lineno">13418</span>&#160;        json.EndObject();</div>
+<div class="line"><a name="l13419"></a><span class="lineno">13419</span>&#160; </div>
+<div class="line"><a name="l13420"></a><span class="lineno">13420</span>&#160;        <span class="keywordflow">if</span>(m_FrameInUseCount &gt; 0)</div>
+<div class="line"><a name="l13421"></a><span class="lineno">13421</span>&#160;        {</div>
+<div class="line"><a name="l13422"></a><span class="lineno">13422</span>&#160;            json.WriteString(<span class="stringliteral">&quot;FrameInUseCount&quot;</span>);</div>
+<div class="line"><a name="l13423"></a><span class="lineno">13423</span>&#160;            json.WriteNumber(m_FrameInUseCount);</div>
+<div class="line"><a name="l13424"></a><span class="lineno">13424</span>&#160;        }</div>
+<div class="line"><a name="l13425"></a><span class="lineno">13425</span>&#160; </div>
+<div class="line"><a name="l13426"></a><span class="lineno">13426</span>&#160;        <span class="keywordflow">if</span>(m_Algorithm != 0)</div>
+<div class="line"><a name="l13427"></a><span class="lineno">13427</span>&#160;        {</div>
+<div class="line"><a name="l13428"></a><span class="lineno">13428</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Algorithm&quot;</span>);</div>
+<div class="line"><a name="l13429"></a><span class="lineno">13429</span>&#160;            json.WriteString(VmaAlgorithmToStr(m_Algorithm));</div>
+<div class="line"><a name="l13430"></a><span class="lineno">13430</span>&#160;        }</div>
+<div class="line"><a name="l13431"></a><span class="lineno">13431</span>&#160;    }</div>
+<div class="line"><a name="l13432"></a><span class="lineno">13432</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l13433"></a><span class="lineno">13433</span>&#160;    {</div>
+<div class="line"><a name="l13434"></a><span class="lineno">13434</span>&#160;        json.WriteString(<span class="stringliteral">&quot;PreferredBlockSize&quot;</span>);</div>
+<div class="line"><a name="l13435"></a><span class="lineno">13435</span>&#160;        json.WriteNumber(m_PreferredBlockSize);</div>
+<div class="line"><a name="l13436"></a><span class="lineno">13436</span>&#160;    }</div>
+<div class="line"><a name="l13437"></a><span class="lineno">13437</span>&#160; </div>
+<div class="line"><a name="l13438"></a><span class="lineno">13438</span>&#160;    json.WriteString(<span class="stringliteral">&quot;Blocks&quot;</span>);</div>
+<div class="line"><a name="l13439"></a><span class="lineno">13439</span>&#160;    json.BeginObject();</div>
+<div class="line"><a name="l13440"></a><span class="lineno">13440</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_Blocks.size(); ++i)</div>
+<div class="line"><a name="l13441"></a><span class="lineno">13441</span>&#160;    {</div>
+<div class="line"><a name="l13442"></a><span class="lineno">13442</span>&#160;        json.BeginString();</div>
+<div class="line"><a name="l13443"></a><span class="lineno">13443</span>&#160;        json.ContinueString(m_Blocks[i]-&gt;GetId());</div>
+<div class="line"><a name="l13444"></a><span class="lineno">13444</span>&#160;        json.EndString();</div>
+<div class="line"><a name="l13445"></a><span class="lineno">13445</span>&#160; </div>
+<div class="line"><a name="l13446"></a><span class="lineno">13446</span>&#160;        m_Blocks[i]-&gt;m_pMetadata-&gt;PrintDetailedMap(json);</div>
+<div class="line"><a name="l13447"></a><span class="lineno">13447</span>&#160;    }</div>
+<div class="line"><a name="l13448"></a><span class="lineno">13448</span>&#160;    json.EndObject();</div>
+<div class="line"><a name="l13449"></a><span class="lineno">13449</span>&#160; </div>
+<div class="line"><a name="l13450"></a><span class="lineno">13450</span>&#160;    json.EndObject();</div>
+<div class="line"><a name="l13451"></a><span class="lineno">13451</span>&#160;}</div>
+<div class="line"><a name="l13452"></a><span class="lineno">13452</span>&#160; </div>
+<div class="line"><a name="l13453"></a><span class="lineno">13453</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l13454"></a><span class="lineno">13454</span>&#160; </div>
+<div class="line"><a name="l13455"></a><span class="lineno">13455</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::Defragment(</div>
+<div class="line"><a name="l13456"></a><span class="lineno">13456</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pCtx,</div>
+<div class="line"><a name="l13457"></a><span class="lineno">13457</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags,</div>
+<div class="line"><a name="l13458"></a><span class="lineno">13458</span>&#160;    VkDeviceSize&amp; maxCpuBytesToMove, uint32_t&amp; maxCpuAllocationsToMove,</div>
+<div class="line"><a name="l13459"></a><span class="lineno">13459</span>&#160;    VkDeviceSize&amp; maxGpuBytesToMove, uint32_t&amp; maxGpuAllocationsToMove,</div>
+<div class="line"><a name="l13460"></a><span class="lineno">13460</span>&#160;    VkCommandBuffer commandBuffer)</div>
+<div class="line"><a name="l13461"></a><span class="lineno">13461</span>&#160;{</div>
+<div class="line"><a name="l13462"></a><span class="lineno">13462</span>&#160;    pCtx-&gt;res = VK_SUCCESS;</div>
+<div class="line"><a name="l13463"></a><span class="lineno">13463</span>&#160;    </div>
+<div class="line"><a name="l13464"></a><span class="lineno">13464</span>&#160;    <span class="keyword">const</span> VkMemoryPropertyFlags memPropFlags =</div>
+<div class="line"><a name="l13465"></a><span class="lineno">13465</span>&#160;        m_hAllocator-&gt;m_MemProps.memoryTypes[m_MemoryTypeIndex].propertyFlags;</div>
+<div class="line"><a name="l13466"></a><span class="lineno">13466</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isHostVisible = (memPropFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0;</div>
+<div class="line"><a name="l13467"></a><span class="lineno">13467</span>&#160; </div>
+<div class="line"><a name="l13468"></a><span class="lineno">13468</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> canDefragmentOnCpu = maxCpuBytesToMove &gt; 0 &amp;&amp; maxCpuAllocationsToMove &gt; 0 &amp;&amp;</div>
+<div class="line"><a name="l13469"></a><span class="lineno">13469</span>&#160;        isHostVisible;</div>
+<div class="line"><a name="l13470"></a><span class="lineno">13470</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> canDefragmentOnGpu = maxGpuBytesToMove &gt; 0 &amp;&amp; maxGpuAllocationsToMove &gt; 0 &amp;&amp;</div>
+<div class="line"><a name="l13471"></a><span class="lineno">13471</span>&#160;        !IsCorruptionDetectionEnabled() &amp;&amp;</div>
+<div class="line"><a name="l13472"></a><span class="lineno">13472</span>&#160;        ((1u &lt;&lt; m_MemoryTypeIndex) &amp; m_hAllocator-&gt;GetGpuDefragmentationMemoryTypeBits()) != 0;</div>
+<div class="line"><a name="l13473"></a><span class="lineno">13473</span>&#160; </div>
+<div class="line"><a name="l13474"></a><span class="lineno">13474</span>&#160;    <span class="comment">// There are options to defragment this memory type.</span></div>
+<div class="line"><a name="l13475"></a><span class="lineno">13475</span>&#160;    <span class="keywordflow">if</span>(canDefragmentOnCpu || canDefragmentOnGpu)</div>
+<div class="line"><a name="l13476"></a><span class="lineno">13476</span>&#160;    {</div>
+<div class="line"><a name="l13477"></a><span class="lineno">13477</span>&#160;        <span class="keywordtype">bool</span> defragmentOnGpu;</div>
+<div class="line"><a name="l13478"></a><span class="lineno">13478</span>&#160;        <span class="comment">// There is only one option to defragment this memory type.</span></div>
+<div class="line"><a name="l13479"></a><span class="lineno">13479</span>&#160;        <span class="keywordflow">if</span>(canDefragmentOnGpu != canDefragmentOnCpu)</div>
 <div class="line"><a name="l13480"></a><span class="lineno">13480</span>&#160;        {</div>
-<div class="line"><a name="l13481"></a><span class="lineno">13481</span>&#160;            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l13481"></a><span class="lineno">13481</span>&#160;            defragmentOnGpu = canDefragmentOnGpu;</div>
 <div class="line"><a name="l13482"></a><span class="lineno">13482</span>&#160;        }</div>
-<div class="line"><a name="l13483"></a><span class="lineno">13483</span>&#160;    }</div>
-<div class="line"><a name="l13484"></a><span class="lineno">13484</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l13485"></a><span class="lineno">13485</span>&#160;}</div>
-<div class="line"><a name="l13486"></a><span class="lineno">13486</span>&#160; </div>
-<div class="line"><a name="l13487"></a><span class="lineno">13487</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::AddStats(<a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats)</div>
-<div class="line"><a name="l13488"></a><span class="lineno">13488</span>&#160;{</div>
-<div class="line"><a name="l13489"></a><span class="lineno">13489</span>&#160;    <span class="keyword">const</span> uint32_t memTypeIndex = m_MemoryTypeIndex;</div>
-<div class="line"><a name="l13490"></a><span class="lineno">13490</span>&#160;    <span class="keyword">const</span> uint32_t memHeapIndex = m_hAllocator-&gt;MemoryTypeIndexToHeapIndex(memTypeIndex);</div>
+<div class="line"><a name="l13483"></a><span class="lineno">13483</span>&#160;        <span class="comment">// Both options are available: Heuristics to choose the best one.</span></div>
+<div class="line"><a name="l13484"></a><span class="lineno">13484</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l13485"></a><span class="lineno">13485</span>&#160;        {</div>
+<div class="line"><a name="l13486"></a><span class="lineno">13486</span>&#160;            defragmentOnGpu = (memPropFlags &amp; VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0 ||</div>
+<div class="line"><a name="l13487"></a><span class="lineno">13487</span>&#160;                m_hAllocator-&gt;IsIntegratedGpu();</div>
+<div class="line"><a name="l13488"></a><span class="lineno">13488</span>&#160;        }</div>
+<div class="line"><a name="l13489"></a><span class="lineno">13489</span>&#160; </div>
+<div class="line"><a name="l13490"></a><span class="lineno">13490</span>&#160;        <span class="keywordtype">bool</span> overlappingMoveSupported = !defragmentOnGpu;</div>
 <div class="line"><a name="l13491"></a><span class="lineno">13491</span>&#160; </div>
-<div class="line"><a name="l13492"></a><span class="lineno">13492</span>&#160;    VmaMutexLockRead lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
-<div class="line"><a name="l13493"></a><span class="lineno">13493</span>&#160; </div>
-<div class="line"><a name="l13494"></a><span class="lineno">13494</span>&#160;    <span class="keywordflow">for</span>(uint32_t blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex)</div>
-<div class="line"><a name="l13495"></a><span class="lineno">13495</span>&#160;    {</div>
-<div class="line"><a name="l13496"></a><span class="lineno">13496</span>&#160;        <span class="keyword">const</span> VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l13497"></a><span class="lineno">13497</span>&#160;        VMA_ASSERT(pBlock);</div>
-<div class="line"><a name="l13498"></a><span class="lineno">13498</span>&#160;        VMA_HEAVY_ASSERT(pBlock-&gt;Validate());</div>
-<div class="line"><a name="l13499"></a><span class="lineno">13499</span>&#160;        <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> allocationStatInfo;</div>
-<div class="line"><a name="l13500"></a><span class="lineno">13500</span>&#160;        pBlock-&gt;m_pMetadata-&gt;CalcAllocationStatInfo(allocationStatInfo);</div>
-<div class="line"><a name="l13501"></a><span class="lineno">13501</span>&#160;        VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>, allocationStatInfo);</div>
-<div class="line"><a name="l13502"></a><span class="lineno">13502</span>&#160;        VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[memTypeIndex], allocationStatInfo);</div>
-<div class="line"><a name="l13503"></a><span class="lineno">13503</span>&#160;        VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[memHeapIndex], allocationStatInfo);</div>
-<div class="line"><a name="l13504"></a><span class="lineno">13504</span>&#160;    }</div>
-<div class="line"><a name="l13505"></a><span class="lineno">13505</span>&#160;}</div>
-<div class="line"><a name="l13506"></a><span class="lineno">13506</span>&#160; </div>
-<div class="line"><a name="l13508"></a><span class="lineno">13508</span>&#160;<span class="comment">// VmaDefragmentationAlgorithm_Generic members definition</span></div>
-<div class="line"><a name="l13509"></a><span class="lineno">13509</span>&#160; </div>
-<div class="line"><a name="l13510"></a><span class="lineno">13510</span>&#160;VmaDefragmentationAlgorithm_Generic::VmaDefragmentationAlgorithm_Generic(</div>
-<div class="line"><a name="l13511"></a><span class="lineno">13511</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l13512"></a><span class="lineno">13512</span>&#160;    VmaBlockVector* pBlockVector,</div>
-<div class="line"><a name="l13513"></a><span class="lineno">13513</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l13514"></a><span class="lineno">13514</span>&#160;    <span class="keywordtype">bool</span> overlappingMoveSupported) :</div>
-<div class="line"><a name="l13515"></a><span class="lineno">13515</span>&#160;    VmaDefragmentationAlgorithm(hAllocator, pBlockVector, currentFrameIndex),</div>
-<div class="line"><a name="l13516"></a><span class="lineno">13516</span>&#160;    m_AllocationCount(0),</div>
-<div class="line"><a name="l13517"></a><span class="lineno">13517</span>&#160;    m_AllAllocations(false),</div>
-<div class="line"><a name="l13518"></a><span class="lineno">13518</span>&#160;    m_BytesMoved(0),</div>
-<div class="line"><a name="l13519"></a><span class="lineno">13519</span>&#160;    m_AllocationsMoved(0),</div>
-<div class="line"><a name="l13520"></a><span class="lineno">13520</span>&#160;    m_Blocks(VmaStlAllocator&lt;BlockInfo*&gt;(hAllocator-&gt;GetAllocationCallbacks()))</div>
-<div class="line"><a name="l13521"></a><span class="lineno">13521</span>&#160;{</div>
-<div class="line"><a name="l13522"></a><span class="lineno">13522</span>&#160;    <span class="comment">// Create block info for each block.</span></div>
-<div class="line"><a name="l13523"></a><span class="lineno">13523</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_pBlockVector-&gt;m_Blocks.size();</div>
-<div class="line"><a name="l13524"></a><span class="lineno">13524</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; blockCount; ++blockIndex)</div>
-<div class="line"><a name="l13525"></a><span class="lineno">13525</span>&#160;    {</div>
-<div class="line"><a name="l13526"></a><span class="lineno">13526</span>&#160;        BlockInfo* pBlockInfo = vma_new(m_hAllocator, BlockInfo)(m_hAllocator-&gt;GetAllocationCallbacks());</div>
-<div class="line"><a name="l13527"></a><span class="lineno">13527</span>&#160;        pBlockInfo-&gt;m_OriginalBlockIndex = blockIndex;</div>
-<div class="line"><a name="l13528"></a><span class="lineno">13528</span>&#160;        pBlockInfo-&gt;m_pBlock = m_pBlockVector-&gt;m_Blocks[blockIndex];</div>
-<div class="line"><a name="l13529"></a><span class="lineno">13529</span>&#160;        m_Blocks.push_back(pBlockInfo);</div>
-<div class="line"><a name="l13530"></a><span class="lineno">13530</span>&#160;    }</div>
-<div class="line"><a name="l13531"></a><span class="lineno">13531</span>&#160; </div>
-<div class="line"><a name="l13532"></a><span class="lineno">13532</span>&#160;    <span class="comment">// Sort them by m_pBlock pointer value.</span></div>
-<div class="line"><a name="l13533"></a><span class="lineno">13533</span>&#160;    VMA_SORT(m_Blocks.begin(), m_Blocks.end(), BlockPointerLess());</div>
-<div class="line"><a name="l13534"></a><span class="lineno">13534</span>&#160;}</div>
-<div class="line"><a name="l13535"></a><span class="lineno">13535</span>&#160; </div>
-<div class="line"><a name="l13536"></a><span class="lineno">13536</span>&#160;VmaDefragmentationAlgorithm_Generic::~VmaDefragmentationAlgorithm_Generic()</div>
-<div class="line"><a name="l13537"></a><span class="lineno">13537</span>&#160;{</div>
-<div class="line"><a name="l13538"></a><span class="lineno">13538</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_Blocks.size(); i--; )</div>
-<div class="line"><a name="l13539"></a><span class="lineno">13539</span>&#160;    {</div>
-<div class="line"><a name="l13540"></a><span class="lineno">13540</span>&#160;        vma_delete(m_hAllocator, m_Blocks[i]);</div>
-<div class="line"><a name="l13541"></a><span class="lineno">13541</span>&#160;    }</div>
-<div class="line"><a name="l13542"></a><span class="lineno">13542</span>&#160;}</div>
-<div class="line"><a name="l13543"></a><span class="lineno">13543</span>&#160; </div>
-<div class="line"><a name="l13544"></a><span class="lineno">13544</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationAlgorithm_Generic::AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged)</div>
-<div class="line"><a name="l13545"></a><span class="lineno">13545</span>&#160;{</div>
-<div class="line"><a name="l13546"></a><span class="lineno">13546</span>&#160;    <span class="comment">// Now as we are inside VmaBlockVector::m_Mutex, we can make final check if this allocation was not lost.</span></div>
-<div class="line"><a name="l13547"></a><span class="lineno">13547</span>&#160;    <span class="keywordflow">if</span>(hAlloc-&gt;GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST)</div>
-<div class="line"><a name="l13548"></a><span class="lineno">13548</span>&#160;    {</div>
-<div class="line"><a name="l13549"></a><span class="lineno">13549</span>&#160;        VmaDeviceMemoryBlock* pBlock = hAlloc-&gt;GetBlock();</div>
-<div class="line"><a name="l13550"></a><span class="lineno">13550</span>&#160;        BlockInfoVector::iterator it = VmaBinaryFindFirstNotLess(m_Blocks.begin(), m_Blocks.end(), pBlock, BlockPointerLess());</div>
-<div class="line"><a name="l13551"></a><span class="lineno">13551</span>&#160;        <span class="keywordflow">if</span>(it != m_Blocks.end() &amp;&amp; (*it)-&gt;m_pBlock == pBlock)</div>
-<div class="line"><a name="l13552"></a><span class="lineno">13552</span>&#160;        {</div>
-<div class="line"><a name="l13553"></a><span class="lineno">13553</span>&#160;            AllocationInfo allocInfo = AllocationInfo(hAlloc, pChanged);</div>
-<div class="line"><a name="l13554"></a><span class="lineno">13554</span>&#160;            (*it)-&gt;m_Allocations.push_back(allocInfo);</div>
-<div class="line"><a name="l13555"></a><span class="lineno">13555</span>&#160;        }</div>
-<div class="line"><a name="l13556"></a><span class="lineno">13556</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13557"></a><span class="lineno">13557</span>&#160;        {</div>
-<div class="line"><a name="l13558"></a><span class="lineno">13558</span>&#160;            VMA_ASSERT(0);</div>
+<div class="line"><a name="l13492"></a><span class="lineno">13492</span>&#160;        <span class="keywordflow">if</span>(m_hAllocator-&gt;m_UseMutex)</div>
+<div class="line"><a name="l13493"></a><span class="lineno">13493</span>&#160;        {</div>
+<div class="line"><a name="l13494"></a><span class="lineno">13494</span>&#160;            <span class="keywordflow">if</span>(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a>)</div>
+<div class="line"><a name="l13495"></a><span class="lineno">13495</span>&#160;            {</div>
+<div class="line"><a name="l13496"></a><span class="lineno">13496</span>&#160;                <span class="keywordflow">if</span>(!m_Mutex.TryLockWrite())</div>
+<div class="line"><a name="l13497"></a><span class="lineno">13497</span>&#160;                {</div>
+<div class="line"><a name="l13498"></a><span class="lineno">13498</span>&#160;                    pCtx-&gt;res = VK_ERROR_INITIALIZATION_FAILED;</div>
+<div class="line"><a name="l13499"></a><span class="lineno">13499</span>&#160;                    <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l13500"></a><span class="lineno">13500</span>&#160;                }</div>
+<div class="line"><a name="l13501"></a><span class="lineno">13501</span>&#160;            }</div>
+<div class="line"><a name="l13502"></a><span class="lineno">13502</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l13503"></a><span class="lineno">13503</span>&#160;            {</div>
+<div class="line"><a name="l13504"></a><span class="lineno">13504</span>&#160;                m_Mutex.LockWrite();</div>
+<div class="line"><a name="l13505"></a><span class="lineno">13505</span>&#160;                pCtx-&gt;mutexLocked = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l13506"></a><span class="lineno">13506</span>&#160;            }</div>
+<div class="line"><a name="l13507"></a><span class="lineno">13507</span>&#160;        }</div>
+<div class="line"><a name="l13508"></a><span class="lineno">13508</span>&#160; </div>
+<div class="line"><a name="l13509"></a><span class="lineno">13509</span>&#160;        pCtx-&gt;Begin(overlappingMoveSupported, flags);</div>
+<div class="line"><a name="l13510"></a><span class="lineno">13510</span>&#160; </div>
+<div class="line"><a name="l13511"></a><span class="lineno">13511</span>&#160;        <span class="comment">// Defragment.</span></div>
+<div class="line"><a name="l13512"></a><span class="lineno">13512</span>&#160; </div>
+<div class="line"><a name="l13513"></a><span class="lineno">13513</span>&#160;        <span class="keyword">const</span> VkDeviceSize maxBytesToMove = defragmentOnGpu ? maxGpuBytesToMove : maxCpuBytesToMove;</div>
+<div class="line"><a name="l13514"></a><span class="lineno">13514</span>&#160;        <span class="keyword">const</span> uint32_t maxAllocationsToMove = defragmentOnGpu ? maxGpuAllocationsToMove : maxCpuAllocationsToMove;</div>
+<div class="line"><a name="l13515"></a><span class="lineno">13515</span>&#160;        pCtx-&gt;res = pCtx-&gt;GetAlgorithm()-&gt;Defragment(pCtx-&gt;defragmentationMoves, maxBytesToMove, maxAllocationsToMove, flags);</div>
+<div class="line"><a name="l13516"></a><span class="lineno">13516</span>&#160; </div>
+<div class="line"><a name="l13517"></a><span class="lineno">13517</span>&#160;        <span class="comment">// Accumulate statistics.</span></div>
+<div class="line"><a name="l13518"></a><span class="lineno">13518</span>&#160;        <span class="keywordflow">if</span>(pStats != VMA_NULL)</div>
+<div class="line"><a name="l13519"></a><span class="lineno">13519</span>&#160;        {</div>
+<div class="line"><a name="l13520"></a><span class="lineno">13520</span>&#160;            <span class="keyword">const</span> VkDeviceSize bytesMoved = pCtx-&gt;GetAlgorithm()-&gt;GetBytesMoved();</div>
+<div class="line"><a name="l13521"></a><span class="lineno">13521</span>&#160;            <span class="keyword">const</span> uint32_t allocationsMoved = pCtx-&gt;GetAlgorithm()-&gt;GetAllocationsMoved();</div>
+<div class="line"><a name="l13522"></a><span class="lineno">13522</span>&#160;            pStats-&gt;<a class="code" href="struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d">bytesMoved</a> += bytesMoved;</div>
+<div class="line"><a name="l13523"></a><span class="lineno">13523</span>&#160;            pStats-&gt;<a class="code" href="struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9">allocationsMoved</a> += allocationsMoved;</div>
+<div class="line"><a name="l13524"></a><span class="lineno">13524</span>&#160;            VMA_ASSERT(bytesMoved &lt;= maxBytesToMove);</div>
+<div class="line"><a name="l13525"></a><span class="lineno">13525</span>&#160;            VMA_ASSERT(allocationsMoved &lt;= maxAllocationsToMove);</div>
+<div class="line"><a name="l13526"></a><span class="lineno">13526</span>&#160;            <span class="keywordflow">if</span>(defragmentOnGpu)</div>
+<div class="line"><a name="l13527"></a><span class="lineno">13527</span>&#160;            {</div>
+<div class="line"><a name="l13528"></a><span class="lineno">13528</span>&#160;                maxGpuBytesToMove -= bytesMoved;</div>
+<div class="line"><a name="l13529"></a><span class="lineno">13529</span>&#160;                maxGpuAllocationsToMove -= allocationsMoved;</div>
+<div class="line"><a name="l13530"></a><span class="lineno">13530</span>&#160;            }</div>
+<div class="line"><a name="l13531"></a><span class="lineno">13531</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l13532"></a><span class="lineno">13532</span>&#160;            {</div>
+<div class="line"><a name="l13533"></a><span class="lineno">13533</span>&#160;                maxCpuBytesToMove -= bytesMoved;</div>
+<div class="line"><a name="l13534"></a><span class="lineno">13534</span>&#160;                maxCpuAllocationsToMove -= allocationsMoved;</div>
+<div class="line"><a name="l13535"></a><span class="lineno">13535</span>&#160;            }</div>
+<div class="line"><a name="l13536"></a><span class="lineno">13536</span>&#160;        }</div>
+<div class="line"><a name="l13537"></a><span class="lineno">13537</span>&#160; </div>
+<div class="line"><a name="l13538"></a><span class="lineno">13538</span>&#160;        <span class="keywordflow">if</span>(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a>)</div>
+<div class="line"><a name="l13539"></a><span class="lineno">13539</span>&#160;        {</div>
+<div class="line"><a name="l13540"></a><span class="lineno">13540</span>&#160;            <span class="keywordflow">if</span>(m_hAllocator-&gt;m_UseMutex)</div>
+<div class="line"><a name="l13541"></a><span class="lineno">13541</span>&#160;                m_Mutex.UnlockWrite();</div>
+<div class="line"><a name="l13542"></a><span class="lineno">13542</span>&#160;            </div>
+<div class="line"><a name="l13543"></a><span class="lineno">13543</span>&#160;            <span class="keywordflow">if</span>(pCtx-&gt;res &gt;= VK_SUCCESS &amp;&amp; !pCtx-&gt;defragmentationMoves.empty())</div>
+<div class="line"><a name="l13544"></a><span class="lineno">13544</span>&#160;                pCtx-&gt;res = VK_NOT_READY;</div>
+<div class="line"><a name="l13545"></a><span class="lineno">13545</span>&#160; </div>
+<div class="line"><a name="l13546"></a><span class="lineno">13546</span>&#160;            <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l13547"></a><span class="lineno">13547</span>&#160;        }</div>
+<div class="line"><a name="l13548"></a><span class="lineno">13548</span>&#160;    </div>
+<div class="line"><a name="l13549"></a><span class="lineno">13549</span>&#160;        <span class="keywordflow">if</span>(pCtx-&gt;res &gt;= VK_SUCCESS)</div>
+<div class="line"><a name="l13550"></a><span class="lineno">13550</span>&#160;        {</div>
+<div class="line"><a name="l13551"></a><span class="lineno">13551</span>&#160;            <span class="keywordflow">if</span>(defragmentOnGpu)</div>
+<div class="line"><a name="l13552"></a><span class="lineno">13552</span>&#160;            {</div>
+<div class="line"><a name="l13553"></a><span class="lineno">13553</span>&#160;                ApplyDefragmentationMovesGpu(pCtx, pCtx-&gt;defragmentationMoves, commandBuffer);</div>
+<div class="line"><a name="l13554"></a><span class="lineno">13554</span>&#160;            }</div>
+<div class="line"><a name="l13555"></a><span class="lineno">13555</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l13556"></a><span class="lineno">13556</span>&#160;            {</div>
+<div class="line"><a name="l13557"></a><span class="lineno">13557</span>&#160;                ApplyDefragmentationMovesCpu(pCtx, pCtx-&gt;defragmentationMoves);</div>
+<div class="line"><a name="l13558"></a><span class="lineno">13558</span>&#160;            }</div>
 <div class="line"><a name="l13559"></a><span class="lineno">13559</span>&#160;        }</div>
-<div class="line"><a name="l13560"></a><span class="lineno">13560</span>&#160; </div>
-<div class="line"><a name="l13561"></a><span class="lineno">13561</span>&#160;        ++m_AllocationCount;</div>
-<div class="line"><a name="l13562"></a><span class="lineno">13562</span>&#160;    }</div>
-<div class="line"><a name="l13563"></a><span class="lineno">13563</span>&#160;}</div>
-<div class="line"><a name="l13564"></a><span class="lineno">13564</span>&#160; </div>
-<div class="line"><a name="l13565"></a><span class="lineno">13565</span>&#160;VkResult VmaDefragmentationAlgorithm_Generic::DefragmentRound(</div>
-<div class="line"><a name="l13566"></a><span class="lineno">13566</span>&#160;    VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
-<div class="line"><a name="l13567"></a><span class="lineno">13567</span>&#160;    VkDeviceSize maxBytesToMove,</div>
-<div class="line"><a name="l13568"></a><span class="lineno">13568</span>&#160;    uint32_t maxAllocationsToMove,</div>
-<div class="line"><a name="l13569"></a><span class="lineno">13569</span>&#160;    <span class="keywordtype">bool</span> freeOldAllocations)</div>
-<div class="line"><a name="l13570"></a><span class="lineno">13570</span>&#160;{</div>
-<div class="line"><a name="l13571"></a><span class="lineno">13571</span>&#160;    <span class="keywordflow">if</span>(m_Blocks.empty())</div>
-<div class="line"><a name="l13572"></a><span class="lineno">13572</span>&#160;    {</div>
-<div class="line"><a name="l13573"></a><span class="lineno">13573</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l13574"></a><span class="lineno">13574</span>&#160;    }</div>
-<div class="line"><a name="l13575"></a><span class="lineno">13575</span>&#160; </div>
-<div class="line"><a name="l13576"></a><span class="lineno">13576</span>&#160;    <span class="comment">// This is a choice based on research.</span></div>
-<div class="line"><a name="l13577"></a><span class="lineno">13577</span>&#160;    <span class="comment">// Option 1:</span></div>
-<div class="line"><a name="l13578"></a><span class="lineno">13578</span>&#160;    uint32_t strategy = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT</a>;</div>
-<div class="line"><a name="l13579"></a><span class="lineno">13579</span>&#160;    <span class="comment">// Option 2:</span></div>
-<div class="line"><a name="l13580"></a><span class="lineno">13580</span>&#160;    <span class="comment">//uint32_t strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT;</span></div>
-<div class="line"><a name="l13581"></a><span class="lineno">13581</span>&#160;    <span class="comment">// Option 3:</span></div>
-<div class="line"><a name="l13582"></a><span class="lineno">13582</span>&#160;    <span class="comment">//uint32_t strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT;</span></div>
-<div class="line"><a name="l13583"></a><span class="lineno">13583</span>&#160; </div>
-<div class="line"><a name="l13584"></a><span class="lineno">13584</span>&#160;    <span class="keywordtype">size_t</span> srcBlockMinIndex = 0;</div>
-<div class="line"><a name="l13585"></a><span class="lineno">13585</span>&#160;    <span class="comment">// When FAST_ALGORITHM, move allocations from only last out of blocks that contain non-movable allocations.</span></div>
-<div class="line"><a name="l13586"></a><span class="lineno">13586</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l13587"></a><span class="lineno">13587</span>&#160;<span class="comment">    if(m_AlgorithmFlags &amp; VMA_DEFRAGMENTATION_FAST_ALGORITHM_BIT)</span></div>
-<div class="line"><a name="l13588"></a><span class="lineno">13588</span>&#160;<span class="comment">    {</span></div>
-<div class="line"><a name="l13589"></a><span class="lineno">13589</span>&#160;<span class="comment">        const size_t blocksWithNonMovableCount = CalcBlocksWithNonMovableCount();</span></div>
-<div class="line"><a name="l13590"></a><span class="lineno">13590</span>&#160;<span class="comment">        if(blocksWithNonMovableCount &gt; 0)</span></div>
-<div class="line"><a name="l13591"></a><span class="lineno">13591</span>&#160;<span class="comment">        {</span></div>
-<div class="line"><a name="l13592"></a><span class="lineno">13592</span>&#160;<span class="comment">            srcBlockMinIndex = blocksWithNonMovableCount - 1;</span></div>
-<div class="line"><a name="l13593"></a><span class="lineno">13593</span>&#160;<span class="comment">        }</span></div>
-<div class="line"><a name="l13594"></a><span class="lineno">13594</span>&#160;<span class="comment">    }</span></div>
-<div class="line"><a name="l13595"></a><span class="lineno">13595</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l13560"></a><span class="lineno">13560</span>&#160;    }</div>
+<div class="line"><a name="l13561"></a><span class="lineno">13561</span>&#160;}</div>
+<div class="line"><a name="l13562"></a><span class="lineno">13562</span>&#160; </div>
+<div class="line"><a name="l13563"></a><span class="lineno">13563</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::DefragmentationEnd(</div>
+<div class="line"><a name="l13564"></a><span class="lineno">13564</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pCtx,</div>
+<div class="line"><a name="l13565"></a><span class="lineno">13565</span>&#160;    uint32_t flags,</div>
+<div class="line"><a name="l13566"></a><span class="lineno">13566</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats)</div>
+<div class="line"><a name="l13567"></a><span class="lineno">13567</span>&#160;{</div>
+<div class="line"><a name="l13568"></a><span class="lineno">13568</span>&#160;    <span class="keywordflow">if</span>(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a> &amp;&amp; m_hAllocator-&gt;m_UseMutex)</div>
+<div class="line"><a name="l13569"></a><span class="lineno">13569</span>&#160;    {</div>
+<div class="line"><a name="l13570"></a><span class="lineno">13570</span>&#160;        VMA_ASSERT(pCtx-&gt;mutexLocked == <span class="keyword">false</span>);</div>
+<div class="line"><a name="l13571"></a><span class="lineno">13571</span>&#160; </div>
+<div class="line"><a name="l13572"></a><span class="lineno">13572</span>&#160;        <span class="comment">// Incremental defragmentation doesn&#39;t hold the lock, so when we enter here we don&#39;t actually have any</span></div>
+<div class="line"><a name="l13573"></a><span class="lineno">13573</span>&#160;        <span class="comment">// lock protecting us. Since we mutate state here, we have to take the lock out now</span></div>
+<div class="line"><a name="l13574"></a><span class="lineno">13574</span>&#160;        m_Mutex.LockWrite();</div>
+<div class="line"><a name="l13575"></a><span class="lineno">13575</span>&#160;        pCtx-&gt;mutexLocked = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l13576"></a><span class="lineno">13576</span>&#160;    }</div>
+<div class="line"><a name="l13577"></a><span class="lineno">13577</span>&#160; </div>
+<div class="line"><a name="l13578"></a><span class="lineno">13578</span>&#160;    <span class="comment">// If the mutex isn&#39;t locked we didn&#39;t do any work and there is nothing to delete.</span></div>
+<div class="line"><a name="l13579"></a><span class="lineno">13579</span>&#160;    <span class="keywordflow">if</span>(pCtx-&gt;mutexLocked || !m_hAllocator-&gt;m_UseMutex)</div>
+<div class="line"><a name="l13580"></a><span class="lineno">13580</span>&#160;    {</div>
+<div class="line"><a name="l13581"></a><span class="lineno">13581</span>&#160;        <span class="comment">// Destroy buffers.</span></div>
+<div class="line"><a name="l13582"></a><span class="lineno">13582</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = pCtx-&gt;blockContexts.size(); blockIndex--;)</div>
+<div class="line"><a name="l13583"></a><span class="lineno">13583</span>&#160;        {</div>
+<div class="line"><a name="l13584"></a><span class="lineno">13584</span>&#160;            VmaBlockDefragmentationContext &amp;blockCtx = pCtx-&gt;blockContexts[blockIndex];</div>
+<div class="line"><a name="l13585"></a><span class="lineno">13585</span>&#160;            <span class="keywordflow">if</span>(blockCtx.hBuffer)</div>
+<div class="line"><a name="l13586"></a><span class="lineno">13586</span>&#160;            {</div>
+<div class="line"><a name="l13587"></a><span class="lineno">13587</span>&#160;                (*m_hAllocator-&gt;GetVulkanFunctions().vkDestroyBuffer)(m_hAllocator-&gt;m_hDevice, blockCtx.hBuffer, m_hAllocator-&gt;GetAllocationCallbacks());</div>
+<div class="line"><a name="l13588"></a><span class="lineno">13588</span>&#160;            }</div>
+<div class="line"><a name="l13589"></a><span class="lineno">13589</span>&#160;        }</div>
+<div class="line"><a name="l13590"></a><span class="lineno">13590</span>&#160; </div>
+<div class="line"><a name="l13591"></a><span class="lineno">13591</span>&#160;        <span class="keywordflow">if</span>(pCtx-&gt;res &gt;= VK_SUCCESS)</div>
+<div class="line"><a name="l13592"></a><span class="lineno">13592</span>&#160;        {</div>
+<div class="line"><a name="l13593"></a><span class="lineno">13593</span>&#160;            FreeEmptyBlocks(pStats);</div>
+<div class="line"><a name="l13594"></a><span class="lineno">13594</span>&#160;        }</div>
+<div class="line"><a name="l13595"></a><span class="lineno">13595</span>&#160;    }</div>
 <div class="line"><a name="l13596"></a><span class="lineno">13596</span>&#160; </div>
-<div class="line"><a name="l13597"></a><span class="lineno">13597</span>&#160;    <span class="keywordtype">size_t</span> srcBlockIndex = m_Blocks.size() - 1;</div>
-<div class="line"><a name="l13598"></a><span class="lineno">13598</span>&#160;    <span class="keywordtype">size_t</span> srcAllocIndex = SIZE_MAX;</div>
-<div class="line"><a name="l13599"></a><span class="lineno">13599</span>&#160;    <span class="keywordflow">for</span>(;;)</div>
-<div class="line"><a name="l13600"></a><span class="lineno">13600</span>&#160;    {</div>
-<div class="line"><a name="l13601"></a><span class="lineno">13601</span>&#160;        <span class="comment">// 1. Find next allocation to move.</span></div>
-<div class="line"><a name="l13602"></a><span class="lineno">13602</span>&#160;        <span class="comment">// 1.1. Start from last to first m_Blocks - they are sorted from most &quot;destination&quot; to most &quot;source&quot;.</span></div>
-<div class="line"><a name="l13603"></a><span class="lineno">13603</span>&#160;        <span class="comment">// 1.2. Then start from last to first m_Allocations.</span></div>
-<div class="line"><a name="l13604"></a><span class="lineno">13604</span>&#160;        <span class="keywordflow">while</span>(srcAllocIndex &gt;= m_Blocks[srcBlockIndex]-&gt;m_Allocations.size())</div>
-<div class="line"><a name="l13605"></a><span class="lineno">13605</span>&#160;        {</div>
-<div class="line"><a name="l13606"></a><span class="lineno">13606</span>&#160;            <span class="keywordflow">if</span>(m_Blocks[srcBlockIndex]-&gt;m_Allocations.empty())</div>
-<div class="line"><a name="l13607"></a><span class="lineno">13607</span>&#160;            {</div>
-<div class="line"><a name="l13608"></a><span class="lineno">13608</span>&#160;                <span class="comment">// Finished: no more allocations to process.</span></div>
-<div class="line"><a name="l13609"></a><span class="lineno">13609</span>&#160;                <span class="keywordflow">if</span>(srcBlockIndex == srcBlockMinIndex)</div>
-<div class="line"><a name="l13610"></a><span class="lineno">13610</span>&#160;                {</div>
-<div class="line"><a name="l13611"></a><span class="lineno">13611</span>&#160;                    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l13612"></a><span class="lineno">13612</span>&#160;                }</div>
-<div class="line"><a name="l13613"></a><span class="lineno">13613</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13614"></a><span class="lineno">13614</span>&#160;                {</div>
-<div class="line"><a name="l13615"></a><span class="lineno">13615</span>&#160;                    --srcBlockIndex;</div>
-<div class="line"><a name="l13616"></a><span class="lineno">13616</span>&#160;                    srcAllocIndex = SIZE_MAX;</div>
-<div class="line"><a name="l13617"></a><span class="lineno">13617</span>&#160;                }</div>
-<div class="line"><a name="l13618"></a><span class="lineno">13618</span>&#160;            }</div>
-<div class="line"><a name="l13619"></a><span class="lineno">13619</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13620"></a><span class="lineno">13620</span>&#160;            {</div>
-<div class="line"><a name="l13621"></a><span class="lineno">13621</span>&#160;                srcAllocIndex = m_Blocks[srcBlockIndex]-&gt;m_Allocations.size() - 1;</div>
-<div class="line"><a name="l13622"></a><span class="lineno">13622</span>&#160;            }</div>
-<div class="line"><a name="l13623"></a><span class="lineno">13623</span>&#160;        }</div>
-<div class="line"><a name="l13624"></a><span class="lineno">13624</span>&#160;        </div>
-<div class="line"><a name="l13625"></a><span class="lineno">13625</span>&#160;        BlockInfo* pSrcBlockInfo = m_Blocks[srcBlockIndex];</div>
-<div class="line"><a name="l13626"></a><span class="lineno">13626</span>&#160;        AllocationInfo&amp; allocInfo = pSrcBlockInfo-&gt;m_Allocations[srcAllocIndex];</div>
+<div class="line"><a name="l13597"></a><span class="lineno">13597</span>&#160;    <span class="keywordflow">if</span>(pCtx-&gt;mutexLocked)</div>
+<div class="line"><a name="l13598"></a><span class="lineno">13598</span>&#160;    {</div>
+<div class="line"><a name="l13599"></a><span class="lineno">13599</span>&#160;        VMA_ASSERT(m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l13600"></a><span class="lineno">13600</span>&#160;        m_Mutex.UnlockWrite();</div>
+<div class="line"><a name="l13601"></a><span class="lineno">13601</span>&#160;    }</div>
+<div class="line"><a name="l13602"></a><span class="lineno">13602</span>&#160;}</div>
+<div class="line"><a name="l13603"></a><span class="lineno">13603</span>&#160; </div>
+<div class="line"><a name="l13604"></a><span class="lineno">13604</span>&#160;uint32_t VmaBlockVector::ProcessDefragmentations(</div>
+<div class="line"><a name="l13605"></a><span class="lineno">13605</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext *pCtx,</div>
+<div class="line"><a name="l13606"></a><span class="lineno">13606</span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a>* pMove, uint32_t maxMoves)</div>
+<div class="line"><a name="l13607"></a><span class="lineno">13607</span>&#160;{</div>
+<div class="line"><a name="l13608"></a><span class="lineno">13608</span>&#160;    VmaMutexLockWrite lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l13609"></a><span class="lineno">13609</span>&#160;    </div>
+<div class="line"><a name="l13610"></a><span class="lineno">13610</span>&#160;    <span class="keyword">const</span> uint32_t moveCount = std::min(uint32_t(pCtx-&gt;defragmentationMoves.size()) - pCtx-&gt;defragmentationMovesProcessed, maxMoves);</div>
+<div class="line"><a name="l13611"></a><span class="lineno">13611</span>&#160; </div>
+<div class="line"><a name="l13612"></a><span class="lineno">13612</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; moveCount; ++ i)</div>
+<div class="line"><a name="l13613"></a><span class="lineno">13613</span>&#160;    {</div>
+<div class="line"><a name="l13614"></a><span class="lineno">13614</span>&#160;        VmaDefragmentationMove&amp; move = pCtx-&gt;defragmentationMoves[pCtx-&gt;defragmentationMovesProcessed + i];</div>
+<div class="line"><a name="l13615"></a><span class="lineno">13615</span>&#160; </div>
+<div class="line"><a name="l13616"></a><span class="lineno">13616</span>&#160;        pMove-&gt;<a class="code" href="struct_vma_defragmentation_pass_move_info.html#ae885c861c2dd8d622e6c19e281d035cc">allocation</a> = move.hAllocation;</div>
+<div class="line"><a name="l13617"></a><span class="lineno">13617</span>&#160;        pMove-&gt;<a class="code" href="struct_vma_defragmentation_pass_move_info.html#a06eb0c8690aa0d3478a036753492e769">memory</a> = move.pDstBlock-&gt;GetDeviceMemory();</div>
+<div class="line"><a name="l13618"></a><span class="lineno">13618</span>&#160;        pMove-&gt;<a class="code" href="struct_vma_defragmentation_pass_move_info.html#a8ab4508bc03625b0653c880576be96c6">offset</a> = move.dstOffset;</div>
+<div class="line"><a name="l13619"></a><span class="lineno">13619</span>&#160; </div>
+<div class="line"><a name="l13620"></a><span class="lineno">13620</span>&#160;        ++ pMove;</div>
+<div class="line"><a name="l13621"></a><span class="lineno">13621</span>&#160;    }</div>
+<div class="line"><a name="l13622"></a><span class="lineno">13622</span>&#160; </div>
+<div class="line"><a name="l13623"></a><span class="lineno">13623</span>&#160;    pCtx-&gt;defragmentationMovesProcessed += moveCount;</div>
+<div class="line"><a name="l13624"></a><span class="lineno">13624</span>&#160; </div>
+<div class="line"><a name="l13625"></a><span class="lineno">13625</span>&#160;    <span class="keywordflow">return</span> moveCount;</div>
+<div class="line"><a name="l13626"></a><span class="lineno">13626</span>&#160;}</div>
 <div class="line"><a name="l13627"></a><span class="lineno">13627</span>&#160; </div>
-<div class="line"><a name="l13628"></a><span class="lineno">13628</span>&#160;        <span class="keyword">const</span> VkDeviceSize size = allocInfo.m_hAllocation-&gt;GetSize();</div>
-<div class="line"><a name="l13629"></a><span class="lineno">13629</span>&#160;        <span class="keyword">const</span> VkDeviceSize srcOffset = allocInfo.m_hAllocation-&gt;GetOffset();</div>
-<div class="line"><a name="l13630"></a><span class="lineno">13630</span>&#160;        <span class="keyword">const</span> VkDeviceSize alignment = allocInfo.m_hAllocation-&gt;GetAlignment();</div>
-<div class="line"><a name="l13631"></a><span class="lineno">13631</span>&#160;        <span class="keyword">const</span> VmaSuballocationType suballocType = allocInfo.m_hAllocation-&gt;GetSuballocationType();</div>
-<div class="line"><a name="l13632"></a><span class="lineno">13632</span>&#160; </div>
-<div class="line"><a name="l13633"></a><span class="lineno">13633</span>&#160;        <span class="comment">// 2. Try to find new place for this allocation in preceding or current block.</span></div>
-<div class="line"><a name="l13634"></a><span class="lineno">13634</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> dstBlockIndex = 0; dstBlockIndex &lt;= srcBlockIndex; ++dstBlockIndex)</div>
-<div class="line"><a name="l13635"></a><span class="lineno">13635</span>&#160;        {</div>
-<div class="line"><a name="l13636"></a><span class="lineno">13636</span>&#160;            BlockInfo* pDstBlockInfo = m_Blocks[dstBlockIndex];</div>
-<div class="line"><a name="l13637"></a><span class="lineno">13637</span>&#160;            VmaAllocationRequest dstAllocRequest;</div>
-<div class="line"><a name="l13638"></a><span class="lineno">13638</span>&#160;            <span class="keywordflow">if</span>(pDstBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;CreateAllocationRequest(</div>
-<div class="line"><a name="l13639"></a><span class="lineno">13639</span>&#160;                m_CurrentFrameIndex,</div>
-<div class="line"><a name="l13640"></a><span class="lineno">13640</span>&#160;                m_pBlockVector-&gt;GetFrameInUseCount(),</div>
-<div class="line"><a name="l13641"></a><span class="lineno">13641</span>&#160;                m_pBlockVector-&gt;GetBufferImageGranularity(),</div>
-<div class="line"><a name="l13642"></a><span class="lineno">13642</span>&#160;                size,</div>
-<div class="line"><a name="l13643"></a><span class="lineno">13643</span>&#160;                alignment,</div>
-<div class="line"><a name="l13644"></a><span class="lineno">13644</span>&#160;                <span class="keyword">false</span>, <span class="comment">// upperAddress</span></div>
-<div class="line"><a name="l13645"></a><span class="lineno">13645</span>&#160;                suballocType,</div>
-<div class="line"><a name="l13646"></a><span class="lineno">13646</span>&#160;                <span class="keyword">false</span>, <span class="comment">// canMakeOtherLost</span></div>
-<div class="line"><a name="l13647"></a><span class="lineno">13647</span>&#160;                strategy,</div>
-<div class="line"><a name="l13648"></a><span class="lineno">13648</span>&#160;                &amp;dstAllocRequest) &amp;&amp;</div>
-<div class="line"><a name="l13649"></a><span class="lineno">13649</span>&#160;            MoveMakesSense(</div>
-<div class="line"><a name="l13650"></a><span class="lineno">13650</span>&#160;                dstBlockIndex, dstAllocRequest.offset, srcBlockIndex, srcOffset))</div>
-<div class="line"><a name="l13651"></a><span class="lineno">13651</span>&#160;            {</div>
-<div class="line"><a name="l13652"></a><span class="lineno">13652</span>&#160;                VMA_ASSERT(dstAllocRequest.itemsToMakeLostCount == 0);</div>
-<div class="line"><a name="l13653"></a><span class="lineno">13653</span>&#160; </div>
-<div class="line"><a name="l13654"></a><span class="lineno">13654</span>&#160;                <span class="comment">// Reached limit on number of allocations or bytes to move.</span></div>
-<div class="line"><a name="l13655"></a><span class="lineno">13655</span>&#160;                <span class="keywordflow">if</span>((m_AllocationsMoved + 1 &gt; maxAllocationsToMove) ||</div>
-<div class="line"><a name="l13656"></a><span class="lineno">13656</span>&#160;                    (m_BytesMoved + size &gt; maxBytesToMove))</div>
-<div class="line"><a name="l13657"></a><span class="lineno">13657</span>&#160;                {</div>
-<div class="line"><a name="l13658"></a><span class="lineno">13658</span>&#160;                    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l13659"></a><span class="lineno">13659</span>&#160;                }</div>
-<div class="line"><a name="l13660"></a><span class="lineno">13660</span>&#160; </div>
-<div class="line"><a name="l13661"></a><span class="lineno">13661</span>&#160;                VmaDefragmentationMove move = {};</div>
-<div class="line"><a name="l13662"></a><span class="lineno">13662</span>&#160;                move.srcBlockIndex = pSrcBlockInfo-&gt;m_OriginalBlockIndex;</div>
-<div class="line"><a name="l13663"></a><span class="lineno">13663</span>&#160;                move.dstBlockIndex = pDstBlockInfo-&gt;m_OriginalBlockIndex;</div>
-<div class="line"><a name="l13664"></a><span class="lineno">13664</span>&#160;                move.srcOffset = srcOffset;</div>
-<div class="line"><a name="l13665"></a><span class="lineno">13665</span>&#160;                move.dstOffset = dstAllocRequest.offset;</div>
-<div class="line"><a name="l13666"></a><span class="lineno">13666</span>&#160;                move.size = size;</div>
-<div class="line"><a name="l13667"></a><span class="lineno">13667</span>&#160;                move.hAllocation = allocInfo.m_hAllocation;</div>
-<div class="line"><a name="l13668"></a><span class="lineno">13668</span>&#160;                move.pSrcBlock = pSrcBlockInfo-&gt;m_pBlock;</div>
-<div class="line"><a name="l13669"></a><span class="lineno">13669</span>&#160;                move.pDstBlock = pDstBlockInfo-&gt;m_pBlock;</div>
-<div class="line"><a name="l13670"></a><span class="lineno">13670</span>&#160; </div>
-<div class="line"><a name="l13671"></a><span class="lineno">13671</span>&#160;                moves.push_back(move);</div>
-<div class="line"><a name="l13672"></a><span class="lineno">13672</span>&#160; </div>
-<div class="line"><a name="l13673"></a><span class="lineno">13673</span>&#160;                pDstBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;Alloc(</div>
-<div class="line"><a name="l13674"></a><span class="lineno">13674</span>&#160;                    dstAllocRequest,</div>
-<div class="line"><a name="l13675"></a><span class="lineno">13675</span>&#160;                    suballocType,</div>
-<div class="line"><a name="l13676"></a><span class="lineno">13676</span>&#160;                    size,</div>
-<div class="line"><a name="l13677"></a><span class="lineno">13677</span>&#160;                    allocInfo.m_hAllocation);</div>
-<div class="line"><a name="l13678"></a><span class="lineno">13678</span>&#160; </div>
-<div class="line"><a name="l13679"></a><span class="lineno">13679</span>&#160;                <span class="keywordflow">if</span>(freeOldAllocations)</div>
-<div class="line"><a name="l13680"></a><span class="lineno">13680</span>&#160;                {</div>
-<div class="line"><a name="l13681"></a><span class="lineno">13681</span>&#160;                    pSrcBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;FreeAtOffset(srcOffset);</div>
-<div class="line"><a name="l13682"></a><span class="lineno">13682</span>&#160;                    allocInfo.m_hAllocation-&gt;ChangeBlockAllocation(m_hAllocator, pDstBlockInfo-&gt;m_pBlock, dstAllocRequest.offset);</div>
-<div class="line"><a name="l13683"></a><span class="lineno">13683</span>&#160;                }</div>
-<div class="line"><a name="l13684"></a><span class="lineno">13684</span>&#160;                </div>
-<div class="line"><a name="l13685"></a><span class="lineno">13685</span>&#160;                <span class="keywordflow">if</span>(allocInfo.m_pChanged != VMA_NULL)</div>
-<div class="line"><a name="l13686"></a><span class="lineno">13686</span>&#160;                {</div>
-<div class="line"><a name="l13687"></a><span class="lineno">13687</span>&#160;                    *allocInfo.m_pChanged = VK_TRUE;</div>
-<div class="line"><a name="l13688"></a><span class="lineno">13688</span>&#160;                }</div>
-<div class="line"><a name="l13689"></a><span class="lineno">13689</span>&#160; </div>
-<div class="line"><a name="l13690"></a><span class="lineno">13690</span>&#160;                ++m_AllocationsMoved;</div>
-<div class="line"><a name="l13691"></a><span class="lineno">13691</span>&#160;                m_BytesMoved += size;</div>
-<div class="line"><a name="l13692"></a><span class="lineno">13692</span>&#160; </div>
-<div class="line"><a name="l13693"></a><span class="lineno">13693</span>&#160;                VmaVectorRemove(pSrcBlockInfo-&gt;m_Allocations, srcAllocIndex);</div>
-<div class="line"><a name="l13694"></a><span class="lineno">13694</span>&#160; </div>
-<div class="line"><a name="l13695"></a><span class="lineno">13695</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l13696"></a><span class="lineno">13696</span>&#160;            }</div>
-<div class="line"><a name="l13697"></a><span class="lineno">13697</span>&#160;        }</div>
-<div class="line"><a name="l13698"></a><span class="lineno">13698</span>&#160; </div>
-<div class="line"><a name="l13699"></a><span class="lineno">13699</span>&#160;        <span class="comment">// If not processed, this allocInfo remains in pBlockInfo-&gt;m_Allocations for next round.</span></div>
+<div class="line"><a name="l13628"></a><span class="lineno">13628</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::CommitDefragmentations(</div>
+<div class="line"><a name="l13629"></a><span class="lineno">13629</span>&#160;    <span class="keyword">class</span> VmaBlockVectorDefragmentationContext *pCtx,</div>
+<div class="line"><a name="l13630"></a><span class="lineno">13630</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats)</div>
+<div class="line"><a name="l13631"></a><span class="lineno">13631</span>&#160;{</div>
+<div class="line"><a name="l13632"></a><span class="lineno">13632</span>&#160;    VmaMutexLockWrite lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l13633"></a><span class="lineno">13633</span>&#160;    </div>
+<div class="line"><a name="l13634"></a><span class="lineno">13634</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = pCtx-&gt;defragmentationMovesCommitted; i &lt; pCtx-&gt;defragmentationMovesProcessed; ++ i)</div>
+<div class="line"><a name="l13635"></a><span class="lineno">13635</span>&#160;    {</div>
+<div class="line"><a name="l13636"></a><span class="lineno">13636</span>&#160;        <span class="keyword">const</span> VmaDefragmentationMove &amp;move = pCtx-&gt;defragmentationMoves[i];</div>
+<div class="line"><a name="l13637"></a><span class="lineno">13637</span>&#160; </div>
+<div class="line"><a name="l13638"></a><span class="lineno">13638</span>&#160;        move.pSrcBlock-&gt;m_pMetadata-&gt;FreeAtOffset(move.srcOffset);</div>
+<div class="line"><a name="l13639"></a><span class="lineno">13639</span>&#160;        move.hAllocation-&gt;ChangeBlockAllocation(m_hAllocator, move.pDstBlock, move.dstOffset);</div>
+<div class="line"><a name="l13640"></a><span class="lineno">13640</span>&#160;    }</div>
+<div class="line"><a name="l13641"></a><span class="lineno">13641</span>&#160; </div>
+<div class="line"><a name="l13642"></a><span class="lineno">13642</span>&#160;    pCtx-&gt;defragmentationMovesCommitted = pCtx-&gt;defragmentationMovesProcessed;</div>
+<div class="line"><a name="l13643"></a><span class="lineno">13643</span>&#160;    FreeEmptyBlocks(pStats);</div>
+<div class="line"><a name="l13644"></a><span class="lineno">13644</span>&#160;}</div>
+<div class="line"><a name="l13645"></a><span class="lineno">13645</span>&#160; </div>
+<div class="line"><a name="l13646"></a><span class="lineno">13646</span>&#160;<span class="keywordtype">size_t</span> VmaBlockVector::CalcAllocationCount()<span class="keyword"> const</span></div>
+<div class="line"><a name="l13647"></a><span class="lineno">13647</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l13648"></a><span class="lineno">13648</span>&#160;    <span class="keywordtype">size_t</span> result = 0;</div>
+<div class="line"><a name="l13649"></a><span class="lineno">13649</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_Blocks.size(); ++i)</div>
+<div class="line"><a name="l13650"></a><span class="lineno">13650</span>&#160;    {</div>
+<div class="line"><a name="l13651"></a><span class="lineno">13651</span>&#160;        result += m_Blocks[i]-&gt;m_pMetadata-&gt;GetAllocationCount();</div>
+<div class="line"><a name="l13652"></a><span class="lineno">13652</span>&#160;    }</div>
+<div class="line"><a name="l13653"></a><span class="lineno">13653</span>&#160;    <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l13654"></a><span class="lineno">13654</span>&#160;}</div>
+<div class="line"><a name="l13655"></a><span class="lineno">13655</span>&#160; </div>
+<div class="line"><a name="l13656"></a><span class="lineno">13656</span>&#160;<span class="keywordtype">bool</span> VmaBlockVector::IsBufferImageGranularityConflictPossible()<span class="keyword"> const</span></div>
+<div class="line"><a name="l13657"></a><span class="lineno">13657</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l13658"></a><span class="lineno">13658</span>&#160;    <span class="keywordflow">if</span>(m_BufferImageGranularity == 1)</div>
+<div class="line"><a name="l13659"></a><span class="lineno">13659</span>&#160;    {</div>
+<div class="line"><a name="l13660"></a><span class="lineno">13660</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l13661"></a><span class="lineno">13661</span>&#160;    }</div>
+<div class="line"><a name="l13662"></a><span class="lineno">13662</span>&#160;    VmaSuballocationType lastSuballocType = VMA_SUBALLOCATION_TYPE_FREE;</div>
+<div class="line"><a name="l13663"></a><span class="lineno">13663</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0, count = m_Blocks.size(); i &lt; count; ++i)</div>
+<div class="line"><a name="l13664"></a><span class="lineno">13664</span>&#160;    {</div>
+<div class="line"><a name="l13665"></a><span class="lineno">13665</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[i];</div>
+<div class="line"><a name="l13666"></a><span class="lineno">13666</span>&#160;        VMA_ASSERT(m_Algorithm == 0);</div>
+<div class="line"><a name="l13667"></a><span class="lineno">13667</span>&#160;        VmaBlockMetadata_Generic* <span class="keyword">const</span> pMetadata = (VmaBlockMetadata_Generic*)pBlock-&gt;m_pMetadata;</div>
+<div class="line"><a name="l13668"></a><span class="lineno">13668</span>&#160;        <span class="keywordflow">if</span>(pMetadata-&gt;IsBufferImageGranularityConflictPossible(m_BufferImageGranularity, lastSuballocType))</div>
+<div class="line"><a name="l13669"></a><span class="lineno">13669</span>&#160;        {</div>
+<div class="line"><a name="l13670"></a><span class="lineno">13670</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l13671"></a><span class="lineno">13671</span>&#160;        }</div>
+<div class="line"><a name="l13672"></a><span class="lineno">13672</span>&#160;    }</div>
+<div class="line"><a name="l13673"></a><span class="lineno">13673</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l13674"></a><span class="lineno">13674</span>&#160;}</div>
+<div class="line"><a name="l13675"></a><span class="lineno">13675</span>&#160; </div>
+<div class="line"><a name="l13676"></a><span class="lineno">13676</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::MakePoolAllocationsLost(</div>
+<div class="line"><a name="l13677"></a><span class="lineno">13677</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l13678"></a><span class="lineno">13678</span>&#160;    <span class="keywordtype">size_t</span>* pLostAllocationCount)</div>
+<div class="line"><a name="l13679"></a><span class="lineno">13679</span>&#160;{</div>
+<div class="line"><a name="l13680"></a><span class="lineno">13680</span>&#160;    VmaMutexLockWrite lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l13681"></a><span class="lineno">13681</span>&#160;    <span class="keywordtype">size_t</span> lostAllocationCount = 0;</div>
+<div class="line"><a name="l13682"></a><span class="lineno">13682</span>&#160;    <span class="keywordflow">for</span>(uint32_t blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex)</div>
+<div class="line"><a name="l13683"></a><span class="lineno">13683</span>&#160;    {</div>
+<div class="line"><a name="l13684"></a><span class="lineno">13684</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l13685"></a><span class="lineno">13685</span>&#160;        VMA_ASSERT(pBlock);</div>
+<div class="line"><a name="l13686"></a><span class="lineno">13686</span>&#160;        lostAllocationCount += pBlock-&gt;m_pMetadata-&gt;MakeAllocationsLost(currentFrameIndex, m_FrameInUseCount);</div>
+<div class="line"><a name="l13687"></a><span class="lineno">13687</span>&#160;    }</div>
+<div class="line"><a name="l13688"></a><span class="lineno">13688</span>&#160;    <span class="keywordflow">if</span>(pLostAllocationCount != VMA_NULL)</div>
+<div class="line"><a name="l13689"></a><span class="lineno">13689</span>&#160;    {</div>
+<div class="line"><a name="l13690"></a><span class="lineno">13690</span>&#160;        *pLostAllocationCount = lostAllocationCount;</div>
+<div class="line"><a name="l13691"></a><span class="lineno">13691</span>&#160;    }</div>
+<div class="line"><a name="l13692"></a><span class="lineno">13692</span>&#160;}</div>
+<div class="line"><a name="l13693"></a><span class="lineno">13693</span>&#160; </div>
+<div class="line"><a name="l13694"></a><span class="lineno">13694</span>&#160;VkResult VmaBlockVector::CheckCorruption()</div>
+<div class="line"><a name="l13695"></a><span class="lineno">13695</span>&#160;{</div>
+<div class="line"><a name="l13696"></a><span class="lineno">13696</span>&#160;    <span class="keywordflow">if</span>(!IsCorruptionDetectionEnabled())</div>
+<div class="line"><a name="l13697"></a><span class="lineno">13697</span>&#160;    {</div>
+<div class="line"><a name="l13698"></a><span class="lineno">13698</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT;</div>
+<div class="line"><a name="l13699"></a><span class="lineno">13699</span>&#160;    }</div>
 <div class="line"><a name="l13700"></a><span class="lineno">13700</span>&#160; </div>
-<div class="line"><a name="l13701"></a><span class="lineno">13701</span>&#160;        <span class="keywordflow">if</span>(srcAllocIndex &gt; 0)</div>
-<div class="line"><a name="l13702"></a><span class="lineno">13702</span>&#160;        {</div>
-<div class="line"><a name="l13703"></a><span class="lineno">13703</span>&#160;            --srcAllocIndex;</div>
-<div class="line"><a name="l13704"></a><span class="lineno">13704</span>&#160;        }</div>
-<div class="line"><a name="l13705"></a><span class="lineno">13705</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13706"></a><span class="lineno">13706</span>&#160;        {</div>
-<div class="line"><a name="l13707"></a><span class="lineno">13707</span>&#160;            <span class="keywordflow">if</span>(srcBlockIndex &gt; 0)</div>
-<div class="line"><a name="l13708"></a><span class="lineno">13708</span>&#160;            {</div>
-<div class="line"><a name="l13709"></a><span class="lineno">13709</span>&#160;                --srcBlockIndex;</div>
-<div class="line"><a name="l13710"></a><span class="lineno">13710</span>&#160;                srcAllocIndex = SIZE_MAX;</div>
-<div class="line"><a name="l13711"></a><span class="lineno">13711</span>&#160;            }</div>
-<div class="line"><a name="l13712"></a><span class="lineno">13712</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13713"></a><span class="lineno">13713</span>&#160;            {</div>
-<div class="line"><a name="l13714"></a><span class="lineno">13714</span>&#160;                <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l13715"></a><span class="lineno">13715</span>&#160;            }</div>
-<div class="line"><a name="l13716"></a><span class="lineno">13716</span>&#160;        }</div>
-<div class="line"><a name="l13717"></a><span class="lineno">13717</span>&#160;    }</div>
-<div class="line"><a name="l13718"></a><span class="lineno">13718</span>&#160;}</div>
+<div class="line"><a name="l13701"></a><span class="lineno">13701</span>&#160;    VmaMutexLockRead lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l13702"></a><span class="lineno">13702</span>&#160;    <span class="keywordflow">for</span>(uint32_t blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex)</div>
+<div class="line"><a name="l13703"></a><span class="lineno">13703</span>&#160;    {</div>
+<div class="line"><a name="l13704"></a><span class="lineno">13704</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l13705"></a><span class="lineno">13705</span>&#160;        VMA_ASSERT(pBlock);</div>
+<div class="line"><a name="l13706"></a><span class="lineno">13706</span>&#160;        VkResult res = pBlock-&gt;CheckCorruption(m_hAllocator);</div>
+<div class="line"><a name="l13707"></a><span class="lineno">13707</span>&#160;        <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l13708"></a><span class="lineno">13708</span>&#160;        {</div>
+<div class="line"><a name="l13709"></a><span class="lineno">13709</span>&#160;            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l13710"></a><span class="lineno">13710</span>&#160;        }</div>
+<div class="line"><a name="l13711"></a><span class="lineno">13711</span>&#160;    }</div>
+<div class="line"><a name="l13712"></a><span class="lineno">13712</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l13713"></a><span class="lineno">13713</span>&#160;}</div>
+<div class="line"><a name="l13714"></a><span class="lineno">13714</span>&#160; </div>
+<div class="line"><a name="l13715"></a><span class="lineno">13715</span>&#160;<span class="keywordtype">void</span> VmaBlockVector::AddStats(<a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats)</div>
+<div class="line"><a name="l13716"></a><span class="lineno">13716</span>&#160;{</div>
+<div class="line"><a name="l13717"></a><span class="lineno">13717</span>&#160;    <span class="keyword">const</span> uint32_t memTypeIndex = m_MemoryTypeIndex;</div>
+<div class="line"><a name="l13718"></a><span class="lineno">13718</span>&#160;    <span class="keyword">const</span> uint32_t memHeapIndex = m_hAllocator-&gt;MemoryTypeIndexToHeapIndex(memTypeIndex);</div>
 <div class="line"><a name="l13719"></a><span class="lineno">13719</span>&#160; </div>
-<div class="line"><a name="l13720"></a><span class="lineno">13720</span>&#160;<span class="keywordtype">size_t</span> VmaDefragmentationAlgorithm_Generic::CalcBlocksWithNonMovableCount()<span class="keyword"> const</span></div>
-<div class="line"><a name="l13721"></a><span class="lineno">13721</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l13722"></a><span class="lineno">13722</span>&#160;    <span class="keywordtype">size_t</span> result = 0;</div>
-<div class="line"><a name="l13723"></a><span class="lineno">13723</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_Blocks.size(); ++i)</div>
-<div class="line"><a name="l13724"></a><span class="lineno">13724</span>&#160;    {</div>
-<div class="line"><a name="l13725"></a><span class="lineno">13725</span>&#160;        <span class="keywordflow">if</span>(m_Blocks[i]-&gt;m_HasNonMovableAllocations)</div>
-<div class="line"><a name="l13726"></a><span class="lineno">13726</span>&#160;        {</div>
-<div class="line"><a name="l13727"></a><span class="lineno">13727</span>&#160;            ++result;</div>
-<div class="line"><a name="l13728"></a><span class="lineno">13728</span>&#160;        }</div>
-<div class="line"><a name="l13729"></a><span class="lineno">13729</span>&#160;    }</div>
-<div class="line"><a name="l13730"></a><span class="lineno">13730</span>&#160;    <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l13731"></a><span class="lineno">13731</span>&#160;}</div>
-<div class="line"><a name="l13732"></a><span class="lineno">13732</span>&#160; </div>
-<div class="line"><a name="l13733"></a><span class="lineno">13733</span>&#160;VkResult VmaDefragmentationAlgorithm_Generic::Defragment(</div>
-<div class="line"><a name="l13734"></a><span class="lineno">13734</span>&#160;    VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
-<div class="line"><a name="l13735"></a><span class="lineno">13735</span>&#160;    VkDeviceSize maxBytesToMove,</div>
-<div class="line"><a name="l13736"></a><span class="lineno">13736</span>&#160;    uint32_t maxAllocationsToMove,</div>
-<div class="line"><a name="l13737"></a><span class="lineno">13737</span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags)</div>
-<div class="line"><a name="l13738"></a><span class="lineno">13738</span>&#160;{</div>
-<div class="line"><a name="l13739"></a><span class="lineno">13739</span>&#160;    <span class="keywordflow">if</span>(!m_AllAllocations &amp;&amp; m_AllocationCount == 0)</div>
-<div class="line"><a name="l13740"></a><span class="lineno">13740</span>&#160;    {</div>
-<div class="line"><a name="l13741"></a><span class="lineno">13741</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l13742"></a><span class="lineno">13742</span>&#160;    }</div>
-<div class="line"><a name="l13743"></a><span class="lineno">13743</span>&#160; </div>
-<div class="line"><a name="l13744"></a><span class="lineno">13744</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_Blocks.size();</div>
-<div class="line"><a name="l13745"></a><span class="lineno">13745</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; blockCount; ++blockIndex)</div>
-<div class="line"><a name="l13746"></a><span class="lineno">13746</span>&#160;    {</div>
-<div class="line"><a name="l13747"></a><span class="lineno">13747</span>&#160;        BlockInfo* pBlockInfo = m_Blocks[blockIndex];</div>
-<div class="line"><a name="l13748"></a><span class="lineno">13748</span>&#160; </div>
-<div class="line"><a name="l13749"></a><span class="lineno">13749</span>&#160;        <span class="keywordflow">if</span>(m_AllAllocations)</div>
-<div class="line"><a name="l13750"></a><span class="lineno">13750</span>&#160;        {</div>
-<div class="line"><a name="l13751"></a><span class="lineno">13751</span>&#160;            VmaBlockMetadata_Generic* pMetadata = (VmaBlockMetadata_Generic*)pBlockInfo-&gt;m_pBlock-&gt;m_pMetadata;</div>
-<div class="line"><a name="l13752"></a><span class="lineno">13752</span>&#160;            <span class="keywordflow">for</span>(VmaSuballocationList::const_iterator it = pMetadata-&gt;m_Suballocations.begin();</div>
-<div class="line"><a name="l13753"></a><span class="lineno">13753</span>&#160;                it != pMetadata-&gt;m_Suballocations.end();</div>
-<div class="line"><a name="l13754"></a><span class="lineno">13754</span>&#160;                ++it)</div>
-<div class="line"><a name="l13755"></a><span class="lineno">13755</span>&#160;            {</div>
-<div class="line"><a name="l13756"></a><span class="lineno">13756</span>&#160;                <span class="keywordflow">if</span>(it-&gt;type != VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l13757"></a><span class="lineno">13757</span>&#160;                {</div>
-<div class="line"><a name="l13758"></a><span class="lineno">13758</span>&#160;                    AllocationInfo allocInfo = AllocationInfo(it-&gt;hAllocation, VMA_NULL);</div>
-<div class="line"><a name="l13759"></a><span class="lineno">13759</span>&#160;                    pBlockInfo-&gt;m_Allocations.push_back(allocInfo);</div>
-<div class="line"><a name="l13760"></a><span class="lineno">13760</span>&#160;                }</div>
-<div class="line"><a name="l13761"></a><span class="lineno">13761</span>&#160;            }</div>
-<div class="line"><a name="l13762"></a><span class="lineno">13762</span>&#160;        }</div>
+<div class="line"><a name="l13720"></a><span class="lineno">13720</span>&#160;    VmaMutexLockRead lock(m_Mutex, m_hAllocator-&gt;m_UseMutex);</div>
+<div class="line"><a name="l13721"></a><span class="lineno">13721</span>&#160; </div>
+<div class="line"><a name="l13722"></a><span class="lineno">13722</span>&#160;    <span class="keywordflow">for</span>(uint32_t blockIndex = 0; blockIndex &lt; m_Blocks.size(); ++blockIndex)</div>
+<div class="line"><a name="l13723"></a><span class="lineno">13723</span>&#160;    {</div>
+<div class="line"><a name="l13724"></a><span class="lineno">13724</span>&#160;        <span class="keyword">const</span> VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l13725"></a><span class="lineno">13725</span>&#160;        VMA_ASSERT(pBlock);</div>
+<div class="line"><a name="l13726"></a><span class="lineno">13726</span>&#160;        VMA_HEAVY_ASSERT(pBlock-&gt;Validate());</div>
+<div class="line"><a name="l13727"></a><span class="lineno">13727</span>&#160;        <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> allocationStatInfo;</div>
+<div class="line"><a name="l13728"></a><span class="lineno">13728</span>&#160;        pBlock-&gt;m_pMetadata-&gt;CalcAllocationStatInfo(allocationStatInfo);</div>
+<div class="line"><a name="l13729"></a><span class="lineno">13729</span>&#160;        VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>, allocationStatInfo);</div>
+<div class="line"><a name="l13730"></a><span class="lineno">13730</span>&#160;        VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[memTypeIndex], allocationStatInfo);</div>
+<div class="line"><a name="l13731"></a><span class="lineno">13731</span>&#160;        VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[memHeapIndex], allocationStatInfo);</div>
+<div class="line"><a name="l13732"></a><span class="lineno">13732</span>&#160;    }</div>
+<div class="line"><a name="l13733"></a><span class="lineno">13733</span>&#160;}</div>
+<div class="line"><a name="l13734"></a><span class="lineno">13734</span>&#160; </div>
+<div class="line"><a name="l13736"></a><span class="lineno">13736</span>&#160;<span class="comment">// VmaDefragmentationAlgorithm_Generic members definition</span></div>
+<div class="line"><a name="l13737"></a><span class="lineno">13737</span>&#160; </div>
+<div class="line"><a name="l13738"></a><span class="lineno">13738</span>&#160;VmaDefragmentationAlgorithm_Generic::VmaDefragmentationAlgorithm_Generic(</div>
+<div class="line"><a name="l13739"></a><span class="lineno">13739</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l13740"></a><span class="lineno">13740</span>&#160;    VmaBlockVector* pBlockVector,</div>
+<div class="line"><a name="l13741"></a><span class="lineno">13741</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l13742"></a><span class="lineno">13742</span>&#160;    <span class="keywordtype">bool</span> overlappingMoveSupported) :</div>
+<div class="line"><a name="l13743"></a><span class="lineno">13743</span>&#160;    VmaDefragmentationAlgorithm(hAllocator, pBlockVector, currentFrameIndex),</div>
+<div class="line"><a name="l13744"></a><span class="lineno">13744</span>&#160;    m_AllocationCount(0),</div>
+<div class="line"><a name="l13745"></a><span class="lineno">13745</span>&#160;    m_AllAllocations(false),</div>
+<div class="line"><a name="l13746"></a><span class="lineno">13746</span>&#160;    m_BytesMoved(0),</div>
+<div class="line"><a name="l13747"></a><span class="lineno">13747</span>&#160;    m_AllocationsMoved(0),</div>
+<div class="line"><a name="l13748"></a><span class="lineno">13748</span>&#160;    m_Blocks(VmaStlAllocator&lt;BlockInfo*&gt;(hAllocator-&gt;GetAllocationCallbacks()))</div>
+<div class="line"><a name="l13749"></a><span class="lineno">13749</span>&#160;{</div>
+<div class="line"><a name="l13750"></a><span class="lineno">13750</span>&#160;    <span class="comment">// Create block info for each block.</span></div>
+<div class="line"><a name="l13751"></a><span class="lineno">13751</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_pBlockVector-&gt;m_Blocks.size();</div>
+<div class="line"><a name="l13752"></a><span class="lineno">13752</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; blockCount; ++blockIndex)</div>
+<div class="line"><a name="l13753"></a><span class="lineno">13753</span>&#160;    {</div>
+<div class="line"><a name="l13754"></a><span class="lineno">13754</span>&#160;        BlockInfo* pBlockInfo = vma_new(m_hAllocator, BlockInfo)(m_hAllocator-&gt;GetAllocationCallbacks());</div>
+<div class="line"><a name="l13755"></a><span class="lineno">13755</span>&#160;        pBlockInfo-&gt;m_OriginalBlockIndex = blockIndex;</div>
+<div class="line"><a name="l13756"></a><span class="lineno">13756</span>&#160;        pBlockInfo-&gt;m_pBlock = m_pBlockVector-&gt;m_Blocks[blockIndex];</div>
+<div class="line"><a name="l13757"></a><span class="lineno">13757</span>&#160;        m_Blocks.push_back(pBlockInfo);</div>
+<div class="line"><a name="l13758"></a><span class="lineno">13758</span>&#160;    }</div>
+<div class="line"><a name="l13759"></a><span class="lineno">13759</span>&#160; </div>
+<div class="line"><a name="l13760"></a><span class="lineno">13760</span>&#160;    <span class="comment">// Sort them by m_pBlock pointer value.</span></div>
+<div class="line"><a name="l13761"></a><span class="lineno">13761</span>&#160;    VMA_SORT(m_Blocks.begin(), m_Blocks.end(), BlockPointerLess());</div>
+<div class="line"><a name="l13762"></a><span class="lineno">13762</span>&#160;}</div>
 <div class="line"><a name="l13763"></a><span class="lineno">13763</span>&#160; </div>
-<div class="line"><a name="l13764"></a><span class="lineno">13764</span>&#160;        pBlockInfo-&gt;CalcHasNonMovableAllocations();</div>
-<div class="line"><a name="l13765"></a><span class="lineno">13765</span>&#160;        </div>
-<div class="line"><a name="l13766"></a><span class="lineno">13766</span>&#160;        <span class="comment">// This is a choice based on research.</span></div>
-<div class="line"><a name="l13767"></a><span class="lineno">13767</span>&#160;        <span class="comment">// Option 1:</span></div>
-<div class="line"><a name="l13768"></a><span class="lineno">13768</span>&#160;        pBlockInfo-&gt;SortAllocationsByOffsetDescending();</div>
-<div class="line"><a name="l13769"></a><span class="lineno">13769</span>&#160;        <span class="comment">// Option 2:</span></div>
-<div class="line"><a name="l13770"></a><span class="lineno">13770</span>&#160;        <span class="comment">//pBlockInfo-&gt;SortAllocationsBySizeDescending();</span></div>
-<div class="line"><a name="l13771"></a><span class="lineno">13771</span>&#160;    }</div>
-<div class="line"><a name="l13772"></a><span class="lineno">13772</span>&#160; </div>
-<div class="line"><a name="l13773"></a><span class="lineno">13773</span>&#160;    <span class="comment">// Sort m_Blocks this time by the main criterium, from most &quot;destination&quot; to most &quot;source&quot; blocks.</span></div>
-<div class="line"><a name="l13774"></a><span class="lineno">13774</span>&#160;    VMA_SORT(m_Blocks.begin(), m_Blocks.end(), BlockInfoCompareMoveDestination());</div>
-<div class="line"><a name="l13775"></a><span class="lineno">13775</span>&#160; </div>
-<div class="line"><a name="l13776"></a><span class="lineno">13776</span>&#160;    <span class="comment">// This is a choice based on research.</span></div>
-<div class="line"><a name="l13777"></a><span class="lineno">13777</span>&#160;    <span class="keyword">const</span> uint32_t roundCount = 2;</div>
-<div class="line"><a name="l13778"></a><span class="lineno">13778</span>&#160; </div>
-<div class="line"><a name="l13779"></a><span class="lineno">13779</span>&#160;    <span class="comment">// Execute defragmentation rounds (the main part).</span></div>
-<div class="line"><a name="l13780"></a><span class="lineno">13780</span>&#160;    VkResult result = VK_SUCCESS;</div>
-<div class="line"><a name="l13781"></a><span class="lineno">13781</span>&#160;    <span class="keywordflow">for</span>(uint32_t round = 0; (round &lt; roundCount) &amp;&amp; (result == VK_SUCCESS); ++round)</div>
-<div class="line"><a name="l13782"></a><span class="lineno">13782</span>&#160;    {</div>
-<div class="line"><a name="l13783"></a><span class="lineno">13783</span>&#160;        result = DefragmentRound(moves, maxBytesToMove, maxAllocationsToMove, !(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a>));</div>
-<div class="line"><a name="l13784"></a><span class="lineno">13784</span>&#160;    }</div>
-<div class="line"><a name="l13785"></a><span class="lineno">13785</span>&#160; </div>
-<div class="line"><a name="l13786"></a><span class="lineno">13786</span>&#160;    <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l13787"></a><span class="lineno">13787</span>&#160;}</div>
+<div class="line"><a name="l13764"></a><span class="lineno">13764</span>&#160;VmaDefragmentationAlgorithm_Generic::~VmaDefragmentationAlgorithm_Generic()</div>
+<div class="line"><a name="l13765"></a><span class="lineno">13765</span>&#160;{</div>
+<div class="line"><a name="l13766"></a><span class="lineno">13766</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_Blocks.size(); i--; )</div>
+<div class="line"><a name="l13767"></a><span class="lineno">13767</span>&#160;    {</div>
+<div class="line"><a name="l13768"></a><span class="lineno">13768</span>&#160;        vma_delete(m_hAllocator, m_Blocks[i]);</div>
+<div class="line"><a name="l13769"></a><span class="lineno">13769</span>&#160;    }</div>
+<div class="line"><a name="l13770"></a><span class="lineno">13770</span>&#160;}</div>
+<div class="line"><a name="l13771"></a><span class="lineno">13771</span>&#160; </div>
+<div class="line"><a name="l13772"></a><span class="lineno">13772</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationAlgorithm_Generic::AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged)</div>
+<div class="line"><a name="l13773"></a><span class="lineno">13773</span>&#160;{</div>
+<div class="line"><a name="l13774"></a><span class="lineno">13774</span>&#160;    <span class="comment">// Now as we are inside VmaBlockVector::m_Mutex, we can make final check if this allocation was not lost.</span></div>
+<div class="line"><a name="l13775"></a><span class="lineno">13775</span>&#160;    <span class="keywordflow">if</span>(hAlloc-&gt;GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST)</div>
+<div class="line"><a name="l13776"></a><span class="lineno">13776</span>&#160;    {</div>
+<div class="line"><a name="l13777"></a><span class="lineno">13777</span>&#160;        VmaDeviceMemoryBlock* pBlock = hAlloc-&gt;GetBlock();</div>
+<div class="line"><a name="l13778"></a><span class="lineno">13778</span>&#160;        BlockInfoVector::iterator it = VmaBinaryFindFirstNotLess(m_Blocks.begin(), m_Blocks.end(), pBlock, BlockPointerLess());</div>
+<div class="line"><a name="l13779"></a><span class="lineno">13779</span>&#160;        <span class="keywordflow">if</span>(it != m_Blocks.end() &amp;&amp; (*it)-&gt;m_pBlock == pBlock)</div>
+<div class="line"><a name="l13780"></a><span class="lineno">13780</span>&#160;        {</div>
+<div class="line"><a name="l13781"></a><span class="lineno">13781</span>&#160;            AllocationInfo allocInfo = AllocationInfo(hAlloc, pChanged);</div>
+<div class="line"><a name="l13782"></a><span class="lineno">13782</span>&#160;            (*it)-&gt;m_Allocations.push_back(allocInfo);</div>
+<div class="line"><a name="l13783"></a><span class="lineno">13783</span>&#160;        }</div>
+<div class="line"><a name="l13784"></a><span class="lineno">13784</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l13785"></a><span class="lineno">13785</span>&#160;        {</div>
+<div class="line"><a name="l13786"></a><span class="lineno">13786</span>&#160;            VMA_ASSERT(0);</div>
+<div class="line"><a name="l13787"></a><span class="lineno">13787</span>&#160;        }</div>
 <div class="line"><a name="l13788"></a><span class="lineno">13788</span>&#160; </div>
-<div class="line"><a name="l13789"></a><span class="lineno">13789</span>&#160;<span class="keywordtype">bool</span> VmaDefragmentationAlgorithm_Generic::MoveMakesSense(</div>
-<div class="line"><a name="l13790"></a><span class="lineno">13790</span>&#160;        <span class="keywordtype">size_t</span> dstBlockIndex, VkDeviceSize dstOffset,</div>
-<div class="line"><a name="l13791"></a><span class="lineno">13791</span>&#160;        <span class="keywordtype">size_t</span> srcBlockIndex, VkDeviceSize srcOffset)</div>
-<div class="line"><a name="l13792"></a><span class="lineno">13792</span>&#160;{</div>
-<div class="line"><a name="l13793"></a><span class="lineno">13793</span>&#160;    <span class="keywordflow">if</span>(dstBlockIndex &lt; srcBlockIndex)</div>
-<div class="line"><a name="l13794"></a><span class="lineno">13794</span>&#160;    {</div>
-<div class="line"><a name="l13795"></a><span class="lineno">13795</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l13796"></a><span class="lineno">13796</span>&#160;    }</div>
-<div class="line"><a name="l13797"></a><span class="lineno">13797</span>&#160;    <span class="keywordflow">if</span>(dstBlockIndex &gt; srcBlockIndex)</div>
-<div class="line"><a name="l13798"></a><span class="lineno">13798</span>&#160;    {</div>
-<div class="line"><a name="l13799"></a><span class="lineno">13799</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l13800"></a><span class="lineno">13800</span>&#160;    }</div>
-<div class="line"><a name="l13801"></a><span class="lineno">13801</span>&#160;    <span class="keywordflow">if</span>(dstOffset &lt; srcOffset)</div>
-<div class="line"><a name="l13802"></a><span class="lineno">13802</span>&#160;    {</div>
-<div class="line"><a name="l13803"></a><span class="lineno">13803</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l13804"></a><span class="lineno">13804</span>&#160;    }</div>
-<div class="line"><a name="l13805"></a><span class="lineno">13805</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l13806"></a><span class="lineno">13806</span>&#160;}</div>
-<div class="line"><a name="l13807"></a><span class="lineno">13807</span>&#160; </div>
-<div class="line"><a name="l13809"></a><span class="lineno">13809</span>&#160;<span class="comment">// VmaDefragmentationAlgorithm_Fast</span></div>
-<div class="line"><a name="l13810"></a><span class="lineno">13810</span>&#160; </div>
-<div class="line"><a name="l13811"></a><span class="lineno">13811</span>&#160;VmaDefragmentationAlgorithm_Fast::VmaDefragmentationAlgorithm_Fast(</div>
-<div class="line"><a name="l13812"></a><span class="lineno">13812</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l13813"></a><span class="lineno">13813</span>&#160;    VmaBlockVector* pBlockVector,</div>
-<div class="line"><a name="l13814"></a><span class="lineno">13814</span>&#160;    uint32_t currentFrameIndex,</div>
-<div class="line"><a name="l13815"></a><span class="lineno">13815</span>&#160;    <span class="keywordtype">bool</span> overlappingMoveSupported) :</div>
-<div class="line"><a name="l13816"></a><span class="lineno">13816</span>&#160;    VmaDefragmentationAlgorithm(hAllocator, pBlockVector, currentFrameIndex),</div>
-<div class="line"><a name="l13817"></a><span class="lineno">13817</span>&#160;    m_OverlappingMoveSupported(overlappingMoveSupported),</div>
-<div class="line"><a name="l13818"></a><span class="lineno">13818</span>&#160;    m_AllocationCount(0),</div>
-<div class="line"><a name="l13819"></a><span class="lineno">13819</span>&#160;    m_AllAllocations(false),</div>
-<div class="line"><a name="l13820"></a><span class="lineno">13820</span>&#160;    m_BytesMoved(0),</div>
-<div class="line"><a name="l13821"></a><span class="lineno">13821</span>&#160;    m_AllocationsMoved(0),</div>
-<div class="line"><a name="l13822"></a><span class="lineno">13822</span>&#160;    m_BlockInfos(VmaStlAllocator&lt;BlockInfo&gt;(hAllocator-&gt;GetAllocationCallbacks()))</div>
-<div class="line"><a name="l13823"></a><span class="lineno">13823</span>&#160;{</div>
-<div class="line"><a name="l13824"></a><span class="lineno">13824</span>&#160;    VMA_ASSERT(VMA_DEBUG_MARGIN == 0);</div>
-<div class="line"><a name="l13825"></a><span class="lineno">13825</span>&#160; </div>
-<div class="line"><a name="l13826"></a><span class="lineno">13826</span>&#160;}</div>
-<div class="line"><a name="l13827"></a><span class="lineno">13827</span>&#160; </div>
-<div class="line"><a name="l13828"></a><span class="lineno">13828</span>&#160;VmaDefragmentationAlgorithm_Fast::~VmaDefragmentationAlgorithm_Fast()</div>
-<div class="line"><a name="l13829"></a><span class="lineno">13829</span>&#160;{</div>
-<div class="line"><a name="l13830"></a><span class="lineno">13830</span>&#160;}</div>
-<div class="line"><a name="l13831"></a><span class="lineno">13831</span>&#160; </div>
-<div class="line"><a name="l13832"></a><span class="lineno">13832</span>&#160;VkResult VmaDefragmentationAlgorithm_Fast::Defragment(</div>
-<div class="line"><a name="l13833"></a><span class="lineno">13833</span>&#160;    VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
-<div class="line"><a name="l13834"></a><span class="lineno">13834</span>&#160;    VkDeviceSize maxBytesToMove,</div>
-<div class="line"><a name="l13835"></a><span class="lineno">13835</span>&#160;    uint32_t maxAllocationsToMove,</div>
-<div class="line"><a name="l13836"></a><span class="lineno">13836</span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags)</div>
-<div class="line"><a name="l13837"></a><span class="lineno">13837</span>&#160;{</div>
-<div class="line"><a name="l13838"></a><span class="lineno">13838</span>&#160;    VMA_ASSERT(m_AllAllocations || m_pBlockVector-&gt;CalcAllocationCount() == m_AllocationCount);</div>
-<div class="line"><a name="l13839"></a><span class="lineno">13839</span>&#160; </div>
-<div class="line"><a name="l13840"></a><span class="lineno">13840</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_pBlockVector-&gt;GetBlockCount();</div>
-<div class="line"><a name="l13841"></a><span class="lineno">13841</span>&#160;    <span class="keywordflow">if</span>(blockCount == 0 || maxBytesToMove == 0 || maxAllocationsToMove == 0)</div>
-<div class="line"><a name="l13842"></a><span class="lineno">13842</span>&#160;    {</div>
-<div class="line"><a name="l13843"></a><span class="lineno">13843</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l13844"></a><span class="lineno">13844</span>&#160;    }</div>
-<div class="line"><a name="l13845"></a><span class="lineno">13845</span>&#160; </div>
-<div class="line"><a name="l13846"></a><span class="lineno">13846</span>&#160;    PreprocessMetadata();</div>
-<div class="line"><a name="l13847"></a><span class="lineno">13847</span>&#160; </div>
-<div class="line"><a name="l13848"></a><span class="lineno">13848</span>&#160;    <span class="comment">// Sort blocks in order from most destination.</span></div>
-<div class="line"><a name="l13849"></a><span class="lineno">13849</span>&#160; </div>
-<div class="line"><a name="l13850"></a><span class="lineno">13850</span>&#160;    m_BlockInfos.resize(blockCount);</div>
-<div class="line"><a name="l13851"></a><span class="lineno">13851</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; blockCount; ++i)</div>
-<div class="line"><a name="l13852"></a><span class="lineno">13852</span>&#160;    {</div>
-<div class="line"><a name="l13853"></a><span class="lineno">13853</span>&#160;        m_BlockInfos[i].origBlockIndex = i;</div>
-<div class="line"><a name="l13854"></a><span class="lineno">13854</span>&#160;    }</div>
+<div class="line"><a name="l13789"></a><span class="lineno">13789</span>&#160;        ++m_AllocationCount;</div>
+<div class="line"><a name="l13790"></a><span class="lineno">13790</span>&#160;    }</div>
+<div class="line"><a name="l13791"></a><span class="lineno">13791</span>&#160;}</div>
+<div class="line"><a name="l13792"></a><span class="lineno">13792</span>&#160; </div>
+<div class="line"><a name="l13793"></a><span class="lineno">13793</span>&#160;VkResult VmaDefragmentationAlgorithm_Generic::DefragmentRound(</div>
+<div class="line"><a name="l13794"></a><span class="lineno">13794</span>&#160;    VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
+<div class="line"><a name="l13795"></a><span class="lineno">13795</span>&#160;    VkDeviceSize maxBytesToMove,</div>
+<div class="line"><a name="l13796"></a><span class="lineno">13796</span>&#160;    uint32_t maxAllocationsToMove,</div>
+<div class="line"><a name="l13797"></a><span class="lineno">13797</span>&#160;    <span class="keywordtype">bool</span> freeOldAllocations)</div>
+<div class="line"><a name="l13798"></a><span class="lineno">13798</span>&#160;{</div>
+<div class="line"><a name="l13799"></a><span class="lineno">13799</span>&#160;    <span class="keywordflow">if</span>(m_Blocks.empty())</div>
+<div class="line"><a name="l13800"></a><span class="lineno">13800</span>&#160;    {</div>
+<div class="line"><a name="l13801"></a><span class="lineno">13801</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l13802"></a><span class="lineno">13802</span>&#160;    }</div>
+<div class="line"><a name="l13803"></a><span class="lineno">13803</span>&#160; </div>
+<div class="line"><a name="l13804"></a><span class="lineno">13804</span>&#160;    <span class="comment">// This is a choice based on research.</span></div>
+<div class="line"><a name="l13805"></a><span class="lineno">13805</span>&#160;    <span class="comment">// Option 1:</span></div>
+<div class="line"><a name="l13806"></a><span class="lineno">13806</span>&#160;    uint32_t strategy = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT</a>;</div>
+<div class="line"><a name="l13807"></a><span class="lineno">13807</span>&#160;    <span class="comment">// Option 2:</span></div>
+<div class="line"><a name="l13808"></a><span class="lineno">13808</span>&#160;    <span class="comment">//uint32_t strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT;</span></div>
+<div class="line"><a name="l13809"></a><span class="lineno">13809</span>&#160;    <span class="comment">// Option 3:</span></div>
+<div class="line"><a name="l13810"></a><span class="lineno">13810</span>&#160;    <span class="comment">//uint32_t strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT;</span></div>
+<div class="line"><a name="l13811"></a><span class="lineno">13811</span>&#160; </div>
+<div class="line"><a name="l13812"></a><span class="lineno">13812</span>&#160;    <span class="keywordtype">size_t</span> srcBlockMinIndex = 0;</div>
+<div class="line"><a name="l13813"></a><span class="lineno">13813</span>&#160;    <span class="comment">// When FAST_ALGORITHM, move allocations from only last out of blocks that contain non-movable allocations.</span></div>
+<div class="line"><a name="l13814"></a><span class="lineno">13814</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l13815"></a><span class="lineno">13815</span>&#160;<span class="comment">    if(m_AlgorithmFlags &amp; VMA_DEFRAGMENTATION_FAST_ALGORITHM_BIT)</span></div>
+<div class="line"><a name="l13816"></a><span class="lineno">13816</span>&#160;<span class="comment">    {</span></div>
+<div class="line"><a name="l13817"></a><span class="lineno">13817</span>&#160;<span class="comment">        const size_t blocksWithNonMovableCount = CalcBlocksWithNonMovableCount();</span></div>
+<div class="line"><a name="l13818"></a><span class="lineno">13818</span>&#160;<span class="comment">        if(blocksWithNonMovableCount &gt; 0)</span></div>
+<div class="line"><a name="l13819"></a><span class="lineno">13819</span>&#160;<span class="comment">        {</span></div>
+<div class="line"><a name="l13820"></a><span class="lineno">13820</span>&#160;<span class="comment">            srcBlockMinIndex = blocksWithNonMovableCount - 1;</span></div>
+<div class="line"><a name="l13821"></a><span class="lineno">13821</span>&#160;<span class="comment">        }</span></div>
+<div class="line"><a name="l13822"></a><span class="lineno">13822</span>&#160;<span class="comment">    }</span></div>
+<div class="line"><a name="l13823"></a><span class="lineno">13823</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l13824"></a><span class="lineno">13824</span>&#160; </div>
+<div class="line"><a name="l13825"></a><span class="lineno">13825</span>&#160;    <span class="keywordtype">size_t</span> srcBlockIndex = m_Blocks.size() - 1;</div>
+<div class="line"><a name="l13826"></a><span class="lineno">13826</span>&#160;    <span class="keywordtype">size_t</span> srcAllocIndex = SIZE_MAX;</div>
+<div class="line"><a name="l13827"></a><span class="lineno">13827</span>&#160;    <span class="keywordflow">for</span>(;;)</div>
+<div class="line"><a name="l13828"></a><span class="lineno">13828</span>&#160;    {</div>
+<div class="line"><a name="l13829"></a><span class="lineno">13829</span>&#160;        <span class="comment">// 1. Find next allocation to move.</span></div>
+<div class="line"><a name="l13830"></a><span class="lineno">13830</span>&#160;        <span class="comment">// 1.1. Start from last to first m_Blocks - they are sorted from most &quot;destination&quot; to most &quot;source&quot;.</span></div>
+<div class="line"><a name="l13831"></a><span class="lineno">13831</span>&#160;        <span class="comment">// 1.2. Then start from last to first m_Allocations.</span></div>
+<div class="line"><a name="l13832"></a><span class="lineno">13832</span>&#160;        <span class="keywordflow">while</span>(srcAllocIndex &gt;= m_Blocks[srcBlockIndex]-&gt;m_Allocations.size())</div>
+<div class="line"><a name="l13833"></a><span class="lineno">13833</span>&#160;        {</div>
+<div class="line"><a name="l13834"></a><span class="lineno">13834</span>&#160;            <span class="keywordflow">if</span>(m_Blocks[srcBlockIndex]-&gt;m_Allocations.empty())</div>
+<div class="line"><a name="l13835"></a><span class="lineno">13835</span>&#160;            {</div>
+<div class="line"><a name="l13836"></a><span class="lineno">13836</span>&#160;                <span class="comment">// Finished: no more allocations to process.</span></div>
+<div class="line"><a name="l13837"></a><span class="lineno">13837</span>&#160;                <span class="keywordflow">if</span>(srcBlockIndex == srcBlockMinIndex)</div>
+<div class="line"><a name="l13838"></a><span class="lineno">13838</span>&#160;                {</div>
+<div class="line"><a name="l13839"></a><span class="lineno">13839</span>&#160;                    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l13840"></a><span class="lineno">13840</span>&#160;                }</div>
+<div class="line"><a name="l13841"></a><span class="lineno">13841</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l13842"></a><span class="lineno">13842</span>&#160;                {</div>
+<div class="line"><a name="l13843"></a><span class="lineno">13843</span>&#160;                    --srcBlockIndex;</div>
+<div class="line"><a name="l13844"></a><span class="lineno">13844</span>&#160;                    srcAllocIndex = SIZE_MAX;</div>
+<div class="line"><a name="l13845"></a><span class="lineno">13845</span>&#160;                }</div>
+<div class="line"><a name="l13846"></a><span class="lineno">13846</span>&#160;            }</div>
+<div class="line"><a name="l13847"></a><span class="lineno">13847</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l13848"></a><span class="lineno">13848</span>&#160;            {</div>
+<div class="line"><a name="l13849"></a><span class="lineno">13849</span>&#160;                srcAllocIndex = m_Blocks[srcBlockIndex]-&gt;m_Allocations.size() - 1;</div>
+<div class="line"><a name="l13850"></a><span class="lineno">13850</span>&#160;            }</div>
+<div class="line"><a name="l13851"></a><span class="lineno">13851</span>&#160;        }</div>
+<div class="line"><a name="l13852"></a><span class="lineno">13852</span>&#160;        </div>
+<div class="line"><a name="l13853"></a><span class="lineno">13853</span>&#160;        BlockInfo* pSrcBlockInfo = m_Blocks[srcBlockIndex];</div>
+<div class="line"><a name="l13854"></a><span class="lineno">13854</span>&#160;        AllocationInfo&amp; allocInfo = pSrcBlockInfo-&gt;m_Allocations[srcAllocIndex];</div>
 <div class="line"><a name="l13855"></a><span class="lineno">13855</span>&#160; </div>
-<div class="line"><a name="l13856"></a><span class="lineno">13856</span>&#160;    VMA_SORT(m_BlockInfos.begin(), m_BlockInfos.end(), [<span class="keyword">this</span>](<span class="keyword">const</span> BlockInfo&amp; lhs, <span class="keyword">const</span> BlockInfo&amp; rhs) -&gt; <span class="keywordtype">bool</span> {</div>
-<div class="line"><a name="l13857"></a><span class="lineno">13857</span>&#160;        return m_pBlockVector-&gt;GetBlock(lhs.origBlockIndex)-&gt;m_pMetadata-&gt;GetSumFreeSize() &lt;</div>
-<div class="line"><a name="l13858"></a><span class="lineno">13858</span>&#160;            m_pBlockVector-&gt;GetBlock(rhs.origBlockIndex)-&gt;m_pMetadata-&gt;GetSumFreeSize();</div>
-<div class="line"><a name="l13859"></a><span class="lineno">13859</span>&#160;    });</div>
+<div class="line"><a name="l13856"></a><span class="lineno">13856</span>&#160;        <span class="keyword">const</span> VkDeviceSize size = allocInfo.m_hAllocation-&gt;GetSize();</div>
+<div class="line"><a name="l13857"></a><span class="lineno">13857</span>&#160;        <span class="keyword">const</span> VkDeviceSize srcOffset = allocInfo.m_hAllocation-&gt;GetOffset();</div>
+<div class="line"><a name="l13858"></a><span class="lineno">13858</span>&#160;        <span class="keyword">const</span> VkDeviceSize alignment = allocInfo.m_hAllocation-&gt;GetAlignment();</div>
+<div class="line"><a name="l13859"></a><span class="lineno">13859</span>&#160;        <span class="keyword">const</span> VmaSuballocationType suballocType = allocInfo.m_hAllocation-&gt;GetSuballocationType();</div>
 <div class="line"><a name="l13860"></a><span class="lineno">13860</span>&#160; </div>
-<div class="line"><a name="l13861"></a><span class="lineno">13861</span>&#160;    <span class="comment">// THE MAIN ALGORITHM</span></div>
-<div class="line"><a name="l13862"></a><span class="lineno">13862</span>&#160; </div>
-<div class="line"><a name="l13863"></a><span class="lineno">13863</span>&#160;    FreeSpaceDatabase freeSpaceDb;</div>
-<div class="line"><a name="l13864"></a><span class="lineno">13864</span>&#160; </div>
-<div class="line"><a name="l13865"></a><span class="lineno">13865</span>&#160;    <span class="keywordtype">size_t</span> dstBlockInfoIndex = 0;</div>
-<div class="line"><a name="l13866"></a><span class="lineno">13866</span>&#160;    <span class="keywordtype">size_t</span> dstOrigBlockIndex = m_BlockInfos[dstBlockInfoIndex].origBlockIndex;</div>
-<div class="line"><a name="l13867"></a><span class="lineno">13867</span>&#160;    VmaDeviceMemoryBlock* pDstBlock = m_pBlockVector-&gt;GetBlock(dstOrigBlockIndex);</div>
-<div class="line"><a name="l13868"></a><span class="lineno">13868</span>&#160;    VmaBlockMetadata_Generic* pDstMetadata = (VmaBlockMetadata_Generic*)pDstBlock-&gt;m_pMetadata;</div>
-<div class="line"><a name="l13869"></a><span class="lineno">13869</span>&#160;    VkDeviceSize dstBlockSize = pDstMetadata-&gt;GetSize();</div>
-<div class="line"><a name="l13870"></a><span class="lineno">13870</span>&#160;    VkDeviceSize dstOffset = 0;</div>
-<div class="line"><a name="l13871"></a><span class="lineno">13871</span>&#160; </div>
-<div class="line"><a name="l13872"></a><span class="lineno">13872</span>&#160;    <span class="keywordtype">bool</span> end = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l13873"></a><span class="lineno">13873</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> srcBlockInfoIndex = 0; !end &amp;&amp; srcBlockInfoIndex &lt; blockCount; ++srcBlockInfoIndex)</div>
-<div class="line"><a name="l13874"></a><span class="lineno">13874</span>&#160;    {</div>
-<div class="line"><a name="l13875"></a><span class="lineno">13875</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> srcOrigBlockIndex = m_BlockInfos[srcBlockInfoIndex].origBlockIndex;</div>
-<div class="line"><a name="l13876"></a><span class="lineno">13876</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pSrcBlock = m_pBlockVector-&gt;GetBlock(srcOrigBlockIndex);</div>
-<div class="line"><a name="l13877"></a><span class="lineno">13877</span>&#160;        VmaBlockMetadata_Generic* <span class="keyword">const</span> pSrcMetadata = (VmaBlockMetadata_Generic*)pSrcBlock-&gt;m_pMetadata;</div>
-<div class="line"><a name="l13878"></a><span class="lineno">13878</span>&#160;        <span class="keywordflow">for</span>(VmaSuballocationList::iterator srcSuballocIt = pSrcMetadata-&gt;m_Suballocations.begin();</div>
-<div class="line"><a name="l13879"></a><span class="lineno">13879</span>&#160;            !end &amp;&amp; srcSuballocIt != pSrcMetadata-&gt;m_Suballocations.end(); )</div>
-<div class="line"><a name="l13880"></a><span class="lineno">13880</span>&#160;        {</div>
-<div class="line"><a name="l13881"></a><span class="lineno">13881</span>&#160;            VmaAllocation_T* <span class="keyword">const</span> pAlloc = srcSuballocIt-&gt;hAllocation;</div>
-<div class="line"><a name="l13882"></a><span class="lineno">13882</span>&#160;            <span class="keyword">const</span> VkDeviceSize srcAllocAlignment = pAlloc-&gt;GetAlignment();</div>
-<div class="line"><a name="l13883"></a><span class="lineno">13883</span>&#160;            <span class="keyword">const</span> VkDeviceSize srcAllocSize = srcSuballocIt-&gt;size;</div>
-<div class="line"><a name="l13884"></a><span class="lineno">13884</span>&#160;            <span class="keywordflow">if</span>(m_AllocationsMoved == maxAllocationsToMove ||</div>
-<div class="line"><a name="l13885"></a><span class="lineno">13885</span>&#160;                m_BytesMoved + srcAllocSize &gt; maxBytesToMove)</div>
-<div class="line"><a name="l13886"></a><span class="lineno">13886</span>&#160;            {</div>
-<div class="line"><a name="l13887"></a><span class="lineno">13887</span>&#160;                end = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l13888"></a><span class="lineno">13888</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l13889"></a><span class="lineno">13889</span>&#160;            }</div>
-<div class="line"><a name="l13890"></a><span class="lineno">13890</span>&#160;            <span class="keyword">const</span> VkDeviceSize srcAllocOffset = srcSuballocIt-&gt;offset;</div>
-<div class="line"><a name="l13891"></a><span class="lineno">13891</span>&#160; </div>
-<div class="line"><a name="l13892"></a><span class="lineno">13892</span>&#160;            VmaDefragmentationMove move = {};</div>
-<div class="line"><a name="l13893"></a><span class="lineno">13893</span>&#160;            <span class="comment">// Try to place it in one of free spaces from the database.</span></div>
-<div class="line"><a name="l13894"></a><span class="lineno">13894</span>&#160;            <span class="keywordtype">size_t</span> freeSpaceInfoIndex;</div>
-<div class="line"><a name="l13895"></a><span class="lineno">13895</span>&#160;            VkDeviceSize dstAllocOffset;</div>
-<div class="line"><a name="l13896"></a><span class="lineno">13896</span>&#160;            <span class="keywordflow">if</span>(freeSpaceDb.Fetch(srcAllocAlignment, srcAllocSize,</div>
-<div class="line"><a name="l13897"></a><span class="lineno">13897</span>&#160;                freeSpaceInfoIndex, dstAllocOffset))</div>
-<div class="line"><a name="l13898"></a><span class="lineno">13898</span>&#160;            {</div>
-<div class="line"><a name="l13899"></a><span class="lineno">13899</span>&#160;                <span class="keywordtype">size_t</span> freeSpaceOrigBlockIndex = m_BlockInfos[freeSpaceInfoIndex].origBlockIndex;</div>
-<div class="line"><a name="l13900"></a><span class="lineno">13900</span>&#160;                VmaDeviceMemoryBlock* pFreeSpaceBlock = m_pBlockVector-&gt;GetBlock(freeSpaceOrigBlockIndex);</div>
-<div class="line"><a name="l13901"></a><span class="lineno">13901</span>&#160;                VmaBlockMetadata_Generic* pFreeSpaceMetadata = (VmaBlockMetadata_Generic*)pFreeSpaceBlock-&gt;m_pMetadata;</div>
-<div class="line"><a name="l13902"></a><span class="lineno">13902</span>&#160; </div>
-<div class="line"><a name="l13903"></a><span class="lineno">13903</span>&#160;                <span class="comment">// Same block</span></div>
-<div class="line"><a name="l13904"></a><span class="lineno">13904</span>&#160;                <span class="keywordflow">if</span>(freeSpaceInfoIndex == srcBlockInfoIndex)</div>
-<div class="line"><a name="l13905"></a><span class="lineno">13905</span>&#160;                {</div>
-<div class="line"><a name="l13906"></a><span class="lineno">13906</span>&#160;                    VMA_ASSERT(dstAllocOffset &lt;= srcAllocOffset);</div>
-<div class="line"><a name="l13907"></a><span class="lineno">13907</span>&#160; </div>
-<div class="line"><a name="l13908"></a><span class="lineno">13908</span>&#160;                    <span class="comment">// MOVE OPTION 1: Move the allocation inside the same block by decreasing offset.</span></div>
-<div class="line"><a name="l13909"></a><span class="lineno">13909</span>&#160; </div>
-<div class="line"><a name="l13910"></a><span class="lineno">13910</span>&#160;                    VmaSuballocation suballoc = *srcSuballocIt;</div>
-<div class="line"><a name="l13911"></a><span class="lineno">13911</span>&#160;                    suballoc.offset = dstAllocOffset;</div>
-<div class="line"><a name="l13912"></a><span class="lineno">13912</span>&#160;                    suballoc.hAllocation-&gt;ChangeOffset(dstAllocOffset);</div>
-<div class="line"><a name="l13913"></a><span class="lineno">13913</span>&#160;                    m_BytesMoved += srcAllocSize;</div>
-<div class="line"><a name="l13914"></a><span class="lineno">13914</span>&#160;                    ++m_AllocationsMoved;</div>
-<div class="line"><a name="l13915"></a><span class="lineno">13915</span>&#160;                    </div>
-<div class="line"><a name="l13916"></a><span class="lineno">13916</span>&#160;                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;</div>
-<div class="line"><a name="l13917"></a><span class="lineno">13917</span>&#160;                    ++nextSuballocIt;</div>
-<div class="line"><a name="l13918"></a><span class="lineno">13918</span>&#160;                    pSrcMetadata-&gt;m_Suballocations.erase(srcSuballocIt);</div>
-<div class="line"><a name="l13919"></a><span class="lineno">13919</span>&#160;                    srcSuballocIt = nextSuballocIt;</div>
+<div class="line"><a name="l13861"></a><span class="lineno">13861</span>&#160;        <span class="comment">// 2. Try to find new place for this allocation in preceding or current block.</span></div>
+<div class="line"><a name="l13862"></a><span class="lineno">13862</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> dstBlockIndex = 0; dstBlockIndex &lt;= srcBlockIndex; ++dstBlockIndex)</div>
+<div class="line"><a name="l13863"></a><span class="lineno">13863</span>&#160;        {</div>
+<div class="line"><a name="l13864"></a><span class="lineno">13864</span>&#160;            BlockInfo* pDstBlockInfo = m_Blocks[dstBlockIndex];</div>
+<div class="line"><a name="l13865"></a><span class="lineno">13865</span>&#160;            VmaAllocationRequest dstAllocRequest;</div>
+<div class="line"><a name="l13866"></a><span class="lineno">13866</span>&#160;            <span class="keywordflow">if</span>(pDstBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;CreateAllocationRequest(</div>
+<div class="line"><a name="l13867"></a><span class="lineno">13867</span>&#160;                m_CurrentFrameIndex,</div>
+<div class="line"><a name="l13868"></a><span class="lineno">13868</span>&#160;                m_pBlockVector-&gt;GetFrameInUseCount(),</div>
+<div class="line"><a name="l13869"></a><span class="lineno">13869</span>&#160;                m_pBlockVector-&gt;GetBufferImageGranularity(),</div>
+<div class="line"><a name="l13870"></a><span class="lineno">13870</span>&#160;                size,</div>
+<div class="line"><a name="l13871"></a><span class="lineno">13871</span>&#160;                alignment,</div>
+<div class="line"><a name="l13872"></a><span class="lineno">13872</span>&#160;                <span class="keyword">false</span>, <span class="comment">// upperAddress</span></div>
+<div class="line"><a name="l13873"></a><span class="lineno">13873</span>&#160;                suballocType,</div>
+<div class="line"><a name="l13874"></a><span class="lineno">13874</span>&#160;                <span class="keyword">false</span>, <span class="comment">// canMakeOtherLost</span></div>
+<div class="line"><a name="l13875"></a><span class="lineno">13875</span>&#160;                strategy,</div>
+<div class="line"><a name="l13876"></a><span class="lineno">13876</span>&#160;                &amp;dstAllocRequest) &amp;&amp;</div>
+<div class="line"><a name="l13877"></a><span class="lineno">13877</span>&#160;            MoveMakesSense(</div>
+<div class="line"><a name="l13878"></a><span class="lineno">13878</span>&#160;                dstBlockIndex, dstAllocRequest.offset, srcBlockIndex, srcOffset))</div>
+<div class="line"><a name="l13879"></a><span class="lineno">13879</span>&#160;            {</div>
+<div class="line"><a name="l13880"></a><span class="lineno">13880</span>&#160;                VMA_ASSERT(dstAllocRequest.itemsToMakeLostCount == 0);</div>
+<div class="line"><a name="l13881"></a><span class="lineno">13881</span>&#160; </div>
+<div class="line"><a name="l13882"></a><span class="lineno">13882</span>&#160;                <span class="comment">// Reached limit on number of allocations or bytes to move.</span></div>
+<div class="line"><a name="l13883"></a><span class="lineno">13883</span>&#160;                <span class="keywordflow">if</span>((m_AllocationsMoved + 1 &gt; maxAllocationsToMove) ||</div>
+<div class="line"><a name="l13884"></a><span class="lineno">13884</span>&#160;                    (m_BytesMoved + size &gt; maxBytesToMove))</div>
+<div class="line"><a name="l13885"></a><span class="lineno">13885</span>&#160;                {</div>
+<div class="line"><a name="l13886"></a><span class="lineno">13886</span>&#160;                    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l13887"></a><span class="lineno">13887</span>&#160;                }</div>
+<div class="line"><a name="l13888"></a><span class="lineno">13888</span>&#160; </div>
+<div class="line"><a name="l13889"></a><span class="lineno">13889</span>&#160;                VmaDefragmentationMove move = {};</div>
+<div class="line"><a name="l13890"></a><span class="lineno">13890</span>&#160;                move.srcBlockIndex = pSrcBlockInfo-&gt;m_OriginalBlockIndex;</div>
+<div class="line"><a name="l13891"></a><span class="lineno">13891</span>&#160;                move.dstBlockIndex = pDstBlockInfo-&gt;m_OriginalBlockIndex;</div>
+<div class="line"><a name="l13892"></a><span class="lineno">13892</span>&#160;                move.srcOffset = srcOffset;</div>
+<div class="line"><a name="l13893"></a><span class="lineno">13893</span>&#160;                move.dstOffset = dstAllocRequest.offset;</div>
+<div class="line"><a name="l13894"></a><span class="lineno">13894</span>&#160;                move.size = size;</div>
+<div class="line"><a name="l13895"></a><span class="lineno">13895</span>&#160;                move.hAllocation = allocInfo.m_hAllocation;</div>
+<div class="line"><a name="l13896"></a><span class="lineno">13896</span>&#160;                move.pSrcBlock = pSrcBlockInfo-&gt;m_pBlock;</div>
+<div class="line"><a name="l13897"></a><span class="lineno">13897</span>&#160;                move.pDstBlock = pDstBlockInfo-&gt;m_pBlock;</div>
+<div class="line"><a name="l13898"></a><span class="lineno">13898</span>&#160; </div>
+<div class="line"><a name="l13899"></a><span class="lineno">13899</span>&#160;                moves.push_back(move);</div>
+<div class="line"><a name="l13900"></a><span class="lineno">13900</span>&#160; </div>
+<div class="line"><a name="l13901"></a><span class="lineno">13901</span>&#160;                pDstBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;Alloc(</div>
+<div class="line"><a name="l13902"></a><span class="lineno">13902</span>&#160;                    dstAllocRequest,</div>
+<div class="line"><a name="l13903"></a><span class="lineno">13903</span>&#160;                    suballocType,</div>
+<div class="line"><a name="l13904"></a><span class="lineno">13904</span>&#160;                    size,</div>
+<div class="line"><a name="l13905"></a><span class="lineno">13905</span>&#160;                    allocInfo.m_hAllocation);</div>
+<div class="line"><a name="l13906"></a><span class="lineno">13906</span>&#160; </div>
+<div class="line"><a name="l13907"></a><span class="lineno">13907</span>&#160;                <span class="keywordflow">if</span>(freeOldAllocations)</div>
+<div class="line"><a name="l13908"></a><span class="lineno">13908</span>&#160;                {</div>
+<div class="line"><a name="l13909"></a><span class="lineno">13909</span>&#160;                    pSrcBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;FreeAtOffset(srcOffset);</div>
+<div class="line"><a name="l13910"></a><span class="lineno">13910</span>&#160;                    allocInfo.m_hAllocation-&gt;ChangeBlockAllocation(m_hAllocator, pDstBlockInfo-&gt;m_pBlock, dstAllocRequest.offset);</div>
+<div class="line"><a name="l13911"></a><span class="lineno">13911</span>&#160;                }</div>
+<div class="line"><a name="l13912"></a><span class="lineno">13912</span>&#160;                </div>
+<div class="line"><a name="l13913"></a><span class="lineno">13913</span>&#160;                <span class="keywordflow">if</span>(allocInfo.m_pChanged != VMA_NULL)</div>
+<div class="line"><a name="l13914"></a><span class="lineno">13914</span>&#160;                {</div>
+<div class="line"><a name="l13915"></a><span class="lineno">13915</span>&#160;                    *allocInfo.m_pChanged = VK_TRUE;</div>
+<div class="line"><a name="l13916"></a><span class="lineno">13916</span>&#160;                }</div>
+<div class="line"><a name="l13917"></a><span class="lineno">13917</span>&#160; </div>
+<div class="line"><a name="l13918"></a><span class="lineno">13918</span>&#160;                ++m_AllocationsMoved;</div>
+<div class="line"><a name="l13919"></a><span class="lineno">13919</span>&#160;                m_BytesMoved += size;</div>
 <div class="line"><a name="l13920"></a><span class="lineno">13920</span>&#160; </div>
-<div class="line"><a name="l13921"></a><span class="lineno">13921</span>&#160;                    InsertSuballoc(pFreeSpaceMetadata, suballoc);</div>
+<div class="line"><a name="l13921"></a><span class="lineno">13921</span>&#160;                VmaVectorRemove(pSrcBlockInfo-&gt;m_Allocations, srcAllocIndex);</div>
 <div class="line"><a name="l13922"></a><span class="lineno">13922</span>&#160; </div>
-<div class="line"><a name="l13923"></a><span class="lineno">13923</span>&#160;                    move.srcBlockIndex = srcOrigBlockIndex;</div>
-<div class="line"><a name="l13924"></a><span class="lineno">13924</span>&#160;                    move.dstBlockIndex = freeSpaceOrigBlockIndex;</div>
-<div class="line"><a name="l13925"></a><span class="lineno">13925</span>&#160;                    move.srcOffset = srcAllocOffset;</div>
-<div class="line"><a name="l13926"></a><span class="lineno">13926</span>&#160;                    move.dstOffset = dstAllocOffset;</div>
-<div class="line"><a name="l13927"></a><span class="lineno">13927</span>&#160;                    move.size = srcAllocSize;</div>
-<div class="line"><a name="l13928"></a><span class="lineno">13928</span>&#160;                    </div>
-<div class="line"><a name="l13929"></a><span class="lineno">13929</span>&#160;                    moves.push_back(move);</div>
-<div class="line"><a name="l13930"></a><span class="lineno">13930</span>&#160;                }</div>
-<div class="line"><a name="l13931"></a><span class="lineno">13931</span>&#160;                <span class="comment">// Different block</span></div>
-<div class="line"><a name="l13932"></a><span class="lineno">13932</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13933"></a><span class="lineno">13933</span>&#160;                {</div>
-<div class="line"><a name="l13934"></a><span class="lineno">13934</span>&#160;                    <span class="comment">// MOVE OPTION 2: Move the allocation to a different block.</span></div>
-<div class="line"><a name="l13935"></a><span class="lineno">13935</span>&#160; </div>
-<div class="line"><a name="l13936"></a><span class="lineno">13936</span>&#160;                    VMA_ASSERT(freeSpaceInfoIndex &lt; srcBlockInfoIndex);</div>
-<div class="line"><a name="l13937"></a><span class="lineno">13937</span>&#160; </div>
-<div class="line"><a name="l13938"></a><span class="lineno">13938</span>&#160;                    VmaSuballocation suballoc = *srcSuballocIt;</div>
-<div class="line"><a name="l13939"></a><span class="lineno">13939</span>&#160;                    suballoc.offset = dstAllocOffset;</div>
-<div class="line"><a name="l13940"></a><span class="lineno">13940</span>&#160;                    suballoc.hAllocation-&gt;ChangeBlockAllocation(m_hAllocator, pFreeSpaceBlock, dstAllocOffset);</div>
-<div class="line"><a name="l13941"></a><span class="lineno">13941</span>&#160;                    m_BytesMoved += srcAllocSize;</div>
-<div class="line"><a name="l13942"></a><span class="lineno">13942</span>&#160;                    ++m_AllocationsMoved;</div>
-<div class="line"><a name="l13943"></a><span class="lineno">13943</span>&#160; </div>
-<div class="line"><a name="l13944"></a><span class="lineno">13944</span>&#160;                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;</div>
-<div class="line"><a name="l13945"></a><span class="lineno">13945</span>&#160;                    ++nextSuballocIt;</div>
-<div class="line"><a name="l13946"></a><span class="lineno">13946</span>&#160;                    pSrcMetadata-&gt;m_Suballocations.erase(srcSuballocIt);</div>
-<div class="line"><a name="l13947"></a><span class="lineno">13947</span>&#160;                    srcSuballocIt = nextSuballocIt;</div>
-<div class="line"><a name="l13948"></a><span class="lineno">13948</span>&#160; </div>
-<div class="line"><a name="l13949"></a><span class="lineno">13949</span>&#160;                    InsertSuballoc(pFreeSpaceMetadata, suballoc);</div>
-<div class="line"><a name="l13950"></a><span class="lineno">13950</span>&#160; </div>
-<div class="line"><a name="l13951"></a><span class="lineno">13951</span>&#160;                    move.srcBlockIndex = srcOrigBlockIndex;</div>
-<div class="line"><a name="l13952"></a><span class="lineno">13952</span>&#160;                    move.dstBlockIndex = freeSpaceOrigBlockIndex;</div>
-<div class="line"><a name="l13953"></a><span class="lineno">13953</span>&#160;                    move.srcOffset = srcAllocOffset;</div>
-<div class="line"><a name="l13954"></a><span class="lineno">13954</span>&#160;                    move.dstOffset = dstAllocOffset;</div>
-<div class="line"><a name="l13955"></a><span class="lineno">13955</span>&#160;                    move.size = srcAllocSize;</div>
-<div class="line"><a name="l13956"></a><span class="lineno">13956</span>&#160;                    </div>
-<div class="line"><a name="l13957"></a><span class="lineno">13957</span>&#160;                    moves.push_back(move);</div>
-<div class="line"><a name="l13958"></a><span class="lineno">13958</span>&#160;                }</div>
-<div class="line"><a name="l13959"></a><span class="lineno">13959</span>&#160;            }</div>
-<div class="line"><a name="l13960"></a><span class="lineno">13960</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l13961"></a><span class="lineno">13961</span>&#160;            {</div>
-<div class="line"><a name="l13962"></a><span class="lineno">13962</span>&#160;                dstAllocOffset = VmaAlignUp(dstOffset, srcAllocAlignment);</div>
-<div class="line"><a name="l13963"></a><span class="lineno">13963</span>&#160; </div>
-<div class="line"><a name="l13964"></a><span class="lineno">13964</span>&#160;                <span class="comment">// If the allocation doesn&#39;t fit before the end of dstBlock, forward to next block.</span></div>
-<div class="line"><a name="l13965"></a><span class="lineno">13965</span>&#160;                <span class="keywordflow">while</span>(dstBlockInfoIndex &lt; srcBlockInfoIndex &amp;&amp;</div>
-<div class="line"><a name="l13966"></a><span class="lineno">13966</span>&#160;                    dstAllocOffset + srcAllocSize &gt; dstBlockSize)</div>
-<div class="line"><a name="l13967"></a><span class="lineno">13967</span>&#160;                {</div>
-<div class="line"><a name="l13968"></a><span class="lineno">13968</span>&#160;                    <span class="comment">// But before that, register remaining free space at the end of dst block.</span></div>
-<div class="line"><a name="l13969"></a><span class="lineno">13969</span>&#160;                    freeSpaceDb.Register(dstBlockInfoIndex, dstOffset, dstBlockSize - dstOffset);</div>
-<div class="line"><a name="l13970"></a><span class="lineno">13970</span>&#160; </div>
-<div class="line"><a name="l13971"></a><span class="lineno">13971</span>&#160;                    ++dstBlockInfoIndex;</div>
-<div class="line"><a name="l13972"></a><span class="lineno">13972</span>&#160;                    dstOrigBlockIndex = m_BlockInfos[dstBlockInfoIndex].origBlockIndex;</div>
-<div class="line"><a name="l13973"></a><span class="lineno">13973</span>&#160;                    pDstBlock = m_pBlockVector-&gt;GetBlock(dstOrigBlockIndex);</div>
-<div class="line"><a name="l13974"></a><span class="lineno">13974</span>&#160;                    pDstMetadata = (VmaBlockMetadata_Generic*)pDstBlock-&gt;m_pMetadata;</div>
-<div class="line"><a name="l13975"></a><span class="lineno">13975</span>&#160;                    dstBlockSize = pDstMetadata-&gt;GetSize();</div>
-<div class="line"><a name="l13976"></a><span class="lineno">13976</span>&#160;                    dstOffset = 0;</div>
-<div class="line"><a name="l13977"></a><span class="lineno">13977</span>&#160;                    dstAllocOffset = 0;</div>
-<div class="line"><a name="l13978"></a><span class="lineno">13978</span>&#160;                }</div>
-<div class="line"><a name="l13979"></a><span class="lineno">13979</span>&#160; </div>
-<div class="line"><a name="l13980"></a><span class="lineno">13980</span>&#160;                <span class="comment">// Same block</span></div>
-<div class="line"><a name="l13981"></a><span class="lineno">13981</span>&#160;                <span class="keywordflow">if</span>(dstBlockInfoIndex == srcBlockInfoIndex)</div>
-<div class="line"><a name="l13982"></a><span class="lineno">13982</span>&#160;                {</div>
-<div class="line"><a name="l13983"></a><span class="lineno">13983</span>&#160;                    VMA_ASSERT(dstAllocOffset &lt;= srcAllocOffset);</div>
-<div class="line"><a name="l13984"></a><span class="lineno">13984</span>&#160; </div>
-<div class="line"><a name="l13985"></a><span class="lineno">13985</span>&#160;                    <span class="keyword">const</span> <span class="keywordtype">bool</span> overlap = dstAllocOffset + srcAllocSize &gt; srcAllocOffset;</div>
-<div class="line"><a name="l13986"></a><span class="lineno">13986</span>&#160; </div>
-<div class="line"><a name="l13987"></a><span class="lineno">13987</span>&#160;                    <span class="keywordtype">bool</span> skipOver = overlap;</div>
-<div class="line"><a name="l13988"></a><span class="lineno">13988</span>&#160;                    <span class="keywordflow">if</span>(overlap &amp;&amp; m_OverlappingMoveSupported &amp;&amp; dstAllocOffset &lt; srcAllocOffset)</div>
-<div class="line"><a name="l13989"></a><span class="lineno">13989</span>&#160;                    {</div>
-<div class="line"><a name="l13990"></a><span class="lineno">13990</span>&#160;                        <span class="comment">// If destination and source place overlap, skip if it would move it</span></div>
-<div class="line"><a name="l13991"></a><span class="lineno">13991</span>&#160;                        <span class="comment">// by only &lt; 1/64 of its size.</span></div>
-<div class="line"><a name="l13992"></a><span class="lineno">13992</span>&#160;                        skipOver = (srcAllocOffset - dstAllocOffset) * 64 &lt; srcAllocSize;</div>
-<div class="line"><a name="l13993"></a><span class="lineno">13993</span>&#160;                    }</div>
-<div class="line"><a name="l13994"></a><span class="lineno">13994</span>&#160; </div>
-<div class="line"><a name="l13995"></a><span class="lineno">13995</span>&#160;                    <span class="keywordflow">if</span>(skipOver)</div>
-<div class="line"><a name="l13996"></a><span class="lineno">13996</span>&#160;                    {</div>
-<div class="line"><a name="l13997"></a><span class="lineno">13997</span>&#160;                        freeSpaceDb.Register(dstBlockInfoIndex, dstOffset, srcAllocOffset - dstOffset);</div>
-<div class="line"><a name="l13998"></a><span class="lineno">13998</span>&#160; </div>
-<div class="line"><a name="l13999"></a><span class="lineno">13999</span>&#160;                        dstOffset = srcAllocOffset + srcAllocSize;</div>
-<div class="line"><a name="l14000"></a><span class="lineno">14000</span>&#160;                        ++srcSuballocIt;</div>
-<div class="line"><a name="l14001"></a><span class="lineno">14001</span>&#160;                    }</div>
-<div class="line"><a name="l14002"></a><span class="lineno">14002</span>&#160;                    <span class="comment">// MOVE OPTION 1: Move the allocation inside the same block by decreasing offset.</span></div>
-<div class="line"><a name="l14003"></a><span class="lineno">14003</span>&#160;                    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l14004"></a><span class="lineno">14004</span>&#160;                    {</div>
-<div class="line"><a name="l14005"></a><span class="lineno">14005</span>&#160;                        srcSuballocIt-&gt;offset = dstAllocOffset;</div>
-<div class="line"><a name="l14006"></a><span class="lineno">14006</span>&#160;                        srcSuballocIt-&gt;hAllocation-&gt;ChangeOffset(dstAllocOffset);</div>
-<div class="line"><a name="l14007"></a><span class="lineno">14007</span>&#160;                        dstOffset = dstAllocOffset + srcAllocSize;</div>
-<div class="line"><a name="l14008"></a><span class="lineno">14008</span>&#160;                        m_BytesMoved += srcAllocSize;</div>
-<div class="line"><a name="l14009"></a><span class="lineno">14009</span>&#160;                        ++m_AllocationsMoved;</div>
-<div class="line"><a name="l14010"></a><span class="lineno">14010</span>&#160;                        ++srcSuballocIt;</div>
-<div class="line"><a name="l14011"></a><span class="lineno">14011</span>&#160;                        </div>
-<div class="line"><a name="l14012"></a><span class="lineno">14012</span>&#160;                        move.srcBlockIndex = srcOrigBlockIndex;</div>
-<div class="line"><a name="l14013"></a><span class="lineno">14013</span>&#160;                        move.dstBlockIndex = dstOrigBlockIndex;</div>
-<div class="line"><a name="l14014"></a><span class="lineno">14014</span>&#160;                        move.srcOffset = srcAllocOffset;</div>
-<div class="line"><a name="l14015"></a><span class="lineno">14015</span>&#160;                        move.dstOffset = dstAllocOffset;</div>
-<div class="line"><a name="l14016"></a><span class="lineno">14016</span>&#160;                        move.size = srcAllocSize;</div>
-<div class="line"><a name="l14017"></a><span class="lineno">14017</span>&#160;                        </div>
-<div class="line"><a name="l14018"></a><span class="lineno">14018</span>&#160;                        moves.push_back(move);</div>
-<div class="line"><a name="l14019"></a><span class="lineno">14019</span>&#160;                    }</div>
-<div class="line"><a name="l14020"></a><span class="lineno">14020</span>&#160;                }</div>
-<div class="line"><a name="l14021"></a><span class="lineno">14021</span>&#160;                <span class="comment">// Different block</span></div>
-<div class="line"><a name="l14022"></a><span class="lineno">14022</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l14023"></a><span class="lineno">14023</span>&#160;                {</div>
-<div class="line"><a name="l14024"></a><span class="lineno">14024</span>&#160;                    <span class="comment">// MOVE OPTION 2: Move the allocation to a different block.</span></div>
-<div class="line"><a name="l14025"></a><span class="lineno">14025</span>&#160; </div>
-<div class="line"><a name="l14026"></a><span class="lineno">14026</span>&#160;                    VMA_ASSERT(dstBlockInfoIndex &lt; srcBlockInfoIndex);</div>
-<div class="line"><a name="l14027"></a><span class="lineno">14027</span>&#160;                    VMA_ASSERT(dstAllocOffset + srcAllocSize &lt;= dstBlockSize);</div>
-<div class="line"><a name="l14028"></a><span class="lineno">14028</span>&#160; </div>
-<div class="line"><a name="l14029"></a><span class="lineno">14029</span>&#160;                    VmaSuballocation suballoc = *srcSuballocIt;</div>
-<div class="line"><a name="l14030"></a><span class="lineno">14030</span>&#160;                    suballoc.offset = dstAllocOffset;</div>
-<div class="line"><a name="l14031"></a><span class="lineno">14031</span>&#160;                    suballoc.hAllocation-&gt;ChangeBlockAllocation(m_hAllocator, pDstBlock, dstAllocOffset);</div>
-<div class="line"><a name="l14032"></a><span class="lineno">14032</span>&#160;                    dstOffset = dstAllocOffset + srcAllocSize;</div>
-<div class="line"><a name="l14033"></a><span class="lineno">14033</span>&#160;                    m_BytesMoved += srcAllocSize;</div>
-<div class="line"><a name="l14034"></a><span class="lineno">14034</span>&#160;                    ++m_AllocationsMoved;</div>
+<div class="line"><a name="l13923"></a><span class="lineno">13923</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l13924"></a><span class="lineno">13924</span>&#160;            }</div>
+<div class="line"><a name="l13925"></a><span class="lineno">13925</span>&#160;        }</div>
+<div class="line"><a name="l13926"></a><span class="lineno">13926</span>&#160; </div>
+<div class="line"><a name="l13927"></a><span class="lineno">13927</span>&#160;        <span class="comment">// If not processed, this allocInfo remains in pBlockInfo-&gt;m_Allocations for next round.</span></div>
+<div class="line"><a name="l13928"></a><span class="lineno">13928</span>&#160; </div>
+<div class="line"><a name="l13929"></a><span class="lineno">13929</span>&#160;        <span class="keywordflow">if</span>(srcAllocIndex &gt; 0)</div>
+<div class="line"><a name="l13930"></a><span class="lineno">13930</span>&#160;        {</div>
+<div class="line"><a name="l13931"></a><span class="lineno">13931</span>&#160;            --srcAllocIndex;</div>
+<div class="line"><a name="l13932"></a><span class="lineno">13932</span>&#160;        }</div>
+<div class="line"><a name="l13933"></a><span class="lineno">13933</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l13934"></a><span class="lineno">13934</span>&#160;        {</div>
+<div class="line"><a name="l13935"></a><span class="lineno">13935</span>&#160;            <span class="keywordflow">if</span>(srcBlockIndex &gt; 0)</div>
+<div class="line"><a name="l13936"></a><span class="lineno">13936</span>&#160;            {</div>
+<div class="line"><a name="l13937"></a><span class="lineno">13937</span>&#160;                --srcBlockIndex;</div>
+<div class="line"><a name="l13938"></a><span class="lineno">13938</span>&#160;                srcAllocIndex = SIZE_MAX;</div>
+<div class="line"><a name="l13939"></a><span class="lineno">13939</span>&#160;            }</div>
+<div class="line"><a name="l13940"></a><span class="lineno">13940</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l13941"></a><span class="lineno">13941</span>&#160;            {</div>
+<div class="line"><a name="l13942"></a><span class="lineno">13942</span>&#160;                <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l13943"></a><span class="lineno">13943</span>&#160;            }</div>
+<div class="line"><a name="l13944"></a><span class="lineno">13944</span>&#160;        }</div>
+<div class="line"><a name="l13945"></a><span class="lineno">13945</span>&#160;    }</div>
+<div class="line"><a name="l13946"></a><span class="lineno">13946</span>&#160;}</div>
+<div class="line"><a name="l13947"></a><span class="lineno">13947</span>&#160; </div>
+<div class="line"><a name="l13948"></a><span class="lineno">13948</span>&#160;<span class="keywordtype">size_t</span> VmaDefragmentationAlgorithm_Generic::CalcBlocksWithNonMovableCount()<span class="keyword"> const</span></div>
+<div class="line"><a name="l13949"></a><span class="lineno">13949</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l13950"></a><span class="lineno">13950</span>&#160;    <span class="keywordtype">size_t</span> result = 0;</div>
+<div class="line"><a name="l13951"></a><span class="lineno">13951</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; m_Blocks.size(); ++i)</div>
+<div class="line"><a name="l13952"></a><span class="lineno">13952</span>&#160;    {</div>
+<div class="line"><a name="l13953"></a><span class="lineno">13953</span>&#160;        <span class="keywordflow">if</span>(m_Blocks[i]-&gt;m_HasNonMovableAllocations)</div>
+<div class="line"><a name="l13954"></a><span class="lineno">13954</span>&#160;        {</div>
+<div class="line"><a name="l13955"></a><span class="lineno">13955</span>&#160;            ++result;</div>
+<div class="line"><a name="l13956"></a><span class="lineno">13956</span>&#160;        }</div>
+<div class="line"><a name="l13957"></a><span class="lineno">13957</span>&#160;    }</div>
+<div class="line"><a name="l13958"></a><span class="lineno">13958</span>&#160;    <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l13959"></a><span class="lineno">13959</span>&#160;}</div>
+<div class="line"><a name="l13960"></a><span class="lineno">13960</span>&#160; </div>
+<div class="line"><a name="l13961"></a><span class="lineno">13961</span>&#160;VkResult VmaDefragmentationAlgorithm_Generic::Defragment(</div>
+<div class="line"><a name="l13962"></a><span class="lineno">13962</span>&#160;    VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
+<div class="line"><a name="l13963"></a><span class="lineno">13963</span>&#160;    VkDeviceSize maxBytesToMove,</div>
+<div class="line"><a name="l13964"></a><span class="lineno">13964</span>&#160;    uint32_t maxAllocationsToMove,</div>
+<div class="line"><a name="l13965"></a><span class="lineno">13965</span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags)</div>
+<div class="line"><a name="l13966"></a><span class="lineno">13966</span>&#160;{</div>
+<div class="line"><a name="l13967"></a><span class="lineno">13967</span>&#160;    <span class="keywordflow">if</span>(!m_AllAllocations &amp;&amp; m_AllocationCount == 0)</div>
+<div class="line"><a name="l13968"></a><span class="lineno">13968</span>&#160;    {</div>
+<div class="line"><a name="l13969"></a><span class="lineno">13969</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l13970"></a><span class="lineno">13970</span>&#160;    }</div>
+<div class="line"><a name="l13971"></a><span class="lineno">13971</span>&#160; </div>
+<div class="line"><a name="l13972"></a><span class="lineno">13972</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_Blocks.size();</div>
+<div class="line"><a name="l13973"></a><span class="lineno">13973</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; blockCount; ++blockIndex)</div>
+<div class="line"><a name="l13974"></a><span class="lineno">13974</span>&#160;    {</div>
+<div class="line"><a name="l13975"></a><span class="lineno">13975</span>&#160;        BlockInfo* pBlockInfo = m_Blocks[blockIndex];</div>
+<div class="line"><a name="l13976"></a><span class="lineno">13976</span>&#160; </div>
+<div class="line"><a name="l13977"></a><span class="lineno">13977</span>&#160;        <span class="keywordflow">if</span>(m_AllAllocations)</div>
+<div class="line"><a name="l13978"></a><span class="lineno">13978</span>&#160;        {</div>
+<div class="line"><a name="l13979"></a><span class="lineno">13979</span>&#160;            VmaBlockMetadata_Generic* pMetadata = (VmaBlockMetadata_Generic*)pBlockInfo-&gt;m_pBlock-&gt;m_pMetadata;</div>
+<div class="line"><a name="l13980"></a><span class="lineno">13980</span>&#160;            <span class="keywordflow">for</span>(VmaSuballocationList::const_iterator it = pMetadata-&gt;m_Suballocations.begin();</div>
+<div class="line"><a name="l13981"></a><span class="lineno">13981</span>&#160;                it != pMetadata-&gt;m_Suballocations.end();</div>
+<div class="line"><a name="l13982"></a><span class="lineno">13982</span>&#160;                ++it)</div>
+<div class="line"><a name="l13983"></a><span class="lineno">13983</span>&#160;            {</div>
+<div class="line"><a name="l13984"></a><span class="lineno">13984</span>&#160;                <span class="keywordflow">if</span>(it-&gt;type != VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l13985"></a><span class="lineno">13985</span>&#160;                {</div>
+<div class="line"><a name="l13986"></a><span class="lineno">13986</span>&#160;                    AllocationInfo allocInfo = AllocationInfo(it-&gt;hAllocation, VMA_NULL);</div>
+<div class="line"><a name="l13987"></a><span class="lineno">13987</span>&#160;                    pBlockInfo-&gt;m_Allocations.push_back(allocInfo);</div>
+<div class="line"><a name="l13988"></a><span class="lineno">13988</span>&#160;                }</div>
+<div class="line"><a name="l13989"></a><span class="lineno">13989</span>&#160;            }</div>
+<div class="line"><a name="l13990"></a><span class="lineno">13990</span>&#160;        }</div>
+<div class="line"><a name="l13991"></a><span class="lineno">13991</span>&#160; </div>
+<div class="line"><a name="l13992"></a><span class="lineno">13992</span>&#160;        pBlockInfo-&gt;CalcHasNonMovableAllocations();</div>
+<div class="line"><a name="l13993"></a><span class="lineno">13993</span>&#160;        </div>
+<div class="line"><a name="l13994"></a><span class="lineno">13994</span>&#160;        <span class="comment">// This is a choice based on research.</span></div>
+<div class="line"><a name="l13995"></a><span class="lineno">13995</span>&#160;        <span class="comment">// Option 1:</span></div>
+<div class="line"><a name="l13996"></a><span class="lineno">13996</span>&#160;        pBlockInfo-&gt;SortAllocationsByOffsetDescending();</div>
+<div class="line"><a name="l13997"></a><span class="lineno">13997</span>&#160;        <span class="comment">// Option 2:</span></div>
+<div class="line"><a name="l13998"></a><span class="lineno">13998</span>&#160;        <span class="comment">//pBlockInfo-&gt;SortAllocationsBySizeDescending();</span></div>
+<div class="line"><a name="l13999"></a><span class="lineno">13999</span>&#160;    }</div>
+<div class="line"><a name="l14000"></a><span class="lineno">14000</span>&#160; </div>
+<div class="line"><a name="l14001"></a><span class="lineno">14001</span>&#160;    <span class="comment">// Sort m_Blocks this time by the main criterium, from most &quot;destination&quot; to most &quot;source&quot; blocks.</span></div>
+<div class="line"><a name="l14002"></a><span class="lineno">14002</span>&#160;    VMA_SORT(m_Blocks.begin(), m_Blocks.end(), BlockInfoCompareMoveDestination());</div>
+<div class="line"><a name="l14003"></a><span class="lineno">14003</span>&#160; </div>
+<div class="line"><a name="l14004"></a><span class="lineno">14004</span>&#160;    <span class="comment">// This is a choice based on research.</span></div>
+<div class="line"><a name="l14005"></a><span class="lineno">14005</span>&#160;    <span class="keyword">const</span> uint32_t roundCount = 2;</div>
+<div class="line"><a name="l14006"></a><span class="lineno">14006</span>&#160; </div>
+<div class="line"><a name="l14007"></a><span class="lineno">14007</span>&#160;    <span class="comment">// Execute defragmentation rounds (the main part).</span></div>
+<div class="line"><a name="l14008"></a><span class="lineno">14008</span>&#160;    VkResult result = VK_SUCCESS;</div>
+<div class="line"><a name="l14009"></a><span class="lineno">14009</span>&#160;    <span class="keywordflow">for</span>(uint32_t round = 0; (round &lt; roundCount) &amp;&amp; (result == VK_SUCCESS); ++round)</div>
+<div class="line"><a name="l14010"></a><span class="lineno">14010</span>&#160;    {</div>
+<div class="line"><a name="l14011"></a><span class="lineno">14011</span>&#160;        result = DefragmentRound(moves, maxBytesToMove, maxAllocationsToMove, !(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a>));</div>
+<div class="line"><a name="l14012"></a><span class="lineno">14012</span>&#160;    }</div>
+<div class="line"><a name="l14013"></a><span class="lineno">14013</span>&#160; </div>
+<div class="line"><a name="l14014"></a><span class="lineno">14014</span>&#160;    <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l14015"></a><span class="lineno">14015</span>&#160;}</div>
+<div class="line"><a name="l14016"></a><span class="lineno">14016</span>&#160; </div>
+<div class="line"><a name="l14017"></a><span class="lineno">14017</span>&#160;<span class="keywordtype">bool</span> VmaDefragmentationAlgorithm_Generic::MoveMakesSense(</div>
+<div class="line"><a name="l14018"></a><span class="lineno">14018</span>&#160;        <span class="keywordtype">size_t</span> dstBlockIndex, VkDeviceSize dstOffset,</div>
+<div class="line"><a name="l14019"></a><span class="lineno">14019</span>&#160;        <span class="keywordtype">size_t</span> srcBlockIndex, VkDeviceSize srcOffset)</div>
+<div class="line"><a name="l14020"></a><span class="lineno">14020</span>&#160;{</div>
+<div class="line"><a name="l14021"></a><span class="lineno">14021</span>&#160;    <span class="keywordflow">if</span>(dstBlockIndex &lt; srcBlockIndex)</div>
+<div class="line"><a name="l14022"></a><span class="lineno">14022</span>&#160;    {</div>
+<div class="line"><a name="l14023"></a><span class="lineno">14023</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l14024"></a><span class="lineno">14024</span>&#160;    }</div>
+<div class="line"><a name="l14025"></a><span class="lineno">14025</span>&#160;    <span class="keywordflow">if</span>(dstBlockIndex &gt; srcBlockIndex)</div>
+<div class="line"><a name="l14026"></a><span class="lineno">14026</span>&#160;    {</div>
+<div class="line"><a name="l14027"></a><span class="lineno">14027</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l14028"></a><span class="lineno">14028</span>&#160;    }</div>
+<div class="line"><a name="l14029"></a><span class="lineno">14029</span>&#160;    <span class="keywordflow">if</span>(dstOffset &lt; srcOffset)</div>
+<div class="line"><a name="l14030"></a><span class="lineno">14030</span>&#160;    {</div>
+<div class="line"><a name="l14031"></a><span class="lineno">14031</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l14032"></a><span class="lineno">14032</span>&#160;    }</div>
+<div class="line"><a name="l14033"></a><span class="lineno">14033</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l14034"></a><span class="lineno">14034</span>&#160;}</div>
 <div class="line"><a name="l14035"></a><span class="lineno">14035</span>&#160; </div>
-<div class="line"><a name="l14036"></a><span class="lineno">14036</span>&#160;                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;</div>
-<div class="line"><a name="l14037"></a><span class="lineno">14037</span>&#160;                    ++nextSuballocIt;</div>
-<div class="line"><a name="l14038"></a><span class="lineno">14038</span>&#160;                    pSrcMetadata-&gt;m_Suballocations.erase(srcSuballocIt);</div>
-<div class="line"><a name="l14039"></a><span class="lineno">14039</span>&#160;                    srcSuballocIt = nextSuballocIt;</div>
-<div class="line"><a name="l14040"></a><span class="lineno">14040</span>&#160; </div>
-<div class="line"><a name="l14041"></a><span class="lineno">14041</span>&#160;                    pDstMetadata-&gt;m_Suballocations.push_back(suballoc);</div>
-<div class="line"><a name="l14042"></a><span class="lineno">14042</span>&#160; </div>
-<div class="line"><a name="l14043"></a><span class="lineno">14043</span>&#160;                    move.srcBlockIndex = srcOrigBlockIndex;</div>
-<div class="line"><a name="l14044"></a><span class="lineno">14044</span>&#160;                    move.dstBlockIndex = dstOrigBlockIndex;</div>
-<div class="line"><a name="l14045"></a><span class="lineno">14045</span>&#160;                    move.srcOffset = srcAllocOffset;</div>
-<div class="line"><a name="l14046"></a><span class="lineno">14046</span>&#160;                    move.dstOffset = dstAllocOffset;</div>
-<div class="line"><a name="l14047"></a><span class="lineno">14047</span>&#160;                    move.size = srcAllocSize;</div>
-<div class="line"><a name="l14048"></a><span class="lineno">14048</span>&#160;                    </div>
-<div class="line"><a name="l14049"></a><span class="lineno">14049</span>&#160;                    moves.push_back(move);</div>
-<div class="line"><a name="l14050"></a><span class="lineno">14050</span>&#160;                }</div>
-<div class="line"><a name="l14051"></a><span class="lineno">14051</span>&#160;            }</div>
-<div class="line"><a name="l14052"></a><span class="lineno">14052</span>&#160;        }</div>
-<div class="line"><a name="l14053"></a><span class="lineno">14053</span>&#160;    }</div>
-<div class="line"><a name="l14054"></a><span class="lineno">14054</span>&#160; </div>
-<div class="line"><a name="l14055"></a><span class="lineno">14055</span>&#160;    m_BlockInfos.clear();</div>
-<div class="line"><a name="l14056"></a><span class="lineno">14056</span>&#160;    </div>
-<div class="line"><a name="l14057"></a><span class="lineno">14057</span>&#160;    PostprocessMetadata();</div>
-<div class="line"><a name="l14058"></a><span class="lineno">14058</span>&#160; </div>
-<div class="line"><a name="l14059"></a><span class="lineno">14059</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l14060"></a><span class="lineno">14060</span>&#160;}</div>
-<div class="line"><a name="l14061"></a><span class="lineno">14061</span>&#160; </div>
-<div class="line"><a name="l14062"></a><span class="lineno">14062</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationAlgorithm_Fast::PreprocessMetadata()</div>
-<div class="line"><a name="l14063"></a><span class="lineno">14063</span>&#160;{</div>
-<div class="line"><a name="l14064"></a><span class="lineno">14064</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_pBlockVector-&gt;GetBlockCount();</div>
-<div class="line"><a name="l14065"></a><span class="lineno">14065</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; blockCount; ++blockIndex)</div>
-<div class="line"><a name="l14066"></a><span class="lineno">14066</span>&#160;    {</div>
-<div class="line"><a name="l14067"></a><span class="lineno">14067</span>&#160;        VmaBlockMetadata_Generic* <span class="keyword">const</span> pMetadata =</div>
-<div class="line"><a name="l14068"></a><span class="lineno">14068</span>&#160;            (VmaBlockMetadata_Generic*)m_pBlockVector-&gt;GetBlock(blockIndex)-&gt;m_pMetadata;</div>
-<div class="line"><a name="l14069"></a><span class="lineno">14069</span>&#160;        pMetadata-&gt;m_FreeCount = 0;</div>
-<div class="line"><a name="l14070"></a><span class="lineno">14070</span>&#160;        pMetadata-&gt;m_SumFreeSize = pMetadata-&gt;GetSize();</div>
-<div class="line"><a name="l14071"></a><span class="lineno">14071</span>&#160;        pMetadata-&gt;m_FreeSuballocationsBySize.clear();</div>
-<div class="line"><a name="l14072"></a><span class="lineno">14072</span>&#160;        <span class="keywordflow">for</span>(VmaSuballocationList::iterator it = pMetadata-&gt;m_Suballocations.begin();</div>
-<div class="line"><a name="l14073"></a><span class="lineno">14073</span>&#160;            it != pMetadata-&gt;m_Suballocations.end(); )</div>
-<div class="line"><a name="l14074"></a><span class="lineno">14074</span>&#160;        {</div>
-<div class="line"><a name="l14075"></a><span class="lineno">14075</span>&#160;            <span class="keywordflow">if</span>(it-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
-<div class="line"><a name="l14076"></a><span class="lineno">14076</span>&#160;            {</div>
-<div class="line"><a name="l14077"></a><span class="lineno">14077</span>&#160;                VmaSuballocationList::iterator nextIt = it;</div>
-<div class="line"><a name="l14078"></a><span class="lineno">14078</span>&#160;                ++nextIt;</div>
-<div class="line"><a name="l14079"></a><span class="lineno">14079</span>&#160;                pMetadata-&gt;m_Suballocations.erase(it);</div>
-<div class="line"><a name="l14080"></a><span class="lineno">14080</span>&#160;                it = nextIt;</div>
-<div class="line"><a name="l14081"></a><span class="lineno">14081</span>&#160;            }</div>
-<div class="line"><a name="l14082"></a><span class="lineno">14082</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l14083"></a><span class="lineno">14083</span>&#160;            {</div>
-<div class="line"><a name="l14084"></a><span class="lineno">14084</span>&#160;                ++it;</div>
-<div class="line"><a name="l14085"></a><span class="lineno">14085</span>&#160;            }</div>
-<div class="line"><a name="l14086"></a><span class="lineno">14086</span>&#160;        }</div>
-<div class="line"><a name="l14087"></a><span class="lineno">14087</span>&#160;    }</div>
-<div class="line"><a name="l14088"></a><span class="lineno">14088</span>&#160;}</div>
-<div class="line"><a name="l14089"></a><span class="lineno">14089</span>&#160; </div>
-<div class="line"><a name="l14090"></a><span class="lineno">14090</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationAlgorithm_Fast::PostprocessMetadata()</div>
-<div class="line"><a name="l14091"></a><span class="lineno">14091</span>&#160;{</div>
-<div class="line"><a name="l14092"></a><span class="lineno">14092</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_pBlockVector-&gt;GetBlockCount();</div>
-<div class="line"><a name="l14093"></a><span class="lineno">14093</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; blockCount; ++blockIndex)</div>
-<div class="line"><a name="l14094"></a><span class="lineno">14094</span>&#160;    {</div>
-<div class="line"><a name="l14095"></a><span class="lineno">14095</span>&#160;        VmaBlockMetadata_Generic* <span class="keyword">const</span> pMetadata =</div>
-<div class="line"><a name="l14096"></a><span class="lineno">14096</span>&#160;            (VmaBlockMetadata_Generic*)m_pBlockVector-&gt;GetBlock(blockIndex)-&gt;m_pMetadata;</div>
-<div class="line"><a name="l14097"></a><span class="lineno">14097</span>&#160;        <span class="keyword">const</span> VkDeviceSize blockSize = pMetadata-&gt;GetSize();</div>
-<div class="line"><a name="l14098"></a><span class="lineno">14098</span>&#160;        </div>
-<div class="line"><a name="l14099"></a><span class="lineno">14099</span>&#160;        <span class="comment">// No allocations in this block - entire area is free.</span></div>
-<div class="line"><a name="l14100"></a><span class="lineno">14100</span>&#160;        <span class="keywordflow">if</span>(pMetadata-&gt;m_Suballocations.empty())</div>
-<div class="line"><a name="l14101"></a><span class="lineno">14101</span>&#160;        {</div>
-<div class="line"><a name="l14102"></a><span class="lineno">14102</span>&#160;            pMetadata-&gt;m_FreeCount = 1;</div>
-<div class="line"><a name="l14103"></a><span class="lineno">14103</span>&#160;            <span class="comment">//pMetadata-&gt;m_SumFreeSize is already set to blockSize.</span></div>
-<div class="line"><a name="l14104"></a><span class="lineno">14104</span>&#160;            VmaSuballocation suballoc = {</div>
-<div class="line"><a name="l14105"></a><span class="lineno">14105</span>&#160;                0, <span class="comment">// offset</span></div>
-<div class="line"><a name="l14106"></a><span class="lineno">14106</span>&#160;                blockSize, <span class="comment">// size</span></div>
-<div class="line"><a name="l14107"></a><span class="lineno">14107</span>&#160;                VMA_NULL, <span class="comment">// hAllocation</span></div>
-<div class="line"><a name="l14108"></a><span class="lineno">14108</span>&#160;                VMA_SUBALLOCATION_TYPE_FREE };</div>
-<div class="line"><a name="l14109"></a><span class="lineno">14109</span>&#160;            pMetadata-&gt;m_Suballocations.push_back(suballoc);</div>
-<div class="line"><a name="l14110"></a><span class="lineno">14110</span>&#160;            pMetadata-&gt;RegisterFreeSuballocation(pMetadata-&gt;m_Suballocations.begin());</div>
-<div class="line"><a name="l14111"></a><span class="lineno">14111</span>&#160;        }</div>
-<div class="line"><a name="l14112"></a><span class="lineno">14112</span>&#160;        <span class="comment">// There are some allocations in this block.</span></div>
-<div class="line"><a name="l14113"></a><span class="lineno">14113</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l14114"></a><span class="lineno">14114</span>&#160;        {</div>
-<div class="line"><a name="l14115"></a><span class="lineno">14115</span>&#160;            VkDeviceSize offset = 0;</div>
-<div class="line"><a name="l14116"></a><span class="lineno">14116</span>&#160;            VmaSuballocationList::iterator it;</div>
-<div class="line"><a name="l14117"></a><span class="lineno">14117</span>&#160;            <span class="keywordflow">for</span>(it = pMetadata-&gt;m_Suballocations.begin();</div>
-<div class="line"><a name="l14118"></a><span class="lineno">14118</span>&#160;                it != pMetadata-&gt;m_Suballocations.end();</div>
-<div class="line"><a name="l14119"></a><span class="lineno">14119</span>&#160;                ++it)</div>
-<div class="line"><a name="l14120"></a><span class="lineno">14120</span>&#160;            {</div>
-<div class="line"><a name="l14121"></a><span class="lineno">14121</span>&#160;                VMA_ASSERT(it-&gt;type != VMA_SUBALLOCATION_TYPE_FREE);</div>
-<div class="line"><a name="l14122"></a><span class="lineno">14122</span>&#160;                VMA_ASSERT(it-&gt;offset &gt;= offset);</div>
-<div class="line"><a name="l14123"></a><span class="lineno">14123</span>&#160; </div>
-<div class="line"><a name="l14124"></a><span class="lineno">14124</span>&#160;                <span class="comment">// Need to insert preceding free space.</span></div>
-<div class="line"><a name="l14125"></a><span class="lineno">14125</span>&#160;                <span class="keywordflow">if</span>(it-&gt;offset &gt; offset)</div>
-<div class="line"><a name="l14126"></a><span class="lineno">14126</span>&#160;                {</div>
-<div class="line"><a name="l14127"></a><span class="lineno">14127</span>&#160;                    ++pMetadata-&gt;m_FreeCount;</div>
-<div class="line"><a name="l14128"></a><span class="lineno">14128</span>&#160;                    <span class="keyword">const</span> VkDeviceSize freeSize = it-&gt;offset - offset;</div>
-<div class="line"><a name="l14129"></a><span class="lineno">14129</span>&#160;                    VmaSuballocation suballoc = {</div>
-<div class="line"><a name="l14130"></a><span class="lineno">14130</span>&#160;                        offset, <span class="comment">// offset</span></div>
-<div class="line"><a name="l14131"></a><span class="lineno">14131</span>&#160;                        freeSize, <span class="comment">// size</span></div>
-<div class="line"><a name="l14132"></a><span class="lineno">14132</span>&#160;                        VMA_NULL, <span class="comment">// hAllocation</span></div>
-<div class="line"><a name="l14133"></a><span class="lineno">14133</span>&#160;                        VMA_SUBALLOCATION_TYPE_FREE };</div>
-<div class="line"><a name="l14134"></a><span class="lineno">14134</span>&#160;                    VmaSuballocationList::iterator precedingFreeIt = pMetadata-&gt;m_Suballocations.insert(it, suballoc);</div>
-<div class="line"><a name="l14135"></a><span class="lineno">14135</span>&#160;                    <span class="keywordflow">if</span>(freeSize &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
-<div class="line"><a name="l14136"></a><span class="lineno">14136</span>&#160;                    {</div>
-<div class="line"><a name="l14137"></a><span class="lineno">14137</span>&#160;                        pMetadata-&gt;m_FreeSuballocationsBySize.push_back(precedingFreeIt);</div>
-<div class="line"><a name="l14138"></a><span class="lineno">14138</span>&#160;                    }</div>
-<div class="line"><a name="l14139"></a><span class="lineno">14139</span>&#160;                }</div>
-<div class="line"><a name="l14140"></a><span class="lineno">14140</span>&#160; </div>
-<div class="line"><a name="l14141"></a><span class="lineno">14141</span>&#160;                pMetadata-&gt;m_SumFreeSize -= it-&gt;size;</div>
-<div class="line"><a name="l14142"></a><span class="lineno">14142</span>&#160;                offset = it-&gt;offset + it-&gt;size;</div>
-<div class="line"><a name="l14143"></a><span class="lineno">14143</span>&#160;            }</div>
-<div class="line"><a name="l14144"></a><span class="lineno">14144</span>&#160; </div>
-<div class="line"><a name="l14145"></a><span class="lineno">14145</span>&#160;            <span class="comment">// Need to insert trailing free space.</span></div>
-<div class="line"><a name="l14146"></a><span class="lineno">14146</span>&#160;            <span class="keywordflow">if</span>(offset &lt; blockSize)</div>
-<div class="line"><a name="l14147"></a><span class="lineno">14147</span>&#160;            {</div>
-<div class="line"><a name="l14148"></a><span class="lineno">14148</span>&#160;                ++pMetadata-&gt;m_FreeCount;</div>
-<div class="line"><a name="l14149"></a><span class="lineno">14149</span>&#160;                <span class="keyword">const</span> VkDeviceSize freeSize = blockSize - offset;</div>
-<div class="line"><a name="l14150"></a><span class="lineno">14150</span>&#160;                VmaSuballocation suballoc = {</div>
-<div class="line"><a name="l14151"></a><span class="lineno">14151</span>&#160;                    offset, <span class="comment">// offset</span></div>
-<div class="line"><a name="l14152"></a><span class="lineno">14152</span>&#160;                    freeSize, <span class="comment">// size</span></div>
-<div class="line"><a name="l14153"></a><span class="lineno">14153</span>&#160;                    VMA_NULL, <span class="comment">// hAllocation</span></div>
-<div class="line"><a name="l14154"></a><span class="lineno">14154</span>&#160;                    VMA_SUBALLOCATION_TYPE_FREE };</div>
-<div class="line"><a name="l14155"></a><span class="lineno">14155</span>&#160;                VMA_ASSERT(it == pMetadata-&gt;m_Suballocations.end());</div>
-<div class="line"><a name="l14156"></a><span class="lineno">14156</span>&#160;                VmaSuballocationList::iterator trailingFreeIt = pMetadata-&gt;m_Suballocations.insert(it, suballoc);</div>
-<div class="line"><a name="l14157"></a><span class="lineno">14157</span>&#160;                <span class="keywordflow">if</span>(freeSize &gt; VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
-<div class="line"><a name="l14158"></a><span class="lineno">14158</span>&#160;                {</div>
-<div class="line"><a name="l14159"></a><span class="lineno">14159</span>&#160;                    pMetadata-&gt;m_FreeSuballocationsBySize.push_back(trailingFreeIt);</div>
-<div class="line"><a name="l14160"></a><span class="lineno">14160</span>&#160;                }</div>
-<div class="line"><a name="l14161"></a><span class="lineno">14161</span>&#160;            }</div>
-<div class="line"><a name="l14162"></a><span class="lineno">14162</span>&#160; </div>
-<div class="line"><a name="l14163"></a><span class="lineno">14163</span>&#160;            VMA_SORT(</div>
-<div class="line"><a name="l14164"></a><span class="lineno">14164</span>&#160;                pMetadata-&gt;m_FreeSuballocationsBySize.begin(),</div>
-<div class="line"><a name="l14165"></a><span class="lineno">14165</span>&#160;                pMetadata-&gt;m_FreeSuballocationsBySize.end(),</div>
-<div class="line"><a name="l14166"></a><span class="lineno">14166</span>&#160;                VmaSuballocationItemSizeLess());</div>
-<div class="line"><a name="l14167"></a><span class="lineno">14167</span>&#160;        }</div>
-<div class="line"><a name="l14168"></a><span class="lineno">14168</span>&#160; </div>
-<div class="line"><a name="l14169"></a><span class="lineno">14169</span>&#160;        VMA_HEAVY_ASSERT(pMetadata-&gt;Validate());</div>
-<div class="line"><a name="l14170"></a><span class="lineno">14170</span>&#160;    }</div>
-<div class="line"><a name="l14171"></a><span class="lineno">14171</span>&#160;}</div>
-<div class="line"><a name="l14172"></a><span class="lineno">14172</span>&#160; </div>
-<div class="line"><a name="l14173"></a><span class="lineno">14173</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationAlgorithm_Fast::InsertSuballoc(VmaBlockMetadata_Generic* pMetadata, <span class="keyword">const</span> VmaSuballocation&amp; suballoc)</div>
-<div class="line"><a name="l14174"></a><span class="lineno">14174</span>&#160;{</div>
-<div class="line"><a name="l14175"></a><span class="lineno">14175</span>&#160;    <span class="comment">// TODO: Optimize somehow. Remember iterator instead of searching for it linearly.</span></div>
-<div class="line"><a name="l14176"></a><span class="lineno">14176</span>&#160;    VmaSuballocationList::iterator it = pMetadata-&gt;m_Suballocations.begin();</div>
-<div class="line"><a name="l14177"></a><span class="lineno">14177</span>&#160;    <span class="keywordflow">while</span>(it != pMetadata-&gt;m_Suballocations.end())</div>
-<div class="line"><a name="l14178"></a><span class="lineno">14178</span>&#160;    {</div>
-<div class="line"><a name="l14179"></a><span class="lineno">14179</span>&#160;        <span class="keywordflow">if</span>(it-&gt;offset &lt; suballoc.offset)</div>
-<div class="line"><a name="l14180"></a><span class="lineno">14180</span>&#160;        {</div>
-<div class="line"><a name="l14181"></a><span class="lineno">14181</span>&#160;            ++it;</div>
-<div class="line"><a name="l14182"></a><span class="lineno">14182</span>&#160;        }</div>
-<div class="line"><a name="l14183"></a><span class="lineno">14183</span>&#160;    }</div>
-<div class="line"><a name="l14184"></a><span class="lineno">14184</span>&#160;    pMetadata-&gt;m_Suballocations.insert(it, suballoc);</div>
-<div class="line"><a name="l14185"></a><span class="lineno">14185</span>&#160;}</div>
-<div class="line"><a name="l14186"></a><span class="lineno">14186</span>&#160; </div>
-<div class="line"><a name="l14188"></a><span class="lineno">14188</span>&#160;<span class="comment">// VmaBlockVectorDefragmentationContext</span></div>
-<div class="line"><a name="l14189"></a><span class="lineno">14189</span>&#160; </div>
-<div class="line"><a name="l14190"></a><span class="lineno">14190</span>&#160;VmaBlockVectorDefragmentationContext::VmaBlockVectorDefragmentationContext(</div>
-<div class="line"><a name="l14191"></a><span class="lineno">14191</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l14192"></a><span class="lineno">14192</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> hCustomPool,</div>
-<div class="line"><a name="l14193"></a><span class="lineno">14193</span>&#160;    VmaBlockVector* pBlockVector,</div>
-<div class="line"><a name="l14194"></a><span class="lineno">14194</span>&#160;    uint32_t currFrameIndex) :</div>
-<div class="line"><a name="l14195"></a><span class="lineno">14195</span>&#160;    res(VK_SUCCESS),</div>
-<div class="line"><a name="l14196"></a><span class="lineno">14196</span>&#160;    mutexLocked(false),</div>
-<div class="line"><a name="l14197"></a><span class="lineno">14197</span>&#160;    blockContexts(VmaStlAllocator&lt;VmaBlockDefragmentationContext&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
-<div class="line"><a name="l14198"></a><span class="lineno">14198</span>&#160;    defragmentationMoves(VmaStlAllocator&lt;VmaDefragmentationMove&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
-<div class="line"><a name="l14199"></a><span class="lineno">14199</span>&#160;    defragmentationMovesProcessed(0),</div>
-<div class="line"><a name="l14200"></a><span class="lineno">14200</span>&#160;    defragmentationMovesCommitted(0),</div>
-<div class="line"><a name="l14201"></a><span class="lineno">14201</span>&#160;    hasDefragmentationPlan(0),</div>
-<div class="line"><a name="l14202"></a><span class="lineno">14202</span>&#160;    m_hAllocator(hAllocator),</div>
-<div class="line"><a name="l14203"></a><span class="lineno">14203</span>&#160;    m_hCustomPool(hCustomPool),</div>
-<div class="line"><a name="l14204"></a><span class="lineno">14204</span>&#160;    m_pBlockVector(pBlockVector),</div>
-<div class="line"><a name="l14205"></a><span class="lineno">14205</span>&#160;    m_CurrFrameIndex(currFrameIndex),</div>
-<div class="line"><a name="l14206"></a><span class="lineno">14206</span>&#160;    m_pAlgorithm(VMA_NULL),</div>
-<div class="line"><a name="l14207"></a><span class="lineno">14207</span>&#160;    m_Allocations(VmaStlAllocator&lt;AllocInfo&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
-<div class="line"><a name="l14208"></a><span class="lineno">14208</span>&#160;    m_AllAllocations(false)</div>
-<div class="line"><a name="l14209"></a><span class="lineno">14209</span>&#160;{</div>
-<div class="line"><a name="l14210"></a><span class="lineno">14210</span>&#160;}</div>
-<div class="line"><a name="l14211"></a><span class="lineno">14211</span>&#160; </div>
-<div class="line"><a name="l14212"></a><span class="lineno">14212</span>&#160;VmaBlockVectorDefragmentationContext::~VmaBlockVectorDefragmentationContext()</div>
-<div class="line"><a name="l14213"></a><span class="lineno">14213</span>&#160;{</div>
-<div class="line"><a name="l14214"></a><span class="lineno">14214</span>&#160;    vma_delete(m_hAllocator, m_pAlgorithm);</div>
-<div class="line"><a name="l14215"></a><span class="lineno">14215</span>&#160;}</div>
-<div class="line"><a name="l14216"></a><span class="lineno">14216</span>&#160; </div>
-<div class="line"><a name="l14217"></a><span class="lineno">14217</span>&#160;<span class="keywordtype">void</span> VmaBlockVectorDefragmentationContext::AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged)</div>
-<div class="line"><a name="l14218"></a><span class="lineno">14218</span>&#160;{</div>
-<div class="line"><a name="l14219"></a><span class="lineno">14219</span>&#160;    AllocInfo info = { hAlloc, pChanged };</div>
-<div class="line"><a name="l14220"></a><span class="lineno">14220</span>&#160;    m_Allocations.push_back(info);</div>
-<div class="line"><a name="l14221"></a><span class="lineno">14221</span>&#160;}</div>
+<div class="line"><a name="l14037"></a><span class="lineno">14037</span>&#160;<span class="comment">// VmaDefragmentationAlgorithm_Fast</span></div>
+<div class="line"><a name="l14038"></a><span class="lineno">14038</span>&#160; </div>
+<div class="line"><a name="l14039"></a><span class="lineno">14039</span>&#160;VmaDefragmentationAlgorithm_Fast::VmaDefragmentationAlgorithm_Fast(</div>
+<div class="line"><a name="l14040"></a><span class="lineno">14040</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l14041"></a><span class="lineno">14041</span>&#160;    VmaBlockVector* pBlockVector,</div>
+<div class="line"><a name="l14042"></a><span class="lineno">14042</span>&#160;    uint32_t currentFrameIndex,</div>
+<div class="line"><a name="l14043"></a><span class="lineno">14043</span>&#160;    <span class="keywordtype">bool</span> overlappingMoveSupported) :</div>
+<div class="line"><a name="l14044"></a><span class="lineno">14044</span>&#160;    VmaDefragmentationAlgorithm(hAllocator, pBlockVector, currentFrameIndex),</div>
+<div class="line"><a name="l14045"></a><span class="lineno">14045</span>&#160;    m_OverlappingMoveSupported(overlappingMoveSupported),</div>
+<div class="line"><a name="l14046"></a><span class="lineno">14046</span>&#160;    m_AllocationCount(0),</div>
+<div class="line"><a name="l14047"></a><span class="lineno">14047</span>&#160;    m_AllAllocations(false),</div>
+<div class="line"><a name="l14048"></a><span class="lineno">14048</span>&#160;    m_BytesMoved(0),</div>
+<div class="line"><a name="l14049"></a><span class="lineno">14049</span>&#160;    m_AllocationsMoved(0),</div>
+<div class="line"><a name="l14050"></a><span class="lineno">14050</span>&#160;    m_BlockInfos(VmaStlAllocator&lt;BlockInfo&gt;(hAllocator-&gt;GetAllocationCallbacks()))</div>
+<div class="line"><a name="l14051"></a><span class="lineno">14051</span>&#160;{</div>
+<div class="line"><a name="l14052"></a><span class="lineno">14052</span>&#160;    VMA_ASSERT(VMA_DEBUG_MARGIN == 0);</div>
+<div class="line"><a name="l14053"></a><span class="lineno">14053</span>&#160; </div>
+<div class="line"><a name="l14054"></a><span class="lineno">14054</span>&#160;}</div>
+<div class="line"><a name="l14055"></a><span class="lineno">14055</span>&#160; </div>
+<div class="line"><a name="l14056"></a><span class="lineno">14056</span>&#160;VmaDefragmentationAlgorithm_Fast::~VmaDefragmentationAlgorithm_Fast()</div>
+<div class="line"><a name="l14057"></a><span class="lineno">14057</span>&#160;{</div>
+<div class="line"><a name="l14058"></a><span class="lineno">14058</span>&#160;}</div>
+<div class="line"><a name="l14059"></a><span class="lineno">14059</span>&#160; </div>
+<div class="line"><a name="l14060"></a><span class="lineno">14060</span>&#160;VkResult VmaDefragmentationAlgorithm_Fast::Defragment(</div>
+<div class="line"><a name="l14061"></a><span class="lineno">14061</span>&#160;    VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
+<div class="line"><a name="l14062"></a><span class="lineno">14062</span>&#160;    VkDeviceSize maxBytesToMove,</div>
+<div class="line"><a name="l14063"></a><span class="lineno">14063</span>&#160;    uint32_t maxAllocationsToMove,</div>
+<div class="line"><a name="l14064"></a><span class="lineno">14064</span>&#160;    <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags)</div>
+<div class="line"><a name="l14065"></a><span class="lineno">14065</span>&#160;{</div>
+<div class="line"><a name="l14066"></a><span class="lineno">14066</span>&#160;    VMA_ASSERT(m_AllAllocations || m_pBlockVector-&gt;CalcAllocationCount() == m_AllocationCount);</div>
+<div class="line"><a name="l14067"></a><span class="lineno">14067</span>&#160; </div>
+<div class="line"><a name="l14068"></a><span class="lineno">14068</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_pBlockVector-&gt;GetBlockCount();</div>
+<div class="line"><a name="l14069"></a><span class="lineno">14069</span>&#160;    <span class="keywordflow">if</span>(blockCount == 0 || maxBytesToMove == 0 || maxAllocationsToMove == 0)</div>
+<div class="line"><a name="l14070"></a><span class="lineno">14070</span>&#160;    {</div>
+<div class="line"><a name="l14071"></a><span class="lineno">14071</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l14072"></a><span class="lineno">14072</span>&#160;    }</div>
+<div class="line"><a name="l14073"></a><span class="lineno">14073</span>&#160; </div>
+<div class="line"><a name="l14074"></a><span class="lineno">14074</span>&#160;    PreprocessMetadata();</div>
+<div class="line"><a name="l14075"></a><span class="lineno">14075</span>&#160; </div>
+<div class="line"><a name="l14076"></a><span class="lineno">14076</span>&#160;    <span class="comment">// Sort blocks in order from most destination.</span></div>
+<div class="line"><a name="l14077"></a><span class="lineno">14077</span>&#160; </div>
+<div class="line"><a name="l14078"></a><span class="lineno">14078</span>&#160;    m_BlockInfos.resize(blockCount);</div>
+<div class="line"><a name="l14079"></a><span class="lineno">14079</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; blockCount; ++i)</div>
+<div class="line"><a name="l14080"></a><span class="lineno">14080</span>&#160;    {</div>
+<div class="line"><a name="l14081"></a><span class="lineno">14081</span>&#160;        m_BlockInfos[i].origBlockIndex = i;</div>
+<div class="line"><a name="l14082"></a><span class="lineno">14082</span>&#160;    }</div>
+<div class="line"><a name="l14083"></a><span class="lineno">14083</span>&#160; </div>
+<div class="line"><a name="l14084"></a><span class="lineno">14084</span>&#160;    VMA_SORT(m_BlockInfos.begin(), m_BlockInfos.end(), [<span class="keyword">this</span>](<span class="keyword">const</span> BlockInfo&amp; lhs, <span class="keyword">const</span> BlockInfo&amp; rhs) -&gt; <span class="keywordtype">bool</span> {</div>
+<div class="line"><a name="l14085"></a><span class="lineno">14085</span>&#160;        return m_pBlockVector-&gt;GetBlock(lhs.origBlockIndex)-&gt;m_pMetadata-&gt;GetSumFreeSize() &lt;</div>
+<div class="line"><a name="l14086"></a><span class="lineno">14086</span>&#160;            m_pBlockVector-&gt;GetBlock(rhs.origBlockIndex)-&gt;m_pMetadata-&gt;GetSumFreeSize();</div>
+<div class="line"><a name="l14087"></a><span class="lineno">14087</span>&#160;    });</div>
+<div class="line"><a name="l14088"></a><span class="lineno">14088</span>&#160; </div>
+<div class="line"><a name="l14089"></a><span class="lineno">14089</span>&#160;    <span class="comment">// THE MAIN ALGORITHM</span></div>
+<div class="line"><a name="l14090"></a><span class="lineno">14090</span>&#160; </div>
+<div class="line"><a name="l14091"></a><span class="lineno">14091</span>&#160;    FreeSpaceDatabase freeSpaceDb;</div>
+<div class="line"><a name="l14092"></a><span class="lineno">14092</span>&#160; </div>
+<div class="line"><a name="l14093"></a><span class="lineno">14093</span>&#160;    <span class="keywordtype">size_t</span> dstBlockInfoIndex = 0;</div>
+<div class="line"><a name="l14094"></a><span class="lineno">14094</span>&#160;    <span class="keywordtype">size_t</span> dstOrigBlockIndex = m_BlockInfos[dstBlockInfoIndex].origBlockIndex;</div>
+<div class="line"><a name="l14095"></a><span class="lineno">14095</span>&#160;    VmaDeviceMemoryBlock* pDstBlock = m_pBlockVector-&gt;GetBlock(dstOrigBlockIndex);</div>
+<div class="line"><a name="l14096"></a><span class="lineno">14096</span>&#160;    VmaBlockMetadata_Generic* pDstMetadata = (VmaBlockMetadata_Generic*)pDstBlock-&gt;m_pMetadata;</div>
+<div class="line"><a name="l14097"></a><span class="lineno">14097</span>&#160;    VkDeviceSize dstBlockSize = pDstMetadata-&gt;GetSize();</div>
+<div class="line"><a name="l14098"></a><span class="lineno">14098</span>&#160;    VkDeviceSize dstOffset = 0;</div>
+<div class="line"><a name="l14099"></a><span class="lineno">14099</span>&#160; </div>
+<div class="line"><a name="l14100"></a><span class="lineno">14100</span>&#160;    <span class="keywordtype">bool</span> end = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l14101"></a><span class="lineno">14101</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> srcBlockInfoIndex = 0; !end &amp;&amp; srcBlockInfoIndex &lt; blockCount; ++srcBlockInfoIndex)</div>
+<div class="line"><a name="l14102"></a><span class="lineno">14102</span>&#160;    {</div>
+<div class="line"><a name="l14103"></a><span class="lineno">14103</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> srcOrigBlockIndex = m_BlockInfos[srcBlockInfoIndex].origBlockIndex;</div>
+<div class="line"><a name="l14104"></a><span class="lineno">14104</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pSrcBlock = m_pBlockVector-&gt;GetBlock(srcOrigBlockIndex);</div>
+<div class="line"><a name="l14105"></a><span class="lineno">14105</span>&#160;        VmaBlockMetadata_Generic* <span class="keyword">const</span> pSrcMetadata = (VmaBlockMetadata_Generic*)pSrcBlock-&gt;m_pMetadata;</div>
+<div class="line"><a name="l14106"></a><span class="lineno">14106</span>&#160;        <span class="keywordflow">for</span>(VmaSuballocationList::iterator srcSuballocIt = pSrcMetadata-&gt;m_Suballocations.begin();</div>
+<div class="line"><a name="l14107"></a><span class="lineno">14107</span>&#160;            !end &amp;&amp; srcSuballocIt != pSrcMetadata-&gt;m_Suballocations.end(); )</div>
+<div class="line"><a name="l14108"></a><span class="lineno">14108</span>&#160;        {</div>
+<div class="line"><a name="l14109"></a><span class="lineno">14109</span>&#160;            VmaAllocation_T* <span class="keyword">const</span> pAlloc = srcSuballocIt-&gt;hAllocation;</div>
+<div class="line"><a name="l14110"></a><span class="lineno">14110</span>&#160;            <span class="keyword">const</span> VkDeviceSize srcAllocAlignment = pAlloc-&gt;GetAlignment();</div>
+<div class="line"><a name="l14111"></a><span class="lineno">14111</span>&#160;            <span class="keyword">const</span> VkDeviceSize srcAllocSize = srcSuballocIt-&gt;size;</div>
+<div class="line"><a name="l14112"></a><span class="lineno">14112</span>&#160;            <span class="keywordflow">if</span>(m_AllocationsMoved == maxAllocationsToMove ||</div>
+<div class="line"><a name="l14113"></a><span class="lineno">14113</span>&#160;                m_BytesMoved + srcAllocSize &gt; maxBytesToMove)</div>
+<div class="line"><a name="l14114"></a><span class="lineno">14114</span>&#160;            {</div>
+<div class="line"><a name="l14115"></a><span class="lineno">14115</span>&#160;                end = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l14116"></a><span class="lineno">14116</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l14117"></a><span class="lineno">14117</span>&#160;            }</div>
+<div class="line"><a name="l14118"></a><span class="lineno">14118</span>&#160;            <span class="keyword">const</span> VkDeviceSize srcAllocOffset = srcSuballocIt-&gt;offset;</div>
+<div class="line"><a name="l14119"></a><span class="lineno">14119</span>&#160; </div>
+<div class="line"><a name="l14120"></a><span class="lineno">14120</span>&#160;            VmaDefragmentationMove move = {};</div>
+<div class="line"><a name="l14121"></a><span class="lineno">14121</span>&#160;            <span class="comment">// Try to place it in one of free spaces from the database.</span></div>
+<div class="line"><a name="l14122"></a><span class="lineno">14122</span>&#160;            <span class="keywordtype">size_t</span> freeSpaceInfoIndex;</div>
+<div class="line"><a name="l14123"></a><span class="lineno">14123</span>&#160;            VkDeviceSize dstAllocOffset;</div>
+<div class="line"><a name="l14124"></a><span class="lineno">14124</span>&#160;            <span class="keywordflow">if</span>(freeSpaceDb.Fetch(srcAllocAlignment, srcAllocSize,</div>
+<div class="line"><a name="l14125"></a><span class="lineno">14125</span>&#160;                freeSpaceInfoIndex, dstAllocOffset))</div>
+<div class="line"><a name="l14126"></a><span class="lineno">14126</span>&#160;            {</div>
+<div class="line"><a name="l14127"></a><span class="lineno">14127</span>&#160;                <span class="keywordtype">size_t</span> freeSpaceOrigBlockIndex = m_BlockInfos[freeSpaceInfoIndex].origBlockIndex;</div>
+<div class="line"><a name="l14128"></a><span class="lineno">14128</span>&#160;                VmaDeviceMemoryBlock* pFreeSpaceBlock = m_pBlockVector-&gt;GetBlock(freeSpaceOrigBlockIndex);</div>
+<div class="line"><a name="l14129"></a><span class="lineno">14129</span>&#160;                VmaBlockMetadata_Generic* pFreeSpaceMetadata = (VmaBlockMetadata_Generic*)pFreeSpaceBlock-&gt;m_pMetadata;</div>
+<div class="line"><a name="l14130"></a><span class="lineno">14130</span>&#160; </div>
+<div class="line"><a name="l14131"></a><span class="lineno">14131</span>&#160;                <span class="comment">// Same block</span></div>
+<div class="line"><a name="l14132"></a><span class="lineno">14132</span>&#160;                <span class="keywordflow">if</span>(freeSpaceInfoIndex == srcBlockInfoIndex)</div>
+<div class="line"><a name="l14133"></a><span class="lineno">14133</span>&#160;                {</div>
+<div class="line"><a name="l14134"></a><span class="lineno">14134</span>&#160;                    VMA_ASSERT(dstAllocOffset &lt;= srcAllocOffset);</div>
+<div class="line"><a name="l14135"></a><span class="lineno">14135</span>&#160; </div>
+<div class="line"><a name="l14136"></a><span class="lineno">14136</span>&#160;                    <span class="comment">// MOVE OPTION 1: Move the allocation inside the same block by decreasing offset.</span></div>
+<div class="line"><a name="l14137"></a><span class="lineno">14137</span>&#160; </div>
+<div class="line"><a name="l14138"></a><span class="lineno">14138</span>&#160;                    VmaSuballocation suballoc = *srcSuballocIt;</div>
+<div class="line"><a name="l14139"></a><span class="lineno">14139</span>&#160;                    suballoc.offset = dstAllocOffset;</div>
+<div class="line"><a name="l14140"></a><span class="lineno">14140</span>&#160;                    suballoc.hAllocation-&gt;ChangeOffset(dstAllocOffset);</div>
+<div class="line"><a name="l14141"></a><span class="lineno">14141</span>&#160;                    m_BytesMoved += srcAllocSize;</div>
+<div class="line"><a name="l14142"></a><span class="lineno">14142</span>&#160;                    ++m_AllocationsMoved;</div>
+<div class="line"><a name="l14143"></a><span class="lineno">14143</span>&#160;                    </div>
+<div class="line"><a name="l14144"></a><span class="lineno">14144</span>&#160;                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;</div>
+<div class="line"><a name="l14145"></a><span class="lineno">14145</span>&#160;                    ++nextSuballocIt;</div>
+<div class="line"><a name="l14146"></a><span class="lineno">14146</span>&#160;                    pSrcMetadata-&gt;m_Suballocations.erase(srcSuballocIt);</div>
+<div class="line"><a name="l14147"></a><span class="lineno">14147</span>&#160;                    srcSuballocIt = nextSuballocIt;</div>
+<div class="line"><a name="l14148"></a><span class="lineno">14148</span>&#160; </div>
+<div class="line"><a name="l14149"></a><span class="lineno">14149</span>&#160;                    InsertSuballoc(pFreeSpaceMetadata, suballoc);</div>
+<div class="line"><a name="l14150"></a><span class="lineno">14150</span>&#160; </div>
+<div class="line"><a name="l14151"></a><span class="lineno">14151</span>&#160;                    move.srcBlockIndex = srcOrigBlockIndex;</div>
+<div class="line"><a name="l14152"></a><span class="lineno">14152</span>&#160;                    move.dstBlockIndex = freeSpaceOrigBlockIndex;</div>
+<div class="line"><a name="l14153"></a><span class="lineno">14153</span>&#160;                    move.srcOffset = srcAllocOffset;</div>
+<div class="line"><a name="l14154"></a><span class="lineno">14154</span>&#160;                    move.dstOffset = dstAllocOffset;</div>
+<div class="line"><a name="l14155"></a><span class="lineno">14155</span>&#160;                    move.size = srcAllocSize;</div>
+<div class="line"><a name="l14156"></a><span class="lineno">14156</span>&#160;                    </div>
+<div class="line"><a name="l14157"></a><span class="lineno">14157</span>&#160;                    moves.push_back(move);</div>
+<div class="line"><a name="l14158"></a><span class="lineno">14158</span>&#160;                }</div>
+<div class="line"><a name="l14159"></a><span class="lineno">14159</span>&#160;                <span class="comment">// Different block</span></div>
+<div class="line"><a name="l14160"></a><span class="lineno">14160</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l14161"></a><span class="lineno">14161</span>&#160;                {</div>
+<div class="line"><a name="l14162"></a><span class="lineno">14162</span>&#160;                    <span class="comment">// MOVE OPTION 2: Move the allocation to a different block.</span></div>
+<div class="line"><a name="l14163"></a><span class="lineno">14163</span>&#160; </div>
+<div class="line"><a name="l14164"></a><span class="lineno">14164</span>&#160;                    VMA_ASSERT(freeSpaceInfoIndex &lt; srcBlockInfoIndex);</div>
+<div class="line"><a name="l14165"></a><span class="lineno">14165</span>&#160; </div>
+<div class="line"><a name="l14166"></a><span class="lineno">14166</span>&#160;                    VmaSuballocation suballoc = *srcSuballocIt;</div>
+<div class="line"><a name="l14167"></a><span class="lineno">14167</span>&#160;                    suballoc.offset = dstAllocOffset;</div>
+<div class="line"><a name="l14168"></a><span class="lineno">14168</span>&#160;                    suballoc.hAllocation-&gt;ChangeBlockAllocation(m_hAllocator, pFreeSpaceBlock, dstAllocOffset);</div>
+<div class="line"><a name="l14169"></a><span class="lineno">14169</span>&#160;                    m_BytesMoved += srcAllocSize;</div>
+<div class="line"><a name="l14170"></a><span class="lineno">14170</span>&#160;                    ++m_AllocationsMoved;</div>
+<div class="line"><a name="l14171"></a><span class="lineno">14171</span>&#160; </div>
+<div class="line"><a name="l14172"></a><span class="lineno">14172</span>&#160;                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;</div>
+<div class="line"><a name="l14173"></a><span class="lineno">14173</span>&#160;                    ++nextSuballocIt;</div>
+<div class="line"><a name="l14174"></a><span class="lineno">14174</span>&#160;                    pSrcMetadata-&gt;m_Suballocations.erase(srcSuballocIt);</div>
+<div class="line"><a name="l14175"></a><span class="lineno">14175</span>&#160;                    srcSuballocIt = nextSuballocIt;</div>
+<div class="line"><a name="l14176"></a><span class="lineno">14176</span>&#160; </div>
+<div class="line"><a name="l14177"></a><span class="lineno">14177</span>&#160;                    InsertSuballoc(pFreeSpaceMetadata, suballoc);</div>
+<div class="line"><a name="l14178"></a><span class="lineno">14178</span>&#160; </div>
+<div class="line"><a name="l14179"></a><span class="lineno">14179</span>&#160;                    move.srcBlockIndex = srcOrigBlockIndex;</div>
+<div class="line"><a name="l14180"></a><span class="lineno">14180</span>&#160;                    move.dstBlockIndex = freeSpaceOrigBlockIndex;</div>
+<div class="line"><a name="l14181"></a><span class="lineno">14181</span>&#160;                    move.srcOffset = srcAllocOffset;</div>
+<div class="line"><a name="l14182"></a><span class="lineno">14182</span>&#160;                    move.dstOffset = dstAllocOffset;</div>
+<div class="line"><a name="l14183"></a><span class="lineno">14183</span>&#160;                    move.size = srcAllocSize;</div>
+<div class="line"><a name="l14184"></a><span class="lineno">14184</span>&#160;                    </div>
+<div class="line"><a name="l14185"></a><span class="lineno">14185</span>&#160;                    moves.push_back(move);</div>
+<div class="line"><a name="l14186"></a><span class="lineno">14186</span>&#160;                }</div>
+<div class="line"><a name="l14187"></a><span class="lineno">14187</span>&#160;            }</div>
+<div class="line"><a name="l14188"></a><span class="lineno">14188</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l14189"></a><span class="lineno">14189</span>&#160;            {</div>
+<div class="line"><a name="l14190"></a><span class="lineno">14190</span>&#160;                dstAllocOffset = VmaAlignUp(dstOffset, srcAllocAlignment);</div>
+<div class="line"><a name="l14191"></a><span class="lineno">14191</span>&#160; </div>
+<div class="line"><a name="l14192"></a><span class="lineno">14192</span>&#160;                <span class="comment">// If the allocation doesn&#39;t fit before the end of dstBlock, forward to next block.</span></div>
+<div class="line"><a name="l14193"></a><span class="lineno">14193</span>&#160;                <span class="keywordflow">while</span>(dstBlockInfoIndex &lt; srcBlockInfoIndex &amp;&amp;</div>
+<div class="line"><a name="l14194"></a><span class="lineno">14194</span>&#160;                    dstAllocOffset + srcAllocSize &gt; dstBlockSize)</div>
+<div class="line"><a name="l14195"></a><span class="lineno">14195</span>&#160;                {</div>
+<div class="line"><a name="l14196"></a><span class="lineno">14196</span>&#160;                    <span class="comment">// But before that, register remaining free space at the end of dst block.</span></div>
+<div class="line"><a name="l14197"></a><span class="lineno">14197</span>&#160;                    freeSpaceDb.Register(dstBlockInfoIndex, dstOffset, dstBlockSize - dstOffset);</div>
+<div class="line"><a name="l14198"></a><span class="lineno">14198</span>&#160; </div>
+<div class="line"><a name="l14199"></a><span class="lineno">14199</span>&#160;                    ++dstBlockInfoIndex;</div>
+<div class="line"><a name="l14200"></a><span class="lineno">14200</span>&#160;                    dstOrigBlockIndex = m_BlockInfos[dstBlockInfoIndex].origBlockIndex;</div>
+<div class="line"><a name="l14201"></a><span class="lineno">14201</span>&#160;                    pDstBlock = m_pBlockVector-&gt;GetBlock(dstOrigBlockIndex);</div>
+<div class="line"><a name="l14202"></a><span class="lineno">14202</span>&#160;                    pDstMetadata = (VmaBlockMetadata_Generic*)pDstBlock-&gt;m_pMetadata;</div>
+<div class="line"><a name="l14203"></a><span class="lineno">14203</span>&#160;                    dstBlockSize = pDstMetadata-&gt;GetSize();</div>
+<div class="line"><a name="l14204"></a><span class="lineno">14204</span>&#160;                    dstOffset = 0;</div>
+<div class="line"><a name="l14205"></a><span class="lineno">14205</span>&#160;                    dstAllocOffset = 0;</div>
+<div class="line"><a name="l14206"></a><span class="lineno">14206</span>&#160;                }</div>
+<div class="line"><a name="l14207"></a><span class="lineno">14207</span>&#160; </div>
+<div class="line"><a name="l14208"></a><span class="lineno">14208</span>&#160;                <span class="comment">// Same block</span></div>
+<div class="line"><a name="l14209"></a><span class="lineno">14209</span>&#160;                <span class="keywordflow">if</span>(dstBlockInfoIndex == srcBlockInfoIndex)</div>
+<div class="line"><a name="l14210"></a><span class="lineno">14210</span>&#160;                {</div>
+<div class="line"><a name="l14211"></a><span class="lineno">14211</span>&#160;                    VMA_ASSERT(dstAllocOffset &lt;= srcAllocOffset);</div>
+<div class="line"><a name="l14212"></a><span class="lineno">14212</span>&#160; </div>
+<div class="line"><a name="l14213"></a><span class="lineno">14213</span>&#160;                    <span class="keyword">const</span> <span class="keywordtype">bool</span> overlap = dstAllocOffset + srcAllocSize &gt; srcAllocOffset;</div>
+<div class="line"><a name="l14214"></a><span class="lineno">14214</span>&#160; </div>
+<div class="line"><a name="l14215"></a><span class="lineno">14215</span>&#160;                    <span class="keywordtype">bool</span> skipOver = overlap;</div>
+<div class="line"><a name="l14216"></a><span class="lineno">14216</span>&#160;                    <span class="keywordflow">if</span>(overlap &amp;&amp; m_OverlappingMoveSupported &amp;&amp; dstAllocOffset &lt; srcAllocOffset)</div>
+<div class="line"><a name="l14217"></a><span class="lineno">14217</span>&#160;                    {</div>
+<div class="line"><a name="l14218"></a><span class="lineno">14218</span>&#160;                        <span class="comment">// If destination and source place overlap, skip if it would move it</span></div>
+<div class="line"><a name="l14219"></a><span class="lineno">14219</span>&#160;                        <span class="comment">// by only &lt; 1/64 of its size.</span></div>
+<div class="line"><a name="l14220"></a><span class="lineno">14220</span>&#160;                        skipOver = (srcAllocOffset - dstAllocOffset) * 64 &lt; srcAllocSize;</div>
+<div class="line"><a name="l14221"></a><span class="lineno">14221</span>&#160;                    }</div>
 <div class="line"><a name="l14222"></a><span class="lineno">14222</span>&#160; </div>
-<div class="line"><a name="l14223"></a><span class="lineno">14223</span>&#160;<span class="keywordtype">void</span> VmaBlockVectorDefragmentationContext::Begin(<span class="keywordtype">bool</span> overlappingMoveSupported, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags)</div>
-<div class="line"><a name="l14224"></a><span class="lineno">14224</span>&#160;{</div>
-<div class="line"><a name="l14225"></a><span class="lineno">14225</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> allAllocations = m_AllAllocations ||</div>
-<div class="line"><a name="l14226"></a><span class="lineno">14226</span>&#160;        m_Allocations.size() == m_pBlockVector-&gt;CalcAllocationCount();</div>
-<div class="line"><a name="l14227"></a><span class="lineno">14227</span>&#160; </div>
-<div class="line"><a name="l14228"></a><span class="lineno">14228</span>&#160;<span class="comment">    /********************************</span></div>
-<div class="line"><a name="l14229"></a><span class="lineno">14229</span>&#160;<span class="comment">    HERE IS THE CHOICE OF DEFRAGMENTATION ALGORITHM.</span></div>
-<div class="line"><a name="l14230"></a><span class="lineno">14230</span>&#160;<span class="comment">    ********************************/</span></div>
-<div class="line"><a name="l14231"></a><span class="lineno">14231</span>&#160; </div>
-<div class="line"><a name="l14232"></a><span class="lineno">14232</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l14233"></a><span class="lineno">14233</span>&#160;<span class="comment">    Fast algorithm is supported only when certain criteria are met:</span></div>
-<div class="line"><a name="l14234"></a><span class="lineno">14234</span>&#160;<span class="comment">    - VMA_DEBUG_MARGIN is 0.</span></div>
-<div class="line"><a name="l14235"></a><span class="lineno">14235</span>&#160;<span class="comment">    - All allocations in this block vector are moveable.</span></div>
-<div class="line"><a name="l14236"></a><span class="lineno">14236</span>&#160;<span class="comment">    - There is no possibility of image/buffer granularity conflict.</span></div>
-<div class="line"><a name="l14237"></a><span class="lineno">14237</span>&#160;<span class="comment">    - The defragmentation is not incremental</span></div>
-<div class="line"><a name="l14238"></a><span class="lineno">14238</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l14239"></a><span class="lineno">14239</span>&#160;    <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN == 0 &amp;&amp;</div>
-<div class="line"><a name="l14240"></a><span class="lineno">14240</span>&#160;        allAllocations &amp;&amp;</div>
-<div class="line"><a name="l14241"></a><span class="lineno">14241</span>&#160;        !m_pBlockVector-&gt;IsBufferImageGranularityConflictPossible() &amp;&amp;</div>
-<div class="line"><a name="l14242"></a><span class="lineno">14242</span>&#160;        !(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a>))</div>
-<div class="line"><a name="l14243"></a><span class="lineno">14243</span>&#160;    {</div>
-<div class="line"><a name="l14244"></a><span class="lineno">14244</span>&#160;        m_pAlgorithm = vma_new(m_hAllocator, VmaDefragmentationAlgorithm_Fast)(</div>
-<div class="line"><a name="l14245"></a><span class="lineno">14245</span>&#160;            m_hAllocator, m_pBlockVector, m_CurrFrameIndex, overlappingMoveSupported);</div>
-<div class="line"><a name="l14246"></a><span class="lineno">14246</span>&#160;    }</div>
-<div class="line"><a name="l14247"></a><span class="lineno">14247</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l14248"></a><span class="lineno">14248</span>&#160;    {</div>
-<div class="line"><a name="l14249"></a><span class="lineno">14249</span>&#160;        m_pAlgorithm = vma_new(m_hAllocator, VmaDefragmentationAlgorithm_Generic)(</div>
-<div class="line"><a name="l14250"></a><span class="lineno">14250</span>&#160;            m_hAllocator, m_pBlockVector, m_CurrFrameIndex, overlappingMoveSupported);</div>
-<div class="line"><a name="l14251"></a><span class="lineno">14251</span>&#160;    }</div>
-<div class="line"><a name="l14252"></a><span class="lineno">14252</span>&#160; </div>
-<div class="line"><a name="l14253"></a><span class="lineno">14253</span>&#160;    <span class="keywordflow">if</span>(allAllocations)</div>
-<div class="line"><a name="l14254"></a><span class="lineno">14254</span>&#160;    {</div>
-<div class="line"><a name="l14255"></a><span class="lineno">14255</span>&#160;        m_pAlgorithm-&gt;AddAll();</div>
-<div class="line"><a name="l14256"></a><span class="lineno">14256</span>&#160;    }</div>
-<div class="line"><a name="l14257"></a><span class="lineno">14257</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l14258"></a><span class="lineno">14258</span>&#160;    {</div>
-<div class="line"><a name="l14259"></a><span class="lineno">14259</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0, count = m_Allocations.size(); i &lt; count; ++i)</div>
-<div class="line"><a name="l14260"></a><span class="lineno">14260</span>&#160;        {</div>
-<div class="line"><a name="l14261"></a><span class="lineno">14261</span>&#160;            m_pAlgorithm-&gt;AddAllocation(m_Allocations[i].hAlloc, m_Allocations[i].pChanged);</div>
-<div class="line"><a name="l14262"></a><span class="lineno">14262</span>&#160;        }</div>
-<div class="line"><a name="l14263"></a><span class="lineno">14263</span>&#160;    }</div>
-<div class="line"><a name="l14264"></a><span class="lineno">14264</span>&#160;}</div>
-<div class="line"><a name="l14265"></a><span class="lineno">14265</span>&#160; </div>
-<div class="line"><a name="l14267"></a><span class="lineno">14267</span>&#160;<span class="comment">// VmaDefragmentationContext</span></div>
+<div class="line"><a name="l14223"></a><span class="lineno">14223</span>&#160;                    <span class="keywordflow">if</span>(skipOver)</div>
+<div class="line"><a name="l14224"></a><span class="lineno">14224</span>&#160;                    {</div>
+<div class="line"><a name="l14225"></a><span class="lineno">14225</span>&#160;                        freeSpaceDb.Register(dstBlockInfoIndex, dstOffset, srcAllocOffset - dstOffset);</div>
+<div class="line"><a name="l14226"></a><span class="lineno">14226</span>&#160; </div>
+<div class="line"><a name="l14227"></a><span class="lineno">14227</span>&#160;                        dstOffset = srcAllocOffset + srcAllocSize;</div>
+<div class="line"><a name="l14228"></a><span class="lineno">14228</span>&#160;                        ++srcSuballocIt;</div>
+<div class="line"><a name="l14229"></a><span class="lineno">14229</span>&#160;                    }</div>
+<div class="line"><a name="l14230"></a><span class="lineno">14230</span>&#160;                    <span class="comment">// MOVE OPTION 1: Move the allocation inside the same block by decreasing offset.</span></div>
+<div class="line"><a name="l14231"></a><span class="lineno">14231</span>&#160;                    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l14232"></a><span class="lineno">14232</span>&#160;                    {</div>
+<div class="line"><a name="l14233"></a><span class="lineno">14233</span>&#160;                        srcSuballocIt-&gt;offset = dstAllocOffset;</div>
+<div class="line"><a name="l14234"></a><span class="lineno">14234</span>&#160;                        srcSuballocIt-&gt;hAllocation-&gt;ChangeOffset(dstAllocOffset);</div>
+<div class="line"><a name="l14235"></a><span class="lineno">14235</span>&#160;                        dstOffset = dstAllocOffset + srcAllocSize;</div>
+<div class="line"><a name="l14236"></a><span class="lineno">14236</span>&#160;                        m_BytesMoved += srcAllocSize;</div>
+<div class="line"><a name="l14237"></a><span class="lineno">14237</span>&#160;                        ++m_AllocationsMoved;</div>
+<div class="line"><a name="l14238"></a><span class="lineno">14238</span>&#160;                        ++srcSuballocIt;</div>
+<div class="line"><a name="l14239"></a><span class="lineno">14239</span>&#160;                        </div>
+<div class="line"><a name="l14240"></a><span class="lineno">14240</span>&#160;                        move.srcBlockIndex = srcOrigBlockIndex;</div>
+<div class="line"><a name="l14241"></a><span class="lineno">14241</span>&#160;                        move.dstBlockIndex = dstOrigBlockIndex;</div>
+<div class="line"><a name="l14242"></a><span class="lineno">14242</span>&#160;                        move.srcOffset = srcAllocOffset;</div>
+<div class="line"><a name="l14243"></a><span class="lineno">14243</span>&#160;                        move.dstOffset = dstAllocOffset;</div>
+<div class="line"><a name="l14244"></a><span class="lineno">14244</span>&#160;                        move.size = srcAllocSize;</div>
+<div class="line"><a name="l14245"></a><span class="lineno">14245</span>&#160;                        </div>
+<div class="line"><a name="l14246"></a><span class="lineno">14246</span>&#160;                        moves.push_back(move);</div>
+<div class="line"><a name="l14247"></a><span class="lineno">14247</span>&#160;                    }</div>
+<div class="line"><a name="l14248"></a><span class="lineno">14248</span>&#160;                }</div>
+<div class="line"><a name="l14249"></a><span class="lineno">14249</span>&#160;                <span class="comment">// Different block</span></div>
+<div class="line"><a name="l14250"></a><span class="lineno">14250</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l14251"></a><span class="lineno">14251</span>&#160;                {</div>
+<div class="line"><a name="l14252"></a><span class="lineno">14252</span>&#160;                    <span class="comment">// MOVE OPTION 2: Move the allocation to a different block.</span></div>
+<div class="line"><a name="l14253"></a><span class="lineno">14253</span>&#160; </div>
+<div class="line"><a name="l14254"></a><span class="lineno">14254</span>&#160;                    VMA_ASSERT(dstBlockInfoIndex &lt; srcBlockInfoIndex);</div>
+<div class="line"><a name="l14255"></a><span class="lineno">14255</span>&#160;                    VMA_ASSERT(dstAllocOffset + srcAllocSize &lt;= dstBlockSize);</div>
+<div class="line"><a name="l14256"></a><span class="lineno">14256</span>&#160; </div>
+<div class="line"><a name="l14257"></a><span class="lineno">14257</span>&#160;                    VmaSuballocation suballoc = *srcSuballocIt;</div>
+<div class="line"><a name="l14258"></a><span class="lineno">14258</span>&#160;                    suballoc.offset = dstAllocOffset;</div>
+<div class="line"><a name="l14259"></a><span class="lineno">14259</span>&#160;                    suballoc.hAllocation-&gt;ChangeBlockAllocation(m_hAllocator, pDstBlock, dstAllocOffset);</div>
+<div class="line"><a name="l14260"></a><span class="lineno">14260</span>&#160;                    dstOffset = dstAllocOffset + srcAllocSize;</div>
+<div class="line"><a name="l14261"></a><span class="lineno">14261</span>&#160;                    m_BytesMoved += srcAllocSize;</div>
+<div class="line"><a name="l14262"></a><span class="lineno">14262</span>&#160;                    ++m_AllocationsMoved;</div>
+<div class="line"><a name="l14263"></a><span class="lineno">14263</span>&#160; </div>
+<div class="line"><a name="l14264"></a><span class="lineno">14264</span>&#160;                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;</div>
+<div class="line"><a name="l14265"></a><span class="lineno">14265</span>&#160;                    ++nextSuballocIt;</div>
+<div class="line"><a name="l14266"></a><span class="lineno">14266</span>&#160;                    pSrcMetadata-&gt;m_Suballocations.erase(srcSuballocIt);</div>
+<div class="line"><a name="l14267"></a><span class="lineno">14267</span>&#160;                    srcSuballocIt = nextSuballocIt;</div>
 <div class="line"><a name="l14268"></a><span class="lineno">14268</span>&#160; </div>
-<div class="line"><a name="l14269"></a><span class="lineno">14269</span>&#160;VmaDefragmentationContext_T::VmaDefragmentationContext_T(</div>
-<div class="line"><a name="l14270"></a><span class="lineno">14270</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
-<div class="line"><a name="l14271"></a><span class="lineno">14271</span>&#160;    uint32_t currFrameIndex,</div>
-<div class="line"><a name="l14272"></a><span class="lineno">14272</span>&#160;    uint32_t flags,</div>
-<div class="line"><a name="l14273"></a><span class="lineno">14273</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats) :</div>
-<div class="line"><a name="l14274"></a><span class="lineno">14274</span>&#160;    m_hAllocator(hAllocator),</div>
-<div class="line"><a name="l14275"></a><span class="lineno">14275</span>&#160;    m_CurrFrameIndex(currFrameIndex),</div>
-<div class="line"><a name="l14276"></a><span class="lineno">14276</span>&#160;    m_Flags(flags),</div>
-<div class="line"><a name="l14277"></a><span class="lineno">14277</span>&#160;    m_pStats(pStats),</div>
-<div class="line"><a name="l14278"></a><span class="lineno">14278</span>&#160;    m_CustomPoolContexts(VmaStlAllocator&lt;VmaBlockVectorDefragmentationContext*&gt;(hAllocator-&gt;GetAllocationCallbacks()))</div>
-<div class="line"><a name="l14279"></a><span class="lineno">14279</span>&#160;{</div>
-<div class="line"><a name="l14280"></a><span class="lineno">14280</span>&#160;    memset(m_DefaultPoolContexts, 0, <span class="keyword">sizeof</span>(m_DefaultPoolContexts));</div>
-<div class="line"><a name="l14281"></a><span class="lineno">14281</span>&#160;}</div>
+<div class="line"><a name="l14269"></a><span class="lineno">14269</span>&#160;                    pDstMetadata-&gt;m_Suballocations.push_back(suballoc);</div>
+<div class="line"><a name="l14270"></a><span class="lineno">14270</span>&#160; </div>
+<div class="line"><a name="l14271"></a><span class="lineno">14271</span>&#160;                    move.srcBlockIndex = srcOrigBlockIndex;</div>
+<div class="line"><a name="l14272"></a><span class="lineno">14272</span>&#160;                    move.dstBlockIndex = dstOrigBlockIndex;</div>
+<div class="line"><a name="l14273"></a><span class="lineno">14273</span>&#160;                    move.srcOffset = srcAllocOffset;</div>
+<div class="line"><a name="l14274"></a><span class="lineno">14274</span>&#160;                    move.dstOffset = dstAllocOffset;</div>
+<div class="line"><a name="l14275"></a><span class="lineno">14275</span>&#160;                    move.size = srcAllocSize;</div>
+<div class="line"><a name="l14276"></a><span class="lineno">14276</span>&#160;                    </div>
+<div class="line"><a name="l14277"></a><span class="lineno">14277</span>&#160;                    moves.push_back(move);</div>
+<div class="line"><a name="l14278"></a><span class="lineno">14278</span>&#160;                }</div>
+<div class="line"><a name="l14279"></a><span class="lineno">14279</span>&#160;            }</div>
+<div class="line"><a name="l14280"></a><span class="lineno">14280</span>&#160;        }</div>
+<div class="line"><a name="l14281"></a><span class="lineno">14281</span>&#160;    }</div>
 <div class="line"><a name="l14282"></a><span class="lineno">14282</span>&#160; </div>
-<div class="line"><a name="l14283"></a><span class="lineno">14283</span>&#160;VmaDefragmentationContext_T::~VmaDefragmentationContext_T()</div>
-<div class="line"><a name="l14284"></a><span class="lineno">14284</span>&#160;{</div>
-<div class="line"><a name="l14285"></a><span class="lineno">14285</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_CustomPoolContexts.size(); i--; )</div>
-<div class="line"><a name="l14286"></a><span class="lineno">14286</span>&#160;    {</div>
-<div class="line"><a name="l14287"></a><span class="lineno">14287</span>&#160;        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_CustomPoolContexts[i];</div>
-<div class="line"><a name="l14288"></a><span class="lineno">14288</span>&#160;        pBlockVectorCtx-&gt;GetBlockVector()-&gt;DefragmentationEnd(pBlockVectorCtx, m_Flags, m_pStats);</div>
-<div class="line"><a name="l14289"></a><span class="lineno">14289</span>&#160;        vma_delete(m_hAllocator, pBlockVectorCtx);</div>
-<div class="line"><a name="l14290"></a><span class="lineno">14290</span>&#160;    }</div>
-<div class="line"><a name="l14291"></a><span class="lineno">14291</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_hAllocator-&gt;m_MemProps.memoryTypeCount; i--; )</div>
-<div class="line"><a name="l14292"></a><span class="lineno">14292</span>&#160;    {</div>
-<div class="line"><a name="l14293"></a><span class="lineno">14293</span>&#160;        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_DefaultPoolContexts[i];</div>
-<div class="line"><a name="l14294"></a><span class="lineno">14294</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx)</div>
-<div class="line"><a name="l14295"></a><span class="lineno">14295</span>&#160;        {</div>
-<div class="line"><a name="l14296"></a><span class="lineno">14296</span>&#160;            pBlockVectorCtx-&gt;GetBlockVector()-&gt;DefragmentationEnd(pBlockVectorCtx, m_Flags, m_pStats);</div>
-<div class="line"><a name="l14297"></a><span class="lineno">14297</span>&#160;            vma_delete(m_hAllocator, pBlockVectorCtx);</div>
-<div class="line"><a name="l14298"></a><span class="lineno">14298</span>&#160;        }</div>
-<div class="line"><a name="l14299"></a><span class="lineno">14299</span>&#160;    }</div>
-<div class="line"><a name="l14300"></a><span class="lineno">14300</span>&#160;}</div>
-<div class="line"><a name="l14301"></a><span class="lineno">14301</span>&#160; </div>
-<div class="line"><a name="l14302"></a><span class="lineno">14302</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationContext_T::AddPools(uint32_t poolCount, <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPools)</div>
-<div class="line"><a name="l14303"></a><span class="lineno">14303</span>&#160;{</div>
-<div class="line"><a name="l14304"></a><span class="lineno">14304</span>&#160;    <span class="keywordflow">for</span>(uint32_t poolIndex = 0; poolIndex &lt; poolCount; ++poolIndex)</div>
-<div class="line"><a name="l14305"></a><span class="lineno">14305</span>&#160;    {</div>
-<div class="line"><a name="l14306"></a><span class="lineno">14306</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> pool = pPools[poolIndex];</div>
-<div class="line"><a name="l14307"></a><span class="lineno">14307</span>&#160;        VMA_ASSERT(pool);</div>
-<div class="line"><a name="l14308"></a><span class="lineno">14308</span>&#160;        <span class="comment">// Pools with algorithm other than default are not defragmented.</span></div>
-<div class="line"><a name="l14309"></a><span class="lineno">14309</span>&#160;        <span class="keywordflow">if</span>(pool-&gt;m_BlockVector.GetAlgorithm() == 0)</div>
-<div class="line"><a name="l14310"></a><span class="lineno">14310</span>&#160;        {</div>
-<div class="line"><a name="l14311"></a><span class="lineno">14311</span>&#160;            VmaBlockVectorDefragmentationContext* pBlockVectorDefragCtx = VMA_NULL;</div>
-<div class="line"><a name="l14312"></a><span class="lineno">14312</span>&#160;            </div>
-<div class="line"><a name="l14313"></a><span class="lineno">14313</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_CustomPoolContexts.size(); i--; )</div>
-<div class="line"><a name="l14314"></a><span class="lineno">14314</span>&#160;            {</div>
-<div class="line"><a name="l14315"></a><span class="lineno">14315</span>&#160;                <span class="keywordflow">if</span>(m_CustomPoolContexts[i]-&gt;GetCustomPool() == pool)</div>
-<div class="line"><a name="l14316"></a><span class="lineno">14316</span>&#160;                {</div>
-<div class="line"><a name="l14317"></a><span class="lineno">14317</span>&#160;                    pBlockVectorDefragCtx = m_CustomPoolContexts[i];</div>
-<div class="line"><a name="l14318"></a><span class="lineno">14318</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l14319"></a><span class="lineno">14319</span>&#160;                }</div>
-<div class="line"><a name="l14320"></a><span class="lineno">14320</span>&#160;            }</div>
-<div class="line"><a name="l14321"></a><span class="lineno">14321</span>&#160;            </div>
-<div class="line"><a name="l14322"></a><span class="lineno">14322</span>&#160;            <span class="keywordflow">if</span>(!pBlockVectorDefragCtx)</div>
-<div class="line"><a name="l14323"></a><span class="lineno">14323</span>&#160;            {</div>
-<div class="line"><a name="l14324"></a><span class="lineno">14324</span>&#160;                pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(</div>
-<div class="line"><a name="l14325"></a><span class="lineno">14325</span>&#160;                    m_hAllocator,</div>
-<div class="line"><a name="l14326"></a><span class="lineno">14326</span>&#160;                    pool,</div>
-<div class="line"><a name="l14327"></a><span class="lineno">14327</span>&#160;                    &amp;pool-&gt;m_BlockVector,</div>
-<div class="line"><a name="l14328"></a><span class="lineno">14328</span>&#160;                    m_CurrFrameIndex);</div>
-<div class="line"><a name="l14329"></a><span class="lineno">14329</span>&#160;                m_CustomPoolContexts.push_back(pBlockVectorDefragCtx);</div>
-<div class="line"><a name="l14330"></a><span class="lineno">14330</span>&#160;            }</div>
-<div class="line"><a name="l14331"></a><span class="lineno">14331</span>&#160; </div>
-<div class="line"><a name="l14332"></a><span class="lineno">14332</span>&#160;            pBlockVectorDefragCtx-&gt;AddAll();</div>
-<div class="line"><a name="l14333"></a><span class="lineno">14333</span>&#160;        }</div>
-<div class="line"><a name="l14334"></a><span class="lineno">14334</span>&#160;    }</div>
-<div class="line"><a name="l14335"></a><span class="lineno">14335</span>&#160;}</div>
-<div class="line"><a name="l14336"></a><span class="lineno">14336</span>&#160; </div>
-<div class="line"><a name="l14337"></a><span class="lineno">14337</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationContext_T::AddAllocations(</div>
-<div class="line"><a name="l14338"></a><span class="lineno">14338</span>&#160;    uint32_t allocationCount,</div>
-<div class="line"><a name="l14339"></a><span class="lineno">14339</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations,</div>
-<div class="line"><a name="l14340"></a><span class="lineno">14340</span>&#160;    VkBool32* pAllocationsChanged)</div>
-<div class="line"><a name="l14341"></a><span class="lineno">14341</span>&#160;{</div>
-<div class="line"><a name="l14342"></a><span class="lineno">14342</span>&#160;    <span class="comment">// Dispatch pAllocations among defragmentators. Create them when necessary.</span></div>
-<div class="line"><a name="l14343"></a><span class="lineno">14343</span>&#160;    <span class="keywordflow">for</span>(uint32_t allocIndex = 0; allocIndex &lt; allocationCount; ++allocIndex)</div>
-<div class="line"><a name="l14344"></a><span class="lineno">14344</span>&#160;    {</div>
-<div class="line"><a name="l14345"></a><span class="lineno">14345</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc = pAllocations[allocIndex];</div>
-<div class="line"><a name="l14346"></a><span class="lineno">14346</span>&#160;        VMA_ASSERT(hAlloc);</div>
-<div class="line"><a name="l14347"></a><span class="lineno">14347</span>&#160;        <span class="comment">// DedicatedAlloc cannot be defragmented.</span></div>
-<div class="line"><a name="l14348"></a><span class="lineno">14348</span>&#160;        <span class="keywordflow">if</span>((hAlloc-&gt;GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK) &amp;&amp;</div>
-<div class="line"><a name="l14349"></a><span class="lineno">14349</span>&#160;            <span class="comment">// Lost allocation cannot be defragmented.</span></div>
-<div class="line"><a name="l14350"></a><span class="lineno">14350</span>&#160;            (hAlloc-&gt;GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST))</div>
-<div class="line"><a name="l14351"></a><span class="lineno">14351</span>&#160;        {</div>
-<div class="line"><a name="l14352"></a><span class="lineno">14352</span>&#160;            VmaBlockVectorDefragmentationContext* pBlockVectorDefragCtx = VMA_NULL;</div>
-<div class="line"><a name="l14353"></a><span class="lineno">14353</span>&#160; </div>
-<div class="line"><a name="l14354"></a><span class="lineno">14354</span>&#160;            <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a> hAllocPool = hAlloc-&gt;GetBlock()-&gt;GetParentPool();</div>
-<div class="line"><a name="l14355"></a><span class="lineno">14355</span>&#160;            <span class="comment">// This allocation belongs to custom pool.</span></div>
-<div class="line"><a name="l14356"></a><span class="lineno">14356</span>&#160;            <span class="keywordflow">if</span>(hAllocPool != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l14357"></a><span class="lineno">14357</span>&#160;            {</div>
-<div class="line"><a name="l14358"></a><span class="lineno">14358</span>&#160;                <span class="comment">// Pools with algorithm other than default are not defragmented.</span></div>
-<div class="line"><a name="l14359"></a><span class="lineno">14359</span>&#160;                <span class="keywordflow">if</span>(hAllocPool-&gt;m_BlockVector.GetAlgorithm() == 0)</div>
-<div class="line"><a name="l14360"></a><span class="lineno">14360</span>&#160;                {</div>
-<div class="line"><a name="l14361"></a><span class="lineno">14361</span>&#160;                    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_CustomPoolContexts.size(); i--; )</div>
-<div class="line"><a name="l14362"></a><span class="lineno">14362</span>&#160;                    {</div>
-<div class="line"><a name="l14363"></a><span class="lineno">14363</span>&#160;                        <span class="keywordflow">if</span>(m_CustomPoolContexts[i]-&gt;GetCustomPool() == hAllocPool)</div>
-<div class="line"><a name="l14364"></a><span class="lineno">14364</span>&#160;                        {</div>
-<div class="line"><a name="l14365"></a><span class="lineno">14365</span>&#160;                            pBlockVectorDefragCtx = m_CustomPoolContexts[i];</div>
-<div class="line"><a name="l14366"></a><span class="lineno">14366</span>&#160;                            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l14367"></a><span class="lineno">14367</span>&#160;                        }</div>
-<div class="line"><a name="l14368"></a><span class="lineno">14368</span>&#160;                    }</div>
-<div class="line"><a name="l14369"></a><span class="lineno">14369</span>&#160;                    <span class="keywordflow">if</span>(!pBlockVectorDefragCtx)</div>
-<div class="line"><a name="l14370"></a><span class="lineno">14370</span>&#160;                    {</div>
-<div class="line"><a name="l14371"></a><span class="lineno">14371</span>&#160;                        pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(</div>
-<div class="line"><a name="l14372"></a><span class="lineno">14372</span>&#160;                            m_hAllocator,</div>
-<div class="line"><a name="l14373"></a><span class="lineno">14373</span>&#160;                            hAllocPool,</div>
-<div class="line"><a name="l14374"></a><span class="lineno">14374</span>&#160;                            &amp;hAllocPool-&gt;m_BlockVector,</div>
-<div class="line"><a name="l14375"></a><span class="lineno">14375</span>&#160;                            m_CurrFrameIndex);</div>
-<div class="line"><a name="l14376"></a><span class="lineno">14376</span>&#160;                        m_CustomPoolContexts.push_back(pBlockVectorDefragCtx);</div>
-<div class="line"><a name="l14377"></a><span class="lineno">14377</span>&#160;                    }</div>
-<div class="line"><a name="l14378"></a><span class="lineno">14378</span>&#160;                }</div>
-<div class="line"><a name="l14379"></a><span class="lineno">14379</span>&#160;            }</div>
-<div class="line"><a name="l14380"></a><span class="lineno">14380</span>&#160;            <span class="comment">// This allocation belongs to default pool.</span></div>
-<div class="line"><a name="l14381"></a><span class="lineno">14381</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l14382"></a><span class="lineno">14382</span>&#160;            {</div>
-<div class="line"><a name="l14383"></a><span class="lineno">14383</span>&#160;                <span class="keyword">const</span> uint32_t memTypeIndex = hAlloc-&gt;GetMemoryTypeIndex();</div>
-<div class="line"><a name="l14384"></a><span class="lineno">14384</span>&#160;                pBlockVectorDefragCtx = m_DefaultPoolContexts[memTypeIndex];</div>
-<div class="line"><a name="l14385"></a><span class="lineno">14385</span>&#160;                <span class="keywordflow">if</span>(!pBlockVectorDefragCtx)</div>
+<div class="line"><a name="l14283"></a><span class="lineno">14283</span>&#160;    m_BlockInfos.clear();</div>
+<div class="line"><a name="l14284"></a><span class="lineno">14284</span>&#160;    </div>
+<div class="line"><a name="l14285"></a><span class="lineno">14285</span>&#160;    PostprocessMetadata();</div>
+<div class="line"><a name="l14286"></a><span class="lineno">14286</span>&#160; </div>
+<div class="line"><a name="l14287"></a><span class="lineno">14287</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l14288"></a><span class="lineno">14288</span>&#160;}</div>
+<div class="line"><a name="l14289"></a><span class="lineno">14289</span>&#160; </div>
+<div class="line"><a name="l14290"></a><span class="lineno">14290</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationAlgorithm_Fast::PreprocessMetadata()</div>
+<div class="line"><a name="l14291"></a><span class="lineno">14291</span>&#160;{</div>
+<div class="line"><a name="l14292"></a><span class="lineno">14292</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_pBlockVector-&gt;GetBlockCount();</div>
+<div class="line"><a name="l14293"></a><span class="lineno">14293</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; blockCount; ++blockIndex)</div>
+<div class="line"><a name="l14294"></a><span class="lineno">14294</span>&#160;    {</div>
+<div class="line"><a name="l14295"></a><span class="lineno">14295</span>&#160;        VmaBlockMetadata_Generic* <span class="keyword">const</span> pMetadata =</div>
+<div class="line"><a name="l14296"></a><span class="lineno">14296</span>&#160;            (VmaBlockMetadata_Generic*)m_pBlockVector-&gt;GetBlock(blockIndex)-&gt;m_pMetadata;</div>
+<div class="line"><a name="l14297"></a><span class="lineno">14297</span>&#160;        pMetadata-&gt;m_FreeCount = 0;</div>
+<div class="line"><a name="l14298"></a><span class="lineno">14298</span>&#160;        pMetadata-&gt;m_SumFreeSize = pMetadata-&gt;GetSize();</div>
+<div class="line"><a name="l14299"></a><span class="lineno">14299</span>&#160;        pMetadata-&gt;m_FreeSuballocationsBySize.clear();</div>
+<div class="line"><a name="l14300"></a><span class="lineno">14300</span>&#160;        <span class="keywordflow">for</span>(VmaSuballocationList::iterator it = pMetadata-&gt;m_Suballocations.begin();</div>
+<div class="line"><a name="l14301"></a><span class="lineno">14301</span>&#160;            it != pMetadata-&gt;m_Suballocations.end(); )</div>
+<div class="line"><a name="l14302"></a><span class="lineno">14302</span>&#160;        {</div>
+<div class="line"><a name="l14303"></a><span class="lineno">14303</span>&#160;            <span class="keywordflow">if</span>(it-&gt;type == VMA_SUBALLOCATION_TYPE_FREE)</div>
+<div class="line"><a name="l14304"></a><span class="lineno">14304</span>&#160;            {</div>
+<div class="line"><a name="l14305"></a><span class="lineno">14305</span>&#160;                VmaSuballocationList::iterator nextIt = it;</div>
+<div class="line"><a name="l14306"></a><span class="lineno">14306</span>&#160;                ++nextIt;</div>
+<div class="line"><a name="l14307"></a><span class="lineno">14307</span>&#160;                pMetadata-&gt;m_Suballocations.erase(it);</div>
+<div class="line"><a name="l14308"></a><span class="lineno">14308</span>&#160;                it = nextIt;</div>
+<div class="line"><a name="l14309"></a><span class="lineno">14309</span>&#160;            }</div>
+<div class="line"><a name="l14310"></a><span class="lineno">14310</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l14311"></a><span class="lineno">14311</span>&#160;            {</div>
+<div class="line"><a name="l14312"></a><span class="lineno">14312</span>&#160;                ++it;</div>
+<div class="line"><a name="l14313"></a><span class="lineno">14313</span>&#160;            }</div>
+<div class="line"><a name="l14314"></a><span class="lineno">14314</span>&#160;        }</div>
+<div class="line"><a name="l14315"></a><span class="lineno">14315</span>&#160;    }</div>
+<div class="line"><a name="l14316"></a><span class="lineno">14316</span>&#160;}</div>
+<div class="line"><a name="l14317"></a><span class="lineno">14317</span>&#160; </div>
+<div class="line"><a name="l14318"></a><span class="lineno">14318</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationAlgorithm_Fast::PostprocessMetadata()</div>
+<div class="line"><a name="l14319"></a><span class="lineno">14319</span>&#160;{</div>
+<div class="line"><a name="l14320"></a><span class="lineno">14320</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockCount = m_pBlockVector-&gt;GetBlockCount();</div>
+<div class="line"><a name="l14321"></a><span class="lineno">14321</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> blockIndex = 0; blockIndex &lt; blockCount; ++blockIndex)</div>
+<div class="line"><a name="l14322"></a><span class="lineno">14322</span>&#160;    {</div>
+<div class="line"><a name="l14323"></a><span class="lineno">14323</span>&#160;        VmaBlockMetadata_Generic* <span class="keyword">const</span> pMetadata =</div>
+<div class="line"><a name="l14324"></a><span class="lineno">14324</span>&#160;            (VmaBlockMetadata_Generic*)m_pBlockVector-&gt;GetBlock(blockIndex)-&gt;m_pMetadata;</div>
+<div class="line"><a name="l14325"></a><span class="lineno">14325</span>&#160;        <span class="keyword">const</span> VkDeviceSize blockSize = pMetadata-&gt;GetSize();</div>
+<div class="line"><a name="l14326"></a><span class="lineno">14326</span>&#160;        </div>
+<div class="line"><a name="l14327"></a><span class="lineno">14327</span>&#160;        <span class="comment">// No allocations in this block - entire area is free.</span></div>
+<div class="line"><a name="l14328"></a><span class="lineno">14328</span>&#160;        <span class="keywordflow">if</span>(pMetadata-&gt;m_Suballocations.empty())</div>
+<div class="line"><a name="l14329"></a><span class="lineno">14329</span>&#160;        {</div>
+<div class="line"><a name="l14330"></a><span class="lineno">14330</span>&#160;            pMetadata-&gt;m_FreeCount = 1;</div>
+<div class="line"><a name="l14331"></a><span class="lineno">14331</span>&#160;            <span class="comment">//pMetadata-&gt;m_SumFreeSize is already set to blockSize.</span></div>
+<div class="line"><a name="l14332"></a><span class="lineno">14332</span>&#160;            VmaSuballocation suballoc = {</div>
+<div class="line"><a name="l14333"></a><span class="lineno">14333</span>&#160;                0, <span class="comment">// offset</span></div>
+<div class="line"><a name="l14334"></a><span class="lineno">14334</span>&#160;                blockSize, <span class="comment">// size</span></div>
+<div class="line"><a name="l14335"></a><span class="lineno">14335</span>&#160;                VMA_NULL, <span class="comment">// hAllocation</span></div>
+<div class="line"><a name="l14336"></a><span class="lineno">14336</span>&#160;                VMA_SUBALLOCATION_TYPE_FREE };</div>
+<div class="line"><a name="l14337"></a><span class="lineno">14337</span>&#160;            pMetadata-&gt;m_Suballocations.push_back(suballoc);</div>
+<div class="line"><a name="l14338"></a><span class="lineno">14338</span>&#160;            pMetadata-&gt;RegisterFreeSuballocation(pMetadata-&gt;m_Suballocations.begin());</div>
+<div class="line"><a name="l14339"></a><span class="lineno">14339</span>&#160;        }</div>
+<div class="line"><a name="l14340"></a><span class="lineno">14340</span>&#160;        <span class="comment">// There are some allocations in this block.</span></div>
+<div class="line"><a name="l14341"></a><span class="lineno">14341</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l14342"></a><span class="lineno">14342</span>&#160;        {</div>
+<div class="line"><a name="l14343"></a><span class="lineno">14343</span>&#160;            VkDeviceSize offset = 0;</div>
+<div class="line"><a name="l14344"></a><span class="lineno">14344</span>&#160;            VmaSuballocationList::iterator it;</div>
+<div class="line"><a name="l14345"></a><span class="lineno">14345</span>&#160;            <span class="keywordflow">for</span>(it = pMetadata-&gt;m_Suballocations.begin();</div>
+<div class="line"><a name="l14346"></a><span class="lineno">14346</span>&#160;                it != pMetadata-&gt;m_Suballocations.end();</div>
+<div class="line"><a name="l14347"></a><span class="lineno">14347</span>&#160;                ++it)</div>
+<div class="line"><a name="l14348"></a><span class="lineno">14348</span>&#160;            {</div>
+<div class="line"><a name="l14349"></a><span class="lineno">14349</span>&#160;                VMA_ASSERT(it-&gt;type != VMA_SUBALLOCATION_TYPE_FREE);</div>
+<div class="line"><a name="l14350"></a><span class="lineno">14350</span>&#160;                VMA_ASSERT(it-&gt;offset &gt;= offset);</div>
+<div class="line"><a name="l14351"></a><span class="lineno">14351</span>&#160; </div>
+<div class="line"><a name="l14352"></a><span class="lineno">14352</span>&#160;                <span class="comment">// Need to insert preceding free space.</span></div>
+<div class="line"><a name="l14353"></a><span class="lineno">14353</span>&#160;                <span class="keywordflow">if</span>(it-&gt;offset &gt; offset)</div>
+<div class="line"><a name="l14354"></a><span class="lineno">14354</span>&#160;                {</div>
+<div class="line"><a name="l14355"></a><span class="lineno">14355</span>&#160;                    ++pMetadata-&gt;m_FreeCount;</div>
+<div class="line"><a name="l14356"></a><span class="lineno">14356</span>&#160;                    <span class="keyword">const</span> VkDeviceSize freeSize = it-&gt;offset - offset;</div>
+<div class="line"><a name="l14357"></a><span class="lineno">14357</span>&#160;                    VmaSuballocation suballoc = {</div>
+<div class="line"><a name="l14358"></a><span class="lineno">14358</span>&#160;                        offset, <span class="comment">// offset</span></div>
+<div class="line"><a name="l14359"></a><span class="lineno">14359</span>&#160;                        freeSize, <span class="comment">// size</span></div>
+<div class="line"><a name="l14360"></a><span class="lineno">14360</span>&#160;                        VMA_NULL, <span class="comment">// hAllocation</span></div>
+<div class="line"><a name="l14361"></a><span class="lineno">14361</span>&#160;                        VMA_SUBALLOCATION_TYPE_FREE };</div>
+<div class="line"><a name="l14362"></a><span class="lineno">14362</span>&#160;                    VmaSuballocationList::iterator precedingFreeIt = pMetadata-&gt;m_Suballocations.insert(it, suballoc);</div>
+<div class="line"><a name="l14363"></a><span class="lineno">14363</span>&#160;                    <span class="keywordflow">if</span>(freeSize &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
+<div class="line"><a name="l14364"></a><span class="lineno">14364</span>&#160;                    {</div>
+<div class="line"><a name="l14365"></a><span class="lineno">14365</span>&#160;                        pMetadata-&gt;m_FreeSuballocationsBySize.push_back(precedingFreeIt);</div>
+<div class="line"><a name="l14366"></a><span class="lineno">14366</span>&#160;                    }</div>
+<div class="line"><a name="l14367"></a><span class="lineno">14367</span>&#160;                }</div>
+<div class="line"><a name="l14368"></a><span class="lineno">14368</span>&#160; </div>
+<div class="line"><a name="l14369"></a><span class="lineno">14369</span>&#160;                pMetadata-&gt;m_SumFreeSize -= it-&gt;size;</div>
+<div class="line"><a name="l14370"></a><span class="lineno">14370</span>&#160;                offset = it-&gt;offset + it-&gt;size;</div>
+<div class="line"><a name="l14371"></a><span class="lineno">14371</span>&#160;            }</div>
+<div class="line"><a name="l14372"></a><span class="lineno">14372</span>&#160; </div>
+<div class="line"><a name="l14373"></a><span class="lineno">14373</span>&#160;            <span class="comment">// Need to insert trailing free space.</span></div>
+<div class="line"><a name="l14374"></a><span class="lineno">14374</span>&#160;            <span class="keywordflow">if</span>(offset &lt; blockSize)</div>
+<div class="line"><a name="l14375"></a><span class="lineno">14375</span>&#160;            {</div>
+<div class="line"><a name="l14376"></a><span class="lineno">14376</span>&#160;                ++pMetadata-&gt;m_FreeCount;</div>
+<div class="line"><a name="l14377"></a><span class="lineno">14377</span>&#160;                <span class="keyword">const</span> VkDeviceSize freeSize = blockSize - offset;</div>
+<div class="line"><a name="l14378"></a><span class="lineno">14378</span>&#160;                VmaSuballocation suballoc = {</div>
+<div class="line"><a name="l14379"></a><span class="lineno">14379</span>&#160;                    offset, <span class="comment">// offset</span></div>
+<div class="line"><a name="l14380"></a><span class="lineno">14380</span>&#160;                    freeSize, <span class="comment">// size</span></div>
+<div class="line"><a name="l14381"></a><span class="lineno">14381</span>&#160;                    VMA_NULL, <span class="comment">// hAllocation</span></div>
+<div class="line"><a name="l14382"></a><span class="lineno">14382</span>&#160;                    VMA_SUBALLOCATION_TYPE_FREE };</div>
+<div class="line"><a name="l14383"></a><span class="lineno">14383</span>&#160;                VMA_ASSERT(it == pMetadata-&gt;m_Suballocations.end());</div>
+<div class="line"><a name="l14384"></a><span class="lineno">14384</span>&#160;                VmaSuballocationList::iterator trailingFreeIt = pMetadata-&gt;m_Suballocations.insert(it, suballoc);</div>
+<div class="line"><a name="l14385"></a><span class="lineno">14385</span>&#160;                <span class="keywordflow">if</span>(freeSize &gt; VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
 <div class="line"><a name="l14386"></a><span class="lineno">14386</span>&#160;                {</div>
-<div class="line"><a name="l14387"></a><span class="lineno">14387</span>&#160;                    pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(</div>
-<div class="line"><a name="l14388"></a><span class="lineno">14388</span>&#160;                        m_hAllocator,</div>
-<div class="line"><a name="l14389"></a><span class="lineno">14389</span>&#160;                        VMA_NULL, <span class="comment">// hCustomPool</span></div>
-<div class="line"><a name="l14390"></a><span class="lineno">14390</span>&#160;                        m_hAllocator-&gt;m_pBlockVectors[memTypeIndex],</div>
-<div class="line"><a name="l14391"></a><span class="lineno">14391</span>&#160;                        m_CurrFrameIndex);</div>
-<div class="line"><a name="l14392"></a><span class="lineno">14392</span>&#160;                    m_DefaultPoolContexts[memTypeIndex] = pBlockVectorDefragCtx;</div>
-<div class="line"><a name="l14393"></a><span class="lineno">14393</span>&#160;                }</div>
-<div class="line"><a name="l14394"></a><span class="lineno">14394</span>&#160;            }</div>
-<div class="line"><a name="l14395"></a><span class="lineno">14395</span>&#160; </div>
-<div class="line"><a name="l14396"></a><span class="lineno">14396</span>&#160;            <span class="keywordflow">if</span>(pBlockVectorDefragCtx)</div>
-<div class="line"><a name="l14397"></a><span class="lineno">14397</span>&#160;            {</div>
-<div class="line"><a name="l14398"></a><span class="lineno">14398</span>&#160;                VkBool32* <span class="keyword">const</span> pChanged = (pAllocationsChanged != VMA_NULL) ?</div>
-<div class="line"><a name="l14399"></a><span class="lineno">14399</span>&#160;                    &amp;pAllocationsChanged[allocIndex] : VMA_NULL;</div>
-<div class="line"><a name="l14400"></a><span class="lineno">14400</span>&#160;                pBlockVectorDefragCtx-&gt;AddAllocation(hAlloc, pChanged);</div>
-<div class="line"><a name="l14401"></a><span class="lineno">14401</span>&#160;            }</div>
-<div class="line"><a name="l14402"></a><span class="lineno">14402</span>&#160;        }</div>
-<div class="line"><a name="l14403"></a><span class="lineno">14403</span>&#160;    }</div>
-<div class="line"><a name="l14404"></a><span class="lineno">14404</span>&#160;}</div>
-<div class="line"><a name="l14405"></a><span class="lineno">14405</span>&#160; </div>
-<div class="line"><a name="l14406"></a><span class="lineno">14406</span>&#160;VkResult VmaDefragmentationContext_T::Defragment(</div>
-<div class="line"><a name="l14407"></a><span class="lineno">14407</span>&#160;    VkDeviceSize maxCpuBytesToMove, uint32_t maxCpuAllocationsToMove,</div>
-<div class="line"><a name="l14408"></a><span class="lineno">14408</span>&#160;    VkDeviceSize maxGpuBytesToMove, uint32_t maxGpuAllocationsToMove,</div>
-<div class="line"><a name="l14409"></a><span class="lineno">14409</span>&#160;    VkCommandBuffer commandBuffer, <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags)</div>
-<div class="line"><a name="l14410"></a><span class="lineno">14410</span>&#160;{</div>
-<div class="line"><a name="l14411"></a><span class="lineno">14411</span>&#160;    <span class="keywordflow">if</span>(pStats)</div>
-<div class="line"><a name="l14412"></a><span class="lineno">14412</span>&#160;    {</div>
-<div class="line"><a name="l14413"></a><span class="lineno">14413</span>&#160;        memset(pStats, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>));</div>
-<div class="line"><a name="l14414"></a><span class="lineno">14414</span>&#160;    }</div>
-<div class="line"><a name="l14415"></a><span class="lineno">14415</span>&#160; </div>
-<div class="line"><a name="l14416"></a><span class="lineno">14416</span>&#160;    <span class="keywordflow">if</span>(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a>)</div>
-<div class="line"><a name="l14417"></a><span class="lineno">14417</span>&#160;    {</div>
-<div class="line"><a name="l14418"></a><span class="lineno">14418</span>&#160;        <span class="comment">// For incremental defragmetnations, we just earmark how much we can move</span></div>
-<div class="line"><a name="l14419"></a><span class="lineno">14419</span>&#160;        <span class="comment">// The real meat is in the defragmentation steps</span></div>
-<div class="line"><a name="l14420"></a><span class="lineno">14420</span>&#160;        m_MaxCpuBytesToMove = maxCpuBytesToMove;</div>
-<div class="line"><a name="l14421"></a><span class="lineno">14421</span>&#160;        m_MaxCpuAllocationsToMove = maxCpuAllocationsToMove;</div>
-<div class="line"><a name="l14422"></a><span class="lineno">14422</span>&#160; </div>
-<div class="line"><a name="l14423"></a><span class="lineno">14423</span>&#160;        m_MaxGpuBytesToMove = maxGpuBytesToMove;</div>
-<div class="line"><a name="l14424"></a><span class="lineno">14424</span>&#160;        m_MaxGpuAllocationsToMove = maxGpuAllocationsToMove;</div>
-<div class="line"><a name="l14425"></a><span class="lineno">14425</span>&#160; </div>
-<div class="line"><a name="l14426"></a><span class="lineno">14426</span>&#160;        <span class="keywordflow">if</span>(m_MaxCpuBytesToMove == 0 &amp;&amp; m_MaxCpuAllocationsToMove == 0 &amp;&amp;</div>
-<div class="line"><a name="l14427"></a><span class="lineno">14427</span>&#160;            m_MaxGpuBytesToMove == 0 &amp;&amp; m_MaxGpuAllocationsToMove == 0)</div>
-<div class="line"><a name="l14428"></a><span class="lineno">14428</span>&#160;            <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l14429"></a><span class="lineno">14429</span>&#160; </div>
-<div class="line"><a name="l14430"></a><span class="lineno">14430</span>&#160;        <span class="keywordflow">return</span> VK_NOT_READY;</div>
-<div class="line"><a name="l14431"></a><span class="lineno">14431</span>&#160;    }</div>
-<div class="line"><a name="l14432"></a><span class="lineno">14432</span>&#160; </div>
-<div class="line"><a name="l14433"></a><span class="lineno">14433</span>&#160;    <span class="keywordflow">if</span>(commandBuffer == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l14434"></a><span class="lineno">14434</span>&#160;    {</div>
-<div class="line"><a name="l14435"></a><span class="lineno">14435</span>&#160;        maxGpuBytesToMove = 0;</div>
-<div class="line"><a name="l14436"></a><span class="lineno">14436</span>&#160;        maxGpuAllocationsToMove = 0;</div>
-<div class="line"><a name="l14437"></a><span class="lineno">14437</span>&#160;    }</div>
-<div class="line"><a name="l14438"></a><span class="lineno">14438</span>&#160; </div>
-<div class="line"><a name="l14439"></a><span class="lineno">14439</span>&#160;    VkResult res = VK_SUCCESS;</div>
-<div class="line"><a name="l14440"></a><span class="lineno">14440</span>&#160; </div>
-<div class="line"><a name="l14441"></a><span class="lineno">14441</span>&#160;    <span class="comment">// Process default pools.</span></div>
-<div class="line"><a name="l14442"></a><span class="lineno">14442</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0;</div>
-<div class="line"><a name="l14443"></a><span class="lineno">14443</span>&#160;        memTypeIndex &lt; m_hAllocator-&gt;GetMemoryTypeCount() &amp;&amp; res &gt;= VK_SUCCESS;</div>
-<div class="line"><a name="l14444"></a><span class="lineno">14444</span>&#160;        ++memTypeIndex)</div>
-<div class="line"><a name="l14445"></a><span class="lineno">14445</span>&#160;    {</div>
-<div class="line"><a name="l14446"></a><span class="lineno">14446</span>&#160;        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];</div>
-<div class="line"><a name="l14447"></a><span class="lineno">14447</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx)</div>
-<div class="line"><a name="l14448"></a><span class="lineno">14448</span>&#160;        {</div>
-<div class="line"><a name="l14449"></a><span class="lineno">14449</span>&#160;            VMA_ASSERT(pBlockVectorCtx-&gt;GetBlockVector());</div>
-<div class="line"><a name="l14450"></a><span class="lineno">14450</span>&#160;            pBlockVectorCtx-&gt;GetBlockVector()-&gt;Defragment(</div>
-<div class="line"><a name="l14451"></a><span class="lineno">14451</span>&#160;                pBlockVectorCtx,</div>
-<div class="line"><a name="l14452"></a><span class="lineno">14452</span>&#160;                pStats, flags,</div>
-<div class="line"><a name="l14453"></a><span class="lineno">14453</span>&#160;                maxCpuBytesToMove, maxCpuAllocationsToMove,</div>
-<div class="line"><a name="l14454"></a><span class="lineno">14454</span>&#160;                maxGpuBytesToMove, maxGpuAllocationsToMove,</div>
-<div class="line"><a name="l14455"></a><span class="lineno">14455</span>&#160;                commandBuffer);</div>
-<div class="line"><a name="l14456"></a><span class="lineno">14456</span>&#160;            <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;res != VK_SUCCESS)</div>
-<div class="line"><a name="l14457"></a><span class="lineno">14457</span>&#160;            {</div>
-<div class="line"><a name="l14458"></a><span class="lineno">14458</span>&#160;                res = pBlockVectorCtx-&gt;res;</div>
-<div class="line"><a name="l14459"></a><span class="lineno">14459</span>&#160;            }</div>
-<div class="line"><a name="l14460"></a><span class="lineno">14460</span>&#160;        }</div>
-<div class="line"><a name="l14461"></a><span class="lineno">14461</span>&#160;    }</div>
-<div class="line"><a name="l14462"></a><span class="lineno">14462</span>&#160; </div>
-<div class="line"><a name="l14463"></a><span class="lineno">14463</span>&#160;    <span class="comment">// Process custom pools.</span></div>
-<div class="line"><a name="l14464"></a><span class="lineno">14464</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();</div>
-<div class="line"><a name="l14465"></a><span class="lineno">14465</span>&#160;        customCtxIndex &lt; customCtxCount &amp;&amp; res &gt;= VK_SUCCESS;</div>
-<div class="line"><a name="l14466"></a><span class="lineno">14466</span>&#160;        ++customCtxIndex)</div>
-<div class="line"><a name="l14467"></a><span class="lineno">14467</span>&#160;    {</div>
-<div class="line"><a name="l14468"></a><span class="lineno">14468</span>&#160;        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];</div>
-<div class="line"><a name="l14469"></a><span class="lineno">14469</span>&#160;        VMA_ASSERT(pBlockVectorCtx &amp;&amp; pBlockVectorCtx-&gt;GetBlockVector());</div>
-<div class="line"><a name="l14470"></a><span class="lineno">14470</span>&#160;        pBlockVectorCtx-&gt;GetBlockVector()-&gt;Defragment(</div>
-<div class="line"><a name="l14471"></a><span class="lineno">14471</span>&#160;            pBlockVectorCtx,</div>
-<div class="line"><a name="l14472"></a><span class="lineno">14472</span>&#160;            pStats, flags,</div>
-<div class="line"><a name="l14473"></a><span class="lineno">14473</span>&#160;            maxCpuBytesToMove, maxCpuAllocationsToMove,</div>
-<div class="line"><a name="l14474"></a><span class="lineno">14474</span>&#160;            maxGpuBytesToMove, maxGpuAllocationsToMove,</div>
-<div class="line"><a name="l14475"></a><span class="lineno">14475</span>&#160;            commandBuffer);</div>
-<div class="line"><a name="l14476"></a><span class="lineno">14476</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;res != VK_SUCCESS)</div>
-<div class="line"><a name="l14477"></a><span class="lineno">14477</span>&#160;        {</div>
-<div class="line"><a name="l14478"></a><span class="lineno">14478</span>&#160;            res = pBlockVectorCtx-&gt;res;</div>
-<div class="line"><a name="l14479"></a><span class="lineno">14479</span>&#160;        }</div>
-<div class="line"><a name="l14480"></a><span class="lineno">14480</span>&#160;    }</div>
-<div class="line"><a name="l14481"></a><span class="lineno">14481</span>&#160; </div>
-<div class="line"><a name="l14482"></a><span class="lineno">14482</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l14483"></a><span class="lineno">14483</span>&#160;}</div>
-<div class="line"><a name="l14484"></a><span class="lineno">14484</span>&#160; </div>
-<div class="line"><a name="l14485"></a><span class="lineno">14485</span>&#160;VkResult VmaDefragmentationContext_T::DefragmentPassBegin(<a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* pInfo)</div>
-<div class="line"><a name="l14486"></a><span class="lineno">14486</span>&#160;{</div>
-<div class="line"><a name="l14487"></a><span class="lineno">14487</span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a>* pCurrentMove = pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792">pMoves</a>;</div>
-<div class="line"><a name="l14488"></a><span class="lineno">14488</span>&#160;    uint32_t movesLeft = pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a>;</div>
-<div class="line"><a name="l14489"></a><span class="lineno">14489</span>&#160; </div>
-<div class="line"><a name="l14490"></a><span class="lineno">14490</span>&#160;    <span class="comment">// Process default pools.</span></div>
-<div class="line"><a name="l14491"></a><span class="lineno">14491</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0;</div>
-<div class="line"><a name="l14492"></a><span class="lineno">14492</span>&#160;        memTypeIndex &lt; m_hAllocator-&gt;GetMemoryTypeCount();</div>
-<div class="line"><a name="l14493"></a><span class="lineno">14493</span>&#160;        ++memTypeIndex)</div>
-<div class="line"><a name="l14494"></a><span class="lineno">14494</span>&#160;    {</div>
-<div class="line"><a name="l14495"></a><span class="lineno">14495</span>&#160;        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];</div>
-<div class="line"><a name="l14496"></a><span class="lineno">14496</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx)</div>
-<div class="line"><a name="l14497"></a><span class="lineno">14497</span>&#160;        {</div>
-<div class="line"><a name="l14498"></a><span class="lineno">14498</span>&#160;            VMA_ASSERT(pBlockVectorCtx-&gt;GetBlockVector());</div>
-<div class="line"><a name="l14499"></a><span class="lineno">14499</span>&#160; </div>
-<div class="line"><a name="l14500"></a><span class="lineno">14500</span>&#160;            <span class="keywordflow">if</span>(!pBlockVectorCtx-&gt;hasDefragmentationPlan)</div>
-<div class="line"><a name="l14501"></a><span class="lineno">14501</span>&#160;            {</div>
-<div class="line"><a name="l14502"></a><span class="lineno">14502</span>&#160;                pBlockVectorCtx-&gt;GetBlockVector()-&gt;Defragment(</div>
-<div class="line"><a name="l14503"></a><span class="lineno">14503</span>&#160;                    pBlockVectorCtx,</div>
-<div class="line"><a name="l14504"></a><span class="lineno">14504</span>&#160;                    m_pStats, m_Flags,</div>
-<div class="line"><a name="l14505"></a><span class="lineno">14505</span>&#160;                    m_MaxCpuBytesToMove, m_MaxCpuAllocationsToMove,</div>
-<div class="line"><a name="l14506"></a><span class="lineno">14506</span>&#160;                    m_MaxGpuBytesToMove, m_MaxGpuAllocationsToMove,</div>
-<div class="line"><a name="l14507"></a><span class="lineno">14507</span>&#160;                    VK_NULL_HANDLE);</div>
-<div class="line"><a name="l14508"></a><span class="lineno">14508</span>&#160; </div>
-<div class="line"><a name="l14509"></a><span class="lineno">14509</span>&#160;                <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;res &lt; VK_SUCCESS)</div>
-<div class="line"><a name="l14510"></a><span class="lineno">14510</span>&#160;                    <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l14511"></a><span class="lineno">14511</span>&#160; </div>
-<div class="line"><a name="l14512"></a><span class="lineno">14512</span>&#160;                pBlockVectorCtx-&gt;hasDefragmentationPlan = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l14513"></a><span class="lineno">14513</span>&#160;            }</div>
-<div class="line"><a name="l14514"></a><span class="lineno">14514</span>&#160; </div>
-<div class="line"><a name="l14515"></a><span class="lineno">14515</span>&#160;            <span class="keyword">const</span> uint32_t processed = pBlockVectorCtx-&gt;GetBlockVector()-&gt;ProcessDefragmentations(</div>
-<div class="line"><a name="l14516"></a><span class="lineno">14516</span>&#160;                pBlockVectorCtx,</div>
-<div class="line"><a name="l14517"></a><span class="lineno">14517</span>&#160;                pCurrentMove, movesLeft);</div>
-<div class="line"><a name="l14518"></a><span class="lineno">14518</span>&#160; </div>
-<div class="line"><a name="l14519"></a><span class="lineno">14519</span>&#160;            movesLeft -= processed;</div>
-<div class="line"><a name="l14520"></a><span class="lineno">14520</span>&#160;            pCurrentMove += processed;</div>
-<div class="line"><a name="l14521"></a><span class="lineno">14521</span>&#160;        }</div>
-<div class="line"><a name="l14522"></a><span class="lineno">14522</span>&#160;    }</div>
-<div class="line"><a name="l14523"></a><span class="lineno">14523</span>&#160; </div>
-<div class="line"><a name="l14524"></a><span class="lineno">14524</span>&#160;    <span class="comment">// Process custom pools.</span></div>
-<div class="line"><a name="l14525"></a><span class="lineno">14525</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();</div>
-<div class="line"><a name="l14526"></a><span class="lineno">14526</span>&#160;        customCtxIndex &lt; customCtxCount;</div>
-<div class="line"><a name="l14527"></a><span class="lineno">14527</span>&#160;        ++customCtxIndex)</div>
-<div class="line"><a name="l14528"></a><span class="lineno">14528</span>&#160;    {</div>
-<div class="line"><a name="l14529"></a><span class="lineno">14529</span>&#160;        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];</div>
-<div class="line"><a name="l14530"></a><span class="lineno">14530</span>&#160;        VMA_ASSERT(pBlockVectorCtx &amp;&amp; pBlockVectorCtx-&gt;GetBlockVector());</div>
-<div class="line"><a name="l14531"></a><span class="lineno">14531</span>&#160; </div>
-<div class="line"><a name="l14532"></a><span class="lineno">14532</span>&#160;        <span class="keywordflow">if</span>(!pBlockVectorCtx-&gt;hasDefragmentationPlan)</div>
-<div class="line"><a name="l14533"></a><span class="lineno">14533</span>&#160;        {</div>
-<div class="line"><a name="l14534"></a><span class="lineno">14534</span>&#160;            pBlockVectorCtx-&gt;GetBlockVector()-&gt;Defragment(</div>
-<div class="line"><a name="l14535"></a><span class="lineno">14535</span>&#160;                pBlockVectorCtx,</div>
-<div class="line"><a name="l14536"></a><span class="lineno">14536</span>&#160;                m_pStats, m_Flags,</div>
-<div class="line"><a name="l14537"></a><span class="lineno">14537</span>&#160;                m_MaxCpuBytesToMove, m_MaxCpuAllocationsToMove,</div>
-<div class="line"><a name="l14538"></a><span class="lineno">14538</span>&#160;                m_MaxGpuBytesToMove, m_MaxGpuAllocationsToMove,</div>
-<div class="line"><a name="l14539"></a><span class="lineno">14539</span>&#160;                VK_NULL_HANDLE);</div>
-<div class="line"><a name="l14540"></a><span class="lineno">14540</span>&#160; </div>
-<div class="line"><a name="l14541"></a><span class="lineno">14541</span>&#160;            <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;res &lt; VK_SUCCESS)</div>
-<div class="line"><a name="l14542"></a><span class="lineno">14542</span>&#160;                <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l14543"></a><span class="lineno">14543</span>&#160; </div>
-<div class="line"><a name="l14544"></a><span class="lineno">14544</span>&#160;            pBlockVectorCtx-&gt;hasDefragmentationPlan = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l14545"></a><span class="lineno">14545</span>&#160;        }</div>
-<div class="line"><a name="l14546"></a><span class="lineno">14546</span>&#160; </div>
-<div class="line"><a name="l14547"></a><span class="lineno">14547</span>&#160;        <span class="keyword">const</span> uint32_t processed = pBlockVectorCtx-&gt;GetBlockVector()-&gt;ProcessDefragmentations(</div>
-<div class="line"><a name="l14548"></a><span class="lineno">14548</span>&#160;            pBlockVectorCtx,</div>
-<div class="line"><a name="l14549"></a><span class="lineno">14549</span>&#160;            pCurrentMove, movesLeft);</div>
-<div class="line"><a name="l14550"></a><span class="lineno">14550</span>&#160; </div>
-<div class="line"><a name="l14551"></a><span class="lineno">14551</span>&#160;        movesLeft -= processed;</div>
-<div class="line"><a name="l14552"></a><span class="lineno">14552</span>&#160;        pCurrentMove += processed;</div>
-<div class="line"><a name="l14553"></a><span class="lineno">14553</span>&#160;    }</div>
-<div class="line"><a name="l14554"></a><span class="lineno">14554</span>&#160; </div>
-<div class="line"><a name="l14555"></a><span class="lineno">14555</span>&#160;    pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a> = pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a> - movesLeft;</div>
-<div class="line"><a name="l14556"></a><span class="lineno">14556</span>&#160; </div>
-<div class="line"><a name="l14557"></a><span class="lineno">14557</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l14558"></a><span class="lineno">14558</span>&#160;}</div>
-<div class="line"><a name="l14559"></a><span class="lineno">14559</span>&#160;VkResult VmaDefragmentationContext_T::DefragmentPassEnd()</div>
-<div class="line"><a name="l14560"></a><span class="lineno">14560</span>&#160;{</div>
-<div class="line"><a name="l14561"></a><span class="lineno">14561</span>&#160;    VkResult res = VK_SUCCESS;</div>
-<div class="line"><a name="l14562"></a><span class="lineno">14562</span>&#160; </div>
-<div class="line"><a name="l14563"></a><span class="lineno">14563</span>&#160;    <span class="comment">// Process default pools.</span></div>
-<div class="line"><a name="l14564"></a><span class="lineno">14564</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0;</div>
-<div class="line"><a name="l14565"></a><span class="lineno">14565</span>&#160;        memTypeIndex &lt; m_hAllocator-&gt;GetMemoryTypeCount();</div>
-<div class="line"><a name="l14566"></a><span class="lineno">14566</span>&#160;        ++memTypeIndex)</div>
-<div class="line"><a name="l14567"></a><span class="lineno">14567</span>&#160;    {</div>
-<div class="line"><a name="l14568"></a><span class="lineno">14568</span>&#160;        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];</div>
-<div class="line"><a name="l14569"></a><span class="lineno">14569</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx)</div>
-<div class="line"><a name="l14570"></a><span class="lineno">14570</span>&#160;        {</div>
-<div class="line"><a name="l14571"></a><span class="lineno">14571</span>&#160;            VMA_ASSERT(pBlockVectorCtx-&gt;GetBlockVector());</div>
-<div class="line"><a name="l14572"></a><span class="lineno">14572</span>&#160; </div>
-<div class="line"><a name="l14573"></a><span class="lineno">14573</span>&#160;            <span class="keywordflow">if</span>(!pBlockVectorCtx-&gt;hasDefragmentationPlan)</div>
-<div class="line"><a name="l14574"></a><span class="lineno">14574</span>&#160;            {</div>
-<div class="line"><a name="l14575"></a><span class="lineno">14575</span>&#160;                res = VK_NOT_READY;</div>
-<div class="line"><a name="l14576"></a><span class="lineno">14576</span>&#160;                <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l14577"></a><span class="lineno">14577</span>&#160;            }</div>
-<div class="line"><a name="l14578"></a><span class="lineno">14578</span>&#160; </div>
-<div class="line"><a name="l14579"></a><span class="lineno">14579</span>&#160;            pBlockVectorCtx-&gt;GetBlockVector()-&gt;CommitDefragmentations(</div>
-<div class="line"><a name="l14580"></a><span class="lineno">14580</span>&#160;                pBlockVectorCtx, m_pStats);</div>
+<div class="line"><a name="l14387"></a><span class="lineno">14387</span>&#160;                    pMetadata-&gt;m_FreeSuballocationsBySize.push_back(trailingFreeIt);</div>
+<div class="line"><a name="l14388"></a><span class="lineno">14388</span>&#160;                }</div>
+<div class="line"><a name="l14389"></a><span class="lineno">14389</span>&#160;            }</div>
+<div class="line"><a name="l14390"></a><span class="lineno">14390</span>&#160; </div>
+<div class="line"><a name="l14391"></a><span class="lineno">14391</span>&#160;            VMA_SORT(</div>
+<div class="line"><a name="l14392"></a><span class="lineno">14392</span>&#160;                pMetadata-&gt;m_FreeSuballocationsBySize.begin(),</div>
+<div class="line"><a name="l14393"></a><span class="lineno">14393</span>&#160;                pMetadata-&gt;m_FreeSuballocationsBySize.end(),</div>
+<div class="line"><a name="l14394"></a><span class="lineno">14394</span>&#160;                VmaSuballocationItemSizeLess());</div>
+<div class="line"><a name="l14395"></a><span class="lineno">14395</span>&#160;        }</div>
+<div class="line"><a name="l14396"></a><span class="lineno">14396</span>&#160; </div>
+<div class="line"><a name="l14397"></a><span class="lineno">14397</span>&#160;        VMA_HEAVY_ASSERT(pMetadata-&gt;Validate());</div>
+<div class="line"><a name="l14398"></a><span class="lineno">14398</span>&#160;    }</div>
+<div class="line"><a name="l14399"></a><span class="lineno">14399</span>&#160;}</div>
+<div class="line"><a name="l14400"></a><span class="lineno">14400</span>&#160; </div>
+<div class="line"><a name="l14401"></a><span class="lineno">14401</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationAlgorithm_Fast::InsertSuballoc(VmaBlockMetadata_Generic* pMetadata, <span class="keyword">const</span> VmaSuballocation&amp; suballoc)</div>
+<div class="line"><a name="l14402"></a><span class="lineno">14402</span>&#160;{</div>
+<div class="line"><a name="l14403"></a><span class="lineno">14403</span>&#160;    <span class="comment">// TODO: Optimize somehow. Remember iterator instead of searching for it linearly.</span></div>
+<div class="line"><a name="l14404"></a><span class="lineno">14404</span>&#160;    VmaSuballocationList::iterator it = pMetadata-&gt;m_Suballocations.begin();</div>
+<div class="line"><a name="l14405"></a><span class="lineno">14405</span>&#160;    <span class="keywordflow">while</span>(it != pMetadata-&gt;m_Suballocations.end())</div>
+<div class="line"><a name="l14406"></a><span class="lineno">14406</span>&#160;    {</div>
+<div class="line"><a name="l14407"></a><span class="lineno">14407</span>&#160;        <span class="keywordflow">if</span>(it-&gt;offset &lt; suballoc.offset)</div>
+<div class="line"><a name="l14408"></a><span class="lineno">14408</span>&#160;        {</div>
+<div class="line"><a name="l14409"></a><span class="lineno">14409</span>&#160;            ++it;</div>
+<div class="line"><a name="l14410"></a><span class="lineno">14410</span>&#160;        }</div>
+<div class="line"><a name="l14411"></a><span class="lineno">14411</span>&#160;    }</div>
+<div class="line"><a name="l14412"></a><span class="lineno">14412</span>&#160;    pMetadata-&gt;m_Suballocations.insert(it, suballoc);</div>
+<div class="line"><a name="l14413"></a><span class="lineno">14413</span>&#160;}</div>
+<div class="line"><a name="l14414"></a><span class="lineno">14414</span>&#160; </div>
+<div class="line"><a name="l14416"></a><span class="lineno">14416</span>&#160;<span class="comment">// VmaBlockVectorDefragmentationContext</span></div>
+<div class="line"><a name="l14417"></a><span class="lineno">14417</span>&#160; </div>
+<div class="line"><a name="l14418"></a><span class="lineno">14418</span>&#160;VmaBlockVectorDefragmentationContext::VmaBlockVectorDefragmentationContext(</div>
+<div class="line"><a name="l14419"></a><span class="lineno">14419</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l14420"></a><span class="lineno">14420</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> hCustomPool,</div>
+<div class="line"><a name="l14421"></a><span class="lineno">14421</span>&#160;    VmaBlockVector* pBlockVector,</div>
+<div class="line"><a name="l14422"></a><span class="lineno">14422</span>&#160;    uint32_t currFrameIndex) :</div>
+<div class="line"><a name="l14423"></a><span class="lineno">14423</span>&#160;    res(VK_SUCCESS),</div>
+<div class="line"><a name="l14424"></a><span class="lineno">14424</span>&#160;    mutexLocked(false),</div>
+<div class="line"><a name="l14425"></a><span class="lineno">14425</span>&#160;    blockContexts(VmaStlAllocator&lt;VmaBlockDefragmentationContext&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
+<div class="line"><a name="l14426"></a><span class="lineno">14426</span>&#160;    defragmentationMoves(VmaStlAllocator&lt;VmaDefragmentationMove&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
+<div class="line"><a name="l14427"></a><span class="lineno">14427</span>&#160;    defragmentationMovesProcessed(0),</div>
+<div class="line"><a name="l14428"></a><span class="lineno">14428</span>&#160;    defragmentationMovesCommitted(0),</div>
+<div class="line"><a name="l14429"></a><span class="lineno">14429</span>&#160;    hasDefragmentationPlan(0),</div>
+<div class="line"><a name="l14430"></a><span class="lineno">14430</span>&#160;    m_hAllocator(hAllocator),</div>
+<div class="line"><a name="l14431"></a><span class="lineno">14431</span>&#160;    m_hCustomPool(hCustomPool),</div>
+<div class="line"><a name="l14432"></a><span class="lineno">14432</span>&#160;    m_pBlockVector(pBlockVector),</div>
+<div class="line"><a name="l14433"></a><span class="lineno">14433</span>&#160;    m_CurrFrameIndex(currFrameIndex),</div>
+<div class="line"><a name="l14434"></a><span class="lineno">14434</span>&#160;    m_pAlgorithm(VMA_NULL),</div>
+<div class="line"><a name="l14435"></a><span class="lineno">14435</span>&#160;    m_Allocations(VmaStlAllocator&lt;AllocInfo&gt;(hAllocator-&gt;GetAllocationCallbacks())),</div>
+<div class="line"><a name="l14436"></a><span class="lineno">14436</span>&#160;    m_AllAllocations(false)</div>
+<div class="line"><a name="l14437"></a><span class="lineno">14437</span>&#160;{</div>
+<div class="line"><a name="l14438"></a><span class="lineno">14438</span>&#160;}</div>
+<div class="line"><a name="l14439"></a><span class="lineno">14439</span>&#160; </div>
+<div class="line"><a name="l14440"></a><span class="lineno">14440</span>&#160;VmaBlockVectorDefragmentationContext::~VmaBlockVectorDefragmentationContext()</div>
+<div class="line"><a name="l14441"></a><span class="lineno">14441</span>&#160;{</div>
+<div class="line"><a name="l14442"></a><span class="lineno">14442</span>&#160;    vma_delete(m_hAllocator, m_pAlgorithm);</div>
+<div class="line"><a name="l14443"></a><span class="lineno">14443</span>&#160;}</div>
+<div class="line"><a name="l14444"></a><span class="lineno">14444</span>&#160; </div>
+<div class="line"><a name="l14445"></a><span class="lineno">14445</span>&#160;<span class="keywordtype">void</span> VmaBlockVectorDefragmentationContext::AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged)</div>
+<div class="line"><a name="l14446"></a><span class="lineno">14446</span>&#160;{</div>
+<div class="line"><a name="l14447"></a><span class="lineno">14447</span>&#160;    AllocInfo info = { hAlloc, pChanged };</div>
+<div class="line"><a name="l14448"></a><span class="lineno">14448</span>&#160;    m_Allocations.push_back(info);</div>
+<div class="line"><a name="l14449"></a><span class="lineno">14449</span>&#160;}</div>
+<div class="line"><a name="l14450"></a><span class="lineno">14450</span>&#160; </div>
+<div class="line"><a name="l14451"></a><span class="lineno">14451</span>&#160;<span class="keywordtype">void</span> VmaBlockVectorDefragmentationContext::Begin(<span class="keywordtype">bool</span> overlappingMoveSupported, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags)</div>
+<div class="line"><a name="l14452"></a><span class="lineno">14452</span>&#160;{</div>
+<div class="line"><a name="l14453"></a><span class="lineno">14453</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> allAllocations = m_AllAllocations ||</div>
+<div class="line"><a name="l14454"></a><span class="lineno">14454</span>&#160;        m_Allocations.size() == m_pBlockVector-&gt;CalcAllocationCount();</div>
+<div class="line"><a name="l14455"></a><span class="lineno">14455</span>&#160; </div>
+<div class="line"><a name="l14456"></a><span class="lineno">14456</span>&#160;<span class="comment">    /********************************</span></div>
+<div class="line"><a name="l14457"></a><span class="lineno">14457</span>&#160;<span class="comment">    HERE IS THE CHOICE OF DEFRAGMENTATION ALGORITHM.</span></div>
+<div class="line"><a name="l14458"></a><span class="lineno">14458</span>&#160;<span class="comment">    ********************************/</span></div>
+<div class="line"><a name="l14459"></a><span class="lineno">14459</span>&#160; </div>
+<div class="line"><a name="l14460"></a><span class="lineno">14460</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l14461"></a><span class="lineno">14461</span>&#160;<span class="comment">    Fast algorithm is supported only when certain criteria are met:</span></div>
+<div class="line"><a name="l14462"></a><span class="lineno">14462</span>&#160;<span class="comment">    - VMA_DEBUG_MARGIN is 0.</span></div>
+<div class="line"><a name="l14463"></a><span class="lineno">14463</span>&#160;<span class="comment">    - All allocations in this block vector are moveable.</span></div>
+<div class="line"><a name="l14464"></a><span class="lineno">14464</span>&#160;<span class="comment">    - There is no possibility of image/buffer granularity conflict.</span></div>
+<div class="line"><a name="l14465"></a><span class="lineno">14465</span>&#160;<span class="comment">    - The defragmentation is not incremental</span></div>
+<div class="line"><a name="l14466"></a><span class="lineno">14466</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l14467"></a><span class="lineno">14467</span>&#160;    <span class="keywordflow">if</span>(VMA_DEBUG_MARGIN == 0 &amp;&amp;</div>
+<div class="line"><a name="l14468"></a><span class="lineno">14468</span>&#160;        allAllocations &amp;&amp;</div>
+<div class="line"><a name="l14469"></a><span class="lineno">14469</span>&#160;        !m_pBlockVector-&gt;IsBufferImageGranularityConflictPossible() &amp;&amp;</div>
+<div class="line"><a name="l14470"></a><span class="lineno">14470</span>&#160;        !(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a>))</div>
+<div class="line"><a name="l14471"></a><span class="lineno">14471</span>&#160;    {</div>
+<div class="line"><a name="l14472"></a><span class="lineno">14472</span>&#160;        m_pAlgorithm = vma_new(m_hAllocator, VmaDefragmentationAlgorithm_Fast)(</div>
+<div class="line"><a name="l14473"></a><span class="lineno">14473</span>&#160;            m_hAllocator, m_pBlockVector, m_CurrFrameIndex, overlappingMoveSupported);</div>
+<div class="line"><a name="l14474"></a><span class="lineno">14474</span>&#160;    }</div>
+<div class="line"><a name="l14475"></a><span class="lineno">14475</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l14476"></a><span class="lineno">14476</span>&#160;    {</div>
+<div class="line"><a name="l14477"></a><span class="lineno">14477</span>&#160;        m_pAlgorithm = vma_new(m_hAllocator, VmaDefragmentationAlgorithm_Generic)(</div>
+<div class="line"><a name="l14478"></a><span class="lineno">14478</span>&#160;            m_hAllocator, m_pBlockVector, m_CurrFrameIndex, overlappingMoveSupported);</div>
+<div class="line"><a name="l14479"></a><span class="lineno">14479</span>&#160;    }</div>
+<div class="line"><a name="l14480"></a><span class="lineno">14480</span>&#160; </div>
+<div class="line"><a name="l14481"></a><span class="lineno">14481</span>&#160;    <span class="keywordflow">if</span>(allAllocations)</div>
+<div class="line"><a name="l14482"></a><span class="lineno">14482</span>&#160;    {</div>
+<div class="line"><a name="l14483"></a><span class="lineno">14483</span>&#160;        m_pAlgorithm-&gt;AddAll();</div>
+<div class="line"><a name="l14484"></a><span class="lineno">14484</span>&#160;    }</div>
+<div class="line"><a name="l14485"></a><span class="lineno">14485</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l14486"></a><span class="lineno">14486</span>&#160;    {</div>
+<div class="line"><a name="l14487"></a><span class="lineno">14487</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0, count = m_Allocations.size(); i &lt; count; ++i)</div>
+<div class="line"><a name="l14488"></a><span class="lineno">14488</span>&#160;        {</div>
+<div class="line"><a name="l14489"></a><span class="lineno">14489</span>&#160;            m_pAlgorithm-&gt;AddAllocation(m_Allocations[i].hAlloc, m_Allocations[i].pChanged);</div>
+<div class="line"><a name="l14490"></a><span class="lineno">14490</span>&#160;        }</div>
+<div class="line"><a name="l14491"></a><span class="lineno">14491</span>&#160;    }</div>
+<div class="line"><a name="l14492"></a><span class="lineno">14492</span>&#160;}</div>
+<div class="line"><a name="l14493"></a><span class="lineno">14493</span>&#160; </div>
+<div class="line"><a name="l14495"></a><span class="lineno">14495</span>&#160;<span class="comment">// VmaDefragmentationContext</span></div>
+<div class="line"><a name="l14496"></a><span class="lineno">14496</span>&#160; </div>
+<div class="line"><a name="l14497"></a><span class="lineno">14497</span>&#160;VmaDefragmentationContext_T::VmaDefragmentationContext_T(</div>
+<div class="line"><a name="l14498"></a><span class="lineno">14498</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
+<div class="line"><a name="l14499"></a><span class="lineno">14499</span>&#160;    uint32_t currFrameIndex,</div>
+<div class="line"><a name="l14500"></a><span class="lineno">14500</span>&#160;    uint32_t flags,</div>
+<div class="line"><a name="l14501"></a><span class="lineno">14501</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats) :</div>
+<div class="line"><a name="l14502"></a><span class="lineno">14502</span>&#160;    m_hAllocator(hAllocator),</div>
+<div class="line"><a name="l14503"></a><span class="lineno">14503</span>&#160;    m_CurrFrameIndex(currFrameIndex),</div>
+<div class="line"><a name="l14504"></a><span class="lineno">14504</span>&#160;    m_Flags(flags),</div>
+<div class="line"><a name="l14505"></a><span class="lineno">14505</span>&#160;    m_pStats(pStats),</div>
+<div class="line"><a name="l14506"></a><span class="lineno">14506</span>&#160;    m_CustomPoolContexts(VmaStlAllocator&lt;VmaBlockVectorDefragmentationContext*&gt;(hAllocator-&gt;GetAllocationCallbacks()))</div>
+<div class="line"><a name="l14507"></a><span class="lineno">14507</span>&#160;{</div>
+<div class="line"><a name="l14508"></a><span class="lineno">14508</span>&#160;    memset(m_DefaultPoolContexts, 0, <span class="keyword">sizeof</span>(m_DefaultPoolContexts));</div>
+<div class="line"><a name="l14509"></a><span class="lineno">14509</span>&#160;}</div>
+<div class="line"><a name="l14510"></a><span class="lineno">14510</span>&#160; </div>
+<div class="line"><a name="l14511"></a><span class="lineno">14511</span>&#160;VmaDefragmentationContext_T::~VmaDefragmentationContext_T()</div>
+<div class="line"><a name="l14512"></a><span class="lineno">14512</span>&#160;{</div>
+<div class="line"><a name="l14513"></a><span class="lineno">14513</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_CustomPoolContexts.size(); i--; )</div>
+<div class="line"><a name="l14514"></a><span class="lineno">14514</span>&#160;    {</div>
+<div class="line"><a name="l14515"></a><span class="lineno">14515</span>&#160;        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_CustomPoolContexts[i];</div>
+<div class="line"><a name="l14516"></a><span class="lineno">14516</span>&#160;        pBlockVectorCtx-&gt;GetBlockVector()-&gt;DefragmentationEnd(pBlockVectorCtx, m_Flags, m_pStats);</div>
+<div class="line"><a name="l14517"></a><span class="lineno">14517</span>&#160;        vma_delete(m_hAllocator, pBlockVectorCtx);</div>
+<div class="line"><a name="l14518"></a><span class="lineno">14518</span>&#160;    }</div>
+<div class="line"><a name="l14519"></a><span class="lineno">14519</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_hAllocator-&gt;m_MemProps.memoryTypeCount; i--; )</div>
+<div class="line"><a name="l14520"></a><span class="lineno">14520</span>&#160;    {</div>
+<div class="line"><a name="l14521"></a><span class="lineno">14521</span>&#160;        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_DefaultPoolContexts[i];</div>
+<div class="line"><a name="l14522"></a><span class="lineno">14522</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx)</div>
+<div class="line"><a name="l14523"></a><span class="lineno">14523</span>&#160;        {</div>
+<div class="line"><a name="l14524"></a><span class="lineno">14524</span>&#160;            pBlockVectorCtx-&gt;GetBlockVector()-&gt;DefragmentationEnd(pBlockVectorCtx, m_Flags, m_pStats);</div>
+<div class="line"><a name="l14525"></a><span class="lineno">14525</span>&#160;            vma_delete(m_hAllocator, pBlockVectorCtx);</div>
+<div class="line"><a name="l14526"></a><span class="lineno">14526</span>&#160;        }</div>
+<div class="line"><a name="l14527"></a><span class="lineno">14527</span>&#160;    }</div>
+<div class="line"><a name="l14528"></a><span class="lineno">14528</span>&#160;}</div>
+<div class="line"><a name="l14529"></a><span class="lineno">14529</span>&#160; </div>
+<div class="line"><a name="l14530"></a><span class="lineno">14530</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationContext_T::AddPools(uint32_t poolCount, <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPools)</div>
+<div class="line"><a name="l14531"></a><span class="lineno">14531</span>&#160;{</div>
+<div class="line"><a name="l14532"></a><span class="lineno">14532</span>&#160;    <span class="keywordflow">for</span>(uint32_t poolIndex = 0; poolIndex &lt; poolCount; ++poolIndex)</div>
+<div class="line"><a name="l14533"></a><span class="lineno">14533</span>&#160;    {</div>
+<div class="line"><a name="l14534"></a><span class="lineno">14534</span>&#160;        <a class="code" href="struct_vma_pool.html">VmaPool</a> pool = pPools[poolIndex];</div>
+<div class="line"><a name="l14535"></a><span class="lineno">14535</span>&#160;        VMA_ASSERT(pool);</div>
+<div class="line"><a name="l14536"></a><span class="lineno">14536</span>&#160;        <span class="comment">// Pools with algorithm other than default are not defragmented.</span></div>
+<div class="line"><a name="l14537"></a><span class="lineno">14537</span>&#160;        <span class="keywordflow">if</span>(pool-&gt;m_BlockVector.GetAlgorithm() == 0)</div>
+<div class="line"><a name="l14538"></a><span class="lineno">14538</span>&#160;        {</div>
+<div class="line"><a name="l14539"></a><span class="lineno">14539</span>&#160;            VmaBlockVectorDefragmentationContext* pBlockVectorDefragCtx = VMA_NULL;</div>
+<div class="line"><a name="l14540"></a><span class="lineno">14540</span>&#160;            </div>
+<div class="line"><a name="l14541"></a><span class="lineno">14541</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_CustomPoolContexts.size(); i--; )</div>
+<div class="line"><a name="l14542"></a><span class="lineno">14542</span>&#160;            {</div>
+<div class="line"><a name="l14543"></a><span class="lineno">14543</span>&#160;                <span class="keywordflow">if</span>(m_CustomPoolContexts[i]-&gt;GetCustomPool() == pool)</div>
+<div class="line"><a name="l14544"></a><span class="lineno">14544</span>&#160;                {</div>
+<div class="line"><a name="l14545"></a><span class="lineno">14545</span>&#160;                    pBlockVectorDefragCtx = m_CustomPoolContexts[i];</div>
+<div class="line"><a name="l14546"></a><span class="lineno">14546</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l14547"></a><span class="lineno">14547</span>&#160;                }</div>
+<div class="line"><a name="l14548"></a><span class="lineno">14548</span>&#160;            }</div>
+<div class="line"><a name="l14549"></a><span class="lineno">14549</span>&#160;            </div>
+<div class="line"><a name="l14550"></a><span class="lineno">14550</span>&#160;            <span class="keywordflow">if</span>(!pBlockVectorDefragCtx)</div>
+<div class="line"><a name="l14551"></a><span class="lineno">14551</span>&#160;            {</div>
+<div class="line"><a name="l14552"></a><span class="lineno">14552</span>&#160;                pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(</div>
+<div class="line"><a name="l14553"></a><span class="lineno">14553</span>&#160;                    m_hAllocator,</div>
+<div class="line"><a name="l14554"></a><span class="lineno">14554</span>&#160;                    pool,</div>
+<div class="line"><a name="l14555"></a><span class="lineno">14555</span>&#160;                    &amp;pool-&gt;m_BlockVector,</div>
+<div class="line"><a name="l14556"></a><span class="lineno">14556</span>&#160;                    m_CurrFrameIndex);</div>
+<div class="line"><a name="l14557"></a><span class="lineno">14557</span>&#160;                m_CustomPoolContexts.push_back(pBlockVectorDefragCtx);</div>
+<div class="line"><a name="l14558"></a><span class="lineno">14558</span>&#160;            }</div>
+<div class="line"><a name="l14559"></a><span class="lineno">14559</span>&#160; </div>
+<div class="line"><a name="l14560"></a><span class="lineno">14560</span>&#160;            pBlockVectorDefragCtx-&gt;AddAll();</div>
+<div class="line"><a name="l14561"></a><span class="lineno">14561</span>&#160;        }</div>
+<div class="line"><a name="l14562"></a><span class="lineno">14562</span>&#160;    }</div>
+<div class="line"><a name="l14563"></a><span class="lineno">14563</span>&#160;}</div>
+<div class="line"><a name="l14564"></a><span class="lineno">14564</span>&#160; </div>
+<div class="line"><a name="l14565"></a><span class="lineno">14565</span>&#160;<span class="keywordtype">void</span> VmaDefragmentationContext_T::AddAllocations(</div>
+<div class="line"><a name="l14566"></a><span class="lineno">14566</span>&#160;    uint32_t allocationCount,</div>
+<div class="line"><a name="l14567"></a><span class="lineno">14567</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations,</div>
+<div class="line"><a name="l14568"></a><span class="lineno">14568</span>&#160;    VkBool32* pAllocationsChanged)</div>
+<div class="line"><a name="l14569"></a><span class="lineno">14569</span>&#160;{</div>
+<div class="line"><a name="l14570"></a><span class="lineno">14570</span>&#160;    <span class="comment">// Dispatch pAllocations among defragmentators. Create them when necessary.</span></div>
+<div class="line"><a name="l14571"></a><span class="lineno">14571</span>&#160;    <span class="keywordflow">for</span>(uint32_t allocIndex = 0; allocIndex &lt; allocationCount; ++allocIndex)</div>
+<div class="line"><a name="l14572"></a><span class="lineno">14572</span>&#160;    {</div>
+<div class="line"><a name="l14573"></a><span class="lineno">14573</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc = pAllocations[allocIndex];</div>
+<div class="line"><a name="l14574"></a><span class="lineno">14574</span>&#160;        VMA_ASSERT(hAlloc);</div>
+<div class="line"><a name="l14575"></a><span class="lineno">14575</span>&#160;        <span class="comment">// DedicatedAlloc cannot be defragmented.</span></div>
+<div class="line"><a name="l14576"></a><span class="lineno">14576</span>&#160;        <span class="keywordflow">if</span>((hAlloc-&gt;GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK) &amp;&amp;</div>
+<div class="line"><a name="l14577"></a><span class="lineno">14577</span>&#160;            <span class="comment">// Lost allocation cannot be defragmented.</span></div>
+<div class="line"><a name="l14578"></a><span class="lineno">14578</span>&#160;            (hAlloc-&gt;GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST))</div>
+<div class="line"><a name="l14579"></a><span class="lineno">14579</span>&#160;        {</div>
+<div class="line"><a name="l14580"></a><span class="lineno">14580</span>&#160;            VmaBlockVectorDefragmentationContext* pBlockVectorDefragCtx = VMA_NULL;</div>
 <div class="line"><a name="l14581"></a><span class="lineno">14581</span>&#160; </div>
-<div class="line"><a name="l14582"></a><span class="lineno">14582</span>&#160;            <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;defragmentationMoves.size() != pBlockVectorCtx-&gt;defragmentationMovesCommitted)</div>
-<div class="line"><a name="l14583"></a><span class="lineno">14583</span>&#160;                res = VK_NOT_READY;</div>
-<div class="line"><a name="l14584"></a><span class="lineno">14584</span>&#160;        }</div>
-<div class="line"><a name="l14585"></a><span class="lineno">14585</span>&#160;    }</div>
-<div class="line"><a name="l14586"></a><span class="lineno">14586</span>&#160; </div>
-<div class="line"><a name="l14587"></a><span class="lineno">14587</span>&#160;    <span class="comment">// Process custom pools.</span></div>
-<div class="line"><a name="l14588"></a><span class="lineno">14588</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();</div>
-<div class="line"><a name="l14589"></a><span class="lineno">14589</span>&#160;        customCtxIndex &lt; customCtxCount;</div>
-<div class="line"><a name="l14590"></a><span class="lineno">14590</span>&#160;        ++customCtxIndex)</div>
-<div class="line"><a name="l14591"></a><span class="lineno">14591</span>&#160;    {</div>
-<div class="line"><a name="l14592"></a><span class="lineno">14592</span>&#160;        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];</div>
-<div class="line"><a name="l14593"></a><span class="lineno">14593</span>&#160;        VMA_ASSERT(pBlockVectorCtx &amp;&amp; pBlockVectorCtx-&gt;GetBlockVector());</div>
-<div class="line"><a name="l14594"></a><span class="lineno">14594</span>&#160; </div>
-<div class="line"><a name="l14595"></a><span class="lineno">14595</span>&#160;        <span class="keywordflow">if</span>(!pBlockVectorCtx-&gt;hasDefragmentationPlan)</div>
-<div class="line"><a name="l14596"></a><span class="lineno">14596</span>&#160;        {</div>
-<div class="line"><a name="l14597"></a><span class="lineno">14597</span>&#160;            res = VK_NOT_READY;</div>
-<div class="line"><a name="l14598"></a><span class="lineno">14598</span>&#160;            <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l14599"></a><span class="lineno">14599</span>&#160;        }</div>
-<div class="line"><a name="l14600"></a><span class="lineno">14600</span>&#160; </div>
-<div class="line"><a name="l14601"></a><span class="lineno">14601</span>&#160;        pBlockVectorCtx-&gt;GetBlockVector()-&gt;CommitDefragmentations(</div>
-<div class="line"><a name="l14602"></a><span class="lineno">14602</span>&#160;            pBlockVectorCtx, m_pStats);</div>
-<div class="line"><a name="l14603"></a><span class="lineno">14603</span>&#160; </div>
-<div class="line"><a name="l14604"></a><span class="lineno">14604</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;defragmentationMoves.size() != pBlockVectorCtx-&gt;defragmentationMovesCommitted)</div>
-<div class="line"><a name="l14605"></a><span class="lineno">14605</span>&#160;            res = VK_NOT_READY;</div>
-<div class="line"><a name="l14606"></a><span class="lineno">14606</span>&#160;    }</div>
-<div class="line"><a name="l14607"></a><span class="lineno">14607</span>&#160; </div>
-<div class="line"><a name="l14608"></a><span class="lineno">14608</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l14609"></a><span class="lineno">14609</span>&#160;}</div>
-<div class="line"><a name="l14610"></a><span class="lineno">14610</span>&#160; </div>
-<div class="line"><a name="l14612"></a><span class="lineno">14612</span>&#160;<span class="comment">// VmaRecorder</span></div>
-<div class="line"><a name="l14613"></a><span class="lineno">14613</span>&#160; </div>
-<div class="line"><a name="l14614"></a><span class="lineno">14614</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l14615"></a><span class="lineno">14615</span>&#160; </div>
-<div class="line"><a name="l14616"></a><span class="lineno">14616</span>&#160;VmaRecorder::VmaRecorder() :</div>
-<div class="line"><a name="l14617"></a><span class="lineno">14617</span>&#160;    m_UseMutex(true),</div>
-<div class="line"><a name="l14618"></a><span class="lineno">14618</span>&#160;    m_Flags(0),</div>
-<div class="line"><a name="l14619"></a><span class="lineno">14619</span>&#160;    m_File(VMA_NULL),</div>
-<div class="line"><a name="l14620"></a><span class="lineno">14620</span>&#160;    m_Freq(INT64_MAX),</div>
-<div class="line"><a name="l14621"></a><span class="lineno">14621</span>&#160;    m_StartCounter(INT64_MAX)</div>
-<div class="line"><a name="l14622"></a><span class="lineno">14622</span>&#160;{</div>
-<div class="line"><a name="l14623"></a><span class="lineno">14623</span>&#160;}</div>
-<div class="line"><a name="l14624"></a><span class="lineno">14624</span>&#160; </div>
-<div class="line"><a name="l14625"></a><span class="lineno">14625</span>&#160;VkResult VmaRecorder::Init(<span class="keyword">const</span> <a class="code" href="struct_vma_record_settings.html">VmaRecordSettings</a>&amp; settings, <span class="keywordtype">bool</span> useMutex)</div>
-<div class="line"><a name="l14626"></a><span class="lineno">14626</span>&#160;{</div>
-<div class="line"><a name="l14627"></a><span class="lineno">14627</span>&#160;    m_UseMutex = useMutex;</div>
-<div class="line"><a name="l14628"></a><span class="lineno">14628</span>&#160;    m_Flags = settings.<a class="code" href="struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a">flags</a>;</div>
-<div class="line"><a name="l14629"></a><span class="lineno">14629</span>&#160; </div>
-<div class="line"><a name="l14630"></a><span class="lineno">14630</span>&#160;    QueryPerformanceFrequency((LARGE_INTEGER*)&amp;m_Freq);</div>
-<div class="line"><a name="l14631"></a><span class="lineno">14631</span>&#160;    QueryPerformanceCounter((LARGE_INTEGER*)&amp;m_StartCounter);</div>
-<div class="line"><a name="l14632"></a><span class="lineno">14632</span>&#160; </div>
-<div class="line"><a name="l14633"></a><span class="lineno">14633</span>&#160;    <span class="comment">// Open file for writing.</span></div>
-<div class="line"><a name="l14634"></a><span class="lineno">14634</span>&#160;    errno_t err = fopen_s(&amp;m_File, settings.<a class="code" href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d">pFilePath</a>, <span class="stringliteral">&quot;wb&quot;</span>);</div>
-<div class="line"><a name="l14635"></a><span class="lineno">14635</span>&#160;    <span class="keywordflow">if</span>(err != 0)</div>
-<div class="line"><a name="l14636"></a><span class="lineno">14636</span>&#160;    {</div>
-<div class="line"><a name="l14637"></a><span class="lineno">14637</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_INITIALIZATION_FAILED;</div>
-<div class="line"><a name="l14638"></a><span class="lineno">14638</span>&#160;    }</div>
-<div class="line"><a name="l14639"></a><span class="lineno">14639</span>&#160; </div>
-<div class="line"><a name="l14640"></a><span class="lineno">14640</span>&#160;    <span class="comment">// Write header.</span></div>
-<div class="line"><a name="l14641"></a><span class="lineno">14641</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%s\n&quot;</span>, <span class="stringliteral">&quot;Vulkan Memory Allocator,Calls recording&quot;</span>);</div>
-<div class="line"><a name="l14642"></a><span class="lineno">14642</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%s\n&quot;</span>, <span class="stringliteral">&quot;1,8&quot;</span>);</div>
+<div class="line"><a name="l14582"></a><span class="lineno">14582</span>&#160;            <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a> hAllocPool = hAlloc-&gt;GetBlock()-&gt;GetParentPool();</div>
+<div class="line"><a name="l14583"></a><span class="lineno">14583</span>&#160;            <span class="comment">// This allocation belongs to custom pool.</span></div>
+<div class="line"><a name="l14584"></a><span class="lineno">14584</span>&#160;            <span class="keywordflow">if</span>(hAllocPool != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l14585"></a><span class="lineno">14585</span>&#160;            {</div>
+<div class="line"><a name="l14586"></a><span class="lineno">14586</span>&#160;                <span class="comment">// Pools with algorithm other than default are not defragmented.</span></div>
+<div class="line"><a name="l14587"></a><span class="lineno">14587</span>&#160;                <span class="keywordflow">if</span>(hAllocPool-&gt;m_BlockVector.GetAlgorithm() == 0)</div>
+<div class="line"><a name="l14588"></a><span class="lineno">14588</span>&#160;                {</div>
+<div class="line"><a name="l14589"></a><span class="lineno">14589</span>&#160;                    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_CustomPoolContexts.size(); i--; )</div>
+<div class="line"><a name="l14590"></a><span class="lineno">14590</span>&#160;                    {</div>
+<div class="line"><a name="l14591"></a><span class="lineno">14591</span>&#160;                        <span class="keywordflow">if</span>(m_CustomPoolContexts[i]-&gt;GetCustomPool() == hAllocPool)</div>
+<div class="line"><a name="l14592"></a><span class="lineno">14592</span>&#160;                        {</div>
+<div class="line"><a name="l14593"></a><span class="lineno">14593</span>&#160;                            pBlockVectorDefragCtx = m_CustomPoolContexts[i];</div>
+<div class="line"><a name="l14594"></a><span class="lineno">14594</span>&#160;                            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l14595"></a><span class="lineno">14595</span>&#160;                        }</div>
+<div class="line"><a name="l14596"></a><span class="lineno">14596</span>&#160;                    }</div>
+<div class="line"><a name="l14597"></a><span class="lineno">14597</span>&#160;                    <span class="keywordflow">if</span>(!pBlockVectorDefragCtx)</div>
+<div class="line"><a name="l14598"></a><span class="lineno">14598</span>&#160;                    {</div>
+<div class="line"><a name="l14599"></a><span class="lineno">14599</span>&#160;                        pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(</div>
+<div class="line"><a name="l14600"></a><span class="lineno">14600</span>&#160;                            m_hAllocator,</div>
+<div class="line"><a name="l14601"></a><span class="lineno">14601</span>&#160;                            hAllocPool,</div>
+<div class="line"><a name="l14602"></a><span class="lineno">14602</span>&#160;                            &amp;hAllocPool-&gt;m_BlockVector,</div>
+<div class="line"><a name="l14603"></a><span class="lineno">14603</span>&#160;                            m_CurrFrameIndex);</div>
+<div class="line"><a name="l14604"></a><span class="lineno">14604</span>&#160;                        m_CustomPoolContexts.push_back(pBlockVectorDefragCtx);</div>
+<div class="line"><a name="l14605"></a><span class="lineno">14605</span>&#160;                    }</div>
+<div class="line"><a name="l14606"></a><span class="lineno">14606</span>&#160;                }</div>
+<div class="line"><a name="l14607"></a><span class="lineno">14607</span>&#160;            }</div>
+<div class="line"><a name="l14608"></a><span class="lineno">14608</span>&#160;            <span class="comment">// This allocation belongs to default pool.</span></div>
+<div class="line"><a name="l14609"></a><span class="lineno">14609</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l14610"></a><span class="lineno">14610</span>&#160;            {</div>
+<div class="line"><a name="l14611"></a><span class="lineno">14611</span>&#160;                <span class="keyword">const</span> uint32_t memTypeIndex = hAlloc-&gt;GetMemoryTypeIndex();</div>
+<div class="line"><a name="l14612"></a><span class="lineno">14612</span>&#160;                pBlockVectorDefragCtx = m_DefaultPoolContexts[memTypeIndex];</div>
+<div class="line"><a name="l14613"></a><span class="lineno">14613</span>&#160;                <span class="keywordflow">if</span>(!pBlockVectorDefragCtx)</div>
+<div class="line"><a name="l14614"></a><span class="lineno">14614</span>&#160;                {</div>
+<div class="line"><a name="l14615"></a><span class="lineno">14615</span>&#160;                    pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(</div>
+<div class="line"><a name="l14616"></a><span class="lineno">14616</span>&#160;                        m_hAllocator,</div>
+<div class="line"><a name="l14617"></a><span class="lineno">14617</span>&#160;                        VMA_NULL, <span class="comment">// hCustomPool</span></div>
+<div class="line"><a name="l14618"></a><span class="lineno">14618</span>&#160;                        m_hAllocator-&gt;m_pBlockVectors[memTypeIndex],</div>
+<div class="line"><a name="l14619"></a><span class="lineno">14619</span>&#160;                        m_CurrFrameIndex);</div>
+<div class="line"><a name="l14620"></a><span class="lineno">14620</span>&#160;                    m_DefaultPoolContexts[memTypeIndex] = pBlockVectorDefragCtx;</div>
+<div class="line"><a name="l14621"></a><span class="lineno">14621</span>&#160;                }</div>
+<div class="line"><a name="l14622"></a><span class="lineno">14622</span>&#160;            }</div>
+<div class="line"><a name="l14623"></a><span class="lineno">14623</span>&#160; </div>
+<div class="line"><a name="l14624"></a><span class="lineno">14624</span>&#160;            <span class="keywordflow">if</span>(pBlockVectorDefragCtx)</div>
+<div class="line"><a name="l14625"></a><span class="lineno">14625</span>&#160;            {</div>
+<div class="line"><a name="l14626"></a><span class="lineno">14626</span>&#160;                VkBool32* <span class="keyword">const</span> pChanged = (pAllocationsChanged != VMA_NULL) ?</div>
+<div class="line"><a name="l14627"></a><span class="lineno">14627</span>&#160;                    &amp;pAllocationsChanged[allocIndex] : VMA_NULL;</div>
+<div class="line"><a name="l14628"></a><span class="lineno">14628</span>&#160;                pBlockVectorDefragCtx-&gt;AddAllocation(hAlloc, pChanged);</div>
+<div class="line"><a name="l14629"></a><span class="lineno">14629</span>&#160;            }</div>
+<div class="line"><a name="l14630"></a><span class="lineno">14630</span>&#160;        }</div>
+<div class="line"><a name="l14631"></a><span class="lineno">14631</span>&#160;    }</div>
+<div class="line"><a name="l14632"></a><span class="lineno">14632</span>&#160;}</div>
+<div class="line"><a name="l14633"></a><span class="lineno">14633</span>&#160; </div>
+<div class="line"><a name="l14634"></a><span class="lineno">14634</span>&#160;VkResult VmaDefragmentationContext_T::Defragment(</div>
+<div class="line"><a name="l14635"></a><span class="lineno">14635</span>&#160;    VkDeviceSize maxCpuBytesToMove, uint32_t maxCpuAllocationsToMove,</div>
+<div class="line"><a name="l14636"></a><span class="lineno">14636</span>&#160;    VkDeviceSize maxGpuBytesToMove, uint32_t maxGpuAllocationsToMove,</div>
+<div class="line"><a name="l14637"></a><span class="lineno">14637</span>&#160;    VkCommandBuffer commandBuffer, <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats, <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> flags)</div>
+<div class="line"><a name="l14638"></a><span class="lineno">14638</span>&#160;{</div>
+<div class="line"><a name="l14639"></a><span class="lineno">14639</span>&#160;    <span class="keywordflow">if</span>(pStats)</div>
+<div class="line"><a name="l14640"></a><span class="lineno">14640</span>&#160;    {</div>
+<div class="line"><a name="l14641"></a><span class="lineno">14641</span>&#160;        memset(pStats, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>));</div>
+<div class="line"><a name="l14642"></a><span class="lineno">14642</span>&#160;    }</div>
 <div class="line"><a name="l14643"></a><span class="lineno">14643</span>&#160; </div>
-<div class="line"><a name="l14644"></a><span class="lineno">14644</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l14645"></a><span class="lineno">14645</span>&#160;}</div>
-<div class="line"><a name="l14646"></a><span class="lineno">14646</span>&#160; </div>
-<div class="line"><a name="l14647"></a><span class="lineno">14647</span>&#160;VmaRecorder::~VmaRecorder()</div>
-<div class="line"><a name="l14648"></a><span class="lineno">14648</span>&#160;{</div>
-<div class="line"><a name="l14649"></a><span class="lineno">14649</span>&#160;    <span class="keywordflow">if</span>(m_File != VMA_NULL)</div>
-<div class="line"><a name="l14650"></a><span class="lineno">14650</span>&#160;    {</div>
-<div class="line"><a name="l14651"></a><span class="lineno">14651</span>&#160;        fclose(m_File);</div>
-<div class="line"><a name="l14652"></a><span class="lineno">14652</span>&#160;    }</div>
-<div class="line"><a name="l14653"></a><span class="lineno">14653</span>&#160;}</div>
-<div class="line"><a name="l14654"></a><span class="lineno">14654</span>&#160; </div>
-<div class="line"><a name="l14655"></a><span class="lineno">14655</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordCreateAllocator(uint32_t frameIndex)</div>
-<div class="line"><a name="l14656"></a><span class="lineno">14656</span>&#160;{</div>
-<div class="line"><a name="l14657"></a><span class="lineno">14657</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14658"></a><span class="lineno">14658</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14659"></a><span class="lineno">14659</span>&#160; </div>
-<div class="line"><a name="l14660"></a><span class="lineno">14660</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14661"></a><span class="lineno">14661</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaCreateAllocator\n&quot;</span>, callParams.threadId, callParams.time, frameIndex);</div>
-<div class="line"><a name="l14662"></a><span class="lineno">14662</span>&#160;    Flush();</div>
-<div class="line"><a name="l14663"></a><span class="lineno">14663</span>&#160;}</div>
-<div class="line"><a name="l14664"></a><span class="lineno">14664</span>&#160; </div>
-<div class="line"><a name="l14665"></a><span class="lineno">14665</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDestroyAllocator(uint32_t frameIndex)</div>
-<div class="line"><a name="l14666"></a><span class="lineno">14666</span>&#160;{</div>
-<div class="line"><a name="l14667"></a><span class="lineno">14667</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14668"></a><span class="lineno">14668</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14669"></a><span class="lineno">14669</span>&#160; </div>
-<div class="line"><a name="l14670"></a><span class="lineno">14670</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14671"></a><span class="lineno">14671</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDestroyAllocator\n&quot;</span>, callParams.threadId, callParams.time, frameIndex);</div>
-<div class="line"><a name="l14672"></a><span class="lineno">14672</span>&#160;    Flush();</div>
-<div class="line"><a name="l14673"></a><span class="lineno">14673</span>&#160;}</div>
-<div class="line"><a name="l14674"></a><span class="lineno">14674</span>&#160; </div>
-<div class="line"><a name="l14675"></a><span class="lineno">14675</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordCreatePool(uint32_t frameIndex, <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>&amp; createInfo, <a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
-<div class="line"><a name="l14676"></a><span class="lineno">14676</span>&#160;{</div>
-<div class="line"><a name="l14677"></a><span class="lineno">14677</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14678"></a><span class="lineno">14678</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14679"></a><span class="lineno">14679</span>&#160; </div>
-<div class="line"><a name="l14680"></a><span class="lineno">14680</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14681"></a><span class="lineno">14681</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaCreatePool,%u,%u,%llu,%llu,%llu,%u,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14682"></a><span class="lineno">14682</span>&#160;        createInfo.<a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a>,</div>
-<div class="line"><a name="l14683"></a><span class="lineno">14683</span>&#160;        createInfo.<a class="code" href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446">flags</a>,</div>
-<div class="line"><a name="l14684"></a><span class="lineno">14684</span>&#160;        createInfo.<a class="code" href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676">blockSize</a>,</div>
-<div class="line"><a name="l14685"></a><span class="lineno">14685</span>&#160;        (uint64_t)createInfo.<a class="code" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae">minBlockCount</a>,</div>
-<div class="line"><a name="l14686"></a><span class="lineno">14686</span>&#160;        (uint64_t)createInfo.<a class="code" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">maxBlockCount</a>,</div>
-<div class="line"><a name="l14687"></a><span class="lineno">14687</span>&#160;        createInfo.<a class="code" href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa">frameInUseCount</a>,</div>
-<div class="line"><a name="l14688"></a><span class="lineno">14688</span>&#160;        pool);</div>
-<div class="line"><a name="l14689"></a><span class="lineno">14689</span>&#160;    Flush();</div>
-<div class="line"><a name="l14690"></a><span class="lineno">14690</span>&#160;}</div>
-<div class="line"><a name="l14691"></a><span class="lineno">14691</span>&#160; </div>
-<div class="line"><a name="l14692"></a><span class="lineno">14692</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDestroyPool(uint32_t frameIndex, <a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
-<div class="line"><a name="l14693"></a><span class="lineno">14693</span>&#160;{</div>
-<div class="line"><a name="l14694"></a><span class="lineno">14694</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14695"></a><span class="lineno">14695</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14696"></a><span class="lineno">14696</span>&#160; </div>
-<div class="line"><a name="l14697"></a><span class="lineno">14697</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14698"></a><span class="lineno">14698</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDestroyPool,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14699"></a><span class="lineno">14699</span>&#160;        pool);</div>
-<div class="line"><a name="l14700"></a><span class="lineno">14700</span>&#160;    Flush();</div>
-<div class="line"><a name="l14701"></a><span class="lineno">14701</span>&#160;}</div>
-<div class="line"><a name="l14702"></a><span class="lineno">14702</span>&#160; </div>
-<div class="line"><a name="l14703"></a><span class="lineno">14703</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordAllocateMemory(uint32_t frameIndex,</div>
-<div class="line"><a name="l14704"></a><span class="lineno">14704</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
-<div class="line"><a name="l14705"></a><span class="lineno">14705</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l14706"></a><span class="lineno">14706</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l14707"></a><span class="lineno">14707</span>&#160;{</div>
-<div class="line"><a name="l14708"></a><span class="lineno">14708</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14709"></a><span class="lineno">14709</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14710"></a><span class="lineno">14710</span>&#160; </div>
-<div class="line"><a name="l14711"></a><span class="lineno">14711</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14712"></a><span class="lineno">14712</span>&#160;    UserDataString userDataStr(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
-<div class="line"><a name="l14713"></a><span class="lineno">14713</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaAllocateMemory,%llu,%llu,%u,%u,%u,%u,%u,%u,%p,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14714"></a><span class="lineno">14714</span>&#160;        vkMemReq.size,</div>
-<div class="line"><a name="l14715"></a><span class="lineno">14715</span>&#160;        vkMemReq.alignment,</div>
-<div class="line"><a name="l14716"></a><span class="lineno">14716</span>&#160;        vkMemReq.memoryTypeBits,</div>
-<div class="line"><a name="l14717"></a><span class="lineno">14717</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
-<div class="line"><a name="l14718"></a><span class="lineno">14718</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
-<div class="line"><a name="l14719"></a><span class="lineno">14719</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
-<div class="line"><a name="l14720"></a><span class="lineno">14720</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
-<div class="line"><a name="l14721"></a><span class="lineno">14721</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
-<div class="line"><a name="l14722"></a><span class="lineno">14722</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>,</div>
-<div class="line"><a name="l14723"></a><span class="lineno">14723</span>&#160;        allocation,</div>
-<div class="line"><a name="l14724"></a><span class="lineno">14724</span>&#160;        userDataStr.GetString());</div>
-<div class="line"><a name="l14725"></a><span class="lineno">14725</span>&#160;    Flush();</div>
-<div class="line"><a name="l14726"></a><span class="lineno">14726</span>&#160;}</div>
+<div class="line"><a name="l14644"></a><span class="lineno">14644</span>&#160;    <span class="keywordflow">if</span>(flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a>)</div>
+<div class="line"><a name="l14645"></a><span class="lineno">14645</span>&#160;    {</div>
+<div class="line"><a name="l14646"></a><span class="lineno">14646</span>&#160;        <span class="comment">// For incremental defragmetnations, we just earmark how much we can move</span></div>
+<div class="line"><a name="l14647"></a><span class="lineno">14647</span>&#160;        <span class="comment">// The real meat is in the defragmentation steps</span></div>
+<div class="line"><a name="l14648"></a><span class="lineno">14648</span>&#160;        m_MaxCpuBytesToMove = maxCpuBytesToMove;</div>
+<div class="line"><a name="l14649"></a><span class="lineno">14649</span>&#160;        m_MaxCpuAllocationsToMove = maxCpuAllocationsToMove;</div>
+<div class="line"><a name="l14650"></a><span class="lineno">14650</span>&#160; </div>
+<div class="line"><a name="l14651"></a><span class="lineno">14651</span>&#160;        m_MaxGpuBytesToMove = maxGpuBytesToMove;</div>
+<div class="line"><a name="l14652"></a><span class="lineno">14652</span>&#160;        m_MaxGpuAllocationsToMove = maxGpuAllocationsToMove;</div>
+<div class="line"><a name="l14653"></a><span class="lineno">14653</span>&#160; </div>
+<div class="line"><a name="l14654"></a><span class="lineno">14654</span>&#160;        <span class="keywordflow">if</span>(m_MaxCpuBytesToMove == 0 &amp;&amp; m_MaxCpuAllocationsToMove == 0 &amp;&amp;</div>
+<div class="line"><a name="l14655"></a><span class="lineno">14655</span>&#160;            m_MaxGpuBytesToMove == 0 &amp;&amp; m_MaxGpuAllocationsToMove == 0)</div>
+<div class="line"><a name="l14656"></a><span class="lineno">14656</span>&#160;            <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l14657"></a><span class="lineno">14657</span>&#160; </div>
+<div class="line"><a name="l14658"></a><span class="lineno">14658</span>&#160;        <span class="keywordflow">return</span> VK_NOT_READY;</div>
+<div class="line"><a name="l14659"></a><span class="lineno">14659</span>&#160;    }</div>
+<div class="line"><a name="l14660"></a><span class="lineno">14660</span>&#160; </div>
+<div class="line"><a name="l14661"></a><span class="lineno">14661</span>&#160;    <span class="keywordflow">if</span>(commandBuffer == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l14662"></a><span class="lineno">14662</span>&#160;    {</div>
+<div class="line"><a name="l14663"></a><span class="lineno">14663</span>&#160;        maxGpuBytesToMove = 0;</div>
+<div class="line"><a name="l14664"></a><span class="lineno">14664</span>&#160;        maxGpuAllocationsToMove = 0;</div>
+<div class="line"><a name="l14665"></a><span class="lineno">14665</span>&#160;    }</div>
+<div class="line"><a name="l14666"></a><span class="lineno">14666</span>&#160; </div>
+<div class="line"><a name="l14667"></a><span class="lineno">14667</span>&#160;    VkResult res = VK_SUCCESS;</div>
+<div class="line"><a name="l14668"></a><span class="lineno">14668</span>&#160; </div>
+<div class="line"><a name="l14669"></a><span class="lineno">14669</span>&#160;    <span class="comment">// Process default pools.</span></div>
+<div class="line"><a name="l14670"></a><span class="lineno">14670</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0;</div>
+<div class="line"><a name="l14671"></a><span class="lineno">14671</span>&#160;        memTypeIndex &lt; m_hAllocator-&gt;GetMemoryTypeCount() &amp;&amp; res &gt;= VK_SUCCESS;</div>
+<div class="line"><a name="l14672"></a><span class="lineno">14672</span>&#160;        ++memTypeIndex)</div>
+<div class="line"><a name="l14673"></a><span class="lineno">14673</span>&#160;    {</div>
+<div class="line"><a name="l14674"></a><span class="lineno">14674</span>&#160;        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];</div>
+<div class="line"><a name="l14675"></a><span class="lineno">14675</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx)</div>
+<div class="line"><a name="l14676"></a><span class="lineno">14676</span>&#160;        {</div>
+<div class="line"><a name="l14677"></a><span class="lineno">14677</span>&#160;            VMA_ASSERT(pBlockVectorCtx-&gt;GetBlockVector());</div>
+<div class="line"><a name="l14678"></a><span class="lineno">14678</span>&#160;            pBlockVectorCtx-&gt;GetBlockVector()-&gt;Defragment(</div>
+<div class="line"><a name="l14679"></a><span class="lineno">14679</span>&#160;                pBlockVectorCtx,</div>
+<div class="line"><a name="l14680"></a><span class="lineno">14680</span>&#160;                pStats, flags,</div>
+<div class="line"><a name="l14681"></a><span class="lineno">14681</span>&#160;                maxCpuBytesToMove, maxCpuAllocationsToMove,</div>
+<div class="line"><a name="l14682"></a><span class="lineno">14682</span>&#160;                maxGpuBytesToMove, maxGpuAllocationsToMove,</div>
+<div class="line"><a name="l14683"></a><span class="lineno">14683</span>&#160;                commandBuffer);</div>
+<div class="line"><a name="l14684"></a><span class="lineno">14684</span>&#160;            <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;res != VK_SUCCESS)</div>
+<div class="line"><a name="l14685"></a><span class="lineno">14685</span>&#160;            {</div>
+<div class="line"><a name="l14686"></a><span class="lineno">14686</span>&#160;                res = pBlockVectorCtx-&gt;res;</div>
+<div class="line"><a name="l14687"></a><span class="lineno">14687</span>&#160;            }</div>
+<div class="line"><a name="l14688"></a><span class="lineno">14688</span>&#160;        }</div>
+<div class="line"><a name="l14689"></a><span class="lineno">14689</span>&#160;    }</div>
+<div class="line"><a name="l14690"></a><span class="lineno">14690</span>&#160; </div>
+<div class="line"><a name="l14691"></a><span class="lineno">14691</span>&#160;    <span class="comment">// Process custom pools.</span></div>
+<div class="line"><a name="l14692"></a><span class="lineno">14692</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();</div>
+<div class="line"><a name="l14693"></a><span class="lineno">14693</span>&#160;        customCtxIndex &lt; customCtxCount &amp;&amp; res &gt;= VK_SUCCESS;</div>
+<div class="line"><a name="l14694"></a><span class="lineno">14694</span>&#160;        ++customCtxIndex)</div>
+<div class="line"><a name="l14695"></a><span class="lineno">14695</span>&#160;    {</div>
+<div class="line"><a name="l14696"></a><span class="lineno">14696</span>&#160;        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];</div>
+<div class="line"><a name="l14697"></a><span class="lineno">14697</span>&#160;        VMA_ASSERT(pBlockVectorCtx &amp;&amp; pBlockVectorCtx-&gt;GetBlockVector());</div>
+<div class="line"><a name="l14698"></a><span class="lineno">14698</span>&#160;        pBlockVectorCtx-&gt;GetBlockVector()-&gt;Defragment(</div>
+<div class="line"><a name="l14699"></a><span class="lineno">14699</span>&#160;            pBlockVectorCtx,</div>
+<div class="line"><a name="l14700"></a><span class="lineno">14700</span>&#160;            pStats, flags,</div>
+<div class="line"><a name="l14701"></a><span class="lineno">14701</span>&#160;            maxCpuBytesToMove, maxCpuAllocationsToMove,</div>
+<div class="line"><a name="l14702"></a><span class="lineno">14702</span>&#160;            maxGpuBytesToMove, maxGpuAllocationsToMove,</div>
+<div class="line"><a name="l14703"></a><span class="lineno">14703</span>&#160;            commandBuffer);</div>
+<div class="line"><a name="l14704"></a><span class="lineno">14704</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;res != VK_SUCCESS)</div>
+<div class="line"><a name="l14705"></a><span class="lineno">14705</span>&#160;        {</div>
+<div class="line"><a name="l14706"></a><span class="lineno">14706</span>&#160;            res = pBlockVectorCtx-&gt;res;</div>
+<div class="line"><a name="l14707"></a><span class="lineno">14707</span>&#160;        }</div>
+<div class="line"><a name="l14708"></a><span class="lineno">14708</span>&#160;    }</div>
+<div class="line"><a name="l14709"></a><span class="lineno">14709</span>&#160; </div>
+<div class="line"><a name="l14710"></a><span class="lineno">14710</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l14711"></a><span class="lineno">14711</span>&#160;}</div>
+<div class="line"><a name="l14712"></a><span class="lineno">14712</span>&#160; </div>
+<div class="line"><a name="l14713"></a><span class="lineno">14713</span>&#160;VkResult VmaDefragmentationContext_T::DefragmentPassBegin(<a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* pInfo)</div>
+<div class="line"><a name="l14714"></a><span class="lineno">14714</span>&#160;{</div>
+<div class="line"><a name="l14715"></a><span class="lineno">14715</span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a>* pCurrentMove = pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792">pMoves</a>;</div>
+<div class="line"><a name="l14716"></a><span class="lineno">14716</span>&#160;    uint32_t movesLeft = pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a>;</div>
+<div class="line"><a name="l14717"></a><span class="lineno">14717</span>&#160; </div>
+<div class="line"><a name="l14718"></a><span class="lineno">14718</span>&#160;    <span class="comment">// Process default pools.</span></div>
+<div class="line"><a name="l14719"></a><span class="lineno">14719</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0;</div>
+<div class="line"><a name="l14720"></a><span class="lineno">14720</span>&#160;        memTypeIndex &lt; m_hAllocator-&gt;GetMemoryTypeCount();</div>
+<div class="line"><a name="l14721"></a><span class="lineno">14721</span>&#160;        ++memTypeIndex)</div>
+<div class="line"><a name="l14722"></a><span class="lineno">14722</span>&#160;    {</div>
+<div class="line"><a name="l14723"></a><span class="lineno">14723</span>&#160;        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];</div>
+<div class="line"><a name="l14724"></a><span class="lineno">14724</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx)</div>
+<div class="line"><a name="l14725"></a><span class="lineno">14725</span>&#160;        {</div>
+<div class="line"><a name="l14726"></a><span class="lineno">14726</span>&#160;            VMA_ASSERT(pBlockVectorCtx-&gt;GetBlockVector());</div>
 <div class="line"><a name="l14727"></a><span class="lineno">14727</span>&#160; </div>
-<div class="line"><a name="l14728"></a><span class="lineno">14728</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordAllocateMemoryPages(uint32_t frameIndex,</div>
-<div class="line"><a name="l14729"></a><span class="lineno">14729</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
-<div class="line"><a name="l14730"></a><span class="lineno">14730</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l14731"></a><span class="lineno">14731</span>&#160;    uint64_t allocationCount,</div>
-<div class="line"><a name="l14732"></a><span class="lineno">14732</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
-<div class="line"><a name="l14733"></a><span class="lineno">14733</span>&#160;{</div>
-<div class="line"><a name="l14734"></a><span class="lineno">14734</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14735"></a><span class="lineno">14735</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l14728"></a><span class="lineno">14728</span>&#160;            <span class="keywordflow">if</span>(!pBlockVectorCtx-&gt;hasDefragmentationPlan)</div>
+<div class="line"><a name="l14729"></a><span class="lineno">14729</span>&#160;            {</div>
+<div class="line"><a name="l14730"></a><span class="lineno">14730</span>&#160;                pBlockVectorCtx-&gt;GetBlockVector()-&gt;Defragment(</div>
+<div class="line"><a name="l14731"></a><span class="lineno">14731</span>&#160;                    pBlockVectorCtx,</div>
+<div class="line"><a name="l14732"></a><span class="lineno">14732</span>&#160;                    m_pStats, m_Flags,</div>
+<div class="line"><a name="l14733"></a><span class="lineno">14733</span>&#160;                    m_MaxCpuBytesToMove, m_MaxCpuAllocationsToMove,</div>
+<div class="line"><a name="l14734"></a><span class="lineno">14734</span>&#160;                    m_MaxGpuBytesToMove, m_MaxGpuAllocationsToMove,</div>
+<div class="line"><a name="l14735"></a><span class="lineno">14735</span>&#160;                    VK_NULL_HANDLE);</div>
 <div class="line"><a name="l14736"></a><span class="lineno">14736</span>&#160; </div>
-<div class="line"><a name="l14737"></a><span class="lineno">14737</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14738"></a><span class="lineno">14738</span>&#160;    UserDataString userDataStr(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
-<div class="line"><a name="l14739"></a><span class="lineno">14739</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaAllocateMemoryPages,%llu,%llu,%u,%u,%u,%u,%u,%u,%p,&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14740"></a><span class="lineno">14740</span>&#160;        vkMemReq.size,</div>
-<div class="line"><a name="l14741"></a><span class="lineno">14741</span>&#160;        vkMemReq.alignment,</div>
-<div class="line"><a name="l14742"></a><span class="lineno">14742</span>&#160;        vkMemReq.memoryTypeBits,</div>
-<div class="line"><a name="l14743"></a><span class="lineno">14743</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
-<div class="line"><a name="l14744"></a><span class="lineno">14744</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
-<div class="line"><a name="l14745"></a><span class="lineno">14745</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
-<div class="line"><a name="l14746"></a><span class="lineno">14746</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
-<div class="line"><a name="l14747"></a><span class="lineno">14747</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
-<div class="line"><a name="l14748"></a><span class="lineno">14748</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>);</div>
-<div class="line"><a name="l14749"></a><span class="lineno">14749</span>&#160;    PrintPointerList(allocationCount, pAllocations);</div>
-<div class="line"><a name="l14750"></a><span class="lineno">14750</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;,%s\n&quot;</span>, userDataStr.GetString());</div>
-<div class="line"><a name="l14751"></a><span class="lineno">14751</span>&#160;    Flush();</div>
-<div class="line"><a name="l14752"></a><span class="lineno">14752</span>&#160;}</div>
-<div class="line"><a name="l14753"></a><span class="lineno">14753</span>&#160; </div>
-<div class="line"><a name="l14754"></a><span class="lineno">14754</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordAllocateMemoryForBuffer(uint32_t frameIndex,</div>
-<div class="line"><a name="l14755"></a><span class="lineno">14755</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
-<div class="line"><a name="l14756"></a><span class="lineno">14756</span>&#160;    <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
-<div class="line"><a name="l14757"></a><span class="lineno">14757</span>&#160;    <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
-<div class="line"><a name="l14758"></a><span class="lineno">14758</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l14759"></a><span class="lineno">14759</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l14760"></a><span class="lineno">14760</span>&#160;{</div>
-<div class="line"><a name="l14761"></a><span class="lineno">14761</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14762"></a><span class="lineno">14762</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14763"></a><span class="lineno">14763</span>&#160; </div>
-<div class="line"><a name="l14764"></a><span class="lineno">14764</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14765"></a><span class="lineno">14765</span>&#160;    UserDataString userDataStr(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
-<div class="line"><a name="l14766"></a><span class="lineno">14766</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaAllocateMemoryForBuffer,%llu,%llu,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14767"></a><span class="lineno">14767</span>&#160;        vkMemReq.size,</div>
-<div class="line"><a name="l14768"></a><span class="lineno">14768</span>&#160;        vkMemReq.alignment,</div>
-<div class="line"><a name="l14769"></a><span class="lineno">14769</span>&#160;        vkMemReq.memoryTypeBits,</div>
-<div class="line"><a name="l14770"></a><span class="lineno">14770</span>&#160;        requiresDedicatedAllocation ? 1 : 0,</div>
-<div class="line"><a name="l14771"></a><span class="lineno">14771</span>&#160;        prefersDedicatedAllocation ? 1 : 0,</div>
-<div class="line"><a name="l14772"></a><span class="lineno">14772</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
-<div class="line"><a name="l14773"></a><span class="lineno">14773</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
-<div class="line"><a name="l14774"></a><span class="lineno">14774</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
-<div class="line"><a name="l14775"></a><span class="lineno">14775</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
-<div class="line"><a name="l14776"></a><span class="lineno">14776</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
-<div class="line"><a name="l14777"></a><span class="lineno">14777</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>,</div>
-<div class="line"><a name="l14778"></a><span class="lineno">14778</span>&#160;        allocation,</div>
-<div class="line"><a name="l14779"></a><span class="lineno">14779</span>&#160;        userDataStr.GetString());</div>
-<div class="line"><a name="l14780"></a><span class="lineno">14780</span>&#160;    Flush();</div>
-<div class="line"><a name="l14781"></a><span class="lineno">14781</span>&#160;}</div>
+<div class="line"><a name="l14737"></a><span class="lineno">14737</span>&#160;                <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;res &lt; VK_SUCCESS)</div>
+<div class="line"><a name="l14738"></a><span class="lineno">14738</span>&#160;                    <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l14739"></a><span class="lineno">14739</span>&#160; </div>
+<div class="line"><a name="l14740"></a><span class="lineno">14740</span>&#160;                pBlockVectorCtx-&gt;hasDefragmentationPlan = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l14741"></a><span class="lineno">14741</span>&#160;            }</div>
+<div class="line"><a name="l14742"></a><span class="lineno">14742</span>&#160; </div>
+<div class="line"><a name="l14743"></a><span class="lineno">14743</span>&#160;            <span class="keyword">const</span> uint32_t processed = pBlockVectorCtx-&gt;GetBlockVector()-&gt;ProcessDefragmentations(</div>
+<div class="line"><a name="l14744"></a><span class="lineno">14744</span>&#160;                pBlockVectorCtx,</div>
+<div class="line"><a name="l14745"></a><span class="lineno">14745</span>&#160;                pCurrentMove, movesLeft);</div>
+<div class="line"><a name="l14746"></a><span class="lineno">14746</span>&#160; </div>
+<div class="line"><a name="l14747"></a><span class="lineno">14747</span>&#160;            movesLeft -= processed;</div>
+<div class="line"><a name="l14748"></a><span class="lineno">14748</span>&#160;            pCurrentMove += processed;</div>
+<div class="line"><a name="l14749"></a><span class="lineno">14749</span>&#160;        }</div>
+<div class="line"><a name="l14750"></a><span class="lineno">14750</span>&#160;    }</div>
+<div class="line"><a name="l14751"></a><span class="lineno">14751</span>&#160; </div>
+<div class="line"><a name="l14752"></a><span class="lineno">14752</span>&#160;    <span class="comment">// Process custom pools.</span></div>
+<div class="line"><a name="l14753"></a><span class="lineno">14753</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();</div>
+<div class="line"><a name="l14754"></a><span class="lineno">14754</span>&#160;        customCtxIndex &lt; customCtxCount;</div>
+<div class="line"><a name="l14755"></a><span class="lineno">14755</span>&#160;        ++customCtxIndex)</div>
+<div class="line"><a name="l14756"></a><span class="lineno">14756</span>&#160;    {</div>
+<div class="line"><a name="l14757"></a><span class="lineno">14757</span>&#160;        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];</div>
+<div class="line"><a name="l14758"></a><span class="lineno">14758</span>&#160;        VMA_ASSERT(pBlockVectorCtx &amp;&amp; pBlockVectorCtx-&gt;GetBlockVector());</div>
+<div class="line"><a name="l14759"></a><span class="lineno">14759</span>&#160; </div>
+<div class="line"><a name="l14760"></a><span class="lineno">14760</span>&#160;        <span class="keywordflow">if</span>(!pBlockVectorCtx-&gt;hasDefragmentationPlan)</div>
+<div class="line"><a name="l14761"></a><span class="lineno">14761</span>&#160;        {</div>
+<div class="line"><a name="l14762"></a><span class="lineno">14762</span>&#160;            pBlockVectorCtx-&gt;GetBlockVector()-&gt;Defragment(</div>
+<div class="line"><a name="l14763"></a><span class="lineno">14763</span>&#160;                pBlockVectorCtx,</div>
+<div class="line"><a name="l14764"></a><span class="lineno">14764</span>&#160;                m_pStats, m_Flags,</div>
+<div class="line"><a name="l14765"></a><span class="lineno">14765</span>&#160;                m_MaxCpuBytesToMove, m_MaxCpuAllocationsToMove,</div>
+<div class="line"><a name="l14766"></a><span class="lineno">14766</span>&#160;                m_MaxGpuBytesToMove, m_MaxGpuAllocationsToMove,</div>
+<div class="line"><a name="l14767"></a><span class="lineno">14767</span>&#160;                VK_NULL_HANDLE);</div>
+<div class="line"><a name="l14768"></a><span class="lineno">14768</span>&#160; </div>
+<div class="line"><a name="l14769"></a><span class="lineno">14769</span>&#160;            <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;res &lt; VK_SUCCESS)</div>
+<div class="line"><a name="l14770"></a><span class="lineno">14770</span>&#160;                <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l14771"></a><span class="lineno">14771</span>&#160; </div>
+<div class="line"><a name="l14772"></a><span class="lineno">14772</span>&#160;            pBlockVectorCtx-&gt;hasDefragmentationPlan = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l14773"></a><span class="lineno">14773</span>&#160;        }</div>
+<div class="line"><a name="l14774"></a><span class="lineno">14774</span>&#160; </div>
+<div class="line"><a name="l14775"></a><span class="lineno">14775</span>&#160;        <span class="keyword">const</span> uint32_t processed = pBlockVectorCtx-&gt;GetBlockVector()-&gt;ProcessDefragmentations(</div>
+<div class="line"><a name="l14776"></a><span class="lineno">14776</span>&#160;            pBlockVectorCtx,</div>
+<div class="line"><a name="l14777"></a><span class="lineno">14777</span>&#160;            pCurrentMove, movesLeft);</div>
+<div class="line"><a name="l14778"></a><span class="lineno">14778</span>&#160; </div>
+<div class="line"><a name="l14779"></a><span class="lineno">14779</span>&#160;        movesLeft -= processed;</div>
+<div class="line"><a name="l14780"></a><span class="lineno">14780</span>&#160;        pCurrentMove += processed;</div>
+<div class="line"><a name="l14781"></a><span class="lineno">14781</span>&#160;    }</div>
 <div class="line"><a name="l14782"></a><span class="lineno">14782</span>&#160; </div>
-<div class="line"><a name="l14783"></a><span class="lineno">14783</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordAllocateMemoryForImage(uint32_t frameIndex,</div>
-<div class="line"><a name="l14784"></a><span class="lineno">14784</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
-<div class="line"><a name="l14785"></a><span class="lineno">14785</span>&#160;    <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
-<div class="line"><a name="l14786"></a><span class="lineno">14786</span>&#160;    <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
-<div class="line"><a name="l14787"></a><span class="lineno">14787</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l14788"></a><span class="lineno">14788</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l14789"></a><span class="lineno">14789</span>&#160;{</div>
-<div class="line"><a name="l14790"></a><span class="lineno">14790</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14791"></a><span class="lineno">14791</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14792"></a><span class="lineno">14792</span>&#160; </div>
-<div class="line"><a name="l14793"></a><span class="lineno">14793</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14794"></a><span class="lineno">14794</span>&#160;    UserDataString userDataStr(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
-<div class="line"><a name="l14795"></a><span class="lineno">14795</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaAllocateMemoryForImage,%llu,%llu,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14796"></a><span class="lineno">14796</span>&#160;        vkMemReq.size,</div>
-<div class="line"><a name="l14797"></a><span class="lineno">14797</span>&#160;        vkMemReq.alignment,</div>
-<div class="line"><a name="l14798"></a><span class="lineno">14798</span>&#160;        vkMemReq.memoryTypeBits,</div>
-<div class="line"><a name="l14799"></a><span class="lineno">14799</span>&#160;        requiresDedicatedAllocation ? 1 : 0,</div>
-<div class="line"><a name="l14800"></a><span class="lineno">14800</span>&#160;        prefersDedicatedAllocation ? 1 : 0,</div>
-<div class="line"><a name="l14801"></a><span class="lineno">14801</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
-<div class="line"><a name="l14802"></a><span class="lineno">14802</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
-<div class="line"><a name="l14803"></a><span class="lineno">14803</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
-<div class="line"><a name="l14804"></a><span class="lineno">14804</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
-<div class="line"><a name="l14805"></a><span class="lineno">14805</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
-<div class="line"><a name="l14806"></a><span class="lineno">14806</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>,</div>
-<div class="line"><a name="l14807"></a><span class="lineno">14807</span>&#160;        allocation,</div>
-<div class="line"><a name="l14808"></a><span class="lineno">14808</span>&#160;        userDataStr.GetString());</div>
-<div class="line"><a name="l14809"></a><span class="lineno">14809</span>&#160;    Flush();</div>
-<div class="line"><a name="l14810"></a><span class="lineno">14810</span>&#160;}</div>
-<div class="line"><a name="l14811"></a><span class="lineno">14811</span>&#160; </div>
-<div class="line"><a name="l14812"></a><span class="lineno">14812</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordFreeMemory(uint32_t frameIndex,</div>
-<div class="line"><a name="l14813"></a><span class="lineno">14813</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l14814"></a><span class="lineno">14814</span>&#160;{</div>
-<div class="line"><a name="l14815"></a><span class="lineno">14815</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14816"></a><span class="lineno">14816</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14817"></a><span class="lineno">14817</span>&#160; </div>
-<div class="line"><a name="l14818"></a><span class="lineno">14818</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14819"></a><span class="lineno">14819</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaFreeMemory,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14820"></a><span class="lineno">14820</span>&#160;        allocation);</div>
-<div class="line"><a name="l14821"></a><span class="lineno">14821</span>&#160;    Flush();</div>
-<div class="line"><a name="l14822"></a><span class="lineno">14822</span>&#160;}</div>
-<div class="line"><a name="l14823"></a><span class="lineno">14823</span>&#160; </div>
-<div class="line"><a name="l14824"></a><span class="lineno">14824</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordFreeMemoryPages(uint32_t frameIndex,</div>
-<div class="line"><a name="l14825"></a><span class="lineno">14825</span>&#160;    uint64_t allocationCount,</div>
-<div class="line"><a name="l14826"></a><span class="lineno">14826</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
-<div class="line"><a name="l14827"></a><span class="lineno">14827</span>&#160;{</div>
-<div class="line"><a name="l14828"></a><span class="lineno">14828</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14829"></a><span class="lineno">14829</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14830"></a><span class="lineno">14830</span>&#160; </div>
-<div class="line"><a name="l14831"></a><span class="lineno">14831</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14832"></a><span class="lineno">14832</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaFreeMemoryPages,&quot;</span>, callParams.threadId, callParams.time, frameIndex);</div>
-<div class="line"><a name="l14833"></a><span class="lineno">14833</span>&#160;    PrintPointerList(allocationCount, pAllocations);</div>
-<div class="line"><a name="l14834"></a><span class="lineno">14834</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;\n&quot;</span>);</div>
-<div class="line"><a name="l14835"></a><span class="lineno">14835</span>&#160;    Flush();</div>
-<div class="line"><a name="l14836"></a><span class="lineno">14836</span>&#160;}</div>
-<div class="line"><a name="l14837"></a><span class="lineno">14837</span>&#160; </div>
-<div class="line"><a name="l14838"></a><span class="lineno">14838</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordSetAllocationUserData(uint32_t frameIndex,</div>
-<div class="line"><a name="l14839"></a><span class="lineno">14839</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
-<div class="line"><a name="l14840"></a><span class="lineno">14840</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pUserData)</div>
-<div class="line"><a name="l14841"></a><span class="lineno">14841</span>&#160;{</div>
-<div class="line"><a name="l14842"></a><span class="lineno">14842</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14843"></a><span class="lineno">14843</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14844"></a><span class="lineno">14844</span>&#160; </div>
-<div class="line"><a name="l14845"></a><span class="lineno">14845</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14846"></a><span class="lineno">14846</span>&#160;    UserDataString userDataStr(</div>
-<div class="line"><a name="l14847"></a><span class="lineno">14847</span>&#160;        allocation-&gt;IsUserDataString() ? <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a> : 0,</div>
-<div class="line"><a name="l14848"></a><span class="lineno">14848</span>&#160;        pUserData);</div>
-<div class="line"><a name="l14849"></a><span class="lineno">14849</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaSetAllocationUserData,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14850"></a><span class="lineno">14850</span>&#160;        allocation,</div>
-<div class="line"><a name="l14851"></a><span class="lineno">14851</span>&#160;        userDataStr.GetString());</div>
-<div class="line"><a name="l14852"></a><span class="lineno">14852</span>&#160;    Flush();</div>
-<div class="line"><a name="l14853"></a><span class="lineno">14853</span>&#160;}</div>
-<div class="line"><a name="l14854"></a><span class="lineno">14854</span>&#160; </div>
-<div class="line"><a name="l14855"></a><span class="lineno">14855</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordCreateLostAllocation(uint32_t frameIndex,</div>
-<div class="line"><a name="l14856"></a><span class="lineno">14856</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l14857"></a><span class="lineno">14857</span>&#160;{</div>
-<div class="line"><a name="l14858"></a><span class="lineno">14858</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14859"></a><span class="lineno">14859</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l14783"></a><span class="lineno">14783</span>&#160;    pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a> = pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a> - movesLeft;</div>
+<div class="line"><a name="l14784"></a><span class="lineno">14784</span>&#160; </div>
+<div class="line"><a name="l14785"></a><span class="lineno">14785</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l14786"></a><span class="lineno">14786</span>&#160;}</div>
+<div class="line"><a name="l14787"></a><span class="lineno">14787</span>&#160;VkResult VmaDefragmentationContext_T::DefragmentPassEnd()</div>
+<div class="line"><a name="l14788"></a><span class="lineno">14788</span>&#160;{</div>
+<div class="line"><a name="l14789"></a><span class="lineno">14789</span>&#160;    VkResult res = VK_SUCCESS;</div>
+<div class="line"><a name="l14790"></a><span class="lineno">14790</span>&#160; </div>
+<div class="line"><a name="l14791"></a><span class="lineno">14791</span>&#160;    <span class="comment">// Process default pools.</span></div>
+<div class="line"><a name="l14792"></a><span class="lineno">14792</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0;</div>
+<div class="line"><a name="l14793"></a><span class="lineno">14793</span>&#160;        memTypeIndex &lt; m_hAllocator-&gt;GetMemoryTypeCount();</div>
+<div class="line"><a name="l14794"></a><span class="lineno">14794</span>&#160;        ++memTypeIndex)</div>
+<div class="line"><a name="l14795"></a><span class="lineno">14795</span>&#160;    {</div>
+<div class="line"><a name="l14796"></a><span class="lineno">14796</span>&#160;        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];</div>
+<div class="line"><a name="l14797"></a><span class="lineno">14797</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx)</div>
+<div class="line"><a name="l14798"></a><span class="lineno">14798</span>&#160;        {</div>
+<div class="line"><a name="l14799"></a><span class="lineno">14799</span>&#160;            VMA_ASSERT(pBlockVectorCtx-&gt;GetBlockVector());</div>
+<div class="line"><a name="l14800"></a><span class="lineno">14800</span>&#160; </div>
+<div class="line"><a name="l14801"></a><span class="lineno">14801</span>&#160;            <span class="keywordflow">if</span>(!pBlockVectorCtx-&gt;hasDefragmentationPlan)</div>
+<div class="line"><a name="l14802"></a><span class="lineno">14802</span>&#160;            {</div>
+<div class="line"><a name="l14803"></a><span class="lineno">14803</span>&#160;                res = VK_NOT_READY;</div>
+<div class="line"><a name="l14804"></a><span class="lineno">14804</span>&#160;                <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l14805"></a><span class="lineno">14805</span>&#160;            }</div>
+<div class="line"><a name="l14806"></a><span class="lineno">14806</span>&#160; </div>
+<div class="line"><a name="l14807"></a><span class="lineno">14807</span>&#160;            pBlockVectorCtx-&gt;GetBlockVector()-&gt;CommitDefragmentations(</div>
+<div class="line"><a name="l14808"></a><span class="lineno">14808</span>&#160;                pBlockVectorCtx, m_pStats);</div>
+<div class="line"><a name="l14809"></a><span class="lineno">14809</span>&#160; </div>
+<div class="line"><a name="l14810"></a><span class="lineno">14810</span>&#160;            <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;defragmentationMoves.size() != pBlockVectorCtx-&gt;defragmentationMovesCommitted)</div>
+<div class="line"><a name="l14811"></a><span class="lineno">14811</span>&#160;                res = VK_NOT_READY;</div>
+<div class="line"><a name="l14812"></a><span class="lineno">14812</span>&#160;        }</div>
+<div class="line"><a name="l14813"></a><span class="lineno">14813</span>&#160;    }</div>
+<div class="line"><a name="l14814"></a><span class="lineno">14814</span>&#160; </div>
+<div class="line"><a name="l14815"></a><span class="lineno">14815</span>&#160;    <span class="comment">// Process custom pools.</span></div>
+<div class="line"><a name="l14816"></a><span class="lineno">14816</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();</div>
+<div class="line"><a name="l14817"></a><span class="lineno">14817</span>&#160;        customCtxIndex &lt; customCtxCount;</div>
+<div class="line"><a name="l14818"></a><span class="lineno">14818</span>&#160;        ++customCtxIndex)</div>
+<div class="line"><a name="l14819"></a><span class="lineno">14819</span>&#160;    {</div>
+<div class="line"><a name="l14820"></a><span class="lineno">14820</span>&#160;        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];</div>
+<div class="line"><a name="l14821"></a><span class="lineno">14821</span>&#160;        VMA_ASSERT(pBlockVectorCtx &amp;&amp; pBlockVectorCtx-&gt;GetBlockVector());</div>
+<div class="line"><a name="l14822"></a><span class="lineno">14822</span>&#160; </div>
+<div class="line"><a name="l14823"></a><span class="lineno">14823</span>&#160;        <span class="keywordflow">if</span>(!pBlockVectorCtx-&gt;hasDefragmentationPlan)</div>
+<div class="line"><a name="l14824"></a><span class="lineno">14824</span>&#160;        {</div>
+<div class="line"><a name="l14825"></a><span class="lineno">14825</span>&#160;            res = VK_NOT_READY;</div>
+<div class="line"><a name="l14826"></a><span class="lineno">14826</span>&#160;            <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l14827"></a><span class="lineno">14827</span>&#160;        }</div>
+<div class="line"><a name="l14828"></a><span class="lineno">14828</span>&#160; </div>
+<div class="line"><a name="l14829"></a><span class="lineno">14829</span>&#160;        pBlockVectorCtx-&gt;GetBlockVector()-&gt;CommitDefragmentations(</div>
+<div class="line"><a name="l14830"></a><span class="lineno">14830</span>&#160;            pBlockVectorCtx, m_pStats);</div>
+<div class="line"><a name="l14831"></a><span class="lineno">14831</span>&#160; </div>
+<div class="line"><a name="l14832"></a><span class="lineno">14832</span>&#160;        <span class="keywordflow">if</span>(pBlockVectorCtx-&gt;defragmentationMoves.size() != pBlockVectorCtx-&gt;defragmentationMovesCommitted)</div>
+<div class="line"><a name="l14833"></a><span class="lineno">14833</span>&#160;            res = VK_NOT_READY;</div>
+<div class="line"><a name="l14834"></a><span class="lineno">14834</span>&#160;    }</div>
+<div class="line"><a name="l14835"></a><span class="lineno">14835</span>&#160; </div>
+<div class="line"><a name="l14836"></a><span class="lineno">14836</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l14837"></a><span class="lineno">14837</span>&#160;}</div>
+<div class="line"><a name="l14838"></a><span class="lineno">14838</span>&#160; </div>
+<div class="line"><a name="l14840"></a><span class="lineno">14840</span>&#160;<span class="comment">// VmaRecorder</span></div>
+<div class="line"><a name="l14841"></a><span class="lineno">14841</span>&#160; </div>
+<div class="line"><a name="l14842"></a><span class="lineno">14842</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l14843"></a><span class="lineno">14843</span>&#160; </div>
+<div class="line"><a name="l14844"></a><span class="lineno">14844</span>&#160;VmaRecorder::VmaRecorder() :</div>
+<div class="line"><a name="l14845"></a><span class="lineno">14845</span>&#160;    m_UseMutex(true),</div>
+<div class="line"><a name="l14846"></a><span class="lineno">14846</span>&#160;    m_Flags(0),</div>
+<div class="line"><a name="l14847"></a><span class="lineno">14847</span>&#160;    m_File(VMA_NULL),</div>
+<div class="line"><a name="l14848"></a><span class="lineno">14848</span>&#160;    m_Freq(INT64_MAX),</div>
+<div class="line"><a name="l14849"></a><span class="lineno">14849</span>&#160;    m_StartCounter(INT64_MAX)</div>
+<div class="line"><a name="l14850"></a><span class="lineno">14850</span>&#160;{</div>
+<div class="line"><a name="l14851"></a><span class="lineno">14851</span>&#160;}</div>
+<div class="line"><a name="l14852"></a><span class="lineno">14852</span>&#160; </div>
+<div class="line"><a name="l14853"></a><span class="lineno">14853</span>&#160;VkResult VmaRecorder::Init(<span class="keyword">const</span> <a class="code" href="struct_vma_record_settings.html">VmaRecordSettings</a>&amp; settings, <span class="keywordtype">bool</span> useMutex)</div>
+<div class="line"><a name="l14854"></a><span class="lineno">14854</span>&#160;{</div>
+<div class="line"><a name="l14855"></a><span class="lineno">14855</span>&#160;    m_UseMutex = useMutex;</div>
+<div class="line"><a name="l14856"></a><span class="lineno">14856</span>&#160;    m_Flags = settings.<a class="code" href="struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a">flags</a>;</div>
+<div class="line"><a name="l14857"></a><span class="lineno">14857</span>&#160; </div>
+<div class="line"><a name="l14858"></a><span class="lineno">14858</span>&#160;    QueryPerformanceFrequency((LARGE_INTEGER*)&amp;m_Freq);</div>
+<div class="line"><a name="l14859"></a><span class="lineno">14859</span>&#160;    QueryPerformanceCounter((LARGE_INTEGER*)&amp;m_StartCounter);</div>
 <div class="line"><a name="l14860"></a><span class="lineno">14860</span>&#160; </div>
-<div class="line"><a name="l14861"></a><span class="lineno">14861</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14862"></a><span class="lineno">14862</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaCreateLostAllocation,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14863"></a><span class="lineno">14863</span>&#160;        allocation);</div>
-<div class="line"><a name="l14864"></a><span class="lineno">14864</span>&#160;    Flush();</div>
-<div class="line"><a name="l14865"></a><span class="lineno">14865</span>&#160;}</div>
-<div class="line"><a name="l14866"></a><span class="lineno">14866</span>&#160; </div>
-<div class="line"><a name="l14867"></a><span class="lineno">14867</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordMapMemory(uint32_t frameIndex,</div>
-<div class="line"><a name="l14868"></a><span class="lineno">14868</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l14869"></a><span class="lineno">14869</span>&#160;{</div>
-<div class="line"><a name="l14870"></a><span class="lineno">14870</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14871"></a><span class="lineno">14871</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14872"></a><span class="lineno">14872</span>&#160; </div>
-<div class="line"><a name="l14873"></a><span class="lineno">14873</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14874"></a><span class="lineno">14874</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaMapMemory,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14875"></a><span class="lineno">14875</span>&#160;        allocation);</div>
-<div class="line"><a name="l14876"></a><span class="lineno">14876</span>&#160;    Flush();</div>
-<div class="line"><a name="l14877"></a><span class="lineno">14877</span>&#160;}</div>
-<div class="line"><a name="l14878"></a><span class="lineno">14878</span>&#160; </div>
-<div class="line"><a name="l14879"></a><span class="lineno">14879</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordUnmapMemory(uint32_t frameIndex,</div>
-<div class="line"><a name="l14880"></a><span class="lineno">14880</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l14881"></a><span class="lineno">14881</span>&#160;{</div>
-<div class="line"><a name="l14882"></a><span class="lineno">14882</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14883"></a><span class="lineno">14883</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14884"></a><span class="lineno">14884</span>&#160; </div>
-<div class="line"><a name="l14885"></a><span class="lineno">14885</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14886"></a><span class="lineno">14886</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaUnmapMemory,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14887"></a><span class="lineno">14887</span>&#160;        allocation);</div>
-<div class="line"><a name="l14888"></a><span class="lineno">14888</span>&#160;    Flush();</div>
-<div class="line"><a name="l14889"></a><span class="lineno">14889</span>&#160;}</div>
-<div class="line"><a name="l14890"></a><span class="lineno">14890</span>&#160; </div>
-<div class="line"><a name="l14891"></a><span class="lineno">14891</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordFlushAllocation(uint32_t frameIndex,</div>
-<div class="line"><a name="l14892"></a><span class="lineno">14892</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</div>
-<div class="line"><a name="l14893"></a><span class="lineno">14893</span>&#160;{</div>
-<div class="line"><a name="l14894"></a><span class="lineno">14894</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14895"></a><span class="lineno">14895</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14896"></a><span class="lineno">14896</span>&#160; </div>
-<div class="line"><a name="l14897"></a><span class="lineno">14897</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14898"></a><span class="lineno">14898</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaFlushAllocation,%p,%llu,%llu\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14899"></a><span class="lineno">14899</span>&#160;        allocation,</div>
-<div class="line"><a name="l14900"></a><span class="lineno">14900</span>&#160;        offset,</div>
-<div class="line"><a name="l14901"></a><span class="lineno">14901</span>&#160;        size);</div>
-<div class="line"><a name="l14902"></a><span class="lineno">14902</span>&#160;    Flush();</div>
-<div class="line"><a name="l14903"></a><span class="lineno">14903</span>&#160;}</div>
-<div class="line"><a name="l14904"></a><span class="lineno">14904</span>&#160; </div>
-<div class="line"><a name="l14905"></a><span class="lineno">14905</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordInvalidateAllocation(uint32_t frameIndex,</div>
-<div class="line"><a name="l14906"></a><span class="lineno">14906</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</div>
-<div class="line"><a name="l14907"></a><span class="lineno">14907</span>&#160;{</div>
-<div class="line"><a name="l14908"></a><span class="lineno">14908</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14909"></a><span class="lineno">14909</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14910"></a><span class="lineno">14910</span>&#160; </div>
-<div class="line"><a name="l14911"></a><span class="lineno">14911</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14912"></a><span class="lineno">14912</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaInvalidateAllocation,%p,%llu,%llu\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14913"></a><span class="lineno">14913</span>&#160;        allocation,</div>
-<div class="line"><a name="l14914"></a><span class="lineno">14914</span>&#160;        offset,</div>
-<div class="line"><a name="l14915"></a><span class="lineno">14915</span>&#160;        size);</div>
-<div class="line"><a name="l14916"></a><span class="lineno">14916</span>&#160;    Flush();</div>
-<div class="line"><a name="l14917"></a><span class="lineno">14917</span>&#160;}</div>
-<div class="line"><a name="l14918"></a><span class="lineno">14918</span>&#160; </div>
-<div class="line"><a name="l14919"></a><span class="lineno">14919</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordCreateBuffer(uint32_t frameIndex,</div>
-<div class="line"><a name="l14920"></a><span class="lineno">14920</span>&#160;    <span class="keyword">const</span> VkBufferCreateInfo&amp; bufCreateInfo,</div>
-<div class="line"><a name="l14921"></a><span class="lineno">14921</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; allocCreateInfo,</div>
-<div class="line"><a name="l14922"></a><span class="lineno">14922</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l14923"></a><span class="lineno">14923</span>&#160;{</div>
-<div class="line"><a name="l14924"></a><span class="lineno">14924</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14925"></a><span class="lineno">14925</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14926"></a><span class="lineno">14926</span>&#160; </div>
-<div class="line"><a name="l14927"></a><span class="lineno">14927</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14928"></a><span class="lineno">14928</span>&#160;    UserDataString userDataStr(allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
-<div class="line"><a name="l14929"></a><span class="lineno">14929</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaCreateBuffer,%u,%llu,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14930"></a><span class="lineno">14930</span>&#160;        bufCreateInfo.flags,</div>
-<div class="line"><a name="l14931"></a><span class="lineno">14931</span>&#160;        bufCreateInfo.size,</div>
-<div class="line"><a name="l14932"></a><span class="lineno">14932</span>&#160;        bufCreateInfo.usage,</div>
-<div class="line"><a name="l14933"></a><span class="lineno">14933</span>&#160;        bufCreateInfo.sharingMode,</div>
-<div class="line"><a name="l14934"></a><span class="lineno">14934</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
-<div class="line"><a name="l14935"></a><span class="lineno">14935</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
-<div class="line"><a name="l14936"></a><span class="lineno">14936</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
-<div class="line"><a name="l14937"></a><span class="lineno">14937</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
-<div class="line"><a name="l14938"></a><span class="lineno">14938</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
-<div class="line"><a name="l14939"></a><span class="lineno">14939</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>,</div>
-<div class="line"><a name="l14940"></a><span class="lineno">14940</span>&#160;        allocation,</div>
-<div class="line"><a name="l14941"></a><span class="lineno">14941</span>&#160;        userDataStr.GetString());</div>
-<div class="line"><a name="l14942"></a><span class="lineno">14942</span>&#160;    Flush();</div>
-<div class="line"><a name="l14943"></a><span class="lineno">14943</span>&#160;}</div>
-<div class="line"><a name="l14944"></a><span class="lineno">14944</span>&#160; </div>
-<div class="line"><a name="l14945"></a><span class="lineno">14945</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordCreateImage(uint32_t frameIndex,</div>
-<div class="line"><a name="l14946"></a><span class="lineno">14946</span>&#160;    <span class="keyword">const</span> VkImageCreateInfo&amp; imageCreateInfo,</div>
-<div class="line"><a name="l14947"></a><span class="lineno">14947</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; allocCreateInfo,</div>
-<div class="line"><a name="l14948"></a><span class="lineno">14948</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l14949"></a><span class="lineno">14949</span>&#160;{</div>
-<div class="line"><a name="l14950"></a><span class="lineno">14950</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14951"></a><span class="lineno">14951</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14952"></a><span class="lineno">14952</span>&#160; </div>
-<div class="line"><a name="l14953"></a><span class="lineno">14953</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14954"></a><span class="lineno">14954</span>&#160;    UserDataString userDataStr(allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
-<div class="line"><a name="l14955"></a><span class="lineno">14955</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaCreateImage,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14956"></a><span class="lineno">14956</span>&#160;        imageCreateInfo.flags,</div>
-<div class="line"><a name="l14957"></a><span class="lineno">14957</span>&#160;        imageCreateInfo.imageType,</div>
-<div class="line"><a name="l14958"></a><span class="lineno">14958</span>&#160;        imageCreateInfo.format,</div>
-<div class="line"><a name="l14959"></a><span class="lineno">14959</span>&#160;        imageCreateInfo.extent.width,</div>
-<div class="line"><a name="l14960"></a><span class="lineno">14960</span>&#160;        imageCreateInfo.extent.height,</div>
-<div class="line"><a name="l14961"></a><span class="lineno">14961</span>&#160;        imageCreateInfo.extent.depth,</div>
-<div class="line"><a name="l14962"></a><span class="lineno">14962</span>&#160;        imageCreateInfo.mipLevels,</div>
-<div class="line"><a name="l14963"></a><span class="lineno">14963</span>&#160;        imageCreateInfo.arrayLayers,</div>
-<div class="line"><a name="l14964"></a><span class="lineno">14964</span>&#160;        imageCreateInfo.samples,</div>
-<div class="line"><a name="l14965"></a><span class="lineno">14965</span>&#160;        imageCreateInfo.tiling,</div>
-<div class="line"><a name="l14966"></a><span class="lineno">14966</span>&#160;        imageCreateInfo.usage,</div>
-<div class="line"><a name="l14967"></a><span class="lineno">14967</span>&#160;        imageCreateInfo.sharingMode,</div>
-<div class="line"><a name="l14968"></a><span class="lineno">14968</span>&#160;        imageCreateInfo.initialLayout,</div>
-<div class="line"><a name="l14969"></a><span class="lineno">14969</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
-<div class="line"><a name="l14970"></a><span class="lineno">14970</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
-<div class="line"><a name="l14971"></a><span class="lineno">14971</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
-<div class="line"><a name="l14972"></a><span class="lineno">14972</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
-<div class="line"><a name="l14973"></a><span class="lineno">14973</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
-<div class="line"><a name="l14974"></a><span class="lineno">14974</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>,</div>
-<div class="line"><a name="l14975"></a><span class="lineno">14975</span>&#160;        allocation,</div>
-<div class="line"><a name="l14976"></a><span class="lineno">14976</span>&#160;        userDataStr.GetString());</div>
-<div class="line"><a name="l14977"></a><span class="lineno">14977</span>&#160;    Flush();</div>
-<div class="line"><a name="l14978"></a><span class="lineno">14978</span>&#160;}</div>
-<div class="line"><a name="l14979"></a><span class="lineno">14979</span>&#160; </div>
-<div class="line"><a name="l14980"></a><span class="lineno">14980</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDestroyBuffer(uint32_t frameIndex,</div>
-<div class="line"><a name="l14981"></a><span class="lineno">14981</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l14982"></a><span class="lineno">14982</span>&#160;{</div>
-<div class="line"><a name="l14983"></a><span class="lineno">14983</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14984"></a><span class="lineno">14984</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14985"></a><span class="lineno">14985</span>&#160; </div>
-<div class="line"><a name="l14986"></a><span class="lineno">14986</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14987"></a><span class="lineno">14987</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDestroyBuffer,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l14988"></a><span class="lineno">14988</span>&#160;        allocation);</div>
-<div class="line"><a name="l14989"></a><span class="lineno">14989</span>&#160;    Flush();</div>
-<div class="line"><a name="l14990"></a><span class="lineno">14990</span>&#160;}</div>
+<div class="line"><a name="l14861"></a><span class="lineno">14861</span>&#160;    <span class="comment">// Open file for writing.</span></div>
+<div class="line"><a name="l14862"></a><span class="lineno">14862</span>&#160;    errno_t err = fopen_s(&amp;m_File, settings.<a class="code" href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d">pFilePath</a>, <span class="stringliteral">&quot;wb&quot;</span>);</div>
+<div class="line"><a name="l14863"></a><span class="lineno">14863</span>&#160;    <span class="keywordflow">if</span>(err != 0)</div>
+<div class="line"><a name="l14864"></a><span class="lineno">14864</span>&#160;    {</div>
+<div class="line"><a name="l14865"></a><span class="lineno">14865</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_INITIALIZATION_FAILED;</div>
+<div class="line"><a name="l14866"></a><span class="lineno">14866</span>&#160;    }</div>
+<div class="line"><a name="l14867"></a><span class="lineno">14867</span>&#160; </div>
+<div class="line"><a name="l14868"></a><span class="lineno">14868</span>&#160;    <span class="comment">// Write header.</span></div>
+<div class="line"><a name="l14869"></a><span class="lineno">14869</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%s\n&quot;</span>, <span class="stringliteral">&quot;Vulkan Memory Allocator,Calls recording&quot;</span>);</div>
+<div class="line"><a name="l14870"></a><span class="lineno">14870</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%s\n&quot;</span>, <span class="stringliteral">&quot;1,8&quot;</span>);</div>
+<div class="line"><a name="l14871"></a><span class="lineno">14871</span>&#160; </div>
+<div class="line"><a name="l14872"></a><span class="lineno">14872</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l14873"></a><span class="lineno">14873</span>&#160;}</div>
+<div class="line"><a name="l14874"></a><span class="lineno">14874</span>&#160; </div>
+<div class="line"><a name="l14875"></a><span class="lineno">14875</span>&#160;VmaRecorder::~VmaRecorder()</div>
+<div class="line"><a name="l14876"></a><span class="lineno">14876</span>&#160;{</div>
+<div class="line"><a name="l14877"></a><span class="lineno">14877</span>&#160;    <span class="keywordflow">if</span>(m_File != VMA_NULL)</div>
+<div class="line"><a name="l14878"></a><span class="lineno">14878</span>&#160;    {</div>
+<div class="line"><a name="l14879"></a><span class="lineno">14879</span>&#160;        fclose(m_File);</div>
+<div class="line"><a name="l14880"></a><span class="lineno">14880</span>&#160;    }</div>
+<div class="line"><a name="l14881"></a><span class="lineno">14881</span>&#160;}</div>
+<div class="line"><a name="l14882"></a><span class="lineno">14882</span>&#160; </div>
+<div class="line"><a name="l14883"></a><span class="lineno">14883</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordCreateAllocator(uint32_t frameIndex)</div>
+<div class="line"><a name="l14884"></a><span class="lineno">14884</span>&#160;{</div>
+<div class="line"><a name="l14885"></a><span class="lineno">14885</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l14886"></a><span class="lineno">14886</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l14887"></a><span class="lineno">14887</span>&#160; </div>
+<div class="line"><a name="l14888"></a><span class="lineno">14888</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l14889"></a><span class="lineno">14889</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaCreateAllocator\n&quot;</span>, callParams.threadId, callParams.time, frameIndex);</div>
+<div class="line"><a name="l14890"></a><span class="lineno">14890</span>&#160;    Flush();</div>
+<div class="line"><a name="l14891"></a><span class="lineno">14891</span>&#160;}</div>
+<div class="line"><a name="l14892"></a><span class="lineno">14892</span>&#160; </div>
+<div class="line"><a name="l14893"></a><span class="lineno">14893</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDestroyAllocator(uint32_t frameIndex)</div>
+<div class="line"><a name="l14894"></a><span class="lineno">14894</span>&#160;{</div>
+<div class="line"><a name="l14895"></a><span class="lineno">14895</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l14896"></a><span class="lineno">14896</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l14897"></a><span class="lineno">14897</span>&#160; </div>
+<div class="line"><a name="l14898"></a><span class="lineno">14898</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l14899"></a><span class="lineno">14899</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDestroyAllocator\n&quot;</span>, callParams.threadId, callParams.time, frameIndex);</div>
+<div class="line"><a name="l14900"></a><span class="lineno">14900</span>&#160;    Flush();</div>
+<div class="line"><a name="l14901"></a><span class="lineno">14901</span>&#160;}</div>
+<div class="line"><a name="l14902"></a><span class="lineno">14902</span>&#160; </div>
+<div class="line"><a name="l14903"></a><span class="lineno">14903</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordCreatePool(uint32_t frameIndex, <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>&amp; createInfo, <a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
+<div class="line"><a name="l14904"></a><span class="lineno">14904</span>&#160;{</div>
+<div class="line"><a name="l14905"></a><span class="lineno">14905</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l14906"></a><span class="lineno">14906</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l14907"></a><span class="lineno">14907</span>&#160; </div>
+<div class="line"><a name="l14908"></a><span class="lineno">14908</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l14909"></a><span class="lineno">14909</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaCreatePool,%u,%u,%llu,%llu,%llu,%u,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l14910"></a><span class="lineno">14910</span>&#160;        createInfo.<a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a>,</div>
+<div class="line"><a name="l14911"></a><span class="lineno">14911</span>&#160;        createInfo.<a class="code" href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446">flags</a>,</div>
+<div class="line"><a name="l14912"></a><span class="lineno">14912</span>&#160;        createInfo.<a class="code" href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676">blockSize</a>,</div>
+<div class="line"><a name="l14913"></a><span class="lineno">14913</span>&#160;        (uint64_t)createInfo.<a class="code" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae">minBlockCount</a>,</div>
+<div class="line"><a name="l14914"></a><span class="lineno">14914</span>&#160;        (uint64_t)createInfo.<a class="code" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">maxBlockCount</a>,</div>
+<div class="line"><a name="l14915"></a><span class="lineno">14915</span>&#160;        createInfo.<a class="code" href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa">frameInUseCount</a>,</div>
+<div class="line"><a name="l14916"></a><span class="lineno">14916</span>&#160;        pool);</div>
+<div class="line"><a name="l14917"></a><span class="lineno">14917</span>&#160;    Flush();</div>
+<div class="line"><a name="l14918"></a><span class="lineno">14918</span>&#160;}</div>
+<div class="line"><a name="l14919"></a><span class="lineno">14919</span>&#160; </div>
+<div class="line"><a name="l14920"></a><span class="lineno">14920</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDestroyPool(uint32_t frameIndex, <a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
+<div class="line"><a name="l14921"></a><span class="lineno">14921</span>&#160;{</div>
+<div class="line"><a name="l14922"></a><span class="lineno">14922</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l14923"></a><span class="lineno">14923</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l14924"></a><span class="lineno">14924</span>&#160; </div>
+<div class="line"><a name="l14925"></a><span class="lineno">14925</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l14926"></a><span class="lineno">14926</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDestroyPool,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l14927"></a><span class="lineno">14927</span>&#160;        pool);</div>
+<div class="line"><a name="l14928"></a><span class="lineno">14928</span>&#160;    Flush();</div>
+<div class="line"><a name="l14929"></a><span class="lineno">14929</span>&#160;}</div>
+<div class="line"><a name="l14930"></a><span class="lineno">14930</span>&#160; </div>
+<div class="line"><a name="l14931"></a><span class="lineno">14931</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordAllocateMemory(uint32_t frameIndex,</div>
+<div class="line"><a name="l14932"></a><span class="lineno">14932</span>&#160;        <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
+<div class="line"><a name="l14933"></a><span class="lineno">14933</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l14934"></a><span class="lineno">14934</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l14935"></a><span class="lineno">14935</span>&#160;{</div>
+<div class="line"><a name="l14936"></a><span class="lineno">14936</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l14937"></a><span class="lineno">14937</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l14938"></a><span class="lineno">14938</span>&#160; </div>
+<div class="line"><a name="l14939"></a><span class="lineno">14939</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l14940"></a><span class="lineno">14940</span>&#160;    UserDataString userDataStr(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
+<div class="line"><a name="l14941"></a><span class="lineno">14941</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaAllocateMemory,%llu,%llu,%u,%u,%u,%u,%u,%u,%p,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l14942"></a><span class="lineno">14942</span>&#160;        vkMemReq.size,</div>
+<div class="line"><a name="l14943"></a><span class="lineno">14943</span>&#160;        vkMemReq.alignment,</div>
+<div class="line"><a name="l14944"></a><span class="lineno">14944</span>&#160;        vkMemReq.memoryTypeBits,</div>
+<div class="line"><a name="l14945"></a><span class="lineno">14945</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
+<div class="line"><a name="l14946"></a><span class="lineno">14946</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
+<div class="line"><a name="l14947"></a><span class="lineno">14947</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
+<div class="line"><a name="l14948"></a><span class="lineno">14948</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
+<div class="line"><a name="l14949"></a><span class="lineno">14949</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
+<div class="line"><a name="l14950"></a><span class="lineno">14950</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>,</div>
+<div class="line"><a name="l14951"></a><span class="lineno">14951</span>&#160;        allocation,</div>
+<div class="line"><a name="l14952"></a><span class="lineno">14952</span>&#160;        userDataStr.GetString());</div>
+<div class="line"><a name="l14953"></a><span class="lineno">14953</span>&#160;    Flush();</div>
+<div class="line"><a name="l14954"></a><span class="lineno">14954</span>&#160;}</div>
+<div class="line"><a name="l14955"></a><span class="lineno">14955</span>&#160; </div>
+<div class="line"><a name="l14956"></a><span class="lineno">14956</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordAllocateMemoryPages(uint32_t frameIndex,</div>
+<div class="line"><a name="l14957"></a><span class="lineno">14957</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
+<div class="line"><a name="l14958"></a><span class="lineno">14958</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l14959"></a><span class="lineno">14959</span>&#160;    uint64_t allocationCount,</div>
+<div class="line"><a name="l14960"></a><span class="lineno">14960</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
+<div class="line"><a name="l14961"></a><span class="lineno">14961</span>&#160;{</div>
+<div class="line"><a name="l14962"></a><span class="lineno">14962</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l14963"></a><span class="lineno">14963</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l14964"></a><span class="lineno">14964</span>&#160; </div>
+<div class="line"><a name="l14965"></a><span class="lineno">14965</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l14966"></a><span class="lineno">14966</span>&#160;    UserDataString userDataStr(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
+<div class="line"><a name="l14967"></a><span class="lineno">14967</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaAllocateMemoryPages,%llu,%llu,%u,%u,%u,%u,%u,%u,%p,&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l14968"></a><span class="lineno">14968</span>&#160;        vkMemReq.size,</div>
+<div class="line"><a name="l14969"></a><span class="lineno">14969</span>&#160;        vkMemReq.alignment,</div>
+<div class="line"><a name="l14970"></a><span class="lineno">14970</span>&#160;        vkMemReq.memoryTypeBits,</div>
+<div class="line"><a name="l14971"></a><span class="lineno">14971</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
+<div class="line"><a name="l14972"></a><span class="lineno">14972</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
+<div class="line"><a name="l14973"></a><span class="lineno">14973</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
+<div class="line"><a name="l14974"></a><span class="lineno">14974</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
+<div class="line"><a name="l14975"></a><span class="lineno">14975</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
+<div class="line"><a name="l14976"></a><span class="lineno">14976</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>);</div>
+<div class="line"><a name="l14977"></a><span class="lineno">14977</span>&#160;    PrintPointerList(allocationCount, pAllocations);</div>
+<div class="line"><a name="l14978"></a><span class="lineno">14978</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;,%s\n&quot;</span>, userDataStr.GetString());</div>
+<div class="line"><a name="l14979"></a><span class="lineno">14979</span>&#160;    Flush();</div>
+<div class="line"><a name="l14980"></a><span class="lineno">14980</span>&#160;}</div>
+<div class="line"><a name="l14981"></a><span class="lineno">14981</span>&#160; </div>
+<div class="line"><a name="l14982"></a><span class="lineno">14982</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordAllocateMemoryForBuffer(uint32_t frameIndex,</div>
+<div class="line"><a name="l14983"></a><span class="lineno">14983</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
+<div class="line"><a name="l14984"></a><span class="lineno">14984</span>&#160;    <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
+<div class="line"><a name="l14985"></a><span class="lineno">14985</span>&#160;    <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
+<div class="line"><a name="l14986"></a><span class="lineno">14986</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l14987"></a><span class="lineno">14987</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l14988"></a><span class="lineno">14988</span>&#160;{</div>
+<div class="line"><a name="l14989"></a><span class="lineno">14989</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l14990"></a><span class="lineno">14990</span>&#160;    GetBasicParams(callParams);</div>
 <div class="line"><a name="l14991"></a><span class="lineno">14991</span>&#160; </div>
-<div class="line"><a name="l14992"></a><span class="lineno">14992</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDestroyImage(uint32_t frameIndex,</div>
-<div class="line"><a name="l14993"></a><span class="lineno">14993</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l14994"></a><span class="lineno">14994</span>&#160;{</div>
-<div class="line"><a name="l14995"></a><span class="lineno">14995</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l14996"></a><span class="lineno">14996</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l14997"></a><span class="lineno">14997</span>&#160; </div>
-<div class="line"><a name="l14998"></a><span class="lineno">14998</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l14999"></a><span class="lineno">14999</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDestroyImage,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l15000"></a><span class="lineno">15000</span>&#160;        allocation);</div>
-<div class="line"><a name="l15001"></a><span class="lineno">15001</span>&#160;    Flush();</div>
-<div class="line"><a name="l15002"></a><span class="lineno">15002</span>&#160;}</div>
-<div class="line"><a name="l15003"></a><span class="lineno">15003</span>&#160; </div>
-<div class="line"><a name="l15004"></a><span class="lineno">15004</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordTouchAllocation(uint32_t frameIndex,</div>
-<div class="line"><a name="l15005"></a><span class="lineno">15005</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l15006"></a><span class="lineno">15006</span>&#160;{</div>
-<div class="line"><a name="l15007"></a><span class="lineno">15007</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l15008"></a><span class="lineno">15008</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l15009"></a><span class="lineno">15009</span>&#160; </div>
-<div class="line"><a name="l15010"></a><span class="lineno">15010</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l15011"></a><span class="lineno">15011</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaTouchAllocation,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l15012"></a><span class="lineno">15012</span>&#160;        allocation);</div>
-<div class="line"><a name="l15013"></a><span class="lineno">15013</span>&#160;    Flush();</div>
-<div class="line"><a name="l15014"></a><span class="lineno">15014</span>&#160;}</div>
-<div class="line"><a name="l15015"></a><span class="lineno">15015</span>&#160; </div>
-<div class="line"><a name="l15016"></a><span class="lineno">15016</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordGetAllocationInfo(uint32_t frameIndex,</div>
-<div class="line"><a name="l15017"></a><span class="lineno">15017</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l15018"></a><span class="lineno">15018</span>&#160;{</div>
-<div class="line"><a name="l15019"></a><span class="lineno">15019</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l15020"></a><span class="lineno">15020</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l15021"></a><span class="lineno">15021</span>&#160; </div>
-<div class="line"><a name="l15022"></a><span class="lineno">15022</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l15023"></a><span class="lineno">15023</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaGetAllocationInfo,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l15024"></a><span class="lineno">15024</span>&#160;        allocation);</div>
-<div class="line"><a name="l15025"></a><span class="lineno">15025</span>&#160;    Flush();</div>
-<div class="line"><a name="l15026"></a><span class="lineno">15026</span>&#160;}</div>
-<div class="line"><a name="l15027"></a><span class="lineno">15027</span>&#160; </div>
-<div class="line"><a name="l15028"></a><span class="lineno">15028</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordMakePoolAllocationsLost(uint32_t frameIndex,</div>
-<div class="line"><a name="l15029"></a><span class="lineno">15029</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
-<div class="line"><a name="l15030"></a><span class="lineno">15030</span>&#160;{</div>
-<div class="line"><a name="l15031"></a><span class="lineno">15031</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l15032"></a><span class="lineno">15032</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l15033"></a><span class="lineno">15033</span>&#160; </div>
-<div class="line"><a name="l15034"></a><span class="lineno">15034</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l15035"></a><span class="lineno">15035</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaMakePoolAllocationsLost,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l15036"></a><span class="lineno">15036</span>&#160;        pool);</div>
+<div class="line"><a name="l14992"></a><span class="lineno">14992</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l14993"></a><span class="lineno">14993</span>&#160;    UserDataString userDataStr(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
+<div class="line"><a name="l14994"></a><span class="lineno">14994</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaAllocateMemoryForBuffer,%llu,%llu,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l14995"></a><span class="lineno">14995</span>&#160;        vkMemReq.size,</div>
+<div class="line"><a name="l14996"></a><span class="lineno">14996</span>&#160;        vkMemReq.alignment,</div>
+<div class="line"><a name="l14997"></a><span class="lineno">14997</span>&#160;        vkMemReq.memoryTypeBits,</div>
+<div class="line"><a name="l14998"></a><span class="lineno">14998</span>&#160;        requiresDedicatedAllocation ? 1 : 0,</div>
+<div class="line"><a name="l14999"></a><span class="lineno">14999</span>&#160;        prefersDedicatedAllocation ? 1 : 0,</div>
+<div class="line"><a name="l15000"></a><span class="lineno">15000</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
+<div class="line"><a name="l15001"></a><span class="lineno">15001</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
+<div class="line"><a name="l15002"></a><span class="lineno">15002</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
+<div class="line"><a name="l15003"></a><span class="lineno">15003</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
+<div class="line"><a name="l15004"></a><span class="lineno">15004</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
+<div class="line"><a name="l15005"></a><span class="lineno">15005</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>,</div>
+<div class="line"><a name="l15006"></a><span class="lineno">15006</span>&#160;        allocation,</div>
+<div class="line"><a name="l15007"></a><span class="lineno">15007</span>&#160;        userDataStr.GetString());</div>
+<div class="line"><a name="l15008"></a><span class="lineno">15008</span>&#160;    Flush();</div>
+<div class="line"><a name="l15009"></a><span class="lineno">15009</span>&#160;}</div>
+<div class="line"><a name="l15010"></a><span class="lineno">15010</span>&#160; </div>
+<div class="line"><a name="l15011"></a><span class="lineno">15011</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordAllocateMemoryForImage(uint32_t frameIndex,</div>
+<div class="line"><a name="l15012"></a><span class="lineno">15012</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
+<div class="line"><a name="l15013"></a><span class="lineno">15013</span>&#160;    <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
+<div class="line"><a name="l15014"></a><span class="lineno">15014</span>&#160;    <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
+<div class="line"><a name="l15015"></a><span class="lineno">15015</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l15016"></a><span class="lineno">15016</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l15017"></a><span class="lineno">15017</span>&#160;{</div>
+<div class="line"><a name="l15018"></a><span class="lineno">15018</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15019"></a><span class="lineno">15019</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15020"></a><span class="lineno">15020</span>&#160; </div>
+<div class="line"><a name="l15021"></a><span class="lineno">15021</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15022"></a><span class="lineno">15022</span>&#160;    UserDataString userDataStr(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
+<div class="line"><a name="l15023"></a><span class="lineno">15023</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaAllocateMemoryForImage,%llu,%llu,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15024"></a><span class="lineno">15024</span>&#160;        vkMemReq.size,</div>
+<div class="line"><a name="l15025"></a><span class="lineno">15025</span>&#160;        vkMemReq.alignment,</div>
+<div class="line"><a name="l15026"></a><span class="lineno">15026</span>&#160;        vkMemReq.memoryTypeBits,</div>
+<div class="line"><a name="l15027"></a><span class="lineno">15027</span>&#160;        requiresDedicatedAllocation ? 1 : 0,</div>
+<div class="line"><a name="l15028"></a><span class="lineno">15028</span>&#160;        prefersDedicatedAllocation ? 1 : 0,</div>
+<div class="line"><a name="l15029"></a><span class="lineno">15029</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
+<div class="line"><a name="l15030"></a><span class="lineno">15030</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
+<div class="line"><a name="l15031"></a><span class="lineno">15031</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
+<div class="line"><a name="l15032"></a><span class="lineno">15032</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
+<div class="line"><a name="l15033"></a><span class="lineno">15033</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
+<div class="line"><a name="l15034"></a><span class="lineno">15034</span>&#160;        createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>,</div>
+<div class="line"><a name="l15035"></a><span class="lineno">15035</span>&#160;        allocation,</div>
+<div class="line"><a name="l15036"></a><span class="lineno">15036</span>&#160;        userDataStr.GetString());</div>
 <div class="line"><a name="l15037"></a><span class="lineno">15037</span>&#160;    Flush();</div>
 <div class="line"><a name="l15038"></a><span class="lineno">15038</span>&#160;}</div>
 <div class="line"><a name="l15039"></a><span class="lineno">15039</span>&#160; </div>
-<div class="line"><a name="l15040"></a><span class="lineno">15040</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDefragmentationBegin(uint32_t frameIndex,</div>
-<div class="line"><a name="l15041"></a><span class="lineno">15041</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>&amp; info,</div>
-<div class="line"><a name="l15042"></a><span class="lineno">15042</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx)</div>
-<div class="line"><a name="l15043"></a><span class="lineno">15043</span>&#160;{</div>
-<div class="line"><a name="l15044"></a><span class="lineno">15044</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l15045"></a><span class="lineno">15045</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l15046"></a><span class="lineno">15046</span>&#160; </div>
-<div class="line"><a name="l15047"></a><span class="lineno">15047</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l15048"></a><span class="lineno">15048</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDefragmentationBegin,%u,&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l15049"></a><span class="lineno">15049</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9">flags</a>);</div>
-<div class="line"><a name="l15050"></a><span class="lineno">15050</span>&#160;    PrintPointerList(info.<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a>);</div>
-<div class="line"><a name="l15051"></a><span class="lineno">15051</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;,&quot;</span>);</div>
-<div class="line"><a name="l15052"></a><span class="lineno">15052</span>&#160;    PrintPointerList(info.<a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">pPools</a>);</div>
-<div class="line"><a name="l15053"></a><span class="lineno">15053</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;,%llu,%u,%llu,%u,%p,%p\n&quot;</span>,</div>
-<div class="line"><a name="l15054"></a><span class="lineno">15054</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">maxCpuBytesToMove</a>,</div>
-<div class="line"><a name="l15055"></a><span class="lineno">15055</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">maxCpuAllocationsToMove</a>,</div>
-<div class="line"><a name="l15056"></a><span class="lineno">15056</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08">maxGpuBytesToMove</a>,</div>
-<div class="line"><a name="l15057"></a><span class="lineno">15057</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6">maxGpuAllocationsToMove</a>,</div>
-<div class="line"><a name="l15058"></a><span class="lineno">15058</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd">commandBuffer</a>,</div>
-<div class="line"><a name="l15059"></a><span class="lineno">15059</span>&#160;        ctx);</div>
-<div class="line"><a name="l15060"></a><span class="lineno">15060</span>&#160;    Flush();</div>
-<div class="line"><a name="l15061"></a><span class="lineno">15061</span>&#160;}</div>
-<div class="line"><a name="l15062"></a><span class="lineno">15062</span>&#160; </div>
-<div class="line"><a name="l15063"></a><span class="lineno">15063</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDefragmentationEnd(uint32_t frameIndex,</div>
-<div class="line"><a name="l15064"></a><span class="lineno">15064</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx)</div>
-<div class="line"><a name="l15065"></a><span class="lineno">15065</span>&#160;{</div>
-<div class="line"><a name="l15066"></a><span class="lineno">15066</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l15067"></a><span class="lineno">15067</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l15068"></a><span class="lineno">15068</span>&#160; </div>
-<div class="line"><a name="l15069"></a><span class="lineno">15069</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l15070"></a><span class="lineno">15070</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDefragmentationEnd,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l15071"></a><span class="lineno">15071</span>&#160;        ctx);</div>
-<div class="line"><a name="l15072"></a><span class="lineno">15072</span>&#160;    Flush();</div>
-<div class="line"><a name="l15073"></a><span class="lineno">15073</span>&#160;}</div>
-<div class="line"><a name="l15074"></a><span class="lineno">15074</span>&#160; </div>
-<div class="line"><a name="l15075"></a><span class="lineno">15075</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordSetPoolName(uint32_t frameIndex,</div>
-<div class="line"><a name="l15076"></a><span class="lineno">15076</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
-<div class="line"><a name="l15077"></a><span class="lineno">15077</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* name)</div>
-<div class="line"><a name="l15078"></a><span class="lineno">15078</span>&#160;{</div>
-<div class="line"><a name="l15079"></a><span class="lineno">15079</span>&#160;    CallParams callParams;</div>
-<div class="line"><a name="l15080"></a><span class="lineno">15080</span>&#160;    GetBasicParams(callParams);</div>
-<div class="line"><a name="l15081"></a><span class="lineno">15081</span>&#160; </div>
-<div class="line"><a name="l15082"></a><span class="lineno">15082</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
-<div class="line"><a name="l15083"></a><span class="lineno">15083</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaSetPoolName,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
-<div class="line"><a name="l15084"></a><span class="lineno">15084</span>&#160;        pool, name != VMA_NULL ? name : <span class="stringliteral">&quot;&quot;</span>);</div>
-<div class="line"><a name="l15085"></a><span class="lineno">15085</span>&#160;    Flush();</div>
-<div class="line"><a name="l15086"></a><span class="lineno">15086</span>&#160;}</div>
-<div class="line"><a name="l15087"></a><span class="lineno">15087</span>&#160; </div>
-<div class="line"><a name="l15088"></a><span class="lineno">15088</span>&#160;VmaRecorder::UserDataString::UserDataString(<a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlags, <span class="keyword">const</span> <span class="keywordtype">void</span>* pUserData)</div>
-<div class="line"><a name="l15089"></a><span class="lineno">15089</span>&#160;{</div>
-<div class="line"><a name="l15090"></a><span class="lineno">15090</span>&#160;    <span class="keywordflow">if</span>(pUserData != VMA_NULL)</div>
-<div class="line"><a name="l15091"></a><span class="lineno">15091</span>&#160;    {</div>
-<div class="line"><a name="l15092"></a><span class="lineno">15092</span>&#160;        <span class="keywordflow">if</span>((allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a>) != 0)</div>
-<div class="line"><a name="l15093"></a><span class="lineno">15093</span>&#160;        {</div>
-<div class="line"><a name="l15094"></a><span class="lineno">15094</span>&#160;            m_Str = (<span class="keyword">const</span> <span class="keywordtype">char</span>*)pUserData;</div>
-<div class="line"><a name="l15095"></a><span class="lineno">15095</span>&#160;        }</div>
-<div class="line"><a name="l15096"></a><span class="lineno">15096</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l15097"></a><span class="lineno">15097</span>&#160;        {</div>
-<div class="line"><a name="l15098"></a><span class="lineno">15098</span>&#160;            sprintf_s(m_PtrStr, <span class="stringliteral">&quot;%p&quot;</span>, pUserData);</div>
-<div class="line"><a name="l15099"></a><span class="lineno">15099</span>&#160;            m_Str = m_PtrStr;</div>
-<div class="line"><a name="l15100"></a><span class="lineno">15100</span>&#160;        }</div>
-<div class="line"><a name="l15101"></a><span class="lineno">15101</span>&#160;    }</div>
-<div class="line"><a name="l15102"></a><span class="lineno">15102</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l15103"></a><span class="lineno">15103</span>&#160;    {</div>
-<div class="line"><a name="l15104"></a><span class="lineno">15104</span>&#160;        m_Str = <span class="stringliteral">&quot;&quot;</span>;</div>
-<div class="line"><a name="l15105"></a><span class="lineno">15105</span>&#160;    }</div>
-<div class="line"><a name="l15106"></a><span class="lineno">15106</span>&#160;}</div>
-<div class="line"><a name="l15107"></a><span class="lineno">15107</span>&#160; </div>
-<div class="line"><a name="l15108"></a><span class="lineno">15108</span>&#160;<span class="keywordtype">void</span> VmaRecorder::WriteConfiguration(</div>
-<div class="line"><a name="l15109"></a><span class="lineno">15109</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceProperties&amp; devProps,</div>
-<div class="line"><a name="l15110"></a><span class="lineno">15110</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceMemoryProperties&amp; memProps,</div>
-<div class="line"><a name="l15111"></a><span class="lineno">15111</span>&#160;    uint32_t vulkanApiVersion,</div>
-<div class="line"><a name="l15112"></a><span class="lineno">15112</span>&#160;    <span class="keywordtype">bool</span> dedicatedAllocationExtensionEnabled,</div>
-<div class="line"><a name="l15113"></a><span class="lineno">15113</span>&#160;    <span class="keywordtype">bool</span> bindMemory2ExtensionEnabled,</div>
-<div class="line"><a name="l15114"></a><span class="lineno">15114</span>&#160;    <span class="keywordtype">bool</span> memoryBudgetExtensionEnabled,</div>
-<div class="line"><a name="l15115"></a><span class="lineno">15115</span>&#160;    <span class="keywordtype">bool</span> deviceCoherentMemoryExtensionEnabled)</div>
-<div class="line"><a name="l15116"></a><span class="lineno">15116</span>&#160;{</div>
-<div class="line"><a name="l15117"></a><span class="lineno">15117</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Config,Begin\n&quot;</span>);</div>
+<div class="line"><a name="l15040"></a><span class="lineno">15040</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordFreeMemory(uint32_t frameIndex,</div>
+<div class="line"><a name="l15041"></a><span class="lineno">15041</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l15042"></a><span class="lineno">15042</span>&#160;{</div>
+<div class="line"><a name="l15043"></a><span class="lineno">15043</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15044"></a><span class="lineno">15044</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15045"></a><span class="lineno">15045</span>&#160; </div>
+<div class="line"><a name="l15046"></a><span class="lineno">15046</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15047"></a><span class="lineno">15047</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaFreeMemory,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15048"></a><span class="lineno">15048</span>&#160;        allocation);</div>
+<div class="line"><a name="l15049"></a><span class="lineno">15049</span>&#160;    Flush();</div>
+<div class="line"><a name="l15050"></a><span class="lineno">15050</span>&#160;}</div>
+<div class="line"><a name="l15051"></a><span class="lineno">15051</span>&#160; </div>
+<div class="line"><a name="l15052"></a><span class="lineno">15052</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordFreeMemoryPages(uint32_t frameIndex,</div>
+<div class="line"><a name="l15053"></a><span class="lineno">15053</span>&#160;    uint64_t allocationCount,</div>
+<div class="line"><a name="l15054"></a><span class="lineno">15054</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
+<div class="line"><a name="l15055"></a><span class="lineno">15055</span>&#160;{</div>
+<div class="line"><a name="l15056"></a><span class="lineno">15056</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15057"></a><span class="lineno">15057</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15058"></a><span class="lineno">15058</span>&#160; </div>
+<div class="line"><a name="l15059"></a><span class="lineno">15059</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15060"></a><span class="lineno">15060</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaFreeMemoryPages,&quot;</span>, callParams.threadId, callParams.time, frameIndex);</div>
+<div class="line"><a name="l15061"></a><span class="lineno">15061</span>&#160;    PrintPointerList(allocationCount, pAllocations);</div>
+<div class="line"><a name="l15062"></a><span class="lineno">15062</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;\n&quot;</span>);</div>
+<div class="line"><a name="l15063"></a><span class="lineno">15063</span>&#160;    Flush();</div>
+<div class="line"><a name="l15064"></a><span class="lineno">15064</span>&#160;}</div>
+<div class="line"><a name="l15065"></a><span class="lineno">15065</span>&#160; </div>
+<div class="line"><a name="l15066"></a><span class="lineno">15066</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordSetAllocationUserData(uint32_t frameIndex,</div>
+<div class="line"><a name="l15067"></a><span class="lineno">15067</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l15068"></a><span class="lineno">15068</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pUserData)</div>
+<div class="line"><a name="l15069"></a><span class="lineno">15069</span>&#160;{</div>
+<div class="line"><a name="l15070"></a><span class="lineno">15070</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15071"></a><span class="lineno">15071</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15072"></a><span class="lineno">15072</span>&#160; </div>
+<div class="line"><a name="l15073"></a><span class="lineno">15073</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15074"></a><span class="lineno">15074</span>&#160;    UserDataString userDataStr(</div>
+<div class="line"><a name="l15075"></a><span class="lineno">15075</span>&#160;        allocation-&gt;IsUserDataString() ? <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a> : 0,</div>
+<div class="line"><a name="l15076"></a><span class="lineno">15076</span>&#160;        pUserData);</div>
+<div class="line"><a name="l15077"></a><span class="lineno">15077</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaSetAllocationUserData,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15078"></a><span class="lineno">15078</span>&#160;        allocation,</div>
+<div class="line"><a name="l15079"></a><span class="lineno">15079</span>&#160;        userDataStr.GetString());</div>
+<div class="line"><a name="l15080"></a><span class="lineno">15080</span>&#160;    Flush();</div>
+<div class="line"><a name="l15081"></a><span class="lineno">15081</span>&#160;}</div>
+<div class="line"><a name="l15082"></a><span class="lineno">15082</span>&#160; </div>
+<div class="line"><a name="l15083"></a><span class="lineno">15083</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordCreateLostAllocation(uint32_t frameIndex,</div>
+<div class="line"><a name="l15084"></a><span class="lineno">15084</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l15085"></a><span class="lineno">15085</span>&#160;{</div>
+<div class="line"><a name="l15086"></a><span class="lineno">15086</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15087"></a><span class="lineno">15087</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15088"></a><span class="lineno">15088</span>&#160; </div>
+<div class="line"><a name="l15089"></a><span class="lineno">15089</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15090"></a><span class="lineno">15090</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaCreateLostAllocation,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15091"></a><span class="lineno">15091</span>&#160;        allocation);</div>
+<div class="line"><a name="l15092"></a><span class="lineno">15092</span>&#160;    Flush();</div>
+<div class="line"><a name="l15093"></a><span class="lineno">15093</span>&#160;}</div>
+<div class="line"><a name="l15094"></a><span class="lineno">15094</span>&#160; </div>
+<div class="line"><a name="l15095"></a><span class="lineno">15095</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordMapMemory(uint32_t frameIndex,</div>
+<div class="line"><a name="l15096"></a><span class="lineno">15096</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l15097"></a><span class="lineno">15097</span>&#160;{</div>
+<div class="line"><a name="l15098"></a><span class="lineno">15098</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15099"></a><span class="lineno">15099</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15100"></a><span class="lineno">15100</span>&#160; </div>
+<div class="line"><a name="l15101"></a><span class="lineno">15101</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15102"></a><span class="lineno">15102</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaMapMemory,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15103"></a><span class="lineno">15103</span>&#160;        allocation);</div>
+<div class="line"><a name="l15104"></a><span class="lineno">15104</span>&#160;    Flush();</div>
+<div class="line"><a name="l15105"></a><span class="lineno">15105</span>&#160;}</div>
+<div class="line"><a name="l15106"></a><span class="lineno">15106</span>&#160; </div>
+<div class="line"><a name="l15107"></a><span class="lineno">15107</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordUnmapMemory(uint32_t frameIndex,</div>
+<div class="line"><a name="l15108"></a><span class="lineno">15108</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l15109"></a><span class="lineno">15109</span>&#160;{</div>
+<div class="line"><a name="l15110"></a><span class="lineno">15110</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15111"></a><span class="lineno">15111</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15112"></a><span class="lineno">15112</span>&#160; </div>
+<div class="line"><a name="l15113"></a><span class="lineno">15113</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15114"></a><span class="lineno">15114</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaUnmapMemory,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15115"></a><span class="lineno">15115</span>&#160;        allocation);</div>
+<div class="line"><a name="l15116"></a><span class="lineno">15116</span>&#160;    Flush();</div>
+<div class="line"><a name="l15117"></a><span class="lineno">15117</span>&#160;}</div>
 <div class="line"><a name="l15118"></a><span class="lineno">15118</span>&#160; </div>
-<div class="line"><a name="l15119"></a><span class="lineno">15119</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;VulkanApiVersion,%u,%u\n&quot;</span>, VK_VERSION_MAJOR(vulkanApiVersion), VK_VERSION_MINOR(vulkanApiVersion));</div>
-<div class="line"><a name="l15120"></a><span class="lineno">15120</span>&#160; </div>
-<div class="line"><a name="l15121"></a><span class="lineno">15121</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,apiVersion,%u\n&quot;</span>, devProps.apiVersion);</div>
-<div class="line"><a name="l15122"></a><span class="lineno">15122</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,driverVersion,%u\n&quot;</span>, devProps.driverVersion);</div>
-<div class="line"><a name="l15123"></a><span class="lineno">15123</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,vendorID,%u\n&quot;</span>, devProps.vendorID);</div>
-<div class="line"><a name="l15124"></a><span class="lineno">15124</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,deviceID,%u\n&quot;</span>, devProps.deviceID);</div>
-<div class="line"><a name="l15125"></a><span class="lineno">15125</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,deviceType,%u\n&quot;</span>, devProps.deviceType);</div>
-<div class="line"><a name="l15126"></a><span class="lineno">15126</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,deviceName,%s\n&quot;</span>, devProps.deviceName);</div>
-<div class="line"><a name="l15127"></a><span class="lineno">15127</span>&#160; </div>
-<div class="line"><a name="l15128"></a><span class="lineno">15128</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceLimits,maxMemoryAllocationCount,%u\n&quot;</span>, devProps.limits.maxMemoryAllocationCount);</div>
-<div class="line"><a name="l15129"></a><span class="lineno">15129</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceLimits,bufferImageGranularity,%llu\n&quot;</span>, devProps.limits.bufferImageGranularity);</div>
-<div class="line"><a name="l15130"></a><span class="lineno">15130</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceLimits,nonCoherentAtomSize,%llu\n&quot;</span>, devProps.limits.nonCoherentAtomSize);</div>
-<div class="line"><a name="l15131"></a><span class="lineno">15131</span>&#160; </div>
-<div class="line"><a name="l15132"></a><span class="lineno">15132</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,HeapCount,%u\n&quot;</span>, memProps.memoryHeapCount);</div>
-<div class="line"><a name="l15133"></a><span class="lineno">15133</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; memProps.memoryHeapCount; ++i)</div>
-<div class="line"><a name="l15134"></a><span class="lineno">15134</span>&#160;    {</div>
-<div class="line"><a name="l15135"></a><span class="lineno">15135</span>&#160;        fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,Heap,%u,size,%llu\n&quot;</span>, i, memProps.memoryHeaps[i].size);</div>
-<div class="line"><a name="l15136"></a><span class="lineno">15136</span>&#160;        fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,Heap,%u,flags,%u\n&quot;</span>, i, memProps.memoryHeaps[i].flags);</div>
-<div class="line"><a name="l15137"></a><span class="lineno">15137</span>&#160;    }</div>
-<div class="line"><a name="l15138"></a><span class="lineno">15138</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,TypeCount,%u\n&quot;</span>, memProps.memoryTypeCount);</div>
-<div class="line"><a name="l15139"></a><span class="lineno">15139</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; memProps.memoryTypeCount; ++i)</div>
-<div class="line"><a name="l15140"></a><span class="lineno">15140</span>&#160;    {</div>
-<div class="line"><a name="l15141"></a><span class="lineno">15141</span>&#160;        fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,Type,%u,heapIndex,%u\n&quot;</span>, i, memProps.memoryTypes[i].heapIndex);</div>
-<div class="line"><a name="l15142"></a><span class="lineno">15142</span>&#160;        fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,Type,%u,propertyFlags,%u\n&quot;</span>, i, memProps.memoryTypes[i].propertyFlags);</div>
-<div class="line"><a name="l15143"></a><span class="lineno">15143</span>&#160;    }</div>
-<div class="line"><a name="l15144"></a><span class="lineno">15144</span>&#160; </div>
-<div class="line"><a name="l15145"></a><span class="lineno">15145</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Extension,VK_KHR_dedicated_allocation,%u\n&quot;</span>, dedicatedAllocationExtensionEnabled ? 1 : 0);</div>
-<div class="line"><a name="l15146"></a><span class="lineno">15146</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Extension,VK_KHR_bind_memory2,%u\n&quot;</span>, bindMemory2ExtensionEnabled ? 1 : 0);</div>
-<div class="line"><a name="l15147"></a><span class="lineno">15147</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Extension,VK_EXT_memory_budget,%u\n&quot;</span>, memoryBudgetExtensionEnabled ? 1 : 0);</div>
-<div class="line"><a name="l15148"></a><span class="lineno">15148</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Extension,VK_AMD_device_coherent_memory,%u\n&quot;</span>, deviceCoherentMemoryExtensionEnabled ? 1 : 0);</div>
-<div class="line"><a name="l15149"></a><span class="lineno">15149</span>&#160; </div>
-<div class="line"><a name="l15150"></a><span class="lineno">15150</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,%u\n&quot;</span>, VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ? 1 : 0);</div>
-<div class="line"><a name="l15151"></a><span class="lineno">15151</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_ALIGNMENT,%llu\n&quot;</span>, (VkDeviceSize)VMA_DEBUG_ALIGNMENT);</div>
-<div class="line"><a name="l15152"></a><span class="lineno">15152</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_MARGIN,%llu\n&quot;</span>, (VkDeviceSize)VMA_DEBUG_MARGIN);</div>
-<div class="line"><a name="l15153"></a><span class="lineno">15153</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,%u\n&quot;</span>, VMA_DEBUG_INITIALIZE_ALLOCATIONS ? 1 : 0);</div>
-<div class="line"><a name="l15154"></a><span class="lineno">15154</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_DETECT_CORRUPTION,%u\n&quot;</span>, VMA_DEBUG_DETECT_CORRUPTION ? 1 : 0);</div>
-<div class="line"><a name="l15155"></a><span class="lineno">15155</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_GLOBAL_MUTEX,%u\n&quot;</span>, VMA_DEBUG_GLOBAL_MUTEX ? 1 : 0);</div>
-<div class="line"><a name="l15156"></a><span class="lineno">15156</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY,%llu\n&quot;</span>, (VkDeviceSize)VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY);</div>
-<div class="line"><a name="l15157"></a><span class="lineno">15157</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_SMALL_HEAP_MAX_SIZE,%llu\n&quot;</span>, (VkDeviceSize)VMA_SMALL_HEAP_MAX_SIZE);</div>
-<div class="line"><a name="l15158"></a><span class="lineno">15158</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE,%llu\n&quot;</span>, (VkDeviceSize)VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE);</div>
-<div class="line"><a name="l15159"></a><span class="lineno">15159</span>&#160; </div>
-<div class="line"><a name="l15160"></a><span class="lineno">15160</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Config,End\n&quot;</span>);</div>
-<div class="line"><a name="l15161"></a><span class="lineno">15161</span>&#160;}</div>
-<div class="line"><a name="l15162"></a><span class="lineno">15162</span>&#160; </div>
-<div class="line"><a name="l15163"></a><span class="lineno">15163</span>&#160;<span class="keywordtype">void</span> VmaRecorder::GetBasicParams(CallParams&amp; outParams)</div>
-<div class="line"><a name="l15164"></a><span class="lineno">15164</span>&#160;{</div>
-<div class="line"><a name="l15165"></a><span class="lineno">15165</span>&#160;    outParams.threadId = GetCurrentThreadId();</div>
-<div class="line"><a name="l15166"></a><span class="lineno">15166</span>&#160; </div>
-<div class="line"><a name="l15167"></a><span class="lineno">15167</span>&#160;    LARGE_INTEGER counter;</div>
-<div class="line"><a name="l15168"></a><span class="lineno">15168</span>&#160;    QueryPerformanceCounter(&amp;counter);</div>
-<div class="line"><a name="l15169"></a><span class="lineno">15169</span>&#160;    outParams.time = (double)(counter.QuadPart - m_StartCounter) / (double)m_Freq;</div>
-<div class="line"><a name="l15170"></a><span class="lineno">15170</span>&#160;}</div>
-<div class="line"><a name="l15171"></a><span class="lineno">15171</span>&#160; </div>
-<div class="line"><a name="l15172"></a><span class="lineno">15172</span>&#160;<span class="keywordtype">void</span> VmaRecorder::PrintPointerList(uint64_t count, <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pItems)</div>
-<div class="line"><a name="l15173"></a><span class="lineno">15173</span>&#160;{</div>
-<div class="line"><a name="l15174"></a><span class="lineno">15174</span>&#160;    <span class="keywordflow">if</span>(count)</div>
-<div class="line"><a name="l15175"></a><span class="lineno">15175</span>&#160;    {</div>
-<div class="line"><a name="l15176"></a><span class="lineno">15176</span>&#160;        fprintf(m_File, <span class="stringliteral">&quot;%p&quot;</span>, pItems[0]);</div>
-<div class="line"><a name="l15177"></a><span class="lineno">15177</span>&#160;        <span class="keywordflow">for</span>(uint64_t i = 1; i &lt; count; ++i)</div>
-<div class="line"><a name="l15178"></a><span class="lineno">15178</span>&#160;        {</div>
-<div class="line"><a name="l15179"></a><span class="lineno">15179</span>&#160;            fprintf(m_File, <span class="stringliteral">&quot; %p&quot;</span>, pItems[i]);</div>
-<div class="line"><a name="l15180"></a><span class="lineno">15180</span>&#160;        }</div>
-<div class="line"><a name="l15181"></a><span class="lineno">15181</span>&#160;    }</div>
-<div class="line"><a name="l15182"></a><span class="lineno">15182</span>&#160;}</div>
-<div class="line"><a name="l15183"></a><span class="lineno">15183</span>&#160; </div>
-<div class="line"><a name="l15184"></a><span class="lineno">15184</span>&#160;<span class="keywordtype">void</span> VmaRecorder::Flush()</div>
-<div class="line"><a name="l15185"></a><span class="lineno">15185</span>&#160;{</div>
-<div class="line"><a name="l15186"></a><span class="lineno">15186</span>&#160;    <span class="keywordflow">if</span>((m_Flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7">VMA_RECORD_FLUSH_AFTER_CALL_BIT</a>) != 0)</div>
-<div class="line"><a name="l15187"></a><span class="lineno">15187</span>&#160;    {</div>
-<div class="line"><a name="l15188"></a><span class="lineno">15188</span>&#160;        fflush(m_File);</div>
-<div class="line"><a name="l15189"></a><span class="lineno">15189</span>&#160;    }</div>
-<div class="line"><a name="l15190"></a><span class="lineno">15190</span>&#160;}</div>
-<div class="line"><a name="l15191"></a><span class="lineno">15191</span>&#160; </div>
-<div class="line"><a name="l15192"></a><span class="lineno">15192</span>&#160;<span class="preprocessor">#endif // #if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l15193"></a><span class="lineno">15193</span>&#160; </div>
-<div class="line"><a name="l15195"></a><span class="lineno">15195</span>&#160;<span class="comment">// VmaAllocationObjectAllocator</span></div>
-<div class="line"><a name="l15196"></a><span class="lineno">15196</span>&#160; </div>
-<div class="line"><a name="l15197"></a><span class="lineno">15197</span>&#160;VmaAllocationObjectAllocator::VmaAllocationObjectAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks) :</div>
-<div class="line"><a name="l15198"></a><span class="lineno">15198</span>&#160;    m_Allocator(pAllocationCallbacks, 1024)</div>
-<div class="line"><a name="l15199"></a><span class="lineno">15199</span>&#160;{</div>
-<div class="line"><a name="l15200"></a><span class="lineno">15200</span>&#160;}</div>
-<div class="line"><a name="l15201"></a><span class="lineno">15201</span>&#160; </div>
-<div class="line"><a name="l15202"></a><span class="lineno">15202</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span>... Types&gt; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VmaAllocationObjectAllocator::Allocate(Types... args)</div>
-<div class="line"><a name="l15203"></a><span class="lineno">15203</span>&#160;{</div>
-<div class="line"><a name="l15204"></a><span class="lineno">15204</span>&#160;    VmaMutexLock mutexLock(m_Mutex);</div>
-<div class="line"><a name="l15205"></a><span class="lineno">15205</span>&#160;    <span class="keywordflow">return</span> m_Allocator.Alloc&lt;Types...&gt;(std::forward&lt;Types&gt;(args)...);</div>
+<div class="line"><a name="l15119"></a><span class="lineno">15119</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordFlushAllocation(uint32_t frameIndex,</div>
+<div class="line"><a name="l15120"></a><span class="lineno">15120</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</div>
+<div class="line"><a name="l15121"></a><span class="lineno">15121</span>&#160;{</div>
+<div class="line"><a name="l15122"></a><span class="lineno">15122</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15123"></a><span class="lineno">15123</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15124"></a><span class="lineno">15124</span>&#160; </div>
+<div class="line"><a name="l15125"></a><span class="lineno">15125</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15126"></a><span class="lineno">15126</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaFlushAllocation,%p,%llu,%llu\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15127"></a><span class="lineno">15127</span>&#160;        allocation,</div>
+<div class="line"><a name="l15128"></a><span class="lineno">15128</span>&#160;        offset,</div>
+<div class="line"><a name="l15129"></a><span class="lineno">15129</span>&#160;        size);</div>
+<div class="line"><a name="l15130"></a><span class="lineno">15130</span>&#160;    Flush();</div>
+<div class="line"><a name="l15131"></a><span class="lineno">15131</span>&#160;}</div>
+<div class="line"><a name="l15132"></a><span class="lineno">15132</span>&#160; </div>
+<div class="line"><a name="l15133"></a><span class="lineno">15133</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordInvalidateAllocation(uint32_t frameIndex,</div>
+<div class="line"><a name="l15134"></a><span class="lineno">15134</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</div>
+<div class="line"><a name="l15135"></a><span class="lineno">15135</span>&#160;{</div>
+<div class="line"><a name="l15136"></a><span class="lineno">15136</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15137"></a><span class="lineno">15137</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15138"></a><span class="lineno">15138</span>&#160; </div>
+<div class="line"><a name="l15139"></a><span class="lineno">15139</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15140"></a><span class="lineno">15140</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaInvalidateAllocation,%p,%llu,%llu\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15141"></a><span class="lineno">15141</span>&#160;        allocation,</div>
+<div class="line"><a name="l15142"></a><span class="lineno">15142</span>&#160;        offset,</div>
+<div class="line"><a name="l15143"></a><span class="lineno">15143</span>&#160;        size);</div>
+<div class="line"><a name="l15144"></a><span class="lineno">15144</span>&#160;    Flush();</div>
+<div class="line"><a name="l15145"></a><span class="lineno">15145</span>&#160;}</div>
+<div class="line"><a name="l15146"></a><span class="lineno">15146</span>&#160; </div>
+<div class="line"><a name="l15147"></a><span class="lineno">15147</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordCreateBuffer(uint32_t frameIndex,</div>
+<div class="line"><a name="l15148"></a><span class="lineno">15148</span>&#160;    <span class="keyword">const</span> VkBufferCreateInfo&amp; bufCreateInfo,</div>
+<div class="line"><a name="l15149"></a><span class="lineno">15149</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; allocCreateInfo,</div>
+<div class="line"><a name="l15150"></a><span class="lineno">15150</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l15151"></a><span class="lineno">15151</span>&#160;{</div>
+<div class="line"><a name="l15152"></a><span class="lineno">15152</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15153"></a><span class="lineno">15153</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15154"></a><span class="lineno">15154</span>&#160; </div>
+<div class="line"><a name="l15155"></a><span class="lineno">15155</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15156"></a><span class="lineno">15156</span>&#160;    UserDataString userDataStr(allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
+<div class="line"><a name="l15157"></a><span class="lineno">15157</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaCreateBuffer,%u,%llu,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15158"></a><span class="lineno">15158</span>&#160;        bufCreateInfo.flags,</div>
+<div class="line"><a name="l15159"></a><span class="lineno">15159</span>&#160;        bufCreateInfo.size,</div>
+<div class="line"><a name="l15160"></a><span class="lineno">15160</span>&#160;        bufCreateInfo.usage,</div>
+<div class="line"><a name="l15161"></a><span class="lineno">15161</span>&#160;        bufCreateInfo.sharingMode,</div>
+<div class="line"><a name="l15162"></a><span class="lineno">15162</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
+<div class="line"><a name="l15163"></a><span class="lineno">15163</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
+<div class="line"><a name="l15164"></a><span class="lineno">15164</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
+<div class="line"><a name="l15165"></a><span class="lineno">15165</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
+<div class="line"><a name="l15166"></a><span class="lineno">15166</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
+<div class="line"><a name="l15167"></a><span class="lineno">15167</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>,</div>
+<div class="line"><a name="l15168"></a><span class="lineno">15168</span>&#160;        allocation,</div>
+<div class="line"><a name="l15169"></a><span class="lineno">15169</span>&#160;        userDataStr.GetString());</div>
+<div class="line"><a name="l15170"></a><span class="lineno">15170</span>&#160;    Flush();</div>
+<div class="line"><a name="l15171"></a><span class="lineno">15171</span>&#160;}</div>
+<div class="line"><a name="l15172"></a><span class="lineno">15172</span>&#160; </div>
+<div class="line"><a name="l15173"></a><span class="lineno">15173</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordCreateImage(uint32_t frameIndex,</div>
+<div class="line"><a name="l15174"></a><span class="lineno">15174</span>&#160;    <span class="keyword">const</span> VkImageCreateInfo&amp; imageCreateInfo,</div>
+<div class="line"><a name="l15175"></a><span class="lineno">15175</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; allocCreateInfo,</div>
+<div class="line"><a name="l15176"></a><span class="lineno">15176</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l15177"></a><span class="lineno">15177</span>&#160;{</div>
+<div class="line"><a name="l15178"></a><span class="lineno">15178</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15179"></a><span class="lineno">15179</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15180"></a><span class="lineno">15180</span>&#160; </div>
+<div class="line"><a name="l15181"></a><span class="lineno">15181</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15182"></a><span class="lineno">15182</span>&#160;    UserDataString userDataStr(allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>, allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>);</div>
+<div class="line"><a name="l15183"></a><span class="lineno">15183</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaCreateImage,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15184"></a><span class="lineno">15184</span>&#160;        imageCreateInfo.flags,</div>
+<div class="line"><a name="l15185"></a><span class="lineno">15185</span>&#160;        imageCreateInfo.imageType,</div>
+<div class="line"><a name="l15186"></a><span class="lineno">15186</span>&#160;        imageCreateInfo.format,</div>
+<div class="line"><a name="l15187"></a><span class="lineno">15187</span>&#160;        imageCreateInfo.extent.width,</div>
+<div class="line"><a name="l15188"></a><span class="lineno">15188</span>&#160;        imageCreateInfo.extent.height,</div>
+<div class="line"><a name="l15189"></a><span class="lineno">15189</span>&#160;        imageCreateInfo.extent.depth,</div>
+<div class="line"><a name="l15190"></a><span class="lineno">15190</span>&#160;        imageCreateInfo.mipLevels,</div>
+<div class="line"><a name="l15191"></a><span class="lineno">15191</span>&#160;        imageCreateInfo.arrayLayers,</div>
+<div class="line"><a name="l15192"></a><span class="lineno">15192</span>&#160;        imageCreateInfo.samples,</div>
+<div class="line"><a name="l15193"></a><span class="lineno">15193</span>&#160;        imageCreateInfo.tiling,</div>
+<div class="line"><a name="l15194"></a><span class="lineno">15194</span>&#160;        imageCreateInfo.usage,</div>
+<div class="line"><a name="l15195"></a><span class="lineno">15195</span>&#160;        imageCreateInfo.sharingMode,</div>
+<div class="line"><a name="l15196"></a><span class="lineno">15196</span>&#160;        imageCreateInfo.initialLayout,</div>
+<div class="line"><a name="l15197"></a><span class="lineno">15197</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>,</div>
+<div class="line"><a name="l15198"></a><span class="lineno">15198</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>,</div>
+<div class="line"><a name="l15199"></a><span class="lineno">15199</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>,</div>
+<div class="line"><a name="l15200"></a><span class="lineno">15200</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>,</div>
+<div class="line"><a name="l15201"></a><span class="lineno">15201</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>,</div>
+<div class="line"><a name="l15202"></a><span class="lineno">15202</span>&#160;        allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>,</div>
+<div class="line"><a name="l15203"></a><span class="lineno">15203</span>&#160;        allocation,</div>
+<div class="line"><a name="l15204"></a><span class="lineno">15204</span>&#160;        userDataStr.GetString());</div>
+<div class="line"><a name="l15205"></a><span class="lineno">15205</span>&#160;    Flush();</div>
 <div class="line"><a name="l15206"></a><span class="lineno">15206</span>&#160;}</div>
 <div class="line"><a name="l15207"></a><span class="lineno">15207</span>&#160; </div>
-<div class="line"><a name="l15208"></a><span class="lineno">15208</span>&#160;<span class="keywordtype">void</span> VmaAllocationObjectAllocator::Free(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc)</div>
-<div class="line"><a name="l15209"></a><span class="lineno">15209</span>&#160;{</div>
-<div class="line"><a name="l15210"></a><span class="lineno">15210</span>&#160;    VmaMutexLock mutexLock(m_Mutex);</div>
-<div class="line"><a name="l15211"></a><span class="lineno">15211</span>&#160;    m_Allocator.Free(hAlloc);</div>
-<div class="line"><a name="l15212"></a><span class="lineno">15212</span>&#160;}</div>
+<div class="line"><a name="l15208"></a><span class="lineno">15208</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDestroyBuffer(uint32_t frameIndex,</div>
+<div class="line"><a name="l15209"></a><span class="lineno">15209</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l15210"></a><span class="lineno">15210</span>&#160;{</div>
+<div class="line"><a name="l15211"></a><span class="lineno">15211</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15212"></a><span class="lineno">15212</span>&#160;    GetBasicParams(callParams);</div>
 <div class="line"><a name="l15213"></a><span class="lineno">15213</span>&#160; </div>
-<div class="line"><a name="l15215"></a><span class="lineno">15215</span>&#160;<span class="comment">// VmaAllocator_T</span></div>
-<div class="line"><a name="l15216"></a><span class="lineno">15216</span>&#160; </div>
-<div class="line"><a name="l15217"></a><span class="lineno">15217</span>&#160;VmaAllocator_T::VmaAllocator_T(<span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo) :</div>
-<div class="line"><a name="l15218"></a><span class="lineno">15218</span>&#160;    m_UseMutex((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d">VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT</a>) == 0),</div>
-<div class="line"><a name="l15219"></a><span class="lineno">15219</span>&#160;    m_VulkanApiVersion(pCreateInfo-&gt;vulkanApiVersion != 0 ? pCreateInfo-&gt;vulkanApiVersion : VK_API_VERSION_1_0),</div>
-<div class="line"><a name="l15220"></a><span class="lineno">15220</span>&#160;    m_UseKhrDedicatedAllocation((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a>) != 0),</div>
-<div class="line"><a name="l15221"></a><span class="lineno">15221</span>&#160;    m_UseKhrBindMemory2((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a>) != 0),</div>
-<div class="line"><a name="l15222"></a><span class="lineno">15222</span>&#160;    m_UseExtMemoryBudget((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0">VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT</a>) != 0),</div>
-<div class="line"><a name="l15223"></a><span class="lineno">15223</span>&#160;    m_UseAmdDeviceCoherentMemory((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f">VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT</a>) != 0),</div>
-<div class="line"><a name="l15224"></a><span class="lineno">15224</span>&#160;    m_UseKhrBufferDeviceAddress((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089">VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT</a>) != 0),</div>
-<div class="line"><a name="l15225"></a><span class="lineno">15225</span>&#160;    m_hDevice(pCreateInfo-&gt;device),</div>
-<div class="line"><a name="l15226"></a><span class="lineno">15226</span>&#160;    m_hInstance(pCreateInfo-&gt;instance),</div>
-<div class="line"><a name="l15227"></a><span class="lineno">15227</span>&#160;    m_AllocationCallbacksSpecified(pCreateInfo-&gt;pAllocationCallbacks != VMA_NULL),</div>
-<div class="line"><a name="l15228"></a><span class="lineno">15228</span>&#160;    m_AllocationCallbacks(pCreateInfo-&gt;pAllocationCallbacks ?</div>
-<div class="line"><a name="l15229"></a><span class="lineno">15229</span>&#160;        *pCreateInfo-&gt;pAllocationCallbacks : VmaEmptyAllocationCallbacks),</div>
-<div class="line"><a name="l15230"></a><span class="lineno">15230</span>&#160;    m_AllocationObjectAllocator(&amp;m_AllocationCallbacks),</div>
-<div class="line"><a name="l15231"></a><span class="lineno">15231</span>&#160;    m_HeapSizeLimitMask(0),</div>
-<div class="line"><a name="l15232"></a><span class="lineno">15232</span>&#160;    m_PreferredLargeHeapBlockSize(0),</div>
-<div class="line"><a name="l15233"></a><span class="lineno">15233</span>&#160;    m_PhysicalDevice(pCreateInfo-&gt;physicalDevice),</div>
-<div class="line"><a name="l15234"></a><span class="lineno">15234</span>&#160;    m_CurrentFrameIndex(0),</div>
-<div class="line"><a name="l15235"></a><span class="lineno">15235</span>&#160;    m_GpuDefragmentationMemoryTypeBits(UINT32_MAX),</div>
-<div class="line"><a name="l15236"></a><span class="lineno">15236</span>&#160;    m_Pools(VmaStlAllocator&lt;<a class="code" href="struct_vma_pool.html">VmaPool</a>&gt;(GetAllocationCallbacks())),</div>
-<div class="line"><a name="l15237"></a><span class="lineno">15237</span>&#160;    m_NextPoolId(0),</div>
-<div class="line"><a name="l15238"></a><span class="lineno">15238</span>&#160;    m_GlobalMemoryTypeBits(UINT32_MAX)</div>
-<div class="line"><a name="l15239"></a><span class="lineno">15239</span>&#160;#if <a class="code" href="vk__mem__alloc_8h.html#a1f0c126759fc96ccb6e2d23c101d770c">VMA_RECORDING_ENABLED</a></div>
-<div class="line"><a name="l15240"></a><span class="lineno">15240</span>&#160;    ,m_pRecorder(VMA_NULL)</div>
-<div class="line"><a name="l15241"></a><span class="lineno">15241</span>&#160;#endif</div>
-<div class="line"><a name="l15242"></a><span class="lineno">15242</span>&#160;{</div>
-<div class="line"><a name="l15243"></a><span class="lineno">15243</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
-<div class="line"><a name="l15244"></a><span class="lineno">15244</span>&#160;    {</div>
-<div class="line"><a name="l15245"></a><span class="lineno">15245</span>&#160;        m_UseKhrDedicatedAllocation = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l15246"></a><span class="lineno">15246</span>&#160;        m_UseKhrBindMemory2 = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l15247"></a><span class="lineno">15247</span>&#160;    }</div>
-<div class="line"><a name="l15248"></a><span class="lineno">15248</span>&#160; </div>
-<div class="line"><a name="l15249"></a><span class="lineno">15249</span>&#160;    <span class="keywordflow">if</span>(VMA_DEBUG_DETECT_CORRUPTION)</div>
-<div class="line"><a name="l15250"></a><span class="lineno">15250</span>&#160;    {</div>
-<div class="line"><a name="l15251"></a><span class="lineno">15251</span>&#160;        <span class="comment">// Needs to be multiply of uint32_t size because we are going to write VMA_CORRUPTION_DETECTION_MAGIC_VALUE to it.</span></div>
-<div class="line"><a name="l15252"></a><span class="lineno">15252</span>&#160;        VMA_ASSERT(VMA_DEBUG_MARGIN % <span class="keyword">sizeof</span>(uint32_t) == 0);</div>
-<div class="line"><a name="l15253"></a><span class="lineno">15253</span>&#160;    }</div>
-<div class="line"><a name="l15254"></a><span class="lineno">15254</span>&#160; </div>
-<div class="line"><a name="l15255"></a><span class="lineno">15255</span>&#160;    VMA_ASSERT(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156">physicalDevice</a> &amp;&amp; pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500">device</a> &amp;&amp; pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b">instance</a>);</div>
-<div class="line"><a name="l15256"></a><span class="lineno">15256</span>&#160; </div>
-<div class="line"><a name="l15257"></a><span class="lineno">15257</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &lt; VK_MAKE_VERSION(1, 1, 0))</div>
-<div class="line"><a name="l15258"></a><span class="lineno">15258</span>&#160;    {</div>
-<div class="line"><a name="l15259"></a><span class="lineno">15259</span>&#160;<span class="preprocessor">#if !(VMA_DEDICATED_ALLOCATION)</span></div>
-<div class="line"><a name="l15260"></a><span class="lineno">15260</span>&#160;        <span class="keywordflow">if</span>((pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a>) != 0)</div>
-<div class="line"><a name="l15261"></a><span class="lineno">15261</span>&#160;        {</div>
-<div class="line"><a name="l15262"></a><span class="lineno">15262</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT set but required extensions are disabled by preprocessor macros.&quot;</span>);</div>
-<div class="line"><a name="l15263"></a><span class="lineno">15263</span>&#160;        }</div>
-<div class="line"><a name="l15264"></a><span class="lineno">15264</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15265"></a><span class="lineno">15265</span>&#160;<span class="preprocessor">#if !(VMA_BIND_MEMORY2)</span></div>
-<div class="line"><a name="l15266"></a><span class="lineno">15266</span>&#160;        <span class="keywordflow">if</span>((pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a>) != 0)</div>
-<div class="line"><a name="l15267"></a><span class="lineno">15267</span>&#160;        {</div>
-<div class="line"><a name="l15268"></a><span class="lineno">15268</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT set but required extension is disabled by preprocessor macros.&quot;</span>);</div>
-<div class="line"><a name="l15269"></a><span class="lineno">15269</span>&#160;        }</div>
-<div class="line"><a name="l15270"></a><span class="lineno">15270</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15271"></a><span class="lineno">15271</span>&#160;    }</div>
-<div class="line"><a name="l15272"></a><span class="lineno">15272</span>&#160;<span class="preprocessor">#if !(VMA_MEMORY_BUDGET)</span></div>
-<div class="line"><a name="l15273"></a><span class="lineno">15273</span>&#160;    <span class="keywordflow">if</span>((pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0">VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT</a>) != 0)</div>
-<div class="line"><a name="l15274"></a><span class="lineno">15274</span>&#160;    {</div>
-<div class="line"><a name="l15275"></a><span class="lineno">15275</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT set but required extension is disabled by preprocessor macros.&quot;</span>);</div>
-<div class="line"><a name="l15276"></a><span class="lineno">15276</span>&#160;    }</div>
-<div class="line"><a name="l15277"></a><span class="lineno">15277</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15278"></a><span class="lineno">15278</span>&#160;<span class="preprocessor">#if !(VMA_BUFFER_DEVICE_ADDRESS)</span></div>
-<div class="line"><a name="l15279"></a><span class="lineno">15279</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrBufferDeviceAddress)</div>
-<div class="line"><a name="l15280"></a><span class="lineno">15280</span>&#160;    {</div>
-<div class="line"><a name="l15281"></a><span class="lineno">15281</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT is set but required extension or Vulkan 1.2 is not available in your Vulkan header or its support in VMA has been disabled by a preprocessor macro.&quot;</span>);</div>
-<div class="line"><a name="l15282"></a><span class="lineno">15282</span>&#160;    }</div>
-<div class="line"><a name="l15283"></a><span class="lineno">15283</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15284"></a><span class="lineno">15284</span>&#160;<span class="preprocessor">#if VMA_VULKAN_VERSION &lt; 1002000</span></div>
-<div class="line"><a name="l15285"></a><span class="lineno">15285</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 2, 0))</div>
-<div class="line"><a name="l15286"></a><span class="lineno">15286</span>&#160;    {</div>
-<div class="line"><a name="l15287"></a><span class="lineno">15287</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;vulkanApiVersion &gt;= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros.&quot;</span>);</div>
-<div class="line"><a name="l15288"></a><span class="lineno">15288</span>&#160;    }</div>
-<div class="line"><a name="l15289"></a><span class="lineno">15289</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15290"></a><span class="lineno">15290</span>&#160;<span class="preprocessor">#if VMA_VULKAN_VERSION &lt; 1001000</span></div>
-<div class="line"><a name="l15291"></a><span class="lineno">15291</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
-<div class="line"><a name="l15292"></a><span class="lineno">15292</span>&#160;    {</div>
-<div class="line"><a name="l15293"></a><span class="lineno">15293</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;vulkanApiVersion &gt;= VK_API_VERSION_1_1 but required Vulkan version is disabled by preprocessor macros.&quot;</span>);</div>
-<div class="line"><a name="l15294"></a><span class="lineno">15294</span>&#160;    }</div>
-<div class="line"><a name="l15295"></a><span class="lineno">15295</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15214"></a><span class="lineno">15214</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15215"></a><span class="lineno">15215</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDestroyBuffer,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15216"></a><span class="lineno">15216</span>&#160;        allocation);</div>
+<div class="line"><a name="l15217"></a><span class="lineno">15217</span>&#160;    Flush();</div>
+<div class="line"><a name="l15218"></a><span class="lineno">15218</span>&#160;}</div>
+<div class="line"><a name="l15219"></a><span class="lineno">15219</span>&#160; </div>
+<div class="line"><a name="l15220"></a><span class="lineno">15220</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDestroyImage(uint32_t frameIndex,</div>
+<div class="line"><a name="l15221"></a><span class="lineno">15221</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l15222"></a><span class="lineno">15222</span>&#160;{</div>
+<div class="line"><a name="l15223"></a><span class="lineno">15223</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15224"></a><span class="lineno">15224</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15225"></a><span class="lineno">15225</span>&#160; </div>
+<div class="line"><a name="l15226"></a><span class="lineno">15226</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15227"></a><span class="lineno">15227</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDestroyImage,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15228"></a><span class="lineno">15228</span>&#160;        allocation);</div>
+<div class="line"><a name="l15229"></a><span class="lineno">15229</span>&#160;    Flush();</div>
+<div class="line"><a name="l15230"></a><span class="lineno">15230</span>&#160;}</div>
+<div class="line"><a name="l15231"></a><span class="lineno">15231</span>&#160; </div>
+<div class="line"><a name="l15232"></a><span class="lineno">15232</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordTouchAllocation(uint32_t frameIndex,</div>
+<div class="line"><a name="l15233"></a><span class="lineno">15233</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l15234"></a><span class="lineno">15234</span>&#160;{</div>
+<div class="line"><a name="l15235"></a><span class="lineno">15235</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15236"></a><span class="lineno">15236</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15237"></a><span class="lineno">15237</span>&#160; </div>
+<div class="line"><a name="l15238"></a><span class="lineno">15238</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15239"></a><span class="lineno">15239</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaTouchAllocation,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15240"></a><span class="lineno">15240</span>&#160;        allocation);</div>
+<div class="line"><a name="l15241"></a><span class="lineno">15241</span>&#160;    Flush();</div>
+<div class="line"><a name="l15242"></a><span class="lineno">15242</span>&#160;}</div>
+<div class="line"><a name="l15243"></a><span class="lineno">15243</span>&#160; </div>
+<div class="line"><a name="l15244"></a><span class="lineno">15244</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordGetAllocationInfo(uint32_t frameIndex,</div>
+<div class="line"><a name="l15245"></a><span class="lineno">15245</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l15246"></a><span class="lineno">15246</span>&#160;{</div>
+<div class="line"><a name="l15247"></a><span class="lineno">15247</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15248"></a><span class="lineno">15248</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15249"></a><span class="lineno">15249</span>&#160; </div>
+<div class="line"><a name="l15250"></a><span class="lineno">15250</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15251"></a><span class="lineno">15251</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaGetAllocationInfo,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15252"></a><span class="lineno">15252</span>&#160;        allocation);</div>
+<div class="line"><a name="l15253"></a><span class="lineno">15253</span>&#160;    Flush();</div>
+<div class="line"><a name="l15254"></a><span class="lineno">15254</span>&#160;}</div>
+<div class="line"><a name="l15255"></a><span class="lineno">15255</span>&#160; </div>
+<div class="line"><a name="l15256"></a><span class="lineno">15256</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordMakePoolAllocationsLost(uint32_t frameIndex,</div>
+<div class="line"><a name="l15257"></a><span class="lineno">15257</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
+<div class="line"><a name="l15258"></a><span class="lineno">15258</span>&#160;{</div>
+<div class="line"><a name="l15259"></a><span class="lineno">15259</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15260"></a><span class="lineno">15260</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15261"></a><span class="lineno">15261</span>&#160; </div>
+<div class="line"><a name="l15262"></a><span class="lineno">15262</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15263"></a><span class="lineno">15263</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaMakePoolAllocationsLost,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15264"></a><span class="lineno">15264</span>&#160;        pool);</div>
+<div class="line"><a name="l15265"></a><span class="lineno">15265</span>&#160;    Flush();</div>
+<div class="line"><a name="l15266"></a><span class="lineno">15266</span>&#160;}</div>
+<div class="line"><a name="l15267"></a><span class="lineno">15267</span>&#160; </div>
+<div class="line"><a name="l15268"></a><span class="lineno">15268</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDefragmentationBegin(uint32_t frameIndex,</div>
+<div class="line"><a name="l15269"></a><span class="lineno">15269</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>&amp; info,</div>
+<div class="line"><a name="l15270"></a><span class="lineno">15270</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx)</div>
+<div class="line"><a name="l15271"></a><span class="lineno">15271</span>&#160;{</div>
+<div class="line"><a name="l15272"></a><span class="lineno">15272</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15273"></a><span class="lineno">15273</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15274"></a><span class="lineno">15274</span>&#160; </div>
+<div class="line"><a name="l15275"></a><span class="lineno">15275</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15276"></a><span class="lineno">15276</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDefragmentationBegin,%u,&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15277"></a><span class="lineno">15277</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9">flags</a>);</div>
+<div class="line"><a name="l15278"></a><span class="lineno">15278</span>&#160;    PrintPointerList(info.<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a>);</div>
+<div class="line"><a name="l15279"></a><span class="lineno">15279</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;,&quot;</span>);</div>
+<div class="line"><a name="l15280"></a><span class="lineno">15280</span>&#160;    PrintPointerList(info.<a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">pPools</a>);</div>
+<div class="line"><a name="l15281"></a><span class="lineno">15281</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;,%llu,%u,%llu,%u,%p,%p\n&quot;</span>,</div>
+<div class="line"><a name="l15282"></a><span class="lineno">15282</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">maxCpuBytesToMove</a>,</div>
+<div class="line"><a name="l15283"></a><span class="lineno">15283</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">maxCpuAllocationsToMove</a>,</div>
+<div class="line"><a name="l15284"></a><span class="lineno">15284</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08">maxGpuBytesToMove</a>,</div>
+<div class="line"><a name="l15285"></a><span class="lineno">15285</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6">maxGpuAllocationsToMove</a>,</div>
+<div class="line"><a name="l15286"></a><span class="lineno">15286</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd">commandBuffer</a>,</div>
+<div class="line"><a name="l15287"></a><span class="lineno">15287</span>&#160;        ctx);</div>
+<div class="line"><a name="l15288"></a><span class="lineno">15288</span>&#160;    Flush();</div>
+<div class="line"><a name="l15289"></a><span class="lineno">15289</span>&#160;}</div>
+<div class="line"><a name="l15290"></a><span class="lineno">15290</span>&#160; </div>
+<div class="line"><a name="l15291"></a><span class="lineno">15291</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordDefragmentationEnd(uint32_t frameIndex,</div>
+<div class="line"><a name="l15292"></a><span class="lineno">15292</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx)</div>
+<div class="line"><a name="l15293"></a><span class="lineno">15293</span>&#160;{</div>
+<div class="line"><a name="l15294"></a><span class="lineno">15294</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15295"></a><span class="lineno">15295</span>&#160;    GetBasicParams(callParams);</div>
 <div class="line"><a name="l15296"></a><span class="lineno">15296</span>&#160; </div>
-<div class="line"><a name="l15297"></a><span class="lineno">15297</span>&#160;    memset(&amp;m_DeviceMemoryCallbacks, 0 ,<span class="keyword">sizeof</span>(m_DeviceMemoryCallbacks));</div>
-<div class="line"><a name="l15298"></a><span class="lineno">15298</span>&#160;    memset(&amp;m_PhysicalDeviceProperties, 0, <span class="keyword">sizeof</span>(m_PhysicalDeviceProperties));</div>
-<div class="line"><a name="l15299"></a><span class="lineno">15299</span>&#160;    memset(&amp;m_MemProps, 0, <span class="keyword">sizeof</span>(m_MemProps));</div>
-<div class="line"><a name="l15300"></a><span class="lineno">15300</span>&#160;        </div>
-<div class="line"><a name="l15301"></a><span class="lineno">15301</span>&#160;    memset(&amp;m_pBlockVectors, 0, <span class="keyword">sizeof</span>(m_pBlockVectors));</div>
-<div class="line"><a name="l15302"></a><span class="lineno">15302</span>&#160;    memset(&amp;m_pDedicatedAllocations, 0, <span class="keyword">sizeof</span>(m_pDedicatedAllocations));</div>
-<div class="line"><a name="l15303"></a><span class="lineno">15303</span>&#160;    memset(&amp;m_VulkanFunctions, 0, <span class="keyword">sizeof</span>(m_VulkanFunctions));</div>
-<div class="line"><a name="l15304"></a><span class="lineno">15304</span>&#160; </div>
-<div class="line"><a name="l15305"></a><span class="lineno">15305</span>&#160;    <span class="keywordflow">if</span>(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">pDeviceMemoryCallbacks</a> != VMA_NULL)</div>
-<div class="line"><a name="l15306"></a><span class="lineno">15306</span>&#160;    {</div>
-<div class="line"><a name="l15307"></a><span class="lineno">15307</span>&#160;        m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">pUserData</a> = pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">pDeviceMemoryCallbacks</a>-&gt;<a class="code" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">pUserData</a>;</div>
-<div class="line"><a name="l15308"></a><span class="lineno">15308</span>&#160;        m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">pfnAllocate</a> = pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">pDeviceMemoryCallbacks</a>-&gt;<a class="code" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">pfnAllocate</a>;</div>
-<div class="line"><a name="l15309"></a><span class="lineno">15309</span>&#160;        m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">pfnFree</a> = pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">pDeviceMemoryCallbacks</a>-&gt;<a class="code" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">pfnFree</a>;</div>
-<div class="line"><a name="l15310"></a><span class="lineno">15310</span>&#160;    }</div>
-<div class="line"><a name="l15311"></a><span class="lineno">15311</span>&#160; </div>
-<div class="line"><a name="l15312"></a><span class="lineno">15312</span>&#160;    ImportVulkanFunctions(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd">pVulkanFunctions</a>);</div>
-<div class="line"><a name="l15313"></a><span class="lineno">15313</span>&#160; </div>
-<div class="line"><a name="l15314"></a><span class="lineno">15314</span>&#160;    (*m_VulkanFunctions.vkGetPhysicalDeviceProperties)(m_PhysicalDevice, &amp;m_PhysicalDeviceProperties);</div>
-<div class="line"><a name="l15315"></a><span class="lineno">15315</span>&#160;    (*m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties)(m_PhysicalDevice, &amp;m_MemProps);</div>
-<div class="line"><a name="l15316"></a><span class="lineno">15316</span>&#160; </div>
-<div class="line"><a name="l15317"></a><span class="lineno">15317</span>&#160;    VMA_ASSERT(VmaIsPow2(VMA_DEBUG_ALIGNMENT));</div>
-<div class="line"><a name="l15318"></a><span class="lineno">15318</span>&#160;    VMA_ASSERT(VmaIsPow2(VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY));</div>
-<div class="line"><a name="l15319"></a><span class="lineno">15319</span>&#160;    VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.bufferImageGranularity));</div>
-<div class="line"><a name="l15320"></a><span class="lineno">15320</span>&#160;    VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.nonCoherentAtomSize));</div>
-<div class="line"><a name="l15321"></a><span class="lineno">15321</span>&#160; </div>
-<div class="line"><a name="l15322"></a><span class="lineno">15322</span>&#160;    m_PreferredLargeHeapBlockSize = (pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a">preferredLargeHeapBlockSize</a> != 0) ?</div>
-<div class="line"><a name="l15323"></a><span class="lineno">15323</span>&#160;        pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a">preferredLargeHeapBlockSize</a> : <span class="keyword">static_cast&lt;</span>VkDeviceSize<span class="keyword">&gt;</span>(VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE);</div>
-<div class="line"><a name="l15324"></a><span class="lineno">15324</span>&#160; </div>
-<div class="line"><a name="l15325"></a><span class="lineno">15325</span>&#160;    m_GlobalMemoryTypeBits = CalculateGlobalMemoryTypeBits();</div>
-<div class="line"><a name="l15326"></a><span class="lineno">15326</span>&#160; </div>
-<div class="line"><a name="l15327"></a><span class="lineno">15327</span>&#160;    <span class="keywordflow">if</span>(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b">pHeapSizeLimit</a> != VMA_NULL)</div>
-<div class="line"><a name="l15328"></a><span class="lineno">15328</span>&#160;    {</div>
-<div class="line"><a name="l15329"></a><span class="lineno">15329</span>&#160;        <span class="keywordflow">for</span>(uint32_t heapIndex = 0; heapIndex &lt; GetMemoryHeapCount(); ++heapIndex)</div>
-<div class="line"><a name="l15330"></a><span class="lineno">15330</span>&#160;        {</div>
-<div class="line"><a name="l15331"></a><span class="lineno">15331</span>&#160;            <span class="keyword">const</span> VkDeviceSize limit = pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b">pHeapSizeLimit</a>[heapIndex];</div>
-<div class="line"><a name="l15332"></a><span class="lineno">15332</span>&#160;            <span class="keywordflow">if</span>(limit != VK_WHOLE_SIZE)</div>
-<div class="line"><a name="l15333"></a><span class="lineno">15333</span>&#160;            {</div>
-<div class="line"><a name="l15334"></a><span class="lineno">15334</span>&#160;                m_HeapSizeLimitMask |= 1u &lt;&lt; heapIndex;</div>
-<div class="line"><a name="l15335"></a><span class="lineno">15335</span>&#160;                <span class="keywordflow">if</span>(limit &lt; m_MemProps.memoryHeaps[heapIndex].size)</div>
-<div class="line"><a name="l15336"></a><span class="lineno">15336</span>&#160;                {</div>
-<div class="line"><a name="l15337"></a><span class="lineno">15337</span>&#160;                    m_MemProps.memoryHeaps[heapIndex].size = limit;</div>
-<div class="line"><a name="l15338"></a><span class="lineno">15338</span>&#160;                }</div>
-<div class="line"><a name="l15339"></a><span class="lineno">15339</span>&#160;            }</div>
-<div class="line"><a name="l15340"></a><span class="lineno">15340</span>&#160;        }</div>
-<div class="line"><a name="l15341"></a><span class="lineno">15341</span>&#160;    }</div>
-<div class="line"><a name="l15342"></a><span class="lineno">15342</span>&#160; </div>
-<div class="line"><a name="l15343"></a><span class="lineno">15343</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
-<div class="line"><a name="l15344"></a><span class="lineno">15344</span>&#160;    {</div>
-<div class="line"><a name="l15345"></a><span class="lineno">15345</span>&#160;        <span class="keyword">const</span> VkDeviceSize preferredBlockSize = CalcPreferredBlockSize(memTypeIndex);</div>
+<div class="line"><a name="l15297"></a><span class="lineno">15297</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15298"></a><span class="lineno">15298</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaDefragmentationEnd,%p\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15299"></a><span class="lineno">15299</span>&#160;        ctx);</div>
+<div class="line"><a name="l15300"></a><span class="lineno">15300</span>&#160;    Flush();</div>
+<div class="line"><a name="l15301"></a><span class="lineno">15301</span>&#160;}</div>
+<div class="line"><a name="l15302"></a><span class="lineno">15302</span>&#160; </div>
+<div class="line"><a name="l15303"></a><span class="lineno">15303</span>&#160;<span class="keywordtype">void</span> VmaRecorder::RecordSetPoolName(uint32_t frameIndex,</div>
+<div class="line"><a name="l15304"></a><span class="lineno">15304</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
+<div class="line"><a name="l15305"></a><span class="lineno">15305</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* name)</div>
+<div class="line"><a name="l15306"></a><span class="lineno">15306</span>&#160;{</div>
+<div class="line"><a name="l15307"></a><span class="lineno">15307</span>&#160;    CallParams callParams;</div>
+<div class="line"><a name="l15308"></a><span class="lineno">15308</span>&#160;    GetBasicParams(callParams);</div>
+<div class="line"><a name="l15309"></a><span class="lineno">15309</span>&#160; </div>
+<div class="line"><a name="l15310"></a><span class="lineno">15310</span>&#160;    VmaMutexLock lock(m_FileMutex, m_UseMutex);</div>
+<div class="line"><a name="l15311"></a><span class="lineno">15311</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;%u,%.3f,%u,vmaSetPoolName,%p,%s\n&quot;</span>, callParams.threadId, callParams.time, frameIndex,</div>
+<div class="line"><a name="l15312"></a><span class="lineno">15312</span>&#160;        pool, name != VMA_NULL ? name : <span class="stringliteral">&quot;&quot;</span>);</div>
+<div class="line"><a name="l15313"></a><span class="lineno">15313</span>&#160;    Flush();</div>
+<div class="line"><a name="l15314"></a><span class="lineno">15314</span>&#160;}</div>
+<div class="line"><a name="l15315"></a><span class="lineno">15315</span>&#160; </div>
+<div class="line"><a name="l15316"></a><span class="lineno">15316</span>&#160;VmaRecorder::UserDataString::UserDataString(<a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlags, <span class="keyword">const</span> <span class="keywordtype">void</span>* pUserData)</div>
+<div class="line"><a name="l15317"></a><span class="lineno">15317</span>&#160;{</div>
+<div class="line"><a name="l15318"></a><span class="lineno">15318</span>&#160;    <span class="keywordflow">if</span>(pUserData != VMA_NULL)</div>
+<div class="line"><a name="l15319"></a><span class="lineno">15319</span>&#160;    {</div>
+<div class="line"><a name="l15320"></a><span class="lineno">15320</span>&#160;        <span class="keywordflow">if</span>((allocFlags &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a>) != 0)</div>
+<div class="line"><a name="l15321"></a><span class="lineno">15321</span>&#160;        {</div>
+<div class="line"><a name="l15322"></a><span class="lineno">15322</span>&#160;            m_Str = (<span class="keyword">const</span> <span class="keywordtype">char</span>*)pUserData;</div>
+<div class="line"><a name="l15323"></a><span class="lineno">15323</span>&#160;        }</div>
+<div class="line"><a name="l15324"></a><span class="lineno">15324</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l15325"></a><span class="lineno">15325</span>&#160;        {</div>
+<div class="line"><a name="l15326"></a><span class="lineno">15326</span>&#160;            sprintf_s(m_PtrStr, <span class="stringliteral">&quot;%p&quot;</span>, pUserData);</div>
+<div class="line"><a name="l15327"></a><span class="lineno">15327</span>&#160;            m_Str = m_PtrStr;</div>
+<div class="line"><a name="l15328"></a><span class="lineno">15328</span>&#160;        }</div>
+<div class="line"><a name="l15329"></a><span class="lineno">15329</span>&#160;    }</div>
+<div class="line"><a name="l15330"></a><span class="lineno">15330</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l15331"></a><span class="lineno">15331</span>&#160;    {</div>
+<div class="line"><a name="l15332"></a><span class="lineno">15332</span>&#160;        m_Str = <span class="stringliteral">&quot;&quot;</span>;</div>
+<div class="line"><a name="l15333"></a><span class="lineno">15333</span>&#160;    }</div>
+<div class="line"><a name="l15334"></a><span class="lineno">15334</span>&#160;}</div>
+<div class="line"><a name="l15335"></a><span class="lineno">15335</span>&#160; </div>
+<div class="line"><a name="l15336"></a><span class="lineno">15336</span>&#160;<span class="keywordtype">void</span> VmaRecorder::WriteConfiguration(</div>
+<div class="line"><a name="l15337"></a><span class="lineno">15337</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceProperties&amp; devProps,</div>
+<div class="line"><a name="l15338"></a><span class="lineno">15338</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceMemoryProperties&amp; memProps,</div>
+<div class="line"><a name="l15339"></a><span class="lineno">15339</span>&#160;    uint32_t vulkanApiVersion,</div>
+<div class="line"><a name="l15340"></a><span class="lineno">15340</span>&#160;    <span class="keywordtype">bool</span> dedicatedAllocationExtensionEnabled,</div>
+<div class="line"><a name="l15341"></a><span class="lineno">15341</span>&#160;    <span class="keywordtype">bool</span> bindMemory2ExtensionEnabled,</div>
+<div class="line"><a name="l15342"></a><span class="lineno">15342</span>&#160;    <span class="keywordtype">bool</span> memoryBudgetExtensionEnabled,</div>
+<div class="line"><a name="l15343"></a><span class="lineno">15343</span>&#160;    <span class="keywordtype">bool</span> deviceCoherentMemoryExtensionEnabled)</div>
+<div class="line"><a name="l15344"></a><span class="lineno">15344</span>&#160;{</div>
+<div class="line"><a name="l15345"></a><span class="lineno">15345</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Config,Begin\n&quot;</span>);</div>
 <div class="line"><a name="l15346"></a><span class="lineno">15346</span>&#160; </div>
-<div class="line"><a name="l15347"></a><span class="lineno">15347</span>&#160;        m_pBlockVectors[memTypeIndex] = vma_new(<span class="keyword">this</span>, VmaBlockVector)(</div>
-<div class="line"><a name="l15348"></a><span class="lineno">15348</span>&#160;            <span class="keyword">this</span>,</div>
-<div class="line"><a name="l15349"></a><span class="lineno">15349</span>&#160;            VK_NULL_HANDLE, <span class="comment">// hParentPool</span></div>
-<div class="line"><a name="l15350"></a><span class="lineno">15350</span>&#160;            memTypeIndex,</div>
-<div class="line"><a name="l15351"></a><span class="lineno">15351</span>&#160;            preferredBlockSize,</div>
-<div class="line"><a name="l15352"></a><span class="lineno">15352</span>&#160;            0,</div>
-<div class="line"><a name="l15353"></a><span class="lineno">15353</span>&#160;            SIZE_MAX,</div>
-<div class="line"><a name="l15354"></a><span class="lineno">15354</span>&#160;            GetBufferImageGranularity(),</div>
-<div class="line"><a name="l15355"></a><span class="lineno">15355</span>&#160;            pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7">frameInUseCount</a>,</div>
-<div class="line"><a name="l15356"></a><span class="lineno">15356</span>&#160;            <span class="keyword">false</span>, <span class="comment">// explicitBlockSize</span></div>
-<div class="line"><a name="l15357"></a><span class="lineno">15357</span>&#160;            <span class="keyword">false</span>); <span class="comment">// linearAlgorithm</span></div>
-<div class="line"><a name="l15358"></a><span class="lineno">15358</span>&#160;        <span class="comment">// No need to call m_pBlockVectors[memTypeIndex][blockVectorTypeIndex]-&gt;CreateMinBlocks here,</span></div>
-<div class="line"><a name="l15359"></a><span class="lineno">15359</span>&#160;        <span class="comment">// becase minBlockCount is 0.</span></div>
-<div class="line"><a name="l15360"></a><span class="lineno">15360</span>&#160;        m_pDedicatedAllocations[memTypeIndex] = vma_new(<span class="keyword">this</span>, AllocationVectorType)(VmaStlAllocator&lt;VmaAllocation&gt;(GetAllocationCallbacks()));</div>
-<div class="line"><a name="l15361"></a><span class="lineno">15361</span>&#160; </div>
-<div class="line"><a name="l15362"></a><span class="lineno">15362</span>&#160;    }</div>
-<div class="line"><a name="l15363"></a><span class="lineno">15363</span>&#160;}</div>
-<div class="line"><a name="l15364"></a><span class="lineno">15364</span>&#160; </div>
-<div class="line"><a name="l15365"></a><span class="lineno">15365</span>&#160;VkResult VmaAllocator_T::Init(<span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo)</div>
-<div class="line"><a name="l15366"></a><span class="lineno">15366</span>&#160;{</div>
-<div class="line"><a name="l15367"></a><span class="lineno">15367</span>&#160;    VkResult res = VK_SUCCESS;</div>
-<div class="line"><a name="l15368"></a><span class="lineno">15368</span>&#160; </div>
-<div class="line"><a name="l15369"></a><span class="lineno">15369</span>&#160;    <span class="keywordflow">if</span>(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee">pRecordSettings</a> != VMA_NULL &amp;&amp;</div>
-<div class="line"><a name="l15370"></a><span class="lineno">15370</span>&#160;        !VmaStrIsEmpty(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee">pRecordSettings</a>-&gt;<a class="code" href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d">pFilePath</a>))</div>
-<div class="line"><a name="l15371"></a><span class="lineno">15371</span>&#160;    {</div>
-<div class="line"><a name="l15372"></a><span class="lineno">15372</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l15373"></a><span class="lineno">15373</span>&#160;        m_pRecorder = vma_new(<span class="keyword">this</span>, VmaRecorder)();</div>
-<div class="line"><a name="l15374"></a><span class="lineno">15374</span>&#160;        res = m_pRecorder-&gt;Init(*pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee">pRecordSettings</a>, m_UseMutex);</div>
-<div class="line"><a name="l15375"></a><span class="lineno">15375</span>&#160;        <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
-<div class="line"><a name="l15376"></a><span class="lineno">15376</span>&#160;        {</div>
-<div class="line"><a name="l15377"></a><span class="lineno">15377</span>&#160;            <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l15378"></a><span class="lineno">15378</span>&#160;        }</div>
-<div class="line"><a name="l15379"></a><span class="lineno">15379</span>&#160;        m_pRecorder-&gt;WriteConfiguration(</div>
-<div class="line"><a name="l15380"></a><span class="lineno">15380</span>&#160;            m_PhysicalDeviceProperties,</div>
-<div class="line"><a name="l15381"></a><span class="lineno">15381</span>&#160;            m_MemProps,</div>
-<div class="line"><a name="l15382"></a><span class="lineno">15382</span>&#160;            m_VulkanApiVersion,</div>
-<div class="line"><a name="l15383"></a><span class="lineno">15383</span>&#160;            m_UseKhrDedicatedAllocation,</div>
-<div class="line"><a name="l15384"></a><span class="lineno">15384</span>&#160;            m_UseKhrBindMemory2,</div>
-<div class="line"><a name="l15385"></a><span class="lineno">15385</span>&#160;            m_UseExtMemoryBudget,</div>
-<div class="line"><a name="l15386"></a><span class="lineno">15386</span>&#160;            m_UseAmdDeviceCoherentMemory);</div>
-<div class="line"><a name="l15387"></a><span class="lineno">15387</span>&#160;        m_pRecorder-&gt;RecordCreateAllocator(GetCurrentFrameIndex());</div>
-<div class="line"><a name="l15388"></a><span class="lineno">15388</span>&#160;<span class="preprocessor">#else</span></div>
-<div class="line"><a name="l15389"></a><span class="lineno">15389</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VmaAllocatorCreateInfo::pRecordSettings used, but not supported due to VMA_RECORDING_ENABLED not defined to 1.&quot;</span>);</div>
-<div class="line"><a name="l15390"></a><span class="lineno">15390</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT;</div>
-<div class="line"><a name="l15391"></a><span class="lineno">15391</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15392"></a><span class="lineno">15392</span>&#160;    }</div>
-<div class="line"><a name="l15393"></a><span class="lineno">15393</span>&#160; </div>
-<div class="line"><a name="l15394"></a><span class="lineno">15394</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l15395"></a><span class="lineno">15395</span>&#160;    <span class="keywordflow">if</span>(m_UseExtMemoryBudget)</div>
-<div class="line"><a name="l15396"></a><span class="lineno">15396</span>&#160;    {</div>
-<div class="line"><a name="l15397"></a><span class="lineno">15397</span>&#160;        UpdateVulkanBudget();</div>
-<div class="line"><a name="l15398"></a><span class="lineno">15398</span>&#160;    }</div>
-<div class="line"><a name="l15399"></a><span class="lineno">15399</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l15400"></a><span class="lineno">15400</span>&#160; </div>
-<div class="line"><a name="l15401"></a><span class="lineno">15401</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l15402"></a><span class="lineno">15402</span>&#160;}</div>
-<div class="line"><a name="l15403"></a><span class="lineno">15403</span>&#160; </div>
-<div class="line"><a name="l15404"></a><span class="lineno">15404</span>&#160;VmaAllocator_T::~VmaAllocator_T()</div>
-<div class="line"><a name="l15405"></a><span class="lineno">15405</span>&#160;{</div>
-<div class="line"><a name="l15406"></a><span class="lineno">15406</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l15407"></a><span class="lineno">15407</span>&#160;    <span class="keywordflow">if</span>(m_pRecorder != VMA_NULL)</div>
-<div class="line"><a name="l15408"></a><span class="lineno">15408</span>&#160;    {</div>
-<div class="line"><a name="l15409"></a><span class="lineno">15409</span>&#160;        m_pRecorder-&gt;RecordDestroyAllocator(GetCurrentFrameIndex());</div>
-<div class="line"><a name="l15410"></a><span class="lineno">15410</span>&#160;        vma_delete(<span class="keyword">this</span>, m_pRecorder);</div>
-<div class="line"><a name="l15411"></a><span class="lineno">15411</span>&#160;    }</div>
-<div class="line"><a name="l15412"></a><span class="lineno">15412</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15413"></a><span class="lineno">15413</span>&#160;    </div>
-<div class="line"><a name="l15414"></a><span class="lineno">15414</span>&#160;    VMA_ASSERT(m_Pools.empty());</div>
-<div class="line"><a name="l15415"></a><span class="lineno">15415</span>&#160; </div>
-<div class="line"><a name="l15416"></a><span class="lineno">15416</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = GetMemoryTypeCount(); i--; )</div>
-<div class="line"><a name="l15417"></a><span class="lineno">15417</span>&#160;    {</div>
-<div class="line"><a name="l15418"></a><span class="lineno">15418</span>&#160;        <span class="keywordflow">if</span>(m_pDedicatedAllocations[i] != VMA_NULL &amp;&amp; !m_pDedicatedAllocations[i]-&gt;empty())</div>
-<div class="line"><a name="l15419"></a><span class="lineno">15419</span>&#160;        {</div>
-<div class="line"><a name="l15420"></a><span class="lineno">15420</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Unfreed dedicated allocations found.&quot;</span>);</div>
-<div class="line"><a name="l15421"></a><span class="lineno">15421</span>&#160;        }</div>
-<div class="line"><a name="l15422"></a><span class="lineno">15422</span>&#160; </div>
-<div class="line"><a name="l15423"></a><span class="lineno">15423</span>&#160;        vma_delete(<span class="keyword">this</span>, m_pDedicatedAllocations[i]);</div>
-<div class="line"><a name="l15424"></a><span class="lineno">15424</span>&#160;        vma_delete(<span class="keyword">this</span>, m_pBlockVectors[i]);</div>
-<div class="line"><a name="l15425"></a><span class="lineno">15425</span>&#160;    }</div>
-<div class="line"><a name="l15426"></a><span class="lineno">15426</span>&#160;}</div>
-<div class="line"><a name="l15427"></a><span class="lineno">15427</span>&#160; </div>
-<div class="line"><a name="l15428"></a><span class="lineno">15428</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::ImportVulkanFunctions(<span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* pVulkanFunctions)</div>
-<div class="line"><a name="l15429"></a><span class="lineno">15429</span>&#160;{</div>
-<div class="line"><a name="l15430"></a><span class="lineno">15430</span>&#160;<span class="preprocessor">#if VMA_STATIC_VULKAN_FUNCTIONS == 1</span></div>
-<div class="line"><a name="l15431"></a><span class="lineno">15431</span>&#160;    ImportVulkanFunctions_Static();</div>
-<div class="line"><a name="l15432"></a><span class="lineno">15432</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15433"></a><span class="lineno">15433</span>&#160; </div>
-<div class="line"><a name="l15434"></a><span class="lineno">15434</span>&#160;    <span class="keywordflow">if</span>(pVulkanFunctions != VMA_NULL)</div>
-<div class="line"><a name="l15435"></a><span class="lineno">15435</span>&#160;    {</div>
-<div class="line"><a name="l15436"></a><span class="lineno">15436</span>&#160;        ImportVulkanFunctions_Custom(pVulkanFunctions);</div>
-<div class="line"><a name="l15437"></a><span class="lineno">15437</span>&#160;    }</div>
-<div class="line"><a name="l15438"></a><span class="lineno">15438</span>&#160; </div>
-<div class="line"><a name="l15439"></a><span class="lineno">15439</span>&#160;<span class="preprocessor">#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1</span></div>
-<div class="line"><a name="l15440"></a><span class="lineno">15440</span>&#160;    ImportVulkanFunctions_Dynamic();</div>
-<div class="line"><a name="l15441"></a><span class="lineno">15441</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15442"></a><span class="lineno">15442</span>&#160; </div>
-<div class="line"><a name="l15443"></a><span class="lineno">15443</span>&#160;    ValidateVulkanFunctions();</div>
-<div class="line"><a name="l15444"></a><span class="lineno">15444</span>&#160;}</div>
-<div class="line"><a name="l15445"></a><span class="lineno">15445</span>&#160; </div>
-<div class="line"><a name="l15446"></a><span class="lineno">15446</span>&#160;<span class="preprocessor">#if VMA_STATIC_VULKAN_FUNCTIONS == 1</span></div>
-<div class="line"><a name="l15447"></a><span class="lineno">15447</span>&#160; </div>
-<div class="line"><a name="l15448"></a><span class="lineno">15448</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::ImportVulkanFunctions_Static()</div>
-<div class="line"><a name="l15449"></a><span class="lineno">15449</span>&#160;{</div>
-<div class="line"><a name="l15450"></a><span class="lineno">15450</span>&#160;    <span class="comment">// Vulkan 1.0</span></div>
-<div class="line"><a name="l15451"></a><span class="lineno">15451</span>&#160;    m_VulkanFunctions.vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties)vkGetPhysicalDeviceProperties;</div>
-<div class="line"><a name="l15452"></a><span class="lineno">15452</span>&#160;    m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties)vkGetPhysicalDeviceMemoryProperties;</div>
-<div class="line"><a name="l15453"></a><span class="lineno">15453</span>&#160;    m_VulkanFunctions.vkAllocateMemory = (PFN_vkAllocateMemory)vkAllocateMemory;</div>
-<div class="line"><a name="l15454"></a><span class="lineno">15454</span>&#160;    m_VulkanFunctions.vkFreeMemory = (PFN_vkFreeMemory)vkFreeMemory;</div>
-<div class="line"><a name="l15455"></a><span class="lineno">15455</span>&#160;    m_VulkanFunctions.vkMapMemory = (PFN_vkMapMemory)vkMapMemory;</div>
-<div class="line"><a name="l15456"></a><span class="lineno">15456</span>&#160;    m_VulkanFunctions.vkUnmapMemory = (PFN_vkUnmapMemory)vkUnmapMemory;</div>
-<div class="line"><a name="l15457"></a><span class="lineno">15457</span>&#160;    m_VulkanFunctions.vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges)vkFlushMappedMemoryRanges;</div>
-<div class="line"><a name="l15458"></a><span class="lineno">15458</span>&#160;    m_VulkanFunctions.vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges)vkInvalidateMappedMemoryRanges;</div>
-<div class="line"><a name="l15459"></a><span class="lineno">15459</span>&#160;    m_VulkanFunctions.vkBindBufferMemory = (PFN_vkBindBufferMemory)vkBindBufferMemory;</div>
-<div class="line"><a name="l15460"></a><span class="lineno">15460</span>&#160;    m_VulkanFunctions.vkBindImageMemory = (PFN_vkBindImageMemory)vkBindImageMemory;</div>
-<div class="line"><a name="l15461"></a><span class="lineno">15461</span>&#160;    m_VulkanFunctions.vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements)vkGetBufferMemoryRequirements;</div>
-<div class="line"><a name="l15462"></a><span class="lineno">15462</span>&#160;    m_VulkanFunctions.vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements)vkGetImageMemoryRequirements;</div>
-<div class="line"><a name="l15463"></a><span class="lineno">15463</span>&#160;    m_VulkanFunctions.vkCreateBuffer = (PFN_vkCreateBuffer)vkCreateBuffer;</div>
-<div class="line"><a name="l15464"></a><span class="lineno">15464</span>&#160;    m_VulkanFunctions.vkDestroyBuffer = (PFN_vkDestroyBuffer)vkDestroyBuffer;</div>
-<div class="line"><a name="l15465"></a><span class="lineno">15465</span>&#160;    m_VulkanFunctions.vkCreateImage = (PFN_vkCreateImage)vkCreateImage;</div>
-<div class="line"><a name="l15466"></a><span class="lineno">15466</span>&#160;    m_VulkanFunctions.vkDestroyImage = (PFN_vkDestroyImage)vkDestroyImage;</div>
-<div class="line"><a name="l15467"></a><span class="lineno">15467</span>&#160;    m_VulkanFunctions.vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer)vkCmdCopyBuffer;</div>
-<div class="line"><a name="l15468"></a><span class="lineno">15468</span>&#160; </div>
-<div class="line"><a name="l15469"></a><span class="lineno">15469</span>&#160;    <span class="comment">// Vulkan 1.1</span></div>
-<div class="line"><a name="l15470"></a><span class="lineno">15470</span>&#160;<span class="preprocessor">#if VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l15347"></a><span class="lineno">15347</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;VulkanApiVersion,%u,%u\n&quot;</span>, VK_VERSION_MAJOR(vulkanApiVersion), VK_VERSION_MINOR(vulkanApiVersion));</div>
+<div class="line"><a name="l15348"></a><span class="lineno">15348</span>&#160; </div>
+<div class="line"><a name="l15349"></a><span class="lineno">15349</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,apiVersion,%u\n&quot;</span>, devProps.apiVersion);</div>
+<div class="line"><a name="l15350"></a><span class="lineno">15350</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,driverVersion,%u\n&quot;</span>, devProps.driverVersion);</div>
+<div class="line"><a name="l15351"></a><span class="lineno">15351</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,vendorID,%u\n&quot;</span>, devProps.vendorID);</div>
+<div class="line"><a name="l15352"></a><span class="lineno">15352</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,deviceID,%u\n&quot;</span>, devProps.deviceID);</div>
+<div class="line"><a name="l15353"></a><span class="lineno">15353</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,deviceType,%u\n&quot;</span>, devProps.deviceType);</div>
+<div class="line"><a name="l15354"></a><span class="lineno">15354</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDevice,deviceName,%s\n&quot;</span>, devProps.deviceName);</div>
+<div class="line"><a name="l15355"></a><span class="lineno">15355</span>&#160; </div>
+<div class="line"><a name="l15356"></a><span class="lineno">15356</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceLimits,maxMemoryAllocationCount,%u\n&quot;</span>, devProps.limits.maxMemoryAllocationCount);</div>
+<div class="line"><a name="l15357"></a><span class="lineno">15357</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceLimits,bufferImageGranularity,%llu\n&quot;</span>, devProps.limits.bufferImageGranularity);</div>
+<div class="line"><a name="l15358"></a><span class="lineno">15358</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceLimits,nonCoherentAtomSize,%llu\n&quot;</span>, devProps.limits.nonCoherentAtomSize);</div>
+<div class="line"><a name="l15359"></a><span class="lineno">15359</span>&#160; </div>
+<div class="line"><a name="l15360"></a><span class="lineno">15360</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,HeapCount,%u\n&quot;</span>, memProps.memoryHeapCount);</div>
+<div class="line"><a name="l15361"></a><span class="lineno">15361</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; memProps.memoryHeapCount; ++i)</div>
+<div class="line"><a name="l15362"></a><span class="lineno">15362</span>&#160;    {</div>
+<div class="line"><a name="l15363"></a><span class="lineno">15363</span>&#160;        fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,Heap,%u,size,%llu\n&quot;</span>, i, memProps.memoryHeaps[i].size);</div>
+<div class="line"><a name="l15364"></a><span class="lineno">15364</span>&#160;        fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,Heap,%u,flags,%u\n&quot;</span>, i, memProps.memoryHeaps[i].flags);</div>
+<div class="line"><a name="l15365"></a><span class="lineno">15365</span>&#160;    }</div>
+<div class="line"><a name="l15366"></a><span class="lineno">15366</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,TypeCount,%u\n&quot;</span>, memProps.memoryTypeCount);</div>
+<div class="line"><a name="l15367"></a><span class="lineno">15367</span>&#160;    <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; memProps.memoryTypeCount; ++i)</div>
+<div class="line"><a name="l15368"></a><span class="lineno">15368</span>&#160;    {</div>
+<div class="line"><a name="l15369"></a><span class="lineno">15369</span>&#160;        fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,Type,%u,heapIndex,%u\n&quot;</span>, i, memProps.memoryTypes[i].heapIndex);</div>
+<div class="line"><a name="l15370"></a><span class="lineno">15370</span>&#160;        fprintf(m_File, <span class="stringliteral">&quot;PhysicalDeviceMemory,Type,%u,propertyFlags,%u\n&quot;</span>, i, memProps.memoryTypes[i].propertyFlags);</div>
+<div class="line"><a name="l15371"></a><span class="lineno">15371</span>&#160;    }</div>
+<div class="line"><a name="l15372"></a><span class="lineno">15372</span>&#160; </div>
+<div class="line"><a name="l15373"></a><span class="lineno">15373</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Extension,VK_KHR_dedicated_allocation,%u\n&quot;</span>, dedicatedAllocationExtensionEnabled ? 1 : 0);</div>
+<div class="line"><a name="l15374"></a><span class="lineno">15374</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Extension,VK_KHR_bind_memory2,%u\n&quot;</span>, bindMemory2ExtensionEnabled ? 1 : 0);</div>
+<div class="line"><a name="l15375"></a><span class="lineno">15375</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Extension,VK_EXT_memory_budget,%u\n&quot;</span>, memoryBudgetExtensionEnabled ? 1 : 0);</div>
+<div class="line"><a name="l15376"></a><span class="lineno">15376</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Extension,VK_AMD_device_coherent_memory,%u\n&quot;</span>, deviceCoherentMemoryExtensionEnabled ? 1 : 0);</div>
+<div class="line"><a name="l15377"></a><span class="lineno">15377</span>&#160; </div>
+<div class="line"><a name="l15378"></a><span class="lineno">15378</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,%u\n&quot;</span>, VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ? 1 : 0);</div>
+<div class="line"><a name="l15379"></a><span class="lineno">15379</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_ALIGNMENT,%llu\n&quot;</span>, (VkDeviceSize)VMA_DEBUG_ALIGNMENT);</div>
+<div class="line"><a name="l15380"></a><span class="lineno">15380</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_MARGIN,%llu\n&quot;</span>, (VkDeviceSize)VMA_DEBUG_MARGIN);</div>
+<div class="line"><a name="l15381"></a><span class="lineno">15381</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,%u\n&quot;</span>, VMA_DEBUG_INITIALIZE_ALLOCATIONS ? 1 : 0);</div>
+<div class="line"><a name="l15382"></a><span class="lineno">15382</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_DETECT_CORRUPTION,%u\n&quot;</span>, VMA_DEBUG_DETECT_CORRUPTION ? 1 : 0);</div>
+<div class="line"><a name="l15383"></a><span class="lineno">15383</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_GLOBAL_MUTEX,%u\n&quot;</span>, VMA_DEBUG_GLOBAL_MUTEX ? 1 : 0);</div>
+<div class="line"><a name="l15384"></a><span class="lineno">15384</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY,%llu\n&quot;</span>, (VkDeviceSize)VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY);</div>
+<div class="line"><a name="l15385"></a><span class="lineno">15385</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_SMALL_HEAP_MAX_SIZE,%llu\n&quot;</span>, (VkDeviceSize)VMA_SMALL_HEAP_MAX_SIZE);</div>
+<div class="line"><a name="l15386"></a><span class="lineno">15386</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Macro,VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE,%llu\n&quot;</span>, (VkDeviceSize)VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE);</div>
+<div class="line"><a name="l15387"></a><span class="lineno">15387</span>&#160; </div>
+<div class="line"><a name="l15388"></a><span class="lineno">15388</span>&#160;    fprintf(m_File, <span class="stringliteral">&quot;Config,End\n&quot;</span>);</div>
+<div class="line"><a name="l15389"></a><span class="lineno">15389</span>&#160;}</div>
+<div class="line"><a name="l15390"></a><span class="lineno">15390</span>&#160; </div>
+<div class="line"><a name="l15391"></a><span class="lineno">15391</span>&#160;<span class="keywordtype">void</span> VmaRecorder::GetBasicParams(CallParams&amp; outParams)</div>
+<div class="line"><a name="l15392"></a><span class="lineno">15392</span>&#160;{</div>
+<div class="line"><a name="l15393"></a><span class="lineno">15393</span>&#160;    outParams.threadId = GetCurrentThreadId();</div>
+<div class="line"><a name="l15394"></a><span class="lineno">15394</span>&#160; </div>
+<div class="line"><a name="l15395"></a><span class="lineno">15395</span>&#160;    LARGE_INTEGER counter;</div>
+<div class="line"><a name="l15396"></a><span class="lineno">15396</span>&#160;    QueryPerformanceCounter(&amp;counter);</div>
+<div class="line"><a name="l15397"></a><span class="lineno">15397</span>&#160;    outParams.time = (double)(counter.QuadPart - m_StartCounter) / (double)m_Freq;</div>
+<div class="line"><a name="l15398"></a><span class="lineno">15398</span>&#160;}</div>
+<div class="line"><a name="l15399"></a><span class="lineno">15399</span>&#160; </div>
+<div class="line"><a name="l15400"></a><span class="lineno">15400</span>&#160;<span class="keywordtype">void</span> VmaRecorder::PrintPointerList(uint64_t count, <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pItems)</div>
+<div class="line"><a name="l15401"></a><span class="lineno">15401</span>&#160;{</div>
+<div class="line"><a name="l15402"></a><span class="lineno">15402</span>&#160;    <span class="keywordflow">if</span>(count)</div>
+<div class="line"><a name="l15403"></a><span class="lineno">15403</span>&#160;    {</div>
+<div class="line"><a name="l15404"></a><span class="lineno">15404</span>&#160;        fprintf(m_File, <span class="stringliteral">&quot;%p&quot;</span>, pItems[0]);</div>
+<div class="line"><a name="l15405"></a><span class="lineno">15405</span>&#160;        <span class="keywordflow">for</span>(uint64_t i = 1; i &lt; count; ++i)</div>
+<div class="line"><a name="l15406"></a><span class="lineno">15406</span>&#160;        {</div>
+<div class="line"><a name="l15407"></a><span class="lineno">15407</span>&#160;            fprintf(m_File, <span class="stringliteral">&quot; %p&quot;</span>, pItems[i]);</div>
+<div class="line"><a name="l15408"></a><span class="lineno">15408</span>&#160;        }</div>
+<div class="line"><a name="l15409"></a><span class="lineno">15409</span>&#160;    }</div>
+<div class="line"><a name="l15410"></a><span class="lineno">15410</span>&#160;}</div>
+<div class="line"><a name="l15411"></a><span class="lineno">15411</span>&#160; </div>
+<div class="line"><a name="l15412"></a><span class="lineno">15412</span>&#160;<span class="keywordtype">void</span> VmaRecorder::Flush()</div>
+<div class="line"><a name="l15413"></a><span class="lineno">15413</span>&#160;{</div>
+<div class="line"><a name="l15414"></a><span class="lineno">15414</span>&#160;    <span class="keywordflow">if</span>((m_Flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7">VMA_RECORD_FLUSH_AFTER_CALL_BIT</a>) != 0)</div>
+<div class="line"><a name="l15415"></a><span class="lineno">15415</span>&#160;    {</div>
+<div class="line"><a name="l15416"></a><span class="lineno">15416</span>&#160;        fflush(m_File);</div>
+<div class="line"><a name="l15417"></a><span class="lineno">15417</span>&#160;    }</div>
+<div class="line"><a name="l15418"></a><span class="lineno">15418</span>&#160;}</div>
+<div class="line"><a name="l15419"></a><span class="lineno">15419</span>&#160; </div>
+<div class="line"><a name="l15420"></a><span class="lineno">15420</span>&#160;<span class="preprocessor">#endif // #if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l15421"></a><span class="lineno">15421</span>&#160; </div>
+<div class="line"><a name="l15423"></a><span class="lineno">15423</span>&#160;<span class="comment">// VmaAllocationObjectAllocator</span></div>
+<div class="line"><a name="l15424"></a><span class="lineno">15424</span>&#160; </div>
+<div class="line"><a name="l15425"></a><span class="lineno">15425</span>&#160;VmaAllocationObjectAllocator::VmaAllocationObjectAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks) :</div>
+<div class="line"><a name="l15426"></a><span class="lineno">15426</span>&#160;    m_Allocator(pAllocationCallbacks, 1024)</div>
+<div class="line"><a name="l15427"></a><span class="lineno">15427</span>&#160;{</div>
+<div class="line"><a name="l15428"></a><span class="lineno">15428</span>&#160;}</div>
+<div class="line"><a name="l15429"></a><span class="lineno">15429</span>&#160; </div>
+<div class="line"><a name="l15430"></a><span class="lineno">15430</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span>... Types&gt; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> VmaAllocationObjectAllocator::Allocate(Types... args)</div>
+<div class="line"><a name="l15431"></a><span class="lineno">15431</span>&#160;{</div>
+<div class="line"><a name="l15432"></a><span class="lineno">15432</span>&#160;    VmaMutexLock mutexLock(m_Mutex);</div>
+<div class="line"><a name="l15433"></a><span class="lineno">15433</span>&#160;    <span class="keywordflow">return</span> m_Allocator.Alloc&lt;Types...&gt;(std::forward&lt;Types&gt;(args)...);</div>
+<div class="line"><a name="l15434"></a><span class="lineno">15434</span>&#160;}</div>
+<div class="line"><a name="l15435"></a><span class="lineno">15435</span>&#160; </div>
+<div class="line"><a name="l15436"></a><span class="lineno">15436</span>&#160;<span class="keywordtype">void</span> VmaAllocationObjectAllocator::Free(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc)</div>
+<div class="line"><a name="l15437"></a><span class="lineno">15437</span>&#160;{</div>
+<div class="line"><a name="l15438"></a><span class="lineno">15438</span>&#160;    VmaMutexLock mutexLock(m_Mutex);</div>
+<div class="line"><a name="l15439"></a><span class="lineno">15439</span>&#160;    m_Allocator.Free(hAlloc);</div>
+<div class="line"><a name="l15440"></a><span class="lineno">15440</span>&#160;}</div>
+<div class="line"><a name="l15441"></a><span class="lineno">15441</span>&#160; </div>
+<div class="line"><a name="l15443"></a><span class="lineno">15443</span>&#160;<span class="comment">// VmaAllocator_T</span></div>
+<div class="line"><a name="l15444"></a><span class="lineno">15444</span>&#160; </div>
+<div class="line"><a name="l15445"></a><span class="lineno">15445</span>&#160;VmaAllocator_T::VmaAllocator_T(<span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo) :</div>
+<div class="line"><a name="l15446"></a><span class="lineno">15446</span>&#160;    m_UseMutex((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d">VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT</a>) == 0),</div>
+<div class="line"><a name="l15447"></a><span class="lineno">15447</span>&#160;    m_VulkanApiVersion(pCreateInfo-&gt;vulkanApiVersion != 0 ? pCreateInfo-&gt;vulkanApiVersion : VK_API_VERSION_1_0),</div>
+<div class="line"><a name="l15448"></a><span class="lineno">15448</span>&#160;    m_UseKhrDedicatedAllocation((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a>) != 0),</div>
+<div class="line"><a name="l15449"></a><span class="lineno">15449</span>&#160;    m_UseKhrBindMemory2((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a>) != 0),</div>
+<div class="line"><a name="l15450"></a><span class="lineno">15450</span>&#160;    m_UseExtMemoryBudget((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0">VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT</a>) != 0),</div>
+<div class="line"><a name="l15451"></a><span class="lineno">15451</span>&#160;    m_UseAmdDeviceCoherentMemory((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f">VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT</a>) != 0),</div>
+<div class="line"><a name="l15452"></a><span class="lineno">15452</span>&#160;    m_UseKhrBufferDeviceAddress((pCreateInfo-&gt;flags &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089">VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT</a>) != 0),</div>
+<div class="line"><a name="l15453"></a><span class="lineno">15453</span>&#160;    m_hDevice(pCreateInfo-&gt;device),</div>
+<div class="line"><a name="l15454"></a><span class="lineno">15454</span>&#160;    m_hInstance(pCreateInfo-&gt;instance),</div>
+<div class="line"><a name="l15455"></a><span class="lineno">15455</span>&#160;    m_AllocationCallbacksSpecified(pCreateInfo-&gt;pAllocationCallbacks != VMA_NULL),</div>
+<div class="line"><a name="l15456"></a><span class="lineno">15456</span>&#160;    m_AllocationCallbacks(pCreateInfo-&gt;pAllocationCallbacks ?</div>
+<div class="line"><a name="l15457"></a><span class="lineno">15457</span>&#160;        *pCreateInfo-&gt;pAllocationCallbacks : VmaEmptyAllocationCallbacks),</div>
+<div class="line"><a name="l15458"></a><span class="lineno">15458</span>&#160;    m_AllocationObjectAllocator(&amp;m_AllocationCallbacks),</div>
+<div class="line"><a name="l15459"></a><span class="lineno">15459</span>&#160;    m_HeapSizeLimitMask(0),</div>
+<div class="line"><a name="l15460"></a><span class="lineno">15460</span>&#160;    m_PreferredLargeHeapBlockSize(0),</div>
+<div class="line"><a name="l15461"></a><span class="lineno">15461</span>&#160;    m_PhysicalDevice(pCreateInfo-&gt;physicalDevice),</div>
+<div class="line"><a name="l15462"></a><span class="lineno">15462</span>&#160;    m_CurrentFrameIndex(0),</div>
+<div class="line"><a name="l15463"></a><span class="lineno">15463</span>&#160;    m_GpuDefragmentationMemoryTypeBits(UINT32_MAX),</div>
+<div class="line"><a name="l15464"></a><span class="lineno">15464</span>&#160;    m_Pools(VmaStlAllocator&lt;<a class="code" href="struct_vma_pool.html">VmaPool</a>&gt;(GetAllocationCallbacks())),</div>
+<div class="line"><a name="l15465"></a><span class="lineno">15465</span>&#160;    m_NextPoolId(0),</div>
+<div class="line"><a name="l15466"></a><span class="lineno">15466</span>&#160;    m_GlobalMemoryTypeBits(UINT32_MAX)</div>
+<div class="line"><a name="l15467"></a><span class="lineno">15467</span>&#160;#if <a class="code" href="vk__mem__alloc_8h.html#a1f0c126759fc96ccb6e2d23c101d770c">VMA_RECORDING_ENABLED</a></div>
+<div class="line"><a name="l15468"></a><span class="lineno">15468</span>&#160;    ,m_pRecorder(VMA_NULL)</div>
+<div class="line"><a name="l15469"></a><span class="lineno">15469</span>&#160;#endif</div>
+<div class="line"><a name="l15470"></a><span class="lineno">15470</span>&#160;{</div>
 <div class="line"><a name="l15471"></a><span class="lineno">15471</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
 <div class="line"><a name="l15472"></a><span class="lineno">15472</span>&#160;    {</div>
-<div class="line"><a name="l15473"></a><span class="lineno">15473</span>&#160;        m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR = (PFN_vkGetBufferMemoryRequirements2)vkGetBufferMemoryRequirements2;</div>
-<div class="line"><a name="l15474"></a><span class="lineno">15474</span>&#160;        m_VulkanFunctions.vkGetImageMemoryRequirements2KHR = (PFN_vkGetImageMemoryRequirements2)vkGetImageMemoryRequirements2;</div>
-<div class="line"><a name="l15475"></a><span class="lineno">15475</span>&#160;        m_VulkanFunctions.vkBindBufferMemory2KHR = (PFN_vkBindBufferMemory2)vkBindBufferMemory2;</div>
-<div class="line"><a name="l15476"></a><span class="lineno">15476</span>&#160;        m_VulkanFunctions.vkBindImageMemory2KHR = (PFN_vkBindImageMemory2)vkBindImageMemory2;</div>
-<div class="line"><a name="l15477"></a><span class="lineno">15477</span>&#160;        m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties2KHR = (PFN_vkGetPhysicalDeviceMemoryProperties2)vkGetPhysicalDeviceMemoryProperties2;</div>
-<div class="line"><a name="l15478"></a><span class="lineno">15478</span>&#160;    }</div>
-<div class="line"><a name="l15479"></a><span class="lineno">15479</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15480"></a><span class="lineno">15480</span>&#160;}</div>
-<div class="line"><a name="l15481"></a><span class="lineno">15481</span>&#160; </div>
-<div class="line"><a name="l15482"></a><span class="lineno">15482</span>&#160;<span class="preprocessor">#endif // #if VMA_STATIC_VULKAN_FUNCTIONS == 1</span></div>
-<div class="line"><a name="l15483"></a><span class="lineno">15483</span>&#160; </div>
-<div class="line"><a name="l15484"></a><span class="lineno">15484</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::ImportVulkanFunctions_Custom(<span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* pVulkanFunctions)</div>
-<div class="line"><a name="l15485"></a><span class="lineno">15485</span>&#160;{</div>
-<div class="line"><a name="l15486"></a><span class="lineno">15486</span>&#160;    VMA_ASSERT(pVulkanFunctions != VMA_NULL);</div>
-<div class="line"><a name="l15487"></a><span class="lineno">15487</span>&#160; </div>
-<div class="line"><a name="l15488"></a><span class="lineno">15488</span>&#160;<span class="preprocessor">#define VMA_COPY_IF_NOT_NULL(funcName) \</span></div>
-<div class="line"><a name="l15489"></a><span class="lineno">15489</span>&#160;<span class="preprocessor">    if(pVulkanFunctions-&gt;funcName != VMA_NULL) m_VulkanFunctions.funcName = pVulkanFunctions-&gt;funcName;</span></div>
-<div class="line"><a name="l15490"></a><span class="lineno">15490</span>&#160; </div>
-<div class="line"><a name="l15491"></a><span class="lineno">15491</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceProperties);</div>
-<div class="line"><a name="l15492"></a><span class="lineno">15492</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceMemoryProperties);</div>
-<div class="line"><a name="l15493"></a><span class="lineno">15493</span>&#160;    VMA_COPY_IF_NOT_NULL(vkAllocateMemory);</div>
-<div class="line"><a name="l15494"></a><span class="lineno">15494</span>&#160;    VMA_COPY_IF_NOT_NULL(vkFreeMemory);</div>
-<div class="line"><a name="l15495"></a><span class="lineno">15495</span>&#160;    VMA_COPY_IF_NOT_NULL(vkMapMemory);</div>
-<div class="line"><a name="l15496"></a><span class="lineno">15496</span>&#160;    VMA_COPY_IF_NOT_NULL(vkUnmapMemory);</div>
-<div class="line"><a name="l15497"></a><span class="lineno">15497</span>&#160;    VMA_COPY_IF_NOT_NULL(vkFlushMappedMemoryRanges);</div>
-<div class="line"><a name="l15498"></a><span class="lineno">15498</span>&#160;    VMA_COPY_IF_NOT_NULL(vkInvalidateMappedMemoryRanges);</div>
-<div class="line"><a name="l15499"></a><span class="lineno">15499</span>&#160;    VMA_COPY_IF_NOT_NULL(vkBindBufferMemory);</div>
-<div class="line"><a name="l15500"></a><span class="lineno">15500</span>&#160;    VMA_COPY_IF_NOT_NULL(vkBindImageMemory);</div>
-<div class="line"><a name="l15501"></a><span class="lineno">15501</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetBufferMemoryRequirements);</div>
-<div class="line"><a name="l15502"></a><span class="lineno">15502</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetImageMemoryRequirements);</div>
-<div class="line"><a name="l15503"></a><span class="lineno">15503</span>&#160;    VMA_COPY_IF_NOT_NULL(vkCreateBuffer);</div>
-<div class="line"><a name="l15504"></a><span class="lineno">15504</span>&#160;    VMA_COPY_IF_NOT_NULL(vkDestroyBuffer);</div>
-<div class="line"><a name="l15505"></a><span class="lineno">15505</span>&#160;    VMA_COPY_IF_NOT_NULL(vkCreateImage);</div>
-<div class="line"><a name="l15506"></a><span class="lineno">15506</span>&#160;    VMA_COPY_IF_NOT_NULL(vkDestroyImage);</div>
-<div class="line"><a name="l15507"></a><span class="lineno">15507</span>&#160;    VMA_COPY_IF_NOT_NULL(vkCmdCopyBuffer);</div>
-<div class="line"><a name="l15508"></a><span class="lineno">15508</span>&#160; </div>
-<div class="line"><a name="l15509"></a><span class="lineno">15509</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l15510"></a><span class="lineno">15510</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetBufferMemoryRequirements2KHR);</div>
-<div class="line"><a name="l15511"></a><span class="lineno">15511</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetImageMemoryRequirements2KHR);</div>
-<div class="line"><a name="l15512"></a><span class="lineno">15512</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15513"></a><span class="lineno">15513</span>&#160; </div>
-<div class="line"><a name="l15514"></a><span class="lineno">15514</span>&#160;<span class="preprocessor">#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l15515"></a><span class="lineno">15515</span>&#160;    VMA_COPY_IF_NOT_NULL(vkBindBufferMemory2KHR);</div>
-<div class="line"><a name="l15516"></a><span class="lineno">15516</span>&#160;    VMA_COPY_IF_NOT_NULL(vkBindImageMemory2KHR);</div>
+<div class="line"><a name="l15473"></a><span class="lineno">15473</span>&#160;        m_UseKhrDedicatedAllocation = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l15474"></a><span class="lineno">15474</span>&#160;        m_UseKhrBindMemory2 = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l15475"></a><span class="lineno">15475</span>&#160;    }</div>
+<div class="line"><a name="l15476"></a><span class="lineno">15476</span>&#160; </div>
+<div class="line"><a name="l15477"></a><span class="lineno">15477</span>&#160;    <span class="keywordflow">if</span>(VMA_DEBUG_DETECT_CORRUPTION)</div>
+<div class="line"><a name="l15478"></a><span class="lineno">15478</span>&#160;    {</div>
+<div class="line"><a name="l15479"></a><span class="lineno">15479</span>&#160;        <span class="comment">// Needs to be multiply of uint32_t size because we are going to write VMA_CORRUPTION_DETECTION_MAGIC_VALUE to it.</span></div>
+<div class="line"><a name="l15480"></a><span class="lineno">15480</span>&#160;        VMA_ASSERT(VMA_DEBUG_MARGIN % <span class="keyword">sizeof</span>(uint32_t) == 0);</div>
+<div class="line"><a name="l15481"></a><span class="lineno">15481</span>&#160;    }</div>
+<div class="line"><a name="l15482"></a><span class="lineno">15482</span>&#160; </div>
+<div class="line"><a name="l15483"></a><span class="lineno">15483</span>&#160;    VMA_ASSERT(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156">physicalDevice</a> &amp;&amp; pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500">device</a> &amp;&amp; pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b">instance</a>);</div>
+<div class="line"><a name="l15484"></a><span class="lineno">15484</span>&#160; </div>
+<div class="line"><a name="l15485"></a><span class="lineno">15485</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &lt; VK_MAKE_VERSION(1, 1, 0))</div>
+<div class="line"><a name="l15486"></a><span class="lineno">15486</span>&#160;    {</div>
+<div class="line"><a name="l15487"></a><span class="lineno">15487</span>&#160;<span class="preprocessor">#if !(VMA_DEDICATED_ALLOCATION)</span></div>
+<div class="line"><a name="l15488"></a><span class="lineno">15488</span>&#160;        <span class="keywordflow">if</span>((pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a>) != 0)</div>
+<div class="line"><a name="l15489"></a><span class="lineno">15489</span>&#160;        {</div>
+<div class="line"><a name="l15490"></a><span class="lineno">15490</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT set but required extensions are disabled by preprocessor macros.&quot;</span>);</div>
+<div class="line"><a name="l15491"></a><span class="lineno">15491</span>&#160;        }</div>
+<div class="line"><a name="l15492"></a><span class="lineno">15492</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15493"></a><span class="lineno">15493</span>&#160;<span class="preprocessor">#if !(VMA_BIND_MEMORY2)</span></div>
+<div class="line"><a name="l15494"></a><span class="lineno">15494</span>&#160;        <span class="keywordflow">if</span>((pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a>) != 0)</div>
+<div class="line"><a name="l15495"></a><span class="lineno">15495</span>&#160;        {</div>
+<div class="line"><a name="l15496"></a><span class="lineno">15496</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT set but required extension is disabled by preprocessor macros.&quot;</span>);</div>
+<div class="line"><a name="l15497"></a><span class="lineno">15497</span>&#160;        }</div>
+<div class="line"><a name="l15498"></a><span class="lineno">15498</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15499"></a><span class="lineno">15499</span>&#160;    }</div>
+<div class="line"><a name="l15500"></a><span class="lineno">15500</span>&#160;<span class="preprocessor">#if !(VMA_MEMORY_BUDGET)</span></div>
+<div class="line"><a name="l15501"></a><span class="lineno">15501</span>&#160;    <span class="keywordflow">if</span>((pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0">VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT</a>) != 0)</div>
+<div class="line"><a name="l15502"></a><span class="lineno">15502</span>&#160;    {</div>
+<div class="line"><a name="l15503"></a><span class="lineno">15503</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT set but required extension is disabled by preprocessor macros.&quot;</span>);</div>
+<div class="line"><a name="l15504"></a><span class="lineno">15504</span>&#160;    }</div>
+<div class="line"><a name="l15505"></a><span class="lineno">15505</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15506"></a><span class="lineno">15506</span>&#160;<span class="preprocessor">#if !(VMA_BUFFER_DEVICE_ADDRESS)</span></div>
+<div class="line"><a name="l15507"></a><span class="lineno">15507</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrBufferDeviceAddress)</div>
+<div class="line"><a name="l15508"></a><span class="lineno">15508</span>&#160;    {</div>
+<div class="line"><a name="l15509"></a><span class="lineno">15509</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT is set but required extension or Vulkan 1.2 is not available in your Vulkan header or its support in VMA has been disabled by a preprocessor macro.&quot;</span>);</div>
+<div class="line"><a name="l15510"></a><span class="lineno">15510</span>&#160;    }</div>
+<div class="line"><a name="l15511"></a><span class="lineno">15511</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15512"></a><span class="lineno">15512</span>&#160;<span class="preprocessor">#if VMA_VULKAN_VERSION &lt; 1002000</span></div>
+<div class="line"><a name="l15513"></a><span class="lineno">15513</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 2, 0))</div>
+<div class="line"><a name="l15514"></a><span class="lineno">15514</span>&#160;    {</div>
+<div class="line"><a name="l15515"></a><span class="lineno">15515</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;vulkanApiVersion &gt;= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros.&quot;</span>);</div>
+<div class="line"><a name="l15516"></a><span class="lineno">15516</span>&#160;    }</div>
 <div class="line"><a name="l15517"></a><span class="lineno">15517</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15518"></a><span class="lineno">15518</span>&#160; </div>
-<div class="line"><a name="l15519"></a><span class="lineno">15519</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l15520"></a><span class="lineno">15520</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceMemoryProperties2KHR);</div>
-<div class="line"><a name="l15521"></a><span class="lineno">15521</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15522"></a><span class="lineno">15522</span>&#160; </div>
-<div class="line"><a name="l15523"></a><span class="lineno">15523</span>&#160;<span class="preprocessor">#undef VMA_COPY_IF_NOT_NULL</span></div>
-<div class="line"><a name="l15524"></a><span class="lineno">15524</span>&#160;}</div>
-<div class="line"><a name="l15525"></a><span class="lineno">15525</span>&#160; </div>
-<div class="line"><a name="l15526"></a><span class="lineno">15526</span>&#160;<span class="preprocessor">#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1</span></div>
-<div class="line"><a name="l15527"></a><span class="lineno">15527</span>&#160; </div>
-<div class="line"><a name="l15528"></a><span class="lineno">15528</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::ImportVulkanFunctions_Dynamic()</div>
-<div class="line"><a name="l15529"></a><span class="lineno">15529</span>&#160;{</div>
-<div class="line"><a name="l15530"></a><span class="lineno">15530</span>&#160;<span class="preprocessor">#define VMA_FETCH_INSTANCE_FUNC(memberName, functionPointerType, functionNameString) \</span></div>
-<div class="line"><a name="l15531"></a><span class="lineno">15531</span>&#160;<span class="preprocessor">    if(m_VulkanFunctions.memberName == VMA_NULL) \</span></div>
-<div class="line"><a name="l15532"></a><span class="lineno">15532</span>&#160;<span class="preprocessor">        m_VulkanFunctions.memberName = \</span></div>
-<div class="line"><a name="l15533"></a><span class="lineno">15533</span>&#160;<span class="preprocessor">            (functionPointerType)vkGetInstanceProcAddr(m_hInstance, functionNameString);</span></div>
-<div class="line"><a name="l15534"></a><span class="lineno">15534</span>&#160;<span class="preprocessor">#define VMA_FETCH_DEVICE_FUNC(memberName, functionPointerType, functionNameString) \</span></div>
-<div class="line"><a name="l15535"></a><span class="lineno">15535</span>&#160;<span class="preprocessor">    if(m_VulkanFunctions.memberName == VMA_NULL) \</span></div>
-<div class="line"><a name="l15536"></a><span class="lineno">15536</span>&#160;<span class="preprocessor">        m_VulkanFunctions.memberName = \</span></div>
-<div class="line"><a name="l15537"></a><span class="lineno">15537</span>&#160;<span class="preprocessor">            (functionPointerType)vkGetDeviceProcAddr(m_hDevice, functionNameString);</span></div>
-<div class="line"><a name="l15538"></a><span class="lineno">15538</span>&#160; </div>
-<div class="line"><a name="l15539"></a><span class="lineno">15539</span>&#160;    VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceProperties, PFN_vkGetPhysicalDeviceProperties, <span class="stringliteral">&quot;vkGetPhysicalDeviceProperties&quot;</span>);</div>
-<div class="line"><a name="l15540"></a><span class="lineno">15540</span>&#160;    VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceMemoryProperties, PFN_vkGetPhysicalDeviceMemoryProperties, <span class="stringliteral">&quot;vkGetPhysicalDeviceMemoryProperties&quot;</span>);</div>
-<div class="line"><a name="l15541"></a><span class="lineno">15541</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkAllocateMemory, PFN_vkAllocateMemory, <span class="stringliteral">&quot;vkAllocateMemory&quot;</span>);</div>
-<div class="line"><a name="l15542"></a><span class="lineno">15542</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkFreeMemory, PFN_vkFreeMemory, <span class="stringliteral">&quot;vkFreeMemory&quot;</span>);</div>
-<div class="line"><a name="l15543"></a><span class="lineno">15543</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkMapMemory, PFN_vkMapMemory, <span class="stringliteral">&quot;vkMapMemory&quot;</span>);</div>
-<div class="line"><a name="l15544"></a><span class="lineno">15544</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkUnmapMemory, PFN_vkUnmapMemory, <span class="stringliteral">&quot;vkUnmapMemory&quot;</span>);</div>
-<div class="line"><a name="l15545"></a><span class="lineno">15545</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkFlushMappedMemoryRanges, PFN_vkFlushMappedMemoryRanges, <span class="stringliteral">&quot;vkFlushMappedMemoryRanges&quot;</span>);</div>
-<div class="line"><a name="l15546"></a><span class="lineno">15546</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkInvalidateMappedMemoryRanges, PFN_vkInvalidateMappedMemoryRanges, <span class="stringliteral">&quot;vkInvalidateMappedMemoryRanges&quot;</span>);</div>
-<div class="line"><a name="l15547"></a><span class="lineno">15547</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkBindBufferMemory, PFN_vkBindBufferMemory, <span class="stringliteral">&quot;vkBindBufferMemory&quot;</span>);</div>
-<div class="line"><a name="l15548"></a><span class="lineno">15548</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkBindImageMemory, PFN_vkBindImageMemory, <span class="stringliteral">&quot;vkBindImageMemory&quot;</span>);</div>
-<div class="line"><a name="l15549"></a><span class="lineno">15549</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkGetBufferMemoryRequirements, PFN_vkGetBufferMemoryRequirements, <span class="stringliteral">&quot;vkGetBufferMemoryRequirements&quot;</span>);</div>
-<div class="line"><a name="l15550"></a><span class="lineno">15550</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkGetImageMemoryRequirements, PFN_vkGetImageMemoryRequirements, <span class="stringliteral">&quot;vkGetImageMemoryRequirements&quot;</span>);</div>
-<div class="line"><a name="l15551"></a><span class="lineno">15551</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkCreateBuffer, PFN_vkCreateBuffer, <span class="stringliteral">&quot;vkCreateBuffer&quot;</span>);</div>
-<div class="line"><a name="l15552"></a><span class="lineno">15552</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkDestroyBuffer, PFN_vkDestroyBuffer, <span class="stringliteral">&quot;vkDestroyBuffer&quot;</span>);</div>
-<div class="line"><a name="l15553"></a><span class="lineno">15553</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkCreateImage, PFN_vkCreateImage, <span class="stringliteral">&quot;vkCreateImage&quot;</span>);</div>
-<div class="line"><a name="l15554"></a><span class="lineno">15554</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkDestroyImage, PFN_vkDestroyImage, <span class="stringliteral">&quot;vkDestroyImage&quot;</span>);</div>
-<div class="line"><a name="l15555"></a><span class="lineno">15555</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkCmdCopyBuffer, PFN_vkCmdCopyBuffer, <span class="stringliteral">&quot;vkCmdCopyBuffer&quot;</span>);</div>
-<div class="line"><a name="l15556"></a><span class="lineno">15556</span>&#160; </div>
-<div class="line"><a name="l15557"></a><span class="lineno">15557</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION</span></div>
-<div class="line"><a name="l15558"></a><span class="lineno">15558</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrDedicatedAllocation)</div>
-<div class="line"><a name="l15559"></a><span class="lineno">15559</span>&#160;    {</div>
-<div class="line"><a name="l15560"></a><span class="lineno">15560</span>&#160;        VMA_FETCH_DEVICE_FUNC(vkGetBufferMemoryRequirements2KHR, PFN_vkGetBufferMemoryRequirements2KHR, <span class="stringliteral">&quot;vkGetBufferMemoryRequirements2KHR&quot;</span>);</div>
-<div class="line"><a name="l15561"></a><span class="lineno">15561</span>&#160;        VMA_FETCH_DEVICE_FUNC(vkGetImageMemoryRequirements2KHR, PFN_vkGetImageMemoryRequirements2KHR, <span class="stringliteral">&quot;vkGetImageMemoryRequirements2KHR&quot;</span>);</div>
-<div class="line"><a name="l15562"></a><span class="lineno">15562</span>&#160;    }</div>
-<div class="line"><a name="l15563"></a><span class="lineno">15563</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15564"></a><span class="lineno">15564</span>&#160; </div>
-<div class="line"><a name="l15565"></a><span class="lineno">15565</span>&#160;<span class="preprocessor">#if VMA_BIND_MEMORY2</span></div>
-<div class="line"><a name="l15566"></a><span class="lineno">15566</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrBindMemory2)</div>
-<div class="line"><a name="l15567"></a><span class="lineno">15567</span>&#160;    {</div>
-<div class="line"><a name="l15568"></a><span class="lineno">15568</span>&#160;        VMA_FETCH_DEVICE_FUNC(vkBindBufferMemory2KHR, PFN_vkBindBufferMemory2KHR, <span class="stringliteral">&quot;vkBindBufferMemory2KHR&quot;</span>);</div>
-<div class="line"><a name="l15569"></a><span class="lineno">15569</span>&#160;        VMA_FETCH_DEVICE_FUNC(vkBindImageMemory2KHR, PFN_vkBindImageMemory2KHR, <span class="stringliteral">&quot;vkBindImageMemory2KHR&quot;</span>);</div>
-<div class="line"><a name="l15570"></a><span class="lineno">15570</span>&#160;    }</div>
-<div class="line"><a name="l15571"></a><span class="lineno">15571</span>&#160;<span class="preprocessor">#endif // #if VMA_BIND_MEMORY2</span></div>
-<div class="line"><a name="l15572"></a><span class="lineno">15572</span>&#160; </div>
-<div class="line"><a name="l15573"></a><span class="lineno">15573</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l15574"></a><span class="lineno">15574</span>&#160;    <span class="keywordflow">if</span>(m_UseExtMemoryBudget &amp;&amp; m_VulkanApiVersion &lt; VK_MAKE_VERSION(1, 1, 0))</div>
-<div class="line"><a name="l15575"></a><span class="lineno">15575</span>&#160;    {</div>
-<div class="line"><a name="l15576"></a><span class="lineno">15576</span>&#160;        VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceMemoryProperties2KHR, PFN_vkGetPhysicalDeviceMemoryProperties2KHR, <span class="stringliteral">&quot;vkGetPhysicalDeviceMemoryProperties2KHR&quot;</span>);</div>
-<div class="line"><a name="l15577"></a><span class="lineno">15577</span>&#160;    }</div>
-<div class="line"><a name="l15578"></a><span class="lineno">15578</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l15579"></a><span class="lineno">15579</span>&#160; </div>
-<div class="line"><a name="l15580"></a><span class="lineno">15580</span>&#160;<span class="preprocessor">#undef VMA_FETCH_DEVICE_FUNC</span></div>
-<div class="line"><a name="l15581"></a><span class="lineno">15581</span>&#160;<span class="preprocessor">#undef VMA_FETCH_INSTANCE_FUNC</span></div>
-<div class="line"><a name="l15582"></a><span class="lineno">15582</span>&#160;}</div>
-<div class="line"><a name="l15583"></a><span class="lineno">15583</span>&#160; </div>
-<div class="line"><a name="l15584"></a><span class="lineno">15584</span>&#160;<span class="preprocessor">#endif // #if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1</span></div>
-<div class="line"><a name="l15585"></a><span class="lineno">15585</span>&#160; </div>
-<div class="line"><a name="l15586"></a><span class="lineno">15586</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::ValidateVulkanFunctions()</div>
-<div class="line"><a name="l15587"></a><span class="lineno">15587</span>&#160;{</div>
-<div class="line"><a name="l15588"></a><span class="lineno">15588</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceProperties != VMA_NULL);</div>
-<div class="line"><a name="l15589"></a><span class="lineno">15589</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties != VMA_NULL);</div>
-<div class="line"><a name="l15590"></a><span class="lineno">15590</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkAllocateMemory != VMA_NULL);</div>
-<div class="line"><a name="l15591"></a><span class="lineno">15591</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkFreeMemory != VMA_NULL);</div>
-<div class="line"><a name="l15592"></a><span class="lineno">15592</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkMapMemory != VMA_NULL);</div>
-<div class="line"><a name="l15593"></a><span class="lineno">15593</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkUnmapMemory != VMA_NULL);</div>
-<div class="line"><a name="l15594"></a><span class="lineno">15594</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkFlushMappedMemoryRanges != VMA_NULL);</div>
-<div class="line"><a name="l15595"></a><span class="lineno">15595</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkInvalidateMappedMemoryRanges != VMA_NULL);</div>
-<div class="line"><a name="l15596"></a><span class="lineno">15596</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkBindBufferMemory != VMA_NULL);</div>
-<div class="line"><a name="l15597"></a><span class="lineno">15597</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkBindImageMemory != VMA_NULL);</div>
-<div class="line"><a name="l15598"></a><span class="lineno">15598</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkGetBufferMemoryRequirements != VMA_NULL);</div>
-<div class="line"><a name="l15599"></a><span class="lineno">15599</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkGetImageMemoryRequirements != VMA_NULL);</div>
-<div class="line"><a name="l15600"></a><span class="lineno">15600</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkCreateBuffer != VMA_NULL);</div>
-<div class="line"><a name="l15601"></a><span class="lineno">15601</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkDestroyBuffer != VMA_NULL);</div>
-<div class="line"><a name="l15602"></a><span class="lineno">15602</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkCreateImage != VMA_NULL);</div>
-<div class="line"><a name="l15603"></a><span class="lineno">15603</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkDestroyImage != VMA_NULL);</div>
-<div class="line"><a name="l15604"></a><span class="lineno">15604</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkCmdCopyBuffer != VMA_NULL);</div>
-<div class="line"><a name="l15605"></a><span class="lineno">15605</span>&#160; </div>
-<div class="line"><a name="l15606"></a><span class="lineno">15606</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l15607"></a><span class="lineno">15607</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0) || m_UseKhrDedicatedAllocation)</div>
-<div class="line"><a name="l15608"></a><span class="lineno">15608</span>&#160;    {</div>
-<div class="line"><a name="l15609"></a><span class="lineno">15609</span>&#160;        VMA_ASSERT(m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR != VMA_NULL);</div>
-<div class="line"><a name="l15610"></a><span class="lineno">15610</span>&#160;        VMA_ASSERT(m_VulkanFunctions.vkGetImageMemoryRequirements2KHR != VMA_NULL);</div>
-<div class="line"><a name="l15611"></a><span class="lineno">15611</span>&#160;    }</div>
-<div class="line"><a name="l15612"></a><span class="lineno">15612</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15613"></a><span class="lineno">15613</span>&#160; </div>
-<div class="line"><a name="l15614"></a><span class="lineno">15614</span>&#160;<span class="preprocessor">#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l15615"></a><span class="lineno">15615</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0) || m_UseKhrBindMemory2)</div>
-<div class="line"><a name="l15616"></a><span class="lineno">15616</span>&#160;    {</div>
-<div class="line"><a name="l15617"></a><span class="lineno">15617</span>&#160;        VMA_ASSERT(m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL);</div>
-<div class="line"><a name="l15618"></a><span class="lineno">15618</span>&#160;        VMA_ASSERT(m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL);</div>
-<div class="line"><a name="l15619"></a><span class="lineno">15619</span>&#160;    }</div>
-<div class="line"><a name="l15620"></a><span class="lineno">15620</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15518"></a><span class="lineno">15518</span>&#160;<span class="preprocessor">#if VMA_VULKAN_VERSION &lt; 1001000</span></div>
+<div class="line"><a name="l15519"></a><span class="lineno">15519</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
+<div class="line"><a name="l15520"></a><span class="lineno">15520</span>&#160;    {</div>
+<div class="line"><a name="l15521"></a><span class="lineno">15521</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;vulkanApiVersion &gt;= VK_API_VERSION_1_1 but required Vulkan version is disabled by preprocessor macros.&quot;</span>);</div>
+<div class="line"><a name="l15522"></a><span class="lineno">15522</span>&#160;    }</div>
+<div class="line"><a name="l15523"></a><span class="lineno">15523</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15524"></a><span class="lineno">15524</span>&#160; </div>
+<div class="line"><a name="l15525"></a><span class="lineno">15525</span>&#160;    memset(&amp;m_DeviceMemoryCallbacks, 0 ,<span class="keyword">sizeof</span>(m_DeviceMemoryCallbacks));</div>
+<div class="line"><a name="l15526"></a><span class="lineno">15526</span>&#160;    memset(&amp;m_PhysicalDeviceProperties, 0, <span class="keyword">sizeof</span>(m_PhysicalDeviceProperties));</div>
+<div class="line"><a name="l15527"></a><span class="lineno">15527</span>&#160;    memset(&amp;m_MemProps, 0, <span class="keyword">sizeof</span>(m_MemProps));</div>
+<div class="line"><a name="l15528"></a><span class="lineno">15528</span>&#160;        </div>
+<div class="line"><a name="l15529"></a><span class="lineno">15529</span>&#160;    memset(&amp;m_pBlockVectors, 0, <span class="keyword">sizeof</span>(m_pBlockVectors));</div>
+<div class="line"><a name="l15530"></a><span class="lineno">15530</span>&#160;    memset(&amp;m_pDedicatedAllocations, 0, <span class="keyword">sizeof</span>(m_pDedicatedAllocations));</div>
+<div class="line"><a name="l15531"></a><span class="lineno">15531</span>&#160;    memset(&amp;m_VulkanFunctions, 0, <span class="keyword">sizeof</span>(m_VulkanFunctions));</div>
+<div class="line"><a name="l15532"></a><span class="lineno">15532</span>&#160; </div>
+<div class="line"><a name="l15533"></a><span class="lineno">15533</span>&#160;    <span class="keywordflow">if</span>(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">pDeviceMemoryCallbacks</a> != VMA_NULL)</div>
+<div class="line"><a name="l15534"></a><span class="lineno">15534</span>&#160;    {</div>
+<div class="line"><a name="l15535"></a><span class="lineno">15535</span>&#160;        m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">pUserData</a> = pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">pDeviceMemoryCallbacks</a>-&gt;<a class="code" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">pUserData</a>;</div>
+<div class="line"><a name="l15536"></a><span class="lineno">15536</span>&#160;        m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">pfnAllocate</a> = pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">pDeviceMemoryCallbacks</a>-&gt;<a class="code" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">pfnAllocate</a>;</div>
+<div class="line"><a name="l15537"></a><span class="lineno">15537</span>&#160;        m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">pfnFree</a> = pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">pDeviceMemoryCallbacks</a>-&gt;<a class="code" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">pfnFree</a>;</div>
+<div class="line"><a name="l15538"></a><span class="lineno">15538</span>&#160;    }</div>
+<div class="line"><a name="l15539"></a><span class="lineno">15539</span>&#160; </div>
+<div class="line"><a name="l15540"></a><span class="lineno">15540</span>&#160;    ImportVulkanFunctions(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd">pVulkanFunctions</a>);</div>
+<div class="line"><a name="l15541"></a><span class="lineno">15541</span>&#160; </div>
+<div class="line"><a name="l15542"></a><span class="lineno">15542</span>&#160;    (*m_VulkanFunctions.vkGetPhysicalDeviceProperties)(m_PhysicalDevice, &amp;m_PhysicalDeviceProperties);</div>
+<div class="line"><a name="l15543"></a><span class="lineno">15543</span>&#160;    (*m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties)(m_PhysicalDevice, &amp;m_MemProps);</div>
+<div class="line"><a name="l15544"></a><span class="lineno">15544</span>&#160; </div>
+<div class="line"><a name="l15545"></a><span class="lineno">15545</span>&#160;    VMA_ASSERT(VmaIsPow2(VMA_DEBUG_ALIGNMENT));</div>
+<div class="line"><a name="l15546"></a><span class="lineno">15546</span>&#160;    VMA_ASSERT(VmaIsPow2(VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY));</div>
+<div class="line"><a name="l15547"></a><span class="lineno">15547</span>&#160;    VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.bufferImageGranularity));</div>
+<div class="line"><a name="l15548"></a><span class="lineno">15548</span>&#160;    VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.nonCoherentAtomSize));</div>
+<div class="line"><a name="l15549"></a><span class="lineno">15549</span>&#160; </div>
+<div class="line"><a name="l15550"></a><span class="lineno">15550</span>&#160;    m_PreferredLargeHeapBlockSize = (pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a">preferredLargeHeapBlockSize</a> != 0) ?</div>
+<div class="line"><a name="l15551"></a><span class="lineno">15551</span>&#160;        pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a">preferredLargeHeapBlockSize</a> : <span class="keyword">static_cast&lt;</span>VkDeviceSize<span class="keyword">&gt;</span>(VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE);</div>
+<div class="line"><a name="l15552"></a><span class="lineno">15552</span>&#160; </div>
+<div class="line"><a name="l15553"></a><span class="lineno">15553</span>&#160;    m_GlobalMemoryTypeBits = CalculateGlobalMemoryTypeBits();</div>
+<div class="line"><a name="l15554"></a><span class="lineno">15554</span>&#160; </div>
+<div class="line"><a name="l15555"></a><span class="lineno">15555</span>&#160;    <span class="keywordflow">if</span>(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b">pHeapSizeLimit</a> != VMA_NULL)</div>
+<div class="line"><a name="l15556"></a><span class="lineno">15556</span>&#160;    {</div>
+<div class="line"><a name="l15557"></a><span class="lineno">15557</span>&#160;        <span class="keywordflow">for</span>(uint32_t heapIndex = 0; heapIndex &lt; GetMemoryHeapCount(); ++heapIndex)</div>
+<div class="line"><a name="l15558"></a><span class="lineno">15558</span>&#160;        {</div>
+<div class="line"><a name="l15559"></a><span class="lineno">15559</span>&#160;            <span class="keyword">const</span> VkDeviceSize limit = pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b">pHeapSizeLimit</a>[heapIndex];</div>
+<div class="line"><a name="l15560"></a><span class="lineno">15560</span>&#160;            <span class="keywordflow">if</span>(limit != VK_WHOLE_SIZE)</div>
+<div class="line"><a name="l15561"></a><span class="lineno">15561</span>&#160;            {</div>
+<div class="line"><a name="l15562"></a><span class="lineno">15562</span>&#160;                m_HeapSizeLimitMask |= 1u &lt;&lt; heapIndex;</div>
+<div class="line"><a name="l15563"></a><span class="lineno">15563</span>&#160;                <span class="keywordflow">if</span>(limit &lt; m_MemProps.memoryHeaps[heapIndex].size)</div>
+<div class="line"><a name="l15564"></a><span class="lineno">15564</span>&#160;                {</div>
+<div class="line"><a name="l15565"></a><span class="lineno">15565</span>&#160;                    m_MemProps.memoryHeaps[heapIndex].size = limit;</div>
+<div class="line"><a name="l15566"></a><span class="lineno">15566</span>&#160;                }</div>
+<div class="line"><a name="l15567"></a><span class="lineno">15567</span>&#160;            }</div>
+<div class="line"><a name="l15568"></a><span class="lineno">15568</span>&#160;        }</div>
+<div class="line"><a name="l15569"></a><span class="lineno">15569</span>&#160;    }</div>
+<div class="line"><a name="l15570"></a><span class="lineno">15570</span>&#160; </div>
+<div class="line"><a name="l15571"></a><span class="lineno">15571</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
+<div class="line"><a name="l15572"></a><span class="lineno">15572</span>&#160;    {</div>
+<div class="line"><a name="l15573"></a><span class="lineno">15573</span>&#160;        <span class="keyword">const</span> VkDeviceSize preferredBlockSize = CalcPreferredBlockSize(memTypeIndex);</div>
+<div class="line"><a name="l15574"></a><span class="lineno">15574</span>&#160; </div>
+<div class="line"><a name="l15575"></a><span class="lineno">15575</span>&#160;        m_pBlockVectors[memTypeIndex] = vma_new(<span class="keyword">this</span>, VmaBlockVector)(</div>
+<div class="line"><a name="l15576"></a><span class="lineno">15576</span>&#160;            <span class="keyword">this</span>,</div>
+<div class="line"><a name="l15577"></a><span class="lineno">15577</span>&#160;            VK_NULL_HANDLE, <span class="comment">// hParentPool</span></div>
+<div class="line"><a name="l15578"></a><span class="lineno">15578</span>&#160;            memTypeIndex,</div>
+<div class="line"><a name="l15579"></a><span class="lineno">15579</span>&#160;            preferredBlockSize,</div>
+<div class="line"><a name="l15580"></a><span class="lineno">15580</span>&#160;            0,</div>
+<div class="line"><a name="l15581"></a><span class="lineno">15581</span>&#160;            SIZE_MAX,</div>
+<div class="line"><a name="l15582"></a><span class="lineno">15582</span>&#160;            GetBufferImageGranularity(),</div>
+<div class="line"><a name="l15583"></a><span class="lineno">15583</span>&#160;            pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7">frameInUseCount</a>,</div>
+<div class="line"><a name="l15584"></a><span class="lineno">15584</span>&#160;            <span class="keyword">false</span>, <span class="comment">// explicitBlockSize</span></div>
+<div class="line"><a name="l15585"></a><span class="lineno">15585</span>&#160;            <span class="keyword">false</span>); <span class="comment">// linearAlgorithm</span></div>
+<div class="line"><a name="l15586"></a><span class="lineno">15586</span>&#160;        <span class="comment">// No need to call m_pBlockVectors[memTypeIndex][blockVectorTypeIndex]-&gt;CreateMinBlocks here,</span></div>
+<div class="line"><a name="l15587"></a><span class="lineno">15587</span>&#160;        <span class="comment">// becase minBlockCount is 0.</span></div>
+<div class="line"><a name="l15588"></a><span class="lineno">15588</span>&#160;        m_pDedicatedAllocations[memTypeIndex] = vma_new(<span class="keyword">this</span>, AllocationVectorType)(VmaStlAllocator&lt;VmaAllocation&gt;(GetAllocationCallbacks()));</div>
+<div class="line"><a name="l15589"></a><span class="lineno">15589</span>&#160; </div>
+<div class="line"><a name="l15590"></a><span class="lineno">15590</span>&#160;    }</div>
+<div class="line"><a name="l15591"></a><span class="lineno">15591</span>&#160;}</div>
+<div class="line"><a name="l15592"></a><span class="lineno">15592</span>&#160; </div>
+<div class="line"><a name="l15593"></a><span class="lineno">15593</span>&#160;VkResult VmaAllocator_T::Init(<span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo)</div>
+<div class="line"><a name="l15594"></a><span class="lineno">15594</span>&#160;{</div>
+<div class="line"><a name="l15595"></a><span class="lineno">15595</span>&#160;    VkResult res = VK_SUCCESS;</div>
+<div class="line"><a name="l15596"></a><span class="lineno">15596</span>&#160; </div>
+<div class="line"><a name="l15597"></a><span class="lineno">15597</span>&#160;    <span class="keywordflow">if</span>(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee">pRecordSettings</a> != VMA_NULL &amp;&amp;</div>
+<div class="line"><a name="l15598"></a><span class="lineno">15598</span>&#160;        !VmaStrIsEmpty(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee">pRecordSettings</a>-&gt;<a class="code" href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d">pFilePath</a>))</div>
+<div class="line"><a name="l15599"></a><span class="lineno">15599</span>&#160;    {</div>
+<div class="line"><a name="l15600"></a><span class="lineno">15600</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l15601"></a><span class="lineno">15601</span>&#160;        m_pRecorder = vma_new(<span class="keyword">this</span>, VmaRecorder)();</div>
+<div class="line"><a name="l15602"></a><span class="lineno">15602</span>&#160;        res = m_pRecorder-&gt;Init(*pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee">pRecordSettings</a>, m_UseMutex);</div>
+<div class="line"><a name="l15603"></a><span class="lineno">15603</span>&#160;        <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l15604"></a><span class="lineno">15604</span>&#160;        {</div>
+<div class="line"><a name="l15605"></a><span class="lineno">15605</span>&#160;            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l15606"></a><span class="lineno">15606</span>&#160;        }</div>
+<div class="line"><a name="l15607"></a><span class="lineno">15607</span>&#160;        m_pRecorder-&gt;WriteConfiguration(</div>
+<div class="line"><a name="l15608"></a><span class="lineno">15608</span>&#160;            m_PhysicalDeviceProperties,</div>
+<div class="line"><a name="l15609"></a><span class="lineno">15609</span>&#160;            m_MemProps,</div>
+<div class="line"><a name="l15610"></a><span class="lineno">15610</span>&#160;            m_VulkanApiVersion,</div>
+<div class="line"><a name="l15611"></a><span class="lineno">15611</span>&#160;            m_UseKhrDedicatedAllocation,</div>
+<div class="line"><a name="l15612"></a><span class="lineno">15612</span>&#160;            m_UseKhrBindMemory2,</div>
+<div class="line"><a name="l15613"></a><span class="lineno">15613</span>&#160;            m_UseExtMemoryBudget,</div>
+<div class="line"><a name="l15614"></a><span class="lineno">15614</span>&#160;            m_UseAmdDeviceCoherentMemory);</div>
+<div class="line"><a name="l15615"></a><span class="lineno">15615</span>&#160;        m_pRecorder-&gt;RecordCreateAllocator(GetCurrentFrameIndex());</div>
+<div class="line"><a name="l15616"></a><span class="lineno">15616</span>&#160;<span class="preprocessor">#else</span></div>
+<div class="line"><a name="l15617"></a><span class="lineno">15617</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VmaAllocatorCreateInfo::pRecordSettings used, but not supported due to VMA_RECORDING_ENABLED not defined to 1.&quot;</span>);</div>
+<div class="line"><a name="l15618"></a><span class="lineno">15618</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT;</div>
+<div class="line"><a name="l15619"></a><span class="lineno">15619</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15620"></a><span class="lineno">15620</span>&#160;    }</div>
 <div class="line"><a name="l15621"></a><span class="lineno">15621</span>&#160; </div>
-<div class="line"><a name="l15622"></a><span class="lineno">15622</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l15623"></a><span class="lineno">15623</span>&#160;    <span class="keywordflow">if</span>(m_UseExtMemoryBudget || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
+<div class="line"><a name="l15622"></a><span class="lineno">15622</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l15623"></a><span class="lineno">15623</span>&#160;    <span class="keywordflow">if</span>(m_UseExtMemoryBudget)</div>
 <div class="line"><a name="l15624"></a><span class="lineno">15624</span>&#160;    {</div>
-<div class="line"><a name="l15625"></a><span class="lineno">15625</span>&#160;        VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties2KHR != VMA_NULL);</div>
+<div class="line"><a name="l15625"></a><span class="lineno">15625</span>&#160;        UpdateVulkanBudget();</div>
 <div class="line"><a name="l15626"></a><span class="lineno">15626</span>&#160;    }</div>
-<div class="line"><a name="l15627"></a><span class="lineno">15627</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l15628"></a><span class="lineno">15628</span>&#160;}</div>
-<div class="line"><a name="l15629"></a><span class="lineno">15629</span>&#160; </div>
-<div class="line"><a name="l15630"></a><span class="lineno">15630</span>&#160;VkDeviceSize VmaAllocator_T::CalcPreferredBlockSize(uint32_t memTypeIndex)</div>
-<div class="line"><a name="l15631"></a><span class="lineno">15631</span>&#160;{</div>
-<div class="line"><a name="l15632"></a><span class="lineno">15632</span>&#160;    <span class="keyword">const</span> uint32_t heapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);</div>
-<div class="line"><a name="l15633"></a><span class="lineno">15633</span>&#160;    <span class="keyword">const</span> VkDeviceSize heapSize = m_MemProps.memoryHeaps[heapIndex].size;</div>
-<div class="line"><a name="l15634"></a><span class="lineno">15634</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isSmallHeap = heapSize &lt;= VMA_SMALL_HEAP_MAX_SIZE;</div>
-<div class="line"><a name="l15635"></a><span class="lineno">15635</span>&#160;    <span class="keywordflow">return</span> VmaAlignUp(isSmallHeap ? (heapSize / 8) : m_PreferredLargeHeapBlockSize, (VkDeviceSize)32);</div>
-<div class="line"><a name="l15636"></a><span class="lineno">15636</span>&#160;}</div>
-<div class="line"><a name="l15637"></a><span class="lineno">15637</span>&#160; </div>
-<div class="line"><a name="l15638"></a><span class="lineno">15638</span>&#160;VkResult VmaAllocator_T::AllocateMemoryOfType(</div>
-<div class="line"><a name="l15639"></a><span class="lineno">15639</span>&#160;    VkDeviceSize size,</div>
-<div class="line"><a name="l15640"></a><span class="lineno">15640</span>&#160;    VkDeviceSize alignment,</div>
-<div class="line"><a name="l15641"></a><span class="lineno">15641</span>&#160;    <span class="keywordtype">bool</span> dedicatedAllocation,</div>
-<div class="line"><a name="l15642"></a><span class="lineno">15642</span>&#160;    VkBuffer dedicatedBuffer,</div>
-<div class="line"><a name="l15643"></a><span class="lineno">15643</span>&#160;    VkBufferUsageFlags dedicatedBufferUsage,</div>
-<div class="line"><a name="l15644"></a><span class="lineno">15644</span>&#160;    VkImage dedicatedImage,</div>
-<div class="line"><a name="l15645"></a><span class="lineno">15645</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l15646"></a><span class="lineno">15646</span>&#160;    uint32_t memTypeIndex,</div>
-<div class="line"><a name="l15647"></a><span class="lineno">15647</span>&#160;    VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l15648"></a><span class="lineno">15648</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l15649"></a><span class="lineno">15649</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
-<div class="line"><a name="l15650"></a><span class="lineno">15650</span>&#160;{</div>
-<div class="line"><a name="l15651"></a><span class="lineno">15651</span>&#160;    VMA_ASSERT(pAllocations != VMA_NULL);</div>
-<div class="line"><a name="l15652"></a><span class="lineno">15652</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;  AllocateMemory: MemoryTypeIndex=%u, AllocationCount=%zu, Size=%llu&quot;</span>, memTypeIndex, allocationCount, size);</div>
-<div class="line"><a name="l15653"></a><span class="lineno">15653</span>&#160; </div>
-<div class="line"><a name="l15654"></a><span class="lineno">15654</span>&#160;    <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> finalCreateInfo = createInfo;</div>
+<div class="line"><a name="l15627"></a><span class="lineno">15627</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l15628"></a><span class="lineno">15628</span>&#160; </div>
+<div class="line"><a name="l15629"></a><span class="lineno">15629</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l15630"></a><span class="lineno">15630</span>&#160;}</div>
+<div class="line"><a name="l15631"></a><span class="lineno">15631</span>&#160; </div>
+<div class="line"><a name="l15632"></a><span class="lineno">15632</span>&#160;VmaAllocator_T::~VmaAllocator_T()</div>
+<div class="line"><a name="l15633"></a><span class="lineno">15633</span>&#160;{</div>
+<div class="line"><a name="l15634"></a><span class="lineno">15634</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l15635"></a><span class="lineno">15635</span>&#160;    <span class="keywordflow">if</span>(m_pRecorder != VMA_NULL)</div>
+<div class="line"><a name="l15636"></a><span class="lineno">15636</span>&#160;    {</div>
+<div class="line"><a name="l15637"></a><span class="lineno">15637</span>&#160;        m_pRecorder-&gt;RecordDestroyAllocator(GetCurrentFrameIndex());</div>
+<div class="line"><a name="l15638"></a><span class="lineno">15638</span>&#160;        vma_delete(<span class="keyword">this</span>, m_pRecorder);</div>
+<div class="line"><a name="l15639"></a><span class="lineno">15639</span>&#160;    }</div>
+<div class="line"><a name="l15640"></a><span class="lineno">15640</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15641"></a><span class="lineno">15641</span>&#160;    </div>
+<div class="line"><a name="l15642"></a><span class="lineno">15642</span>&#160;    VMA_ASSERT(m_Pools.empty());</div>
+<div class="line"><a name="l15643"></a><span class="lineno">15643</span>&#160; </div>
+<div class="line"><a name="l15644"></a><span class="lineno">15644</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = GetMemoryTypeCount(); i--; )</div>
+<div class="line"><a name="l15645"></a><span class="lineno">15645</span>&#160;    {</div>
+<div class="line"><a name="l15646"></a><span class="lineno">15646</span>&#160;        <span class="keywordflow">if</span>(m_pDedicatedAllocations[i] != VMA_NULL &amp;&amp; !m_pDedicatedAllocations[i]-&gt;empty())</div>
+<div class="line"><a name="l15647"></a><span class="lineno">15647</span>&#160;        {</div>
+<div class="line"><a name="l15648"></a><span class="lineno">15648</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Unfreed dedicated allocations found.&quot;</span>);</div>
+<div class="line"><a name="l15649"></a><span class="lineno">15649</span>&#160;        }</div>
+<div class="line"><a name="l15650"></a><span class="lineno">15650</span>&#160; </div>
+<div class="line"><a name="l15651"></a><span class="lineno">15651</span>&#160;        vma_delete(<span class="keyword">this</span>, m_pDedicatedAllocations[i]);</div>
+<div class="line"><a name="l15652"></a><span class="lineno">15652</span>&#160;        vma_delete(<span class="keyword">this</span>, m_pBlockVectors[i]);</div>
+<div class="line"><a name="l15653"></a><span class="lineno">15653</span>&#160;    }</div>
+<div class="line"><a name="l15654"></a><span class="lineno">15654</span>&#160;}</div>
 <div class="line"><a name="l15655"></a><span class="lineno">15655</span>&#160; </div>
-<div class="line"><a name="l15656"></a><span class="lineno">15656</span>&#160;    <span class="comment">// If memory type is not HOST_VISIBLE, disable MAPPED.</span></div>
-<div class="line"><a name="l15657"></a><span class="lineno">15657</span>&#160;    <span class="keywordflow">if</span>((finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0 &amp;&amp;</div>
-<div class="line"><a name="l15658"></a><span class="lineno">15658</span>&#160;        (m_MemProps.memoryTypes[memTypeIndex].propertyFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)</div>
-<div class="line"><a name="l15659"></a><span class="lineno">15659</span>&#160;    {</div>
-<div class="line"><a name="l15660"></a><span class="lineno">15660</span>&#160;        finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp;= ~<a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>;</div>
-<div class="line"><a name="l15661"></a><span class="lineno">15661</span>&#160;    }</div>
-<div class="line"><a name="l15662"></a><span class="lineno">15662</span>&#160;    <span class="comment">// If memory is lazily allocated, it should be always dedicated.</span></div>
-<div class="line"><a name="l15663"></a><span class="lineno">15663</span>&#160;    <span class="keywordflow">if</span>(finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a> == <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d">VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED</a>)</div>
-<div class="line"><a name="l15664"></a><span class="lineno">15664</span>&#160;    {</div>
-<div class="line"><a name="l15665"></a><span class="lineno">15665</span>&#160;        finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> |= <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>;</div>
-<div class="line"><a name="l15666"></a><span class="lineno">15666</span>&#160;    }</div>
-<div class="line"><a name="l15667"></a><span class="lineno">15667</span>&#160; </div>
-<div class="line"><a name="l15668"></a><span class="lineno">15668</span>&#160;    VmaBlockVector* <span class="keyword">const</span> blockVector = m_pBlockVectors[memTypeIndex];</div>
-<div class="line"><a name="l15669"></a><span class="lineno">15669</span>&#160;    VMA_ASSERT(blockVector);</div>
+<div class="line"><a name="l15656"></a><span class="lineno">15656</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::ImportVulkanFunctions(<span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* pVulkanFunctions)</div>
+<div class="line"><a name="l15657"></a><span class="lineno">15657</span>&#160;{</div>
+<div class="line"><a name="l15658"></a><span class="lineno">15658</span>&#160;<span class="preprocessor">#if VMA_STATIC_VULKAN_FUNCTIONS == 1</span></div>
+<div class="line"><a name="l15659"></a><span class="lineno">15659</span>&#160;    ImportVulkanFunctions_Static();</div>
+<div class="line"><a name="l15660"></a><span class="lineno">15660</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15661"></a><span class="lineno">15661</span>&#160; </div>
+<div class="line"><a name="l15662"></a><span class="lineno">15662</span>&#160;    <span class="keywordflow">if</span>(pVulkanFunctions != VMA_NULL)</div>
+<div class="line"><a name="l15663"></a><span class="lineno">15663</span>&#160;    {</div>
+<div class="line"><a name="l15664"></a><span class="lineno">15664</span>&#160;        ImportVulkanFunctions_Custom(pVulkanFunctions);</div>
+<div class="line"><a name="l15665"></a><span class="lineno">15665</span>&#160;    }</div>
+<div class="line"><a name="l15666"></a><span class="lineno">15666</span>&#160; </div>
+<div class="line"><a name="l15667"></a><span class="lineno">15667</span>&#160;<span class="preprocessor">#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1</span></div>
+<div class="line"><a name="l15668"></a><span class="lineno">15668</span>&#160;    ImportVulkanFunctions_Dynamic();</div>
+<div class="line"><a name="l15669"></a><span class="lineno">15669</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l15670"></a><span class="lineno">15670</span>&#160; </div>
-<div class="line"><a name="l15671"></a><span class="lineno">15671</span>&#160;    <span class="keyword">const</span> VkDeviceSize preferredBlockSize = blockVector-&gt;GetPreferredBlockSize();</div>
-<div class="line"><a name="l15672"></a><span class="lineno">15672</span>&#160;    <span class="keywordtype">bool</span> preferDedicatedMemory =</div>
-<div class="line"><a name="l15673"></a><span class="lineno">15673</span>&#160;        VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ||</div>
-<div class="line"><a name="l15674"></a><span class="lineno">15674</span>&#160;        dedicatedAllocation ||</div>
-<div class="line"><a name="l15675"></a><span class="lineno">15675</span>&#160;        <span class="comment">// Heuristics: Allocate dedicated memory if requested size if greater than half of preferred block size.</span></div>
-<div class="line"><a name="l15676"></a><span class="lineno">15676</span>&#160;        size &gt; preferredBlockSize / 2;</div>
-<div class="line"><a name="l15677"></a><span class="lineno">15677</span>&#160; </div>
-<div class="line"><a name="l15678"></a><span class="lineno">15678</span>&#160;    <span class="keywordflow">if</span>(preferDedicatedMemory &amp;&amp;</div>
-<div class="line"><a name="l15679"></a><span class="lineno">15679</span>&#160;        (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) == 0 &amp;&amp;</div>
-<div class="line"><a name="l15680"></a><span class="lineno">15680</span>&#160;        finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a> == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l15681"></a><span class="lineno">15681</span>&#160;    {</div>
-<div class="line"><a name="l15682"></a><span class="lineno">15682</span>&#160;        finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> |= <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>;</div>
-<div class="line"><a name="l15683"></a><span class="lineno">15683</span>&#160;    }</div>
-<div class="line"><a name="l15684"></a><span class="lineno">15684</span>&#160; </div>
-<div class="line"><a name="l15685"></a><span class="lineno">15685</span>&#160;    <span class="keywordflow">if</span>((finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>) != 0)</div>
-<div class="line"><a name="l15686"></a><span class="lineno">15686</span>&#160;    {</div>
-<div class="line"><a name="l15687"></a><span class="lineno">15687</span>&#160;        <span class="keywordflow">if</span>((finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) != 0)</div>
-<div class="line"><a name="l15688"></a><span class="lineno">15688</span>&#160;        {</div>
-<div class="line"><a name="l15689"></a><span class="lineno">15689</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l15690"></a><span class="lineno">15690</span>&#160;        }</div>
-<div class="line"><a name="l15691"></a><span class="lineno">15691</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l15692"></a><span class="lineno">15692</span>&#160;        {</div>
-<div class="line"><a name="l15693"></a><span class="lineno">15693</span>&#160;            <span class="keywordflow">return</span> AllocateDedicatedMemory(</div>
-<div class="line"><a name="l15694"></a><span class="lineno">15694</span>&#160;                size,</div>
-<div class="line"><a name="l15695"></a><span class="lineno">15695</span>&#160;                suballocType,</div>
-<div class="line"><a name="l15696"></a><span class="lineno">15696</span>&#160;                memTypeIndex,</div>
-<div class="line"><a name="l15697"></a><span class="lineno">15697</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d">VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT</a>) != 0,</div>
-<div class="line"><a name="l15698"></a><span class="lineno">15698</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0,</div>
-<div class="line"><a name="l15699"></a><span class="lineno">15699</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a>) != 0,</div>
-<div class="line"><a name="l15700"></a><span class="lineno">15700</span>&#160;                finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
-<div class="line"><a name="l15701"></a><span class="lineno">15701</span>&#160;                dedicatedBuffer,</div>
-<div class="line"><a name="l15702"></a><span class="lineno">15702</span>&#160;                dedicatedBufferUsage,</div>
-<div class="line"><a name="l15703"></a><span class="lineno">15703</span>&#160;                dedicatedImage,</div>
-<div class="line"><a name="l15704"></a><span class="lineno">15704</span>&#160;                allocationCount,</div>
-<div class="line"><a name="l15705"></a><span class="lineno">15705</span>&#160;                pAllocations);</div>
-<div class="line"><a name="l15706"></a><span class="lineno">15706</span>&#160;        }</div>
-<div class="line"><a name="l15707"></a><span class="lineno">15707</span>&#160;    }</div>
-<div class="line"><a name="l15708"></a><span class="lineno">15708</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l15709"></a><span class="lineno">15709</span>&#160;    {</div>
-<div class="line"><a name="l15710"></a><span class="lineno">15710</span>&#160;        VkResult res = blockVector-&gt;Allocate(</div>
-<div class="line"><a name="l15711"></a><span class="lineno">15711</span>&#160;            m_CurrentFrameIndex.load(),</div>
-<div class="line"><a name="l15712"></a><span class="lineno">15712</span>&#160;            size,</div>
-<div class="line"><a name="l15713"></a><span class="lineno">15713</span>&#160;            alignment,</div>
-<div class="line"><a name="l15714"></a><span class="lineno">15714</span>&#160;            finalCreateInfo,</div>
-<div class="line"><a name="l15715"></a><span class="lineno">15715</span>&#160;            suballocType,</div>
-<div class="line"><a name="l15716"></a><span class="lineno">15716</span>&#160;            allocationCount,</div>
-<div class="line"><a name="l15717"></a><span class="lineno">15717</span>&#160;            pAllocations);</div>
-<div class="line"><a name="l15718"></a><span class="lineno">15718</span>&#160;        <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l15719"></a><span class="lineno">15719</span>&#160;        {</div>
-<div class="line"><a name="l15720"></a><span class="lineno">15720</span>&#160;            <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l15721"></a><span class="lineno">15721</span>&#160;        }</div>
-<div class="line"><a name="l15722"></a><span class="lineno">15722</span>&#160; </div>
-<div class="line"><a name="l15723"></a><span class="lineno">15723</span>&#160;        <span class="comment">// 5. Try dedicated memory.</span></div>
-<div class="line"><a name="l15724"></a><span class="lineno">15724</span>&#160;        <span class="keywordflow">if</span>((finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) != 0)</div>
-<div class="line"><a name="l15725"></a><span class="lineno">15725</span>&#160;        {</div>
-<div class="line"><a name="l15726"></a><span class="lineno">15726</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l15727"></a><span class="lineno">15727</span>&#160;        }</div>
-<div class="line"><a name="l15728"></a><span class="lineno">15728</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l15729"></a><span class="lineno">15729</span>&#160;        {</div>
-<div class="line"><a name="l15730"></a><span class="lineno">15730</span>&#160;            res = AllocateDedicatedMemory(</div>
-<div class="line"><a name="l15731"></a><span class="lineno">15731</span>&#160;                size,</div>
-<div class="line"><a name="l15732"></a><span class="lineno">15732</span>&#160;                suballocType,</div>
-<div class="line"><a name="l15733"></a><span class="lineno">15733</span>&#160;                memTypeIndex,</div>
-<div class="line"><a name="l15734"></a><span class="lineno">15734</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d">VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT</a>) != 0,</div>
-<div class="line"><a name="l15735"></a><span class="lineno">15735</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0,</div>
-<div class="line"><a name="l15736"></a><span class="lineno">15736</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a>) != 0,</div>
-<div class="line"><a name="l15737"></a><span class="lineno">15737</span>&#160;                finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
-<div class="line"><a name="l15738"></a><span class="lineno">15738</span>&#160;                dedicatedBuffer,</div>
-<div class="line"><a name="l15739"></a><span class="lineno">15739</span>&#160;                dedicatedBufferUsage,</div>
-<div class="line"><a name="l15740"></a><span class="lineno">15740</span>&#160;                dedicatedImage,</div>
-<div class="line"><a name="l15741"></a><span class="lineno">15741</span>&#160;                allocationCount,</div>
-<div class="line"><a name="l15742"></a><span class="lineno">15742</span>&#160;                pAllocations);</div>
-<div class="line"><a name="l15743"></a><span class="lineno">15743</span>&#160;            <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l15744"></a><span class="lineno">15744</span>&#160;            {</div>
-<div class="line"><a name="l15745"></a><span class="lineno">15745</span>&#160;                <span class="comment">// Succeeded: AllocateDedicatedMemory function already filld pMemory, nothing more to do here.</span></div>
-<div class="line"><a name="l15746"></a><span class="lineno">15746</span>&#160;                VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Allocated as DedicatedMemory&quot;</span>);</div>
-<div class="line"><a name="l15747"></a><span class="lineno">15747</span>&#160;                <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l15748"></a><span class="lineno">15748</span>&#160;            }</div>
-<div class="line"><a name="l15749"></a><span class="lineno">15749</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l15750"></a><span class="lineno">15750</span>&#160;            {</div>
-<div class="line"><a name="l15751"></a><span class="lineno">15751</span>&#160;                <span class="comment">// Everything failed: Return error code.</span></div>
-<div class="line"><a name="l15752"></a><span class="lineno">15752</span>&#160;                VMA_DEBUG_LOG(<span class="stringliteral">&quot;    vkAllocateMemory FAILED&quot;</span>);</div>
-<div class="line"><a name="l15753"></a><span class="lineno">15753</span>&#160;                <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l15754"></a><span class="lineno">15754</span>&#160;            }</div>
-<div class="line"><a name="l15755"></a><span class="lineno">15755</span>&#160;        }</div>
-<div class="line"><a name="l15756"></a><span class="lineno">15756</span>&#160;    }</div>
-<div class="line"><a name="l15757"></a><span class="lineno">15757</span>&#160;}</div>
-<div class="line"><a name="l15758"></a><span class="lineno">15758</span>&#160; </div>
-<div class="line"><a name="l15759"></a><span class="lineno">15759</span>&#160;VkResult VmaAllocator_T::AllocateDedicatedMemory(</div>
-<div class="line"><a name="l15760"></a><span class="lineno">15760</span>&#160;    VkDeviceSize size,</div>
-<div class="line"><a name="l15761"></a><span class="lineno">15761</span>&#160;    VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l15762"></a><span class="lineno">15762</span>&#160;    uint32_t memTypeIndex,</div>
-<div class="line"><a name="l15763"></a><span class="lineno">15763</span>&#160;    <span class="keywordtype">bool</span> withinBudget,</div>
-<div class="line"><a name="l15764"></a><span class="lineno">15764</span>&#160;    <span class="keywordtype">bool</span> map,</div>
-<div class="line"><a name="l15765"></a><span class="lineno">15765</span>&#160;    <span class="keywordtype">bool</span> isUserDataString,</div>
-<div class="line"><a name="l15766"></a><span class="lineno">15766</span>&#160;    <span class="keywordtype">void</span>* pUserData,</div>
-<div class="line"><a name="l15767"></a><span class="lineno">15767</span>&#160;    VkBuffer dedicatedBuffer,</div>
-<div class="line"><a name="l15768"></a><span class="lineno">15768</span>&#160;    VkBufferUsageFlags dedicatedBufferUsage,</div>
-<div class="line"><a name="l15769"></a><span class="lineno">15769</span>&#160;    VkImage dedicatedImage,</div>
-<div class="line"><a name="l15770"></a><span class="lineno">15770</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l15771"></a><span class="lineno">15771</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
-<div class="line"><a name="l15772"></a><span class="lineno">15772</span>&#160;{</div>
-<div class="line"><a name="l15773"></a><span class="lineno">15773</span>&#160;    VMA_ASSERT(allocationCount &gt; 0 &amp;&amp; pAllocations);</div>
-<div class="line"><a name="l15774"></a><span class="lineno">15774</span>&#160; </div>
-<div class="line"><a name="l15775"></a><span class="lineno">15775</span>&#160;    <span class="keywordflow">if</span>(withinBudget)</div>
-<div class="line"><a name="l15776"></a><span class="lineno">15776</span>&#160;    {</div>
-<div class="line"><a name="l15777"></a><span class="lineno">15777</span>&#160;        <span class="keyword">const</span> uint32_t heapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);</div>
-<div class="line"><a name="l15778"></a><span class="lineno">15778</span>&#160;        <a class="code" href="struct_vma_budget.html">VmaBudget</a> heapBudget = {};</div>
-<div class="line"><a name="l15779"></a><span class="lineno">15779</span>&#160;        GetBudget(&amp;heapBudget, heapIndex, 1);</div>
-<div class="line"><a name="l15780"></a><span class="lineno">15780</span>&#160;        <span class="keywordflow">if</span>(heapBudget.<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> + size * allocationCount &gt; heapBudget.<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a>)</div>
-<div class="line"><a name="l15781"></a><span class="lineno">15781</span>&#160;        {</div>
-<div class="line"><a name="l15782"></a><span class="lineno">15782</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l15783"></a><span class="lineno">15783</span>&#160;        }</div>
-<div class="line"><a name="l15784"></a><span class="lineno">15784</span>&#160;    }</div>
-<div class="line"><a name="l15785"></a><span class="lineno">15785</span>&#160; </div>
-<div class="line"><a name="l15786"></a><span class="lineno">15786</span>&#160;    VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };</div>
-<div class="line"><a name="l15787"></a><span class="lineno">15787</span>&#160;    allocInfo.memoryTypeIndex = memTypeIndex;</div>
-<div class="line"><a name="l15788"></a><span class="lineno">15788</span>&#160;    allocInfo.allocationSize = size;</div>
-<div class="line"><a name="l15789"></a><span class="lineno">15789</span>&#160; </div>
-<div class="line"><a name="l15790"></a><span class="lineno">15790</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l15791"></a><span class="lineno">15791</span>&#160;    VkMemoryDedicatedAllocateInfoKHR dedicatedAllocInfo = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR };</div>
-<div class="line"><a name="l15792"></a><span class="lineno">15792</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrDedicatedAllocation || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
-<div class="line"><a name="l15793"></a><span class="lineno">15793</span>&#160;    {</div>
-<div class="line"><a name="l15794"></a><span class="lineno">15794</span>&#160;        <span class="keywordflow">if</span>(dedicatedBuffer != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l15795"></a><span class="lineno">15795</span>&#160;        {</div>
-<div class="line"><a name="l15796"></a><span class="lineno">15796</span>&#160;            VMA_ASSERT(dedicatedImage == VK_NULL_HANDLE);</div>
-<div class="line"><a name="l15797"></a><span class="lineno">15797</span>&#160;            dedicatedAllocInfo.buffer = dedicatedBuffer;</div>
-<div class="line"><a name="l15798"></a><span class="lineno">15798</span>&#160;            VmaPnextChainPushFront(&amp;allocInfo, &amp;dedicatedAllocInfo);</div>
-<div class="line"><a name="l15799"></a><span class="lineno">15799</span>&#160;        }</div>
-<div class="line"><a name="l15800"></a><span class="lineno">15800</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(dedicatedImage != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l15801"></a><span class="lineno">15801</span>&#160;        {</div>
-<div class="line"><a name="l15802"></a><span class="lineno">15802</span>&#160;            dedicatedAllocInfo.image = dedicatedImage;</div>
-<div class="line"><a name="l15803"></a><span class="lineno">15803</span>&#160;            VmaPnextChainPushFront(&amp;allocInfo, &amp;dedicatedAllocInfo);</div>
-<div class="line"><a name="l15804"></a><span class="lineno">15804</span>&#160;        }</div>
+<div class="line"><a name="l15671"></a><span class="lineno">15671</span>&#160;    ValidateVulkanFunctions();</div>
+<div class="line"><a name="l15672"></a><span class="lineno">15672</span>&#160;}</div>
+<div class="line"><a name="l15673"></a><span class="lineno">15673</span>&#160; </div>
+<div class="line"><a name="l15674"></a><span class="lineno">15674</span>&#160;<span class="preprocessor">#if VMA_STATIC_VULKAN_FUNCTIONS == 1</span></div>
+<div class="line"><a name="l15675"></a><span class="lineno">15675</span>&#160; </div>
+<div class="line"><a name="l15676"></a><span class="lineno">15676</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::ImportVulkanFunctions_Static()</div>
+<div class="line"><a name="l15677"></a><span class="lineno">15677</span>&#160;{</div>
+<div class="line"><a name="l15678"></a><span class="lineno">15678</span>&#160;    <span class="comment">// Vulkan 1.0</span></div>
+<div class="line"><a name="l15679"></a><span class="lineno">15679</span>&#160;    m_VulkanFunctions.vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties)vkGetPhysicalDeviceProperties;</div>
+<div class="line"><a name="l15680"></a><span class="lineno">15680</span>&#160;    m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties)vkGetPhysicalDeviceMemoryProperties;</div>
+<div class="line"><a name="l15681"></a><span class="lineno">15681</span>&#160;    m_VulkanFunctions.vkAllocateMemory = (PFN_vkAllocateMemory)vkAllocateMemory;</div>
+<div class="line"><a name="l15682"></a><span class="lineno">15682</span>&#160;    m_VulkanFunctions.vkFreeMemory = (PFN_vkFreeMemory)vkFreeMemory;</div>
+<div class="line"><a name="l15683"></a><span class="lineno">15683</span>&#160;    m_VulkanFunctions.vkMapMemory = (PFN_vkMapMemory)vkMapMemory;</div>
+<div class="line"><a name="l15684"></a><span class="lineno">15684</span>&#160;    m_VulkanFunctions.vkUnmapMemory = (PFN_vkUnmapMemory)vkUnmapMemory;</div>
+<div class="line"><a name="l15685"></a><span class="lineno">15685</span>&#160;    m_VulkanFunctions.vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges)vkFlushMappedMemoryRanges;</div>
+<div class="line"><a name="l15686"></a><span class="lineno">15686</span>&#160;    m_VulkanFunctions.vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges)vkInvalidateMappedMemoryRanges;</div>
+<div class="line"><a name="l15687"></a><span class="lineno">15687</span>&#160;    m_VulkanFunctions.vkBindBufferMemory = (PFN_vkBindBufferMemory)vkBindBufferMemory;</div>
+<div class="line"><a name="l15688"></a><span class="lineno">15688</span>&#160;    m_VulkanFunctions.vkBindImageMemory = (PFN_vkBindImageMemory)vkBindImageMemory;</div>
+<div class="line"><a name="l15689"></a><span class="lineno">15689</span>&#160;    m_VulkanFunctions.vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements)vkGetBufferMemoryRequirements;</div>
+<div class="line"><a name="l15690"></a><span class="lineno">15690</span>&#160;    m_VulkanFunctions.vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements)vkGetImageMemoryRequirements;</div>
+<div class="line"><a name="l15691"></a><span class="lineno">15691</span>&#160;    m_VulkanFunctions.vkCreateBuffer = (PFN_vkCreateBuffer)vkCreateBuffer;</div>
+<div class="line"><a name="l15692"></a><span class="lineno">15692</span>&#160;    m_VulkanFunctions.vkDestroyBuffer = (PFN_vkDestroyBuffer)vkDestroyBuffer;</div>
+<div class="line"><a name="l15693"></a><span class="lineno">15693</span>&#160;    m_VulkanFunctions.vkCreateImage = (PFN_vkCreateImage)vkCreateImage;</div>
+<div class="line"><a name="l15694"></a><span class="lineno">15694</span>&#160;    m_VulkanFunctions.vkDestroyImage = (PFN_vkDestroyImage)vkDestroyImage;</div>
+<div class="line"><a name="l15695"></a><span class="lineno">15695</span>&#160;    m_VulkanFunctions.vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer)vkCmdCopyBuffer;</div>
+<div class="line"><a name="l15696"></a><span class="lineno">15696</span>&#160; </div>
+<div class="line"><a name="l15697"></a><span class="lineno">15697</span>&#160;    <span class="comment">// Vulkan 1.1</span></div>
+<div class="line"><a name="l15698"></a><span class="lineno">15698</span>&#160;<span class="preprocessor">#if VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l15699"></a><span class="lineno">15699</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
+<div class="line"><a name="l15700"></a><span class="lineno">15700</span>&#160;    {</div>
+<div class="line"><a name="l15701"></a><span class="lineno">15701</span>&#160;        m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR = (PFN_vkGetBufferMemoryRequirements2)vkGetBufferMemoryRequirements2;</div>
+<div class="line"><a name="l15702"></a><span class="lineno">15702</span>&#160;        m_VulkanFunctions.vkGetImageMemoryRequirements2KHR = (PFN_vkGetImageMemoryRequirements2)vkGetImageMemoryRequirements2;</div>
+<div class="line"><a name="l15703"></a><span class="lineno">15703</span>&#160;        m_VulkanFunctions.vkBindBufferMemory2KHR = (PFN_vkBindBufferMemory2)vkBindBufferMemory2;</div>
+<div class="line"><a name="l15704"></a><span class="lineno">15704</span>&#160;        m_VulkanFunctions.vkBindImageMemory2KHR = (PFN_vkBindImageMemory2)vkBindImageMemory2;</div>
+<div class="line"><a name="l15705"></a><span class="lineno">15705</span>&#160;        m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties2KHR = (PFN_vkGetPhysicalDeviceMemoryProperties2)vkGetPhysicalDeviceMemoryProperties2;</div>
+<div class="line"><a name="l15706"></a><span class="lineno">15706</span>&#160;    }</div>
+<div class="line"><a name="l15707"></a><span class="lineno">15707</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15708"></a><span class="lineno">15708</span>&#160;}</div>
+<div class="line"><a name="l15709"></a><span class="lineno">15709</span>&#160; </div>
+<div class="line"><a name="l15710"></a><span class="lineno">15710</span>&#160;<span class="preprocessor">#endif // #if VMA_STATIC_VULKAN_FUNCTIONS == 1</span></div>
+<div class="line"><a name="l15711"></a><span class="lineno">15711</span>&#160; </div>
+<div class="line"><a name="l15712"></a><span class="lineno">15712</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::ImportVulkanFunctions_Custom(<span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* pVulkanFunctions)</div>
+<div class="line"><a name="l15713"></a><span class="lineno">15713</span>&#160;{</div>
+<div class="line"><a name="l15714"></a><span class="lineno">15714</span>&#160;    VMA_ASSERT(pVulkanFunctions != VMA_NULL);</div>
+<div class="line"><a name="l15715"></a><span class="lineno">15715</span>&#160; </div>
+<div class="line"><a name="l15716"></a><span class="lineno">15716</span>&#160;<span class="preprocessor">#define VMA_COPY_IF_NOT_NULL(funcName) \</span></div>
+<div class="line"><a name="l15717"></a><span class="lineno">15717</span>&#160;<span class="preprocessor">    if(pVulkanFunctions-&gt;funcName != VMA_NULL) m_VulkanFunctions.funcName = pVulkanFunctions-&gt;funcName;</span></div>
+<div class="line"><a name="l15718"></a><span class="lineno">15718</span>&#160; </div>
+<div class="line"><a name="l15719"></a><span class="lineno">15719</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceProperties);</div>
+<div class="line"><a name="l15720"></a><span class="lineno">15720</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceMemoryProperties);</div>
+<div class="line"><a name="l15721"></a><span class="lineno">15721</span>&#160;    VMA_COPY_IF_NOT_NULL(vkAllocateMemory);</div>
+<div class="line"><a name="l15722"></a><span class="lineno">15722</span>&#160;    VMA_COPY_IF_NOT_NULL(vkFreeMemory);</div>
+<div class="line"><a name="l15723"></a><span class="lineno">15723</span>&#160;    VMA_COPY_IF_NOT_NULL(vkMapMemory);</div>
+<div class="line"><a name="l15724"></a><span class="lineno">15724</span>&#160;    VMA_COPY_IF_NOT_NULL(vkUnmapMemory);</div>
+<div class="line"><a name="l15725"></a><span class="lineno">15725</span>&#160;    VMA_COPY_IF_NOT_NULL(vkFlushMappedMemoryRanges);</div>
+<div class="line"><a name="l15726"></a><span class="lineno">15726</span>&#160;    VMA_COPY_IF_NOT_NULL(vkInvalidateMappedMemoryRanges);</div>
+<div class="line"><a name="l15727"></a><span class="lineno">15727</span>&#160;    VMA_COPY_IF_NOT_NULL(vkBindBufferMemory);</div>
+<div class="line"><a name="l15728"></a><span class="lineno">15728</span>&#160;    VMA_COPY_IF_NOT_NULL(vkBindImageMemory);</div>
+<div class="line"><a name="l15729"></a><span class="lineno">15729</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetBufferMemoryRequirements);</div>
+<div class="line"><a name="l15730"></a><span class="lineno">15730</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetImageMemoryRequirements);</div>
+<div class="line"><a name="l15731"></a><span class="lineno">15731</span>&#160;    VMA_COPY_IF_NOT_NULL(vkCreateBuffer);</div>
+<div class="line"><a name="l15732"></a><span class="lineno">15732</span>&#160;    VMA_COPY_IF_NOT_NULL(vkDestroyBuffer);</div>
+<div class="line"><a name="l15733"></a><span class="lineno">15733</span>&#160;    VMA_COPY_IF_NOT_NULL(vkCreateImage);</div>
+<div class="line"><a name="l15734"></a><span class="lineno">15734</span>&#160;    VMA_COPY_IF_NOT_NULL(vkDestroyImage);</div>
+<div class="line"><a name="l15735"></a><span class="lineno">15735</span>&#160;    VMA_COPY_IF_NOT_NULL(vkCmdCopyBuffer);</div>
+<div class="line"><a name="l15736"></a><span class="lineno">15736</span>&#160; </div>
+<div class="line"><a name="l15737"></a><span class="lineno">15737</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l15738"></a><span class="lineno">15738</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetBufferMemoryRequirements2KHR);</div>
+<div class="line"><a name="l15739"></a><span class="lineno">15739</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetImageMemoryRequirements2KHR);</div>
+<div class="line"><a name="l15740"></a><span class="lineno">15740</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15741"></a><span class="lineno">15741</span>&#160; </div>
+<div class="line"><a name="l15742"></a><span class="lineno">15742</span>&#160;<span class="preprocessor">#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l15743"></a><span class="lineno">15743</span>&#160;    VMA_COPY_IF_NOT_NULL(vkBindBufferMemory2KHR);</div>
+<div class="line"><a name="l15744"></a><span class="lineno">15744</span>&#160;    VMA_COPY_IF_NOT_NULL(vkBindImageMemory2KHR);</div>
+<div class="line"><a name="l15745"></a><span class="lineno">15745</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15746"></a><span class="lineno">15746</span>&#160; </div>
+<div class="line"><a name="l15747"></a><span class="lineno">15747</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l15748"></a><span class="lineno">15748</span>&#160;    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceMemoryProperties2KHR);</div>
+<div class="line"><a name="l15749"></a><span class="lineno">15749</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15750"></a><span class="lineno">15750</span>&#160; </div>
+<div class="line"><a name="l15751"></a><span class="lineno">15751</span>&#160;<span class="preprocessor">#undef VMA_COPY_IF_NOT_NULL</span></div>
+<div class="line"><a name="l15752"></a><span class="lineno">15752</span>&#160;}</div>
+<div class="line"><a name="l15753"></a><span class="lineno">15753</span>&#160; </div>
+<div class="line"><a name="l15754"></a><span class="lineno">15754</span>&#160;<span class="preprocessor">#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1</span></div>
+<div class="line"><a name="l15755"></a><span class="lineno">15755</span>&#160; </div>
+<div class="line"><a name="l15756"></a><span class="lineno">15756</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::ImportVulkanFunctions_Dynamic()</div>
+<div class="line"><a name="l15757"></a><span class="lineno">15757</span>&#160;{</div>
+<div class="line"><a name="l15758"></a><span class="lineno">15758</span>&#160;<span class="preprocessor">#define VMA_FETCH_INSTANCE_FUNC(memberName, functionPointerType, functionNameString) \</span></div>
+<div class="line"><a name="l15759"></a><span class="lineno">15759</span>&#160;<span class="preprocessor">    if(m_VulkanFunctions.memberName == VMA_NULL) \</span></div>
+<div class="line"><a name="l15760"></a><span class="lineno">15760</span>&#160;<span class="preprocessor">        m_VulkanFunctions.memberName = \</span></div>
+<div class="line"><a name="l15761"></a><span class="lineno">15761</span>&#160;<span class="preprocessor">            (functionPointerType)vkGetInstanceProcAddr(m_hInstance, functionNameString);</span></div>
+<div class="line"><a name="l15762"></a><span class="lineno">15762</span>&#160;<span class="preprocessor">#define VMA_FETCH_DEVICE_FUNC(memberName, functionPointerType, functionNameString) \</span></div>
+<div class="line"><a name="l15763"></a><span class="lineno">15763</span>&#160;<span class="preprocessor">    if(m_VulkanFunctions.memberName == VMA_NULL) \</span></div>
+<div class="line"><a name="l15764"></a><span class="lineno">15764</span>&#160;<span class="preprocessor">        m_VulkanFunctions.memberName = \</span></div>
+<div class="line"><a name="l15765"></a><span class="lineno">15765</span>&#160;<span class="preprocessor">            (functionPointerType)vkGetDeviceProcAddr(m_hDevice, functionNameString);</span></div>
+<div class="line"><a name="l15766"></a><span class="lineno">15766</span>&#160; </div>
+<div class="line"><a name="l15767"></a><span class="lineno">15767</span>&#160;    VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceProperties, PFN_vkGetPhysicalDeviceProperties, <span class="stringliteral">&quot;vkGetPhysicalDeviceProperties&quot;</span>);</div>
+<div class="line"><a name="l15768"></a><span class="lineno">15768</span>&#160;    VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceMemoryProperties, PFN_vkGetPhysicalDeviceMemoryProperties, <span class="stringliteral">&quot;vkGetPhysicalDeviceMemoryProperties&quot;</span>);</div>
+<div class="line"><a name="l15769"></a><span class="lineno">15769</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkAllocateMemory, PFN_vkAllocateMemory, <span class="stringliteral">&quot;vkAllocateMemory&quot;</span>);</div>
+<div class="line"><a name="l15770"></a><span class="lineno">15770</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkFreeMemory, PFN_vkFreeMemory, <span class="stringliteral">&quot;vkFreeMemory&quot;</span>);</div>
+<div class="line"><a name="l15771"></a><span class="lineno">15771</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkMapMemory, PFN_vkMapMemory, <span class="stringliteral">&quot;vkMapMemory&quot;</span>);</div>
+<div class="line"><a name="l15772"></a><span class="lineno">15772</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkUnmapMemory, PFN_vkUnmapMemory, <span class="stringliteral">&quot;vkUnmapMemory&quot;</span>);</div>
+<div class="line"><a name="l15773"></a><span class="lineno">15773</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkFlushMappedMemoryRanges, PFN_vkFlushMappedMemoryRanges, <span class="stringliteral">&quot;vkFlushMappedMemoryRanges&quot;</span>);</div>
+<div class="line"><a name="l15774"></a><span class="lineno">15774</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkInvalidateMappedMemoryRanges, PFN_vkInvalidateMappedMemoryRanges, <span class="stringliteral">&quot;vkInvalidateMappedMemoryRanges&quot;</span>);</div>
+<div class="line"><a name="l15775"></a><span class="lineno">15775</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkBindBufferMemory, PFN_vkBindBufferMemory, <span class="stringliteral">&quot;vkBindBufferMemory&quot;</span>);</div>
+<div class="line"><a name="l15776"></a><span class="lineno">15776</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkBindImageMemory, PFN_vkBindImageMemory, <span class="stringliteral">&quot;vkBindImageMemory&quot;</span>);</div>
+<div class="line"><a name="l15777"></a><span class="lineno">15777</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkGetBufferMemoryRequirements, PFN_vkGetBufferMemoryRequirements, <span class="stringliteral">&quot;vkGetBufferMemoryRequirements&quot;</span>);</div>
+<div class="line"><a name="l15778"></a><span class="lineno">15778</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkGetImageMemoryRequirements, PFN_vkGetImageMemoryRequirements, <span class="stringliteral">&quot;vkGetImageMemoryRequirements&quot;</span>);</div>
+<div class="line"><a name="l15779"></a><span class="lineno">15779</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkCreateBuffer, PFN_vkCreateBuffer, <span class="stringliteral">&quot;vkCreateBuffer&quot;</span>);</div>
+<div class="line"><a name="l15780"></a><span class="lineno">15780</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkDestroyBuffer, PFN_vkDestroyBuffer, <span class="stringliteral">&quot;vkDestroyBuffer&quot;</span>);</div>
+<div class="line"><a name="l15781"></a><span class="lineno">15781</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkCreateImage, PFN_vkCreateImage, <span class="stringliteral">&quot;vkCreateImage&quot;</span>);</div>
+<div class="line"><a name="l15782"></a><span class="lineno">15782</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkDestroyImage, PFN_vkDestroyImage, <span class="stringliteral">&quot;vkDestroyImage&quot;</span>);</div>
+<div class="line"><a name="l15783"></a><span class="lineno">15783</span>&#160;    VMA_FETCH_DEVICE_FUNC(vkCmdCopyBuffer, PFN_vkCmdCopyBuffer, <span class="stringliteral">&quot;vkCmdCopyBuffer&quot;</span>);</div>
+<div class="line"><a name="l15784"></a><span class="lineno">15784</span>&#160; </div>
+<div class="line"><a name="l15785"></a><span class="lineno">15785</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION</span></div>
+<div class="line"><a name="l15786"></a><span class="lineno">15786</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrDedicatedAllocation)</div>
+<div class="line"><a name="l15787"></a><span class="lineno">15787</span>&#160;    {</div>
+<div class="line"><a name="l15788"></a><span class="lineno">15788</span>&#160;        VMA_FETCH_DEVICE_FUNC(vkGetBufferMemoryRequirements2KHR, PFN_vkGetBufferMemoryRequirements2KHR, <span class="stringliteral">&quot;vkGetBufferMemoryRequirements2KHR&quot;</span>);</div>
+<div class="line"><a name="l15789"></a><span class="lineno">15789</span>&#160;        VMA_FETCH_DEVICE_FUNC(vkGetImageMemoryRequirements2KHR, PFN_vkGetImageMemoryRequirements2KHR, <span class="stringliteral">&quot;vkGetImageMemoryRequirements2KHR&quot;</span>);</div>
+<div class="line"><a name="l15790"></a><span class="lineno">15790</span>&#160;    }</div>
+<div class="line"><a name="l15791"></a><span class="lineno">15791</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15792"></a><span class="lineno">15792</span>&#160; </div>
+<div class="line"><a name="l15793"></a><span class="lineno">15793</span>&#160;<span class="preprocessor">#if VMA_BIND_MEMORY2</span></div>
+<div class="line"><a name="l15794"></a><span class="lineno">15794</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrBindMemory2)</div>
+<div class="line"><a name="l15795"></a><span class="lineno">15795</span>&#160;    {</div>
+<div class="line"><a name="l15796"></a><span class="lineno">15796</span>&#160;        VMA_FETCH_DEVICE_FUNC(vkBindBufferMemory2KHR, PFN_vkBindBufferMemory2KHR, <span class="stringliteral">&quot;vkBindBufferMemory2KHR&quot;</span>);</div>
+<div class="line"><a name="l15797"></a><span class="lineno">15797</span>&#160;        VMA_FETCH_DEVICE_FUNC(vkBindImageMemory2KHR, PFN_vkBindImageMemory2KHR, <span class="stringliteral">&quot;vkBindImageMemory2KHR&quot;</span>);</div>
+<div class="line"><a name="l15798"></a><span class="lineno">15798</span>&#160;    }</div>
+<div class="line"><a name="l15799"></a><span class="lineno">15799</span>&#160;<span class="preprocessor">#endif // #if VMA_BIND_MEMORY2</span></div>
+<div class="line"><a name="l15800"></a><span class="lineno">15800</span>&#160; </div>
+<div class="line"><a name="l15801"></a><span class="lineno">15801</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l15802"></a><span class="lineno">15802</span>&#160;    <span class="keywordflow">if</span>(m_UseExtMemoryBudget &amp;&amp; m_VulkanApiVersion &lt; VK_MAKE_VERSION(1, 1, 0))</div>
+<div class="line"><a name="l15803"></a><span class="lineno">15803</span>&#160;    {</div>
+<div class="line"><a name="l15804"></a><span class="lineno">15804</span>&#160;        VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceMemoryProperties2KHR, PFN_vkGetPhysicalDeviceMemoryProperties2KHR, <span class="stringliteral">&quot;vkGetPhysicalDeviceMemoryProperties2KHR&quot;</span>);</div>
 <div class="line"><a name="l15805"></a><span class="lineno">15805</span>&#160;    }</div>
-<div class="line"><a name="l15806"></a><span class="lineno">15806</span>&#160;<span class="preprocessor">#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l15806"></a><span class="lineno">15806</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
 <div class="line"><a name="l15807"></a><span class="lineno">15807</span>&#160; </div>
-<div class="line"><a name="l15808"></a><span class="lineno">15808</span>&#160;<span class="preprocessor">#if VMA_BUFFER_DEVICE_ADDRESS</span></div>
-<div class="line"><a name="l15809"></a><span class="lineno">15809</span>&#160;    VkMemoryAllocateFlagsInfoKHR allocFlagsInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR };</div>
-<div class="line"><a name="l15810"></a><span class="lineno">15810</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrBufferDeviceAddress)</div>
-<div class="line"><a name="l15811"></a><span class="lineno">15811</span>&#160;    {</div>
-<div class="line"><a name="l15812"></a><span class="lineno">15812</span>&#160;        <span class="keywordtype">bool</span> canContainBufferWithDeviceAddress = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l15813"></a><span class="lineno">15813</span>&#160;        <span class="keywordflow">if</span>(dedicatedBuffer != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l15814"></a><span class="lineno">15814</span>&#160;        {</div>
-<div class="line"><a name="l15815"></a><span class="lineno">15815</span>&#160;            canContainBufferWithDeviceAddress = dedicatedBufferUsage == UINT32_MAX || <span class="comment">// Usage flags unknown</span></div>
-<div class="line"><a name="l15816"></a><span class="lineno">15816</span>&#160;                (dedicatedBufferUsage &amp; VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT) != 0;</div>
-<div class="line"><a name="l15817"></a><span class="lineno">15817</span>&#160;        }</div>
-<div class="line"><a name="l15818"></a><span class="lineno">15818</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(dedicatedImage != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l15819"></a><span class="lineno">15819</span>&#160;        {</div>
-<div class="line"><a name="l15820"></a><span class="lineno">15820</span>&#160;            canContainBufferWithDeviceAddress = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l15821"></a><span class="lineno">15821</span>&#160;        }</div>
-<div class="line"><a name="l15822"></a><span class="lineno">15822</span>&#160;        <span class="keywordflow">if</span>(canContainBufferWithDeviceAddress)</div>
-<div class="line"><a name="l15823"></a><span class="lineno">15823</span>&#160;        {</div>
-<div class="line"><a name="l15824"></a><span class="lineno">15824</span>&#160;            allocFlagsInfo.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;</div>
-<div class="line"><a name="l15825"></a><span class="lineno">15825</span>&#160;            VmaPnextChainPushFront(&amp;allocInfo, &amp;allocFlagsInfo);</div>
-<div class="line"><a name="l15826"></a><span class="lineno">15826</span>&#160;        }</div>
-<div class="line"><a name="l15827"></a><span class="lineno">15827</span>&#160;    }</div>
-<div class="line"><a name="l15828"></a><span class="lineno">15828</span>&#160;<span class="preprocessor">#endif // #if VMA_BUFFER_DEVICE_ADDRESS</span></div>
-<div class="line"><a name="l15829"></a><span class="lineno">15829</span>&#160; </div>
-<div class="line"><a name="l15830"></a><span class="lineno">15830</span>&#160;    <span class="keywordtype">size_t</span> allocIndex;</div>
-<div class="line"><a name="l15831"></a><span class="lineno">15831</span>&#160;    VkResult res = VK_SUCCESS;</div>
-<div class="line"><a name="l15832"></a><span class="lineno">15832</span>&#160;    <span class="keywordflow">for</span>(allocIndex = 0; allocIndex &lt; allocationCount; ++allocIndex)</div>
-<div class="line"><a name="l15833"></a><span class="lineno">15833</span>&#160;    {</div>
-<div class="line"><a name="l15834"></a><span class="lineno">15834</span>&#160;        res = AllocateDedicatedMemoryPage(</div>
-<div class="line"><a name="l15835"></a><span class="lineno">15835</span>&#160;            size,</div>
-<div class="line"><a name="l15836"></a><span class="lineno">15836</span>&#160;            suballocType,</div>
-<div class="line"><a name="l15837"></a><span class="lineno">15837</span>&#160;            memTypeIndex,</div>
-<div class="line"><a name="l15838"></a><span class="lineno">15838</span>&#160;            allocInfo,</div>
-<div class="line"><a name="l15839"></a><span class="lineno">15839</span>&#160;            map,</div>
-<div class="line"><a name="l15840"></a><span class="lineno">15840</span>&#160;            isUserDataString,</div>
-<div class="line"><a name="l15841"></a><span class="lineno">15841</span>&#160;            pUserData,</div>
-<div class="line"><a name="l15842"></a><span class="lineno">15842</span>&#160;            pAllocations + allocIndex);</div>
-<div class="line"><a name="l15843"></a><span class="lineno">15843</span>&#160;        <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
-<div class="line"><a name="l15844"></a><span class="lineno">15844</span>&#160;        {</div>
-<div class="line"><a name="l15845"></a><span class="lineno">15845</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l15846"></a><span class="lineno">15846</span>&#160;        }</div>
+<div class="line"><a name="l15808"></a><span class="lineno">15808</span>&#160;<span class="preprocessor">#undef VMA_FETCH_DEVICE_FUNC</span></div>
+<div class="line"><a name="l15809"></a><span class="lineno">15809</span>&#160;<span class="preprocessor">#undef VMA_FETCH_INSTANCE_FUNC</span></div>
+<div class="line"><a name="l15810"></a><span class="lineno">15810</span>&#160;}</div>
+<div class="line"><a name="l15811"></a><span class="lineno">15811</span>&#160; </div>
+<div class="line"><a name="l15812"></a><span class="lineno">15812</span>&#160;<span class="preprocessor">#endif // #if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1</span></div>
+<div class="line"><a name="l15813"></a><span class="lineno">15813</span>&#160; </div>
+<div class="line"><a name="l15814"></a><span class="lineno">15814</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::ValidateVulkanFunctions()</div>
+<div class="line"><a name="l15815"></a><span class="lineno">15815</span>&#160;{</div>
+<div class="line"><a name="l15816"></a><span class="lineno">15816</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceProperties != VMA_NULL);</div>
+<div class="line"><a name="l15817"></a><span class="lineno">15817</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties != VMA_NULL);</div>
+<div class="line"><a name="l15818"></a><span class="lineno">15818</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkAllocateMemory != VMA_NULL);</div>
+<div class="line"><a name="l15819"></a><span class="lineno">15819</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkFreeMemory != VMA_NULL);</div>
+<div class="line"><a name="l15820"></a><span class="lineno">15820</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkMapMemory != VMA_NULL);</div>
+<div class="line"><a name="l15821"></a><span class="lineno">15821</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkUnmapMemory != VMA_NULL);</div>
+<div class="line"><a name="l15822"></a><span class="lineno">15822</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkFlushMappedMemoryRanges != VMA_NULL);</div>
+<div class="line"><a name="l15823"></a><span class="lineno">15823</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkInvalidateMappedMemoryRanges != VMA_NULL);</div>
+<div class="line"><a name="l15824"></a><span class="lineno">15824</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkBindBufferMemory != VMA_NULL);</div>
+<div class="line"><a name="l15825"></a><span class="lineno">15825</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkBindImageMemory != VMA_NULL);</div>
+<div class="line"><a name="l15826"></a><span class="lineno">15826</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkGetBufferMemoryRequirements != VMA_NULL);</div>
+<div class="line"><a name="l15827"></a><span class="lineno">15827</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkGetImageMemoryRequirements != VMA_NULL);</div>
+<div class="line"><a name="l15828"></a><span class="lineno">15828</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkCreateBuffer != VMA_NULL);</div>
+<div class="line"><a name="l15829"></a><span class="lineno">15829</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkDestroyBuffer != VMA_NULL);</div>
+<div class="line"><a name="l15830"></a><span class="lineno">15830</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkCreateImage != VMA_NULL);</div>
+<div class="line"><a name="l15831"></a><span class="lineno">15831</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkDestroyImage != VMA_NULL);</div>
+<div class="line"><a name="l15832"></a><span class="lineno">15832</span>&#160;    VMA_ASSERT(m_VulkanFunctions.vkCmdCopyBuffer != VMA_NULL);</div>
+<div class="line"><a name="l15833"></a><span class="lineno">15833</span>&#160; </div>
+<div class="line"><a name="l15834"></a><span class="lineno">15834</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l15835"></a><span class="lineno">15835</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0) || m_UseKhrDedicatedAllocation)</div>
+<div class="line"><a name="l15836"></a><span class="lineno">15836</span>&#160;    {</div>
+<div class="line"><a name="l15837"></a><span class="lineno">15837</span>&#160;        VMA_ASSERT(m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR != VMA_NULL);</div>
+<div class="line"><a name="l15838"></a><span class="lineno">15838</span>&#160;        VMA_ASSERT(m_VulkanFunctions.vkGetImageMemoryRequirements2KHR != VMA_NULL);</div>
+<div class="line"><a name="l15839"></a><span class="lineno">15839</span>&#160;    }</div>
+<div class="line"><a name="l15840"></a><span class="lineno">15840</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15841"></a><span class="lineno">15841</span>&#160; </div>
+<div class="line"><a name="l15842"></a><span class="lineno">15842</span>&#160;<span class="preprocessor">#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l15843"></a><span class="lineno">15843</span>&#160;    <span class="keywordflow">if</span>(m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0) || m_UseKhrBindMemory2)</div>
+<div class="line"><a name="l15844"></a><span class="lineno">15844</span>&#160;    {</div>
+<div class="line"><a name="l15845"></a><span class="lineno">15845</span>&#160;        VMA_ASSERT(m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL);</div>
+<div class="line"><a name="l15846"></a><span class="lineno">15846</span>&#160;        VMA_ASSERT(m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL);</div>
 <div class="line"><a name="l15847"></a><span class="lineno">15847</span>&#160;    }</div>
-<div class="line"><a name="l15848"></a><span class="lineno">15848</span>&#160; </div>
-<div class="line"><a name="l15849"></a><span class="lineno">15849</span>&#160;    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l15850"></a><span class="lineno">15850</span>&#160;    {</div>
-<div class="line"><a name="l15851"></a><span class="lineno">15851</span>&#160;        <span class="comment">// Register them in m_pDedicatedAllocations.</span></div>
-<div class="line"><a name="l15852"></a><span class="lineno">15852</span>&#160;        {</div>
-<div class="line"><a name="l15853"></a><span class="lineno">15853</span>&#160;            VmaMutexLockWrite lock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);</div>
-<div class="line"><a name="l15854"></a><span class="lineno">15854</span>&#160;            AllocationVectorType* pDedicatedAllocations = m_pDedicatedAllocations[memTypeIndex];</div>
-<div class="line"><a name="l15855"></a><span class="lineno">15855</span>&#160;            VMA_ASSERT(pDedicatedAllocations);</div>
-<div class="line"><a name="l15856"></a><span class="lineno">15856</span>&#160;            <span class="keywordflow">for</span>(allocIndex = 0; allocIndex &lt; allocationCount; ++allocIndex)</div>
-<div class="line"><a name="l15857"></a><span class="lineno">15857</span>&#160;            {</div>
-<div class="line"><a name="l15858"></a><span class="lineno">15858</span>&#160;                VmaVectorInsertSorted&lt;VmaPointerLess&gt;(*pDedicatedAllocations, pAllocations[allocIndex]);</div>
-<div class="line"><a name="l15859"></a><span class="lineno">15859</span>&#160;            }</div>
-<div class="line"><a name="l15860"></a><span class="lineno">15860</span>&#160;        }</div>
-<div class="line"><a name="l15861"></a><span class="lineno">15861</span>&#160; </div>
-<div class="line"><a name="l15862"></a><span class="lineno">15862</span>&#160;        VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Allocated DedicatedMemory Count=%zu, MemoryTypeIndex=#%u&quot;</span>, allocationCount, memTypeIndex);</div>
-<div class="line"><a name="l15863"></a><span class="lineno">15863</span>&#160;    }</div>
-<div class="line"><a name="l15864"></a><span class="lineno">15864</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l15865"></a><span class="lineno">15865</span>&#160;    {</div>
-<div class="line"><a name="l15866"></a><span class="lineno">15866</span>&#160;        <span class="comment">// Free all already created allocations.</span></div>
-<div class="line"><a name="l15867"></a><span class="lineno">15867</span>&#160;        <span class="keywordflow">while</span>(allocIndex--)</div>
-<div class="line"><a name="l15868"></a><span class="lineno">15868</span>&#160;        {</div>
-<div class="line"><a name="l15869"></a><span class="lineno">15869</span>&#160;            <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> currAlloc = pAllocations[allocIndex];</div>
-<div class="line"><a name="l15870"></a><span class="lineno">15870</span>&#160;            VkDeviceMemory hMemory = currAlloc-&gt;GetMemory();</div>
-<div class="line"><a name="l15871"></a><span class="lineno">15871</span>&#160;    </div>
-<div class="line"><a name="l15872"></a><span class="lineno">15872</span>&#160;            <span class="comment">/*</span></div>
-<div class="line"><a name="l15873"></a><span class="lineno">15873</span>&#160;<span class="comment">            There is no need to call this, because Vulkan spec allows to skip vkUnmapMemory</span></div>
-<div class="line"><a name="l15874"></a><span class="lineno">15874</span>&#160;<span class="comment">            before vkFreeMemory.</span></div>
-<div class="line"><a name="l15875"></a><span class="lineno">15875</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l15876"></a><span class="lineno">15876</span>&#160;<span class="comment">            if(currAlloc-&gt;GetMappedData() != VMA_NULL)</span></div>
-<div class="line"><a name="l15877"></a><span class="lineno">15877</span>&#160;<span class="comment">            {</span></div>
-<div class="line"><a name="l15878"></a><span class="lineno">15878</span>&#160;<span class="comment">                (*m_VulkanFunctions.vkUnmapMemory)(m_hDevice, hMemory);</span></div>
-<div class="line"><a name="l15879"></a><span class="lineno">15879</span>&#160;<span class="comment">            }</span></div>
-<div class="line"><a name="l15880"></a><span class="lineno">15880</span>&#160;<span class="comment">            */</span></div>
-<div class="line"><a name="l15881"></a><span class="lineno">15881</span>&#160;    </div>
-<div class="line"><a name="l15882"></a><span class="lineno">15882</span>&#160;            FreeVulkanMemory(memTypeIndex, currAlloc-&gt;GetSize(), hMemory);</div>
-<div class="line"><a name="l15883"></a><span class="lineno">15883</span>&#160;            m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(memTypeIndex), currAlloc-&gt;GetSize());</div>
-<div class="line"><a name="l15884"></a><span class="lineno">15884</span>&#160;            currAlloc-&gt;SetUserData(<span class="keyword">this</span>, VMA_NULL);</div>
-<div class="line"><a name="l15885"></a><span class="lineno">15885</span>&#160;            m_AllocationObjectAllocator.Free(currAlloc);</div>
-<div class="line"><a name="l15886"></a><span class="lineno">15886</span>&#160;        }</div>
-<div class="line"><a name="l15887"></a><span class="lineno">15887</span>&#160; </div>
-<div class="line"><a name="l15888"></a><span class="lineno">15888</span>&#160;        memset(pAllocations, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>) * allocationCount);</div>
+<div class="line"><a name="l15848"></a><span class="lineno">15848</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15849"></a><span class="lineno">15849</span>&#160; </div>
+<div class="line"><a name="l15850"></a><span class="lineno">15850</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l15851"></a><span class="lineno">15851</span>&#160;    <span class="keywordflow">if</span>(m_UseExtMemoryBudget || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
+<div class="line"><a name="l15852"></a><span class="lineno">15852</span>&#160;    {</div>
+<div class="line"><a name="l15853"></a><span class="lineno">15853</span>&#160;        VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties2KHR != VMA_NULL);</div>
+<div class="line"><a name="l15854"></a><span class="lineno">15854</span>&#160;    }</div>
+<div class="line"><a name="l15855"></a><span class="lineno">15855</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l15856"></a><span class="lineno">15856</span>&#160;}</div>
+<div class="line"><a name="l15857"></a><span class="lineno">15857</span>&#160; </div>
+<div class="line"><a name="l15858"></a><span class="lineno">15858</span>&#160;VkDeviceSize VmaAllocator_T::CalcPreferredBlockSize(uint32_t memTypeIndex)</div>
+<div class="line"><a name="l15859"></a><span class="lineno">15859</span>&#160;{</div>
+<div class="line"><a name="l15860"></a><span class="lineno">15860</span>&#160;    <span class="keyword">const</span> uint32_t heapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);</div>
+<div class="line"><a name="l15861"></a><span class="lineno">15861</span>&#160;    <span class="keyword">const</span> VkDeviceSize heapSize = m_MemProps.memoryHeaps[heapIndex].size;</div>
+<div class="line"><a name="l15862"></a><span class="lineno">15862</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">bool</span> isSmallHeap = heapSize &lt;= VMA_SMALL_HEAP_MAX_SIZE;</div>
+<div class="line"><a name="l15863"></a><span class="lineno">15863</span>&#160;    <span class="keywordflow">return</span> VmaAlignUp(isSmallHeap ? (heapSize / 8) : m_PreferredLargeHeapBlockSize, (VkDeviceSize)32);</div>
+<div class="line"><a name="l15864"></a><span class="lineno">15864</span>&#160;}</div>
+<div class="line"><a name="l15865"></a><span class="lineno">15865</span>&#160; </div>
+<div class="line"><a name="l15866"></a><span class="lineno">15866</span>&#160;VkResult VmaAllocator_T::AllocateMemoryOfType(</div>
+<div class="line"><a name="l15867"></a><span class="lineno">15867</span>&#160;    VkDeviceSize size,</div>
+<div class="line"><a name="l15868"></a><span class="lineno">15868</span>&#160;    VkDeviceSize alignment,</div>
+<div class="line"><a name="l15869"></a><span class="lineno">15869</span>&#160;    <span class="keywordtype">bool</span> dedicatedAllocation,</div>
+<div class="line"><a name="l15870"></a><span class="lineno">15870</span>&#160;    VkBuffer dedicatedBuffer,</div>
+<div class="line"><a name="l15871"></a><span class="lineno">15871</span>&#160;    VkBufferUsageFlags dedicatedBufferUsage,</div>
+<div class="line"><a name="l15872"></a><span class="lineno">15872</span>&#160;    VkImage dedicatedImage,</div>
+<div class="line"><a name="l15873"></a><span class="lineno">15873</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l15874"></a><span class="lineno">15874</span>&#160;    uint32_t memTypeIndex,</div>
+<div class="line"><a name="l15875"></a><span class="lineno">15875</span>&#160;    VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l15876"></a><span class="lineno">15876</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l15877"></a><span class="lineno">15877</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
+<div class="line"><a name="l15878"></a><span class="lineno">15878</span>&#160;{</div>
+<div class="line"><a name="l15879"></a><span class="lineno">15879</span>&#160;    VMA_ASSERT(pAllocations != VMA_NULL);</div>
+<div class="line"><a name="l15880"></a><span class="lineno">15880</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;  AllocateMemory: MemoryTypeIndex=%u, AllocationCount=%zu, Size=%llu&quot;</span>, memTypeIndex, allocationCount, size);</div>
+<div class="line"><a name="l15881"></a><span class="lineno">15881</span>&#160; </div>
+<div class="line"><a name="l15882"></a><span class="lineno">15882</span>&#160;    <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> finalCreateInfo = createInfo;</div>
+<div class="line"><a name="l15883"></a><span class="lineno">15883</span>&#160; </div>
+<div class="line"><a name="l15884"></a><span class="lineno">15884</span>&#160;    <span class="comment">// If memory type is not HOST_VISIBLE, disable MAPPED.</span></div>
+<div class="line"><a name="l15885"></a><span class="lineno">15885</span>&#160;    <span class="keywordflow">if</span>((finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0 &amp;&amp;</div>
+<div class="line"><a name="l15886"></a><span class="lineno">15886</span>&#160;        (m_MemProps.memoryTypes[memTypeIndex].propertyFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)</div>
+<div class="line"><a name="l15887"></a><span class="lineno">15887</span>&#160;    {</div>
+<div class="line"><a name="l15888"></a><span class="lineno">15888</span>&#160;        finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp;= ~<a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>;</div>
 <div class="line"><a name="l15889"></a><span class="lineno">15889</span>&#160;    }</div>
-<div class="line"><a name="l15890"></a><span class="lineno">15890</span>&#160; </div>
-<div class="line"><a name="l15891"></a><span class="lineno">15891</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l15892"></a><span class="lineno">15892</span>&#160;}</div>
-<div class="line"><a name="l15893"></a><span class="lineno">15893</span>&#160; </div>
-<div class="line"><a name="l15894"></a><span class="lineno">15894</span>&#160;VkResult VmaAllocator_T::AllocateDedicatedMemoryPage(</div>
-<div class="line"><a name="l15895"></a><span class="lineno">15895</span>&#160;    VkDeviceSize size,</div>
-<div class="line"><a name="l15896"></a><span class="lineno">15896</span>&#160;    VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l15897"></a><span class="lineno">15897</span>&#160;    uint32_t memTypeIndex,</div>
-<div class="line"><a name="l15898"></a><span class="lineno">15898</span>&#160;    <span class="keyword">const</span> VkMemoryAllocateInfo&amp; allocInfo,</div>
-<div class="line"><a name="l15899"></a><span class="lineno">15899</span>&#160;    <span class="keywordtype">bool</span> map,</div>
-<div class="line"><a name="l15900"></a><span class="lineno">15900</span>&#160;    <span class="keywordtype">bool</span> isUserDataString,</div>
-<div class="line"><a name="l15901"></a><span class="lineno">15901</span>&#160;    <span class="keywordtype">void</span>* pUserData,</div>
-<div class="line"><a name="l15902"></a><span class="lineno">15902</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation)</div>
-<div class="line"><a name="l15903"></a><span class="lineno">15903</span>&#160;{</div>
-<div class="line"><a name="l15904"></a><span class="lineno">15904</span>&#160;    VkDeviceMemory hMemory = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l15905"></a><span class="lineno">15905</span>&#160;    VkResult res = AllocateVulkanMemory(&amp;allocInfo, &amp;hMemory);</div>
-<div class="line"><a name="l15906"></a><span class="lineno">15906</span>&#160;    <span class="keywordflow">if</span>(res &lt; 0)</div>
-<div class="line"><a name="l15907"></a><span class="lineno">15907</span>&#160;    {</div>
-<div class="line"><a name="l15908"></a><span class="lineno">15908</span>&#160;        VMA_DEBUG_LOG(<span class="stringliteral">&quot;    vkAllocateMemory FAILED&quot;</span>);</div>
-<div class="line"><a name="l15909"></a><span class="lineno">15909</span>&#160;        <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l15910"></a><span class="lineno">15910</span>&#160;    }</div>
-<div class="line"><a name="l15911"></a><span class="lineno">15911</span>&#160; </div>
-<div class="line"><a name="l15912"></a><span class="lineno">15912</span>&#160;    <span class="keywordtype">void</span>* pMappedData = VMA_NULL;</div>
-<div class="line"><a name="l15913"></a><span class="lineno">15913</span>&#160;    <span class="keywordflow">if</span>(map)</div>
+<div class="line"><a name="l15890"></a><span class="lineno">15890</span>&#160;    <span class="comment">// If memory is lazily allocated, it should be always dedicated.</span></div>
+<div class="line"><a name="l15891"></a><span class="lineno">15891</span>&#160;    <span class="keywordflow">if</span>(finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a> == <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d">VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED</a>)</div>
+<div class="line"><a name="l15892"></a><span class="lineno">15892</span>&#160;    {</div>
+<div class="line"><a name="l15893"></a><span class="lineno">15893</span>&#160;        finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> |= <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>;</div>
+<div class="line"><a name="l15894"></a><span class="lineno">15894</span>&#160;    }</div>
+<div class="line"><a name="l15895"></a><span class="lineno">15895</span>&#160; </div>
+<div class="line"><a name="l15896"></a><span class="lineno">15896</span>&#160;    VmaBlockVector* <span class="keyword">const</span> blockVector = m_pBlockVectors[memTypeIndex];</div>
+<div class="line"><a name="l15897"></a><span class="lineno">15897</span>&#160;    VMA_ASSERT(blockVector);</div>
+<div class="line"><a name="l15898"></a><span class="lineno">15898</span>&#160; </div>
+<div class="line"><a name="l15899"></a><span class="lineno">15899</span>&#160;    <span class="keyword">const</span> VkDeviceSize preferredBlockSize = blockVector-&gt;GetPreferredBlockSize();</div>
+<div class="line"><a name="l15900"></a><span class="lineno">15900</span>&#160;    <span class="keywordtype">bool</span> preferDedicatedMemory =</div>
+<div class="line"><a name="l15901"></a><span class="lineno">15901</span>&#160;        VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ||</div>
+<div class="line"><a name="l15902"></a><span class="lineno">15902</span>&#160;        dedicatedAllocation ||</div>
+<div class="line"><a name="l15903"></a><span class="lineno">15903</span>&#160;        <span class="comment">// Heuristics: Allocate dedicated memory if requested size if greater than half of preferred block size.</span></div>
+<div class="line"><a name="l15904"></a><span class="lineno">15904</span>&#160;        size &gt; preferredBlockSize / 2;</div>
+<div class="line"><a name="l15905"></a><span class="lineno">15905</span>&#160; </div>
+<div class="line"><a name="l15906"></a><span class="lineno">15906</span>&#160;    <span class="keywordflow">if</span>(preferDedicatedMemory &amp;&amp;</div>
+<div class="line"><a name="l15907"></a><span class="lineno">15907</span>&#160;        (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) == 0 &amp;&amp;</div>
+<div class="line"><a name="l15908"></a><span class="lineno">15908</span>&#160;        finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a> == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l15909"></a><span class="lineno">15909</span>&#160;    {</div>
+<div class="line"><a name="l15910"></a><span class="lineno">15910</span>&#160;        finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> |= <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>;</div>
+<div class="line"><a name="l15911"></a><span class="lineno">15911</span>&#160;    }</div>
+<div class="line"><a name="l15912"></a><span class="lineno">15912</span>&#160; </div>
+<div class="line"><a name="l15913"></a><span class="lineno">15913</span>&#160;    <span class="keywordflow">if</span>((finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>) != 0)</div>
 <div class="line"><a name="l15914"></a><span class="lineno">15914</span>&#160;    {</div>
-<div class="line"><a name="l15915"></a><span class="lineno">15915</span>&#160;        res = (*m_VulkanFunctions.vkMapMemory)(</div>
-<div class="line"><a name="l15916"></a><span class="lineno">15916</span>&#160;            m_hDevice,</div>
-<div class="line"><a name="l15917"></a><span class="lineno">15917</span>&#160;            hMemory,</div>
-<div class="line"><a name="l15918"></a><span class="lineno">15918</span>&#160;            0,</div>
-<div class="line"><a name="l15919"></a><span class="lineno">15919</span>&#160;            VK_WHOLE_SIZE,</div>
-<div class="line"><a name="l15920"></a><span class="lineno">15920</span>&#160;            0,</div>
-<div class="line"><a name="l15921"></a><span class="lineno">15921</span>&#160;            &amp;pMappedData);</div>
-<div class="line"><a name="l15922"></a><span class="lineno">15922</span>&#160;        <span class="keywordflow">if</span>(res &lt; 0)</div>
-<div class="line"><a name="l15923"></a><span class="lineno">15923</span>&#160;        {</div>
-<div class="line"><a name="l15924"></a><span class="lineno">15924</span>&#160;            VMA_DEBUG_LOG(<span class="stringliteral">&quot;    vkMapMemory FAILED&quot;</span>);</div>
-<div class="line"><a name="l15925"></a><span class="lineno">15925</span>&#160;            FreeVulkanMemory(memTypeIndex, size, hMemory);</div>
-<div class="line"><a name="l15926"></a><span class="lineno">15926</span>&#160;            <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l15927"></a><span class="lineno">15927</span>&#160;        }</div>
-<div class="line"><a name="l15928"></a><span class="lineno">15928</span>&#160;    }</div>
-<div class="line"><a name="l15929"></a><span class="lineno">15929</span>&#160; </div>
-<div class="line"><a name="l15930"></a><span class="lineno">15930</span>&#160;    *pAllocation = m_AllocationObjectAllocator.Allocate(m_CurrentFrameIndex.load(), isUserDataString);</div>
-<div class="line"><a name="l15931"></a><span class="lineno">15931</span>&#160;    (*pAllocation)-&gt;InitDedicatedAllocation(memTypeIndex, hMemory, suballocType, pMappedData, size);</div>
-<div class="line"><a name="l15932"></a><span class="lineno">15932</span>&#160;    (*pAllocation)-&gt;SetUserData(<span class="keyword">this</span>, pUserData);</div>
-<div class="line"><a name="l15933"></a><span class="lineno">15933</span>&#160;    m_Budget.AddAllocation(MemoryTypeIndexToHeapIndex(memTypeIndex), size);</div>
-<div class="line"><a name="l15934"></a><span class="lineno">15934</span>&#160;    <span class="keywordflow">if</span>(VMA_DEBUG_INITIALIZE_ALLOCATIONS)</div>
-<div class="line"><a name="l15935"></a><span class="lineno">15935</span>&#160;    {</div>
-<div class="line"><a name="l15936"></a><span class="lineno">15936</span>&#160;        FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);</div>
-<div class="line"><a name="l15937"></a><span class="lineno">15937</span>&#160;    }</div>
-<div class="line"><a name="l15938"></a><span class="lineno">15938</span>&#160; </div>
-<div class="line"><a name="l15939"></a><span class="lineno">15939</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l15940"></a><span class="lineno">15940</span>&#160;}</div>
-<div class="line"><a name="l15941"></a><span class="lineno">15941</span>&#160; </div>
-<div class="line"><a name="l15942"></a><span class="lineno">15942</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::GetBufferMemoryRequirements(</div>
-<div class="line"><a name="l15943"></a><span class="lineno">15943</span>&#160;    VkBuffer hBuffer,</div>
-<div class="line"><a name="l15944"></a><span class="lineno">15944</span>&#160;    VkMemoryRequirements&amp; memReq,</div>
-<div class="line"><a name="l15945"></a><span class="lineno">15945</span>&#160;    <span class="keywordtype">bool</span>&amp; requiresDedicatedAllocation,</div>
-<div class="line"><a name="l15946"></a><span class="lineno">15946</span>&#160;    <span class="keywordtype">bool</span>&amp; prefersDedicatedAllocation)<span class="keyword"> const</span></div>
-<div class="line"><a name="l15947"></a><span class="lineno">15947</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l15948"></a><span class="lineno">15948</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l15949"></a><span class="lineno">15949</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrDedicatedAllocation || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
-<div class="line"><a name="l15950"></a><span class="lineno">15950</span>&#160;    {</div>
-<div class="line"><a name="l15951"></a><span class="lineno">15951</span>&#160;        VkBufferMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR };</div>
-<div class="line"><a name="l15952"></a><span class="lineno">15952</span>&#160;        memReqInfo.buffer = hBuffer;</div>
-<div class="line"><a name="l15953"></a><span class="lineno">15953</span>&#160; </div>
-<div class="line"><a name="l15954"></a><span class="lineno">15954</span>&#160;        VkMemoryDedicatedRequirementsKHR memDedicatedReq = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR };</div>
-<div class="line"><a name="l15955"></a><span class="lineno">15955</span>&#160; </div>
-<div class="line"><a name="l15956"></a><span class="lineno">15956</span>&#160;        VkMemoryRequirements2KHR memReq2 = { VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR };</div>
-<div class="line"><a name="l15957"></a><span class="lineno">15957</span>&#160;        VmaPnextChainPushFront(&amp;memReq2, &amp;memDedicatedReq);</div>
-<div class="line"><a name="l15958"></a><span class="lineno">15958</span>&#160; </div>
-<div class="line"><a name="l15959"></a><span class="lineno">15959</span>&#160;        (*m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR)(m_hDevice, &amp;memReqInfo, &amp;memReq2);</div>
-<div class="line"><a name="l15960"></a><span class="lineno">15960</span>&#160; </div>
-<div class="line"><a name="l15961"></a><span class="lineno">15961</span>&#160;        memReq = memReq2.memoryRequirements;</div>
-<div class="line"><a name="l15962"></a><span class="lineno">15962</span>&#160;        requiresDedicatedAllocation = (memDedicatedReq.requiresDedicatedAllocation != VK_FALSE);</div>
-<div class="line"><a name="l15963"></a><span class="lineno">15963</span>&#160;        prefersDedicatedAllocation  = (memDedicatedReq.prefersDedicatedAllocation  != VK_FALSE);</div>
-<div class="line"><a name="l15964"></a><span class="lineno">15964</span>&#160;    }</div>
-<div class="line"><a name="l15965"></a><span class="lineno">15965</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l15966"></a><span class="lineno">15966</span>&#160;<span class="preprocessor">#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l15967"></a><span class="lineno">15967</span>&#160;    {</div>
-<div class="line"><a name="l15968"></a><span class="lineno">15968</span>&#160;        (*m_VulkanFunctions.vkGetBufferMemoryRequirements)(m_hDevice, hBuffer, &amp;memReq);</div>
-<div class="line"><a name="l15969"></a><span class="lineno">15969</span>&#160;        requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l15970"></a><span class="lineno">15970</span>&#160;        prefersDedicatedAllocation  = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l15971"></a><span class="lineno">15971</span>&#160;    }</div>
-<div class="line"><a name="l15972"></a><span class="lineno">15972</span>&#160;}</div>
-<div class="line"><a name="l15973"></a><span class="lineno">15973</span>&#160; </div>
-<div class="line"><a name="l15974"></a><span class="lineno">15974</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::GetImageMemoryRequirements(</div>
-<div class="line"><a name="l15975"></a><span class="lineno">15975</span>&#160;    VkImage hImage,</div>
-<div class="line"><a name="l15976"></a><span class="lineno">15976</span>&#160;    VkMemoryRequirements&amp; memReq,</div>
-<div class="line"><a name="l15977"></a><span class="lineno">15977</span>&#160;    <span class="keywordtype">bool</span>&amp; requiresDedicatedAllocation,</div>
-<div class="line"><a name="l15978"></a><span class="lineno">15978</span>&#160;    <span class="keywordtype">bool</span>&amp; prefersDedicatedAllocation)<span class="keyword"> const</span></div>
-<div class="line"><a name="l15979"></a><span class="lineno">15979</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l15980"></a><span class="lineno">15980</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l15981"></a><span class="lineno">15981</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrDedicatedAllocation || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
-<div class="line"><a name="l15982"></a><span class="lineno">15982</span>&#160;    {</div>
-<div class="line"><a name="l15983"></a><span class="lineno">15983</span>&#160;        VkImageMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR };</div>
-<div class="line"><a name="l15984"></a><span class="lineno">15984</span>&#160;        memReqInfo.image = hImage;</div>
-<div class="line"><a name="l15985"></a><span class="lineno">15985</span>&#160; </div>
-<div class="line"><a name="l15986"></a><span class="lineno">15986</span>&#160;        VkMemoryDedicatedRequirementsKHR memDedicatedReq = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR };</div>
-<div class="line"><a name="l15987"></a><span class="lineno">15987</span>&#160; </div>
-<div class="line"><a name="l15988"></a><span class="lineno">15988</span>&#160;        VkMemoryRequirements2KHR memReq2 = { VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR };</div>
-<div class="line"><a name="l15989"></a><span class="lineno">15989</span>&#160;        VmaPnextChainPushFront(&amp;memReq2, &amp;memDedicatedReq);</div>
-<div class="line"><a name="l15990"></a><span class="lineno">15990</span>&#160; </div>
-<div class="line"><a name="l15991"></a><span class="lineno">15991</span>&#160;        (*m_VulkanFunctions.vkGetImageMemoryRequirements2KHR)(m_hDevice, &amp;memReqInfo, &amp;memReq2);</div>
-<div class="line"><a name="l15992"></a><span class="lineno">15992</span>&#160; </div>
-<div class="line"><a name="l15993"></a><span class="lineno">15993</span>&#160;        memReq = memReq2.memoryRequirements;</div>
-<div class="line"><a name="l15994"></a><span class="lineno">15994</span>&#160;        requiresDedicatedAllocation = (memDedicatedReq.requiresDedicatedAllocation != VK_FALSE);</div>
-<div class="line"><a name="l15995"></a><span class="lineno">15995</span>&#160;        prefersDedicatedAllocation  = (memDedicatedReq.prefersDedicatedAllocation  != VK_FALSE);</div>
-<div class="line"><a name="l15996"></a><span class="lineno">15996</span>&#160;    }</div>
-<div class="line"><a name="l15997"></a><span class="lineno">15997</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l15998"></a><span class="lineno">15998</span>&#160;<span class="preprocessor">#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
-<div class="line"><a name="l15999"></a><span class="lineno">15999</span>&#160;    {</div>
-<div class="line"><a name="l16000"></a><span class="lineno">16000</span>&#160;        (*m_VulkanFunctions.vkGetImageMemoryRequirements)(m_hDevice, hImage, &amp;memReq);</div>
-<div class="line"><a name="l16001"></a><span class="lineno">16001</span>&#160;        requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l16002"></a><span class="lineno">16002</span>&#160;        prefersDedicatedAllocation  = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l16003"></a><span class="lineno">16003</span>&#160;    }</div>
-<div class="line"><a name="l16004"></a><span class="lineno">16004</span>&#160;}</div>
-<div class="line"><a name="l16005"></a><span class="lineno">16005</span>&#160; </div>
-<div class="line"><a name="l16006"></a><span class="lineno">16006</span>&#160;VkResult VmaAllocator_T::AllocateMemory(</div>
-<div class="line"><a name="l16007"></a><span class="lineno">16007</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
-<div class="line"><a name="l16008"></a><span class="lineno">16008</span>&#160;    <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
-<div class="line"><a name="l16009"></a><span class="lineno">16009</span>&#160;    <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
-<div class="line"><a name="l16010"></a><span class="lineno">16010</span>&#160;    VkBuffer dedicatedBuffer,</div>
-<div class="line"><a name="l16011"></a><span class="lineno">16011</span>&#160;    VkBufferUsageFlags dedicatedBufferUsage,</div>
-<div class="line"><a name="l16012"></a><span class="lineno">16012</span>&#160;    VkImage dedicatedImage,</div>
-<div class="line"><a name="l16013"></a><span class="lineno">16013</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
-<div class="line"><a name="l16014"></a><span class="lineno">16014</span>&#160;    VmaSuballocationType suballocType,</div>
-<div class="line"><a name="l16015"></a><span class="lineno">16015</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l16016"></a><span class="lineno">16016</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
-<div class="line"><a name="l16017"></a><span class="lineno">16017</span>&#160;{</div>
-<div class="line"><a name="l16018"></a><span class="lineno">16018</span>&#160;    memset(pAllocations, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>) * allocationCount);</div>
-<div class="line"><a name="l16019"></a><span class="lineno">16019</span>&#160; </div>
-<div class="line"><a name="l16020"></a><span class="lineno">16020</span>&#160;    VMA_ASSERT(VmaIsPow2(vkMemReq.alignment));</div>
-<div class="line"><a name="l16021"></a><span class="lineno">16021</span>&#160; </div>
-<div class="line"><a name="l16022"></a><span class="lineno">16022</span>&#160;    <span class="keywordflow">if</span>(vkMemReq.size == 0)</div>
-<div class="line"><a name="l16023"></a><span class="lineno">16023</span>&#160;    {</div>
-<div class="line"><a name="l16024"></a><span class="lineno">16024</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
-<div class="line"><a name="l16025"></a><span class="lineno">16025</span>&#160;    }</div>
-<div class="line"><a name="l16026"></a><span class="lineno">16026</span>&#160;    <span class="keywordflow">if</span>((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>) != 0 &amp;&amp;</div>
-<div class="line"><a name="l16027"></a><span class="lineno">16027</span>&#160;        (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) != 0)</div>
-<div class="line"><a name="l16028"></a><span class="lineno">16028</span>&#160;    {</div>
-<div class="line"><a name="l16029"></a><span class="lineno">16029</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Specifying VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT together with VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT makes no sense.&quot;</span>);</div>
-<div class="line"><a name="l16030"></a><span class="lineno">16030</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l16031"></a><span class="lineno">16031</span>&#160;    }</div>
-<div class="line"><a name="l16032"></a><span class="lineno">16032</span>&#160;    <span class="keywordflow">if</span>((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0 &amp;&amp;</div>
-<div class="line"><a name="l16033"></a><span class="lineno">16033</span>&#160;        (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a>) != 0)</div>
-<div class="line"><a name="l16034"></a><span class="lineno">16034</span>&#160;    {</div>
-<div class="line"><a name="l16035"></a><span class="lineno">16035</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Specifying VMA_ALLOCATION_CREATE_MAPPED_BIT together with VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT is invalid.&quot;</span>);</div>
-<div class="line"><a name="l16036"></a><span class="lineno">16036</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l16037"></a><span class="lineno">16037</span>&#160;    }</div>
-<div class="line"><a name="l16038"></a><span class="lineno">16038</span>&#160;    <span class="keywordflow">if</span>(requiresDedicatedAllocation)</div>
+<div class="line"><a name="l15915"></a><span class="lineno">15915</span>&#160;        <span class="keywordflow">if</span>((finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) != 0)</div>
+<div class="line"><a name="l15916"></a><span class="lineno">15916</span>&#160;        {</div>
+<div class="line"><a name="l15917"></a><span class="lineno">15917</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l15918"></a><span class="lineno">15918</span>&#160;        }</div>
+<div class="line"><a name="l15919"></a><span class="lineno">15919</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l15920"></a><span class="lineno">15920</span>&#160;        {</div>
+<div class="line"><a name="l15921"></a><span class="lineno">15921</span>&#160;            <span class="keywordflow">return</span> AllocateDedicatedMemory(</div>
+<div class="line"><a name="l15922"></a><span class="lineno">15922</span>&#160;                size,</div>
+<div class="line"><a name="l15923"></a><span class="lineno">15923</span>&#160;                suballocType,</div>
+<div class="line"><a name="l15924"></a><span class="lineno">15924</span>&#160;                memTypeIndex,</div>
+<div class="line"><a name="l15925"></a><span class="lineno">15925</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d">VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT</a>) != 0,</div>
+<div class="line"><a name="l15926"></a><span class="lineno">15926</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0,</div>
+<div class="line"><a name="l15927"></a><span class="lineno">15927</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a>) != 0,</div>
+<div class="line"><a name="l15928"></a><span class="lineno">15928</span>&#160;                finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
+<div class="line"><a name="l15929"></a><span class="lineno">15929</span>&#160;                dedicatedBuffer,</div>
+<div class="line"><a name="l15930"></a><span class="lineno">15930</span>&#160;                dedicatedBufferUsage,</div>
+<div class="line"><a name="l15931"></a><span class="lineno">15931</span>&#160;                dedicatedImage,</div>
+<div class="line"><a name="l15932"></a><span class="lineno">15932</span>&#160;                allocationCount,</div>
+<div class="line"><a name="l15933"></a><span class="lineno">15933</span>&#160;                pAllocations);</div>
+<div class="line"><a name="l15934"></a><span class="lineno">15934</span>&#160;        }</div>
+<div class="line"><a name="l15935"></a><span class="lineno">15935</span>&#160;    }</div>
+<div class="line"><a name="l15936"></a><span class="lineno">15936</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l15937"></a><span class="lineno">15937</span>&#160;    {</div>
+<div class="line"><a name="l15938"></a><span class="lineno">15938</span>&#160;        VkResult res = blockVector-&gt;Allocate(</div>
+<div class="line"><a name="l15939"></a><span class="lineno">15939</span>&#160;            m_CurrentFrameIndex.load(),</div>
+<div class="line"><a name="l15940"></a><span class="lineno">15940</span>&#160;            size,</div>
+<div class="line"><a name="l15941"></a><span class="lineno">15941</span>&#160;            alignment,</div>
+<div class="line"><a name="l15942"></a><span class="lineno">15942</span>&#160;            finalCreateInfo,</div>
+<div class="line"><a name="l15943"></a><span class="lineno">15943</span>&#160;            suballocType,</div>
+<div class="line"><a name="l15944"></a><span class="lineno">15944</span>&#160;            allocationCount,</div>
+<div class="line"><a name="l15945"></a><span class="lineno">15945</span>&#160;            pAllocations);</div>
+<div class="line"><a name="l15946"></a><span class="lineno">15946</span>&#160;        <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l15947"></a><span class="lineno">15947</span>&#160;        {</div>
+<div class="line"><a name="l15948"></a><span class="lineno">15948</span>&#160;            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l15949"></a><span class="lineno">15949</span>&#160;        }</div>
+<div class="line"><a name="l15950"></a><span class="lineno">15950</span>&#160; </div>
+<div class="line"><a name="l15951"></a><span class="lineno">15951</span>&#160;        <span class="comment">// 5. Try dedicated memory.</span></div>
+<div class="line"><a name="l15952"></a><span class="lineno">15952</span>&#160;        <span class="keywordflow">if</span>((finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) != 0)</div>
+<div class="line"><a name="l15953"></a><span class="lineno">15953</span>&#160;        {</div>
+<div class="line"><a name="l15954"></a><span class="lineno">15954</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l15955"></a><span class="lineno">15955</span>&#160;        }</div>
+<div class="line"><a name="l15956"></a><span class="lineno">15956</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l15957"></a><span class="lineno">15957</span>&#160;        {</div>
+<div class="line"><a name="l15958"></a><span class="lineno">15958</span>&#160;            res = AllocateDedicatedMemory(</div>
+<div class="line"><a name="l15959"></a><span class="lineno">15959</span>&#160;                size,</div>
+<div class="line"><a name="l15960"></a><span class="lineno">15960</span>&#160;                suballocType,</div>
+<div class="line"><a name="l15961"></a><span class="lineno">15961</span>&#160;                memTypeIndex,</div>
+<div class="line"><a name="l15962"></a><span class="lineno">15962</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d">VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT</a>) != 0,</div>
+<div class="line"><a name="l15963"></a><span class="lineno">15963</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0,</div>
+<div class="line"><a name="l15964"></a><span class="lineno">15964</span>&#160;                (finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a>) != 0,</div>
+<div class="line"><a name="l15965"></a><span class="lineno">15965</span>&#160;                finalCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>,</div>
+<div class="line"><a name="l15966"></a><span class="lineno">15966</span>&#160;                dedicatedBuffer,</div>
+<div class="line"><a name="l15967"></a><span class="lineno">15967</span>&#160;                dedicatedBufferUsage,</div>
+<div class="line"><a name="l15968"></a><span class="lineno">15968</span>&#160;                dedicatedImage,</div>
+<div class="line"><a name="l15969"></a><span class="lineno">15969</span>&#160;                allocationCount,</div>
+<div class="line"><a name="l15970"></a><span class="lineno">15970</span>&#160;                pAllocations);</div>
+<div class="line"><a name="l15971"></a><span class="lineno">15971</span>&#160;            <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l15972"></a><span class="lineno">15972</span>&#160;            {</div>
+<div class="line"><a name="l15973"></a><span class="lineno">15973</span>&#160;                <span class="comment">// Succeeded: AllocateDedicatedMemory function already filld pMemory, nothing more to do here.</span></div>
+<div class="line"><a name="l15974"></a><span class="lineno">15974</span>&#160;                VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Allocated as DedicatedMemory&quot;</span>);</div>
+<div class="line"><a name="l15975"></a><span class="lineno">15975</span>&#160;                <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l15976"></a><span class="lineno">15976</span>&#160;            }</div>
+<div class="line"><a name="l15977"></a><span class="lineno">15977</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l15978"></a><span class="lineno">15978</span>&#160;            {</div>
+<div class="line"><a name="l15979"></a><span class="lineno">15979</span>&#160;                <span class="comment">// Everything failed: Return error code.</span></div>
+<div class="line"><a name="l15980"></a><span class="lineno">15980</span>&#160;                VMA_DEBUG_LOG(<span class="stringliteral">&quot;    vkAllocateMemory FAILED&quot;</span>);</div>
+<div class="line"><a name="l15981"></a><span class="lineno">15981</span>&#160;                <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l15982"></a><span class="lineno">15982</span>&#160;            }</div>
+<div class="line"><a name="l15983"></a><span class="lineno">15983</span>&#160;        }</div>
+<div class="line"><a name="l15984"></a><span class="lineno">15984</span>&#160;    }</div>
+<div class="line"><a name="l15985"></a><span class="lineno">15985</span>&#160;}</div>
+<div class="line"><a name="l15986"></a><span class="lineno">15986</span>&#160; </div>
+<div class="line"><a name="l15987"></a><span class="lineno">15987</span>&#160;VkResult VmaAllocator_T::AllocateDedicatedMemory(</div>
+<div class="line"><a name="l15988"></a><span class="lineno">15988</span>&#160;    VkDeviceSize size,</div>
+<div class="line"><a name="l15989"></a><span class="lineno">15989</span>&#160;    VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l15990"></a><span class="lineno">15990</span>&#160;    uint32_t memTypeIndex,</div>
+<div class="line"><a name="l15991"></a><span class="lineno">15991</span>&#160;    <span class="keywordtype">bool</span> withinBudget,</div>
+<div class="line"><a name="l15992"></a><span class="lineno">15992</span>&#160;    <span class="keywordtype">bool</span> map,</div>
+<div class="line"><a name="l15993"></a><span class="lineno">15993</span>&#160;    <span class="keywordtype">bool</span> isUserDataString,</div>
+<div class="line"><a name="l15994"></a><span class="lineno">15994</span>&#160;    <span class="keywordtype">void</span>* pUserData,</div>
+<div class="line"><a name="l15995"></a><span class="lineno">15995</span>&#160;    VkBuffer dedicatedBuffer,</div>
+<div class="line"><a name="l15996"></a><span class="lineno">15996</span>&#160;    VkBufferUsageFlags dedicatedBufferUsage,</div>
+<div class="line"><a name="l15997"></a><span class="lineno">15997</span>&#160;    VkImage dedicatedImage,</div>
+<div class="line"><a name="l15998"></a><span class="lineno">15998</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l15999"></a><span class="lineno">15999</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
+<div class="line"><a name="l16000"></a><span class="lineno">16000</span>&#160;{</div>
+<div class="line"><a name="l16001"></a><span class="lineno">16001</span>&#160;    VMA_ASSERT(allocationCount &gt; 0 &amp;&amp; pAllocations);</div>
+<div class="line"><a name="l16002"></a><span class="lineno">16002</span>&#160; </div>
+<div class="line"><a name="l16003"></a><span class="lineno">16003</span>&#160;    <span class="keywordflow">if</span>(withinBudget)</div>
+<div class="line"><a name="l16004"></a><span class="lineno">16004</span>&#160;    {</div>
+<div class="line"><a name="l16005"></a><span class="lineno">16005</span>&#160;        <span class="keyword">const</span> uint32_t heapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);</div>
+<div class="line"><a name="l16006"></a><span class="lineno">16006</span>&#160;        <a class="code" href="struct_vma_budget.html">VmaBudget</a> heapBudget = {};</div>
+<div class="line"><a name="l16007"></a><span class="lineno">16007</span>&#160;        GetBudget(&amp;heapBudget, heapIndex, 1);</div>
+<div class="line"><a name="l16008"></a><span class="lineno">16008</span>&#160;        <span class="keywordflow">if</span>(heapBudget.<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> + size * allocationCount &gt; heapBudget.<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a>)</div>
+<div class="line"><a name="l16009"></a><span class="lineno">16009</span>&#160;        {</div>
+<div class="line"><a name="l16010"></a><span class="lineno">16010</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l16011"></a><span class="lineno">16011</span>&#160;        }</div>
+<div class="line"><a name="l16012"></a><span class="lineno">16012</span>&#160;    }</div>
+<div class="line"><a name="l16013"></a><span class="lineno">16013</span>&#160; </div>
+<div class="line"><a name="l16014"></a><span class="lineno">16014</span>&#160;    VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };</div>
+<div class="line"><a name="l16015"></a><span class="lineno">16015</span>&#160;    allocInfo.memoryTypeIndex = memTypeIndex;</div>
+<div class="line"><a name="l16016"></a><span class="lineno">16016</span>&#160;    allocInfo.allocationSize = size;</div>
+<div class="line"><a name="l16017"></a><span class="lineno">16017</span>&#160; </div>
+<div class="line"><a name="l16018"></a><span class="lineno">16018</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l16019"></a><span class="lineno">16019</span>&#160;    VkMemoryDedicatedAllocateInfoKHR dedicatedAllocInfo = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR };</div>
+<div class="line"><a name="l16020"></a><span class="lineno">16020</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrDedicatedAllocation || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
+<div class="line"><a name="l16021"></a><span class="lineno">16021</span>&#160;    {</div>
+<div class="line"><a name="l16022"></a><span class="lineno">16022</span>&#160;        <span class="keywordflow">if</span>(dedicatedBuffer != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l16023"></a><span class="lineno">16023</span>&#160;        {</div>
+<div class="line"><a name="l16024"></a><span class="lineno">16024</span>&#160;            VMA_ASSERT(dedicatedImage == VK_NULL_HANDLE);</div>
+<div class="line"><a name="l16025"></a><span class="lineno">16025</span>&#160;            dedicatedAllocInfo.buffer = dedicatedBuffer;</div>
+<div class="line"><a name="l16026"></a><span class="lineno">16026</span>&#160;            VmaPnextChainPushFront(&amp;allocInfo, &amp;dedicatedAllocInfo);</div>
+<div class="line"><a name="l16027"></a><span class="lineno">16027</span>&#160;        }</div>
+<div class="line"><a name="l16028"></a><span class="lineno">16028</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(dedicatedImage != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l16029"></a><span class="lineno">16029</span>&#160;        {</div>
+<div class="line"><a name="l16030"></a><span class="lineno">16030</span>&#160;            dedicatedAllocInfo.image = dedicatedImage;</div>
+<div class="line"><a name="l16031"></a><span class="lineno">16031</span>&#160;            VmaPnextChainPushFront(&amp;allocInfo, &amp;dedicatedAllocInfo);</div>
+<div class="line"><a name="l16032"></a><span class="lineno">16032</span>&#160;        }</div>
+<div class="line"><a name="l16033"></a><span class="lineno">16033</span>&#160;    }</div>
+<div class="line"><a name="l16034"></a><span class="lineno">16034</span>&#160;<span class="preprocessor">#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l16035"></a><span class="lineno">16035</span>&#160; </div>
+<div class="line"><a name="l16036"></a><span class="lineno">16036</span>&#160;<span class="preprocessor">#if VMA_BUFFER_DEVICE_ADDRESS</span></div>
+<div class="line"><a name="l16037"></a><span class="lineno">16037</span>&#160;    VkMemoryAllocateFlagsInfoKHR allocFlagsInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR };</div>
+<div class="line"><a name="l16038"></a><span class="lineno">16038</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrBufferDeviceAddress)</div>
 <div class="line"><a name="l16039"></a><span class="lineno">16039</span>&#160;    {</div>
-<div class="line"><a name="l16040"></a><span class="lineno">16040</span>&#160;        <span class="keywordflow">if</span>((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) != 0)</div>
-<div class="line"><a name="l16041"></a><span class="lineno">16041</span>&#160;        {</div>
-<div class="line"><a name="l16042"></a><span class="lineno">16042</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT specified while dedicated allocation is required.&quot;</span>);</div>
-<div class="line"><a name="l16043"></a><span class="lineno">16043</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l16044"></a><span class="lineno">16044</span>&#160;        }</div>
-<div class="line"><a name="l16045"></a><span class="lineno">16045</span>&#160;        <span class="keywordflow">if</span>(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a> != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l16046"></a><span class="lineno">16046</span>&#160;        {</div>
-<div class="line"><a name="l16047"></a><span class="lineno">16047</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Pool specified while dedicated allocation is required.&quot;</span>);</div>
-<div class="line"><a name="l16048"></a><span class="lineno">16048</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l16040"></a><span class="lineno">16040</span>&#160;        <span class="keywordtype">bool</span> canContainBufferWithDeviceAddress = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l16041"></a><span class="lineno">16041</span>&#160;        <span class="keywordflow">if</span>(dedicatedBuffer != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l16042"></a><span class="lineno">16042</span>&#160;        {</div>
+<div class="line"><a name="l16043"></a><span class="lineno">16043</span>&#160;            canContainBufferWithDeviceAddress = dedicatedBufferUsage == UINT32_MAX || <span class="comment">// Usage flags unknown</span></div>
+<div class="line"><a name="l16044"></a><span class="lineno">16044</span>&#160;                (dedicatedBufferUsage &amp; VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT) != 0;</div>
+<div class="line"><a name="l16045"></a><span class="lineno">16045</span>&#160;        }</div>
+<div class="line"><a name="l16046"></a><span class="lineno">16046</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(dedicatedImage != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l16047"></a><span class="lineno">16047</span>&#160;        {</div>
+<div class="line"><a name="l16048"></a><span class="lineno">16048</span>&#160;            canContainBufferWithDeviceAddress = <span class="keyword">false</span>;</div>
 <div class="line"><a name="l16049"></a><span class="lineno">16049</span>&#160;        }</div>
-<div class="line"><a name="l16050"></a><span class="lineno">16050</span>&#160;    }</div>
-<div class="line"><a name="l16051"></a><span class="lineno">16051</span>&#160;    <span class="keywordflow">if</span>((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a> != VK_NULL_HANDLE) &amp;&amp;</div>
-<div class="line"><a name="l16052"></a><span class="lineno">16052</span>&#160;        ((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; (<a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>)) != 0))</div>
-<div class="line"><a name="l16053"></a><span class="lineno">16053</span>&#160;    {</div>
-<div class="line"><a name="l16054"></a><span class="lineno">16054</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Specifying VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT when pool != null is invalid.&quot;</span>);</div>
-<div class="line"><a name="l16055"></a><span class="lineno">16055</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l16056"></a><span class="lineno">16056</span>&#160;    }</div>
+<div class="line"><a name="l16050"></a><span class="lineno">16050</span>&#160;        <span class="keywordflow">if</span>(canContainBufferWithDeviceAddress)</div>
+<div class="line"><a name="l16051"></a><span class="lineno">16051</span>&#160;        {</div>
+<div class="line"><a name="l16052"></a><span class="lineno">16052</span>&#160;            allocFlagsInfo.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;</div>
+<div class="line"><a name="l16053"></a><span class="lineno">16053</span>&#160;            VmaPnextChainPushFront(&amp;allocInfo, &amp;allocFlagsInfo);</div>
+<div class="line"><a name="l16054"></a><span class="lineno">16054</span>&#160;        }</div>
+<div class="line"><a name="l16055"></a><span class="lineno">16055</span>&#160;    }</div>
+<div class="line"><a name="l16056"></a><span class="lineno">16056</span>&#160;<span class="preprocessor">#endif // #if VMA_BUFFER_DEVICE_ADDRESS</span></div>
 <div class="line"><a name="l16057"></a><span class="lineno">16057</span>&#160; </div>
-<div class="line"><a name="l16058"></a><span class="lineno">16058</span>&#160;    <span class="keywordflow">if</span>(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a> != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l16059"></a><span class="lineno">16059</span>&#160;    {</div>
-<div class="line"><a name="l16060"></a><span class="lineno">16060</span>&#160;        <span class="keyword">const</span> VkDeviceSize alignmentForPool = VMA_MAX(</div>
-<div class="line"><a name="l16061"></a><span class="lineno">16061</span>&#160;            vkMemReq.alignment,</div>
-<div class="line"><a name="l16062"></a><span class="lineno">16062</span>&#160;            GetMemoryTypeMinAlignment(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>-&gt;m_BlockVector.GetMemoryTypeIndex()));</div>
-<div class="line"><a name="l16063"></a><span class="lineno">16063</span>&#160; </div>
-<div class="line"><a name="l16064"></a><span class="lineno">16064</span>&#160;        <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> createInfoForPool = createInfo;</div>
-<div class="line"><a name="l16065"></a><span class="lineno">16065</span>&#160;        <span class="comment">// If memory type is not HOST_VISIBLE, disable MAPPED.</span></div>
-<div class="line"><a name="l16066"></a><span class="lineno">16066</span>&#160;        <span class="keywordflow">if</span>((createInfoForPool.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0 &amp;&amp;</div>
-<div class="line"><a name="l16067"></a><span class="lineno">16067</span>&#160;            (m_MemProps.memoryTypes[createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>-&gt;m_BlockVector.GetMemoryTypeIndex()].propertyFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)</div>
-<div class="line"><a name="l16068"></a><span class="lineno">16068</span>&#160;        {</div>
-<div class="line"><a name="l16069"></a><span class="lineno">16069</span>&#160;            createInfoForPool.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp;= ~<a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>;</div>
-<div class="line"><a name="l16070"></a><span class="lineno">16070</span>&#160;        }</div>
-<div class="line"><a name="l16071"></a><span class="lineno">16071</span>&#160; </div>
-<div class="line"><a name="l16072"></a><span class="lineno">16072</span>&#160;        <span class="keywordflow">return</span> createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>-&gt;m_BlockVector.Allocate(</div>
-<div class="line"><a name="l16073"></a><span class="lineno">16073</span>&#160;            m_CurrentFrameIndex.load(),</div>
-<div class="line"><a name="l16074"></a><span class="lineno">16074</span>&#160;            vkMemReq.size,</div>
-<div class="line"><a name="l16075"></a><span class="lineno">16075</span>&#160;            alignmentForPool,</div>
-<div class="line"><a name="l16076"></a><span class="lineno">16076</span>&#160;            createInfoForPool,</div>
-<div class="line"><a name="l16077"></a><span class="lineno">16077</span>&#160;            suballocType,</div>
-<div class="line"><a name="l16078"></a><span class="lineno">16078</span>&#160;            allocationCount,</div>
-<div class="line"><a name="l16079"></a><span class="lineno">16079</span>&#160;            pAllocations);</div>
-<div class="line"><a name="l16080"></a><span class="lineno">16080</span>&#160;    }</div>
-<div class="line"><a name="l16081"></a><span class="lineno">16081</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16082"></a><span class="lineno">16082</span>&#160;    {</div>
-<div class="line"><a name="l16083"></a><span class="lineno">16083</span>&#160;        <span class="comment">// Bit mask of memory Vulkan types acceptable for this allocation.</span></div>
-<div class="line"><a name="l16084"></a><span class="lineno">16084</span>&#160;        uint32_t memoryTypeBits = vkMemReq.memoryTypeBits;</div>
-<div class="line"><a name="l16085"></a><span class="lineno">16085</span>&#160;        uint32_t memTypeIndex = UINT32_MAX;</div>
-<div class="line"><a name="l16086"></a><span class="lineno">16086</span>&#160;        VkResult res = <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(<span class="keyword">this</span>, memoryTypeBits, &amp;createInfo, &amp;memTypeIndex);</div>
-<div class="line"><a name="l16087"></a><span class="lineno">16087</span>&#160;        <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l16088"></a><span class="lineno">16088</span>&#160;        {</div>
-<div class="line"><a name="l16089"></a><span class="lineno">16089</span>&#160;            VkDeviceSize alignmentForMemType = VMA_MAX(</div>
-<div class="line"><a name="l16090"></a><span class="lineno">16090</span>&#160;                vkMemReq.alignment,</div>
-<div class="line"><a name="l16091"></a><span class="lineno">16091</span>&#160;                GetMemoryTypeMinAlignment(memTypeIndex));</div>
-<div class="line"><a name="l16092"></a><span class="lineno">16092</span>&#160; </div>
-<div class="line"><a name="l16093"></a><span class="lineno">16093</span>&#160;            res = AllocateMemoryOfType(</div>
-<div class="line"><a name="l16094"></a><span class="lineno">16094</span>&#160;                vkMemReq.size,</div>
-<div class="line"><a name="l16095"></a><span class="lineno">16095</span>&#160;                alignmentForMemType,</div>
-<div class="line"><a name="l16096"></a><span class="lineno">16096</span>&#160;                requiresDedicatedAllocation || prefersDedicatedAllocation,</div>
-<div class="line"><a name="l16097"></a><span class="lineno">16097</span>&#160;                dedicatedBuffer,</div>
-<div class="line"><a name="l16098"></a><span class="lineno">16098</span>&#160;                dedicatedBufferUsage,</div>
-<div class="line"><a name="l16099"></a><span class="lineno">16099</span>&#160;                dedicatedImage,</div>
-<div class="line"><a name="l16100"></a><span class="lineno">16100</span>&#160;                createInfo,</div>
-<div class="line"><a name="l16101"></a><span class="lineno">16101</span>&#160;                memTypeIndex,</div>
-<div class="line"><a name="l16102"></a><span class="lineno">16102</span>&#160;                suballocType,</div>
-<div class="line"><a name="l16103"></a><span class="lineno">16103</span>&#160;                allocationCount,</div>
-<div class="line"><a name="l16104"></a><span class="lineno">16104</span>&#160;                pAllocations);</div>
-<div class="line"><a name="l16105"></a><span class="lineno">16105</span>&#160;            <span class="comment">// Succeeded on first try.</span></div>
-<div class="line"><a name="l16106"></a><span class="lineno">16106</span>&#160;            <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l16107"></a><span class="lineno">16107</span>&#160;            {</div>
-<div class="line"><a name="l16108"></a><span class="lineno">16108</span>&#160;                <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l16109"></a><span class="lineno">16109</span>&#160;            }</div>
-<div class="line"><a name="l16110"></a><span class="lineno">16110</span>&#160;            <span class="comment">// Allocation from this memory type failed. Try other compatible memory types.</span></div>
-<div class="line"><a name="l16111"></a><span class="lineno">16111</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16112"></a><span class="lineno">16112</span>&#160;            {</div>
-<div class="line"><a name="l16113"></a><span class="lineno">16113</span>&#160;                <span class="keywordflow">for</span>(;;)</div>
-<div class="line"><a name="l16114"></a><span class="lineno">16114</span>&#160;                {</div>
-<div class="line"><a name="l16115"></a><span class="lineno">16115</span>&#160;                    <span class="comment">// Remove old memTypeIndex from list of possibilities.</span></div>
-<div class="line"><a name="l16116"></a><span class="lineno">16116</span>&#160;                    memoryTypeBits &amp;= ~(1u &lt;&lt; memTypeIndex);</div>
-<div class="line"><a name="l16117"></a><span class="lineno">16117</span>&#160;                    <span class="comment">// Find alternative memTypeIndex.</span></div>
-<div class="line"><a name="l16118"></a><span class="lineno">16118</span>&#160;                    res = <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(<span class="keyword">this</span>, memoryTypeBits, &amp;createInfo, &amp;memTypeIndex);</div>
-<div class="line"><a name="l16119"></a><span class="lineno">16119</span>&#160;                    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l16120"></a><span class="lineno">16120</span>&#160;                    {</div>
-<div class="line"><a name="l16121"></a><span class="lineno">16121</span>&#160;                        alignmentForMemType = VMA_MAX(</div>
-<div class="line"><a name="l16122"></a><span class="lineno">16122</span>&#160;                            vkMemReq.alignment,</div>
-<div class="line"><a name="l16123"></a><span class="lineno">16123</span>&#160;                            GetMemoryTypeMinAlignment(memTypeIndex));</div>
-<div class="line"><a name="l16124"></a><span class="lineno">16124</span>&#160;                        </div>
-<div class="line"><a name="l16125"></a><span class="lineno">16125</span>&#160;                        res = AllocateMemoryOfType(</div>
-<div class="line"><a name="l16126"></a><span class="lineno">16126</span>&#160;                            vkMemReq.size,</div>
-<div class="line"><a name="l16127"></a><span class="lineno">16127</span>&#160;                            alignmentForMemType,</div>
-<div class="line"><a name="l16128"></a><span class="lineno">16128</span>&#160;                            requiresDedicatedAllocation || prefersDedicatedAllocation,</div>
-<div class="line"><a name="l16129"></a><span class="lineno">16129</span>&#160;                            dedicatedBuffer,</div>
-<div class="line"><a name="l16130"></a><span class="lineno">16130</span>&#160;                            dedicatedBufferUsage,</div>
-<div class="line"><a name="l16131"></a><span class="lineno">16131</span>&#160;                            dedicatedImage,</div>
-<div class="line"><a name="l16132"></a><span class="lineno">16132</span>&#160;                            createInfo,</div>
-<div class="line"><a name="l16133"></a><span class="lineno">16133</span>&#160;                            memTypeIndex,</div>
-<div class="line"><a name="l16134"></a><span class="lineno">16134</span>&#160;                            suballocType,</div>
-<div class="line"><a name="l16135"></a><span class="lineno">16135</span>&#160;                            allocationCount,</div>
-<div class="line"><a name="l16136"></a><span class="lineno">16136</span>&#160;                            pAllocations);</div>
-<div class="line"><a name="l16137"></a><span class="lineno">16137</span>&#160;                        <span class="comment">// Allocation from this alternative memory type succeeded.</span></div>
-<div class="line"><a name="l16138"></a><span class="lineno">16138</span>&#160;                        <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l16139"></a><span class="lineno">16139</span>&#160;                        {</div>
-<div class="line"><a name="l16140"></a><span class="lineno">16140</span>&#160;                            <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l16141"></a><span class="lineno">16141</span>&#160;                        }</div>
-<div class="line"><a name="l16142"></a><span class="lineno">16142</span>&#160;                        <span class="comment">// else: Allocation from this memory type failed. Try next one - next loop iteration.</span></div>
-<div class="line"><a name="l16143"></a><span class="lineno">16143</span>&#160;                    }</div>
-<div class="line"><a name="l16144"></a><span class="lineno">16144</span>&#160;                    <span class="comment">// No other matching memory type index could be found.</span></div>
-<div class="line"><a name="l16145"></a><span class="lineno">16145</span>&#160;                    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16146"></a><span class="lineno">16146</span>&#160;                    {</div>
-<div class="line"><a name="l16147"></a><span class="lineno">16147</span>&#160;                        <span class="comment">// Not returning res, which is VK_ERROR_FEATURE_NOT_PRESENT, because we already failed to allocate once.</span></div>
-<div class="line"><a name="l16148"></a><span class="lineno">16148</span>&#160;                        <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l16149"></a><span class="lineno">16149</span>&#160;                    }</div>
-<div class="line"><a name="l16150"></a><span class="lineno">16150</span>&#160;                }</div>
-<div class="line"><a name="l16151"></a><span class="lineno">16151</span>&#160;            }</div>
-<div class="line"><a name="l16152"></a><span class="lineno">16152</span>&#160;        }</div>
-<div class="line"><a name="l16153"></a><span class="lineno">16153</span>&#160;        <span class="comment">// Can&#39;t find any single memory type maching requirements. res is VK_ERROR_FEATURE_NOT_PRESENT.</span></div>
-<div class="line"><a name="l16154"></a><span class="lineno">16154</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16155"></a><span class="lineno">16155</span>&#160;            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l16058"></a><span class="lineno">16058</span>&#160;    <span class="keywordtype">size_t</span> allocIndex;</div>
+<div class="line"><a name="l16059"></a><span class="lineno">16059</span>&#160;    VkResult res = VK_SUCCESS;</div>
+<div class="line"><a name="l16060"></a><span class="lineno">16060</span>&#160;    <span class="keywordflow">for</span>(allocIndex = 0; allocIndex &lt; allocationCount; ++allocIndex)</div>
+<div class="line"><a name="l16061"></a><span class="lineno">16061</span>&#160;    {</div>
+<div class="line"><a name="l16062"></a><span class="lineno">16062</span>&#160;        res = AllocateDedicatedMemoryPage(</div>
+<div class="line"><a name="l16063"></a><span class="lineno">16063</span>&#160;            size,</div>
+<div class="line"><a name="l16064"></a><span class="lineno">16064</span>&#160;            suballocType,</div>
+<div class="line"><a name="l16065"></a><span class="lineno">16065</span>&#160;            memTypeIndex,</div>
+<div class="line"><a name="l16066"></a><span class="lineno">16066</span>&#160;            allocInfo,</div>
+<div class="line"><a name="l16067"></a><span class="lineno">16067</span>&#160;            map,</div>
+<div class="line"><a name="l16068"></a><span class="lineno">16068</span>&#160;            isUserDataString,</div>
+<div class="line"><a name="l16069"></a><span class="lineno">16069</span>&#160;            pUserData,</div>
+<div class="line"><a name="l16070"></a><span class="lineno">16070</span>&#160;            pAllocations + allocIndex);</div>
+<div class="line"><a name="l16071"></a><span class="lineno">16071</span>&#160;        <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l16072"></a><span class="lineno">16072</span>&#160;        {</div>
+<div class="line"><a name="l16073"></a><span class="lineno">16073</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l16074"></a><span class="lineno">16074</span>&#160;        }</div>
+<div class="line"><a name="l16075"></a><span class="lineno">16075</span>&#160;    }</div>
+<div class="line"><a name="l16076"></a><span class="lineno">16076</span>&#160; </div>
+<div class="line"><a name="l16077"></a><span class="lineno">16077</span>&#160;    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l16078"></a><span class="lineno">16078</span>&#160;    {</div>
+<div class="line"><a name="l16079"></a><span class="lineno">16079</span>&#160;        <span class="comment">// Register them in m_pDedicatedAllocations.</span></div>
+<div class="line"><a name="l16080"></a><span class="lineno">16080</span>&#160;        {</div>
+<div class="line"><a name="l16081"></a><span class="lineno">16081</span>&#160;            VmaMutexLockWrite lock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);</div>
+<div class="line"><a name="l16082"></a><span class="lineno">16082</span>&#160;            AllocationVectorType* pDedicatedAllocations = m_pDedicatedAllocations[memTypeIndex];</div>
+<div class="line"><a name="l16083"></a><span class="lineno">16083</span>&#160;            VMA_ASSERT(pDedicatedAllocations);</div>
+<div class="line"><a name="l16084"></a><span class="lineno">16084</span>&#160;            <span class="keywordflow">for</span>(allocIndex = 0; allocIndex &lt; allocationCount; ++allocIndex)</div>
+<div class="line"><a name="l16085"></a><span class="lineno">16085</span>&#160;            {</div>
+<div class="line"><a name="l16086"></a><span class="lineno">16086</span>&#160;                VmaVectorInsertSorted&lt;VmaPointerLess&gt;(*pDedicatedAllocations, pAllocations[allocIndex]);</div>
+<div class="line"><a name="l16087"></a><span class="lineno">16087</span>&#160;            }</div>
+<div class="line"><a name="l16088"></a><span class="lineno">16088</span>&#160;        }</div>
+<div class="line"><a name="l16089"></a><span class="lineno">16089</span>&#160; </div>
+<div class="line"><a name="l16090"></a><span class="lineno">16090</span>&#160;        VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Allocated DedicatedMemory Count=%zu, MemoryTypeIndex=#%u&quot;</span>, allocationCount, memTypeIndex);</div>
+<div class="line"><a name="l16091"></a><span class="lineno">16091</span>&#160;    }</div>
+<div class="line"><a name="l16092"></a><span class="lineno">16092</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16093"></a><span class="lineno">16093</span>&#160;    {</div>
+<div class="line"><a name="l16094"></a><span class="lineno">16094</span>&#160;        <span class="comment">// Free all already created allocations.</span></div>
+<div class="line"><a name="l16095"></a><span class="lineno">16095</span>&#160;        <span class="keywordflow">while</span>(allocIndex--)</div>
+<div class="line"><a name="l16096"></a><span class="lineno">16096</span>&#160;        {</div>
+<div class="line"><a name="l16097"></a><span class="lineno">16097</span>&#160;            <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> currAlloc = pAllocations[allocIndex];</div>
+<div class="line"><a name="l16098"></a><span class="lineno">16098</span>&#160;            VkDeviceMemory hMemory = currAlloc-&gt;GetMemory();</div>
+<div class="line"><a name="l16099"></a><span class="lineno">16099</span>&#160;    </div>
+<div class="line"><a name="l16100"></a><span class="lineno">16100</span>&#160;            <span class="comment">/*</span></div>
+<div class="line"><a name="l16101"></a><span class="lineno">16101</span>&#160;<span class="comment">            There is no need to call this, because Vulkan spec allows to skip vkUnmapMemory</span></div>
+<div class="line"><a name="l16102"></a><span class="lineno">16102</span>&#160;<span class="comment">            before vkFreeMemory.</span></div>
+<div class="line"><a name="l16103"></a><span class="lineno">16103</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l16104"></a><span class="lineno">16104</span>&#160;<span class="comment">            if(currAlloc-&gt;GetMappedData() != VMA_NULL)</span></div>
+<div class="line"><a name="l16105"></a><span class="lineno">16105</span>&#160;<span class="comment">            {</span></div>
+<div class="line"><a name="l16106"></a><span class="lineno">16106</span>&#160;<span class="comment">                (*m_VulkanFunctions.vkUnmapMemory)(m_hDevice, hMemory);</span></div>
+<div class="line"><a name="l16107"></a><span class="lineno">16107</span>&#160;<span class="comment">            }</span></div>
+<div class="line"><a name="l16108"></a><span class="lineno">16108</span>&#160;<span class="comment">            */</span></div>
+<div class="line"><a name="l16109"></a><span class="lineno">16109</span>&#160;    </div>
+<div class="line"><a name="l16110"></a><span class="lineno">16110</span>&#160;            FreeVulkanMemory(memTypeIndex, currAlloc-&gt;GetSize(), hMemory);</div>
+<div class="line"><a name="l16111"></a><span class="lineno">16111</span>&#160;            m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(memTypeIndex), currAlloc-&gt;GetSize());</div>
+<div class="line"><a name="l16112"></a><span class="lineno">16112</span>&#160;            currAlloc-&gt;SetUserData(<span class="keyword">this</span>, VMA_NULL);</div>
+<div class="line"><a name="l16113"></a><span class="lineno">16113</span>&#160;            m_AllocationObjectAllocator.Free(currAlloc);</div>
+<div class="line"><a name="l16114"></a><span class="lineno">16114</span>&#160;        }</div>
+<div class="line"><a name="l16115"></a><span class="lineno">16115</span>&#160; </div>
+<div class="line"><a name="l16116"></a><span class="lineno">16116</span>&#160;        memset(pAllocations, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>) * allocationCount);</div>
+<div class="line"><a name="l16117"></a><span class="lineno">16117</span>&#160;    }</div>
+<div class="line"><a name="l16118"></a><span class="lineno">16118</span>&#160; </div>
+<div class="line"><a name="l16119"></a><span class="lineno">16119</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l16120"></a><span class="lineno">16120</span>&#160;}</div>
+<div class="line"><a name="l16121"></a><span class="lineno">16121</span>&#160; </div>
+<div class="line"><a name="l16122"></a><span class="lineno">16122</span>&#160;VkResult VmaAllocator_T::AllocateDedicatedMemoryPage(</div>
+<div class="line"><a name="l16123"></a><span class="lineno">16123</span>&#160;    VkDeviceSize size,</div>
+<div class="line"><a name="l16124"></a><span class="lineno">16124</span>&#160;    VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l16125"></a><span class="lineno">16125</span>&#160;    uint32_t memTypeIndex,</div>
+<div class="line"><a name="l16126"></a><span class="lineno">16126</span>&#160;    <span class="keyword">const</span> VkMemoryAllocateInfo&amp; allocInfo,</div>
+<div class="line"><a name="l16127"></a><span class="lineno">16127</span>&#160;    <span class="keywordtype">bool</span> map,</div>
+<div class="line"><a name="l16128"></a><span class="lineno">16128</span>&#160;    <span class="keywordtype">bool</span> isUserDataString,</div>
+<div class="line"><a name="l16129"></a><span class="lineno">16129</span>&#160;    <span class="keywordtype">void</span>* pUserData,</div>
+<div class="line"><a name="l16130"></a><span class="lineno">16130</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation)</div>
+<div class="line"><a name="l16131"></a><span class="lineno">16131</span>&#160;{</div>
+<div class="line"><a name="l16132"></a><span class="lineno">16132</span>&#160;    VkDeviceMemory hMemory = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l16133"></a><span class="lineno">16133</span>&#160;    VkResult res = AllocateVulkanMemory(&amp;allocInfo, &amp;hMemory);</div>
+<div class="line"><a name="l16134"></a><span class="lineno">16134</span>&#160;    <span class="keywordflow">if</span>(res &lt; 0)</div>
+<div class="line"><a name="l16135"></a><span class="lineno">16135</span>&#160;    {</div>
+<div class="line"><a name="l16136"></a><span class="lineno">16136</span>&#160;        VMA_DEBUG_LOG(<span class="stringliteral">&quot;    vkAllocateMemory FAILED&quot;</span>);</div>
+<div class="line"><a name="l16137"></a><span class="lineno">16137</span>&#160;        <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l16138"></a><span class="lineno">16138</span>&#160;    }</div>
+<div class="line"><a name="l16139"></a><span class="lineno">16139</span>&#160; </div>
+<div class="line"><a name="l16140"></a><span class="lineno">16140</span>&#160;    <span class="keywordtype">void</span>* pMappedData = VMA_NULL;</div>
+<div class="line"><a name="l16141"></a><span class="lineno">16141</span>&#160;    <span class="keywordflow">if</span>(map)</div>
+<div class="line"><a name="l16142"></a><span class="lineno">16142</span>&#160;    {</div>
+<div class="line"><a name="l16143"></a><span class="lineno">16143</span>&#160;        res = (*m_VulkanFunctions.vkMapMemory)(</div>
+<div class="line"><a name="l16144"></a><span class="lineno">16144</span>&#160;            m_hDevice,</div>
+<div class="line"><a name="l16145"></a><span class="lineno">16145</span>&#160;            hMemory,</div>
+<div class="line"><a name="l16146"></a><span class="lineno">16146</span>&#160;            0,</div>
+<div class="line"><a name="l16147"></a><span class="lineno">16147</span>&#160;            VK_WHOLE_SIZE,</div>
+<div class="line"><a name="l16148"></a><span class="lineno">16148</span>&#160;            0,</div>
+<div class="line"><a name="l16149"></a><span class="lineno">16149</span>&#160;            &amp;pMappedData);</div>
+<div class="line"><a name="l16150"></a><span class="lineno">16150</span>&#160;        <span class="keywordflow">if</span>(res &lt; 0)</div>
+<div class="line"><a name="l16151"></a><span class="lineno">16151</span>&#160;        {</div>
+<div class="line"><a name="l16152"></a><span class="lineno">16152</span>&#160;            VMA_DEBUG_LOG(<span class="stringliteral">&quot;    vkMapMemory FAILED&quot;</span>);</div>
+<div class="line"><a name="l16153"></a><span class="lineno">16153</span>&#160;            FreeVulkanMemory(memTypeIndex, size, hMemory);</div>
+<div class="line"><a name="l16154"></a><span class="lineno">16154</span>&#160;            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l16155"></a><span class="lineno">16155</span>&#160;        }</div>
 <div class="line"><a name="l16156"></a><span class="lineno">16156</span>&#160;    }</div>
-<div class="line"><a name="l16157"></a><span class="lineno">16157</span>&#160;}</div>
-<div class="line"><a name="l16158"></a><span class="lineno">16158</span>&#160; </div>
-<div class="line"><a name="l16159"></a><span class="lineno">16159</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::FreeMemory(</div>
-<div class="line"><a name="l16160"></a><span class="lineno">16160</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l16161"></a><span class="lineno">16161</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
-<div class="line"><a name="l16162"></a><span class="lineno">16162</span>&#160;{</div>
-<div class="line"><a name="l16163"></a><span class="lineno">16163</span>&#160;    VMA_ASSERT(pAllocations);</div>
-<div class="line"><a name="l16164"></a><span class="lineno">16164</span>&#160; </div>
-<div class="line"><a name="l16165"></a><span class="lineno">16165</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> allocIndex = allocationCount; allocIndex--; )</div>
-<div class="line"><a name="l16166"></a><span class="lineno">16166</span>&#160;    {</div>
-<div class="line"><a name="l16167"></a><span class="lineno">16167</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation = pAllocations[allocIndex];</div>
-<div class="line"><a name="l16168"></a><span class="lineno">16168</span>&#160; </div>
-<div class="line"><a name="l16169"></a><span class="lineno">16169</span>&#160;        <span class="keywordflow">if</span>(allocation != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l16170"></a><span class="lineno">16170</span>&#160;        {</div>
-<div class="line"><a name="l16171"></a><span class="lineno">16171</span>&#160;            <span class="keywordflow">if</span>(TouchAllocation(allocation))</div>
-<div class="line"><a name="l16172"></a><span class="lineno">16172</span>&#160;            {</div>
-<div class="line"><a name="l16173"></a><span class="lineno">16173</span>&#160;                <span class="keywordflow">if</span>(VMA_DEBUG_INITIALIZE_ALLOCATIONS)</div>
-<div class="line"><a name="l16174"></a><span class="lineno">16174</span>&#160;                {</div>
-<div class="line"><a name="l16175"></a><span class="lineno">16175</span>&#160;                    FillAllocation(allocation, VMA_ALLOCATION_FILL_PATTERN_DESTROYED);</div>
-<div class="line"><a name="l16176"></a><span class="lineno">16176</span>&#160;                }</div>
-<div class="line"><a name="l16177"></a><span class="lineno">16177</span>&#160; </div>
-<div class="line"><a name="l16178"></a><span class="lineno">16178</span>&#160;                <span class="keywordflow">switch</span>(allocation-&gt;GetType())</div>
-<div class="line"><a name="l16179"></a><span class="lineno">16179</span>&#160;                {</div>
-<div class="line"><a name="l16180"></a><span class="lineno">16180</span>&#160;                <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
-<div class="line"><a name="l16181"></a><span class="lineno">16181</span>&#160;                    {</div>
-<div class="line"><a name="l16182"></a><span class="lineno">16182</span>&#160;                        VmaBlockVector* pBlockVector = VMA_NULL;</div>
-<div class="line"><a name="l16183"></a><span class="lineno">16183</span>&#160;                        <a class="code" href="struct_vma_pool.html">VmaPool</a> hPool = allocation-&gt;GetBlock()-&gt;GetParentPool();</div>
-<div class="line"><a name="l16184"></a><span class="lineno">16184</span>&#160;                        <span class="keywordflow">if</span>(hPool != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l16185"></a><span class="lineno">16185</span>&#160;                        {</div>
-<div class="line"><a name="l16186"></a><span class="lineno">16186</span>&#160;                            pBlockVector = &amp;hPool-&gt;m_BlockVector;</div>
-<div class="line"><a name="l16187"></a><span class="lineno">16187</span>&#160;                        }</div>
-<div class="line"><a name="l16188"></a><span class="lineno">16188</span>&#160;                        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16189"></a><span class="lineno">16189</span>&#160;                        {</div>
-<div class="line"><a name="l16190"></a><span class="lineno">16190</span>&#160;                            <span class="keyword">const</span> uint32_t memTypeIndex = allocation-&gt;GetMemoryTypeIndex();</div>
-<div class="line"><a name="l16191"></a><span class="lineno">16191</span>&#160;                            pBlockVector = m_pBlockVectors[memTypeIndex];</div>
-<div class="line"><a name="l16192"></a><span class="lineno">16192</span>&#160;                        }</div>
-<div class="line"><a name="l16193"></a><span class="lineno">16193</span>&#160;                        pBlockVector-&gt;Free(allocation);</div>
-<div class="line"><a name="l16194"></a><span class="lineno">16194</span>&#160;                    }</div>
-<div class="line"><a name="l16195"></a><span class="lineno">16195</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16196"></a><span class="lineno">16196</span>&#160;                <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
-<div class="line"><a name="l16197"></a><span class="lineno">16197</span>&#160;                    FreeDedicatedMemory(allocation);</div>
-<div class="line"><a name="l16198"></a><span class="lineno">16198</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16199"></a><span class="lineno">16199</span>&#160;                <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l16200"></a><span class="lineno">16200</span>&#160;                    VMA_ASSERT(0);</div>
-<div class="line"><a name="l16201"></a><span class="lineno">16201</span>&#160;                }</div>
-<div class="line"><a name="l16202"></a><span class="lineno">16202</span>&#160;            }</div>
-<div class="line"><a name="l16203"></a><span class="lineno">16203</span>&#160; </div>
-<div class="line"><a name="l16204"></a><span class="lineno">16204</span>&#160;            <span class="comment">// Do this regardless of whether the allocation is lost. Lost allocations still account to Budget.AllocationBytes.</span></div>
-<div class="line"><a name="l16205"></a><span class="lineno">16205</span>&#160;            m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(allocation-&gt;GetMemoryTypeIndex()), allocation-&gt;GetSize());</div>
-<div class="line"><a name="l16206"></a><span class="lineno">16206</span>&#160;            allocation-&gt;SetUserData(<span class="keyword">this</span>, VMA_NULL);</div>
-<div class="line"><a name="l16207"></a><span class="lineno">16207</span>&#160;            m_AllocationObjectAllocator.Free(allocation);</div>
-<div class="line"><a name="l16208"></a><span class="lineno">16208</span>&#160;        }</div>
-<div class="line"><a name="l16209"></a><span class="lineno">16209</span>&#160;    }</div>
-<div class="line"><a name="l16210"></a><span class="lineno">16210</span>&#160;}</div>
-<div class="line"><a name="l16211"></a><span class="lineno">16211</span>&#160; </div>
-<div class="line"><a name="l16212"></a><span class="lineno">16212</span>&#160;VkResult VmaAllocator_T::ResizeAllocation(</div>
-<div class="line"><a name="l16213"></a><span class="lineno">16213</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc,</div>
-<div class="line"><a name="l16214"></a><span class="lineno">16214</span>&#160;    VkDeviceSize newSize)</div>
-<div class="line"><a name="l16215"></a><span class="lineno">16215</span>&#160;{</div>
-<div class="line"><a name="l16216"></a><span class="lineno">16216</span>&#160;    <span class="comment">// This function is deprecated and so it does nothing. It&#39;s left for backward compatibility.</span></div>
-<div class="line"><a name="l16217"></a><span class="lineno">16217</span>&#160;    <span class="keywordflow">if</span>(newSize == 0 || alloc-&gt;GetLastUseFrameIndex() == VMA_FRAME_INDEX_LOST)</div>
-<div class="line"><a name="l16218"></a><span class="lineno">16218</span>&#160;    {</div>
-<div class="line"><a name="l16219"></a><span class="lineno">16219</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
-<div class="line"><a name="l16220"></a><span class="lineno">16220</span>&#160;    }</div>
-<div class="line"><a name="l16221"></a><span class="lineno">16221</span>&#160;    <span class="keywordflow">if</span>(newSize == alloc-&gt;GetSize())</div>
-<div class="line"><a name="l16222"></a><span class="lineno">16222</span>&#160;    {</div>
-<div class="line"><a name="l16223"></a><span class="lineno">16223</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l16157"></a><span class="lineno">16157</span>&#160; </div>
+<div class="line"><a name="l16158"></a><span class="lineno">16158</span>&#160;    *pAllocation = m_AllocationObjectAllocator.Allocate(m_CurrentFrameIndex.load(), isUserDataString);</div>
+<div class="line"><a name="l16159"></a><span class="lineno">16159</span>&#160;    (*pAllocation)-&gt;InitDedicatedAllocation(memTypeIndex, hMemory, suballocType, pMappedData, size);</div>
+<div class="line"><a name="l16160"></a><span class="lineno">16160</span>&#160;    (*pAllocation)-&gt;SetUserData(<span class="keyword">this</span>, pUserData);</div>
+<div class="line"><a name="l16161"></a><span class="lineno">16161</span>&#160;    m_Budget.AddAllocation(MemoryTypeIndexToHeapIndex(memTypeIndex), size);</div>
+<div class="line"><a name="l16162"></a><span class="lineno">16162</span>&#160;    <span class="keywordflow">if</span>(VMA_DEBUG_INITIALIZE_ALLOCATIONS)</div>
+<div class="line"><a name="l16163"></a><span class="lineno">16163</span>&#160;    {</div>
+<div class="line"><a name="l16164"></a><span class="lineno">16164</span>&#160;        FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);</div>
+<div class="line"><a name="l16165"></a><span class="lineno">16165</span>&#160;    }</div>
+<div class="line"><a name="l16166"></a><span class="lineno">16166</span>&#160; </div>
+<div class="line"><a name="l16167"></a><span class="lineno">16167</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l16168"></a><span class="lineno">16168</span>&#160;}</div>
+<div class="line"><a name="l16169"></a><span class="lineno">16169</span>&#160; </div>
+<div class="line"><a name="l16170"></a><span class="lineno">16170</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::GetBufferMemoryRequirements(</div>
+<div class="line"><a name="l16171"></a><span class="lineno">16171</span>&#160;    VkBuffer hBuffer,</div>
+<div class="line"><a name="l16172"></a><span class="lineno">16172</span>&#160;    VkMemoryRequirements&amp; memReq,</div>
+<div class="line"><a name="l16173"></a><span class="lineno">16173</span>&#160;    <span class="keywordtype">bool</span>&amp; requiresDedicatedAllocation,</div>
+<div class="line"><a name="l16174"></a><span class="lineno">16174</span>&#160;    <span class="keywordtype">bool</span>&amp; prefersDedicatedAllocation)<span class="keyword"> const</span></div>
+<div class="line"><a name="l16175"></a><span class="lineno">16175</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l16176"></a><span class="lineno">16176</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l16177"></a><span class="lineno">16177</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrDedicatedAllocation || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
+<div class="line"><a name="l16178"></a><span class="lineno">16178</span>&#160;    {</div>
+<div class="line"><a name="l16179"></a><span class="lineno">16179</span>&#160;        VkBufferMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR };</div>
+<div class="line"><a name="l16180"></a><span class="lineno">16180</span>&#160;        memReqInfo.buffer = hBuffer;</div>
+<div class="line"><a name="l16181"></a><span class="lineno">16181</span>&#160; </div>
+<div class="line"><a name="l16182"></a><span class="lineno">16182</span>&#160;        VkMemoryDedicatedRequirementsKHR memDedicatedReq = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR };</div>
+<div class="line"><a name="l16183"></a><span class="lineno">16183</span>&#160; </div>
+<div class="line"><a name="l16184"></a><span class="lineno">16184</span>&#160;        VkMemoryRequirements2KHR memReq2 = { VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR };</div>
+<div class="line"><a name="l16185"></a><span class="lineno">16185</span>&#160;        VmaPnextChainPushFront(&amp;memReq2, &amp;memDedicatedReq);</div>
+<div class="line"><a name="l16186"></a><span class="lineno">16186</span>&#160; </div>
+<div class="line"><a name="l16187"></a><span class="lineno">16187</span>&#160;        (*m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR)(m_hDevice, &amp;memReqInfo, &amp;memReq2);</div>
+<div class="line"><a name="l16188"></a><span class="lineno">16188</span>&#160; </div>
+<div class="line"><a name="l16189"></a><span class="lineno">16189</span>&#160;        memReq = memReq2.memoryRequirements;</div>
+<div class="line"><a name="l16190"></a><span class="lineno">16190</span>&#160;        requiresDedicatedAllocation = (memDedicatedReq.requiresDedicatedAllocation != VK_FALSE);</div>
+<div class="line"><a name="l16191"></a><span class="lineno">16191</span>&#160;        prefersDedicatedAllocation  = (memDedicatedReq.prefersDedicatedAllocation  != VK_FALSE);</div>
+<div class="line"><a name="l16192"></a><span class="lineno">16192</span>&#160;    }</div>
+<div class="line"><a name="l16193"></a><span class="lineno">16193</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16194"></a><span class="lineno">16194</span>&#160;<span class="preprocessor">#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l16195"></a><span class="lineno">16195</span>&#160;    {</div>
+<div class="line"><a name="l16196"></a><span class="lineno">16196</span>&#160;        (*m_VulkanFunctions.vkGetBufferMemoryRequirements)(m_hDevice, hBuffer, &amp;memReq);</div>
+<div class="line"><a name="l16197"></a><span class="lineno">16197</span>&#160;        requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l16198"></a><span class="lineno">16198</span>&#160;        prefersDedicatedAllocation  = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l16199"></a><span class="lineno">16199</span>&#160;    }</div>
+<div class="line"><a name="l16200"></a><span class="lineno">16200</span>&#160;}</div>
+<div class="line"><a name="l16201"></a><span class="lineno">16201</span>&#160; </div>
+<div class="line"><a name="l16202"></a><span class="lineno">16202</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::GetImageMemoryRequirements(</div>
+<div class="line"><a name="l16203"></a><span class="lineno">16203</span>&#160;    VkImage hImage,</div>
+<div class="line"><a name="l16204"></a><span class="lineno">16204</span>&#160;    VkMemoryRequirements&amp; memReq,</div>
+<div class="line"><a name="l16205"></a><span class="lineno">16205</span>&#160;    <span class="keywordtype">bool</span>&amp; requiresDedicatedAllocation,</div>
+<div class="line"><a name="l16206"></a><span class="lineno">16206</span>&#160;    <span class="keywordtype">bool</span>&amp; prefersDedicatedAllocation)<span class="keyword"> const</span></div>
+<div class="line"><a name="l16207"></a><span class="lineno">16207</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l16208"></a><span class="lineno">16208</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l16209"></a><span class="lineno">16209</span>&#160;    <span class="keywordflow">if</span>(m_UseKhrDedicatedAllocation || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0))</div>
+<div class="line"><a name="l16210"></a><span class="lineno">16210</span>&#160;    {</div>
+<div class="line"><a name="l16211"></a><span class="lineno">16211</span>&#160;        VkImageMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR };</div>
+<div class="line"><a name="l16212"></a><span class="lineno">16212</span>&#160;        memReqInfo.image = hImage;</div>
+<div class="line"><a name="l16213"></a><span class="lineno">16213</span>&#160; </div>
+<div class="line"><a name="l16214"></a><span class="lineno">16214</span>&#160;        VkMemoryDedicatedRequirementsKHR memDedicatedReq = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR };</div>
+<div class="line"><a name="l16215"></a><span class="lineno">16215</span>&#160; </div>
+<div class="line"><a name="l16216"></a><span class="lineno">16216</span>&#160;        VkMemoryRequirements2KHR memReq2 = { VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR };</div>
+<div class="line"><a name="l16217"></a><span class="lineno">16217</span>&#160;        VmaPnextChainPushFront(&amp;memReq2, &amp;memDedicatedReq);</div>
+<div class="line"><a name="l16218"></a><span class="lineno">16218</span>&#160; </div>
+<div class="line"><a name="l16219"></a><span class="lineno">16219</span>&#160;        (*m_VulkanFunctions.vkGetImageMemoryRequirements2KHR)(m_hDevice, &amp;memReqInfo, &amp;memReq2);</div>
+<div class="line"><a name="l16220"></a><span class="lineno">16220</span>&#160; </div>
+<div class="line"><a name="l16221"></a><span class="lineno">16221</span>&#160;        memReq = memReq2.memoryRequirements;</div>
+<div class="line"><a name="l16222"></a><span class="lineno">16222</span>&#160;        requiresDedicatedAllocation = (memDedicatedReq.requiresDedicatedAllocation != VK_FALSE);</div>
+<div class="line"><a name="l16223"></a><span class="lineno">16223</span>&#160;        prefersDedicatedAllocation  = (memDedicatedReq.prefersDedicatedAllocation  != VK_FALSE);</div>
 <div class="line"><a name="l16224"></a><span class="lineno">16224</span>&#160;    }</div>
-<div class="line"><a name="l16225"></a><span class="lineno">16225</span>&#160;    <span class="keywordflow">return</span> VK_ERROR_OUT_OF_POOL_MEMORY;</div>
-<div class="line"><a name="l16226"></a><span class="lineno">16226</span>&#160;}</div>
-<div class="line"><a name="l16227"></a><span class="lineno">16227</span>&#160; </div>
-<div class="line"><a name="l16228"></a><span class="lineno">16228</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::CalculateStats(<a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats)</div>
-<div class="line"><a name="l16229"></a><span class="lineno">16229</span>&#160;{</div>
-<div class="line"><a name="l16230"></a><span class="lineno">16230</span>&#160;    <span class="comment">// Initialize.</span></div>
-<div class="line"><a name="l16231"></a><span class="lineno">16231</span>&#160;    InitStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>);</div>
-<div class="line"><a name="l16232"></a><span class="lineno">16232</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; VK_MAX_MEMORY_TYPES; ++i)</div>
-<div class="line"><a name="l16233"></a><span class="lineno">16233</span>&#160;        InitStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[i]);</div>
-<div class="line"><a name="l16234"></a><span class="lineno">16234</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; VK_MAX_MEMORY_HEAPS; ++i)</div>
-<div class="line"><a name="l16235"></a><span class="lineno">16235</span>&#160;        InitStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[i]);</div>
-<div class="line"><a name="l16236"></a><span class="lineno">16236</span>&#160;    </div>
-<div class="line"><a name="l16237"></a><span class="lineno">16237</span>&#160;    <span class="comment">// Process default pools.</span></div>
-<div class="line"><a name="l16238"></a><span class="lineno">16238</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
-<div class="line"><a name="l16239"></a><span class="lineno">16239</span>&#160;    {</div>
-<div class="line"><a name="l16240"></a><span class="lineno">16240</span>&#160;        VmaBlockVector* <span class="keyword">const</span> pBlockVector = m_pBlockVectors[memTypeIndex];</div>
-<div class="line"><a name="l16241"></a><span class="lineno">16241</span>&#160;        VMA_ASSERT(pBlockVector);</div>
-<div class="line"><a name="l16242"></a><span class="lineno">16242</span>&#160;        pBlockVector-&gt;AddStats(pStats);</div>
-<div class="line"><a name="l16243"></a><span class="lineno">16243</span>&#160;    }</div>
-<div class="line"><a name="l16244"></a><span class="lineno">16244</span>&#160; </div>
-<div class="line"><a name="l16245"></a><span class="lineno">16245</span>&#160;    <span class="comment">// Process custom pools.</span></div>
-<div class="line"><a name="l16246"></a><span class="lineno">16246</span>&#160;    {</div>
-<div class="line"><a name="l16247"></a><span class="lineno">16247</span>&#160;        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);</div>
-<div class="line"><a name="l16248"></a><span class="lineno">16248</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> poolIndex = 0, poolCount = m_Pools.size(); poolIndex &lt; poolCount; ++poolIndex)</div>
-<div class="line"><a name="l16249"></a><span class="lineno">16249</span>&#160;        {</div>
-<div class="line"><a name="l16250"></a><span class="lineno">16250</span>&#160;            m_Pools[poolIndex]-&gt;m_BlockVector.AddStats(pStats);</div>
-<div class="line"><a name="l16251"></a><span class="lineno">16251</span>&#160;        }</div>
-<div class="line"><a name="l16252"></a><span class="lineno">16252</span>&#160;    }</div>
-<div class="line"><a name="l16253"></a><span class="lineno">16253</span>&#160; </div>
-<div class="line"><a name="l16254"></a><span class="lineno">16254</span>&#160;    <span class="comment">// Process dedicated allocations.</span></div>
-<div class="line"><a name="l16255"></a><span class="lineno">16255</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
+<div class="line"><a name="l16225"></a><span class="lineno">16225</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16226"></a><span class="lineno">16226</span>&#160;<span class="preprocessor">#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
+<div class="line"><a name="l16227"></a><span class="lineno">16227</span>&#160;    {</div>
+<div class="line"><a name="l16228"></a><span class="lineno">16228</span>&#160;        (*m_VulkanFunctions.vkGetImageMemoryRequirements)(m_hDevice, hImage, &amp;memReq);</div>
+<div class="line"><a name="l16229"></a><span class="lineno">16229</span>&#160;        requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l16230"></a><span class="lineno">16230</span>&#160;        prefersDedicatedAllocation  = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l16231"></a><span class="lineno">16231</span>&#160;    }</div>
+<div class="line"><a name="l16232"></a><span class="lineno">16232</span>&#160;}</div>
+<div class="line"><a name="l16233"></a><span class="lineno">16233</span>&#160; </div>
+<div class="line"><a name="l16234"></a><span class="lineno">16234</span>&#160;VkResult VmaAllocator_T::AllocateMemory(</div>
+<div class="line"><a name="l16235"></a><span class="lineno">16235</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
+<div class="line"><a name="l16236"></a><span class="lineno">16236</span>&#160;    <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
+<div class="line"><a name="l16237"></a><span class="lineno">16237</span>&#160;    <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
+<div class="line"><a name="l16238"></a><span class="lineno">16238</span>&#160;    VkBuffer dedicatedBuffer,</div>
+<div class="line"><a name="l16239"></a><span class="lineno">16239</span>&#160;    VkBufferUsageFlags dedicatedBufferUsage,</div>
+<div class="line"><a name="l16240"></a><span class="lineno">16240</span>&#160;    VkImage dedicatedImage,</div>
+<div class="line"><a name="l16241"></a><span class="lineno">16241</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
+<div class="line"><a name="l16242"></a><span class="lineno">16242</span>&#160;    VmaSuballocationType suballocType,</div>
+<div class="line"><a name="l16243"></a><span class="lineno">16243</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l16244"></a><span class="lineno">16244</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
+<div class="line"><a name="l16245"></a><span class="lineno">16245</span>&#160;{</div>
+<div class="line"><a name="l16246"></a><span class="lineno">16246</span>&#160;    memset(pAllocations, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>) * allocationCount);</div>
+<div class="line"><a name="l16247"></a><span class="lineno">16247</span>&#160; </div>
+<div class="line"><a name="l16248"></a><span class="lineno">16248</span>&#160;    VMA_ASSERT(VmaIsPow2(vkMemReq.alignment));</div>
+<div class="line"><a name="l16249"></a><span class="lineno">16249</span>&#160; </div>
+<div class="line"><a name="l16250"></a><span class="lineno">16250</span>&#160;    <span class="keywordflow">if</span>(vkMemReq.size == 0)</div>
+<div class="line"><a name="l16251"></a><span class="lineno">16251</span>&#160;    {</div>
+<div class="line"><a name="l16252"></a><span class="lineno">16252</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
+<div class="line"><a name="l16253"></a><span class="lineno">16253</span>&#160;    }</div>
+<div class="line"><a name="l16254"></a><span class="lineno">16254</span>&#160;    <span class="keywordflow">if</span>((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>) != 0 &amp;&amp;</div>
+<div class="line"><a name="l16255"></a><span class="lineno">16255</span>&#160;        (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) != 0)</div>
 <div class="line"><a name="l16256"></a><span class="lineno">16256</span>&#160;    {</div>
-<div class="line"><a name="l16257"></a><span class="lineno">16257</span>&#160;        <span class="keyword">const</span> uint32_t memHeapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);</div>
-<div class="line"><a name="l16258"></a><span class="lineno">16258</span>&#160;        VmaMutexLockRead dedicatedAllocationsLock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);</div>
-<div class="line"><a name="l16259"></a><span class="lineno">16259</span>&#160;        AllocationVectorType* <span class="keyword">const</span> pDedicatedAllocVector = m_pDedicatedAllocations[memTypeIndex];</div>
-<div class="line"><a name="l16260"></a><span class="lineno">16260</span>&#160;        VMA_ASSERT(pDedicatedAllocVector);</div>
-<div class="line"><a name="l16261"></a><span class="lineno">16261</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> allocIndex = 0, allocCount = pDedicatedAllocVector-&gt;size(); allocIndex &lt; allocCount; ++allocIndex)</div>
-<div class="line"><a name="l16262"></a><span class="lineno">16262</span>&#160;        {</div>
-<div class="line"><a name="l16263"></a><span class="lineno">16263</span>&#160;            <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> allocationStatInfo;</div>
-<div class="line"><a name="l16264"></a><span class="lineno">16264</span>&#160;            (*pDedicatedAllocVector)[allocIndex]-&gt;DedicatedAllocCalcStatsInfo(allocationStatInfo);</div>
-<div class="line"><a name="l16265"></a><span class="lineno">16265</span>&#160;            VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>, allocationStatInfo);</div>
-<div class="line"><a name="l16266"></a><span class="lineno">16266</span>&#160;            VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[memTypeIndex], allocationStatInfo);</div>
-<div class="line"><a name="l16267"></a><span class="lineno">16267</span>&#160;            VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[memHeapIndex], allocationStatInfo);</div>
-<div class="line"><a name="l16268"></a><span class="lineno">16268</span>&#160;        }</div>
-<div class="line"><a name="l16269"></a><span class="lineno">16269</span>&#160;    }</div>
-<div class="line"><a name="l16270"></a><span class="lineno">16270</span>&#160; </div>
-<div class="line"><a name="l16271"></a><span class="lineno">16271</span>&#160;    <span class="comment">// Postprocess.</span></div>
-<div class="line"><a name="l16272"></a><span class="lineno">16272</span>&#160;    VmaPostprocessCalcStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>);</div>
-<div class="line"><a name="l16273"></a><span class="lineno">16273</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; GetMemoryTypeCount(); ++i)</div>
-<div class="line"><a name="l16274"></a><span class="lineno">16274</span>&#160;        VmaPostprocessCalcStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[i]);</div>
-<div class="line"><a name="l16275"></a><span class="lineno">16275</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; GetMemoryHeapCount(); ++i)</div>
-<div class="line"><a name="l16276"></a><span class="lineno">16276</span>&#160;        VmaPostprocessCalcStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[i]);</div>
-<div class="line"><a name="l16277"></a><span class="lineno">16277</span>&#160;}</div>
-<div class="line"><a name="l16278"></a><span class="lineno">16278</span>&#160; </div>
-<div class="line"><a name="l16279"></a><span class="lineno">16279</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::GetBudget(<a class="code" href="struct_vma_budget.html">VmaBudget</a>* outBudget, uint32_t firstHeap, uint32_t heapCount)</div>
-<div class="line"><a name="l16280"></a><span class="lineno">16280</span>&#160;{</div>
-<div class="line"><a name="l16281"></a><span class="lineno">16281</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l16282"></a><span class="lineno">16282</span>&#160;    <span class="keywordflow">if</span>(m_UseExtMemoryBudget)</div>
-<div class="line"><a name="l16283"></a><span class="lineno">16283</span>&#160;    {</div>
-<div class="line"><a name="l16284"></a><span class="lineno">16284</span>&#160;        <span class="keywordflow">if</span>(m_Budget.m_OperationsSinceBudgetFetch &lt; 30)</div>
-<div class="line"><a name="l16285"></a><span class="lineno">16285</span>&#160;        {</div>
-<div class="line"><a name="l16286"></a><span class="lineno">16286</span>&#160;            VmaMutexLockRead lockRead(m_Budget.m_BudgetMutex, m_UseMutex);</div>
-<div class="line"><a name="l16287"></a><span class="lineno">16287</span>&#160;            <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; heapCount; ++i, ++outBudget)</div>
-<div class="line"><a name="l16288"></a><span class="lineno">16288</span>&#160;            {</div>
-<div class="line"><a name="l16289"></a><span class="lineno">16289</span>&#160;                <span class="keyword">const</span> uint32_t heapIndex = firstHeap + i;</div>
-<div class="line"><a name="l16290"></a><span class="lineno">16290</span>&#160; </div>
-<div class="line"><a name="l16291"></a><span class="lineno">16291</span>&#160;                outBudget-&gt;<a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a> = m_Budget.m_BlockBytes[heapIndex];</div>
-<div class="line"><a name="l16292"></a><span class="lineno">16292</span>&#160;                outBudget-&gt;<a class="code" href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8">allocationBytes</a> = m_Budget.m_AllocationBytes[heapIndex];</div>
-<div class="line"><a name="l16293"></a><span class="lineno">16293</span>&#160; </div>
-<div class="line"><a name="l16294"></a><span class="lineno">16294</span>&#160;                <span class="keywordflow">if</span>(m_Budget.m_VulkanUsage[heapIndex] + outBudget-&gt;<a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a> &gt; m_Budget.m_BlockBytesAtBudgetFetch[heapIndex])</div>
-<div class="line"><a name="l16295"></a><span class="lineno">16295</span>&#160;                {</div>
-<div class="line"><a name="l16296"></a><span class="lineno">16296</span>&#160;                    outBudget-&gt;<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> = m_Budget.m_VulkanUsage[heapIndex] +</div>
-<div class="line"><a name="l16297"></a><span class="lineno">16297</span>&#160;                        outBudget-&gt;<a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a> - m_Budget.m_BlockBytesAtBudgetFetch[heapIndex];</div>
-<div class="line"><a name="l16298"></a><span class="lineno">16298</span>&#160;                }</div>
-<div class="line"><a name="l16299"></a><span class="lineno">16299</span>&#160;                <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16300"></a><span class="lineno">16300</span>&#160;                {</div>
-<div class="line"><a name="l16301"></a><span class="lineno">16301</span>&#160;                    outBudget-&gt;<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> = 0;</div>
-<div class="line"><a name="l16302"></a><span class="lineno">16302</span>&#160;                }</div>
-<div class="line"><a name="l16303"></a><span class="lineno">16303</span>&#160; </div>
-<div class="line"><a name="l16304"></a><span class="lineno">16304</span>&#160;                <span class="comment">// Have to take MIN with heap size because explicit HeapSizeLimit is included in it.</span></div>
-<div class="line"><a name="l16305"></a><span class="lineno">16305</span>&#160;                outBudget-&gt;<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a> = VMA_MIN(</div>
-<div class="line"><a name="l16306"></a><span class="lineno">16306</span>&#160;                    m_Budget.m_VulkanBudget[heapIndex], m_MemProps.memoryHeaps[heapIndex].size);</div>
-<div class="line"><a name="l16307"></a><span class="lineno">16307</span>&#160;            }</div>
-<div class="line"><a name="l16308"></a><span class="lineno">16308</span>&#160;        }</div>
-<div class="line"><a name="l16309"></a><span class="lineno">16309</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16310"></a><span class="lineno">16310</span>&#160;        {</div>
-<div class="line"><a name="l16311"></a><span class="lineno">16311</span>&#160;            UpdateVulkanBudget(); <span class="comment">// Outside of mutex lock</span></div>
-<div class="line"><a name="l16312"></a><span class="lineno">16312</span>&#160;            GetBudget(outBudget, firstHeap, heapCount); <span class="comment">// Recursion</span></div>
-<div class="line"><a name="l16313"></a><span class="lineno">16313</span>&#160;        }</div>
-<div class="line"><a name="l16314"></a><span class="lineno">16314</span>&#160;    }</div>
-<div class="line"><a name="l16315"></a><span class="lineno">16315</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16316"></a><span class="lineno">16316</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l16317"></a><span class="lineno">16317</span>&#160;    {</div>
-<div class="line"><a name="l16318"></a><span class="lineno">16318</span>&#160;        <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; heapCount; ++i, ++outBudget)</div>
-<div class="line"><a name="l16319"></a><span class="lineno">16319</span>&#160;        {</div>
-<div class="line"><a name="l16320"></a><span class="lineno">16320</span>&#160;            <span class="keyword">const</span> uint32_t heapIndex = firstHeap + i;</div>
-<div class="line"><a name="l16321"></a><span class="lineno">16321</span>&#160; </div>
-<div class="line"><a name="l16322"></a><span class="lineno">16322</span>&#160;            outBudget-&gt;<a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a> = m_Budget.m_BlockBytes[heapIndex];</div>
-<div class="line"><a name="l16323"></a><span class="lineno">16323</span>&#160;            outBudget-&gt;<a class="code" href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8">allocationBytes</a> = m_Budget.m_AllocationBytes[heapIndex];</div>
-<div class="line"><a name="l16324"></a><span class="lineno">16324</span>&#160; </div>
-<div class="line"><a name="l16325"></a><span class="lineno">16325</span>&#160;            outBudget-&gt;<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> = outBudget-&gt;<a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a>;</div>
-<div class="line"><a name="l16326"></a><span class="lineno">16326</span>&#160;            outBudget-&gt;<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a> = m_MemProps.memoryHeaps[heapIndex].size * 8 / 10; <span class="comment">// 80% heuristics.</span></div>
-<div class="line"><a name="l16327"></a><span class="lineno">16327</span>&#160;        }</div>
-<div class="line"><a name="l16328"></a><span class="lineno">16328</span>&#160;    }</div>
-<div class="line"><a name="l16329"></a><span class="lineno">16329</span>&#160;}</div>
-<div class="line"><a name="l16330"></a><span class="lineno">16330</span>&#160; </div>
-<div class="line"><a name="l16331"></a><span class="lineno">16331</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_VENDOR_ID_AMD = 4098;</div>
-<div class="line"><a name="l16332"></a><span class="lineno">16332</span>&#160; </div>
-<div class="line"><a name="l16333"></a><span class="lineno">16333</span>&#160;VkResult VmaAllocator_T::DefragmentationBegin(</div>
-<div class="line"><a name="l16334"></a><span class="lineno">16334</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>&amp; info,</div>
-<div class="line"><a name="l16335"></a><span class="lineno">16335</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats,</div>
-<div class="line"><a name="l16336"></a><span class="lineno">16336</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a>* pContext)</div>
-<div class="line"><a name="l16337"></a><span class="lineno">16337</span>&#160;{</div>
-<div class="line"><a name="l16338"></a><span class="lineno">16338</span>&#160;    <span class="keywordflow">if</span>(info.<a class="code" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">pAllocationsChanged</a> != VMA_NULL)</div>
-<div class="line"><a name="l16339"></a><span class="lineno">16339</span>&#160;    {</div>
-<div class="line"><a name="l16340"></a><span class="lineno">16340</span>&#160;        memset(info.<a class="code" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">pAllocationsChanged</a>, 0, info.<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a> * <span class="keyword">sizeof</span>(VkBool32));</div>
-<div class="line"><a name="l16341"></a><span class="lineno">16341</span>&#160;    }</div>
-<div class="line"><a name="l16342"></a><span class="lineno">16342</span>&#160; </div>
-<div class="line"><a name="l16343"></a><span class="lineno">16343</span>&#160;    *pContext = vma_new(<span class="keyword">this</span>, VmaDefragmentationContext_T)(</div>
-<div class="line"><a name="l16344"></a><span class="lineno">16344</span>&#160;        <span class="keyword">this</span>, m_CurrentFrameIndex.load(), info.<a class="code" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9">flags</a>, pStats);</div>
-<div class="line"><a name="l16345"></a><span class="lineno">16345</span>&#160; </div>
-<div class="line"><a name="l16346"></a><span class="lineno">16346</span>&#160;    (*pContext)-&gt;AddPools(info.<a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">pPools</a>);</div>
-<div class="line"><a name="l16347"></a><span class="lineno">16347</span>&#160;    (*pContext)-&gt;AddAllocations(</div>
-<div class="line"><a name="l16348"></a><span class="lineno">16348</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">pAllocationsChanged</a>);</div>
-<div class="line"><a name="l16349"></a><span class="lineno">16349</span>&#160; </div>
-<div class="line"><a name="l16350"></a><span class="lineno">16350</span>&#160;    VkResult res = (*pContext)-&gt;Defragment(</div>
-<div class="line"><a name="l16351"></a><span class="lineno">16351</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">maxCpuBytesToMove</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">maxCpuAllocationsToMove</a>,</div>
-<div class="line"><a name="l16352"></a><span class="lineno">16352</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08">maxGpuBytesToMove</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6">maxGpuAllocationsToMove</a>,</div>
-<div class="line"><a name="l16353"></a><span class="lineno">16353</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd">commandBuffer</a>, pStats, info.<a class="code" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9">flags</a>);</div>
-<div class="line"><a name="l16354"></a><span class="lineno">16354</span>&#160; </div>
-<div class="line"><a name="l16355"></a><span class="lineno">16355</span>&#160;    <span class="keywordflow">if</span>(res != VK_NOT_READY)</div>
-<div class="line"><a name="l16356"></a><span class="lineno">16356</span>&#160;    {</div>
-<div class="line"><a name="l16357"></a><span class="lineno">16357</span>&#160;        vma_delete(<span class="keyword">this</span>, *pContext);</div>
-<div class="line"><a name="l16358"></a><span class="lineno">16358</span>&#160;        *pContext = VMA_NULL;</div>
-<div class="line"><a name="l16359"></a><span class="lineno">16359</span>&#160;    }</div>
-<div class="line"><a name="l16360"></a><span class="lineno">16360</span>&#160; </div>
-<div class="line"><a name="l16361"></a><span class="lineno">16361</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l16362"></a><span class="lineno">16362</span>&#160;}</div>
-<div class="line"><a name="l16363"></a><span class="lineno">16363</span>&#160; </div>
-<div class="line"><a name="l16364"></a><span class="lineno">16364</span>&#160;VkResult VmaAllocator_T::DefragmentationEnd(</div>
-<div class="line"><a name="l16365"></a><span class="lineno">16365</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context)</div>
-<div class="line"><a name="l16366"></a><span class="lineno">16366</span>&#160;{</div>
-<div class="line"><a name="l16367"></a><span class="lineno">16367</span>&#160;    vma_delete(<span class="keyword">this</span>, context);</div>
-<div class="line"><a name="l16368"></a><span class="lineno">16368</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l16369"></a><span class="lineno">16369</span>&#160;}</div>
-<div class="line"><a name="l16370"></a><span class="lineno">16370</span>&#160; </div>
-<div class="line"><a name="l16371"></a><span class="lineno">16371</span>&#160;VkResult VmaAllocator_T::DefragmentationPassBegin(</div>
-<div class="line"><a name="l16372"></a><span class="lineno">16372</span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* pInfo,</div>
-<div class="line"><a name="l16373"></a><span class="lineno">16373</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context)</div>
-<div class="line"><a name="l16374"></a><span class="lineno">16374</span>&#160;{</div>
-<div class="line"><a name="l16375"></a><span class="lineno">16375</span>&#160;    <span class="keywordflow">return</span> context-&gt;DefragmentPassBegin(pInfo);</div>
-<div class="line"><a name="l16376"></a><span class="lineno">16376</span>&#160;}</div>
-<div class="line"><a name="l16377"></a><span class="lineno">16377</span>&#160;VkResult VmaAllocator_T::DefragmentationPassEnd(</div>
-<div class="line"><a name="l16378"></a><span class="lineno">16378</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context)</div>
-<div class="line"><a name="l16379"></a><span class="lineno">16379</span>&#160;{</div>
-<div class="line"><a name="l16380"></a><span class="lineno">16380</span>&#160;    <span class="keywordflow">return</span> context-&gt;DefragmentPassEnd();</div>
-<div class="line"><a name="l16381"></a><span class="lineno">16381</span>&#160;    </div>
-<div class="line"><a name="l16382"></a><span class="lineno">16382</span>&#160;}</div>
-<div class="line"><a name="l16383"></a><span class="lineno">16383</span>&#160; </div>
-<div class="line"><a name="l16384"></a><span class="lineno">16384</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::GetAllocationInfo(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
-<div class="line"><a name="l16385"></a><span class="lineno">16385</span>&#160;{</div>
-<div class="line"><a name="l16386"></a><span class="lineno">16386</span>&#160;    <span class="keywordflow">if</span>(hAllocation-&gt;CanBecomeLost())</div>
-<div class="line"><a name="l16387"></a><span class="lineno">16387</span>&#160;    {</div>
-<div class="line"><a name="l16388"></a><span class="lineno">16388</span>&#160;        <span class="comment">/*</span></div>
-<div class="line"><a name="l16389"></a><span class="lineno">16389</span>&#160;<span class="comment">        Warning: This is a carefully designed algorithm.</span></div>
-<div class="line"><a name="l16390"></a><span class="lineno">16390</span>&#160;<span class="comment">        Do not modify unless you really know what you&#39;re doing :)</span></div>
-<div class="line"><a name="l16391"></a><span class="lineno">16391</span>&#160;<span class="comment">        */</span></div>
-<div class="line"><a name="l16392"></a><span class="lineno">16392</span>&#160;        <span class="keyword">const</span> uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();</div>
-<div class="line"><a name="l16393"></a><span class="lineno">16393</span>&#160;        uint32_t localLastUseFrameIndex = hAllocation-&gt;GetLastUseFrameIndex();</div>
-<div class="line"><a name="l16394"></a><span class="lineno">16394</span>&#160;        <span class="keywordflow">for</span>(;;)</div>
-<div class="line"><a name="l16395"></a><span class="lineno">16395</span>&#160;        {</div>
-<div class="line"><a name="l16396"></a><span class="lineno">16396</span>&#160;            <span class="keywordflow">if</span>(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)</div>
-<div class="line"><a name="l16397"></a><span class="lineno">16397</span>&#160;            {</div>
-<div class="line"><a name="l16398"></a><span class="lineno">16398</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">memoryType</a> = UINT32_MAX;</div>
-<div class="line"><a name="l16399"></a><span class="lineno">16399</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">deviceMemory</a> = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l16400"></a><span class="lineno">16400</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">offset</a> = 0;</div>
-<div class="line"><a name="l16401"></a><span class="lineno">16401</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f">size</a> = hAllocation-&gt;GetSize();</div>
-<div class="line"><a name="l16402"></a><span class="lineno">16402</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a> = VMA_NULL;</div>
-<div class="line"><a name="l16403"></a><span class="lineno">16403</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a> = hAllocation-&gt;GetUserData();</div>
-<div class="line"><a name="l16404"></a><span class="lineno">16404</span>&#160;                <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l16405"></a><span class="lineno">16405</span>&#160;            }</div>
-<div class="line"><a name="l16406"></a><span class="lineno">16406</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span>(localLastUseFrameIndex == localCurrFrameIndex)</div>
-<div class="line"><a name="l16407"></a><span class="lineno">16407</span>&#160;            {</div>
-<div class="line"><a name="l16408"></a><span class="lineno">16408</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">memoryType</a> = hAllocation-&gt;GetMemoryTypeIndex();</div>
-<div class="line"><a name="l16409"></a><span class="lineno">16409</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">deviceMemory</a> = hAllocation-&gt;GetMemory();</div>
-<div class="line"><a name="l16410"></a><span class="lineno">16410</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">offset</a> = hAllocation-&gt;GetOffset();</div>
-<div class="line"><a name="l16411"></a><span class="lineno">16411</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f">size</a> = hAllocation-&gt;GetSize();</div>
-<div class="line"><a name="l16412"></a><span class="lineno">16412</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a> = VMA_NULL;</div>
-<div class="line"><a name="l16413"></a><span class="lineno">16413</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a> = hAllocation-&gt;GetUserData();</div>
-<div class="line"><a name="l16414"></a><span class="lineno">16414</span>&#160;                <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l16415"></a><span class="lineno">16415</span>&#160;            }</div>
-<div class="line"><a name="l16416"></a><span class="lineno">16416</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// Last use time earlier than current time.</span></div>
-<div class="line"><a name="l16417"></a><span class="lineno">16417</span>&#160;            {</div>
-<div class="line"><a name="l16418"></a><span class="lineno">16418</span>&#160;                <span class="keywordflow">if</span>(hAllocation-&gt;CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))</div>
-<div class="line"><a name="l16419"></a><span class="lineno">16419</span>&#160;                {</div>
-<div class="line"><a name="l16420"></a><span class="lineno">16420</span>&#160;                    localLastUseFrameIndex = localCurrFrameIndex;</div>
-<div class="line"><a name="l16421"></a><span class="lineno">16421</span>&#160;                }</div>
-<div class="line"><a name="l16422"></a><span class="lineno">16422</span>&#160;            }</div>
-<div class="line"><a name="l16423"></a><span class="lineno">16423</span>&#160;        }</div>
-<div class="line"><a name="l16424"></a><span class="lineno">16424</span>&#160;    }</div>
-<div class="line"><a name="l16425"></a><span class="lineno">16425</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16426"></a><span class="lineno">16426</span>&#160;    {</div>
-<div class="line"><a name="l16427"></a><span class="lineno">16427</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l16428"></a><span class="lineno">16428</span>&#160;        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();</div>
-<div class="line"><a name="l16429"></a><span class="lineno">16429</span>&#160;        uint32_t localLastUseFrameIndex = hAllocation-&gt;GetLastUseFrameIndex();</div>
-<div class="line"><a name="l16430"></a><span class="lineno">16430</span>&#160;        <span class="keywordflow">for</span>(;;)</div>
-<div class="line"><a name="l16431"></a><span class="lineno">16431</span>&#160;        {</div>
-<div class="line"><a name="l16432"></a><span class="lineno">16432</span>&#160;            VMA_ASSERT(localLastUseFrameIndex != VMA_FRAME_INDEX_LOST);</div>
-<div class="line"><a name="l16433"></a><span class="lineno">16433</span>&#160;            <span class="keywordflow">if</span>(localLastUseFrameIndex == localCurrFrameIndex)</div>
-<div class="line"><a name="l16434"></a><span class="lineno">16434</span>&#160;            {</div>
-<div class="line"><a name="l16435"></a><span class="lineno">16435</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16436"></a><span class="lineno">16436</span>&#160;            }</div>
-<div class="line"><a name="l16437"></a><span class="lineno">16437</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// Last use time earlier than current time.</span></div>
-<div class="line"><a name="l16438"></a><span class="lineno">16438</span>&#160;            {</div>
-<div class="line"><a name="l16439"></a><span class="lineno">16439</span>&#160;                <span class="keywordflow">if</span>(hAllocation-&gt;CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))</div>
-<div class="line"><a name="l16440"></a><span class="lineno">16440</span>&#160;                {</div>
-<div class="line"><a name="l16441"></a><span class="lineno">16441</span>&#160;                    localLastUseFrameIndex = localCurrFrameIndex;</div>
-<div class="line"><a name="l16442"></a><span class="lineno">16442</span>&#160;                }</div>
-<div class="line"><a name="l16443"></a><span class="lineno">16443</span>&#160;            }</div>
-<div class="line"><a name="l16444"></a><span class="lineno">16444</span>&#160;        }</div>
-<div class="line"><a name="l16445"></a><span class="lineno">16445</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l16446"></a><span class="lineno">16446</span>&#160; </div>
-<div class="line"><a name="l16447"></a><span class="lineno">16447</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">memoryType</a> = hAllocation-&gt;GetMemoryTypeIndex();</div>
-<div class="line"><a name="l16448"></a><span class="lineno">16448</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">deviceMemory</a> = hAllocation-&gt;GetMemory();</div>
-<div class="line"><a name="l16449"></a><span class="lineno">16449</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">offset</a> = hAllocation-&gt;GetOffset();</div>
-<div class="line"><a name="l16450"></a><span class="lineno">16450</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f">size</a> = hAllocation-&gt;GetSize();</div>
-<div class="line"><a name="l16451"></a><span class="lineno">16451</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a> = hAllocation-&gt;GetMappedData();</div>
-<div class="line"><a name="l16452"></a><span class="lineno">16452</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a> = hAllocation-&gt;GetUserData();</div>
-<div class="line"><a name="l16453"></a><span class="lineno">16453</span>&#160;    }</div>
+<div class="line"><a name="l16257"></a><span class="lineno">16257</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Specifying VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT together with VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT makes no sense.&quot;</span>);</div>
+<div class="line"><a name="l16258"></a><span class="lineno">16258</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l16259"></a><span class="lineno">16259</span>&#160;    }</div>
+<div class="line"><a name="l16260"></a><span class="lineno">16260</span>&#160;    <span class="keywordflow">if</span>((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0 &amp;&amp;</div>
+<div class="line"><a name="l16261"></a><span class="lineno">16261</span>&#160;        (createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a>) != 0)</div>
+<div class="line"><a name="l16262"></a><span class="lineno">16262</span>&#160;    {</div>
+<div class="line"><a name="l16263"></a><span class="lineno">16263</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Specifying VMA_ALLOCATION_CREATE_MAPPED_BIT together with VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT is invalid.&quot;</span>);</div>
+<div class="line"><a name="l16264"></a><span class="lineno">16264</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l16265"></a><span class="lineno">16265</span>&#160;    }</div>
+<div class="line"><a name="l16266"></a><span class="lineno">16266</span>&#160;    <span class="keywordflow">if</span>(requiresDedicatedAllocation)</div>
+<div class="line"><a name="l16267"></a><span class="lineno">16267</span>&#160;    {</div>
+<div class="line"><a name="l16268"></a><span class="lineno">16268</span>&#160;        <span class="keywordflow">if</span>((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a>) != 0)</div>
+<div class="line"><a name="l16269"></a><span class="lineno">16269</span>&#160;        {</div>
+<div class="line"><a name="l16270"></a><span class="lineno">16270</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT specified while dedicated allocation is required.&quot;</span>);</div>
+<div class="line"><a name="l16271"></a><span class="lineno">16271</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l16272"></a><span class="lineno">16272</span>&#160;        }</div>
+<div class="line"><a name="l16273"></a><span class="lineno">16273</span>&#160;        <span class="keywordflow">if</span>(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a> != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l16274"></a><span class="lineno">16274</span>&#160;        {</div>
+<div class="line"><a name="l16275"></a><span class="lineno">16275</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Pool specified while dedicated allocation is required.&quot;</span>);</div>
+<div class="line"><a name="l16276"></a><span class="lineno">16276</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l16277"></a><span class="lineno">16277</span>&#160;        }</div>
+<div class="line"><a name="l16278"></a><span class="lineno">16278</span>&#160;    }</div>
+<div class="line"><a name="l16279"></a><span class="lineno">16279</span>&#160;    <span class="keywordflow">if</span>((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a> != VK_NULL_HANDLE) &amp;&amp;</div>
+<div class="line"><a name="l16280"></a><span class="lineno">16280</span>&#160;        ((createInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; (<a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>)) != 0))</div>
+<div class="line"><a name="l16281"></a><span class="lineno">16281</span>&#160;    {</div>
+<div class="line"><a name="l16282"></a><span class="lineno">16282</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Specifying VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT when pool != null is invalid.&quot;</span>);</div>
+<div class="line"><a name="l16283"></a><span class="lineno">16283</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l16284"></a><span class="lineno">16284</span>&#160;    }</div>
+<div class="line"><a name="l16285"></a><span class="lineno">16285</span>&#160; </div>
+<div class="line"><a name="l16286"></a><span class="lineno">16286</span>&#160;    <span class="keywordflow">if</span>(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a> != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l16287"></a><span class="lineno">16287</span>&#160;    {</div>
+<div class="line"><a name="l16288"></a><span class="lineno">16288</span>&#160;        <span class="keyword">const</span> VkDeviceSize alignmentForPool = VMA_MAX(</div>
+<div class="line"><a name="l16289"></a><span class="lineno">16289</span>&#160;            vkMemReq.alignment,</div>
+<div class="line"><a name="l16290"></a><span class="lineno">16290</span>&#160;            GetMemoryTypeMinAlignment(createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>-&gt;m_BlockVector.GetMemoryTypeIndex()));</div>
+<div class="line"><a name="l16291"></a><span class="lineno">16291</span>&#160; </div>
+<div class="line"><a name="l16292"></a><span class="lineno">16292</span>&#160;        <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> createInfoForPool = createInfo;</div>
+<div class="line"><a name="l16293"></a><span class="lineno">16293</span>&#160;        <span class="comment">// If memory type is not HOST_VISIBLE, disable MAPPED.</span></div>
+<div class="line"><a name="l16294"></a><span class="lineno">16294</span>&#160;        <span class="keywordflow">if</span>((createInfoForPool.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>) != 0 &amp;&amp;</div>
+<div class="line"><a name="l16295"></a><span class="lineno">16295</span>&#160;            (m_MemProps.memoryTypes[createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>-&gt;m_BlockVector.GetMemoryTypeIndex()].propertyFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)</div>
+<div class="line"><a name="l16296"></a><span class="lineno">16296</span>&#160;        {</div>
+<div class="line"><a name="l16297"></a><span class="lineno">16297</span>&#160;            createInfoForPool.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp;= ~<a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>;</div>
+<div class="line"><a name="l16298"></a><span class="lineno">16298</span>&#160;        }</div>
+<div class="line"><a name="l16299"></a><span class="lineno">16299</span>&#160; </div>
+<div class="line"><a name="l16300"></a><span class="lineno">16300</span>&#160;        <span class="keywordflow">return</span> createInfo.<a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>-&gt;m_BlockVector.Allocate(</div>
+<div class="line"><a name="l16301"></a><span class="lineno">16301</span>&#160;            m_CurrentFrameIndex.load(),</div>
+<div class="line"><a name="l16302"></a><span class="lineno">16302</span>&#160;            vkMemReq.size,</div>
+<div class="line"><a name="l16303"></a><span class="lineno">16303</span>&#160;            alignmentForPool,</div>
+<div class="line"><a name="l16304"></a><span class="lineno">16304</span>&#160;            createInfoForPool,</div>
+<div class="line"><a name="l16305"></a><span class="lineno">16305</span>&#160;            suballocType,</div>
+<div class="line"><a name="l16306"></a><span class="lineno">16306</span>&#160;            allocationCount,</div>
+<div class="line"><a name="l16307"></a><span class="lineno">16307</span>&#160;            pAllocations);</div>
+<div class="line"><a name="l16308"></a><span class="lineno">16308</span>&#160;    }</div>
+<div class="line"><a name="l16309"></a><span class="lineno">16309</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16310"></a><span class="lineno">16310</span>&#160;    {</div>
+<div class="line"><a name="l16311"></a><span class="lineno">16311</span>&#160;        <span class="comment">// Bit mask of memory Vulkan types acceptable for this allocation.</span></div>
+<div class="line"><a name="l16312"></a><span class="lineno">16312</span>&#160;        uint32_t memoryTypeBits = vkMemReq.memoryTypeBits;</div>
+<div class="line"><a name="l16313"></a><span class="lineno">16313</span>&#160;        uint32_t memTypeIndex = UINT32_MAX;</div>
+<div class="line"><a name="l16314"></a><span class="lineno">16314</span>&#160;        VkResult res = <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(<span class="keyword">this</span>, memoryTypeBits, &amp;createInfo, &amp;memTypeIndex);</div>
+<div class="line"><a name="l16315"></a><span class="lineno">16315</span>&#160;        <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l16316"></a><span class="lineno">16316</span>&#160;        {</div>
+<div class="line"><a name="l16317"></a><span class="lineno">16317</span>&#160;            VkDeviceSize alignmentForMemType = VMA_MAX(</div>
+<div class="line"><a name="l16318"></a><span class="lineno">16318</span>&#160;                vkMemReq.alignment,</div>
+<div class="line"><a name="l16319"></a><span class="lineno">16319</span>&#160;                GetMemoryTypeMinAlignment(memTypeIndex));</div>
+<div class="line"><a name="l16320"></a><span class="lineno">16320</span>&#160; </div>
+<div class="line"><a name="l16321"></a><span class="lineno">16321</span>&#160;            res = AllocateMemoryOfType(</div>
+<div class="line"><a name="l16322"></a><span class="lineno">16322</span>&#160;                vkMemReq.size,</div>
+<div class="line"><a name="l16323"></a><span class="lineno">16323</span>&#160;                alignmentForMemType,</div>
+<div class="line"><a name="l16324"></a><span class="lineno">16324</span>&#160;                requiresDedicatedAllocation || prefersDedicatedAllocation,</div>
+<div class="line"><a name="l16325"></a><span class="lineno">16325</span>&#160;                dedicatedBuffer,</div>
+<div class="line"><a name="l16326"></a><span class="lineno">16326</span>&#160;                dedicatedBufferUsage,</div>
+<div class="line"><a name="l16327"></a><span class="lineno">16327</span>&#160;                dedicatedImage,</div>
+<div class="line"><a name="l16328"></a><span class="lineno">16328</span>&#160;                createInfo,</div>
+<div class="line"><a name="l16329"></a><span class="lineno">16329</span>&#160;                memTypeIndex,</div>
+<div class="line"><a name="l16330"></a><span class="lineno">16330</span>&#160;                suballocType,</div>
+<div class="line"><a name="l16331"></a><span class="lineno">16331</span>&#160;                allocationCount,</div>
+<div class="line"><a name="l16332"></a><span class="lineno">16332</span>&#160;                pAllocations);</div>
+<div class="line"><a name="l16333"></a><span class="lineno">16333</span>&#160;            <span class="comment">// Succeeded on first try.</span></div>
+<div class="line"><a name="l16334"></a><span class="lineno">16334</span>&#160;            <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l16335"></a><span class="lineno">16335</span>&#160;            {</div>
+<div class="line"><a name="l16336"></a><span class="lineno">16336</span>&#160;                <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l16337"></a><span class="lineno">16337</span>&#160;            }</div>
+<div class="line"><a name="l16338"></a><span class="lineno">16338</span>&#160;            <span class="comment">// Allocation from this memory type failed. Try other compatible memory types.</span></div>
+<div class="line"><a name="l16339"></a><span class="lineno">16339</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16340"></a><span class="lineno">16340</span>&#160;            {</div>
+<div class="line"><a name="l16341"></a><span class="lineno">16341</span>&#160;                <span class="keywordflow">for</span>(;;)</div>
+<div class="line"><a name="l16342"></a><span class="lineno">16342</span>&#160;                {</div>
+<div class="line"><a name="l16343"></a><span class="lineno">16343</span>&#160;                    <span class="comment">// Remove old memTypeIndex from list of possibilities.</span></div>
+<div class="line"><a name="l16344"></a><span class="lineno">16344</span>&#160;                    memoryTypeBits &amp;= ~(1u &lt;&lt; memTypeIndex);</div>
+<div class="line"><a name="l16345"></a><span class="lineno">16345</span>&#160;                    <span class="comment">// Find alternative memTypeIndex.</span></div>
+<div class="line"><a name="l16346"></a><span class="lineno">16346</span>&#160;                    res = <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(<span class="keyword">this</span>, memoryTypeBits, &amp;createInfo, &amp;memTypeIndex);</div>
+<div class="line"><a name="l16347"></a><span class="lineno">16347</span>&#160;                    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l16348"></a><span class="lineno">16348</span>&#160;                    {</div>
+<div class="line"><a name="l16349"></a><span class="lineno">16349</span>&#160;                        alignmentForMemType = VMA_MAX(</div>
+<div class="line"><a name="l16350"></a><span class="lineno">16350</span>&#160;                            vkMemReq.alignment,</div>
+<div class="line"><a name="l16351"></a><span class="lineno">16351</span>&#160;                            GetMemoryTypeMinAlignment(memTypeIndex));</div>
+<div class="line"><a name="l16352"></a><span class="lineno">16352</span>&#160;                        </div>
+<div class="line"><a name="l16353"></a><span class="lineno">16353</span>&#160;                        res = AllocateMemoryOfType(</div>
+<div class="line"><a name="l16354"></a><span class="lineno">16354</span>&#160;                            vkMemReq.size,</div>
+<div class="line"><a name="l16355"></a><span class="lineno">16355</span>&#160;                            alignmentForMemType,</div>
+<div class="line"><a name="l16356"></a><span class="lineno">16356</span>&#160;                            requiresDedicatedAllocation || prefersDedicatedAllocation,</div>
+<div class="line"><a name="l16357"></a><span class="lineno">16357</span>&#160;                            dedicatedBuffer,</div>
+<div class="line"><a name="l16358"></a><span class="lineno">16358</span>&#160;                            dedicatedBufferUsage,</div>
+<div class="line"><a name="l16359"></a><span class="lineno">16359</span>&#160;                            dedicatedImage,</div>
+<div class="line"><a name="l16360"></a><span class="lineno">16360</span>&#160;                            createInfo,</div>
+<div class="line"><a name="l16361"></a><span class="lineno">16361</span>&#160;                            memTypeIndex,</div>
+<div class="line"><a name="l16362"></a><span class="lineno">16362</span>&#160;                            suballocType,</div>
+<div class="line"><a name="l16363"></a><span class="lineno">16363</span>&#160;                            allocationCount,</div>
+<div class="line"><a name="l16364"></a><span class="lineno">16364</span>&#160;                            pAllocations);</div>
+<div class="line"><a name="l16365"></a><span class="lineno">16365</span>&#160;                        <span class="comment">// Allocation from this alternative memory type succeeded.</span></div>
+<div class="line"><a name="l16366"></a><span class="lineno">16366</span>&#160;                        <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l16367"></a><span class="lineno">16367</span>&#160;                        {</div>
+<div class="line"><a name="l16368"></a><span class="lineno">16368</span>&#160;                            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l16369"></a><span class="lineno">16369</span>&#160;                        }</div>
+<div class="line"><a name="l16370"></a><span class="lineno">16370</span>&#160;                        <span class="comment">// else: Allocation from this memory type failed. Try next one - next loop iteration.</span></div>
+<div class="line"><a name="l16371"></a><span class="lineno">16371</span>&#160;                    }</div>
+<div class="line"><a name="l16372"></a><span class="lineno">16372</span>&#160;                    <span class="comment">// No other matching memory type index could be found.</span></div>
+<div class="line"><a name="l16373"></a><span class="lineno">16373</span>&#160;                    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16374"></a><span class="lineno">16374</span>&#160;                    {</div>
+<div class="line"><a name="l16375"></a><span class="lineno">16375</span>&#160;                        <span class="comment">// Not returning res, which is VK_ERROR_FEATURE_NOT_PRESENT, because we already failed to allocate once.</span></div>
+<div class="line"><a name="l16376"></a><span class="lineno">16376</span>&#160;                        <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l16377"></a><span class="lineno">16377</span>&#160;                    }</div>
+<div class="line"><a name="l16378"></a><span class="lineno">16378</span>&#160;                }</div>
+<div class="line"><a name="l16379"></a><span class="lineno">16379</span>&#160;            }</div>
+<div class="line"><a name="l16380"></a><span class="lineno">16380</span>&#160;        }</div>
+<div class="line"><a name="l16381"></a><span class="lineno">16381</span>&#160;        <span class="comment">// Can&#39;t find any single memory type maching requirements. res is VK_ERROR_FEATURE_NOT_PRESENT.</span></div>
+<div class="line"><a name="l16382"></a><span class="lineno">16382</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16383"></a><span class="lineno">16383</span>&#160;            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l16384"></a><span class="lineno">16384</span>&#160;    }</div>
+<div class="line"><a name="l16385"></a><span class="lineno">16385</span>&#160;}</div>
+<div class="line"><a name="l16386"></a><span class="lineno">16386</span>&#160; </div>
+<div class="line"><a name="l16387"></a><span class="lineno">16387</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::FreeMemory(</div>
+<div class="line"><a name="l16388"></a><span class="lineno">16388</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l16389"></a><span class="lineno">16389</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
+<div class="line"><a name="l16390"></a><span class="lineno">16390</span>&#160;{</div>
+<div class="line"><a name="l16391"></a><span class="lineno">16391</span>&#160;    VMA_ASSERT(pAllocations);</div>
+<div class="line"><a name="l16392"></a><span class="lineno">16392</span>&#160; </div>
+<div class="line"><a name="l16393"></a><span class="lineno">16393</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> allocIndex = allocationCount; allocIndex--; )</div>
+<div class="line"><a name="l16394"></a><span class="lineno">16394</span>&#160;    {</div>
+<div class="line"><a name="l16395"></a><span class="lineno">16395</span>&#160;        <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation = pAllocations[allocIndex];</div>
+<div class="line"><a name="l16396"></a><span class="lineno">16396</span>&#160; </div>
+<div class="line"><a name="l16397"></a><span class="lineno">16397</span>&#160;        <span class="keywordflow">if</span>(allocation != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l16398"></a><span class="lineno">16398</span>&#160;        {</div>
+<div class="line"><a name="l16399"></a><span class="lineno">16399</span>&#160;            <span class="keywordflow">if</span>(TouchAllocation(allocation))</div>
+<div class="line"><a name="l16400"></a><span class="lineno">16400</span>&#160;            {</div>
+<div class="line"><a name="l16401"></a><span class="lineno">16401</span>&#160;                <span class="keywordflow">if</span>(VMA_DEBUG_INITIALIZE_ALLOCATIONS)</div>
+<div class="line"><a name="l16402"></a><span class="lineno">16402</span>&#160;                {</div>
+<div class="line"><a name="l16403"></a><span class="lineno">16403</span>&#160;                    FillAllocation(allocation, VMA_ALLOCATION_FILL_PATTERN_DESTROYED);</div>
+<div class="line"><a name="l16404"></a><span class="lineno">16404</span>&#160;                }</div>
+<div class="line"><a name="l16405"></a><span class="lineno">16405</span>&#160; </div>
+<div class="line"><a name="l16406"></a><span class="lineno">16406</span>&#160;                <span class="keywordflow">switch</span>(allocation-&gt;GetType())</div>
+<div class="line"><a name="l16407"></a><span class="lineno">16407</span>&#160;                {</div>
+<div class="line"><a name="l16408"></a><span class="lineno">16408</span>&#160;                <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
+<div class="line"><a name="l16409"></a><span class="lineno">16409</span>&#160;                    {</div>
+<div class="line"><a name="l16410"></a><span class="lineno">16410</span>&#160;                        VmaBlockVector* pBlockVector = VMA_NULL;</div>
+<div class="line"><a name="l16411"></a><span class="lineno">16411</span>&#160;                        <a class="code" href="struct_vma_pool.html">VmaPool</a> hPool = allocation-&gt;GetBlock()-&gt;GetParentPool();</div>
+<div class="line"><a name="l16412"></a><span class="lineno">16412</span>&#160;                        <span class="keywordflow">if</span>(hPool != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l16413"></a><span class="lineno">16413</span>&#160;                        {</div>
+<div class="line"><a name="l16414"></a><span class="lineno">16414</span>&#160;                            pBlockVector = &amp;hPool-&gt;m_BlockVector;</div>
+<div class="line"><a name="l16415"></a><span class="lineno">16415</span>&#160;                        }</div>
+<div class="line"><a name="l16416"></a><span class="lineno">16416</span>&#160;                        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16417"></a><span class="lineno">16417</span>&#160;                        {</div>
+<div class="line"><a name="l16418"></a><span class="lineno">16418</span>&#160;                            <span class="keyword">const</span> uint32_t memTypeIndex = allocation-&gt;GetMemoryTypeIndex();</div>
+<div class="line"><a name="l16419"></a><span class="lineno">16419</span>&#160;                            pBlockVector = m_pBlockVectors[memTypeIndex];</div>
+<div class="line"><a name="l16420"></a><span class="lineno">16420</span>&#160;                        }</div>
+<div class="line"><a name="l16421"></a><span class="lineno">16421</span>&#160;                        pBlockVector-&gt;Free(allocation);</div>
+<div class="line"><a name="l16422"></a><span class="lineno">16422</span>&#160;                    }</div>
+<div class="line"><a name="l16423"></a><span class="lineno">16423</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l16424"></a><span class="lineno">16424</span>&#160;                <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
+<div class="line"><a name="l16425"></a><span class="lineno">16425</span>&#160;                    FreeDedicatedMemory(allocation);</div>
+<div class="line"><a name="l16426"></a><span class="lineno">16426</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l16427"></a><span class="lineno">16427</span>&#160;                <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l16428"></a><span class="lineno">16428</span>&#160;                    VMA_ASSERT(0);</div>
+<div class="line"><a name="l16429"></a><span class="lineno">16429</span>&#160;                }</div>
+<div class="line"><a name="l16430"></a><span class="lineno">16430</span>&#160;            }</div>
+<div class="line"><a name="l16431"></a><span class="lineno">16431</span>&#160; </div>
+<div class="line"><a name="l16432"></a><span class="lineno">16432</span>&#160;            <span class="comment">// Do this regardless of whether the allocation is lost. Lost allocations still account to Budget.AllocationBytes.</span></div>
+<div class="line"><a name="l16433"></a><span class="lineno">16433</span>&#160;            m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(allocation-&gt;GetMemoryTypeIndex()), allocation-&gt;GetSize());</div>
+<div class="line"><a name="l16434"></a><span class="lineno">16434</span>&#160;            allocation-&gt;SetUserData(<span class="keyword">this</span>, VMA_NULL);</div>
+<div class="line"><a name="l16435"></a><span class="lineno">16435</span>&#160;            m_AllocationObjectAllocator.Free(allocation);</div>
+<div class="line"><a name="l16436"></a><span class="lineno">16436</span>&#160;        }</div>
+<div class="line"><a name="l16437"></a><span class="lineno">16437</span>&#160;    }</div>
+<div class="line"><a name="l16438"></a><span class="lineno">16438</span>&#160;}</div>
+<div class="line"><a name="l16439"></a><span class="lineno">16439</span>&#160; </div>
+<div class="line"><a name="l16440"></a><span class="lineno">16440</span>&#160;VkResult VmaAllocator_T::ResizeAllocation(</div>
+<div class="line"><a name="l16441"></a><span class="lineno">16441</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc,</div>
+<div class="line"><a name="l16442"></a><span class="lineno">16442</span>&#160;    VkDeviceSize newSize)</div>
+<div class="line"><a name="l16443"></a><span class="lineno">16443</span>&#160;{</div>
+<div class="line"><a name="l16444"></a><span class="lineno">16444</span>&#160;    <span class="comment">// This function is deprecated and so it does nothing. It&#39;s left for backward compatibility.</span></div>
+<div class="line"><a name="l16445"></a><span class="lineno">16445</span>&#160;    <span class="keywordflow">if</span>(newSize == 0 || alloc-&gt;GetLastUseFrameIndex() == VMA_FRAME_INDEX_LOST)</div>
+<div class="line"><a name="l16446"></a><span class="lineno">16446</span>&#160;    {</div>
+<div class="line"><a name="l16447"></a><span class="lineno">16447</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
+<div class="line"><a name="l16448"></a><span class="lineno">16448</span>&#160;    }</div>
+<div class="line"><a name="l16449"></a><span class="lineno">16449</span>&#160;    <span class="keywordflow">if</span>(newSize == alloc-&gt;GetSize())</div>
+<div class="line"><a name="l16450"></a><span class="lineno">16450</span>&#160;    {</div>
+<div class="line"><a name="l16451"></a><span class="lineno">16451</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l16452"></a><span class="lineno">16452</span>&#160;    }</div>
+<div class="line"><a name="l16453"></a><span class="lineno">16453</span>&#160;    <span class="keywordflow">return</span> VK_ERROR_OUT_OF_POOL_MEMORY;</div>
 <div class="line"><a name="l16454"></a><span class="lineno">16454</span>&#160;}</div>
 <div class="line"><a name="l16455"></a><span class="lineno">16455</span>&#160; </div>
-<div class="line"><a name="l16456"></a><span class="lineno">16456</span>&#160;<span class="keywordtype">bool</span> VmaAllocator_T::TouchAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
+<div class="line"><a name="l16456"></a><span class="lineno">16456</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::CalculateStats(<a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats)</div>
 <div class="line"><a name="l16457"></a><span class="lineno">16457</span>&#160;{</div>
-<div class="line"><a name="l16458"></a><span class="lineno">16458</span>&#160;    <span class="comment">// This is a stripped-down version of VmaAllocator_T::GetAllocationInfo.</span></div>
-<div class="line"><a name="l16459"></a><span class="lineno">16459</span>&#160;    <span class="keywordflow">if</span>(hAllocation-&gt;CanBecomeLost())</div>
-<div class="line"><a name="l16460"></a><span class="lineno">16460</span>&#160;    {</div>
-<div class="line"><a name="l16461"></a><span class="lineno">16461</span>&#160;        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();</div>
-<div class="line"><a name="l16462"></a><span class="lineno">16462</span>&#160;        uint32_t localLastUseFrameIndex = hAllocation-&gt;GetLastUseFrameIndex();</div>
-<div class="line"><a name="l16463"></a><span class="lineno">16463</span>&#160;        <span class="keywordflow">for</span>(;;)</div>
-<div class="line"><a name="l16464"></a><span class="lineno">16464</span>&#160;        {</div>
-<div class="line"><a name="l16465"></a><span class="lineno">16465</span>&#160;            <span class="keywordflow">if</span>(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)</div>
-<div class="line"><a name="l16466"></a><span class="lineno">16466</span>&#160;            {</div>
-<div class="line"><a name="l16467"></a><span class="lineno">16467</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
-<div class="line"><a name="l16468"></a><span class="lineno">16468</span>&#160;            }</div>
-<div class="line"><a name="l16469"></a><span class="lineno">16469</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span>(localLastUseFrameIndex == localCurrFrameIndex)</div>
-<div class="line"><a name="l16470"></a><span class="lineno">16470</span>&#160;            {</div>
-<div class="line"><a name="l16471"></a><span class="lineno">16471</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l16472"></a><span class="lineno">16472</span>&#160;            }</div>
-<div class="line"><a name="l16473"></a><span class="lineno">16473</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// Last use time earlier than current time.</span></div>
-<div class="line"><a name="l16474"></a><span class="lineno">16474</span>&#160;            {</div>
-<div class="line"><a name="l16475"></a><span class="lineno">16475</span>&#160;                <span class="keywordflow">if</span>(hAllocation-&gt;CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))</div>
-<div class="line"><a name="l16476"></a><span class="lineno">16476</span>&#160;                {</div>
-<div class="line"><a name="l16477"></a><span class="lineno">16477</span>&#160;                    localLastUseFrameIndex = localCurrFrameIndex;</div>
-<div class="line"><a name="l16478"></a><span class="lineno">16478</span>&#160;                }</div>
-<div class="line"><a name="l16479"></a><span class="lineno">16479</span>&#160;            }</div>
-<div class="line"><a name="l16480"></a><span class="lineno">16480</span>&#160;        }</div>
-<div class="line"><a name="l16481"></a><span class="lineno">16481</span>&#160;    }</div>
-<div class="line"><a name="l16482"></a><span class="lineno">16482</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16483"></a><span class="lineno">16483</span>&#160;    {</div>
-<div class="line"><a name="l16484"></a><span class="lineno">16484</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l16485"></a><span class="lineno">16485</span>&#160;        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();</div>
-<div class="line"><a name="l16486"></a><span class="lineno">16486</span>&#160;        uint32_t localLastUseFrameIndex = hAllocation-&gt;GetLastUseFrameIndex();</div>
-<div class="line"><a name="l16487"></a><span class="lineno">16487</span>&#160;        <span class="keywordflow">for</span>(;;)</div>
-<div class="line"><a name="l16488"></a><span class="lineno">16488</span>&#160;        {</div>
-<div class="line"><a name="l16489"></a><span class="lineno">16489</span>&#160;            VMA_ASSERT(localLastUseFrameIndex != VMA_FRAME_INDEX_LOST);</div>
-<div class="line"><a name="l16490"></a><span class="lineno">16490</span>&#160;            <span class="keywordflow">if</span>(localLastUseFrameIndex == localCurrFrameIndex)</div>
-<div class="line"><a name="l16491"></a><span class="lineno">16491</span>&#160;            {</div>
-<div class="line"><a name="l16492"></a><span class="lineno">16492</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16493"></a><span class="lineno">16493</span>&#160;            }</div>
-<div class="line"><a name="l16494"></a><span class="lineno">16494</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// Last use time earlier than current time.</span></div>
-<div class="line"><a name="l16495"></a><span class="lineno">16495</span>&#160;            {</div>
-<div class="line"><a name="l16496"></a><span class="lineno">16496</span>&#160;                <span class="keywordflow">if</span>(hAllocation-&gt;CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))</div>
-<div class="line"><a name="l16497"></a><span class="lineno">16497</span>&#160;                {</div>
-<div class="line"><a name="l16498"></a><span class="lineno">16498</span>&#160;                    localLastUseFrameIndex = localCurrFrameIndex;</div>
-<div class="line"><a name="l16499"></a><span class="lineno">16499</span>&#160;                }</div>
-<div class="line"><a name="l16500"></a><span class="lineno">16500</span>&#160;            }</div>
-<div class="line"><a name="l16501"></a><span class="lineno">16501</span>&#160;        }</div>
-<div class="line"><a name="l16502"></a><span class="lineno">16502</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l16503"></a><span class="lineno">16503</span>&#160; </div>
-<div class="line"><a name="l16504"></a><span class="lineno">16504</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
-<div class="line"><a name="l16505"></a><span class="lineno">16505</span>&#160;    }</div>
-<div class="line"><a name="l16506"></a><span class="lineno">16506</span>&#160;}</div>
-<div class="line"><a name="l16507"></a><span class="lineno">16507</span>&#160; </div>
-<div class="line"><a name="l16508"></a><span class="lineno">16508</span>&#160;VkResult VmaAllocator_T::CreatePool(<span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>* pCreateInfo, <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPool)</div>
-<div class="line"><a name="l16509"></a><span class="lineno">16509</span>&#160;{</div>
-<div class="line"><a name="l16510"></a><span class="lineno">16510</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;  CreatePool: MemoryTypeIndex=%u, flags=%u&quot;</span>, pCreateInfo-&gt;<a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a>, pCreateInfo-&gt;<a class="code" href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446">flags</a>);</div>
-<div class="line"><a name="l16511"></a><span class="lineno">16511</span>&#160; </div>
-<div class="line"><a name="l16512"></a><span class="lineno">16512</span>&#160;    <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a> newCreateInfo = *pCreateInfo;</div>
-<div class="line"><a name="l16513"></a><span class="lineno">16513</span>&#160; </div>
-<div class="line"><a name="l16514"></a><span class="lineno">16514</span>&#160;    <span class="keywordflow">if</span>(newCreateInfo.<a class="code" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">maxBlockCount</a> == 0)</div>
-<div class="line"><a name="l16515"></a><span class="lineno">16515</span>&#160;    {</div>
-<div class="line"><a name="l16516"></a><span class="lineno">16516</span>&#160;        newCreateInfo.<a class="code" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">maxBlockCount</a> = SIZE_MAX;</div>
-<div class="line"><a name="l16517"></a><span class="lineno">16517</span>&#160;    }</div>
-<div class="line"><a name="l16518"></a><span class="lineno">16518</span>&#160;    <span class="keywordflow">if</span>(newCreateInfo.<a class="code" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae">minBlockCount</a> &gt; newCreateInfo.<a class="code" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">maxBlockCount</a>)</div>
-<div class="line"><a name="l16519"></a><span class="lineno">16519</span>&#160;    {</div>
-<div class="line"><a name="l16520"></a><span class="lineno">16520</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_INITIALIZATION_FAILED;</div>
-<div class="line"><a name="l16521"></a><span class="lineno">16521</span>&#160;    }</div>
-<div class="line"><a name="l16522"></a><span class="lineno">16522</span>&#160;    <span class="comment">// Memory type index out of range or forbidden.</span></div>
-<div class="line"><a name="l16523"></a><span class="lineno">16523</span>&#160;    <span class="keywordflow">if</span>(pCreateInfo-&gt;<a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a> &gt;= GetMemoryTypeCount() ||</div>
-<div class="line"><a name="l16524"></a><span class="lineno">16524</span>&#160;        ((1u &lt;&lt; pCreateInfo-&gt;<a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a>) &amp; m_GlobalMemoryTypeBits) == 0)</div>
-<div class="line"><a name="l16525"></a><span class="lineno">16525</span>&#160;    {</div>
-<div class="line"><a name="l16526"></a><span class="lineno">16526</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT;</div>
-<div class="line"><a name="l16527"></a><span class="lineno">16527</span>&#160;    }</div>
-<div class="line"><a name="l16528"></a><span class="lineno">16528</span>&#160; </div>
-<div class="line"><a name="l16529"></a><span class="lineno">16529</span>&#160;    <span class="keyword">const</span> VkDeviceSize preferredBlockSize = CalcPreferredBlockSize(newCreateInfo.<a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a>);</div>
-<div class="line"><a name="l16530"></a><span class="lineno">16530</span>&#160; </div>
-<div class="line"><a name="l16531"></a><span class="lineno">16531</span>&#160;    *pPool = vma_new(<span class="keyword">this</span>, VmaPool_T)(<span class="keyword">this</span>, newCreateInfo, preferredBlockSize);</div>
-<div class="line"><a name="l16532"></a><span class="lineno">16532</span>&#160; </div>
-<div class="line"><a name="l16533"></a><span class="lineno">16533</span>&#160;    VkResult res = (*pPool)-&gt;m_BlockVector.CreateMinBlocks();</div>
-<div class="line"><a name="l16534"></a><span class="lineno">16534</span>&#160;    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
-<div class="line"><a name="l16535"></a><span class="lineno">16535</span>&#160;    {</div>
-<div class="line"><a name="l16536"></a><span class="lineno">16536</span>&#160;        vma_delete(<span class="keyword">this</span>, *pPool);</div>
-<div class="line"><a name="l16537"></a><span class="lineno">16537</span>&#160;        *pPool = VMA_NULL;</div>
-<div class="line"><a name="l16538"></a><span class="lineno">16538</span>&#160;        <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l16539"></a><span class="lineno">16539</span>&#160;    }</div>
-<div class="line"><a name="l16540"></a><span class="lineno">16540</span>&#160; </div>
-<div class="line"><a name="l16541"></a><span class="lineno">16541</span>&#160;    <span class="comment">// Add to m_Pools.</span></div>
-<div class="line"><a name="l16542"></a><span class="lineno">16542</span>&#160;    {</div>
-<div class="line"><a name="l16543"></a><span class="lineno">16543</span>&#160;        VmaMutexLockWrite lock(m_PoolsMutex, m_UseMutex);</div>
-<div class="line"><a name="l16544"></a><span class="lineno">16544</span>&#160;        (*pPool)-&gt;SetId(m_NextPoolId++);</div>
-<div class="line"><a name="l16545"></a><span class="lineno">16545</span>&#160;        VmaVectorInsertSorted&lt;VmaPointerLess&gt;(m_Pools, *pPool);</div>
-<div class="line"><a name="l16546"></a><span class="lineno">16546</span>&#160;    }</div>
-<div class="line"><a name="l16547"></a><span class="lineno">16547</span>&#160; </div>
-<div class="line"><a name="l16548"></a><span class="lineno">16548</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l16549"></a><span class="lineno">16549</span>&#160;}</div>
-<div class="line"><a name="l16550"></a><span class="lineno">16550</span>&#160; </div>
-<div class="line"><a name="l16551"></a><span class="lineno">16551</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::DestroyPool(<a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
-<div class="line"><a name="l16552"></a><span class="lineno">16552</span>&#160;{</div>
-<div class="line"><a name="l16553"></a><span class="lineno">16553</span>&#160;    <span class="comment">// Remove from m_Pools.</span></div>
-<div class="line"><a name="l16554"></a><span class="lineno">16554</span>&#160;    {</div>
-<div class="line"><a name="l16555"></a><span class="lineno">16555</span>&#160;        VmaMutexLockWrite lock(m_PoolsMutex, m_UseMutex);</div>
-<div class="line"><a name="l16556"></a><span class="lineno">16556</span>&#160;        <span class="keywordtype">bool</span> success = VmaVectorRemoveSorted&lt;VmaPointerLess&gt;(m_Pools, pool);</div>
-<div class="line"><a name="l16557"></a><span class="lineno">16557</span>&#160;        VMA_ASSERT(success &amp;&amp; <span class="stringliteral">&quot;Pool not found in Allocator.&quot;</span>);</div>
-<div class="line"><a name="l16558"></a><span class="lineno">16558</span>&#160;    }</div>
-<div class="line"><a name="l16559"></a><span class="lineno">16559</span>&#160; </div>
-<div class="line"><a name="l16560"></a><span class="lineno">16560</span>&#160;    vma_delete(<span class="keyword">this</span>, pool);</div>
-<div class="line"><a name="l16561"></a><span class="lineno">16561</span>&#160;}</div>
-<div class="line"><a name="l16562"></a><span class="lineno">16562</span>&#160; </div>
-<div class="line"><a name="l16563"></a><span class="lineno">16563</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::GetPoolStats(<a class="code" href="struct_vma_pool.html">VmaPool</a> pool, <a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pPoolStats)</div>
-<div class="line"><a name="l16564"></a><span class="lineno">16564</span>&#160;{</div>
-<div class="line"><a name="l16565"></a><span class="lineno">16565</span>&#160;    pool-&gt;m_BlockVector.GetPoolStats(pPoolStats);</div>
-<div class="line"><a name="l16566"></a><span class="lineno">16566</span>&#160;}</div>
-<div class="line"><a name="l16567"></a><span class="lineno">16567</span>&#160; </div>
-<div class="line"><a name="l16568"></a><span class="lineno">16568</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::SetCurrentFrameIndex(uint32_t frameIndex)</div>
-<div class="line"><a name="l16569"></a><span class="lineno">16569</span>&#160;{</div>
-<div class="line"><a name="l16570"></a><span class="lineno">16570</span>&#160;    m_CurrentFrameIndex.store(frameIndex);</div>
-<div class="line"><a name="l16571"></a><span class="lineno">16571</span>&#160; </div>
-<div class="line"><a name="l16572"></a><span class="lineno">16572</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l16573"></a><span class="lineno">16573</span>&#160;    <span class="keywordflow">if</span>(m_UseExtMemoryBudget)</div>
-<div class="line"><a name="l16574"></a><span class="lineno">16574</span>&#160;    {</div>
-<div class="line"><a name="l16575"></a><span class="lineno">16575</span>&#160;        UpdateVulkanBudget();</div>
-<div class="line"><a name="l16576"></a><span class="lineno">16576</span>&#160;    }</div>
-<div class="line"><a name="l16577"></a><span class="lineno">16577</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l16578"></a><span class="lineno">16578</span>&#160;}</div>
-<div class="line"><a name="l16579"></a><span class="lineno">16579</span>&#160; </div>
-<div class="line"><a name="l16580"></a><span class="lineno">16580</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::MakePoolAllocationsLost(</div>
-<div class="line"><a name="l16581"></a><span class="lineno">16581</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> hPool,</div>
-<div class="line"><a name="l16582"></a><span class="lineno">16582</span>&#160;    <span class="keywordtype">size_t</span>* pLostAllocationCount)</div>
-<div class="line"><a name="l16583"></a><span class="lineno">16583</span>&#160;{</div>
-<div class="line"><a name="l16584"></a><span class="lineno">16584</span>&#160;    hPool-&gt;m_BlockVector.MakePoolAllocationsLost(</div>
-<div class="line"><a name="l16585"></a><span class="lineno">16585</span>&#160;        m_CurrentFrameIndex.load(),</div>
-<div class="line"><a name="l16586"></a><span class="lineno">16586</span>&#160;        pLostAllocationCount);</div>
-<div class="line"><a name="l16587"></a><span class="lineno">16587</span>&#160;}</div>
+<div class="line"><a name="l16458"></a><span class="lineno">16458</span>&#160;    <span class="comment">// Initialize.</span></div>
+<div class="line"><a name="l16459"></a><span class="lineno">16459</span>&#160;    InitStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>);</div>
+<div class="line"><a name="l16460"></a><span class="lineno">16460</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; VK_MAX_MEMORY_TYPES; ++i)</div>
+<div class="line"><a name="l16461"></a><span class="lineno">16461</span>&#160;        InitStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[i]);</div>
+<div class="line"><a name="l16462"></a><span class="lineno">16462</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; VK_MAX_MEMORY_HEAPS; ++i)</div>
+<div class="line"><a name="l16463"></a><span class="lineno">16463</span>&#160;        InitStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[i]);</div>
+<div class="line"><a name="l16464"></a><span class="lineno">16464</span>&#160;    </div>
+<div class="line"><a name="l16465"></a><span class="lineno">16465</span>&#160;    <span class="comment">// Process default pools.</span></div>
+<div class="line"><a name="l16466"></a><span class="lineno">16466</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
+<div class="line"><a name="l16467"></a><span class="lineno">16467</span>&#160;    {</div>
+<div class="line"><a name="l16468"></a><span class="lineno">16468</span>&#160;        VmaBlockVector* <span class="keyword">const</span> pBlockVector = m_pBlockVectors[memTypeIndex];</div>
+<div class="line"><a name="l16469"></a><span class="lineno">16469</span>&#160;        VMA_ASSERT(pBlockVector);</div>
+<div class="line"><a name="l16470"></a><span class="lineno">16470</span>&#160;        pBlockVector-&gt;AddStats(pStats);</div>
+<div class="line"><a name="l16471"></a><span class="lineno">16471</span>&#160;    }</div>
+<div class="line"><a name="l16472"></a><span class="lineno">16472</span>&#160; </div>
+<div class="line"><a name="l16473"></a><span class="lineno">16473</span>&#160;    <span class="comment">// Process custom pools.</span></div>
+<div class="line"><a name="l16474"></a><span class="lineno">16474</span>&#160;    {</div>
+<div class="line"><a name="l16475"></a><span class="lineno">16475</span>&#160;        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);</div>
+<div class="line"><a name="l16476"></a><span class="lineno">16476</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> poolIndex = 0, poolCount = m_Pools.size(); poolIndex &lt; poolCount; ++poolIndex)</div>
+<div class="line"><a name="l16477"></a><span class="lineno">16477</span>&#160;        {</div>
+<div class="line"><a name="l16478"></a><span class="lineno">16478</span>&#160;            m_Pools[poolIndex]-&gt;m_BlockVector.AddStats(pStats);</div>
+<div class="line"><a name="l16479"></a><span class="lineno">16479</span>&#160;        }</div>
+<div class="line"><a name="l16480"></a><span class="lineno">16480</span>&#160;    }</div>
+<div class="line"><a name="l16481"></a><span class="lineno">16481</span>&#160; </div>
+<div class="line"><a name="l16482"></a><span class="lineno">16482</span>&#160;    <span class="comment">// Process dedicated allocations.</span></div>
+<div class="line"><a name="l16483"></a><span class="lineno">16483</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
+<div class="line"><a name="l16484"></a><span class="lineno">16484</span>&#160;    {</div>
+<div class="line"><a name="l16485"></a><span class="lineno">16485</span>&#160;        <span class="keyword">const</span> uint32_t memHeapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);</div>
+<div class="line"><a name="l16486"></a><span class="lineno">16486</span>&#160;        VmaMutexLockRead dedicatedAllocationsLock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);</div>
+<div class="line"><a name="l16487"></a><span class="lineno">16487</span>&#160;        AllocationVectorType* <span class="keyword">const</span> pDedicatedAllocVector = m_pDedicatedAllocations[memTypeIndex];</div>
+<div class="line"><a name="l16488"></a><span class="lineno">16488</span>&#160;        VMA_ASSERT(pDedicatedAllocVector);</div>
+<div class="line"><a name="l16489"></a><span class="lineno">16489</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> allocIndex = 0, allocCount = pDedicatedAllocVector-&gt;size(); allocIndex &lt; allocCount; ++allocIndex)</div>
+<div class="line"><a name="l16490"></a><span class="lineno">16490</span>&#160;        {</div>
+<div class="line"><a name="l16491"></a><span class="lineno">16491</span>&#160;            <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> allocationStatInfo;</div>
+<div class="line"><a name="l16492"></a><span class="lineno">16492</span>&#160;            (*pDedicatedAllocVector)[allocIndex]-&gt;DedicatedAllocCalcStatsInfo(allocationStatInfo);</div>
+<div class="line"><a name="l16493"></a><span class="lineno">16493</span>&#160;            VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>, allocationStatInfo);</div>
+<div class="line"><a name="l16494"></a><span class="lineno">16494</span>&#160;            VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[memTypeIndex], allocationStatInfo);</div>
+<div class="line"><a name="l16495"></a><span class="lineno">16495</span>&#160;            VmaAddStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[memHeapIndex], allocationStatInfo);</div>
+<div class="line"><a name="l16496"></a><span class="lineno">16496</span>&#160;        }</div>
+<div class="line"><a name="l16497"></a><span class="lineno">16497</span>&#160;    }</div>
+<div class="line"><a name="l16498"></a><span class="lineno">16498</span>&#160; </div>
+<div class="line"><a name="l16499"></a><span class="lineno">16499</span>&#160;    <span class="comment">// Postprocess.</span></div>
+<div class="line"><a name="l16500"></a><span class="lineno">16500</span>&#160;    VmaPostprocessCalcStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>);</div>
+<div class="line"><a name="l16501"></a><span class="lineno">16501</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; GetMemoryTypeCount(); ++i)</div>
+<div class="line"><a name="l16502"></a><span class="lineno">16502</span>&#160;        VmaPostprocessCalcStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[i]);</div>
+<div class="line"><a name="l16503"></a><span class="lineno">16503</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; GetMemoryHeapCount(); ++i)</div>
+<div class="line"><a name="l16504"></a><span class="lineno">16504</span>&#160;        VmaPostprocessCalcStatInfo(pStats-&gt;<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[i]);</div>
+<div class="line"><a name="l16505"></a><span class="lineno">16505</span>&#160;}</div>
+<div class="line"><a name="l16506"></a><span class="lineno">16506</span>&#160; </div>
+<div class="line"><a name="l16507"></a><span class="lineno">16507</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::GetBudget(<a class="code" href="struct_vma_budget.html">VmaBudget</a>* outBudget, uint32_t firstHeap, uint32_t heapCount)</div>
+<div class="line"><a name="l16508"></a><span class="lineno">16508</span>&#160;{</div>
+<div class="line"><a name="l16509"></a><span class="lineno">16509</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l16510"></a><span class="lineno">16510</span>&#160;    <span class="keywordflow">if</span>(m_UseExtMemoryBudget)</div>
+<div class="line"><a name="l16511"></a><span class="lineno">16511</span>&#160;    {</div>
+<div class="line"><a name="l16512"></a><span class="lineno">16512</span>&#160;        <span class="keywordflow">if</span>(m_Budget.m_OperationsSinceBudgetFetch &lt; 30)</div>
+<div class="line"><a name="l16513"></a><span class="lineno">16513</span>&#160;        {</div>
+<div class="line"><a name="l16514"></a><span class="lineno">16514</span>&#160;            VmaMutexLockRead lockRead(m_Budget.m_BudgetMutex, m_UseMutex);</div>
+<div class="line"><a name="l16515"></a><span class="lineno">16515</span>&#160;            <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; heapCount; ++i, ++outBudget)</div>
+<div class="line"><a name="l16516"></a><span class="lineno">16516</span>&#160;            {</div>
+<div class="line"><a name="l16517"></a><span class="lineno">16517</span>&#160;                <span class="keyword">const</span> uint32_t heapIndex = firstHeap + i;</div>
+<div class="line"><a name="l16518"></a><span class="lineno">16518</span>&#160; </div>
+<div class="line"><a name="l16519"></a><span class="lineno">16519</span>&#160;                outBudget-&gt;<a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a> = m_Budget.m_BlockBytes[heapIndex];</div>
+<div class="line"><a name="l16520"></a><span class="lineno">16520</span>&#160;                outBudget-&gt;<a class="code" href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8">allocationBytes</a> = m_Budget.m_AllocationBytes[heapIndex];</div>
+<div class="line"><a name="l16521"></a><span class="lineno">16521</span>&#160; </div>
+<div class="line"><a name="l16522"></a><span class="lineno">16522</span>&#160;                <span class="keywordflow">if</span>(m_Budget.m_VulkanUsage[heapIndex] + outBudget-&gt;<a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a> &gt; m_Budget.m_BlockBytesAtBudgetFetch[heapIndex])</div>
+<div class="line"><a name="l16523"></a><span class="lineno">16523</span>&#160;                {</div>
+<div class="line"><a name="l16524"></a><span class="lineno">16524</span>&#160;                    outBudget-&gt;<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> = m_Budget.m_VulkanUsage[heapIndex] +</div>
+<div class="line"><a name="l16525"></a><span class="lineno">16525</span>&#160;                        outBudget-&gt;<a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a> - m_Budget.m_BlockBytesAtBudgetFetch[heapIndex];</div>
+<div class="line"><a name="l16526"></a><span class="lineno">16526</span>&#160;                }</div>
+<div class="line"><a name="l16527"></a><span class="lineno">16527</span>&#160;                <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16528"></a><span class="lineno">16528</span>&#160;                {</div>
+<div class="line"><a name="l16529"></a><span class="lineno">16529</span>&#160;                    outBudget-&gt;<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> = 0;</div>
+<div class="line"><a name="l16530"></a><span class="lineno">16530</span>&#160;                }</div>
+<div class="line"><a name="l16531"></a><span class="lineno">16531</span>&#160; </div>
+<div class="line"><a name="l16532"></a><span class="lineno">16532</span>&#160;                <span class="comment">// Have to take MIN with heap size because explicit HeapSizeLimit is included in it.</span></div>
+<div class="line"><a name="l16533"></a><span class="lineno">16533</span>&#160;                outBudget-&gt;<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a> = VMA_MIN(</div>
+<div class="line"><a name="l16534"></a><span class="lineno">16534</span>&#160;                    m_Budget.m_VulkanBudget[heapIndex], m_MemProps.memoryHeaps[heapIndex].size);</div>
+<div class="line"><a name="l16535"></a><span class="lineno">16535</span>&#160;            }</div>
+<div class="line"><a name="l16536"></a><span class="lineno">16536</span>&#160;        }</div>
+<div class="line"><a name="l16537"></a><span class="lineno">16537</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16538"></a><span class="lineno">16538</span>&#160;        {</div>
+<div class="line"><a name="l16539"></a><span class="lineno">16539</span>&#160;            UpdateVulkanBudget(); <span class="comment">// Outside of mutex lock</span></div>
+<div class="line"><a name="l16540"></a><span class="lineno">16540</span>&#160;            GetBudget(outBudget, firstHeap, heapCount); <span class="comment">// Recursion</span></div>
+<div class="line"><a name="l16541"></a><span class="lineno">16541</span>&#160;        }</div>
+<div class="line"><a name="l16542"></a><span class="lineno">16542</span>&#160;    }</div>
+<div class="line"><a name="l16543"></a><span class="lineno">16543</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16544"></a><span class="lineno">16544</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l16545"></a><span class="lineno">16545</span>&#160;    {</div>
+<div class="line"><a name="l16546"></a><span class="lineno">16546</span>&#160;        <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; heapCount; ++i, ++outBudget)</div>
+<div class="line"><a name="l16547"></a><span class="lineno">16547</span>&#160;        {</div>
+<div class="line"><a name="l16548"></a><span class="lineno">16548</span>&#160;            <span class="keyword">const</span> uint32_t heapIndex = firstHeap + i;</div>
+<div class="line"><a name="l16549"></a><span class="lineno">16549</span>&#160; </div>
+<div class="line"><a name="l16550"></a><span class="lineno">16550</span>&#160;            outBudget-&gt;<a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a> = m_Budget.m_BlockBytes[heapIndex];</div>
+<div class="line"><a name="l16551"></a><span class="lineno">16551</span>&#160;            outBudget-&gt;<a class="code" href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8">allocationBytes</a> = m_Budget.m_AllocationBytes[heapIndex];</div>
+<div class="line"><a name="l16552"></a><span class="lineno">16552</span>&#160; </div>
+<div class="line"><a name="l16553"></a><span class="lineno">16553</span>&#160;            outBudget-&gt;<a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a> = outBudget-&gt;<a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a>;</div>
+<div class="line"><a name="l16554"></a><span class="lineno">16554</span>&#160;            outBudget-&gt;<a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a> = m_MemProps.memoryHeaps[heapIndex].size * 8 / 10; <span class="comment">// 80% heuristics.</span></div>
+<div class="line"><a name="l16555"></a><span class="lineno">16555</span>&#160;        }</div>
+<div class="line"><a name="l16556"></a><span class="lineno">16556</span>&#160;    }</div>
+<div class="line"><a name="l16557"></a><span class="lineno">16557</span>&#160;}</div>
+<div class="line"><a name="l16558"></a><span class="lineno">16558</span>&#160; </div>
+<div class="line"><a name="l16559"></a><span class="lineno">16559</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_VENDOR_ID_AMD = 4098;</div>
+<div class="line"><a name="l16560"></a><span class="lineno">16560</span>&#160; </div>
+<div class="line"><a name="l16561"></a><span class="lineno">16561</span>&#160;VkResult VmaAllocator_T::DefragmentationBegin(</div>
+<div class="line"><a name="l16562"></a><span class="lineno">16562</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>&amp; info,</div>
+<div class="line"><a name="l16563"></a><span class="lineno">16563</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats,</div>
+<div class="line"><a name="l16564"></a><span class="lineno">16564</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a>* pContext)</div>
+<div class="line"><a name="l16565"></a><span class="lineno">16565</span>&#160;{</div>
+<div class="line"><a name="l16566"></a><span class="lineno">16566</span>&#160;    <span class="keywordflow">if</span>(info.<a class="code" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">pAllocationsChanged</a> != VMA_NULL)</div>
+<div class="line"><a name="l16567"></a><span class="lineno">16567</span>&#160;    {</div>
+<div class="line"><a name="l16568"></a><span class="lineno">16568</span>&#160;        memset(info.<a class="code" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">pAllocationsChanged</a>, 0, info.<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a> * <span class="keyword">sizeof</span>(VkBool32));</div>
+<div class="line"><a name="l16569"></a><span class="lineno">16569</span>&#160;    }</div>
+<div class="line"><a name="l16570"></a><span class="lineno">16570</span>&#160; </div>
+<div class="line"><a name="l16571"></a><span class="lineno">16571</span>&#160;    *pContext = vma_new(<span class="keyword">this</span>, VmaDefragmentationContext_T)(</div>
+<div class="line"><a name="l16572"></a><span class="lineno">16572</span>&#160;        <span class="keyword">this</span>, m_CurrentFrameIndex.load(), info.<a class="code" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9">flags</a>, pStats);</div>
+<div class="line"><a name="l16573"></a><span class="lineno">16573</span>&#160; </div>
+<div class="line"><a name="l16574"></a><span class="lineno">16574</span>&#160;    (*pContext)-&gt;AddPools(info.<a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">pPools</a>);</div>
+<div class="line"><a name="l16575"></a><span class="lineno">16575</span>&#160;    (*pContext)-&gt;AddAllocations(</div>
+<div class="line"><a name="l16576"></a><span class="lineno">16576</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">pAllocationsChanged</a>);</div>
+<div class="line"><a name="l16577"></a><span class="lineno">16577</span>&#160; </div>
+<div class="line"><a name="l16578"></a><span class="lineno">16578</span>&#160;    VkResult res = (*pContext)-&gt;Defragment(</div>
+<div class="line"><a name="l16579"></a><span class="lineno">16579</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">maxCpuBytesToMove</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">maxCpuAllocationsToMove</a>,</div>
+<div class="line"><a name="l16580"></a><span class="lineno">16580</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08">maxGpuBytesToMove</a>, info.<a class="code" href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6">maxGpuAllocationsToMove</a>,</div>
+<div class="line"><a name="l16581"></a><span class="lineno">16581</span>&#160;        info.<a class="code" href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd">commandBuffer</a>, pStats, info.<a class="code" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9">flags</a>);</div>
+<div class="line"><a name="l16582"></a><span class="lineno">16582</span>&#160; </div>
+<div class="line"><a name="l16583"></a><span class="lineno">16583</span>&#160;    <span class="keywordflow">if</span>(res != VK_NOT_READY)</div>
+<div class="line"><a name="l16584"></a><span class="lineno">16584</span>&#160;    {</div>
+<div class="line"><a name="l16585"></a><span class="lineno">16585</span>&#160;        vma_delete(<span class="keyword">this</span>, *pContext);</div>
+<div class="line"><a name="l16586"></a><span class="lineno">16586</span>&#160;        *pContext = VMA_NULL;</div>
+<div class="line"><a name="l16587"></a><span class="lineno">16587</span>&#160;    }</div>
 <div class="line"><a name="l16588"></a><span class="lineno">16588</span>&#160; </div>
-<div class="line"><a name="l16589"></a><span class="lineno">16589</span>&#160;VkResult VmaAllocator_T::CheckPoolCorruption(<a class="code" href="struct_vma_pool.html">VmaPool</a> hPool)</div>
-<div class="line"><a name="l16590"></a><span class="lineno">16590</span>&#160;{</div>
-<div class="line"><a name="l16591"></a><span class="lineno">16591</span>&#160;    <span class="keywordflow">return</span> hPool-&gt;m_BlockVector.CheckCorruption();</div>
-<div class="line"><a name="l16592"></a><span class="lineno">16592</span>&#160;}</div>
-<div class="line"><a name="l16593"></a><span class="lineno">16593</span>&#160; </div>
-<div class="line"><a name="l16594"></a><span class="lineno">16594</span>&#160;VkResult VmaAllocator_T::CheckCorruption(uint32_t memoryTypeBits)</div>
-<div class="line"><a name="l16595"></a><span class="lineno">16595</span>&#160;{</div>
-<div class="line"><a name="l16596"></a><span class="lineno">16596</span>&#160;    VkResult finalRes = VK_ERROR_FEATURE_NOT_PRESENT;</div>
-<div class="line"><a name="l16597"></a><span class="lineno">16597</span>&#160; </div>
-<div class="line"><a name="l16598"></a><span class="lineno">16598</span>&#160;    <span class="comment">// Process default pools.</span></div>
-<div class="line"><a name="l16599"></a><span class="lineno">16599</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
-<div class="line"><a name="l16600"></a><span class="lineno">16600</span>&#160;    {</div>
-<div class="line"><a name="l16601"></a><span class="lineno">16601</span>&#160;        <span class="keywordflow">if</span>(((1u &lt;&lt; memTypeIndex) &amp; memoryTypeBits) != 0)</div>
-<div class="line"><a name="l16602"></a><span class="lineno">16602</span>&#160;        {</div>
-<div class="line"><a name="l16603"></a><span class="lineno">16603</span>&#160;            VmaBlockVector* <span class="keyword">const</span> pBlockVector = m_pBlockVectors[memTypeIndex];</div>
-<div class="line"><a name="l16604"></a><span class="lineno">16604</span>&#160;            VMA_ASSERT(pBlockVector);</div>
-<div class="line"><a name="l16605"></a><span class="lineno">16605</span>&#160;            VkResult localRes = pBlockVector-&gt;CheckCorruption();</div>
-<div class="line"><a name="l16606"></a><span class="lineno">16606</span>&#160;            <span class="keywordflow">switch</span>(localRes)</div>
-<div class="line"><a name="l16607"></a><span class="lineno">16607</span>&#160;            {</div>
-<div class="line"><a name="l16608"></a><span class="lineno">16608</span>&#160;            <span class="keywordflow">case</span> VK_ERROR_FEATURE_NOT_PRESENT:</div>
-<div class="line"><a name="l16609"></a><span class="lineno">16609</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16610"></a><span class="lineno">16610</span>&#160;            <span class="keywordflow">case</span> VK_SUCCESS:</div>
-<div class="line"><a name="l16611"></a><span class="lineno">16611</span>&#160;                finalRes = VK_SUCCESS;</div>
-<div class="line"><a name="l16612"></a><span class="lineno">16612</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16613"></a><span class="lineno">16613</span>&#160;            <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l16614"></a><span class="lineno">16614</span>&#160;                <span class="keywordflow">return</span> localRes;</div>
-<div class="line"><a name="l16615"></a><span class="lineno">16615</span>&#160;            }</div>
-<div class="line"><a name="l16616"></a><span class="lineno">16616</span>&#160;        }</div>
-<div class="line"><a name="l16617"></a><span class="lineno">16617</span>&#160;    }</div>
-<div class="line"><a name="l16618"></a><span class="lineno">16618</span>&#160; </div>
-<div class="line"><a name="l16619"></a><span class="lineno">16619</span>&#160;    <span class="comment">// Process custom pools.</span></div>
-<div class="line"><a name="l16620"></a><span class="lineno">16620</span>&#160;    {</div>
-<div class="line"><a name="l16621"></a><span class="lineno">16621</span>&#160;        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);</div>
-<div class="line"><a name="l16622"></a><span class="lineno">16622</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> poolIndex = 0, poolCount = m_Pools.size(); poolIndex &lt; poolCount; ++poolIndex)</div>
+<div class="line"><a name="l16589"></a><span class="lineno">16589</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l16590"></a><span class="lineno">16590</span>&#160;}</div>
+<div class="line"><a name="l16591"></a><span class="lineno">16591</span>&#160; </div>
+<div class="line"><a name="l16592"></a><span class="lineno">16592</span>&#160;VkResult VmaAllocator_T::DefragmentationEnd(</div>
+<div class="line"><a name="l16593"></a><span class="lineno">16593</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context)</div>
+<div class="line"><a name="l16594"></a><span class="lineno">16594</span>&#160;{</div>
+<div class="line"><a name="l16595"></a><span class="lineno">16595</span>&#160;    vma_delete(<span class="keyword">this</span>, context);</div>
+<div class="line"><a name="l16596"></a><span class="lineno">16596</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l16597"></a><span class="lineno">16597</span>&#160;}</div>
+<div class="line"><a name="l16598"></a><span class="lineno">16598</span>&#160; </div>
+<div class="line"><a name="l16599"></a><span class="lineno">16599</span>&#160;VkResult VmaAllocator_T::DefragmentationPassBegin(</div>
+<div class="line"><a name="l16600"></a><span class="lineno">16600</span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* pInfo,</div>
+<div class="line"><a name="l16601"></a><span class="lineno">16601</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context)</div>
+<div class="line"><a name="l16602"></a><span class="lineno">16602</span>&#160;{</div>
+<div class="line"><a name="l16603"></a><span class="lineno">16603</span>&#160;    <span class="keywordflow">return</span> context-&gt;DefragmentPassBegin(pInfo);</div>
+<div class="line"><a name="l16604"></a><span class="lineno">16604</span>&#160;}</div>
+<div class="line"><a name="l16605"></a><span class="lineno">16605</span>&#160;VkResult VmaAllocator_T::DefragmentationPassEnd(</div>
+<div class="line"><a name="l16606"></a><span class="lineno">16606</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context)</div>
+<div class="line"><a name="l16607"></a><span class="lineno">16607</span>&#160;{</div>
+<div class="line"><a name="l16608"></a><span class="lineno">16608</span>&#160;    <span class="keywordflow">return</span> context-&gt;DefragmentPassEnd();</div>
+<div class="line"><a name="l16609"></a><span class="lineno">16609</span>&#160;    </div>
+<div class="line"><a name="l16610"></a><span class="lineno">16610</span>&#160;}</div>
+<div class="line"><a name="l16611"></a><span class="lineno">16611</span>&#160; </div>
+<div class="line"><a name="l16612"></a><span class="lineno">16612</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::GetAllocationInfo(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
+<div class="line"><a name="l16613"></a><span class="lineno">16613</span>&#160;{</div>
+<div class="line"><a name="l16614"></a><span class="lineno">16614</span>&#160;    <span class="keywordflow">if</span>(hAllocation-&gt;CanBecomeLost())</div>
+<div class="line"><a name="l16615"></a><span class="lineno">16615</span>&#160;    {</div>
+<div class="line"><a name="l16616"></a><span class="lineno">16616</span>&#160;        <span class="comment">/*</span></div>
+<div class="line"><a name="l16617"></a><span class="lineno">16617</span>&#160;<span class="comment">        Warning: This is a carefully designed algorithm.</span></div>
+<div class="line"><a name="l16618"></a><span class="lineno">16618</span>&#160;<span class="comment">        Do not modify unless you really know what you&#39;re doing :)</span></div>
+<div class="line"><a name="l16619"></a><span class="lineno">16619</span>&#160;<span class="comment">        */</span></div>
+<div class="line"><a name="l16620"></a><span class="lineno">16620</span>&#160;        <span class="keyword">const</span> uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();</div>
+<div class="line"><a name="l16621"></a><span class="lineno">16621</span>&#160;        uint32_t localLastUseFrameIndex = hAllocation-&gt;GetLastUseFrameIndex();</div>
+<div class="line"><a name="l16622"></a><span class="lineno">16622</span>&#160;        <span class="keywordflow">for</span>(;;)</div>
 <div class="line"><a name="l16623"></a><span class="lineno">16623</span>&#160;        {</div>
-<div class="line"><a name="l16624"></a><span class="lineno">16624</span>&#160;            <span class="keywordflow">if</span>(((1u &lt;&lt; m_Pools[poolIndex]-&gt;m_BlockVector.GetMemoryTypeIndex()) &amp; memoryTypeBits) != 0)</div>
+<div class="line"><a name="l16624"></a><span class="lineno">16624</span>&#160;            <span class="keywordflow">if</span>(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)</div>
 <div class="line"><a name="l16625"></a><span class="lineno">16625</span>&#160;            {</div>
-<div class="line"><a name="l16626"></a><span class="lineno">16626</span>&#160;                VkResult localRes = m_Pools[poolIndex]-&gt;m_BlockVector.CheckCorruption();</div>
-<div class="line"><a name="l16627"></a><span class="lineno">16627</span>&#160;                <span class="keywordflow">switch</span>(localRes)</div>
-<div class="line"><a name="l16628"></a><span class="lineno">16628</span>&#160;                {</div>
-<div class="line"><a name="l16629"></a><span class="lineno">16629</span>&#160;                <span class="keywordflow">case</span> VK_ERROR_FEATURE_NOT_PRESENT:</div>
-<div class="line"><a name="l16630"></a><span class="lineno">16630</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16631"></a><span class="lineno">16631</span>&#160;                <span class="keywordflow">case</span> VK_SUCCESS:</div>
-<div class="line"><a name="l16632"></a><span class="lineno">16632</span>&#160;                    finalRes = VK_SUCCESS;</div>
-<div class="line"><a name="l16633"></a><span class="lineno">16633</span>&#160;                    <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16634"></a><span class="lineno">16634</span>&#160;                <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l16635"></a><span class="lineno">16635</span>&#160;                    <span class="keywordflow">return</span> localRes;</div>
-<div class="line"><a name="l16636"></a><span class="lineno">16636</span>&#160;                }</div>
-<div class="line"><a name="l16637"></a><span class="lineno">16637</span>&#160;            }</div>
-<div class="line"><a name="l16638"></a><span class="lineno">16638</span>&#160;        }</div>
-<div class="line"><a name="l16639"></a><span class="lineno">16639</span>&#160;    }</div>
-<div class="line"><a name="l16640"></a><span class="lineno">16640</span>&#160; </div>
-<div class="line"><a name="l16641"></a><span class="lineno">16641</span>&#160;    <span class="keywordflow">return</span> finalRes;</div>
-<div class="line"><a name="l16642"></a><span class="lineno">16642</span>&#160;}</div>
-<div class="line"><a name="l16643"></a><span class="lineno">16643</span>&#160; </div>
-<div class="line"><a name="l16644"></a><span class="lineno">16644</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::CreateLostAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation)</div>
-<div class="line"><a name="l16645"></a><span class="lineno">16645</span>&#160;{</div>
-<div class="line"><a name="l16646"></a><span class="lineno">16646</span>&#160;    *pAllocation = m_AllocationObjectAllocator.Allocate(VMA_FRAME_INDEX_LOST, <span class="keyword">false</span>);</div>
-<div class="line"><a name="l16647"></a><span class="lineno">16647</span>&#160;    (*pAllocation)-&gt;InitLost();</div>
-<div class="line"><a name="l16648"></a><span class="lineno">16648</span>&#160;}</div>
-<div class="line"><a name="l16649"></a><span class="lineno">16649</span>&#160; </div>
-<div class="line"><a name="l16650"></a><span class="lineno">16650</span>&#160;VkResult VmaAllocator_T::AllocateVulkanMemory(<span class="keyword">const</span> VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory)</div>
-<div class="line"><a name="l16651"></a><span class="lineno">16651</span>&#160;{</div>
-<div class="line"><a name="l16652"></a><span class="lineno">16652</span>&#160;    <span class="keyword">const</span> uint32_t heapIndex = MemoryTypeIndexToHeapIndex(pAllocateInfo-&gt;memoryTypeIndex);</div>
-<div class="line"><a name="l16653"></a><span class="lineno">16653</span>&#160; </div>
-<div class="line"><a name="l16654"></a><span class="lineno">16654</span>&#160;    <span class="comment">// HeapSizeLimit is in effect for this heap.</span></div>
-<div class="line"><a name="l16655"></a><span class="lineno">16655</span>&#160;    <span class="keywordflow">if</span>((m_HeapSizeLimitMask &amp; (1u &lt;&lt; heapIndex)) != 0)</div>
-<div class="line"><a name="l16656"></a><span class="lineno">16656</span>&#160;    {</div>
-<div class="line"><a name="l16657"></a><span class="lineno">16657</span>&#160;        <span class="keyword">const</span> VkDeviceSize heapSize = m_MemProps.memoryHeaps[heapIndex].size;</div>
-<div class="line"><a name="l16658"></a><span class="lineno">16658</span>&#160;        VkDeviceSize blockBytes = m_Budget.m_BlockBytes[heapIndex];</div>
-<div class="line"><a name="l16659"></a><span class="lineno">16659</span>&#160;        <span class="keywordflow">for</span>(;;)</div>
-<div class="line"><a name="l16660"></a><span class="lineno">16660</span>&#160;        {</div>
-<div class="line"><a name="l16661"></a><span class="lineno">16661</span>&#160;            <span class="keyword">const</span> VkDeviceSize blockBytesAfterAllocation = blockBytes + pAllocateInfo-&gt;allocationSize;</div>
-<div class="line"><a name="l16662"></a><span class="lineno">16662</span>&#160;            <span class="keywordflow">if</span>(blockBytesAfterAllocation &gt; heapSize)</div>
-<div class="line"><a name="l16663"></a><span class="lineno">16663</span>&#160;            {</div>
-<div class="line"><a name="l16664"></a><span class="lineno">16664</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
-<div class="line"><a name="l16665"></a><span class="lineno">16665</span>&#160;            }</div>
-<div class="line"><a name="l16666"></a><span class="lineno">16666</span>&#160;            <span class="keywordflow">if</span>(m_Budget.m_BlockBytes[heapIndex].compare_exchange_strong(blockBytes, blockBytesAfterAllocation))</div>
-<div class="line"><a name="l16667"></a><span class="lineno">16667</span>&#160;            {</div>
-<div class="line"><a name="l16668"></a><span class="lineno">16668</span>&#160;                <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16669"></a><span class="lineno">16669</span>&#160;            }</div>
-<div class="line"><a name="l16670"></a><span class="lineno">16670</span>&#160;        }</div>
-<div class="line"><a name="l16671"></a><span class="lineno">16671</span>&#160;    }</div>
-<div class="line"><a name="l16672"></a><span class="lineno">16672</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16673"></a><span class="lineno">16673</span>&#160;    {</div>
-<div class="line"><a name="l16674"></a><span class="lineno">16674</span>&#160;        m_Budget.m_BlockBytes[heapIndex] += pAllocateInfo-&gt;allocationSize;</div>
-<div class="line"><a name="l16675"></a><span class="lineno">16675</span>&#160;    }</div>
-<div class="line"><a name="l16676"></a><span class="lineno">16676</span>&#160; </div>
-<div class="line"><a name="l16677"></a><span class="lineno">16677</span>&#160;    <span class="comment">// VULKAN CALL vkAllocateMemory.</span></div>
-<div class="line"><a name="l16678"></a><span class="lineno">16678</span>&#160;    VkResult res = (*m_VulkanFunctions.vkAllocateMemory)(m_hDevice, pAllocateInfo, GetAllocationCallbacks(), pMemory);</div>
-<div class="line"><a name="l16679"></a><span class="lineno">16679</span>&#160; </div>
-<div class="line"><a name="l16680"></a><span class="lineno">16680</span>&#160;    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l16681"></a><span class="lineno">16681</span>&#160;    {</div>
-<div class="line"><a name="l16682"></a><span class="lineno">16682</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l16683"></a><span class="lineno">16683</span>&#160;        ++m_Budget.m_OperationsSinceBudgetFetch;</div>
-<div class="line"><a name="l16684"></a><span class="lineno">16684</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l16685"></a><span class="lineno">16685</span>&#160; </div>
-<div class="line"><a name="l16686"></a><span class="lineno">16686</span>&#160;        <span class="comment">// Informative callback.</span></div>
-<div class="line"><a name="l16687"></a><span class="lineno">16687</span>&#160;        <span class="keywordflow">if</span>(m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">pfnAllocate</a> != VMA_NULL)</div>
-<div class="line"><a name="l16688"></a><span class="lineno">16688</span>&#160;        {</div>
-<div class="line"><a name="l16689"></a><span class="lineno">16689</span>&#160;            (*m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">pfnAllocate</a>)(<span class="keyword">this</span>, pAllocateInfo-&gt;memoryTypeIndex, *pMemory, pAllocateInfo-&gt;allocationSize, m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">pUserData</a>);</div>
-<div class="line"><a name="l16690"></a><span class="lineno">16690</span>&#160;        }</div>
-<div class="line"><a name="l16691"></a><span class="lineno">16691</span>&#160;    }</div>
-<div class="line"><a name="l16692"></a><span class="lineno">16692</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16693"></a><span class="lineno">16693</span>&#160;    {</div>
-<div class="line"><a name="l16694"></a><span class="lineno">16694</span>&#160;        m_Budget.m_BlockBytes[heapIndex] -= pAllocateInfo-&gt;allocationSize;</div>
-<div class="line"><a name="l16695"></a><span class="lineno">16695</span>&#160;    }</div>
-<div class="line"><a name="l16696"></a><span class="lineno">16696</span>&#160; </div>
-<div class="line"><a name="l16697"></a><span class="lineno">16697</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l16698"></a><span class="lineno">16698</span>&#160;}</div>
-<div class="line"><a name="l16699"></a><span class="lineno">16699</span>&#160; </div>
-<div class="line"><a name="l16700"></a><span class="lineno">16700</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, VkDeviceMemory hMemory)</div>
-<div class="line"><a name="l16701"></a><span class="lineno">16701</span>&#160;{</div>
-<div class="line"><a name="l16702"></a><span class="lineno">16702</span>&#160;    <span class="comment">// Informative callback.</span></div>
-<div class="line"><a name="l16703"></a><span class="lineno">16703</span>&#160;    <span class="keywordflow">if</span>(m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">pfnFree</a> != VMA_NULL)</div>
-<div class="line"><a name="l16704"></a><span class="lineno">16704</span>&#160;    {</div>
-<div class="line"><a name="l16705"></a><span class="lineno">16705</span>&#160;        (*m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">pfnFree</a>)(<span class="keyword">this</span>, memoryType, hMemory, size, m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">pUserData</a>);</div>
-<div class="line"><a name="l16706"></a><span class="lineno">16706</span>&#160;    }</div>
-<div class="line"><a name="l16707"></a><span class="lineno">16707</span>&#160; </div>
-<div class="line"><a name="l16708"></a><span class="lineno">16708</span>&#160;    <span class="comment">// VULKAN CALL vkFreeMemory.</span></div>
-<div class="line"><a name="l16709"></a><span class="lineno">16709</span>&#160;    (*m_VulkanFunctions.vkFreeMemory)(m_hDevice, hMemory, GetAllocationCallbacks());</div>
-<div class="line"><a name="l16710"></a><span class="lineno">16710</span>&#160; </div>
-<div class="line"><a name="l16711"></a><span class="lineno">16711</span>&#160;    m_Budget.m_BlockBytes[MemoryTypeIndexToHeapIndex(memoryType)] -= size;</div>
-<div class="line"><a name="l16712"></a><span class="lineno">16712</span>&#160;}</div>
-<div class="line"><a name="l16713"></a><span class="lineno">16713</span>&#160; </div>
-<div class="line"><a name="l16714"></a><span class="lineno">16714</span>&#160;VkResult VmaAllocator_T::BindVulkanBuffer(</div>
-<div class="line"><a name="l16715"></a><span class="lineno">16715</span>&#160;    VkDeviceMemory memory,</div>
-<div class="line"><a name="l16716"></a><span class="lineno">16716</span>&#160;    VkDeviceSize memoryOffset,</div>
-<div class="line"><a name="l16717"></a><span class="lineno">16717</span>&#160;    VkBuffer buffer,</div>
-<div class="line"><a name="l16718"></a><span class="lineno">16718</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
-<div class="line"><a name="l16719"></a><span class="lineno">16719</span>&#160;{</div>
-<div class="line"><a name="l16720"></a><span class="lineno">16720</span>&#160;    <span class="keywordflow">if</span>(pNext != VMA_NULL)</div>
-<div class="line"><a name="l16721"></a><span class="lineno">16721</span>&#160;    {</div>
-<div class="line"><a name="l16722"></a><span class="lineno">16722</span>&#160;<span class="preprocessor">#if VMA_VULKAN_VERSION &gt;= 1001000 || VMA_BIND_MEMORY2</span></div>
-<div class="line"><a name="l16723"></a><span class="lineno">16723</span>&#160;        <span class="keywordflow">if</span>((m_UseKhrBindMemory2 || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0)) &amp;&amp;</div>
-<div class="line"><a name="l16724"></a><span class="lineno">16724</span>&#160;            m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL)</div>
-<div class="line"><a name="l16725"></a><span class="lineno">16725</span>&#160;        {</div>
-<div class="line"><a name="l16726"></a><span class="lineno">16726</span>&#160;            VkBindBufferMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR };</div>
-<div class="line"><a name="l16727"></a><span class="lineno">16727</span>&#160;            bindBufferMemoryInfo.pNext = pNext;</div>
-<div class="line"><a name="l16728"></a><span class="lineno">16728</span>&#160;            bindBufferMemoryInfo.buffer = buffer;</div>
-<div class="line"><a name="l16729"></a><span class="lineno">16729</span>&#160;            bindBufferMemoryInfo.memory = memory;</div>
-<div class="line"><a name="l16730"></a><span class="lineno">16730</span>&#160;            bindBufferMemoryInfo.memoryOffset = memoryOffset;</div>
-<div class="line"><a name="l16731"></a><span class="lineno">16731</span>&#160;            <span class="keywordflow">return</span> (*m_VulkanFunctions.vkBindBufferMemory2KHR)(m_hDevice, 1, &amp;bindBufferMemoryInfo);</div>
-<div class="line"><a name="l16732"></a><span class="lineno">16732</span>&#160;        }</div>
-<div class="line"><a name="l16733"></a><span class="lineno">16733</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16734"></a><span class="lineno">16734</span>&#160;<span class="preprocessor">#endif // #if VMA_VULKAN_VERSION &gt;= 1001000 || VMA_BIND_MEMORY2</span></div>
-<div class="line"><a name="l16735"></a><span class="lineno">16735</span>&#160;        {</div>
-<div class="line"><a name="l16736"></a><span class="lineno">16736</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_EXTENSION_NOT_PRESENT;</div>
-<div class="line"><a name="l16737"></a><span class="lineno">16737</span>&#160;        }</div>
-<div class="line"><a name="l16738"></a><span class="lineno">16738</span>&#160;    }</div>
-<div class="line"><a name="l16739"></a><span class="lineno">16739</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16740"></a><span class="lineno">16740</span>&#160;    {</div>
-<div class="line"><a name="l16741"></a><span class="lineno">16741</span>&#160;        <span class="keywordflow">return</span> (*m_VulkanFunctions.vkBindBufferMemory)(m_hDevice, buffer, memory, memoryOffset);</div>
-<div class="line"><a name="l16742"></a><span class="lineno">16742</span>&#160;    }</div>
-<div class="line"><a name="l16743"></a><span class="lineno">16743</span>&#160;}</div>
-<div class="line"><a name="l16744"></a><span class="lineno">16744</span>&#160; </div>
-<div class="line"><a name="l16745"></a><span class="lineno">16745</span>&#160;VkResult VmaAllocator_T::BindVulkanImage(</div>
-<div class="line"><a name="l16746"></a><span class="lineno">16746</span>&#160;    VkDeviceMemory memory,</div>
-<div class="line"><a name="l16747"></a><span class="lineno">16747</span>&#160;    VkDeviceSize memoryOffset,</div>
-<div class="line"><a name="l16748"></a><span class="lineno">16748</span>&#160;    VkImage image,</div>
-<div class="line"><a name="l16749"></a><span class="lineno">16749</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
-<div class="line"><a name="l16750"></a><span class="lineno">16750</span>&#160;{</div>
-<div class="line"><a name="l16751"></a><span class="lineno">16751</span>&#160;    <span class="keywordflow">if</span>(pNext != VMA_NULL)</div>
-<div class="line"><a name="l16752"></a><span class="lineno">16752</span>&#160;    {</div>
-<div class="line"><a name="l16753"></a><span class="lineno">16753</span>&#160;<span class="preprocessor">#if VMA_VULKAN_VERSION &gt;= 1001000 || VMA_BIND_MEMORY2</span></div>
-<div class="line"><a name="l16754"></a><span class="lineno">16754</span>&#160;        <span class="keywordflow">if</span>((m_UseKhrBindMemory2 || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0)) &amp;&amp;</div>
-<div class="line"><a name="l16755"></a><span class="lineno">16755</span>&#160;            m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL)</div>
-<div class="line"><a name="l16756"></a><span class="lineno">16756</span>&#160;        {</div>
-<div class="line"><a name="l16757"></a><span class="lineno">16757</span>&#160;            VkBindImageMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR };</div>
-<div class="line"><a name="l16758"></a><span class="lineno">16758</span>&#160;            bindBufferMemoryInfo.pNext = pNext;</div>
-<div class="line"><a name="l16759"></a><span class="lineno">16759</span>&#160;            bindBufferMemoryInfo.image = image;</div>
-<div class="line"><a name="l16760"></a><span class="lineno">16760</span>&#160;            bindBufferMemoryInfo.memory = memory;</div>
-<div class="line"><a name="l16761"></a><span class="lineno">16761</span>&#160;            bindBufferMemoryInfo.memoryOffset = memoryOffset;</div>
-<div class="line"><a name="l16762"></a><span class="lineno">16762</span>&#160;            <span class="keywordflow">return</span> (*m_VulkanFunctions.vkBindImageMemory2KHR)(m_hDevice, 1, &amp;bindBufferMemoryInfo);</div>
-<div class="line"><a name="l16763"></a><span class="lineno">16763</span>&#160;        }</div>
-<div class="line"><a name="l16764"></a><span class="lineno">16764</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16765"></a><span class="lineno">16765</span>&#160;<span class="preprocessor">#endif // #if VMA_BIND_MEMORY2</span></div>
-<div class="line"><a name="l16766"></a><span class="lineno">16766</span>&#160;        {</div>
-<div class="line"><a name="l16767"></a><span class="lineno">16767</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_EXTENSION_NOT_PRESENT;</div>
-<div class="line"><a name="l16768"></a><span class="lineno">16768</span>&#160;        }</div>
-<div class="line"><a name="l16769"></a><span class="lineno">16769</span>&#160;    }</div>
-<div class="line"><a name="l16770"></a><span class="lineno">16770</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16771"></a><span class="lineno">16771</span>&#160;    {</div>
-<div class="line"><a name="l16772"></a><span class="lineno">16772</span>&#160;        <span class="keywordflow">return</span> (*m_VulkanFunctions.vkBindImageMemory)(m_hDevice, image, memory, memoryOffset);</div>
-<div class="line"><a name="l16773"></a><span class="lineno">16773</span>&#160;    }</div>
-<div class="line"><a name="l16774"></a><span class="lineno">16774</span>&#160;}</div>
+<div class="line"><a name="l16626"></a><span class="lineno">16626</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">memoryType</a> = UINT32_MAX;</div>
+<div class="line"><a name="l16627"></a><span class="lineno">16627</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">deviceMemory</a> = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l16628"></a><span class="lineno">16628</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">offset</a> = 0;</div>
+<div class="line"><a name="l16629"></a><span class="lineno">16629</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f">size</a> = hAllocation-&gt;GetSize();</div>
+<div class="line"><a name="l16630"></a><span class="lineno">16630</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a> = VMA_NULL;</div>
+<div class="line"><a name="l16631"></a><span class="lineno">16631</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a> = hAllocation-&gt;GetUserData();</div>
+<div class="line"><a name="l16632"></a><span class="lineno">16632</span>&#160;                <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l16633"></a><span class="lineno">16633</span>&#160;            }</div>
+<div class="line"><a name="l16634"></a><span class="lineno">16634</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span>(localLastUseFrameIndex == localCurrFrameIndex)</div>
+<div class="line"><a name="l16635"></a><span class="lineno">16635</span>&#160;            {</div>
+<div class="line"><a name="l16636"></a><span class="lineno">16636</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">memoryType</a> = hAllocation-&gt;GetMemoryTypeIndex();</div>
+<div class="line"><a name="l16637"></a><span class="lineno">16637</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">deviceMemory</a> = hAllocation-&gt;GetMemory();</div>
+<div class="line"><a name="l16638"></a><span class="lineno">16638</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">offset</a> = hAllocation-&gt;GetOffset();</div>
+<div class="line"><a name="l16639"></a><span class="lineno">16639</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f">size</a> = hAllocation-&gt;GetSize();</div>
+<div class="line"><a name="l16640"></a><span class="lineno">16640</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a> = VMA_NULL;</div>
+<div class="line"><a name="l16641"></a><span class="lineno">16641</span>&#160;                pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a> = hAllocation-&gt;GetUserData();</div>
+<div class="line"><a name="l16642"></a><span class="lineno">16642</span>&#160;                <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l16643"></a><span class="lineno">16643</span>&#160;            }</div>
+<div class="line"><a name="l16644"></a><span class="lineno">16644</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// Last use time earlier than current time.</span></div>
+<div class="line"><a name="l16645"></a><span class="lineno">16645</span>&#160;            {</div>
+<div class="line"><a name="l16646"></a><span class="lineno">16646</span>&#160;                <span class="keywordflow">if</span>(hAllocation-&gt;CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))</div>
+<div class="line"><a name="l16647"></a><span class="lineno">16647</span>&#160;                {</div>
+<div class="line"><a name="l16648"></a><span class="lineno">16648</span>&#160;                    localLastUseFrameIndex = localCurrFrameIndex;</div>
+<div class="line"><a name="l16649"></a><span class="lineno">16649</span>&#160;                }</div>
+<div class="line"><a name="l16650"></a><span class="lineno">16650</span>&#160;            }</div>
+<div class="line"><a name="l16651"></a><span class="lineno">16651</span>&#160;        }</div>
+<div class="line"><a name="l16652"></a><span class="lineno">16652</span>&#160;    }</div>
+<div class="line"><a name="l16653"></a><span class="lineno">16653</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16654"></a><span class="lineno">16654</span>&#160;    {</div>
+<div class="line"><a name="l16655"></a><span class="lineno">16655</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l16656"></a><span class="lineno">16656</span>&#160;        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();</div>
+<div class="line"><a name="l16657"></a><span class="lineno">16657</span>&#160;        uint32_t localLastUseFrameIndex = hAllocation-&gt;GetLastUseFrameIndex();</div>
+<div class="line"><a name="l16658"></a><span class="lineno">16658</span>&#160;        <span class="keywordflow">for</span>(;;)</div>
+<div class="line"><a name="l16659"></a><span class="lineno">16659</span>&#160;        {</div>
+<div class="line"><a name="l16660"></a><span class="lineno">16660</span>&#160;            VMA_ASSERT(localLastUseFrameIndex != VMA_FRAME_INDEX_LOST);</div>
+<div class="line"><a name="l16661"></a><span class="lineno">16661</span>&#160;            <span class="keywordflow">if</span>(localLastUseFrameIndex == localCurrFrameIndex)</div>
+<div class="line"><a name="l16662"></a><span class="lineno">16662</span>&#160;            {</div>
+<div class="line"><a name="l16663"></a><span class="lineno">16663</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l16664"></a><span class="lineno">16664</span>&#160;            }</div>
+<div class="line"><a name="l16665"></a><span class="lineno">16665</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// Last use time earlier than current time.</span></div>
+<div class="line"><a name="l16666"></a><span class="lineno">16666</span>&#160;            {</div>
+<div class="line"><a name="l16667"></a><span class="lineno">16667</span>&#160;                <span class="keywordflow">if</span>(hAllocation-&gt;CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))</div>
+<div class="line"><a name="l16668"></a><span class="lineno">16668</span>&#160;                {</div>
+<div class="line"><a name="l16669"></a><span class="lineno">16669</span>&#160;                    localLastUseFrameIndex = localCurrFrameIndex;</div>
+<div class="line"><a name="l16670"></a><span class="lineno">16670</span>&#160;                }</div>
+<div class="line"><a name="l16671"></a><span class="lineno">16671</span>&#160;            }</div>
+<div class="line"><a name="l16672"></a><span class="lineno">16672</span>&#160;        }</div>
+<div class="line"><a name="l16673"></a><span class="lineno">16673</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l16674"></a><span class="lineno">16674</span>&#160; </div>
+<div class="line"><a name="l16675"></a><span class="lineno">16675</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">memoryType</a> = hAllocation-&gt;GetMemoryTypeIndex();</div>
+<div class="line"><a name="l16676"></a><span class="lineno">16676</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">deviceMemory</a> = hAllocation-&gt;GetMemory();</div>
+<div class="line"><a name="l16677"></a><span class="lineno">16677</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">offset</a> = hAllocation-&gt;GetOffset();</div>
+<div class="line"><a name="l16678"></a><span class="lineno">16678</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f">size</a> = hAllocation-&gt;GetSize();</div>
+<div class="line"><a name="l16679"></a><span class="lineno">16679</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a> = hAllocation-&gt;GetMappedData();</div>
+<div class="line"><a name="l16680"></a><span class="lineno">16680</span>&#160;        pAllocationInfo-&gt;<a class="code" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a> = hAllocation-&gt;GetUserData();</div>
+<div class="line"><a name="l16681"></a><span class="lineno">16681</span>&#160;    }</div>
+<div class="line"><a name="l16682"></a><span class="lineno">16682</span>&#160;}</div>
+<div class="line"><a name="l16683"></a><span class="lineno">16683</span>&#160; </div>
+<div class="line"><a name="l16684"></a><span class="lineno">16684</span>&#160;<span class="keywordtype">bool</span> VmaAllocator_T::TouchAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
+<div class="line"><a name="l16685"></a><span class="lineno">16685</span>&#160;{</div>
+<div class="line"><a name="l16686"></a><span class="lineno">16686</span>&#160;    <span class="comment">// This is a stripped-down version of VmaAllocator_T::GetAllocationInfo.</span></div>
+<div class="line"><a name="l16687"></a><span class="lineno">16687</span>&#160;    <span class="keywordflow">if</span>(hAllocation-&gt;CanBecomeLost())</div>
+<div class="line"><a name="l16688"></a><span class="lineno">16688</span>&#160;    {</div>
+<div class="line"><a name="l16689"></a><span class="lineno">16689</span>&#160;        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();</div>
+<div class="line"><a name="l16690"></a><span class="lineno">16690</span>&#160;        uint32_t localLastUseFrameIndex = hAllocation-&gt;GetLastUseFrameIndex();</div>
+<div class="line"><a name="l16691"></a><span class="lineno">16691</span>&#160;        <span class="keywordflow">for</span>(;;)</div>
+<div class="line"><a name="l16692"></a><span class="lineno">16692</span>&#160;        {</div>
+<div class="line"><a name="l16693"></a><span class="lineno">16693</span>&#160;            <span class="keywordflow">if</span>(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)</div>
+<div class="line"><a name="l16694"></a><span class="lineno">16694</span>&#160;            {</div>
+<div class="line"><a name="l16695"></a><span class="lineno">16695</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l16696"></a><span class="lineno">16696</span>&#160;            }</div>
+<div class="line"><a name="l16697"></a><span class="lineno">16697</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span>(localLastUseFrameIndex == localCurrFrameIndex)</div>
+<div class="line"><a name="l16698"></a><span class="lineno">16698</span>&#160;            {</div>
+<div class="line"><a name="l16699"></a><span class="lineno">16699</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l16700"></a><span class="lineno">16700</span>&#160;            }</div>
+<div class="line"><a name="l16701"></a><span class="lineno">16701</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// Last use time earlier than current time.</span></div>
+<div class="line"><a name="l16702"></a><span class="lineno">16702</span>&#160;            {</div>
+<div class="line"><a name="l16703"></a><span class="lineno">16703</span>&#160;                <span class="keywordflow">if</span>(hAllocation-&gt;CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))</div>
+<div class="line"><a name="l16704"></a><span class="lineno">16704</span>&#160;                {</div>
+<div class="line"><a name="l16705"></a><span class="lineno">16705</span>&#160;                    localLastUseFrameIndex = localCurrFrameIndex;</div>
+<div class="line"><a name="l16706"></a><span class="lineno">16706</span>&#160;                }</div>
+<div class="line"><a name="l16707"></a><span class="lineno">16707</span>&#160;            }</div>
+<div class="line"><a name="l16708"></a><span class="lineno">16708</span>&#160;        }</div>
+<div class="line"><a name="l16709"></a><span class="lineno">16709</span>&#160;    }</div>
+<div class="line"><a name="l16710"></a><span class="lineno">16710</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16711"></a><span class="lineno">16711</span>&#160;    {</div>
+<div class="line"><a name="l16712"></a><span class="lineno">16712</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l16713"></a><span class="lineno">16713</span>&#160;        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();</div>
+<div class="line"><a name="l16714"></a><span class="lineno">16714</span>&#160;        uint32_t localLastUseFrameIndex = hAllocation-&gt;GetLastUseFrameIndex();</div>
+<div class="line"><a name="l16715"></a><span class="lineno">16715</span>&#160;        <span class="keywordflow">for</span>(;;)</div>
+<div class="line"><a name="l16716"></a><span class="lineno">16716</span>&#160;        {</div>
+<div class="line"><a name="l16717"></a><span class="lineno">16717</span>&#160;            VMA_ASSERT(localLastUseFrameIndex != VMA_FRAME_INDEX_LOST);</div>
+<div class="line"><a name="l16718"></a><span class="lineno">16718</span>&#160;            <span class="keywordflow">if</span>(localLastUseFrameIndex == localCurrFrameIndex)</div>
+<div class="line"><a name="l16719"></a><span class="lineno">16719</span>&#160;            {</div>
+<div class="line"><a name="l16720"></a><span class="lineno">16720</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l16721"></a><span class="lineno">16721</span>&#160;            }</div>
+<div class="line"><a name="l16722"></a><span class="lineno">16722</span>&#160;            <span class="keywordflow">else</span> <span class="comment">// Last use time earlier than current time.</span></div>
+<div class="line"><a name="l16723"></a><span class="lineno">16723</span>&#160;            {</div>
+<div class="line"><a name="l16724"></a><span class="lineno">16724</span>&#160;                <span class="keywordflow">if</span>(hAllocation-&gt;CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))</div>
+<div class="line"><a name="l16725"></a><span class="lineno">16725</span>&#160;                {</div>
+<div class="line"><a name="l16726"></a><span class="lineno">16726</span>&#160;                    localLastUseFrameIndex = localCurrFrameIndex;</div>
+<div class="line"><a name="l16727"></a><span class="lineno">16727</span>&#160;                }</div>
+<div class="line"><a name="l16728"></a><span class="lineno">16728</span>&#160;            }</div>
+<div class="line"><a name="l16729"></a><span class="lineno">16729</span>&#160;        }</div>
+<div class="line"><a name="l16730"></a><span class="lineno">16730</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l16731"></a><span class="lineno">16731</span>&#160; </div>
+<div class="line"><a name="l16732"></a><span class="lineno">16732</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l16733"></a><span class="lineno">16733</span>&#160;    }</div>
+<div class="line"><a name="l16734"></a><span class="lineno">16734</span>&#160;}</div>
+<div class="line"><a name="l16735"></a><span class="lineno">16735</span>&#160; </div>
+<div class="line"><a name="l16736"></a><span class="lineno">16736</span>&#160;VkResult VmaAllocator_T::CreatePool(<span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>* pCreateInfo, <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPool)</div>
+<div class="line"><a name="l16737"></a><span class="lineno">16737</span>&#160;{</div>
+<div class="line"><a name="l16738"></a><span class="lineno">16738</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;  CreatePool: MemoryTypeIndex=%u, flags=%u&quot;</span>, pCreateInfo-&gt;<a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a>, pCreateInfo-&gt;<a class="code" href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446">flags</a>);</div>
+<div class="line"><a name="l16739"></a><span class="lineno">16739</span>&#160; </div>
+<div class="line"><a name="l16740"></a><span class="lineno">16740</span>&#160;    <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a> newCreateInfo = *pCreateInfo;</div>
+<div class="line"><a name="l16741"></a><span class="lineno">16741</span>&#160; </div>
+<div class="line"><a name="l16742"></a><span class="lineno">16742</span>&#160;    <span class="keywordflow">if</span>(newCreateInfo.<a class="code" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">maxBlockCount</a> == 0)</div>
+<div class="line"><a name="l16743"></a><span class="lineno">16743</span>&#160;    {</div>
+<div class="line"><a name="l16744"></a><span class="lineno">16744</span>&#160;        newCreateInfo.<a class="code" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">maxBlockCount</a> = SIZE_MAX;</div>
+<div class="line"><a name="l16745"></a><span class="lineno">16745</span>&#160;    }</div>
+<div class="line"><a name="l16746"></a><span class="lineno">16746</span>&#160;    <span class="keywordflow">if</span>(newCreateInfo.<a class="code" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae">minBlockCount</a> &gt; newCreateInfo.<a class="code" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">maxBlockCount</a>)</div>
+<div class="line"><a name="l16747"></a><span class="lineno">16747</span>&#160;    {</div>
+<div class="line"><a name="l16748"></a><span class="lineno">16748</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_INITIALIZATION_FAILED;</div>
+<div class="line"><a name="l16749"></a><span class="lineno">16749</span>&#160;    }</div>
+<div class="line"><a name="l16750"></a><span class="lineno">16750</span>&#160;    <span class="comment">// Memory type index out of range or forbidden.</span></div>
+<div class="line"><a name="l16751"></a><span class="lineno">16751</span>&#160;    <span class="keywordflow">if</span>(pCreateInfo-&gt;<a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a> &gt;= GetMemoryTypeCount() ||</div>
+<div class="line"><a name="l16752"></a><span class="lineno">16752</span>&#160;        ((1u &lt;&lt; pCreateInfo-&gt;<a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a>) &amp; m_GlobalMemoryTypeBits) == 0)</div>
+<div class="line"><a name="l16753"></a><span class="lineno">16753</span>&#160;    {</div>
+<div class="line"><a name="l16754"></a><span class="lineno">16754</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT;</div>
+<div class="line"><a name="l16755"></a><span class="lineno">16755</span>&#160;    }</div>
+<div class="line"><a name="l16756"></a><span class="lineno">16756</span>&#160; </div>
+<div class="line"><a name="l16757"></a><span class="lineno">16757</span>&#160;    <span class="keyword">const</span> VkDeviceSize preferredBlockSize = CalcPreferredBlockSize(newCreateInfo.<a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a>);</div>
+<div class="line"><a name="l16758"></a><span class="lineno">16758</span>&#160; </div>
+<div class="line"><a name="l16759"></a><span class="lineno">16759</span>&#160;    *pPool = vma_new(<span class="keyword">this</span>, VmaPool_T)(<span class="keyword">this</span>, newCreateInfo, preferredBlockSize);</div>
+<div class="line"><a name="l16760"></a><span class="lineno">16760</span>&#160; </div>
+<div class="line"><a name="l16761"></a><span class="lineno">16761</span>&#160;    VkResult res = (*pPool)-&gt;m_BlockVector.CreateMinBlocks();</div>
+<div class="line"><a name="l16762"></a><span class="lineno">16762</span>&#160;    <span class="keywordflow">if</span>(res != VK_SUCCESS)</div>
+<div class="line"><a name="l16763"></a><span class="lineno">16763</span>&#160;    {</div>
+<div class="line"><a name="l16764"></a><span class="lineno">16764</span>&#160;        vma_delete(<span class="keyword">this</span>, *pPool);</div>
+<div class="line"><a name="l16765"></a><span class="lineno">16765</span>&#160;        *pPool = VMA_NULL;</div>
+<div class="line"><a name="l16766"></a><span class="lineno">16766</span>&#160;        <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l16767"></a><span class="lineno">16767</span>&#160;    }</div>
+<div class="line"><a name="l16768"></a><span class="lineno">16768</span>&#160; </div>
+<div class="line"><a name="l16769"></a><span class="lineno">16769</span>&#160;    <span class="comment">// Add to m_Pools.</span></div>
+<div class="line"><a name="l16770"></a><span class="lineno">16770</span>&#160;    {</div>
+<div class="line"><a name="l16771"></a><span class="lineno">16771</span>&#160;        VmaMutexLockWrite lock(m_PoolsMutex, m_UseMutex);</div>
+<div class="line"><a name="l16772"></a><span class="lineno">16772</span>&#160;        (*pPool)-&gt;SetId(m_NextPoolId++);</div>
+<div class="line"><a name="l16773"></a><span class="lineno">16773</span>&#160;        VmaVectorInsertSorted&lt;VmaPointerLess&gt;(m_Pools, *pPool);</div>
+<div class="line"><a name="l16774"></a><span class="lineno">16774</span>&#160;    }</div>
 <div class="line"><a name="l16775"></a><span class="lineno">16775</span>&#160; </div>
-<div class="line"><a name="l16776"></a><span class="lineno">16776</span>&#160;VkResult VmaAllocator_T::Map(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, <span class="keywordtype">void</span>** ppData)</div>
-<div class="line"><a name="l16777"></a><span class="lineno">16777</span>&#160;{</div>
-<div class="line"><a name="l16778"></a><span class="lineno">16778</span>&#160;    <span class="keywordflow">if</span>(hAllocation-&gt;CanBecomeLost())</div>
-<div class="line"><a name="l16779"></a><span class="lineno">16779</span>&#160;    {</div>
-<div class="line"><a name="l16780"></a><span class="lineno">16780</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_MEMORY_MAP_FAILED;</div>
-<div class="line"><a name="l16781"></a><span class="lineno">16781</span>&#160;    }</div>
-<div class="line"><a name="l16782"></a><span class="lineno">16782</span>&#160; </div>
-<div class="line"><a name="l16783"></a><span class="lineno">16783</span>&#160;    <span class="keywordflow">switch</span>(hAllocation-&gt;GetType())</div>
-<div class="line"><a name="l16784"></a><span class="lineno">16784</span>&#160;    {</div>
-<div class="line"><a name="l16785"></a><span class="lineno">16785</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
-<div class="line"><a name="l16786"></a><span class="lineno">16786</span>&#160;        {</div>
-<div class="line"><a name="l16787"></a><span class="lineno">16787</span>&#160;            VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = hAllocation-&gt;GetBlock();</div>
-<div class="line"><a name="l16788"></a><span class="lineno">16788</span>&#160;            <span class="keywordtype">char</span> *pBytes = VMA_NULL;</div>
-<div class="line"><a name="l16789"></a><span class="lineno">16789</span>&#160;            VkResult res = pBlock-&gt;Map(<span class="keyword">this</span>, 1, (<span class="keywordtype">void</span>**)&amp;pBytes);</div>
-<div class="line"><a name="l16790"></a><span class="lineno">16790</span>&#160;            <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l16791"></a><span class="lineno">16791</span>&#160;            {</div>
-<div class="line"><a name="l16792"></a><span class="lineno">16792</span>&#160;                *ppData = pBytes + (ptrdiff_t)hAllocation-&gt;GetOffset();</div>
-<div class="line"><a name="l16793"></a><span class="lineno">16793</span>&#160;                hAllocation-&gt;BlockAllocMap();</div>
-<div class="line"><a name="l16794"></a><span class="lineno">16794</span>&#160;            }</div>
-<div class="line"><a name="l16795"></a><span class="lineno">16795</span>&#160;            <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l16796"></a><span class="lineno">16796</span>&#160;        }</div>
-<div class="line"><a name="l16797"></a><span class="lineno">16797</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
-<div class="line"><a name="l16798"></a><span class="lineno">16798</span>&#160;        <span class="keywordflow">return</span> hAllocation-&gt;DedicatedAllocMap(<span class="keyword">this</span>, ppData);</div>
-<div class="line"><a name="l16799"></a><span class="lineno">16799</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l16800"></a><span class="lineno">16800</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l16801"></a><span class="lineno">16801</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_MEMORY_MAP_FAILED;</div>
-<div class="line"><a name="l16802"></a><span class="lineno">16802</span>&#160;    }</div>
-<div class="line"><a name="l16803"></a><span class="lineno">16803</span>&#160;}</div>
-<div class="line"><a name="l16804"></a><span class="lineno">16804</span>&#160; </div>
-<div class="line"><a name="l16805"></a><span class="lineno">16805</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::Unmap(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
-<div class="line"><a name="l16806"></a><span class="lineno">16806</span>&#160;{</div>
-<div class="line"><a name="l16807"></a><span class="lineno">16807</span>&#160;    <span class="keywordflow">switch</span>(hAllocation-&gt;GetType())</div>
-<div class="line"><a name="l16808"></a><span class="lineno">16808</span>&#160;    {</div>
-<div class="line"><a name="l16809"></a><span class="lineno">16809</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
-<div class="line"><a name="l16810"></a><span class="lineno">16810</span>&#160;        {</div>
-<div class="line"><a name="l16811"></a><span class="lineno">16811</span>&#160;            VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = hAllocation-&gt;GetBlock();</div>
-<div class="line"><a name="l16812"></a><span class="lineno">16812</span>&#160;            hAllocation-&gt;BlockAllocUnmap();</div>
-<div class="line"><a name="l16813"></a><span class="lineno">16813</span>&#160;            pBlock-&gt;Unmap(<span class="keyword">this</span>, 1);</div>
-<div class="line"><a name="l16814"></a><span class="lineno">16814</span>&#160;        }</div>
-<div class="line"><a name="l16815"></a><span class="lineno">16815</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16816"></a><span class="lineno">16816</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
-<div class="line"><a name="l16817"></a><span class="lineno">16817</span>&#160;        hAllocation-&gt;DedicatedAllocUnmap(<span class="keyword">this</span>);</div>
-<div class="line"><a name="l16818"></a><span class="lineno">16818</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16819"></a><span class="lineno">16819</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l16820"></a><span class="lineno">16820</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l16821"></a><span class="lineno">16821</span>&#160;    }</div>
-<div class="line"><a name="l16822"></a><span class="lineno">16822</span>&#160;}</div>
-<div class="line"><a name="l16823"></a><span class="lineno">16823</span>&#160; </div>
-<div class="line"><a name="l16824"></a><span class="lineno">16824</span>&#160;VkResult VmaAllocator_T::BindBufferMemory(</div>
-<div class="line"><a name="l16825"></a><span class="lineno">16825</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
-<div class="line"><a name="l16826"></a><span class="lineno">16826</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l16827"></a><span class="lineno">16827</span>&#160;    VkBuffer hBuffer,</div>
-<div class="line"><a name="l16828"></a><span class="lineno">16828</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
-<div class="line"><a name="l16829"></a><span class="lineno">16829</span>&#160;{</div>
-<div class="line"><a name="l16830"></a><span class="lineno">16830</span>&#160;    VkResult res = VK_SUCCESS;</div>
-<div class="line"><a name="l16831"></a><span class="lineno">16831</span>&#160;    <span class="keywordflow">switch</span>(hAllocation-&gt;GetType())</div>
-<div class="line"><a name="l16832"></a><span class="lineno">16832</span>&#160;    {</div>
-<div class="line"><a name="l16833"></a><span class="lineno">16833</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
-<div class="line"><a name="l16834"></a><span class="lineno">16834</span>&#160;        res = BindVulkanBuffer(hAllocation-&gt;GetMemory(), allocationLocalOffset, hBuffer, pNext);</div>
-<div class="line"><a name="l16835"></a><span class="lineno">16835</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16836"></a><span class="lineno">16836</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
-<div class="line"><a name="l16837"></a><span class="lineno">16837</span>&#160;    {</div>
-<div class="line"><a name="l16838"></a><span class="lineno">16838</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = hAllocation-&gt;GetBlock();</div>
-<div class="line"><a name="l16839"></a><span class="lineno">16839</span>&#160;        VMA_ASSERT(pBlock &amp;&amp; <span class="stringliteral">&quot;Binding buffer to allocation that doesn&#39;t belong to any block. Is the allocation lost?&quot;</span>);</div>
-<div class="line"><a name="l16840"></a><span class="lineno">16840</span>&#160;        res = pBlock-&gt;BindBufferMemory(<span class="keyword">this</span>, hAllocation, allocationLocalOffset, hBuffer, pNext);</div>
-<div class="line"><a name="l16841"></a><span class="lineno">16841</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16842"></a><span class="lineno">16842</span>&#160;    }</div>
-<div class="line"><a name="l16843"></a><span class="lineno">16843</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l16844"></a><span class="lineno">16844</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l16776"></a><span class="lineno">16776</span>&#160;    <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l16777"></a><span class="lineno">16777</span>&#160;}</div>
+<div class="line"><a name="l16778"></a><span class="lineno">16778</span>&#160; </div>
+<div class="line"><a name="l16779"></a><span class="lineno">16779</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::DestroyPool(<a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
+<div class="line"><a name="l16780"></a><span class="lineno">16780</span>&#160;{</div>
+<div class="line"><a name="l16781"></a><span class="lineno">16781</span>&#160;    <span class="comment">// Remove from m_Pools.</span></div>
+<div class="line"><a name="l16782"></a><span class="lineno">16782</span>&#160;    {</div>
+<div class="line"><a name="l16783"></a><span class="lineno">16783</span>&#160;        VmaMutexLockWrite lock(m_PoolsMutex, m_UseMutex);</div>
+<div class="line"><a name="l16784"></a><span class="lineno">16784</span>&#160;        <span class="keywordtype">bool</span> success = VmaVectorRemoveSorted&lt;VmaPointerLess&gt;(m_Pools, pool);</div>
+<div class="line"><a name="l16785"></a><span class="lineno">16785</span>&#160;        VMA_ASSERT(success &amp;&amp; <span class="stringliteral">&quot;Pool not found in Allocator.&quot;</span>);</div>
+<div class="line"><a name="l16786"></a><span class="lineno">16786</span>&#160;    }</div>
+<div class="line"><a name="l16787"></a><span class="lineno">16787</span>&#160; </div>
+<div class="line"><a name="l16788"></a><span class="lineno">16788</span>&#160;    vma_delete(<span class="keyword">this</span>, pool);</div>
+<div class="line"><a name="l16789"></a><span class="lineno">16789</span>&#160;}</div>
+<div class="line"><a name="l16790"></a><span class="lineno">16790</span>&#160; </div>
+<div class="line"><a name="l16791"></a><span class="lineno">16791</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::GetPoolStats(<a class="code" href="struct_vma_pool.html">VmaPool</a> pool, <a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pPoolStats)</div>
+<div class="line"><a name="l16792"></a><span class="lineno">16792</span>&#160;{</div>
+<div class="line"><a name="l16793"></a><span class="lineno">16793</span>&#160;    pool-&gt;m_BlockVector.GetPoolStats(pPoolStats);</div>
+<div class="line"><a name="l16794"></a><span class="lineno">16794</span>&#160;}</div>
+<div class="line"><a name="l16795"></a><span class="lineno">16795</span>&#160; </div>
+<div class="line"><a name="l16796"></a><span class="lineno">16796</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::SetCurrentFrameIndex(uint32_t frameIndex)</div>
+<div class="line"><a name="l16797"></a><span class="lineno">16797</span>&#160;{</div>
+<div class="line"><a name="l16798"></a><span class="lineno">16798</span>&#160;    m_CurrentFrameIndex.store(frameIndex);</div>
+<div class="line"><a name="l16799"></a><span class="lineno">16799</span>&#160; </div>
+<div class="line"><a name="l16800"></a><span class="lineno">16800</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l16801"></a><span class="lineno">16801</span>&#160;    <span class="keywordflow">if</span>(m_UseExtMemoryBudget)</div>
+<div class="line"><a name="l16802"></a><span class="lineno">16802</span>&#160;    {</div>
+<div class="line"><a name="l16803"></a><span class="lineno">16803</span>&#160;        UpdateVulkanBudget();</div>
+<div class="line"><a name="l16804"></a><span class="lineno">16804</span>&#160;    }</div>
+<div class="line"><a name="l16805"></a><span class="lineno">16805</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l16806"></a><span class="lineno">16806</span>&#160;}</div>
+<div class="line"><a name="l16807"></a><span class="lineno">16807</span>&#160; </div>
+<div class="line"><a name="l16808"></a><span class="lineno">16808</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::MakePoolAllocationsLost(</div>
+<div class="line"><a name="l16809"></a><span class="lineno">16809</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> hPool,</div>
+<div class="line"><a name="l16810"></a><span class="lineno">16810</span>&#160;    <span class="keywordtype">size_t</span>* pLostAllocationCount)</div>
+<div class="line"><a name="l16811"></a><span class="lineno">16811</span>&#160;{</div>
+<div class="line"><a name="l16812"></a><span class="lineno">16812</span>&#160;    hPool-&gt;m_BlockVector.MakePoolAllocationsLost(</div>
+<div class="line"><a name="l16813"></a><span class="lineno">16813</span>&#160;        m_CurrentFrameIndex.load(),</div>
+<div class="line"><a name="l16814"></a><span class="lineno">16814</span>&#160;        pLostAllocationCount);</div>
+<div class="line"><a name="l16815"></a><span class="lineno">16815</span>&#160;}</div>
+<div class="line"><a name="l16816"></a><span class="lineno">16816</span>&#160; </div>
+<div class="line"><a name="l16817"></a><span class="lineno">16817</span>&#160;VkResult VmaAllocator_T::CheckPoolCorruption(<a class="code" href="struct_vma_pool.html">VmaPool</a> hPool)</div>
+<div class="line"><a name="l16818"></a><span class="lineno">16818</span>&#160;{</div>
+<div class="line"><a name="l16819"></a><span class="lineno">16819</span>&#160;    <span class="keywordflow">return</span> hPool-&gt;m_BlockVector.CheckCorruption();</div>
+<div class="line"><a name="l16820"></a><span class="lineno">16820</span>&#160;}</div>
+<div class="line"><a name="l16821"></a><span class="lineno">16821</span>&#160; </div>
+<div class="line"><a name="l16822"></a><span class="lineno">16822</span>&#160;VkResult VmaAllocator_T::CheckCorruption(uint32_t memoryTypeBits)</div>
+<div class="line"><a name="l16823"></a><span class="lineno">16823</span>&#160;{</div>
+<div class="line"><a name="l16824"></a><span class="lineno">16824</span>&#160;    VkResult finalRes = VK_ERROR_FEATURE_NOT_PRESENT;</div>
+<div class="line"><a name="l16825"></a><span class="lineno">16825</span>&#160; </div>
+<div class="line"><a name="l16826"></a><span class="lineno">16826</span>&#160;    <span class="comment">// Process default pools.</span></div>
+<div class="line"><a name="l16827"></a><span class="lineno">16827</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
+<div class="line"><a name="l16828"></a><span class="lineno">16828</span>&#160;    {</div>
+<div class="line"><a name="l16829"></a><span class="lineno">16829</span>&#160;        <span class="keywordflow">if</span>(((1u &lt;&lt; memTypeIndex) &amp; memoryTypeBits) != 0)</div>
+<div class="line"><a name="l16830"></a><span class="lineno">16830</span>&#160;        {</div>
+<div class="line"><a name="l16831"></a><span class="lineno">16831</span>&#160;            VmaBlockVector* <span class="keyword">const</span> pBlockVector = m_pBlockVectors[memTypeIndex];</div>
+<div class="line"><a name="l16832"></a><span class="lineno">16832</span>&#160;            VMA_ASSERT(pBlockVector);</div>
+<div class="line"><a name="l16833"></a><span class="lineno">16833</span>&#160;            VkResult localRes = pBlockVector-&gt;CheckCorruption();</div>
+<div class="line"><a name="l16834"></a><span class="lineno">16834</span>&#160;            <span class="keywordflow">switch</span>(localRes)</div>
+<div class="line"><a name="l16835"></a><span class="lineno">16835</span>&#160;            {</div>
+<div class="line"><a name="l16836"></a><span class="lineno">16836</span>&#160;            <span class="keywordflow">case</span> VK_ERROR_FEATURE_NOT_PRESENT:</div>
+<div class="line"><a name="l16837"></a><span class="lineno">16837</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l16838"></a><span class="lineno">16838</span>&#160;            <span class="keywordflow">case</span> VK_SUCCESS:</div>
+<div class="line"><a name="l16839"></a><span class="lineno">16839</span>&#160;                finalRes = VK_SUCCESS;</div>
+<div class="line"><a name="l16840"></a><span class="lineno">16840</span>&#160;                <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l16841"></a><span class="lineno">16841</span>&#160;            <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l16842"></a><span class="lineno">16842</span>&#160;                <span class="keywordflow">return</span> localRes;</div>
+<div class="line"><a name="l16843"></a><span class="lineno">16843</span>&#160;            }</div>
+<div class="line"><a name="l16844"></a><span class="lineno">16844</span>&#160;        }</div>
 <div class="line"><a name="l16845"></a><span class="lineno">16845</span>&#160;    }</div>
-<div class="line"><a name="l16846"></a><span class="lineno">16846</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l16847"></a><span class="lineno">16847</span>&#160;}</div>
-<div class="line"><a name="l16848"></a><span class="lineno">16848</span>&#160; </div>
-<div class="line"><a name="l16849"></a><span class="lineno">16849</span>&#160;VkResult VmaAllocator_T::BindImageMemory(</div>
-<div class="line"><a name="l16850"></a><span class="lineno">16850</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
-<div class="line"><a name="l16851"></a><span class="lineno">16851</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l16852"></a><span class="lineno">16852</span>&#160;    VkImage hImage,</div>
-<div class="line"><a name="l16853"></a><span class="lineno">16853</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
-<div class="line"><a name="l16854"></a><span class="lineno">16854</span>&#160;{</div>
-<div class="line"><a name="l16855"></a><span class="lineno">16855</span>&#160;    VkResult res = VK_SUCCESS;</div>
-<div class="line"><a name="l16856"></a><span class="lineno">16856</span>&#160;    <span class="keywordflow">switch</span>(hAllocation-&gt;GetType())</div>
-<div class="line"><a name="l16857"></a><span class="lineno">16857</span>&#160;    {</div>
-<div class="line"><a name="l16858"></a><span class="lineno">16858</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
-<div class="line"><a name="l16859"></a><span class="lineno">16859</span>&#160;        res = BindVulkanImage(hAllocation-&gt;GetMemory(), allocationLocalOffset, hImage, pNext);</div>
-<div class="line"><a name="l16860"></a><span class="lineno">16860</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16861"></a><span class="lineno">16861</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
-<div class="line"><a name="l16862"></a><span class="lineno">16862</span>&#160;    {</div>
-<div class="line"><a name="l16863"></a><span class="lineno">16863</span>&#160;        VmaDeviceMemoryBlock* pBlock = hAllocation-&gt;GetBlock();</div>
-<div class="line"><a name="l16864"></a><span class="lineno">16864</span>&#160;        VMA_ASSERT(pBlock &amp;&amp; <span class="stringliteral">&quot;Binding image to allocation that doesn&#39;t belong to any block. Is the allocation lost?&quot;</span>);</div>
-<div class="line"><a name="l16865"></a><span class="lineno">16865</span>&#160;        res = pBlock-&gt;BindImageMemory(<span class="keyword">this</span>, hAllocation, allocationLocalOffset, hImage, pNext);</div>
-<div class="line"><a name="l16866"></a><span class="lineno">16866</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l16846"></a><span class="lineno">16846</span>&#160; </div>
+<div class="line"><a name="l16847"></a><span class="lineno">16847</span>&#160;    <span class="comment">// Process custom pools.</span></div>
+<div class="line"><a name="l16848"></a><span class="lineno">16848</span>&#160;    {</div>
+<div class="line"><a name="l16849"></a><span class="lineno">16849</span>&#160;        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);</div>
+<div class="line"><a name="l16850"></a><span class="lineno">16850</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> poolIndex = 0, poolCount = m_Pools.size(); poolIndex &lt; poolCount; ++poolIndex)</div>
+<div class="line"><a name="l16851"></a><span class="lineno">16851</span>&#160;        {</div>
+<div class="line"><a name="l16852"></a><span class="lineno">16852</span>&#160;            <span class="keywordflow">if</span>(((1u &lt;&lt; m_Pools[poolIndex]-&gt;m_BlockVector.GetMemoryTypeIndex()) &amp; memoryTypeBits) != 0)</div>
+<div class="line"><a name="l16853"></a><span class="lineno">16853</span>&#160;            {</div>
+<div class="line"><a name="l16854"></a><span class="lineno">16854</span>&#160;                VkResult localRes = m_Pools[poolIndex]-&gt;m_BlockVector.CheckCorruption();</div>
+<div class="line"><a name="l16855"></a><span class="lineno">16855</span>&#160;                <span class="keywordflow">switch</span>(localRes)</div>
+<div class="line"><a name="l16856"></a><span class="lineno">16856</span>&#160;                {</div>
+<div class="line"><a name="l16857"></a><span class="lineno">16857</span>&#160;                <span class="keywordflow">case</span> VK_ERROR_FEATURE_NOT_PRESENT:</div>
+<div class="line"><a name="l16858"></a><span class="lineno">16858</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l16859"></a><span class="lineno">16859</span>&#160;                <span class="keywordflow">case</span> VK_SUCCESS:</div>
+<div class="line"><a name="l16860"></a><span class="lineno">16860</span>&#160;                    finalRes = VK_SUCCESS;</div>
+<div class="line"><a name="l16861"></a><span class="lineno">16861</span>&#160;                    <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l16862"></a><span class="lineno">16862</span>&#160;                <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l16863"></a><span class="lineno">16863</span>&#160;                    <span class="keywordflow">return</span> localRes;</div>
+<div class="line"><a name="l16864"></a><span class="lineno">16864</span>&#160;                }</div>
+<div class="line"><a name="l16865"></a><span class="lineno">16865</span>&#160;            }</div>
+<div class="line"><a name="l16866"></a><span class="lineno">16866</span>&#160;        }</div>
 <div class="line"><a name="l16867"></a><span class="lineno">16867</span>&#160;    }</div>
-<div class="line"><a name="l16868"></a><span class="lineno">16868</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l16869"></a><span class="lineno">16869</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l16870"></a><span class="lineno">16870</span>&#160;    }</div>
-<div class="line"><a name="l16871"></a><span class="lineno">16871</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l16872"></a><span class="lineno">16872</span>&#160;}</div>
-<div class="line"><a name="l16873"></a><span class="lineno">16873</span>&#160; </div>
-<div class="line"><a name="l16874"></a><span class="lineno">16874</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::FlushOrInvalidateAllocation(</div>
-<div class="line"><a name="l16875"></a><span class="lineno">16875</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
-<div class="line"><a name="l16876"></a><span class="lineno">16876</span>&#160;    VkDeviceSize offset, VkDeviceSize size,</div>
-<div class="line"><a name="l16877"></a><span class="lineno">16877</span>&#160;    VMA_CACHE_OPERATION op)</div>
-<div class="line"><a name="l16878"></a><span class="lineno">16878</span>&#160;{</div>
-<div class="line"><a name="l16879"></a><span class="lineno">16879</span>&#160;    <span class="keyword">const</span> uint32_t memTypeIndex = hAllocation-&gt;GetMemoryTypeIndex();</div>
-<div class="line"><a name="l16880"></a><span class="lineno">16880</span>&#160;    <span class="keywordflow">if</span>(size &gt; 0 &amp;&amp; IsMemoryTypeNonCoherent(memTypeIndex))</div>
-<div class="line"><a name="l16881"></a><span class="lineno">16881</span>&#160;    {</div>
-<div class="line"><a name="l16882"></a><span class="lineno">16882</span>&#160;        <span class="keyword">const</span> VkDeviceSize allocationSize = hAllocation-&gt;GetSize();</div>
-<div class="line"><a name="l16883"></a><span class="lineno">16883</span>&#160;        VMA_ASSERT(offset &lt;= allocationSize);</div>
-<div class="line"><a name="l16884"></a><span class="lineno">16884</span>&#160; </div>
-<div class="line"><a name="l16885"></a><span class="lineno">16885</span>&#160;        <span class="keyword">const</span> VkDeviceSize nonCoherentAtomSize = m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;</div>
-<div class="line"><a name="l16886"></a><span class="lineno">16886</span>&#160; </div>
-<div class="line"><a name="l16887"></a><span class="lineno">16887</span>&#160;        VkMappedMemoryRange memRange = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE };</div>
-<div class="line"><a name="l16888"></a><span class="lineno">16888</span>&#160;        memRange.memory = hAllocation-&gt;GetMemory();</div>
-<div class="line"><a name="l16889"></a><span class="lineno">16889</span>&#160;        </div>
-<div class="line"><a name="l16890"></a><span class="lineno">16890</span>&#160;        <span class="keywordflow">switch</span>(hAllocation-&gt;GetType())</div>
-<div class="line"><a name="l16891"></a><span class="lineno">16891</span>&#160;        {</div>
-<div class="line"><a name="l16892"></a><span class="lineno">16892</span>&#160;        <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
-<div class="line"><a name="l16893"></a><span class="lineno">16893</span>&#160;            memRange.offset = VmaAlignDown(offset, nonCoherentAtomSize);</div>
-<div class="line"><a name="l16894"></a><span class="lineno">16894</span>&#160;            <span class="keywordflow">if</span>(size == VK_WHOLE_SIZE)</div>
+<div class="line"><a name="l16868"></a><span class="lineno">16868</span>&#160; </div>
+<div class="line"><a name="l16869"></a><span class="lineno">16869</span>&#160;    <span class="keywordflow">return</span> finalRes;</div>
+<div class="line"><a name="l16870"></a><span class="lineno">16870</span>&#160;}</div>
+<div class="line"><a name="l16871"></a><span class="lineno">16871</span>&#160; </div>
+<div class="line"><a name="l16872"></a><span class="lineno">16872</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::CreateLostAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation)</div>
+<div class="line"><a name="l16873"></a><span class="lineno">16873</span>&#160;{</div>
+<div class="line"><a name="l16874"></a><span class="lineno">16874</span>&#160;    *pAllocation = m_AllocationObjectAllocator.Allocate(VMA_FRAME_INDEX_LOST, <span class="keyword">false</span>);</div>
+<div class="line"><a name="l16875"></a><span class="lineno">16875</span>&#160;    (*pAllocation)-&gt;InitLost();</div>
+<div class="line"><a name="l16876"></a><span class="lineno">16876</span>&#160;}</div>
+<div class="line"><a name="l16877"></a><span class="lineno">16877</span>&#160; </div>
+<div class="line"><a name="l16878"></a><span class="lineno">16878</span>&#160;VkResult VmaAllocator_T::AllocateVulkanMemory(<span class="keyword">const</span> VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory)</div>
+<div class="line"><a name="l16879"></a><span class="lineno">16879</span>&#160;{</div>
+<div class="line"><a name="l16880"></a><span class="lineno">16880</span>&#160;    <span class="keyword">const</span> uint32_t heapIndex = MemoryTypeIndexToHeapIndex(pAllocateInfo-&gt;memoryTypeIndex);</div>
+<div class="line"><a name="l16881"></a><span class="lineno">16881</span>&#160; </div>
+<div class="line"><a name="l16882"></a><span class="lineno">16882</span>&#160;    <span class="comment">// HeapSizeLimit is in effect for this heap.</span></div>
+<div class="line"><a name="l16883"></a><span class="lineno">16883</span>&#160;    <span class="keywordflow">if</span>((m_HeapSizeLimitMask &amp; (1u &lt;&lt; heapIndex)) != 0)</div>
+<div class="line"><a name="l16884"></a><span class="lineno">16884</span>&#160;    {</div>
+<div class="line"><a name="l16885"></a><span class="lineno">16885</span>&#160;        <span class="keyword">const</span> VkDeviceSize heapSize = m_MemProps.memoryHeaps[heapIndex].size;</div>
+<div class="line"><a name="l16886"></a><span class="lineno">16886</span>&#160;        VkDeviceSize blockBytes = m_Budget.m_BlockBytes[heapIndex];</div>
+<div class="line"><a name="l16887"></a><span class="lineno">16887</span>&#160;        <span class="keywordflow">for</span>(;;)</div>
+<div class="line"><a name="l16888"></a><span class="lineno">16888</span>&#160;        {</div>
+<div class="line"><a name="l16889"></a><span class="lineno">16889</span>&#160;            <span class="keyword">const</span> VkDeviceSize blockBytesAfterAllocation = blockBytes + pAllocateInfo-&gt;allocationSize;</div>
+<div class="line"><a name="l16890"></a><span class="lineno">16890</span>&#160;            <span class="keywordflow">if</span>(blockBytesAfterAllocation &gt; heapSize)</div>
+<div class="line"><a name="l16891"></a><span class="lineno">16891</span>&#160;            {</div>
+<div class="line"><a name="l16892"></a><span class="lineno">16892</span>&#160;                <span class="keywordflow">return</span> VK_ERROR_OUT_OF_DEVICE_MEMORY;</div>
+<div class="line"><a name="l16893"></a><span class="lineno">16893</span>&#160;            }</div>
+<div class="line"><a name="l16894"></a><span class="lineno">16894</span>&#160;            <span class="keywordflow">if</span>(m_Budget.m_BlockBytes[heapIndex].compare_exchange_strong(blockBytes, blockBytesAfterAllocation))</div>
 <div class="line"><a name="l16895"></a><span class="lineno">16895</span>&#160;            {</div>
-<div class="line"><a name="l16896"></a><span class="lineno">16896</span>&#160;                memRange.size = allocationSize - memRange.offset;</div>
+<div class="line"><a name="l16896"></a><span class="lineno">16896</span>&#160;                <span class="keywordflow">break</span>;</div>
 <div class="line"><a name="l16897"></a><span class="lineno">16897</span>&#160;            }</div>
-<div class="line"><a name="l16898"></a><span class="lineno">16898</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16899"></a><span class="lineno">16899</span>&#160;            {</div>
-<div class="line"><a name="l16900"></a><span class="lineno">16900</span>&#160;                VMA_ASSERT(offset + size &lt;= allocationSize);</div>
-<div class="line"><a name="l16901"></a><span class="lineno">16901</span>&#160;                memRange.size = VMA_MIN(</div>
-<div class="line"><a name="l16902"></a><span class="lineno">16902</span>&#160;                    VmaAlignUp(size + (offset - memRange.offset), nonCoherentAtomSize),</div>
-<div class="line"><a name="l16903"></a><span class="lineno">16903</span>&#160;                    allocationSize - memRange.offset);</div>
-<div class="line"><a name="l16904"></a><span class="lineno">16904</span>&#160;            }</div>
-<div class="line"><a name="l16905"></a><span class="lineno">16905</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16906"></a><span class="lineno">16906</span>&#160; </div>
-<div class="line"><a name="l16907"></a><span class="lineno">16907</span>&#160;        <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
-<div class="line"><a name="l16908"></a><span class="lineno">16908</span>&#160;        {</div>
-<div class="line"><a name="l16909"></a><span class="lineno">16909</span>&#160;            <span class="comment">// 1. Still within this allocation.</span></div>
-<div class="line"><a name="l16910"></a><span class="lineno">16910</span>&#160;            memRange.offset = VmaAlignDown(offset, nonCoherentAtomSize);</div>
-<div class="line"><a name="l16911"></a><span class="lineno">16911</span>&#160;            <span class="keywordflow">if</span>(size == VK_WHOLE_SIZE)</div>
-<div class="line"><a name="l16912"></a><span class="lineno">16912</span>&#160;            {</div>
-<div class="line"><a name="l16913"></a><span class="lineno">16913</span>&#160;                size = allocationSize - offset;</div>
-<div class="line"><a name="l16914"></a><span class="lineno">16914</span>&#160;            }</div>
-<div class="line"><a name="l16915"></a><span class="lineno">16915</span>&#160;            <span class="keywordflow">else</span></div>
-<div class="line"><a name="l16916"></a><span class="lineno">16916</span>&#160;            {</div>
-<div class="line"><a name="l16917"></a><span class="lineno">16917</span>&#160;                VMA_ASSERT(offset + size &lt;= allocationSize);</div>
-<div class="line"><a name="l16918"></a><span class="lineno">16918</span>&#160;            }</div>
-<div class="line"><a name="l16919"></a><span class="lineno">16919</span>&#160;            memRange.size = VmaAlignUp(size + (offset - memRange.offset), nonCoherentAtomSize);</div>
-<div class="line"><a name="l16920"></a><span class="lineno">16920</span>&#160; </div>
-<div class="line"><a name="l16921"></a><span class="lineno">16921</span>&#160;            <span class="comment">// 2. Adjust to whole block.</span></div>
-<div class="line"><a name="l16922"></a><span class="lineno">16922</span>&#160;            <span class="keyword">const</span> VkDeviceSize allocationOffset = hAllocation-&gt;GetOffset();</div>
-<div class="line"><a name="l16923"></a><span class="lineno">16923</span>&#160;            VMA_ASSERT(allocationOffset % nonCoherentAtomSize == 0);</div>
-<div class="line"><a name="l16924"></a><span class="lineno">16924</span>&#160;            <span class="keyword">const</span> VkDeviceSize blockSize = hAllocation-&gt;GetBlock()-&gt;m_pMetadata-&gt;GetSize();</div>
-<div class="line"><a name="l16925"></a><span class="lineno">16925</span>&#160;            memRange.offset += allocationOffset;</div>
-<div class="line"><a name="l16926"></a><span class="lineno">16926</span>&#160;            memRange.size = VMA_MIN(memRange.size, blockSize - memRange.offset);</div>
-<div class="line"><a name="l16927"></a><span class="lineno">16927</span>&#160;            </div>
-<div class="line"><a name="l16928"></a><span class="lineno">16928</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16929"></a><span class="lineno">16929</span>&#160;        }</div>
-<div class="line"><a name="l16930"></a><span class="lineno">16930</span>&#160;        </div>
-<div class="line"><a name="l16931"></a><span class="lineno">16931</span>&#160;        <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l16932"></a><span class="lineno">16932</span>&#160;            VMA_ASSERT(0);</div>
-<div class="line"><a name="l16933"></a><span class="lineno">16933</span>&#160;        }</div>
-<div class="line"><a name="l16934"></a><span class="lineno">16934</span>&#160; </div>
-<div class="line"><a name="l16935"></a><span class="lineno">16935</span>&#160;        <span class="keywordflow">switch</span>(op)</div>
-<div class="line"><a name="l16936"></a><span class="lineno">16936</span>&#160;        {</div>
-<div class="line"><a name="l16937"></a><span class="lineno">16937</span>&#160;        <span class="keywordflow">case</span> VMA_CACHE_FLUSH:</div>
-<div class="line"><a name="l16938"></a><span class="lineno">16938</span>&#160;            (*GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hDevice, 1, &amp;memRange);</div>
-<div class="line"><a name="l16939"></a><span class="lineno">16939</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16940"></a><span class="lineno">16940</span>&#160;        <span class="keywordflow">case</span> VMA_CACHE_INVALIDATE:</div>
-<div class="line"><a name="l16941"></a><span class="lineno">16941</span>&#160;            (*GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hDevice, 1, &amp;memRange);</div>
-<div class="line"><a name="l16942"></a><span class="lineno">16942</span>&#160;            <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l16943"></a><span class="lineno">16943</span>&#160;        <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l16944"></a><span class="lineno">16944</span>&#160;            VMA_ASSERT(0);</div>
-<div class="line"><a name="l16945"></a><span class="lineno">16945</span>&#160;        }</div>
-<div class="line"><a name="l16946"></a><span class="lineno">16946</span>&#160;    }</div>
-<div class="line"><a name="l16947"></a><span class="lineno">16947</span>&#160;    <span class="comment">// else: Just ignore this call.</span></div>
-<div class="line"><a name="l16948"></a><span class="lineno">16948</span>&#160;}</div>
-<div class="line"><a name="l16949"></a><span class="lineno">16949</span>&#160; </div>
-<div class="line"><a name="l16950"></a><span class="lineno">16950</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::FreeDedicatedMemory(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l16951"></a><span class="lineno">16951</span>&#160;{</div>
-<div class="line"><a name="l16952"></a><span class="lineno">16952</span>&#160;    VMA_ASSERT(allocation &amp;&amp; allocation-&gt;GetType() == VmaAllocation_T::ALLOCATION_TYPE_DEDICATED);</div>
-<div class="line"><a name="l16953"></a><span class="lineno">16953</span>&#160; </div>
-<div class="line"><a name="l16954"></a><span class="lineno">16954</span>&#160;    <span class="keyword">const</span> uint32_t memTypeIndex = allocation-&gt;GetMemoryTypeIndex();</div>
-<div class="line"><a name="l16955"></a><span class="lineno">16955</span>&#160;    {</div>
-<div class="line"><a name="l16956"></a><span class="lineno">16956</span>&#160;        VmaMutexLockWrite lock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);</div>
-<div class="line"><a name="l16957"></a><span class="lineno">16957</span>&#160;        AllocationVectorType* <span class="keyword">const</span> pDedicatedAllocations = m_pDedicatedAllocations[memTypeIndex];</div>
-<div class="line"><a name="l16958"></a><span class="lineno">16958</span>&#160;        VMA_ASSERT(pDedicatedAllocations);</div>
-<div class="line"><a name="l16959"></a><span class="lineno">16959</span>&#160;        <span class="keywordtype">bool</span> success = VmaVectorRemoveSorted&lt;VmaPointerLess&gt;(*pDedicatedAllocations, allocation);</div>
-<div class="line"><a name="l16960"></a><span class="lineno">16960</span>&#160;        VMA_ASSERT(success);</div>
-<div class="line"><a name="l16961"></a><span class="lineno">16961</span>&#160;    }</div>
-<div class="line"><a name="l16962"></a><span class="lineno">16962</span>&#160; </div>
-<div class="line"><a name="l16963"></a><span class="lineno">16963</span>&#160;    VkDeviceMemory hMemory = allocation-&gt;GetMemory();</div>
-<div class="line"><a name="l16964"></a><span class="lineno">16964</span>&#160;    </div>
-<div class="line"><a name="l16965"></a><span class="lineno">16965</span>&#160;    <span class="comment">/*</span></div>
-<div class="line"><a name="l16966"></a><span class="lineno">16966</span>&#160;<span class="comment">    There is no need to call this, because Vulkan spec allows to skip vkUnmapMemory</span></div>
-<div class="line"><a name="l16967"></a><span class="lineno">16967</span>&#160;<span class="comment">    before vkFreeMemory.</span></div>
-<div class="line"><a name="l16968"></a><span class="lineno">16968</span>&#160;<span class="comment"></span> </div>
-<div class="line"><a name="l16969"></a><span class="lineno">16969</span>&#160;<span class="comment">    if(allocation-&gt;GetMappedData() != VMA_NULL)</span></div>
-<div class="line"><a name="l16970"></a><span class="lineno">16970</span>&#160;<span class="comment">    {</span></div>
-<div class="line"><a name="l16971"></a><span class="lineno">16971</span>&#160;<span class="comment">        (*m_VulkanFunctions.vkUnmapMemory)(m_hDevice, hMemory);</span></div>
-<div class="line"><a name="l16972"></a><span class="lineno">16972</span>&#160;<span class="comment">    }</span></div>
-<div class="line"><a name="l16973"></a><span class="lineno">16973</span>&#160;<span class="comment">    */</span></div>
-<div class="line"><a name="l16974"></a><span class="lineno">16974</span>&#160;    </div>
-<div class="line"><a name="l16975"></a><span class="lineno">16975</span>&#160;    FreeVulkanMemory(memTypeIndex, allocation-&gt;GetSize(), hMemory);</div>
-<div class="line"><a name="l16976"></a><span class="lineno">16976</span>&#160; </div>
-<div class="line"><a name="l16977"></a><span class="lineno">16977</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Freed DedicatedMemory MemoryTypeIndex=%u&quot;</span>, memTypeIndex);</div>
-<div class="line"><a name="l16978"></a><span class="lineno">16978</span>&#160;}</div>
-<div class="line"><a name="l16979"></a><span class="lineno">16979</span>&#160; </div>
-<div class="line"><a name="l16980"></a><span class="lineno">16980</span>&#160;uint32_t VmaAllocator_T::CalculateGpuDefragmentationMemoryTypeBits()<span class="keyword"> const</span></div>
-<div class="line"><a name="l16981"></a><span class="lineno">16981</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l16982"></a><span class="lineno">16982</span>&#160;    VkBufferCreateInfo dummyBufCreateInfo;</div>
-<div class="line"><a name="l16983"></a><span class="lineno">16983</span>&#160;    VmaFillGpuDefragmentationBufferCreateInfo(dummyBufCreateInfo);</div>
-<div class="line"><a name="l16984"></a><span class="lineno">16984</span>&#160; </div>
-<div class="line"><a name="l16985"></a><span class="lineno">16985</span>&#160;    uint32_t memoryTypeBits = 0;</div>
-<div class="line"><a name="l16986"></a><span class="lineno">16986</span>&#160; </div>
-<div class="line"><a name="l16987"></a><span class="lineno">16987</span>&#160;    <span class="comment">// Create buffer.</span></div>
-<div class="line"><a name="l16988"></a><span class="lineno">16988</span>&#160;    VkBuffer buf = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l16989"></a><span class="lineno">16989</span>&#160;    VkResult res = (*GetVulkanFunctions().vkCreateBuffer)(</div>
-<div class="line"><a name="l16990"></a><span class="lineno">16990</span>&#160;        m_hDevice, &amp;dummyBufCreateInfo, GetAllocationCallbacks(), &amp;buf);</div>
-<div class="line"><a name="l16991"></a><span class="lineno">16991</span>&#160;    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l16992"></a><span class="lineno">16992</span>&#160;    {</div>
-<div class="line"><a name="l16993"></a><span class="lineno">16993</span>&#160;        <span class="comment">// Query for supported memory types.</span></div>
-<div class="line"><a name="l16994"></a><span class="lineno">16994</span>&#160;        VkMemoryRequirements memReq;</div>
-<div class="line"><a name="l16995"></a><span class="lineno">16995</span>&#160;        (*GetVulkanFunctions().vkGetBufferMemoryRequirements)(m_hDevice, buf, &amp;memReq);</div>
-<div class="line"><a name="l16996"></a><span class="lineno">16996</span>&#160;        memoryTypeBits = memReq.memoryTypeBits;</div>
-<div class="line"><a name="l16997"></a><span class="lineno">16997</span>&#160; </div>
-<div class="line"><a name="l16998"></a><span class="lineno">16998</span>&#160;        <span class="comment">// Destroy buffer.</span></div>
-<div class="line"><a name="l16999"></a><span class="lineno">16999</span>&#160;        (*GetVulkanFunctions().vkDestroyBuffer)(m_hDevice, buf, GetAllocationCallbacks());</div>
-<div class="line"><a name="l17000"></a><span class="lineno">17000</span>&#160;    }</div>
-<div class="line"><a name="l17001"></a><span class="lineno">17001</span>&#160; </div>
-<div class="line"><a name="l17002"></a><span class="lineno">17002</span>&#160;    <span class="keywordflow">return</span> memoryTypeBits;</div>
-<div class="line"><a name="l17003"></a><span class="lineno">17003</span>&#160;}</div>
-<div class="line"><a name="l17004"></a><span class="lineno">17004</span>&#160; </div>
-<div class="line"><a name="l17005"></a><span class="lineno">17005</span>&#160;uint32_t VmaAllocator_T::CalculateGlobalMemoryTypeBits()<span class="keyword"> const</span></div>
-<div class="line"><a name="l17006"></a><span class="lineno">17006</span>&#160;<span class="keyword"></span>{</div>
-<div class="line"><a name="l17007"></a><span class="lineno">17007</span>&#160;    <span class="comment">// Make sure memory information is already fetched.</span></div>
-<div class="line"><a name="l17008"></a><span class="lineno">17008</span>&#160;    VMA_ASSERT(GetMemoryTypeCount() &gt; 0);</div>
-<div class="line"><a name="l17009"></a><span class="lineno">17009</span>&#160; </div>
-<div class="line"><a name="l17010"></a><span class="lineno">17010</span>&#160;    uint32_t memoryTypeBits = UINT32_MAX;</div>
-<div class="line"><a name="l17011"></a><span class="lineno">17011</span>&#160; </div>
-<div class="line"><a name="l17012"></a><span class="lineno">17012</span>&#160;    <span class="keywordflow">if</span>(!m_UseAmdDeviceCoherentMemory)</div>
-<div class="line"><a name="l17013"></a><span class="lineno">17013</span>&#160;    {</div>
-<div class="line"><a name="l17014"></a><span class="lineno">17014</span>&#160;        <span class="comment">// Exclude memory types that have VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD.</span></div>
-<div class="line"><a name="l17015"></a><span class="lineno">17015</span>&#160;        <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
-<div class="line"><a name="l17016"></a><span class="lineno">17016</span>&#160;        {</div>
-<div class="line"><a name="l17017"></a><span class="lineno">17017</span>&#160;            <span class="keywordflow">if</span>((m_MemProps.memoryTypes[memTypeIndex].propertyFlags &amp; VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY) != 0)</div>
-<div class="line"><a name="l17018"></a><span class="lineno">17018</span>&#160;            {</div>
-<div class="line"><a name="l17019"></a><span class="lineno">17019</span>&#160;                memoryTypeBits &amp;= ~(1u &lt;&lt; memTypeIndex);</div>
-<div class="line"><a name="l17020"></a><span class="lineno">17020</span>&#160;            }</div>
-<div class="line"><a name="l17021"></a><span class="lineno">17021</span>&#160;        }</div>
-<div class="line"><a name="l17022"></a><span class="lineno">17022</span>&#160;    }</div>
-<div class="line"><a name="l17023"></a><span class="lineno">17023</span>&#160; </div>
-<div class="line"><a name="l17024"></a><span class="lineno">17024</span>&#160;    <span class="keywordflow">return</span> memoryTypeBits;</div>
-<div class="line"><a name="l17025"></a><span class="lineno">17025</span>&#160;}</div>
-<div class="line"><a name="l17026"></a><span class="lineno">17026</span>&#160; </div>
-<div class="line"><a name="l17027"></a><span class="lineno">17027</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l17028"></a><span class="lineno">17028</span>&#160; </div>
-<div class="line"><a name="l17029"></a><span class="lineno">17029</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::UpdateVulkanBudget()</div>
-<div class="line"><a name="l17030"></a><span class="lineno">17030</span>&#160;{</div>
-<div class="line"><a name="l17031"></a><span class="lineno">17031</span>&#160;    VMA_ASSERT(m_UseExtMemoryBudget);</div>
+<div class="line"><a name="l16898"></a><span class="lineno">16898</span>&#160;        }</div>
+<div class="line"><a name="l16899"></a><span class="lineno">16899</span>&#160;    }</div>
+<div class="line"><a name="l16900"></a><span class="lineno">16900</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16901"></a><span class="lineno">16901</span>&#160;    {</div>
+<div class="line"><a name="l16902"></a><span class="lineno">16902</span>&#160;        m_Budget.m_BlockBytes[heapIndex] += pAllocateInfo-&gt;allocationSize;</div>
+<div class="line"><a name="l16903"></a><span class="lineno">16903</span>&#160;    }</div>
+<div class="line"><a name="l16904"></a><span class="lineno">16904</span>&#160; </div>
+<div class="line"><a name="l16905"></a><span class="lineno">16905</span>&#160;    <span class="comment">// VULKAN CALL vkAllocateMemory.</span></div>
+<div class="line"><a name="l16906"></a><span class="lineno">16906</span>&#160;    VkResult res = (*m_VulkanFunctions.vkAllocateMemory)(m_hDevice, pAllocateInfo, GetAllocationCallbacks(), pMemory);</div>
+<div class="line"><a name="l16907"></a><span class="lineno">16907</span>&#160; </div>
+<div class="line"><a name="l16908"></a><span class="lineno">16908</span>&#160;    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l16909"></a><span class="lineno">16909</span>&#160;    {</div>
+<div class="line"><a name="l16910"></a><span class="lineno">16910</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l16911"></a><span class="lineno">16911</span>&#160;        ++m_Budget.m_OperationsSinceBudgetFetch;</div>
+<div class="line"><a name="l16912"></a><span class="lineno">16912</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l16913"></a><span class="lineno">16913</span>&#160; </div>
+<div class="line"><a name="l16914"></a><span class="lineno">16914</span>&#160;        <span class="comment">// Informative callback.</span></div>
+<div class="line"><a name="l16915"></a><span class="lineno">16915</span>&#160;        <span class="keywordflow">if</span>(m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">pfnAllocate</a> != VMA_NULL)</div>
+<div class="line"><a name="l16916"></a><span class="lineno">16916</span>&#160;        {</div>
+<div class="line"><a name="l16917"></a><span class="lineno">16917</span>&#160;            (*m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">pfnAllocate</a>)(<span class="keyword">this</span>, pAllocateInfo-&gt;memoryTypeIndex, *pMemory, pAllocateInfo-&gt;allocationSize, m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">pUserData</a>);</div>
+<div class="line"><a name="l16918"></a><span class="lineno">16918</span>&#160;        }</div>
+<div class="line"><a name="l16919"></a><span class="lineno">16919</span>&#160;    }</div>
+<div class="line"><a name="l16920"></a><span class="lineno">16920</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16921"></a><span class="lineno">16921</span>&#160;    {</div>
+<div class="line"><a name="l16922"></a><span class="lineno">16922</span>&#160;        m_Budget.m_BlockBytes[heapIndex] -= pAllocateInfo-&gt;allocationSize;</div>
+<div class="line"><a name="l16923"></a><span class="lineno">16923</span>&#160;    }</div>
+<div class="line"><a name="l16924"></a><span class="lineno">16924</span>&#160; </div>
+<div class="line"><a name="l16925"></a><span class="lineno">16925</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l16926"></a><span class="lineno">16926</span>&#160;}</div>
+<div class="line"><a name="l16927"></a><span class="lineno">16927</span>&#160; </div>
+<div class="line"><a name="l16928"></a><span class="lineno">16928</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, VkDeviceMemory hMemory)</div>
+<div class="line"><a name="l16929"></a><span class="lineno">16929</span>&#160;{</div>
+<div class="line"><a name="l16930"></a><span class="lineno">16930</span>&#160;    <span class="comment">// Informative callback.</span></div>
+<div class="line"><a name="l16931"></a><span class="lineno">16931</span>&#160;    <span class="keywordflow">if</span>(m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">pfnFree</a> != VMA_NULL)</div>
+<div class="line"><a name="l16932"></a><span class="lineno">16932</span>&#160;    {</div>
+<div class="line"><a name="l16933"></a><span class="lineno">16933</span>&#160;        (*m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">pfnFree</a>)(<span class="keyword">this</span>, memoryType, hMemory, size, m_DeviceMemoryCallbacks.<a class="code" href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">pUserData</a>);</div>
+<div class="line"><a name="l16934"></a><span class="lineno">16934</span>&#160;    }</div>
+<div class="line"><a name="l16935"></a><span class="lineno">16935</span>&#160; </div>
+<div class="line"><a name="l16936"></a><span class="lineno">16936</span>&#160;    <span class="comment">// VULKAN CALL vkFreeMemory.</span></div>
+<div class="line"><a name="l16937"></a><span class="lineno">16937</span>&#160;    (*m_VulkanFunctions.vkFreeMemory)(m_hDevice, hMemory, GetAllocationCallbacks());</div>
+<div class="line"><a name="l16938"></a><span class="lineno">16938</span>&#160; </div>
+<div class="line"><a name="l16939"></a><span class="lineno">16939</span>&#160;    m_Budget.m_BlockBytes[MemoryTypeIndexToHeapIndex(memoryType)] -= size;</div>
+<div class="line"><a name="l16940"></a><span class="lineno">16940</span>&#160;}</div>
+<div class="line"><a name="l16941"></a><span class="lineno">16941</span>&#160; </div>
+<div class="line"><a name="l16942"></a><span class="lineno">16942</span>&#160;VkResult VmaAllocator_T::BindVulkanBuffer(</div>
+<div class="line"><a name="l16943"></a><span class="lineno">16943</span>&#160;    VkDeviceMemory memory,</div>
+<div class="line"><a name="l16944"></a><span class="lineno">16944</span>&#160;    VkDeviceSize memoryOffset,</div>
+<div class="line"><a name="l16945"></a><span class="lineno">16945</span>&#160;    VkBuffer buffer,</div>
+<div class="line"><a name="l16946"></a><span class="lineno">16946</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
+<div class="line"><a name="l16947"></a><span class="lineno">16947</span>&#160;{</div>
+<div class="line"><a name="l16948"></a><span class="lineno">16948</span>&#160;    <span class="keywordflow">if</span>(pNext != VMA_NULL)</div>
+<div class="line"><a name="l16949"></a><span class="lineno">16949</span>&#160;    {</div>
+<div class="line"><a name="l16950"></a><span class="lineno">16950</span>&#160;<span class="preprocessor">#if VMA_VULKAN_VERSION &gt;= 1001000 || VMA_BIND_MEMORY2</span></div>
+<div class="line"><a name="l16951"></a><span class="lineno">16951</span>&#160;        <span class="keywordflow">if</span>((m_UseKhrBindMemory2 || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0)) &amp;&amp;</div>
+<div class="line"><a name="l16952"></a><span class="lineno">16952</span>&#160;            m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL)</div>
+<div class="line"><a name="l16953"></a><span class="lineno">16953</span>&#160;        {</div>
+<div class="line"><a name="l16954"></a><span class="lineno">16954</span>&#160;            VkBindBufferMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR };</div>
+<div class="line"><a name="l16955"></a><span class="lineno">16955</span>&#160;            bindBufferMemoryInfo.pNext = pNext;</div>
+<div class="line"><a name="l16956"></a><span class="lineno">16956</span>&#160;            bindBufferMemoryInfo.buffer = buffer;</div>
+<div class="line"><a name="l16957"></a><span class="lineno">16957</span>&#160;            bindBufferMemoryInfo.memory = memory;</div>
+<div class="line"><a name="l16958"></a><span class="lineno">16958</span>&#160;            bindBufferMemoryInfo.memoryOffset = memoryOffset;</div>
+<div class="line"><a name="l16959"></a><span class="lineno">16959</span>&#160;            <span class="keywordflow">return</span> (*m_VulkanFunctions.vkBindBufferMemory2KHR)(m_hDevice, 1, &amp;bindBufferMemoryInfo);</div>
+<div class="line"><a name="l16960"></a><span class="lineno">16960</span>&#160;        }</div>
+<div class="line"><a name="l16961"></a><span class="lineno">16961</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16962"></a><span class="lineno">16962</span>&#160;<span class="preprocessor">#endif // #if VMA_VULKAN_VERSION &gt;= 1001000 || VMA_BIND_MEMORY2</span></div>
+<div class="line"><a name="l16963"></a><span class="lineno">16963</span>&#160;        {</div>
+<div class="line"><a name="l16964"></a><span class="lineno">16964</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_EXTENSION_NOT_PRESENT;</div>
+<div class="line"><a name="l16965"></a><span class="lineno">16965</span>&#160;        }</div>
+<div class="line"><a name="l16966"></a><span class="lineno">16966</span>&#160;    }</div>
+<div class="line"><a name="l16967"></a><span class="lineno">16967</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16968"></a><span class="lineno">16968</span>&#160;    {</div>
+<div class="line"><a name="l16969"></a><span class="lineno">16969</span>&#160;        <span class="keywordflow">return</span> (*m_VulkanFunctions.vkBindBufferMemory)(m_hDevice, buffer, memory, memoryOffset);</div>
+<div class="line"><a name="l16970"></a><span class="lineno">16970</span>&#160;    }</div>
+<div class="line"><a name="l16971"></a><span class="lineno">16971</span>&#160;}</div>
+<div class="line"><a name="l16972"></a><span class="lineno">16972</span>&#160; </div>
+<div class="line"><a name="l16973"></a><span class="lineno">16973</span>&#160;VkResult VmaAllocator_T::BindVulkanImage(</div>
+<div class="line"><a name="l16974"></a><span class="lineno">16974</span>&#160;    VkDeviceMemory memory,</div>
+<div class="line"><a name="l16975"></a><span class="lineno">16975</span>&#160;    VkDeviceSize memoryOffset,</div>
+<div class="line"><a name="l16976"></a><span class="lineno">16976</span>&#160;    VkImage image,</div>
+<div class="line"><a name="l16977"></a><span class="lineno">16977</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
+<div class="line"><a name="l16978"></a><span class="lineno">16978</span>&#160;{</div>
+<div class="line"><a name="l16979"></a><span class="lineno">16979</span>&#160;    <span class="keywordflow">if</span>(pNext != VMA_NULL)</div>
+<div class="line"><a name="l16980"></a><span class="lineno">16980</span>&#160;    {</div>
+<div class="line"><a name="l16981"></a><span class="lineno">16981</span>&#160;<span class="preprocessor">#if VMA_VULKAN_VERSION &gt;= 1001000 || VMA_BIND_MEMORY2</span></div>
+<div class="line"><a name="l16982"></a><span class="lineno">16982</span>&#160;        <span class="keywordflow">if</span>((m_UseKhrBindMemory2 || m_VulkanApiVersion &gt;= VK_MAKE_VERSION(1, 1, 0)) &amp;&amp;</div>
+<div class="line"><a name="l16983"></a><span class="lineno">16983</span>&#160;            m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL)</div>
+<div class="line"><a name="l16984"></a><span class="lineno">16984</span>&#160;        {</div>
+<div class="line"><a name="l16985"></a><span class="lineno">16985</span>&#160;            VkBindImageMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR };</div>
+<div class="line"><a name="l16986"></a><span class="lineno">16986</span>&#160;            bindBufferMemoryInfo.pNext = pNext;</div>
+<div class="line"><a name="l16987"></a><span class="lineno">16987</span>&#160;            bindBufferMemoryInfo.image = image;</div>
+<div class="line"><a name="l16988"></a><span class="lineno">16988</span>&#160;            bindBufferMemoryInfo.memory = memory;</div>
+<div class="line"><a name="l16989"></a><span class="lineno">16989</span>&#160;            bindBufferMemoryInfo.memoryOffset = memoryOffset;</div>
+<div class="line"><a name="l16990"></a><span class="lineno">16990</span>&#160;            <span class="keywordflow">return</span> (*m_VulkanFunctions.vkBindImageMemory2KHR)(m_hDevice, 1, &amp;bindBufferMemoryInfo);</div>
+<div class="line"><a name="l16991"></a><span class="lineno">16991</span>&#160;        }</div>
+<div class="line"><a name="l16992"></a><span class="lineno">16992</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16993"></a><span class="lineno">16993</span>&#160;<span class="preprocessor">#endif // #if VMA_BIND_MEMORY2</span></div>
+<div class="line"><a name="l16994"></a><span class="lineno">16994</span>&#160;        {</div>
+<div class="line"><a name="l16995"></a><span class="lineno">16995</span>&#160;            <span class="keywordflow">return</span> VK_ERROR_EXTENSION_NOT_PRESENT;</div>
+<div class="line"><a name="l16996"></a><span class="lineno">16996</span>&#160;        }</div>
+<div class="line"><a name="l16997"></a><span class="lineno">16997</span>&#160;    }</div>
+<div class="line"><a name="l16998"></a><span class="lineno">16998</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l16999"></a><span class="lineno">16999</span>&#160;    {</div>
+<div class="line"><a name="l17000"></a><span class="lineno">17000</span>&#160;        <span class="keywordflow">return</span> (*m_VulkanFunctions.vkBindImageMemory)(m_hDevice, image, memory, memoryOffset);</div>
+<div class="line"><a name="l17001"></a><span class="lineno">17001</span>&#160;    }</div>
+<div class="line"><a name="l17002"></a><span class="lineno">17002</span>&#160;}</div>
+<div class="line"><a name="l17003"></a><span class="lineno">17003</span>&#160; </div>
+<div class="line"><a name="l17004"></a><span class="lineno">17004</span>&#160;VkResult VmaAllocator_T::Map(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, <span class="keywordtype">void</span>** ppData)</div>
+<div class="line"><a name="l17005"></a><span class="lineno">17005</span>&#160;{</div>
+<div class="line"><a name="l17006"></a><span class="lineno">17006</span>&#160;    <span class="keywordflow">if</span>(hAllocation-&gt;CanBecomeLost())</div>
+<div class="line"><a name="l17007"></a><span class="lineno">17007</span>&#160;    {</div>
+<div class="line"><a name="l17008"></a><span class="lineno">17008</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_MEMORY_MAP_FAILED;</div>
+<div class="line"><a name="l17009"></a><span class="lineno">17009</span>&#160;    }</div>
+<div class="line"><a name="l17010"></a><span class="lineno">17010</span>&#160; </div>
+<div class="line"><a name="l17011"></a><span class="lineno">17011</span>&#160;    <span class="keywordflow">switch</span>(hAllocation-&gt;GetType())</div>
+<div class="line"><a name="l17012"></a><span class="lineno">17012</span>&#160;    {</div>
+<div class="line"><a name="l17013"></a><span class="lineno">17013</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
+<div class="line"><a name="l17014"></a><span class="lineno">17014</span>&#160;        {</div>
+<div class="line"><a name="l17015"></a><span class="lineno">17015</span>&#160;            VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = hAllocation-&gt;GetBlock();</div>
+<div class="line"><a name="l17016"></a><span class="lineno">17016</span>&#160;            <span class="keywordtype">char</span> *pBytes = VMA_NULL;</div>
+<div class="line"><a name="l17017"></a><span class="lineno">17017</span>&#160;            VkResult res = pBlock-&gt;Map(<span class="keyword">this</span>, 1, (<span class="keywordtype">void</span>**)&amp;pBytes);</div>
+<div class="line"><a name="l17018"></a><span class="lineno">17018</span>&#160;            <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l17019"></a><span class="lineno">17019</span>&#160;            {</div>
+<div class="line"><a name="l17020"></a><span class="lineno">17020</span>&#160;                *ppData = pBytes + (ptrdiff_t)hAllocation-&gt;GetOffset();</div>
+<div class="line"><a name="l17021"></a><span class="lineno">17021</span>&#160;                hAllocation-&gt;BlockAllocMap();</div>
+<div class="line"><a name="l17022"></a><span class="lineno">17022</span>&#160;            }</div>
+<div class="line"><a name="l17023"></a><span class="lineno">17023</span>&#160;            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l17024"></a><span class="lineno">17024</span>&#160;        }</div>
+<div class="line"><a name="l17025"></a><span class="lineno">17025</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
+<div class="line"><a name="l17026"></a><span class="lineno">17026</span>&#160;        <span class="keywordflow">return</span> hAllocation-&gt;DedicatedAllocMap(<span class="keyword">this</span>, ppData);</div>
+<div class="line"><a name="l17027"></a><span class="lineno">17027</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l17028"></a><span class="lineno">17028</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l17029"></a><span class="lineno">17029</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_MEMORY_MAP_FAILED;</div>
+<div class="line"><a name="l17030"></a><span class="lineno">17030</span>&#160;    }</div>
+<div class="line"><a name="l17031"></a><span class="lineno">17031</span>&#160;}</div>
 <div class="line"><a name="l17032"></a><span class="lineno">17032</span>&#160; </div>
-<div class="line"><a name="l17033"></a><span class="lineno">17033</span>&#160;    VkPhysicalDeviceMemoryProperties2KHR memProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR };</div>
-<div class="line"><a name="l17034"></a><span class="lineno">17034</span>&#160; </div>
-<div class="line"><a name="l17035"></a><span class="lineno">17035</span>&#160;    VkPhysicalDeviceMemoryBudgetPropertiesEXT budgetProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT };</div>
-<div class="line"><a name="l17036"></a><span class="lineno">17036</span>&#160;    VmaPnextChainPushFront(&amp;memProps, &amp;budgetProps);</div>
-<div class="line"><a name="l17037"></a><span class="lineno">17037</span>&#160; </div>
-<div class="line"><a name="l17038"></a><span class="lineno">17038</span>&#160;    GetVulkanFunctions().vkGetPhysicalDeviceMemoryProperties2KHR(m_PhysicalDevice, &amp;memProps);</div>
-<div class="line"><a name="l17039"></a><span class="lineno">17039</span>&#160; </div>
-<div class="line"><a name="l17040"></a><span class="lineno">17040</span>&#160;    {</div>
-<div class="line"><a name="l17041"></a><span class="lineno">17041</span>&#160;        VmaMutexLockWrite lockWrite(m_Budget.m_BudgetMutex, m_UseMutex);</div>
-<div class="line"><a name="l17042"></a><span class="lineno">17042</span>&#160; </div>
-<div class="line"><a name="l17043"></a><span class="lineno">17043</span>&#160;        <span class="keywordflow">for</span>(uint32_t heapIndex = 0; heapIndex &lt; GetMemoryHeapCount(); ++heapIndex)</div>
-<div class="line"><a name="l17044"></a><span class="lineno">17044</span>&#160;        {</div>
-<div class="line"><a name="l17045"></a><span class="lineno">17045</span>&#160;            m_Budget.m_VulkanUsage[heapIndex] = budgetProps.heapUsage[heapIndex];</div>
-<div class="line"><a name="l17046"></a><span class="lineno">17046</span>&#160;            m_Budget.m_VulkanBudget[heapIndex] = budgetProps.heapBudget[heapIndex];</div>
-<div class="line"><a name="l17047"></a><span class="lineno">17047</span>&#160;            m_Budget.m_BlockBytesAtBudgetFetch[heapIndex] = m_Budget.m_BlockBytes[heapIndex].load();</div>
-<div class="line"><a name="l17048"></a><span class="lineno">17048</span>&#160; </div>
-<div class="line"><a name="l17049"></a><span class="lineno">17049</span>&#160;            <span class="comment">// Some bugged drivers return the budget incorrectly, e.g. 0 or much bigger than heap size.</span></div>
-<div class="line"><a name="l17050"></a><span class="lineno">17050</span>&#160;            <span class="keywordflow">if</span>(m_Budget.m_VulkanBudget[heapIndex] == 0)</div>
-<div class="line"><a name="l17051"></a><span class="lineno">17051</span>&#160;            {</div>
-<div class="line"><a name="l17052"></a><span class="lineno">17052</span>&#160;                m_Budget.m_VulkanBudget[heapIndex] = m_MemProps.memoryHeaps[heapIndex].size * 8 / 10; <span class="comment">// 80% heuristics.</span></div>
-<div class="line"><a name="l17053"></a><span class="lineno">17053</span>&#160;            }</div>
-<div class="line"><a name="l17054"></a><span class="lineno">17054</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span>(m_Budget.m_VulkanBudget[heapIndex] &gt; m_MemProps.memoryHeaps[heapIndex].size)</div>
-<div class="line"><a name="l17055"></a><span class="lineno">17055</span>&#160;            {</div>
-<div class="line"><a name="l17056"></a><span class="lineno">17056</span>&#160;                m_Budget.m_VulkanBudget[heapIndex] = m_MemProps.memoryHeaps[heapIndex].size;</div>
-<div class="line"><a name="l17057"></a><span class="lineno">17057</span>&#160;            }</div>
-<div class="line"><a name="l17058"></a><span class="lineno">17058</span>&#160;            <span class="keywordflow">if</span>(m_Budget.m_VulkanUsage[heapIndex] == 0 &amp;&amp; m_Budget.m_BlockBytesAtBudgetFetch[heapIndex] &gt; 0)</div>
-<div class="line"><a name="l17059"></a><span class="lineno">17059</span>&#160;            {</div>
-<div class="line"><a name="l17060"></a><span class="lineno">17060</span>&#160;                m_Budget.m_VulkanUsage[heapIndex] = m_Budget.m_BlockBytesAtBudgetFetch[heapIndex];</div>
-<div class="line"><a name="l17061"></a><span class="lineno">17061</span>&#160;            }</div>
-<div class="line"><a name="l17062"></a><span class="lineno">17062</span>&#160;        }</div>
-<div class="line"><a name="l17063"></a><span class="lineno">17063</span>&#160;        m_Budget.m_OperationsSinceBudgetFetch = 0;</div>
-<div class="line"><a name="l17064"></a><span class="lineno">17064</span>&#160;    }</div>
-<div class="line"><a name="l17065"></a><span class="lineno">17065</span>&#160;}</div>
-<div class="line"><a name="l17066"></a><span class="lineno">17066</span>&#160; </div>
-<div class="line"><a name="l17067"></a><span class="lineno">17067</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
-<div class="line"><a name="l17068"></a><span class="lineno">17068</span>&#160; </div>
-<div class="line"><a name="l17069"></a><span class="lineno">17069</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::FillAllocation(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, uint8_t pattern)</div>
-<div class="line"><a name="l17070"></a><span class="lineno">17070</span>&#160;{</div>
-<div class="line"><a name="l17071"></a><span class="lineno">17071</span>&#160;    <span class="keywordflow">if</span>(VMA_DEBUG_INITIALIZE_ALLOCATIONS &amp;&amp;</div>
-<div class="line"><a name="l17072"></a><span class="lineno">17072</span>&#160;        !hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
-<div class="line"><a name="l17073"></a><span class="lineno">17073</span>&#160;        (m_MemProps.memoryTypes[hAllocation-&gt;GetMemoryTypeIndex()].propertyFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)</div>
-<div class="line"><a name="l17074"></a><span class="lineno">17074</span>&#160;    {</div>
-<div class="line"><a name="l17075"></a><span class="lineno">17075</span>&#160;        <span class="keywordtype">void</span>* pData = VMA_NULL;</div>
-<div class="line"><a name="l17076"></a><span class="lineno">17076</span>&#160;        VkResult res = Map(hAllocation, &amp;pData);</div>
-<div class="line"><a name="l17077"></a><span class="lineno">17077</span>&#160;        <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l17078"></a><span class="lineno">17078</span>&#160;        {</div>
-<div class="line"><a name="l17079"></a><span class="lineno">17079</span>&#160;            memset(pData, (<span class="keywordtype">int</span>)pattern, (<span class="keywordtype">size_t</span>)hAllocation-&gt;GetSize());</div>
-<div class="line"><a name="l17080"></a><span class="lineno">17080</span>&#160;            FlushOrInvalidateAllocation(hAllocation, 0, VK_WHOLE_SIZE, VMA_CACHE_FLUSH);</div>
-<div class="line"><a name="l17081"></a><span class="lineno">17081</span>&#160;            Unmap(hAllocation);</div>
-<div class="line"><a name="l17082"></a><span class="lineno">17082</span>&#160;        }</div>
-<div class="line"><a name="l17083"></a><span class="lineno">17083</span>&#160;        <span class="keywordflow">else</span></div>
-<div class="line"><a name="l17084"></a><span class="lineno">17084</span>&#160;        {</div>
-<div class="line"><a name="l17085"></a><span class="lineno">17085</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_DEBUG_INITIALIZE_ALLOCATIONS is enabled, but couldn&#39;t map memory to fill allocation.&quot;</span>);</div>
-<div class="line"><a name="l17086"></a><span class="lineno">17086</span>&#160;        }</div>
-<div class="line"><a name="l17087"></a><span class="lineno">17087</span>&#160;    }</div>
-<div class="line"><a name="l17088"></a><span class="lineno">17088</span>&#160;}</div>
-<div class="line"><a name="l17089"></a><span class="lineno">17089</span>&#160; </div>
-<div class="line"><a name="l17090"></a><span class="lineno">17090</span>&#160;uint32_t VmaAllocator_T::GetGpuDefragmentationMemoryTypeBits()</div>
-<div class="line"><a name="l17091"></a><span class="lineno">17091</span>&#160;{</div>
-<div class="line"><a name="l17092"></a><span class="lineno">17092</span>&#160;    uint32_t memoryTypeBits = m_GpuDefragmentationMemoryTypeBits.load();</div>
-<div class="line"><a name="l17093"></a><span class="lineno">17093</span>&#160;    <span class="keywordflow">if</span>(memoryTypeBits == UINT32_MAX)</div>
-<div class="line"><a name="l17094"></a><span class="lineno">17094</span>&#160;    {</div>
-<div class="line"><a name="l17095"></a><span class="lineno">17095</span>&#160;        memoryTypeBits = CalculateGpuDefragmentationMemoryTypeBits();</div>
-<div class="line"><a name="l17096"></a><span class="lineno">17096</span>&#160;        m_GpuDefragmentationMemoryTypeBits.store(memoryTypeBits);</div>
-<div class="line"><a name="l17097"></a><span class="lineno">17097</span>&#160;    }</div>
-<div class="line"><a name="l17098"></a><span class="lineno">17098</span>&#160;    <span class="keywordflow">return</span> memoryTypeBits;</div>
-<div class="line"><a name="l17099"></a><span class="lineno">17099</span>&#160;}</div>
-<div class="line"><a name="l17100"></a><span class="lineno">17100</span>&#160; </div>
-<div class="line"><a name="l17101"></a><span class="lineno">17101</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l17102"></a><span class="lineno">17102</span>&#160; </div>
-<div class="line"><a name="l17103"></a><span class="lineno">17103</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::PrintDetailedMap(VmaJsonWriter&amp; json)</div>
-<div class="line"><a name="l17104"></a><span class="lineno">17104</span>&#160;{</div>
-<div class="line"><a name="l17105"></a><span class="lineno">17105</span>&#160;    <span class="keywordtype">bool</span> dedicatedAllocationsStarted = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l17106"></a><span class="lineno">17106</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
-<div class="line"><a name="l17107"></a><span class="lineno">17107</span>&#160;    {</div>
-<div class="line"><a name="l17108"></a><span class="lineno">17108</span>&#160;        VmaMutexLockRead dedicatedAllocationsLock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);</div>
-<div class="line"><a name="l17109"></a><span class="lineno">17109</span>&#160;        AllocationVectorType* <span class="keyword">const</span> pDedicatedAllocVector = m_pDedicatedAllocations[memTypeIndex];</div>
-<div class="line"><a name="l17110"></a><span class="lineno">17110</span>&#160;        VMA_ASSERT(pDedicatedAllocVector);</div>
-<div class="line"><a name="l17111"></a><span class="lineno">17111</span>&#160;        <span class="keywordflow">if</span>(pDedicatedAllocVector-&gt;empty() == <span class="keyword">false</span>)</div>
-<div class="line"><a name="l17112"></a><span class="lineno">17112</span>&#160;        {</div>
-<div class="line"><a name="l17113"></a><span class="lineno">17113</span>&#160;            <span class="keywordflow">if</span>(dedicatedAllocationsStarted == <span class="keyword">false</span>)</div>
-<div class="line"><a name="l17114"></a><span class="lineno">17114</span>&#160;            {</div>
-<div class="line"><a name="l17115"></a><span class="lineno">17115</span>&#160;                dedicatedAllocationsStarted = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l17116"></a><span class="lineno">17116</span>&#160;                json.WriteString(<span class="stringliteral">&quot;DedicatedAllocations&quot;</span>);</div>
-<div class="line"><a name="l17117"></a><span class="lineno">17117</span>&#160;                json.BeginObject();</div>
-<div class="line"><a name="l17118"></a><span class="lineno">17118</span>&#160;            }</div>
-<div class="line"><a name="l17119"></a><span class="lineno">17119</span>&#160; </div>
-<div class="line"><a name="l17120"></a><span class="lineno">17120</span>&#160;            json.BeginString(<span class="stringliteral">&quot;Type &quot;</span>);</div>
-<div class="line"><a name="l17121"></a><span class="lineno">17121</span>&#160;            json.ContinueString(memTypeIndex);</div>
-<div class="line"><a name="l17122"></a><span class="lineno">17122</span>&#160;            json.EndString();</div>
-<div class="line"><a name="l17123"></a><span class="lineno">17123</span>&#160;                </div>
-<div class="line"><a name="l17124"></a><span class="lineno">17124</span>&#160;            json.BeginArray();</div>
-<div class="line"><a name="l17125"></a><span class="lineno">17125</span>&#160; </div>
-<div class="line"><a name="l17126"></a><span class="lineno">17126</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; pDedicatedAllocVector-&gt;size(); ++i)</div>
-<div class="line"><a name="l17127"></a><span class="lineno">17127</span>&#160;            {</div>
-<div class="line"><a name="l17128"></a><span class="lineno">17128</span>&#160;                json.BeginObject(<span class="keyword">true</span>);</div>
-<div class="line"><a name="l17129"></a><span class="lineno">17129</span>&#160;                <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc = (*pDedicatedAllocVector)[i];</div>
-<div class="line"><a name="l17130"></a><span class="lineno">17130</span>&#160;                hAlloc-&gt;PrintParameters(json);</div>
-<div class="line"><a name="l17131"></a><span class="lineno">17131</span>&#160;                json.EndObject();</div>
-<div class="line"><a name="l17132"></a><span class="lineno">17132</span>&#160;            }</div>
-<div class="line"><a name="l17133"></a><span class="lineno">17133</span>&#160; </div>
-<div class="line"><a name="l17134"></a><span class="lineno">17134</span>&#160;            json.EndArray();</div>
-<div class="line"><a name="l17135"></a><span class="lineno">17135</span>&#160;        }</div>
-<div class="line"><a name="l17136"></a><span class="lineno">17136</span>&#160;    }</div>
-<div class="line"><a name="l17137"></a><span class="lineno">17137</span>&#160;    <span class="keywordflow">if</span>(dedicatedAllocationsStarted)</div>
-<div class="line"><a name="l17138"></a><span class="lineno">17138</span>&#160;    {</div>
-<div class="line"><a name="l17139"></a><span class="lineno">17139</span>&#160;        json.EndObject();</div>
-<div class="line"><a name="l17140"></a><span class="lineno">17140</span>&#160;    }</div>
-<div class="line"><a name="l17141"></a><span class="lineno">17141</span>&#160; </div>
-<div class="line"><a name="l17142"></a><span class="lineno">17142</span>&#160;    {</div>
-<div class="line"><a name="l17143"></a><span class="lineno">17143</span>&#160;        <span class="keywordtype">bool</span> allocationsStarted = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l17144"></a><span class="lineno">17144</span>&#160;        <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
+<div class="line"><a name="l17033"></a><span class="lineno">17033</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::Unmap(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation)</div>
+<div class="line"><a name="l17034"></a><span class="lineno">17034</span>&#160;{</div>
+<div class="line"><a name="l17035"></a><span class="lineno">17035</span>&#160;    <span class="keywordflow">switch</span>(hAllocation-&gt;GetType())</div>
+<div class="line"><a name="l17036"></a><span class="lineno">17036</span>&#160;    {</div>
+<div class="line"><a name="l17037"></a><span class="lineno">17037</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
+<div class="line"><a name="l17038"></a><span class="lineno">17038</span>&#160;        {</div>
+<div class="line"><a name="l17039"></a><span class="lineno">17039</span>&#160;            VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = hAllocation-&gt;GetBlock();</div>
+<div class="line"><a name="l17040"></a><span class="lineno">17040</span>&#160;            hAllocation-&gt;BlockAllocUnmap();</div>
+<div class="line"><a name="l17041"></a><span class="lineno">17041</span>&#160;            pBlock-&gt;Unmap(<span class="keyword">this</span>, 1);</div>
+<div class="line"><a name="l17042"></a><span class="lineno">17042</span>&#160;        }</div>
+<div class="line"><a name="l17043"></a><span class="lineno">17043</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17044"></a><span class="lineno">17044</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
+<div class="line"><a name="l17045"></a><span class="lineno">17045</span>&#160;        hAllocation-&gt;DedicatedAllocUnmap(<span class="keyword">this</span>);</div>
+<div class="line"><a name="l17046"></a><span class="lineno">17046</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17047"></a><span class="lineno">17047</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l17048"></a><span class="lineno">17048</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l17049"></a><span class="lineno">17049</span>&#160;    }</div>
+<div class="line"><a name="l17050"></a><span class="lineno">17050</span>&#160;}</div>
+<div class="line"><a name="l17051"></a><span class="lineno">17051</span>&#160; </div>
+<div class="line"><a name="l17052"></a><span class="lineno">17052</span>&#160;VkResult VmaAllocator_T::BindBufferMemory(</div>
+<div class="line"><a name="l17053"></a><span class="lineno">17053</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
+<div class="line"><a name="l17054"></a><span class="lineno">17054</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l17055"></a><span class="lineno">17055</span>&#160;    VkBuffer hBuffer,</div>
+<div class="line"><a name="l17056"></a><span class="lineno">17056</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
+<div class="line"><a name="l17057"></a><span class="lineno">17057</span>&#160;{</div>
+<div class="line"><a name="l17058"></a><span class="lineno">17058</span>&#160;    VkResult res = VK_SUCCESS;</div>
+<div class="line"><a name="l17059"></a><span class="lineno">17059</span>&#160;    <span class="keywordflow">switch</span>(hAllocation-&gt;GetType())</div>
+<div class="line"><a name="l17060"></a><span class="lineno">17060</span>&#160;    {</div>
+<div class="line"><a name="l17061"></a><span class="lineno">17061</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
+<div class="line"><a name="l17062"></a><span class="lineno">17062</span>&#160;        res = BindVulkanBuffer(hAllocation-&gt;GetMemory(), allocationLocalOffset, hBuffer, pNext);</div>
+<div class="line"><a name="l17063"></a><span class="lineno">17063</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17064"></a><span class="lineno">17064</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
+<div class="line"><a name="l17065"></a><span class="lineno">17065</span>&#160;    {</div>
+<div class="line"><a name="l17066"></a><span class="lineno">17066</span>&#160;        VmaDeviceMemoryBlock* <span class="keyword">const</span> pBlock = hAllocation-&gt;GetBlock();</div>
+<div class="line"><a name="l17067"></a><span class="lineno">17067</span>&#160;        VMA_ASSERT(pBlock &amp;&amp; <span class="stringliteral">&quot;Binding buffer to allocation that doesn&#39;t belong to any block. Is the allocation lost?&quot;</span>);</div>
+<div class="line"><a name="l17068"></a><span class="lineno">17068</span>&#160;        res = pBlock-&gt;BindBufferMemory(<span class="keyword">this</span>, hAllocation, allocationLocalOffset, hBuffer, pNext);</div>
+<div class="line"><a name="l17069"></a><span class="lineno">17069</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17070"></a><span class="lineno">17070</span>&#160;    }</div>
+<div class="line"><a name="l17071"></a><span class="lineno">17071</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l17072"></a><span class="lineno">17072</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l17073"></a><span class="lineno">17073</span>&#160;    }</div>
+<div class="line"><a name="l17074"></a><span class="lineno">17074</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l17075"></a><span class="lineno">17075</span>&#160;}</div>
+<div class="line"><a name="l17076"></a><span class="lineno">17076</span>&#160; </div>
+<div class="line"><a name="l17077"></a><span class="lineno">17077</span>&#160;VkResult VmaAllocator_T::BindImageMemory(</div>
+<div class="line"><a name="l17078"></a><span class="lineno">17078</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
+<div class="line"><a name="l17079"></a><span class="lineno">17079</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l17080"></a><span class="lineno">17080</span>&#160;    VkImage hImage,</div>
+<div class="line"><a name="l17081"></a><span class="lineno">17081</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
+<div class="line"><a name="l17082"></a><span class="lineno">17082</span>&#160;{</div>
+<div class="line"><a name="l17083"></a><span class="lineno">17083</span>&#160;    VkResult res = VK_SUCCESS;</div>
+<div class="line"><a name="l17084"></a><span class="lineno">17084</span>&#160;    <span class="keywordflow">switch</span>(hAllocation-&gt;GetType())</div>
+<div class="line"><a name="l17085"></a><span class="lineno">17085</span>&#160;    {</div>
+<div class="line"><a name="l17086"></a><span class="lineno">17086</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
+<div class="line"><a name="l17087"></a><span class="lineno">17087</span>&#160;        res = BindVulkanImage(hAllocation-&gt;GetMemory(), allocationLocalOffset, hImage, pNext);</div>
+<div class="line"><a name="l17088"></a><span class="lineno">17088</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17089"></a><span class="lineno">17089</span>&#160;    <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
+<div class="line"><a name="l17090"></a><span class="lineno">17090</span>&#160;    {</div>
+<div class="line"><a name="l17091"></a><span class="lineno">17091</span>&#160;        VmaDeviceMemoryBlock* pBlock = hAllocation-&gt;GetBlock();</div>
+<div class="line"><a name="l17092"></a><span class="lineno">17092</span>&#160;        VMA_ASSERT(pBlock &amp;&amp; <span class="stringliteral">&quot;Binding image to allocation that doesn&#39;t belong to any block. Is the allocation lost?&quot;</span>);</div>
+<div class="line"><a name="l17093"></a><span class="lineno">17093</span>&#160;        res = pBlock-&gt;BindImageMemory(<span class="keyword">this</span>, hAllocation, allocationLocalOffset, hImage, pNext);</div>
+<div class="line"><a name="l17094"></a><span class="lineno">17094</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17095"></a><span class="lineno">17095</span>&#160;    }</div>
+<div class="line"><a name="l17096"></a><span class="lineno">17096</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l17097"></a><span class="lineno">17097</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l17098"></a><span class="lineno">17098</span>&#160;    }</div>
+<div class="line"><a name="l17099"></a><span class="lineno">17099</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l17100"></a><span class="lineno">17100</span>&#160;}</div>
+<div class="line"><a name="l17101"></a><span class="lineno">17101</span>&#160; </div>
+<div class="line"><a name="l17102"></a><span class="lineno">17102</span>&#160;VkResult VmaAllocator_T::FlushOrInvalidateAllocation(</div>
+<div class="line"><a name="l17103"></a><span class="lineno">17103</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
+<div class="line"><a name="l17104"></a><span class="lineno">17104</span>&#160;    VkDeviceSize offset, VkDeviceSize size,</div>
+<div class="line"><a name="l17105"></a><span class="lineno">17105</span>&#160;    VMA_CACHE_OPERATION op)</div>
+<div class="line"><a name="l17106"></a><span class="lineno">17106</span>&#160;{</div>
+<div class="line"><a name="l17107"></a><span class="lineno">17107</span>&#160;    VkResult res = VK_SUCCESS;</div>
+<div class="line"><a name="l17108"></a><span class="lineno">17108</span>&#160; </div>
+<div class="line"><a name="l17109"></a><span class="lineno">17109</span>&#160;    VkMappedMemoryRange memRange = {};</div>
+<div class="line"><a name="l17110"></a><span class="lineno">17110</span>&#160;    <span class="keywordflow">if</span>(GetFlushOrInvalidateRange(hAllocation, offset, size, memRange))</div>
+<div class="line"><a name="l17111"></a><span class="lineno">17111</span>&#160;    {</div>
+<div class="line"><a name="l17112"></a><span class="lineno">17112</span>&#160;        <span class="keywordflow">switch</span>(op)</div>
+<div class="line"><a name="l17113"></a><span class="lineno">17113</span>&#160;        {</div>
+<div class="line"><a name="l17114"></a><span class="lineno">17114</span>&#160;        <span class="keywordflow">case</span> VMA_CACHE_FLUSH:</div>
+<div class="line"><a name="l17115"></a><span class="lineno">17115</span>&#160;            res = (*GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hDevice, 1, &amp;memRange);</div>
+<div class="line"><a name="l17116"></a><span class="lineno">17116</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17117"></a><span class="lineno">17117</span>&#160;        <span class="keywordflow">case</span> VMA_CACHE_INVALIDATE:</div>
+<div class="line"><a name="l17118"></a><span class="lineno">17118</span>&#160;            res = (*GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hDevice, 1, &amp;memRange);</div>
+<div class="line"><a name="l17119"></a><span class="lineno">17119</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17120"></a><span class="lineno">17120</span>&#160;        <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l17121"></a><span class="lineno">17121</span>&#160;            VMA_ASSERT(0);</div>
+<div class="line"><a name="l17122"></a><span class="lineno">17122</span>&#160;        }</div>
+<div class="line"><a name="l17123"></a><span class="lineno">17123</span>&#160;    }</div>
+<div class="line"><a name="l17124"></a><span class="lineno">17124</span>&#160;    <span class="comment">// else: Just ignore this call.</span></div>
+<div class="line"><a name="l17125"></a><span class="lineno">17125</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l17126"></a><span class="lineno">17126</span>&#160;}</div>
+<div class="line"><a name="l17127"></a><span class="lineno">17127</span>&#160; </div>
+<div class="line"><a name="l17128"></a><span class="lineno">17128</span>&#160;VkResult VmaAllocator_T::FlushOrInvalidateAllocations(</div>
+<div class="line"><a name="l17129"></a><span class="lineno">17129</span>&#160;    uint32_t allocationCount,</div>
+<div class="line"><a name="l17130"></a><span class="lineno">17130</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* allocations,</div>
+<div class="line"><a name="l17131"></a><span class="lineno">17131</span>&#160;    <span class="keyword">const</span> VkDeviceSize* offsets, <span class="keyword">const</span> VkDeviceSize* sizes,</div>
+<div class="line"><a name="l17132"></a><span class="lineno">17132</span>&#160;    VMA_CACHE_OPERATION op)</div>
+<div class="line"><a name="l17133"></a><span class="lineno">17133</span>&#160;{</div>
+<div class="line"><a name="l17134"></a><span class="lineno">17134</span>&#160;    <span class="keyword">typedef</span> VmaStlAllocator&lt;VkMappedMemoryRange&gt; RangeAllocator;</div>
+<div class="line"><a name="l17135"></a><span class="lineno">17135</span>&#160;    <span class="keyword">typedef</span> VmaSmallVector&lt;VkMappedMemoryRange, RangeAllocator, 16&gt; RangeVector;</div>
+<div class="line"><a name="l17136"></a><span class="lineno">17136</span>&#160;    RangeVector ranges = RangeVector(RangeAllocator(GetAllocationCallbacks()));</div>
+<div class="line"><a name="l17137"></a><span class="lineno">17137</span>&#160;    </div>
+<div class="line"><a name="l17138"></a><span class="lineno">17138</span>&#160;    <span class="keywordflow">for</span>(uint32_t allocIndex = 0; allocIndex &lt; allocationCount; ++allocIndex)</div>
+<div class="line"><a name="l17139"></a><span class="lineno">17139</span>&#160;    {</div>
+<div class="line"><a name="l17140"></a><span class="lineno">17140</span>&#160;        <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc = allocations[allocIndex];</div>
+<div class="line"><a name="l17141"></a><span class="lineno">17141</span>&#160;        <span class="keyword">const</span> VkDeviceSize offset = offsets != VMA_NULL ? offsets[allocIndex] : 0;</div>
+<div class="line"><a name="l17142"></a><span class="lineno">17142</span>&#160;        <span class="keyword">const</span> VkDeviceSize size = sizes != VMA_NULL ? sizes[allocIndex] : VK_WHOLE_SIZE;</div>
+<div class="line"><a name="l17143"></a><span class="lineno">17143</span>&#160;        VkMappedMemoryRange newRange;</div>
+<div class="line"><a name="l17144"></a><span class="lineno">17144</span>&#160;        <span class="keywordflow">if</span>(GetFlushOrInvalidateRange(alloc, offset, size, newRange))</div>
 <div class="line"><a name="l17145"></a><span class="lineno">17145</span>&#160;        {</div>
-<div class="line"><a name="l17146"></a><span class="lineno">17146</span>&#160;            <span class="keywordflow">if</span>(m_pBlockVectors[memTypeIndex]-&gt;IsEmpty() == <span class="keyword">false</span>)</div>
-<div class="line"><a name="l17147"></a><span class="lineno">17147</span>&#160;            {</div>
-<div class="line"><a name="l17148"></a><span class="lineno">17148</span>&#160;                <span class="keywordflow">if</span>(allocationsStarted == <span class="keyword">false</span>)</div>
-<div class="line"><a name="l17149"></a><span class="lineno">17149</span>&#160;                {</div>
-<div class="line"><a name="l17150"></a><span class="lineno">17150</span>&#160;                    allocationsStarted = <span class="keyword">true</span>;</div>
-<div class="line"><a name="l17151"></a><span class="lineno">17151</span>&#160;                    json.WriteString(<span class="stringliteral">&quot;DefaultPools&quot;</span>);</div>
-<div class="line"><a name="l17152"></a><span class="lineno">17152</span>&#160;                    json.BeginObject();</div>
-<div class="line"><a name="l17153"></a><span class="lineno">17153</span>&#160;                }</div>
-<div class="line"><a name="l17154"></a><span class="lineno">17154</span>&#160; </div>
-<div class="line"><a name="l17155"></a><span class="lineno">17155</span>&#160;                json.BeginString(<span class="stringliteral">&quot;Type &quot;</span>);</div>
-<div class="line"><a name="l17156"></a><span class="lineno">17156</span>&#160;                json.ContinueString(memTypeIndex);</div>
-<div class="line"><a name="l17157"></a><span class="lineno">17157</span>&#160;                json.EndString();</div>
-<div class="line"><a name="l17158"></a><span class="lineno">17158</span>&#160; </div>
-<div class="line"><a name="l17159"></a><span class="lineno">17159</span>&#160;                m_pBlockVectors[memTypeIndex]-&gt;PrintDetailedMap(json);</div>
-<div class="line"><a name="l17160"></a><span class="lineno">17160</span>&#160;            }</div>
-<div class="line"><a name="l17161"></a><span class="lineno">17161</span>&#160;        }</div>
-<div class="line"><a name="l17162"></a><span class="lineno">17162</span>&#160;        <span class="keywordflow">if</span>(allocationsStarted)</div>
-<div class="line"><a name="l17163"></a><span class="lineno">17163</span>&#160;        {</div>
-<div class="line"><a name="l17164"></a><span class="lineno">17164</span>&#160;            json.EndObject();</div>
-<div class="line"><a name="l17165"></a><span class="lineno">17165</span>&#160;        }</div>
-<div class="line"><a name="l17166"></a><span class="lineno">17166</span>&#160;    }</div>
-<div class="line"><a name="l17167"></a><span class="lineno">17167</span>&#160; </div>
-<div class="line"><a name="l17168"></a><span class="lineno">17168</span>&#160;    <span class="comment">// Custom pools</span></div>
-<div class="line"><a name="l17169"></a><span class="lineno">17169</span>&#160;    {</div>
-<div class="line"><a name="l17170"></a><span class="lineno">17170</span>&#160;        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);</div>
-<div class="line"><a name="l17171"></a><span class="lineno">17171</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> poolCount = m_Pools.size();</div>
-<div class="line"><a name="l17172"></a><span class="lineno">17172</span>&#160;        <span class="keywordflow">if</span>(poolCount &gt; 0)</div>
-<div class="line"><a name="l17173"></a><span class="lineno">17173</span>&#160;        {</div>
-<div class="line"><a name="l17174"></a><span class="lineno">17174</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Pools&quot;</span>);</div>
-<div class="line"><a name="l17175"></a><span class="lineno">17175</span>&#160;            json.BeginObject();</div>
-<div class="line"><a name="l17176"></a><span class="lineno">17176</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> poolIndex = 0; poolIndex &lt; poolCount; ++poolIndex)</div>
-<div class="line"><a name="l17177"></a><span class="lineno">17177</span>&#160;            {</div>
-<div class="line"><a name="l17178"></a><span class="lineno">17178</span>&#160;                json.BeginString();</div>
-<div class="line"><a name="l17179"></a><span class="lineno">17179</span>&#160;                json.ContinueString(m_Pools[poolIndex]-&gt;GetId());</div>
-<div class="line"><a name="l17180"></a><span class="lineno">17180</span>&#160;                json.EndString();</div>
+<div class="line"><a name="l17146"></a><span class="lineno">17146</span>&#160;            ranges.push_back(newRange);</div>
+<div class="line"><a name="l17147"></a><span class="lineno">17147</span>&#160;        }</div>
+<div class="line"><a name="l17148"></a><span class="lineno">17148</span>&#160;    }</div>
+<div class="line"><a name="l17149"></a><span class="lineno">17149</span>&#160; </div>
+<div class="line"><a name="l17150"></a><span class="lineno">17150</span>&#160;    VkResult res = VK_SUCCESS;</div>
+<div class="line"><a name="l17151"></a><span class="lineno">17151</span>&#160;    <span class="keywordflow">if</span>(!ranges.empty())</div>
+<div class="line"><a name="l17152"></a><span class="lineno">17152</span>&#160;    {</div>
+<div class="line"><a name="l17153"></a><span class="lineno">17153</span>&#160;        <span class="keywordflow">switch</span>(op)</div>
+<div class="line"><a name="l17154"></a><span class="lineno">17154</span>&#160;        {</div>
+<div class="line"><a name="l17155"></a><span class="lineno">17155</span>&#160;        <span class="keywordflow">case</span> VMA_CACHE_FLUSH:</div>
+<div class="line"><a name="l17156"></a><span class="lineno">17156</span>&#160;            res = (*GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hDevice, (uint32_t)ranges.size(), ranges.data());</div>
+<div class="line"><a name="l17157"></a><span class="lineno">17157</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17158"></a><span class="lineno">17158</span>&#160;        <span class="keywordflow">case</span> VMA_CACHE_INVALIDATE:</div>
+<div class="line"><a name="l17159"></a><span class="lineno">17159</span>&#160;            res = (*GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hDevice, (uint32_t)ranges.size(), ranges.data());</div>
+<div class="line"><a name="l17160"></a><span class="lineno">17160</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17161"></a><span class="lineno">17161</span>&#160;        <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l17162"></a><span class="lineno">17162</span>&#160;            VMA_ASSERT(0);</div>
+<div class="line"><a name="l17163"></a><span class="lineno">17163</span>&#160;        }</div>
+<div class="line"><a name="l17164"></a><span class="lineno">17164</span>&#160;    }</div>
+<div class="line"><a name="l17165"></a><span class="lineno">17165</span>&#160;    <span class="comment">// else: Just ignore this call.</span></div>
+<div class="line"><a name="l17166"></a><span class="lineno">17166</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l17167"></a><span class="lineno">17167</span>&#160;}</div>
+<div class="line"><a name="l17168"></a><span class="lineno">17168</span>&#160; </div>
+<div class="line"><a name="l17169"></a><span class="lineno">17169</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::FreeDedicatedMemory(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l17170"></a><span class="lineno">17170</span>&#160;{</div>
+<div class="line"><a name="l17171"></a><span class="lineno">17171</span>&#160;    VMA_ASSERT(allocation &amp;&amp; allocation-&gt;GetType() == VmaAllocation_T::ALLOCATION_TYPE_DEDICATED);</div>
+<div class="line"><a name="l17172"></a><span class="lineno">17172</span>&#160; </div>
+<div class="line"><a name="l17173"></a><span class="lineno">17173</span>&#160;    <span class="keyword">const</span> uint32_t memTypeIndex = allocation-&gt;GetMemoryTypeIndex();</div>
+<div class="line"><a name="l17174"></a><span class="lineno">17174</span>&#160;    {</div>
+<div class="line"><a name="l17175"></a><span class="lineno">17175</span>&#160;        VmaMutexLockWrite lock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);</div>
+<div class="line"><a name="l17176"></a><span class="lineno">17176</span>&#160;        AllocationVectorType* <span class="keyword">const</span> pDedicatedAllocations = m_pDedicatedAllocations[memTypeIndex];</div>
+<div class="line"><a name="l17177"></a><span class="lineno">17177</span>&#160;        VMA_ASSERT(pDedicatedAllocations);</div>
+<div class="line"><a name="l17178"></a><span class="lineno">17178</span>&#160;        <span class="keywordtype">bool</span> success = VmaVectorRemoveSorted&lt;VmaPointerLess&gt;(*pDedicatedAllocations, allocation);</div>
+<div class="line"><a name="l17179"></a><span class="lineno">17179</span>&#160;        VMA_ASSERT(success);</div>
+<div class="line"><a name="l17180"></a><span class="lineno">17180</span>&#160;    }</div>
 <div class="line"><a name="l17181"></a><span class="lineno">17181</span>&#160; </div>
-<div class="line"><a name="l17182"></a><span class="lineno">17182</span>&#160;                m_Pools[poolIndex]-&gt;m_BlockVector.PrintDetailedMap(json);</div>
-<div class="line"><a name="l17183"></a><span class="lineno">17183</span>&#160;            }</div>
-<div class="line"><a name="l17184"></a><span class="lineno">17184</span>&#160;            json.EndObject();</div>
-<div class="line"><a name="l17185"></a><span class="lineno">17185</span>&#160;        }</div>
-<div class="line"><a name="l17186"></a><span class="lineno">17186</span>&#160;    }</div>
-<div class="line"><a name="l17187"></a><span class="lineno">17187</span>&#160;}</div>
-<div class="line"><a name="l17188"></a><span class="lineno">17188</span>&#160; </div>
-<div class="line"><a name="l17189"></a><span class="lineno">17189</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l17190"></a><span class="lineno">17190</span>&#160; </div>
-<div class="line"><a name="l17192"></a><span class="lineno">17192</span>&#160;<span class="comment">// Public interface</span></div>
-<div class="line"><a name="l17193"></a><span class="lineno">17193</span>&#160; </div>
-<div class="line"><a name="l17194"></a><span class="lineno">17194</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb">vmaCreateAllocator</a>(</div>
-<div class="line"><a name="l17195"></a><span class="lineno">17195</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo,</div>
-<div class="line"><a name="l17196"></a><span class="lineno">17196</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a>* pAllocator)</div>
-<div class="line"><a name="l17197"></a><span class="lineno">17197</span>&#160;{</div>
-<div class="line"><a name="l17198"></a><span class="lineno">17198</span>&#160;    VMA_ASSERT(pCreateInfo &amp;&amp; pAllocator);</div>
-<div class="line"><a name="l17199"></a><span class="lineno">17199</span>&#160;    VMA_ASSERT(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">vulkanApiVersion</a> == 0 ||</div>
-<div class="line"><a name="l17200"></a><span class="lineno">17200</span>&#160;        (VK_VERSION_MAJOR(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">vulkanApiVersion</a>) == 1 &amp;&amp; VK_VERSION_MINOR(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">vulkanApiVersion</a>) &lt;= 2));</div>
-<div class="line"><a name="l17201"></a><span class="lineno">17201</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCreateAllocator&quot;</span>);</div>
-<div class="line"><a name="l17202"></a><span class="lineno">17202</span>&#160;    *pAllocator = vma_new(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d">pAllocationCallbacks</a>, VmaAllocator_T)(pCreateInfo);</div>
-<div class="line"><a name="l17203"></a><span class="lineno">17203</span>&#160;    <span class="keywordflow">return</span> (*pAllocator)-&gt;Init(pCreateInfo);</div>
-<div class="line"><a name="l17204"></a><span class="lineno">17204</span>&#160;}</div>
+<div class="line"><a name="l17182"></a><span class="lineno">17182</span>&#160;    VkDeviceMemory hMemory = allocation-&gt;GetMemory();</div>
+<div class="line"><a name="l17183"></a><span class="lineno">17183</span>&#160;    </div>
+<div class="line"><a name="l17184"></a><span class="lineno">17184</span>&#160;    <span class="comment">/*</span></div>
+<div class="line"><a name="l17185"></a><span class="lineno">17185</span>&#160;<span class="comment">    There is no need to call this, because Vulkan spec allows to skip vkUnmapMemory</span></div>
+<div class="line"><a name="l17186"></a><span class="lineno">17186</span>&#160;<span class="comment">    before vkFreeMemory.</span></div>
+<div class="line"><a name="l17187"></a><span class="lineno">17187</span>&#160;<span class="comment"></span> </div>
+<div class="line"><a name="l17188"></a><span class="lineno">17188</span>&#160;<span class="comment">    if(allocation-&gt;GetMappedData() != VMA_NULL)</span></div>
+<div class="line"><a name="l17189"></a><span class="lineno">17189</span>&#160;<span class="comment">    {</span></div>
+<div class="line"><a name="l17190"></a><span class="lineno">17190</span>&#160;<span class="comment">        (*m_VulkanFunctions.vkUnmapMemory)(m_hDevice, hMemory);</span></div>
+<div class="line"><a name="l17191"></a><span class="lineno">17191</span>&#160;<span class="comment">    }</span></div>
+<div class="line"><a name="l17192"></a><span class="lineno">17192</span>&#160;<span class="comment">    */</span></div>
+<div class="line"><a name="l17193"></a><span class="lineno">17193</span>&#160;    </div>
+<div class="line"><a name="l17194"></a><span class="lineno">17194</span>&#160;    FreeVulkanMemory(memTypeIndex, allocation-&gt;GetSize(), hMemory);</div>
+<div class="line"><a name="l17195"></a><span class="lineno">17195</span>&#160; </div>
+<div class="line"><a name="l17196"></a><span class="lineno">17196</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;    Freed DedicatedMemory MemoryTypeIndex=%u&quot;</span>, memTypeIndex);</div>
+<div class="line"><a name="l17197"></a><span class="lineno">17197</span>&#160;}</div>
+<div class="line"><a name="l17198"></a><span class="lineno">17198</span>&#160; </div>
+<div class="line"><a name="l17199"></a><span class="lineno">17199</span>&#160;uint32_t VmaAllocator_T::CalculateGpuDefragmentationMemoryTypeBits()<span class="keyword"> const</span></div>
+<div class="line"><a name="l17200"></a><span class="lineno">17200</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l17201"></a><span class="lineno">17201</span>&#160;    VkBufferCreateInfo dummyBufCreateInfo;</div>
+<div class="line"><a name="l17202"></a><span class="lineno">17202</span>&#160;    VmaFillGpuDefragmentationBufferCreateInfo(dummyBufCreateInfo);</div>
+<div class="line"><a name="l17203"></a><span class="lineno">17203</span>&#160; </div>
+<div class="line"><a name="l17204"></a><span class="lineno">17204</span>&#160;    uint32_t memoryTypeBits = 0;</div>
 <div class="line"><a name="l17205"></a><span class="lineno">17205</span>&#160; </div>
-<div class="line"><a name="l17206"></a><span class="lineno">17206</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa8d164061c88f22fb1fd3c8f3534bc1d">vmaDestroyAllocator</a>(</div>
-<div class="line"><a name="l17207"></a><span class="lineno">17207</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator)</div>
-<div class="line"><a name="l17208"></a><span class="lineno">17208</span>&#160;{</div>
-<div class="line"><a name="l17209"></a><span class="lineno">17209</span>&#160;    <span class="keywordflow">if</span>(allocator != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l17210"></a><span class="lineno">17210</span>&#160;    {</div>
-<div class="line"><a name="l17211"></a><span class="lineno">17211</span>&#160;        VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDestroyAllocator&quot;</span>);</div>
-<div class="line"><a name="l17212"></a><span class="lineno">17212</span>&#160;        VkAllocationCallbacks allocationCallbacks = allocator-&gt;m_AllocationCallbacks;</div>
-<div class="line"><a name="l17213"></a><span class="lineno">17213</span>&#160;        vma_delete(&amp;allocationCallbacks, allocator);</div>
-<div class="line"><a name="l17214"></a><span class="lineno">17214</span>&#160;    }</div>
-<div class="line"><a name="l17215"></a><span class="lineno">17215</span>&#160;}</div>
+<div class="line"><a name="l17206"></a><span class="lineno">17206</span>&#160;    <span class="comment">// Create buffer.</span></div>
+<div class="line"><a name="l17207"></a><span class="lineno">17207</span>&#160;    VkBuffer buf = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l17208"></a><span class="lineno">17208</span>&#160;    VkResult res = (*GetVulkanFunctions().vkCreateBuffer)(</div>
+<div class="line"><a name="l17209"></a><span class="lineno">17209</span>&#160;        m_hDevice, &amp;dummyBufCreateInfo, GetAllocationCallbacks(), &amp;buf);</div>
+<div class="line"><a name="l17210"></a><span class="lineno">17210</span>&#160;    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l17211"></a><span class="lineno">17211</span>&#160;    {</div>
+<div class="line"><a name="l17212"></a><span class="lineno">17212</span>&#160;        <span class="comment">// Query for supported memory types.</span></div>
+<div class="line"><a name="l17213"></a><span class="lineno">17213</span>&#160;        VkMemoryRequirements memReq;</div>
+<div class="line"><a name="l17214"></a><span class="lineno">17214</span>&#160;        (*GetVulkanFunctions().vkGetBufferMemoryRequirements)(m_hDevice, buf, &amp;memReq);</div>
+<div class="line"><a name="l17215"></a><span class="lineno">17215</span>&#160;        memoryTypeBits = memReq.memoryTypeBits;</div>
 <div class="line"><a name="l17216"></a><span class="lineno">17216</span>&#160; </div>
-<div class="line"><a name="l17217"></a><span class="lineno">17217</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7">vmaGetAllocatorInfo</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="code" href="struct_vma_allocator_info.html">VmaAllocatorInfo</a>* pAllocatorInfo)</div>
-<div class="line"><a name="l17218"></a><span class="lineno">17218</span>&#160;{</div>
-<div class="line"><a name="l17219"></a><span class="lineno">17219</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pAllocatorInfo);</div>
-<div class="line"><a name="l17220"></a><span class="lineno">17220</span>&#160;    pAllocatorInfo-&gt;<a class="code" href="struct_vma_allocator_info.html#a2ed6a4d2d3fea039d66a13f15d0ce5fe">instance</a> = allocator-&gt;m_hInstance;</div>
-<div class="line"><a name="l17221"></a><span class="lineno">17221</span>&#160;    pAllocatorInfo-&gt;<a class="code" href="struct_vma_allocator_info.html#aba2b703f96e51d567717e1fb2935b47a">physicalDevice</a> = allocator-&gt;GetPhysicalDevice();</div>
-<div class="line"><a name="l17222"></a><span class="lineno">17222</span>&#160;    pAllocatorInfo-&gt;<a class="code" href="struct_vma_allocator_info.html#a012b4c485bf3b0ea8921352c5ee0c357">device</a> = allocator-&gt;m_hDevice;</div>
-<div class="line"><a name="l17223"></a><span class="lineno">17223</span>&#160;}</div>
-<div class="line"><a name="l17224"></a><span class="lineno">17224</span>&#160; </div>
-<div class="line"><a name="l17225"></a><span class="lineno">17225</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0">vmaGetPhysicalDeviceProperties</a>(</div>
-<div class="line"><a name="l17226"></a><span class="lineno">17226</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17227"></a><span class="lineno">17227</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceProperties **ppPhysicalDeviceProperties)</div>
-<div class="line"><a name="l17228"></a><span class="lineno">17228</span>&#160;{</div>
-<div class="line"><a name="l17229"></a><span class="lineno">17229</span>&#160;    VMA_ASSERT(allocator &amp;&amp; ppPhysicalDeviceProperties);</div>
-<div class="line"><a name="l17230"></a><span class="lineno">17230</span>&#160;    *ppPhysicalDeviceProperties = &amp;allocator-&gt;m_PhysicalDeviceProperties;</div>
-<div class="line"><a name="l17231"></a><span class="lineno">17231</span>&#160;}</div>
-<div class="line"><a name="l17232"></a><span class="lineno">17232</span>&#160; </div>
-<div class="line"><a name="l17233"></a><span class="lineno">17233</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19">vmaGetMemoryProperties</a>(</div>
-<div class="line"><a name="l17234"></a><span class="lineno">17234</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17235"></a><span class="lineno">17235</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceMemoryProperties** ppPhysicalDeviceMemoryProperties)</div>
-<div class="line"><a name="l17236"></a><span class="lineno">17236</span>&#160;{</div>
-<div class="line"><a name="l17237"></a><span class="lineno">17237</span>&#160;    VMA_ASSERT(allocator &amp;&amp; ppPhysicalDeviceMemoryProperties);</div>
-<div class="line"><a name="l17238"></a><span class="lineno">17238</span>&#160;    *ppPhysicalDeviceMemoryProperties = &amp;allocator-&gt;m_MemProps;</div>
-<div class="line"><a name="l17239"></a><span class="lineno">17239</span>&#160;}</div>
-<div class="line"><a name="l17240"></a><span class="lineno">17240</span>&#160; </div>
-<div class="line"><a name="l17241"></a><span class="lineno">17241</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca">vmaGetMemoryTypeProperties</a>(</div>
-<div class="line"><a name="l17242"></a><span class="lineno">17242</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17243"></a><span class="lineno">17243</span>&#160;    uint32_t memoryTypeIndex,</div>
-<div class="line"><a name="l17244"></a><span class="lineno">17244</span>&#160;    VkMemoryPropertyFlags* pFlags)</div>
-<div class="line"><a name="l17245"></a><span class="lineno">17245</span>&#160;{</div>
-<div class="line"><a name="l17246"></a><span class="lineno">17246</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pFlags);</div>
-<div class="line"><a name="l17247"></a><span class="lineno">17247</span>&#160;    VMA_ASSERT(memoryTypeIndex &lt; allocator-&gt;GetMemoryTypeCount());</div>
-<div class="line"><a name="l17248"></a><span class="lineno">17248</span>&#160;    *pFlags = allocator-&gt;m_MemProps.memoryTypes[memoryTypeIndex].propertyFlags;</div>
-<div class="line"><a name="l17249"></a><span class="lineno">17249</span>&#160;}</div>
-<div class="line"><a name="l17250"></a><span class="lineno">17250</span>&#160; </div>
-<div class="line"><a name="l17251"></a><span class="lineno">17251</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236">vmaSetCurrentFrameIndex</a>(</div>
-<div class="line"><a name="l17252"></a><span class="lineno">17252</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17253"></a><span class="lineno">17253</span>&#160;    uint32_t frameIndex)</div>
-<div class="line"><a name="l17254"></a><span class="lineno">17254</span>&#160;{</div>
-<div class="line"><a name="l17255"></a><span class="lineno">17255</span>&#160;    VMA_ASSERT(allocator);</div>
-<div class="line"><a name="l17256"></a><span class="lineno">17256</span>&#160;    VMA_ASSERT(frameIndex != VMA_FRAME_INDEX_LOST);</div>
+<div class="line"><a name="l17217"></a><span class="lineno">17217</span>&#160;        <span class="comment">// Destroy buffer.</span></div>
+<div class="line"><a name="l17218"></a><span class="lineno">17218</span>&#160;        (*GetVulkanFunctions().vkDestroyBuffer)(m_hDevice, buf, GetAllocationCallbacks());</div>
+<div class="line"><a name="l17219"></a><span class="lineno">17219</span>&#160;    }</div>
+<div class="line"><a name="l17220"></a><span class="lineno">17220</span>&#160; </div>
+<div class="line"><a name="l17221"></a><span class="lineno">17221</span>&#160;    <span class="keywordflow">return</span> memoryTypeBits;</div>
+<div class="line"><a name="l17222"></a><span class="lineno">17222</span>&#160;}</div>
+<div class="line"><a name="l17223"></a><span class="lineno">17223</span>&#160; </div>
+<div class="line"><a name="l17224"></a><span class="lineno">17224</span>&#160;uint32_t VmaAllocator_T::CalculateGlobalMemoryTypeBits()<span class="keyword"> const</span></div>
+<div class="line"><a name="l17225"></a><span class="lineno">17225</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l17226"></a><span class="lineno">17226</span>&#160;    <span class="comment">// Make sure memory information is already fetched.</span></div>
+<div class="line"><a name="l17227"></a><span class="lineno">17227</span>&#160;    VMA_ASSERT(GetMemoryTypeCount() &gt; 0);</div>
+<div class="line"><a name="l17228"></a><span class="lineno">17228</span>&#160; </div>
+<div class="line"><a name="l17229"></a><span class="lineno">17229</span>&#160;    uint32_t memoryTypeBits = UINT32_MAX;</div>
+<div class="line"><a name="l17230"></a><span class="lineno">17230</span>&#160; </div>
+<div class="line"><a name="l17231"></a><span class="lineno">17231</span>&#160;    <span class="keywordflow">if</span>(!m_UseAmdDeviceCoherentMemory)</div>
+<div class="line"><a name="l17232"></a><span class="lineno">17232</span>&#160;    {</div>
+<div class="line"><a name="l17233"></a><span class="lineno">17233</span>&#160;        <span class="comment">// Exclude memory types that have VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD.</span></div>
+<div class="line"><a name="l17234"></a><span class="lineno">17234</span>&#160;        <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
+<div class="line"><a name="l17235"></a><span class="lineno">17235</span>&#160;        {</div>
+<div class="line"><a name="l17236"></a><span class="lineno">17236</span>&#160;            <span class="keywordflow">if</span>((m_MemProps.memoryTypes[memTypeIndex].propertyFlags &amp; VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY) != 0)</div>
+<div class="line"><a name="l17237"></a><span class="lineno">17237</span>&#160;            {</div>
+<div class="line"><a name="l17238"></a><span class="lineno">17238</span>&#160;                memoryTypeBits &amp;= ~(1u &lt;&lt; memTypeIndex);</div>
+<div class="line"><a name="l17239"></a><span class="lineno">17239</span>&#160;            }</div>
+<div class="line"><a name="l17240"></a><span class="lineno">17240</span>&#160;        }</div>
+<div class="line"><a name="l17241"></a><span class="lineno">17241</span>&#160;    }</div>
+<div class="line"><a name="l17242"></a><span class="lineno">17242</span>&#160; </div>
+<div class="line"><a name="l17243"></a><span class="lineno">17243</span>&#160;    <span class="keywordflow">return</span> memoryTypeBits;</div>
+<div class="line"><a name="l17244"></a><span class="lineno">17244</span>&#160;}</div>
+<div class="line"><a name="l17245"></a><span class="lineno">17245</span>&#160; </div>
+<div class="line"><a name="l17246"></a><span class="lineno">17246</span>&#160;<span class="keywordtype">bool</span> VmaAllocator_T::GetFlushOrInvalidateRange(</div>
+<div class="line"><a name="l17247"></a><span class="lineno">17247</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l17248"></a><span class="lineno">17248</span>&#160;    VkDeviceSize offset, VkDeviceSize size,</div>
+<div class="line"><a name="l17249"></a><span class="lineno">17249</span>&#160;    VkMappedMemoryRange&amp; outRange)<span class="keyword"> const</span></div>
+<div class="line"><a name="l17250"></a><span class="lineno">17250</span>&#160;<span class="keyword"></span>{</div>
+<div class="line"><a name="l17251"></a><span class="lineno">17251</span>&#160;    <span class="keyword">const</span> uint32_t memTypeIndex = allocation-&gt;GetMemoryTypeIndex();</div>
+<div class="line"><a name="l17252"></a><span class="lineno">17252</span>&#160;    <span class="keywordflow">if</span>(size &gt; 0 &amp;&amp; IsMemoryTypeNonCoherent(memTypeIndex))</div>
+<div class="line"><a name="l17253"></a><span class="lineno">17253</span>&#160;    {</div>
+<div class="line"><a name="l17254"></a><span class="lineno">17254</span>&#160;        <span class="keyword">const</span> VkDeviceSize nonCoherentAtomSize = m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;</div>
+<div class="line"><a name="l17255"></a><span class="lineno">17255</span>&#160;        <span class="keyword">const</span> VkDeviceSize allocationSize = allocation-&gt;GetSize();</div>
+<div class="line"><a name="l17256"></a><span class="lineno">17256</span>&#160;        VMA_ASSERT(offset &lt;= allocationSize);</div>
 <div class="line"><a name="l17257"></a><span class="lineno">17257</span>&#160; </div>
-<div class="line"><a name="l17258"></a><span class="lineno">17258</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17259"></a><span class="lineno">17259</span>&#160; </div>
-<div class="line"><a name="l17260"></a><span class="lineno">17260</span>&#160;    allocator-&gt;SetCurrentFrameIndex(frameIndex);</div>
-<div class="line"><a name="l17261"></a><span class="lineno">17261</span>&#160;}</div>
-<div class="line"><a name="l17262"></a><span class="lineno">17262</span>&#160; </div>
-<div class="line"><a name="l17263"></a><span class="lineno">17263</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3">vmaCalculateStats</a>(</div>
-<div class="line"><a name="l17264"></a><span class="lineno">17264</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17265"></a><span class="lineno">17265</span>&#160;    <a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats)</div>
-<div class="line"><a name="l17266"></a><span class="lineno">17266</span>&#160;{</div>
-<div class="line"><a name="l17267"></a><span class="lineno">17267</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pStats);</div>
-<div class="line"><a name="l17268"></a><span class="lineno">17268</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17269"></a><span class="lineno">17269</span>&#160;    allocator-&gt;CalculateStats(pStats);</div>
-<div class="line"><a name="l17270"></a><span class="lineno">17270</span>&#160;}</div>
-<div class="line"><a name="l17271"></a><span class="lineno">17271</span>&#160; </div>
-<div class="line"><a name="l17272"></a><span class="lineno">17272</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba">vmaGetBudget</a>(</div>
-<div class="line"><a name="l17273"></a><span class="lineno">17273</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17274"></a><span class="lineno">17274</span>&#160;    <a class="code" href="struct_vma_budget.html">VmaBudget</a>* pBudget)</div>
-<div class="line"><a name="l17275"></a><span class="lineno">17275</span>&#160;{</div>
-<div class="line"><a name="l17276"></a><span class="lineno">17276</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pBudget);</div>
-<div class="line"><a name="l17277"></a><span class="lineno">17277</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17278"></a><span class="lineno">17278</span>&#160;    allocator-&gt;GetBudget(pBudget, 0, allocator-&gt;GetMemoryHeapCount());</div>
-<div class="line"><a name="l17279"></a><span class="lineno">17279</span>&#160;}</div>
-<div class="line"><a name="l17280"></a><span class="lineno">17280</span>&#160; </div>
-<div class="line"><a name="l17281"></a><span class="lineno">17281</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l17282"></a><span class="lineno">17282</span>&#160; </div>
-<div class="line"><a name="l17283"></a><span class="lineno">17283</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0">vmaBuildStatsString</a>(</div>
-<div class="line"><a name="l17284"></a><span class="lineno">17284</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17285"></a><span class="lineno">17285</span>&#160;    <span class="keywordtype">char</span>** ppStatsString,</div>
-<div class="line"><a name="l17286"></a><span class="lineno">17286</span>&#160;    VkBool32 detailedMap)</div>
-<div class="line"><a name="l17287"></a><span class="lineno">17287</span>&#160;{</div>
-<div class="line"><a name="l17288"></a><span class="lineno">17288</span>&#160;    VMA_ASSERT(allocator &amp;&amp; ppStatsString);</div>
-<div class="line"><a name="l17289"></a><span class="lineno">17289</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17290"></a><span class="lineno">17290</span>&#160; </div>
-<div class="line"><a name="l17291"></a><span class="lineno">17291</span>&#160;    VmaStringBuilder sb(allocator);</div>
-<div class="line"><a name="l17292"></a><span class="lineno">17292</span>&#160;    {</div>
-<div class="line"><a name="l17293"></a><span class="lineno">17293</span>&#160;        VmaJsonWriter json(allocator-&gt;GetAllocationCallbacks(), sb);</div>
-<div class="line"><a name="l17294"></a><span class="lineno">17294</span>&#160;        json.BeginObject();</div>
-<div class="line"><a name="l17295"></a><span class="lineno">17295</span>&#160; </div>
-<div class="line"><a name="l17296"></a><span class="lineno">17296</span>&#160;        <a class="code" href="struct_vma_budget.html">VmaBudget</a> budget[VK_MAX_MEMORY_HEAPS];</div>
-<div class="line"><a name="l17297"></a><span class="lineno">17297</span>&#160;        allocator-&gt;GetBudget(budget, 0, allocator-&gt;GetMemoryHeapCount());</div>
+<div class="line"><a name="l17258"></a><span class="lineno">17258</span>&#160;        outRange.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;</div>
+<div class="line"><a name="l17259"></a><span class="lineno">17259</span>&#160;        outRange.pNext = VMA_NULL;</div>
+<div class="line"><a name="l17260"></a><span class="lineno">17260</span>&#160;        outRange.memory = allocation-&gt;GetMemory();</div>
+<div class="line"><a name="l17261"></a><span class="lineno">17261</span>&#160; </div>
+<div class="line"><a name="l17262"></a><span class="lineno">17262</span>&#160;        <span class="keywordflow">switch</span>(allocation-&gt;GetType())</div>
+<div class="line"><a name="l17263"></a><span class="lineno">17263</span>&#160;        {</div>
+<div class="line"><a name="l17264"></a><span class="lineno">17264</span>&#160;        <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:</div>
+<div class="line"><a name="l17265"></a><span class="lineno">17265</span>&#160;            outRange.offset = VmaAlignDown(offset, nonCoherentAtomSize);</div>
+<div class="line"><a name="l17266"></a><span class="lineno">17266</span>&#160;            <span class="keywordflow">if</span>(size == VK_WHOLE_SIZE)</div>
+<div class="line"><a name="l17267"></a><span class="lineno">17267</span>&#160;            {</div>
+<div class="line"><a name="l17268"></a><span class="lineno">17268</span>&#160;                outRange.size = allocationSize - outRange.offset;</div>
+<div class="line"><a name="l17269"></a><span class="lineno">17269</span>&#160;            }</div>
+<div class="line"><a name="l17270"></a><span class="lineno">17270</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l17271"></a><span class="lineno">17271</span>&#160;            {</div>
+<div class="line"><a name="l17272"></a><span class="lineno">17272</span>&#160;                VMA_ASSERT(offset + size &lt;= allocationSize);</div>
+<div class="line"><a name="l17273"></a><span class="lineno">17273</span>&#160;                outRange.size = VMA_MIN(</div>
+<div class="line"><a name="l17274"></a><span class="lineno">17274</span>&#160;                    VmaAlignUp(size + (offset - outRange.offset), nonCoherentAtomSize),</div>
+<div class="line"><a name="l17275"></a><span class="lineno">17275</span>&#160;                    allocationSize - outRange.offset);</div>
+<div class="line"><a name="l17276"></a><span class="lineno">17276</span>&#160;            }</div>
+<div class="line"><a name="l17277"></a><span class="lineno">17277</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17278"></a><span class="lineno">17278</span>&#160;        <span class="keywordflow">case</span> VmaAllocation_T::ALLOCATION_TYPE_BLOCK:</div>
+<div class="line"><a name="l17279"></a><span class="lineno">17279</span>&#160;        {</div>
+<div class="line"><a name="l17280"></a><span class="lineno">17280</span>&#160;            <span class="comment">// 1. Still within this allocation.</span></div>
+<div class="line"><a name="l17281"></a><span class="lineno">17281</span>&#160;            outRange.offset = VmaAlignDown(offset, nonCoherentAtomSize);</div>
+<div class="line"><a name="l17282"></a><span class="lineno">17282</span>&#160;            <span class="keywordflow">if</span>(size == VK_WHOLE_SIZE)</div>
+<div class="line"><a name="l17283"></a><span class="lineno">17283</span>&#160;            {</div>
+<div class="line"><a name="l17284"></a><span class="lineno">17284</span>&#160;                size = allocationSize - offset;</div>
+<div class="line"><a name="l17285"></a><span class="lineno">17285</span>&#160;            }</div>
+<div class="line"><a name="l17286"></a><span class="lineno">17286</span>&#160;            <span class="keywordflow">else</span></div>
+<div class="line"><a name="l17287"></a><span class="lineno">17287</span>&#160;            {</div>
+<div class="line"><a name="l17288"></a><span class="lineno">17288</span>&#160;                VMA_ASSERT(offset + size &lt;= allocationSize);</div>
+<div class="line"><a name="l17289"></a><span class="lineno">17289</span>&#160;            }</div>
+<div class="line"><a name="l17290"></a><span class="lineno">17290</span>&#160;            outRange.size = VmaAlignUp(size + (offset - outRange.offset), nonCoherentAtomSize);</div>
+<div class="line"><a name="l17291"></a><span class="lineno">17291</span>&#160; </div>
+<div class="line"><a name="l17292"></a><span class="lineno">17292</span>&#160;            <span class="comment">// 2. Adjust to whole block.</span></div>
+<div class="line"><a name="l17293"></a><span class="lineno">17293</span>&#160;            <span class="keyword">const</span> VkDeviceSize allocationOffset = allocation-&gt;GetOffset();</div>
+<div class="line"><a name="l17294"></a><span class="lineno">17294</span>&#160;            VMA_ASSERT(allocationOffset % nonCoherentAtomSize == 0);</div>
+<div class="line"><a name="l17295"></a><span class="lineno">17295</span>&#160;            <span class="keyword">const</span> VkDeviceSize blockSize = allocation-&gt;GetBlock()-&gt;m_pMetadata-&gt;GetSize();</div>
+<div class="line"><a name="l17296"></a><span class="lineno">17296</span>&#160;            outRange.offset += allocationOffset;</div>
+<div class="line"><a name="l17297"></a><span class="lineno">17297</span>&#160;            outRange.size = VMA_MIN(outRange.size, blockSize - outRange.offset);</div>
 <div class="line"><a name="l17298"></a><span class="lineno">17298</span>&#160; </div>
-<div class="line"><a name="l17299"></a><span class="lineno">17299</span>&#160;        <a class="code" href="struct_vma_stats.html">VmaStats</a> stats;</div>
-<div class="line"><a name="l17300"></a><span class="lineno">17300</span>&#160;        allocator-&gt;CalculateStats(&amp;stats);</div>
-<div class="line"><a name="l17301"></a><span class="lineno">17301</span>&#160; </div>
-<div class="line"><a name="l17302"></a><span class="lineno">17302</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Total&quot;</span>);</div>
-<div class="line"><a name="l17303"></a><span class="lineno">17303</span>&#160;        VmaPrintStatInfo(json, stats.<a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>);</div>
-<div class="line"><a name="l17304"></a><span class="lineno">17304</span>&#160;    </div>
-<div class="line"><a name="l17305"></a><span class="lineno">17305</span>&#160;        <span class="keywordflow">for</span>(uint32_t heapIndex = 0; heapIndex &lt; allocator-&gt;GetMemoryHeapCount(); ++heapIndex)</div>
-<div class="line"><a name="l17306"></a><span class="lineno">17306</span>&#160;        {</div>
-<div class="line"><a name="l17307"></a><span class="lineno">17307</span>&#160;            json.BeginString(<span class="stringliteral">&quot;Heap &quot;</span>);</div>
-<div class="line"><a name="l17308"></a><span class="lineno">17308</span>&#160;            json.ContinueString(heapIndex);</div>
-<div class="line"><a name="l17309"></a><span class="lineno">17309</span>&#160;            json.EndString();</div>
-<div class="line"><a name="l17310"></a><span class="lineno">17310</span>&#160;            json.BeginObject();</div>
-<div class="line"><a name="l17311"></a><span class="lineno">17311</span>&#160; </div>
-<div class="line"><a name="l17312"></a><span class="lineno">17312</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Size&quot;</span>);</div>
-<div class="line"><a name="l17313"></a><span class="lineno">17313</span>&#160;            json.WriteNumber(allocator-&gt;m_MemProps.memoryHeaps[heapIndex].size);</div>
+<div class="line"><a name="l17299"></a><span class="lineno">17299</span>&#160;            <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17300"></a><span class="lineno">17300</span>&#160;        }</div>
+<div class="line"><a name="l17301"></a><span class="lineno">17301</span>&#160;        <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l17302"></a><span class="lineno">17302</span>&#160;            VMA_ASSERT(0);</div>
+<div class="line"><a name="l17303"></a><span class="lineno">17303</span>&#160;        }</div>
+<div class="line"><a name="l17304"></a><span class="lineno">17304</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l17305"></a><span class="lineno">17305</span>&#160;    }</div>
+<div class="line"><a name="l17306"></a><span class="lineno">17306</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l17307"></a><span class="lineno">17307</span>&#160;}</div>
+<div class="line"><a name="l17308"></a><span class="lineno">17308</span>&#160; </div>
+<div class="line"><a name="l17309"></a><span class="lineno">17309</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
+<div class="line"><a name="l17310"></a><span class="lineno">17310</span>&#160; </div>
+<div class="line"><a name="l17311"></a><span class="lineno">17311</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::UpdateVulkanBudget()</div>
+<div class="line"><a name="l17312"></a><span class="lineno">17312</span>&#160;{</div>
+<div class="line"><a name="l17313"></a><span class="lineno">17313</span>&#160;    VMA_ASSERT(m_UseExtMemoryBudget);</div>
 <div class="line"><a name="l17314"></a><span class="lineno">17314</span>&#160; </div>
-<div class="line"><a name="l17315"></a><span class="lineno">17315</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Flags&quot;</span>);</div>
-<div class="line"><a name="l17316"></a><span class="lineno">17316</span>&#160;            json.BeginArray(<span class="keyword">true</span>);</div>
-<div class="line"><a name="l17317"></a><span class="lineno">17317</span>&#160;            <span class="keywordflow">if</span>((allocator-&gt;m_MemProps.memoryHeaps[heapIndex].flags &amp; VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) != 0)</div>
-<div class="line"><a name="l17318"></a><span class="lineno">17318</span>&#160;            {</div>
-<div class="line"><a name="l17319"></a><span class="lineno">17319</span>&#160;                json.WriteString(<span class="stringliteral">&quot;DEVICE_LOCAL&quot;</span>);</div>
-<div class="line"><a name="l17320"></a><span class="lineno">17320</span>&#160;            }</div>
-<div class="line"><a name="l17321"></a><span class="lineno">17321</span>&#160;            json.EndArray();</div>
-<div class="line"><a name="l17322"></a><span class="lineno">17322</span>&#160; </div>
-<div class="line"><a name="l17323"></a><span class="lineno">17323</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Budget&quot;</span>);</div>
-<div class="line"><a name="l17324"></a><span class="lineno">17324</span>&#160;            json.BeginObject();</div>
-<div class="line"><a name="l17325"></a><span class="lineno">17325</span>&#160;            {</div>
-<div class="line"><a name="l17326"></a><span class="lineno">17326</span>&#160;                json.WriteString(<span class="stringliteral">&quot;BlockBytes&quot;</span>);</div>
-<div class="line"><a name="l17327"></a><span class="lineno">17327</span>&#160;                json.WriteNumber(budget[heapIndex].blockBytes);</div>
-<div class="line"><a name="l17328"></a><span class="lineno">17328</span>&#160;                json.WriteString(<span class="stringliteral">&quot;AllocationBytes&quot;</span>);</div>
-<div class="line"><a name="l17329"></a><span class="lineno">17329</span>&#160;                json.WriteNumber(budget[heapIndex].allocationBytes);</div>
-<div class="line"><a name="l17330"></a><span class="lineno">17330</span>&#160;                json.WriteString(<span class="stringliteral">&quot;Usage&quot;</span>);</div>
-<div class="line"><a name="l17331"></a><span class="lineno">17331</span>&#160;                json.WriteNumber(budget[heapIndex].usage);</div>
-<div class="line"><a name="l17332"></a><span class="lineno">17332</span>&#160;                json.WriteString(<span class="stringliteral">&quot;Budget&quot;</span>);</div>
-<div class="line"><a name="l17333"></a><span class="lineno">17333</span>&#160;                json.WriteNumber(budget[heapIndex].budget);</div>
-<div class="line"><a name="l17334"></a><span class="lineno">17334</span>&#160;            }</div>
-<div class="line"><a name="l17335"></a><span class="lineno">17335</span>&#160;            json.EndObject();</div>
-<div class="line"><a name="l17336"></a><span class="lineno">17336</span>&#160; </div>
-<div class="line"><a name="l17337"></a><span class="lineno">17337</span>&#160;            <span class="keywordflow">if</span>(stats.<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[heapIndex].<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> &gt; 0)</div>
-<div class="line"><a name="l17338"></a><span class="lineno">17338</span>&#160;            {</div>
-<div class="line"><a name="l17339"></a><span class="lineno">17339</span>&#160;                json.WriteString(<span class="stringliteral">&quot;Stats&quot;</span>);</div>
-<div class="line"><a name="l17340"></a><span class="lineno">17340</span>&#160;                VmaPrintStatInfo(json, stats.<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[heapIndex]);</div>
-<div class="line"><a name="l17341"></a><span class="lineno">17341</span>&#160;            }</div>
-<div class="line"><a name="l17342"></a><span class="lineno">17342</span>&#160; </div>
-<div class="line"><a name="l17343"></a><span class="lineno">17343</span>&#160;            <span class="keywordflow">for</span>(uint32_t typeIndex = 0; typeIndex &lt; allocator-&gt;GetMemoryTypeCount(); ++typeIndex)</div>
-<div class="line"><a name="l17344"></a><span class="lineno">17344</span>&#160;            {</div>
-<div class="line"><a name="l17345"></a><span class="lineno">17345</span>&#160;                <span class="keywordflow">if</span>(allocator-&gt;MemoryTypeIndexToHeapIndex(typeIndex) == heapIndex)</div>
-<div class="line"><a name="l17346"></a><span class="lineno">17346</span>&#160;                {</div>
-<div class="line"><a name="l17347"></a><span class="lineno">17347</span>&#160;                    json.BeginString(<span class="stringliteral">&quot;Type &quot;</span>);</div>
-<div class="line"><a name="l17348"></a><span class="lineno">17348</span>&#160;                    json.ContinueString(typeIndex);</div>
-<div class="line"><a name="l17349"></a><span class="lineno">17349</span>&#160;                    json.EndString();</div>
+<div class="line"><a name="l17315"></a><span class="lineno">17315</span>&#160;    VkPhysicalDeviceMemoryProperties2KHR memProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR };</div>
+<div class="line"><a name="l17316"></a><span class="lineno">17316</span>&#160; </div>
+<div class="line"><a name="l17317"></a><span class="lineno">17317</span>&#160;    VkPhysicalDeviceMemoryBudgetPropertiesEXT budgetProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT };</div>
+<div class="line"><a name="l17318"></a><span class="lineno">17318</span>&#160;    VmaPnextChainPushFront(&amp;memProps, &amp;budgetProps);</div>
+<div class="line"><a name="l17319"></a><span class="lineno">17319</span>&#160; </div>
+<div class="line"><a name="l17320"></a><span class="lineno">17320</span>&#160;    GetVulkanFunctions().vkGetPhysicalDeviceMemoryProperties2KHR(m_PhysicalDevice, &amp;memProps);</div>
+<div class="line"><a name="l17321"></a><span class="lineno">17321</span>&#160; </div>
+<div class="line"><a name="l17322"></a><span class="lineno">17322</span>&#160;    {</div>
+<div class="line"><a name="l17323"></a><span class="lineno">17323</span>&#160;        VmaMutexLockWrite lockWrite(m_Budget.m_BudgetMutex, m_UseMutex);</div>
+<div class="line"><a name="l17324"></a><span class="lineno">17324</span>&#160; </div>
+<div class="line"><a name="l17325"></a><span class="lineno">17325</span>&#160;        <span class="keywordflow">for</span>(uint32_t heapIndex = 0; heapIndex &lt; GetMemoryHeapCount(); ++heapIndex)</div>
+<div class="line"><a name="l17326"></a><span class="lineno">17326</span>&#160;        {</div>
+<div class="line"><a name="l17327"></a><span class="lineno">17327</span>&#160;            m_Budget.m_VulkanUsage[heapIndex] = budgetProps.heapUsage[heapIndex];</div>
+<div class="line"><a name="l17328"></a><span class="lineno">17328</span>&#160;            m_Budget.m_VulkanBudget[heapIndex] = budgetProps.heapBudget[heapIndex];</div>
+<div class="line"><a name="l17329"></a><span class="lineno">17329</span>&#160;            m_Budget.m_BlockBytesAtBudgetFetch[heapIndex] = m_Budget.m_BlockBytes[heapIndex].load();</div>
+<div class="line"><a name="l17330"></a><span class="lineno">17330</span>&#160; </div>
+<div class="line"><a name="l17331"></a><span class="lineno">17331</span>&#160;            <span class="comment">// Some bugged drivers return the budget incorrectly, e.g. 0 or much bigger than heap size.</span></div>
+<div class="line"><a name="l17332"></a><span class="lineno">17332</span>&#160;            <span class="keywordflow">if</span>(m_Budget.m_VulkanBudget[heapIndex] == 0)</div>
+<div class="line"><a name="l17333"></a><span class="lineno">17333</span>&#160;            {</div>
+<div class="line"><a name="l17334"></a><span class="lineno">17334</span>&#160;                m_Budget.m_VulkanBudget[heapIndex] = m_MemProps.memoryHeaps[heapIndex].size * 8 / 10; <span class="comment">// 80% heuristics.</span></div>
+<div class="line"><a name="l17335"></a><span class="lineno">17335</span>&#160;            }</div>
+<div class="line"><a name="l17336"></a><span class="lineno">17336</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span>(m_Budget.m_VulkanBudget[heapIndex] &gt; m_MemProps.memoryHeaps[heapIndex].size)</div>
+<div class="line"><a name="l17337"></a><span class="lineno">17337</span>&#160;            {</div>
+<div class="line"><a name="l17338"></a><span class="lineno">17338</span>&#160;                m_Budget.m_VulkanBudget[heapIndex] = m_MemProps.memoryHeaps[heapIndex].size;</div>
+<div class="line"><a name="l17339"></a><span class="lineno">17339</span>&#160;            }</div>
+<div class="line"><a name="l17340"></a><span class="lineno">17340</span>&#160;            <span class="keywordflow">if</span>(m_Budget.m_VulkanUsage[heapIndex] == 0 &amp;&amp; m_Budget.m_BlockBytesAtBudgetFetch[heapIndex] &gt; 0)</div>
+<div class="line"><a name="l17341"></a><span class="lineno">17341</span>&#160;            {</div>
+<div class="line"><a name="l17342"></a><span class="lineno">17342</span>&#160;                m_Budget.m_VulkanUsage[heapIndex] = m_Budget.m_BlockBytesAtBudgetFetch[heapIndex];</div>
+<div class="line"><a name="l17343"></a><span class="lineno">17343</span>&#160;            }</div>
+<div class="line"><a name="l17344"></a><span class="lineno">17344</span>&#160;        }</div>
+<div class="line"><a name="l17345"></a><span class="lineno">17345</span>&#160;        m_Budget.m_OperationsSinceBudgetFetch = 0;</div>
+<div class="line"><a name="l17346"></a><span class="lineno">17346</span>&#160;    }</div>
+<div class="line"><a name="l17347"></a><span class="lineno">17347</span>&#160;}</div>
+<div class="line"><a name="l17348"></a><span class="lineno">17348</span>&#160; </div>
+<div class="line"><a name="l17349"></a><span class="lineno">17349</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
 <div class="line"><a name="l17350"></a><span class="lineno">17350</span>&#160; </div>
-<div class="line"><a name="l17351"></a><span class="lineno">17351</span>&#160;                    json.BeginObject();</div>
-<div class="line"><a name="l17352"></a><span class="lineno">17352</span>&#160; </div>
-<div class="line"><a name="l17353"></a><span class="lineno">17353</span>&#160;                    json.WriteString(<span class="stringliteral">&quot;Flags&quot;</span>);</div>
-<div class="line"><a name="l17354"></a><span class="lineno">17354</span>&#160;                    json.BeginArray(<span class="keyword">true</span>);</div>
-<div class="line"><a name="l17355"></a><span class="lineno">17355</span>&#160;                    VkMemoryPropertyFlags flags = allocator-&gt;m_MemProps.memoryTypes[typeIndex].propertyFlags;</div>
-<div class="line"><a name="l17356"></a><span class="lineno">17356</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0)</div>
-<div class="line"><a name="l17357"></a><span class="lineno">17357</span>&#160;                    {</div>
-<div class="line"><a name="l17358"></a><span class="lineno">17358</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;DEVICE_LOCAL&quot;</span>);</div>
-<div class="line"><a name="l17359"></a><span class="lineno">17359</span>&#160;                    }</div>
-<div class="line"><a name="l17360"></a><span class="lineno">17360</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)</div>
-<div class="line"><a name="l17361"></a><span class="lineno">17361</span>&#160;                    {</div>
-<div class="line"><a name="l17362"></a><span class="lineno">17362</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;HOST_VISIBLE&quot;</span>);</div>
-<div class="line"><a name="l17363"></a><span class="lineno">17363</span>&#160;                    }</div>
-<div class="line"><a name="l17364"></a><span class="lineno">17364</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) != 0)</div>
-<div class="line"><a name="l17365"></a><span class="lineno">17365</span>&#160;                    {</div>
-<div class="line"><a name="l17366"></a><span class="lineno">17366</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;HOST_COHERENT&quot;</span>);</div>
-<div class="line"><a name="l17367"></a><span class="lineno">17367</span>&#160;                    }</div>
-<div class="line"><a name="l17368"></a><span class="lineno">17368</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_HOST_CACHED_BIT) != 0)</div>
-<div class="line"><a name="l17369"></a><span class="lineno">17369</span>&#160;                    {</div>
-<div class="line"><a name="l17370"></a><span class="lineno">17370</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;HOST_CACHED&quot;</span>);</div>
-<div class="line"><a name="l17371"></a><span class="lineno">17371</span>&#160;                    }</div>
-<div class="line"><a name="l17372"></a><span class="lineno">17372</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) != 0)</div>
-<div class="line"><a name="l17373"></a><span class="lineno">17373</span>&#160;                    {</div>
-<div class="line"><a name="l17374"></a><span class="lineno">17374</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;LAZILY_ALLOCATED&quot;</span>);</div>
-<div class="line"><a name="l17375"></a><span class="lineno">17375</span>&#160;                    }</div>
-<div class="line"><a name="l17376"></a><span class="lineno">17376</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_PROTECTED_BIT) != 0)</div>
-<div class="line"><a name="l17377"></a><span class="lineno">17377</span>&#160;                    {</div>
-<div class="line"><a name="l17378"></a><span class="lineno">17378</span>&#160;                        json.WriteString(<span class="stringliteral">&quot; PROTECTED&quot;</span>);</div>
-<div class="line"><a name="l17379"></a><span class="lineno">17379</span>&#160;                    }</div>
-<div class="line"><a name="l17380"></a><span class="lineno">17380</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY) != 0)</div>
-<div class="line"><a name="l17381"></a><span class="lineno">17381</span>&#160;                    {</div>
-<div class="line"><a name="l17382"></a><span class="lineno">17382</span>&#160;                        json.WriteString(<span class="stringliteral">&quot; DEVICE_COHERENT&quot;</span>);</div>
-<div class="line"><a name="l17383"></a><span class="lineno">17383</span>&#160;                    }</div>
-<div class="line"><a name="l17384"></a><span class="lineno">17384</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY) != 0)</div>
-<div class="line"><a name="l17385"></a><span class="lineno">17385</span>&#160;                    {</div>
-<div class="line"><a name="l17386"></a><span class="lineno">17386</span>&#160;                        json.WriteString(<span class="stringliteral">&quot; DEVICE_UNCACHED&quot;</span>);</div>
-<div class="line"><a name="l17387"></a><span class="lineno">17387</span>&#160;                    }</div>
-<div class="line"><a name="l17388"></a><span class="lineno">17388</span>&#160;                    json.EndArray();</div>
-<div class="line"><a name="l17389"></a><span class="lineno">17389</span>&#160; </div>
-<div class="line"><a name="l17390"></a><span class="lineno">17390</span>&#160;                    <span class="keywordflow">if</span>(stats.<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[typeIndex].<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> &gt; 0)</div>
-<div class="line"><a name="l17391"></a><span class="lineno">17391</span>&#160;                    {</div>
-<div class="line"><a name="l17392"></a><span class="lineno">17392</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;Stats&quot;</span>);</div>
-<div class="line"><a name="l17393"></a><span class="lineno">17393</span>&#160;                        VmaPrintStatInfo(json, stats.<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[typeIndex]);</div>
-<div class="line"><a name="l17394"></a><span class="lineno">17394</span>&#160;                    }</div>
-<div class="line"><a name="l17395"></a><span class="lineno">17395</span>&#160; </div>
-<div class="line"><a name="l17396"></a><span class="lineno">17396</span>&#160;                    json.EndObject();</div>
-<div class="line"><a name="l17397"></a><span class="lineno">17397</span>&#160;                }</div>
-<div class="line"><a name="l17398"></a><span class="lineno">17398</span>&#160;            }</div>
-<div class="line"><a name="l17399"></a><span class="lineno">17399</span>&#160; </div>
-<div class="line"><a name="l17400"></a><span class="lineno">17400</span>&#160;            json.EndObject();</div>
-<div class="line"><a name="l17401"></a><span class="lineno">17401</span>&#160;        }</div>
-<div class="line"><a name="l17402"></a><span class="lineno">17402</span>&#160;        <span class="keywordflow">if</span>(detailedMap == VK_TRUE)</div>
-<div class="line"><a name="l17403"></a><span class="lineno">17403</span>&#160;        {</div>
-<div class="line"><a name="l17404"></a><span class="lineno">17404</span>&#160;            allocator-&gt;PrintDetailedMap(json);</div>
-<div class="line"><a name="l17405"></a><span class="lineno">17405</span>&#160;        }</div>
-<div class="line"><a name="l17406"></a><span class="lineno">17406</span>&#160; </div>
-<div class="line"><a name="l17407"></a><span class="lineno">17407</span>&#160;        json.EndObject();</div>
-<div class="line"><a name="l17408"></a><span class="lineno">17408</span>&#160;    }</div>
-<div class="line"><a name="l17409"></a><span class="lineno">17409</span>&#160; </div>
-<div class="line"><a name="l17410"></a><span class="lineno">17410</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> len = sb.GetLength();</div>
-<div class="line"><a name="l17411"></a><span class="lineno">17411</span>&#160;    <span class="keywordtype">char</span>* <span class="keyword">const</span> pChars = vma_new_array(allocator, <span class="keywordtype">char</span>, len + 1);</div>
-<div class="line"><a name="l17412"></a><span class="lineno">17412</span>&#160;    <span class="keywordflow">if</span>(len &gt; 0)</div>
-<div class="line"><a name="l17413"></a><span class="lineno">17413</span>&#160;    {</div>
-<div class="line"><a name="l17414"></a><span class="lineno">17414</span>&#160;        memcpy(pChars, sb.GetData(), len);</div>
-<div class="line"><a name="l17415"></a><span class="lineno">17415</span>&#160;    }</div>
-<div class="line"><a name="l17416"></a><span class="lineno">17416</span>&#160;    pChars[len] = <span class="charliteral">&#39;\0&#39;</span>;</div>
-<div class="line"><a name="l17417"></a><span class="lineno">17417</span>&#160;    *ppStatsString = pChars;</div>
-<div class="line"><a name="l17418"></a><span class="lineno">17418</span>&#160;}</div>
-<div class="line"><a name="l17419"></a><span class="lineno">17419</span>&#160; </div>
-<div class="line"><a name="l17420"></a><span class="lineno">17420</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288">vmaFreeStatsString</a>(</div>
-<div class="line"><a name="l17421"></a><span class="lineno">17421</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17422"></a><span class="lineno">17422</span>&#160;    <span class="keywordtype">char</span>* pStatsString)</div>
-<div class="line"><a name="l17423"></a><span class="lineno">17423</span>&#160;{</div>
-<div class="line"><a name="l17424"></a><span class="lineno">17424</span>&#160;    <span class="keywordflow">if</span>(pStatsString != VMA_NULL)</div>
-<div class="line"><a name="l17425"></a><span class="lineno">17425</span>&#160;    {</div>
-<div class="line"><a name="l17426"></a><span class="lineno">17426</span>&#160;        VMA_ASSERT(allocator);</div>
-<div class="line"><a name="l17427"></a><span class="lineno">17427</span>&#160;        <span class="keywordtype">size_t</span> len = strlen(pStatsString);</div>
-<div class="line"><a name="l17428"></a><span class="lineno">17428</span>&#160;        vma_delete_array(allocator, pStatsString, len + 1);</div>
-<div class="line"><a name="l17429"></a><span class="lineno">17429</span>&#160;    }</div>
-<div class="line"><a name="l17430"></a><span class="lineno">17430</span>&#160;}</div>
-<div class="line"><a name="l17431"></a><span class="lineno">17431</span>&#160; </div>
-<div class="line"><a name="l17432"></a><span class="lineno">17432</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l17433"></a><span class="lineno">17433</span>&#160; </div>
-<div class="line"><a name="l17434"></a><span class="lineno">17434</span>&#160;<span class="comment">/*</span></div>
-<div class="line"><a name="l17435"></a><span class="lineno">17435</span>&#160;<span class="comment">This function is not protected by any mutex because it just reads immutable data.</span></div>
-<div class="line"><a name="l17436"></a><span class="lineno">17436</span>&#160;<span class="comment">*/</span></div>
-<div class="line"><a name="l17437"></a><span class="lineno">17437</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(</div>
-<div class="line"><a name="l17438"></a><span class="lineno">17438</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17439"></a><span class="lineno">17439</span>&#160;    uint32_t memoryTypeBits,</div>
-<div class="line"><a name="l17440"></a><span class="lineno">17440</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
-<div class="line"><a name="l17441"></a><span class="lineno">17441</span>&#160;    uint32_t* pMemoryTypeIndex)</div>
-<div class="line"><a name="l17442"></a><span class="lineno">17442</span>&#160;{</div>
-<div class="line"><a name="l17443"></a><span class="lineno">17443</span>&#160;    VMA_ASSERT(allocator != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l17444"></a><span class="lineno">17444</span>&#160;    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);</div>
-<div class="line"><a name="l17445"></a><span class="lineno">17445</span>&#160;    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);</div>
-<div class="line"><a name="l17446"></a><span class="lineno">17446</span>&#160; </div>
-<div class="line"><a name="l17447"></a><span class="lineno">17447</span>&#160;    memoryTypeBits &amp;= allocator-&gt;GetGlobalMemoryTypeBits();</div>
-<div class="line"><a name="l17448"></a><span class="lineno">17448</span>&#160; </div>
-<div class="line"><a name="l17449"></a><span class="lineno">17449</span>&#160;    <span class="keywordflow">if</span>(pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a> != 0)</div>
-<div class="line"><a name="l17450"></a><span class="lineno">17450</span>&#160;    {</div>
-<div class="line"><a name="l17451"></a><span class="lineno">17451</span>&#160;        memoryTypeBits &amp;= pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>;</div>
-<div class="line"><a name="l17452"></a><span class="lineno">17452</span>&#160;    }</div>
-<div class="line"><a name="l17453"></a><span class="lineno">17453</span>&#160;    </div>
-<div class="line"><a name="l17454"></a><span class="lineno">17454</span>&#160;    uint32_t requiredFlags = pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>;</div>
-<div class="line"><a name="l17455"></a><span class="lineno">17455</span>&#160;    uint32_t preferredFlags = pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>;</div>
-<div class="line"><a name="l17456"></a><span class="lineno">17456</span>&#160;    uint32_t notPreferredFlags = 0;</div>
-<div class="line"><a name="l17457"></a><span class="lineno">17457</span>&#160; </div>
-<div class="line"><a name="l17458"></a><span class="lineno">17458</span>&#160;    <span class="comment">// Convert usage to requiredFlags and preferredFlags.</span></div>
-<div class="line"><a name="l17459"></a><span class="lineno">17459</span>&#160;    <span class="keywordflow">switch</span>(pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>)</div>
-<div class="line"><a name="l17460"></a><span class="lineno">17460</span>&#160;    {</div>
-<div class="line"><a name="l17461"></a><span class="lineno">17461</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd">VMA_MEMORY_USAGE_UNKNOWN</a>:</div>
-<div class="line"><a name="l17462"></a><span class="lineno">17462</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l17463"></a><span class="lineno">17463</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a>:</div>
-<div class="line"><a name="l17464"></a><span class="lineno">17464</span>&#160;        <span class="keywordflow">if</span>(!allocator-&gt;IsIntegratedGpu() || (preferredFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)</div>
-<div class="line"><a name="l17465"></a><span class="lineno">17465</span>&#160;        {</div>
-<div class="line"><a name="l17466"></a><span class="lineno">17466</span>&#160;            preferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;</div>
+<div class="line"><a name="l17351"></a><span class="lineno">17351</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::FillAllocation(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, uint8_t pattern)</div>
+<div class="line"><a name="l17352"></a><span class="lineno">17352</span>&#160;{</div>
+<div class="line"><a name="l17353"></a><span class="lineno">17353</span>&#160;    <span class="keywordflow">if</span>(VMA_DEBUG_INITIALIZE_ALLOCATIONS &amp;&amp;</div>
+<div class="line"><a name="l17354"></a><span class="lineno">17354</span>&#160;        !hAllocation-&gt;CanBecomeLost() &amp;&amp;</div>
+<div class="line"><a name="l17355"></a><span class="lineno">17355</span>&#160;        (m_MemProps.memoryTypes[hAllocation-&gt;GetMemoryTypeIndex()].propertyFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)</div>
+<div class="line"><a name="l17356"></a><span class="lineno">17356</span>&#160;    {</div>
+<div class="line"><a name="l17357"></a><span class="lineno">17357</span>&#160;        <span class="keywordtype">void</span>* pData = VMA_NULL;</div>
+<div class="line"><a name="l17358"></a><span class="lineno">17358</span>&#160;        VkResult res = Map(hAllocation, &amp;pData);</div>
+<div class="line"><a name="l17359"></a><span class="lineno">17359</span>&#160;        <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l17360"></a><span class="lineno">17360</span>&#160;        {</div>
+<div class="line"><a name="l17361"></a><span class="lineno">17361</span>&#160;            memset(pData, (<span class="keywordtype">int</span>)pattern, (<span class="keywordtype">size_t</span>)hAllocation-&gt;GetSize());</div>
+<div class="line"><a name="l17362"></a><span class="lineno">17362</span>&#160;            FlushOrInvalidateAllocation(hAllocation, 0, VK_WHOLE_SIZE, VMA_CACHE_FLUSH);</div>
+<div class="line"><a name="l17363"></a><span class="lineno">17363</span>&#160;            Unmap(hAllocation);</div>
+<div class="line"><a name="l17364"></a><span class="lineno">17364</span>&#160;        }</div>
+<div class="line"><a name="l17365"></a><span class="lineno">17365</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l17366"></a><span class="lineno">17366</span>&#160;        {</div>
+<div class="line"><a name="l17367"></a><span class="lineno">17367</span>&#160;            VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;VMA_DEBUG_INITIALIZE_ALLOCATIONS is enabled, but couldn&#39;t map memory to fill allocation.&quot;</span>);</div>
+<div class="line"><a name="l17368"></a><span class="lineno">17368</span>&#160;        }</div>
+<div class="line"><a name="l17369"></a><span class="lineno">17369</span>&#160;    }</div>
+<div class="line"><a name="l17370"></a><span class="lineno">17370</span>&#160;}</div>
+<div class="line"><a name="l17371"></a><span class="lineno">17371</span>&#160; </div>
+<div class="line"><a name="l17372"></a><span class="lineno">17372</span>&#160;uint32_t VmaAllocator_T::GetGpuDefragmentationMemoryTypeBits()</div>
+<div class="line"><a name="l17373"></a><span class="lineno">17373</span>&#160;{</div>
+<div class="line"><a name="l17374"></a><span class="lineno">17374</span>&#160;    uint32_t memoryTypeBits = m_GpuDefragmentationMemoryTypeBits.load();</div>
+<div class="line"><a name="l17375"></a><span class="lineno">17375</span>&#160;    <span class="keywordflow">if</span>(memoryTypeBits == UINT32_MAX)</div>
+<div class="line"><a name="l17376"></a><span class="lineno">17376</span>&#160;    {</div>
+<div class="line"><a name="l17377"></a><span class="lineno">17377</span>&#160;        memoryTypeBits = CalculateGpuDefragmentationMemoryTypeBits();</div>
+<div class="line"><a name="l17378"></a><span class="lineno">17378</span>&#160;        m_GpuDefragmentationMemoryTypeBits.store(memoryTypeBits);</div>
+<div class="line"><a name="l17379"></a><span class="lineno">17379</span>&#160;    }</div>
+<div class="line"><a name="l17380"></a><span class="lineno">17380</span>&#160;    <span class="keywordflow">return</span> memoryTypeBits;</div>
+<div class="line"><a name="l17381"></a><span class="lineno">17381</span>&#160;}</div>
+<div class="line"><a name="l17382"></a><span class="lineno">17382</span>&#160; </div>
+<div class="line"><a name="l17383"></a><span class="lineno">17383</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l17384"></a><span class="lineno">17384</span>&#160; </div>
+<div class="line"><a name="l17385"></a><span class="lineno">17385</span>&#160;<span class="keywordtype">void</span> VmaAllocator_T::PrintDetailedMap(VmaJsonWriter&amp; json)</div>
+<div class="line"><a name="l17386"></a><span class="lineno">17386</span>&#160;{</div>
+<div class="line"><a name="l17387"></a><span class="lineno">17387</span>&#160;    <span class="keywordtype">bool</span> dedicatedAllocationsStarted = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l17388"></a><span class="lineno">17388</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
+<div class="line"><a name="l17389"></a><span class="lineno">17389</span>&#160;    {</div>
+<div class="line"><a name="l17390"></a><span class="lineno">17390</span>&#160;        VmaMutexLockRead dedicatedAllocationsLock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);</div>
+<div class="line"><a name="l17391"></a><span class="lineno">17391</span>&#160;        AllocationVectorType* <span class="keyword">const</span> pDedicatedAllocVector = m_pDedicatedAllocations[memTypeIndex];</div>
+<div class="line"><a name="l17392"></a><span class="lineno">17392</span>&#160;        VMA_ASSERT(pDedicatedAllocVector);</div>
+<div class="line"><a name="l17393"></a><span class="lineno">17393</span>&#160;        <span class="keywordflow">if</span>(pDedicatedAllocVector-&gt;empty() == <span class="keyword">false</span>)</div>
+<div class="line"><a name="l17394"></a><span class="lineno">17394</span>&#160;        {</div>
+<div class="line"><a name="l17395"></a><span class="lineno">17395</span>&#160;            <span class="keywordflow">if</span>(dedicatedAllocationsStarted == <span class="keyword">false</span>)</div>
+<div class="line"><a name="l17396"></a><span class="lineno">17396</span>&#160;            {</div>
+<div class="line"><a name="l17397"></a><span class="lineno">17397</span>&#160;                dedicatedAllocationsStarted = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l17398"></a><span class="lineno">17398</span>&#160;                json.WriteString(<span class="stringliteral">&quot;DedicatedAllocations&quot;</span>);</div>
+<div class="line"><a name="l17399"></a><span class="lineno">17399</span>&#160;                json.BeginObject();</div>
+<div class="line"><a name="l17400"></a><span class="lineno">17400</span>&#160;            }</div>
+<div class="line"><a name="l17401"></a><span class="lineno">17401</span>&#160; </div>
+<div class="line"><a name="l17402"></a><span class="lineno">17402</span>&#160;            json.BeginString(<span class="stringliteral">&quot;Type &quot;</span>);</div>
+<div class="line"><a name="l17403"></a><span class="lineno">17403</span>&#160;            json.ContinueString(memTypeIndex);</div>
+<div class="line"><a name="l17404"></a><span class="lineno">17404</span>&#160;            json.EndString();</div>
+<div class="line"><a name="l17405"></a><span class="lineno">17405</span>&#160;                </div>
+<div class="line"><a name="l17406"></a><span class="lineno">17406</span>&#160;            json.BeginArray();</div>
+<div class="line"><a name="l17407"></a><span class="lineno">17407</span>&#160; </div>
+<div class="line"><a name="l17408"></a><span class="lineno">17408</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; pDedicatedAllocVector-&gt;size(); ++i)</div>
+<div class="line"><a name="l17409"></a><span class="lineno">17409</span>&#160;            {</div>
+<div class="line"><a name="l17410"></a><span class="lineno">17410</span>&#160;                json.BeginObject(<span class="keyword">true</span>);</div>
+<div class="line"><a name="l17411"></a><span class="lineno">17411</span>&#160;                <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc = (*pDedicatedAllocVector)[i];</div>
+<div class="line"><a name="l17412"></a><span class="lineno">17412</span>&#160;                hAlloc-&gt;PrintParameters(json);</div>
+<div class="line"><a name="l17413"></a><span class="lineno">17413</span>&#160;                json.EndObject();</div>
+<div class="line"><a name="l17414"></a><span class="lineno">17414</span>&#160;            }</div>
+<div class="line"><a name="l17415"></a><span class="lineno">17415</span>&#160; </div>
+<div class="line"><a name="l17416"></a><span class="lineno">17416</span>&#160;            json.EndArray();</div>
+<div class="line"><a name="l17417"></a><span class="lineno">17417</span>&#160;        }</div>
+<div class="line"><a name="l17418"></a><span class="lineno">17418</span>&#160;    }</div>
+<div class="line"><a name="l17419"></a><span class="lineno">17419</span>&#160;    <span class="keywordflow">if</span>(dedicatedAllocationsStarted)</div>
+<div class="line"><a name="l17420"></a><span class="lineno">17420</span>&#160;    {</div>
+<div class="line"><a name="l17421"></a><span class="lineno">17421</span>&#160;        json.EndObject();</div>
+<div class="line"><a name="l17422"></a><span class="lineno">17422</span>&#160;    }</div>
+<div class="line"><a name="l17423"></a><span class="lineno">17423</span>&#160; </div>
+<div class="line"><a name="l17424"></a><span class="lineno">17424</span>&#160;    {</div>
+<div class="line"><a name="l17425"></a><span class="lineno">17425</span>&#160;        <span class="keywordtype">bool</span> allocationsStarted = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l17426"></a><span class="lineno">17426</span>&#160;        <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0; memTypeIndex &lt; GetMemoryTypeCount(); ++memTypeIndex)</div>
+<div class="line"><a name="l17427"></a><span class="lineno">17427</span>&#160;        {</div>
+<div class="line"><a name="l17428"></a><span class="lineno">17428</span>&#160;            <span class="keywordflow">if</span>(m_pBlockVectors[memTypeIndex]-&gt;IsEmpty() == <span class="keyword">false</span>)</div>
+<div class="line"><a name="l17429"></a><span class="lineno">17429</span>&#160;            {</div>
+<div class="line"><a name="l17430"></a><span class="lineno">17430</span>&#160;                <span class="keywordflow">if</span>(allocationsStarted == <span class="keyword">false</span>)</div>
+<div class="line"><a name="l17431"></a><span class="lineno">17431</span>&#160;                {</div>
+<div class="line"><a name="l17432"></a><span class="lineno">17432</span>&#160;                    allocationsStarted = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l17433"></a><span class="lineno">17433</span>&#160;                    json.WriteString(<span class="stringliteral">&quot;DefaultPools&quot;</span>);</div>
+<div class="line"><a name="l17434"></a><span class="lineno">17434</span>&#160;                    json.BeginObject();</div>
+<div class="line"><a name="l17435"></a><span class="lineno">17435</span>&#160;                }</div>
+<div class="line"><a name="l17436"></a><span class="lineno">17436</span>&#160; </div>
+<div class="line"><a name="l17437"></a><span class="lineno">17437</span>&#160;                json.BeginString(<span class="stringliteral">&quot;Type &quot;</span>);</div>
+<div class="line"><a name="l17438"></a><span class="lineno">17438</span>&#160;                json.ContinueString(memTypeIndex);</div>
+<div class="line"><a name="l17439"></a><span class="lineno">17439</span>&#160;                json.EndString();</div>
+<div class="line"><a name="l17440"></a><span class="lineno">17440</span>&#160; </div>
+<div class="line"><a name="l17441"></a><span class="lineno">17441</span>&#160;                m_pBlockVectors[memTypeIndex]-&gt;PrintDetailedMap(json);</div>
+<div class="line"><a name="l17442"></a><span class="lineno">17442</span>&#160;            }</div>
+<div class="line"><a name="l17443"></a><span class="lineno">17443</span>&#160;        }</div>
+<div class="line"><a name="l17444"></a><span class="lineno">17444</span>&#160;        <span class="keywordflow">if</span>(allocationsStarted)</div>
+<div class="line"><a name="l17445"></a><span class="lineno">17445</span>&#160;        {</div>
+<div class="line"><a name="l17446"></a><span class="lineno">17446</span>&#160;            json.EndObject();</div>
+<div class="line"><a name="l17447"></a><span class="lineno">17447</span>&#160;        }</div>
+<div class="line"><a name="l17448"></a><span class="lineno">17448</span>&#160;    }</div>
+<div class="line"><a name="l17449"></a><span class="lineno">17449</span>&#160; </div>
+<div class="line"><a name="l17450"></a><span class="lineno">17450</span>&#160;    <span class="comment">// Custom pools</span></div>
+<div class="line"><a name="l17451"></a><span class="lineno">17451</span>&#160;    {</div>
+<div class="line"><a name="l17452"></a><span class="lineno">17452</span>&#160;        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);</div>
+<div class="line"><a name="l17453"></a><span class="lineno">17453</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">size_t</span> poolCount = m_Pools.size();</div>
+<div class="line"><a name="l17454"></a><span class="lineno">17454</span>&#160;        <span class="keywordflow">if</span>(poolCount &gt; 0)</div>
+<div class="line"><a name="l17455"></a><span class="lineno">17455</span>&#160;        {</div>
+<div class="line"><a name="l17456"></a><span class="lineno">17456</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Pools&quot;</span>);</div>
+<div class="line"><a name="l17457"></a><span class="lineno">17457</span>&#160;            json.BeginObject();</div>
+<div class="line"><a name="l17458"></a><span class="lineno">17458</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> poolIndex = 0; poolIndex &lt; poolCount; ++poolIndex)</div>
+<div class="line"><a name="l17459"></a><span class="lineno">17459</span>&#160;            {</div>
+<div class="line"><a name="l17460"></a><span class="lineno">17460</span>&#160;                json.BeginString();</div>
+<div class="line"><a name="l17461"></a><span class="lineno">17461</span>&#160;                json.ContinueString(m_Pools[poolIndex]-&gt;GetId());</div>
+<div class="line"><a name="l17462"></a><span class="lineno">17462</span>&#160;                json.EndString();</div>
+<div class="line"><a name="l17463"></a><span class="lineno">17463</span>&#160; </div>
+<div class="line"><a name="l17464"></a><span class="lineno">17464</span>&#160;                m_Pools[poolIndex]-&gt;m_BlockVector.PrintDetailedMap(json);</div>
+<div class="line"><a name="l17465"></a><span class="lineno">17465</span>&#160;            }</div>
+<div class="line"><a name="l17466"></a><span class="lineno">17466</span>&#160;            json.EndObject();</div>
 <div class="line"><a name="l17467"></a><span class="lineno">17467</span>&#160;        }</div>
-<div class="line"><a name="l17468"></a><span class="lineno">17468</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l17469"></a><span class="lineno">17469</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a>:</div>
-<div class="line"><a name="l17470"></a><span class="lineno">17470</span>&#160;        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;</div>
-<div class="line"><a name="l17471"></a><span class="lineno">17471</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l17472"></a><span class="lineno">17472</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67">VMA_MEMORY_USAGE_CPU_TO_GPU</a>:</div>
-<div class="line"><a name="l17473"></a><span class="lineno">17473</span>&#160;        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;</div>
-<div class="line"><a name="l17474"></a><span class="lineno">17474</span>&#160;        <span class="keywordflow">if</span>(!allocator-&gt;IsIntegratedGpu() || (preferredFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)</div>
-<div class="line"><a name="l17475"></a><span class="lineno">17475</span>&#160;        {</div>
-<div class="line"><a name="l17476"></a><span class="lineno">17476</span>&#160;            preferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;</div>
-<div class="line"><a name="l17477"></a><span class="lineno">17477</span>&#160;        }</div>
-<div class="line"><a name="l17478"></a><span class="lineno">17478</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l17479"></a><span class="lineno">17479</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27">VMA_MEMORY_USAGE_GPU_TO_CPU</a>:</div>
-<div class="line"><a name="l17480"></a><span class="lineno">17480</span>&#160;        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;</div>
-<div class="line"><a name="l17481"></a><span class="lineno">17481</span>&#160;        preferredFlags |= VK_MEMORY_PROPERTY_HOST_CACHED_BIT;</div>
-<div class="line"><a name="l17482"></a><span class="lineno">17482</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l17483"></a><span class="lineno">17483</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500">VMA_MEMORY_USAGE_CPU_COPY</a>:</div>
-<div class="line"><a name="l17484"></a><span class="lineno">17484</span>&#160;        notPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;</div>
-<div class="line"><a name="l17485"></a><span class="lineno">17485</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l17486"></a><span class="lineno">17486</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d">VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED</a>:</div>
-<div class="line"><a name="l17487"></a><span class="lineno">17487</span>&#160;        requiredFlags |= VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT;</div>
-<div class="line"><a name="l17488"></a><span class="lineno">17488</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l17489"></a><span class="lineno">17489</span>&#160;    <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l17490"></a><span class="lineno">17490</span>&#160;        VMA_ASSERT(0);</div>
-<div class="line"><a name="l17491"></a><span class="lineno">17491</span>&#160;        <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l17492"></a><span class="lineno">17492</span>&#160;    }</div>
-<div class="line"><a name="l17493"></a><span class="lineno">17493</span>&#160; </div>
-<div class="line"><a name="l17494"></a><span class="lineno">17494</span>&#160;    <span class="comment">// Avoid DEVICE_COHERENT unless explicitly requested.</span></div>
-<div class="line"><a name="l17495"></a><span class="lineno">17495</span>&#160;    <span class="keywordflow">if</span>(((pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a> | pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>) &amp;</div>
-<div class="line"><a name="l17496"></a><span class="lineno">17496</span>&#160;        (VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY | VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY)) == 0)</div>
-<div class="line"><a name="l17497"></a><span class="lineno">17497</span>&#160;    {</div>
-<div class="line"><a name="l17498"></a><span class="lineno">17498</span>&#160;        notPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY;</div>
-<div class="line"><a name="l17499"></a><span class="lineno">17499</span>&#160;    }</div>
-<div class="line"><a name="l17500"></a><span class="lineno">17500</span>&#160; </div>
-<div class="line"><a name="l17501"></a><span class="lineno">17501</span>&#160;    *pMemoryTypeIndex = UINT32_MAX;</div>
-<div class="line"><a name="l17502"></a><span class="lineno">17502</span>&#160;    uint32_t minCost = UINT32_MAX;</div>
-<div class="line"><a name="l17503"></a><span class="lineno">17503</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0, memTypeBit = 1;</div>
-<div class="line"><a name="l17504"></a><span class="lineno">17504</span>&#160;        memTypeIndex &lt; allocator-&gt;GetMemoryTypeCount();</div>
-<div class="line"><a name="l17505"></a><span class="lineno">17505</span>&#160;        ++memTypeIndex, memTypeBit &lt;&lt;= 1)</div>
-<div class="line"><a name="l17506"></a><span class="lineno">17506</span>&#160;    {</div>
-<div class="line"><a name="l17507"></a><span class="lineno">17507</span>&#160;        <span class="comment">// This memory type is acceptable according to memoryTypeBits bitmask.</span></div>
-<div class="line"><a name="l17508"></a><span class="lineno">17508</span>&#160;        <span class="keywordflow">if</span>((memTypeBit &amp; memoryTypeBits) != 0)</div>
-<div class="line"><a name="l17509"></a><span class="lineno">17509</span>&#160;        {</div>
-<div class="line"><a name="l17510"></a><span class="lineno">17510</span>&#160;            <span class="keyword">const</span> VkMemoryPropertyFlags currFlags =</div>
-<div class="line"><a name="l17511"></a><span class="lineno">17511</span>&#160;                allocator-&gt;m_MemProps.memoryTypes[memTypeIndex].propertyFlags;</div>
-<div class="line"><a name="l17512"></a><span class="lineno">17512</span>&#160;            <span class="comment">// This memory type contains requiredFlags.</span></div>
-<div class="line"><a name="l17513"></a><span class="lineno">17513</span>&#160;            <span class="keywordflow">if</span>((requiredFlags &amp; ~currFlags) == 0)</div>
-<div class="line"><a name="l17514"></a><span class="lineno">17514</span>&#160;            {</div>
-<div class="line"><a name="l17515"></a><span class="lineno">17515</span>&#160;                <span class="comment">// Calculate cost as number of bits from preferredFlags not present in this memory type.</span></div>
-<div class="line"><a name="l17516"></a><span class="lineno">17516</span>&#160;                uint32_t currCost = VmaCountBitsSet(preferredFlags &amp; ~currFlags) +</div>
-<div class="line"><a name="l17517"></a><span class="lineno">17517</span>&#160;                    VmaCountBitsSet(currFlags &amp; notPreferredFlags);</div>
-<div class="line"><a name="l17518"></a><span class="lineno">17518</span>&#160;                <span class="comment">// Remember memory type with lowest cost.</span></div>
-<div class="line"><a name="l17519"></a><span class="lineno">17519</span>&#160;                <span class="keywordflow">if</span>(currCost &lt; minCost)</div>
-<div class="line"><a name="l17520"></a><span class="lineno">17520</span>&#160;                {</div>
-<div class="line"><a name="l17521"></a><span class="lineno">17521</span>&#160;                    *pMemoryTypeIndex = memTypeIndex;</div>
-<div class="line"><a name="l17522"></a><span class="lineno">17522</span>&#160;                    <span class="keywordflow">if</span>(currCost == 0)</div>
-<div class="line"><a name="l17523"></a><span class="lineno">17523</span>&#160;                    {</div>
-<div class="line"><a name="l17524"></a><span class="lineno">17524</span>&#160;                        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l17525"></a><span class="lineno">17525</span>&#160;                    }</div>
-<div class="line"><a name="l17526"></a><span class="lineno">17526</span>&#160;                    minCost = currCost;</div>
-<div class="line"><a name="l17527"></a><span class="lineno">17527</span>&#160;                }</div>
-<div class="line"><a name="l17528"></a><span class="lineno">17528</span>&#160;            }</div>
-<div class="line"><a name="l17529"></a><span class="lineno">17529</span>&#160;        }</div>
-<div class="line"><a name="l17530"></a><span class="lineno">17530</span>&#160;    }</div>
-<div class="line"><a name="l17531"></a><span class="lineno">17531</span>&#160;    <span class="keywordflow">return</span> (*pMemoryTypeIndex != UINT32_MAX) ? VK_SUCCESS : VK_ERROR_FEATURE_NOT_PRESENT;</div>
-<div class="line"><a name="l17532"></a><span class="lineno">17532</span>&#160;}</div>
-<div class="line"><a name="l17533"></a><span class="lineno">17533</span>&#160; </div>
-<div class="line"><a name="l17534"></a><span class="lineno">17534</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888">vmaFindMemoryTypeIndexForBufferInfo</a>(</div>
-<div class="line"><a name="l17535"></a><span class="lineno">17535</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17536"></a><span class="lineno">17536</span>&#160;    <span class="keyword">const</span> VkBufferCreateInfo* pBufferCreateInfo,</div>
-<div class="line"><a name="l17537"></a><span class="lineno">17537</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
-<div class="line"><a name="l17538"></a><span class="lineno">17538</span>&#160;    uint32_t* pMemoryTypeIndex)</div>
-<div class="line"><a name="l17539"></a><span class="lineno">17539</span>&#160;{</div>
-<div class="line"><a name="l17540"></a><span class="lineno">17540</span>&#160;    VMA_ASSERT(allocator != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l17541"></a><span class="lineno">17541</span>&#160;    VMA_ASSERT(pBufferCreateInfo != VMA_NULL);</div>
-<div class="line"><a name="l17542"></a><span class="lineno">17542</span>&#160;    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);</div>
-<div class="line"><a name="l17543"></a><span class="lineno">17543</span>&#160;    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);</div>
+<div class="line"><a name="l17468"></a><span class="lineno">17468</span>&#160;    }</div>
+<div class="line"><a name="l17469"></a><span class="lineno">17469</span>&#160;}</div>
+<div class="line"><a name="l17470"></a><span class="lineno">17470</span>&#160; </div>
+<div class="line"><a name="l17471"></a><span class="lineno">17471</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l17472"></a><span class="lineno">17472</span>&#160; </div>
+<div class="line"><a name="l17474"></a><span class="lineno">17474</span>&#160;<span class="comment">// Public interface</span></div>
+<div class="line"><a name="l17475"></a><span class="lineno">17475</span>&#160; </div>
+<div class="line"><a name="l17476"></a><span class="lineno">17476</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb">vmaCreateAllocator</a>(</div>
+<div class="line"><a name="l17477"></a><span class="lineno">17477</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo,</div>
+<div class="line"><a name="l17478"></a><span class="lineno">17478</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a>* pAllocator)</div>
+<div class="line"><a name="l17479"></a><span class="lineno">17479</span>&#160;{</div>
+<div class="line"><a name="l17480"></a><span class="lineno">17480</span>&#160;    VMA_ASSERT(pCreateInfo &amp;&amp; pAllocator);</div>
+<div class="line"><a name="l17481"></a><span class="lineno">17481</span>&#160;    VMA_ASSERT(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">vulkanApiVersion</a> == 0 ||</div>
+<div class="line"><a name="l17482"></a><span class="lineno">17482</span>&#160;        (VK_VERSION_MAJOR(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">vulkanApiVersion</a>) == 1 &amp;&amp; VK_VERSION_MINOR(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">vulkanApiVersion</a>) &lt;= 2));</div>
+<div class="line"><a name="l17483"></a><span class="lineno">17483</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCreateAllocator&quot;</span>);</div>
+<div class="line"><a name="l17484"></a><span class="lineno">17484</span>&#160;    *pAllocator = vma_new(pCreateInfo-&gt;<a class="code" href="struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d">pAllocationCallbacks</a>, VmaAllocator_T)(pCreateInfo);</div>
+<div class="line"><a name="l17485"></a><span class="lineno">17485</span>&#160;    <span class="keywordflow">return</span> (*pAllocator)-&gt;Init(pCreateInfo);</div>
+<div class="line"><a name="l17486"></a><span class="lineno">17486</span>&#160;}</div>
+<div class="line"><a name="l17487"></a><span class="lineno">17487</span>&#160; </div>
+<div class="line"><a name="l17488"></a><span class="lineno">17488</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa8d164061c88f22fb1fd3c8f3534bc1d">vmaDestroyAllocator</a>(</div>
+<div class="line"><a name="l17489"></a><span class="lineno">17489</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator)</div>
+<div class="line"><a name="l17490"></a><span class="lineno">17490</span>&#160;{</div>
+<div class="line"><a name="l17491"></a><span class="lineno">17491</span>&#160;    <span class="keywordflow">if</span>(allocator != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l17492"></a><span class="lineno">17492</span>&#160;    {</div>
+<div class="line"><a name="l17493"></a><span class="lineno">17493</span>&#160;        VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDestroyAllocator&quot;</span>);</div>
+<div class="line"><a name="l17494"></a><span class="lineno">17494</span>&#160;        VkAllocationCallbacks allocationCallbacks = allocator-&gt;m_AllocationCallbacks;</div>
+<div class="line"><a name="l17495"></a><span class="lineno">17495</span>&#160;        vma_delete(&amp;allocationCallbacks, allocator);</div>
+<div class="line"><a name="l17496"></a><span class="lineno">17496</span>&#160;    }</div>
+<div class="line"><a name="l17497"></a><span class="lineno">17497</span>&#160;}</div>
+<div class="line"><a name="l17498"></a><span class="lineno">17498</span>&#160; </div>
+<div class="line"><a name="l17499"></a><span class="lineno">17499</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7">vmaGetAllocatorInfo</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="code" href="struct_vma_allocator_info.html">VmaAllocatorInfo</a>* pAllocatorInfo)</div>
+<div class="line"><a name="l17500"></a><span class="lineno">17500</span>&#160;{</div>
+<div class="line"><a name="l17501"></a><span class="lineno">17501</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pAllocatorInfo);</div>
+<div class="line"><a name="l17502"></a><span class="lineno">17502</span>&#160;    pAllocatorInfo-&gt;<a class="code" href="struct_vma_allocator_info.html#a2ed6a4d2d3fea039d66a13f15d0ce5fe">instance</a> = allocator-&gt;m_hInstance;</div>
+<div class="line"><a name="l17503"></a><span class="lineno">17503</span>&#160;    pAllocatorInfo-&gt;<a class="code" href="struct_vma_allocator_info.html#aba2b703f96e51d567717e1fb2935b47a">physicalDevice</a> = allocator-&gt;GetPhysicalDevice();</div>
+<div class="line"><a name="l17504"></a><span class="lineno">17504</span>&#160;    pAllocatorInfo-&gt;<a class="code" href="struct_vma_allocator_info.html#a012b4c485bf3b0ea8921352c5ee0c357">device</a> = allocator-&gt;m_hDevice;</div>
+<div class="line"><a name="l17505"></a><span class="lineno">17505</span>&#160;}</div>
+<div class="line"><a name="l17506"></a><span class="lineno">17506</span>&#160; </div>
+<div class="line"><a name="l17507"></a><span class="lineno">17507</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0">vmaGetPhysicalDeviceProperties</a>(</div>
+<div class="line"><a name="l17508"></a><span class="lineno">17508</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17509"></a><span class="lineno">17509</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceProperties **ppPhysicalDeviceProperties)</div>
+<div class="line"><a name="l17510"></a><span class="lineno">17510</span>&#160;{</div>
+<div class="line"><a name="l17511"></a><span class="lineno">17511</span>&#160;    VMA_ASSERT(allocator &amp;&amp; ppPhysicalDeviceProperties);</div>
+<div class="line"><a name="l17512"></a><span class="lineno">17512</span>&#160;    *ppPhysicalDeviceProperties = &amp;allocator-&gt;m_PhysicalDeviceProperties;</div>
+<div class="line"><a name="l17513"></a><span class="lineno">17513</span>&#160;}</div>
+<div class="line"><a name="l17514"></a><span class="lineno">17514</span>&#160; </div>
+<div class="line"><a name="l17515"></a><span class="lineno">17515</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19">vmaGetMemoryProperties</a>(</div>
+<div class="line"><a name="l17516"></a><span class="lineno">17516</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17517"></a><span class="lineno">17517</span>&#160;    <span class="keyword">const</span> VkPhysicalDeviceMemoryProperties** ppPhysicalDeviceMemoryProperties)</div>
+<div class="line"><a name="l17518"></a><span class="lineno">17518</span>&#160;{</div>
+<div class="line"><a name="l17519"></a><span class="lineno">17519</span>&#160;    VMA_ASSERT(allocator &amp;&amp; ppPhysicalDeviceMemoryProperties);</div>
+<div class="line"><a name="l17520"></a><span class="lineno">17520</span>&#160;    *ppPhysicalDeviceMemoryProperties = &amp;allocator-&gt;m_MemProps;</div>
+<div class="line"><a name="l17521"></a><span class="lineno">17521</span>&#160;}</div>
+<div class="line"><a name="l17522"></a><span class="lineno">17522</span>&#160; </div>
+<div class="line"><a name="l17523"></a><span class="lineno">17523</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca">vmaGetMemoryTypeProperties</a>(</div>
+<div class="line"><a name="l17524"></a><span class="lineno">17524</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17525"></a><span class="lineno">17525</span>&#160;    uint32_t memoryTypeIndex,</div>
+<div class="line"><a name="l17526"></a><span class="lineno">17526</span>&#160;    VkMemoryPropertyFlags* pFlags)</div>
+<div class="line"><a name="l17527"></a><span class="lineno">17527</span>&#160;{</div>
+<div class="line"><a name="l17528"></a><span class="lineno">17528</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pFlags);</div>
+<div class="line"><a name="l17529"></a><span class="lineno">17529</span>&#160;    VMA_ASSERT(memoryTypeIndex &lt; allocator-&gt;GetMemoryTypeCount());</div>
+<div class="line"><a name="l17530"></a><span class="lineno">17530</span>&#160;    *pFlags = allocator-&gt;m_MemProps.memoryTypes[memoryTypeIndex].propertyFlags;</div>
+<div class="line"><a name="l17531"></a><span class="lineno">17531</span>&#160;}</div>
+<div class="line"><a name="l17532"></a><span class="lineno">17532</span>&#160; </div>
+<div class="line"><a name="l17533"></a><span class="lineno">17533</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236">vmaSetCurrentFrameIndex</a>(</div>
+<div class="line"><a name="l17534"></a><span class="lineno">17534</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17535"></a><span class="lineno">17535</span>&#160;    uint32_t frameIndex)</div>
+<div class="line"><a name="l17536"></a><span class="lineno">17536</span>&#160;{</div>
+<div class="line"><a name="l17537"></a><span class="lineno">17537</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l17538"></a><span class="lineno">17538</span>&#160;    VMA_ASSERT(frameIndex != VMA_FRAME_INDEX_LOST);</div>
+<div class="line"><a name="l17539"></a><span class="lineno">17539</span>&#160; </div>
+<div class="line"><a name="l17540"></a><span class="lineno">17540</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l17541"></a><span class="lineno">17541</span>&#160; </div>
+<div class="line"><a name="l17542"></a><span class="lineno">17542</span>&#160;    allocator-&gt;SetCurrentFrameIndex(frameIndex);</div>
+<div class="line"><a name="l17543"></a><span class="lineno">17543</span>&#160;}</div>
 <div class="line"><a name="l17544"></a><span class="lineno">17544</span>&#160; </div>
-<div class="line"><a name="l17545"></a><span class="lineno">17545</span>&#160;    <span class="keyword">const</span> VkDevice hDev = allocator-&gt;m_hDevice;</div>
-<div class="line"><a name="l17546"></a><span class="lineno">17546</span>&#160;    VkBuffer hBuffer = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l17547"></a><span class="lineno">17547</span>&#160;    VkResult res = allocator-&gt;GetVulkanFunctions().vkCreateBuffer(</div>
-<div class="line"><a name="l17548"></a><span class="lineno">17548</span>&#160;        hDev, pBufferCreateInfo, allocator-&gt;GetAllocationCallbacks(), &amp;hBuffer);</div>
-<div class="line"><a name="l17549"></a><span class="lineno">17549</span>&#160;    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l17550"></a><span class="lineno">17550</span>&#160;    {</div>
-<div class="line"><a name="l17551"></a><span class="lineno">17551</span>&#160;        VkMemoryRequirements memReq = {};</div>
-<div class="line"><a name="l17552"></a><span class="lineno">17552</span>&#160;        allocator-&gt;GetVulkanFunctions().vkGetBufferMemoryRequirements(</div>
-<div class="line"><a name="l17553"></a><span class="lineno">17553</span>&#160;            hDev, hBuffer, &amp;memReq);</div>
-<div class="line"><a name="l17554"></a><span class="lineno">17554</span>&#160; </div>
-<div class="line"><a name="l17555"></a><span class="lineno">17555</span>&#160;        res = <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(</div>
-<div class="line"><a name="l17556"></a><span class="lineno">17556</span>&#160;            allocator,</div>
-<div class="line"><a name="l17557"></a><span class="lineno">17557</span>&#160;            memReq.memoryTypeBits,</div>
-<div class="line"><a name="l17558"></a><span class="lineno">17558</span>&#160;            pAllocationCreateInfo,</div>
-<div class="line"><a name="l17559"></a><span class="lineno">17559</span>&#160;            pMemoryTypeIndex);</div>
-<div class="line"><a name="l17560"></a><span class="lineno">17560</span>&#160; </div>
-<div class="line"><a name="l17561"></a><span class="lineno">17561</span>&#160;        allocator-&gt;GetVulkanFunctions().vkDestroyBuffer(</div>
-<div class="line"><a name="l17562"></a><span class="lineno">17562</span>&#160;            hDev, hBuffer, allocator-&gt;GetAllocationCallbacks());</div>
-<div class="line"><a name="l17563"></a><span class="lineno">17563</span>&#160;    }</div>
-<div class="line"><a name="l17564"></a><span class="lineno">17564</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l17565"></a><span class="lineno">17565</span>&#160;}</div>
-<div class="line"><a name="l17566"></a><span class="lineno">17566</span>&#160; </div>
-<div class="line"><a name="l17567"></a><span class="lineno">17567</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472">vmaFindMemoryTypeIndexForImageInfo</a>(</div>
-<div class="line"><a name="l17568"></a><span class="lineno">17568</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17569"></a><span class="lineno">17569</span>&#160;    <span class="keyword">const</span> VkImageCreateInfo* pImageCreateInfo,</div>
-<div class="line"><a name="l17570"></a><span class="lineno">17570</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
-<div class="line"><a name="l17571"></a><span class="lineno">17571</span>&#160;    uint32_t* pMemoryTypeIndex)</div>
-<div class="line"><a name="l17572"></a><span class="lineno">17572</span>&#160;{</div>
-<div class="line"><a name="l17573"></a><span class="lineno">17573</span>&#160;    VMA_ASSERT(allocator != VK_NULL_HANDLE);</div>
-<div class="line"><a name="l17574"></a><span class="lineno">17574</span>&#160;    VMA_ASSERT(pImageCreateInfo != VMA_NULL);</div>
-<div class="line"><a name="l17575"></a><span class="lineno">17575</span>&#160;    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);</div>
-<div class="line"><a name="l17576"></a><span class="lineno">17576</span>&#160;    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);</div>
+<div class="line"><a name="l17545"></a><span class="lineno">17545</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3">vmaCalculateStats</a>(</div>
+<div class="line"><a name="l17546"></a><span class="lineno">17546</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17547"></a><span class="lineno">17547</span>&#160;    <a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats)</div>
+<div class="line"><a name="l17548"></a><span class="lineno">17548</span>&#160;{</div>
+<div class="line"><a name="l17549"></a><span class="lineno">17549</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pStats);</div>
+<div class="line"><a name="l17550"></a><span class="lineno">17550</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l17551"></a><span class="lineno">17551</span>&#160;    allocator-&gt;CalculateStats(pStats);</div>
+<div class="line"><a name="l17552"></a><span class="lineno">17552</span>&#160;}</div>
+<div class="line"><a name="l17553"></a><span class="lineno">17553</span>&#160; </div>
+<div class="line"><a name="l17554"></a><span class="lineno">17554</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba">vmaGetBudget</a>(</div>
+<div class="line"><a name="l17555"></a><span class="lineno">17555</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17556"></a><span class="lineno">17556</span>&#160;    <a class="code" href="struct_vma_budget.html">VmaBudget</a>* pBudget)</div>
+<div class="line"><a name="l17557"></a><span class="lineno">17557</span>&#160;{</div>
+<div class="line"><a name="l17558"></a><span class="lineno">17558</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pBudget);</div>
+<div class="line"><a name="l17559"></a><span class="lineno">17559</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l17560"></a><span class="lineno">17560</span>&#160;    allocator-&gt;GetBudget(pBudget, 0, allocator-&gt;GetMemoryHeapCount());</div>
+<div class="line"><a name="l17561"></a><span class="lineno">17561</span>&#160;}</div>
+<div class="line"><a name="l17562"></a><span class="lineno">17562</span>&#160; </div>
+<div class="line"><a name="l17563"></a><span class="lineno">17563</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l17564"></a><span class="lineno">17564</span>&#160; </div>
+<div class="line"><a name="l17565"></a><span class="lineno">17565</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0">vmaBuildStatsString</a>(</div>
+<div class="line"><a name="l17566"></a><span class="lineno">17566</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17567"></a><span class="lineno">17567</span>&#160;    <span class="keywordtype">char</span>** ppStatsString,</div>
+<div class="line"><a name="l17568"></a><span class="lineno">17568</span>&#160;    VkBool32 detailedMap)</div>
+<div class="line"><a name="l17569"></a><span class="lineno">17569</span>&#160;{</div>
+<div class="line"><a name="l17570"></a><span class="lineno">17570</span>&#160;    VMA_ASSERT(allocator &amp;&amp; ppStatsString);</div>
+<div class="line"><a name="l17571"></a><span class="lineno">17571</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l17572"></a><span class="lineno">17572</span>&#160; </div>
+<div class="line"><a name="l17573"></a><span class="lineno">17573</span>&#160;    VmaStringBuilder sb(allocator);</div>
+<div class="line"><a name="l17574"></a><span class="lineno">17574</span>&#160;    {</div>
+<div class="line"><a name="l17575"></a><span class="lineno">17575</span>&#160;        VmaJsonWriter json(allocator-&gt;GetAllocationCallbacks(), sb);</div>
+<div class="line"><a name="l17576"></a><span class="lineno">17576</span>&#160;        json.BeginObject();</div>
 <div class="line"><a name="l17577"></a><span class="lineno">17577</span>&#160; </div>
-<div class="line"><a name="l17578"></a><span class="lineno">17578</span>&#160;    <span class="keyword">const</span> VkDevice hDev = allocator-&gt;m_hDevice;</div>
-<div class="line"><a name="l17579"></a><span class="lineno">17579</span>&#160;    VkImage hImage = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l17580"></a><span class="lineno">17580</span>&#160;    VkResult res = allocator-&gt;GetVulkanFunctions().vkCreateImage(</div>
-<div class="line"><a name="l17581"></a><span class="lineno">17581</span>&#160;        hDev, pImageCreateInfo, allocator-&gt;GetAllocationCallbacks(), &amp;hImage);</div>
-<div class="line"><a name="l17582"></a><span class="lineno">17582</span>&#160;    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
-<div class="line"><a name="l17583"></a><span class="lineno">17583</span>&#160;    {</div>
-<div class="line"><a name="l17584"></a><span class="lineno">17584</span>&#160;        VkMemoryRequirements memReq = {};</div>
-<div class="line"><a name="l17585"></a><span class="lineno">17585</span>&#160;        allocator-&gt;GetVulkanFunctions().vkGetImageMemoryRequirements(</div>
-<div class="line"><a name="l17586"></a><span class="lineno">17586</span>&#160;            hDev, hImage, &amp;memReq);</div>
-<div class="line"><a name="l17587"></a><span class="lineno">17587</span>&#160; </div>
-<div class="line"><a name="l17588"></a><span class="lineno">17588</span>&#160;        res = <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(</div>
-<div class="line"><a name="l17589"></a><span class="lineno">17589</span>&#160;            allocator,</div>
-<div class="line"><a name="l17590"></a><span class="lineno">17590</span>&#160;            memReq.memoryTypeBits,</div>
-<div class="line"><a name="l17591"></a><span class="lineno">17591</span>&#160;            pAllocationCreateInfo,</div>
-<div class="line"><a name="l17592"></a><span class="lineno">17592</span>&#160;            pMemoryTypeIndex);</div>
+<div class="line"><a name="l17578"></a><span class="lineno">17578</span>&#160;        <a class="code" href="struct_vma_budget.html">VmaBudget</a> budget[VK_MAX_MEMORY_HEAPS];</div>
+<div class="line"><a name="l17579"></a><span class="lineno">17579</span>&#160;        allocator-&gt;GetBudget(budget, 0, allocator-&gt;GetMemoryHeapCount());</div>
+<div class="line"><a name="l17580"></a><span class="lineno">17580</span>&#160; </div>
+<div class="line"><a name="l17581"></a><span class="lineno">17581</span>&#160;        <a class="code" href="struct_vma_stats.html">VmaStats</a> stats;</div>
+<div class="line"><a name="l17582"></a><span class="lineno">17582</span>&#160;        allocator-&gt;CalculateStats(&amp;stats);</div>
+<div class="line"><a name="l17583"></a><span class="lineno">17583</span>&#160; </div>
+<div class="line"><a name="l17584"></a><span class="lineno">17584</span>&#160;        json.WriteString(<span class="stringliteral">&quot;Total&quot;</span>);</div>
+<div class="line"><a name="l17585"></a><span class="lineno">17585</span>&#160;        VmaPrintStatInfo(json, stats.<a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>);</div>
+<div class="line"><a name="l17586"></a><span class="lineno">17586</span>&#160;    </div>
+<div class="line"><a name="l17587"></a><span class="lineno">17587</span>&#160;        <span class="keywordflow">for</span>(uint32_t heapIndex = 0; heapIndex &lt; allocator-&gt;GetMemoryHeapCount(); ++heapIndex)</div>
+<div class="line"><a name="l17588"></a><span class="lineno">17588</span>&#160;        {</div>
+<div class="line"><a name="l17589"></a><span class="lineno">17589</span>&#160;            json.BeginString(<span class="stringliteral">&quot;Heap &quot;</span>);</div>
+<div class="line"><a name="l17590"></a><span class="lineno">17590</span>&#160;            json.ContinueString(heapIndex);</div>
+<div class="line"><a name="l17591"></a><span class="lineno">17591</span>&#160;            json.EndString();</div>
+<div class="line"><a name="l17592"></a><span class="lineno">17592</span>&#160;            json.BeginObject();</div>
 <div class="line"><a name="l17593"></a><span class="lineno">17593</span>&#160; </div>
-<div class="line"><a name="l17594"></a><span class="lineno">17594</span>&#160;        allocator-&gt;GetVulkanFunctions().vkDestroyImage(</div>
-<div class="line"><a name="l17595"></a><span class="lineno">17595</span>&#160;            hDev, hImage, allocator-&gt;GetAllocationCallbacks());</div>
-<div class="line"><a name="l17596"></a><span class="lineno">17596</span>&#160;    }</div>
-<div class="line"><a name="l17597"></a><span class="lineno">17597</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l17598"></a><span class="lineno">17598</span>&#160;}</div>
-<div class="line"><a name="l17599"></a><span class="lineno">17599</span>&#160; </div>
-<div class="line"><a name="l17600"></a><span class="lineno">17600</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5c8770ded7c59c8caac6de0c2cb00b50">vmaCreatePool</a>(</div>
-<div class="line"><a name="l17601"></a><span class="lineno">17601</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17602"></a><span class="lineno">17602</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>* pCreateInfo,</div>
-<div class="line"><a name="l17603"></a><span class="lineno">17603</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPool)</div>
-<div class="line"><a name="l17604"></a><span class="lineno">17604</span>&#160;{</div>
-<div class="line"><a name="l17605"></a><span class="lineno">17605</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pCreateInfo &amp;&amp; pPool);</div>
-<div class="line"><a name="l17606"></a><span class="lineno">17606</span>&#160;    </div>
-<div class="line"><a name="l17607"></a><span class="lineno">17607</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCreatePool&quot;</span>);</div>
-<div class="line"><a name="l17608"></a><span class="lineno">17608</span>&#160;    </div>
-<div class="line"><a name="l17609"></a><span class="lineno">17609</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17610"></a><span class="lineno">17610</span>&#160;    </div>
-<div class="line"><a name="l17611"></a><span class="lineno">17611</span>&#160;    VkResult res = allocator-&gt;CreatePool(pCreateInfo, pPool);</div>
-<div class="line"><a name="l17612"></a><span class="lineno">17612</span>&#160;    </div>
-<div class="line"><a name="l17613"></a><span class="lineno">17613</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l17614"></a><span class="lineno">17614</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l17615"></a><span class="lineno">17615</span>&#160;    {</div>
-<div class="line"><a name="l17616"></a><span class="lineno">17616</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordCreatePool(allocator-&gt;GetCurrentFrameIndex(), *pCreateInfo, *pPool);</div>
-<div class="line"><a name="l17617"></a><span class="lineno">17617</span>&#160;    }</div>
-<div class="line"><a name="l17618"></a><span class="lineno">17618</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l17619"></a><span class="lineno">17619</span>&#160;    </div>
-<div class="line"><a name="l17620"></a><span class="lineno">17620</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l17621"></a><span class="lineno">17621</span>&#160;}</div>
-<div class="line"><a name="l17622"></a><span class="lineno">17622</span>&#160; </div>
-<div class="line"><a name="l17623"></a><span class="lineno">17623</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5485779c8f1948238fc4e92232fa65e1">vmaDestroyPool</a>(</div>
-<div class="line"><a name="l17624"></a><span class="lineno">17624</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17625"></a><span class="lineno">17625</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
-<div class="line"><a name="l17626"></a><span class="lineno">17626</span>&#160;{</div>
-<div class="line"><a name="l17627"></a><span class="lineno">17627</span>&#160;    VMA_ASSERT(allocator);</div>
-<div class="line"><a name="l17628"></a><span class="lineno">17628</span>&#160;    </div>
-<div class="line"><a name="l17629"></a><span class="lineno">17629</span>&#160;    <span class="keywordflow">if</span>(pool == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l17630"></a><span class="lineno">17630</span>&#160;    {</div>
-<div class="line"><a name="l17631"></a><span class="lineno">17631</span>&#160;        <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l17632"></a><span class="lineno">17632</span>&#160;    }</div>
-<div class="line"><a name="l17633"></a><span class="lineno">17633</span>&#160;    </div>
-<div class="line"><a name="l17634"></a><span class="lineno">17634</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDestroyPool&quot;</span>);</div>
-<div class="line"><a name="l17635"></a><span class="lineno">17635</span>&#160;    </div>
-<div class="line"><a name="l17636"></a><span class="lineno">17636</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17637"></a><span class="lineno">17637</span>&#160;    </div>
-<div class="line"><a name="l17638"></a><span class="lineno">17638</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l17639"></a><span class="lineno">17639</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l17640"></a><span class="lineno">17640</span>&#160;    {</div>
-<div class="line"><a name="l17641"></a><span class="lineno">17641</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordDestroyPool(allocator-&gt;GetCurrentFrameIndex(), pool);</div>
-<div class="line"><a name="l17642"></a><span class="lineno">17642</span>&#160;    }</div>
-<div class="line"><a name="l17643"></a><span class="lineno">17643</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l17644"></a><span class="lineno">17644</span>&#160; </div>
-<div class="line"><a name="l17645"></a><span class="lineno">17645</span>&#160;    allocator-&gt;DestroyPool(pool);</div>
-<div class="line"><a name="l17646"></a><span class="lineno">17646</span>&#160;}</div>
-<div class="line"><a name="l17647"></a><span class="lineno">17647</span>&#160; </div>
-<div class="line"><a name="l17648"></a><span class="lineno">17648</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153">vmaGetPoolStats</a>(</div>
-<div class="line"><a name="l17649"></a><span class="lineno">17649</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17650"></a><span class="lineno">17650</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
-<div class="line"><a name="l17651"></a><span class="lineno">17651</span>&#160;    <a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pPoolStats)</div>
-<div class="line"><a name="l17652"></a><span class="lineno">17652</span>&#160;{</div>
-<div class="line"><a name="l17653"></a><span class="lineno">17653</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pool &amp;&amp; pPoolStats);</div>
-<div class="line"><a name="l17654"></a><span class="lineno">17654</span>&#160; </div>
-<div class="line"><a name="l17655"></a><span class="lineno">17655</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17656"></a><span class="lineno">17656</span>&#160; </div>
-<div class="line"><a name="l17657"></a><span class="lineno">17657</span>&#160;    allocator-&gt;GetPoolStats(pool, pPoolStats);</div>
-<div class="line"><a name="l17658"></a><span class="lineno">17658</span>&#160;}</div>
-<div class="line"><a name="l17659"></a><span class="lineno">17659</span>&#160; </div>
-<div class="line"><a name="l17660"></a><span class="lineno">17660</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024">vmaMakePoolAllocationsLost</a>(</div>
-<div class="line"><a name="l17661"></a><span class="lineno">17661</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17662"></a><span class="lineno">17662</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
-<div class="line"><a name="l17663"></a><span class="lineno">17663</span>&#160;    <span class="keywordtype">size_t</span>* pLostAllocationCount)</div>
-<div class="line"><a name="l17664"></a><span class="lineno">17664</span>&#160;{</div>
-<div class="line"><a name="l17665"></a><span class="lineno">17665</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pool);</div>
-<div class="line"><a name="l17666"></a><span class="lineno">17666</span>&#160; </div>
-<div class="line"><a name="l17667"></a><span class="lineno">17667</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17668"></a><span class="lineno">17668</span>&#160; </div>
-<div class="line"><a name="l17669"></a><span class="lineno">17669</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l17670"></a><span class="lineno">17670</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l17671"></a><span class="lineno">17671</span>&#160;    {</div>
-<div class="line"><a name="l17672"></a><span class="lineno">17672</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordMakePoolAllocationsLost(allocator-&gt;GetCurrentFrameIndex(), pool);</div>
-<div class="line"><a name="l17673"></a><span class="lineno">17673</span>&#160;    }</div>
-<div class="line"><a name="l17674"></a><span class="lineno">17674</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l17675"></a><span class="lineno">17675</span>&#160; </div>
-<div class="line"><a name="l17676"></a><span class="lineno">17676</span>&#160;    allocator-&gt;MakePoolAllocationsLost(pool, pLostAllocationCount);</div>
-<div class="line"><a name="l17677"></a><span class="lineno">17677</span>&#160;}</div>
-<div class="line"><a name="l17678"></a><span class="lineno">17678</span>&#160; </div>
-<div class="line"><a name="l17679"></a><span class="lineno">17679</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad535935619c7a549bf837e1bb0068f89">vmaCheckPoolCorruption</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
-<div class="line"><a name="l17680"></a><span class="lineno">17680</span>&#160;{</div>
-<div class="line"><a name="l17681"></a><span class="lineno">17681</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pool);</div>
-<div class="line"><a name="l17682"></a><span class="lineno">17682</span>&#160; </div>
-<div class="line"><a name="l17683"></a><span class="lineno">17683</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17684"></a><span class="lineno">17684</span>&#160; </div>
-<div class="line"><a name="l17685"></a><span class="lineno">17685</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCheckPoolCorruption&quot;</span>);</div>
-<div class="line"><a name="l17686"></a><span class="lineno">17686</span>&#160; </div>
-<div class="line"><a name="l17687"></a><span class="lineno">17687</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;CheckPoolCorruption(pool);</div>
-<div class="line"><a name="l17688"></a><span class="lineno">17688</span>&#160;}</div>
-<div class="line"><a name="l17689"></a><span class="lineno">17689</span>&#160; </div>
-<div class="line"><a name="l17690"></a><span class="lineno">17690</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030">vmaGetPoolName</a>(</div>
-<div class="line"><a name="l17691"></a><span class="lineno">17691</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17692"></a><span class="lineno">17692</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
-<div class="line"><a name="l17693"></a><span class="lineno">17693</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>** ppName)</div>
-<div class="line"><a name="l17694"></a><span class="lineno">17694</span>&#160;{</div>
-<div class="line"><a name="l17695"></a><span class="lineno">17695</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pool &amp;&amp; ppName);</div>
-<div class="line"><a name="l17696"></a><span class="lineno">17696</span>&#160;    </div>
-<div class="line"><a name="l17697"></a><span class="lineno">17697</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaGetPoolName&quot;</span>);</div>
-<div class="line"><a name="l17698"></a><span class="lineno">17698</span>&#160; </div>
-<div class="line"><a name="l17699"></a><span class="lineno">17699</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17700"></a><span class="lineno">17700</span>&#160; </div>
-<div class="line"><a name="l17701"></a><span class="lineno">17701</span>&#160;    *ppName = pool-&gt;GetName();</div>
-<div class="line"><a name="l17702"></a><span class="lineno">17702</span>&#160;}</div>
-<div class="line"><a name="l17703"></a><span class="lineno">17703</span>&#160; </div>
-<div class="line"><a name="l17704"></a><span class="lineno">17704</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58">vmaSetPoolName</a>(</div>
-<div class="line"><a name="l17705"></a><span class="lineno">17705</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17706"></a><span class="lineno">17706</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
-<div class="line"><a name="l17707"></a><span class="lineno">17707</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* pName)</div>
-<div class="line"><a name="l17708"></a><span class="lineno">17708</span>&#160;{</div>
-<div class="line"><a name="l17709"></a><span class="lineno">17709</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pool);</div>
-<div class="line"><a name="l17710"></a><span class="lineno">17710</span>&#160; </div>
-<div class="line"><a name="l17711"></a><span class="lineno">17711</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaSetPoolName&quot;</span>);</div>
-<div class="line"><a name="l17712"></a><span class="lineno">17712</span>&#160; </div>
-<div class="line"><a name="l17713"></a><span class="lineno">17713</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17714"></a><span class="lineno">17714</span>&#160; </div>
-<div class="line"><a name="l17715"></a><span class="lineno">17715</span>&#160;    pool-&gt;SetName(pName);</div>
-<div class="line"><a name="l17716"></a><span class="lineno">17716</span>&#160; </div>
-<div class="line"><a name="l17717"></a><span class="lineno">17717</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l17718"></a><span class="lineno">17718</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l17719"></a><span class="lineno">17719</span>&#160;    {</div>
-<div class="line"><a name="l17720"></a><span class="lineno">17720</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordSetPoolName(allocator-&gt;GetCurrentFrameIndex(), pool, pName);</div>
-<div class="line"><a name="l17721"></a><span class="lineno">17721</span>&#160;    }</div>
-<div class="line"><a name="l17722"></a><span class="lineno">17722</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l17723"></a><span class="lineno">17723</span>&#160;}</div>
-<div class="line"><a name="l17724"></a><span class="lineno">17724</span>&#160; </div>
-<div class="line"><a name="l17725"></a><span class="lineno">17725</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8">vmaAllocateMemory</a>(</div>
-<div class="line"><a name="l17726"></a><span class="lineno">17726</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17727"></a><span class="lineno">17727</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements* pVkMemoryRequirements,</div>
-<div class="line"><a name="l17728"></a><span class="lineno">17728</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
-<div class="line"><a name="l17729"></a><span class="lineno">17729</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
-<div class="line"><a name="l17730"></a><span class="lineno">17730</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
-<div class="line"><a name="l17731"></a><span class="lineno">17731</span>&#160;{</div>
-<div class="line"><a name="l17732"></a><span class="lineno">17732</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pVkMemoryRequirements &amp;&amp; pCreateInfo &amp;&amp; pAllocation);</div>
-<div class="line"><a name="l17733"></a><span class="lineno">17733</span>&#160; </div>
-<div class="line"><a name="l17734"></a><span class="lineno">17734</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaAllocateMemory&quot;</span>);</div>
-<div class="line"><a name="l17735"></a><span class="lineno">17735</span>&#160; </div>
-<div class="line"><a name="l17736"></a><span class="lineno">17736</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17737"></a><span class="lineno">17737</span>&#160; </div>
-<div class="line"><a name="l17738"></a><span class="lineno">17738</span>&#160;    VkResult result = allocator-&gt;AllocateMemory(</div>
-<div class="line"><a name="l17739"></a><span class="lineno">17739</span>&#160;        *pVkMemoryRequirements,</div>
-<div class="line"><a name="l17740"></a><span class="lineno">17740</span>&#160;        <span class="keyword">false</span>, <span class="comment">// requiresDedicatedAllocation</span></div>
-<div class="line"><a name="l17741"></a><span class="lineno">17741</span>&#160;        <span class="keyword">false</span>, <span class="comment">// prefersDedicatedAllocation</span></div>
-<div class="line"><a name="l17742"></a><span class="lineno">17742</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedBuffer</span></div>
-<div class="line"><a name="l17743"></a><span class="lineno">17743</span>&#160;        UINT32_MAX, <span class="comment">// dedicatedBufferUsage</span></div>
-<div class="line"><a name="l17744"></a><span class="lineno">17744</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedImage</span></div>
-<div class="line"><a name="l17745"></a><span class="lineno">17745</span>&#160;        *pCreateInfo,</div>
-<div class="line"><a name="l17746"></a><span class="lineno">17746</span>&#160;        VMA_SUBALLOCATION_TYPE_UNKNOWN,</div>
-<div class="line"><a name="l17747"></a><span class="lineno">17747</span>&#160;        1, <span class="comment">// allocationCount</span></div>
-<div class="line"><a name="l17748"></a><span class="lineno">17748</span>&#160;        pAllocation);</div>
-<div class="line"><a name="l17749"></a><span class="lineno">17749</span>&#160; </div>
-<div class="line"><a name="l17750"></a><span class="lineno">17750</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l17751"></a><span class="lineno">17751</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l17752"></a><span class="lineno">17752</span>&#160;    {</div>
-<div class="line"><a name="l17753"></a><span class="lineno">17753</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordAllocateMemory(</div>
-<div class="line"><a name="l17754"></a><span class="lineno">17754</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l17755"></a><span class="lineno">17755</span>&#160;            *pVkMemoryRequirements,</div>
-<div class="line"><a name="l17756"></a><span class="lineno">17756</span>&#160;            *pCreateInfo,</div>
-<div class="line"><a name="l17757"></a><span class="lineno">17757</span>&#160;            *pAllocation);</div>
-<div class="line"><a name="l17758"></a><span class="lineno">17758</span>&#160;    }</div>
-<div class="line"><a name="l17759"></a><span class="lineno">17759</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l17760"></a><span class="lineno">17760</span>&#160;        </div>
-<div class="line"><a name="l17761"></a><span class="lineno">17761</span>&#160;    <span class="keywordflow">if</span>(pAllocationInfo != VMA_NULL &amp;&amp; result == VK_SUCCESS)</div>
-<div class="line"><a name="l17762"></a><span class="lineno">17762</span>&#160;    {</div>
-<div class="line"><a name="l17763"></a><span class="lineno">17763</span>&#160;        allocator-&gt;GetAllocationInfo(*pAllocation, pAllocationInfo);</div>
-<div class="line"><a name="l17764"></a><span class="lineno">17764</span>&#160;    }</div>
-<div class="line"><a name="l17765"></a><span class="lineno">17765</span>&#160; </div>
-<div class="line"><a name="l17766"></a><span class="lineno">17766</span>&#160;    <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l17767"></a><span class="lineno">17767</span>&#160;}</div>
-<div class="line"><a name="l17768"></a><span class="lineno">17768</span>&#160; </div>
-<div class="line"><a name="l17769"></a><span class="lineno">17769</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad37e82e492b3de38fc3f4cffd9ad0ae1">vmaAllocateMemoryPages</a>(</div>
-<div class="line"><a name="l17770"></a><span class="lineno">17770</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17771"></a><span class="lineno">17771</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements* pVkMemoryRequirements,</div>
-<div class="line"><a name="l17772"></a><span class="lineno">17772</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
-<div class="line"><a name="l17773"></a><span class="lineno">17773</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l17774"></a><span class="lineno">17774</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations,</div>
-<div class="line"><a name="l17775"></a><span class="lineno">17775</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
-<div class="line"><a name="l17776"></a><span class="lineno">17776</span>&#160;{</div>
-<div class="line"><a name="l17777"></a><span class="lineno">17777</span>&#160;    <span class="keywordflow">if</span>(allocationCount == 0)</div>
-<div class="line"><a name="l17778"></a><span class="lineno">17778</span>&#160;    {</div>
-<div class="line"><a name="l17779"></a><span class="lineno">17779</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l17780"></a><span class="lineno">17780</span>&#160;    }</div>
-<div class="line"><a name="l17781"></a><span class="lineno">17781</span>&#160; </div>
-<div class="line"><a name="l17782"></a><span class="lineno">17782</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pVkMemoryRequirements &amp;&amp; pCreateInfo &amp;&amp; pAllocations);</div>
-<div class="line"><a name="l17783"></a><span class="lineno">17783</span>&#160; </div>
-<div class="line"><a name="l17784"></a><span class="lineno">17784</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaAllocateMemoryPages&quot;</span>);</div>
-<div class="line"><a name="l17785"></a><span class="lineno">17785</span>&#160; </div>
-<div class="line"><a name="l17786"></a><span class="lineno">17786</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17787"></a><span class="lineno">17787</span>&#160; </div>
-<div class="line"><a name="l17788"></a><span class="lineno">17788</span>&#160;    VkResult result = allocator-&gt;AllocateMemory(</div>
-<div class="line"><a name="l17789"></a><span class="lineno">17789</span>&#160;        *pVkMemoryRequirements,</div>
-<div class="line"><a name="l17790"></a><span class="lineno">17790</span>&#160;        <span class="keyword">false</span>, <span class="comment">// requiresDedicatedAllocation</span></div>
-<div class="line"><a name="l17791"></a><span class="lineno">17791</span>&#160;        <span class="keyword">false</span>, <span class="comment">// prefersDedicatedAllocation</span></div>
-<div class="line"><a name="l17792"></a><span class="lineno">17792</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedBuffer</span></div>
-<div class="line"><a name="l17793"></a><span class="lineno">17793</span>&#160;        UINT32_MAX, <span class="comment">// dedicatedBufferUsage</span></div>
-<div class="line"><a name="l17794"></a><span class="lineno">17794</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedImage</span></div>
-<div class="line"><a name="l17795"></a><span class="lineno">17795</span>&#160;        *pCreateInfo,</div>
-<div class="line"><a name="l17796"></a><span class="lineno">17796</span>&#160;        VMA_SUBALLOCATION_TYPE_UNKNOWN,</div>
-<div class="line"><a name="l17797"></a><span class="lineno">17797</span>&#160;        allocationCount,</div>
-<div class="line"><a name="l17798"></a><span class="lineno">17798</span>&#160;        pAllocations);</div>
-<div class="line"><a name="l17799"></a><span class="lineno">17799</span>&#160; </div>
-<div class="line"><a name="l17800"></a><span class="lineno">17800</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l17801"></a><span class="lineno">17801</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l17802"></a><span class="lineno">17802</span>&#160;    {</div>
-<div class="line"><a name="l17803"></a><span class="lineno">17803</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordAllocateMemoryPages(</div>
-<div class="line"><a name="l17804"></a><span class="lineno">17804</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l17805"></a><span class="lineno">17805</span>&#160;            *pVkMemoryRequirements,</div>
-<div class="line"><a name="l17806"></a><span class="lineno">17806</span>&#160;            *pCreateInfo,</div>
-<div class="line"><a name="l17807"></a><span class="lineno">17807</span>&#160;            (uint64_t)allocationCount,</div>
-<div class="line"><a name="l17808"></a><span class="lineno">17808</span>&#160;            pAllocations);</div>
-<div class="line"><a name="l17809"></a><span class="lineno">17809</span>&#160;    }</div>
-<div class="line"><a name="l17810"></a><span class="lineno">17810</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l17811"></a><span class="lineno">17811</span>&#160;        </div>
-<div class="line"><a name="l17812"></a><span class="lineno">17812</span>&#160;    <span class="keywordflow">if</span>(pAllocationInfo != VMA_NULL &amp;&amp; result == VK_SUCCESS)</div>
-<div class="line"><a name="l17813"></a><span class="lineno">17813</span>&#160;    {</div>
-<div class="line"><a name="l17814"></a><span class="lineno">17814</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; allocationCount; ++i)</div>
-<div class="line"><a name="l17815"></a><span class="lineno">17815</span>&#160;        {</div>
-<div class="line"><a name="l17816"></a><span class="lineno">17816</span>&#160;            allocator-&gt;GetAllocationInfo(pAllocations[i], pAllocationInfo + i);</div>
-<div class="line"><a name="l17817"></a><span class="lineno">17817</span>&#160;        }</div>
-<div class="line"><a name="l17818"></a><span class="lineno">17818</span>&#160;    }</div>
-<div class="line"><a name="l17819"></a><span class="lineno">17819</span>&#160; </div>
-<div class="line"><a name="l17820"></a><span class="lineno">17820</span>&#160;    <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l17821"></a><span class="lineno">17821</span>&#160;}</div>
-<div class="line"><a name="l17822"></a><span class="lineno">17822</span>&#160; </div>
-<div class="line"><a name="l17823"></a><span class="lineno">17823</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer</a>(</div>
-<div class="line"><a name="l17824"></a><span class="lineno">17824</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17825"></a><span class="lineno">17825</span>&#160;    VkBuffer buffer,</div>
-<div class="line"><a name="l17826"></a><span class="lineno">17826</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
-<div class="line"><a name="l17827"></a><span class="lineno">17827</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
-<div class="line"><a name="l17828"></a><span class="lineno">17828</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
-<div class="line"><a name="l17829"></a><span class="lineno">17829</span>&#160;{</div>
-<div class="line"><a name="l17830"></a><span class="lineno">17830</span>&#160;    VMA_ASSERT(allocator &amp;&amp; buffer != VK_NULL_HANDLE &amp;&amp; pCreateInfo &amp;&amp; pAllocation);</div>
-<div class="line"><a name="l17831"></a><span class="lineno">17831</span>&#160; </div>
-<div class="line"><a name="l17832"></a><span class="lineno">17832</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaAllocateMemoryForBuffer&quot;</span>);</div>
-<div class="line"><a name="l17833"></a><span class="lineno">17833</span>&#160; </div>
-<div class="line"><a name="l17834"></a><span class="lineno">17834</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17835"></a><span class="lineno">17835</span>&#160; </div>
-<div class="line"><a name="l17836"></a><span class="lineno">17836</span>&#160;    VkMemoryRequirements vkMemReq = {};</div>
-<div class="line"><a name="l17837"></a><span class="lineno">17837</span>&#160;    <span class="keywordtype">bool</span> requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l17838"></a><span class="lineno">17838</span>&#160;    <span class="keywordtype">bool</span> prefersDedicatedAllocation = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l17839"></a><span class="lineno">17839</span>&#160;    allocator-&gt;GetBufferMemoryRequirements(buffer, vkMemReq,</div>
-<div class="line"><a name="l17840"></a><span class="lineno">17840</span>&#160;        requiresDedicatedAllocation,</div>
-<div class="line"><a name="l17841"></a><span class="lineno">17841</span>&#160;        prefersDedicatedAllocation);</div>
+<div class="line"><a name="l17594"></a><span class="lineno">17594</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Size&quot;</span>);</div>
+<div class="line"><a name="l17595"></a><span class="lineno">17595</span>&#160;            json.WriteNumber(allocator-&gt;m_MemProps.memoryHeaps[heapIndex].size);</div>
+<div class="line"><a name="l17596"></a><span class="lineno">17596</span>&#160; </div>
+<div class="line"><a name="l17597"></a><span class="lineno">17597</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Flags&quot;</span>);</div>
+<div class="line"><a name="l17598"></a><span class="lineno">17598</span>&#160;            json.BeginArray(<span class="keyword">true</span>);</div>
+<div class="line"><a name="l17599"></a><span class="lineno">17599</span>&#160;            <span class="keywordflow">if</span>((allocator-&gt;m_MemProps.memoryHeaps[heapIndex].flags &amp; VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) != 0)</div>
+<div class="line"><a name="l17600"></a><span class="lineno">17600</span>&#160;            {</div>
+<div class="line"><a name="l17601"></a><span class="lineno">17601</span>&#160;                json.WriteString(<span class="stringliteral">&quot;DEVICE_LOCAL&quot;</span>);</div>
+<div class="line"><a name="l17602"></a><span class="lineno">17602</span>&#160;            }</div>
+<div class="line"><a name="l17603"></a><span class="lineno">17603</span>&#160;            json.EndArray();</div>
+<div class="line"><a name="l17604"></a><span class="lineno">17604</span>&#160; </div>
+<div class="line"><a name="l17605"></a><span class="lineno">17605</span>&#160;            json.WriteString(<span class="stringliteral">&quot;Budget&quot;</span>);</div>
+<div class="line"><a name="l17606"></a><span class="lineno">17606</span>&#160;            json.BeginObject();</div>
+<div class="line"><a name="l17607"></a><span class="lineno">17607</span>&#160;            {</div>
+<div class="line"><a name="l17608"></a><span class="lineno">17608</span>&#160;                json.WriteString(<span class="stringliteral">&quot;BlockBytes&quot;</span>);</div>
+<div class="line"><a name="l17609"></a><span class="lineno">17609</span>&#160;                json.WriteNumber(budget[heapIndex].blockBytes);</div>
+<div class="line"><a name="l17610"></a><span class="lineno">17610</span>&#160;                json.WriteString(<span class="stringliteral">&quot;AllocationBytes&quot;</span>);</div>
+<div class="line"><a name="l17611"></a><span class="lineno">17611</span>&#160;                json.WriteNumber(budget[heapIndex].allocationBytes);</div>
+<div class="line"><a name="l17612"></a><span class="lineno">17612</span>&#160;                json.WriteString(<span class="stringliteral">&quot;Usage&quot;</span>);</div>
+<div class="line"><a name="l17613"></a><span class="lineno">17613</span>&#160;                json.WriteNumber(budget[heapIndex].usage);</div>
+<div class="line"><a name="l17614"></a><span class="lineno">17614</span>&#160;                json.WriteString(<span class="stringliteral">&quot;Budget&quot;</span>);</div>
+<div class="line"><a name="l17615"></a><span class="lineno">17615</span>&#160;                json.WriteNumber(budget[heapIndex].budget);</div>
+<div class="line"><a name="l17616"></a><span class="lineno">17616</span>&#160;            }</div>
+<div class="line"><a name="l17617"></a><span class="lineno">17617</span>&#160;            json.EndObject();</div>
+<div class="line"><a name="l17618"></a><span class="lineno">17618</span>&#160; </div>
+<div class="line"><a name="l17619"></a><span class="lineno">17619</span>&#160;            <span class="keywordflow">if</span>(stats.<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[heapIndex].<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> &gt; 0)</div>
+<div class="line"><a name="l17620"></a><span class="lineno">17620</span>&#160;            {</div>
+<div class="line"><a name="l17621"></a><span class="lineno">17621</span>&#160;                json.WriteString(<span class="stringliteral">&quot;Stats&quot;</span>);</div>
+<div class="line"><a name="l17622"></a><span class="lineno">17622</span>&#160;                VmaPrintStatInfo(json, stats.<a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[heapIndex]);</div>
+<div class="line"><a name="l17623"></a><span class="lineno">17623</span>&#160;            }</div>
+<div class="line"><a name="l17624"></a><span class="lineno">17624</span>&#160; </div>
+<div class="line"><a name="l17625"></a><span class="lineno">17625</span>&#160;            <span class="keywordflow">for</span>(uint32_t typeIndex = 0; typeIndex &lt; allocator-&gt;GetMemoryTypeCount(); ++typeIndex)</div>
+<div class="line"><a name="l17626"></a><span class="lineno">17626</span>&#160;            {</div>
+<div class="line"><a name="l17627"></a><span class="lineno">17627</span>&#160;                <span class="keywordflow">if</span>(allocator-&gt;MemoryTypeIndexToHeapIndex(typeIndex) == heapIndex)</div>
+<div class="line"><a name="l17628"></a><span class="lineno">17628</span>&#160;                {</div>
+<div class="line"><a name="l17629"></a><span class="lineno">17629</span>&#160;                    json.BeginString(<span class="stringliteral">&quot;Type &quot;</span>);</div>
+<div class="line"><a name="l17630"></a><span class="lineno">17630</span>&#160;                    json.ContinueString(typeIndex);</div>
+<div class="line"><a name="l17631"></a><span class="lineno">17631</span>&#160;                    json.EndString();</div>
+<div class="line"><a name="l17632"></a><span class="lineno">17632</span>&#160; </div>
+<div class="line"><a name="l17633"></a><span class="lineno">17633</span>&#160;                    json.BeginObject();</div>
+<div class="line"><a name="l17634"></a><span class="lineno">17634</span>&#160; </div>
+<div class="line"><a name="l17635"></a><span class="lineno">17635</span>&#160;                    json.WriteString(<span class="stringliteral">&quot;Flags&quot;</span>);</div>
+<div class="line"><a name="l17636"></a><span class="lineno">17636</span>&#160;                    json.BeginArray(<span class="keyword">true</span>);</div>
+<div class="line"><a name="l17637"></a><span class="lineno">17637</span>&#160;                    VkMemoryPropertyFlags flags = allocator-&gt;m_MemProps.memoryTypes[typeIndex].propertyFlags;</div>
+<div class="line"><a name="l17638"></a><span class="lineno">17638</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0)</div>
+<div class="line"><a name="l17639"></a><span class="lineno">17639</span>&#160;                    {</div>
+<div class="line"><a name="l17640"></a><span class="lineno">17640</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;DEVICE_LOCAL&quot;</span>);</div>
+<div class="line"><a name="l17641"></a><span class="lineno">17641</span>&#160;                    }</div>
+<div class="line"><a name="l17642"></a><span class="lineno">17642</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)</div>
+<div class="line"><a name="l17643"></a><span class="lineno">17643</span>&#160;                    {</div>
+<div class="line"><a name="l17644"></a><span class="lineno">17644</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;HOST_VISIBLE&quot;</span>);</div>
+<div class="line"><a name="l17645"></a><span class="lineno">17645</span>&#160;                    }</div>
+<div class="line"><a name="l17646"></a><span class="lineno">17646</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) != 0)</div>
+<div class="line"><a name="l17647"></a><span class="lineno">17647</span>&#160;                    {</div>
+<div class="line"><a name="l17648"></a><span class="lineno">17648</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;HOST_COHERENT&quot;</span>);</div>
+<div class="line"><a name="l17649"></a><span class="lineno">17649</span>&#160;                    }</div>
+<div class="line"><a name="l17650"></a><span class="lineno">17650</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_HOST_CACHED_BIT) != 0)</div>
+<div class="line"><a name="l17651"></a><span class="lineno">17651</span>&#160;                    {</div>
+<div class="line"><a name="l17652"></a><span class="lineno">17652</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;HOST_CACHED&quot;</span>);</div>
+<div class="line"><a name="l17653"></a><span class="lineno">17653</span>&#160;                    }</div>
+<div class="line"><a name="l17654"></a><span class="lineno">17654</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) != 0)</div>
+<div class="line"><a name="l17655"></a><span class="lineno">17655</span>&#160;                    {</div>
+<div class="line"><a name="l17656"></a><span class="lineno">17656</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;LAZILY_ALLOCATED&quot;</span>);</div>
+<div class="line"><a name="l17657"></a><span class="lineno">17657</span>&#160;                    }</div>
+<div class="line"><a name="l17658"></a><span class="lineno">17658</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_PROTECTED_BIT) != 0)</div>
+<div class="line"><a name="l17659"></a><span class="lineno">17659</span>&#160;                    {</div>
+<div class="line"><a name="l17660"></a><span class="lineno">17660</span>&#160;                        json.WriteString(<span class="stringliteral">&quot; PROTECTED&quot;</span>);</div>
+<div class="line"><a name="l17661"></a><span class="lineno">17661</span>&#160;                    }</div>
+<div class="line"><a name="l17662"></a><span class="lineno">17662</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY) != 0)</div>
+<div class="line"><a name="l17663"></a><span class="lineno">17663</span>&#160;                    {</div>
+<div class="line"><a name="l17664"></a><span class="lineno">17664</span>&#160;                        json.WriteString(<span class="stringliteral">&quot; DEVICE_COHERENT&quot;</span>);</div>
+<div class="line"><a name="l17665"></a><span class="lineno">17665</span>&#160;                    }</div>
+<div class="line"><a name="l17666"></a><span class="lineno">17666</span>&#160;                    <span class="keywordflow">if</span>((flags &amp; VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY) != 0)</div>
+<div class="line"><a name="l17667"></a><span class="lineno">17667</span>&#160;                    {</div>
+<div class="line"><a name="l17668"></a><span class="lineno">17668</span>&#160;                        json.WriteString(<span class="stringliteral">&quot; DEVICE_UNCACHED&quot;</span>);</div>
+<div class="line"><a name="l17669"></a><span class="lineno">17669</span>&#160;                    }</div>
+<div class="line"><a name="l17670"></a><span class="lineno">17670</span>&#160;                    json.EndArray();</div>
+<div class="line"><a name="l17671"></a><span class="lineno">17671</span>&#160; </div>
+<div class="line"><a name="l17672"></a><span class="lineno">17672</span>&#160;                    <span class="keywordflow">if</span>(stats.<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[typeIndex].<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> &gt; 0)</div>
+<div class="line"><a name="l17673"></a><span class="lineno">17673</span>&#160;                    {</div>
+<div class="line"><a name="l17674"></a><span class="lineno">17674</span>&#160;                        json.WriteString(<span class="stringliteral">&quot;Stats&quot;</span>);</div>
+<div class="line"><a name="l17675"></a><span class="lineno">17675</span>&#160;                        VmaPrintStatInfo(json, stats.<a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[typeIndex]);</div>
+<div class="line"><a name="l17676"></a><span class="lineno">17676</span>&#160;                    }</div>
+<div class="line"><a name="l17677"></a><span class="lineno">17677</span>&#160; </div>
+<div class="line"><a name="l17678"></a><span class="lineno">17678</span>&#160;                    json.EndObject();</div>
+<div class="line"><a name="l17679"></a><span class="lineno">17679</span>&#160;                }</div>
+<div class="line"><a name="l17680"></a><span class="lineno">17680</span>&#160;            }</div>
+<div class="line"><a name="l17681"></a><span class="lineno">17681</span>&#160; </div>
+<div class="line"><a name="l17682"></a><span class="lineno">17682</span>&#160;            json.EndObject();</div>
+<div class="line"><a name="l17683"></a><span class="lineno">17683</span>&#160;        }</div>
+<div class="line"><a name="l17684"></a><span class="lineno">17684</span>&#160;        <span class="keywordflow">if</span>(detailedMap == VK_TRUE)</div>
+<div class="line"><a name="l17685"></a><span class="lineno">17685</span>&#160;        {</div>
+<div class="line"><a name="l17686"></a><span class="lineno">17686</span>&#160;            allocator-&gt;PrintDetailedMap(json);</div>
+<div class="line"><a name="l17687"></a><span class="lineno">17687</span>&#160;        }</div>
+<div class="line"><a name="l17688"></a><span class="lineno">17688</span>&#160; </div>
+<div class="line"><a name="l17689"></a><span class="lineno">17689</span>&#160;        json.EndObject();</div>
+<div class="line"><a name="l17690"></a><span class="lineno">17690</span>&#160;    }</div>
+<div class="line"><a name="l17691"></a><span class="lineno">17691</span>&#160; </div>
+<div class="line"><a name="l17692"></a><span class="lineno">17692</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">size_t</span> len = sb.GetLength();</div>
+<div class="line"><a name="l17693"></a><span class="lineno">17693</span>&#160;    <span class="keywordtype">char</span>* <span class="keyword">const</span> pChars = vma_new_array(allocator, <span class="keywordtype">char</span>, len + 1);</div>
+<div class="line"><a name="l17694"></a><span class="lineno">17694</span>&#160;    <span class="keywordflow">if</span>(len &gt; 0)</div>
+<div class="line"><a name="l17695"></a><span class="lineno">17695</span>&#160;    {</div>
+<div class="line"><a name="l17696"></a><span class="lineno">17696</span>&#160;        memcpy(pChars, sb.GetData(), len);</div>
+<div class="line"><a name="l17697"></a><span class="lineno">17697</span>&#160;    }</div>
+<div class="line"><a name="l17698"></a><span class="lineno">17698</span>&#160;    pChars[len] = <span class="charliteral">&#39;\0&#39;</span>;</div>
+<div class="line"><a name="l17699"></a><span class="lineno">17699</span>&#160;    *ppStatsString = pChars;</div>
+<div class="line"><a name="l17700"></a><span class="lineno">17700</span>&#160;}</div>
+<div class="line"><a name="l17701"></a><span class="lineno">17701</span>&#160; </div>
+<div class="line"><a name="l17702"></a><span class="lineno">17702</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288">vmaFreeStatsString</a>(</div>
+<div class="line"><a name="l17703"></a><span class="lineno">17703</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17704"></a><span class="lineno">17704</span>&#160;    <span class="keywordtype">char</span>* pStatsString)</div>
+<div class="line"><a name="l17705"></a><span class="lineno">17705</span>&#160;{</div>
+<div class="line"><a name="l17706"></a><span class="lineno">17706</span>&#160;    <span class="keywordflow">if</span>(pStatsString != VMA_NULL)</div>
+<div class="line"><a name="l17707"></a><span class="lineno">17707</span>&#160;    {</div>
+<div class="line"><a name="l17708"></a><span class="lineno">17708</span>&#160;        VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l17709"></a><span class="lineno">17709</span>&#160;        <span class="keywordtype">size_t</span> len = strlen(pStatsString);</div>
+<div class="line"><a name="l17710"></a><span class="lineno">17710</span>&#160;        vma_delete_array(allocator, pStatsString, len + 1);</div>
+<div class="line"><a name="l17711"></a><span class="lineno">17711</span>&#160;    }</div>
+<div class="line"><a name="l17712"></a><span class="lineno">17712</span>&#160;}</div>
+<div class="line"><a name="l17713"></a><span class="lineno">17713</span>&#160; </div>
+<div class="line"><a name="l17714"></a><span class="lineno">17714</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l17715"></a><span class="lineno">17715</span>&#160; </div>
+<div class="line"><a name="l17716"></a><span class="lineno">17716</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l17717"></a><span class="lineno">17717</span>&#160;<span class="comment">This function is not protected by any mutex because it just reads immutable data.</span></div>
+<div class="line"><a name="l17718"></a><span class="lineno">17718</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l17719"></a><span class="lineno">17719</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(</div>
+<div class="line"><a name="l17720"></a><span class="lineno">17720</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17721"></a><span class="lineno">17721</span>&#160;    uint32_t memoryTypeBits,</div>
+<div class="line"><a name="l17722"></a><span class="lineno">17722</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
+<div class="line"><a name="l17723"></a><span class="lineno">17723</span>&#160;    uint32_t* pMemoryTypeIndex)</div>
+<div class="line"><a name="l17724"></a><span class="lineno">17724</span>&#160;{</div>
+<div class="line"><a name="l17725"></a><span class="lineno">17725</span>&#160;    VMA_ASSERT(allocator != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l17726"></a><span class="lineno">17726</span>&#160;    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);</div>
+<div class="line"><a name="l17727"></a><span class="lineno">17727</span>&#160;    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);</div>
+<div class="line"><a name="l17728"></a><span class="lineno">17728</span>&#160; </div>
+<div class="line"><a name="l17729"></a><span class="lineno">17729</span>&#160;    memoryTypeBits &amp;= allocator-&gt;GetGlobalMemoryTypeBits();</div>
+<div class="line"><a name="l17730"></a><span class="lineno">17730</span>&#160; </div>
+<div class="line"><a name="l17731"></a><span class="lineno">17731</span>&#160;    <span class="keywordflow">if</span>(pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a> != 0)</div>
+<div class="line"><a name="l17732"></a><span class="lineno">17732</span>&#160;    {</div>
+<div class="line"><a name="l17733"></a><span class="lineno">17733</span>&#160;        memoryTypeBits &amp;= pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>;</div>
+<div class="line"><a name="l17734"></a><span class="lineno">17734</span>&#160;    }</div>
+<div class="line"><a name="l17735"></a><span class="lineno">17735</span>&#160;    </div>
+<div class="line"><a name="l17736"></a><span class="lineno">17736</span>&#160;    uint32_t requiredFlags = pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>;</div>
+<div class="line"><a name="l17737"></a><span class="lineno">17737</span>&#160;    uint32_t preferredFlags = pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>;</div>
+<div class="line"><a name="l17738"></a><span class="lineno">17738</span>&#160;    uint32_t notPreferredFlags = 0;</div>
+<div class="line"><a name="l17739"></a><span class="lineno">17739</span>&#160; </div>
+<div class="line"><a name="l17740"></a><span class="lineno">17740</span>&#160;    <span class="comment">// Convert usage to requiredFlags and preferredFlags.</span></div>
+<div class="line"><a name="l17741"></a><span class="lineno">17741</span>&#160;    <span class="keywordflow">switch</span>(pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>)</div>
+<div class="line"><a name="l17742"></a><span class="lineno">17742</span>&#160;    {</div>
+<div class="line"><a name="l17743"></a><span class="lineno">17743</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd">VMA_MEMORY_USAGE_UNKNOWN</a>:</div>
+<div class="line"><a name="l17744"></a><span class="lineno">17744</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17745"></a><span class="lineno">17745</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a>:</div>
+<div class="line"><a name="l17746"></a><span class="lineno">17746</span>&#160;        <span class="keywordflow">if</span>(!allocator-&gt;IsIntegratedGpu() || (preferredFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)</div>
+<div class="line"><a name="l17747"></a><span class="lineno">17747</span>&#160;        {</div>
+<div class="line"><a name="l17748"></a><span class="lineno">17748</span>&#160;            preferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;</div>
+<div class="line"><a name="l17749"></a><span class="lineno">17749</span>&#160;        }</div>
+<div class="line"><a name="l17750"></a><span class="lineno">17750</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17751"></a><span class="lineno">17751</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a>:</div>
+<div class="line"><a name="l17752"></a><span class="lineno">17752</span>&#160;        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;</div>
+<div class="line"><a name="l17753"></a><span class="lineno">17753</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17754"></a><span class="lineno">17754</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67">VMA_MEMORY_USAGE_CPU_TO_GPU</a>:</div>
+<div class="line"><a name="l17755"></a><span class="lineno">17755</span>&#160;        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;</div>
+<div class="line"><a name="l17756"></a><span class="lineno">17756</span>&#160;        <span class="keywordflow">if</span>(!allocator-&gt;IsIntegratedGpu() || (preferredFlags &amp; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)</div>
+<div class="line"><a name="l17757"></a><span class="lineno">17757</span>&#160;        {</div>
+<div class="line"><a name="l17758"></a><span class="lineno">17758</span>&#160;            preferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;</div>
+<div class="line"><a name="l17759"></a><span class="lineno">17759</span>&#160;        }</div>
+<div class="line"><a name="l17760"></a><span class="lineno">17760</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17761"></a><span class="lineno">17761</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27">VMA_MEMORY_USAGE_GPU_TO_CPU</a>:</div>
+<div class="line"><a name="l17762"></a><span class="lineno">17762</span>&#160;        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;</div>
+<div class="line"><a name="l17763"></a><span class="lineno">17763</span>&#160;        preferredFlags |= VK_MEMORY_PROPERTY_HOST_CACHED_BIT;</div>
+<div class="line"><a name="l17764"></a><span class="lineno">17764</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17765"></a><span class="lineno">17765</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500">VMA_MEMORY_USAGE_CPU_COPY</a>:</div>
+<div class="line"><a name="l17766"></a><span class="lineno">17766</span>&#160;        notPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;</div>
+<div class="line"><a name="l17767"></a><span class="lineno">17767</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17768"></a><span class="lineno">17768</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d">VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED</a>:</div>
+<div class="line"><a name="l17769"></a><span class="lineno">17769</span>&#160;        requiredFlags |= VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT;</div>
+<div class="line"><a name="l17770"></a><span class="lineno">17770</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17771"></a><span class="lineno">17771</span>&#160;    <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l17772"></a><span class="lineno">17772</span>&#160;        VMA_ASSERT(0);</div>
+<div class="line"><a name="l17773"></a><span class="lineno">17773</span>&#160;        <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l17774"></a><span class="lineno">17774</span>&#160;    }</div>
+<div class="line"><a name="l17775"></a><span class="lineno">17775</span>&#160; </div>
+<div class="line"><a name="l17776"></a><span class="lineno">17776</span>&#160;    <span class="comment">// Avoid DEVICE_COHERENT unless explicitly requested.</span></div>
+<div class="line"><a name="l17777"></a><span class="lineno">17777</span>&#160;    <span class="keywordflow">if</span>(((pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a> | pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>) &amp;</div>
+<div class="line"><a name="l17778"></a><span class="lineno">17778</span>&#160;        (VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY | VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY)) == 0)</div>
+<div class="line"><a name="l17779"></a><span class="lineno">17779</span>&#160;    {</div>
+<div class="line"><a name="l17780"></a><span class="lineno">17780</span>&#160;        notPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY;</div>
+<div class="line"><a name="l17781"></a><span class="lineno">17781</span>&#160;    }</div>
+<div class="line"><a name="l17782"></a><span class="lineno">17782</span>&#160; </div>
+<div class="line"><a name="l17783"></a><span class="lineno">17783</span>&#160;    *pMemoryTypeIndex = UINT32_MAX;</div>
+<div class="line"><a name="l17784"></a><span class="lineno">17784</span>&#160;    uint32_t minCost = UINT32_MAX;</div>
+<div class="line"><a name="l17785"></a><span class="lineno">17785</span>&#160;    <span class="keywordflow">for</span>(uint32_t memTypeIndex = 0, memTypeBit = 1;</div>
+<div class="line"><a name="l17786"></a><span class="lineno">17786</span>&#160;        memTypeIndex &lt; allocator-&gt;GetMemoryTypeCount();</div>
+<div class="line"><a name="l17787"></a><span class="lineno">17787</span>&#160;        ++memTypeIndex, memTypeBit &lt;&lt;= 1)</div>
+<div class="line"><a name="l17788"></a><span class="lineno">17788</span>&#160;    {</div>
+<div class="line"><a name="l17789"></a><span class="lineno">17789</span>&#160;        <span class="comment">// This memory type is acceptable according to memoryTypeBits bitmask.</span></div>
+<div class="line"><a name="l17790"></a><span class="lineno">17790</span>&#160;        <span class="keywordflow">if</span>((memTypeBit &amp; memoryTypeBits) != 0)</div>
+<div class="line"><a name="l17791"></a><span class="lineno">17791</span>&#160;        {</div>
+<div class="line"><a name="l17792"></a><span class="lineno">17792</span>&#160;            <span class="keyword">const</span> VkMemoryPropertyFlags currFlags =</div>
+<div class="line"><a name="l17793"></a><span class="lineno">17793</span>&#160;                allocator-&gt;m_MemProps.memoryTypes[memTypeIndex].propertyFlags;</div>
+<div class="line"><a name="l17794"></a><span class="lineno">17794</span>&#160;            <span class="comment">// This memory type contains requiredFlags.</span></div>
+<div class="line"><a name="l17795"></a><span class="lineno">17795</span>&#160;            <span class="keywordflow">if</span>((requiredFlags &amp; ~currFlags) == 0)</div>
+<div class="line"><a name="l17796"></a><span class="lineno">17796</span>&#160;            {</div>
+<div class="line"><a name="l17797"></a><span class="lineno">17797</span>&#160;                <span class="comment">// Calculate cost as number of bits from preferredFlags not present in this memory type.</span></div>
+<div class="line"><a name="l17798"></a><span class="lineno">17798</span>&#160;                uint32_t currCost = VmaCountBitsSet(preferredFlags &amp; ~currFlags) +</div>
+<div class="line"><a name="l17799"></a><span class="lineno">17799</span>&#160;                    VmaCountBitsSet(currFlags &amp; notPreferredFlags);</div>
+<div class="line"><a name="l17800"></a><span class="lineno">17800</span>&#160;                <span class="comment">// Remember memory type with lowest cost.</span></div>
+<div class="line"><a name="l17801"></a><span class="lineno">17801</span>&#160;                <span class="keywordflow">if</span>(currCost &lt; minCost)</div>
+<div class="line"><a name="l17802"></a><span class="lineno">17802</span>&#160;                {</div>
+<div class="line"><a name="l17803"></a><span class="lineno">17803</span>&#160;                    *pMemoryTypeIndex = memTypeIndex;</div>
+<div class="line"><a name="l17804"></a><span class="lineno">17804</span>&#160;                    <span class="keywordflow">if</span>(currCost == 0)</div>
+<div class="line"><a name="l17805"></a><span class="lineno">17805</span>&#160;                    {</div>
+<div class="line"><a name="l17806"></a><span class="lineno">17806</span>&#160;                        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l17807"></a><span class="lineno">17807</span>&#160;                    }</div>
+<div class="line"><a name="l17808"></a><span class="lineno">17808</span>&#160;                    minCost = currCost;</div>
+<div class="line"><a name="l17809"></a><span class="lineno">17809</span>&#160;                }</div>
+<div class="line"><a name="l17810"></a><span class="lineno">17810</span>&#160;            }</div>
+<div class="line"><a name="l17811"></a><span class="lineno">17811</span>&#160;        }</div>
+<div class="line"><a name="l17812"></a><span class="lineno">17812</span>&#160;    }</div>
+<div class="line"><a name="l17813"></a><span class="lineno">17813</span>&#160;    <span class="keywordflow">return</span> (*pMemoryTypeIndex != UINT32_MAX) ? VK_SUCCESS : VK_ERROR_FEATURE_NOT_PRESENT;</div>
+<div class="line"><a name="l17814"></a><span class="lineno">17814</span>&#160;}</div>
+<div class="line"><a name="l17815"></a><span class="lineno">17815</span>&#160; </div>
+<div class="line"><a name="l17816"></a><span class="lineno">17816</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888">vmaFindMemoryTypeIndexForBufferInfo</a>(</div>
+<div class="line"><a name="l17817"></a><span class="lineno">17817</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17818"></a><span class="lineno">17818</span>&#160;    <span class="keyword">const</span> VkBufferCreateInfo* pBufferCreateInfo,</div>
+<div class="line"><a name="l17819"></a><span class="lineno">17819</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
+<div class="line"><a name="l17820"></a><span class="lineno">17820</span>&#160;    uint32_t* pMemoryTypeIndex)</div>
+<div class="line"><a name="l17821"></a><span class="lineno">17821</span>&#160;{</div>
+<div class="line"><a name="l17822"></a><span class="lineno">17822</span>&#160;    VMA_ASSERT(allocator != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l17823"></a><span class="lineno">17823</span>&#160;    VMA_ASSERT(pBufferCreateInfo != VMA_NULL);</div>
+<div class="line"><a name="l17824"></a><span class="lineno">17824</span>&#160;    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);</div>
+<div class="line"><a name="l17825"></a><span class="lineno">17825</span>&#160;    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);</div>
+<div class="line"><a name="l17826"></a><span class="lineno">17826</span>&#160; </div>
+<div class="line"><a name="l17827"></a><span class="lineno">17827</span>&#160;    <span class="keyword">const</span> VkDevice hDev = allocator-&gt;m_hDevice;</div>
+<div class="line"><a name="l17828"></a><span class="lineno">17828</span>&#160;    VkBuffer hBuffer = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l17829"></a><span class="lineno">17829</span>&#160;    VkResult res = allocator-&gt;GetVulkanFunctions().vkCreateBuffer(</div>
+<div class="line"><a name="l17830"></a><span class="lineno">17830</span>&#160;        hDev, pBufferCreateInfo, allocator-&gt;GetAllocationCallbacks(), &amp;hBuffer);</div>
+<div class="line"><a name="l17831"></a><span class="lineno">17831</span>&#160;    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l17832"></a><span class="lineno">17832</span>&#160;    {</div>
+<div class="line"><a name="l17833"></a><span class="lineno">17833</span>&#160;        VkMemoryRequirements memReq = {};</div>
+<div class="line"><a name="l17834"></a><span class="lineno">17834</span>&#160;        allocator-&gt;GetVulkanFunctions().vkGetBufferMemoryRequirements(</div>
+<div class="line"><a name="l17835"></a><span class="lineno">17835</span>&#160;            hDev, hBuffer, &amp;memReq);</div>
+<div class="line"><a name="l17836"></a><span class="lineno">17836</span>&#160; </div>
+<div class="line"><a name="l17837"></a><span class="lineno">17837</span>&#160;        res = <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(</div>
+<div class="line"><a name="l17838"></a><span class="lineno">17838</span>&#160;            allocator,</div>
+<div class="line"><a name="l17839"></a><span class="lineno">17839</span>&#160;            memReq.memoryTypeBits,</div>
+<div class="line"><a name="l17840"></a><span class="lineno">17840</span>&#160;            pAllocationCreateInfo,</div>
+<div class="line"><a name="l17841"></a><span class="lineno">17841</span>&#160;            pMemoryTypeIndex);</div>
 <div class="line"><a name="l17842"></a><span class="lineno">17842</span>&#160; </div>
-<div class="line"><a name="l17843"></a><span class="lineno">17843</span>&#160;    VkResult result = allocator-&gt;AllocateMemory(</div>
-<div class="line"><a name="l17844"></a><span class="lineno">17844</span>&#160;        vkMemReq,</div>
-<div class="line"><a name="l17845"></a><span class="lineno">17845</span>&#160;        requiresDedicatedAllocation,</div>
-<div class="line"><a name="l17846"></a><span class="lineno">17846</span>&#160;        prefersDedicatedAllocation,</div>
-<div class="line"><a name="l17847"></a><span class="lineno">17847</span>&#160;        buffer, <span class="comment">// dedicatedBuffer</span></div>
-<div class="line"><a name="l17848"></a><span class="lineno">17848</span>&#160;        UINT32_MAX, <span class="comment">// dedicatedBufferUsage</span></div>
-<div class="line"><a name="l17849"></a><span class="lineno">17849</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedImage</span></div>
-<div class="line"><a name="l17850"></a><span class="lineno">17850</span>&#160;        *pCreateInfo,</div>
-<div class="line"><a name="l17851"></a><span class="lineno">17851</span>&#160;        VMA_SUBALLOCATION_TYPE_BUFFER,</div>
-<div class="line"><a name="l17852"></a><span class="lineno">17852</span>&#160;        1, <span class="comment">// allocationCount</span></div>
-<div class="line"><a name="l17853"></a><span class="lineno">17853</span>&#160;        pAllocation);</div>
-<div class="line"><a name="l17854"></a><span class="lineno">17854</span>&#160; </div>
-<div class="line"><a name="l17855"></a><span class="lineno">17855</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l17856"></a><span class="lineno">17856</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l17857"></a><span class="lineno">17857</span>&#160;    {</div>
-<div class="line"><a name="l17858"></a><span class="lineno">17858</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordAllocateMemoryForBuffer(</div>
-<div class="line"><a name="l17859"></a><span class="lineno">17859</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l17860"></a><span class="lineno">17860</span>&#160;            vkMemReq,</div>
-<div class="line"><a name="l17861"></a><span class="lineno">17861</span>&#160;            requiresDedicatedAllocation,</div>
-<div class="line"><a name="l17862"></a><span class="lineno">17862</span>&#160;            prefersDedicatedAllocation,</div>
-<div class="line"><a name="l17863"></a><span class="lineno">17863</span>&#160;            *pCreateInfo,</div>
-<div class="line"><a name="l17864"></a><span class="lineno">17864</span>&#160;            *pAllocation);</div>
-<div class="line"><a name="l17865"></a><span class="lineno">17865</span>&#160;    }</div>
-<div class="line"><a name="l17866"></a><span class="lineno">17866</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l17867"></a><span class="lineno">17867</span>&#160; </div>
-<div class="line"><a name="l17868"></a><span class="lineno">17868</span>&#160;    <span class="keywordflow">if</span>(pAllocationInfo &amp;&amp; result == VK_SUCCESS)</div>
-<div class="line"><a name="l17869"></a><span class="lineno">17869</span>&#160;    {</div>
-<div class="line"><a name="l17870"></a><span class="lineno">17870</span>&#160;        allocator-&gt;GetAllocationInfo(*pAllocation, pAllocationInfo);</div>
-<div class="line"><a name="l17871"></a><span class="lineno">17871</span>&#160;    }</div>
-<div class="line"><a name="l17872"></a><span class="lineno">17872</span>&#160; </div>
-<div class="line"><a name="l17873"></a><span class="lineno">17873</span>&#160;    <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l17874"></a><span class="lineno">17874</span>&#160;}</div>
+<div class="line"><a name="l17843"></a><span class="lineno">17843</span>&#160;        allocator-&gt;GetVulkanFunctions().vkDestroyBuffer(</div>
+<div class="line"><a name="l17844"></a><span class="lineno">17844</span>&#160;            hDev, hBuffer, allocator-&gt;GetAllocationCallbacks());</div>
+<div class="line"><a name="l17845"></a><span class="lineno">17845</span>&#160;    }</div>
+<div class="line"><a name="l17846"></a><span class="lineno">17846</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l17847"></a><span class="lineno">17847</span>&#160;}</div>
+<div class="line"><a name="l17848"></a><span class="lineno">17848</span>&#160; </div>
+<div class="line"><a name="l17849"></a><span class="lineno">17849</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472">vmaFindMemoryTypeIndexForImageInfo</a>(</div>
+<div class="line"><a name="l17850"></a><span class="lineno">17850</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17851"></a><span class="lineno">17851</span>&#160;    <span class="keyword">const</span> VkImageCreateInfo* pImageCreateInfo,</div>
+<div class="line"><a name="l17852"></a><span class="lineno">17852</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
+<div class="line"><a name="l17853"></a><span class="lineno">17853</span>&#160;    uint32_t* pMemoryTypeIndex)</div>
+<div class="line"><a name="l17854"></a><span class="lineno">17854</span>&#160;{</div>
+<div class="line"><a name="l17855"></a><span class="lineno">17855</span>&#160;    VMA_ASSERT(allocator != VK_NULL_HANDLE);</div>
+<div class="line"><a name="l17856"></a><span class="lineno">17856</span>&#160;    VMA_ASSERT(pImageCreateInfo != VMA_NULL);</div>
+<div class="line"><a name="l17857"></a><span class="lineno">17857</span>&#160;    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);</div>
+<div class="line"><a name="l17858"></a><span class="lineno">17858</span>&#160;    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);</div>
+<div class="line"><a name="l17859"></a><span class="lineno">17859</span>&#160; </div>
+<div class="line"><a name="l17860"></a><span class="lineno">17860</span>&#160;    <span class="keyword">const</span> VkDevice hDev = allocator-&gt;m_hDevice;</div>
+<div class="line"><a name="l17861"></a><span class="lineno">17861</span>&#160;    VkImage hImage = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l17862"></a><span class="lineno">17862</span>&#160;    VkResult res = allocator-&gt;GetVulkanFunctions().vkCreateImage(</div>
+<div class="line"><a name="l17863"></a><span class="lineno">17863</span>&#160;        hDev, pImageCreateInfo, allocator-&gt;GetAllocationCallbacks(), &amp;hImage);</div>
+<div class="line"><a name="l17864"></a><span class="lineno">17864</span>&#160;    <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
+<div class="line"><a name="l17865"></a><span class="lineno">17865</span>&#160;    {</div>
+<div class="line"><a name="l17866"></a><span class="lineno">17866</span>&#160;        VkMemoryRequirements memReq = {};</div>
+<div class="line"><a name="l17867"></a><span class="lineno">17867</span>&#160;        allocator-&gt;GetVulkanFunctions().vkGetImageMemoryRequirements(</div>
+<div class="line"><a name="l17868"></a><span class="lineno">17868</span>&#160;            hDev, hImage, &amp;memReq);</div>
+<div class="line"><a name="l17869"></a><span class="lineno">17869</span>&#160; </div>
+<div class="line"><a name="l17870"></a><span class="lineno">17870</span>&#160;        res = <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(</div>
+<div class="line"><a name="l17871"></a><span class="lineno">17871</span>&#160;            allocator,</div>
+<div class="line"><a name="l17872"></a><span class="lineno">17872</span>&#160;            memReq.memoryTypeBits,</div>
+<div class="line"><a name="l17873"></a><span class="lineno">17873</span>&#160;            pAllocationCreateInfo,</div>
+<div class="line"><a name="l17874"></a><span class="lineno">17874</span>&#160;            pMemoryTypeIndex);</div>
 <div class="line"><a name="l17875"></a><span class="lineno">17875</span>&#160; </div>
-<div class="line"><a name="l17876"></a><span class="lineno">17876</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb">vmaAllocateMemoryForImage</a>(</div>
-<div class="line"><a name="l17877"></a><span class="lineno">17877</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17878"></a><span class="lineno">17878</span>&#160;    VkImage image,</div>
-<div class="line"><a name="l17879"></a><span class="lineno">17879</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
-<div class="line"><a name="l17880"></a><span class="lineno">17880</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
-<div class="line"><a name="l17881"></a><span class="lineno">17881</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
-<div class="line"><a name="l17882"></a><span class="lineno">17882</span>&#160;{</div>
-<div class="line"><a name="l17883"></a><span class="lineno">17883</span>&#160;    VMA_ASSERT(allocator &amp;&amp; image != VK_NULL_HANDLE &amp;&amp; pCreateInfo &amp;&amp; pAllocation);</div>
-<div class="line"><a name="l17884"></a><span class="lineno">17884</span>&#160; </div>
-<div class="line"><a name="l17885"></a><span class="lineno">17885</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaAllocateMemoryForImage&quot;</span>);</div>
-<div class="line"><a name="l17886"></a><span class="lineno">17886</span>&#160; </div>
-<div class="line"><a name="l17887"></a><span class="lineno">17887</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17888"></a><span class="lineno">17888</span>&#160; </div>
-<div class="line"><a name="l17889"></a><span class="lineno">17889</span>&#160;    VkMemoryRequirements vkMemReq = {};</div>
-<div class="line"><a name="l17890"></a><span class="lineno">17890</span>&#160;    <span class="keywordtype">bool</span> requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l17891"></a><span class="lineno">17891</span>&#160;    <span class="keywordtype">bool</span> prefersDedicatedAllocation  = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l17892"></a><span class="lineno">17892</span>&#160;    allocator-&gt;GetImageMemoryRequirements(image, vkMemReq,</div>
-<div class="line"><a name="l17893"></a><span class="lineno">17893</span>&#160;        requiresDedicatedAllocation, prefersDedicatedAllocation);</div>
-<div class="line"><a name="l17894"></a><span class="lineno">17894</span>&#160; </div>
-<div class="line"><a name="l17895"></a><span class="lineno">17895</span>&#160;    VkResult result = allocator-&gt;AllocateMemory(</div>
-<div class="line"><a name="l17896"></a><span class="lineno">17896</span>&#160;        vkMemReq,</div>
-<div class="line"><a name="l17897"></a><span class="lineno">17897</span>&#160;        requiresDedicatedAllocation,</div>
-<div class="line"><a name="l17898"></a><span class="lineno">17898</span>&#160;        prefersDedicatedAllocation,</div>
-<div class="line"><a name="l17899"></a><span class="lineno">17899</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedBuffer</span></div>
-<div class="line"><a name="l17900"></a><span class="lineno">17900</span>&#160;        UINT32_MAX, <span class="comment">// dedicatedBufferUsage</span></div>
-<div class="line"><a name="l17901"></a><span class="lineno">17901</span>&#160;        image, <span class="comment">// dedicatedImage</span></div>
-<div class="line"><a name="l17902"></a><span class="lineno">17902</span>&#160;        *pCreateInfo,</div>
-<div class="line"><a name="l17903"></a><span class="lineno">17903</span>&#160;        VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN,</div>
-<div class="line"><a name="l17904"></a><span class="lineno">17904</span>&#160;        1, <span class="comment">// allocationCount</span></div>
-<div class="line"><a name="l17905"></a><span class="lineno">17905</span>&#160;        pAllocation);</div>
-<div class="line"><a name="l17906"></a><span class="lineno">17906</span>&#160; </div>
-<div class="line"><a name="l17907"></a><span class="lineno">17907</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l17908"></a><span class="lineno">17908</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l17909"></a><span class="lineno">17909</span>&#160;    {</div>
-<div class="line"><a name="l17910"></a><span class="lineno">17910</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordAllocateMemoryForImage(</div>
-<div class="line"><a name="l17911"></a><span class="lineno">17911</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l17912"></a><span class="lineno">17912</span>&#160;            vkMemReq,</div>
-<div class="line"><a name="l17913"></a><span class="lineno">17913</span>&#160;            requiresDedicatedAllocation,</div>
-<div class="line"><a name="l17914"></a><span class="lineno">17914</span>&#160;            prefersDedicatedAllocation,</div>
-<div class="line"><a name="l17915"></a><span class="lineno">17915</span>&#160;            *pCreateInfo,</div>
-<div class="line"><a name="l17916"></a><span class="lineno">17916</span>&#160;            *pAllocation);</div>
-<div class="line"><a name="l17917"></a><span class="lineno">17917</span>&#160;    }</div>
-<div class="line"><a name="l17918"></a><span class="lineno">17918</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l17919"></a><span class="lineno">17919</span>&#160; </div>
-<div class="line"><a name="l17920"></a><span class="lineno">17920</span>&#160;    <span class="keywordflow">if</span>(pAllocationInfo &amp;&amp; result == VK_SUCCESS)</div>
-<div class="line"><a name="l17921"></a><span class="lineno">17921</span>&#160;    {</div>
-<div class="line"><a name="l17922"></a><span class="lineno">17922</span>&#160;        allocator-&gt;GetAllocationInfo(*pAllocation, pAllocationInfo);</div>
-<div class="line"><a name="l17923"></a><span class="lineno">17923</span>&#160;    }</div>
-<div class="line"><a name="l17924"></a><span class="lineno">17924</span>&#160; </div>
-<div class="line"><a name="l17925"></a><span class="lineno">17925</span>&#160;    <span class="keywordflow">return</span> result;</div>
-<div class="line"><a name="l17926"></a><span class="lineno">17926</span>&#160;}</div>
-<div class="line"><a name="l17927"></a><span class="lineno">17927</span>&#160; </div>
-<div class="line"><a name="l17928"></a><span class="lineno">17928</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5fea5518972ae9094b1526cbcb19b05f">vmaFreeMemory</a>(</div>
-<div class="line"><a name="l17929"></a><span class="lineno">17929</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17930"></a><span class="lineno">17930</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l17931"></a><span class="lineno">17931</span>&#160;{</div>
-<div class="line"><a name="l17932"></a><span class="lineno">17932</span>&#160;    VMA_ASSERT(allocator);</div>
-<div class="line"><a name="l17933"></a><span class="lineno">17933</span>&#160;    </div>
-<div class="line"><a name="l17934"></a><span class="lineno">17934</span>&#160;    <span class="keywordflow">if</span>(allocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l17935"></a><span class="lineno">17935</span>&#160;    {</div>
-<div class="line"><a name="l17936"></a><span class="lineno">17936</span>&#160;        <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l17937"></a><span class="lineno">17937</span>&#160;    }</div>
-<div class="line"><a name="l17938"></a><span class="lineno">17938</span>&#160;    </div>
-<div class="line"><a name="l17939"></a><span class="lineno">17939</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaFreeMemory&quot;</span>);</div>
-<div class="line"><a name="l17940"></a><span class="lineno">17940</span>&#160;    </div>
-<div class="line"><a name="l17941"></a><span class="lineno">17941</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17942"></a><span class="lineno">17942</span>&#160; </div>
-<div class="line"><a name="l17943"></a><span class="lineno">17943</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l17944"></a><span class="lineno">17944</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l17945"></a><span class="lineno">17945</span>&#160;    {</div>
-<div class="line"><a name="l17946"></a><span class="lineno">17946</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordFreeMemory(</div>
-<div class="line"><a name="l17947"></a><span class="lineno">17947</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l17948"></a><span class="lineno">17948</span>&#160;            allocation);</div>
-<div class="line"><a name="l17949"></a><span class="lineno">17949</span>&#160;    }</div>
-<div class="line"><a name="l17950"></a><span class="lineno">17950</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l17951"></a><span class="lineno">17951</span>&#160;    </div>
-<div class="line"><a name="l17952"></a><span class="lineno">17952</span>&#160;    allocator-&gt;FreeMemory(</div>
-<div class="line"><a name="l17953"></a><span class="lineno">17953</span>&#160;        1, <span class="comment">// allocationCount</span></div>
-<div class="line"><a name="l17954"></a><span class="lineno">17954</span>&#160;        &amp;allocation);</div>
-<div class="line"><a name="l17955"></a><span class="lineno">17955</span>&#160;}</div>
-<div class="line"><a name="l17956"></a><span class="lineno">17956</span>&#160; </div>
-<div class="line"><a name="l17957"></a><span class="lineno">17957</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a834b1e4aef395c0a1d56a28e69a4a17e">vmaFreeMemoryPages</a>(</div>
-<div class="line"><a name="l17958"></a><span class="lineno">17958</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17959"></a><span class="lineno">17959</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l17960"></a><span class="lineno">17960</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
-<div class="line"><a name="l17961"></a><span class="lineno">17961</span>&#160;{</div>
-<div class="line"><a name="l17962"></a><span class="lineno">17962</span>&#160;    <span class="keywordflow">if</span>(allocationCount == 0)</div>
-<div class="line"><a name="l17963"></a><span class="lineno">17963</span>&#160;    {</div>
-<div class="line"><a name="l17964"></a><span class="lineno">17964</span>&#160;        <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l17965"></a><span class="lineno">17965</span>&#160;    }</div>
+<div class="line"><a name="l17876"></a><span class="lineno">17876</span>&#160;        allocator-&gt;GetVulkanFunctions().vkDestroyImage(</div>
+<div class="line"><a name="l17877"></a><span class="lineno">17877</span>&#160;            hDev, hImage, allocator-&gt;GetAllocationCallbacks());</div>
+<div class="line"><a name="l17878"></a><span class="lineno">17878</span>&#160;    }</div>
+<div class="line"><a name="l17879"></a><span class="lineno">17879</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l17880"></a><span class="lineno">17880</span>&#160;}</div>
+<div class="line"><a name="l17881"></a><span class="lineno">17881</span>&#160; </div>
+<div class="line"><a name="l17882"></a><span class="lineno">17882</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5c8770ded7c59c8caac6de0c2cb00b50">vmaCreatePool</a>(</div>
+<div class="line"><a name="l17883"></a><span class="lineno">17883</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17884"></a><span class="lineno">17884</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>* pCreateInfo,</div>
+<div class="line"><a name="l17885"></a><span class="lineno">17885</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPool)</div>
+<div class="line"><a name="l17886"></a><span class="lineno">17886</span>&#160;{</div>
+<div class="line"><a name="l17887"></a><span class="lineno">17887</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pCreateInfo &amp;&amp; pPool);</div>
+<div class="line"><a name="l17888"></a><span class="lineno">17888</span>&#160;    </div>
+<div class="line"><a name="l17889"></a><span class="lineno">17889</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCreatePool&quot;</span>);</div>
+<div class="line"><a name="l17890"></a><span class="lineno">17890</span>&#160;    </div>
+<div class="line"><a name="l17891"></a><span class="lineno">17891</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l17892"></a><span class="lineno">17892</span>&#160;    </div>
+<div class="line"><a name="l17893"></a><span class="lineno">17893</span>&#160;    VkResult res = allocator-&gt;CreatePool(pCreateInfo, pPool);</div>
+<div class="line"><a name="l17894"></a><span class="lineno">17894</span>&#160;    </div>
+<div class="line"><a name="l17895"></a><span class="lineno">17895</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l17896"></a><span class="lineno">17896</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l17897"></a><span class="lineno">17897</span>&#160;    {</div>
+<div class="line"><a name="l17898"></a><span class="lineno">17898</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordCreatePool(allocator-&gt;GetCurrentFrameIndex(), *pCreateInfo, *pPool);</div>
+<div class="line"><a name="l17899"></a><span class="lineno">17899</span>&#160;    }</div>
+<div class="line"><a name="l17900"></a><span class="lineno">17900</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l17901"></a><span class="lineno">17901</span>&#160;    </div>
+<div class="line"><a name="l17902"></a><span class="lineno">17902</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l17903"></a><span class="lineno">17903</span>&#160;}</div>
+<div class="line"><a name="l17904"></a><span class="lineno">17904</span>&#160; </div>
+<div class="line"><a name="l17905"></a><span class="lineno">17905</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5485779c8f1948238fc4e92232fa65e1">vmaDestroyPool</a>(</div>
+<div class="line"><a name="l17906"></a><span class="lineno">17906</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17907"></a><span class="lineno">17907</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
+<div class="line"><a name="l17908"></a><span class="lineno">17908</span>&#160;{</div>
+<div class="line"><a name="l17909"></a><span class="lineno">17909</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l17910"></a><span class="lineno">17910</span>&#160;    </div>
+<div class="line"><a name="l17911"></a><span class="lineno">17911</span>&#160;    <span class="keywordflow">if</span>(pool == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l17912"></a><span class="lineno">17912</span>&#160;    {</div>
+<div class="line"><a name="l17913"></a><span class="lineno">17913</span>&#160;        <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l17914"></a><span class="lineno">17914</span>&#160;    }</div>
+<div class="line"><a name="l17915"></a><span class="lineno">17915</span>&#160;    </div>
+<div class="line"><a name="l17916"></a><span class="lineno">17916</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDestroyPool&quot;</span>);</div>
+<div class="line"><a name="l17917"></a><span class="lineno">17917</span>&#160;    </div>
+<div class="line"><a name="l17918"></a><span class="lineno">17918</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l17919"></a><span class="lineno">17919</span>&#160;    </div>
+<div class="line"><a name="l17920"></a><span class="lineno">17920</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l17921"></a><span class="lineno">17921</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l17922"></a><span class="lineno">17922</span>&#160;    {</div>
+<div class="line"><a name="l17923"></a><span class="lineno">17923</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordDestroyPool(allocator-&gt;GetCurrentFrameIndex(), pool);</div>
+<div class="line"><a name="l17924"></a><span class="lineno">17924</span>&#160;    }</div>
+<div class="line"><a name="l17925"></a><span class="lineno">17925</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l17926"></a><span class="lineno">17926</span>&#160; </div>
+<div class="line"><a name="l17927"></a><span class="lineno">17927</span>&#160;    allocator-&gt;DestroyPool(pool);</div>
+<div class="line"><a name="l17928"></a><span class="lineno">17928</span>&#160;}</div>
+<div class="line"><a name="l17929"></a><span class="lineno">17929</span>&#160; </div>
+<div class="line"><a name="l17930"></a><span class="lineno">17930</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153">vmaGetPoolStats</a>(</div>
+<div class="line"><a name="l17931"></a><span class="lineno">17931</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17932"></a><span class="lineno">17932</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
+<div class="line"><a name="l17933"></a><span class="lineno">17933</span>&#160;    <a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pPoolStats)</div>
+<div class="line"><a name="l17934"></a><span class="lineno">17934</span>&#160;{</div>
+<div class="line"><a name="l17935"></a><span class="lineno">17935</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pool &amp;&amp; pPoolStats);</div>
+<div class="line"><a name="l17936"></a><span class="lineno">17936</span>&#160; </div>
+<div class="line"><a name="l17937"></a><span class="lineno">17937</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l17938"></a><span class="lineno">17938</span>&#160; </div>
+<div class="line"><a name="l17939"></a><span class="lineno">17939</span>&#160;    allocator-&gt;GetPoolStats(pool, pPoolStats);</div>
+<div class="line"><a name="l17940"></a><span class="lineno">17940</span>&#160;}</div>
+<div class="line"><a name="l17941"></a><span class="lineno">17941</span>&#160; </div>
+<div class="line"><a name="l17942"></a><span class="lineno">17942</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024">vmaMakePoolAllocationsLost</a>(</div>
+<div class="line"><a name="l17943"></a><span class="lineno">17943</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17944"></a><span class="lineno">17944</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
+<div class="line"><a name="l17945"></a><span class="lineno">17945</span>&#160;    <span class="keywordtype">size_t</span>* pLostAllocationCount)</div>
+<div class="line"><a name="l17946"></a><span class="lineno">17946</span>&#160;{</div>
+<div class="line"><a name="l17947"></a><span class="lineno">17947</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pool);</div>
+<div class="line"><a name="l17948"></a><span class="lineno">17948</span>&#160; </div>
+<div class="line"><a name="l17949"></a><span class="lineno">17949</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l17950"></a><span class="lineno">17950</span>&#160; </div>
+<div class="line"><a name="l17951"></a><span class="lineno">17951</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l17952"></a><span class="lineno">17952</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l17953"></a><span class="lineno">17953</span>&#160;    {</div>
+<div class="line"><a name="l17954"></a><span class="lineno">17954</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordMakePoolAllocationsLost(allocator-&gt;GetCurrentFrameIndex(), pool);</div>
+<div class="line"><a name="l17955"></a><span class="lineno">17955</span>&#160;    }</div>
+<div class="line"><a name="l17956"></a><span class="lineno">17956</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l17957"></a><span class="lineno">17957</span>&#160; </div>
+<div class="line"><a name="l17958"></a><span class="lineno">17958</span>&#160;    allocator-&gt;MakePoolAllocationsLost(pool, pLostAllocationCount);</div>
+<div class="line"><a name="l17959"></a><span class="lineno">17959</span>&#160;}</div>
+<div class="line"><a name="l17960"></a><span class="lineno">17960</span>&#160; </div>
+<div class="line"><a name="l17961"></a><span class="lineno">17961</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad535935619c7a549bf837e1bb0068f89">vmaCheckPoolCorruption</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="code" href="struct_vma_pool.html">VmaPool</a> pool)</div>
+<div class="line"><a name="l17962"></a><span class="lineno">17962</span>&#160;{</div>
+<div class="line"><a name="l17963"></a><span class="lineno">17963</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pool);</div>
+<div class="line"><a name="l17964"></a><span class="lineno">17964</span>&#160; </div>
+<div class="line"><a name="l17965"></a><span class="lineno">17965</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
 <div class="line"><a name="l17966"></a><span class="lineno">17966</span>&#160; </div>
-<div class="line"><a name="l17967"></a><span class="lineno">17967</span>&#160;    VMA_ASSERT(allocator);</div>
-<div class="line"><a name="l17968"></a><span class="lineno">17968</span>&#160;    </div>
-<div class="line"><a name="l17969"></a><span class="lineno">17969</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaFreeMemoryPages&quot;</span>);</div>
-<div class="line"><a name="l17970"></a><span class="lineno">17970</span>&#160;    </div>
-<div class="line"><a name="l17971"></a><span class="lineno">17971</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l17972"></a><span class="lineno">17972</span>&#160; </div>
-<div class="line"><a name="l17973"></a><span class="lineno">17973</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l17974"></a><span class="lineno">17974</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l17975"></a><span class="lineno">17975</span>&#160;    {</div>
-<div class="line"><a name="l17976"></a><span class="lineno">17976</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordFreeMemoryPages(</div>
-<div class="line"><a name="l17977"></a><span class="lineno">17977</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l17978"></a><span class="lineno">17978</span>&#160;            (uint64_t)allocationCount,</div>
-<div class="line"><a name="l17979"></a><span class="lineno">17979</span>&#160;            pAllocations);</div>
-<div class="line"><a name="l17980"></a><span class="lineno">17980</span>&#160;    }</div>
-<div class="line"><a name="l17981"></a><span class="lineno">17981</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l17982"></a><span class="lineno">17982</span>&#160;    </div>
-<div class="line"><a name="l17983"></a><span class="lineno">17983</span>&#160;    allocator-&gt;FreeMemory(allocationCount, pAllocations);</div>
+<div class="line"><a name="l17967"></a><span class="lineno">17967</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCheckPoolCorruption&quot;</span>);</div>
+<div class="line"><a name="l17968"></a><span class="lineno">17968</span>&#160; </div>
+<div class="line"><a name="l17969"></a><span class="lineno">17969</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;CheckPoolCorruption(pool);</div>
+<div class="line"><a name="l17970"></a><span class="lineno">17970</span>&#160;}</div>
+<div class="line"><a name="l17971"></a><span class="lineno">17971</span>&#160; </div>
+<div class="line"><a name="l17972"></a><span class="lineno">17972</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030">vmaGetPoolName</a>(</div>
+<div class="line"><a name="l17973"></a><span class="lineno">17973</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l17974"></a><span class="lineno">17974</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
+<div class="line"><a name="l17975"></a><span class="lineno">17975</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>** ppName)</div>
+<div class="line"><a name="l17976"></a><span class="lineno">17976</span>&#160;{</div>
+<div class="line"><a name="l17977"></a><span class="lineno">17977</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pool &amp;&amp; ppName);</div>
+<div class="line"><a name="l17978"></a><span class="lineno">17978</span>&#160;    </div>
+<div class="line"><a name="l17979"></a><span class="lineno">17979</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaGetPoolName&quot;</span>);</div>
+<div class="line"><a name="l17980"></a><span class="lineno">17980</span>&#160; </div>
+<div class="line"><a name="l17981"></a><span class="lineno">17981</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l17982"></a><span class="lineno">17982</span>&#160; </div>
+<div class="line"><a name="l17983"></a><span class="lineno">17983</span>&#160;    *ppName = pool-&gt;GetName();</div>
 <div class="line"><a name="l17984"></a><span class="lineno">17984</span>&#160;}</div>
 <div class="line"><a name="l17985"></a><span class="lineno">17985</span>&#160; </div>
-<div class="line"><a name="l17986"></a><span class="lineno">17986</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0ff488958ca72b28e545880463cb8696">vmaResizeAllocation</a>(</div>
+<div class="line"><a name="l17986"></a><span class="lineno">17986</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58">vmaSetPoolName</a>(</div>
 <div class="line"><a name="l17987"></a><span class="lineno">17987</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l17988"></a><span class="lineno">17988</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
-<div class="line"><a name="l17989"></a><span class="lineno">17989</span>&#160;    VkDeviceSize newSize)</div>
+<div class="line"><a name="l17988"></a><span class="lineno">17988</span>&#160;    <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
+<div class="line"><a name="l17989"></a><span class="lineno">17989</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* pName)</div>
 <div class="line"><a name="l17990"></a><span class="lineno">17990</span>&#160;{</div>
-<div class="line"><a name="l17991"></a><span class="lineno">17991</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
-<div class="line"><a name="l17992"></a><span class="lineno">17992</span>&#160;    </div>
-<div class="line"><a name="l17993"></a><span class="lineno">17993</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaResizeAllocation&quot;</span>);</div>
-<div class="line"><a name="l17994"></a><span class="lineno">17994</span>&#160;    </div>
+<div class="line"><a name="l17991"></a><span class="lineno">17991</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pool);</div>
+<div class="line"><a name="l17992"></a><span class="lineno">17992</span>&#160; </div>
+<div class="line"><a name="l17993"></a><span class="lineno">17993</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaSetPoolName&quot;</span>);</div>
+<div class="line"><a name="l17994"></a><span class="lineno">17994</span>&#160; </div>
 <div class="line"><a name="l17995"></a><span class="lineno">17995</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
 <div class="line"><a name="l17996"></a><span class="lineno">17996</span>&#160; </div>
-<div class="line"><a name="l17997"></a><span class="lineno">17997</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;ResizeAllocation(allocation, newSize);</div>
-<div class="line"><a name="l17998"></a><span class="lineno">17998</span>&#160;}</div>
-<div class="line"><a name="l17999"></a><span class="lineno">17999</span>&#160; </div>
-<div class="line"><a name="l18000"></a><span class="lineno">18000</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a>(</div>
-<div class="line"><a name="l18001"></a><span class="lineno">18001</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18002"></a><span class="lineno">18002</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
-<div class="line"><a name="l18003"></a><span class="lineno">18003</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
-<div class="line"><a name="l18004"></a><span class="lineno">18004</span>&#160;{</div>
-<div class="line"><a name="l18005"></a><span class="lineno">18005</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; pAllocationInfo);</div>
+<div class="line"><a name="l17997"></a><span class="lineno">17997</span>&#160;    pool-&gt;SetName(pName);</div>
+<div class="line"><a name="l17998"></a><span class="lineno">17998</span>&#160; </div>
+<div class="line"><a name="l17999"></a><span class="lineno">17999</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18000"></a><span class="lineno">18000</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18001"></a><span class="lineno">18001</span>&#160;    {</div>
+<div class="line"><a name="l18002"></a><span class="lineno">18002</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordSetPoolName(allocator-&gt;GetCurrentFrameIndex(), pool, pName);</div>
+<div class="line"><a name="l18003"></a><span class="lineno">18003</span>&#160;    }</div>
+<div class="line"><a name="l18004"></a><span class="lineno">18004</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18005"></a><span class="lineno">18005</span>&#160;}</div>
 <div class="line"><a name="l18006"></a><span class="lineno">18006</span>&#160; </div>
-<div class="line"><a name="l18007"></a><span class="lineno">18007</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18008"></a><span class="lineno">18008</span>&#160; </div>
-<div class="line"><a name="l18009"></a><span class="lineno">18009</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18010"></a><span class="lineno">18010</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18011"></a><span class="lineno">18011</span>&#160;    {</div>
-<div class="line"><a name="l18012"></a><span class="lineno">18012</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordGetAllocationInfo(</div>
-<div class="line"><a name="l18013"></a><span class="lineno">18013</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18014"></a><span class="lineno">18014</span>&#160;            allocation);</div>
-<div class="line"><a name="l18015"></a><span class="lineno">18015</span>&#160;    }</div>
-<div class="line"><a name="l18016"></a><span class="lineno">18016</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18007"></a><span class="lineno">18007</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8">vmaAllocateMemory</a>(</div>
+<div class="line"><a name="l18008"></a><span class="lineno">18008</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18009"></a><span class="lineno">18009</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements* pVkMemoryRequirements,</div>
+<div class="line"><a name="l18010"></a><span class="lineno">18010</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
+<div class="line"><a name="l18011"></a><span class="lineno">18011</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
+<div class="line"><a name="l18012"></a><span class="lineno">18012</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
+<div class="line"><a name="l18013"></a><span class="lineno">18013</span>&#160;{</div>
+<div class="line"><a name="l18014"></a><span class="lineno">18014</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pVkMemoryRequirements &amp;&amp; pCreateInfo &amp;&amp; pAllocation);</div>
+<div class="line"><a name="l18015"></a><span class="lineno">18015</span>&#160; </div>
+<div class="line"><a name="l18016"></a><span class="lineno">18016</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaAllocateMemory&quot;</span>);</div>
 <div class="line"><a name="l18017"></a><span class="lineno">18017</span>&#160; </div>
-<div class="line"><a name="l18018"></a><span class="lineno">18018</span>&#160;    allocator-&gt;GetAllocationInfo(allocation, pAllocationInfo);</div>
-<div class="line"><a name="l18019"></a><span class="lineno">18019</span>&#160;}</div>
-<div class="line"><a name="l18020"></a><span class="lineno">18020</span>&#160; </div>
-<div class="line"><a name="l18021"></a><span class="lineno">18021</span>&#160;VMA_CALL_PRE VkBool32 VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a">vmaTouchAllocation</a>(</div>
-<div class="line"><a name="l18022"></a><span class="lineno">18022</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18023"></a><span class="lineno">18023</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l18024"></a><span class="lineno">18024</span>&#160;{</div>
-<div class="line"><a name="l18025"></a><span class="lineno">18025</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
-<div class="line"><a name="l18026"></a><span class="lineno">18026</span>&#160; </div>
-<div class="line"><a name="l18027"></a><span class="lineno">18027</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18028"></a><span class="lineno">18028</span>&#160; </div>
-<div class="line"><a name="l18029"></a><span class="lineno">18029</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18030"></a><span class="lineno">18030</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18031"></a><span class="lineno">18031</span>&#160;    {</div>
-<div class="line"><a name="l18032"></a><span class="lineno">18032</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordTouchAllocation(</div>
-<div class="line"><a name="l18033"></a><span class="lineno">18033</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18034"></a><span class="lineno">18034</span>&#160;            allocation);</div>
-<div class="line"><a name="l18035"></a><span class="lineno">18035</span>&#160;    }</div>
-<div class="line"><a name="l18036"></a><span class="lineno">18036</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l18037"></a><span class="lineno">18037</span>&#160; </div>
-<div class="line"><a name="l18038"></a><span class="lineno">18038</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;TouchAllocation(allocation);</div>
-<div class="line"><a name="l18039"></a><span class="lineno">18039</span>&#160;}</div>
-<div class="line"><a name="l18040"></a><span class="lineno">18040</span>&#160; </div>
-<div class="line"><a name="l18041"></a><span class="lineno">18041</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f">vmaSetAllocationUserData</a>(</div>
-<div class="line"><a name="l18042"></a><span class="lineno">18042</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18043"></a><span class="lineno">18043</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
-<div class="line"><a name="l18044"></a><span class="lineno">18044</span>&#160;    <span class="keywordtype">void</span>* pUserData)</div>
-<div class="line"><a name="l18045"></a><span class="lineno">18045</span>&#160;{</div>
-<div class="line"><a name="l18046"></a><span class="lineno">18046</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
+<div class="line"><a name="l18018"></a><span class="lineno">18018</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18019"></a><span class="lineno">18019</span>&#160; </div>
+<div class="line"><a name="l18020"></a><span class="lineno">18020</span>&#160;    VkResult result = allocator-&gt;AllocateMemory(</div>
+<div class="line"><a name="l18021"></a><span class="lineno">18021</span>&#160;        *pVkMemoryRequirements,</div>
+<div class="line"><a name="l18022"></a><span class="lineno">18022</span>&#160;        <span class="keyword">false</span>, <span class="comment">// requiresDedicatedAllocation</span></div>
+<div class="line"><a name="l18023"></a><span class="lineno">18023</span>&#160;        <span class="keyword">false</span>, <span class="comment">// prefersDedicatedAllocation</span></div>
+<div class="line"><a name="l18024"></a><span class="lineno">18024</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedBuffer</span></div>
+<div class="line"><a name="l18025"></a><span class="lineno">18025</span>&#160;        UINT32_MAX, <span class="comment">// dedicatedBufferUsage</span></div>
+<div class="line"><a name="l18026"></a><span class="lineno">18026</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedImage</span></div>
+<div class="line"><a name="l18027"></a><span class="lineno">18027</span>&#160;        *pCreateInfo,</div>
+<div class="line"><a name="l18028"></a><span class="lineno">18028</span>&#160;        VMA_SUBALLOCATION_TYPE_UNKNOWN,</div>
+<div class="line"><a name="l18029"></a><span class="lineno">18029</span>&#160;        1, <span class="comment">// allocationCount</span></div>
+<div class="line"><a name="l18030"></a><span class="lineno">18030</span>&#160;        pAllocation);</div>
+<div class="line"><a name="l18031"></a><span class="lineno">18031</span>&#160; </div>
+<div class="line"><a name="l18032"></a><span class="lineno">18032</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18033"></a><span class="lineno">18033</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18034"></a><span class="lineno">18034</span>&#160;    {</div>
+<div class="line"><a name="l18035"></a><span class="lineno">18035</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordAllocateMemory(</div>
+<div class="line"><a name="l18036"></a><span class="lineno">18036</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18037"></a><span class="lineno">18037</span>&#160;            *pVkMemoryRequirements,</div>
+<div class="line"><a name="l18038"></a><span class="lineno">18038</span>&#160;            *pCreateInfo,</div>
+<div class="line"><a name="l18039"></a><span class="lineno">18039</span>&#160;            *pAllocation);</div>
+<div class="line"><a name="l18040"></a><span class="lineno">18040</span>&#160;    }</div>
+<div class="line"><a name="l18041"></a><span class="lineno">18041</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18042"></a><span class="lineno">18042</span>&#160;        </div>
+<div class="line"><a name="l18043"></a><span class="lineno">18043</span>&#160;    <span class="keywordflow">if</span>(pAllocationInfo != VMA_NULL &amp;&amp; result == VK_SUCCESS)</div>
+<div class="line"><a name="l18044"></a><span class="lineno">18044</span>&#160;    {</div>
+<div class="line"><a name="l18045"></a><span class="lineno">18045</span>&#160;        allocator-&gt;GetAllocationInfo(*pAllocation, pAllocationInfo);</div>
+<div class="line"><a name="l18046"></a><span class="lineno">18046</span>&#160;    }</div>
 <div class="line"><a name="l18047"></a><span class="lineno">18047</span>&#160; </div>
-<div class="line"><a name="l18048"></a><span class="lineno">18048</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18049"></a><span class="lineno">18049</span>&#160; </div>
-<div class="line"><a name="l18050"></a><span class="lineno">18050</span>&#160;    allocation-&gt;SetUserData(allocator, pUserData);</div>
-<div class="line"><a name="l18051"></a><span class="lineno">18051</span>&#160; </div>
-<div class="line"><a name="l18052"></a><span class="lineno">18052</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18053"></a><span class="lineno">18053</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18054"></a><span class="lineno">18054</span>&#160;    {</div>
-<div class="line"><a name="l18055"></a><span class="lineno">18055</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordSetAllocationUserData(</div>
-<div class="line"><a name="l18056"></a><span class="lineno">18056</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18057"></a><span class="lineno">18057</span>&#160;            allocation,</div>
-<div class="line"><a name="l18058"></a><span class="lineno">18058</span>&#160;            pUserData);</div>
-<div class="line"><a name="l18059"></a><span class="lineno">18059</span>&#160;    }</div>
-<div class="line"><a name="l18060"></a><span class="lineno">18060</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l18061"></a><span class="lineno">18061</span>&#160;}</div>
-<div class="line"><a name="l18062"></a><span class="lineno">18062</span>&#160; </div>
-<div class="line"><a name="l18063"></a><span class="lineno">18063</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae5c9657d9e94756269145b01c05d16f1">vmaCreateLostAllocation</a>(</div>
-<div class="line"><a name="l18064"></a><span class="lineno">18064</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18065"></a><span class="lineno">18065</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation)</div>
-<div class="line"><a name="l18066"></a><span class="lineno">18066</span>&#160;{</div>
-<div class="line"><a name="l18067"></a><span class="lineno">18067</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pAllocation);</div>
-<div class="line"><a name="l18068"></a><span class="lineno">18068</span>&#160; </div>
-<div class="line"><a name="l18069"></a><span class="lineno">18069</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK;</div>
-<div class="line"><a name="l18070"></a><span class="lineno">18070</span>&#160; </div>
-<div class="line"><a name="l18071"></a><span class="lineno">18071</span>&#160;    allocator-&gt;CreateLostAllocation(pAllocation);</div>
-<div class="line"><a name="l18072"></a><span class="lineno">18072</span>&#160; </div>
-<div class="line"><a name="l18073"></a><span class="lineno">18073</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18074"></a><span class="lineno">18074</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18075"></a><span class="lineno">18075</span>&#160;    {</div>
-<div class="line"><a name="l18076"></a><span class="lineno">18076</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordCreateLostAllocation(</div>
-<div class="line"><a name="l18077"></a><span class="lineno">18077</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18078"></a><span class="lineno">18078</span>&#160;            *pAllocation);</div>
-<div class="line"><a name="l18079"></a><span class="lineno">18079</span>&#160;    }</div>
-<div class="line"><a name="l18080"></a><span class="lineno">18080</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l18081"></a><span class="lineno">18081</span>&#160;}</div>
-<div class="line"><a name="l18082"></a><span class="lineno">18082</span>&#160; </div>
-<div class="line"><a name="l18083"></a><span class="lineno">18083</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069">vmaMapMemory</a>(</div>
-<div class="line"><a name="l18084"></a><span class="lineno">18084</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18085"></a><span class="lineno">18085</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
-<div class="line"><a name="l18086"></a><span class="lineno">18086</span>&#160;    <span class="keywordtype">void</span>** ppData)</div>
-<div class="line"><a name="l18087"></a><span class="lineno">18087</span>&#160;{</div>
-<div class="line"><a name="l18088"></a><span class="lineno">18088</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; ppData);</div>
-<div class="line"><a name="l18089"></a><span class="lineno">18089</span>&#160; </div>
-<div class="line"><a name="l18090"></a><span class="lineno">18090</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18091"></a><span class="lineno">18091</span>&#160; </div>
-<div class="line"><a name="l18092"></a><span class="lineno">18092</span>&#160;    VkResult res = allocator-&gt;Map(allocation, ppData);</div>
-<div class="line"><a name="l18093"></a><span class="lineno">18093</span>&#160; </div>
-<div class="line"><a name="l18094"></a><span class="lineno">18094</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18095"></a><span class="lineno">18095</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18096"></a><span class="lineno">18096</span>&#160;    {</div>
-<div class="line"><a name="l18097"></a><span class="lineno">18097</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordMapMemory(</div>
-<div class="line"><a name="l18098"></a><span class="lineno">18098</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18099"></a><span class="lineno">18099</span>&#160;            allocation);</div>
+<div class="line"><a name="l18048"></a><span class="lineno">18048</span>&#160;    <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l18049"></a><span class="lineno">18049</span>&#160;}</div>
+<div class="line"><a name="l18050"></a><span class="lineno">18050</span>&#160; </div>
+<div class="line"><a name="l18051"></a><span class="lineno">18051</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad37e82e492b3de38fc3f4cffd9ad0ae1">vmaAllocateMemoryPages</a>(</div>
+<div class="line"><a name="l18052"></a><span class="lineno">18052</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18053"></a><span class="lineno">18053</span>&#160;    <span class="keyword">const</span> VkMemoryRequirements* pVkMemoryRequirements,</div>
+<div class="line"><a name="l18054"></a><span class="lineno">18054</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
+<div class="line"><a name="l18055"></a><span class="lineno">18055</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l18056"></a><span class="lineno">18056</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations,</div>
+<div class="line"><a name="l18057"></a><span class="lineno">18057</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
+<div class="line"><a name="l18058"></a><span class="lineno">18058</span>&#160;{</div>
+<div class="line"><a name="l18059"></a><span class="lineno">18059</span>&#160;    <span class="keywordflow">if</span>(allocationCount == 0)</div>
+<div class="line"><a name="l18060"></a><span class="lineno">18060</span>&#160;    {</div>
+<div class="line"><a name="l18061"></a><span class="lineno">18061</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l18062"></a><span class="lineno">18062</span>&#160;    }</div>
+<div class="line"><a name="l18063"></a><span class="lineno">18063</span>&#160; </div>
+<div class="line"><a name="l18064"></a><span class="lineno">18064</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pVkMemoryRequirements &amp;&amp; pCreateInfo &amp;&amp; pAllocations);</div>
+<div class="line"><a name="l18065"></a><span class="lineno">18065</span>&#160; </div>
+<div class="line"><a name="l18066"></a><span class="lineno">18066</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaAllocateMemoryPages&quot;</span>);</div>
+<div class="line"><a name="l18067"></a><span class="lineno">18067</span>&#160; </div>
+<div class="line"><a name="l18068"></a><span class="lineno">18068</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18069"></a><span class="lineno">18069</span>&#160; </div>
+<div class="line"><a name="l18070"></a><span class="lineno">18070</span>&#160;    VkResult result = allocator-&gt;AllocateMemory(</div>
+<div class="line"><a name="l18071"></a><span class="lineno">18071</span>&#160;        *pVkMemoryRequirements,</div>
+<div class="line"><a name="l18072"></a><span class="lineno">18072</span>&#160;        <span class="keyword">false</span>, <span class="comment">// requiresDedicatedAllocation</span></div>
+<div class="line"><a name="l18073"></a><span class="lineno">18073</span>&#160;        <span class="keyword">false</span>, <span class="comment">// prefersDedicatedAllocation</span></div>
+<div class="line"><a name="l18074"></a><span class="lineno">18074</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedBuffer</span></div>
+<div class="line"><a name="l18075"></a><span class="lineno">18075</span>&#160;        UINT32_MAX, <span class="comment">// dedicatedBufferUsage</span></div>
+<div class="line"><a name="l18076"></a><span class="lineno">18076</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedImage</span></div>
+<div class="line"><a name="l18077"></a><span class="lineno">18077</span>&#160;        *pCreateInfo,</div>
+<div class="line"><a name="l18078"></a><span class="lineno">18078</span>&#160;        VMA_SUBALLOCATION_TYPE_UNKNOWN,</div>
+<div class="line"><a name="l18079"></a><span class="lineno">18079</span>&#160;        allocationCount,</div>
+<div class="line"><a name="l18080"></a><span class="lineno">18080</span>&#160;        pAllocations);</div>
+<div class="line"><a name="l18081"></a><span class="lineno">18081</span>&#160; </div>
+<div class="line"><a name="l18082"></a><span class="lineno">18082</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18083"></a><span class="lineno">18083</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18084"></a><span class="lineno">18084</span>&#160;    {</div>
+<div class="line"><a name="l18085"></a><span class="lineno">18085</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordAllocateMemoryPages(</div>
+<div class="line"><a name="l18086"></a><span class="lineno">18086</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18087"></a><span class="lineno">18087</span>&#160;            *pVkMemoryRequirements,</div>
+<div class="line"><a name="l18088"></a><span class="lineno">18088</span>&#160;            *pCreateInfo,</div>
+<div class="line"><a name="l18089"></a><span class="lineno">18089</span>&#160;            (uint64_t)allocationCount,</div>
+<div class="line"><a name="l18090"></a><span class="lineno">18090</span>&#160;            pAllocations);</div>
+<div class="line"><a name="l18091"></a><span class="lineno">18091</span>&#160;    }</div>
+<div class="line"><a name="l18092"></a><span class="lineno">18092</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18093"></a><span class="lineno">18093</span>&#160;        </div>
+<div class="line"><a name="l18094"></a><span class="lineno">18094</span>&#160;    <span class="keywordflow">if</span>(pAllocationInfo != VMA_NULL &amp;&amp; result == VK_SUCCESS)</div>
+<div class="line"><a name="l18095"></a><span class="lineno">18095</span>&#160;    {</div>
+<div class="line"><a name="l18096"></a><span class="lineno">18096</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; allocationCount; ++i)</div>
+<div class="line"><a name="l18097"></a><span class="lineno">18097</span>&#160;        {</div>
+<div class="line"><a name="l18098"></a><span class="lineno">18098</span>&#160;            allocator-&gt;GetAllocationInfo(pAllocations[i], pAllocationInfo + i);</div>
+<div class="line"><a name="l18099"></a><span class="lineno">18099</span>&#160;        }</div>
 <div class="line"><a name="l18100"></a><span class="lineno">18100</span>&#160;    }</div>
-<div class="line"><a name="l18101"></a><span class="lineno">18101</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l18102"></a><span class="lineno">18102</span>&#160; </div>
-<div class="line"><a name="l18103"></a><span class="lineno">18103</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l18104"></a><span class="lineno">18104</span>&#160;}</div>
-<div class="line"><a name="l18105"></a><span class="lineno">18105</span>&#160; </div>
-<div class="line"><a name="l18106"></a><span class="lineno">18106</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45">vmaUnmapMemory</a>(</div>
-<div class="line"><a name="l18107"></a><span class="lineno">18107</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18108"></a><span class="lineno">18108</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l18109"></a><span class="lineno">18109</span>&#160;{</div>
-<div class="line"><a name="l18110"></a><span class="lineno">18110</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
-<div class="line"><a name="l18111"></a><span class="lineno">18111</span>&#160; </div>
-<div class="line"><a name="l18112"></a><span class="lineno">18112</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18101"></a><span class="lineno">18101</span>&#160; </div>
+<div class="line"><a name="l18102"></a><span class="lineno">18102</span>&#160;    <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l18103"></a><span class="lineno">18103</span>&#160;}</div>
+<div class="line"><a name="l18104"></a><span class="lineno">18104</span>&#160; </div>
+<div class="line"><a name="l18105"></a><span class="lineno">18105</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer</a>(</div>
+<div class="line"><a name="l18106"></a><span class="lineno">18106</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18107"></a><span class="lineno">18107</span>&#160;    VkBuffer buffer,</div>
+<div class="line"><a name="l18108"></a><span class="lineno">18108</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
+<div class="line"><a name="l18109"></a><span class="lineno">18109</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
+<div class="line"><a name="l18110"></a><span class="lineno">18110</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
+<div class="line"><a name="l18111"></a><span class="lineno">18111</span>&#160;{</div>
+<div class="line"><a name="l18112"></a><span class="lineno">18112</span>&#160;    VMA_ASSERT(allocator &amp;&amp; buffer != VK_NULL_HANDLE &amp;&amp; pCreateInfo &amp;&amp; pAllocation);</div>
 <div class="line"><a name="l18113"></a><span class="lineno">18113</span>&#160; </div>
-<div class="line"><a name="l18114"></a><span class="lineno">18114</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18115"></a><span class="lineno">18115</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18116"></a><span class="lineno">18116</span>&#160;    {</div>
-<div class="line"><a name="l18117"></a><span class="lineno">18117</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordUnmapMemory(</div>
-<div class="line"><a name="l18118"></a><span class="lineno">18118</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18119"></a><span class="lineno">18119</span>&#160;            allocation);</div>
-<div class="line"><a name="l18120"></a><span class="lineno">18120</span>&#160;    }</div>
-<div class="line"><a name="l18121"></a><span class="lineno">18121</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l18122"></a><span class="lineno">18122</span>&#160; </div>
-<div class="line"><a name="l18123"></a><span class="lineno">18123</span>&#160;    allocator-&gt;Unmap(allocation);</div>
-<div class="line"><a name="l18124"></a><span class="lineno">18124</span>&#160;}</div>
-<div class="line"><a name="l18125"></a><span class="lineno">18125</span>&#160; </div>
-<div class="line"><a name="l18126"></a><span class="lineno">18126</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de">vmaFlushAllocation</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</div>
-<div class="line"><a name="l18127"></a><span class="lineno">18127</span>&#160;{</div>
-<div class="line"><a name="l18128"></a><span class="lineno">18128</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
-<div class="line"><a name="l18129"></a><span class="lineno">18129</span>&#160; </div>
-<div class="line"><a name="l18130"></a><span class="lineno">18130</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaFlushAllocation&quot;</span>);</div>
-<div class="line"><a name="l18131"></a><span class="lineno">18131</span>&#160; </div>
-<div class="line"><a name="l18132"></a><span class="lineno">18132</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18133"></a><span class="lineno">18133</span>&#160; </div>
-<div class="line"><a name="l18134"></a><span class="lineno">18134</span>&#160;    allocator-&gt;FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_FLUSH);</div>
-<div class="line"><a name="l18135"></a><span class="lineno">18135</span>&#160; </div>
-<div class="line"><a name="l18136"></a><span class="lineno">18136</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18137"></a><span class="lineno">18137</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18138"></a><span class="lineno">18138</span>&#160;    {</div>
-<div class="line"><a name="l18139"></a><span class="lineno">18139</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordFlushAllocation(</div>
-<div class="line"><a name="l18140"></a><span class="lineno">18140</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18141"></a><span class="lineno">18141</span>&#160;            allocation, offset, size);</div>
-<div class="line"><a name="l18142"></a><span class="lineno">18142</span>&#160;    }</div>
-<div class="line"><a name="l18143"></a><span class="lineno">18143</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l18144"></a><span class="lineno">18144</span>&#160;}</div>
-<div class="line"><a name="l18145"></a><span class="lineno">18145</span>&#160; </div>
-<div class="line"><a name="l18146"></a><span class="lineno">18146</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006">vmaInvalidateAllocation</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</div>
-<div class="line"><a name="l18147"></a><span class="lineno">18147</span>&#160;{</div>
-<div class="line"><a name="l18148"></a><span class="lineno">18148</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
+<div class="line"><a name="l18114"></a><span class="lineno">18114</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaAllocateMemoryForBuffer&quot;</span>);</div>
+<div class="line"><a name="l18115"></a><span class="lineno">18115</span>&#160; </div>
+<div class="line"><a name="l18116"></a><span class="lineno">18116</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18117"></a><span class="lineno">18117</span>&#160; </div>
+<div class="line"><a name="l18118"></a><span class="lineno">18118</span>&#160;    VkMemoryRequirements vkMemReq = {};</div>
+<div class="line"><a name="l18119"></a><span class="lineno">18119</span>&#160;    <span class="keywordtype">bool</span> requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l18120"></a><span class="lineno">18120</span>&#160;    <span class="keywordtype">bool</span> prefersDedicatedAllocation = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l18121"></a><span class="lineno">18121</span>&#160;    allocator-&gt;GetBufferMemoryRequirements(buffer, vkMemReq,</div>
+<div class="line"><a name="l18122"></a><span class="lineno">18122</span>&#160;        requiresDedicatedAllocation,</div>
+<div class="line"><a name="l18123"></a><span class="lineno">18123</span>&#160;        prefersDedicatedAllocation);</div>
+<div class="line"><a name="l18124"></a><span class="lineno">18124</span>&#160; </div>
+<div class="line"><a name="l18125"></a><span class="lineno">18125</span>&#160;    VkResult result = allocator-&gt;AllocateMemory(</div>
+<div class="line"><a name="l18126"></a><span class="lineno">18126</span>&#160;        vkMemReq,</div>
+<div class="line"><a name="l18127"></a><span class="lineno">18127</span>&#160;        requiresDedicatedAllocation,</div>
+<div class="line"><a name="l18128"></a><span class="lineno">18128</span>&#160;        prefersDedicatedAllocation,</div>
+<div class="line"><a name="l18129"></a><span class="lineno">18129</span>&#160;        buffer, <span class="comment">// dedicatedBuffer</span></div>
+<div class="line"><a name="l18130"></a><span class="lineno">18130</span>&#160;        UINT32_MAX, <span class="comment">// dedicatedBufferUsage</span></div>
+<div class="line"><a name="l18131"></a><span class="lineno">18131</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedImage</span></div>
+<div class="line"><a name="l18132"></a><span class="lineno">18132</span>&#160;        *pCreateInfo,</div>
+<div class="line"><a name="l18133"></a><span class="lineno">18133</span>&#160;        VMA_SUBALLOCATION_TYPE_BUFFER,</div>
+<div class="line"><a name="l18134"></a><span class="lineno">18134</span>&#160;        1, <span class="comment">// allocationCount</span></div>
+<div class="line"><a name="l18135"></a><span class="lineno">18135</span>&#160;        pAllocation);</div>
+<div class="line"><a name="l18136"></a><span class="lineno">18136</span>&#160; </div>
+<div class="line"><a name="l18137"></a><span class="lineno">18137</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18138"></a><span class="lineno">18138</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18139"></a><span class="lineno">18139</span>&#160;    {</div>
+<div class="line"><a name="l18140"></a><span class="lineno">18140</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordAllocateMemoryForBuffer(</div>
+<div class="line"><a name="l18141"></a><span class="lineno">18141</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18142"></a><span class="lineno">18142</span>&#160;            vkMemReq,</div>
+<div class="line"><a name="l18143"></a><span class="lineno">18143</span>&#160;            requiresDedicatedAllocation,</div>
+<div class="line"><a name="l18144"></a><span class="lineno">18144</span>&#160;            prefersDedicatedAllocation,</div>
+<div class="line"><a name="l18145"></a><span class="lineno">18145</span>&#160;            *pCreateInfo,</div>
+<div class="line"><a name="l18146"></a><span class="lineno">18146</span>&#160;            *pAllocation);</div>
+<div class="line"><a name="l18147"></a><span class="lineno">18147</span>&#160;    }</div>
+<div class="line"><a name="l18148"></a><span class="lineno">18148</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l18149"></a><span class="lineno">18149</span>&#160; </div>
-<div class="line"><a name="l18150"></a><span class="lineno">18150</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaInvalidateAllocation&quot;</span>);</div>
-<div class="line"><a name="l18151"></a><span class="lineno">18151</span>&#160; </div>
-<div class="line"><a name="l18152"></a><span class="lineno">18152</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18153"></a><span class="lineno">18153</span>&#160; </div>
-<div class="line"><a name="l18154"></a><span class="lineno">18154</span>&#160;    allocator-&gt;FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_INVALIDATE);</div>
-<div class="line"><a name="l18155"></a><span class="lineno">18155</span>&#160; </div>
-<div class="line"><a name="l18156"></a><span class="lineno">18156</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18157"></a><span class="lineno">18157</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18158"></a><span class="lineno">18158</span>&#160;    {</div>
-<div class="line"><a name="l18159"></a><span class="lineno">18159</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordInvalidateAllocation(</div>
-<div class="line"><a name="l18160"></a><span class="lineno">18160</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18161"></a><span class="lineno">18161</span>&#160;            allocation, offset, size);</div>
-<div class="line"><a name="l18162"></a><span class="lineno">18162</span>&#160;    }</div>
-<div class="line"><a name="l18163"></a><span class="lineno">18163</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l18164"></a><span class="lineno">18164</span>&#160;}</div>
-<div class="line"><a name="l18165"></a><span class="lineno">18165</span>&#160; </div>
-<div class="line"><a name="l18166"></a><span class="lineno">18166</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98">vmaCheckCorruption</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, uint32_t memoryTypeBits)</div>
-<div class="line"><a name="l18167"></a><span class="lineno">18167</span>&#160;{</div>
-<div class="line"><a name="l18168"></a><span class="lineno">18168</span>&#160;    VMA_ASSERT(allocator);</div>
-<div class="line"><a name="l18169"></a><span class="lineno">18169</span>&#160; </div>
-<div class="line"><a name="l18170"></a><span class="lineno">18170</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCheckCorruption&quot;</span>);</div>
-<div class="line"><a name="l18171"></a><span class="lineno">18171</span>&#160; </div>
-<div class="line"><a name="l18172"></a><span class="lineno">18172</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18173"></a><span class="lineno">18173</span>&#160; </div>
-<div class="line"><a name="l18174"></a><span class="lineno">18174</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;CheckCorruption(memoryTypeBits);</div>
-<div class="line"><a name="l18175"></a><span class="lineno">18175</span>&#160;}</div>
+<div class="line"><a name="l18150"></a><span class="lineno">18150</span>&#160;    <span class="keywordflow">if</span>(pAllocationInfo &amp;&amp; result == VK_SUCCESS)</div>
+<div class="line"><a name="l18151"></a><span class="lineno">18151</span>&#160;    {</div>
+<div class="line"><a name="l18152"></a><span class="lineno">18152</span>&#160;        allocator-&gt;GetAllocationInfo(*pAllocation, pAllocationInfo);</div>
+<div class="line"><a name="l18153"></a><span class="lineno">18153</span>&#160;    }</div>
+<div class="line"><a name="l18154"></a><span class="lineno">18154</span>&#160; </div>
+<div class="line"><a name="l18155"></a><span class="lineno">18155</span>&#160;    <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l18156"></a><span class="lineno">18156</span>&#160;}</div>
+<div class="line"><a name="l18157"></a><span class="lineno">18157</span>&#160; </div>
+<div class="line"><a name="l18158"></a><span class="lineno">18158</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb">vmaAllocateMemoryForImage</a>(</div>
+<div class="line"><a name="l18159"></a><span class="lineno">18159</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18160"></a><span class="lineno">18160</span>&#160;    VkImage image,</div>
+<div class="line"><a name="l18161"></a><span class="lineno">18161</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
+<div class="line"><a name="l18162"></a><span class="lineno">18162</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
+<div class="line"><a name="l18163"></a><span class="lineno">18163</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
+<div class="line"><a name="l18164"></a><span class="lineno">18164</span>&#160;{</div>
+<div class="line"><a name="l18165"></a><span class="lineno">18165</span>&#160;    VMA_ASSERT(allocator &amp;&amp; image != VK_NULL_HANDLE &amp;&amp; pCreateInfo &amp;&amp; pAllocation);</div>
+<div class="line"><a name="l18166"></a><span class="lineno">18166</span>&#160; </div>
+<div class="line"><a name="l18167"></a><span class="lineno">18167</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaAllocateMemoryForImage&quot;</span>);</div>
+<div class="line"><a name="l18168"></a><span class="lineno">18168</span>&#160; </div>
+<div class="line"><a name="l18169"></a><span class="lineno">18169</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18170"></a><span class="lineno">18170</span>&#160; </div>
+<div class="line"><a name="l18171"></a><span class="lineno">18171</span>&#160;    VkMemoryRequirements vkMemReq = {};</div>
+<div class="line"><a name="l18172"></a><span class="lineno">18172</span>&#160;    <span class="keywordtype">bool</span> requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l18173"></a><span class="lineno">18173</span>&#160;    <span class="keywordtype">bool</span> prefersDedicatedAllocation  = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l18174"></a><span class="lineno">18174</span>&#160;    allocator-&gt;GetImageMemoryRequirements(image, vkMemReq,</div>
+<div class="line"><a name="l18175"></a><span class="lineno">18175</span>&#160;        requiresDedicatedAllocation, prefersDedicatedAllocation);</div>
 <div class="line"><a name="l18176"></a><span class="lineno">18176</span>&#160; </div>
-<div class="line"><a name="l18177"></a><span class="lineno">18177</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a9f0f8f56db5f7f57fe4454f465142dac">vmaDefragment</a>(</div>
-<div class="line"><a name="l18178"></a><span class="lineno">18178</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18179"></a><span class="lineno">18179</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations,</div>
-<div class="line"><a name="l18180"></a><span class="lineno">18180</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
-<div class="line"><a name="l18181"></a><span class="lineno">18181</span>&#160;    VkBool32* pAllocationsChanged,</div>
-<div class="line"><a name="l18182"></a><span class="lineno">18182</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a> *pDefragmentationInfo,</div>
-<div class="line"><a name="l18183"></a><span class="lineno">18183</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pDefragmentationStats)</div>
-<div class="line"><a name="l18184"></a><span class="lineno">18184</span>&#160;{</div>
-<div class="line"><a name="l18185"></a><span class="lineno">18185</span>&#160;    <span class="comment">// Deprecated interface, reimplemented using new one.</span></div>
-<div class="line"><a name="l18186"></a><span class="lineno">18186</span>&#160; </div>
-<div class="line"><a name="l18187"></a><span class="lineno">18187</span>&#160;    <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a> info2 = {};</div>
-<div class="line"><a name="l18188"></a><span class="lineno">18188</span>&#160;    info2.<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a> = (uint32_t)allocationCount;</div>
-<div class="line"><a name="l18189"></a><span class="lineno">18189</span>&#160;    info2.<a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a> = pAllocations;</div>
-<div class="line"><a name="l18190"></a><span class="lineno">18190</span>&#160;    info2.<a class="code" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">pAllocationsChanged</a> = pAllocationsChanged;</div>
-<div class="line"><a name="l18191"></a><span class="lineno">18191</span>&#160;    <span class="keywordflow">if</span>(pDefragmentationInfo != VMA_NULL)</div>
-<div class="line"><a name="l18192"></a><span class="lineno">18192</span>&#160;    {</div>
-<div class="line"><a name="l18193"></a><span class="lineno">18193</span>&#160;        info2.<a class="code" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">maxCpuAllocationsToMove</a> = pDefragmentationInfo-&gt;<a class="code" href="struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc">maxAllocationsToMove</a>;</div>
-<div class="line"><a name="l18194"></a><span class="lineno">18194</span>&#160;        info2.<a class="code" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">maxCpuBytesToMove</a> = pDefragmentationInfo-&gt;<a class="code" href="struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d">maxBytesToMove</a>;</div>
-<div class="line"><a name="l18195"></a><span class="lineno">18195</span>&#160;    }</div>
-<div class="line"><a name="l18196"></a><span class="lineno">18196</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l18197"></a><span class="lineno">18197</span>&#160;    {</div>
-<div class="line"><a name="l18198"></a><span class="lineno">18198</span>&#160;        info2.<a class="code" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">maxCpuAllocationsToMove</a> = UINT32_MAX;</div>
-<div class="line"><a name="l18199"></a><span class="lineno">18199</span>&#160;        info2.<a class="code" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">maxCpuBytesToMove</a> = VK_WHOLE_SIZE;</div>
-<div class="line"><a name="l18200"></a><span class="lineno">18200</span>&#160;    }</div>
-<div class="line"><a name="l18201"></a><span class="lineno">18201</span>&#160;    <span class="comment">// info2.flags, maxGpuAllocationsToMove, maxGpuBytesToMove, commandBuffer deliberately left zero.</span></div>
-<div class="line"><a name="l18202"></a><span class="lineno">18202</span>&#160; </div>
-<div class="line"><a name="l18203"></a><span class="lineno">18203</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx;</div>
-<div class="line"><a name="l18204"></a><span class="lineno">18204</span>&#160;    VkResult res = <a class="code" href="vk__mem__alloc_8h.html#a36ba776fd7fd5cb1e9359fdc0d8e6e8a">vmaDefragmentationBegin</a>(allocator, &amp;info2, pDefragmentationStats, &amp;ctx);</div>
-<div class="line"><a name="l18205"></a><span class="lineno">18205</span>&#160;    <span class="keywordflow">if</span>(res == VK_NOT_READY)</div>
-<div class="line"><a name="l18206"></a><span class="lineno">18206</span>&#160;    {</div>
-<div class="line"><a name="l18207"></a><span class="lineno">18207</span>&#160;        res = <a class="code" href="vk__mem__alloc_8h.html#a8774e20e91e245aae959ba63efa15dd2">vmaDefragmentationEnd</a>( allocator, ctx);</div>
-<div class="line"><a name="l18208"></a><span class="lineno">18208</span>&#160;    }</div>
-<div class="line"><a name="l18209"></a><span class="lineno">18209</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l18210"></a><span class="lineno">18210</span>&#160;}</div>
-<div class="line"><a name="l18211"></a><span class="lineno">18211</span>&#160; </div>
-<div class="line"><a name="l18212"></a><span class="lineno">18212</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a36ba776fd7fd5cb1e9359fdc0d8e6e8a">vmaDefragmentationBegin</a>(</div>
-<div class="line"><a name="l18213"></a><span class="lineno">18213</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18214"></a><span class="lineno">18214</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>* pInfo,</div>
-<div class="line"><a name="l18215"></a><span class="lineno">18215</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats,</div>
-<div class="line"><a name="l18216"></a><span class="lineno">18216</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> *pContext)</div>
-<div class="line"><a name="l18217"></a><span class="lineno">18217</span>&#160;{</div>
-<div class="line"><a name="l18218"></a><span class="lineno">18218</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pInfo &amp;&amp; pContext);</div>
-<div class="line"><a name="l18219"></a><span class="lineno">18219</span>&#160; </div>
-<div class="line"><a name="l18220"></a><span class="lineno">18220</span>&#160;    <span class="comment">// Degenerate case: Nothing to defragment.</span></div>
-<div class="line"><a name="l18221"></a><span class="lineno">18221</span>&#160;    <span class="keywordflow">if</span>(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a> == 0 &amp;&amp; pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a> == 0)</div>
-<div class="line"><a name="l18222"></a><span class="lineno">18222</span>&#160;    {</div>
-<div class="line"><a name="l18223"></a><span class="lineno">18223</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l18224"></a><span class="lineno">18224</span>&#160;    }</div>
-<div class="line"><a name="l18225"></a><span class="lineno">18225</span>&#160; </div>
-<div class="line"><a name="l18226"></a><span class="lineno">18226</span>&#160;    VMA_ASSERT(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a> == 0 || pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a> != VMA_NULL);</div>
-<div class="line"><a name="l18227"></a><span class="lineno">18227</span>&#160;    VMA_ASSERT(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a> == 0 || pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">pPools</a> != VMA_NULL);</div>
-<div class="line"><a name="l18228"></a><span class="lineno">18228</span>&#160;    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a>, pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a>));</div>
-<div class="line"><a name="l18229"></a><span class="lineno">18229</span>&#160;    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a>, pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">pPools</a>));</div>
-<div class="line"><a name="l18230"></a><span class="lineno">18230</span>&#160; </div>
-<div class="line"><a name="l18231"></a><span class="lineno">18231</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDefragmentationBegin&quot;</span>);</div>
-<div class="line"><a name="l18232"></a><span class="lineno">18232</span>&#160; </div>
-<div class="line"><a name="l18233"></a><span class="lineno">18233</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18234"></a><span class="lineno">18234</span>&#160; </div>
-<div class="line"><a name="l18235"></a><span class="lineno">18235</span>&#160;    VkResult res = allocator-&gt;DefragmentationBegin(*pInfo, pStats, pContext);</div>
-<div class="line"><a name="l18236"></a><span class="lineno">18236</span>&#160; </div>
-<div class="line"><a name="l18237"></a><span class="lineno">18237</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18238"></a><span class="lineno">18238</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18239"></a><span class="lineno">18239</span>&#160;    {</div>
-<div class="line"><a name="l18240"></a><span class="lineno">18240</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordDefragmentationBegin(</div>
-<div class="line"><a name="l18241"></a><span class="lineno">18241</span>&#160;            allocator-&gt;GetCurrentFrameIndex(), *pInfo, *pContext);</div>
-<div class="line"><a name="l18242"></a><span class="lineno">18242</span>&#160;    }</div>
-<div class="line"><a name="l18243"></a><span class="lineno">18243</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l18244"></a><span class="lineno">18244</span>&#160; </div>
-<div class="line"><a name="l18245"></a><span class="lineno">18245</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l18246"></a><span class="lineno">18246</span>&#160;}</div>
-<div class="line"><a name="l18247"></a><span class="lineno">18247</span>&#160; </div>
-<div class="line"><a name="l18248"></a><span class="lineno">18248</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a8774e20e91e245aae959ba63efa15dd2">vmaDefragmentationEnd</a>(</div>
-<div class="line"><a name="l18249"></a><span class="lineno">18249</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18250"></a><span class="lineno">18250</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context)</div>
-<div class="line"><a name="l18251"></a><span class="lineno">18251</span>&#160;{</div>
-<div class="line"><a name="l18252"></a><span class="lineno">18252</span>&#160;    VMA_ASSERT(allocator);</div>
-<div class="line"><a name="l18253"></a><span class="lineno">18253</span>&#160; </div>
-<div class="line"><a name="l18254"></a><span class="lineno">18254</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDefragmentationEnd&quot;</span>);</div>
-<div class="line"><a name="l18255"></a><span class="lineno">18255</span>&#160; </div>
-<div class="line"><a name="l18256"></a><span class="lineno">18256</span>&#160;    <span class="keywordflow">if</span>(context != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l18177"></a><span class="lineno">18177</span>&#160;    VkResult result = allocator-&gt;AllocateMemory(</div>
+<div class="line"><a name="l18178"></a><span class="lineno">18178</span>&#160;        vkMemReq,</div>
+<div class="line"><a name="l18179"></a><span class="lineno">18179</span>&#160;        requiresDedicatedAllocation,</div>
+<div class="line"><a name="l18180"></a><span class="lineno">18180</span>&#160;        prefersDedicatedAllocation,</div>
+<div class="line"><a name="l18181"></a><span class="lineno">18181</span>&#160;        VK_NULL_HANDLE, <span class="comment">// dedicatedBuffer</span></div>
+<div class="line"><a name="l18182"></a><span class="lineno">18182</span>&#160;        UINT32_MAX, <span class="comment">// dedicatedBufferUsage</span></div>
+<div class="line"><a name="l18183"></a><span class="lineno">18183</span>&#160;        image, <span class="comment">// dedicatedImage</span></div>
+<div class="line"><a name="l18184"></a><span class="lineno">18184</span>&#160;        *pCreateInfo,</div>
+<div class="line"><a name="l18185"></a><span class="lineno">18185</span>&#160;        VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN,</div>
+<div class="line"><a name="l18186"></a><span class="lineno">18186</span>&#160;        1, <span class="comment">// allocationCount</span></div>
+<div class="line"><a name="l18187"></a><span class="lineno">18187</span>&#160;        pAllocation);</div>
+<div class="line"><a name="l18188"></a><span class="lineno">18188</span>&#160; </div>
+<div class="line"><a name="l18189"></a><span class="lineno">18189</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18190"></a><span class="lineno">18190</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18191"></a><span class="lineno">18191</span>&#160;    {</div>
+<div class="line"><a name="l18192"></a><span class="lineno">18192</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordAllocateMemoryForImage(</div>
+<div class="line"><a name="l18193"></a><span class="lineno">18193</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18194"></a><span class="lineno">18194</span>&#160;            vkMemReq,</div>
+<div class="line"><a name="l18195"></a><span class="lineno">18195</span>&#160;            requiresDedicatedAllocation,</div>
+<div class="line"><a name="l18196"></a><span class="lineno">18196</span>&#160;            prefersDedicatedAllocation,</div>
+<div class="line"><a name="l18197"></a><span class="lineno">18197</span>&#160;            *pCreateInfo,</div>
+<div class="line"><a name="l18198"></a><span class="lineno">18198</span>&#160;            *pAllocation);</div>
+<div class="line"><a name="l18199"></a><span class="lineno">18199</span>&#160;    }</div>
+<div class="line"><a name="l18200"></a><span class="lineno">18200</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18201"></a><span class="lineno">18201</span>&#160; </div>
+<div class="line"><a name="l18202"></a><span class="lineno">18202</span>&#160;    <span class="keywordflow">if</span>(pAllocationInfo &amp;&amp; result == VK_SUCCESS)</div>
+<div class="line"><a name="l18203"></a><span class="lineno">18203</span>&#160;    {</div>
+<div class="line"><a name="l18204"></a><span class="lineno">18204</span>&#160;        allocator-&gt;GetAllocationInfo(*pAllocation, pAllocationInfo);</div>
+<div class="line"><a name="l18205"></a><span class="lineno">18205</span>&#160;    }</div>
+<div class="line"><a name="l18206"></a><span class="lineno">18206</span>&#160; </div>
+<div class="line"><a name="l18207"></a><span class="lineno">18207</span>&#160;    <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l18208"></a><span class="lineno">18208</span>&#160;}</div>
+<div class="line"><a name="l18209"></a><span class="lineno">18209</span>&#160; </div>
+<div class="line"><a name="l18210"></a><span class="lineno">18210</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5fea5518972ae9094b1526cbcb19b05f">vmaFreeMemory</a>(</div>
+<div class="line"><a name="l18211"></a><span class="lineno">18211</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18212"></a><span class="lineno">18212</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l18213"></a><span class="lineno">18213</span>&#160;{</div>
+<div class="line"><a name="l18214"></a><span class="lineno">18214</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l18215"></a><span class="lineno">18215</span>&#160;    </div>
+<div class="line"><a name="l18216"></a><span class="lineno">18216</span>&#160;    <span class="keywordflow">if</span>(allocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l18217"></a><span class="lineno">18217</span>&#160;    {</div>
+<div class="line"><a name="l18218"></a><span class="lineno">18218</span>&#160;        <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l18219"></a><span class="lineno">18219</span>&#160;    }</div>
+<div class="line"><a name="l18220"></a><span class="lineno">18220</span>&#160;    </div>
+<div class="line"><a name="l18221"></a><span class="lineno">18221</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaFreeMemory&quot;</span>);</div>
+<div class="line"><a name="l18222"></a><span class="lineno">18222</span>&#160;    </div>
+<div class="line"><a name="l18223"></a><span class="lineno">18223</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18224"></a><span class="lineno">18224</span>&#160; </div>
+<div class="line"><a name="l18225"></a><span class="lineno">18225</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18226"></a><span class="lineno">18226</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18227"></a><span class="lineno">18227</span>&#160;    {</div>
+<div class="line"><a name="l18228"></a><span class="lineno">18228</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordFreeMemory(</div>
+<div class="line"><a name="l18229"></a><span class="lineno">18229</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18230"></a><span class="lineno">18230</span>&#160;            allocation);</div>
+<div class="line"><a name="l18231"></a><span class="lineno">18231</span>&#160;    }</div>
+<div class="line"><a name="l18232"></a><span class="lineno">18232</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18233"></a><span class="lineno">18233</span>&#160;    </div>
+<div class="line"><a name="l18234"></a><span class="lineno">18234</span>&#160;    allocator-&gt;FreeMemory(</div>
+<div class="line"><a name="l18235"></a><span class="lineno">18235</span>&#160;        1, <span class="comment">// allocationCount</span></div>
+<div class="line"><a name="l18236"></a><span class="lineno">18236</span>&#160;        &amp;allocation);</div>
+<div class="line"><a name="l18237"></a><span class="lineno">18237</span>&#160;}</div>
+<div class="line"><a name="l18238"></a><span class="lineno">18238</span>&#160; </div>
+<div class="line"><a name="l18239"></a><span class="lineno">18239</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a834b1e4aef395c0a1d56a28e69a4a17e">vmaFreeMemoryPages</a>(</div>
+<div class="line"><a name="l18240"></a><span class="lineno">18240</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18241"></a><span class="lineno">18241</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l18242"></a><span class="lineno">18242</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations)</div>
+<div class="line"><a name="l18243"></a><span class="lineno">18243</span>&#160;{</div>
+<div class="line"><a name="l18244"></a><span class="lineno">18244</span>&#160;    <span class="keywordflow">if</span>(allocationCount == 0)</div>
+<div class="line"><a name="l18245"></a><span class="lineno">18245</span>&#160;    {</div>
+<div class="line"><a name="l18246"></a><span class="lineno">18246</span>&#160;        <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l18247"></a><span class="lineno">18247</span>&#160;    }</div>
+<div class="line"><a name="l18248"></a><span class="lineno">18248</span>&#160; </div>
+<div class="line"><a name="l18249"></a><span class="lineno">18249</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l18250"></a><span class="lineno">18250</span>&#160;    </div>
+<div class="line"><a name="l18251"></a><span class="lineno">18251</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaFreeMemoryPages&quot;</span>);</div>
+<div class="line"><a name="l18252"></a><span class="lineno">18252</span>&#160;    </div>
+<div class="line"><a name="l18253"></a><span class="lineno">18253</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18254"></a><span class="lineno">18254</span>&#160; </div>
+<div class="line"><a name="l18255"></a><span class="lineno">18255</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18256"></a><span class="lineno">18256</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
 <div class="line"><a name="l18257"></a><span class="lineno">18257</span>&#160;    {</div>
-<div class="line"><a name="l18258"></a><span class="lineno">18258</span>&#160;        VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18259"></a><span class="lineno">18259</span>&#160; </div>
-<div class="line"><a name="l18260"></a><span class="lineno">18260</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18261"></a><span class="lineno">18261</span>&#160;        <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18262"></a><span class="lineno">18262</span>&#160;        {</div>
-<div class="line"><a name="l18263"></a><span class="lineno">18263</span>&#160;            allocator-&gt;GetRecorder()-&gt;RecordDefragmentationEnd(</div>
-<div class="line"><a name="l18264"></a><span class="lineno">18264</span>&#160;                allocator-&gt;GetCurrentFrameIndex(), context);</div>
-<div class="line"><a name="l18265"></a><span class="lineno">18265</span>&#160;        }</div>
-<div class="line"><a name="l18266"></a><span class="lineno">18266</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18258"></a><span class="lineno">18258</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordFreeMemoryPages(</div>
+<div class="line"><a name="l18259"></a><span class="lineno">18259</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18260"></a><span class="lineno">18260</span>&#160;            (uint64_t)allocationCount,</div>
+<div class="line"><a name="l18261"></a><span class="lineno">18261</span>&#160;            pAllocations);</div>
+<div class="line"><a name="l18262"></a><span class="lineno">18262</span>&#160;    }</div>
+<div class="line"><a name="l18263"></a><span class="lineno">18263</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18264"></a><span class="lineno">18264</span>&#160;    </div>
+<div class="line"><a name="l18265"></a><span class="lineno">18265</span>&#160;    allocator-&gt;FreeMemory(allocationCount, pAllocations);</div>
+<div class="line"><a name="l18266"></a><span class="lineno">18266</span>&#160;}</div>
 <div class="line"><a name="l18267"></a><span class="lineno">18267</span>&#160; </div>
-<div class="line"><a name="l18268"></a><span class="lineno">18268</span>&#160;        <span class="keywordflow">return</span> allocator-&gt;DefragmentationEnd(context);</div>
-<div class="line"><a name="l18269"></a><span class="lineno">18269</span>&#160;    }</div>
-<div class="line"><a name="l18270"></a><span class="lineno">18270</span>&#160;    <span class="keywordflow">else</span></div>
-<div class="line"><a name="l18271"></a><span class="lineno">18271</span>&#160;    {</div>
-<div class="line"><a name="l18272"></a><span class="lineno">18272</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l18273"></a><span class="lineno">18273</span>&#160;    }</div>
-<div class="line"><a name="l18274"></a><span class="lineno">18274</span>&#160;}</div>
-<div class="line"><a name="l18275"></a><span class="lineno">18275</span>&#160; </div>
-<div class="line"><a name="l18276"></a><span class="lineno">18276</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ac0f01545b6262f7d4d128fc8f8e5c77b">vmaBeginDefragmentationPass</a>(</div>
-<div class="line"><a name="l18277"></a><span class="lineno">18277</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18278"></a><span class="lineno">18278</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context,</div>
-<div class="line"><a name="l18279"></a><span class="lineno">18279</span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* pInfo</div>
-<div class="line"><a name="l18280"></a><span class="lineno">18280</span>&#160;    )</div>
-<div class="line"><a name="l18281"></a><span class="lineno">18281</span>&#160;{</div>
-<div class="line"><a name="l18282"></a><span class="lineno">18282</span>&#160;    VMA_ASSERT(allocator);</div>
-<div class="line"><a name="l18283"></a><span class="lineno">18283</span>&#160;    VMA_ASSERT(pInfo);</div>
-<div class="line"><a name="l18284"></a><span class="lineno">18284</span>&#160;    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a>, pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792">pMoves</a>));</div>
-<div class="line"><a name="l18285"></a><span class="lineno">18285</span>&#160; </div>
-<div class="line"><a name="l18286"></a><span class="lineno">18286</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaBeginDefragmentationPass&quot;</span>);</div>
-<div class="line"><a name="l18287"></a><span class="lineno">18287</span>&#160; </div>
-<div class="line"><a name="l18288"></a><span class="lineno">18288</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18289"></a><span class="lineno">18289</span>&#160; </div>
-<div class="line"><a name="l18290"></a><span class="lineno">18290</span>&#160;    <span class="keywordflow">if</span>(context == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l18291"></a><span class="lineno">18291</span>&#160;    {</div>
-<div class="line"><a name="l18292"></a><span class="lineno">18292</span>&#160;        pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a> = 0;</div>
-<div class="line"><a name="l18293"></a><span class="lineno">18293</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l18294"></a><span class="lineno">18294</span>&#160;    }</div>
-<div class="line"><a name="l18295"></a><span class="lineno">18295</span>&#160; </div>
-<div class="line"><a name="l18296"></a><span class="lineno">18296</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;DefragmentationPassBegin(pInfo, context);</div>
-<div class="line"><a name="l18297"></a><span class="lineno">18297</span>&#160;}</div>
-<div class="line"><a name="l18298"></a><span class="lineno">18298</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a1b9ffa538bed905af55c747cc48963bd">vmaEndDefragmentationPass</a>(</div>
-<div class="line"><a name="l18299"></a><span class="lineno">18299</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18300"></a><span class="lineno">18300</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context)</div>
-<div class="line"><a name="l18301"></a><span class="lineno">18301</span>&#160;{</div>
-<div class="line"><a name="l18302"></a><span class="lineno">18302</span>&#160;    VMA_ASSERT(allocator);</div>
-<div class="line"><a name="l18303"></a><span class="lineno">18303</span>&#160; </div>
-<div class="line"><a name="l18304"></a><span class="lineno">18304</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaEndDefragmentationPass&quot;</span>);</div>
-<div class="line"><a name="l18305"></a><span class="lineno">18305</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18306"></a><span class="lineno">18306</span>&#160; </div>
-<div class="line"><a name="l18307"></a><span class="lineno">18307</span>&#160;    <span class="keywordflow">if</span>(context == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l18308"></a><span class="lineno">18308</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l18309"></a><span class="lineno">18309</span>&#160; </div>
-<div class="line"><a name="l18310"></a><span class="lineno">18310</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;DefragmentationPassEnd(context);</div>
-<div class="line"><a name="l18311"></a><span class="lineno">18311</span>&#160;}</div>
-<div class="line"><a name="l18312"></a><span class="lineno">18312</span>&#160; </div>
-<div class="line"><a name="l18313"></a><span class="lineno">18313</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470">vmaBindBufferMemory</a>(</div>
-<div class="line"><a name="l18314"></a><span class="lineno">18314</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18315"></a><span class="lineno">18315</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
-<div class="line"><a name="l18316"></a><span class="lineno">18316</span>&#160;    VkBuffer buffer)</div>
-<div class="line"><a name="l18317"></a><span class="lineno">18317</span>&#160;{</div>
-<div class="line"><a name="l18318"></a><span class="lineno">18318</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; buffer);</div>
+<div class="line"><a name="l18268"></a><span class="lineno">18268</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0ff488958ca72b28e545880463cb8696">vmaResizeAllocation</a>(</div>
+<div class="line"><a name="l18269"></a><span class="lineno">18269</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18270"></a><span class="lineno">18270</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l18271"></a><span class="lineno">18271</span>&#160;    VkDeviceSize newSize)</div>
+<div class="line"><a name="l18272"></a><span class="lineno">18272</span>&#160;{</div>
+<div class="line"><a name="l18273"></a><span class="lineno">18273</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
+<div class="line"><a name="l18274"></a><span class="lineno">18274</span>&#160;    </div>
+<div class="line"><a name="l18275"></a><span class="lineno">18275</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaResizeAllocation&quot;</span>);</div>
+<div class="line"><a name="l18276"></a><span class="lineno">18276</span>&#160;    </div>
+<div class="line"><a name="l18277"></a><span class="lineno">18277</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18278"></a><span class="lineno">18278</span>&#160; </div>
+<div class="line"><a name="l18279"></a><span class="lineno">18279</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;ResizeAllocation(allocation, newSize);</div>
+<div class="line"><a name="l18280"></a><span class="lineno">18280</span>&#160;}</div>
+<div class="line"><a name="l18281"></a><span class="lineno">18281</span>&#160; </div>
+<div class="line"><a name="l18282"></a><span class="lineno">18282</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a>(</div>
+<div class="line"><a name="l18283"></a><span class="lineno">18283</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18284"></a><span class="lineno">18284</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l18285"></a><span class="lineno">18285</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
+<div class="line"><a name="l18286"></a><span class="lineno">18286</span>&#160;{</div>
+<div class="line"><a name="l18287"></a><span class="lineno">18287</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; pAllocationInfo);</div>
+<div class="line"><a name="l18288"></a><span class="lineno">18288</span>&#160; </div>
+<div class="line"><a name="l18289"></a><span class="lineno">18289</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18290"></a><span class="lineno">18290</span>&#160; </div>
+<div class="line"><a name="l18291"></a><span class="lineno">18291</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18292"></a><span class="lineno">18292</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18293"></a><span class="lineno">18293</span>&#160;    {</div>
+<div class="line"><a name="l18294"></a><span class="lineno">18294</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordGetAllocationInfo(</div>
+<div class="line"><a name="l18295"></a><span class="lineno">18295</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18296"></a><span class="lineno">18296</span>&#160;            allocation);</div>
+<div class="line"><a name="l18297"></a><span class="lineno">18297</span>&#160;    }</div>
+<div class="line"><a name="l18298"></a><span class="lineno">18298</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18299"></a><span class="lineno">18299</span>&#160; </div>
+<div class="line"><a name="l18300"></a><span class="lineno">18300</span>&#160;    allocator-&gt;GetAllocationInfo(allocation, pAllocationInfo);</div>
+<div class="line"><a name="l18301"></a><span class="lineno">18301</span>&#160;}</div>
+<div class="line"><a name="l18302"></a><span class="lineno">18302</span>&#160; </div>
+<div class="line"><a name="l18303"></a><span class="lineno">18303</span>&#160;VMA_CALL_PRE VkBool32 VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a">vmaTouchAllocation</a>(</div>
+<div class="line"><a name="l18304"></a><span class="lineno">18304</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18305"></a><span class="lineno">18305</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l18306"></a><span class="lineno">18306</span>&#160;{</div>
+<div class="line"><a name="l18307"></a><span class="lineno">18307</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
+<div class="line"><a name="l18308"></a><span class="lineno">18308</span>&#160; </div>
+<div class="line"><a name="l18309"></a><span class="lineno">18309</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18310"></a><span class="lineno">18310</span>&#160; </div>
+<div class="line"><a name="l18311"></a><span class="lineno">18311</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18312"></a><span class="lineno">18312</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18313"></a><span class="lineno">18313</span>&#160;    {</div>
+<div class="line"><a name="l18314"></a><span class="lineno">18314</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordTouchAllocation(</div>
+<div class="line"><a name="l18315"></a><span class="lineno">18315</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18316"></a><span class="lineno">18316</span>&#160;            allocation);</div>
+<div class="line"><a name="l18317"></a><span class="lineno">18317</span>&#160;    }</div>
+<div class="line"><a name="l18318"></a><span class="lineno">18318</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l18319"></a><span class="lineno">18319</span>&#160; </div>
-<div class="line"><a name="l18320"></a><span class="lineno">18320</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaBindBufferMemory&quot;</span>);</div>
-<div class="line"><a name="l18321"></a><span class="lineno">18321</span>&#160; </div>
-<div class="line"><a name="l18322"></a><span class="lineno">18322</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18323"></a><span class="lineno">18323</span>&#160; </div>
-<div class="line"><a name="l18324"></a><span class="lineno">18324</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;BindBufferMemory(allocation, 0, buffer, VMA_NULL);</div>
-<div class="line"><a name="l18325"></a><span class="lineno">18325</span>&#160;}</div>
-<div class="line"><a name="l18326"></a><span class="lineno">18326</span>&#160; </div>
-<div class="line"><a name="l18327"></a><span class="lineno">18327</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a">vmaBindBufferMemory2</a>(</div>
-<div class="line"><a name="l18328"></a><span class="lineno">18328</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18329"></a><span class="lineno">18329</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
-<div class="line"><a name="l18330"></a><span class="lineno">18330</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l18331"></a><span class="lineno">18331</span>&#160;    VkBuffer buffer,</div>
-<div class="line"><a name="l18332"></a><span class="lineno">18332</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
-<div class="line"><a name="l18333"></a><span class="lineno">18333</span>&#160;{</div>
-<div class="line"><a name="l18334"></a><span class="lineno">18334</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; buffer);</div>
-<div class="line"><a name="l18335"></a><span class="lineno">18335</span>&#160; </div>
-<div class="line"><a name="l18336"></a><span class="lineno">18336</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaBindBufferMemory2&quot;</span>);</div>
-<div class="line"><a name="l18337"></a><span class="lineno">18337</span>&#160; </div>
-<div class="line"><a name="l18338"></a><span class="lineno">18338</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18339"></a><span class="lineno">18339</span>&#160; </div>
-<div class="line"><a name="l18340"></a><span class="lineno">18340</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;BindBufferMemory(allocation, allocationLocalOffset, buffer, pNext);</div>
-<div class="line"><a name="l18341"></a><span class="lineno">18341</span>&#160;}</div>
-<div class="line"><a name="l18342"></a><span class="lineno">18342</span>&#160; </div>
-<div class="line"><a name="l18343"></a><span class="lineno">18343</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5">vmaBindImageMemory</a>(</div>
-<div class="line"><a name="l18344"></a><span class="lineno">18344</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18345"></a><span class="lineno">18345</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
-<div class="line"><a name="l18346"></a><span class="lineno">18346</span>&#160;    VkImage image)</div>
-<div class="line"><a name="l18347"></a><span class="lineno">18347</span>&#160;{</div>
-<div class="line"><a name="l18348"></a><span class="lineno">18348</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; image);</div>
-<div class="line"><a name="l18349"></a><span class="lineno">18349</span>&#160; </div>
-<div class="line"><a name="l18350"></a><span class="lineno">18350</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaBindImageMemory&quot;</span>);</div>
-<div class="line"><a name="l18351"></a><span class="lineno">18351</span>&#160; </div>
-<div class="line"><a name="l18352"></a><span class="lineno">18352</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18353"></a><span class="lineno">18353</span>&#160; </div>
-<div class="line"><a name="l18354"></a><span class="lineno">18354</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;BindImageMemory(allocation, 0, image, VMA_NULL);</div>
-<div class="line"><a name="l18355"></a><span class="lineno">18355</span>&#160;}</div>
-<div class="line"><a name="l18356"></a><span class="lineno">18356</span>&#160; </div>
-<div class="line"><a name="l18357"></a><span class="lineno">18357</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc">vmaBindImageMemory2</a>(</div>
-<div class="line"><a name="l18358"></a><span class="lineno">18358</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18359"></a><span class="lineno">18359</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
-<div class="line"><a name="l18360"></a><span class="lineno">18360</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
-<div class="line"><a name="l18361"></a><span class="lineno">18361</span>&#160;    VkImage image,</div>
-<div class="line"><a name="l18362"></a><span class="lineno">18362</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
-<div class="line"><a name="l18363"></a><span class="lineno">18363</span>&#160;{</div>
-<div class="line"><a name="l18364"></a><span class="lineno">18364</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; image);</div>
-<div class="line"><a name="l18365"></a><span class="lineno">18365</span>&#160; </div>
-<div class="line"><a name="l18366"></a><span class="lineno">18366</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaBindImageMemory2&quot;</span>);</div>
-<div class="line"><a name="l18367"></a><span class="lineno">18367</span>&#160; </div>
-<div class="line"><a name="l18368"></a><span class="lineno">18368</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18369"></a><span class="lineno">18369</span>&#160; </div>
-<div class="line"><a name="l18370"></a><span class="lineno">18370</span>&#160;        <span class="keywordflow">return</span> allocator-&gt;BindImageMemory(allocation, allocationLocalOffset, image, pNext);</div>
-<div class="line"><a name="l18371"></a><span class="lineno">18371</span>&#160;}</div>
-<div class="line"><a name="l18372"></a><span class="lineno">18372</span>&#160; </div>
-<div class="line"><a name="l18373"></a><span class="lineno">18373</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(</div>
-<div class="line"><a name="l18374"></a><span class="lineno">18374</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18375"></a><span class="lineno">18375</span>&#160;    <span class="keyword">const</span> VkBufferCreateInfo* pBufferCreateInfo,</div>
-<div class="line"><a name="l18376"></a><span class="lineno">18376</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
-<div class="line"><a name="l18377"></a><span class="lineno">18377</span>&#160;    VkBuffer* pBuffer,</div>
-<div class="line"><a name="l18378"></a><span class="lineno">18378</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
-<div class="line"><a name="l18379"></a><span class="lineno">18379</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
-<div class="line"><a name="l18380"></a><span class="lineno">18380</span>&#160;{</div>
-<div class="line"><a name="l18381"></a><span class="lineno">18381</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pBufferCreateInfo &amp;&amp; pAllocationCreateInfo &amp;&amp; pBuffer &amp;&amp; pAllocation);</div>
-<div class="line"><a name="l18382"></a><span class="lineno">18382</span>&#160; </div>
-<div class="line"><a name="l18383"></a><span class="lineno">18383</span>&#160;    <span class="keywordflow">if</span>(pBufferCreateInfo-&gt;size == 0)</div>
-<div class="line"><a name="l18384"></a><span class="lineno">18384</span>&#160;    {</div>
-<div class="line"><a name="l18385"></a><span class="lineno">18385</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
-<div class="line"><a name="l18386"></a><span class="lineno">18386</span>&#160;    }</div>
-<div class="line"><a name="l18387"></a><span class="lineno">18387</span>&#160;    <span class="keywordflow">if</span>((pBufferCreateInfo-&gt;usage &amp; VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_COPY) != 0 &amp;&amp;</div>
-<div class="line"><a name="l18388"></a><span class="lineno">18388</span>&#160;        !allocator-&gt;m_UseKhrBufferDeviceAddress)</div>
-<div class="line"><a name="l18389"></a><span class="lineno">18389</span>&#160;    {</div>
-<div class="line"><a name="l18390"></a><span class="lineno">18390</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Creating a buffer with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT is not valid if VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT was not used.&quot;</span>);</div>
-<div class="line"><a name="l18391"></a><span class="lineno">18391</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
-<div class="line"><a name="l18392"></a><span class="lineno">18392</span>&#160;    }</div>
-<div class="line"><a name="l18393"></a><span class="lineno">18393</span>&#160;    </div>
-<div class="line"><a name="l18394"></a><span class="lineno">18394</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCreateBuffer&quot;</span>);</div>
-<div class="line"><a name="l18395"></a><span class="lineno">18395</span>&#160;    </div>
-<div class="line"><a name="l18396"></a><span class="lineno">18396</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18397"></a><span class="lineno">18397</span>&#160; </div>
-<div class="line"><a name="l18398"></a><span class="lineno">18398</span>&#160;    *pBuffer = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l18399"></a><span class="lineno">18399</span>&#160;    *pAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l18400"></a><span class="lineno">18400</span>&#160; </div>
-<div class="line"><a name="l18401"></a><span class="lineno">18401</span>&#160;    <span class="comment">// 1. Create VkBuffer.</span></div>
-<div class="line"><a name="l18402"></a><span class="lineno">18402</span>&#160;    VkResult res = (*allocator-&gt;GetVulkanFunctions().vkCreateBuffer)(</div>
-<div class="line"><a name="l18403"></a><span class="lineno">18403</span>&#160;        allocator-&gt;m_hDevice,</div>
-<div class="line"><a name="l18404"></a><span class="lineno">18404</span>&#160;        pBufferCreateInfo,</div>
-<div class="line"><a name="l18405"></a><span class="lineno">18405</span>&#160;        allocator-&gt;GetAllocationCallbacks(),</div>
-<div class="line"><a name="l18406"></a><span class="lineno">18406</span>&#160;        pBuffer);</div>
-<div class="line"><a name="l18407"></a><span class="lineno">18407</span>&#160;    <span class="keywordflow">if</span>(res &gt;= 0)</div>
-<div class="line"><a name="l18408"></a><span class="lineno">18408</span>&#160;    {</div>
-<div class="line"><a name="l18409"></a><span class="lineno">18409</span>&#160;        <span class="comment">// 2. vkGetBufferMemoryRequirements.</span></div>
-<div class="line"><a name="l18410"></a><span class="lineno">18410</span>&#160;        VkMemoryRequirements vkMemReq = {};</div>
-<div class="line"><a name="l18411"></a><span class="lineno">18411</span>&#160;        <span class="keywordtype">bool</span> requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l18412"></a><span class="lineno">18412</span>&#160;        <span class="keywordtype">bool</span> prefersDedicatedAllocation  = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l18413"></a><span class="lineno">18413</span>&#160;        allocator-&gt;GetBufferMemoryRequirements(*pBuffer, vkMemReq,</div>
-<div class="line"><a name="l18414"></a><span class="lineno">18414</span>&#160;            requiresDedicatedAllocation, prefersDedicatedAllocation);</div>
+<div class="line"><a name="l18320"></a><span class="lineno">18320</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;TouchAllocation(allocation);</div>
+<div class="line"><a name="l18321"></a><span class="lineno">18321</span>&#160;}</div>
+<div class="line"><a name="l18322"></a><span class="lineno">18322</span>&#160; </div>
+<div class="line"><a name="l18323"></a><span class="lineno">18323</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f">vmaSetAllocationUserData</a>(</div>
+<div class="line"><a name="l18324"></a><span class="lineno">18324</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18325"></a><span class="lineno">18325</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l18326"></a><span class="lineno">18326</span>&#160;    <span class="keywordtype">void</span>* pUserData)</div>
+<div class="line"><a name="l18327"></a><span class="lineno">18327</span>&#160;{</div>
+<div class="line"><a name="l18328"></a><span class="lineno">18328</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
+<div class="line"><a name="l18329"></a><span class="lineno">18329</span>&#160; </div>
+<div class="line"><a name="l18330"></a><span class="lineno">18330</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18331"></a><span class="lineno">18331</span>&#160; </div>
+<div class="line"><a name="l18332"></a><span class="lineno">18332</span>&#160;    allocation-&gt;SetUserData(allocator, pUserData);</div>
+<div class="line"><a name="l18333"></a><span class="lineno">18333</span>&#160; </div>
+<div class="line"><a name="l18334"></a><span class="lineno">18334</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18335"></a><span class="lineno">18335</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18336"></a><span class="lineno">18336</span>&#160;    {</div>
+<div class="line"><a name="l18337"></a><span class="lineno">18337</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordSetAllocationUserData(</div>
+<div class="line"><a name="l18338"></a><span class="lineno">18338</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18339"></a><span class="lineno">18339</span>&#160;            allocation,</div>
+<div class="line"><a name="l18340"></a><span class="lineno">18340</span>&#160;            pUserData);</div>
+<div class="line"><a name="l18341"></a><span class="lineno">18341</span>&#160;    }</div>
+<div class="line"><a name="l18342"></a><span class="lineno">18342</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18343"></a><span class="lineno">18343</span>&#160;}</div>
+<div class="line"><a name="l18344"></a><span class="lineno">18344</span>&#160; </div>
+<div class="line"><a name="l18345"></a><span class="lineno">18345</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae5c9657d9e94756269145b01c05d16f1">vmaCreateLostAllocation</a>(</div>
+<div class="line"><a name="l18346"></a><span class="lineno">18346</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18347"></a><span class="lineno">18347</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation)</div>
+<div class="line"><a name="l18348"></a><span class="lineno">18348</span>&#160;{</div>
+<div class="line"><a name="l18349"></a><span class="lineno">18349</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pAllocation);</div>
+<div class="line"><a name="l18350"></a><span class="lineno">18350</span>&#160; </div>
+<div class="line"><a name="l18351"></a><span class="lineno">18351</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK;</div>
+<div class="line"><a name="l18352"></a><span class="lineno">18352</span>&#160; </div>
+<div class="line"><a name="l18353"></a><span class="lineno">18353</span>&#160;    allocator-&gt;CreateLostAllocation(pAllocation);</div>
+<div class="line"><a name="l18354"></a><span class="lineno">18354</span>&#160; </div>
+<div class="line"><a name="l18355"></a><span class="lineno">18355</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18356"></a><span class="lineno">18356</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18357"></a><span class="lineno">18357</span>&#160;    {</div>
+<div class="line"><a name="l18358"></a><span class="lineno">18358</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordCreateLostAllocation(</div>
+<div class="line"><a name="l18359"></a><span class="lineno">18359</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18360"></a><span class="lineno">18360</span>&#160;            *pAllocation);</div>
+<div class="line"><a name="l18361"></a><span class="lineno">18361</span>&#160;    }</div>
+<div class="line"><a name="l18362"></a><span class="lineno">18362</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18363"></a><span class="lineno">18363</span>&#160;}</div>
+<div class="line"><a name="l18364"></a><span class="lineno">18364</span>&#160; </div>
+<div class="line"><a name="l18365"></a><span class="lineno">18365</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069">vmaMapMemory</a>(</div>
+<div class="line"><a name="l18366"></a><span class="lineno">18366</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18367"></a><span class="lineno">18367</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l18368"></a><span class="lineno">18368</span>&#160;    <span class="keywordtype">void</span>** ppData)</div>
+<div class="line"><a name="l18369"></a><span class="lineno">18369</span>&#160;{</div>
+<div class="line"><a name="l18370"></a><span class="lineno">18370</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; ppData);</div>
+<div class="line"><a name="l18371"></a><span class="lineno">18371</span>&#160; </div>
+<div class="line"><a name="l18372"></a><span class="lineno">18372</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18373"></a><span class="lineno">18373</span>&#160; </div>
+<div class="line"><a name="l18374"></a><span class="lineno">18374</span>&#160;    VkResult res = allocator-&gt;Map(allocation, ppData);</div>
+<div class="line"><a name="l18375"></a><span class="lineno">18375</span>&#160; </div>
+<div class="line"><a name="l18376"></a><span class="lineno">18376</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18377"></a><span class="lineno">18377</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18378"></a><span class="lineno">18378</span>&#160;    {</div>
+<div class="line"><a name="l18379"></a><span class="lineno">18379</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordMapMemory(</div>
+<div class="line"><a name="l18380"></a><span class="lineno">18380</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18381"></a><span class="lineno">18381</span>&#160;            allocation);</div>
+<div class="line"><a name="l18382"></a><span class="lineno">18382</span>&#160;    }</div>
+<div class="line"><a name="l18383"></a><span class="lineno">18383</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18384"></a><span class="lineno">18384</span>&#160; </div>
+<div class="line"><a name="l18385"></a><span class="lineno">18385</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18386"></a><span class="lineno">18386</span>&#160;}</div>
+<div class="line"><a name="l18387"></a><span class="lineno">18387</span>&#160; </div>
+<div class="line"><a name="l18388"></a><span class="lineno">18388</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45">vmaUnmapMemory</a>(</div>
+<div class="line"><a name="l18389"></a><span class="lineno">18389</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18390"></a><span class="lineno">18390</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l18391"></a><span class="lineno">18391</span>&#160;{</div>
+<div class="line"><a name="l18392"></a><span class="lineno">18392</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
+<div class="line"><a name="l18393"></a><span class="lineno">18393</span>&#160; </div>
+<div class="line"><a name="l18394"></a><span class="lineno">18394</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18395"></a><span class="lineno">18395</span>&#160; </div>
+<div class="line"><a name="l18396"></a><span class="lineno">18396</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18397"></a><span class="lineno">18397</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18398"></a><span class="lineno">18398</span>&#160;    {</div>
+<div class="line"><a name="l18399"></a><span class="lineno">18399</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordUnmapMemory(</div>
+<div class="line"><a name="l18400"></a><span class="lineno">18400</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18401"></a><span class="lineno">18401</span>&#160;            allocation);</div>
+<div class="line"><a name="l18402"></a><span class="lineno">18402</span>&#160;    }</div>
+<div class="line"><a name="l18403"></a><span class="lineno">18403</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18404"></a><span class="lineno">18404</span>&#160; </div>
+<div class="line"><a name="l18405"></a><span class="lineno">18405</span>&#160;    allocator-&gt;Unmap(allocation);</div>
+<div class="line"><a name="l18406"></a><span class="lineno">18406</span>&#160;}</div>
+<div class="line"><a name="l18407"></a><span class="lineno">18407</span>&#160; </div>
+<div class="line"><a name="l18408"></a><span class="lineno">18408</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f">vmaFlushAllocation</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</div>
+<div class="line"><a name="l18409"></a><span class="lineno">18409</span>&#160;{</div>
+<div class="line"><a name="l18410"></a><span class="lineno">18410</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
+<div class="line"><a name="l18411"></a><span class="lineno">18411</span>&#160; </div>
+<div class="line"><a name="l18412"></a><span class="lineno">18412</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaFlushAllocation&quot;</span>);</div>
+<div class="line"><a name="l18413"></a><span class="lineno">18413</span>&#160; </div>
+<div class="line"><a name="l18414"></a><span class="lineno">18414</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
 <div class="line"><a name="l18415"></a><span class="lineno">18415</span>&#160; </div>
-<div class="line"><a name="l18416"></a><span class="lineno">18416</span>&#160;        <span class="comment">// 3. Allocate memory using allocator.</span></div>
-<div class="line"><a name="l18417"></a><span class="lineno">18417</span>&#160;        res = allocator-&gt;AllocateMemory(</div>
-<div class="line"><a name="l18418"></a><span class="lineno">18418</span>&#160;            vkMemReq,</div>
-<div class="line"><a name="l18419"></a><span class="lineno">18419</span>&#160;            requiresDedicatedAllocation,</div>
-<div class="line"><a name="l18420"></a><span class="lineno">18420</span>&#160;            prefersDedicatedAllocation,</div>
-<div class="line"><a name="l18421"></a><span class="lineno">18421</span>&#160;            *pBuffer, <span class="comment">// dedicatedBuffer</span></div>
-<div class="line"><a name="l18422"></a><span class="lineno">18422</span>&#160;            pBufferCreateInfo-&gt;usage, <span class="comment">// dedicatedBufferUsage</span></div>
-<div class="line"><a name="l18423"></a><span class="lineno">18423</span>&#160;            VK_NULL_HANDLE, <span class="comment">// dedicatedImage</span></div>
-<div class="line"><a name="l18424"></a><span class="lineno">18424</span>&#160;            *pAllocationCreateInfo,</div>
-<div class="line"><a name="l18425"></a><span class="lineno">18425</span>&#160;            VMA_SUBALLOCATION_TYPE_BUFFER,</div>
-<div class="line"><a name="l18426"></a><span class="lineno">18426</span>&#160;            1, <span class="comment">// allocationCount</span></div>
-<div class="line"><a name="l18427"></a><span class="lineno">18427</span>&#160;            pAllocation);</div>
-<div class="line"><a name="l18428"></a><span class="lineno">18428</span>&#160; </div>
-<div class="line"><a name="l18429"></a><span class="lineno">18429</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18430"></a><span class="lineno">18430</span>&#160;        <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18431"></a><span class="lineno">18431</span>&#160;        {</div>
-<div class="line"><a name="l18432"></a><span class="lineno">18432</span>&#160;            allocator-&gt;GetRecorder()-&gt;RecordCreateBuffer(</div>
-<div class="line"><a name="l18433"></a><span class="lineno">18433</span>&#160;                allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18434"></a><span class="lineno">18434</span>&#160;                *pBufferCreateInfo,</div>
-<div class="line"><a name="l18435"></a><span class="lineno">18435</span>&#160;                *pAllocationCreateInfo,</div>
-<div class="line"><a name="l18436"></a><span class="lineno">18436</span>&#160;                *pAllocation);</div>
-<div class="line"><a name="l18437"></a><span class="lineno">18437</span>&#160;        }</div>
-<div class="line"><a name="l18438"></a><span class="lineno">18438</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18416"></a><span class="lineno">18416</span>&#160;    <span class="keyword">const</span> VkResult res = allocator-&gt;FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_FLUSH);</div>
+<div class="line"><a name="l18417"></a><span class="lineno">18417</span>&#160; </div>
+<div class="line"><a name="l18418"></a><span class="lineno">18418</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18419"></a><span class="lineno">18419</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18420"></a><span class="lineno">18420</span>&#160;    {</div>
+<div class="line"><a name="l18421"></a><span class="lineno">18421</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordFlushAllocation(</div>
+<div class="line"><a name="l18422"></a><span class="lineno">18422</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18423"></a><span class="lineno">18423</span>&#160;            allocation, offset, size);</div>
+<div class="line"><a name="l18424"></a><span class="lineno">18424</span>&#160;    }</div>
+<div class="line"><a name="l18425"></a><span class="lineno">18425</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18426"></a><span class="lineno">18426</span>&#160; </div>
+<div class="line"><a name="l18427"></a><span class="lineno">18427</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18428"></a><span class="lineno">18428</span>&#160;}</div>
+<div class="line"><a name="l18429"></a><span class="lineno">18429</span>&#160; </div>
+<div class="line"><a name="l18430"></a><span class="lineno">18430</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae">vmaInvalidateAllocation</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size)</div>
+<div class="line"><a name="l18431"></a><span class="lineno">18431</span>&#160;{</div>
+<div class="line"><a name="l18432"></a><span class="lineno">18432</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation);</div>
+<div class="line"><a name="l18433"></a><span class="lineno">18433</span>&#160; </div>
+<div class="line"><a name="l18434"></a><span class="lineno">18434</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaInvalidateAllocation&quot;</span>);</div>
+<div class="line"><a name="l18435"></a><span class="lineno">18435</span>&#160; </div>
+<div class="line"><a name="l18436"></a><span class="lineno">18436</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18437"></a><span class="lineno">18437</span>&#160; </div>
+<div class="line"><a name="l18438"></a><span class="lineno">18438</span>&#160;    <span class="keyword">const</span> VkResult res = allocator-&gt;FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_INVALIDATE);</div>
 <div class="line"><a name="l18439"></a><span class="lineno">18439</span>&#160; </div>
-<div class="line"><a name="l18440"></a><span class="lineno">18440</span>&#160;        <span class="keywordflow">if</span>(res &gt;= 0)</div>
-<div class="line"><a name="l18441"></a><span class="lineno">18441</span>&#160;        {</div>
-<div class="line"><a name="l18442"></a><span class="lineno">18442</span>&#160;            <span class="comment">// 3. Bind buffer with memory.</span></div>
-<div class="line"><a name="l18443"></a><span class="lineno">18443</span>&#160;            <span class="keywordflow">if</span>((pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea">VMA_ALLOCATION_CREATE_DONT_BIND_BIT</a>) == 0)</div>
-<div class="line"><a name="l18444"></a><span class="lineno">18444</span>&#160;            {</div>
-<div class="line"><a name="l18445"></a><span class="lineno">18445</span>&#160;                res = allocator-&gt;BindBufferMemory(*pAllocation, 0, *pBuffer, VMA_NULL);</div>
-<div class="line"><a name="l18446"></a><span class="lineno">18446</span>&#160;            }</div>
-<div class="line"><a name="l18447"></a><span class="lineno">18447</span>&#160;            <span class="keywordflow">if</span>(res &gt;= 0)</div>
-<div class="line"><a name="l18448"></a><span class="lineno">18448</span>&#160;            {</div>
-<div class="line"><a name="l18449"></a><span class="lineno">18449</span>&#160;                <span class="comment">// All steps succeeded.</span></div>
-<div class="line"><a name="l18450"></a><span class="lineno">18450</span>&#160;<span class="preprocessor">                #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l18451"></a><span class="lineno">18451</span>&#160;                    (*pAllocation)-&gt;InitBufferImageUsage(pBufferCreateInfo-&gt;usage);</div>
-<div class="line"><a name="l18452"></a><span class="lineno">18452</span>&#160;<span class="preprocessor">                #endif</span></div>
-<div class="line"><a name="l18453"></a><span class="lineno">18453</span>&#160;                <span class="keywordflow">if</span>(pAllocationInfo != VMA_NULL)</div>
-<div class="line"><a name="l18454"></a><span class="lineno">18454</span>&#160;                {</div>
-<div class="line"><a name="l18455"></a><span class="lineno">18455</span>&#160;                    allocator-&gt;GetAllocationInfo(*pAllocation, pAllocationInfo);</div>
-<div class="line"><a name="l18456"></a><span class="lineno">18456</span>&#160;                }</div>
-<div class="line"><a name="l18457"></a><span class="lineno">18457</span>&#160; </div>
-<div class="line"><a name="l18458"></a><span class="lineno">18458</span>&#160;                <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l18459"></a><span class="lineno">18459</span>&#160;            }</div>
-<div class="line"><a name="l18460"></a><span class="lineno">18460</span>&#160;            allocator-&gt;FreeMemory(</div>
-<div class="line"><a name="l18461"></a><span class="lineno">18461</span>&#160;                1, <span class="comment">// allocationCount</span></div>
-<div class="line"><a name="l18462"></a><span class="lineno">18462</span>&#160;                pAllocation);</div>
-<div class="line"><a name="l18463"></a><span class="lineno">18463</span>&#160;            *pAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l18464"></a><span class="lineno">18464</span>&#160;            (*allocator-&gt;GetVulkanFunctions().vkDestroyBuffer)(allocator-&gt;m_hDevice, *pBuffer, allocator-&gt;GetAllocationCallbacks());</div>
-<div class="line"><a name="l18465"></a><span class="lineno">18465</span>&#160;            *pBuffer = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l18466"></a><span class="lineno">18466</span>&#160;            <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l18467"></a><span class="lineno">18467</span>&#160;        }</div>
-<div class="line"><a name="l18468"></a><span class="lineno">18468</span>&#160;        (*allocator-&gt;GetVulkanFunctions().vkDestroyBuffer)(allocator-&gt;m_hDevice, *pBuffer, allocator-&gt;GetAllocationCallbacks());</div>
-<div class="line"><a name="l18469"></a><span class="lineno">18469</span>&#160;        *pBuffer = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l18470"></a><span class="lineno">18470</span>&#160;        <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l18471"></a><span class="lineno">18471</span>&#160;    }</div>
-<div class="line"><a name="l18472"></a><span class="lineno">18472</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l18473"></a><span class="lineno">18473</span>&#160;}</div>
-<div class="line"><a name="l18474"></a><span class="lineno">18474</span>&#160; </div>
-<div class="line"><a name="l18475"></a><span class="lineno">18475</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a>(</div>
-<div class="line"><a name="l18476"></a><span class="lineno">18476</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18477"></a><span class="lineno">18477</span>&#160;    VkBuffer buffer,</div>
-<div class="line"><a name="l18478"></a><span class="lineno">18478</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l18479"></a><span class="lineno">18479</span>&#160;{</div>
-<div class="line"><a name="l18480"></a><span class="lineno">18480</span>&#160;    VMA_ASSERT(allocator);</div>
-<div class="line"><a name="l18481"></a><span class="lineno">18481</span>&#160; </div>
-<div class="line"><a name="l18482"></a><span class="lineno">18482</span>&#160;    <span class="keywordflow">if</span>(buffer == VK_NULL_HANDLE &amp;&amp; allocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l18483"></a><span class="lineno">18483</span>&#160;    {</div>
-<div class="line"><a name="l18484"></a><span class="lineno">18484</span>&#160;        <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l18485"></a><span class="lineno">18485</span>&#160;    }</div>
-<div class="line"><a name="l18486"></a><span class="lineno">18486</span>&#160; </div>
-<div class="line"><a name="l18487"></a><span class="lineno">18487</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDestroyBuffer&quot;</span>);</div>
-<div class="line"><a name="l18488"></a><span class="lineno">18488</span>&#160; </div>
-<div class="line"><a name="l18489"></a><span class="lineno">18489</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18490"></a><span class="lineno">18490</span>&#160; </div>
-<div class="line"><a name="l18491"></a><span class="lineno">18491</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18492"></a><span class="lineno">18492</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18493"></a><span class="lineno">18493</span>&#160;    {</div>
-<div class="line"><a name="l18494"></a><span class="lineno">18494</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordDestroyBuffer(</div>
-<div class="line"><a name="l18495"></a><span class="lineno">18495</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18496"></a><span class="lineno">18496</span>&#160;            allocation);</div>
-<div class="line"><a name="l18497"></a><span class="lineno">18497</span>&#160;    }</div>
-<div class="line"><a name="l18498"></a><span class="lineno">18498</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18440"></a><span class="lineno">18440</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18441"></a><span class="lineno">18441</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18442"></a><span class="lineno">18442</span>&#160;    {</div>
+<div class="line"><a name="l18443"></a><span class="lineno">18443</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordInvalidateAllocation(</div>
+<div class="line"><a name="l18444"></a><span class="lineno">18444</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18445"></a><span class="lineno">18445</span>&#160;            allocation, offset, size);</div>
+<div class="line"><a name="l18446"></a><span class="lineno">18446</span>&#160;    }</div>
+<div class="line"><a name="l18447"></a><span class="lineno">18447</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18448"></a><span class="lineno">18448</span>&#160; </div>
+<div class="line"><a name="l18449"></a><span class="lineno">18449</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18450"></a><span class="lineno">18450</span>&#160;}</div>
+<div class="line"><a name="l18451"></a><span class="lineno">18451</span>&#160; </div>
+<div class="line"><a name="l18452"></a><span class="lineno">18452</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ac3dd00da721875ed99fa8a881922bdfc">vmaFlushAllocations</a>(</div>
+<div class="line"><a name="l18453"></a><span class="lineno">18453</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18454"></a><span class="lineno">18454</span>&#160;    uint32_t allocationCount,</div>
+<div class="line"><a name="l18455"></a><span class="lineno">18455</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* allocations,</div>
+<div class="line"><a name="l18456"></a><span class="lineno">18456</span>&#160;    <span class="keyword">const</span> VkDeviceSize* offsets,</div>
+<div class="line"><a name="l18457"></a><span class="lineno">18457</span>&#160;    <span class="keyword">const</span> VkDeviceSize* sizes)</div>
+<div class="line"><a name="l18458"></a><span class="lineno">18458</span>&#160;{</div>
+<div class="line"><a name="l18459"></a><span class="lineno">18459</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l18460"></a><span class="lineno">18460</span>&#160; </div>
+<div class="line"><a name="l18461"></a><span class="lineno">18461</span>&#160;    <span class="keywordflow">if</span>(allocationCount == 0)</div>
+<div class="line"><a name="l18462"></a><span class="lineno">18462</span>&#160;    {</div>
+<div class="line"><a name="l18463"></a><span class="lineno">18463</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l18464"></a><span class="lineno">18464</span>&#160;    }</div>
+<div class="line"><a name="l18465"></a><span class="lineno">18465</span>&#160; </div>
+<div class="line"><a name="l18466"></a><span class="lineno">18466</span>&#160;    VMA_ASSERT(allocations);</div>
+<div class="line"><a name="l18467"></a><span class="lineno">18467</span>&#160; </div>
+<div class="line"><a name="l18468"></a><span class="lineno">18468</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaFlushAllocations&quot;</span>);</div>
+<div class="line"><a name="l18469"></a><span class="lineno">18469</span>&#160; </div>
+<div class="line"><a name="l18470"></a><span class="lineno">18470</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18471"></a><span class="lineno">18471</span>&#160; </div>
+<div class="line"><a name="l18472"></a><span class="lineno">18472</span>&#160;    <span class="keyword">const</span> VkResult res = allocator-&gt;FlushOrInvalidateAllocations(allocationCount, allocations, offsets, sizes, VMA_CACHE_FLUSH);</div>
+<div class="line"><a name="l18473"></a><span class="lineno">18473</span>&#160; </div>
+<div class="line"><a name="l18474"></a><span class="lineno">18474</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18475"></a><span class="lineno">18475</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18476"></a><span class="lineno">18476</span>&#160;    {</div>
+<div class="line"><a name="l18477"></a><span class="lineno">18477</span>&#160;        <span class="comment">//TODO</span></div>
+<div class="line"><a name="l18478"></a><span class="lineno">18478</span>&#160;    }</div>
+<div class="line"><a name="l18479"></a><span class="lineno">18479</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18480"></a><span class="lineno">18480</span>&#160; </div>
+<div class="line"><a name="l18481"></a><span class="lineno">18481</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18482"></a><span class="lineno">18482</span>&#160;}</div>
+<div class="line"><a name="l18483"></a><span class="lineno">18483</span>&#160; </div>
+<div class="line"><a name="l18484"></a><span class="lineno">18484</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5">vmaInvalidateAllocations</a>(</div>
+<div class="line"><a name="l18485"></a><span class="lineno">18485</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18486"></a><span class="lineno">18486</span>&#160;    uint32_t allocationCount,</div>
+<div class="line"><a name="l18487"></a><span class="lineno">18487</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* allocations,</div>
+<div class="line"><a name="l18488"></a><span class="lineno">18488</span>&#160;    <span class="keyword">const</span> VkDeviceSize* offsets,</div>
+<div class="line"><a name="l18489"></a><span class="lineno">18489</span>&#160;    <span class="keyword">const</span> VkDeviceSize* sizes)</div>
+<div class="line"><a name="l18490"></a><span class="lineno">18490</span>&#160;{</div>
+<div class="line"><a name="l18491"></a><span class="lineno">18491</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l18492"></a><span class="lineno">18492</span>&#160; </div>
+<div class="line"><a name="l18493"></a><span class="lineno">18493</span>&#160;    <span class="keywordflow">if</span>(allocationCount == 0)</div>
+<div class="line"><a name="l18494"></a><span class="lineno">18494</span>&#160;    {</div>
+<div class="line"><a name="l18495"></a><span class="lineno">18495</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l18496"></a><span class="lineno">18496</span>&#160;    }</div>
+<div class="line"><a name="l18497"></a><span class="lineno">18497</span>&#160; </div>
+<div class="line"><a name="l18498"></a><span class="lineno">18498</span>&#160;    VMA_ASSERT(allocations);</div>
 <div class="line"><a name="l18499"></a><span class="lineno">18499</span>&#160; </div>
-<div class="line"><a name="l18500"></a><span class="lineno">18500</span>&#160;    <span class="keywordflow">if</span>(buffer != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l18501"></a><span class="lineno">18501</span>&#160;    {</div>
-<div class="line"><a name="l18502"></a><span class="lineno">18502</span>&#160;        (*allocator-&gt;GetVulkanFunctions().vkDestroyBuffer)(allocator-&gt;m_hDevice, buffer, allocator-&gt;GetAllocationCallbacks());</div>
-<div class="line"><a name="l18503"></a><span class="lineno">18503</span>&#160;    }</div>
-<div class="line"><a name="l18504"></a><span class="lineno">18504</span>&#160; </div>
-<div class="line"><a name="l18505"></a><span class="lineno">18505</span>&#160;    <span class="keywordflow">if</span>(allocation != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l18506"></a><span class="lineno">18506</span>&#160;    {</div>
-<div class="line"><a name="l18507"></a><span class="lineno">18507</span>&#160;        allocator-&gt;FreeMemory(</div>
-<div class="line"><a name="l18508"></a><span class="lineno">18508</span>&#160;            1, <span class="comment">// allocationCount</span></div>
-<div class="line"><a name="l18509"></a><span class="lineno">18509</span>&#160;            &amp;allocation);</div>
+<div class="line"><a name="l18500"></a><span class="lineno">18500</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaInvalidateAllocations&quot;</span>);</div>
+<div class="line"><a name="l18501"></a><span class="lineno">18501</span>&#160; </div>
+<div class="line"><a name="l18502"></a><span class="lineno">18502</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18503"></a><span class="lineno">18503</span>&#160; </div>
+<div class="line"><a name="l18504"></a><span class="lineno">18504</span>&#160;    <span class="keyword">const</span> VkResult res = allocator-&gt;FlushOrInvalidateAllocations(allocationCount, allocations, offsets, sizes, VMA_CACHE_INVALIDATE);</div>
+<div class="line"><a name="l18505"></a><span class="lineno">18505</span>&#160; </div>
+<div class="line"><a name="l18506"></a><span class="lineno">18506</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18507"></a><span class="lineno">18507</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18508"></a><span class="lineno">18508</span>&#160;    {</div>
+<div class="line"><a name="l18509"></a><span class="lineno">18509</span>&#160;        <span class="comment">//TODO</span></div>
 <div class="line"><a name="l18510"></a><span class="lineno">18510</span>&#160;    }</div>
-<div class="line"><a name="l18511"></a><span class="lineno">18511</span>&#160;}</div>
+<div class="line"><a name="l18511"></a><span class="lineno">18511</span>&#160;<span class="preprocessor">#endif</span></div>
 <div class="line"><a name="l18512"></a><span class="lineno">18512</span>&#160; </div>
-<div class="line"><a name="l18513"></a><span class="lineno">18513</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73">vmaCreateImage</a>(</div>
-<div class="line"><a name="l18514"></a><span class="lineno">18514</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18515"></a><span class="lineno">18515</span>&#160;    <span class="keyword">const</span> VkImageCreateInfo* pImageCreateInfo,</div>
-<div class="line"><a name="l18516"></a><span class="lineno">18516</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
-<div class="line"><a name="l18517"></a><span class="lineno">18517</span>&#160;    VkImage* pImage,</div>
-<div class="line"><a name="l18518"></a><span class="lineno">18518</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
-<div class="line"><a name="l18519"></a><span class="lineno">18519</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
-<div class="line"><a name="l18520"></a><span class="lineno">18520</span>&#160;{</div>
-<div class="line"><a name="l18521"></a><span class="lineno">18521</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pImageCreateInfo &amp;&amp; pAllocationCreateInfo &amp;&amp; pImage &amp;&amp; pAllocation);</div>
-<div class="line"><a name="l18522"></a><span class="lineno">18522</span>&#160; </div>
-<div class="line"><a name="l18523"></a><span class="lineno">18523</span>&#160;    <span class="keywordflow">if</span>(pImageCreateInfo-&gt;extent.width == 0 ||</div>
-<div class="line"><a name="l18524"></a><span class="lineno">18524</span>&#160;        pImageCreateInfo-&gt;extent.height == 0 ||</div>
-<div class="line"><a name="l18525"></a><span class="lineno">18525</span>&#160;        pImageCreateInfo-&gt;extent.depth == 0 ||</div>
-<div class="line"><a name="l18526"></a><span class="lineno">18526</span>&#160;        pImageCreateInfo-&gt;mipLevels == 0 ||</div>
-<div class="line"><a name="l18527"></a><span class="lineno">18527</span>&#160;        pImageCreateInfo-&gt;arrayLayers == 0)</div>
-<div class="line"><a name="l18528"></a><span class="lineno">18528</span>&#160;    {</div>
-<div class="line"><a name="l18529"></a><span class="lineno">18529</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
-<div class="line"><a name="l18530"></a><span class="lineno">18530</span>&#160;    }</div>
-<div class="line"><a name="l18531"></a><span class="lineno">18531</span>&#160; </div>
-<div class="line"><a name="l18532"></a><span class="lineno">18532</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCreateImage&quot;</span>);</div>
-<div class="line"><a name="l18533"></a><span class="lineno">18533</span>&#160; </div>
-<div class="line"><a name="l18534"></a><span class="lineno">18534</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18535"></a><span class="lineno">18535</span>&#160; </div>
-<div class="line"><a name="l18536"></a><span class="lineno">18536</span>&#160;    *pImage = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l18537"></a><span class="lineno">18537</span>&#160;    *pAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l18538"></a><span class="lineno">18538</span>&#160; </div>
-<div class="line"><a name="l18539"></a><span class="lineno">18539</span>&#160;    <span class="comment">// 1. Create VkImage.</span></div>
-<div class="line"><a name="l18540"></a><span class="lineno">18540</span>&#160;    VkResult res = (*allocator-&gt;GetVulkanFunctions().vkCreateImage)(</div>
-<div class="line"><a name="l18541"></a><span class="lineno">18541</span>&#160;        allocator-&gt;m_hDevice,</div>
-<div class="line"><a name="l18542"></a><span class="lineno">18542</span>&#160;        pImageCreateInfo,</div>
-<div class="line"><a name="l18543"></a><span class="lineno">18543</span>&#160;        allocator-&gt;GetAllocationCallbacks(),</div>
-<div class="line"><a name="l18544"></a><span class="lineno">18544</span>&#160;        pImage);</div>
-<div class="line"><a name="l18545"></a><span class="lineno">18545</span>&#160;    <span class="keywordflow">if</span>(res &gt;= 0)</div>
-<div class="line"><a name="l18546"></a><span class="lineno">18546</span>&#160;    {</div>
-<div class="line"><a name="l18547"></a><span class="lineno">18547</span>&#160;        VmaSuballocationType suballocType = pImageCreateInfo-&gt;tiling == VK_IMAGE_TILING_OPTIMAL ?</div>
-<div class="line"><a name="l18548"></a><span class="lineno">18548</span>&#160;            VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL :</div>
-<div class="line"><a name="l18549"></a><span class="lineno">18549</span>&#160;            VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR;</div>
-<div class="line"><a name="l18550"></a><span class="lineno">18550</span>&#160;        </div>
-<div class="line"><a name="l18551"></a><span class="lineno">18551</span>&#160;        <span class="comment">// 2. Allocate memory using allocator.</span></div>
-<div class="line"><a name="l18552"></a><span class="lineno">18552</span>&#160;        VkMemoryRequirements vkMemReq = {};</div>
-<div class="line"><a name="l18553"></a><span class="lineno">18553</span>&#160;        <span class="keywordtype">bool</span> requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l18554"></a><span class="lineno">18554</span>&#160;        <span class="keywordtype">bool</span> prefersDedicatedAllocation  = <span class="keyword">false</span>;</div>
-<div class="line"><a name="l18555"></a><span class="lineno">18555</span>&#160;        allocator-&gt;GetImageMemoryRequirements(*pImage, vkMemReq,</div>
-<div class="line"><a name="l18556"></a><span class="lineno">18556</span>&#160;            requiresDedicatedAllocation, prefersDedicatedAllocation);</div>
-<div class="line"><a name="l18557"></a><span class="lineno">18557</span>&#160; </div>
-<div class="line"><a name="l18558"></a><span class="lineno">18558</span>&#160;        res = allocator-&gt;AllocateMemory(</div>
-<div class="line"><a name="l18559"></a><span class="lineno">18559</span>&#160;            vkMemReq,</div>
-<div class="line"><a name="l18560"></a><span class="lineno">18560</span>&#160;            requiresDedicatedAllocation,</div>
-<div class="line"><a name="l18561"></a><span class="lineno">18561</span>&#160;            prefersDedicatedAllocation,</div>
-<div class="line"><a name="l18562"></a><span class="lineno">18562</span>&#160;            VK_NULL_HANDLE, <span class="comment">// dedicatedBuffer</span></div>
-<div class="line"><a name="l18563"></a><span class="lineno">18563</span>&#160;            UINT32_MAX, <span class="comment">// dedicatedBufferUsage</span></div>
-<div class="line"><a name="l18564"></a><span class="lineno">18564</span>&#160;            *pImage, <span class="comment">// dedicatedImage</span></div>
-<div class="line"><a name="l18565"></a><span class="lineno">18565</span>&#160;            *pAllocationCreateInfo,</div>
-<div class="line"><a name="l18566"></a><span class="lineno">18566</span>&#160;            suballocType,</div>
-<div class="line"><a name="l18567"></a><span class="lineno">18567</span>&#160;            1, <span class="comment">// allocationCount</span></div>
-<div class="line"><a name="l18568"></a><span class="lineno">18568</span>&#160;            pAllocation);</div>
+<div class="line"><a name="l18513"></a><span class="lineno">18513</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18514"></a><span class="lineno">18514</span>&#160;}</div>
+<div class="line"><a name="l18515"></a><span class="lineno">18515</span>&#160; </div>
+<div class="line"><a name="l18516"></a><span class="lineno">18516</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98">vmaCheckCorruption</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, uint32_t memoryTypeBits)</div>
+<div class="line"><a name="l18517"></a><span class="lineno">18517</span>&#160;{</div>
+<div class="line"><a name="l18518"></a><span class="lineno">18518</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l18519"></a><span class="lineno">18519</span>&#160; </div>
+<div class="line"><a name="l18520"></a><span class="lineno">18520</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCheckCorruption&quot;</span>);</div>
+<div class="line"><a name="l18521"></a><span class="lineno">18521</span>&#160; </div>
+<div class="line"><a name="l18522"></a><span class="lineno">18522</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18523"></a><span class="lineno">18523</span>&#160; </div>
+<div class="line"><a name="l18524"></a><span class="lineno">18524</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;CheckCorruption(memoryTypeBits);</div>
+<div class="line"><a name="l18525"></a><span class="lineno">18525</span>&#160;}</div>
+<div class="line"><a name="l18526"></a><span class="lineno">18526</span>&#160; </div>
+<div class="line"><a name="l18527"></a><span class="lineno">18527</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a9f0f8f56db5f7f57fe4454f465142dac">vmaDefragment</a>(</div>
+<div class="line"><a name="l18528"></a><span class="lineno">18528</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18529"></a><span class="lineno">18529</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations,</div>
+<div class="line"><a name="l18530"></a><span class="lineno">18530</span>&#160;    <span class="keywordtype">size_t</span> allocationCount,</div>
+<div class="line"><a name="l18531"></a><span class="lineno">18531</span>&#160;    VkBool32* pAllocationsChanged,</div>
+<div class="line"><a name="l18532"></a><span class="lineno">18532</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a> *pDefragmentationInfo,</div>
+<div class="line"><a name="l18533"></a><span class="lineno">18533</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pDefragmentationStats)</div>
+<div class="line"><a name="l18534"></a><span class="lineno">18534</span>&#160;{</div>
+<div class="line"><a name="l18535"></a><span class="lineno">18535</span>&#160;    <span class="comment">// Deprecated interface, reimplemented using new one.</span></div>
+<div class="line"><a name="l18536"></a><span class="lineno">18536</span>&#160; </div>
+<div class="line"><a name="l18537"></a><span class="lineno">18537</span>&#160;    <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a> info2 = {};</div>
+<div class="line"><a name="l18538"></a><span class="lineno">18538</span>&#160;    info2.<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a> = (uint32_t)allocationCount;</div>
+<div class="line"><a name="l18539"></a><span class="lineno">18539</span>&#160;    info2.<a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a> = pAllocations;</div>
+<div class="line"><a name="l18540"></a><span class="lineno">18540</span>&#160;    info2.<a class="code" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">pAllocationsChanged</a> = pAllocationsChanged;</div>
+<div class="line"><a name="l18541"></a><span class="lineno">18541</span>&#160;    <span class="keywordflow">if</span>(pDefragmentationInfo != VMA_NULL)</div>
+<div class="line"><a name="l18542"></a><span class="lineno">18542</span>&#160;    {</div>
+<div class="line"><a name="l18543"></a><span class="lineno">18543</span>&#160;        info2.<a class="code" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">maxCpuAllocationsToMove</a> = pDefragmentationInfo-&gt;<a class="code" href="struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc">maxAllocationsToMove</a>;</div>
+<div class="line"><a name="l18544"></a><span class="lineno">18544</span>&#160;        info2.<a class="code" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">maxCpuBytesToMove</a> = pDefragmentationInfo-&gt;<a class="code" href="struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d">maxBytesToMove</a>;</div>
+<div class="line"><a name="l18545"></a><span class="lineno">18545</span>&#160;    }</div>
+<div class="line"><a name="l18546"></a><span class="lineno">18546</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l18547"></a><span class="lineno">18547</span>&#160;    {</div>
+<div class="line"><a name="l18548"></a><span class="lineno">18548</span>&#160;        info2.<a class="code" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">maxCpuAllocationsToMove</a> = UINT32_MAX;</div>
+<div class="line"><a name="l18549"></a><span class="lineno">18549</span>&#160;        info2.<a class="code" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">maxCpuBytesToMove</a> = VK_WHOLE_SIZE;</div>
+<div class="line"><a name="l18550"></a><span class="lineno">18550</span>&#160;    }</div>
+<div class="line"><a name="l18551"></a><span class="lineno">18551</span>&#160;    <span class="comment">// info2.flags, maxGpuAllocationsToMove, maxGpuBytesToMove, commandBuffer deliberately left zero.</span></div>
+<div class="line"><a name="l18552"></a><span class="lineno">18552</span>&#160; </div>
+<div class="line"><a name="l18553"></a><span class="lineno">18553</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx;</div>
+<div class="line"><a name="l18554"></a><span class="lineno">18554</span>&#160;    VkResult res = <a class="code" href="vk__mem__alloc_8h.html#a36ba776fd7fd5cb1e9359fdc0d8e6e8a">vmaDefragmentationBegin</a>(allocator, &amp;info2, pDefragmentationStats, &amp;ctx);</div>
+<div class="line"><a name="l18555"></a><span class="lineno">18555</span>&#160;    <span class="keywordflow">if</span>(res == VK_NOT_READY)</div>
+<div class="line"><a name="l18556"></a><span class="lineno">18556</span>&#160;    {</div>
+<div class="line"><a name="l18557"></a><span class="lineno">18557</span>&#160;        res = <a class="code" href="vk__mem__alloc_8h.html#a8774e20e91e245aae959ba63efa15dd2">vmaDefragmentationEnd</a>( allocator, ctx);</div>
+<div class="line"><a name="l18558"></a><span class="lineno">18558</span>&#160;    }</div>
+<div class="line"><a name="l18559"></a><span class="lineno">18559</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18560"></a><span class="lineno">18560</span>&#160;}</div>
+<div class="line"><a name="l18561"></a><span class="lineno">18561</span>&#160; </div>
+<div class="line"><a name="l18562"></a><span class="lineno">18562</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a36ba776fd7fd5cb1e9359fdc0d8e6e8a">vmaDefragmentationBegin</a>(</div>
+<div class="line"><a name="l18563"></a><span class="lineno">18563</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18564"></a><span class="lineno">18564</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>* pInfo,</div>
+<div class="line"><a name="l18565"></a><span class="lineno">18565</span>&#160;    <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats,</div>
+<div class="line"><a name="l18566"></a><span class="lineno">18566</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> *pContext)</div>
+<div class="line"><a name="l18567"></a><span class="lineno">18567</span>&#160;{</div>
+<div class="line"><a name="l18568"></a><span class="lineno">18568</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pInfo &amp;&amp; pContext);</div>
 <div class="line"><a name="l18569"></a><span class="lineno">18569</span>&#160; </div>
-<div class="line"><a name="l18570"></a><span class="lineno">18570</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18571"></a><span class="lineno">18571</span>&#160;        <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18572"></a><span class="lineno">18572</span>&#160;        {</div>
-<div class="line"><a name="l18573"></a><span class="lineno">18573</span>&#160;            allocator-&gt;GetRecorder()-&gt;RecordCreateImage(</div>
-<div class="line"><a name="l18574"></a><span class="lineno">18574</span>&#160;                allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18575"></a><span class="lineno">18575</span>&#160;                *pImageCreateInfo,</div>
-<div class="line"><a name="l18576"></a><span class="lineno">18576</span>&#160;                *pAllocationCreateInfo,</div>
-<div class="line"><a name="l18577"></a><span class="lineno">18577</span>&#160;                *pAllocation);</div>
-<div class="line"><a name="l18578"></a><span class="lineno">18578</span>&#160;        }</div>
-<div class="line"><a name="l18579"></a><span class="lineno">18579</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18570"></a><span class="lineno">18570</span>&#160;    <span class="comment">// Degenerate case: Nothing to defragment.</span></div>
+<div class="line"><a name="l18571"></a><span class="lineno">18571</span>&#160;    <span class="keywordflow">if</span>(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a> == 0 &amp;&amp; pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a> == 0)</div>
+<div class="line"><a name="l18572"></a><span class="lineno">18572</span>&#160;    {</div>
+<div class="line"><a name="l18573"></a><span class="lineno">18573</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l18574"></a><span class="lineno">18574</span>&#160;    }</div>
+<div class="line"><a name="l18575"></a><span class="lineno">18575</span>&#160; </div>
+<div class="line"><a name="l18576"></a><span class="lineno">18576</span>&#160;    VMA_ASSERT(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a> == 0 || pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a> != VMA_NULL);</div>
+<div class="line"><a name="l18577"></a><span class="lineno">18577</span>&#160;    VMA_ASSERT(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a> == 0 || pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">pPools</a> != VMA_NULL);</div>
+<div class="line"><a name="l18578"></a><span class="lineno">18578</span>&#160;    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a>, pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">pAllocations</a>));</div>
+<div class="line"><a name="l18579"></a><span class="lineno">18579</span>&#160;    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a>, pInfo-&gt;<a class="code" href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">pPools</a>));</div>
 <div class="line"><a name="l18580"></a><span class="lineno">18580</span>&#160; </div>
-<div class="line"><a name="l18581"></a><span class="lineno">18581</span>&#160;        <span class="keywordflow">if</span>(res &gt;= 0)</div>
-<div class="line"><a name="l18582"></a><span class="lineno">18582</span>&#160;        {</div>
-<div class="line"><a name="l18583"></a><span class="lineno">18583</span>&#160;            <span class="comment">// 3. Bind image with memory.</span></div>
-<div class="line"><a name="l18584"></a><span class="lineno">18584</span>&#160;            <span class="keywordflow">if</span>((pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea">VMA_ALLOCATION_CREATE_DONT_BIND_BIT</a>) == 0)</div>
-<div class="line"><a name="l18585"></a><span class="lineno">18585</span>&#160;            {</div>
-<div class="line"><a name="l18586"></a><span class="lineno">18586</span>&#160;                res = allocator-&gt;BindImageMemory(*pAllocation, 0, *pImage, VMA_NULL);</div>
-<div class="line"><a name="l18587"></a><span class="lineno">18587</span>&#160;            }</div>
-<div class="line"><a name="l18588"></a><span class="lineno">18588</span>&#160;            <span class="keywordflow">if</span>(res &gt;= 0)</div>
-<div class="line"><a name="l18589"></a><span class="lineno">18589</span>&#160;            {</div>
-<div class="line"><a name="l18590"></a><span class="lineno">18590</span>&#160;                <span class="comment">// All steps succeeded.</span></div>
-<div class="line"><a name="l18591"></a><span class="lineno">18591</span>&#160;<span class="preprocessor">                #if VMA_STATS_STRING_ENABLED</span></div>
-<div class="line"><a name="l18592"></a><span class="lineno">18592</span>&#160;                    (*pAllocation)-&gt;InitBufferImageUsage(pImageCreateInfo-&gt;usage);</div>
-<div class="line"><a name="l18593"></a><span class="lineno">18593</span>&#160;<span class="preprocessor">                #endif</span></div>
-<div class="line"><a name="l18594"></a><span class="lineno">18594</span>&#160;                <span class="keywordflow">if</span>(pAllocationInfo != VMA_NULL)</div>
-<div class="line"><a name="l18595"></a><span class="lineno">18595</span>&#160;                {</div>
-<div class="line"><a name="l18596"></a><span class="lineno">18596</span>&#160;                    allocator-&gt;GetAllocationInfo(*pAllocation, pAllocationInfo);</div>
-<div class="line"><a name="l18597"></a><span class="lineno">18597</span>&#160;                }</div>
-<div class="line"><a name="l18598"></a><span class="lineno">18598</span>&#160; </div>
-<div class="line"><a name="l18599"></a><span class="lineno">18599</span>&#160;                <span class="keywordflow">return</span> VK_SUCCESS;</div>
-<div class="line"><a name="l18600"></a><span class="lineno">18600</span>&#160;            }</div>
-<div class="line"><a name="l18601"></a><span class="lineno">18601</span>&#160;            allocator-&gt;FreeMemory(</div>
-<div class="line"><a name="l18602"></a><span class="lineno">18602</span>&#160;                1, <span class="comment">// allocationCount</span></div>
-<div class="line"><a name="l18603"></a><span class="lineno">18603</span>&#160;                pAllocation);</div>
-<div class="line"><a name="l18604"></a><span class="lineno">18604</span>&#160;            *pAllocation = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l18605"></a><span class="lineno">18605</span>&#160;            (*allocator-&gt;GetVulkanFunctions().vkDestroyImage)(allocator-&gt;m_hDevice, *pImage, allocator-&gt;GetAllocationCallbacks());</div>
-<div class="line"><a name="l18606"></a><span class="lineno">18606</span>&#160;            *pImage = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l18607"></a><span class="lineno">18607</span>&#160;            <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l18608"></a><span class="lineno">18608</span>&#160;        }</div>
-<div class="line"><a name="l18609"></a><span class="lineno">18609</span>&#160;        (*allocator-&gt;GetVulkanFunctions().vkDestroyImage)(allocator-&gt;m_hDevice, *pImage, allocator-&gt;GetAllocationCallbacks());</div>
-<div class="line"><a name="l18610"></a><span class="lineno">18610</span>&#160;        *pImage = VK_NULL_HANDLE;</div>
-<div class="line"><a name="l18611"></a><span class="lineno">18611</span>&#160;        <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l18612"></a><span class="lineno">18612</span>&#160;    }</div>
-<div class="line"><a name="l18613"></a><span class="lineno">18613</span>&#160;    <span class="keywordflow">return</span> res;</div>
-<div class="line"><a name="l18614"></a><span class="lineno">18614</span>&#160;}</div>
-<div class="line"><a name="l18615"></a><span class="lineno">18615</span>&#160; </div>
-<div class="line"><a name="l18616"></a><span class="lineno">18616</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae50d2cb3b4a3bfd4dd40987234e50e7e">vmaDestroyImage</a>(</div>
-<div class="line"><a name="l18617"></a><span class="lineno">18617</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
-<div class="line"><a name="l18618"></a><span class="lineno">18618</span>&#160;    VkImage image,</div>
-<div class="line"><a name="l18619"></a><span class="lineno">18619</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
-<div class="line"><a name="l18620"></a><span class="lineno">18620</span>&#160;{</div>
-<div class="line"><a name="l18621"></a><span class="lineno">18621</span>&#160;    VMA_ASSERT(allocator);</div>
-<div class="line"><a name="l18622"></a><span class="lineno">18622</span>&#160; </div>
-<div class="line"><a name="l18623"></a><span class="lineno">18623</span>&#160;    <span class="keywordflow">if</span>(image == VK_NULL_HANDLE &amp;&amp; allocation == VK_NULL_HANDLE)</div>
-<div class="line"><a name="l18624"></a><span class="lineno">18624</span>&#160;    {</div>
-<div class="line"><a name="l18625"></a><span class="lineno">18625</span>&#160;        <span class="keywordflow">return</span>;</div>
-<div class="line"><a name="l18626"></a><span class="lineno">18626</span>&#160;    }</div>
-<div class="line"><a name="l18627"></a><span class="lineno">18627</span>&#160; </div>
-<div class="line"><a name="l18628"></a><span class="lineno">18628</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDestroyImage&quot;</span>);</div>
-<div class="line"><a name="l18629"></a><span class="lineno">18629</span>&#160; </div>
-<div class="line"><a name="l18630"></a><span class="lineno">18630</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
-<div class="line"><a name="l18631"></a><span class="lineno">18631</span>&#160; </div>
-<div class="line"><a name="l18632"></a><span class="lineno">18632</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
-<div class="line"><a name="l18633"></a><span class="lineno">18633</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
-<div class="line"><a name="l18634"></a><span class="lineno">18634</span>&#160;    {</div>
-<div class="line"><a name="l18635"></a><span class="lineno">18635</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordDestroyImage(</div>
-<div class="line"><a name="l18636"></a><span class="lineno">18636</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
-<div class="line"><a name="l18637"></a><span class="lineno">18637</span>&#160;            allocation);</div>
-<div class="line"><a name="l18638"></a><span class="lineno">18638</span>&#160;    }</div>
-<div class="line"><a name="l18639"></a><span class="lineno">18639</span>&#160;<span class="preprocessor">#endif</span></div>
-<div class="line"><a name="l18640"></a><span class="lineno">18640</span>&#160; </div>
-<div class="line"><a name="l18641"></a><span class="lineno">18641</span>&#160;    <span class="keywordflow">if</span>(image != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l18642"></a><span class="lineno">18642</span>&#160;    {</div>
-<div class="line"><a name="l18643"></a><span class="lineno">18643</span>&#160;        (*allocator-&gt;GetVulkanFunctions().vkDestroyImage)(allocator-&gt;m_hDevice, image, allocator-&gt;GetAllocationCallbacks());</div>
+<div class="line"><a name="l18581"></a><span class="lineno">18581</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDefragmentationBegin&quot;</span>);</div>
+<div class="line"><a name="l18582"></a><span class="lineno">18582</span>&#160; </div>
+<div class="line"><a name="l18583"></a><span class="lineno">18583</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18584"></a><span class="lineno">18584</span>&#160; </div>
+<div class="line"><a name="l18585"></a><span class="lineno">18585</span>&#160;    VkResult res = allocator-&gt;DefragmentationBegin(*pInfo, pStats, pContext);</div>
+<div class="line"><a name="l18586"></a><span class="lineno">18586</span>&#160; </div>
+<div class="line"><a name="l18587"></a><span class="lineno">18587</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18588"></a><span class="lineno">18588</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18589"></a><span class="lineno">18589</span>&#160;    {</div>
+<div class="line"><a name="l18590"></a><span class="lineno">18590</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordDefragmentationBegin(</div>
+<div class="line"><a name="l18591"></a><span class="lineno">18591</span>&#160;            allocator-&gt;GetCurrentFrameIndex(), *pInfo, *pContext);</div>
+<div class="line"><a name="l18592"></a><span class="lineno">18592</span>&#160;    }</div>
+<div class="line"><a name="l18593"></a><span class="lineno">18593</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18594"></a><span class="lineno">18594</span>&#160; </div>
+<div class="line"><a name="l18595"></a><span class="lineno">18595</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18596"></a><span class="lineno">18596</span>&#160;}</div>
+<div class="line"><a name="l18597"></a><span class="lineno">18597</span>&#160; </div>
+<div class="line"><a name="l18598"></a><span class="lineno">18598</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a8774e20e91e245aae959ba63efa15dd2">vmaDefragmentationEnd</a>(</div>
+<div class="line"><a name="l18599"></a><span class="lineno">18599</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18600"></a><span class="lineno">18600</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context)</div>
+<div class="line"><a name="l18601"></a><span class="lineno">18601</span>&#160;{</div>
+<div class="line"><a name="l18602"></a><span class="lineno">18602</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l18603"></a><span class="lineno">18603</span>&#160; </div>
+<div class="line"><a name="l18604"></a><span class="lineno">18604</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDefragmentationEnd&quot;</span>);</div>
+<div class="line"><a name="l18605"></a><span class="lineno">18605</span>&#160; </div>
+<div class="line"><a name="l18606"></a><span class="lineno">18606</span>&#160;    <span class="keywordflow">if</span>(context != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l18607"></a><span class="lineno">18607</span>&#160;    {</div>
+<div class="line"><a name="l18608"></a><span class="lineno">18608</span>&#160;        VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18609"></a><span class="lineno">18609</span>&#160; </div>
+<div class="line"><a name="l18610"></a><span class="lineno">18610</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18611"></a><span class="lineno">18611</span>&#160;        <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18612"></a><span class="lineno">18612</span>&#160;        {</div>
+<div class="line"><a name="l18613"></a><span class="lineno">18613</span>&#160;            allocator-&gt;GetRecorder()-&gt;RecordDefragmentationEnd(</div>
+<div class="line"><a name="l18614"></a><span class="lineno">18614</span>&#160;                allocator-&gt;GetCurrentFrameIndex(), context);</div>
+<div class="line"><a name="l18615"></a><span class="lineno">18615</span>&#160;        }</div>
+<div class="line"><a name="l18616"></a><span class="lineno">18616</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18617"></a><span class="lineno">18617</span>&#160; </div>
+<div class="line"><a name="l18618"></a><span class="lineno">18618</span>&#160;        <span class="keywordflow">return</span> allocator-&gt;DefragmentationEnd(context);</div>
+<div class="line"><a name="l18619"></a><span class="lineno">18619</span>&#160;    }</div>
+<div class="line"><a name="l18620"></a><span class="lineno">18620</span>&#160;    <span class="keywordflow">else</span></div>
+<div class="line"><a name="l18621"></a><span class="lineno">18621</span>&#160;    {</div>
+<div class="line"><a name="l18622"></a><span class="lineno">18622</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l18623"></a><span class="lineno">18623</span>&#160;    }</div>
+<div class="line"><a name="l18624"></a><span class="lineno">18624</span>&#160;}</div>
+<div class="line"><a name="l18625"></a><span class="lineno">18625</span>&#160; </div>
+<div class="line"><a name="l18626"></a><span class="lineno">18626</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ac0f01545b6262f7d4d128fc8f8e5c77b">vmaBeginDefragmentationPass</a>(</div>
+<div class="line"><a name="l18627"></a><span class="lineno">18627</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18628"></a><span class="lineno">18628</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context,</div>
+<div class="line"><a name="l18629"></a><span class="lineno">18629</span>&#160;    <a class="code" href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a>* pInfo</div>
+<div class="line"><a name="l18630"></a><span class="lineno">18630</span>&#160;    )</div>
+<div class="line"><a name="l18631"></a><span class="lineno">18631</span>&#160;{</div>
+<div class="line"><a name="l18632"></a><span class="lineno">18632</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l18633"></a><span class="lineno">18633</span>&#160;    VMA_ASSERT(pInfo);</div>
+<div class="line"><a name="l18634"></a><span class="lineno">18634</span>&#160;    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a>, pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792">pMoves</a>));</div>
+<div class="line"><a name="l18635"></a><span class="lineno">18635</span>&#160; </div>
+<div class="line"><a name="l18636"></a><span class="lineno">18636</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaBeginDefragmentationPass&quot;</span>);</div>
+<div class="line"><a name="l18637"></a><span class="lineno">18637</span>&#160; </div>
+<div class="line"><a name="l18638"></a><span class="lineno">18638</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18639"></a><span class="lineno">18639</span>&#160; </div>
+<div class="line"><a name="l18640"></a><span class="lineno">18640</span>&#160;    <span class="keywordflow">if</span>(context == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l18641"></a><span class="lineno">18641</span>&#160;    {</div>
+<div class="line"><a name="l18642"></a><span class="lineno">18642</span>&#160;        pInfo-&gt;<a class="code" href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">moveCount</a> = 0;</div>
+<div class="line"><a name="l18643"></a><span class="lineno">18643</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
 <div class="line"><a name="l18644"></a><span class="lineno">18644</span>&#160;    }</div>
-<div class="line"><a name="l18645"></a><span class="lineno">18645</span>&#160;    <span class="keywordflow">if</span>(allocation != VK_NULL_HANDLE)</div>
-<div class="line"><a name="l18646"></a><span class="lineno">18646</span>&#160;    {</div>
-<div class="line"><a name="l18647"></a><span class="lineno">18647</span>&#160;        allocator-&gt;FreeMemory(</div>
-<div class="line"><a name="l18648"></a><span class="lineno">18648</span>&#160;            1, <span class="comment">// allocationCount</span></div>
-<div class="line"><a name="l18649"></a><span class="lineno">18649</span>&#160;            &amp;allocation);</div>
-<div class="line"><a name="l18650"></a><span class="lineno">18650</span>&#160;    }</div>
-<div class="line"><a name="l18651"></a><span class="lineno">18651</span>&#160;}</div>
-<div class="line"><a name="l18652"></a><span class="lineno">18652</span>&#160; </div>
-<div class="line"><a name="l18653"></a><span class="lineno">18653</span>&#160;<span class="preprocessor">#endif // #ifdef VMA_IMPLEMENTATION</span></div>
+<div class="line"><a name="l18645"></a><span class="lineno">18645</span>&#160; </div>
+<div class="line"><a name="l18646"></a><span class="lineno">18646</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;DefragmentationPassBegin(pInfo, context);</div>
+<div class="line"><a name="l18647"></a><span class="lineno">18647</span>&#160;}</div>
+<div class="line"><a name="l18648"></a><span class="lineno">18648</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a1b9ffa538bed905af55c747cc48963bd">vmaEndDefragmentationPass</a>(</div>
+<div class="line"><a name="l18649"></a><span class="lineno">18649</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18650"></a><span class="lineno">18650</span>&#160;    <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context)</div>
+<div class="line"><a name="l18651"></a><span class="lineno">18651</span>&#160;{</div>
+<div class="line"><a name="l18652"></a><span class="lineno">18652</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l18653"></a><span class="lineno">18653</span>&#160; </div>
+<div class="line"><a name="l18654"></a><span class="lineno">18654</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaEndDefragmentationPass&quot;</span>);</div>
+<div class="line"><a name="l18655"></a><span class="lineno">18655</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18656"></a><span class="lineno">18656</span>&#160; </div>
+<div class="line"><a name="l18657"></a><span class="lineno">18657</span>&#160;    <span class="keywordflow">if</span>(context == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l18658"></a><span class="lineno">18658</span>&#160;        <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l18659"></a><span class="lineno">18659</span>&#160; </div>
+<div class="line"><a name="l18660"></a><span class="lineno">18660</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;DefragmentationPassEnd(context);</div>
+<div class="line"><a name="l18661"></a><span class="lineno">18661</span>&#160;}</div>
+<div class="line"><a name="l18662"></a><span class="lineno">18662</span>&#160; </div>
+<div class="line"><a name="l18663"></a><span class="lineno">18663</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470">vmaBindBufferMemory</a>(</div>
+<div class="line"><a name="l18664"></a><span class="lineno">18664</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18665"></a><span class="lineno">18665</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l18666"></a><span class="lineno">18666</span>&#160;    VkBuffer buffer)</div>
+<div class="line"><a name="l18667"></a><span class="lineno">18667</span>&#160;{</div>
+<div class="line"><a name="l18668"></a><span class="lineno">18668</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; buffer);</div>
+<div class="line"><a name="l18669"></a><span class="lineno">18669</span>&#160; </div>
+<div class="line"><a name="l18670"></a><span class="lineno">18670</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaBindBufferMemory&quot;</span>);</div>
+<div class="line"><a name="l18671"></a><span class="lineno">18671</span>&#160; </div>
+<div class="line"><a name="l18672"></a><span class="lineno">18672</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18673"></a><span class="lineno">18673</span>&#160; </div>
+<div class="line"><a name="l18674"></a><span class="lineno">18674</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;BindBufferMemory(allocation, 0, buffer, VMA_NULL);</div>
+<div class="line"><a name="l18675"></a><span class="lineno">18675</span>&#160;}</div>
+<div class="line"><a name="l18676"></a><span class="lineno">18676</span>&#160; </div>
+<div class="line"><a name="l18677"></a><span class="lineno">18677</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a">vmaBindBufferMemory2</a>(</div>
+<div class="line"><a name="l18678"></a><span class="lineno">18678</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18679"></a><span class="lineno">18679</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l18680"></a><span class="lineno">18680</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l18681"></a><span class="lineno">18681</span>&#160;    VkBuffer buffer,</div>
+<div class="line"><a name="l18682"></a><span class="lineno">18682</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
+<div class="line"><a name="l18683"></a><span class="lineno">18683</span>&#160;{</div>
+<div class="line"><a name="l18684"></a><span class="lineno">18684</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; buffer);</div>
+<div class="line"><a name="l18685"></a><span class="lineno">18685</span>&#160; </div>
+<div class="line"><a name="l18686"></a><span class="lineno">18686</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaBindBufferMemory2&quot;</span>);</div>
+<div class="line"><a name="l18687"></a><span class="lineno">18687</span>&#160; </div>
+<div class="line"><a name="l18688"></a><span class="lineno">18688</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18689"></a><span class="lineno">18689</span>&#160; </div>
+<div class="line"><a name="l18690"></a><span class="lineno">18690</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;BindBufferMemory(allocation, allocationLocalOffset, buffer, pNext);</div>
+<div class="line"><a name="l18691"></a><span class="lineno">18691</span>&#160;}</div>
+<div class="line"><a name="l18692"></a><span class="lineno">18692</span>&#160; </div>
+<div class="line"><a name="l18693"></a><span class="lineno">18693</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5">vmaBindImageMemory</a>(</div>
+<div class="line"><a name="l18694"></a><span class="lineno">18694</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18695"></a><span class="lineno">18695</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l18696"></a><span class="lineno">18696</span>&#160;    VkImage image)</div>
+<div class="line"><a name="l18697"></a><span class="lineno">18697</span>&#160;{</div>
+<div class="line"><a name="l18698"></a><span class="lineno">18698</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; image);</div>
+<div class="line"><a name="l18699"></a><span class="lineno">18699</span>&#160; </div>
+<div class="line"><a name="l18700"></a><span class="lineno">18700</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaBindImageMemory&quot;</span>);</div>
+<div class="line"><a name="l18701"></a><span class="lineno">18701</span>&#160; </div>
+<div class="line"><a name="l18702"></a><span class="lineno">18702</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18703"></a><span class="lineno">18703</span>&#160; </div>
+<div class="line"><a name="l18704"></a><span class="lineno">18704</span>&#160;    <span class="keywordflow">return</span> allocator-&gt;BindImageMemory(allocation, 0, image, VMA_NULL);</div>
+<div class="line"><a name="l18705"></a><span class="lineno">18705</span>&#160;}</div>
+<div class="line"><a name="l18706"></a><span class="lineno">18706</span>&#160; </div>
+<div class="line"><a name="l18707"></a><span class="lineno">18707</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc">vmaBindImageMemory2</a>(</div>
+<div class="line"><a name="l18708"></a><span class="lineno">18708</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18709"></a><span class="lineno">18709</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
+<div class="line"><a name="l18710"></a><span class="lineno">18710</span>&#160;    VkDeviceSize allocationLocalOffset,</div>
+<div class="line"><a name="l18711"></a><span class="lineno">18711</span>&#160;    VkImage image,</div>
+<div class="line"><a name="l18712"></a><span class="lineno">18712</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext)</div>
+<div class="line"><a name="l18713"></a><span class="lineno">18713</span>&#160;{</div>
+<div class="line"><a name="l18714"></a><span class="lineno">18714</span>&#160;    VMA_ASSERT(allocator &amp;&amp; allocation &amp;&amp; image);</div>
+<div class="line"><a name="l18715"></a><span class="lineno">18715</span>&#160; </div>
+<div class="line"><a name="l18716"></a><span class="lineno">18716</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaBindImageMemory2&quot;</span>);</div>
+<div class="line"><a name="l18717"></a><span class="lineno">18717</span>&#160; </div>
+<div class="line"><a name="l18718"></a><span class="lineno">18718</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18719"></a><span class="lineno">18719</span>&#160; </div>
+<div class="line"><a name="l18720"></a><span class="lineno">18720</span>&#160;        <span class="keywordflow">return</span> allocator-&gt;BindImageMemory(allocation, allocationLocalOffset, image, pNext);</div>
+<div class="line"><a name="l18721"></a><span class="lineno">18721</span>&#160;}</div>
+<div class="line"><a name="l18722"></a><span class="lineno">18722</span>&#160; </div>
+<div class="line"><a name="l18723"></a><span class="lineno">18723</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(</div>
+<div class="line"><a name="l18724"></a><span class="lineno">18724</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18725"></a><span class="lineno">18725</span>&#160;    <span class="keyword">const</span> VkBufferCreateInfo* pBufferCreateInfo,</div>
+<div class="line"><a name="l18726"></a><span class="lineno">18726</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
+<div class="line"><a name="l18727"></a><span class="lineno">18727</span>&#160;    VkBuffer* pBuffer,</div>
+<div class="line"><a name="l18728"></a><span class="lineno">18728</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
+<div class="line"><a name="l18729"></a><span class="lineno">18729</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
+<div class="line"><a name="l18730"></a><span class="lineno">18730</span>&#160;{</div>
+<div class="line"><a name="l18731"></a><span class="lineno">18731</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pBufferCreateInfo &amp;&amp; pAllocationCreateInfo &amp;&amp; pBuffer &amp;&amp; pAllocation);</div>
+<div class="line"><a name="l18732"></a><span class="lineno">18732</span>&#160; </div>
+<div class="line"><a name="l18733"></a><span class="lineno">18733</span>&#160;    <span class="keywordflow">if</span>(pBufferCreateInfo-&gt;size == 0)</div>
+<div class="line"><a name="l18734"></a><span class="lineno">18734</span>&#160;    {</div>
+<div class="line"><a name="l18735"></a><span class="lineno">18735</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
+<div class="line"><a name="l18736"></a><span class="lineno">18736</span>&#160;    }</div>
+<div class="line"><a name="l18737"></a><span class="lineno">18737</span>&#160;    <span class="keywordflow">if</span>((pBufferCreateInfo-&gt;usage &amp; VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_COPY) != 0 &amp;&amp;</div>
+<div class="line"><a name="l18738"></a><span class="lineno">18738</span>&#160;        !allocator-&gt;m_UseKhrBufferDeviceAddress)</div>
+<div class="line"><a name="l18739"></a><span class="lineno">18739</span>&#160;    {</div>
+<div class="line"><a name="l18740"></a><span class="lineno">18740</span>&#160;        VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Creating a buffer with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT is not valid if VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT was not used.&quot;</span>);</div>
+<div class="line"><a name="l18741"></a><span class="lineno">18741</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
+<div class="line"><a name="l18742"></a><span class="lineno">18742</span>&#160;    }</div>
+<div class="line"><a name="l18743"></a><span class="lineno">18743</span>&#160;    </div>
+<div class="line"><a name="l18744"></a><span class="lineno">18744</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCreateBuffer&quot;</span>);</div>
+<div class="line"><a name="l18745"></a><span class="lineno">18745</span>&#160;    </div>
+<div class="line"><a name="l18746"></a><span class="lineno">18746</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18747"></a><span class="lineno">18747</span>&#160; </div>
+<div class="line"><a name="l18748"></a><span class="lineno">18748</span>&#160;    *pBuffer = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l18749"></a><span class="lineno">18749</span>&#160;    *pAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l18750"></a><span class="lineno">18750</span>&#160; </div>
+<div class="line"><a name="l18751"></a><span class="lineno">18751</span>&#160;    <span class="comment">// 1. Create VkBuffer.</span></div>
+<div class="line"><a name="l18752"></a><span class="lineno">18752</span>&#160;    VkResult res = (*allocator-&gt;GetVulkanFunctions().vkCreateBuffer)(</div>
+<div class="line"><a name="l18753"></a><span class="lineno">18753</span>&#160;        allocator-&gt;m_hDevice,</div>
+<div class="line"><a name="l18754"></a><span class="lineno">18754</span>&#160;        pBufferCreateInfo,</div>
+<div class="line"><a name="l18755"></a><span class="lineno">18755</span>&#160;        allocator-&gt;GetAllocationCallbacks(),</div>
+<div class="line"><a name="l18756"></a><span class="lineno">18756</span>&#160;        pBuffer);</div>
+<div class="line"><a name="l18757"></a><span class="lineno">18757</span>&#160;    <span class="keywordflow">if</span>(res &gt;= 0)</div>
+<div class="line"><a name="l18758"></a><span class="lineno">18758</span>&#160;    {</div>
+<div class="line"><a name="l18759"></a><span class="lineno">18759</span>&#160;        <span class="comment">// 2. vkGetBufferMemoryRequirements.</span></div>
+<div class="line"><a name="l18760"></a><span class="lineno">18760</span>&#160;        VkMemoryRequirements vkMemReq = {};</div>
+<div class="line"><a name="l18761"></a><span class="lineno">18761</span>&#160;        <span class="keywordtype">bool</span> requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l18762"></a><span class="lineno">18762</span>&#160;        <span class="keywordtype">bool</span> prefersDedicatedAllocation  = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l18763"></a><span class="lineno">18763</span>&#160;        allocator-&gt;GetBufferMemoryRequirements(*pBuffer, vkMemReq,</div>
+<div class="line"><a name="l18764"></a><span class="lineno">18764</span>&#160;            requiresDedicatedAllocation, prefersDedicatedAllocation);</div>
+<div class="line"><a name="l18765"></a><span class="lineno">18765</span>&#160; </div>
+<div class="line"><a name="l18766"></a><span class="lineno">18766</span>&#160;        <span class="comment">// 3. Allocate memory using allocator.</span></div>
+<div class="line"><a name="l18767"></a><span class="lineno">18767</span>&#160;        res = allocator-&gt;AllocateMemory(</div>
+<div class="line"><a name="l18768"></a><span class="lineno">18768</span>&#160;            vkMemReq,</div>
+<div class="line"><a name="l18769"></a><span class="lineno">18769</span>&#160;            requiresDedicatedAllocation,</div>
+<div class="line"><a name="l18770"></a><span class="lineno">18770</span>&#160;            prefersDedicatedAllocation,</div>
+<div class="line"><a name="l18771"></a><span class="lineno">18771</span>&#160;            *pBuffer, <span class="comment">// dedicatedBuffer</span></div>
+<div class="line"><a name="l18772"></a><span class="lineno">18772</span>&#160;            pBufferCreateInfo-&gt;usage, <span class="comment">// dedicatedBufferUsage</span></div>
+<div class="line"><a name="l18773"></a><span class="lineno">18773</span>&#160;            VK_NULL_HANDLE, <span class="comment">// dedicatedImage</span></div>
+<div class="line"><a name="l18774"></a><span class="lineno">18774</span>&#160;            *pAllocationCreateInfo,</div>
+<div class="line"><a name="l18775"></a><span class="lineno">18775</span>&#160;            VMA_SUBALLOCATION_TYPE_BUFFER,</div>
+<div class="line"><a name="l18776"></a><span class="lineno">18776</span>&#160;            1, <span class="comment">// allocationCount</span></div>
+<div class="line"><a name="l18777"></a><span class="lineno">18777</span>&#160;            pAllocation);</div>
+<div class="line"><a name="l18778"></a><span class="lineno">18778</span>&#160; </div>
+<div class="line"><a name="l18779"></a><span class="lineno">18779</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18780"></a><span class="lineno">18780</span>&#160;        <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18781"></a><span class="lineno">18781</span>&#160;        {</div>
+<div class="line"><a name="l18782"></a><span class="lineno">18782</span>&#160;            allocator-&gt;GetRecorder()-&gt;RecordCreateBuffer(</div>
+<div class="line"><a name="l18783"></a><span class="lineno">18783</span>&#160;                allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18784"></a><span class="lineno">18784</span>&#160;                *pBufferCreateInfo,</div>
+<div class="line"><a name="l18785"></a><span class="lineno">18785</span>&#160;                *pAllocationCreateInfo,</div>
+<div class="line"><a name="l18786"></a><span class="lineno">18786</span>&#160;                *pAllocation);</div>
+<div class="line"><a name="l18787"></a><span class="lineno">18787</span>&#160;        }</div>
+<div class="line"><a name="l18788"></a><span class="lineno">18788</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18789"></a><span class="lineno">18789</span>&#160; </div>
+<div class="line"><a name="l18790"></a><span class="lineno">18790</span>&#160;        <span class="keywordflow">if</span>(res &gt;= 0)</div>
+<div class="line"><a name="l18791"></a><span class="lineno">18791</span>&#160;        {</div>
+<div class="line"><a name="l18792"></a><span class="lineno">18792</span>&#160;            <span class="comment">// 3. Bind buffer with memory.</span></div>
+<div class="line"><a name="l18793"></a><span class="lineno">18793</span>&#160;            <span class="keywordflow">if</span>((pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea">VMA_ALLOCATION_CREATE_DONT_BIND_BIT</a>) == 0)</div>
+<div class="line"><a name="l18794"></a><span class="lineno">18794</span>&#160;            {</div>
+<div class="line"><a name="l18795"></a><span class="lineno">18795</span>&#160;                res = allocator-&gt;BindBufferMemory(*pAllocation, 0, *pBuffer, VMA_NULL);</div>
+<div class="line"><a name="l18796"></a><span class="lineno">18796</span>&#160;            }</div>
+<div class="line"><a name="l18797"></a><span class="lineno">18797</span>&#160;            <span class="keywordflow">if</span>(res &gt;= 0)</div>
+<div class="line"><a name="l18798"></a><span class="lineno">18798</span>&#160;            {</div>
+<div class="line"><a name="l18799"></a><span class="lineno">18799</span>&#160;                <span class="comment">// All steps succeeded.</span></div>
+<div class="line"><a name="l18800"></a><span class="lineno">18800</span>&#160;<span class="preprocessor">                #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l18801"></a><span class="lineno">18801</span>&#160;                    (*pAllocation)-&gt;InitBufferImageUsage(pBufferCreateInfo-&gt;usage);</div>
+<div class="line"><a name="l18802"></a><span class="lineno">18802</span>&#160;<span class="preprocessor">                #endif</span></div>
+<div class="line"><a name="l18803"></a><span class="lineno">18803</span>&#160;                <span class="keywordflow">if</span>(pAllocationInfo != VMA_NULL)</div>
+<div class="line"><a name="l18804"></a><span class="lineno">18804</span>&#160;                {</div>
+<div class="line"><a name="l18805"></a><span class="lineno">18805</span>&#160;                    allocator-&gt;GetAllocationInfo(*pAllocation, pAllocationInfo);</div>
+<div class="line"><a name="l18806"></a><span class="lineno">18806</span>&#160;                }</div>
+<div class="line"><a name="l18807"></a><span class="lineno">18807</span>&#160; </div>
+<div class="line"><a name="l18808"></a><span class="lineno">18808</span>&#160;                <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l18809"></a><span class="lineno">18809</span>&#160;            }</div>
+<div class="line"><a name="l18810"></a><span class="lineno">18810</span>&#160;            allocator-&gt;FreeMemory(</div>
+<div class="line"><a name="l18811"></a><span class="lineno">18811</span>&#160;                1, <span class="comment">// allocationCount</span></div>
+<div class="line"><a name="l18812"></a><span class="lineno">18812</span>&#160;                pAllocation);</div>
+<div class="line"><a name="l18813"></a><span class="lineno">18813</span>&#160;            *pAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l18814"></a><span class="lineno">18814</span>&#160;            (*allocator-&gt;GetVulkanFunctions().vkDestroyBuffer)(allocator-&gt;m_hDevice, *pBuffer, allocator-&gt;GetAllocationCallbacks());</div>
+<div class="line"><a name="l18815"></a><span class="lineno">18815</span>&#160;            *pBuffer = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l18816"></a><span class="lineno">18816</span>&#160;            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18817"></a><span class="lineno">18817</span>&#160;        }</div>
+<div class="line"><a name="l18818"></a><span class="lineno">18818</span>&#160;        (*allocator-&gt;GetVulkanFunctions().vkDestroyBuffer)(allocator-&gt;m_hDevice, *pBuffer, allocator-&gt;GetAllocationCallbacks());</div>
+<div class="line"><a name="l18819"></a><span class="lineno">18819</span>&#160;        *pBuffer = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l18820"></a><span class="lineno">18820</span>&#160;        <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18821"></a><span class="lineno">18821</span>&#160;    }</div>
+<div class="line"><a name="l18822"></a><span class="lineno">18822</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18823"></a><span class="lineno">18823</span>&#160;}</div>
+<div class="line"><a name="l18824"></a><span class="lineno">18824</span>&#160; </div>
+<div class="line"><a name="l18825"></a><span class="lineno">18825</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a>(</div>
+<div class="line"><a name="l18826"></a><span class="lineno">18826</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18827"></a><span class="lineno">18827</span>&#160;    VkBuffer buffer,</div>
+<div class="line"><a name="l18828"></a><span class="lineno">18828</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l18829"></a><span class="lineno">18829</span>&#160;{</div>
+<div class="line"><a name="l18830"></a><span class="lineno">18830</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l18831"></a><span class="lineno">18831</span>&#160; </div>
+<div class="line"><a name="l18832"></a><span class="lineno">18832</span>&#160;    <span class="keywordflow">if</span>(buffer == VK_NULL_HANDLE &amp;&amp; allocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l18833"></a><span class="lineno">18833</span>&#160;    {</div>
+<div class="line"><a name="l18834"></a><span class="lineno">18834</span>&#160;        <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l18835"></a><span class="lineno">18835</span>&#160;    }</div>
+<div class="line"><a name="l18836"></a><span class="lineno">18836</span>&#160; </div>
+<div class="line"><a name="l18837"></a><span class="lineno">18837</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDestroyBuffer&quot;</span>);</div>
+<div class="line"><a name="l18838"></a><span class="lineno">18838</span>&#160; </div>
+<div class="line"><a name="l18839"></a><span class="lineno">18839</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18840"></a><span class="lineno">18840</span>&#160; </div>
+<div class="line"><a name="l18841"></a><span class="lineno">18841</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18842"></a><span class="lineno">18842</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18843"></a><span class="lineno">18843</span>&#160;    {</div>
+<div class="line"><a name="l18844"></a><span class="lineno">18844</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordDestroyBuffer(</div>
+<div class="line"><a name="l18845"></a><span class="lineno">18845</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18846"></a><span class="lineno">18846</span>&#160;            allocation);</div>
+<div class="line"><a name="l18847"></a><span class="lineno">18847</span>&#160;    }</div>
+<div class="line"><a name="l18848"></a><span class="lineno">18848</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18849"></a><span class="lineno">18849</span>&#160; </div>
+<div class="line"><a name="l18850"></a><span class="lineno">18850</span>&#160;    <span class="keywordflow">if</span>(buffer != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l18851"></a><span class="lineno">18851</span>&#160;    {</div>
+<div class="line"><a name="l18852"></a><span class="lineno">18852</span>&#160;        (*allocator-&gt;GetVulkanFunctions().vkDestroyBuffer)(allocator-&gt;m_hDevice, buffer, allocator-&gt;GetAllocationCallbacks());</div>
+<div class="line"><a name="l18853"></a><span class="lineno">18853</span>&#160;    }</div>
+<div class="line"><a name="l18854"></a><span class="lineno">18854</span>&#160; </div>
+<div class="line"><a name="l18855"></a><span class="lineno">18855</span>&#160;    <span class="keywordflow">if</span>(allocation != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l18856"></a><span class="lineno">18856</span>&#160;    {</div>
+<div class="line"><a name="l18857"></a><span class="lineno">18857</span>&#160;        allocator-&gt;FreeMemory(</div>
+<div class="line"><a name="l18858"></a><span class="lineno">18858</span>&#160;            1, <span class="comment">// allocationCount</span></div>
+<div class="line"><a name="l18859"></a><span class="lineno">18859</span>&#160;            &amp;allocation);</div>
+<div class="line"><a name="l18860"></a><span class="lineno">18860</span>&#160;    }</div>
+<div class="line"><a name="l18861"></a><span class="lineno">18861</span>&#160;}</div>
+<div class="line"><a name="l18862"></a><span class="lineno">18862</span>&#160; </div>
+<div class="line"><a name="l18863"></a><span class="lineno">18863</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73">vmaCreateImage</a>(</div>
+<div class="line"><a name="l18864"></a><span class="lineno">18864</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18865"></a><span class="lineno">18865</span>&#160;    <span class="keyword">const</span> VkImageCreateInfo* pImageCreateInfo,</div>
+<div class="line"><a name="l18866"></a><span class="lineno">18866</span>&#160;    <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
+<div class="line"><a name="l18867"></a><span class="lineno">18867</span>&#160;    VkImage* pImage,</div>
+<div class="line"><a name="l18868"></a><span class="lineno">18868</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
+<div class="line"><a name="l18869"></a><span class="lineno">18869</span>&#160;    <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo)</div>
+<div class="line"><a name="l18870"></a><span class="lineno">18870</span>&#160;{</div>
+<div class="line"><a name="l18871"></a><span class="lineno">18871</span>&#160;    VMA_ASSERT(allocator &amp;&amp; pImageCreateInfo &amp;&amp; pAllocationCreateInfo &amp;&amp; pImage &amp;&amp; pAllocation);</div>
+<div class="line"><a name="l18872"></a><span class="lineno">18872</span>&#160; </div>
+<div class="line"><a name="l18873"></a><span class="lineno">18873</span>&#160;    <span class="keywordflow">if</span>(pImageCreateInfo-&gt;extent.width == 0 ||</div>
+<div class="line"><a name="l18874"></a><span class="lineno">18874</span>&#160;        pImageCreateInfo-&gt;extent.height == 0 ||</div>
+<div class="line"><a name="l18875"></a><span class="lineno">18875</span>&#160;        pImageCreateInfo-&gt;extent.depth == 0 ||</div>
+<div class="line"><a name="l18876"></a><span class="lineno">18876</span>&#160;        pImageCreateInfo-&gt;mipLevels == 0 ||</div>
+<div class="line"><a name="l18877"></a><span class="lineno">18877</span>&#160;        pImageCreateInfo-&gt;arrayLayers == 0)</div>
+<div class="line"><a name="l18878"></a><span class="lineno">18878</span>&#160;    {</div>
+<div class="line"><a name="l18879"></a><span class="lineno">18879</span>&#160;        <span class="keywordflow">return</span> VK_ERROR_VALIDATION_FAILED_EXT;</div>
+<div class="line"><a name="l18880"></a><span class="lineno">18880</span>&#160;    }</div>
+<div class="line"><a name="l18881"></a><span class="lineno">18881</span>&#160; </div>
+<div class="line"><a name="l18882"></a><span class="lineno">18882</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaCreateImage&quot;</span>);</div>
+<div class="line"><a name="l18883"></a><span class="lineno">18883</span>&#160; </div>
+<div class="line"><a name="l18884"></a><span class="lineno">18884</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18885"></a><span class="lineno">18885</span>&#160; </div>
+<div class="line"><a name="l18886"></a><span class="lineno">18886</span>&#160;    *pImage = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l18887"></a><span class="lineno">18887</span>&#160;    *pAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l18888"></a><span class="lineno">18888</span>&#160; </div>
+<div class="line"><a name="l18889"></a><span class="lineno">18889</span>&#160;    <span class="comment">// 1. Create VkImage.</span></div>
+<div class="line"><a name="l18890"></a><span class="lineno">18890</span>&#160;    VkResult res = (*allocator-&gt;GetVulkanFunctions().vkCreateImage)(</div>
+<div class="line"><a name="l18891"></a><span class="lineno">18891</span>&#160;        allocator-&gt;m_hDevice,</div>
+<div class="line"><a name="l18892"></a><span class="lineno">18892</span>&#160;        pImageCreateInfo,</div>
+<div class="line"><a name="l18893"></a><span class="lineno">18893</span>&#160;        allocator-&gt;GetAllocationCallbacks(),</div>
+<div class="line"><a name="l18894"></a><span class="lineno">18894</span>&#160;        pImage);</div>
+<div class="line"><a name="l18895"></a><span class="lineno">18895</span>&#160;    <span class="keywordflow">if</span>(res &gt;= 0)</div>
+<div class="line"><a name="l18896"></a><span class="lineno">18896</span>&#160;    {</div>
+<div class="line"><a name="l18897"></a><span class="lineno">18897</span>&#160;        VmaSuballocationType suballocType = pImageCreateInfo-&gt;tiling == VK_IMAGE_TILING_OPTIMAL ?</div>
+<div class="line"><a name="l18898"></a><span class="lineno">18898</span>&#160;            VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL :</div>
+<div class="line"><a name="l18899"></a><span class="lineno">18899</span>&#160;            VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR;</div>
+<div class="line"><a name="l18900"></a><span class="lineno">18900</span>&#160;        </div>
+<div class="line"><a name="l18901"></a><span class="lineno">18901</span>&#160;        <span class="comment">// 2. Allocate memory using allocator.</span></div>
+<div class="line"><a name="l18902"></a><span class="lineno">18902</span>&#160;        VkMemoryRequirements vkMemReq = {};</div>
+<div class="line"><a name="l18903"></a><span class="lineno">18903</span>&#160;        <span class="keywordtype">bool</span> requiresDedicatedAllocation = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l18904"></a><span class="lineno">18904</span>&#160;        <span class="keywordtype">bool</span> prefersDedicatedAllocation  = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l18905"></a><span class="lineno">18905</span>&#160;        allocator-&gt;GetImageMemoryRequirements(*pImage, vkMemReq,</div>
+<div class="line"><a name="l18906"></a><span class="lineno">18906</span>&#160;            requiresDedicatedAllocation, prefersDedicatedAllocation);</div>
+<div class="line"><a name="l18907"></a><span class="lineno">18907</span>&#160; </div>
+<div class="line"><a name="l18908"></a><span class="lineno">18908</span>&#160;        res = allocator-&gt;AllocateMemory(</div>
+<div class="line"><a name="l18909"></a><span class="lineno">18909</span>&#160;            vkMemReq,</div>
+<div class="line"><a name="l18910"></a><span class="lineno">18910</span>&#160;            requiresDedicatedAllocation,</div>
+<div class="line"><a name="l18911"></a><span class="lineno">18911</span>&#160;            prefersDedicatedAllocation,</div>
+<div class="line"><a name="l18912"></a><span class="lineno">18912</span>&#160;            VK_NULL_HANDLE, <span class="comment">// dedicatedBuffer</span></div>
+<div class="line"><a name="l18913"></a><span class="lineno">18913</span>&#160;            UINT32_MAX, <span class="comment">// dedicatedBufferUsage</span></div>
+<div class="line"><a name="l18914"></a><span class="lineno">18914</span>&#160;            *pImage, <span class="comment">// dedicatedImage</span></div>
+<div class="line"><a name="l18915"></a><span class="lineno">18915</span>&#160;            *pAllocationCreateInfo,</div>
+<div class="line"><a name="l18916"></a><span class="lineno">18916</span>&#160;            suballocType,</div>
+<div class="line"><a name="l18917"></a><span class="lineno">18917</span>&#160;            1, <span class="comment">// allocationCount</span></div>
+<div class="line"><a name="l18918"></a><span class="lineno">18918</span>&#160;            pAllocation);</div>
+<div class="line"><a name="l18919"></a><span class="lineno">18919</span>&#160; </div>
+<div class="line"><a name="l18920"></a><span class="lineno">18920</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18921"></a><span class="lineno">18921</span>&#160;        <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18922"></a><span class="lineno">18922</span>&#160;        {</div>
+<div class="line"><a name="l18923"></a><span class="lineno">18923</span>&#160;            allocator-&gt;GetRecorder()-&gt;RecordCreateImage(</div>
+<div class="line"><a name="l18924"></a><span class="lineno">18924</span>&#160;                allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18925"></a><span class="lineno">18925</span>&#160;                *pImageCreateInfo,</div>
+<div class="line"><a name="l18926"></a><span class="lineno">18926</span>&#160;                *pAllocationCreateInfo,</div>
+<div class="line"><a name="l18927"></a><span class="lineno">18927</span>&#160;                *pAllocation);</div>
+<div class="line"><a name="l18928"></a><span class="lineno">18928</span>&#160;        }</div>
+<div class="line"><a name="l18929"></a><span class="lineno">18929</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18930"></a><span class="lineno">18930</span>&#160; </div>
+<div class="line"><a name="l18931"></a><span class="lineno">18931</span>&#160;        <span class="keywordflow">if</span>(res &gt;= 0)</div>
+<div class="line"><a name="l18932"></a><span class="lineno">18932</span>&#160;        {</div>
+<div class="line"><a name="l18933"></a><span class="lineno">18933</span>&#160;            <span class="comment">// 3. Bind image with memory.</span></div>
+<div class="line"><a name="l18934"></a><span class="lineno">18934</span>&#160;            <span class="keywordflow">if</span>((pAllocationCreateInfo-&gt;<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> &amp; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea">VMA_ALLOCATION_CREATE_DONT_BIND_BIT</a>) == 0)</div>
+<div class="line"><a name="l18935"></a><span class="lineno">18935</span>&#160;            {</div>
+<div class="line"><a name="l18936"></a><span class="lineno">18936</span>&#160;                res = allocator-&gt;BindImageMemory(*pAllocation, 0, *pImage, VMA_NULL);</div>
+<div class="line"><a name="l18937"></a><span class="lineno">18937</span>&#160;            }</div>
+<div class="line"><a name="l18938"></a><span class="lineno">18938</span>&#160;            <span class="keywordflow">if</span>(res &gt;= 0)</div>
+<div class="line"><a name="l18939"></a><span class="lineno">18939</span>&#160;            {</div>
+<div class="line"><a name="l18940"></a><span class="lineno">18940</span>&#160;                <span class="comment">// All steps succeeded.</span></div>
+<div class="line"><a name="l18941"></a><span class="lineno">18941</span>&#160;<span class="preprocessor">                #if VMA_STATS_STRING_ENABLED</span></div>
+<div class="line"><a name="l18942"></a><span class="lineno">18942</span>&#160;                    (*pAllocation)-&gt;InitBufferImageUsage(pImageCreateInfo-&gt;usage);</div>
+<div class="line"><a name="l18943"></a><span class="lineno">18943</span>&#160;<span class="preprocessor">                #endif</span></div>
+<div class="line"><a name="l18944"></a><span class="lineno">18944</span>&#160;                <span class="keywordflow">if</span>(pAllocationInfo != VMA_NULL)</div>
+<div class="line"><a name="l18945"></a><span class="lineno">18945</span>&#160;                {</div>
+<div class="line"><a name="l18946"></a><span class="lineno">18946</span>&#160;                    allocator-&gt;GetAllocationInfo(*pAllocation, pAllocationInfo);</div>
+<div class="line"><a name="l18947"></a><span class="lineno">18947</span>&#160;                }</div>
+<div class="line"><a name="l18948"></a><span class="lineno">18948</span>&#160; </div>
+<div class="line"><a name="l18949"></a><span class="lineno">18949</span>&#160;                <span class="keywordflow">return</span> VK_SUCCESS;</div>
+<div class="line"><a name="l18950"></a><span class="lineno">18950</span>&#160;            }</div>
+<div class="line"><a name="l18951"></a><span class="lineno">18951</span>&#160;            allocator-&gt;FreeMemory(</div>
+<div class="line"><a name="l18952"></a><span class="lineno">18952</span>&#160;                1, <span class="comment">// allocationCount</span></div>
+<div class="line"><a name="l18953"></a><span class="lineno">18953</span>&#160;                pAllocation);</div>
+<div class="line"><a name="l18954"></a><span class="lineno">18954</span>&#160;            *pAllocation = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l18955"></a><span class="lineno">18955</span>&#160;            (*allocator-&gt;GetVulkanFunctions().vkDestroyImage)(allocator-&gt;m_hDevice, *pImage, allocator-&gt;GetAllocationCallbacks());</div>
+<div class="line"><a name="l18956"></a><span class="lineno">18956</span>&#160;            *pImage = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l18957"></a><span class="lineno">18957</span>&#160;            <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18958"></a><span class="lineno">18958</span>&#160;        }</div>
+<div class="line"><a name="l18959"></a><span class="lineno">18959</span>&#160;        (*allocator-&gt;GetVulkanFunctions().vkDestroyImage)(allocator-&gt;m_hDevice, *pImage, allocator-&gt;GetAllocationCallbacks());</div>
+<div class="line"><a name="l18960"></a><span class="lineno">18960</span>&#160;        *pImage = VK_NULL_HANDLE;</div>
+<div class="line"><a name="l18961"></a><span class="lineno">18961</span>&#160;        <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18962"></a><span class="lineno">18962</span>&#160;    }</div>
+<div class="line"><a name="l18963"></a><span class="lineno">18963</span>&#160;    <span class="keywordflow">return</span> res;</div>
+<div class="line"><a name="l18964"></a><span class="lineno">18964</span>&#160;}</div>
+<div class="line"><a name="l18965"></a><span class="lineno">18965</span>&#160; </div>
+<div class="line"><a name="l18966"></a><span class="lineno">18966</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae50d2cb3b4a3bfd4dd40987234e50e7e">vmaDestroyImage</a>(</div>
+<div class="line"><a name="l18967"></a><span class="lineno">18967</span>&#160;    <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
+<div class="line"><a name="l18968"></a><span class="lineno">18968</span>&#160;    VkImage image,</div>
+<div class="line"><a name="l18969"></a><span class="lineno">18969</span>&#160;    <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</div>
+<div class="line"><a name="l18970"></a><span class="lineno">18970</span>&#160;{</div>
+<div class="line"><a name="l18971"></a><span class="lineno">18971</span>&#160;    VMA_ASSERT(allocator);</div>
+<div class="line"><a name="l18972"></a><span class="lineno">18972</span>&#160; </div>
+<div class="line"><a name="l18973"></a><span class="lineno">18973</span>&#160;    <span class="keywordflow">if</span>(image == VK_NULL_HANDLE &amp;&amp; allocation == VK_NULL_HANDLE)</div>
+<div class="line"><a name="l18974"></a><span class="lineno">18974</span>&#160;    {</div>
+<div class="line"><a name="l18975"></a><span class="lineno">18975</span>&#160;        <span class="keywordflow">return</span>;</div>
+<div class="line"><a name="l18976"></a><span class="lineno">18976</span>&#160;    }</div>
+<div class="line"><a name="l18977"></a><span class="lineno">18977</span>&#160; </div>
+<div class="line"><a name="l18978"></a><span class="lineno">18978</span>&#160;    VMA_DEBUG_LOG(<span class="stringliteral">&quot;vmaDestroyImage&quot;</span>);</div>
+<div class="line"><a name="l18979"></a><span class="lineno">18979</span>&#160; </div>
+<div class="line"><a name="l18980"></a><span class="lineno">18980</span>&#160;    VMA_DEBUG_GLOBAL_MUTEX_LOCK</div>
+<div class="line"><a name="l18981"></a><span class="lineno">18981</span>&#160; </div>
+<div class="line"><a name="l18982"></a><span class="lineno">18982</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
+<div class="line"><a name="l18983"></a><span class="lineno">18983</span>&#160;    <span class="keywordflow">if</span>(allocator-&gt;GetRecorder() != VMA_NULL)</div>
+<div class="line"><a name="l18984"></a><span class="lineno">18984</span>&#160;    {</div>
+<div class="line"><a name="l18985"></a><span class="lineno">18985</span>&#160;        allocator-&gt;GetRecorder()-&gt;RecordDestroyImage(</div>
+<div class="line"><a name="l18986"></a><span class="lineno">18986</span>&#160;            allocator-&gt;GetCurrentFrameIndex(),</div>
+<div class="line"><a name="l18987"></a><span class="lineno">18987</span>&#160;            allocation);</div>
+<div class="line"><a name="l18988"></a><span class="lineno">18988</span>&#160;    }</div>
+<div class="line"><a name="l18989"></a><span class="lineno">18989</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l18990"></a><span class="lineno">18990</span>&#160; </div>
+<div class="line"><a name="l18991"></a><span class="lineno">18991</span>&#160;    <span class="keywordflow">if</span>(image != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l18992"></a><span class="lineno">18992</span>&#160;    {</div>
+<div class="line"><a name="l18993"></a><span class="lineno">18993</span>&#160;        (*allocator-&gt;GetVulkanFunctions().vkDestroyImage)(allocator-&gt;m_hDevice, image, allocator-&gt;GetAllocationCallbacks());</div>
+<div class="line"><a name="l18994"></a><span class="lineno">18994</span>&#160;    }</div>
+<div class="line"><a name="l18995"></a><span class="lineno">18995</span>&#160;    <span class="keywordflow">if</span>(allocation != VK_NULL_HANDLE)</div>
+<div class="line"><a name="l18996"></a><span class="lineno">18996</span>&#160;    {</div>
+<div class="line"><a name="l18997"></a><span class="lineno">18997</span>&#160;        allocator-&gt;FreeMemory(</div>
+<div class="line"><a name="l18998"></a><span class="lineno">18998</span>&#160;            1, <span class="comment">// allocationCount</span></div>
+<div class="line"><a name="l18999"></a><span class="lineno">18999</span>&#160;            &amp;allocation);</div>
+<div class="line"><a name="l19000"></a><span class="lineno">19000</span>&#160;    }</div>
+<div class="line"><a name="l19001"></a><span class="lineno">19001</span>&#160;}</div>
+<div class="line"><a name="l19002"></a><span class="lineno">19002</span>&#160; </div>
+<div class="line"><a name="l19003"></a><span class="lineno">19003</span>&#160;<span class="preprocessor">#endif // #ifdef VMA_IMPLEMENTATION</span></div>
 </div><!-- fragment --></div><!-- contents -->
 <div class="ttc" id="avk__mem__alloc_8h_html_a21813b2efdf3836767a9058cd8a94034"><div class="ttname"><a href="vk__mem__alloc_8h.html#a21813b2efdf3836767a9058cd8a94034">VmaStats</a></div><div class="ttdeci">struct VmaStats VmaStats</div><div class="ttdoc">General statistics from current state of Allocator.</div></div>
-<div class="ttc" id="astruct_vma_record_settings_html"><div class="ttname"><a href="struct_vma_record_settings.html">VmaRecordSettings</a></div><div class="ttdoc">Parameters for recording calls to VMA functions. To be used in VmaAllocatorCreateInfo::pRecordSetting...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2244</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a2943bf99dfd784a0e8f599d987e22e6c"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c">VmaVulkanFunctions::vkAllocateMemory</a></div><div class="ttdeci">PFN_vkAllocateMemory vkAllocateMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2202</div></div>
-<div class="ttc" id="astruct_vma_device_memory_callbacks_html_abe8a3328bbc916f6f712fdb6b299444c"><div class="ttname"><a href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">VmaDeviceMemoryCallbacks::pfnFree</a></div><div class="ttdeci">PFN_vmaFreeDeviceMemoryFunction pfnFree</div><div class="ttdoc">Optional, can be null.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2090</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e">VMA_RECORD_FLAG_BITS_MAX_ENUM</a></div><div class="ttdeci">@ VMA_RECORD_FLAG_BITS_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2239</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a77b7a74082823e865dd6546623468f96"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a77b7a74082823e865dd6546623468f96">VmaVulkanFunctions::vkGetPhysicalDeviceProperties</a></div><div class="ttdeci">PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2200</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_a08230f04ae6ccf8a78150a9e829a7156"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156">VmaAllocatorCreateInfo::physicalDevice</a></div><div class="ttdeci">VkPhysicalDevice physicalDevice</div><div class="ttdoc">Vulkan physical device.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2265</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a></div><div class="ttdeci">@ VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</div><div class="ttdoc">Enables alternative, linear allocation algorithm in this pool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2862</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a3cf86ab32c1da779b4923d301a3056ba"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">VmaDefragmentationInfo2::allocationCount</a></div><div class="ttdeci">uint32_t allocationCount</div><div class="ttdoc">Number of allocations in pAllocations array.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3421</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_a21ea188dd212b8171cb9ecbed4a2a3a7"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7">VmaAllocatorCreateInfo::frameInUseCount</a></div><div class="ttdeci">uint32_t frameInUseCount</div><div class="ttdoc">Maximum number of additional frames that are in use at the same time as current frame.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2291</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0">VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2153</div></div>
-<div class="ttc" id="astruct_vma_budget_html"><div class="ttname"><a href="struct_vma_budget.html">VmaBudget</a></div><div class="ttdoc">Statistics of current memory usage and available budget, in bytes, for specific memory heap.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2463</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_pass_move_info_html_a06eb0c8690aa0d3478a036753492e769"><div class="ttname"><a href="struct_vma_defragmentation_pass_move_info.html#a06eb0c8690aa0d3478a036753492e769">VmaDefragmentationPassMoveInfo::memory</a></div><div class="ttdeci">VkDeviceMemory memory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3489</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a0d0eb0c1102268fa9a476d12ecbe4006"><div class="ttname"><a href="vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006">vmaInvalidateAllocation</a></div><div class="ttdeci">void vmaInvalidateAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)</div><div class="ttdoc">Invalidates memory of given allocation.</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a3c9c6aa5c97d5670f8e362b3a6f3029b"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">VmaDefragmentationInfo2::pPools</a></div><div class="ttdeci">const VmaPool * pPools</div><div class="ttdoc">Either null or pointer to array of pools to be defragmented.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3455</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d">VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2608</div></div>
+<div class="ttc" id="astruct_vma_record_settings_html"><div class="ttname"><a href="struct_vma_record_settings.html">VmaRecordSettings</a></div><div class="ttdoc">Parameters for recording calls to VMA functions. To be used in VmaAllocatorCreateInfo::pRecordSetting...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2245</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a2943bf99dfd784a0e8f599d987e22e6c"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c">VmaVulkanFunctions::vkAllocateMemory</a></div><div class="ttdeci">PFN_vkAllocateMemory vkAllocateMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2203</div></div>
+<div class="ttc" id="astruct_vma_device_memory_callbacks_html_abe8a3328bbc916f6f712fdb6b299444c"><div class="ttname"><a href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">VmaDeviceMemoryCallbacks::pfnFree</a></div><div class="ttdeci">PFN_vmaFreeDeviceMemoryFunction pfnFree</div><div class="ttdoc">Optional, can be null.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2091</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e">VMA_RECORD_FLAG_BITS_MAX_ENUM</a></div><div class="ttdeci">@ VMA_RECORD_FLAG_BITS_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2240</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a77b7a74082823e865dd6546623468f96"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a77b7a74082823e865dd6546623468f96">VmaVulkanFunctions::vkGetPhysicalDeviceProperties</a></div><div class="ttdeci">PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2201</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_a08230f04ae6ccf8a78150a9e829a7156"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156">VmaAllocatorCreateInfo::physicalDevice</a></div><div class="ttdeci">VkPhysicalDevice physicalDevice</div><div class="ttdoc">Vulkan physical device.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2266</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a></div><div class="ttdeci">@ VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</div><div class="ttdoc">Enables alternative, linear allocation algorithm in this pool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2863</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a3cf86ab32c1da779b4923d301a3056ba"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">VmaDefragmentationInfo2::allocationCount</a></div><div class="ttdeci">uint32_t allocationCount</div><div class="ttdoc">Number of allocations in pAllocations array.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3470</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_a21ea188dd212b8171cb9ecbed4a2a3a7"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7">VmaAllocatorCreateInfo::frameInUseCount</a></div><div class="ttdeci">uint32_t frameInUseCount</div><div class="ttdoc">Maximum number of additional frames that are in use at the same time as current frame.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2292</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0">VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2154</div></div>
+<div class="ttc" id="astruct_vma_budget_html"><div class="ttname"><a href="struct_vma_budget.html">VmaBudget</a></div><div class="ttdoc">Statistics of current memory usage and available budget, in bytes, for specific memory heap.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2464</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_pass_move_info_html_a06eb0c8690aa0d3478a036753492e769"><div class="ttname"><a href="struct_vma_defragmentation_pass_move_info.html#a06eb0c8690aa0d3478a036753492e769">VmaDefragmentationPassMoveInfo::memory</a></div><div class="ttdeci">VkDeviceMemory memory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3538</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a3c9c6aa5c97d5670f8e362b3a6f3029b"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a3c9c6aa5c97d5670f8e362b3a6f3029b">VmaDefragmentationInfo2::pPools</a></div><div class="ttdeci">const VmaPool * pPools</div><div class="ttdoc">Either null or pointer to array of pools to be defragmented.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3504</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d">VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2609</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a2bf47f96bf92bed2a49461bd9af3acfa"><div class="ttname"><a href="vk__mem__alloc_8h.html#a2bf47f96bf92bed2a49461bd9af3acfa">VmaDefragmentationInfo</a></div><div class="ttdeci">struct VmaDefragmentationInfo VmaDefragmentationInfo</div><div class="ttdoc">Deprecated. Optional configuration parameters to be passed to function vmaDefragment().</div></div>
-<div class="ttc" id="astruct_vma_pool_stats_html"><div class="ttname"><a href="struct_vma_pool_stats.html">VmaPoolStats</a></div><div class="ttdoc">Describes parameter of existing VmaPool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2934</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2691</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d">VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT</div><div class="ttdoc">Allocator and all objects created from it will not be synchronized internally, so you must guarantee ...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2101</div></div>
-<div class="ttc" id="astruct_vma_pool_stats_html_ad7c54874724fce7b06aba526202d82a8"><div class="ttname"><a href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">VmaPoolStats::unusedSize</a></div><div class="ttdeci">VkDeviceSize unusedSize</div><div class="ttdoc">Total number of bytes in the pool not used by any VmaAllocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2940</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2671</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a4dd2c44642312a147a4e93373a6e64d2"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2">VmaRecordFlagBits</a></div><div class="ttdeci">VmaRecordFlagBits</div><div class="ttdoc">Flags to be used in VmaRecordSettings::flags.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2231</div></div>
+<div class="ttc" id="astruct_vma_pool_stats_html"><div class="ttname"><a href="struct_vma_pool_stats.html">VmaPoolStats</a></div><div class="ttdoc">Describes parameter of existing VmaPool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2935</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2692</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d">VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT</div><div class="ttdoc">Allocator and all objects created from it will not be synchronized internally, so you must guarantee ...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2102</div></div>
+<div class="ttc" id="astruct_vma_pool_stats_html_ad7c54874724fce7b06aba526202d82a8"><div class="ttname"><a href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">VmaPoolStats::unusedSize</a></div><div class="ttdeci">VkDeviceSize unusedSize</div><div class="ttdoc">Total number of bytes in the pool not used by any VmaAllocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2941</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2672</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4dd2c44642312a147a4e93373a6e64d2"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2">VmaRecordFlagBits</a></div><div class="ttdeci">VmaRecordFlagBits</div><div class="ttdoc">Flags to be used in VmaRecordSettings::flags.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2232</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_adbae3a0b4ab078024462fc85c37f3b58"><div class="ttname"><a href="vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58">vmaSetPoolName</a></div><div class="ttdeci">void vmaSetPoolName(VmaAllocator allocator, VmaPool pool, const char *pName)</div><div class="ttdoc">Sets name of a custom pool.</div></div>
-<div class="ttc" id="astruct_vma_device_memory_callbacks_html"><div class="ttname"><a href="struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks</a></div><div class="ttdoc">Set of callbacks that the library will call for vkAllocateMemory and vkFreeMemory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2086</div></div>
+<div class="ttc" id="astruct_vma_device_memory_callbacks_html"><div class="ttname"><a href="struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks</a></div><div class="ttdoc">Set of callbacks that the library will call for vkAllocateMemory and vkFreeMemory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2087</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a43d8ba9673c846f049089a5029d5c73a"><div class="ttname"><a href="vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a">vmaTouchAllocation</a></div><div class="ttdeci">VkBool32 vmaTouchAllocation(VmaAllocator allocator, VmaAllocation allocation)</div><div class="ttdoc">Returns VK_TRUE if allocation is not lost and atomically marks it as used in current frame.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2658</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_a8e4714298e3121cdd8b214a1ae7a637a"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a">VmaAllocatorCreateInfo::preferredLargeHeapBlockSize</a></div><div class="ttdeci">VkDeviceSize preferredLargeHeapBlockSize</div><div class="ttdoc">Preferred size of a single VkDeviceMemory block to be allocated from large heaps &gt; 1 GiB....</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2271</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7">VMA_RECORD_FLUSH_AFTER_CALL_BIT</a></div><div class="ttdeci">@ VMA_RECORD_FLUSH_AFTER_CALL_BIT</div><div class="ttdoc">Enables flush after recording every function call.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2237</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2659</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_a8e4714298e3121cdd8b214a1ae7a637a"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a">VmaAllocatorCreateInfo::preferredLargeHeapBlockSize</a></div><div class="ttdeci">VkDeviceSize preferredLargeHeapBlockSize</div><div class="ttdoc">Preferred size of a single VkDeviceMemory block to be allocated from large heaps &gt; 1 GiB....</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2272</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7">VMA_RECORD_FLUSH_AFTER_CALL_BIT</a></div><div class="ttdeci">@ VMA_RECORD_FLUSH_AFTER_CALL_BIT</div><div class="ttdoc">Enables flush after recording every function call.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2238</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a3bf110892ea2fb4649fedb68488d026a"><div class="ttname"><a href="vk__mem__alloc_8h.html#a3bf110892ea2fb4649fedb68488d026a">VmaAllocationCreateInfo</a></div><div class="ttdeci">struct VmaAllocationCreateInfo VmaAllocationCreateInfo</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a0ff488958ca72b28e545880463cb8696"><div class="ttname"><a href="vk__mem__alloc_8h.html#a0ff488958ca72b28e545880463cb8696">vmaResizeAllocation</a></div><div class="ttdeci">VkResult vmaResizeAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize newSize)</div><div class="ttdoc">Deprecated.</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_acc798589736f0becb317fc2196c1d8b9"><div class="ttname"><a href="struct_vma_vulkan_functions.html#acc798589736f0becb317fc2196c1d8b9">VmaVulkanFunctions::vkUnmapMemory</a></div><div class="ttdeci">PFN_vkUnmapMemory vkUnmapMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2205</div></div>
-<div class="ttc" id="astruct_vma_allocation_info_html_ae0bfb7dfdf79a76ffefc9a94677a2f67"><div class="ttname"><a href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">VmaAllocationInfo::deviceMemory</a></div><div class="ttdeci">VkDeviceMemory deviceMemory</div><div class="ttdoc">Handle to Vulkan memory object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3077</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html_ae06129c771bfebfd6468a7f4276502a9"><div class="ttname"><a href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">VmaStatInfo::unusedRangeCount</a></div><div class="ttdeci">uint32_t unusedRangeCount</div><div class="ttdoc">Number of free ranges of memory between allocations.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2431</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_a8259e85c272683434f4abb4ddddffe19"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">VmaAllocationCreateInfo::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2765</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html_a5ba1a2476c4d39b10f7e2f7ebbb72ac4"><div class="ttname"><a href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">VmaStatInfo::unusedRangeSizeMax</a></div><div class="ttdeci">VkDeviceSize unusedRangeSizeMax</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2437</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_ab5c1f38dea3a2cf00dc9eb4f57218c49"><div class="ttname"><a href="struct_vma_vulkan_functions.html#ab5c1f38dea3a2cf00dc9eb4f57218c49">VmaVulkanFunctions::vkMapMemory</a></div><div class="ttdeci">PFN_vkMapMemory vkMapMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2204</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a1f0c126759fc96ccb6e2d23c101d770c"><div class="ttname"><a href="vk__mem__alloc_8h.html#a1f0c126759fc96ccb6e2d23c101d770c">VMA_RECORDING_ENABLED</a></div><div class="ttdeci">#define VMA_RECORDING_ENABLED</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:1894</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_pass_move_info_html_a8ab4508bc03625b0653c880576be96c6"><div class="ttname"><a href="struct_vma_defragmentation_pass_move_info.html#a8ab4508bc03625b0653c880576be96c6">VmaDefragmentationPassMoveInfo::offset</a></div><div class="ttdeci">VkDeviceSize offset</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3490</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_pass_info_html_acbd42d4a3357999da130a95cd99a3792"><div class="ttname"><a href="struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792">VmaDefragmentationPassInfo::pMoves</a></div><div class="ttdeci">VmaDefragmentationPassMoveInfo * pMoves</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3499</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2702</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_acc798589736f0becb317fc2196c1d8b9"><div class="ttname"><a href="struct_vma_vulkan_functions.html#acc798589736f0becb317fc2196c1d8b9">VmaVulkanFunctions::vkUnmapMemory</a></div><div class="ttdeci">PFN_vkUnmapMemory vkUnmapMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2206</div></div>
+<div class="ttc" id="astruct_vma_allocation_info_html_ae0bfb7dfdf79a76ffefc9a94677a2f67"><div class="ttname"><a href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">VmaAllocationInfo::deviceMemory</a></div><div class="ttdeci">VkDeviceMemory deviceMemory</div><div class="ttdoc">Handle to Vulkan memory object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3078</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html_ae06129c771bfebfd6468a7f4276502a9"><div class="ttname"><a href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">VmaStatInfo::unusedRangeCount</a></div><div class="ttdeci">uint32_t unusedRangeCount</div><div class="ttdoc">Number of free ranges of memory between allocations.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2432</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_a8259e85c272683434f4abb4ddddffe19"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">VmaAllocationCreateInfo::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2766</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html_a5ba1a2476c4d39b10f7e2f7ebbb72ac4"><div class="ttname"><a href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">VmaStatInfo::unusedRangeSizeMax</a></div><div class="ttdeci">VkDeviceSize unusedRangeSizeMax</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2438</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_ab5c1f38dea3a2cf00dc9eb4f57218c49"><div class="ttname"><a href="struct_vma_vulkan_functions.html#ab5c1f38dea3a2cf00dc9eb4f57218c49">VmaVulkanFunctions::vkMapMemory</a></div><div class="ttdeci">PFN_vkMapMemory vkMapMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2205</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a1f0c126759fc96ccb6e2d23c101d770c"><div class="ttname"><a href="vk__mem__alloc_8h.html#a1f0c126759fc96ccb6e2d23c101d770c">VMA_RECORDING_ENABLED</a></div><div class="ttdeci">#define VMA_RECORDING_ENABLED</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:1895</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_pass_move_info_html_a8ab4508bc03625b0653c880576be96c6"><div class="ttname"><a href="struct_vma_defragmentation_pass_move_info.html#a8ab4508bc03625b0653c880576be96c6">VmaDefragmentationPassMoveInfo::offset</a></div><div class="ttdeci">VkDeviceSize offset</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3539</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_pass_info_html_acbd42d4a3357999da130a95cd99a3792"><div class="ttname"><a href="struct_vma_defragmentation_pass_info.html#acbd42d4a3357999da130a95cd99a3792">VmaDefragmentationPassInfo::pMoves</a></div><div class="ttdeci">VmaDefragmentationPassMoveInfo * pMoves</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3548</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2703</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a9bc268595cb33f6ec4d519cfce81ff45"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45">vmaUnmapMemory</a></div><div class="ttdeci">void vmaUnmapMemory(VmaAllocator allocator, VmaAllocation allocation)</div><div class="ttdoc">Unmaps memory represented by given allocation, mapped previously using vmaMapMemory().</div></div>
-<div class="ttc" id="astruct_vma_allocator_info_html_a2ed6a4d2d3fea039d66a13f15d0ce5fe"><div class="ttname"><a href="struct_vma_allocator_info.html#a2ed6a4d2d3fea039d66a13f15d0ce5fe">VmaAllocatorInfo::instance</a></div><div class="ttdeci">VkInstance instance</div><div class="ttdoc">Handle to Vulkan instance object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2363</div></div>
-<div class="ttc" id="astruct_vma_budget_html_a84dd1ecca8b0110259eb206dbadb11f6"><div class="ttname"><a href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">VmaBudget::usage</a></div><div class="ttdeci">VkDeviceSize usage</div><div class="ttdoc">Estimated current memory usage of the program, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2488</div></div>
+<div class="ttc" id="astruct_vma_allocator_info_html_a2ed6a4d2d3fea039d66a13f15d0ce5fe"><div class="ttname"><a href="struct_vma_allocator_info.html#a2ed6a4d2d3fea039d66a13f15d0ce5fe">VmaAllocatorInfo::instance</a></div><div class="ttdeci">VkInstance instance</div><div class="ttdoc">Handle to Vulkan instance object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2364</div></div>
+<div class="ttc" id="astruct_vma_budget_html_a84dd1ecca8b0110259eb206dbadb11f6"><div class="ttname"><a href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">VmaBudget::usage</a></div><div class="ttdeci">VkDeviceSize usage</div><div class="ttdoc">Estimated current memory usage of the program, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2489</div></div>
 <div class="ttc" id="astruct_vma_allocator_html"><div class="ttname"><a href="struct_vma_allocator.html">VmaAllocator</a></div><div class="ttdoc">Represents main object of this library initialized.</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_ae5c0db8c89a3b82593dc16aa6a49fa3a"><div class="ttname"><a href="struct_vma_vulkan_functions.html#ae5c0db8c89a3b82593dc16aa6a49fa3a">VmaVulkanFunctions::vkCmdCopyBuffer</a></div><div class="ttdeci">PFN_vkCmdCopyBuffer vkCmdCopyBuffer</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2216</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html"><div class="ttname"><a href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a></div><div class="ttdoc">Description of a Allocator to be created.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2259</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</div><div class="ttdoc">Set this flag to only try to allocate from existing VkDeviceMemory blocks and never create new such b...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2632</div></div>
-<div class="ttc" id="astruct_vma_allocator_info_html_a012b4c485bf3b0ea8921352c5ee0c357"><div class="ttname"><a href="struct_vma_allocator_info.html#a012b4c485bf3b0ea8921352c5ee0c357">VmaAllocatorInfo::device</a></div><div class="ttdeci">VkDevice device</div><div class="ttdoc">Handle to Vulkan device object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2373</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97"><div class="ttname"><a href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97">VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM</a></div><div class="ttdeci">@ VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3407</div></div>
-<div class="ttc" id="astruct_vma_pool_stats_html_ab4c8f52dd42ab01998f60f0b6acc722b"><div class="ttname"><a href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">VmaPoolStats::unusedRangeSizeMax</a></div><div class="ttdeci">VkDeviceSize unusedRangeSizeMax</div><div class="ttdoc">Size of the largest continuous free memory region available for new allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2953</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2695</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</div><div class="ttdoc">Enables usage of VK_KHR_dedicated_allocation extension.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2126</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_ae5c0db8c89a3b82593dc16aa6a49fa3a"><div class="ttname"><a href="struct_vma_vulkan_functions.html#ae5c0db8c89a3b82593dc16aa6a49fa3a">VmaVulkanFunctions::vkCmdCopyBuffer</a></div><div class="ttdeci">PFN_vkCmdCopyBuffer vkCmdCopyBuffer</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2217</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html"><div class="ttname"><a href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a></div><div class="ttdoc">Description of a Allocator to be created.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2260</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</div><div class="ttdoc">Set this flag to only try to allocate from existing VkDeviceMemory blocks and never create new such b...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2633</div></div>
+<div class="ttc" id="astruct_vma_allocator_info_html_a012b4c485bf3b0ea8921352c5ee0c357"><div class="ttname"><a href="struct_vma_allocator_info.html#a012b4c485bf3b0ea8921352c5ee0c357">VmaAllocatorInfo::device</a></div><div class="ttdeci">VkDevice device</div><div class="ttdoc">Handle to Vulkan device object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2374</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97"><div class="ttname"><a href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97">VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM</a></div><div class="ttdeci">@ VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3456</div></div>
+<div class="ttc" id="astruct_vma_pool_stats_html_ab4c8f52dd42ab01998f60f0b6acc722b"><div class="ttname"><a href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">VmaPoolStats::unusedRangeSizeMax</a></div><div class="ttdeci">VkDeviceSize unusedRangeSizeMax</div><div class="ttdoc">Size of the largest continuous free memory region available for new allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2954</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2696</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</div><div class="ttdoc">Enables usage of VK_KHR_dedicated_allocation extension.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2127</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ade56bf8dc9f5a5eaddf5f119ed525236"><div class="ttname"><a href="vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236">vmaSetCurrentFrameIndex</a></div><div class="ttdeci">void vmaSetCurrentFrameIndex(VmaAllocator allocator, uint32_t frameIndex)</div><div class="ttdoc">Sets index of the current frame.</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info_html_aa7c7304e13c71f604c907196c4e28fbc"><div class="ttname"><a href="struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc">VmaDefragmentationInfo::maxAllocationsToMove</a></div><div class="ttdeci">uint32_t maxAllocationsToMove</div><div class="ttdoc">Maximum number of allocations that can be moved to different place.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3516</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d">VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2686</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cc"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a></div><div class="ttdeci">VmaMemoryUsage</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2546</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info_html_aa7c7304e13c71f604c907196c4e28fbc"><div class="ttname"><a href="struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc">VmaDefragmentationInfo::maxAllocationsToMove</a></div><div class="ttdeci">uint32_t maxAllocationsToMove</div><div class="ttdoc">Maximum number of allocations that can be moved to different place.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3565</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d">VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2687</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cc"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a></div><div class="ttdeci">VmaMemoryUsage</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2547</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a834b1e4aef395c0a1d56a28e69a4a17e"><div class="ttname"><a href="vk__mem__alloc_8h.html#a834b1e4aef395c0a1d56a28e69a4a17e">vmaFreeMemoryPages</a></div><div class="ttdeci">void vmaFreeMemoryPages(VmaAllocator allocator, size_t allocationCount, const VmaAllocation *pAllocations)</div><div class="ttdoc">Frees memory and destroys multiple allocations.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a8701444752eb5de4464adb5a2b514bca"><div class="ttname"><a href="vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca">vmaGetMemoryTypeProperties</a></div><div class="ttdeci">void vmaGetMemoryTypeProperties(VmaAllocator allocator, uint32_t memoryTypeIndex, VkMemoryPropertyFlags *pFlags)</div><div class="ttdoc">Given Memory Type Index, returns Property Flags of this memory type.</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html_abc4bb7cd611900778464c56e50c970a4"><div class="ttname"><a href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">VmaStatInfo::blockCount</a></div><div class="ttdeci">uint32_t blockCount</div><div class="ttdoc">Number of VkDeviceMemory Vulkan memory blocks allocated.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2427</div></div>
-<div class="ttc" id="astruct_vma_pool_create_info_html_a596fa76b685d3f1f688f84a709a5b319"><div class="ttname"><a href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">VmaPoolCreateInfo::memoryTypeIndex</a></div><div class="ttdeci">uint32_t memoryTypeIndex</div><div class="ttdoc">Vulkan memory type index to allocate this pool from.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2890</div></div>
-<div class="ttc" id="astruct_vma_pool_create_info_html_aa4265160536cdb9be821b7686c16c676"><div class="ttname"><a href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676">VmaPoolCreateInfo::blockSize</a></div><div class="ttdeci">VkDeviceSize blockSize</div><div class="ttdoc">Size of a single VkDeviceMemory block to be allocated as part of this pool, in bytes....</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2902</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a7e70aa2a1081d849dcc7829b19d3ec9d"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">VmaDefragmentationInfo2::poolCount</a></div><div class="ttdeci">uint32_t poolCount</div><div class="ttdoc">Numer of pools in pPools array.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3439</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_pass_move_info_html"><div class="ttname"><a href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3487</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html_abc4bb7cd611900778464c56e50c970a4"><div class="ttname"><a href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">VmaStatInfo::blockCount</a></div><div class="ttdeci">uint32_t blockCount</div><div class="ttdoc">Number of VkDeviceMemory Vulkan memory blocks allocated.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2428</div></div>
+<div class="ttc" id="astruct_vma_pool_create_info_html_a596fa76b685d3f1f688f84a709a5b319"><div class="ttname"><a href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">VmaPoolCreateInfo::memoryTypeIndex</a></div><div class="ttdeci">uint32_t memoryTypeIndex</div><div class="ttdoc">Vulkan memory type index to allocate this pool from.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2891</div></div>
+<div class="ttc" id="astruct_vma_pool_create_info_html_aa4265160536cdb9be821b7686c16c676"><div class="ttname"><a href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676">VmaPoolCreateInfo::blockSize</a></div><div class="ttdeci">VkDeviceSize blockSize</div><div class="ttdoc">Size of a single VkDeviceMemory block to be allocated as part of this pool, in bytes....</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2903</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a7e70aa2a1081d849dcc7829b19d3ec9d"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">VmaDefragmentationInfo2::poolCount</a></div><div class="ttdeci">uint32_t poolCount</div><div class="ttdoc">Numer of pools in pPools array.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3488</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_pass_move_info_html"><div class="ttname"><a href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3536</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_aa4fee7eb5253377599ef4fd38c93c2a0"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0">vmaBuildStatsString</a></div><div class="ttdeci">void vmaBuildStatsString(VmaAllocator allocator, char **ppStatsString, VkBool32 detailedMap)</div><div class="ttdoc">Builds and returns statistics as string in JSON format.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a86dd08aba8633bfa4ad0df2e76481d8b"><div class="ttname"><a href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a></div><div class="ttdeci">void vmaGetAllocationInfo(VmaAllocator allocator, VmaAllocation allocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">Returns current information about specified allocation and atomically marks it as used in current fra...</div></div>
-<div class="ttc" id="astruct_vma_pool_stats_html_ad1924eb54fffa45e9e0e65670c8fe5eb"><div class="ttname"><a href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">VmaPoolStats::allocationCount</a></div><div class="ttdeci">size_t allocationCount</div><div class="ttdoc">Number of VmaAllocation objects created from this pool that were not destroyed or lost.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2943</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_acfe6863e160722c2c1bbcf7573fddc4d"><div class="ttname"><a href="vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d">VmaAllocatorCreateFlags</a></div><div class="ttdeci">VkFlags VmaAllocatorCreateFlags</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2193</div></div>
+<div class="ttc" id="astruct_vma_pool_stats_html_ad1924eb54fffa45e9e0e65670c8fe5eb"><div class="ttname"><a href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">VmaPoolStats::allocationCount</a></div><div class="ttdeci">size_t allocationCount</div><div class="ttdoc">Number of VmaAllocation objects created from this pool that were not destroyed or lost.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2944</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_acfe6863e160722c2c1bbcf7573fddc4d"><div class="ttname"><a href="vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d">VmaAllocatorCreateFlags</a></div><div class="ttdeci">VkFlags VmaAllocatorCreateFlags</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2194</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a3104eb30d8122c84dd8541063f145288"><div class="ttname"><a href="vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288">vmaFreeStatsString</a></div><div class="ttdeci">void vmaFreeStatsString(VmaAllocator allocator, char *pStatsString)</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a7fdf64415b6c3d83c454f28d2c53df7b"><div class="ttname"><a href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer</a></div><div class="ttdeci">VkResult vmaAllocateMemoryForBuffer(VmaAllocator allocator, VkBuffer buffer, const VmaAllocationCreateInfo *pCreateInfo, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_abb0a8e3b5040d847571cca6c7f9a8074"><div class="ttname"><a href="vk__mem__alloc_8h.html#abb0a8e3b5040d847571cca6c7f9a8074">VmaVulkanFunctions</a></div><div class="ttdeci">struct VmaVulkanFunctions VmaVulkanFunctions</div><div class="ttdoc">Pointers to some Vulkan functions - a subset used by the library.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c">VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2191</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a6552a65b71d16f378c6994b3ceaef50c"><div class="ttname"><a href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50c">VmaDefragmentationFlagBits</a></div><div class="ttdeci">VmaDefragmentationFlagBits</div><div class="ttdoc">Flags to be used in vmaDefragmentationBegin(). None at the moment. Reserved for future use.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3405</div></div>
-<div class="ttc" id="astruct_vma_allocation_info_html_a4a3c732388dbdc7a23f9365b00825268"><div class="ttname"><a href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">VmaAllocationInfo::offset</a></div><div class="ttdeci">VkDeviceSize offset</div><div class="ttdoc">Offset into deviceMemory object to the beginning of this allocation, in bytes. (deviceMemory,...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3082</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597">VmaAllocationCreateFlagBits</a></div><div class="ttdeci">VmaAllocationCreateFlagBits</div><div class="ttdoc">Flags to be passed as VmaAllocationCreateInfo::flags.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2614</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a60d25c33bba06bb8592e6875cbaa9830"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a60d25c33bba06bb8592e6875cbaa9830">VmaVulkanFunctions::vkGetPhysicalDeviceMemoryProperties</a></div><div class="ttdeci">PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2201</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a2770e325ea42e087c1b91fdf46d0292a"><div class="ttname"><a href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a">VmaPoolCreateFlags</a></div><div class="ttdeci">VkFlags VmaPoolCreateFlags</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2883</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c">VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2192</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a6552a65b71d16f378c6994b3ceaef50c"><div class="ttname"><a href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50c">VmaDefragmentationFlagBits</a></div><div class="ttdeci">VmaDefragmentationFlagBits</div><div class="ttdoc">Flags to be used in vmaDefragmentationBegin(). None at the moment. Reserved for future use.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3454</div></div>
+<div class="ttc" id="astruct_vma_allocation_info_html_a4a3c732388dbdc7a23f9365b00825268"><div class="ttname"><a href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">VmaAllocationInfo::offset</a></div><div class="ttdeci">VkDeviceSize offset</div><div class="ttdoc">Offset into deviceMemory object to the beginning of this allocation, in bytes. (deviceMemory,...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3083</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597">VmaAllocationCreateFlagBits</a></div><div class="ttdeci">VmaAllocationCreateFlagBits</div><div class="ttdoc">Flags to be passed as VmaAllocationCreateInfo::flags.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2615</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a60d25c33bba06bb8592e6875cbaa9830"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a60d25c33bba06bb8592e6875cbaa9830">VmaVulkanFunctions::vkGetPhysicalDeviceMemoryProperties</a></div><div class="ttdeci">PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2202</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a2770e325ea42e087c1b91fdf46d0292a"><div class="ttname"><a href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a">VmaPoolCreateFlags</a></div><div class="ttdeci">VkFlags VmaPoolCreateFlags</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2884</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ae5c9657d9e94756269145b01c05d16f1"><div class="ttname"><a href="vk__mem__alloc_8h.html#ae5c9657d9e94756269145b01c05d16f1">vmaCreateLostAllocation</a></div><div class="ttdeci">void vmaCreateLostAllocation(VmaAllocator allocator, VmaAllocation *pAllocation)</div><div class="ttdoc">Creates new allocation that is in lost state from the beginning.</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ab25b558d75f7378ec944a1522fdcc3c5"><div class="ttname"><a href="vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5">vmaInvalidateAllocations</a></div><div class="ttdeci">VkResult vmaInvalidateAllocations(VmaAllocator allocator, uint32_t allocationCount, const VmaAllocation *allocations, const VkDeviceSize *offsets, const VkDeviceSize *sizes)</div><div class="ttdoc">Invalidates memory of given set of allocations.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a77692d3c8770ea8882d573206bd27b2b"><div class="ttname"><a href="vk__mem__alloc_8h.html#a77692d3c8770ea8882d573206bd27b2b">VmaDeviceMemoryCallbacks</a></div><div class="ttdeci">struct VmaDeviceMemoryCallbacks VmaDeviceMemoryCallbacks</div><div class="ttdoc">Set of callbacks that the library will call for vkAllocateMemory and vkFreeMemory.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_aecabf7b6e91ea87d0316fa0a9e014fe0"><div class="ttname"><a href="vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0">vmaGetPhysicalDeviceProperties</a></div><div class="ttdeci">void vmaGetPhysicalDeviceProperties(VmaAllocator allocator, const VkPhysicalDeviceProperties **ppPhysicalDeviceProperties)</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_a6272c0555cfd1fe28bff1afeb6190150"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">VmaAllocationCreateInfo::pool</a></div><div class="ttdeci">VmaPool pool</div><div class="ttdoc">Pool that this allocation should be created in.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2758</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_a6272c0555cfd1fe28bff1afeb6190150"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">VmaAllocationCreateInfo::pool</a></div><div class="ttdeci">VmaPool pool</div><div class="ttdoc">Pool that this allocation should be created in.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2759</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ab88db292a17974f911182543fda52d19"><div class="ttname"><a href="vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19">vmaGetMemoryProperties</a></div><div class="ttdeci">void vmaGetMemoryProperties(VmaAllocator allocator, const VkPhysicalDeviceMemoryProperties **ppPhysicalDeviceMemoryProperties)</div></div>
-<div class="ttc" id="astruct_vma_stats_html_a2e8f5b3353f2fefef3c27f29e245a1f9"><div class="ttname"><a href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">VmaStats::total</a></div><div class="ttdeci">VmaStatInfo total</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2445</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</div><div class="ttdoc">Set this flag if the allocation should have its own memory block.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2621</div></div>
+<div class="ttc" id="astruct_vma_stats_html_a2e8f5b3353f2fefef3c27f29e245a1f9"><div class="ttname"><a href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">VmaStats::total</a></div><div class="ttdeci">VmaStatInfo total</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2446</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</div><div class="ttdoc">Set this flag if the allocation should have its own memory block.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2622</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a8774e20e91e245aae959ba63efa15dd2"><div class="ttname"><a href="vk__mem__alloc_8h.html#a8774e20e91e245aae959ba63efa15dd2">vmaDefragmentationEnd</a></div><div class="ttdeci">VkResult vmaDefragmentationEnd(VmaAllocator allocator, VmaDefragmentationContext context)</div><div class="ttdoc">Ends defragmentation process.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2141</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a53e844ee5633e229cf6daf14b2d9fff9"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9">VmaDefragmentationInfo2::flags</a></div><div class="ttdeci">VmaDefragmentationFlags flags</div><div class="ttdoc">Reserved for future use. Should be 0.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3418</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a1338d96a128a5ade648b8d934907c637"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a1338d96a128a5ade648b8d934907c637">VmaVulkanFunctions::vkBindImageMemory</a></div><div class="ttdeci">PFN_vkBindImageMemory vkBindImageMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2209</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a4ddbc898d0afe1518f863a3763628f08"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08">VmaDefragmentationInfo2::maxGpuBytesToMove</a></div><div class="ttdeci">VkDeviceSize maxGpuBytesToMove</div><div class="ttdoc">Maximum total numbers of bytes that can be copied while moving allocations to different places using ...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3470</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_stats_html"><div class="ttname"><a href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a></div><div class="ttdoc">Statistics returned by function vmaDefragment().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3520</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2142</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a53e844ee5633e229cf6daf14b2d9fff9"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9">VmaDefragmentationInfo2::flags</a></div><div class="ttdeci">VmaDefragmentationFlags flags</div><div class="ttdoc">Reserved for future use. Should be 0.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3467</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a1338d96a128a5ade648b8d934907c637"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a1338d96a128a5ade648b8d934907c637">VmaVulkanFunctions::vkBindImageMemory</a></div><div class="ttdeci">PFN_vkBindImageMemory vkBindImageMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2210</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a4ddbc898d0afe1518f863a3763628f08"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08">VmaDefragmentationInfo2::maxGpuBytesToMove</a></div><div class="ttdeci">VkDeviceSize maxGpuBytesToMove</div><div class="ttdoc">Maximum total numbers of bytes that can be copied while moving allocations to different places using ...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3519</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_stats_html"><div class="ttname"><a href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a></div><div class="ttdoc">Statistics returned by function vmaDefragment().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3569</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a5485779c8f1948238fc4e92232fa65e1"><div class="ttname"><a href="vk__mem__alloc_8h.html#a5485779c8f1948238fc4e92232fa65e1">vmaDestroyPool</a></div><div class="ttdeci">void vmaDestroyPool(VmaAllocator allocator, VmaPool pool)</div><div class="ttdoc">Destroys VmaPool object and frees Vulkan device memory.</div></div>
-<div class="ttc" id="astruct_vma_pool_stats_html_a326807b2de2b0931cee4ed9a5f2e420c"><div class="ttname"><a href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">VmaPoolStats::size</a></div><div class="ttdeci">VkDeviceSize size</div><div class="ttdoc">Total amount of VkDeviceMemory allocated from Vulkan for this pool, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2937</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a4c658701778564d62034255b5dda91b4"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a4c658701778564d62034255b5dda91b4">VmaVulkanFunctions::vkFreeMemory</a></div><div class="ttdeci">PFN_vkFreeMemory vkFreeMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2203</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_af3929a1a4547c592fc0b0e55ef452828"><div class="ttname"><a href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828">VmaRecordFlags</a></div><div class="ttdeci">VkFlags VmaRecordFlags</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2241</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_CPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2578</div></div>
+<div class="ttc" id="astruct_vma_pool_stats_html_a326807b2de2b0931cee4ed9a5f2e420c"><div class="ttname"><a href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">VmaPoolStats::size</a></div><div class="ttdeci">VkDeviceSize size</div><div class="ttdoc">Total amount of VkDeviceMemory allocated from Vulkan for this pool, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2938</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a4c658701778564d62034255b5dda91b4"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a4c658701778564d62034255b5dda91b4">VmaVulkanFunctions::vkFreeMemory</a></div><div class="ttdeci">PFN_vkFreeMemory vkFreeMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2204</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_af3929a1a4547c592fc0b0e55ef452828"><div class="ttname"><a href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828">VmaRecordFlags</a></div><div class="ttdeci">VkFlags VmaRecordFlags</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2242</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a30c37c1eec6025f397be41644f48490f"><div class="ttname"><a href="vk__mem__alloc_8h.html#a30c37c1eec6025f397be41644f48490f">vmaFlushAllocation</a></div><div class="ttdeci">VkResult vmaFlushAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)</div><div class="ttdoc">Flushes memory of given allocation.</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_CPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2579</div></div>
 <div class="ttc" id="astruct_vma_allocation_html"><div class="ttname"><a href="struct_vma_allocation.html">VmaAllocation</a></div><div class="ttdoc">Represents single memory allocation.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500">VMA_MEMORY_USAGE_CPU_COPY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_CPU_COPY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2600</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500">VMA_MEMORY_USAGE_CPU_COPY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_CPU_COPY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2601</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_af9147d31ffc11d62fc187bde283ed14f"><div class="ttname"><a href="vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f">vmaSetAllocationUserData</a></div><div class="ttdeci">void vmaSetAllocationUserData(VmaAllocator allocator, VmaAllocation allocation, void *pUserData)</div><div class="ttdoc">Sets pUserData in given allocation to new value.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33"><div class="ttname"><a href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a></div><div class="ttdeci">@ VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3406</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_ace2aa4877b16a42b0b7673d4e26000ee"><div class="ttname"><a href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee">VmaAllocatorCreateInfo::pRecordSettings</a></div><div class="ttdeci">const VmaRecordSettings * pRecordSettings</div><div class="ttdoc">Parameters for recording of VMA calls. Can be null.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2329</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a94fc4f3a605d9880bb3c0ba2c2fc80b2"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2">VmaVulkanFunctions::vkBindBufferMemory</a></div><div class="ttdeci">PFN_vkBindBufferMemory vkBindBufferMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2208</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a5b92901df89a4194b0d12f6071d4d143"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a5b92901df89a4194b0d12f6071d4d143">VmaVulkanFunctions::vkGetBufferMemoryRequirements</a></div><div class="ttdeci">PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2210</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a7f71f39590c5316771493d2333f9c1bd"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd">VmaDefragmentationInfo2::commandBuffer</a></div><div class="ttdeci">VkCommandBuffer commandBuffer</div><div class="ttdoc">Optional. Command buffer where GPU copy commands will be posted.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3484</div></div>
-<div class="ttc" id="astruct_vma_stats_html"><div class="ttname"><a href="struct_vma_stats.html">VmaStats</a></div><div class="ttdoc">General statistics from current state of Allocator.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2441</div></div>
-<div class="ttc" id="astruct_vma_pool_create_info_html_ad8006fb803185c0a699d30f3e9a865ae"><div class="ttname"><a href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae">VmaPoolCreateInfo::minBlockCount</a></div><div class="ttdeci">size_t minBlockCount</div><div class="ttdoc">Minimum number of blocks to be always allocated in this pool, even if they stay empty.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2907</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_ae0ffc55139b54520a6bb704b29ffc285"><div class="ttname"><a href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">VmaAllocatorCreateInfo::vulkanApiVersion</a></div><div class="ttdeci">uint32_t vulkanApiVersion</div><div class="ttdoc">Optional. The highest version of Vulkan that the application is designed to use.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2343</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html"><div class="ttname"><a href="struct_vma_stat_info.html">VmaStatInfo</a></div><div class="ttdoc">Calculated statistics of memory usage in entire allocator.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2424</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_stats_html_ab0cb9ac0dbc106c77e384ea676422f28"><div class="ttname"><a href="struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28">VmaDefragmentationStats::bytesFreed</a></div><div class="ttdeci">VkDeviceSize bytesFreed</div><div class="ttdoc">Total number of bytes that have been released to the system by freeing empty VkDeviceMemory objects.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3524</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33"><div class="ttname"><a href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50ca31af49446af2459284a568ce2f3fdd33">VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</a></div><div class="ttdeci">@ VMA_DEFRAGMENTATION_FLAG_INCREMENTAL</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3455</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_ace2aa4877b16a42b0b7673d4e26000ee"><div class="ttname"><a href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee">VmaAllocatorCreateInfo::pRecordSettings</a></div><div class="ttdeci">const VmaRecordSettings * pRecordSettings</div><div class="ttdoc">Parameters for recording of VMA calls. Can be null.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2330</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a94fc4f3a605d9880bb3c0ba2c2fc80b2"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2">VmaVulkanFunctions::vkBindBufferMemory</a></div><div class="ttdeci">PFN_vkBindBufferMemory vkBindBufferMemory</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2209</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a5b92901df89a4194b0d12f6071d4d143"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a5b92901df89a4194b0d12f6071d4d143">VmaVulkanFunctions::vkGetBufferMemoryRequirements</a></div><div class="ttdeci">PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2211</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a7f71f39590c5316771493d2333f9c1bd"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd">VmaDefragmentationInfo2::commandBuffer</a></div><div class="ttdeci">VkCommandBuffer commandBuffer</div><div class="ttdoc">Optional. Command buffer where GPU copy commands will be posted.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3533</div></div>
+<div class="ttc" id="astruct_vma_stats_html"><div class="ttname"><a href="struct_vma_stats.html">VmaStats</a></div><div class="ttdoc">General statistics from current state of Allocator.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2442</div></div>
+<div class="ttc" id="astruct_vma_pool_create_info_html_ad8006fb803185c0a699d30f3e9a865ae"><div class="ttname"><a href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae">VmaPoolCreateInfo::minBlockCount</a></div><div class="ttdeci">size_t minBlockCount</div><div class="ttdoc">Minimum number of blocks to be always allocated in this pool, even if they stay empty.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2908</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_ae0ffc55139b54520a6bb704b29ffc285"><div class="ttname"><a href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">VmaAllocatorCreateInfo::vulkanApiVersion</a></div><div class="ttdeci">uint32_t vulkanApiVersion</div><div class="ttdoc">Optional. The highest version of Vulkan that the application is designed to use.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2344</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html"><div class="ttname"><a href="struct_vma_stat_info.html">VmaStatInfo</a></div><div class="ttdoc">Calculated statistics of memory usage in entire allocator.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2425</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_stats_html_ab0cb9ac0dbc106c77e384ea676422f28"><div class="ttname"><a href="struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28">VmaDefragmentationStats::bytesFreed</a></div><div class="ttdeci">VkDeviceSize bytesFreed</div><div class="ttdoc">Total number of bytes that have been released to the system by freeing empty VkDeviceMemory objects.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3573</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a9f0f8f56db5f7f57fe4454f465142dac"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9f0f8f56db5f7f57fe4454f465142dac">vmaDefragment</a></div><div class="ttdeci">VkResult vmaDefragment(VmaAllocator allocator, const VmaAllocation *pAllocations, size_t allocationCount, VkBool32 *pAllocationsChanged, const VmaDefragmentationInfo *pDefragmentationInfo, VmaDefragmentationStats *pDefragmentationStats)</div><div class="ttdoc">Deprecated. Compacts memory by moving allocations.</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_pass_info_html_ac1086e657ba995f8d1f4e49b83dcfb6c"><div class="ttname"><a href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">VmaDefragmentationPassInfo::moveCount</a></div><div class="ttdeci">uint32_t moveCount</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3498</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2568</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_pass_info_html_ac1086e657ba995f8d1f4e49b83dcfb6c"><div class="ttname"><a href="struct_vma_defragmentation_pass_info.html#ac1086e657ba995f8d1f4e49b83dcfb6c">VmaDefragmentationPassInfo::moveCount</a></div><div class="ttdeci">uint32_t moveCount</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3547</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_ONLY</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2569</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ac0f01545b6262f7d4d128fc8f8e5c77b"><div class="ttname"><a href="vk__mem__alloc_8h.html#ac0f01545b6262f7d4d128fc8f8e5c77b">vmaBeginDefragmentationPass</a></div><div class="ttdeci">VkResult vmaBeginDefragmentationPass(VmaAllocator allocator, VmaDefragmentationContext context, VmaDefragmentationPassInfo *pInfo)</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_aef15a94b58fbcb0fe706d5720e84a74a"><div class="ttname"><a href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a></div><div class="ttdeci">VkResult vmaFindMemoryTypeIndex(VmaAllocator allocator, uint32_t memoryTypeBits, const VmaAllocationCreateInfo *pAllocationCreateInfo, uint32_t *pMemoryTypeIndex)</div><div class="ttdoc">Helps to find memoryTypeIndex, given memoryTypeBits and VmaAllocationCreateInfo.</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ac3dd00da721875ed99fa8a881922bdfc"><div class="ttname"><a href="vk__mem__alloc_8h.html#ac3dd00da721875ed99fa8a881922bdfc">vmaFlushAllocations</a></div><div class="ttdeci">VkResult vmaFlushAllocations(VmaAllocator allocator, uint32_t allocationCount, const VmaAllocation *allocations, const VkDeviceSize *offsets, const VkDeviceSize *sizes)</div><div class="ttdoc">Flushes memory of given set of allocations.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a5c8770ded7c59c8caac6de0c2cb00b50"><div class="ttname"><a href="vk__mem__alloc_8h.html#a5c8770ded7c59c8caac6de0c2cb00b50">vmaCreatePool</a></div><div class="ttdeci">VkResult vmaCreatePool(VmaAllocator allocator, const VmaPoolCreateInfo *pCreateInfo, VmaPool *pPool)</div><div class="ttdoc">Allocates Vulkan device memory and creates VmaPool object.</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html_a1859d290aca2cd582d8dc25922092669"><div class="ttname"><a href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">VmaStatInfo::unusedBytes</a></div><div class="ttdeci">VkDeviceSize unusedBytes</div><div class="ttdoc">Total number of bytes occupied by unused ranges.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2435</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089">VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2189</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html_a1859d290aca2cd582d8dc25922092669"><div class="ttname"><a href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">VmaStatInfo::unusedBytes</a></div><div class="ttdeci">VkDeviceSize unusedBytes</div><div class="ttdoc">Total number of bytes occupied by unused ranges.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2436</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089">VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2190</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ad37e82e492b3de38fc3f4cffd9ad0ae1"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad37e82e492b3de38fc3f4cffd9ad0ae1">vmaAllocateMemoryPages</a></div><div class="ttdeci">VkResult vmaAllocateMemoryPages(VmaAllocator allocator, const VkMemoryRequirements *pVkMemoryRequirements, const VmaAllocationCreateInfo *pCreateInfo, size_t allocationCount, VmaAllocation *pAllocations, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">General purpose memory allocation for multiple allocation objects at once.</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html_ab0c6c73837e5a70c749fbd4f6064895a"><div class="ttname"><a href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">VmaStatInfo::usedBytes</a></div><div class="ttdeci">VkDeviceSize usedBytes</div><div class="ttdoc">Total number of bytes occupied by all allocations.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2433</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_a6e409087e3be55400d0e4ccbe43c608d"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d">VmaAllocatorCreateInfo::pAllocationCallbacks</a></div><div class="ttdeci">const VkAllocationCallbacks * pAllocationCallbacks</div><div class="ttdoc">Custom CPU memory allocation callbacks. Optional.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2274</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7c"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c">VmaAllocatorCreateFlagBits</a></div><div class="ttdeci">VmaAllocatorCreateFlagBits</div><div class="ttdoc">Flags for created VmaAllocator.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2096</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html_ab0c6c73837e5a70c749fbd4f6064895a"><div class="ttname"><a href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">VmaStatInfo::usedBytes</a></div><div class="ttdeci">VkDeviceSize usedBytes</div><div class="ttdoc">Total number of bytes occupied by all allocations.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2434</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_a6e409087e3be55400d0e4ccbe43c608d"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d">VmaAllocatorCreateInfo::pAllocationCallbacks</a></div><div class="ttdeci">const VkAllocationCallbacks * pAllocationCallbacks</div><div class="ttdoc">Custom CPU memory allocation callbacks. Optional.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2275</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7c"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c">VmaAllocatorCreateFlagBits</a></div><div class="ttdeci">VmaAllocatorCreateFlagBits</div><div class="ttdoc">Flags for created VmaAllocator.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2097</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a0faa3f9e5fb233d29d1e00390650febb"><div class="ttname"><a href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb">vmaAllocateMemoryForImage</a></div><div class="ttdeci">VkResult vmaAllocateMemoryForImage(VmaAllocator allocator, VkImage image, const VmaAllocationCreateInfo *pCreateInfo, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">Function similar to vmaAllocateMemoryForBuffer().</div></div>
-<div class="ttc" id="astruct_vma_pool_create_info_html_ae41142f2834fcdc82baa4883c187b75c"><div class="ttname"><a href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">VmaPoolCreateInfo::maxBlockCount</a></div><div class="ttdeci">size_t maxBlockCount</div><div class="ttdoc">Maximum number of blocks that can be allocated in this pool. Optional.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2915</div></div>
-<div class="ttc" id="astruct_vma_pool_create_info_html"><div class="ttname"><a href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a></div><div class="ttdoc">Describes parameter of created VmaPool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2887</div></div>
-<div class="ttc" id="astruct_vma_device_memory_callbacks_html_a4f17f7b255101e733b44d5633aceabfb"><div class="ttname"><a href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">VmaDeviceMemoryCallbacks::pfnAllocate</a></div><div class="ttdeci">PFN_vmaAllocateDeviceMemoryFunction pfnAllocate</div><div class="ttdoc">Optional, can be null.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2088</div></div>
+<div class="ttc" id="astruct_vma_pool_create_info_html_ae41142f2834fcdc82baa4883c187b75c"><div class="ttname"><a href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">VmaPoolCreateInfo::maxBlockCount</a></div><div class="ttdeci">size_t maxBlockCount</div><div class="ttdoc">Maximum number of blocks that can be allocated in this pool. Optional.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2916</div></div>
+<div class="ttc" id="astruct_vma_pool_create_info_html"><div class="ttname"><a href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a></div><div class="ttdoc">Describes parameter of created VmaPool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2888</div></div>
+<div class="ttc" id="astruct_vma_device_memory_callbacks_html_a4f17f7b255101e733b44d5633aceabfb"><div class="ttname"><a href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">VmaDeviceMemoryCallbacks::pfnAllocate</a></div><div class="ttdeci">PFN_vmaAllocateDeviceMemoryFunction pfnAllocate</div><div class="ttdoc">Optional, can be null.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2089</div></div>
 <div class="ttc" id="astruct_vma_pool_html"><div class="ttname"><a href="struct_vma_pool.html">VmaPool</a></div><div class="ttdoc">Represents custom memory pool.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27">VMA_MEMORY_USAGE_GPU_TO_CPU</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_TO_CPU</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2594</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2665</div></div>
-<div class="ttc" id="astruct_vma_pool_create_info_html_a8405139f63d078340ae74513a59f5446"><div class="ttname"><a href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446">VmaPoolCreateInfo::flags</a></div><div class="ttdeci">VmaPoolCreateFlags flags</div><div class="ttdoc">Use combination of VmaPoolCreateFlagBits.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2893</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e">VMA_MEMORY_USAGE_MAX_ENUM</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2610</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html_a537741e4d5cdddc1c0ab95ec650afaff"><div class="ttname"><a href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">VmaStatInfo::allocationCount</a></div><div class="ttdeci">uint32_t allocationCount</div><div class="ttdoc">Number of VmaAllocation allocation objects allocated.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2429</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a5c1093bc32386a8060c37c9f282078a1"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a5c1093bc32386a8060c37c9f282078a1">VmaVulkanFunctions::vkInvalidateMappedMemoryRanges</a></div><div class="ttdeci">PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2207</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27">VMA_MEMORY_USAGE_GPU_TO_CPU</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_GPU_TO_CPU</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2595</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2666</div></div>
+<div class="ttc" id="astruct_vma_pool_create_info_html_a8405139f63d078340ae74513a59f5446"><div class="ttname"><a href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446">VmaPoolCreateInfo::flags</a></div><div class="ttdeci">VmaPoolCreateFlags flags</div><div class="ttdoc">Use combination of VmaPoolCreateFlagBits.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2894</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e">VMA_MEMORY_USAGE_MAX_ENUM</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2611</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html_a537741e4d5cdddc1c0ab95ec650afaff"><div class="ttname"><a href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">VmaStatInfo::allocationCount</a></div><div class="ttdeci">uint32_t allocationCount</div><div class="ttdoc">Number of VmaAllocation allocation objects allocated.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2430</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a5c1093bc32386a8060c37c9f282078a1"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a5c1093bc32386a8060c37c9f282078a1">VmaVulkanFunctions::vkInvalidateMappedMemoryRanges</a></div><div class="ttdeci">PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2208</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_abf28077dbf82d0908b8acbe8ee8dd9b8"><div class="ttname"><a href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8">vmaAllocateMemory</a></div><div class="ttdeci">VkResult vmaAllocateMemory(VmaAllocator allocator, const VkMemoryRequirements *pVkMemoryRequirements, const VmaAllocationCreateInfo *pCreateInfo, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">General purpose memory allocation.</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html"><div class="ttname"><a href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a></div><div class="ttdoc">Parameters for defragmentation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3415</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info_html_acb311c940a777270e67e1b81c5ab6a1d"><div class="ttname"><a href="struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d">VmaDefragmentationInfo::maxBytesToMove</a></div><div class="ttdeci">VkDeviceSize maxBytesToMove</div><div class="ttdoc">Maximum total numbers of bytes that can be copied while moving allocations to different places.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3511</div></div>
-<div class="ttc" id="astruct_vma_budget_html_a58b492901baab685f466199124e514a0"><div class="ttname"><a href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">VmaBudget::blockBytes</a></div><div class="ttdeci">VkDeviceSize blockBytes</div><div class="ttdoc">Sum size of all VkDeviceMemory blocks allocated from particular heap, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2467</div></div>
-<div class="ttc" id="astruct_vma_allocator_info_html"><div class="ttname"><a href="struct_vma_allocator_info.html">VmaAllocatorInfo</a></div><div class="ttdoc">Information about existing VmaAllocator object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2357</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec">VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM</a></div><div class="ttdeci">@ VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2881</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_a9166390303ff42d783305bc31c2b6b90"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">VmaAllocationCreateInfo::requiredFlags</a></div><div class="ttdeci">VkMemoryPropertyFlags requiredFlags</div><div class="ttdoc">Flags that must be set in a Memory Type chosen for an allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2739</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706">VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2712</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html"><div class="ttname"><a href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a></div><div class="ttdoc">Parameters for defragmentation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3464</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info_html_acb311c940a777270e67e1b81c5ab6a1d"><div class="ttname"><a href="struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d">VmaDefragmentationInfo::maxBytesToMove</a></div><div class="ttdeci">VkDeviceSize maxBytesToMove</div><div class="ttdoc">Maximum total numbers of bytes that can be copied while moving allocations to different places.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3560</div></div>
+<div class="ttc" id="astruct_vma_budget_html_a58b492901baab685f466199124e514a0"><div class="ttname"><a href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">VmaBudget::blockBytes</a></div><div class="ttdeci">VkDeviceSize blockBytes</div><div class="ttdoc">Sum size of all VkDeviceMemory blocks allocated from particular heap, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2468</div></div>
+<div class="ttc" id="astruct_vma_allocator_info_html"><div class="ttname"><a href="struct_vma_allocator_info.html">VmaAllocatorInfo</a></div><div class="ttdoc">Information about existing VmaAllocator object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2358</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec">VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM</a></div><div class="ttdeci">@ VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2882</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_a9166390303ff42d783305bc31c2b6b90"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">VmaAllocationCreateInfo::requiredFlags</a></div><div class="ttdeci">VkMemoryPropertyFlags requiredFlags</div><div class="ttdoc">Flags that must be set in a Memory Type chosen for an allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2740</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706">VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2713</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_aec5b57e29c97b5d69c6d5654d60df878"><div class="ttname"><a href="vk__mem__alloc_8h.html#aec5b57e29c97b5d69c6d5654d60df878">VmaStatInfo</a></div><div class="ttdeci">struct VmaStatInfo VmaStatInfo</div><div class="ttdoc">Calculated statistics of memory usage in entire allocator.</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html_a1081a039964e566c672e7a2347f9e599"><div class="ttname"><a href="struct_vma_stat_info.html#a1081a039964e566c672e7a2347f9e599">VmaStatInfo::allocationSizeAvg</a></div><div class="ttdeci">VkDeviceSize allocationSizeAvg</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2436</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html_a1081a039964e566c672e7a2347f9e599"><div class="ttname"><a href="struct_vma_stat_info.html#a1081a039964e566c672e7a2347f9e599">VmaStatInfo::allocationSizeAvg</a></div><div class="ttdeci">VkDeviceSize allocationSizeAvg</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2437</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_aa8d164061c88f22fb1fd3c8f3534bc1d"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa8d164061c88f22fb1fd3c8f3534bc1d">vmaDestroyAllocator</a></div><div class="ttdeci">void vmaDestroyAllocator(VmaAllocator allocator)</div><div class="ttdoc">Destroys allocator object.</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_af1380969b5e1ea4c3184a877892d260e"><div class="ttname"><a href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">VmaAllocatorCreateInfo::pDeviceMemoryCallbacks</a></div><div class="ttdeci">const VmaDeviceMemoryCallbacks * pDeviceMemoryCallbacks</div><div class="ttdoc">Informative callbacks for vkAllocateMemory, vkFreeMemory. Optional.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2277</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e">VMA_ALLOCATION_CREATE_STRATEGY_MASK</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_MASK</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2716</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_ad924ddd77b04039c88d0c09b0ffcd500"><div class="ttname"><a href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500">VmaAllocatorCreateInfo::device</a></div><div class="ttdeci">VkDevice device</div><div class="ttdoc">Vulkan device.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2268</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_af1380969b5e1ea4c3184a877892d260e"><div class="ttname"><a href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">VmaAllocatorCreateInfo::pDeviceMemoryCallbacks</a></div><div class="ttdeci">const VmaDeviceMemoryCallbacks * pDeviceMemoryCallbacks</div><div class="ttdoc">Informative callbacks for vkAllocateMemory, vkFreeMemory. Optional.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2278</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e">VMA_ALLOCATION_CREATE_STRATEGY_MASK</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_MASK</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2717</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_ad924ddd77b04039c88d0c09b0ffcd500"><div class="ttname"><a href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500">VmaAllocatorCreateInfo::device</a></div><div class="ttdeci">VkDevice device</div><div class="ttdoc">Vulkan device.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2269</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a088da83d8eaf3ce9056d9ea0b981d472"><div class="ttname"><a href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472">vmaFindMemoryTypeIndexForImageInfo</a></div><div class="ttdeci">VkResult vmaFindMemoryTypeIndexForImageInfo(VmaAllocator allocator, const VkImageCreateInfo *pImageCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, uint32_t *pMemoryTypeIndex)</div><div class="ttdoc">Helps to find memoryTypeIndex, given VkImageCreateInfo and VmaAllocationCreateInfo.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ad5bd1243512d099706de88168992f069"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069">vmaMapMemory</a></div><div class="ttdeci">VkResult vmaMapMemory(VmaAllocator allocator, VmaAllocation allocation, void **ppData)</div><div class="ttdoc">Maps memory represented by given allocation and returns pointer to it.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a6b0929b914b60cf2d45cac4bf3547470"><div class="ttname"><a href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470">vmaBindBufferMemory</a></div><div class="ttdeci">VkResult vmaBindBufferMemory(VmaAllocator allocator, VmaAllocation allocation, VkBuffer buffer)</div><div class="ttdoc">Binds buffer to allocation.</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_a31c192aa6cbffa33279f6d9f0c47c44b"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b">VmaAllocatorCreateInfo::pHeapSizeLimit</a></div><div class="ttdeci">const VkDeviceSize * pHeapSizeLimit</div><div class="ttdoc">Either null or a pointer to an array of limits on maximum number of bytes that can be allocated out o...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2316</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_pass_move_info_html_ae885c861c2dd8d622e6c19e281d035cc"><div class="ttname"><a href="struct_vma_defragmentation_pass_move_info.html#ae885c861c2dd8d622e6c19e281d035cc">VmaDefragmentationPassMoveInfo::allocation</a></div><div class="ttdeci">VmaAllocation allocation</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3488</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_a31c192aa6cbffa33279f6d9f0c47c44b"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b">VmaAllocatorCreateInfo::pHeapSizeLimit</a></div><div class="ttdeci">const VkDeviceSize * pHeapSizeLimit</div><div class="ttdoc">Either null or a pointer to an array of limits on maximum number of bytes that can be allocated out o...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2317</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_pass_move_info_html_ae885c861c2dd8d622e6c19e281d035cc"><div class="ttname"><a href="struct_vma_defragmentation_pass_move_info.html#ae885c861c2dd8d622e6c19e281d035cc">VmaDefragmentationPassMoveInfo::allocation</a></div><div class="ttdeci">VmaAllocation allocation</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3537</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a02a94f25679275851a53e82eacbcfc73"><div class="ttname"><a href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73">vmaCreateImage</a></div><div class="ttdeci">VkResult vmaCreateImage(VmaAllocator allocator, const VkImageCreateInfo *pImageCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkImage *pImage, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">Function similar to vmaCreateBuffer().</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ae790ab9ffaf7667fb8f62523e6897888"><div class="ttname"><a href="vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888">vmaFindMemoryTypeIndexForBufferInfo</a></div><div class="ttdeci">VkResult vmaFindMemoryTypeIndexForBufferInfo(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, uint32_t *pMemoryTypeIndex)</div><div class="ttdoc">Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.</div></div>
-<div class="ttc" id="astruct_vma_budget_html_ab82e1d1754c2d210d0bdf90220bc6cdd"><div class="ttname"><a href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">VmaBudget::budget</a></div><div class="ttdeci">VkDeviceSize budget</div><div class="ttdoc">Estimated amount of memory available to the program, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2499</div></div>
+<div class="ttc" id="astruct_vma_budget_html_ab82e1d1754c2d210d0bdf90220bc6cdd"><div class="ttname"><a href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">VmaBudget::budget</a></div><div class="ttdeci">VkDeviceSize budget</div><div class="ttdoc">Estimated amount of memory available to the program, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2500</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a4759a2d9f99c19ba7627553c847132f1"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4759a2d9f99c19ba7627553c847132f1">VmaPoolStats</a></div><div class="ttdeci">struct VmaPoolStats VmaPoolStats</div><div class="ttdoc">Describes parameter of existing VmaPool.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a72aebd522242d56abea67b4f47f6549e"><div class="ttname"><a href="vk__mem__alloc_8h.html#a72aebd522242d56abea67b4f47f6549e">VmaDefragmentationPassInfo</a></div><div class="ttdeci">struct VmaDefragmentationPassInfo VmaDefragmentationPassInfo</div><div class="ttdoc">Parameters for incremental defragmentation steps.</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html"><div class="ttname"><a href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a></div><div class="ttdoc">Pointers to some Vulkan functions - a subset used by the library.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2199</div></div>
-<div class="ttc" id="astruct_vma_allocation_info_html_a5eeffbe2d2f30f53370ff14aefbadbe2"><div class="ttname"><a href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">VmaAllocationInfo::pMappedData</a></div><div class="ttdeci">void * pMappedData</div><div class="ttdoc">Pointer to the beginning of this allocation as mapped data.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3096</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_a392ea2ecbaff93f91a7c49f735ad4346"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">VmaAllocatorCreateInfo::flags</a></div><div class="ttdeci">VmaAllocatorCreateFlags flags</div><div class="ttdoc">Flags for created allocator. Use VmaAllocatorCreateFlagBits enum.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2262</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a88a77cef37e5d3c4fc9eb328885d048d"><div class="ttname"><a href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a></div><div class="ttdeci">VkFlags VmaDefragmentationFlags</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3409</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_ab6d288f29d028156cf73542d630a2e32"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">VmaDefragmentationInfo2::pAllocations</a></div><div class="ttdeci">const VmaAllocation * pAllocations</div><div class="ttdoc">Pointer to array of allocations that can be defragmented.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3430</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html"><div class="ttname"><a href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a></div><div class="ttdoc">Pointers to some Vulkan functions - a subset used by the library.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2200</div></div>
+<div class="ttc" id="astruct_vma_allocation_info_html_a5eeffbe2d2f30f53370ff14aefbadbe2"><div class="ttname"><a href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">VmaAllocationInfo::pMappedData</a></div><div class="ttdeci">void * pMappedData</div><div class="ttdoc">Pointer to the beginning of this allocation as mapped data.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3097</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_a392ea2ecbaff93f91a7c49f735ad4346"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">VmaAllocatorCreateInfo::flags</a></div><div class="ttdeci">VmaAllocatorCreateFlags flags</div><div class="ttdoc">Flags for created allocator. Use VmaAllocatorCreateFlagBits enum.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2263</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a88a77cef37e5d3c4fc9eb328885d048d"><div class="ttname"><a href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a></div><div class="ttdeci">VkFlags VmaDefragmentationFlags</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3458</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_ab6d288f29d028156cf73542d630a2e32"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#ab6d288f29d028156cf73542d630a2e32">VmaDefragmentationInfo2::pAllocations</a></div><div class="ttdeci">const VmaAllocation * pAllocations</div><div class="ttdoc">Pointer to array of allocations that can be defragmented.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3479</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ae8bf76997b234ef68aad922616df4153"><div class="ttname"><a href="vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153">vmaGetPoolStats</a></div><div class="ttdeci">void vmaGetPoolStats(VmaAllocator allocator, VmaPool pool, VmaPoolStats *pPoolStats)</div><div class="ttdoc">Retrieves statistics of existing VmaPool object.</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a23ebe70be515b9b5010a1d691200e325"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a23ebe70be515b9b5010a1d691200e325">VmaVulkanFunctions::vkCreateImage</a></div><div class="ttdeci">PFN_vkCreateImage vkCreateImage</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2214</div></div>
-<div class="ttc" id="astruct_vma_device_memory_callbacks_html_a24052de0937ddd54015a2df0363903c6"><div class="ttname"><a href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">VmaDeviceMemoryCallbacks::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Optional, can be null.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2092</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a23ebe70be515b9b5010a1d691200e325"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a23ebe70be515b9b5010a1d691200e325">VmaVulkanFunctions::vkCreateImage</a></div><div class="ttdeci">PFN_vkCreateImage vkCreateImage</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2215</div></div>
+<div class="ttc" id="astruct_vma_device_memory_callbacks_html_a24052de0937ddd54015a2df0363903c6"><div class="ttname"><a href="struct_vma_device_memory_callbacks.html#a24052de0937ddd54015a2df0363903c6">VmaDeviceMemoryCallbacks::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Optional, can be null.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2093</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a16e21c877101493fce582664cd8754fc"><div class="ttname"><a href="vk__mem__alloc_8h.html#a16e21c877101493fce582664cd8754fc">VmaRecordSettings</a></div><div class="ttdeci">struct VmaRecordSettings VmaRecordSettings</div><div class="ttdoc">Parameters for recording calls to VMA functions. To be used in VmaAllocatorCreateInfo::pRecordSetting...</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html_a2f9b3452af90c9768a30b7fb6ae194fc"><div class="ttname"><a href="struct_vma_stat_info.html#a2f9b3452af90c9768a30b7fb6ae194fc">VmaStatInfo::unusedRangeSizeAvg</a></div><div class="ttdeci">VkDeviceSize unusedRangeSizeAvg</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2437</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67">VMA_MEMORY_USAGE_CPU_TO_GPU</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_CPU_TO_GPU</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2585</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2709</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2706</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f">VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2171</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html_a2f9b3452af90c9768a30b7fb6ae194fc"><div class="ttname"><a href="struct_vma_stat_info.html#a2f9b3452af90c9768a30b7fb6ae194fc">VmaStatInfo::unusedRangeSizeAvg</a></div><div class="ttdeci">VkDeviceSize unusedRangeSizeAvg</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2438</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67">VMA_MEMORY_USAGE_CPU_TO_GPU</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_CPU_TO_GPU</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2586</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2710</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2707</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f">VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2172</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ad94034192259c2e34a4d1c5e27810403"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad94034192259c2e34a4d1c5e27810403">VmaDefragmentationStats</a></div><div class="ttdeci">struct VmaDefragmentationStats VmaDefragmentationStats</div><div class="ttdoc">Statistics returned by function vmaDefragment().</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2734</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html_ade8b40bd3139c04aabd2fc538a356fea"><div class="ttname"><a href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">VmaStatInfo::allocationSizeMin</a></div><div class="ttdeci">VkDeviceSize allocationSizeMin</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2436</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2735</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html_ade8b40bd3139c04aabd2fc538a356fea"><div class="ttname"><a href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">VmaStatInfo::allocationSizeMin</a></div><div class="ttdeci">VkDeviceSize allocationSizeMin</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2437</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a927c944f45e0f2941182abb6f608e64a"><div class="ttname"><a href="vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a">vmaBindBufferMemory2</a></div><div class="ttdeci">VkResult vmaBindBufferMemory2(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize allocationLocalOffset, VkBuffer buffer, const void *pNext)</div><div class="ttdoc">Binds buffer to allocation with additional parameters.</div></div>
-<div class="ttc" id="astruct_vma_allocation_info_html_aac76d113a6a5ccbb09fea00fb25fd18f"><div class="ttname"><a href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f">VmaAllocationInfo::size</a></div><div class="ttdeci">VkDeviceSize size</div><div class="ttdoc">Size of this allocation, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3087</div></div>
-<div class="ttc" id="astruct_vma_record_settings_html_ad8fdcc92119ae7a8c08c1a564c01d63a"><div class="ttname"><a href="struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a">VmaRecordSettings::flags</a></div><div class="ttdeci">VmaRecordFlags flags</div><div class="ttdoc">Flags for recording. Use VmaRecordFlagBits enum.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2247</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a33c322f4c4ad2810f8a9c97a277572f9"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a33c322f4c4ad2810f8a9c97a277572f9">VmaVulkanFunctions::vkFlushMappedMemoryRanges</a></div><div class="ttdeci">PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2206</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:3101</div></div>
+<div class="ttc" id="astruct_vma_allocation_info_html_aac76d113a6a5ccbb09fea00fb25fd18f"><div class="ttname"><a href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f">VmaAllocationInfo::size</a></div><div class="ttdeci">VkDeviceSize size</div><div class="ttdoc">Size of this allocation, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3088</div></div>
+<div class="ttc" id="astruct_vma_record_settings_html_ad8fdcc92119ae7a8c08c1a564c01d63a"><div class="ttname"><a href="struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a">VmaRecordSettings::flags</a></div><div class="ttdeci">VmaRecordFlags flags</div><div class="ttdoc">Flags for recording. Use VmaRecordFlagBits enum.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2248</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a33c322f4c4ad2810f8a9c97a277572f9"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a33c322f4c4ad2810f8a9c97a277572f9">VmaVulkanFunctions::vkFlushMappedMemoryRanges</a></div><div class="ttdeci">PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2207</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:3102</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a736bd6cbda886f36c891727e73bd4024"><div class="ttname"><a href="vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024">vmaMakePoolAllocationsLost</a></div><div class="ttdeci">void vmaMakePoolAllocationsLost(VmaAllocator allocator, VmaPool pool, size_t *pLostAllocationCount)</div><div class="ttdoc">Marks all allocations in given pool as lost if they are not used in current frame or VmaPoolCreateInf...</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2">VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT</a></div><div class="ttdeci">@ VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT</div><div class="ttdoc">Use this flag if you always allocate only buffers and linear images or only optimal images out of thi...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2845</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2">VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT</a></div><div class="ttdeci">@ VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT</div><div class="ttdoc">Use this flag if you always allocate only buffers and linear images or only optimal images out of thi...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2846</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aaa8412919139ef413a4215ac6a290fae"><div class="ttname"><a href="vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae">vmaInvalidateAllocation</a></div><div class="ttdeci">VkResult vmaInvalidateAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)</div><div class="ttdoc">Invalidates memory of given allocation.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ac72ee55598617e8eecca384e746bab51"><div class="ttname"><a href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a></div><div class="ttdeci">VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div></div>
-<div class="ttc" id="astruct_vma_stats_html_a0e6611508c29a187f0fd14ff1a0329c0"><div class="ttname"><a href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">VmaStats::memoryHeap</a></div><div class="ttdeci">VmaStatInfo memoryHeap[VK_MAX_MEMORY_HEAPS]</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2444</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_a3dc197be3227da7338b1643f70db36bd"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd">VmaAllocatorCreateInfo::pVulkanFunctions</a></div><div class="ttdeci">const VmaVulkanFunctions * pVulkanFunctions</div><div class="ttdoc">Pointers to Vulkan functions. Can be null.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2322</div></div>
-<div class="ttc" id="astruct_vma_pool_stats_html_aa0b5cb45cef6f18571cefb03b9a230e7"><div class="ttname"><a href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7">VmaPoolStats::blockCount</a></div><div class="ttdeci">size_t blockCount</div><div class="ttdoc">Number of VkDeviceMemory blocks allocated for this pool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2956</div></div>
+<div class="ttc" id="astruct_vma_stats_html_a0e6611508c29a187f0fd14ff1a0329c0"><div class="ttname"><a href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">VmaStats::memoryHeap</a></div><div class="ttdeci">VmaStatInfo memoryHeap[VK_MAX_MEMORY_HEAPS]</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2445</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_a3dc197be3227da7338b1643f70db36bd"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd">VmaAllocatorCreateInfo::pVulkanFunctions</a></div><div class="ttdeci">const VmaVulkanFunctions * pVulkanFunctions</div><div class="ttdoc">Pointers to Vulkan functions. Can be null.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2323</div></div>
+<div class="ttc" id="astruct_vma_pool_stats_html_aa0b5cb45cef6f18571cefb03b9a230e7"><div class="ttname"><a href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7">VmaPoolStats::blockCount</a></div><div class="ttdeci">size_t blockCount</div><div class="ttdoc">Number of VkDeviceMemory blocks allocated for this pool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2957</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a200692051ddb34240248234f5f4c17bb"><div class="ttname"><a href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb">vmaCreateAllocator</a></div><div class="ttdeci">VkResult vmaCreateAllocator(const VmaAllocatorCreateInfo *pCreateInfo, VmaAllocator *pAllocator)</div><div class="ttdoc">Creates Allocator object.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a49329a7f030dafcf82f7b73334c22e98"><div class="ttname"><a href="vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98">vmaCheckCorruption</a></div><div class="ttdeci">VkResult vmaCheckCorruption(VmaAllocator allocator, uint32_t memoryTypeBits)</div><div class="ttdoc">Checks magic number in margins around all allocations in given memory types (in both default and cust...</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_pass_info_html"><div class="ttname"><a href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a></div><div class="ttdoc">Parameters for incremental defragmentation steps.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3497</div></div>
-<div class="ttc" id="astruct_vma_stats_html_a13e3caf754be79352c42408756309331"><div class="ttname"><a href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">VmaStats::memoryType</a></div><div class="ttdeci">VmaStatInfo memoryType[VK_MAX_MEMORY_TYPES]</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2443</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a5225e5e11f8376f6a31a1791f3d6e817"><div class="ttname"><a href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a></div><div class="ttdeci">VkFlags VmaAllocationCreateFlags</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2723</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_a70dd42e29b1df1d1b9b61532ae0b370b"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b">VmaAllocatorCreateInfo::instance</a></div><div class="ttdeci">VkInstance instance</div><div class="ttdoc">Handle to Vulkan instance object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2334</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_abc34ee6f021f459aff885f3758c435de"><div class="ttname"><a href="vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de">vmaFlushAllocation</a></div><div class="ttdeci">void vmaFlushAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)</div><div class="ttdoc">Flushes memory of given allocation.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd">VMA_MEMORY_USAGE_UNKNOWN</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_UNKNOWN</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2551</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a40d53d33e71ba0b66f844ed63c05a3f6"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6">VmaDefragmentationInfo2::maxGpuAllocationsToMove</a></div><div class="ttdeci">uint32_t maxGpuAllocationsToMove</div><div class="ttdoc">Maximum number of allocations that can be moved to a different place using transfers on GPU side,...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3475</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a7e054606faddb07f0e8556f3ed317d45"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a7e054606faddb07f0e8556f3ed317d45">VmaVulkanFunctions::vkDestroyBuffer</a></div><div class="ttdeci">PFN_vkDestroyBuffer vkDestroyBuffer</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2213</div></div>
-<div class="ttc" id="astruct_vma_pool_create_info_html_a9437e43ffbb644dbbf7fc4e50cfad6aa"><div class="ttname"><a href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa">VmaPoolCreateInfo::frameInUseCount</a></div><div class="ttdeci">uint32_t frameInUseCount</div><div class="ttdoc">Maximum number of additional frames that are in use at the same time as current frame.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2929</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a90b898227039b1dcb3520f6e91f09ffa"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a90b898227039b1dcb3520f6e91f09ffa">VmaVulkanFunctions::vkDestroyImage</a></div><div class="ttdeci">PFN_vkDestroyImage vkDestroyImage</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2215</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_af78e1ea40c22d85137b65f6b384a4d0a"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">VmaDefragmentationInfo2::maxCpuBytesToMove</a></div><div class="ttdeci">VkDeviceSize maxCpuBytesToMove</div><div class="ttdoc">Maximum total numbers of bytes that can be copied while moving allocations to different places using ...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3460</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_pass_info_html"><div class="ttname"><a href="struct_vma_defragmentation_pass_info.html">VmaDefragmentationPassInfo</a></div><div class="ttdoc">Parameters for incremental defragmentation steps.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3546</div></div>
+<div class="ttc" id="astruct_vma_stats_html_a13e3caf754be79352c42408756309331"><div class="ttname"><a href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">VmaStats::memoryType</a></div><div class="ttdeci">VmaStatInfo memoryType[VK_MAX_MEMORY_TYPES]</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2444</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a5225e5e11f8376f6a31a1791f3d6e817"><div class="ttname"><a href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a></div><div class="ttdeci">VkFlags VmaAllocationCreateFlags</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2724</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_a70dd42e29b1df1d1b9b61532ae0b370b"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b">VmaAllocatorCreateInfo::instance</a></div><div class="ttdeci">VkInstance instance</div><div class="ttdoc">Handle to Vulkan instance object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2335</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd">VMA_MEMORY_USAGE_UNKNOWN</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_UNKNOWN</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2552</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a40d53d33e71ba0b66f844ed63c05a3f6"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6">VmaDefragmentationInfo2::maxGpuAllocationsToMove</a></div><div class="ttdeci">uint32_t maxGpuAllocationsToMove</div><div class="ttdoc">Maximum number of allocations that can be moved to a different place using transfers on GPU side,...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3524</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a7e054606faddb07f0e8556f3ed317d45"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a7e054606faddb07f0e8556f3ed317d45">VmaVulkanFunctions::vkDestroyBuffer</a></div><div class="ttdeci">PFN_vkDestroyBuffer vkDestroyBuffer</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2214</div></div>
+<div class="ttc" id="astruct_vma_pool_create_info_html_a9437e43ffbb644dbbf7fc4e50cfad6aa"><div class="ttname"><a href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa">VmaPoolCreateInfo::frameInUseCount</a></div><div class="ttdeci">uint32_t frameInUseCount</div><div class="ttdoc">Maximum number of additional frames that are in use at the same time as current frame.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2930</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a90b898227039b1dcb3520f6e91f09ffa"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a90b898227039b1dcb3520f6e91f09ffa">VmaVulkanFunctions::vkDestroyImage</a></div><div class="ttdeci">PFN_vkDestroyImage vkDestroyImage</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2216</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_af78e1ea40c22d85137b65f6b384a4d0a"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">VmaDefragmentationInfo2::maxCpuBytesToMove</a></div><div class="ttdeci">VkDeviceSize maxCpuBytesToMove</div><div class="ttdoc">Maximum total numbers of bytes that can be copied while moving allocations to different places using ...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3509</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a1017aa83489c0eee8d2163d2bf253f67"><div class="ttname"><a href="vk__mem__alloc_8h.html#a1017aa83489c0eee8d2163d2bf253f67">VmaPoolCreateInfo</a></div><div class="ttdeci">struct VmaPoolCreateInfo VmaPoolCreateInfo</div><div class="ttdoc">Describes parameter of created VmaPool.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_af09b4e4eafdbee812e8d73ddf960f030"><div class="ttname"><a href="vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030">vmaGetPoolName</a></div><div class="ttdeci">void vmaGetPoolName(VmaAllocator allocator, VmaPool pool, const char **ppName)</div><div class="ttdoc">Retrieves name of a custom pool.</div></div>
-<div class="ttc" id="astruct_vma_allocation_info_html_a7f6b0aa58c135e488e6b40a388dad9d5"><div class="ttname"><a href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">VmaAllocationInfo::memoryType</a></div><div class="ttdeci">uint32_t memoryType</div><div class="ttdoc">Memory type index that this allocation was allocated from.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3068</div></div>
+<div class="ttc" id="astruct_vma_allocation_info_html_a7f6b0aa58c135e488e6b40a388dad9d5"><div class="ttname"><a href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">VmaAllocationInfo::memoryType</a></div><div class="ttdeci">uint32_t memoryType</div><div class="ttdoc">Memory type index that this allocation was allocated from.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3069</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ae50d2cb3b4a3bfd4dd40987234e50e7e"><div class="ttname"><a href="vk__mem__alloc_8h.html#ae50d2cb3b4a3bfd4dd40987234e50e7e">vmaDestroyImage</a></div><div class="ttdeci">void vmaDestroyImage(VmaAllocator allocator, VkImage image, VmaAllocation allocation)</div><div class="ttdoc">Destroys Vulkan image and frees allocated memory.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_MAPPED_BIT</div><div class="ttdoc">Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2645</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_MAPPED_BIT</div><div class="ttdoc">Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2646</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a333b61c1788cb23559177531e6a93ca3"><div class="ttname"><a href="vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3">vmaCalculateStats</a></div><div class="ttdeci">void vmaCalculateStats(VmaAllocator allocator, VmaStats *pStats)</div><div class="ttdoc">Retrieves statistics from current state of the Allocator.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a0d9f4e4ba5bf9aab1f1c746387753d77"><div class="ttname"><a href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a></div><div class="ttdeci">void vmaDestroyBuffer(VmaAllocator allocator, VkBuffer buffer, VmaAllocation allocation)</div><div class="ttdoc">Destroys Vulkan buffer and frees allocated memory.</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_ae8084315a25006271a2edfc3a447519f"><div class="ttname"><a href="struct_vma_vulkan_functions.html#ae8084315a25006271a2edfc3a447519f">VmaVulkanFunctions::vkCreateBuffer</a></div><div class="ttdeci">PFN_vkCreateBuffer vkCreateBuffer</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2212</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a7e1ed85f7799600b03ad51a77acc21f3"><div class="ttname"><a href="vk__mem__alloc_8h.html#a7e1ed85f7799600b03ad51a77acc21f3">PFN_vmaAllocateDeviceMemoryFunction</a></div><div class="ttdeci">void(VKAPI_PTR * PFN_vmaAllocateDeviceMemoryFunction)(VmaAllocator allocator, uint32_t memoryType, VkDeviceMemory memory, VkDeviceSize size, void *pUserData)</div><div class="ttdoc">Callback function called after successful vkAllocateMemory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2065</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_ae8084315a25006271a2edfc3a447519f"><div class="ttname"><a href="struct_vma_vulkan_functions.html#ae8084315a25006271a2edfc3a447519f">VmaVulkanFunctions::vkCreateBuffer</a></div><div class="ttdeci">PFN_vkCreateBuffer vkCreateBuffer</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2213</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a7e1ed85f7799600b03ad51a77acc21f3"><div class="ttname"><a href="vk__mem__alloc_8h.html#a7e1ed85f7799600b03ad51a77acc21f3">PFN_vmaAllocateDeviceMemoryFunction</a></div><div class="ttdeci">void(VKAPI_PTR * PFN_vmaAllocateDeviceMemoryFunction)(VmaAllocator allocator, uint32_t memoryType, VkDeviceMemory memory, VkDeviceSize size, void *pUserData)</div><div class="ttdoc">Callback function called after successful vkAllocateMemory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2066</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_afa02231a791b37255720d566a52683e7"><div class="ttname"><a href="vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7">vmaGetAllocatorInfo</a></div><div class="ttdeci">void vmaGetAllocatorInfo(VmaAllocator allocator, VmaAllocatorInfo *pAllocatorInfo)</div><div class="ttdoc">Returns information about existing VmaAllocator object - handle to Vulkan device etc.</div></div>
-<div class="ttc" id="astruct_vma_pool_stats_html_ae4f3546ffa4d1e598b64d8e6134854f4"><div class="ttname"><a href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">VmaPoolStats::unusedRangeCount</a></div><div class="ttdeci">size_t unusedRangeCount</div><div class="ttdoc">Number of continuous memory ranges in the pool not used by any VmaAllocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2946</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7">VmaPoolCreateFlagBits</a></div><div class="ttdeci">VmaPoolCreateFlagBits</div><div class="ttdoc">Flags to be passed as VmaPoolCreateInfo::flags.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2827</div></div>
+<div class="ttc" id="astruct_vma_pool_stats_html_ae4f3546ffa4d1e598b64d8e6134854f4"><div class="ttname"><a href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">VmaPoolStats::unusedRangeCount</a></div><div class="ttdeci">size_t unusedRangeCount</div><div class="ttdoc">Number of continuous memory ranges in the pool not used by any VmaAllocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2947</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7">VmaPoolCreateFlagBits</a></div><div class="ttdeci">VmaPoolCreateFlagBits</div><div class="ttdoc">Flags to be passed as VmaPoolCreateInfo::flags.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2828</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a1cf7774606721026a68aabe3af2e5b50"><div class="ttname"><a href="vk__mem__alloc_8h.html#a1cf7774606721026a68aabe3af2e5b50">VmaAllocationInfo</a></div><div class="ttdeci">struct VmaAllocationInfo VmaAllocationInfo</div><div class="ttdoc">Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_stats_html_a36f9d5df2a10ba2a36b16e126d60572d"><div class="ttname"><a href="struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d">VmaDefragmentationStats::bytesMoved</a></div><div class="ttdeci">VkDeviceSize bytesMoved</div><div class="ttdoc">Total number of bytes that have been copied while moving allocations to different places.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3522</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html_aedeba931324f16589cd2416c0d2dd0d4"><div class="ttname"><a href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">VmaStatInfo::unusedRangeSizeMin</a></div><div class="ttdeci">VkDeviceSize unusedRangeSizeMin</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2437</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2676</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_stats_html_a36f9d5df2a10ba2a36b16e126d60572d"><div class="ttname"><a href="struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d">VmaDefragmentationStats::bytesMoved</a></div><div class="ttdeci">VkDeviceSize bytesMoved</div><div class="ttdoc">Total number of bytes that have been copied while moving allocations to different places.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3571</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html_aedeba931324f16589cd2416c0d2dd0d4"><div class="ttname"><a href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">VmaStatInfo::unusedRangeSizeMin</a></div><div class="ttdeci">VkDeviceSize unusedRangeSizeMin</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2438</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2677</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ad535935619c7a549bf837e1bb0068f89"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad535935619c7a549bf837e1bb0068f89">vmaCheckPoolCorruption</a></div><div class="ttdeci">VkResult vmaCheckPoolCorruption(VmaAllocator allocator, VmaPool pool)</div><div class="ttdoc">Checks magic number in margins around all allocations in given memory pool in search for corruptions.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a3d3ca45799923aa5d138e9e5f9eb2da5"><div class="ttname"><a href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5">vmaBindImageMemory</a></div><div class="ttdeci">VkResult vmaBindImageMemory(VmaAllocator allocator, VmaAllocation allocation, VkImage image)</div><div class="ttdoc">Binds image to allocation.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a154ccaaf53dc2c36378f80f0c4f3679b"><div class="ttname"><a href="vk__mem__alloc_8h.html#a154ccaaf53dc2c36378f80f0c4f3679b">PFN_vmaFreeDeviceMemoryFunction</a></div><div class="ttdeci">void(VKAPI_PTR * PFN_vmaFreeDeviceMemoryFunction)(VmaAllocator allocator, uint32_t memoryType, VkDeviceMemory memory, VkDeviceSize size, void *pUserData)</div><div class="ttdoc">Callback function called before vkFreeMemory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2072</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a154ccaaf53dc2c36378f80f0c4f3679b"><div class="ttname"><a href="vk__mem__alloc_8h.html#a154ccaaf53dc2c36378f80f0c4f3679b">PFN_vmaFreeDeviceMemoryFunction</a></div><div class="ttdeci">void(VKAPI_PTR * PFN_vmaFreeDeviceMemoryFunction)(VmaAllocator allocator, uint32_t memoryType, VkDeviceMemory memory, VkDeviceSize size, void *pUserData)</div><div class="ttdoc">Callback function called before vkFreeMemory.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2073</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ad6799e8e2b1527abfc84d33bc44aeaf5"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad6799e8e2b1527abfc84d33bc44aeaf5">VmaDefragmentationPassMoveInfo</a></div><div class="ttdeci">struct VmaDefragmentationPassMoveInfo VmaDefragmentationPassMoveInfo</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:2728</div></div>
-<div class="ttc" id="astruct_vma_vulkan_functions_html_a475f6f49f8debe4d10800592606d53f4"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a475f6f49f8debe4d10800592606d53f4">VmaVulkanFunctions::vkGetImageMemoryRequirements</a></div><div class="ttdeci">PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2211</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:2729</div></div>
+<div class="ttc" id="astruct_vma_vulkan_functions_html_a475f6f49f8debe4d10800592606d53f4"><div class="ttname"><a href="struct_vma_vulkan_functions.html#a475f6f49f8debe4d10800592606d53f4">VmaVulkanFunctions::vkGetImageMemoryRequirements</a></div><div class="ttdeci">PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2212</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_aec0ed24ebea2d0099eed5f801daaefba"><div class="ttname"><a href="vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba">vmaGetBudget</a></div><div class="ttdeci">void vmaGetBudget(VmaAllocator allocator, VmaBudget *pBudget)</div><div class="ttdoc">Retrieves information about current memory budget for all memory heaps.</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2725</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_a7fe8d81a1ad10b2a2faacacee5b15d6d"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">VmaAllocationCreateInfo::preferredFlags</a></div><div class="ttdeci">VkMemoryPropertyFlags preferredFlags</div><div class="ttdoc">Flags that preferably should be set in a memory type chosen for an allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2744</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2726</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_a7fe8d81a1ad10b2a2faacacee5b15d6d"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">VmaAllocationCreateInfo::preferredFlags</a></div><div class="ttdeci">VkMemoryPropertyFlags preferredFlags</div><div class="ttdoc">Flags that preferably should be set in a memory type chosen for an allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2745</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a36ba776fd7fd5cb1e9359fdc0d8e6e8a"><div class="ttname"><a href="vk__mem__alloc_8h.html#a36ba776fd7fd5cb1e9359fdc0d8e6e8a">vmaDefragmentationBegin</a></div><div class="ttdeci">VkResult vmaDefragmentationBegin(VmaAllocator allocator, const VmaDefragmentationInfo2 *pInfo, VmaDefragmentationStats *pStats, VmaDefragmentationContext *pContext)</div><div class="ttdoc">Begins defragmentation process.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_aa8251ee81b0045a443e35b8e8aa021bc"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc">vmaBindImageMemory2</a></div><div class="ttdeci">VkResult vmaBindImageMemory2(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize allocationLocalOffset, VkImage image, const void *pNext)</div><div class="ttdoc">Binds image to allocation with additional parameters.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_aa078667e71b1ef24e87a6a30d128381d"><div class="ttname"><a href="vk__mem__alloc_8h.html#aa078667e71b1ef24e87a6a30d128381d">VmaBudget</a></div><div class="ttdeci">struct VmaBudget VmaBudget</div><div class="ttdoc">Statistics of current memory usage and available budget, in bytes, for specific memory heap.</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a1b9ffa538bed905af55c747cc48963bd"><div class="ttname"><a href="vk__mem__alloc_8h.html#a1b9ffa538bed905af55c747cc48963bd">vmaEndDefragmentationPass</a></div><div class="ttdeci">VkResult vmaEndDefragmentationPass(VmaAllocator allocator, VmaDefragmentationContext context)</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a76d51a644dc7f5405d0cdd0025ecd0cc"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">VmaDefragmentationInfo2::pAllocationsChanged</a></div><div class="ttdeci">VkBool32 * pAllocationsChanged</div><div class="ttdoc">Optional, output. Pointer to array that will be filled with information whether the allocation at cer...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3436</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_stats_html_aefeabf130022008eadd75999478af3f9"><div class="ttname"><a href="struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9">VmaDefragmentationStats::allocationsMoved</a></div><div class="ttdeci">uint32_t allocationsMoved</div><div class="ttdoc">Number of allocations that have been moved to different places.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3526</div></div>
-<div class="ttc" id="astruct_vma_allocation_create_info_html_a3bf940c0271d85d6ba32a4d820075055"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">VmaAllocationCreateInfo::memoryTypeBits</a></div><div class="ttdeci">uint32_t memoryTypeBits</div><div class="ttdoc">Bitmask containing one bit set for every memory type acceptable for this allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2752</div></div>
-<div class="ttc" id="astruct_vma_allocator_info_html_aba2b703f96e51d567717e1fb2935b47a"><div class="ttname"><a href="struct_vma_allocator_info.html#aba2b703f96e51d567717e1fb2935b47a">VmaAllocatorInfo::physicalDevice</a></div><div class="ttdeci">VkPhysicalDevice physicalDevice</div><div class="ttdoc">Handle to Vulkan physical device object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2368</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_stats_html_a0113f1877904a5d1ee8f409216ff276b"><div class="ttname"><a href="struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b">VmaDefragmentationStats::deviceMemoryBlocksFreed</a></div><div class="ttdeci">uint32_t deviceMemoryBlocksFreed</div><div class="ttdoc">Number of empty VkDeviceMemory objects that have been released to the system.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3528</div></div>
-<div class="ttc" id="astruct_vma_record_settings_html_a6cb1fdbf6bcb610b68f2010dd629e89d"><div class="ttname"><a href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d">VmaRecordSettings::pFilePath</a></div><div class="ttdeci">const char * pFilePath</div><div class="ttdoc">Path to the file that should be written by the recording.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2255</div></div>
-<div class="ttc" id="astruct_vma_stat_info_html_a17e9733a5ecd76287d4db6e66f71f50c"><div class="ttname"><a href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">VmaStatInfo::allocationSizeMax</a></div><div class="ttdeci">VkDeviceSize allocationSizeMax</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2436</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="ttdoc">Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3063</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a></div><div class="ttdeci">@ VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</div><div class="ttdoc">Enables alternative, buddy allocation algorithm in this pool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2873</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a76d51a644dc7f5405d0cdd0025ecd0cc"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">VmaDefragmentationInfo2::pAllocationsChanged</a></div><div class="ttdeci">VkBool32 * pAllocationsChanged</div><div class="ttdoc">Optional, output. Pointer to array that will be filled with information whether the allocation at cer...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3485</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_stats_html_aefeabf130022008eadd75999478af3f9"><div class="ttname"><a href="struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9">VmaDefragmentationStats::allocationsMoved</a></div><div class="ttdeci">uint32_t allocationsMoved</div><div class="ttdoc">Number of allocations that have been moved to different places.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3575</div></div>
+<div class="ttc" id="astruct_vma_allocation_create_info_html_a3bf940c0271d85d6ba32a4d820075055"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">VmaAllocationCreateInfo::memoryTypeBits</a></div><div class="ttdeci">uint32_t memoryTypeBits</div><div class="ttdoc">Bitmask containing one bit set for every memory type acceptable for this allocation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2753</div></div>
+<div class="ttc" id="astruct_vma_allocator_info_html_aba2b703f96e51d567717e1fb2935b47a"><div class="ttname"><a href="struct_vma_allocator_info.html#aba2b703f96e51d567717e1fb2935b47a">VmaAllocatorInfo::physicalDevice</a></div><div class="ttdeci">VkPhysicalDevice physicalDevice</div><div class="ttdoc">Handle to Vulkan physical device object.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2369</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_stats_html_a0113f1877904a5d1ee8f409216ff276b"><div class="ttname"><a href="struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b">VmaDefragmentationStats::deviceMemoryBlocksFreed</a></div><div class="ttdeci">uint32_t deviceMemoryBlocksFreed</div><div class="ttdoc">Number of empty VkDeviceMemory objects that have been released to the system.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3577</div></div>
+<div class="ttc" id="astruct_vma_record_settings_html_a6cb1fdbf6bcb610b68f2010dd629e89d"><div class="ttname"><a href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d">VmaRecordSettings::pFilePath</a></div><div class="ttdeci">const char * pFilePath</div><div class="ttdoc">Path to the file that should be written by the recording.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2256</div></div>
+<div class="ttc" id="astruct_vma_stat_info_html_a17e9733a5ecd76287d4db6e66f71f50c"><div class="ttname"><a href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">VmaStatInfo::allocationSizeMax</a></div><div class="ttdeci">VkDeviceSize allocationSizeMax</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2437</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="ttdoc">Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3064</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a></div><div class="ttdeci">@ VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</div><div class="ttdoc">Enables alternative, buddy allocation algorithm in this pool.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2874</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a1988031b0223fdbd564250fa1edd942c"><div class="ttname"><a href="vk__mem__alloc_8h.html#a1988031b0223fdbd564250fa1edd942c">VmaAllocatorInfo</a></div><div class="ttdeci">struct VmaAllocatorInfo VmaAllocatorInfo</div><div class="ttdoc">Information about existing VmaAllocator object.</div></div>
-<div class="ttc" id="astruct_vma_budget_html_a7e2a6583ebd63e194951c542563804d8"><div class="ttname"><a href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8">VmaBudget::allocationBytes</a></div><div class="ttdeci">VkDeviceSize allocationBytes</div><div class="ttdoc">Sum size of all allocations created in particular heap, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2478</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882">VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2721</div></div>
+<div class="ttc" id="astruct_vma_budget_html_a7e2a6583ebd63e194951c542563804d8"><div class="ttname"><a href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8">VmaBudget::allocationBytes</a></div><div class="ttdeci">VkDeviceSize allocationBytes</div><div class="ttdoc">Sum size of all allocations created in particular heap, in bytes.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2479</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882">VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2722</div></div>
 <div class="ttc" id="astruct_vma_defragmentation_context_html"><div class="ttname"><a href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a></div><div class="ttdoc">Represents Opaque object that represents started defragmentation process.</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c">VMA_POOL_CREATE_ALGORITHM_MASK</a></div><div class="ttdeci">@ VMA_POOL_CREATE_ALGORITHM_MASK</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2877</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info2_html_a94c2c7223d52878445a8cccce396b671"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">VmaDefragmentationInfo2::maxCpuAllocationsToMove</a></div><div class="ttdeci">uint32_t maxCpuAllocationsToMove</div><div class="ttdoc">Maximum number of allocations that can be moved to a different place using transfers on CPU side,...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3465</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c"><div class="ttname"><a href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c">VMA_POOL_CREATE_ALGORITHM_MASK</a></div><div class="ttdeci">@ VMA_POOL_CREATE_ALGORITHM_MASK</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2878</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info2_html_a94c2c7223d52878445a8cccce396b671"><div class="ttname"><a href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">VmaDefragmentationInfo2::maxCpuAllocationsToMove</a></div><div class="ttdeci">uint32_t maxCpuAllocationsToMove</div><div class="ttdoc">Maximum number of allocations that can be moved to a different place using transfers on CPU side,...</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3514</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a5fea5518972ae9094b1526cbcb19b05f"><div class="ttname"><a href="vk__mem__alloc_8h.html#a5fea5518972ae9094b1526cbcb19b05f">vmaFreeMemory</a></div><div class="ttdeci">void vmaFreeMemory(VmaAllocator allocator, const VmaAllocation allocation)</div><div class="ttdoc">Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(),...</div></div>
-<div class="ttc" id="astruct_vma_defragmentation_info_html"><div class="ttname"><a href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a></div><div class="ttdoc">Deprecated. Optional configuration parameters to be passed to function vmaDefragment().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3506</div></div>
-<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea">VMA_ALLOCATION_CREATE_DONT_BIND_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_DONT_BIND_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2682</div></div>
+<div class="ttc" id="astruct_vma_defragmentation_info_html"><div class="ttname"><a href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a></div><div class="ttdoc">Deprecated. Optional configuration parameters to be passed to function vmaDefragment().</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:3555</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea">VMA_ALLOCATION_CREATE_DONT_BIND_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_DONT_BIND_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2683</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_ad6daeffaa670ce6d11a203a6224c9937"><div class="ttname"><a href="vk__mem__alloc_8h.html#ad6daeffaa670ce6d11a203a6224c9937">VmaDefragmentationInfo2</a></div><div class="ttdeci">struct VmaDefragmentationInfo2 VmaDefragmentationInfo2</div><div class="ttdoc">Parameters for defragmentation.</div></div>
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
diff --git a/docs/html/vk_khr_dedicated_allocation.html b/docs/html/vk_khr_dedicated_allocation.html
index e30decf..e5e21f1 100644
--- a/docs/html/vk_khr_dedicated_allocation.html
+++ b/docs/html/vk_khr_dedicated_allocation.html
@@ -91,8 +91,8 @@
 </ul>
 </div></div><!-- contents -->
 </div><!-- PageDoc -->
-<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</div><div class="ttdoc">Enables usage of VK_KHR_dedicated_allocation extension.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2126</div></div>
-<div class="ttc" id="astruct_vma_allocator_create_info_html_a392ea2ecbaff93f91a7c49f735ad4346"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">VmaAllocatorCreateInfo::flags</a></div><div class="ttdeci">VmaAllocatorCreateFlags flags</div><div class="ttdoc">Flags for created allocator. Use VmaAllocatorCreateFlagBits enum.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2262</div></div>
+<div class="ttc" id="avk__mem__alloc_8h_html_a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878"><div class="ttname"><a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</div><div class="ttdoc">Enables usage of VK_KHR_dedicated_allocation extension.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2127</div></div>
+<div class="ttc" id="astruct_vma_allocator_create_info_html_a392ea2ecbaff93f91a7c49f735ad4346"><div class="ttname"><a href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">VmaAllocatorCreateInfo::flags</a></div><div class="ttdeci">VmaAllocatorCreateFlags flags</div><div class="ttdoc">Flags for created allocator. Use VmaAllocatorCreateFlagBits enum.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:2263</div></div>
 <div class="ttc" id="avk__mem__alloc_8h_html_a200692051ddb34240248234f5f4c17bb"><div class="ttname"><a href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb">vmaCreateAllocator</a></div><div class="ttdeci">VkResult vmaCreateAllocator(const VmaAllocatorCreateInfo *pCreateInfo, VmaAllocator *pAllocator)</div><div class="ttdoc">Creates Allocator object.</div></div>
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h
index 724ff8a..708f8c8 100644
--- a/src/vk_mem_alloc.h
+++ b/src/vk_mem_alloc.h
@@ -1,18665 +1,19003 @@
-//
-// Copyright (c) 2017-2020 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
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#ifndef AMD_VULKAN_MEMORY_ALLOCATOR_H
-#define AMD_VULKAN_MEMORY_ALLOCATOR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** \mainpage Vulkan Memory Allocator
-
-<b>Version 3.0.0-development</b> (2020-03-23)
-
-Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved. \n
-License: MIT
-
-Documentation of all members: vk_mem_alloc.h
-
-\section main_table_of_contents Table of contents
-
-- <b>User guide</b>
-  - \subpage quick_start
-    - [Project setup](@ref quick_start_project_setup)
-    - [Initialization](@ref quick_start_initialization)
-    - [Resource allocation](@ref quick_start_resource_allocation)
-  - \subpage choosing_memory_type
-    - [Usage](@ref choosing_memory_type_usage)
-    - [Required and preferred flags](@ref choosing_memory_type_required_preferred_flags)
-    - [Explicit memory types](@ref choosing_memory_type_explicit_memory_types)
-    - [Custom memory pools](@ref choosing_memory_type_custom_memory_pools)
-    - [Dedicated allocations](@ref choosing_memory_type_dedicated_allocations)
-  - \subpage memory_mapping
-    - [Mapping functions](@ref memory_mapping_mapping_functions)
-    - [Persistently mapped memory](@ref memory_mapping_persistently_mapped_memory)
-    - [Cache flush and invalidate](@ref memory_mapping_cache_control)
-    - [Finding out if memory is mappable](@ref memory_mapping_finding_if_memory_mappable)
-  - \subpage staying_within_budget
-    - [Querying for budget](@ref staying_within_budget_querying_for_budget)
-    - [Controlling memory usage](@ref staying_within_budget_controlling_memory_usage)
-  - \subpage custom_memory_pools
-    - [Choosing memory type index](@ref custom_memory_pools_MemTypeIndex)
-    - [Linear allocation algorithm](@ref linear_algorithm)
-      - [Free-at-once](@ref linear_algorithm_free_at_once)
-      - [Stack](@ref linear_algorithm_stack)
-      - [Double stack](@ref linear_algorithm_double_stack)
-      - [Ring buffer](@ref linear_algorithm_ring_buffer)
-    - [Buddy allocation algorithm](@ref buddy_algorithm)
-  - \subpage defragmentation
-  	- [Defragmenting CPU memory](@ref defragmentation_cpu)
-  	- [Defragmenting GPU memory](@ref defragmentation_gpu)
-  	- [Additional notes](@ref defragmentation_additional_notes)
-  	- [Writing custom allocation algorithm](@ref defragmentation_custom_algorithm)
-  - \subpage lost_allocations
-  - \subpage statistics
-    - [Numeric statistics](@ref statistics_numeric_statistics)
-    - [JSON dump](@ref statistics_json_dump)
-  - \subpage allocation_annotation
-    - [Allocation user data](@ref allocation_user_data)
-    - [Allocation names](@ref allocation_names)
-  - \subpage debugging_memory_usage
-    - [Memory initialization](@ref debugging_memory_usage_initialization)
-    - [Margins](@ref debugging_memory_usage_margins)
-    - [Corruption detection](@ref debugging_memory_usage_corruption_detection)
-  - \subpage record_and_replay
-- \subpage usage_patterns
-  - [Common mistakes](@ref usage_patterns_common_mistakes)
-  - [Simple patterns](@ref usage_patterns_simple)
-  - [Advanced patterns](@ref usage_patterns_advanced)
-- \subpage configuration
-  - [Pointers to Vulkan functions](@ref config_Vulkan_functions)
-  - [Custom host memory allocator](@ref custom_memory_allocator)
-  - [Device memory allocation callbacks](@ref allocation_callbacks)
-  - [Device heap memory limit](@ref heap_memory_limit)
-  - \subpage vk_khr_dedicated_allocation
-  - \subpage enabling_buffer_device_address
-  - \subpage vk_amd_device_coherent_memory
-- \subpage general_considerations
-  - [Thread safety](@ref general_considerations_thread_safety)
-  - [Validation layer warnings](@ref general_considerations_validation_layer_warnings)
-  - [Allocation algorithm](@ref general_considerations_allocation_algorithm)
-  - [Features not supported](@ref general_considerations_features_not_supported)
-
-\section main_see_also See also
-
-- [Product page on GPUOpen](https://gpuopen.com/gaming-product/vulkan-memory-allocator/)
-- [Source repository on GitHub](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator)
-
-
-
-
-\page quick_start Quick start
-
-\section quick_start_project_setup Project setup
-
-Vulkan Memory Allocator comes in form of a "stb-style" single header file.
-You don't need to build it as a separate library project.
-You can add this file directly to your project and submit it to code repository next to your other source files.
-
-"Single header" doesn't mean that everything is contained in C/C++ declarations,
-like it tends to be in case of inline functions or C++ templates.
-It means that implementation is bundled with interface in a single file and needs to be extracted using preprocessor macro.
-If you don't do it properly, you will get linker errors.
-
-To do it properly:
-
--# Include "vk_mem_alloc.h" file in each CPP file where you want to use the library.
-   This includes declarations of all members of the library.
--# In exacly one CPP file define following macro before this include.
-   It enables also internal definitions.
-
-\code
-#define VMA_IMPLEMENTATION
-#include "vk_mem_alloc.h"
-\endcode
-
-It may be a good idea to create dedicated CPP file just for this purpose.
-
-Note on language: This library is written in C++, but has C-compatible interface.
-Thus you can include and use vk_mem_alloc.h in C or C++ code, but full
-implementation with `VMA_IMPLEMENTATION` macro must be compiled as C++, NOT as C.
-
-Please note that this library includes header `<vulkan/vulkan.h>`, which in turn
-includes `<windows.h>` on Windows. If you need some specific macros defined
-before including these headers (like `WIN32_LEAN_AND_MEAN` or
-`WINVER` for Windows, `VK_USE_PLATFORM_WIN32_KHR` for Vulkan), you must define
-them before every `#include` of this library.
-
-
-\section quick_start_initialization Initialization
-
-At program startup:
-
--# Initialize Vulkan to have `VkPhysicalDevice` and `VkDevice` object.
--# Fill VmaAllocatorCreateInfo structure and create #VmaAllocator object by
-   calling vmaCreateAllocator().
-
-\code
-VmaAllocatorCreateInfo allocatorInfo = {};
-allocatorInfo.physicalDevice = physicalDevice;
-allocatorInfo.device = device;
-
-VmaAllocator allocator;
-vmaCreateAllocator(&allocatorInfo, &allocator);
-\endcode
-
-\section quick_start_resource_allocation Resource allocation
-
-When you want to create a buffer or image:
-
--# Fill `VkBufferCreateInfo` / `VkImageCreateInfo` structure.
--# Fill VmaAllocationCreateInfo structure.
--# Call vmaCreateBuffer() / vmaCreateImage() to get `VkBuffer`/`VkImage` with memory
-   already allocated and bound to it.
-
-\code
-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_GPU_ONLY;
-
-VkBuffer buffer;
-VmaAllocation allocation;
-vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
-\endcode
-
-Don't forget to destroy your objects when no longer needed:
-
-\code
-vmaDestroyBuffer(allocator, buffer, allocation);
-vmaDestroyAllocator(allocator);
-\endcode
-
-
-\page choosing_memory_type Choosing memory type
-
-Physical devices in Vulkan support various combinations of memory heaps and
-types. Help with choosing correct and optimal memory type for your specific
-resource is one of the key features of this library. You can use it by filling
-appropriate members of VmaAllocationCreateInfo structure, as described below.
-You can also combine multiple methods.
-
--# If you just want to find memory type index that meets your requirements, you
-   can use function: vmaFindMemoryTypeIndex(), vmaFindMemoryTypeIndexForBufferInfo(),
-   vmaFindMemoryTypeIndexForImageInfo().
--# If you want to allocate a region of device memory without association with any
-   specific image or buffer, you can use function vmaAllocateMemory(). Usage of
-   this function is not recommended and usually not needed.
-   vmaAllocateMemoryPages() function is also provided for creating multiple allocations at once,
-   which may be useful for sparse binding.
--# If you already have a buffer or an image created, you want to allocate memory
-   for it and then you will bind it yourself, you can use function
-   vmaAllocateMemoryForBuffer(), vmaAllocateMemoryForImage().
-   For binding you should use functions: vmaBindBufferMemory(), vmaBindImageMemory()
-   or their extended versions: vmaBindBufferMemory2(), vmaBindImageMemory2().
--# If you want to create a buffer or an image, allocate memory for it and bind
-   them together, all in one call, you can use function vmaCreateBuffer(),
-   vmaCreateImage(). This is the easiest and recommended way to use this library.
-
-When using 3. or 4., the library internally queries Vulkan for memory types
-supported for that buffer or image (function `vkGetBufferMemoryRequirements()`)
-and uses only one of these types.
-
-If no memory type can be found that meets all the requirements, these functions
-return `VK_ERROR_FEATURE_NOT_PRESENT`.
-
-You can leave VmaAllocationCreateInfo structure completely filled with zeros.
-It means no requirements are specified for memory type.
-It is valid, although not very useful.
-
-\section choosing_memory_type_usage Usage
-
-The easiest way to specify memory requirements is to fill member
-VmaAllocationCreateInfo::usage using one of the values of enum #VmaMemoryUsage.
-It defines high level, common usage types.
-For more details, see description of this enum.
-
-For example, if you want to create a uniform buffer that will be filled using
-transfer only once or infrequently and used for rendering every frame, you can
-do it using following code:
-
-\code
-VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-bufferInfo.size = 65536;
-bufferInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
-
-VmaAllocationCreateInfo allocInfo = {};
-allocInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-
-VkBuffer buffer;
-VmaAllocation allocation;
-vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
-\endcode
-
-\section choosing_memory_type_required_preferred_flags Required and preferred flags
-
-You can specify more detailed requirements by filling members
-VmaAllocationCreateInfo::requiredFlags and VmaAllocationCreateInfo::preferredFlags
-with a combination of bits from enum `VkMemoryPropertyFlags`. For example,
-if you want to create a buffer that will be persistently mapped on host (so it
-must be `HOST_VISIBLE`) and preferably will also be `HOST_COHERENT` and `HOST_CACHED`,
-use following code:
-
-\code
-VmaAllocationCreateInfo allocInfo = {};
-allocInfo.requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
-allocInfo.preferredFlags = VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
-allocInfo.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT;
-
-VkBuffer buffer;
-VmaAllocation allocation;
-vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
-\endcode
-
-A memory type is chosen that has all the required flags and as many preferred
-flags set as possible.
-
-If you use VmaAllocationCreateInfo::usage, it is just internally converted to
-a set of required and preferred flags.
-
-\section choosing_memory_type_explicit_memory_types Explicit memory types
-
-If you inspected memory types available on the physical device and you have
-a preference for memory types that you want to use, you can fill member
-VmaAllocationCreateInfo::memoryTypeBits. It is a bit mask, where each bit set
-means that a memory type with that index is allowed to be used for the
-allocation. Special value 0, just like `UINT32_MAX`, means there are no
-restrictions to memory type index.
-
-Please note that this member is NOT just a memory type index.
-Still you can use it to choose just one, specific memory type.
-For example, if you already determined that your buffer should be created in
-memory type 2, use following code:
-
-\code
-uint32_t memoryTypeIndex = 2;
-
-VmaAllocationCreateInfo allocInfo = {};
-allocInfo.memoryTypeBits = 1u << memoryTypeIndex;
-
-VkBuffer buffer;
-VmaAllocation allocation;
-vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
-\endcode
-
-\section choosing_memory_type_custom_memory_pools Custom memory pools
-
-If you allocate from custom memory pool, all the ways of specifying memory
-requirements described above are not applicable and the aforementioned members
-of VmaAllocationCreateInfo 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 \ref custom_memory_pools.
-
-\section choosing_memory_type_dedicated_allocations Dedicated allocations
-
-Memory for allocations is reserved out of larger block of `VkDeviceMemory`
-allocated from Vulkan internally. That's 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 #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
-The library can also internally decide to use dedicated allocation in some cases, e.g.:
-
-- When the size of the allocation is large.
-- When [VK_KHR_dedicated_allocation](@ref vk_khr_dedicated_allocation) extension is enabled
-  and it reports that dedicated allocation is required or recommended for the resource.
-- When allocation of next big memory block fails due to not enough device memory,
-  but allocation with the exact requested size succeeds.
-
-
-\page memory_mapping Memory mapping
-
-To "map memory" in Vulkan means to obtain a CPU pointer to `VkDeviceMemory`,
-to be able to read from it or write to it in CPU code.
-Mapping is possible only of memory allocated from a memory type that has
-`VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` flag.
-Functions `vkMapMemory()`, `vkUnmapMemory()` are designed for this purpose.
-You can use them directly with memory allocated by this library,
-but it is not recommended because of following issue:
-Mapping the same `VkDeviceMemory` block multiple times is illegal - only one mapping at a time is allowed.
-This includes mapping disjoint regions. Mapping is not reference-counted internally by Vulkan.
-Because of this, Vulkan Memory Allocator provides following facilities:
-
-\section memory_mapping_mapping_functions Mapping functions
-
-The library provides following functions for mapping of a specific #VmaAllocation: vmaMapMemory(), vmaUnmapMemory().
-They are safer and more convenient to use than standard Vulkan functions.
-You can map an allocation multiple times simultaneously - mapping is reference-counted internally.
-You can also map different allocations simultaneously regardless of whether they use the same `VkDeviceMemory` block.
-The way it's implemented is that the library always maps entire memory block, not just region of the allocation.
-For further details, see description of vmaMapMemory() function.
-Example:
-
-\code
-// Having these objects initialized:
-
-struct ConstantBuffer
-{
-    ...
-};
-ConstantBuffer constantBufferData;
-
-VmaAllocator allocator;
-VkBuffer constantBuffer;
-VmaAllocation constantBufferAllocation;
-
-// You can map and fill your buffer using following code:
-
-void* mappedData;
-vmaMapMemory(allocator, constantBufferAllocation, &mappedData);
-memcpy(mappedData, &constantBufferData, sizeof(constantBufferData));
-vmaUnmapMemory(allocator, constantBufferAllocation);
-\endcode
-
-When mapping, you may see a warning from Vulkan validation layer similar to this one:
-
-<i>Mapping an image with layout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL can result in undefined behavior if this memory is used by the device. Only GENERAL or PREINITIALIZED should be used.</i>
-
-It happens because the library maps entire `VkDeviceMemory` block, where different
-types of images and buffers may end up together, especially on GPUs with unified memory like Intel.
-You can safely ignore it if you are sure you access only memory of the intended
-object that you wanted to map.
-
-
-\section memory_mapping_persistently_mapped_memory Persistently mapped memory
-
-Kepping your memory persistently mapped is generally OK in Vulkan.
-You don't need to unmap it before using its data on the GPU.
-The library provides a special feature designed for that:
-Allocations made with #VMA_ALLOCATION_CREATE_MAPPED_BIT flag set in
-VmaAllocationCreateInfo::flags stay mapped all the time,
-so you can just access CPU pointer to it any time
-without a need to call any "map" or "unmap" function.
-Example:
-
-\code
-VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-bufCreateInfo.size = sizeof(ConstantBuffer);
-bufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
-
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_CPU_ONLY;
-allocCreateInfo.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT;
-
-VkBuffer buf;
-VmaAllocation alloc;
-VmaAllocationInfo allocInfo;
-vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
-
-// Buffer is already mapped. You can access its memory.
-memcpy(allocInfo.pMappedData, &constantBufferData, sizeof(constantBufferData));
-\endcode
-
-There are some exceptions though, when you should consider mapping memory only for a short period of time:
-
-- When operating system is Windows 7 or 8.x (Windows 10 is not affected because it uses WDDM2),
-  device is discrete AMD GPU,
-  and memory type is the special 256 MiB pool of `DEVICE_LOCAL + HOST_VISIBLE` memory
-  (selected when you use #VMA_MEMORY_USAGE_CPU_TO_GPU),
-  then whenever a memory block allocated from this memory type stays mapped
-  for the time of any call to `vkQueueSubmit()` or `vkQueuePresentKHR()`, this
-  block is migrated by WDDM to system RAM, which degrades performance. It doesn't
-  matter if that particular memory block is actually used by the command buffer
-  being submitted.
-- On Mac/MoltenVK there is a known bug - [Issue #175](https://github.com/KhronosGroup/MoltenVK/issues/175)
-  which requires unmapping before GPU can see updated texture.
-- Keeping many large memory blocks mapped may impact performance or stability of some debugging tools.
-
-\section memory_mapping_cache_control Cache flush and invalidate
-  
-Memory in Vulkan doesn't need to be unmapped before using it on GPU,
-but unless a memory types has `VK_MEMORY_PROPERTY_HOST_COHERENT_BIT` flag set,
-you need to manually **invalidate** cache before reading of mapped pointer
-and **flush** cache after writing to mapped pointer.
-Map/unmap operations don't do that automatically.
-Vulkan provides following functions for this purpose `vkFlushMappedMemoryRanges()`,
-`vkInvalidateMappedMemoryRanges()`, but this library provides more convenient
-functions that refer to given allocation object: vmaFlushAllocation(),
-vmaInvalidateAllocation().
-
-Regions of memory specified for flush/invalidate must be aligned to
-`VkPhysicalDeviceLimits::nonCoherentAtomSize`. This is automatically ensured by the library.
-In any memory type that is `HOST_VISIBLE` but not `HOST_COHERENT`, all allocations
-within blocks are aligned to this value, so their offsets are always multiply of
-`nonCoherentAtomSize` and two different allocations never share same "line" of this size.
-
-Please note that memory allocated with #VMA_MEMORY_USAGE_CPU_ONLY is guaranteed to be `HOST_COHERENT`.
-
-Also, Windows drivers from all 3 **PC** GPU vendors (AMD, Intel, NVIDIA)
-currently provide `HOST_COHERENT` flag on all memory types that are
-`HOST_VISIBLE`, so on this platform you may not need to bother.
-
-\section memory_mapping_finding_if_memory_mappable Finding out if memory is mappable
-
-It may happen that your allocation ends up in memory that is `HOST_VISIBLE` (available for mapping)
-despite it wasn't explicitly requested.
-For example, application may work on integrated graphics with unified memory (like Intel) or
-allocation from video memory might have failed, so the library chose system memory as fallback.
-
-You can detect this case and map such allocation to access its memory on CPU directly,
-instead of launching a transfer operation.
-In order to do that: inspect `allocInfo.memoryType`, call vmaGetMemoryTypeProperties(),
-and look for `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` flag in properties of that memory type.
-
-\code
-VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-bufCreateInfo.size = sizeof(ConstantBuffer);
-bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
-
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-allocCreateInfo.preferredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
-
-VkBuffer buf;
-VmaAllocation alloc;
-VmaAllocationInfo allocInfo;
-vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
-
-VkMemoryPropertyFlags memFlags;
-vmaGetMemoryTypeProperties(allocator, allocInfo.memoryType, &memFlags);
-if((memFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
-{
-    // Allocation ended up in mappable memory. You can map it and access it directly.
-    void* mappedData;
-    vmaMapMemory(allocator, alloc, &mappedData);
-    memcpy(mappedData, &constantBufferData, sizeof(constantBufferData));
-    vmaUnmapMemory(allocator, alloc);
-}
-else
-{
-    // Allocation ended up in non-mappable memory.
-    // You need to create CPU-side buffer in VMA_MEMORY_USAGE_CPU_ONLY and make a transfer.
-}
-\endcode
-
-You can even use #VMA_ALLOCATION_CREATE_MAPPED_BIT flag while creating allocations
-that are not necessarily `HOST_VISIBLE` (e.g. using #VMA_MEMORY_USAGE_GPU_ONLY).
-If the allocation ends up in memory type that is `HOST_VISIBLE`, it will be persistently mapped and you can use it directly.
-If not, the flag is just ignored.
-Example:
-
-\code
-VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-bufCreateInfo.size = sizeof(ConstantBuffer);
-bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
-
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-allocCreateInfo.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT;
-
-VkBuffer buf;
-VmaAllocation alloc;
-VmaAllocationInfo allocInfo;
-vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
-
-if(allocInfo.pUserData != nullptr)
-{
-    // Allocation ended up in mappable memory.
-    // It's persistently mapped. You can access it directly.
-    memcpy(allocInfo.pMappedData, &constantBufferData, sizeof(constantBufferData));
-}
-else
-{
-    // Allocation ended up in non-mappable memory.
-    // You need to create CPU-side buffer in VMA_MEMORY_USAGE_CPU_ONLY and make a transfer.
-}
-\endcode
-
-
-\page staying_within_budget Staying within budget
-
-When developing a graphics-intensive game or program, it is important to avoid allocating
-more GPU memory than it's physically available. When the memory is over-committed,
-various bad things can happen, depending on the specific GPU, graphics driver, and
-operating system:
-
-- It may just work without any problems.
-- The application may slow down because some memory blocks are moved to system RAM
-  and the GPU has to access them through PCI Express bus.
-- A new allocation may take very long time to complete, even few seconds, and possibly
-  freeze entire system.
-- The new allocation may fail with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
-- It may even result in GPU crash (TDR), observed as `VK_ERROR_DEVICE_LOST`
-  returned somewhere later.
-
-\section staying_within_budget_querying_for_budget Querying for budget
-
-To query for current memory usage and available budget, use function vmaGetBudget().
-Returned structure #VmaBudget contains quantities expressed in bytes, per Vulkan memory heap.
-
-Please note that this function returns different information and works faster than
-vmaCalculateStats(). vmaGetBudget() can be called every frame or even before every
-allocation, while vmaCalculateStats() is intended to be used rarely,
-only to obtain statistical information, e.g. for debugging purposes.
-
-It is recommended to use <b>VK_EXT_memory_budget</b> device extension to obtain information
-about the budget from Vulkan device. VMA is able to use this extension automatically.
-When not enabled, the allocator behaves same way, but then it estimates current usage
-and available budget based on its internal information and Vulkan memory heap sizes,
-which may be less precise. In order to use this extension:
-
-1. Make sure extensions VK_EXT_memory_budget and VK_KHR_get_physical_device_properties2
-   required by it are available and enable them. Please note that the first is a device
-   extension and the second is instance extension!
-2. Use flag #VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT when creating #VmaAllocator object.
-3. Make sure to call vmaSetCurrentFrameIndex() every frame. Budget is queried from
-   Vulkan inside of it to avoid overhead of querying it with every allocation.
-
-\section staying_within_budget_controlling_memory_usage Controlling memory usage
-
-There are many ways in which you can try to stay within the budget.
-
-First, when making new allocation requires allocating a new memory block, the library
-tries not to exceed the budget automatically. If a block with default recommended size
-(e.g. 256 MB) would go over budget, a smaller block is allocated, possibly even
-dedicated memory for just this resource.
-
-If the size of the requested resource plus current memory usage is more than the
-budget, by default the library still tries to create it, leaving it to the Vulkan
-implementation whether the allocation succeeds or fails. You can change this behavior
-by using #VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT flag. With it, the allocation is
-not made if it would exceed the budget or if the budget is already exceeded.
-Some other allocations become lost instead to make room for it, if the mechanism of
-[lost allocations](@ref lost_allocations) is used.
-If that is not possible, the allocation fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
-Example usage pattern may be to pass the #VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT flag
-when creating resources that are not essential for the application (e.g. the texture
-of a specific object) and not to pass it when creating critically important resources
-(e.g. render targets).
-
-Finally, you can also use #VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT flag to make sure
-a new allocation is created only when it fits inside one of the existing memory blocks.
-If it would require to allocate a new block, if fails instead with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
-This also ensures that the function call is very fast because it never goes to Vulkan
-to obtain a new block.
-
-Please note that creating \ref custom_memory_pools with VmaPoolCreateInfo::minBlockCount
-set to more than 0 will try to allocate memory blocks without checking whether they
-fit within budget.
-
-
-\page custom_memory_pools Custom memory pools
-
-A memory pool contains a number of `VkDeviceMemory` blocks.
-The library automatically creates and manages default pool for each memory type available on the device.
-Default memory pool automatically grows in size.
-Size of allocated blocks is also variable and managed automatically.
-
-You can create custom pool and allocate memory out of it.
-It can be useful if you want to:
-
-- Keep certain kind of allocations separate from others.
-- Enforce particular, fixed size of Vulkan memory blocks.
-- Limit maximum amount of Vulkan memory allocated for that pool.
-- Reserve minimum or fixed amount of Vulkan memory always preallocated for that pool.
-
-To use custom memory pools:
-
--# Fill VmaPoolCreateInfo structure.
--# Call vmaCreatePool() to obtain #VmaPool handle.
--# When making an allocation, set VmaAllocationCreateInfo::pool to this handle.
-   You don't need to specify any other parameters of this structure, like `usage`.
-
-Example:
-
-\code
-// Create a pool that can have at most 2 blocks, 128 MiB each.
-VmaPoolCreateInfo poolCreateInfo = {};
-poolCreateInfo.memoryTypeIndex = ...
-poolCreateInfo.blockSize = 128ull * 1024 * 1024;
-poolCreateInfo.maxBlockCount = 2;
-
-VmaPool pool;
-vmaCreatePool(allocator, &poolCreateInfo, &pool);
-
-// Allocate a buffer out of it.
-VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-bufCreateInfo.size = 1024;
-bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
-
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.pool = pool;
-
-VkBuffer buf;
-VmaAllocation alloc;
-VmaAllocationInfo allocInfo;
-vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
-\endcode
-
-You have to free all allocations made from this pool before destroying it.
-
-\code
-vmaDestroyBuffer(allocator, buf, alloc);
-vmaDestroyPool(allocator, pool);
-\endcode
-
-\section custom_memory_pools_MemTypeIndex Choosing memory type index
-
-When creating a pool, you must explicitly specify memory type index.
-To find the one suitable for your buffers or images, you can use helper functions
-vmaFindMemoryTypeIndexForBufferInfo(), vmaFindMemoryTypeIndexForImageInfo().
-You need to provide structures with example parameters of buffers or images
-that you are going to create in that pool.
-
-\code
-VkBufferCreateInfo exampleBufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-exampleBufCreateInfo.size = 1024; // Whatever.
-exampleBufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT; // Change if needed.
-
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY; // Change if needed.
-
-uint32_t memTypeIndex;
-vmaFindMemoryTypeIndexForBufferInfo(allocator, &exampleBufCreateInfo, &allocCreateInfo, &memTypeIndex);
-
-VmaPoolCreateInfo poolCreateInfo = {};
-poolCreateInfo.memoryTypeIndex = memTypeIndex;
-// ...
-\endcode
-
-When creating buffers/images allocated in that pool, provide following parameters:
-
-- `VkBufferCreateInfo`: Prefer to pass same parameters as above.
-  Otherwise you risk creating resources in a memory type that is not suitable for them, which may result in undefined behavior.
-  Using different `VK_BUFFER_USAGE_` flags may work, but you shouldn't create images in a pool intended for buffers
-  or the other way around.
-- VmaAllocationCreateInfo: You don't need to pass same parameters. Fill only `pool` member.
-  Other members are ignored anyway.
-
-\section linear_algorithm Linear allocation algorithm
-
-Each Vulkan memory block managed by this library has accompanying metadata that
-keeps track of used and unused regions. By default, the metadata structure and
-algorithm tries to find best place for new allocations among free regions to
-optimize memory usage. This way you can allocate and free objects in any order.
-
-![Default allocation algorithm](../gfx/Linear_allocator_1_algo_default.png)
-
-Sometimes there is a need to use simpler, linear allocation algorithm. You can
-create custom pool that uses such algorithm by adding flag
-#VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT to VmaPoolCreateInfo::flags while creating
-#VmaPool object. Then an alternative metadata management is used. It always
-creates new allocations after last one and doesn't reuse free regions after
-allocations freed in the middle. It results in better allocation performance and
-less memory consumed by metadata.
-
-![Linear allocation algorithm](../gfx/Linear_allocator_2_algo_linear.png)
-
-With this one flag, you can create a custom pool that can be used in many ways:
-free-at-once, stack, double stack, and ring buffer. See below for details.
-
-\subsection linear_algorithm_free_at_once Free-at-once
-
-In a pool that uses linear algorithm, you still need to free all the allocations
-individually, e.g. by using vmaFreeMemory() or vmaDestroyBuffer(). You can free
-them in any order. New allocations are always made after last one - free space
-in the middle is not reused. However, when you release all the allocation and
-the pool becomes empty, allocation starts from the beginning again. This way you
-can use linear algorithm to speed up creation of allocations that you are going
-to release all at once.
-
-![Free-at-once](../gfx/Linear_allocator_3_free_at_once.png)
-
-This mode is also available for pools created with VmaPoolCreateInfo::maxBlockCount
-value that allows multiple memory blocks.
-
-\subsection linear_algorithm_stack Stack
-
-When you free an allocation that was created last, its space can be reused.
-Thanks to this, if you always release allocations in the order opposite to their
-creation (LIFO - Last In First Out), you can achieve behavior of a stack.
-
-![Stack](../gfx/Linear_allocator_4_stack.png)
-
-This mode is also available for pools created with VmaPoolCreateInfo::maxBlockCount
-value that allows multiple memory blocks.
-
-\subsection linear_algorithm_double_stack Double stack
-
-The space reserved by a custom pool with linear algorithm may be used by two
-stacks:
-
-- First, default one, growing up from offset 0.
-- Second, "upper" one, growing down from the end towards lower offsets.
-
-To make allocation from upper stack, add flag #VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT
-to VmaAllocationCreateInfo::flags.
-
-![Double stack](../gfx/Linear_allocator_7_double_stack.png)
-
-Double stack is available only in pools with one memory block -
-VmaPoolCreateInfo::maxBlockCount must be 1. Otherwise behavior is undefined.
-
-When the two stacks' ends meet so there is not enough space between them for a
-new allocation, such allocation fails with usual
-`VK_ERROR_OUT_OF_DEVICE_MEMORY` error.
-
-\subsection linear_algorithm_ring_buffer Ring buffer
-
-When you free some allocations from the beginning and there is not enough free space
-for a new one at the end of a pool, allocator's "cursor" wraps around to the
-beginning and starts allocation there. Thanks to this, if you always release
-allocations in the same order as you created them (FIFO - First In First Out),
-you can achieve behavior of a ring buffer / queue.
-
-![Ring buffer](../gfx/Linear_allocator_5_ring_buffer.png)
-
-Pools with linear algorithm support [lost allocations](@ref lost_allocations) when used as ring buffer.
-If there is not enough free space for a new allocation, but existing allocations
-from the front of the queue can become lost, they become lost and the allocation
-succeeds.
-
-![Ring buffer with lost allocations](../gfx/Linear_allocator_6_ring_buffer_lost.png)
-
-Ring buffer is available only in pools with one memory block -
-VmaPoolCreateInfo::maxBlockCount must be 1. Otherwise behavior is undefined.
-
-\section buddy_algorithm Buddy allocation algorithm
-
-There is another allocation algorithm that can be used with custom pools, called
-"buddy". Its internal data structure is based on a tree of blocks, each having
-size that is a power of two and a half of its parent's size. When you want to
-allocate memory of certain size, a free node in the tree is located. If it's too
-large, it is recursively split into two halves (called "buddies"). However, if
-requested allocation size is not a power of two, the size of a tree node is
-aligned up to the nearest power of two and the remaining space is wasted. When
-two buddy nodes become free, they are merged back into one larger node.
-
-![Buddy allocator](../gfx/Buddy_allocator.png)
-
-The advantage of buddy allocation algorithm over default algorithm is faster
-allocation and deallocation, as well as smaller external fragmentation. The
-disadvantage is more wasted space (internal fragmentation).
-
-For more information, please read ["Buddy memory allocation" on Wikipedia](https://en.wikipedia.org/wiki/Buddy_memory_allocation)
-or other sources that describe this concept in general.
-
-To use buddy allocation algorithm with a custom pool, add flag
-#VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT to VmaPoolCreateInfo::flags while creating
-#VmaPool object.
-
-Several limitations apply to pools that use buddy algorithm:
-
-- It is recommended to use VmaPoolCreateInfo::blockSize that is a power of two.
-  Otherwise, only largest power of two smaller than the size is used for
-  allocations. The remaining space always stays unused.
-- [Margins](@ref debugging_memory_usage_margins) and
-  [corruption detection](@ref debugging_memory_usage_corruption_detection)
-  don't work in such pools.
-- [Lost allocations](@ref lost_allocations) don't work in such pools. You can
-  use them, but they never become lost. Support may be added in the future.
-- [Defragmentation](@ref defragmentation) doesn't work with allocations made from
-  such pool.
-
-\page defragmentation Defragmentation
-
-Interleaved allocations and deallocations of many objects of varying size can
-cause fragmentation over time, which can lead to a situation where the library is unable
-to find a continuous range of free memory for a new allocation despite there is
-enough free space, just scattered across many small free ranges between existing
-allocations.
-
-To mitigate this problem, you can use defragmentation feature:
-structure #VmaDefragmentationInfo2, function vmaDefragmentationBegin(), vmaDefragmentationEnd().
-Given set of allocations, 
-this function can move them to compact used memory, ensure more continuous free
-space and possibly also free some `VkDeviceMemory` blocks.
-
-What the defragmentation does is:
-
-- Updates #VmaAllocation objects to point to new `VkDeviceMemory` and offset.
-  After allocation has been moved, its VmaAllocationInfo::deviceMemory and/or
-  VmaAllocationInfo::offset changes. You must query them again using
-  vmaGetAllocationInfo() if you need them.
-- Moves actual data in memory.
-
-What it doesn't do, so you need to do it yourself:
-
-- Recreate buffers and images that were bound to allocations that were defragmented and
-  bind them with their new places in memory.
-  You must use `vkDestroyBuffer()`, `vkDestroyImage()`,
-  `vkCreateBuffer()`, `vkCreateImage()`, vmaBindBufferMemory(), vmaBindImageMemory()
-  for that purpose and NOT vmaDestroyBuffer(),
-  vmaDestroyImage(), vmaCreateBuffer(), vmaCreateImage(), because you don't need to
-  destroy or create allocation objects!
-- Recreate views and update descriptors that point to these buffers and images.
-
-\section defragmentation_cpu Defragmenting CPU memory
-
-Following example demonstrates how you can run defragmentation on CPU.
-Only allocations created in memory types that are `HOST_VISIBLE` can be defragmented.
-Others are ignored.
-
-The way it works is:
-
-- It temporarily maps entire memory blocks when necessary.
-- It moves data using `memmove()` function.
-
-\code
-// Given following variables already initialized:
-VkDevice device;
-VmaAllocator allocator;
-std::vector<VkBuffer> buffers;
-std::vector<VmaAllocation> allocations;
-
-
-const uint32_t allocCount = (uint32_t)allocations.size();
-std::vector<VkBool32> allocationsChanged(allocCount);
-
-VmaDefragmentationInfo2 defragInfo = {};
-defragInfo.allocationCount = allocCount;
-defragInfo.pAllocations = allocations.data();
-defragInfo.pAllocationsChanged = allocationsChanged.data();
-defragInfo.maxCpuBytesToMove = VK_WHOLE_SIZE; // No limit.
-defragInfo.maxCpuAllocationsToMove = UINT32_MAX; // No limit.
-
-VmaDefragmentationContext defragCtx;
-vmaDefragmentationBegin(allocator, &defragInfo, nullptr, &defragCtx);
-vmaDefragmentationEnd(allocator, defragCtx);
-
-for(uint32_t i = 0; i < allocCount; ++i)
-{
-    if(allocationsChanged[i])
-    {
-        // Destroy buffer that is immutably bound to memory region which is no longer valid.
-        vkDestroyBuffer(device, buffers[i], nullptr);
-
-        // Create new buffer with same parameters.
-        VkBufferCreateInfo bufferInfo = ...;
-        vkCreateBuffer(device, &bufferInfo, nullptr, &buffers[i]);
-            
-        // You can make dummy call to vkGetBufferMemoryRequirements here to silence validation layer warning.
-            
-        // Bind new buffer to new memory region. Data contained in it is already moved.
-        VmaAllocationInfo allocInfo;
-        vmaGetAllocationInfo(allocator, allocations[i], &allocInfo);
-        vmaBindBufferMemory(allocator, allocations[i], buffers[i]);
-    }
-}
-\endcode
-
-Setting VmaDefragmentationInfo2::pAllocationsChanged is optional.
-This output array tells whether particular allocation in VmaDefragmentationInfo2::pAllocations at the same index
-has been modified during defragmentation.
-You can pass null, but you then need to query every allocation passed to defragmentation
-for new parameters using vmaGetAllocationInfo() if you might need to recreate and rebind a buffer or image associated with it.
-
-If you use [Custom memory pools](@ref choosing_memory_type_custom_memory_pools),
-you can fill VmaDefragmentationInfo2::poolCount and VmaDefragmentationInfo2::pPools
-instead of VmaDefragmentationInfo2::allocationCount and VmaDefragmentationInfo2::pAllocations
-to defragment all allocations in given pools.
-You cannot use VmaDefragmentationInfo2::pAllocationsChanged in that case.
-You can also combine both methods.
-
-\section defragmentation_gpu Defragmenting GPU memory
-
-It is also possible to defragment allocations created in memory types that are not `HOST_VISIBLE`.
-To do that, you need to pass a command buffer that meets requirements as described in
-VmaDefragmentationInfo2::commandBuffer. The way it works is:
-
-- It creates temporary buffers and binds them to entire memory blocks when necessary.
-- It issues `vkCmdCopyBuffer()` to passed command buffer.
-
-Example:
-
-\code
-// Given following variables already initialized:
-VkDevice device;
-VmaAllocator allocator;
-VkCommandBuffer commandBuffer;
-std::vector<VkBuffer> buffers;
-std::vector<VmaAllocation> allocations;
-
-
-const uint32_t allocCount = (uint32_t)allocations.size();
-std::vector<VkBool32> allocationsChanged(allocCount);
-
-VkCommandBufferBeginInfo cmdBufBeginInfo = ...;
-vkBeginCommandBuffer(commandBuffer, &cmdBufBeginInfo);
-
-VmaDefragmentationInfo2 defragInfo = {};
-defragInfo.allocationCount = allocCount;
-defragInfo.pAllocations = allocations.data();
-defragInfo.pAllocationsChanged = allocationsChanged.data();
-defragInfo.maxGpuBytesToMove = VK_WHOLE_SIZE; // Notice it's "GPU" this time.
-defragInfo.maxGpuAllocationsToMove = UINT32_MAX; // Notice it's "GPU" this time.
-defragInfo.commandBuffer = commandBuffer;
-
-VmaDefragmentationContext defragCtx;
-vmaDefragmentationBegin(allocator, &defragInfo, nullptr, &defragCtx);
-
-vkEndCommandBuffer(commandBuffer);
-
-// Submit commandBuffer.
-// Wait for a fence that ensures commandBuffer execution finished.
-
-vmaDefragmentationEnd(allocator, defragCtx);
-
-for(uint32_t i = 0; i < allocCount; ++i)
-{
-    if(allocationsChanged[i])
-    {
-        // Destroy buffer that is immutably bound to memory region which is no longer valid.
-        vkDestroyBuffer(device, buffers[i], nullptr);
-
-        // Create new buffer with same parameters.
-        VkBufferCreateInfo bufferInfo = ...;
-        vkCreateBuffer(device, &bufferInfo, nullptr, &buffers[i]);
-            
-        // You can make dummy call to vkGetBufferMemoryRequirements here to silence validation layer warning.
-            
-        // Bind new buffer to new memory region. Data contained in it is already moved.
-        VmaAllocationInfo allocInfo;
-        vmaGetAllocationInfo(allocator, allocations[i], &allocInfo);
-        vmaBindBufferMemory(allocator, allocations[i], buffers[i]);
-    }
-}
-\endcode
-
-You can combine these two methods by specifying non-zero `maxGpu*` as well as `maxCpu*` parameters.
-The library automatically chooses best method to defragment each memory pool.
-
-You may try not to block your entire program to wait until defragmentation finishes,
-but do it in the background, as long as you carefully fullfill requirements described
-in function vmaDefragmentationBegin().
-
-\section defragmentation_additional_notes Additional notes
-
-It is only legal to defragment allocations bound to:
-
-- buffers
-- images created with `VK_IMAGE_CREATE_ALIAS_BIT`, `VK_IMAGE_TILING_LINEAR`, and
-  being currently in `VK_IMAGE_LAYOUT_GENERAL` or `VK_IMAGE_LAYOUT_PREINITIALIZED`.
-
-Defragmentation of images created with `VK_IMAGE_TILING_OPTIMAL` or in any other
-layout may give undefined results.
-
-If you defragment allocations bound to images, new images to be bound to new
-memory region after defragmentation should be created with `VK_IMAGE_LAYOUT_PREINITIALIZED`
-and then transitioned to their original layout from before defragmentation if
-needed using an image memory barrier.
-
-While using defragmentation, you may experience validation layer warnings, which you just need to ignore.
-See [Validation layer warnings](@ref general_considerations_validation_layer_warnings).
-
-Please don't expect memory to be fully compacted after defragmentation.
-Algorithms inside are based on some heuristics that try to maximize number of Vulkan
-memory blocks to make totally empty to release them, as well as to maximimze continuous
-empty space inside remaining blocks, while minimizing the number and size of allocations that
-need to be moved. Some fragmentation may still remain - this is normal.
-
-\section defragmentation_custom_algorithm Writing custom defragmentation algorithm
-
-If you want to implement your own, custom defragmentation algorithm,
-there is infrastructure prepared for that,
-but it is not exposed through the library API - you need to hack its source code.
-Here are steps needed to do this:
-
--# Main thing you need to do is to define your own class derived from base abstract
-   class `VmaDefragmentationAlgorithm` and implement your version of its pure virtual methods.
-   See definition and comments of this class for details.
--# Your code needs to interact with device memory block metadata.
-   If you need more access to its data than it's provided by its public interface,
-   declare your new class as a friend class e.g. in class `VmaBlockMetadata_Generic`.
--# If you want to create a flag that would enable your algorithm or pass some additional
-   flags to configure it, add them to `VmaDefragmentationFlagBits` and use them in
-   VmaDefragmentationInfo2::flags.
--# Modify function `VmaBlockVectorDefragmentationContext::Begin` to create object
-   of your new class whenever needed.
-
-
-\page lost_allocations Lost allocations
-
-If your game oversubscribes video memory, if may work OK in previous-generation
-graphics APIs (DirectX 9, 10, 11, OpenGL) because resources are automatically
-paged to system RAM. In Vulkan you can't do it because when you run out of
-memory, an allocation just fails. If you have more data (e.g. textures) that can
-fit into VRAM and you don't need it all at once, you may want to upload them to
-GPU on demand and "push out" ones that are not used for a long time to make room
-for the new ones, effectively using VRAM (or a cartain memory pool) as a form of
-cache. Vulkan Memory Allocator can help you with that by supporting a concept of
-"lost allocations".
-
-To create an allocation that can become lost, include #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT
-flag in VmaAllocationCreateInfo::flags. Before using a buffer or image bound to
-such allocation in every new frame, you need to query it if it's not lost.
-To check it, call vmaTouchAllocation().
-If the allocation is lost, you should not use it or buffer/image bound to it.
-You mustn't forget to destroy this allocation and this buffer/image.
-vmaGetAllocationInfo() can also be used for checking status of the allocation.
-Allocation is lost when returned VmaAllocationInfo::deviceMemory == `VK_NULL_HANDLE`.
-
-To create an allocation that can make some other allocations lost to make room
-for it, use #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flag. You will
-usually use both flags #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT and
-#VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT at the same time.
-
-Warning! Current implementation uses quite naive, brute force algorithm,
-which can make allocation calls that use #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT
-flag quite slow. A new, more optimal algorithm and data structure to speed this
-up is planned for the future.
-
-<b>Q: When interleaving creation of new allocations with usage of existing ones,
-how do you make sure that an allocation won't become lost while it's used in the
-current frame?</b>
-
-It is ensured because vmaTouchAllocation() / vmaGetAllocationInfo() not only returns allocation
-status/parameters and checks whether it's not lost, but when it's not, it also
-atomically marks it as used in the current frame, which makes it impossible to
-become lost in that frame. It uses lockless algorithm, so it works fast and
-doesn't involve locking any internal mutex.
-
-<b>Q: What if my allocation may still be in use by the GPU when it's rendering a
-previous frame while I already submit new frame on the CPU?</b>
-
-You can make sure that allocations "touched" by vmaTouchAllocation() / vmaGetAllocationInfo() will not
-become lost for a number of additional frames back from the current one by
-specifying this number as VmaAllocatorCreateInfo::frameInUseCount (for default
-memory pool) and VmaPoolCreateInfo::frameInUseCount (for custom pool).
-
-<b>Q: How do you inform the library when new frame starts?</b>
-
-You need to call function vmaSetCurrentFrameIndex().
-
-Example code:
-
-\code
-struct MyBuffer
-{
-    VkBuffer m_Buf = nullptr;
-    VmaAllocation m_Alloc = nullptr;
-
-    // Called when the buffer is really needed in the current frame.
-    void EnsureBuffer();
-};
-
-void MyBuffer::EnsureBuffer()
-{
-    // Buffer has been created.
-    if(m_Buf != VK_NULL_HANDLE)
-    {
-        // Check if its allocation is not lost + mark it as used in current frame.
-        if(vmaTouchAllocation(allocator, m_Alloc))
-        {
-            // It's all OK - safe to use m_Buf.
-            return;
-        }
-    }
-
-    // Buffer not yet exists or lost - destroy and recreate it.
-
-    vmaDestroyBuffer(allocator, m_Buf, m_Alloc);
-
-    VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-    bufCreateInfo.size = 1024;
-    bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
-
-    VmaAllocationCreateInfo allocCreateInfo = {};
-    allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-    allocCreateInfo.flags = VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT |
-        VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT;
-
-    vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &m_Buf, &m_Alloc, nullptr);
-}
-\endcode
-
-When using lost allocations, you may see some Vulkan validation layer warnings
-about overlapping regions of memory bound to different kinds of buffers and
-images. This is still valid as long as you implement proper handling of lost
-allocations (like in the example above) and don't use them.
-
-You can create an allocation that is already in lost state from the beginning using function
-vmaCreateLostAllocation(). It may be useful if you need a "dummy" allocation that is not null.
-
-You can call function vmaMakePoolAllocationsLost() to set all eligible allocations
-in a specified custom pool to lost state.
-Allocations that have been "touched" in current frame or VmaPoolCreateInfo::frameInUseCount frames back
-cannot become lost.
-
-<b>Q: Can I touch allocation that cannot become lost?</b>
-
-Yes, although it has no visible effect.
-Calls to vmaGetAllocationInfo() and vmaTouchAllocation() update last use frame index
-also for allocations that cannot become lost, but the only way to observe it is to dump
-internal allocator state using vmaBuildStatsString().
-You can use this feature for debugging purposes to explicitly mark allocations that you use
-in current frame and then analyze JSON dump to see for how long each allocation stays unused.
-
-
-\page statistics Statistics
-
-This library contains functions that return information about its internal state,
-especially the amount of memory allocated from Vulkan.
-Please keep in mind that these functions need to traverse all internal data structures
-to gather these information, so they may be quite time-consuming.
-Don't call them too often.
-
-\section statistics_numeric_statistics Numeric statistics
-
-You can query for overall statistics of the allocator using function vmaCalculateStats().
-Information are returned using structure #VmaStats.
-It contains #VmaStatInfo - number of allocated blocks, number of allocations
-(occupied ranges in these blocks), number of unused (free) ranges in these blocks,
-number of bytes used and unused (but still allocated from Vulkan) and other information.
-They are summed across memory heaps, memory types and total for whole allocator.
-
-You can query for statistics of a custom pool using function vmaGetPoolStats().
-Information are returned using structure #VmaPoolStats.
-
-You can query for information about specific allocation using function vmaGetAllocationInfo().
-It fill structure #VmaAllocationInfo.
-
-\section statistics_json_dump JSON dump
-
-You can dump internal state of the allocator to a string in JSON format using function vmaBuildStatsString().
-The result is guaranteed to be correct JSON.
-It uses ANSI encoding.
-Any strings provided by user (see [Allocation names](@ref allocation_names))
-are copied as-is and properly escaped for JSON, so if they use UTF-8, ISO-8859-2 or any other encoding,
-this JSON string can be treated as using this encoding.
-It must be freed using function vmaFreeStatsString().
-
-The format of this JSON string is not part of official documentation of the library,
-but it will not change in backward-incompatible way without increasing library major version number
-and appropriate mention in changelog.
-
-The JSON string contains all the data that can be obtained using vmaCalculateStats().
-It can also contain detailed map of allocated memory blocks and their regions -
-free and occupied by allocations.
-This allows e.g. to visualize the memory or assess fragmentation.
-
-
-\page allocation_annotation Allocation names and user data
-
-\section allocation_user_data Allocation user data
-
-You can annotate allocations with your own information, e.g. for debugging purposes.
-To do that, fill VmaAllocationCreateInfo::pUserData field when creating
-an allocation. It's an opaque `void*` 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.
-
-\code
-VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-// Fill bufferInfo...
-
-MyBufferMetadata* pMetadata = CreateBufferMetadata();
-
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-allocCreateInfo.pUserData = pMetadata;
-
-VkBuffer buffer;
-VmaAllocation allocation;
-vmaCreateBuffer(allocator, &bufferInfo, &allocCreateInfo, &buffer, &allocation, nullptr);
-\endcode
-
-The pointer may be later retrieved as VmaAllocationInfo::pUserData:
-
-\code
-VmaAllocationInfo allocInfo;
-vmaGetAllocationInfo(allocator, allocation, &allocInfo);
-MyBufferMetadata* pMetadata = (MyBufferMetadata*)allocInfo.pUserData;
-\endcode
-
-It can also be changed using function vmaSetAllocationUserData().
-
-Values of (non-zero) allocations' `pUserData` are printed in JSON report created by
-vmaBuildStatsString(), in hexadecimal form.
-
-\section allocation_names Allocation names
-
-There is alternative mode available where `pUserData` pointer is used to point to
-a null-terminated string, giving a name to the allocation. To use this mode,
-set #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT flag in VmaAllocationCreateInfo::flags.
-Then `pUserData` passed as VmaAllocationCreateInfo::pUserData or argument to
-vmaSetAllocationUserData() must be either null or pointer to a null-terminated string.
-The library creates internal copy of the string, so the pointer you pass doesn't need
-to be valid for whole lifetime of the allocation. You can free it after the call.
-
-\code
-VkImageCreateInfo imageInfo = { VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO };
-// Fill imageInfo...
-
-std::string imageName = "Texture: ";
-imageName += fileName;
-
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-allocCreateInfo.flags = VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT;
-allocCreateInfo.pUserData = imageName.c_str();
-
-VkImage image;
-VmaAllocation allocation;
-vmaCreateImage(allocator, &imageInfo, &allocCreateInfo, &image, &allocation, nullptr);
-\endcode
-
-The value of `pUserData` pointer of the allocation will be different than the one
-you passed when setting allocation's name - pointing to a buffer managed
-internally that holds copy of the string.
-
-\code
-VmaAllocationInfo allocInfo;
-vmaGetAllocationInfo(allocator, allocation, &allocInfo);
-const char* imageName = (const char*)allocInfo.pUserData;
-printf("Image name: %s\n", imageName);
-\endcode
-
-That string is also printed in JSON report created by vmaBuildStatsString().
-
-\note Passing string name to VMA allocation doesn't automatically set it to the Vulkan buffer or image created with it.
-You must do it manually using an extension like VK_EXT_debug_utils, which is independent of this library.
-
-
-\page debugging_memory_usage Debugging incorrect memory usage
-
-If you suspect a bug with memory usage, like usage of uninitialized memory or
-memory being overwritten out of bounds of an allocation,
-you can use debug features of this library to verify this.
-
-\section debugging_memory_usage_initialization Memory initialization
-
-If you experience a bug with incorrect and nondeterministic data in your program and you suspect uninitialized memory to be used,
-you can enable automatic memory initialization to verify this.
-To do it, define macro `VMA_DEBUG_INITIALIZE_ALLOCATIONS` to 1.
-
-\code
-#define VMA_DEBUG_INITIALIZE_ALLOCATIONS 1
-#include "vk_mem_alloc.h"
-\endcode
-
-It makes memory of all new allocations initialized to bit pattern `0xDCDCDCDC`.
-Before an allocation is destroyed, its memory is filled with bit pattern `0xEFEFEFEF`.
-Memory is automatically mapped and unmapped if necessary.
-
-If you find these values while debugging your program, good chances are that you incorrectly
-read Vulkan memory that is allocated but not initialized, or already freed, respectively.
-
-Memory initialization works only with memory types that are `HOST_VISIBLE`.
-It works also with dedicated allocations.
-It doesn't work with allocations created with #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag,
-as they cannot be mapped.
-
-\section debugging_memory_usage_margins Margins
-
-By default, allocations are laid out in memory blocks next to each other if possible
-(considering required alignment, `bufferImageGranularity`, and `nonCoherentAtomSize`).
-
-![Allocations without margin](../gfx/Margins_1.png)
-
-Define macro `VMA_DEBUG_MARGIN` to some non-zero value (e.g. 16) to enforce specified
-number of bytes as a margin before and after every allocation.
-
-\code
-#define VMA_DEBUG_MARGIN 16
-#include "vk_mem_alloc.h"
-\endcode
-
-![Allocations with margin](../gfx/Margins_2.png)
-
-If your bug goes away after enabling margins, it means it may be caused by memory
-being overwritten outside of allocation boundaries. It is not 100% certain though.
-Change in application behavior may also be caused by different order and distribution
-of allocations across memory blocks after margins are applied.
-
-The margin is applied also before first and after last allocation in a block.
-It may occur only once between two adjacent allocations.
-
-Margins work with all types of memory.
-
-Margin is applied only to allocations made out of memory blocks and not to dedicated
-allocations, which have their own memory block of specific size.
-It is thus not applied to allocations made using #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT flag
-or those automatically decided to put into dedicated allocations, e.g. due to its
-large size or recommended by VK_KHR_dedicated_allocation extension.
-Margins are also not active in custom pools created with #VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT flag.
-
-Margins appear in [JSON dump](@ref statistics_json_dump) as part of free space.
-
-Note that enabling margins increases memory usage and fragmentation.
-
-\section debugging_memory_usage_corruption_detection Corruption detection
-
-You can additionally define macro `VMA_DEBUG_DETECT_CORRUPTION` to 1 to enable validation
-of contents of the margins.
-
-\code
-#define VMA_DEBUG_MARGIN 16
-#define VMA_DEBUG_DETECT_CORRUPTION 1
-#include "vk_mem_alloc.h"
-\endcode
-
-When this feature is enabled, number of bytes specified as `VMA_DEBUG_MARGIN`
-(it must be multiply of 4) before and after every allocation is filled with a magic number.
-This idea is also know as "canary".
-Memory is automatically mapped and unmapped if necessary.
-
-This number is validated automatically when the allocation is destroyed.
-If it's not equal to the expected value, `VMA_ASSERT()` is executed.
-It clearly means that either CPU or GPU overwritten the memory outside of boundaries of the allocation,
-which indicates a serious bug.
-
-You can also explicitly request checking margins of all allocations in all memory blocks
-that belong to specified memory types by using function vmaCheckCorruption(),
-or in memory blocks that belong to specified custom pool, by using function 
-vmaCheckPoolCorruption().
-
-Margin validation (corruption detection) works only for memory types that are
-`HOST_VISIBLE` and `HOST_COHERENT`.
-
-
-\page record_and_replay Record and replay
-
-\section record_and_replay_introduction Introduction
-
-While using the library, sequence of calls to its functions together with their
-parameters can be recorded to a file and later replayed using standalone player
-application. It can be useful to:
-
-- Test correctness - check if same sequence of calls will not cause crash or
-  failures on a target platform.
-- Gather statistics - see number of allocations, peak memory usage, number of
-  calls etc.
-- Benchmark performance - see how much time it takes to replay the whole
-  sequence.
-
-\section record_and_replay_usage Usage
-
-Recording functionality is disabled by default.
-To enable it, define following macro before every include of this library:
-
-\code
-#define VMA_RECORDING_ENABLED 1
-\endcode
-
-<b>To record sequence of calls to a file:</b> Fill in
-VmaAllocatorCreateInfo::pRecordSettings member while creating #VmaAllocator
-object. File is opened and written during whole lifetime of the allocator.
-
-<b>To replay file:</b> Use VmaReplay - standalone command-line program.
-Precompiled binary can be found in "bin" directory.
-Its source can be found in "src/VmaReplay" directory.
-Its project is generated by Premake.
-Command line syntax is printed when the program is launched without parameters.
-Basic usage:
-
-    VmaReplay.exe MyRecording.csv
-
-<b>Documentation of file format</b> can be found in file: "docs/Recording file format.md".
-It's a human-readable, text file in CSV format (Comma Separated Values).
-
-\section record_and_replay_additional_considerations Additional considerations
-
-- Replaying file that was recorded on a different GPU (with different parameters
-  like `bufferImageGranularity`, `nonCoherentAtomSize`, and especially different
-  set of memory heaps and types) may give different performance and memory usage
-  results, as well as issue some warnings and errors.
-- Current implementation of recording in VMA, as well as VmaReplay application, is
-  coded and tested only on Windows. Inclusion of recording code is driven by
-  `VMA_RECORDING_ENABLED` macro. Support for other platforms should be easy to
-  add. Contributions are welcomed.
-
-
-\page usage_patterns Recommended usage patterns
-
-See also slides from talk:
-[Sawicki, Adam. Advanced Graphics Techniques Tutorial: Memory management in Vulkan and DX12. Game Developers Conference, 2018](https://www.gdcvault.com/play/1025458/Advanced-Graphics-Techniques-Tutorial-New)
-
-
-\section usage_patterns_common_mistakes Common mistakes
-
-<b>Use of CPU_TO_GPU instead of CPU_ONLY memory</b>
-
-#VMA_MEMORY_USAGE_CPU_TO_GPU is recommended only for resources that will be
-mapped and written by the CPU, as well as read directly by the GPU - like some
-buffers or textures updated every frame (dynamic). If you create a staging copy
-of a resource to be written by CPU and then used as a source of transfer to
-another resource placed in the GPU memory, that staging resource should be
-created with #VMA_MEMORY_USAGE_CPU_ONLY. Please read the descriptions of these
-enums carefully for details.
-
-<b>Unnecessary use of custom pools</b>
-
-\ref custom_memory_pools may be useful for special purposes - when you want to
-keep certain type of resources separate e.g. to reserve minimum amount of memory
-for them, limit maximum amount of memory they can occupy, or make some of them
-push out the other through the mechanism of \ref lost_allocations. For most
-resources this is not needed and so it is not recommended to create #VmaPool
-objects and allocations out of them. Allocating from the default pool is sufficient.
-
-\section usage_patterns_simple Simple patterns
-
-\subsection usage_patterns_simple_render_targets Render targets
-
-<b>When:</b>
-Any resources that you frequently write and read on GPU,
-e.g. images used as color attachments (aka "render targets"), depth-stencil attachments,
-images/buffers used as storage image/buffer (aka "Unordered Access View (UAV)").
-
-<b>What to do:</b>
-Create them in video memory that is fastest to access from GPU using
-#VMA_MEMORY_USAGE_GPU_ONLY.
-
-Consider using [VK_KHR_dedicated_allocation](@ref vk_khr_dedicated_allocation) extension
-and/or manually creating them as dedicated allocations using #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT,
-especially if they are large or if you plan to destroy and recreate them e.g. when
-display resolution changes.
-Prefer to create such resources first and all other GPU resources (like textures and vertex buffers) later.
-
-\subsection usage_patterns_simple_immutable_resources Immutable resources
-
-<b>When:</b>
-Any resources that you fill on CPU only once (aka "immutable") or infrequently
-and then read frequently on GPU,
-e.g. textures, vertex and index buffers, constant buffers that don't change often.
-
-<b>What to do:</b>
-Create them in video memory that is fastest to access from GPU using
-#VMA_MEMORY_USAGE_GPU_ONLY.
-
-To initialize content of such resource, create a CPU-side (aka "staging") copy of it
-in system memory - #VMA_MEMORY_USAGE_CPU_ONLY, map it, fill it,
-and submit a transfer from it to the GPU resource.
-You can keep the staging copy if you need it for another upload transfer in the future.
-If you don't, you can destroy it or reuse this buffer for uploading different resource
-after the transfer finishes.
-
-Prefer to create just buffers in system memory rather than images, even for uploading textures.
-Use `vkCmdCopyBufferToImage()`.
-Dont use images with `VK_IMAGE_TILING_LINEAR`.
-
-\subsection usage_patterns_dynamic_resources Dynamic resources
-
-<b>When:</b>
-Any resources that change frequently (aka "dynamic"), e.g. every frame or every draw call,
-written on CPU, read on GPU.
-
-<b>What to do:</b>
-Create them using #VMA_MEMORY_USAGE_CPU_TO_GPU.
-You can map it and write to it directly on CPU, as well as read from it on GPU.
-
-This is a more complex situation. Different solutions are possible,
-and the best one depends on specific GPU type, but you can use this simple approach for the start.
-Prefer to write to such resource sequentially (e.g. using `memcpy`).
-Don't perform random access or any reads from it on CPU, as it may be very slow.
-
-\subsection usage_patterns_readback Readback
-
-<b>When:</b>
-Resources that contain data written by GPU that you want to read back on CPU,
-e.g. results of some computations.
-
-<b>What to do:</b>
-Create them using #VMA_MEMORY_USAGE_GPU_TO_CPU.
-You can write to them directly on GPU, as well as map and read them on CPU.
-
-\section usage_patterns_advanced Advanced patterns
-
-\subsection usage_patterns_integrated_graphics Detecting integrated graphics
-
-You can support integrated graphics (like Intel HD Graphics, AMD APU) better
-by detecting it in Vulkan.
-To do it, call `vkGetPhysicalDeviceProperties()`, inspect
-`VkPhysicalDeviceProperties::deviceType` and look for `VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU`.
-When you find it, you can assume that memory is unified and all memory types are comparably fast
-to access from GPU, regardless of `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`.
-
-You can then sum up sizes of all available memory heaps and treat them as useful for
-your GPU resources, instead of only `DEVICE_LOCAL` ones.
-You can also prefer to create your resources in memory types that are `HOST_VISIBLE` to map them
-directly instead of submitting explicit transfer (see below).
-
-\subsection usage_patterns_direct_vs_transfer Direct access versus transfer
-
-For resources that you frequently write on CPU and read on GPU, many solutions are possible:
-
--# Create one copy in video memory using #VMA_MEMORY_USAGE_GPU_ONLY,
-   second copy in system memory using #VMA_MEMORY_USAGE_CPU_ONLY and submit explicit tranfer each time.
--# Create just single copy using #VMA_MEMORY_USAGE_CPU_TO_GPU, map it and fill it on CPU,
-   read it directly on GPU.
--# Create just single copy using #VMA_MEMORY_USAGE_CPU_ONLY, map it and fill it on CPU,
-   read it directly on GPU.
-
-Which solution is the most efficient depends on your resource and especially on the GPU.
-It is best to measure it and then make the decision.
-Some general recommendations:
-
-- On integrated graphics use (2) or (3) to avoid unnecesary time and memory overhead
-  related to using a second copy and making transfer.
-- For small resources (e.g. constant buffers) use (2).
-  Discrete AMD cards have special 256 MiB pool of video memory that is directly mappable.
-  Even if the resource ends up in system memory, its data may be cached on GPU after first
-  fetch over PCIe bus.
-- For larger resources (e.g. textures), decide between (1) and (2).
-  You may want to differentiate NVIDIA and AMD, e.g. by looking for memory type that is
-  both `DEVICE_LOCAL` and `HOST_VISIBLE`. When you find it, use (2), otherwise use (1).
-
-Similarly, for resources that you frequently write on GPU and read on CPU, multiple
-solutions are possible:
-
--# Create one copy in video memory using #VMA_MEMORY_USAGE_GPU_ONLY,
-   second copy in system memory using #VMA_MEMORY_USAGE_GPU_TO_CPU and submit explicit tranfer each time.
--# Create just single copy using #VMA_MEMORY_USAGE_GPU_TO_CPU, write to it directly on GPU,
-   map it and read it on CPU.
-
-You should take some measurements to decide which option is faster in case of your specific
-resource.
-
-If you don't want to specialize your code for specific types of GPUs, you can still make
-an simple optimization for cases when your resource ends up in mappable memory to use it
-directly in this case instead of creating CPU-side staging copy.
-For details see [Finding out if memory is mappable](@ref memory_mapping_finding_if_memory_mappable).
-
-
-\page configuration Configuration
-
-Please check "CONFIGURATION SECTION" in the code to find macros that you can define
-before each include of this file or change directly in this file to provide
-your own implementation of basic facilities like assert, `min()` and `max()` functions,
-mutex, atomic etc.
-The library uses its own implementation of containers by default, but you can switch to using
-STL containers instead.
-
-For example, define `VMA_ASSERT(expr)` before including the library to provide
-custom implementation of the assertion, compatible with your project.
-By default it is defined to standard C `assert(expr)` in `_DEBUG` configuration
-and empty otherwise.
-
-\section config_Vulkan_functions Pointers to Vulkan functions
-
-There are multiple ways to import pointers to Vulkan functions in the library.
-In the simplest case you don't need to do anything.
-If the compilation or linking of your program or the initialization of the #VmaAllocator
-doesn't work for you, you can try to reconfigure it.
-
-First, the allocator tries to fetch pointers to Vulkan functions linked statically,
-like this:
-
-\code
-m_VulkanFunctions.vkAllocateMemory = (PFN_vkAllocateMemory)vkAllocateMemory;
-\endcode
-
-If you want to disable this feature, set configuration macro: `#define VMA_STATIC_VULKAN_FUNCTIONS 0`.
-
-Second, you can provide the pointers yourself by setting member VmaAllocatorCreateInfo::pVulkanFunctions.
-You can fetch them e.g. using functions `vkGetInstanceProcAddr` and `vkGetDeviceProcAddr` or
-by using a helper library like [volk](https://github.com/zeux/volk).
-
-Third, VMA tries to fetch remaining pointers that are still null by calling
-`vkGetInstanceProcAddr` and `vkGetDeviceProcAddr` on its own.
-If you want to disable this feature, set configuration macro: `#define VMA_DYNAMIC_VULKAN_FUNCTIONS 0`.
-
-Finally, all the function pointers required by the library (considering selected
-Vulkan version and enabled extensions) are checked with `VMA_ASSERT` if they are not null.
-
-
-\section custom_memory_allocator Custom host memory allocator
-
-If you use custom allocator for CPU memory rather than default operator `new`
-and `delete` from C++, you can make this library using your allocator as well
-by filling optional member VmaAllocatorCreateInfo::pAllocationCallbacks. These
-functions will be passed to Vulkan, as well as used by the library itself to
-make any CPU-side allocations.
-
-\section allocation_callbacks Device memory allocation callbacks
-
-The library makes calls to `vkAllocateMemory()` and `vkFreeMemory()` internally.
-You can setup callbacks to be informed about these calls, e.g. for the purpose
-of gathering some statistics. To do it, fill optional member
-VmaAllocatorCreateInfo::pDeviceMemoryCallbacks.
-
-\section heap_memory_limit Device heap memory limit
-
-When device memory of certain heap runs out of free space, new allocations may
-fail (returning error code) or they may succeed, silently pushing some existing
-memory blocks from GPU VRAM to system RAM (which degrades performance). This
-behavior is implementation-dependant - it depends on GPU vendor and graphics
-driver.
-
-On AMD cards it can be controlled while creating Vulkan device object by using
-VK_AMD_memory_overallocation_behavior extension, if available.
-
-Alternatively, if you want to test how your program behaves with limited amount of Vulkan device
-memory available without switching your graphics card to one that really has
-smaller VRAM, you can use a feature of this library intended for this purpose.
-To do it, fill optional member VmaAllocatorCreateInfo::pHeapSizeLimit.
-
-
-
-\page vk_khr_dedicated_allocation VK_KHR_dedicated_allocation
-
-VK_KHR_dedicated_allocation is a Vulkan extension which can be used to improve
-performance on some GPUs. It augments Vulkan API with possibility to query
-driver whether it prefers particular buffer or image to have its own, dedicated
-allocation (separate `VkDeviceMemory` block) for better efficiency - to be able
-to do some internal optimizations.
-
-The extension is supported by this library. It will be used automatically when
-enabled. To enable it:
-
-1 . When creating Vulkan device, check if following 2 device extensions are
-supported (call `vkEnumerateDeviceExtensionProperties()`).
-If yes, enable them (fill `VkDeviceCreateInfo::ppEnabledExtensionNames`).
-
-- VK_KHR_get_memory_requirements2
-- VK_KHR_dedicated_allocation
-
-If you enabled these extensions:
-
-2 . Use #VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT flag when creating
-your #VmaAllocator`to inform the library that you enabled required extensions
-and you want the library to use them.
-
-\code
-allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT;
-
-vmaCreateAllocator(&allocatorInfo, &allocator);
-\endcode
-
-That's all. The extension will be automatically used whenever you create a
-buffer using vmaCreateBuffer() or image using vmaCreateImage().
-
-When using the extension together with Vulkan Validation Layer, you will receive
-warnings like this:
-
-    vkBindBufferMemory(): Binding memory to buffer 0x33 but vkGetBufferMemoryRequirements() has not been called on that buffer.
-
-It is OK, you should just ignore it. It happens because you use function
-`vkGetBufferMemoryRequirements2KHR()` instead of standard
-`vkGetBufferMemoryRequirements()`, while the validation layer seems to be
-unaware of it.
-
-To learn more about this extension, see:
-
-- [VK_KHR_dedicated_allocation in Vulkan specification](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap44.html#VK_KHR_dedicated_allocation)
-- [VK_KHR_dedicated_allocation unofficial manual](http://asawicki.info/articles/VK_KHR_dedicated_allocation.php5)
-
-
-
-\page vk_amd_device_coherent_memory VK_AMD_device_coherent_memory
-
-VK_AMD_device_coherent_memory is a device extension that enables access to
-additional memory types with `VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD` and
-`VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD` flag. It is useful mostly for
-allocation of buffers intended for writing "breadcrumb markers" in between passes
-or draw calls, which in turn are useful for debugging GPU crash/hang/TDR cases.
-
-When the extension is available but has not been enabled, Vulkan physical device
-still exposes those memory types, but their usage is forbidden. VMA automatically
-takes care of that - it returns `VK_ERROR_FEATURE_NOT_PRESENT` when an attempt
-to allocate memory of such type is made.
-
-If you want to use this extension in connection with VMA, follow these steps:
-
-\section vk_amd_device_coherent_memory_initialization Initialization
-
-1) Call `vkEnumerateDeviceExtensionProperties` for the physical device.
-Check if the extension is supported - if returned array of `VkExtensionProperties` contains "VK_AMD_device_coherent_memory".
-
-2) Call `vkGetPhysicalDeviceFeatures2` for the physical device instead of old `vkGetPhysicalDeviceFeatures`.
-Attach additional structure `VkPhysicalDeviceCoherentMemoryFeaturesAMD` to `VkPhysicalDeviceFeatures2::pNext` to be returned.
-Check if the device feature is really supported - check if `VkPhysicalDeviceCoherentMemoryFeaturesAMD::deviceCoherentMemory` is true.
-
-3) While creating device with `vkCreateDevice`, enable this extension - add "VK_AMD_device_coherent_memory"
-to the list passed as `VkDeviceCreateInfo::ppEnabledExtensionNames`.
-
-4) While creating the device, also don't set `VkDeviceCreateInfo::pEnabledFeatures`.
-Fill in `VkPhysicalDeviceFeatures2` structure instead and pass it as `VkDeviceCreateInfo::pNext`.
-Enable this device feature - attach additional structure `VkPhysicalDeviceCoherentMemoryFeaturesAMD` to
-`VkPhysicalDeviceFeatures2::pNext` and set its member `deviceCoherentMemory` to `VK_TRUE`.
-
-5) While creating #VmaAllocator with vmaCreateAllocator() inform VMA that you
-have enabled this extension and feature - add #VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT
-to VmaAllocatorCreateInfo::flags.
-
-\section vk_amd_device_coherent_memory_usage Usage
-
-After following steps described above, you can create VMA allocations and custom pools
-out of the special `DEVICE_COHERENT` and `DEVICE_UNCACHED` memory types on eligible
-devices. There are multiple ways to do it, for example:
-
-- You can request or prefer to allocate out of such memory types by adding
-  `VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD` to VmaAllocationCreateInfo::requiredFlags
-  or VmaAllocationCreateInfo::preferredFlags. Those flags can be freely mixed with
-  other ways of \ref choosing_memory_type, like setting VmaAllocationCreateInfo::usage.
-- If you manually found memory type index to use for this purpose, force allocation
-  from this specific index by setting VmaAllocationCreateInfo::memoryTypeBits `= 1u << index`.
-
-\section vk_amd_device_coherent_memory_more_information More information
-
-To learn more about this extension, see [VK_AMD_device_coherent_memory in Vulkan specification](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap44.html#VK_AMD_device_coherent_memory)
-
-Example use of this extension can be found in the code of the sample and test suite
-accompanying this library.
-
-
-\page enabling_buffer_device_address Enabling buffer device address
-
-Device extension VK_KHR_buffer_device_address
-allow to fetch raw GPU pointer to a buffer and pass it for usage in a shader code.
-It is promoted to core Vulkan 1.2.
-
-If you want to use this feature in connection with VMA, follow these steps:
-
-\section enabling_buffer_device_address_initialization Initialization
-
-1) (For Vulkan version < 1.2) Call `vkEnumerateDeviceExtensionProperties` for the physical device.
-Check if the extension is supported - if returned array of `VkExtensionProperties` contains
-"VK_KHR_buffer_device_address".
-
-2) Call `vkGetPhysicalDeviceFeatures2` for the physical device instead of old `vkGetPhysicalDeviceFeatures`.
-Attach additional structure `VkPhysicalDeviceBufferDeviceAddressFeatures*` to `VkPhysicalDeviceFeatures2::pNext` to be returned.
-Check if the device feature is really supported - check if `VkPhysicalDeviceBufferDeviceAddressFeatures*::bufferDeviceAddress` is true.
-
-3) (For Vulkan version < 1.2) While creating device with `vkCreateDevice`, enable this extension - add
-"VK_KHR_buffer_device_address" to the list passed as `VkDeviceCreateInfo::ppEnabledExtensionNames`.
-
-4) While creating the device, also don't set `VkDeviceCreateInfo::pEnabledFeatures`.
-Fill in `VkPhysicalDeviceFeatures2` structure instead and pass it as `VkDeviceCreateInfo::pNext`.
-Enable this device feature - attach additional structure `VkPhysicalDeviceBufferDeviceAddressFeatures*` to
-`VkPhysicalDeviceFeatures2::pNext` and set its member `bufferDeviceAddress` to `VK_TRUE`.
-
-5) While creating #VmaAllocator with vmaCreateAllocator() inform VMA that you
-have enabled this feature - add #VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT
-to VmaAllocatorCreateInfo::flags.
-
-\section enabling_buffer_device_address_usage Usage
-
-After following steps described above, you can create buffers with `VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT*` using VMA.
-The library automatically adds `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT*` to
-allocated memory blocks wherever it might be needed.
-
-Please note that the library supports only `VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT*`.
-The second part of this functionality related to "capture and replay" is not supported,
-as it is intended for usage in debugging tools like RenderDoc, not in everyday Vulkan usage.
-
-\section enabling_buffer_device_address_more_information More information
-
-To learn more about this extension, see [VK_KHR_buffer_device_address in Vulkan specification](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap46.html#VK_KHR_buffer_device_address)
-
-Example use of this extension can be found in the code of the sample and test suite
-accompanying this library.
-
-\page general_considerations General considerations
-
-\section general_considerations_thread_safety Thread safety
-
-- The library has no global state, so separate #VmaAllocator objects can be used
-  independently.
-  There should be no need to create multiple such objects though - one per `VkDevice` is enough.
-- By default, all calls to functions that take #VmaAllocator as first parameter
-  are safe to call from multiple threads simultaneously because they are
-  synchronized internally when needed.
-- When the allocator is created with #VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT
-  flag, calls to functions that take such #VmaAllocator object must be
-  synchronized externally.
-- Access to a #VmaAllocation object must be externally synchronized. For example,
-  you must not call vmaGetAllocationInfo() and vmaMapMemory() from different
-  threads at the same time if you pass the same #VmaAllocation object to these
-  functions.
-
-\section general_considerations_validation_layer_warnings Validation layer warnings
-
-When using this library, you can meet following types of warnings issued by
-Vulkan validation layer. They don't necessarily indicate a bug, so you may need
-to just ignore them.
-
-- *vkBindBufferMemory(): Binding memory to buffer 0xeb8e4 but vkGetBufferMemoryRequirements() has not been called on that buffer.*
-  - It happens when VK_KHR_dedicated_allocation extension is enabled.
-    `vkGetBufferMemoryRequirements2KHR` function is used instead, while validation layer seems to be unaware of it.
-- *Mapping an image with layout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL can result in undefined behavior if this memory is used by the device. Only GENERAL or PREINITIALIZED should be used.*
-  - It happens when you map a buffer or image, because the library maps entire
-    `VkDeviceMemory` block, where different types of images and buffers may end
-    up together, especially on GPUs with unified memory like Intel.
-- *Non-linear image 0xebc91 is aliased with linear buffer 0xeb8e4 which may indicate a bug.*
-  - It happens when you use lost allocations, and a new image or buffer is
-    created in place of an existing object that bacame lost.
-  - It may happen also when you use [defragmentation](@ref defragmentation).
-
-\section general_considerations_allocation_algorithm Allocation algorithm
-
-The library uses following algorithm for allocation, in order:
-
--# Try to find free range of memory in existing blocks.
--# If failed, try to create a new block of `VkDeviceMemory`, with preferred block size.
--# If failed, try to create such block with size/2, size/4, size/8.
--# If failed and #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flag was
-   specified, try to find space in existing blocks, possilby making some other
-   allocations lost.
--# If failed, try to allocate separate `VkDeviceMemory` for this allocation,
-   just like when you use #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
--# If failed, choose other memory type that meets the requirements specified in
-   VmaAllocationCreateInfo and go to point 1.
--# If failed, return `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
-
-\section general_considerations_features_not_supported Features not supported
-
-Features deliberately excluded from the scope of this library:
-
-- Data transfer. Uploading (straming) and downloading data of buffers and images
-  between CPU and GPU memory and related synchronization is responsibility of the user.
-  Defining some "texture" object that would automatically stream its data from a
-  staging copy in CPU memory to GPU memory would rather be a feature of another,
-  higher-level library implemented on top of VMA.
-- Allocations for imported/exported external memory. They tend to require
-  explicit memory type index and dedicated allocation anyway, so they don't
-  interact with main features of this library. Such special purpose allocations
-  should be made manually, using `vkCreateBuffer()` and `vkAllocateMemory()`.
-- Recreation of buffers and images. Although the library has functions for
-  buffer and image creation (vmaCreateBuffer(), vmaCreateImage()), you need to
-  recreate these objects yourself after defragmentation. That's because the big
-  structures `VkBufferCreateInfo`, `VkImageCreateInfo` are not stored in
-  #VmaAllocation object.
-- Handling CPU memory allocation failures. When dynamically creating small C++
-  objects in CPU memory (not Vulkan memory), allocation failures are not checked
-  and handled gracefully, because that would complicate code significantly and
-  is usually not needed in desktop PC applications anyway.
-- Code free of any compiler warnings. Maintaining the library to compile and
-  work correctly on so many different platforms is hard enough. Being free of 
-  any warnings, on any version of any compiler, is simply not feasible.
-- This is a C++ library with C interface.
-  Bindings or ports to any other programming languages are welcomed as external projects and
-  are not going to be included into this repository.
-
-*/
-
-/*
-Define this macro to 0/1 to disable/enable support for recording functionality,
-available through VmaAllocatorCreateInfo::pRecordSettings.
-*/
-#ifndef VMA_RECORDING_ENABLED
-    #define VMA_RECORDING_ENABLED 0
-#endif
-
-#ifndef NOMINMAX
-    #define NOMINMAX // For windows.h
-#endif
-
-#if defined(__ANDROID__) && defined(VK_NO_PROTOTYPES) && VMA_STATIC_VULKAN_FUNCTIONS
-    extern PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
-    extern PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;
-    extern PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;
-    extern PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;
-    extern PFN_vkAllocateMemory vkAllocateMemory;
-    extern PFN_vkFreeMemory vkFreeMemory;
-    extern PFN_vkMapMemory vkMapMemory;
-    extern PFN_vkUnmapMemory vkUnmapMemory;
-    extern PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;
-    extern PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges;
-    extern PFN_vkBindBufferMemory vkBindBufferMemory;
-    extern PFN_vkBindImageMemory vkBindImageMemory;
-    extern PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;
-    extern PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;
-    extern PFN_vkCreateBuffer vkCreateBuffer;
-    extern PFN_vkDestroyBuffer vkDestroyBuffer;
-    extern PFN_vkCreateImage vkCreateImage;
-    extern PFN_vkDestroyImage vkDestroyImage;
-    extern PFN_vkCmdCopyBuffer vkCmdCopyBuffer;
-    #if VMA_VULKAN_VERSION >= 1001000
-        extern PFN_vkGetBufferMemoryRequirements2 vkGetBufferMemoryRequirements2;
-        extern PFN_vkGetImageMemoryRequirements2 vkGetImageMemoryRequirements2;
-        extern PFN_vkBindBufferMemory2 vkBindBufferMemory2;
-        extern PFN_vkBindImageMemory2 vkBindImageMemory2;
-        extern PFN_vkGetPhysicalDeviceMemoryProperties2 vkGetPhysicalDeviceMemoryProperties2;
-    #endif // #if VMA_VULKAN_VERSION >= 1001000
-#endif // #if defined(__ANDROID__) && VMA_STATIC_VULKAN_FUNCTIONS && VK_NO_PROTOTYPES
-
-#ifndef VULKAN_H_
-    #include <vulkan/vulkan.h>
-#endif
-
-#if VMA_RECORDING_ENABLED
-    #if defined(_WIN32)
-        #include <windows.h>
-    #else
-        #error VMA Recording functionality is not yet available for non-Windows platforms
-    #endif
-#endif
-
-// Define this macro to declare maximum supported Vulkan version in format AAABBBCCC,
-// where AAA = major, BBB = minor, CCC = patch.
-// If you want to use version > 1.0, it still needs to be enabled via VmaAllocatorCreateInfo::vulkanApiVersion.
-#if !defined(VMA_VULKAN_VERSION)
-    #if defined(VK_VERSION_1_2)
-        #define VMA_VULKAN_VERSION 1002000
-    #elif defined(VK_VERSION_1_1)
-        #define VMA_VULKAN_VERSION 1001000
-    #else
-        #define VMA_VULKAN_VERSION 1000000
-    #endif
-#endif
-
-#if !defined(VMA_DEDICATED_ALLOCATION)
-    #if VK_KHR_get_memory_requirements2 && VK_KHR_dedicated_allocation
-        #define VMA_DEDICATED_ALLOCATION 1
-    #else
-        #define VMA_DEDICATED_ALLOCATION 0
-    #endif
-#endif
-
-#if !defined(VMA_BIND_MEMORY2)
-    #if VK_KHR_bind_memory2
-        #define VMA_BIND_MEMORY2 1
-    #else
-        #define VMA_BIND_MEMORY2 0
-    #endif
-#endif
-
-#if !defined(VMA_MEMORY_BUDGET)
-    #if VK_EXT_memory_budget && (VK_KHR_get_physical_device_properties2 || VMA_VULKAN_VERSION >= 1001000)
-        #define VMA_MEMORY_BUDGET 1
-    #else
-        #define VMA_MEMORY_BUDGET 0
-    #endif
-#endif
-
-// Defined to 1 when VK_KHR_buffer_device_address device extension or equivalent core Vulkan 1.2 feature is defined in its headers.
-#if !defined(VMA_BUFFER_DEVICE_ADDRESS)
-    #if VK_KHR_buffer_device_address || VMA_VULKAN_VERSION >= 1002000
-        #define VMA_BUFFER_DEVICE_ADDRESS 1
-    #else
-        #define VMA_BUFFER_DEVICE_ADDRESS 0
-    #endif
-#endif
-
-// Define these macros to decorate all public functions with additional code,
-// before and after returned type, appropriately. This may be useful for
-// exporing the functions when compiling VMA as a separate library. Example:
-// #define VMA_CALL_PRE  __declspec(dllexport)
-// #define VMA_CALL_POST __cdecl
-#ifndef VMA_CALL_PRE
-    #define VMA_CALL_PRE
-#endif
-#ifndef VMA_CALL_POST
-    #define VMA_CALL_POST
-#endif
-
-// Define this macro to decorate pointers with an attribute specifying the
-// length of the array they point to if they are not null.
-//
-// The length may be one of
-// - The name of another parameter in the argument list where the pointer is declared
-// - The name of another member in the struct where the pointer is declared
-// - The name of a member of a struct type, meaning the value of that member in
-//   the context of the call. For example
-//   VMA_LEN_IF_NOT_NULL("VkPhysicalDeviceMemoryProperties::memoryHeapCount"),
-//   this means the number of memory heaps available in the device associated
-//   with the VmaAllocator being dealt with.
-#ifndef VMA_LEN_IF_NOT_NULL
-    #define VMA_LEN_IF_NOT_NULL(len)
-#endif
-
-// The VMA_NULLABLE macro is defined to be _Nullable when compiling with Clang.
-// see: https://clang.llvm.org/docs/AttributeReference.html#nullable
-#ifndef VMA_NULLABLE
-    #ifdef __clang__
-        #define VMA_NULLABLE _Nullable
-    #else
-        #define VMA_NULLABLE
-    #endif
-#endif
-
-// The VMA_NOT_NULL macro is defined to be _Nonnull when compiling with Clang.
-// see: https://clang.llvm.org/docs/AttributeReference.html#nonnull
-#ifndef VMA_NOT_NULL
-    #ifdef __clang__
-        #define VMA_NOT_NULL _Nonnull
-    #else
-        #define VMA_NOT_NULL
-    #endif
-#endif
-
-// If non-dispatchable handles are represented as pointers then we can give
-// then nullability annotations
-#ifndef VMA_NOT_NULL_NON_DISPATCHABLE
-    #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
-        #define VMA_NOT_NULL_NON_DISPATCHABLE VMA_NOT_NULL
-    #else
-        #define VMA_NOT_NULL_NON_DISPATCHABLE
-    #endif
-#endif
-
-#ifndef VMA_NULLABLE_NON_DISPATCHABLE
-    #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
-        #define VMA_NULLABLE_NON_DISPATCHABLE VMA_NULLABLE
-    #else
-        #define VMA_NULLABLE_NON_DISPATCHABLE
-    #endif
-#endif
-
-/** \struct VmaAllocator
-\brief Represents main object of this library initialized.
-
-Fill structure #VmaAllocatorCreateInfo and call function vmaCreateAllocator() to create it.
-Call function vmaDestroyAllocator() to destroy it.
-
-It is recommended to create just one object of this type per `VkDevice` object,
-right after Vulkan is initialized and keep it alive until before Vulkan device is destroyed.
-*/
-VK_DEFINE_HANDLE(VmaAllocator)
-
-/// Callback function called after successful vkAllocateMemory.
-typedef void (VKAPI_PTR *PFN_vmaAllocateDeviceMemoryFunction)(
-    VmaAllocator VMA_NOT_NULL                    allocator,
-    uint32_t                                     memoryType,
-    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,
-    VkDeviceSize                                 size,
-    void* VMA_NULLABLE                           pUserData);
-/// Callback function called before vkFreeMemory.
-typedef void (VKAPI_PTR *PFN_vmaFreeDeviceMemoryFunction)(
-    VmaAllocator VMA_NOT_NULL                    allocator,
-    uint32_t                                     memoryType,
-    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,
-    VkDeviceSize                                 size,
-    void* VMA_NULLABLE                           pUserData);
-
-/** \brief Set of callbacks that the library will call for `vkAllocateMemory` and `vkFreeMemory`.
-
-Provided for informative purpose, e.g. to gather statistics about number of
-allocations or total amount of memory allocated in Vulkan.
-
-Used in VmaAllocatorCreateInfo::pDeviceMemoryCallbacks.
-*/
-typedef struct VmaDeviceMemoryCallbacks {
-    /// Optional, can be null.
-    PFN_vmaAllocateDeviceMemoryFunction VMA_NULLABLE pfnAllocate;
-    /// Optional, can be null.
-    PFN_vmaFreeDeviceMemoryFunction VMA_NULLABLE pfnFree;
-    /// Optional, can be null.
-    void* VMA_NULLABLE pUserData;
-} VmaDeviceMemoryCallbacks;
-
-/// Flags for created #VmaAllocator.
-typedef enum VmaAllocatorCreateFlagBits {
-    /** \brief Allocator and all objects created from it will not be synchronized internally, so you must guarantee they are used from only one thread at a time or synchronized externally by you.
-
-    Using this flag may increase performance because internal mutexes are not used.
-    */
-    VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT = 0x00000001,
-    /** \brief Enables usage of VK_KHR_dedicated_allocation extension.
-
-    The flag works only if VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_0`.
-    When it's `VK_API_VERSION_1_1`, the flag is ignored because the extension has been promoted to Vulkan 1.1.
-
-    Using this extenion will automatically allocate dedicated blocks of memory for
-    some buffers and images instead of suballocating place for them out of bigger
-    memory blocks (as if you explicitly used #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT
-    flag) when it is recommended by the driver. It may improve performance on some
-    GPUs.
-
-    You may set this flag only if you found out that following device extensions are
-    supported, you enabled them while creating Vulkan device passed as
-    VmaAllocatorCreateInfo::device, and you want them to be used internally by this
-    library:
-
-    - VK_KHR_get_memory_requirements2 (device extension)
-    - VK_KHR_dedicated_allocation (device extension)
-
-    When this flag is set, you can experience following warnings reported by Vulkan
-    validation layer. You can ignore them.
-
-    > vkBindBufferMemory(): Binding memory to buffer 0x2d but vkGetBufferMemoryRequirements() has not been called on that buffer.
-    */
-    VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT = 0x00000002,
-    /**
-    Enables usage of VK_KHR_bind_memory2 extension.
-
-    The flag works only if VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_0`.
-    When it's `VK_API_VERSION_1_1`, the flag is ignored because the extension has been promoted to Vulkan 1.1.
-
-    You may set this flag only if you found out that this device extension is supported,
-    you enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,
-    and you want it to be used internally by this library.
-
-    The extension provides functions `vkBindBufferMemory2KHR` and `vkBindImageMemory2KHR`,
-    which allow to pass a chain of `pNext` structures while binding.
-    This flag is required if you use `pNext` parameter in vmaBindBufferMemory2() or vmaBindImageMemory2().
-    */
-    VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT = 0x00000004,
-    /**
-    Enables usage of VK_EXT_memory_budget extension.
-
-    You may set this flag only if you found out that this device extension is supported,
-    you enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,
-    and you want it to be used internally by this library, along with another instance extension
-    VK_KHR_get_physical_device_properties2, which is required by it (or Vulkan 1.1, where this extension is promoted).
-
-    The extension provides query for current memory usage and budget, which will probably
-    be more accurate than an estimation used by the library otherwise.
-    */
-    VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT = 0x00000008,
-    /**
-    Enables usage of VK_AMD_device_coherent_memory extension.
-    
-    You may set this flag only if you:
-
-    - found out that this device extension is supported and enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,
-    - checked that `VkPhysicalDeviceCoherentMemoryFeaturesAMD::deviceCoherentMemory` is true and set it while creating the Vulkan device,
-    - want it to be used internally by this library.
-
-    The extension and accompanying device feature provide access to memory types with
-    `VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD` and `VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD` flags.
-    They are useful mostly for writing breadcrumb markers - a common method for debugging GPU crash/hang/TDR.
-    
-    When the extension is not enabled, such memory types are still enumerated, but their usage is illegal.
-    To protect from this error, if you don't create the allocator with this flag, it will refuse to allocate any memory or create a custom pool in such memory type,
-    returning `VK_ERROR_FEATURE_NOT_PRESENT`.
-    */
-    VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT = 0x00000010,
-    /**
-    Enables usage of "buffer device address" feature, which allows you to use function
-    `vkGetBufferDeviceAddress*` to get raw GPU pointer to a buffer and pass it for usage inside a shader.
-
-    You may set this flag only if you:
-
-    1. (For Vulkan version < 1.2) Found as available and enabled device extension
-    VK_KHR_buffer_device_address.
-    This extension is promoted to core Vulkan 1.2.
-    2. Found as available and enabled device feature `VkPhysicalDeviceBufferDeviceAddressFeatures*::bufferDeviceAddress`.
-
-    When this flag is set, you can create buffers with `VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT*` using VMA.
-    The library automatically adds `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT*` to
-    allocated memory blocks wherever it might be needed.
-
-    For more information, see documentation chapter \ref enabling_buffer_device_address.
-    */
-    VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT = 0x00000020,
-
-    VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
-} VmaAllocatorCreateFlagBits;
-typedef VkFlags VmaAllocatorCreateFlags;
-
-/** \brief Pointers to some Vulkan functions - a subset used by the library.
-
-Used in VmaAllocatorCreateInfo::pVulkanFunctions.
-*/
-typedef struct VmaVulkanFunctions {
-    PFN_vkGetPhysicalDeviceProperties VMA_NULLABLE vkGetPhysicalDeviceProperties;
-    PFN_vkGetPhysicalDeviceMemoryProperties VMA_NULLABLE vkGetPhysicalDeviceMemoryProperties;
-    PFN_vkAllocateMemory VMA_NULLABLE vkAllocateMemory;
-    PFN_vkFreeMemory VMA_NULLABLE vkFreeMemory;
-    PFN_vkMapMemory VMA_NULLABLE vkMapMemory;
-    PFN_vkUnmapMemory VMA_NULLABLE vkUnmapMemory;
-    PFN_vkFlushMappedMemoryRanges VMA_NULLABLE vkFlushMappedMemoryRanges;
-    PFN_vkInvalidateMappedMemoryRanges VMA_NULLABLE vkInvalidateMappedMemoryRanges;
-    PFN_vkBindBufferMemory VMA_NULLABLE vkBindBufferMemory;
-    PFN_vkBindImageMemory VMA_NULLABLE vkBindImageMemory;
-    PFN_vkGetBufferMemoryRequirements VMA_NULLABLE vkGetBufferMemoryRequirements;
-    PFN_vkGetImageMemoryRequirements VMA_NULLABLE vkGetImageMemoryRequirements;
-    PFN_vkCreateBuffer VMA_NULLABLE vkCreateBuffer;
-    PFN_vkDestroyBuffer VMA_NULLABLE vkDestroyBuffer;
-    PFN_vkCreateImage VMA_NULLABLE vkCreateImage;
-    PFN_vkDestroyImage VMA_NULLABLE vkDestroyImage;
-    PFN_vkCmdCopyBuffer VMA_NULLABLE vkCmdCopyBuffer;
-#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
-    PFN_vkGetBufferMemoryRequirements2KHR VMA_NULLABLE vkGetBufferMemoryRequirements2KHR;
-    PFN_vkGetImageMemoryRequirements2KHR VMA_NULLABLE vkGetImageMemoryRequirements2KHR;
-#endif
-#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION >= 1001000
-    PFN_vkBindBufferMemory2KHR VMA_NULLABLE vkBindBufferMemory2KHR;
-    PFN_vkBindImageMemory2KHR VMA_NULLABLE vkBindImageMemory2KHR;
-#endif
-#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION >= 1001000
-    PFN_vkGetPhysicalDeviceMemoryProperties2KHR VMA_NULLABLE vkGetPhysicalDeviceMemoryProperties2KHR;
-#endif
-} VmaVulkanFunctions;
-
-/// Flags to be used in VmaRecordSettings::flags.
-typedef enum VmaRecordFlagBits {
-    /** \brief Enables flush after recording every function call.
-
-    Enable it if you expect your application to crash, which may leave recording file truncated.
-    It may degrade performance though.
-    */
-    VMA_RECORD_FLUSH_AFTER_CALL_BIT = 0x00000001,
-    
-    VMA_RECORD_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
-} VmaRecordFlagBits;
-typedef VkFlags VmaRecordFlags;
-
-/// Parameters for recording calls to VMA functions. To be used in VmaAllocatorCreateInfo::pRecordSettings.
-typedef struct VmaRecordSettings
-{
-    /// Flags for recording. Use #VmaRecordFlagBits enum.
-    VmaRecordFlags flags;
-    /** \brief Path to the file that should be written by the recording.
-
-    Suggested extension: "csv".
-    If the file already exists, it will be overwritten.
-    It will be opened for the whole time #VmaAllocator object is alive.
-    If opening this file fails, creation of the whole allocator object fails.
-    */
-    const char* VMA_NOT_NULL pFilePath;
-} VmaRecordSettings;
-
-/// Description of a Allocator to be created.
-typedef struct VmaAllocatorCreateInfo
-{
-    /// Flags for created allocator. Use #VmaAllocatorCreateFlagBits enum.
-    VmaAllocatorCreateFlags flags;
-    /// Vulkan physical device.
-    /** It must be valid throughout whole lifetime of created allocator. */
-    VkPhysicalDevice VMA_NOT_NULL physicalDevice;
-    /// Vulkan device.
-    /** It must be valid throughout whole lifetime of created allocator. */
-    VkDevice VMA_NOT_NULL device;
-    /// Preferred size of a single `VkDeviceMemory` block to be allocated from large heaps > 1 GiB. Optional.
-    /** Set to 0 to use default, which is currently 256 MiB. */
-    VkDeviceSize preferredLargeHeapBlockSize;
-    /// Custom CPU memory allocation callbacks. Optional.
-    /** Optional, can be null. When specified, will also be used for all CPU-side memory allocations. */
-    const VkAllocationCallbacks* VMA_NULLABLE pAllocationCallbacks;
-    /// Informative callbacks for `vkAllocateMemory`, `vkFreeMemory`. Optional.
-    /** Optional, can be null. */
-    const VmaDeviceMemoryCallbacks* VMA_NULLABLE pDeviceMemoryCallbacks;
-    /** \brief Maximum number of additional frames that are in use at the same time as current frame.
-
-    This value is used only when you make allocations with
-    VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag. Such allocation cannot become
-    lost if allocation.lastUseFrameIndex >= allocator.currentFrameIndex - frameInUseCount.
-
-    For example, if you double-buffer your command buffers, so resources used for
-    rendering in previous frame may still be in use by the GPU at the moment you
-    allocate resources needed for the current frame, set this value to 1.
-
-    If you want to allow any allocations other than used in the current frame to
-    become lost, set this value to 0.
-    */
-    uint32_t frameInUseCount;
-    /** \brief Either null or a pointer to an array of limits on maximum number of bytes that can be allocated out of particular Vulkan memory heap.
-
-    If not NULL, it must be a pointer to an array of
-    `VkPhysicalDeviceMemoryProperties::memoryHeapCount` elements, defining limit on
-    maximum number of bytes that can be allocated out of particular Vulkan memory
-    heap.
-
-    Any of the elements may be equal to `VK_WHOLE_SIZE`, which means no limit on that
-    heap. This is also the default in case of `pHeapSizeLimit` = NULL.
-
-    If there is a limit defined for a heap:
-
-    - If user tries to allocate more memory from that heap using this allocator,
-      the allocation fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
-    - If the limit is smaller than heap size reported in `VkMemoryHeap::size`, the
-      value of this limit will be reported instead when using vmaGetMemoryProperties().
-
-    Warning! Using this feature may not be equivalent to installing a GPU with
-    smaller amount of memory, because graphics driver doesn't necessary fail new
-    allocations with `VK_ERROR_OUT_OF_DEVICE_MEMORY` result when memory capacity is
-    exceeded. It may return success and just silently migrate some device memory
-    blocks to system RAM. This driver behavior can also be controlled using
-    VK_AMD_memory_overallocation_behavior extension.
-    */
-    const VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL("VkPhysicalDeviceMemoryProperties::memoryHeapCount") pHeapSizeLimit;
-
-    /** \brief Pointers to Vulkan functions. Can be null.
-
-    For details see [Pointers to Vulkan functions](@ref config_Vulkan_functions).
-    */
-    const VmaVulkanFunctions* VMA_NULLABLE pVulkanFunctions;
-    /** \brief Parameters for recording of VMA calls. Can be null.
-
-    If not null, it enables recording of calls to VMA functions to a file.
-    If support for recording is not enabled using `VMA_RECORDING_ENABLED` macro,
-    creation of the allocator object fails with `VK_ERROR_FEATURE_NOT_PRESENT`.
-    */
-    const VmaRecordSettings* VMA_NULLABLE pRecordSettings;
-    /** \brief Handle to Vulkan instance object.
-
-    Starting from version 3.0.0 this member is no longer optional, it must be set!
-    */
-    VkInstance VMA_NOT_NULL instance;
-    /** \brief Optional. The highest version of Vulkan that the application is designed to use.
-    
-    It must be a value in the format as created by macro `VK_MAKE_VERSION` or a constant like: `VK_API_VERSION_1_1`, `VK_API_VERSION_1_0`.
-    The patch version number specified is ignored. Only the major and minor versions are considered.
-    It must be less or equal (preferably equal) to value as passed to `vkCreateInstance` as `VkApplicationInfo::apiVersion`.
-    Only versions 1.0 and 1.1 are supported by the current implementation.
-    Leaving it initialized to zero is equivalent to `VK_API_VERSION_1_0`.
-    */
-    uint32_t vulkanApiVersion;
-} VmaAllocatorCreateInfo;
-
-/// Creates Allocator object.
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAllocator(
-    const VmaAllocatorCreateInfo* VMA_NOT_NULL pCreateInfo,
-    VmaAllocator VMA_NULLABLE * VMA_NOT_NULL pAllocator);
-
-/// Destroys allocator object.
-VMA_CALL_PRE void VMA_CALL_POST vmaDestroyAllocator(
-    VmaAllocator VMA_NULLABLE allocator);
-
-/** \brief Information about existing #VmaAllocator object.
-*/
-typedef struct VmaAllocatorInfo
-{
-    /** \brief Handle to Vulkan instance object.
-
-    This is the same value as has been passed through VmaAllocatorCreateInfo::instance.
-    */
-    VkInstance VMA_NOT_NULL instance;
-    /** \brief Handle to Vulkan physical device object.
-
-    This is the same value as has been passed through VmaAllocatorCreateInfo::physicalDevice.
-    */
-    VkPhysicalDevice VMA_NOT_NULL physicalDevice;
-    /** \brief Handle to Vulkan device object.
-
-    This is the same value as has been passed through VmaAllocatorCreateInfo::device.
-    */
-    VkDevice VMA_NOT_NULL device;
-} VmaAllocatorInfo;
-
-/** \brief Returns information about existing #VmaAllocator object - handle to Vulkan device etc.
-
-It might be useful if you want to keep just the #VmaAllocator handle and fetch other required handles to
-`VkPhysicalDevice`, `VkDevice` etc. every time using this function.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocatorInfo(VmaAllocator VMA_NOT_NULL allocator, VmaAllocatorInfo* VMA_NOT_NULL pAllocatorInfo);
-
-/**
-PhysicalDeviceProperties are fetched from physicalDevice by the allocator.
-You can access it here, without fetching it again on your own.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetPhysicalDeviceProperties(
-    VmaAllocator VMA_NOT_NULL allocator,
-    const VkPhysicalDeviceProperties* VMA_NULLABLE * VMA_NOT_NULL ppPhysicalDeviceProperties);
-
-/**
-PhysicalDeviceMemoryProperties are fetched from physicalDevice by the allocator.
-You can access it here, without fetching it again on your own.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryProperties(
-    VmaAllocator VMA_NOT_NULL allocator,
-    const VkPhysicalDeviceMemoryProperties* VMA_NULLABLE * VMA_NOT_NULL ppPhysicalDeviceMemoryProperties);
-
-/**
-\brief Given Memory Type Index, returns Property Flags of this memory type.
-
-This is just a convenience function. Same information can be obtained using
-vmaGetMemoryProperties().
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryTypeProperties(
-    VmaAllocator VMA_NOT_NULL allocator,
-    uint32_t memoryTypeIndex,
-    VkMemoryPropertyFlags* VMA_NOT_NULL pFlags);
-
-/** \brief Sets index of the current frame.
-
-This function must be used if you make allocations with
-#VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT and
-#VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flags to inform the allocator
-when a new frame begins. Allocations queried using vmaGetAllocationInfo() cannot
-become lost in the current frame.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaSetCurrentFrameIndex(
-    VmaAllocator VMA_NOT_NULL allocator,
-    uint32_t frameIndex);
-
-/** \brief Calculated statistics of memory usage in entire allocator.
-*/
-typedef struct VmaStatInfo
-{
-    /// Number of `VkDeviceMemory` Vulkan memory blocks allocated.
-    uint32_t blockCount;
-    /// Number of #VmaAllocation allocation objects allocated.
-    uint32_t allocationCount;
-    /// Number of free ranges of memory between allocations.
-    uint32_t unusedRangeCount;
-    /// Total number of bytes occupied by all allocations.
-    VkDeviceSize usedBytes;
-    /// Total number of bytes occupied by unused ranges.
-    VkDeviceSize unusedBytes;
-    VkDeviceSize allocationSizeMin, allocationSizeAvg, allocationSizeMax;
-    VkDeviceSize unusedRangeSizeMin, unusedRangeSizeAvg, unusedRangeSizeMax;
-} VmaStatInfo;
-
-/// General statistics from current state of Allocator.
-typedef struct VmaStats
-{
-    VmaStatInfo memoryType[VK_MAX_MEMORY_TYPES];
-    VmaStatInfo memoryHeap[VK_MAX_MEMORY_HEAPS];
-    VmaStatInfo total;
-} VmaStats;
-
-/** \brief Retrieves statistics from current state of the Allocator.
-
-This function is called "calculate" not "get" because it has to traverse all
-internal data structures, so it may be quite slow. For faster but more brief statistics
-suitable to be called every frame or every allocation, use vmaGetBudget().
-
-Note that when using allocator from multiple threads, returned information may immediately
-become outdated.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaCalculateStats(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaStats* VMA_NOT_NULL pStats);
-
-/** \brief Statistics of current memory usage and available budget, in bytes, for specific memory heap.
-*/
-typedef struct VmaBudget
-{
-    /** \brief Sum size of all `VkDeviceMemory` blocks allocated from particular heap, in bytes.
-    */
-    VkDeviceSize blockBytes;
-    
-    /** \brief Sum size of all allocations created in particular heap, in bytes.
-    
-    Usually less or equal than `blockBytes`.
-    Difference `blockBytes - allocationBytes` is the amount of memory allocated but unused -
-    available for new allocations or wasted due to fragmentation.
-    
-    It might be greater than `blockBytes` if there are some allocations in lost state, as they account
-    to this value as well.
-    */
-    VkDeviceSize allocationBytes;
-    
-    /** \brief Estimated current memory usage of the program, in bytes.
-    
-    Fetched from system using `VK_EXT_memory_budget` extension if enabled.
-    
-    It might be different than `blockBytes` (usually higher) due to additional implicit objects
-    also occupying the memory, like swapchain, pipelines, descriptor heaps, command buffers, or
-    `VkDeviceMemory` blocks allocated outside of this library, if any.
-    */
-    VkDeviceSize usage;
-    
-    /** \brief Estimated amount of memory available to the program, in bytes.
-    
-    Fetched from system using `VK_EXT_memory_budget` extension if enabled.
-    
-    It might be different (most probably smaller) than `VkMemoryHeap::size[heapIndex]` due to factors
-    external to the program, like other programs also consuming system resources.
-    Difference `budget - usage` is the amount of additional memory that can probably
-    be allocated without problems. Exceeding the budget may result in various problems.
-    */
-    VkDeviceSize budget;
-} VmaBudget;
-
-/** \brief Retrieves information about current memory budget for all memory heaps.
-
-\param[out] pBudget Must point to array with number of elements at least equal to number of memory heaps in physical device used.
-
-This function is called "get" not "calculate" because it is very fast, suitable to be called
-every frame or every allocation. For more detailed statistics use vmaCalculateStats().
-
-Note that when using allocator from multiple threads, returned information may immediately
-become outdated.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetBudget(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaBudget* VMA_NOT_NULL pBudget);
-
-#ifndef VMA_STATS_STRING_ENABLED
-#define VMA_STATS_STRING_ENABLED 1
-#endif
-
-#if VMA_STATS_STRING_ENABLED
-
-/// Builds and returns statistics as string in JSON format.
-/** @param[out] ppStatsString Must be freed using vmaFreeStatsString() function.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaBuildStatsString(
-    VmaAllocator VMA_NOT_NULL allocator,
-    char* VMA_NULLABLE * VMA_NOT_NULL ppStatsString,
-    VkBool32 detailedMap);
-
-VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(
-    VmaAllocator VMA_NOT_NULL allocator,
-    char* VMA_NULLABLE pStatsString);
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-/** \struct VmaPool
-\brief Represents custom memory pool
-
-Fill structure VmaPoolCreateInfo and call function vmaCreatePool() to create it.
-Call function vmaDestroyPool() to destroy it.
-
-For more information see [Custom memory pools](@ref choosing_memory_type_custom_memory_pools).
-*/
-VK_DEFINE_HANDLE(VmaPool)
-
-typedef enum VmaMemoryUsage
-{
-    /** No intended memory usage specified.
-    Use other members of VmaAllocationCreateInfo to specify your requirements.
-    */
-    VMA_MEMORY_USAGE_UNKNOWN = 0,
-    /** Memory will be used on device only, so fast access from the device is preferred.
-    It usually means device-local GPU (video) memory.
-    No need to be mappable on host.
-    It is roughly equivalent of `D3D12_HEAP_TYPE_DEFAULT`.
-
-    Usage:
-    
-    - Resources written and read by device, e.g. images used as attachments.
-    - Resources transferred from host once (immutable) or infrequently and read by
-      device multiple times, e.g. textures to be sampled, vertex buffers, uniform
-      (constant) buffers, and majority of other types of resources used on GPU.
-
-    Allocation may still end up in `HOST_VISIBLE` memory on some implementations.
-    In such case, you are free to map it.
-    You can use #VMA_ALLOCATION_CREATE_MAPPED_BIT with this usage type.
-    */
-    VMA_MEMORY_USAGE_GPU_ONLY = 1,
-    /** Memory will be mappable on host.
-    It usually means CPU (system) memory.
-    Guarantees to be `HOST_VISIBLE` and `HOST_COHERENT`.
-    CPU access is typically uncached. Writes may be write-combined.
-    Resources created in this pool may still be accessible to the device, but access to them can be slow.
-    It is roughly equivalent of `D3D12_HEAP_TYPE_UPLOAD`.
-
-    Usage: Staging copy of resources used as transfer source.
-    */
-    VMA_MEMORY_USAGE_CPU_ONLY = 2,
-    /**
-    Memory that is both mappable on host (guarantees to be `HOST_VISIBLE`) and preferably fast to access by GPU.
-    CPU access is typically uncached. Writes may be write-combined.
-
-    Usage: Resources written frequently by host (dynamic), read by device. E.g. textures, vertex buffers, uniform buffers updated every frame or every draw call.
-    */
-    VMA_MEMORY_USAGE_CPU_TO_GPU = 3,
-    /** Memory mappable on host (guarantees to be `HOST_VISIBLE`) and cached.
-    It is roughly equivalent of `D3D12_HEAP_TYPE_READBACK`.
-
-    Usage:
-
-    - Resources written by device, read by host - results of some computations, e.g. screen capture, average scene luminance for HDR tone mapping.
-    - Any resources read or accessed randomly on host, e.g. CPU-side copy of vertex buffer used as source of transfer, but also used for collision detection.
-    */
-    VMA_MEMORY_USAGE_GPU_TO_CPU = 4,
-    /** CPU memory - memory that is preferably not `DEVICE_LOCAL`, but also not guaranteed to be `HOST_VISIBLE`.
-
-    Usage: Staging copy of resources moved from GPU memory to CPU memory as part
-    of custom paging/residency mechanism, to be moved back to GPU memory when needed.
-    */
-    VMA_MEMORY_USAGE_CPU_COPY = 5,
-    /** Lazily allocated GPU memory having `VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT`.
-    Exists mostly on mobile platforms. Using it on desktop PC or other GPUs with no such memory type present will fail the allocation.
-    
-    Usage: Memory for transient attachment images (color attachments, depth attachments etc.), created with `VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT`.
-
-    Allocations with this usage are always created as dedicated - it implies #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
-    */
-    VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED = 6,
-
-    VMA_MEMORY_USAGE_MAX_ENUM = 0x7FFFFFFF
-} VmaMemoryUsage;
-
-/// Flags to be passed as VmaAllocationCreateInfo::flags.
-typedef enum VmaAllocationCreateFlagBits {
-    /** \brief Set this flag if the allocation should have its own memory block.
-    
-    Use it for special, big resources, like fullscreen images used as attachments.
-   
-    You should not use this flag if VmaAllocationCreateInfo::pool is not null.
-    */
-    VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT = 0x00000001,
-
-    /** \brief Set this flag to only try to allocate from existing `VkDeviceMemory` blocks and never create new such block.
-    
-    If new allocation cannot be placed in any of the existing blocks, allocation
-    fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY` error.
-    
-    You should not use #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT and
-    #VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT at the same time. It makes no sense.
-    
-    If VmaAllocationCreateInfo::pool is not null, this flag is implied and ignored. */
-    VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT = 0x00000002,
-    /** \brief Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.
-    
-    Pointer to mapped memory will be returned through VmaAllocationInfo::pMappedData.
-
-    Is it valid to use this flag for allocation made from memory type that is not
-    `HOST_VISIBLE`. This flag is then ignored and memory is not mapped. This is
-    useful if you need an allocation that is efficient to use on GPU
-    (`DEVICE_LOCAL`) and still want to map it directly if possible on platforms that
-    support it (e.g. Intel GPU).
-
-    You should not use this flag together with #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT.
-    */
-    VMA_ALLOCATION_CREATE_MAPPED_BIT = 0x00000004,
-    /** Allocation created with this flag can become lost as a result of another
-    allocation with #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flag, so you
-    must check it before use.
-
-    To check if allocation is not lost, call vmaGetAllocationInfo() and check if
-    VmaAllocationInfo::deviceMemory is not `VK_NULL_HANDLE`.
-
-    For details about supporting lost allocations, see Lost Allocations
-    chapter of User Guide on Main Page.
-
-    You should not use this flag together with #VMA_ALLOCATION_CREATE_MAPPED_BIT.
-    */
-    VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT = 0x00000008,
-    /** While creating allocation using this flag, other allocations that were
-    created with flag #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT can become lost.
-
-    For details about supporting lost allocations, see Lost Allocations
-    chapter of User Guide on Main Page.
-    */
-    VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT = 0x00000010,
-    /** Set this flag to treat VmaAllocationCreateInfo::pUserData as pointer to a
-    null-terminated string. Instead of copying pointer value, a local copy of the
-    string is made and stored in allocation's `pUserData`. The string is automatically
-    freed together with the allocation. It is also used in vmaBuildStatsString().
-    */
-    VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT = 0x00000020,
-    /** Allocation will be created from upper stack in a double stack pool.
-
-    This flag is only allowed for custom pools created with #VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT flag.
-    */
-    VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT = 0x00000040,
-    /** Create both buffer/image and allocation, but don't bind them together.
-    It is useful when you want to bind yourself to do some more advanced binding, e.g. using some extensions.
-    The flag is meaningful only with functions that bind by default: vmaCreateBuffer(), vmaCreateImage().
-    Otherwise it is ignored.
-    */
-    VMA_ALLOCATION_CREATE_DONT_BIND_BIT = 0x00000080,
-    /** Create allocation only if additional device memory required for it, if any, won't exceed
-    memory budget. Otherwise return `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
-    */
-    VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT = 0x00000100,
-
-    /** Allocation strategy that chooses smallest possible free range for the
-    allocation.
-    */
-    VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT  = 0x00010000,
-    /** Allocation strategy that chooses biggest possible free range for the
-    allocation.
-    */
-    VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT = 0x00020000,
-    /** Allocation strategy that chooses first suitable free range for the
-    allocation.
-
-    "First" doesn't necessarily means the one with smallest offset in memory,
-    but rather the one that is easiest and fastest to find.
-    */
-    VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT = 0x00040000,
-
-    /** Allocation strategy that tries to minimize memory usage.
-    */
-    VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT = VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT,
-    /** Allocation strategy that tries to minimize allocation time.
-    */
-    VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT = VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT,
-    /** Allocation strategy that tries to minimize memory fragmentation.
-    */
-    VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT = VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT,
-
-    /** A bit mask to extract only `STRATEGY` bits from entire set of flags.
-    */
-    VMA_ALLOCATION_CREATE_STRATEGY_MASK =
-        VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT |
-        VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT |
-        VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT,
-
-    VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
-} VmaAllocationCreateFlagBits;
-typedef VkFlags VmaAllocationCreateFlags;
-
-typedef struct VmaAllocationCreateInfo
-{
-    /// Use #VmaAllocationCreateFlagBits enum.
-    VmaAllocationCreateFlags flags;
-    /** \brief Intended usage of memory.
-    
-    You can leave #VMA_MEMORY_USAGE_UNKNOWN if you specify memory requirements in other way. \n
-    If `pool` is not null, this member is ignored.
-    */
-    VmaMemoryUsage usage;
-    /** \brief Flags that must be set in a Memory Type chosen for an allocation.
-    
-    Leave 0 if you specify memory requirements in other way. \n
-    If `pool` is not null, this member is ignored.*/
-    VkMemoryPropertyFlags requiredFlags;
-    /** \brief Flags that preferably should be set in a memory type chosen for an allocation.
-    
-    Set to 0 if no additional flags are prefered. \n
-    If `pool` is not null, this member is ignored. */
-    VkMemoryPropertyFlags preferredFlags;
-    /** \brief Bitmask containing one bit set for every memory type acceptable for this allocation.
-
-    Value 0 is equivalent to `UINT32_MAX` - it means any memory type is accepted if
-    it meets other requirements specified by this structure, with no further
-    restrictions on memory type index. \n
-    If `pool` is not null, this member is ignored.
-    */
-    uint32_t memoryTypeBits;
-    /** \brief Pool that this allocation should be created in.
-
-    Leave `VK_NULL_HANDLE` to allocate from default pool. If not null, members:
-    `usage`, `requiredFlags`, `preferredFlags`, `memoryTypeBits` are ignored.
-    */
-    VmaPool VMA_NULLABLE pool;
-    /** \brief Custom general-purpose pointer that will be stored in #VmaAllocation, can be read as VmaAllocationInfo::pUserData and changed using vmaSetAllocationUserData().
-    
-    If #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT is used, it must be either
-    null or pointer to a null-terminated string. The string will be then copied to
-    internal buffer, so it doesn't need to be valid after allocation call.
-    */
-    void* VMA_NULLABLE pUserData;
-} VmaAllocationCreateInfo;
-
-/**
-\brief Helps to find memoryTypeIndex, given memoryTypeBits and VmaAllocationCreateInfo.
-
-This algorithm tries to find a memory type that:
-
-- Is allowed by memoryTypeBits.
-- Contains all the flags from pAllocationCreateInfo->requiredFlags.
-- Matches intended usage.
-- Has as many flags from pAllocationCreateInfo->preferredFlags as possible.
-
-\return Returns VK_ERROR_FEATURE_NOT_PRESENT if not found. Receiving such result
-from this function or any other allocating function probably means that your
-device doesn't support any memory type with requested features for the specific
-type of resource you want to use it for. Please check parameters of your
-resource, like image layout (OPTIMAL versus LINEAR) or mip level count.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndex(
-    VmaAllocator VMA_NOT_NULL allocator,
-    uint32_t memoryTypeBits,
-    const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,
-    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);
-
-/**
-\brief Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.
-
-It can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex.
-It internally creates a temporary, dummy buffer that never has memory bound.
-It is just a convenience function, equivalent to calling:
-
-- `vkCreateBuffer`
-- `vkGetBufferMemoryRequirements`
-- `vmaFindMemoryTypeIndex`
-- `vkDestroyBuffer`
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForBufferInfo(
-    VmaAllocator VMA_NOT_NULL allocator,
-    const VkBufferCreateInfo* VMA_NOT_NULL pBufferCreateInfo,
-    const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,
-    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);
-
-/**
-\brief Helps to find memoryTypeIndex, given VkImageCreateInfo and VmaAllocationCreateInfo.
-
-It can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex.
-It internally creates a temporary, dummy image that never has memory bound.
-It is just a convenience function, equivalent to calling:
-
-- `vkCreateImage`
-- `vkGetImageMemoryRequirements`
-- `vmaFindMemoryTypeIndex`
-- `vkDestroyImage`
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForImageInfo(
-    VmaAllocator VMA_NOT_NULL allocator,
-    const VkImageCreateInfo* VMA_NOT_NULL pImageCreateInfo,
-    const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,
-    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);
-
-/// Flags to be passed as VmaPoolCreateInfo::flags.
-typedef enum VmaPoolCreateFlagBits {
-    /** \brief Use this flag if you always allocate only buffers and linear images or only optimal images out of this pool and so Buffer-Image Granularity can be ignored.
-
-    This is an optional optimization flag.
-
-    If you always allocate using vmaCreateBuffer(), vmaCreateImage(),
-    vmaAllocateMemoryForBuffer(), then you don't need to use it because allocator
-    knows exact type of your allocations so it can handle Buffer-Image Granularity
-    in the optimal way.
-
-    If you also allocate using vmaAllocateMemoryForImage() or vmaAllocateMemory(),
-    exact type of such allocations is not known, so allocator must be conservative
-    in handling Buffer-Image Granularity, which can lead to suboptimal allocation
-    (wasted memory). In that case, if you can make sure you always allocate only
-    buffers and linear images or only optimal images out of this pool, use this flag
-    to make allocator disregard Buffer-Image Granularity and so make allocations
-    faster and more optimal.
-    */
-    VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT = 0x00000002,
-
-    /** \brief Enables alternative, linear allocation algorithm in this pool.
-
-    Specify this flag to enable linear allocation algorithm, which always creates
-    new allocations after last one and doesn't reuse space from allocations freed in
-    between. It trades memory consumption for simplified algorithm and data
-    structure, which has better performance and uses less memory for metadata.
-
-    By using this flag, you can achieve behavior of free-at-once, stack,
-    ring buffer, and double stack. For details, see documentation chapter
-    \ref linear_algorithm.
-
-    When using this flag, you must specify VmaPoolCreateInfo::maxBlockCount == 1 (or 0 for default).
-
-    For more details, see [Linear allocation algorithm](@ref linear_algorithm).
-    */
-    VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT = 0x00000004,
-
-    /** \brief Enables alternative, buddy allocation algorithm in this pool.
-
-    It operates on a tree of blocks, each having size that is a power of two and
-    a half of its parent's size. Comparing to default algorithm, this one provides
-    faster allocation and deallocation and decreased external fragmentation,
-    at the expense of more memory wasted (internal fragmentation).
-
-    For more details, see [Buddy allocation algorithm](@ref buddy_algorithm).
-    */
-    VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT = 0x00000008,
-
-    /** Bit mask to extract only `ALGORITHM` bits from entire set of flags.
-    */
-    VMA_POOL_CREATE_ALGORITHM_MASK =
-        VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT |
-        VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT,
-
-    VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
-} VmaPoolCreateFlagBits;
-typedef VkFlags VmaPoolCreateFlags;
-
-/** \brief Describes parameter of created #VmaPool.
-*/
-typedef struct VmaPoolCreateInfo {
-    /** \brief Vulkan memory type index to allocate this pool from.
-    */
-    uint32_t memoryTypeIndex;
-    /** \brief Use combination of #VmaPoolCreateFlagBits.
-    */
-    VmaPoolCreateFlags flags;
-    /** \brief Size of a single `VkDeviceMemory` block to be allocated as part of this pool, in bytes. Optional.
-
-    Specify nonzero to set explicit, constant size of memory blocks used by this
-    pool.
-
-    Leave 0 to use default and let the library manage block sizes automatically.
-    Sizes of particular blocks may vary.
-    */
-    VkDeviceSize blockSize;
-    /** \brief Minimum number of blocks to be always allocated in this pool, even if they stay empty.
-
-    Set to 0 to have no preallocated blocks and allow the pool be completely empty.
-    */
-    size_t minBlockCount;
-    /** \brief Maximum number of blocks that can be allocated in this pool. Optional.
-
-    Set to 0 to use default, which is `SIZE_MAX`, which means no limit.
-    
-    Set to same value as VmaPoolCreateInfo::minBlockCount to have fixed amount of memory allocated
-    throughout whole lifetime of this pool.
-    */
-    size_t maxBlockCount;
-    /** \brief Maximum number of additional frames that are in use at the same time as current frame.
-
-    This value is used only when you make allocations with
-    #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag. Such allocation cannot become
-    lost if allocation.lastUseFrameIndex >= allocator.currentFrameIndex - frameInUseCount.
-
-    For example, if you double-buffer your command buffers, so resources used for
-    rendering in previous frame may still be in use by the GPU at the moment you
-    allocate resources needed for the current frame, set this value to 1.
-
-    If you want to allow any allocations other than used in the current frame to
-    become lost, set this value to 0.
-    */
-    uint32_t frameInUseCount;
-} VmaPoolCreateInfo;
-
-/** \brief Describes parameter of existing #VmaPool.
-*/
-typedef struct VmaPoolStats {
-    /** \brief Total amount of `VkDeviceMemory` allocated from Vulkan for this pool, in bytes.
-    */
-    VkDeviceSize size;
-    /** \brief Total number of bytes in the pool not used by any #VmaAllocation.
-    */
-    VkDeviceSize unusedSize;
-    /** \brief Number of #VmaAllocation objects created from this pool that were not destroyed or lost.
-    */
-    size_t allocationCount;
-    /** \brief Number of continuous memory ranges in the pool not used by any #VmaAllocation.
-    */
-    size_t unusedRangeCount;
-    /** \brief Size of the largest continuous free memory region available for new allocation.
-
-    Making a new allocation of that size is not guaranteed to succeed because of
-    possible additional margin required to respect alignment and buffer/image
-    granularity.
-    */
-    VkDeviceSize unusedRangeSizeMax;
-    /** \brief Number of `VkDeviceMemory` blocks allocated for this pool.
-    */
-    size_t blockCount;
-} VmaPoolStats;
-
-/** \brief Allocates Vulkan device memory and creates #VmaPool object.
-
-@param allocator Allocator object.
-@param pCreateInfo Parameters of pool to create.
-@param[out] pPool Handle to created pool.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreatePool(
-	VmaAllocator VMA_NOT_NULL allocator,
-	const VmaPoolCreateInfo* VMA_NOT_NULL pCreateInfo,
-	VmaPool VMA_NULLABLE * VMA_NOT_NULL pPool);
-
-/** \brief Destroys #VmaPool object and frees Vulkan device memory.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaDestroyPool(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaPool VMA_NULLABLE pool);
-
-/** \brief Retrieves statistics of existing #VmaPool object.
-
-@param allocator Allocator object.
-@param pool Pool object.
-@param[out] pPoolStats Statistics of specified pool.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolStats(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaPool VMA_NOT_NULL pool,
-    VmaPoolStats* VMA_NOT_NULL pPoolStats);
-
-/** \brief Marks all allocations in given pool as lost if they are not used in current frame or VmaPoolCreateInfo::frameInUseCount back from now.
-
-@param allocator Allocator object.
-@param pool Pool.
-@param[out] pLostAllocationCount Number of allocations marked as lost. Optional - pass null if you don't need this information.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaMakePoolAllocationsLost(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaPool VMA_NOT_NULL pool,
-    size_t* VMA_NULLABLE pLostAllocationCount);
-
-/** \brief Checks magic number in margins around all allocations in given memory pool in search for corruptions.
-
-Corruption detection is enabled only when `VMA_DEBUG_DETECT_CORRUPTION` macro is defined to nonzero,
-`VMA_DEBUG_MARGIN` is defined to nonzero and the pool is created in memory type that is
-`HOST_VISIBLE` and `HOST_COHERENT`. For more information, see [Corruption detection](@ref debugging_memory_usage_corruption_detection).
-
-Possible return values:
-
-- `VK_ERROR_FEATURE_NOT_PRESENT` - corruption detection is not enabled for specified pool.
-- `VK_SUCCESS` - corruption detection has been performed and succeeded.
-- `VK_ERROR_VALIDATION_FAILED_EXT` - corruption detection has been performed and found memory corruptions around one of the allocations.
-  `VMA_ASSERT` is also fired in that case.
-- Other value: Error returned by Vulkan, e.g. memory mapping failure.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckPoolCorruption(VmaAllocator VMA_NOT_NULL allocator, VmaPool VMA_NOT_NULL pool);
-
-/** \brief Retrieves name of a custom pool.
-
-After the call `ppName` is either null or points to an internally-owned null-terminated string
-containing name of the pool that was previously set. The pointer becomes invalid when the pool is
-destroyed or its name is changed using vmaSetPoolName().
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolName(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaPool VMA_NOT_NULL pool,
-    const char* VMA_NULLABLE * VMA_NOT_NULL ppName);
-
-/** \brief Sets name of a custom pool.
-
-`pName` can be either null or pointer to a null-terminated string with new name for the pool.
-Function makes internal copy of the string, so it can be changed or freed immediately after this call.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaSetPoolName(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaPool VMA_NOT_NULL pool,
-    const char* VMA_NULLABLE pName);
-
-/** \struct VmaAllocation
-\brief Represents single memory allocation.
-
-It may be either dedicated block of `VkDeviceMemory` or a specific region of a bigger block of this type
-plus unique offset.
-
-There are multiple ways to create such object.
-You need to fill structure VmaAllocationCreateInfo.
-For more information see [Choosing memory type](@ref choosing_memory_type).
-
-Although the library provides convenience functions that create Vulkan buffer or image,
-allocate memory for it and bind them together,
-binding of the allocation to a buffer or an image is out of scope of the allocation itself.
-Allocation object can exist without buffer/image bound,
-binding can be done manually by the user, and destruction of it can be done
-independently of destruction of the allocation.
-
-The object also remembers its size and some other information.
-To retrieve this information, use function vmaGetAllocationInfo() and inspect
-returned structure VmaAllocationInfo.
-
-Some kinds allocations can be in lost state.
-For more information, see [Lost allocations](@ref lost_allocations).
-*/
-VK_DEFINE_HANDLE(VmaAllocation)
-
-/** \brief Parameters of #VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
-*/
-typedef struct VmaAllocationInfo {
-    /** \brief Memory type index that this allocation was allocated from.
-    
-    It never changes.
-    */
-    uint32_t memoryType;
-    /** \brief Handle to Vulkan memory object.
-
-    Same memory object can be shared by multiple allocations.
-    
-    It can change after call to vmaDefragment() if this allocation is passed to the function, or if allocation is lost.
-
-    If the allocation is lost, it is equal to `VK_NULL_HANDLE`.
-    */
-    VkDeviceMemory VMA_NULLABLE_NON_DISPATCHABLE deviceMemory;
-    /** \brief Offset into deviceMemory object to the beginning of this allocation, in bytes. (deviceMemory, offset) pair is unique to this allocation.
-
-    It can change after call to vmaDefragment() if this allocation is passed to the function, or if allocation is lost.
-    */
-    VkDeviceSize offset;
-    /** \brief Size of this allocation, in bytes.
-
-    It never changes, unless allocation is lost.
-    */
-    VkDeviceSize size;
-    /** \brief Pointer to the beginning of this allocation as mapped data.
-
-    If the allocation hasn't been mapped using vmaMapMemory() and hasn't been
-    created with #VMA_ALLOCATION_CREATE_MAPPED_BIT flag, this value is null.
-
-    It can change after call to vmaMapMemory(), vmaUnmapMemory().
-    It can also change after call to vmaDefragment() if this allocation is passed to the function.
-    */
-    void* VMA_NULLABLE pMappedData;
-    /** \brief Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vmaSetAllocationUserData().
-
-    It can change after call to vmaSetAllocationUserData() for this allocation.
-    */
-    void* VMA_NULLABLE pUserData;
-} VmaAllocationInfo;
-
-/** \brief General purpose memory allocation.
-
-@param[out] pAllocation Handle to allocated memory.
-@param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().
-
-You should free the memory using vmaFreeMemory() or vmaFreeMemoryPages().
-
-It is recommended to use vmaAllocateMemoryForBuffer(), vmaAllocateMemoryForImage(),
-vmaCreateBuffer(), vmaCreateImage() instead whenever possible.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemory(
-    VmaAllocator VMA_NOT_NULL allocator,
-    const VkMemoryRequirements* VMA_NOT_NULL pVkMemoryRequirements,
-    const VmaAllocationCreateInfo* VMA_NOT_NULL pCreateInfo,
-    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,
-    VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);
-
-/** \brief General purpose memory allocation for multiple allocation objects at once.
-
-@param allocator Allocator object.
-@param pVkMemoryRequirements Memory requirements for each allocation.
-@param pCreateInfo Creation parameters for each alloction.
-@param allocationCount Number of allocations to make.
-@param[out] pAllocations Pointer to array that will be filled with handles to created allocations.
-@param[out] pAllocationInfo Optional. Pointer to array that will be filled with parameters of created allocations.
-
-You should free the memory using vmaFreeMemory() or vmaFreeMemoryPages().
-
-Word "pages" is just a suggestion to use this function to allocate pieces of memory needed for sparse binding.
-It is just a general purpose allocation function able to make multiple allocations at once.
-It may be internally optimized to be more efficient than calling vmaAllocateMemory() `allocationCount` times.
-
-All allocations are made using same parameters. All of them are created out of the same memory pool and type.
-If any allocation fails, all allocations already made within this function call are also freed, so that when
-returned result is not `VK_SUCCESS`, `pAllocation` array is always entirely filled with `VK_NULL_HANDLE`.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryPages(
-    VmaAllocator VMA_NOT_NULL allocator,
-    const VkMemoryRequirements* VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pVkMemoryRequirements,
-    const VmaAllocationCreateInfo* VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pCreateInfo,
-    size_t allocationCount,
-    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations,
-    VmaAllocationInfo* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationInfo);
-
-/**
-@param[out] pAllocation Handle to allocated memory.
-@param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().
-
-You should free the memory using vmaFreeMemory().
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForBuffer(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer,
-    const VmaAllocationCreateInfo* VMA_NOT_NULL pCreateInfo,
-    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,
-    VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);
-
-/// Function similar to vmaAllocateMemoryForBuffer().
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForImage(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image,
-    const VmaAllocationCreateInfo* VMA_NOT_NULL pCreateInfo,
-    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,
-    VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);
-
-/** \brief Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(), or vmaAllocateMemoryForImage().
-
-Passing `VK_NULL_HANDLE` as `allocation` is valid. Such function call is just skipped.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemory(
-    VmaAllocator VMA_NOT_NULL allocator,
-    const VmaAllocation VMA_NULLABLE allocation);
-
-/** \brief Frees memory and destroys multiple allocations.
-
-Word "pages" is just a suggestion to use this function to free pieces of memory used for sparse binding.
-It is just a general purpose function to free memory and destroy allocations made using e.g. vmaAllocateMemory(),
-vmaAllocateMemoryPages() and other functions.
-It may be internally optimized to be more efficient than calling vmaFreeMemory() `allocationCount` times.
-
-Allocations in `pAllocations` array can come from any memory pools and types.
-Passing `VK_NULL_HANDLE` as elements of `pAllocations` array is valid. Such entries are just skipped.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemoryPages(
-    VmaAllocator VMA_NOT_NULL allocator,
-    size_t allocationCount,
-    const VmaAllocation VMA_NULLABLE * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations);
-
-/** \brief Deprecated.
-
-\deprecated
-In version 2.2.0 it used to try to change allocation's size without moving or reallocating it.
-In current version it returns `VK_SUCCESS` only if `newSize` equals current allocation's size.
-Otherwise returns `VK_ERROR_OUT_OF_POOL_MEMORY`, indicating that allocation's size could not be changed.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaResizeAllocation(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation,
-    VkDeviceSize newSize);
-
-/** \brief Returns current information about specified allocation and atomically marks it as used in current frame.
-
-Current paramters of given allocation are returned in `pAllocationInfo`.
-
-This function also atomically "touches" allocation - marks it as used in current frame,
-just like vmaTouchAllocation().
-If the allocation is in lost state, `pAllocationInfo->deviceMemory == VK_NULL_HANDLE`.
-
-Although this function uses atomics and doesn't lock any mutex, so it should be quite efficient,
-you can avoid calling it too often.
-
-- You can retrieve same VmaAllocationInfo structure while creating your resource, from function
-  vmaCreateBuffer(), vmaCreateImage(). You can remember it if you are sure parameters don't change
-  (e.g. due to defragmentation or allocation becoming lost).
-- If you just want to check if allocation is not lost, vmaTouchAllocation() will work faster.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocationInfo(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation,
-    VmaAllocationInfo* VMA_NOT_NULL pAllocationInfo);
-
-/** \brief Returns `VK_TRUE` if allocation is not lost and atomically marks it as used in current frame.
-
-If the allocation has been created with #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag,
-this function returns `VK_TRUE` if it's not in lost state, so it can still be used.
-It then also atomically "touches" the allocation - marks it as used in current frame,
-so that you can be sure it won't become lost in current frame or next `frameInUseCount` frames.
-
-If the allocation is in lost state, the function returns `VK_FALSE`.
-Memory of such allocation, as well as buffer or image bound to it, should not be used.
-Lost allocation and the buffer/image still need to be destroyed.
-
-If the allocation has been created without #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag,
-this function always returns `VK_TRUE`.
-*/
-VMA_CALL_PRE VkBool32 VMA_CALL_POST vmaTouchAllocation(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation);
-
-/** \brief Sets pUserData in given allocation to new value.
-
-If the allocation was created with VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT,
-pUserData must be either null, or pointer to a null-terminated string. The function
-makes local copy of the string and sets it as allocation's `pUserData`. String
-passed as pUserData doesn't need to be valid for whole lifetime of the allocation -
-you can free it after this call. String previously pointed by allocation's
-pUserData is freed from memory.
-
-If the flag was not used, the value of pointer `pUserData` is just copied to
-allocation's `pUserData`. It is opaque, so you can use it however you want - e.g.
-as a pointer, ordinal number or some handle to you own data.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaSetAllocationUserData(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation,
-    void* VMA_NULLABLE pUserData);
-
-/** \brief Creates new allocation that is in lost state from the beginning.
-
-It can be useful if you need a dummy, non-null allocation.
-
-You still need to destroy created object using vmaFreeMemory().
-
-Returned allocation is not tied to any specific memory pool or memory type and
-not bound to any image or buffer. It has size = 0. It cannot be turned into
-a real, non-empty allocation.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaCreateLostAllocation(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation);
-
-/** \brief Maps memory represented by given allocation and returns pointer to it.
-
-Maps memory represented by given allocation to make it accessible to CPU code.
-When succeeded, `*ppData` contains pointer to first byte of this memory.
-If the allocation is part of bigger `VkDeviceMemory` block, the pointer is
-correctly offseted to the beginning of region assigned to this particular
-allocation.
-
-Mapping is internally reference-counted and synchronized, so despite raw Vulkan
-function `vkMapMemory()` cannot be used to map same block of `VkDeviceMemory`
-multiple times simultaneously, it is safe to call this function on allocations
-assigned to the same memory block. Actual Vulkan memory will be mapped on first
-mapping and unmapped on last unmapping.
-
-If the function succeeded, you must call vmaUnmapMemory() to unmap the
-allocation when mapping is no longer needed or before freeing the allocation, at
-the latest.
-
-It also safe to call this function multiple times on the same allocation. You
-must call vmaUnmapMemory() same number of times as you called vmaMapMemory().
-
-It is also safe to call this function on allocation created with
-#VMA_ALLOCATION_CREATE_MAPPED_BIT flag. Its memory stays mapped all the time.
-You must still call vmaUnmapMemory() same number of times as you called
-vmaMapMemory(). You must not call vmaUnmapMemory() additional time to free the
-"0-th" mapping made automatically due to #VMA_ALLOCATION_CREATE_MAPPED_BIT flag.
-
-This function fails when used on allocation made in memory type that is not
-`HOST_VISIBLE`.
-
-This function always fails when called for allocation that was created with
-#VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag. Such allocations cannot be
-mapped.
-
-This function doesn't automatically flush or invalidate caches.
-If the allocation is made from a memory types that is not `HOST_COHERENT`,
-you also need to use vmaInvalidateAllocation() / vmaFlushAllocation(), as required by Vulkan specification.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaMapMemory(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation,
-    void* VMA_NULLABLE * VMA_NOT_NULL ppData);
-
-/** \brief Unmaps memory represented by given allocation, mapped previously using vmaMapMemory().
-
-For details, see description of vmaMapMemory().
-
-This function doesn't automatically flush or invalidate caches.
-If the allocation is made from a memory types that is not `HOST_COHERENT`,
-you also need to use vmaInvalidateAllocation() / vmaFlushAllocation(), as required by Vulkan specification.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaUnmapMemory(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation);
-
-/** \brief Flushes memory of given allocation.
-
-Calls `vkFlushMappedMemoryRanges()` for memory associated with given range of given allocation.
-It needs to be called after writing to a mapped memory for memory types that are not `HOST_COHERENT`.
-Unmap operation doesn't do that automatically.
-
-- `offset` must be relative to the beginning of allocation.
-- `size` can be `VK_WHOLE_SIZE`. It means all memory from `offset` the the end of given allocation.
-- `offset` and `size` don't have to be aligned.
-  They are internally rounded down/up to multiply of `nonCoherentAtomSize`.
-- If `size` is 0, this call is ignored.
-- If memory type that the `allocation` belongs to is not `HOST_VISIBLE` or it is `HOST_COHERENT`,
-  this call is ignored.
-
-Warning! `offset` and `size` are relative to the contents of given `allocation`.
-If you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.
-Do not pass allocation's offset as `offset`!!!
-
-This function returns the `VkResult` from `vkFlushMappedMemoryRanges` if it is
-called, otherwise `VK_SUCCESS`.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaFlushAllocation(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation,
-    VkDeviceSize offset,
-    VkDeviceSize size);
-
-/** \brief Invalidates memory of given allocation.
-
-Calls `vkInvalidateMappedMemoryRanges()` for memory associated with given range of given allocation.
-It needs to be called before reading from a mapped memory for memory types that are not `HOST_COHERENT`.
-Map operation doesn't do that automatically.
-
-- `offset` must be relative to the beginning of allocation.
-- `size` can be `VK_WHOLE_SIZE`. It means all memory from `offset` the the end of given allocation.
-- `offset` and `size` don't have to be aligned.
-  They are internally rounded down/up to multiply of `nonCoherentAtomSize`.
-- If `size` is 0, this call is ignored.
-- If memory type that the `allocation` belongs to is not `HOST_VISIBLE` or it is `HOST_COHERENT`,
-  this call is ignored.
-
-Warning! `offset` and `size` are relative to the contents of given `allocation`.
-If you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.
-Do not pass allocation's offset as `offset`!!!
-
-This function returns the `VkResult` from `vkInvalidateMappedMemoryRanges` if
-it is called, otherwise `VK_SUCCESS`.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaInvalidateAllocation(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation,
-    VkDeviceSize offset,
-    VkDeviceSize size);
-
-/** \brief Checks magic number in margins around all allocations in given memory types (in both default and custom pools) in search for corruptions.
-
-@param memoryTypeBits Bit mask, where each bit set means that a memory type with that index should be checked.
-
-Corruption detection is enabled only when `VMA_DEBUG_DETECT_CORRUPTION` macro is defined to nonzero,
-`VMA_DEBUG_MARGIN` is defined to nonzero and only for memory types that are
-`HOST_VISIBLE` and `HOST_COHERENT`. For more information, see [Corruption detection](@ref debugging_memory_usage_corruption_detection).
-
-Possible return values:
-
-- `VK_ERROR_FEATURE_NOT_PRESENT` - corruption detection is not enabled for any of specified memory types.
-- `VK_SUCCESS` - corruption detection has been performed and succeeded.
-- `VK_ERROR_VALIDATION_FAILED_EXT` - corruption detection has been performed and found memory corruptions around one of the allocations.
-  `VMA_ASSERT` is also fired in that case.
-- Other value: Error returned by Vulkan, e.g. memory mapping failure.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckCorruption(VmaAllocator VMA_NOT_NULL allocator, uint32_t memoryTypeBits);
-
-/** \struct VmaDefragmentationContext
-\brief Represents Opaque object that represents started defragmentation process.
-
-Fill structure #VmaDefragmentationInfo2 and call function vmaDefragmentationBegin() to create it.
-Call function vmaDefragmentationEnd() to destroy it.
-*/
-VK_DEFINE_HANDLE(VmaDefragmentationContext)
-
-/// Flags to be used in vmaDefragmentationBegin(). None at the moment. Reserved for future use.
-typedef enum VmaDefragmentationFlagBits {
-    VMA_DEFRAGMENTATION_FLAG_INCREMENTAL = 0x1,
-    VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
-} VmaDefragmentationFlagBits;
-typedef VkFlags VmaDefragmentationFlags;
-
-/** \brief Parameters for defragmentation.
-
-To be used with function vmaDefragmentationBegin().
-*/
-typedef struct VmaDefragmentationInfo2 {
-    /** \brief Reserved for future use. Should be 0.
-    */
-    VmaDefragmentationFlags flags;
-    /** \brief Number of allocations in `pAllocations` array.
-    */
-    uint32_t allocationCount;
-    /** \brief Pointer to array of allocations that can be defragmented.
-
-    The array should have `allocationCount` elements.
-    The array should not contain nulls.
-    Elements in the array should be unique - same allocation cannot occur twice.
-    It is safe to pass allocations that are in the lost state - they are ignored.
-    All allocations not present in this array are considered non-moveable during this defragmentation.
-    */
-    const VmaAllocation VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations;
-    /** \brief Optional, output. Pointer to array that will be filled with information whether the allocation at certain index has been changed during defragmentation.
-
-    The array should have `allocationCount` elements.
-    You can pass null if you are not interested in this information.
-    */
-    VkBool32* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationsChanged;
-    /** \brief Numer of pools in `pPools` array.
-    */
-    uint32_t poolCount;
-    /** \brief Either null or pointer to array of pools to be defragmented.
-
-    All the allocations in the specified pools can be moved during defragmentation
-    and there is no way to check if they were really moved as in `pAllocationsChanged`,
-    so you must query all the allocations in all these pools for new `VkDeviceMemory`
-    and offset using vmaGetAllocationInfo() if you might need to recreate buffers
-    and images bound to them.
-
-    The array should have `poolCount` elements.
-    The array should not contain nulls.
-    Elements in the array should be unique - same pool cannot occur twice.
-
-    Using this array is equivalent to specifying all allocations from the pools in `pAllocations`.
-    It might be more efficient.
-    */
-    const VmaPool VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(poolCount) pPools;
-    /** \brief Maximum total numbers of bytes that can be copied while moving allocations to different places using transfers on CPU side, like `memcpy()`, `memmove()`.
-    
-    `VK_WHOLE_SIZE` means no limit.
-    */
-    VkDeviceSize maxCpuBytesToMove;
-    /** \brief Maximum number of allocations that can be moved to a different place using transfers on CPU side, like `memcpy()`, `memmove()`.
-
-    `UINT32_MAX` means no limit.
-    */
-    uint32_t maxCpuAllocationsToMove;
-    /** \brief Maximum total numbers of bytes that can be copied while moving allocations to different places using transfers on GPU side, posted to `commandBuffer`.
-    
-    `VK_WHOLE_SIZE` means no limit.
-    */
-    VkDeviceSize maxGpuBytesToMove;
-    /** \brief Maximum number of allocations that can be moved to a different place using transfers on GPU side, posted to `commandBuffer`.
-
-    `UINT32_MAX` means no limit.
-    */
-    uint32_t maxGpuAllocationsToMove;
-    /** \brief Optional. Command buffer where GPU copy commands will be posted.
-
-    If not null, it must be a valid command buffer handle that supports Transfer queue type.
-    It must be in the recording state and outside of a render pass instance.
-    You need to submit it and make sure it finished execution before calling vmaDefragmentationEnd().
-
-    Passing null means that only CPU defragmentation will be performed.
-    */
-    VkCommandBuffer VMA_NULLABLE commandBuffer;
-} VmaDefragmentationInfo2;
-
-typedef struct VmaDefragmentationPassMoveInfo {
-    VmaAllocation VMA_NOT_NULL allocation;
-    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory;
-    VkDeviceSize offset;
-} VmaDefragmentationPassMoveInfo;
-
-/** \brief Parameters for incremental defragmentation steps.
-
-To be used with function vmaBeginDefragmentationPass().
-*/
-typedef struct VmaDefragmentationPassInfo {
-    uint32_t moveCount;
-    VmaDefragmentationPassMoveInfo* VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(moveCount) pMoves;
-} VmaDefragmentationPassInfo;
-
-/** \brief Deprecated. Optional configuration parameters to be passed to function vmaDefragment().
-
-\deprecated This is a part of the old interface. It is recommended to use structure #VmaDefragmentationInfo2 and function vmaDefragmentationBegin() instead.
-*/
-typedef struct VmaDefragmentationInfo {
-    /** \brief Maximum total numbers of bytes that can be copied while moving allocations to different places.
-    
-    Default is `VK_WHOLE_SIZE`, which means no limit.
-    */
-    VkDeviceSize maxBytesToMove;
-    /** \brief Maximum number of allocations that can be moved to different place.
-
-    Default is `UINT32_MAX`, which means no limit.
-    */
-    uint32_t maxAllocationsToMove;
-} VmaDefragmentationInfo;
-
-/** \brief Statistics returned by function vmaDefragment(). */
-typedef struct VmaDefragmentationStats {
-    /// Total number of bytes that have been copied while moving allocations to different places.
-    VkDeviceSize bytesMoved;
-    /// Total number of bytes that have been released to the system by freeing empty `VkDeviceMemory` objects.
-    VkDeviceSize bytesFreed;
-    /// Number of allocations that have been moved to different places.
-    uint32_t allocationsMoved;
-    /// Number of empty `VkDeviceMemory` objects that have been released to the system.
-    uint32_t deviceMemoryBlocksFreed;
-} VmaDefragmentationStats;
-
-/** \brief Begins defragmentation process.
-
-@param allocator Allocator object.
-@param pInfo Structure filled with parameters of defragmentation.
-@param[out] pStats Optional. Statistics of defragmentation. You can pass null if you are not interested in this information.
-@param[out] pContext Context object that must be passed to vmaDefragmentationEnd() to finish defragmentation.
-@return `VK_SUCCESS` and `*pContext == null` if defragmentation finished within this function call. `VK_NOT_READY` and `*pContext != null` if defragmentation has been started and you need to call vmaDefragmentationEnd() to finish it. Negative value in case of error.
-
-Use this function instead of old, deprecated vmaDefragment().
-
-Warning! Between the call to vmaDefragmentationBegin() and vmaDefragmentationEnd():
-
-- You should not use any of allocations passed as `pInfo->pAllocations` or
-  any allocations that belong to pools passed as `pInfo->pPools`,
-  including calling vmaGetAllocationInfo(), vmaTouchAllocation(), or access
-  their data.
-- Some mutexes protecting internal data structures may be locked, so trying to
-  make or free any allocations, bind buffers or images, map memory, or launch
-  another simultaneous defragmentation in between may cause stall (when done on
-  another thread) or deadlock (when done on the same thread), unless you are
-  100% sure that defragmented allocations are in different pools.
-- Information returned via `pStats` and `pInfo->pAllocationsChanged` are undefined.
-  They become valid after call to vmaDefragmentationEnd().
-- If `pInfo->commandBuffer` is not null, you must submit that command buffer
-  and make sure it finished execution before calling vmaDefragmentationEnd().
-
-For more information and important limitations regarding defragmentation, see documentation chapter:
-[Defragmentation](@ref defragmentation).
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragmentationBegin(
-    VmaAllocator VMA_NOT_NULL allocator,
-    const VmaDefragmentationInfo2* VMA_NOT_NULL pInfo,
-    VmaDefragmentationStats* VMA_NULLABLE pStats,
-    VmaDefragmentationContext VMA_NULLABLE * VMA_NOT_NULL pContext);
-
-/** \brief Ends defragmentation process.
-
-Use this function to finish defragmentation started by vmaDefragmentationBegin().
-It is safe to pass `context == null`. The function then does nothing.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragmentationEnd(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaDefragmentationContext VMA_NULLABLE context);
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentationPass(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaDefragmentationContext VMA_NULLABLE context,
-    VmaDefragmentationPassInfo* VMA_NOT_NULL pInfo
-);
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentationPass(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaDefragmentationContext VMA_NULLABLE context
-);
-
-/** \brief Deprecated. Compacts memory by moving allocations.
-
-@param pAllocations Array of allocations that can be moved during this compation.
-@param allocationCount Number of elements in pAllocations and pAllocationsChanged arrays.
-@param[out] pAllocationsChanged Array of boolean values that will indicate whether matching allocation in pAllocations array has been moved. This parameter is optional. Pass null if you don't need this information.
-@param pDefragmentationInfo Configuration parameters. Optional - pass null to use default values.
-@param[out] pDefragmentationStats Statistics returned by the function. Optional - pass null if you don't need this information.
-@return `VK_SUCCESS` if completed, negative error code in case of error.
-
-\deprecated This is a part of the old interface. It is recommended to use structure #VmaDefragmentationInfo2 and function vmaDefragmentationBegin() instead.
-
-This function works by moving allocations to different places (different
-`VkDeviceMemory` objects and/or different offsets) in order to optimize memory
-usage. Only allocations that are in `pAllocations` array can be moved. All other
-allocations are considered nonmovable in this call. Basic rules:
-
-- Only allocations made in memory types that have
-  `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` and `VK_MEMORY_PROPERTY_HOST_COHERENT_BIT`
-  flags can be compacted. You may pass other allocations but it makes no sense -
-  these will never be moved.
-- Custom pools created with #VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT or
-  #VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT flag are not defragmented. Allocations
-  passed to this function that come from such pools are ignored.
-- Allocations created with #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT or
-  created as dedicated allocations for any other reason are also ignored.
-- Both allocations made with or without #VMA_ALLOCATION_CREATE_MAPPED_BIT
-  flag can be compacted. If not persistently mapped, memory will be mapped
-  temporarily inside this function if needed.
-- You must not pass same #VmaAllocation object multiple times in `pAllocations` array.
-
-The function also frees empty `VkDeviceMemory` blocks.
-
-Warning: This function may be time-consuming, so you shouldn't call it too often
-(like after every resource creation/destruction).
-You can call it on special occasions (like when reloading a game level or
-when you just destroyed a lot of objects). Calling it every frame may be OK, but
-you should measure that on your platform.
-
-For more information, see [Defragmentation](@ref defragmentation) chapter.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragment(
-    VmaAllocator VMA_NOT_NULL allocator,
-    const VmaAllocation VMA_NOT_NULL * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations,
-    size_t allocationCount,
-    VkBool32* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationsChanged,
-    const VmaDefragmentationInfo* VMA_NULLABLE pDefragmentationInfo,
-    VmaDefragmentationStats* VMA_NULLABLE pDefragmentationStats);
-
-/** \brief Binds buffer to allocation.
-
-Binds specified buffer to region of memory represented by specified allocation.
-Gets `VkDeviceMemory` handle and offset from the allocation.
-If you want to create a buffer, allocate memory for it and bind them together separately,
-you should use this function for binding instead of standard `vkBindBufferMemory()`,
-because it ensures proper synchronization so that when a `VkDeviceMemory` object is used by multiple
-allocations, calls to `vkBind*Memory()` or `vkMapMemory()` won't happen from multiple threads simultaneously
-(which is illegal in Vulkan).
-
-It is recommended to use function vmaCreateBuffer() instead of this one.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation,
-    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer);
-
-/** \brief Binds buffer to allocation with additional parameters.
-
-@param allocationLocalOffset Additional offset to be added while binding, relative to the beginnig of the `allocation`. Normally it should be 0.
-@param pNext A chain of structures to be attached to `VkBindBufferMemoryInfoKHR` structure used internally. Normally it should be null.
-
-This function is similar to vmaBindBufferMemory(), but it provides additional parameters.
-
-If `pNext` is not null, #VmaAllocator object must have been created with #VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT flag
-or with VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_1`. Otherwise the call fails.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory2(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation,
-    VkDeviceSize allocationLocalOffset,
-    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer,
-    const void* VMA_NULLABLE pNext);
-
-/** \brief Binds image to allocation.
-
-Binds specified image to region of memory represented by specified allocation.
-Gets `VkDeviceMemory` handle and offset from the allocation.
-If you want to create an image, allocate memory for it and bind them together separately,
-you should use this function for binding instead of standard `vkBindImageMemory()`,
-because it ensures proper synchronization so that when a `VkDeviceMemory` object is used by multiple
-allocations, calls to `vkBind*Memory()` or `vkMapMemory()` won't happen from multiple threads simultaneously
-(which is illegal in Vulkan).
-
-It is recommended to use function vmaCreateImage() instead of this one.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation,
-    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image);
-
-/** \brief Binds image to allocation with additional parameters.
-
-@param allocationLocalOffset Additional offset to be added while binding, relative to the beginnig of the `allocation`. Normally it should be 0.
-@param pNext A chain of structures to be attached to `VkBindImageMemoryInfoKHR` structure used internally. Normally it should be null.
-
-This function is similar to vmaBindImageMemory(), but it provides additional parameters.
-
-If `pNext` is not null, #VmaAllocator object must have been created with #VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT flag
-or with VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_1`. Otherwise the call fails.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory2(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VmaAllocation VMA_NOT_NULL allocation,
-    VkDeviceSize allocationLocalOffset,
-    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image,
-    const void* VMA_NULLABLE pNext);
-
-/**
-@param[out] pBuffer Buffer that was created.
-@param[out] pAllocation Allocation that was created.
-@param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().
-
-This function automatically:
-
--# Creates buffer.
--# Allocates appropriate memory for it.
--# Binds the buffer with the memory.
-
-If any of these operations fail, buffer and allocation are not created,
-returned value is negative error code, *pBuffer and *pAllocation are null.
-
-If the function succeeded, you must destroy both buffer and allocation when you
-no longer need them using either convenience function vmaDestroyBuffer() or
-separately, using `vkDestroyBuffer()` and vmaFreeMemory().
-
-If VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT flag was used,
-VK_KHR_dedicated_allocation extension is used internally to query driver whether
-it requires or prefers the new buffer to have dedicated allocation. If yes,
-and if dedicated allocation is possible (VmaAllocationCreateInfo::pool is null
-and VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT is not used), it creates dedicated
-allocation for this buffer, just like when using
-VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateBuffer(
-    VmaAllocator VMA_NOT_NULL allocator,
-    const VkBufferCreateInfo* VMA_NOT_NULL pBufferCreateInfo,
-    const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,
-    VkBuffer VMA_NULLABLE_NON_DISPATCHABLE * VMA_NOT_NULL pBuffer,
-    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,
-    VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);
-
-/** \brief Destroys Vulkan buffer and frees allocated memory.
-
-This is just a convenience function equivalent to:
-
-\code
-vkDestroyBuffer(device, buffer, allocationCallbacks);
-vmaFreeMemory(allocator, allocation);
-\endcode
-
-It it safe to pass null as buffer and/or allocation.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaDestroyBuffer(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VkBuffer VMA_NULLABLE_NON_DISPATCHABLE buffer,
-    VmaAllocation VMA_NULLABLE allocation);
-
-/// Function similar to vmaCreateBuffer().
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateImage(
-    VmaAllocator VMA_NOT_NULL allocator,
-    const VkImageCreateInfo* VMA_NOT_NULL pImageCreateInfo,
-    const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,
-    VkImage VMA_NULLABLE_NON_DISPATCHABLE * VMA_NOT_NULL pImage,
-    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,
-    VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);
-
-/** \brief Destroys Vulkan image and frees allocated memory.
-
-This is just a convenience function equivalent to:
-
-\code
-vkDestroyImage(device, image, allocationCallbacks);
-vmaFreeMemory(allocator, allocation);
-\endcode
-
-It it safe to pass null as image and/or allocation.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaDestroyImage(
-    VmaAllocator VMA_NOT_NULL allocator,
-    VkImage VMA_NULLABLE_NON_DISPATCHABLE image,
-    VmaAllocation VMA_NULLABLE allocation);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // AMD_VULKAN_MEMORY_ALLOCATOR_H
-
-// For Visual Studio IntelliSense.
-#if defined(__cplusplus) && defined(__INTELLISENSE__)
-#define VMA_IMPLEMENTATION
-#endif
-
-#ifdef VMA_IMPLEMENTATION
-#undef VMA_IMPLEMENTATION
-
-#include <cstdint>
-#include <cstdlib>
-#include <cstring>
-#include <utility>
-
-/*******************************************************************************
-CONFIGURATION SECTION
-
-Define some of these macros before each #include of this header or change them
-here if you need other then default behavior depending on your environment.
-*/
-
-/*
-Define this macro to 1 to make the library fetch pointers to Vulkan functions
-internally, like:
-
-    vulkanFunctions.vkAllocateMemory = &vkAllocateMemory;
-*/
-#if !defined(VMA_STATIC_VULKAN_FUNCTIONS) && !defined(VK_NO_PROTOTYPES)
-    #define VMA_STATIC_VULKAN_FUNCTIONS 1
-#endif
-
-/*
-Define this macro to 1 to make the library fetch pointers to Vulkan functions
-internally, like:
-
-    vulkanFunctions.vkAllocateMemory = (PFN_vkAllocateMemory)vkGetDeviceProcAddr(m_hDevice, vkAllocateMemory);
-*/
-#if !defined(VMA_DYNAMIC_VULKAN_FUNCTIONS)
-    #define VMA_DYNAMIC_VULKAN_FUNCTIONS 1
-#endif
-
-// Define this macro to 1 to make the library use STL containers instead of its own implementation.
-//#define VMA_USE_STL_CONTAINERS 1
-
-/* Set this macro to 1 to make the library including and using STL containers:
-std::pair, std::vector, std::list, std::unordered_map.
-
-Set it to 0 or undefined to make the library using its own implementation of
-the containers.
-*/
-#if VMA_USE_STL_CONTAINERS
-   #define VMA_USE_STL_VECTOR 1
-   #define VMA_USE_STL_UNORDERED_MAP 1
-   #define VMA_USE_STL_LIST 1
-#endif
-
-#ifndef VMA_USE_STL_SHARED_MUTEX
-    // Compiler conforms to C++17.
-    #if __cplusplus >= 201703L
-        #define VMA_USE_STL_SHARED_MUTEX 1
-    // Visual studio defines __cplusplus properly only when passed additional parameter: /Zc:__cplusplus
-    // Otherwise it's always 199711L, despite shared_mutex works since Visual Studio 2015 Update 2.
-    // See: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
-    #elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023918 && __cplusplus == 199711L && _MSVC_LANG >= 201703L
-        #define VMA_USE_STL_SHARED_MUTEX 1
-    #else
-        #define VMA_USE_STL_SHARED_MUTEX 0
-    #endif
-#endif
-
-/*
-THESE INCLUDES ARE NOT ENABLED BY DEFAULT.
-Library has its own container implementation.
-*/
-#if VMA_USE_STL_VECTOR
-   #include <vector>
-#endif
-
-#if VMA_USE_STL_UNORDERED_MAP
-   #include <unordered_map>
-#endif
-
-#if VMA_USE_STL_LIST
-   #include <list>
-#endif
-
-/*
-Following headers are used in this CONFIGURATION section only, so feel free to
-remove them if not needed.
-*/
-#include <cassert> // for assert
-#include <algorithm> // for min, max
-#include <mutex>
-
-#ifndef VMA_NULL
-   // Value used as null pointer. Define it to e.g.: nullptr, NULL, 0, (void*)0.
-   #define VMA_NULL   nullptr
-#endif
-
-#if defined(__ANDROID_API__) && (__ANDROID_API__ < 16)
-#include <cstdlib>
-void *aligned_alloc(size_t alignment, size_t size)
-{
-    // alignment must be >= sizeof(void*)
-    if(alignment < sizeof(void*))
-    {
-        alignment = sizeof(void*);
-    }
-
-    return memalign(alignment, size);
-}
-#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
-#include <cstdlib>
-void *aligned_alloc(size_t alignment, size_t size)
-{
-    // alignment must be >= sizeof(void*)
-    if(alignment < sizeof(void*))
-    {
-        alignment = sizeof(void*);
-    }
-
-    void *pointer;
-    if(posix_memalign(&pointer, alignment, size) == 0)
-        return pointer;
-    return VMA_NULL;
-}
-#endif
-
-// If your compiler is not compatible with C++11 and definition of
-// aligned_alloc() function is missing, uncommeting following line may help:
-
-//#include <malloc.h>
-
-// Normal assert to check for programmer's errors, especially in Debug configuration.
-#ifndef VMA_ASSERT
-   #ifdef NDEBUG
-       #define VMA_ASSERT(expr)
-   #else
-       #define VMA_ASSERT(expr)         assert(expr)
-   #endif
-#endif
-
-// Assert that will be called very often, like inside data structures e.g. operator[].
-// Making it non-empty can make program slow.
-#ifndef VMA_HEAVY_ASSERT
-   #ifdef NDEBUG
-       #define VMA_HEAVY_ASSERT(expr)
-   #else
-       #define VMA_HEAVY_ASSERT(expr)   //VMA_ASSERT(expr)
-   #endif
-#endif
-
-#ifndef VMA_ALIGN_OF
-   #define VMA_ALIGN_OF(type)       (__alignof(type))
-#endif
-
-#ifndef VMA_SYSTEM_ALIGNED_MALLOC
-   #if defined(_WIN32)
-       #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment)   (_aligned_malloc((size), (alignment)))
-   #else
-       #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment)   (aligned_alloc((alignment), (size) ))
-   #endif
-#endif
-
-#ifndef VMA_SYSTEM_FREE
-   #if defined(_WIN32)
-       #define VMA_SYSTEM_FREE(ptr)   _aligned_free(ptr)
-   #else
-       #define VMA_SYSTEM_FREE(ptr)   free(ptr)
-   #endif
-#endif
-
-#ifndef VMA_MIN
-   #define VMA_MIN(v1, v2)    (std::min((v1), (v2)))
-#endif
-
-#ifndef VMA_MAX
-   #define VMA_MAX(v1, v2)    (std::max((v1), (v2)))
-#endif
-
-#ifndef VMA_SWAP
-   #define VMA_SWAP(v1, v2)   std::swap((v1), (v2))
-#endif
-
-#ifndef VMA_SORT
-   #define VMA_SORT(beg, end, cmp)  std::sort(beg, end, cmp)
-#endif
-
-#ifndef VMA_DEBUG_LOG
-   #define VMA_DEBUG_LOG(format, ...)
-   /*
-   #define VMA_DEBUG_LOG(format, ...) do { \
-       printf(format, __VA_ARGS__); \
-       printf("\n"); \
-   } while(false)
-   */
-#endif
-
-// Define this macro to 1 to enable functions: vmaBuildStatsString, vmaFreeStatsString.
-#if VMA_STATS_STRING_ENABLED
-    static inline void VmaUint32ToStr(char* outStr, size_t strLen, uint32_t num)
-    {
-        snprintf(outStr, strLen, "%u", static_cast<unsigned int>(num));
-    }
-    static inline void VmaUint64ToStr(char* outStr, size_t strLen, uint64_t num)
-    {
-        snprintf(outStr, strLen, "%llu", static_cast<unsigned long long>(num));
-    }
-    static inline void VmaPtrToStr(char* outStr, size_t strLen, const void* ptr)
-    {
-        snprintf(outStr, strLen, "%p", ptr);
-    }
-#endif
-
-#ifndef VMA_MUTEX
-    class VmaMutex
-    {
-    public:
-        void Lock() { m_Mutex.lock(); }
-        void Unlock() { m_Mutex.unlock(); }
-        bool TryLock() { return m_Mutex.try_lock(); }
-    private:
-        std::mutex m_Mutex;
-    };
-    #define VMA_MUTEX VmaMutex
-#endif
-
-// Read-write mutex, where "read" is shared access, "write" is exclusive access.
-#ifndef VMA_RW_MUTEX
-    #if VMA_USE_STL_SHARED_MUTEX
-        // Use std::shared_mutex from C++17.
-        #include <shared_mutex>
-        class VmaRWMutex
-        {
-        public:
-            void LockRead() { m_Mutex.lock_shared(); }
-            void UnlockRead() { m_Mutex.unlock_shared(); }
-            bool TryLockRead() { return m_Mutex.try_lock_shared(); }
-            void LockWrite() { m_Mutex.lock(); }
-            void UnlockWrite() { m_Mutex.unlock(); }
-            bool TryLockWrite() { return m_Mutex.try_lock(); }
-        private:
-            std::shared_mutex m_Mutex;
-        };
-        #define VMA_RW_MUTEX VmaRWMutex
-    #elif defined(_WIN32) && defined(WINVER) && WINVER >= 0x0600
-        // Use SRWLOCK from WinAPI.
-        // Minimum supported client = Windows Vista, server = Windows Server 2008.
-        class VmaRWMutex
-        {
-        public:
-            VmaRWMutex() { InitializeSRWLock(&m_Lock); }
-            void LockRead() { AcquireSRWLockShared(&m_Lock); }
-            void UnlockRead() { ReleaseSRWLockShared(&m_Lock); }
-            bool TryLockRead() { return TryAcquireSRWLockShared(&m_Lock) != FALSE; }
-            void LockWrite() { AcquireSRWLockExclusive(&m_Lock); }
-            void UnlockWrite() { ReleaseSRWLockExclusive(&m_Lock); }
-            bool TryLockWrite() { return TryAcquireSRWLockExclusive(&m_Lock) != FALSE; }
-        private:
-            SRWLOCK m_Lock;
-        };
-        #define VMA_RW_MUTEX VmaRWMutex
-    #else
-        // Less efficient fallback: Use normal mutex.
-        class VmaRWMutex
-        {
-        public:
-            void LockRead() { m_Mutex.Lock(); }
-            void UnlockRead() { m_Mutex.Unlock(); }
-            bool TryLockRead() { return m_Mutex.TryLock(); }
-            void LockWrite() { m_Mutex.Lock(); }
-            void UnlockWrite() { m_Mutex.Unlock(); }
-            bool TryLockWrite() { return m_Mutex.TryLock(); }
-        private:
-            VMA_MUTEX m_Mutex;
-        };
-        #define VMA_RW_MUTEX VmaRWMutex
-    #endif // #if VMA_USE_STL_SHARED_MUTEX
-#endif // #ifndef VMA_RW_MUTEX
-
-/*
-If providing your own implementation, you need to implement a subset of std::atomic.
-*/
-#ifndef VMA_ATOMIC_UINT32
-    #include <atomic>
-    #define VMA_ATOMIC_UINT32 std::atomic<uint32_t>
-#endif
-
-#ifndef VMA_ATOMIC_UINT64
-    #include <atomic>
-    #define VMA_ATOMIC_UINT64 std::atomic<uint64_t>
-#endif
-
-#ifndef VMA_DEBUG_ALWAYS_DEDICATED_MEMORY
-    /**
-    Every allocation will have its own memory block.
-    Define to 1 for debugging purposes only.
-    */
-    #define VMA_DEBUG_ALWAYS_DEDICATED_MEMORY (0)
-#endif
-
-#ifndef VMA_DEBUG_ALIGNMENT
-    /**
-    Minimum alignment of all allocations, in bytes.
-    Set to more than 1 for debugging purposes only. Must be power of two.
-    */
-    #define VMA_DEBUG_ALIGNMENT (1)
-#endif
-
-#ifndef VMA_DEBUG_MARGIN
-    /**
-    Minimum margin before and after every allocation, in bytes.
-    Set nonzero for debugging purposes only.
-    */
-    #define VMA_DEBUG_MARGIN (0)
-#endif
-
-#ifndef VMA_DEBUG_INITIALIZE_ALLOCATIONS
-    /**
-    Define this macro to 1 to automatically fill new allocations and destroyed
-    allocations with some bit pattern.
-    */
-    #define VMA_DEBUG_INITIALIZE_ALLOCATIONS (0)
-#endif
-
-#ifndef VMA_DEBUG_DETECT_CORRUPTION
-    /**
-    Define this macro to 1 together with non-zero value of VMA_DEBUG_MARGIN to
-    enable writing magic value to the margin before and after every allocation and
-    validating it, so that memory corruptions (out-of-bounds writes) are detected.
-    */
-    #define VMA_DEBUG_DETECT_CORRUPTION (0)
-#endif
-
-#ifndef VMA_DEBUG_GLOBAL_MUTEX
-    /**
-    Set this to 1 for debugging purposes only, to enable single mutex protecting all
-    entry calls to the library. Can be useful for debugging multithreading issues.
-    */
-    #define VMA_DEBUG_GLOBAL_MUTEX (0)
-#endif
-
-#ifndef VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY
-    /**
-    Minimum value for VkPhysicalDeviceLimits::bufferImageGranularity.
-    Set to more than 1 for debugging purposes only. Must be power of two.
-    */
-    #define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY (1)
-#endif
-
-#ifndef VMA_SMALL_HEAP_MAX_SIZE
-   /// Maximum size of a memory heap in Vulkan to consider it "small".
-   #define VMA_SMALL_HEAP_MAX_SIZE (1024ull * 1024 * 1024)
-#endif
-
-#ifndef VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE
-   /// Default size of a block allocated as single VkDeviceMemory from a "large" heap.
-   #define VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE (256ull * 1024 * 1024)
-#endif
-
-#ifndef VMA_CLASS_NO_COPY
-    #define VMA_CLASS_NO_COPY(className) \
-        private: \
-            className(const className&) = delete; \
-            className& operator=(const className&) = delete;
-#endif
-
-static const uint32_t VMA_FRAME_INDEX_LOST = UINT32_MAX;
-
-// Decimal 2139416166, float NaN, little-endian binary 66 E6 84 7F.
-static const uint32_t VMA_CORRUPTION_DETECTION_MAGIC_VALUE = 0x7F84E666;
-
-static const uint8_t VMA_ALLOCATION_FILL_PATTERN_CREATED   = 0xDC;
-static const uint8_t VMA_ALLOCATION_FILL_PATTERN_DESTROYED = 0xEF;
-
-/*******************************************************************************
-END OF CONFIGURATION
-*/
-
-// # Copy of some Vulkan definitions so we don't need to check their existence just to handle few constants.
-
-static const uint32_t VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY = 0x00000040;
-static const uint32_t VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY = 0x00000080;
-static const uint32_t VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_COPY = 0x00020000;
-
-static const uint32_t VMA_ALLOCATION_INTERNAL_STRATEGY_MIN_OFFSET = 0x10000000u;
-
-static VkAllocationCallbacks VmaEmptyAllocationCallbacks = {
-    VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL };
-
-// Returns number of bits set to 1 in (v).
-static inline uint32_t VmaCountBitsSet(uint32_t v)
-{
-	uint32_t c = v - ((v >> 1) & 0x55555555);
-	c = ((c >>  2) & 0x33333333) + (c & 0x33333333);
-	c = ((c >>  4) + c) & 0x0F0F0F0F;
-	c = ((c >>  8) + c) & 0x00FF00FF;
-	c = ((c >> 16) + c) & 0x0000FFFF;
-	return c;
-}
-
-// Aligns given value up to nearest multiply of align value. For example: VmaAlignUp(11, 8) = 16.
-// Use types like uint32_t, uint64_t as T.
-template <typename T>
-static inline T VmaAlignUp(T val, T align)
-{
-	return (val + align - 1) / align * align;
-}
-// Aligns given value down to nearest multiply of align value. For example: VmaAlignUp(11, 8) = 8.
-// Use types like uint32_t, uint64_t as T.
-template <typename T>
-static inline T VmaAlignDown(T val, T align)
-{
-    return val / align * align;
-}
-
-// Division with mathematical rounding to nearest number.
-template <typename T>
-static inline T VmaRoundDiv(T x, T y)
-{
-	return (x + (y / (T)2)) / y;
-}
-
-/*
-Returns true if given number is a power of two.
-T must be unsigned integer number or signed integer but always nonnegative.
-For 0 returns true.
-*/
-template <typename T>
-inline bool VmaIsPow2(T x)
-{
-    return (x & (x-1)) == 0;
-}
-
-// Returns smallest power of 2 greater or equal to v.
-static inline uint32_t VmaNextPow2(uint32_t v)
-{
-	v--;
-    v |= v >> 1;
-    v |= v >> 2;
-    v |= v >> 4;
-    v |= v >> 8;
-    v |= v >> 16;
-    v++;
-    return v;
-}
-static inline uint64_t VmaNextPow2(uint64_t v)
-{
-	v--;
-    v |= v >> 1;
-    v |= v >> 2;
-    v |= v >> 4;
-    v |= v >> 8;
-    v |= v >> 16;
-    v |= v >> 32;
-    v++;
-    return v;
-}
-
-// Returns largest power of 2 less or equal to v.
-static inline uint32_t VmaPrevPow2(uint32_t v)
-{
-    v |= v >> 1;
-    v |= v >> 2;
-    v |= v >> 4;
-    v |= v >> 8;
-    v |= v >> 16;
-    v = v ^ (v >> 1);
-    return v;
-}
-static inline uint64_t VmaPrevPow2(uint64_t v)
-{
-    v |= v >> 1;
-    v |= v >> 2;
-    v |= v >> 4;
-    v |= v >> 8;
-    v |= v >> 16;
-    v |= v >> 32;
-    v = v ^ (v >> 1);
-    return v;
-}
-
-static inline bool VmaStrIsEmpty(const char* pStr)
-{
-    return pStr == VMA_NULL || *pStr == '\0';
-}
-
-#if VMA_STATS_STRING_ENABLED
-
-static const char* VmaAlgorithmToStr(uint32_t algorithm)
-{
-    switch(algorithm)
-    {
-    case VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT:
-        return "Linear";
-    case VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT:
-        return "Buddy";
-    case 0:
-        return "Default";
-    default:
-        VMA_ASSERT(0);
-        return "";
-    }
-}
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-#ifndef VMA_SORT
-
-template<typename Iterator, typename Compare>
-Iterator VmaQuickSortPartition(Iterator beg, Iterator end, Compare cmp)
-{
-    Iterator centerValue = end; --centerValue;
-    Iterator insertIndex = beg;
-    for(Iterator memTypeIndex = beg; memTypeIndex < centerValue; ++memTypeIndex)
-    {
-        if(cmp(*memTypeIndex, *centerValue))
-        {
-            if(insertIndex != memTypeIndex)
-            {
-                VMA_SWAP(*memTypeIndex, *insertIndex);
-            }
-            ++insertIndex;
-        }
-    }
-    if(insertIndex != centerValue)
-    {
-        VMA_SWAP(*insertIndex, *centerValue);
-    }
-    return insertIndex;
-}
-
-template<typename Iterator, typename Compare>
-void VmaQuickSort(Iterator beg, Iterator end, Compare cmp)
-{
-    if(beg < end)
-    {
-        Iterator it = VmaQuickSortPartition<Iterator, Compare>(beg, end, cmp);
-        VmaQuickSort<Iterator, Compare>(beg, it, cmp);
-        VmaQuickSort<Iterator, Compare>(it + 1, end, cmp);
-    }
-}
-
-#define VMA_SORT(beg, end, cmp) VmaQuickSort(beg, end, cmp)
-
-#endif // #ifndef VMA_SORT
-
-/*
-Returns true if two memory blocks occupy overlapping pages.
-ResourceA must be in less memory offset than ResourceB.
-
-Algorithm is based on "Vulkan 1.0.39 - A Specification (with all registered Vulkan extensions)"
-chapter 11.6 "Resource Memory Association", paragraph "Buffer-Image Granularity".
-*/
-static inline bool VmaBlocksOnSamePage(
-    VkDeviceSize resourceAOffset,
-    VkDeviceSize resourceASize,
-    VkDeviceSize resourceBOffset,
-    VkDeviceSize pageSize)
-{
-    VMA_ASSERT(resourceAOffset + resourceASize <= resourceBOffset && resourceASize > 0 && pageSize > 0);
-    VkDeviceSize resourceAEnd = resourceAOffset + resourceASize - 1;
-    VkDeviceSize resourceAEndPage = resourceAEnd & ~(pageSize - 1);
-    VkDeviceSize resourceBStart = resourceBOffset;
-    VkDeviceSize resourceBStartPage = resourceBStart & ~(pageSize - 1);
-    return resourceAEndPage == resourceBStartPage;
-}
-
-enum VmaSuballocationType
-{
-    VMA_SUBALLOCATION_TYPE_FREE = 0,
-    VMA_SUBALLOCATION_TYPE_UNKNOWN = 1,
-    VMA_SUBALLOCATION_TYPE_BUFFER = 2,
-    VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN = 3,
-    VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR = 4,
-    VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL = 5,
-    VMA_SUBALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF
-};
-
-/*
-Returns true if given suballocation types could conflict and must respect
-VkPhysicalDeviceLimits::bufferImageGranularity. They conflict if one is buffer
-or linear image and another one is optimal image. If type is unknown, behave
-conservatively.
-*/
-static inline bool VmaIsBufferImageGranularityConflict(
-    VmaSuballocationType suballocType1,
-    VmaSuballocationType suballocType2)
-{
-    if(suballocType1 > suballocType2)
-    {
-        VMA_SWAP(suballocType1, suballocType2);
-    }
-    
-    switch(suballocType1)
-    {
-    case VMA_SUBALLOCATION_TYPE_FREE:
-        return false;
-    case VMA_SUBALLOCATION_TYPE_UNKNOWN:
-        return true;
-    case VMA_SUBALLOCATION_TYPE_BUFFER:
-        return
-            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||
-            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;
-    case VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN:
-        return
-            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||
-            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR ||
-            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;
-    case VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR:
-        return
-            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;
-    case VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL:
-        return false;
-    default:
-        VMA_ASSERT(0);
-        return true;
-    }
-}
-
-static void VmaWriteMagicValue(void* pData, VkDeviceSize offset)
-{
-#if VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_DETECT_CORRUPTION
-    uint32_t* pDst = (uint32_t*)((char*)pData + offset);
-    const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);
-    for(size_t i = 0; i < numberCount; ++i, ++pDst)
-    {
-        *pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;
-    }
-#else
-    // no-op
-#endif
-}
-
-static bool VmaValidateMagicValue(const void* pData, VkDeviceSize offset)
-{
-#if VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_DETECT_CORRUPTION
-    const uint32_t* pSrc = (const uint32_t*)((const char*)pData + offset);
-    const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);
-    for(size_t i = 0; i < numberCount; ++i, ++pSrc)
-    {
-        if(*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE)
-        {
-            return false;
-        }
-    }
-#endif
-    return true;
-}
-
-/*
-Fills structure with parameters of an example buffer to be used for transfers
-during GPU memory defragmentation.
-*/
-static void VmaFillGpuDefragmentationBufferCreateInfo(VkBufferCreateInfo& outBufCreateInfo)
-{
-    memset(&outBufCreateInfo, 0, sizeof(outBufCreateInfo));
-    outBufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
-    outBufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
-    outBufCreateInfo.size = (VkDeviceSize)VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE; // Example size.
-}
-
-// Helper RAII class to lock a mutex in constructor and unlock it in destructor (at the end of scope).
-struct VmaMutexLock
-{
-    VMA_CLASS_NO_COPY(VmaMutexLock)
-public:
-    VmaMutexLock(VMA_MUTEX& mutex, bool useMutex = true) :
-        m_pMutex(useMutex ? &mutex : VMA_NULL)
-    { if(m_pMutex) { m_pMutex->Lock(); } }
-    ~VmaMutexLock()
-    { if(m_pMutex) { m_pMutex->Unlock(); } }
-private:
-    VMA_MUTEX* m_pMutex;
-};
-
-// Helper RAII class to lock a RW mutex in constructor and unlock it in destructor (at the end of scope), for reading.
-struct VmaMutexLockRead
-{
-    VMA_CLASS_NO_COPY(VmaMutexLockRead)
-public:
-    VmaMutexLockRead(VMA_RW_MUTEX& mutex, bool useMutex) :
-        m_pMutex(useMutex ? &mutex : VMA_NULL)
-    { if(m_pMutex) { m_pMutex->LockRead(); } }
-    ~VmaMutexLockRead() { if(m_pMutex) { m_pMutex->UnlockRead(); } }
-private:
-    VMA_RW_MUTEX* m_pMutex;
-};
-
-// Helper RAII class to lock a RW mutex in constructor and unlock it in destructor (at the end of scope), for writing.
-struct VmaMutexLockWrite
-{
-    VMA_CLASS_NO_COPY(VmaMutexLockWrite)
-public:
-    VmaMutexLockWrite(VMA_RW_MUTEX& mutex, bool useMutex) :
-        m_pMutex(useMutex ? &mutex : VMA_NULL)
-    { if(m_pMutex) { m_pMutex->LockWrite(); } }
-    ~VmaMutexLockWrite() { if(m_pMutex) { m_pMutex->UnlockWrite(); } }
-private:
-    VMA_RW_MUTEX* m_pMutex;
-};
-
-#if VMA_DEBUG_GLOBAL_MUTEX
-    static VMA_MUTEX gDebugGlobalMutex;
-    #define VMA_DEBUG_GLOBAL_MUTEX_LOCK VmaMutexLock debugGlobalMutexLock(gDebugGlobalMutex, true);
-#else
-    #define VMA_DEBUG_GLOBAL_MUTEX_LOCK
-#endif
-
-// Minimum size of a free suballocation to register it in the free suballocation collection.
-static const VkDeviceSize VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER = 16;
-
-/*
-Performs binary search and returns iterator to first element that is greater or
-equal to (key), according to comparison (cmp).
-
-Cmp should return true if first argument is less than second argument.
-
-Returned value is the found element, if present in the collection or place where
-new element with value (key) should be inserted.
-*/
-template <typename CmpLess, typename IterT, typename KeyT>
-static IterT VmaBinaryFindFirstNotLess(IterT beg, IterT end, const KeyT &key, const CmpLess& cmp)
-{
-    size_t down = 0, up = (end - beg);
-    while(down < up)
-    {
-        const size_t mid = (down + up) / 2;
-        if(cmp(*(beg+mid), key))
-        {
-            down = mid + 1;
-        }
-        else
-        {
-            up = mid;
-        }
-    }
-    return beg + down;
-}
-
-template<typename CmpLess, typename IterT, typename KeyT>
-IterT VmaBinaryFindSorted(const IterT& beg, const IterT& end, const KeyT& value, const CmpLess& cmp)
-{
-    IterT it = VmaBinaryFindFirstNotLess<CmpLess, IterT, KeyT>(
-        beg, end, value, cmp);
-    if(it == end ||
-        (!cmp(*it, value) && !cmp(value, *it)))
-    {
-        return it;
-    }
-    return end;
-}
-
-/*
-Returns true if all pointers in the array are not-null and unique.
-Warning! O(n^2) complexity. Use only inside VMA_HEAVY_ASSERT.
-T must be pointer type, e.g. VmaAllocation, VmaPool.
-*/
-template<typename T>
-static bool VmaValidatePointerArray(uint32_t count, const T* arr)
-{
-    for(uint32_t i = 0; i < count; ++i)
-    {
-        const T iPtr = arr[i];
-        if(iPtr == VMA_NULL)
-        {
-            return false;
-        }
-        for(uint32_t j = i + 1; j < count; ++j)
-        {
-            if(iPtr == arr[j])
-            {
-                return false;
-            }
-        }
-    }
-    return true;
-}
-
-template<typename MainT, typename NewT>
-static inline void VmaPnextChainPushFront(MainT* mainStruct, NewT* newStruct)
-{
-    newStruct->pNext = mainStruct->pNext;
-    mainStruct->pNext = newStruct;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Memory allocation
-
-static void* VmaMalloc(const VkAllocationCallbacks* pAllocationCallbacks, size_t size, size_t alignment)
-{
-    if((pAllocationCallbacks != VMA_NULL) &&
-        (pAllocationCallbacks->pfnAllocation != VMA_NULL))
-    {
-        return (*pAllocationCallbacks->pfnAllocation)(
-            pAllocationCallbacks->pUserData,
-            size,
-            alignment,
-            VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
-    }
-    else
-    {
-        return VMA_SYSTEM_ALIGNED_MALLOC(size, alignment);
-    }
-}
-
-static void VmaFree(const VkAllocationCallbacks* pAllocationCallbacks, void* ptr)
-{
-    if((pAllocationCallbacks != VMA_NULL) &&
-        (pAllocationCallbacks->pfnFree != VMA_NULL))
-    {
-        (*pAllocationCallbacks->pfnFree)(pAllocationCallbacks->pUserData, ptr);
-    }
-    else
-    {
-        VMA_SYSTEM_FREE(ptr);
-    }
-}
-
-template<typename T>
-static T* VmaAllocate(const VkAllocationCallbacks* pAllocationCallbacks)
-{
-    return (T*)VmaMalloc(pAllocationCallbacks, sizeof(T), VMA_ALIGN_OF(T));
-}
-
-template<typename T>
-static T* VmaAllocateArray(const VkAllocationCallbacks* pAllocationCallbacks, size_t count)
-{
-    return (T*)VmaMalloc(pAllocationCallbacks, sizeof(T) * count, VMA_ALIGN_OF(T));
-}
-
-#define vma_new(allocator, type)   new(VmaAllocate<type>(allocator))(type)
-
-#define vma_new_array(allocator, type, count)   new(VmaAllocateArray<type>((allocator), (count)))(type)
-
-template<typename T>
-static void vma_delete(const VkAllocationCallbacks* pAllocationCallbacks, T* ptr)
-{
-    ptr->~T();
-    VmaFree(pAllocationCallbacks, ptr);
-}
-
-template<typename T>
-static void vma_delete_array(const VkAllocationCallbacks* pAllocationCallbacks, T* ptr, size_t count)
-{
-    if(ptr != VMA_NULL)
-    {
-        for(size_t i = count; i--; )
-        {
-            ptr[i].~T();
-        }
-        VmaFree(pAllocationCallbacks, ptr);
-    }
-}
-
-static char* VmaCreateStringCopy(const VkAllocationCallbacks* allocs, const char* srcStr)
-{
-    if(srcStr != VMA_NULL)
-    {
-        const size_t len = strlen(srcStr);
-        char* const result = vma_new_array(allocs, char, len + 1);
-        memcpy(result, srcStr, len + 1);
-        return result;
-    }
-    else
-    {
-        return VMA_NULL;
-    }
-}
-
-static void VmaFreeString(const VkAllocationCallbacks* allocs, char* str)
-{
-    if(str != VMA_NULL)
-    {
-        const size_t len = strlen(str);
-        vma_delete_array(allocs, str, len + 1);
-    }
-}
-
-// STL-compatible allocator.
-template<typename T>
-class VmaStlAllocator
-{
-public:
-    const VkAllocationCallbacks* const m_pCallbacks;
-    typedef T value_type;
-    
-    VmaStlAllocator(const VkAllocationCallbacks* pCallbacks) : m_pCallbacks(pCallbacks) { }
-    template<typename U> VmaStlAllocator(const VmaStlAllocator<U>& src) : m_pCallbacks(src.m_pCallbacks) { }
-
-    T* allocate(size_t n) { return VmaAllocateArray<T>(m_pCallbacks, n); }
-    void deallocate(T* p, size_t n) { VmaFree(m_pCallbacks, p); }
-
-    template<typename U>
-    bool operator==(const VmaStlAllocator<U>& rhs) const
-    {
-        return m_pCallbacks == rhs.m_pCallbacks;
-    }
-    template<typename U>
-    bool operator!=(const VmaStlAllocator<U>& rhs) const
-    {
-        return m_pCallbacks != rhs.m_pCallbacks;
-    }
-
-    VmaStlAllocator& operator=(const VmaStlAllocator& x) = delete;
-};
-
-#if VMA_USE_STL_VECTOR
-
-#define VmaVector std::vector
-
-template<typename T, typename allocatorT>
-static void VmaVectorInsert(std::vector<T, allocatorT>& vec, size_t index, const T& item)
-{
-    vec.insert(vec.begin() + index, item);
-}
-
-template<typename T, typename allocatorT>
-static void VmaVectorRemove(std::vector<T, allocatorT>& vec, size_t index)
-{
-    vec.erase(vec.begin() + index);
-}
-
-#else // #if VMA_USE_STL_VECTOR
-
-/* Class with interface compatible with subset of std::vector.
-T must be POD because constructors and destructors are not called and memcpy is
-used for these objects. */
-template<typename T, typename AllocatorT>
-class VmaVector
-{
-public:
-    typedef T value_type;
-
-    VmaVector(const AllocatorT& allocator) :
-        m_Allocator(allocator),
-        m_pArray(VMA_NULL),
-        m_Count(0),
-        m_Capacity(0)
-    {
-    }
-
-    VmaVector(size_t count, const AllocatorT& allocator) :
-        m_Allocator(allocator),
-        m_pArray(count ? (T*)VmaAllocateArray<T>(allocator.m_pCallbacks, count) : VMA_NULL),
-        m_Count(count),
-        m_Capacity(count)
-    {
-    }
-    
-    // This version of the constructor is here for compatibility with pre-C++14 std::vector.
-    // value is unused.
-    VmaVector(size_t count, const T& value, const AllocatorT& allocator)
-        : VmaVector(count, allocator) {}
-    
-    VmaVector(const VmaVector<T, AllocatorT>& src) :
-        m_Allocator(src.m_Allocator),
-        m_pArray(src.m_Count ? (T*)VmaAllocateArray<T>(src.m_Allocator.m_pCallbacks, src.m_Count) : VMA_NULL),
-        m_Count(src.m_Count),
-        m_Capacity(src.m_Count)
-    {
-        if(m_Count != 0)
-        {
-            memcpy(m_pArray, src.m_pArray, m_Count * sizeof(T));
-        }
-    }
-    
-    ~VmaVector()
-    {
-        VmaFree(m_Allocator.m_pCallbacks, m_pArray);
-    }
-
-    VmaVector& operator=(const VmaVector<T, AllocatorT>& rhs)
-    {
-        if(&rhs != this)
-        {
-            resize(rhs.m_Count);
-            if(m_Count != 0)
-            {
-                memcpy(m_pArray, rhs.m_pArray, m_Count * sizeof(T));
-            }
-        }
-        return *this;
-    }
-    
-    bool empty() const { return m_Count == 0; }
-    size_t size() const { return m_Count; }
-    T* data() { return m_pArray; }
-    const T* data() const { return m_pArray; }
-    
-    T& operator[](size_t index)
-    {
-        VMA_HEAVY_ASSERT(index < m_Count);
-        return m_pArray[index];
-    }
-    const T& operator[](size_t index) const
-    {
-        VMA_HEAVY_ASSERT(index < m_Count);
-        return m_pArray[index];
-    }
-
-    T& front()
-    {
-        VMA_HEAVY_ASSERT(m_Count > 0);
-        return m_pArray[0];
-    }
-    const T& front() const
-    {
-        VMA_HEAVY_ASSERT(m_Count > 0);
-        return m_pArray[0];
-    }
-    T& back()
-    {
-        VMA_HEAVY_ASSERT(m_Count > 0);
-        return m_pArray[m_Count - 1];
-    }
-    const T& back() const
-    {
-        VMA_HEAVY_ASSERT(m_Count > 0);
-        return m_pArray[m_Count - 1];
-    }
-
-    void reserve(size_t newCapacity, bool freeMemory = false)
-    {
-        newCapacity = VMA_MAX(newCapacity, m_Count);
-        
-        if((newCapacity < m_Capacity) && !freeMemory)
-        {
-            newCapacity = m_Capacity;
-        }
-        
-        if(newCapacity != m_Capacity)
-        {
-            T* const newArray = newCapacity ? VmaAllocateArray<T>(m_Allocator, newCapacity) : VMA_NULL;
-            if(m_Count != 0)
-            {
-                memcpy(newArray, m_pArray, m_Count * sizeof(T));
-            }
-            VmaFree(m_Allocator.m_pCallbacks, m_pArray);
-            m_Capacity = newCapacity;
-            m_pArray = newArray;
-        }
-    }
-
-    void resize(size_t newCount, bool freeMemory = false)
-    {
-        size_t newCapacity = m_Capacity;
-        if(newCount > m_Capacity)
-        {
-            newCapacity = VMA_MAX(newCount, VMA_MAX(m_Capacity * 3 / 2, (size_t)8));
-        }
-        else if(freeMemory)
-        {
-            newCapacity = newCount;
-        }
-
-        if(newCapacity != m_Capacity)
-        {
-            T* const newArray = newCapacity ? VmaAllocateArray<T>(m_Allocator.m_pCallbacks, newCapacity) : VMA_NULL;
-            const size_t elementsToCopy = VMA_MIN(m_Count, newCount);
-            if(elementsToCopy != 0)
-            {
-                memcpy(newArray, m_pArray, elementsToCopy * sizeof(T));
-            }
-            VmaFree(m_Allocator.m_pCallbacks, m_pArray);
-            m_Capacity = newCapacity;
-            m_pArray = newArray;
-        }
-
-        m_Count = newCount;
-    }
-
-    void clear(bool freeMemory = false)
-    {
-        resize(0, freeMemory);
-    }
-
-    void insert(size_t index, const T& src)
-    {
-        VMA_HEAVY_ASSERT(index <= m_Count);
-        const size_t oldCount = size();
-        resize(oldCount + 1);
-        if(index < oldCount)
-        {
-            memmove(m_pArray + (index + 1), m_pArray + index, (oldCount - index) * sizeof(T));
-        }
-        m_pArray[index] = src;
-    }
-
-    void remove(size_t index)
-    {
-        VMA_HEAVY_ASSERT(index < m_Count);
-        const size_t oldCount = size();
-        if(index < oldCount - 1)
-        {
-            memmove(m_pArray + index, m_pArray + (index + 1), (oldCount - index - 1) * sizeof(T));
-        }
-        resize(oldCount - 1);
-    }
-
-    void push_back(const T& src)
-    {
-        const size_t newIndex = size();
-        resize(newIndex + 1);
-        m_pArray[newIndex] = src;
-    }
-
-    void pop_back()
-    {
-        VMA_HEAVY_ASSERT(m_Count > 0);
-        resize(size() - 1);
-    }
-
-    void push_front(const T& src)
-    {
-        insert(0, src);
-    }
-
-    void pop_front()
-    {
-        VMA_HEAVY_ASSERT(m_Count > 0);
-        remove(0);
-    }
-
-    typedef T* iterator;
-
-    iterator begin() { return m_pArray; }
-    iterator end() { return m_pArray + m_Count; }
-
-private:
-    AllocatorT m_Allocator;
-    T* m_pArray;
-    size_t m_Count;
-    size_t m_Capacity;
-};
-
-template<typename T, typename allocatorT>
-static void VmaVectorInsert(VmaVector<T, allocatorT>& vec, size_t index, const T& item)
-{
-    vec.insert(index, item);
-}
-
-template<typename T, typename allocatorT>
-static void VmaVectorRemove(VmaVector<T, allocatorT>& vec, size_t index)
-{
-    vec.remove(index);
-}
-
-#endif // #if VMA_USE_STL_VECTOR
-
-template<typename CmpLess, typename VectorT>
-size_t VmaVectorInsertSorted(VectorT& vector, const typename VectorT::value_type& value)
-{
-    const size_t indexToInsert = VmaBinaryFindFirstNotLess(
-        vector.data(),
-        vector.data() + vector.size(),
-        value,
-        CmpLess()) - vector.data();
-    VmaVectorInsert(vector, indexToInsert, value);
-    return indexToInsert;
-}
-
-template<typename CmpLess, typename VectorT>
-bool VmaVectorRemoveSorted(VectorT& vector, const typename VectorT::value_type& value)
-{
-    CmpLess comparator;
-    typename VectorT::iterator it = VmaBinaryFindFirstNotLess(
-        vector.begin(),
-        vector.end(),
-        value,
-        comparator);
-    if((it != vector.end()) && !comparator(*it, value) && !comparator(value, *it))
-    {
-        size_t indexToRemove = it - vector.begin();
-        VmaVectorRemove(vector, indexToRemove);
-        return true;
-    }
-    return false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// class VmaPoolAllocator
-
-/*
-Allocator for objects of type T using a list of arrays (pools) to speed up
-allocation. Number of elements that can be allocated is not bounded because
-allocator can create multiple blocks.
-*/
-template<typename T>
-class VmaPoolAllocator
-{
-    VMA_CLASS_NO_COPY(VmaPoolAllocator)
-public:
-    VmaPoolAllocator(const VkAllocationCallbacks* pAllocationCallbacks, uint32_t firstBlockCapacity);
-    ~VmaPoolAllocator();
-    template<typename... Types> T* Alloc(Types... args);
-    void Free(T* ptr);
-
-private:
-    union Item
-    {
-        uint32_t NextFreeIndex;
-        alignas(T) char Value[sizeof(T)];
-    };
-
-    struct ItemBlock
-    {
-        Item* pItems;
-        uint32_t Capacity;
-        uint32_t FirstFreeIndex;
-    };
-    
-    const VkAllocationCallbacks* m_pAllocationCallbacks;
-    const uint32_t m_FirstBlockCapacity;
-    VmaVector< ItemBlock, VmaStlAllocator<ItemBlock> > m_ItemBlocks;
-
-    ItemBlock& CreateNewBlock();
-};
-
-template<typename T>
-VmaPoolAllocator<T>::VmaPoolAllocator(const VkAllocationCallbacks* pAllocationCallbacks, uint32_t firstBlockCapacity) :
-    m_pAllocationCallbacks(pAllocationCallbacks),
-    m_FirstBlockCapacity(firstBlockCapacity),
-    m_ItemBlocks(VmaStlAllocator<ItemBlock>(pAllocationCallbacks))
-{
-    VMA_ASSERT(m_FirstBlockCapacity > 1);
-}
-
-template<typename T>
-VmaPoolAllocator<T>::~VmaPoolAllocator()
-{
-    for(size_t i = m_ItemBlocks.size(); i--; )
-        vma_delete_array(m_pAllocationCallbacks, m_ItemBlocks[i].pItems, m_ItemBlocks[i].Capacity);
-    m_ItemBlocks.clear();
-}
-
-template<typename T>
-template<typename... Types> T* VmaPoolAllocator<T>::Alloc(Types... args)
-{
-    for(size_t i = m_ItemBlocks.size(); i--; )
-    {
-        ItemBlock& block = m_ItemBlocks[i];
-        // This block has some free items: Use first one.
-        if(block.FirstFreeIndex != UINT32_MAX)
-        {
-            Item* const pItem = &block.pItems[block.FirstFreeIndex];
-            block.FirstFreeIndex = pItem->NextFreeIndex;
-            T* result = (T*)&pItem->Value;
-            new(result)T(std::forward<Types>(args)...); // Explicit constructor call.
-            return result;
-        }
-    }
-
-    // No block has free item: Create new one and use it.
-    ItemBlock& newBlock = CreateNewBlock();
-    Item* const pItem = &newBlock.pItems[0];
-    newBlock.FirstFreeIndex = pItem->NextFreeIndex;
-    T* result = (T*)&pItem->Value;
-    new(result)T(std::forward<Types>(args)...); // Explicit constructor call.
-    return result;
-}
-
-template<typename T>
-void VmaPoolAllocator<T>::Free(T* ptr)
-{
-    // Search all memory blocks to find ptr.
-    for(size_t i = m_ItemBlocks.size(); i--; )
-    {
-        ItemBlock& block = m_ItemBlocks[i];
-        
-        // Casting to union.
-        Item* pItemPtr;
-        memcpy(&pItemPtr, &ptr, sizeof(pItemPtr));
-        
-        // Check if pItemPtr is in address range of this block.
-        if((pItemPtr >= block.pItems) && (pItemPtr < block.pItems + block.Capacity))
-        {
-            ptr->~T(); // Explicit destructor call.
-            const uint32_t index = static_cast<uint32_t>(pItemPtr - block.pItems);
-            pItemPtr->NextFreeIndex = block.FirstFreeIndex;
-            block.FirstFreeIndex = index;
-            return;
-        }
-    }
-    VMA_ASSERT(0 && "Pointer doesn't belong to this memory pool.");
-}
-
-template<typename T>
-typename VmaPoolAllocator<T>::ItemBlock& VmaPoolAllocator<T>::CreateNewBlock()
-{
-    const uint32_t newBlockCapacity = m_ItemBlocks.empty() ?
-        m_FirstBlockCapacity : m_ItemBlocks.back().Capacity * 3 / 2;
-
-    const ItemBlock newBlock = {
-        vma_new_array(m_pAllocationCallbacks, Item, newBlockCapacity),
-        newBlockCapacity,
-        0 };
-
-    m_ItemBlocks.push_back(newBlock);
-
-    // Setup singly-linked list of all free items in this block.
-    for(uint32_t i = 0; i < newBlockCapacity - 1; ++i)
-        newBlock.pItems[i].NextFreeIndex = i + 1;
-    newBlock.pItems[newBlockCapacity - 1].NextFreeIndex = UINT32_MAX;
-    return m_ItemBlocks.back();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// class VmaRawList, VmaList
-
-#if VMA_USE_STL_LIST
-
-#define VmaList std::list
-
-#else // #if VMA_USE_STL_LIST
-
-template<typename T>
-struct VmaListItem
-{
-    VmaListItem* pPrev;
-    VmaListItem* pNext;
-    T Value;
-};
-
-// Doubly linked list.
-template<typename T>
-class VmaRawList
-{
-    VMA_CLASS_NO_COPY(VmaRawList)
-public:
-    typedef VmaListItem<T> ItemType;
-
-    VmaRawList(const VkAllocationCallbacks* pAllocationCallbacks);
-    ~VmaRawList();
-    void Clear();
-
-    size_t GetCount() const { return m_Count; }
-    bool IsEmpty() const { return m_Count == 0; }
-
-    ItemType* Front() { return m_pFront; }
-    const ItemType* Front() const { return m_pFront; }
-    ItemType* Back() { return m_pBack; }
-    const ItemType* Back() const { return m_pBack; }
-
-    ItemType* PushBack();
-    ItemType* PushFront();
-    ItemType* PushBack(const T& value);
-    ItemType* PushFront(const T& value);
-    void PopBack();
-    void PopFront();
-    
-    // Item can be null - it means PushBack.
-    ItemType* InsertBefore(ItemType* pItem);
-    // Item can be null - it means PushFront.
-    ItemType* InsertAfter(ItemType* pItem);
-
-    ItemType* InsertBefore(ItemType* pItem, const T& value);
-    ItemType* InsertAfter(ItemType* pItem, const T& value);
-
-    void Remove(ItemType* pItem);
-
-private:
-    const VkAllocationCallbacks* const m_pAllocationCallbacks;
-    VmaPoolAllocator<ItemType> m_ItemAllocator;
-    ItemType* m_pFront;
-    ItemType* m_pBack;
-    size_t m_Count;
-};
-
-template<typename T>
-VmaRawList<T>::VmaRawList(const VkAllocationCallbacks* pAllocationCallbacks) :
-    m_pAllocationCallbacks(pAllocationCallbacks),
-    m_ItemAllocator(pAllocationCallbacks, 128),
-    m_pFront(VMA_NULL),
-    m_pBack(VMA_NULL),
-    m_Count(0)
-{
-}
-
-template<typename T>
-VmaRawList<T>::~VmaRawList()
-{
-    // Intentionally not calling Clear, because that would be unnecessary
-    // computations to return all items to m_ItemAllocator as free.
-}
-
-template<typename T>
-void VmaRawList<T>::Clear()
-{
-    if(IsEmpty() == false)
-    {
-        ItemType* pItem = m_pBack;
-        while(pItem != VMA_NULL)
-        {
-            ItemType* const pPrevItem = pItem->pPrev;
-            m_ItemAllocator.Free(pItem);
-            pItem = pPrevItem;
-        }
-        m_pFront = VMA_NULL;
-        m_pBack = VMA_NULL;
-        m_Count = 0;
-    }
-}
-
-template<typename T>
-VmaListItem<T>* VmaRawList<T>::PushBack()
-{
-    ItemType* const pNewItem = m_ItemAllocator.Alloc();
-    pNewItem->pNext = VMA_NULL;
-    if(IsEmpty())
-    {
-        pNewItem->pPrev = VMA_NULL;
-        m_pFront = pNewItem;
-        m_pBack = pNewItem;
-        m_Count = 1;
-    }
-    else
-    {
-        pNewItem->pPrev = m_pBack;
-        m_pBack->pNext = pNewItem;
-        m_pBack = pNewItem;
-        ++m_Count;
-    }
-    return pNewItem;
-}
-
-template<typename T>
-VmaListItem<T>* VmaRawList<T>::PushFront()
-{
-    ItemType* const pNewItem = m_ItemAllocator.Alloc();
-    pNewItem->pPrev = VMA_NULL;
-    if(IsEmpty())
-    {
-        pNewItem->pNext = VMA_NULL;
-        m_pFront = pNewItem;
-        m_pBack = pNewItem;
-        m_Count = 1;
-    }
-    else
-    {
-        pNewItem->pNext = m_pFront;
-        m_pFront->pPrev = pNewItem;
-        m_pFront = pNewItem;
-        ++m_Count;
-    }
-    return pNewItem;
-}
-
-template<typename T>
-VmaListItem<T>* VmaRawList<T>::PushBack(const T& value)
-{
-    ItemType* const pNewItem = PushBack();
-    pNewItem->Value = value;
-    return pNewItem;
-}
-
-template<typename T>
-VmaListItem<T>* VmaRawList<T>::PushFront(const T& value)
-{
-    ItemType* const pNewItem = PushFront();
-    pNewItem->Value = value;
-    return pNewItem;
-}
-
-template<typename T>
-void VmaRawList<T>::PopBack()
-{
-    VMA_HEAVY_ASSERT(m_Count > 0);
-    ItemType* const pBackItem = m_pBack;
-    ItemType* const pPrevItem = pBackItem->pPrev;
-    if(pPrevItem != VMA_NULL)
-    {
-        pPrevItem->pNext = VMA_NULL;
-    }
-    m_pBack = pPrevItem;
-    m_ItemAllocator.Free(pBackItem);
-    --m_Count;
-}
-
-template<typename T>
-void VmaRawList<T>::PopFront()
-{
-    VMA_HEAVY_ASSERT(m_Count > 0);
-    ItemType* const pFrontItem = m_pFront;
-    ItemType* const pNextItem = pFrontItem->pNext;
-    if(pNextItem != VMA_NULL)
-    {
-        pNextItem->pPrev = VMA_NULL;
-    }
-    m_pFront = pNextItem;
-    m_ItemAllocator.Free(pFrontItem);
-    --m_Count;
-}
-
-template<typename T>
-void VmaRawList<T>::Remove(ItemType* pItem)
-{
-    VMA_HEAVY_ASSERT(pItem != VMA_NULL);
-    VMA_HEAVY_ASSERT(m_Count > 0);
-
-    if(pItem->pPrev != VMA_NULL)
-    {
-        pItem->pPrev->pNext = pItem->pNext;
-    }
-    else
-    {
-        VMA_HEAVY_ASSERT(m_pFront == pItem);
-        m_pFront = pItem->pNext;
-    }
-
-    if(pItem->pNext != VMA_NULL)
-    {
-        pItem->pNext->pPrev = pItem->pPrev;
-    }
-    else
-    {
-        VMA_HEAVY_ASSERT(m_pBack == pItem);
-        m_pBack = pItem->pPrev;
-    }
-
-    m_ItemAllocator.Free(pItem);
-    --m_Count;
-}
-
-template<typename T>
-VmaListItem<T>* VmaRawList<T>::InsertBefore(ItemType* pItem)
-{
-    if(pItem != VMA_NULL)
-    {
-        ItemType* const prevItem = pItem->pPrev;
-        ItemType* const newItem = m_ItemAllocator.Alloc();
-        newItem->pPrev = prevItem;
-        newItem->pNext = pItem;
-        pItem->pPrev = newItem;
-        if(prevItem != VMA_NULL)
-        {
-            prevItem->pNext = newItem;
-        }
-        else
-        {
-            VMA_HEAVY_ASSERT(m_pFront == pItem);
-            m_pFront = newItem;
-        }
-        ++m_Count;
-        return newItem;
-    }
-    else
-        return PushBack();
-}
-
-template<typename T>
-VmaListItem<T>* VmaRawList<T>::InsertAfter(ItemType* pItem)
-{
-    if(pItem != VMA_NULL)
-    {
-        ItemType* const nextItem = pItem->pNext;
-        ItemType* const newItem = m_ItemAllocator.Alloc();
-        newItem->pNext = nextItem;
-        newItem->pPrev = pItem;
-        pItem->pNext = newItem;
-        if(nextItem != VMA_NULL)
-        {
-            nextItem->pPrev = newItem;
-        }
-        else
-        {
-            VMA_HEAVY_ASSERT(m_pBack == pItem);
-            m_pBack = newItem;
-        }
-        ++m_Count;
-        return newItem;
-    }
-    else
-        return PushFront();
-}
-
-template<typename T>
-VmaListItem<T>* VmaRawList<T>::InsertBefore(ItemType* pItem, const T& value)
-{
-    ItemType* const newItem = InsertBefore(pItem);
-    newItem->Value = value;
-    return newItem;
-}
-
-template<typename T>
-VmaListItem<T>* VmaRawList<T>::InsertAfter(ItemType* pItem, const T& value)
-{
-    ItemType* const newItem = InsertAfter(pItem);
-    newItem->Value = value;
-    return newItem;
-}
-
-template<typename T, typename AllocatorT>
-class VmaList
-{
-    VMA_CLASS_NO_COPY(VmaList)
-public:
-    class iterator
-    {
-    public:
-        iterator() :
-            m_pList(VMA_NULL),
-            m_pItem(VMA_NULL)
-        {
-        }
-
-        T& operator*() const
-        {
-            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);
-            return m_pItem->Value;
-        }
-        T* operator->() const
-        {
-            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);
-            return &m_pItem->Value;
-        }
-
-        iterator& operator++()
-        {
-            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);
-            m_pItem = m_pItem->pNext;
-            return *this;
-        }
-        iterator& operator--()
-        {
-            if(m_pItem != VMA_NULL)
-            {
-                m_pItem = m_pItem->pPrev;
-            }
-            else
-            {
-                VMA_HEAVY_ASSERT(!m_pList->IsEmpty());
-                m_pItem = m_pList->Back();
-            }
-            return *this;
-        }
-
-        iterator operator++(int)
-        {
-            iterator result = *this;
-            ++*this;
-            return result;
-        }
-        iterator operator--(int)
-        {
-            iterator result = *this;
-            --*this;
-            return result;
-        }
-
-        bool operator==(const iterator& rhs) const
-        {
-            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);
-            return m_pItem == rhs.m_pItem;
-        }
-        bool operator!=(const iterator& rhs) const
-        {
-            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);
-            return m_pItem != rhs.m_pItem;
-        }
-        
-    private:
-        VmaRawList<T>* m_pList;
-        VmaListItem<T>* m_pItem;
-
-        iterator(VmaRawList<T>* pList, VmaListItem<T>* pItem) :
-            m_pList(pList),
-            m_pItem(pItem)
-        {
-        }
-
-        friend class VmaList<T, AllocatorT>;
-    };
-
-    class const_iterator
-    {
-    public:
-        const_iterator() :
-            m_pList(VMA_NULL),
-            m_pItem(VMA_NULL)
-        {
-        }
-
-        const_iterator(const iterator& src) :
-            m_pList(src.m_pList),
-            m_pItem(src.m_pItem)
-        {
-        }
-        
-        const T& operator*() const
-        {
-            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);
-            return m_pItem->Value;
-        }
-        const T* operator->() const
-        {
-            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);
-            return &m_pItem->Value;
-        }
-
-        const_iterator& operator++()
-        {
-            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);
-            m_pItem = m_pItem->pNext;
-            return *this;
-        }
-        const_iterator& operator--()
-        {
-            if(m_pItem != VMA_NULL)
-            {
-                m_pItem = m_pItem->pPrev;
-            }
-            else
-            {
-                VMA_HEAVY_ASSERT(!m_pList->IsEmpty());
-                m_pItem = m_pList->Back();
-            }
-            return *this;
-        }
-
-        const_iterator operator++(int)
-        {
-            const_iterator result = *this;
-            ++*this;
-            return result;
-        }
-        const_iterator operator--(int)
-        {
-            const_iterator result = *this;
-            --*this;
-            return result;
-        }
-
-        bool operator==(const const_iterator& rhs) const
-        {
-            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);
-            return m_pItem == rhs.m_pItem;
-        }
-        bool operator!=(const const_iterator& rhs) const
-        {
-            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);
-            return m_pItem != rhs.m_pItem;
-        }
-        
-    private:
-        const_iterator(const VmaRawList<T>* pList, const VmaListItem<T>* pItem) :
-            m_pList(pList),
-            m_pItem(pItem)
-        {
-        }
-
-        const VmaRawList<T>* m_pList;
-        const VmaListItem<T>* m_pItem;
-
-        friend class VmaList<T, AllocatorT>;
-    };
-
-    VmaList(const AllocatorT& allocator) : m_RawList(allocator.m_pCallbacks) { }
-
-    bool empty() const { return m_RawList.IsEmpty(); }
-    size_t size() const { return m_RawList.GetCount(); }
-
-    iterator begin() { return iterator(&m_RawList, m_RawList.Front()); }
-    iterator end() { return iterator(&m_RawList, VMA_NULL); }
-
-    const_iterator cbegin() const { return const_iterator(&m_RawList, m_RawList.Front()); }
-    const_iterator cend() const { return const_iterator(&m_RawList, VMA_NULL); }
-
-    void clear() { m_RawList.Clear(); }
-    void push_back(const T& value) { m_RawList.PushBack(value); }
-    void erase(iterator it) { m_RawList.Remove(it.m_pItem); }
-    iterator insert(iterator it, const T& value) { return iterator(&m_RawList, m_RawList.InsertBefore(it.m_pItem, value)); }
-
-private:
-    VmaRawList<T> m_RawList;
-};
-
-#endif // #if VMA_USE_STL_LIST
-
-////////////////////////////////////////////////////////////////////////////////
-// class VmaMap
-
-// Unused in this version.
-#if 0
-
-#if VMA_USE_STL_UNORDERED_MAP
-
-#define VmaPair std::pair
-
-#define VMA_MAP_TYPE(KeyT, ValueT) \
-    std::unordered_map< KeyT, ValueT, std::hash<KeyT>, std::equal_to<KeyT>, VmaStlAllocator< std::pair<KeyT, ValueT> > >
-
-#else // #if VMA_USE_STL_UNORDERED_MAP
-
-template<typename T1, typename T2>
-struct VmaPair
-{
-    T1 first;
-    T2 second;
-
-    VmaPair() : first(), second() { }
-    VmaPair(const T1& firstSrc, const T2& secondSrc) : first(firstSrc), second(secondSrc) { }
-};
-
-/* Class compatible with subset of interface of std::unordered_map.
-KeyT, ValueT must be POD because they will be stored in VmaVector.
-*/
-template<typename KeyT, typename ValueT>
-class VmaMap
-{
-public:
-    typedef VmaPair<KeyT, ValueT> PairType;
-    typedef PairType* iterator;
-
-    VmaMap(const VmaStlAllocator<PairType>& allocator) : m_Vector(allocator) { }
-
-    iterator begin() { return m_Vector.begin(); }
-    iterator end() { return m_Vector.end(); }
-
-    void insert(const PairType& pair);
-    iterator find(const KeyT& key);
-    void erase(iterator it);
-    
-private:
-    VmaVector< PairType, VmaStlAllocator<PairType> > m_Vector;
-};
-
-#define VMA_MAP_TYPE(KeyT, ValueT) VmaMap<KeyT, ValueT>
-
-template<typename FirstT, typename SecondT>
-struct VmaPairFirstLess
-{
-    bool operator()(const VmaPair<FirstT, SecondT>& lhs, const VmaPair<FirstT, SecondT>& rhs) const
-    {
-        return lhs.first < rhs.first;
-    }
-    bool operator()(const VmaPair<FirstT, SecondT>& lhs, const FirstT& rhsFirst) const
-    {
-        return lhs.first < rhsFirst;
-    }
-};
-
-template<typename KeyT, typename ValueT>
-void VmaMap<KeyT, ValueT>::insert(const PairType& pair)
-{
-    const size_t indexToInsert = VmaBinaryFindFirstNotLess(
-        m_Vector.data(),
-        m_Vector.data() + m_Vector.size(),
-        pair,
-        VmaPairFirstLess<KeyT, ValueT>()) - m_Vector.data();
-    VmaVectorInsert(m_Vector, indexToInsert, pair);
-}
-
-template<typename KeyT, typename ValueT>
-VmaPair<KeyT, ValueT>* VmaMap<KeyT, ValueT>::find(const KeyT& key)
-{
-    PairType* it = VmaBinaryFindFirstNotLess(
-        m_Vector.data(),
-        m_Vector.data() + m_Vector.size(),
-        key,
-        VmaPairFirstLess<KeyT, ValueT>());
-    if((it != m_Vector.end()) && (it->first == key))
-    {
-        return it;
-    }
-    else
-    {
-        return m_Vector.end();
-    }
-}
-
-template<typename KeyT, typename ValueT>
-void VmaMap<KeyT, ValueT>::erase(iterator it)
-{
-    VmaVectorRemove(m_Vector, it - m_Vector.begin());
-}
-
-#endif // #if VMA_USE_STL_UNORDERED_MAP
-
-#endif // #if 0
-
-////////////////////////////////////////////////////////////////////////////////
-
-class VmaDeviceMemoryBlock;
-
-enum VMA_CACHE_OPERATION { VMA_CACHE_FLUSH, VMA_CACHE_INVALIDATE };
-
-struct VmaAllocation_T
-{
-private:
-    static const uint8_t MAP_COUNT_FLAG_PERSISTENT_MAP = 0x80;
-
-    enum FLAGS
-    {
-        FLAG_USER_DATA_STRING = 0x01,
-    };
-
-public:
-    enum ALLOCATION_TYPE
-    {
-        ALLOCATION_TYPE_NONE,
-        ALLOCATION_TYPE_BLOCK,
-        ALLOCATION_TYPE_DEDICATED,
-    };
-
-    /*
-    This struct is allocated using VmaPoolAllocator.
-    */
-
-    VmaAllocation_T(uint32_t currentFrameIndex, bool userDataString) :
-        m_Alignment{1},
-        m_Size{0},
-        m_pUserData{VMA_NULL},
-        m_LastUseFrameIndex{currentFrameIndex},
-        m_MemoryTypeIndex{0},
-        m_Type{(uint8_t)ALLOCATION_TYPE_NONE},
-        m_SuballocationType{(uint8_t)VMA_SUBALLOCATION_TYPE_UNKNOWN},
-        m_MapCount{0},
-        m_Flags{userDataString ? (uint8_t)FLAG_USER_DATA_STRING : (uint8_t)0}
-    {
-#if VMA_STATS_STRING_ENABLED
-        m_CreationFrameIndex = currentFrameIndex;
-        m_BufferImageUsage = 0;
-#endif
-    }
-
-    ~VmaAllocation_T()
-    {
-        VMA_ASSERT((m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP) == 0 && "Allocation was not unmapped before destruction.");
-
-        // Check if owned string was freed.
-        VMA_ASSERT(m_pUserData == VMA_NULL);
-    }
-
-    void InitBlockAllocation(
-        VmaDeviceMemoryBlock* block,
-        VkDeviceSize offset,
-        VkDeviceSize alignment,
-        VkDeviceSize size,
-        uint32_t memoryTypeIndex,
-        VmaSuballocationType suballocationType,
-        bool mapped,
-        bool canBecomeLost)
-    {
-        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);
-        VMA_ASSERT(block != VMA_NULL);
-        m_Type = (uint8_t)ALLOCATION_TYPE_BLOCK;
-        m_Alignment = alignment;
-        m_Size = size;
-        m_MemoryTypeIndex = memoryTypeIndex;
-        m_MapCount = mapped ? MAP_COUNT_FLAG_PERSISTENT_MAP : 0;
-        m_SuballocationType = (uint8_t)suballocationType;
-        m_BlockAllocation.m_Block = block;
-        m_BlockAllocation.m_Offset = offset;
-        m_BlockAllocation.m_CanBecomeLost = canBecomeLost;
-    }
-
-    void InitLost()
-    {
-        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);
-        VMA_ASSERT(m_LastUseFrameIndex.load() == VMA_FRAME_INDEX_LOST);
-        m_Type = (uint8_t)ALLOCATION_TYPE_BLOCK;
-        m_MemoryTypeIndex = 0;
-        m_BlockAllocation.m_Block = VMA_NULL;
-        m_BlockAllocation.m_Offset = 0;
-        m_BlockAllocation.m_CanBecomeLost = true;
-    }
-
-    void ChangeBlockAllocation(
-        VmaAllocator hAllocator,
-        VmaDeviceMemoryBlock* block,
-        VkDeviceSize offset); 
-
-    void ChangeOffset(VkDeviceSize newOffset);
-
-    // pMappedData not null means allocation is created with MAPPED flag.
-    void InitDedicatedAllocation(
-        uint32_t memoryTypeIndex,
-        VkDeviceMemory hMemory,
-        VmaSuballocationType suballocationType,
-        void* pMappedData,
-        VkDeviceSize size)
-    {
-        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);
-        VMA_ASSERT(hMemory != VK_NULL_HANDLE);
-        m_Type = (uint8_t)ALLOCATION_TYPE_DEDICATED;
-        m_Alignment = 0;
-        m_Size = size;
-        m_MemoryTypeIndex = memoryTypeIndex;
-        m_SuballocationType = (uint8_t)suballocationType;
-        m_MapCount = (pMappedData != VMA_NULL) ? MAP_COUNT_FLAG_PERSISTENT_MAP : 0;
-        m_DedicatedAllocation.m_hMemory = hMemory;
-        m_DedicatedAllocation.m_pMappedData = pMappedData;
-    }
-
-    ALLOCATION_TYPE GetType() const { return (ALLOCATION_TYPE)m_Type; }
-    VkDeviceSize GetAlignment() const { return m_Alignment; }
-    VkDeviceSize GetSize() const { return m_Size; }
-    bool IsUserDataString() const { return (m_Flags & FLAG_USER_DATA_STRING) != 0; }
-    void* GetUserData() const { return m_pUserData; }
-    void SetUserData(VmaAllocator hAllocator, void* pUserData);
-    VmaSuballocationType GetSuballocationType() const { return (VmaSuballocationType)m_SuballocationType; }
-
-    VmaDeviceMemoryBlock* GetBlock() const
-    {
-        VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);
-        return m_BlockAllocation.m_Block;
-    }
-    VkDeviceSize GetOffset() const;
-    VkDeviceMemory GetMemory() const;
-    uint32_t GetMemoryTypeIndex() const { return m_MemoryTypeIndex; }
-    bool IsPersistentMap() const { return (m_MapCount & MAP_COUNT_FLAG_PERSISTENT_MAP) != 0; }
-    void* GetMappedData() const;
-    bool CanBecomeLost() const;
-    
-    uint32_t GetLastUseFrameIndex() const
-    {
-        return m_LastUseFrameIndex.load();
-    }
-    bool CompareExchangeLastUseFrameIndex(uint32_t& expected, uint32_t desired)
-    {
-        return m_LastUseFrameIndex.compare_exchange_weak(expected, desired);
-    }
-    /*
-    - If hAllocation.LastUseFrameIndex + frameInUseCount < allocator.CurrentFrameIndex,
-      makes it lost by setting LastUseFrameIndex = VMA_FRAME_INDEX_LOST and returns true.
-    - Else, returns false.
-    
-    If hAllocation is already lost, assert - you should not call it then.
-    If hAllocation was not created with CAN_BECOME_LOST_BIT, assert.
-    */
-    bool MakeLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);
-
-    void DedicatedAllocCalcStatsInfo(VmaStatInfo& outInfo)
-    {
-        VMA_ASSERT(m_Type == ALLOCATION_TYPE_DEDICATED);
-        outInfo.blockCount = 1;
-        outInfo.allocationCount = 1;
-        outInfo.unusedRangeCount = 0;
-        outInfo.usedBytes = m_Size;
-        outInfo.unusedBytes = 0;
-        outInfo.allocationSizeMin = outInfo.allocationSizeMax = m_Size;
-        outInfo.unusedRangeSizeMin = UINT64_MAX;
-        outInfo.unusedRangeSizeMax = 0;
-    }
-
-    void BlockAllocMap();
-    void BlockAllocUnmap();
-    VkResult DedicatedAllocMap(VmaAllocator hAllocator, void** ppData);
-    void DedicatedAllocUnmap(VmaAllocator hAllocator);
-
-#if VMA_STATS_STRING_ENABLED
-    uint32_t GetCreationFrameIndex() const { return m_CreationFrameIndex; }
-    uint32_t GetBufferImageUsage() const { return m_BufferImageUsage; }
-
-    void InitBufferImageUsage(uint32_t bufferImageUsage)
-    {
-        VMA_ASSERT(m_BufferImageUsage == 0);
-        m_BufferImageUsage = bufferImageUsage;
-    }
-
-    void PrintParameters(class VmaJsonWriter& json) const;
-#endif
-
-private:
-    VkDeviceSize m_Alignment;
-    VkDeviceSize m_Size;
-    void* m_pUserData;
-    VMA_ATOMIC_UINT32 m_LastUseFrameIndex;
-    uint32_t m_MemoryTypeIndex;
-    uint8_t m_Type; // ALLOCATION_TYPE
-    uint8_t m_SuballocationType; // VmaSuballocationType
-    // Bit 0x80 is set when allocation was created with VMA_ALLOCATION_CREATE_MAPPED_BIT.
-    // Bits with mask 0x7F are reference counter for vmaMapMemory()/vmaUnmapMemory().
-    uint8_t m_MapCount;
-    uint8_t m_Flags; // enum FLAGS
-
-    // Allocation out of VmaDeviceMemoryBlock.
-    struct BlockAllocation
-    {
-        VmaDeviceMemoryBlock* m_Block;
-        VkDeviceSize m_Offset;
-        bool m_CanBecomeLost;
-    };
-
-    // Allocation for an object that has its own private VkDeviceMemory.
-    struct DedicatedAllocation
-    {
-        VkDeviceMemory m_hMemory;
-        void* m_pMappedData; // Not null means memory is mapped.
-    };
-
-    union
-    {
-        // Allocation out of VmaDeviceMemoryBlock.
-        BlockAllocation m_BlockAllocation;
-        // Allocation for an object that has its own private VkDeviceMemory.
-        DedicatedAllocation m_DedicatedAllocation;
-    };
-
-#if VMA_STATS_STRING_ENABLED
-    uint32_t m_CreationFrameIndex;
-    uint32_t m_BufferImageUsage; // 0 if unknown.
-#endif
-
-    void FreeUserDataString(VmaAllocator hAllocator);
-};
-
-/*
-Represents a region of VmaDeviceMemoryBlock that is either assigned and returned as
-allocated memory block or free.
-*/
-struct VmaSuballocation
-{
-    VkDeviceSize offset;
-    VkDeviceSize size;
-    VmaAllocation hAllocation;
-    VmaSuballocationType type;
-};
-
-// Comparator for offsets.
-struct VmaSuballocationOffsetLess
-{
-    bool operator()(const VmaSuballocation& lhs, const VmaSuballocation& rhs) const
-    {
-        return lhs.offset < rhs.offset;
-    }
-};
-struct VmaSuballocationOffsetGreater
-{
-    bool operator()(const VmaSuballocation& lhs, const VmaSuballocation& rhs) const
-    {
-        return lhs.offset > rhs.offset;
-    }
-};
-
-typedef VmaList< VmaSuballocation, VmaStlAllocator<VmaSuballocation> > VmaSuballocationList;
-
-// Cost of one additional allocation lost, as equivalent in bytes.
-static const VkDeviceSize VMA_LOST_ALLOCATION_COST = 1048576;
-
-enum class VmaAllocationRequestType
-{
-    Normal,
-    // Used by "Linear" algorithm.
-    UpperAddress,
-    EndOf1st,
-    EndOf2nd,
-};
-
-/*
-Parameters of planned allocation inside a VmaDeviceMemoryBlock.
-
-If canMakeOtherLost was false:
-- item points to a FREE suballocation.
-- itemsToMakeLostCount is 0.
-
-If canMakeOtherLost was true:
-- item points to first of sequence of suballocations, which are either FREE,
-  or point to VmaAllocations that can become lost.
-- itemsToMakeLostCount is the number of VmaAllocations that need to be made lost for
-  the requested allocation to succeed.
-*/
-struct VmaAllocationRequest
-{
-    VkDeviceSize offset;
-    VkDeviceSize sumFreeSize; // Sum size of free items that overlap with proposed allocation.
-    VkDeviceSize sumItemSize; // Sum size of items to make lost that overlap with proposed allocation.
-    VmaSuballocationList::iterator item;
-    size_t itemsToMakeLostCount;
-    void* customData;
-    VmaAllocationRequestType type;
-
-    VkDeviceSize CalcCost() const
-    {
-        return sumItemSize + itemsToMakeLostCount * VMA_LOST_ALLOCATION_COST;
-    }
-};
-
-/*
-Data structure used for bookkeeping of allocations and unused ranges of memory
-in a single VkDeviceMemory block.
-*/
-class VmaBlockMetadata
-{
-public:
-    VmaBlockMetadata(VmaAllocator hAllocator);
-    virtual ~VmaBlockMetadata() { }
-    virtual void Init(VkDeviceSize size) { m_Size = size; }
-
-    // Validates all data structures inside this object. If not valid, returns false.
-    virtual bool Validate() const = 0;
-    VkDeviceSize GetSize() const { return m_Size; }
-    virtual size_t GetAllocationCount() const = 0;
-    virtual VkDeviceSize GetSumFreeSize() const = 0;
-    virtual VkDeviceSize GetUnusedRangeSizeMax() const = 0;
-    // Returns true if this block is empty - contains only single free suballocation.
-    virtual bool IsEmpty() const = 0;
-
-    virtual void CalcAllocationStatInfo(VmaStatInfo& outInfo) const = 0;
-    // Shouldn't modify blockCount.
-    virtual void AddPoolStats(VmaPoolStats& inoutStats) const = 0;
-
-#if VMA_STATS_STRING_ENABLED
-    virtual void PrintDetailedMap(class VmaJsonWriter& json) const = 0;
-#endif
-
-    // Tries to find a place for suballocation with given parameters inside this block.
-    // If succeeded, fills pAllocationRequest and returns true.
-    // If failed, returns false.
-    virtual bool CreateAllocationRequest(
-        uint32_t currentFrameIndex,
-        uint32_t frameInUseCount,
-        VkDeviceSize bufferImageGranularity,
-        VkDeviceSize allocSize,
-        VkDeviceSize allocAlignment,
-        bool upperAddress,
-        VmaSuballocationType allocType,
-        bool canMakeOtherLost,
-        // Always one of VMA_ALLOCATION_CREATE_STRATEGY_* or VMA_ALLOCATION_INTERNAL_STRATEGY_* flags.
-        uint32_t strategy,
-        VmaAllocationRequest* pAllocationRequest) = 0;
-
-    virtual bool MakeRequestedAllocationsLost(
-        uint32_t currentFrameIndex,
-        uint32_t frameInUseCount,
-        VmaAllocationRequest* pAllocationRequest) = 0;
-
-    virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount) = 0;
-
-    virtual VkResult CheckCorruption(const void* pBlockData) = 0;
-
-    // Makes actual allocation based on request. Request must already be checked and valid.
-    virtual void Alloc(
-        const VmaAllocationRequest& request,
-        VmaSuballocationType type,
-        VkDeviceSize allocSize,
-        VmaAllocation hAllocation) = 0;
-
-    // Frees suballocation assigned to given memory region.
-    virtual void Free(const VmaAllocation allocation) = 0;
-    virtual void FreeAtOffset(VkDeviceSize offset) = 0;
-
-protected:
-    const VkAllocationCallbacks* GetAllocationCallbacks() const { return m_pAllocationCallbacks; }
-
-#if VMA_STATS_STRING_ENABLED
-    void PrintDetailedMap_Begin(class VmaJsonWriter& json,
-        VkDeviceSize unusedBytes,
-        size_t allocationCount,
-        size_t unusedRangeCount) const;
-    void PrintDetailedMap_Allocation(class VmaJsonWriter& json,
-        VkDeviceSize offset,
-        VmaAllocation hAllocation) const;
-    void PrintDetailedMap_UnusedRange(class VmaJsonWriter& json,
-        VkDeviceSize offset,
-        VkDeviceSize size) const;
-    void PrintDetailedMap_End(class VmaJsonWriter& json) const;
-#endif
-
-private:
-    VkDeviceSize m_Size;
-    const VkAllocationCallbacks* m_pAllocationCallbacks;
-};
-
-#define VMA_VALIDATE(cond) do { if(!(cond)) { \
-        VMA_ASSERT(0 && "Validation failed: " #cond); \
-        return false; \
-    } } while(false)
-
-class VmaBlockMetadata_Generic : public VmaBlockMetadata
-{
-    VMA_CLASS_NO_COPY(VmaBlockMetadata_Generic)
-public:
-    VmaBlockMetadata_Generic(VmaAllocator hAllocator);
-    virtual ~VmaBlockMetadata_Generic();
-    virtual void Init(VkDeviceSize size);
-
-    virtual bool Validate() const;
-    virtual size_t GetAllocationCount() const { return m_Suballocations.size() - m_FreeCount; }
-    virtual VkDeviceSize GetSumFreeSize() const { return m_SumFreeSize; }
-    virtual VkDeviceSize GetUnusedRangeSizeMax() const;
-    virtual bool IsEmpty() const;
-
-    virtual void CalcAllocationStatInfo(VmaStatInfo& outInfo) const;
-    virtual void AddPoolStats(VmaPoolStats& inoutStats) const;
-
-#if VMA_STATS_STRING_ENABLED
-    virtual void PrintDetailedMap(class VmaJsonWriter& json) const;
-#endif
-
-    virtual bool CreateAllocationRequest(
-        uint32_t currentFrameIndex,
-        uint32_t frameInUseCount,
-        VkDeviceSize bufferImageGranularity,
-        VkDeviceSize allocSize,
-        VkDeviceSize allocAlignment,
-        bool upperAddress,
-        VmaSuballocationType allocType,
-        bool canMakeOtherLost,
-        uint32_t strategy,
-        VmaAllocationRequest* pAllocationRequest);
-
-    virtual bool MakeRequestedAllocationsLost(
-        uint32_t currentFrameIndex,
-        uint32_t frameInUseCount,
-        VmaAllocationRequest* pAllocationRequest);
-
-    virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);
-
-    virtual VkResult CheckCorruption(const void* pBlockData);
-
-    virtual void Alloc(
-        const VmaAllocationRequest& request,
-        VmaSuballocationType type,
-        VkDeviceSize allocSize,
-        VmaAllocation hAllocation);
-
-    virtual void Free(const VmaAllocation allocation);
-    virtual void FreeAtOffset(VkDeviceSize offset);
-
-    ////////////////////////////////////////////////////////////////////////////////
-    // For defragmentation
-    
-    bool IsBufferImageGranularityConflictPossible(
-        VkDeviceSize bufferImageGranularity,
-        VmaSuballocationType& inOutPrevSuballocType) const;
-
-private:
-    friend class VmaDefragmentationAlgorithm_Generic;
-    friend class VmaDefragmentationAlgorithm_Fast;
-
-    uint32_t m_FreeCount;
-    VkDeviceSize m_SumFreeSize;
-    VmaSuballocationList m_Suballocations;
-    // Suballocations that are free and have size greater than certain threshold.
-    // Sorted by size, ascending.
-    VmaVector< VmaSuballocationList::iterator, VmaStlAllocator< VmaSuballocationList::iterator > > m_FreeSuballocationsBySize;
-
-    bool ValidateFreeSuballocationList() const;
-
-    // Checks if requested suballocation with given parameters can be placed in given pFreeSuballocItem.
-    // If yes, fills pOffset and returns true. If no, returns false.
-    bool CheckAllocation(
-        uint32_t currentFrameIndex,
-        uint32_t frameInUseCount,
-        VkDeviceSize bufferImageGranularity,
-        VkDeviceSize allocSize,
-        VkDeviceSize allocAlignment,
-        VmaSuballocationType allocType,
-        VmaSuballocationList::const_iterator suballocItem,
-        bool canMakeOtherLost,
-        VkDeviceSize* pOffset,
-        size_t* itemsToMakeLostCount,
-        VkDeviceSize* pSumFreeSize,
-        VkDeviceSize* pSumItemSize) const;
-    // Given free suballocation, it merges it with following one, which must also be free.
-    void MergeFreeWithNext(VmaSuballocationList::iterator item);
-    // Releases given suballocation, making it free.
-    // Merges it with adjacent free suballocations if applicable.
-    // Returns iterator to new free suballocation at this place.
-    VmaSuballocationList::iterator FreeSuballocation(VmaSuballocationList::iterator suballocItem);
-    // Given free suballocation, it inserts it into sorted list of
-    // m_FreeSuballocationsBySize if it's suitable.
-    void RegisterFreeSuballocation(VmaSuballocationList::iterator item);
-    // Given free suballocation, it removes it from sorted list of
-    // m_FreeSuballocationsBySize if it's suitable.
-    void UnregisterFreeSuballocation(VmaSuballocationList::iterator item);
-};
-
-/*
-Allocations and their references in internal data structure look like this:
-
-if(m_2ndVectorMode == SECOND_VECTOR_EMPTY):
-
-        0 +-------+
-          |       |
-          |       |
-          |       |
-          +-------+
-          | Alloc |  1st[m_1stNullItemsBeginCount]
-          +-------+
-          | Alloc |  1st[m_1stNullItemsBeginCount + 1]
-          +-------+
-          |  ...  |
-          +-------+
-          | Alloc |  1st[1st.size() - 1]
-          +-------+
-          |       |
-          |       |
-          |       |
-GetSize() +-------+
-
-if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER):
-
-        0 +-------+
-          | Alloc |  2nd[0]
-          +-------+
-          | Alloc |  2nd[1]
-          +-------+
-          |  ...  |
-          +-------+
-          | Alloc |  2nd[2nd.size() - 1]
-          +-------+
-          |       |
-          |       |
-          |       |
-          +-------+
-          | Alloc |  1st[m_1stNullItemsBeginCount]
-          +-------+
-          | Alloc |  1st[m_1stNullItemsBeginCount + 1]
-          +-------+
-          |  ...  |
-          +-------+
-          | Alloc |  1st[1st.size() - 1]
-          +-------+
-          |       |
-GetSize() +-------+
-
-if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK):
-
-        0 +-------+
-          |       |
-          |       |
-          |       |
-          +-------+
-          | Alloc |  1st[m_1stNullItemsBeginCount]
-          +-------+
-          | Alloc |  1st[m_1stNullItemsBeginCount + 1]
-          +-------+
-          |  ...  |
-          +-------+
-          | Alloc |  1st[1st.size() - 1]
-          +-------+
-          |       |
-          |       |
-          |       |
-          +-------+
-          | Alloc |  2nd[2nd.size() - 1]
-          +-------+
-          |  ...  |
-          +-------+
-          | Alloc |  2nd[1]
-          +-------+
-          | Alloc |  2nd[0]
-GetSize() +-------+
-
-*/
-class VmaBlockMetadata_Linear : public VmaBlockMetadata
-{
-    VMA_CLASS_NO_COPY(VmaBlockMetadata_Linear)
-public:
-    VmaBlockMetadata_Linear(VmaAllocator hAllocator);
-    virtual ~VmaBlockMetadata_Linear();
-    virtual void Init(VkDeviceSize size);
-
-    virtual bool Validate() const;
-    virtual size_t GetAllocationCount() const;
-    virtual VkDeviceSize GetSumFreeSize() const { return m_SumFreeSize; }
-    virtual VkDeviceSize GetUnusedRangeSizeMax() const;
-    virtual bool IsEmpty() const { return GetAllocationCount() == 0; }
-
-    virtual void CalcAllocationStatInfo(VmaStatInfo& outInfo) const;
-    virtual void AddPoolStats(VmaPoolStats& inoutStats) const;
-
-#if VMA_STATS_STRING_ENABLED
-    virtual void PrintDetailedMap(class VmaJsonWriter& json) const;
-#endif
-
-    virtual bool CreateAllocationRequest(
-        uint32_t currentFrameIndex,
-        uint32_t frameInUseCount,
-        VkDeviceSize bufferImageGranularity,
-        VkDeviceSize allocSize,
-        VkDeviceSize allocAlignment,
-        bool upperAddress,
-        VmaSuballocationType allocType,
-        bool canMakeOtherLost,
-        uint32_t strategy,
-        VmaAllocationRequest* pAllocationRequest);
-
-    virtual bool MakeRequestedAllocationsLost(
-        uint32_t currentFrameIndex,
-        uint32_t frameInUseCount,
-        VmaAllocationRequest* pAllocationRequest);
-
-    virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);
-
-    virtual VkResult CheckCorruption(const void* pBlockData);
-
-    virtual void Alloc(
-        const VmaAllocationRequest& request,
-        VmaSuballocationType type,
-        VkDeviceSize allocSize,
-        VmaAllocation hAllocation);
-
-    virtual void Free(const VmaAllocation allocation);
-    virtual void FreeAtOffset(VkDeviceSize offset);
-
-private:
-    /*
-    There are two suballocation vectors, used in ping-pong way.
-    The one with index m_1stVectorIndex is called 1st.
-    The one with index (m_1stVectorIndex ^ 1) is called 2nd.
-    2nd can be non-empty only when 1st is not empty.
-    When 2nd is not empty, m_2ndVectorMode indicates its mode of operation.
-    */
-    typedef VmaVector< VmaSuballocation, VmaStlAllocator<VmaSuballocation> > SuballocationVectorType;
-
-    enum SECOND_VECTOR_MODE
-    {
-        SECOND_VECTOR_EMPTY,
-        /*
-        Suballocations in 2nd vector are created later than the ones in 1st, but they
-        all have smaller offset.
-        */
-        SECOND_VECTOR_RING_BUFFER,
-        /*
-        Suballocations in 2nd vector are upper side of double stack.
-        They all have offsets higher than those in 1st vector.
-        Top of this stack means smaller offsets, but higher indices in this vector.
-        */
-        SECOND_VECTOR_DOUBLE_STACK,
-    };
-
-    VkDeviceSize m_SumFreeSize;
-    SuballocationVectorType m_Suballocations0, m_Suballocations1;
-    uint32_t m_1stVectorIndex;
-    SECOND_VECTOR_MODE m_2ndVectorMode;
-
-    SuballocationVectorType& AccessSuballocations1st() { return m_1stVectorIndex ? m_Suballocations1 : m_Suballocations0; }
-    SuballocationVectorType& AccessSuballocations2nd() { return m_1stVectorIndex ? m_Suballocations0 : m_Suballocations1; }
-    const SuballocationVectorType& AccessSuballocations1st() const { return m_1stVectorIndex ? m_Suballocations1 : m_Suballocations0; }
-    const SuballocationVectorType& AccessSuballocations2nd() const { return m_1stVectorIndex ? m_Suballocations0 : m_Suballocations1; }
-    
-    // Number of items in 1st vector with hAllocation = null at the beginning.
-    size_t m_1stNullItemsBeginCount;
-    // Number of other items in 1st vector with hAllocation = null somewhere in the middle.
-    size_t m_1stNullItemsMiddleCount;
-    // Number of items in 2nd vector with hAllocation = null.
-    size_t m_2ndNullItemsCount;
-
-    bool ShouldCompact1st() const;
-    void CleanupAfterFree();
-
-    bool CreateAllocationRequest_LowerAddress(
-        uint32_t currentFrameIndex,
-        uint32_t frameInUseCount,
-        VkDeviceSize bufferImageGranularity,
-        VkDeviceSize allocSize,
-        VkDeviceSize allocAlignment,
-        VmaSuballocationType allocType,
-        bool canMakeOtherLost,
-        uint32_t strategy,
-        VmaAllocationRequest* pAllocationRequest);
-    bool CreateAllocationRequest_UpperAddress(
-        uint32_t currentFrameIndex,
-        uint32_t frameInUseCount,
-        VkDeviceSize bufferImageGranularity,
-        VkDeviceSize allocSize,
-        VkDeviceSize allocAlignment,
-        VmaSuballocationType allocType,
-        bool canMakeOtherLost,
-        uint32_t strategy,
-        VmaAllocationRequest* pAllocationRequest);
-};
-
-/*
-- GetSize() is the original size of allocated memory block.
-- m_UsableSize is this size aligned down to a power of two.
-  All allocations and calculations happen relative to m_UsableSize.
-- GetUnusableSize() is the difference between them.
-  It is repoted as separate, unused range, not available for allocations.
-
-Node at level 0 has size = m_UsableSize.
-Each next level contains nodes with size 2 times smaller than current level.
-m_LevelCount is the maximum number of levels to use in the current object.
-*/
-class VmaBlockMetadata_Buddy : public VmaBlockMetadata
-{
-    VMA_CLASS_NO_COPY(VmaBlockMetadata_Buddy)
-public:
-    VmaBlockMetadata_Buddy(VmaAllocator hAllocator);
-    virtual ~VmaBlockMetadata_Buddy();
-    virtual void Init(VkDeviceSize size);
-
-    virtual bool Validate() const;
-    virtual size_t GetAllocationCount() const { return m_AllocationCount; }
-    virtual VkDeviceSize GetSumFreeSize() const { return m_SumFreeSize + GetUnusableSize(); }
-    virtual VkDeviceSize GetUnusedRangeSizeMax() const;
-    virtual bool IsEmpty() const { return m_Root->type == Node::TYPE_FREE; }
-
-    virtual void CalcAllocationStatInfo(VmaStatInfo& outInfo) const;
-    virtual void AddPoolStats(VmaPoolStats& inoutStats) const;
-
-#if VMA_STATS_STRING_ENABLED
-    virtual void PrintDetailedMap(class VmaJsonWriter& json) const;
-#endif
-
-    virtual bool CreateAllocationRequest(
-        uint32_t currentFrameIndex,
-        uint32_t frameInUseCount,
-        VkDeviceSize bufferImageGranularity,
-        VkDeviceSize allocSize,
-        VkDeviceSize allocAlignment,
-        bool upperAddress,
-        VmaSuballocationType allocType,
-        bool canMakeOtherLost,
-        uint32_t strategy,
-        VmaAllocationRequest* pAllocationRequest);
-
-    virtual bool MakeRequestedAllocationsLost(
-        uint32_t currentFrameIndex,
-        uint32_t frameInUseCount,
-        VmaAllocationRequest* pAllocationRequest);
-
-    virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);
-
-    virtual VkResult CheckCorruption(const void* pBlockData) { return VK_ERROR_FEATURE_NOT_PRESENT; }
-
-    virtual void Alloc(
-        const VmaAllocationRequest& request,
-        VmaSuballocationType type,
-        VkDeviceSize allocSize,
-        VmaAllocation hAllocation);
-
-    virtual void Free(const VmaAllocation allocation) { FreeAtOffset(allocation, allocation->GetOffset()); }
-    virtual void FreeAtOffset(VkDeviceSize offset) { FreeAtOffset(VMA_NULL, offset); }
-
-private:
-    static const VkDeviceSize MIN_NODE_SIZE = 32;
-    static const size_t MAX_LEVELS = 30;
-
-    struct ValidationContext
-    {
-        size_t calculatedAllocationCount;
-        size_t calculatedFreeCount;
-        VkDeviceSize calculatedSumFreeSize;
-
-        ValidationContext() :
-            calculatedAllocationCount(0),
-            calculatedFreeCount(0),
-            calculatedSumFreeSize(0) { }
-    };
-
-    struct Node
-    {
-        VkDeviceSize offset;
-        enum TYPE
-        {
-            TYPE_FREE,
-            TYPE_ALLOCATION,
-            TYPE_SPLIT,
-            TYPE_COUNT
-        } type;
-        Node* parent;
-        Node* buddy;
-
-        union
-        {
-            struct
-            {
-                Node* prev;
-                Node* next;
-            } free;
-            struct
-            {
-                VmaAllocation alloc;
-            } allocation;
-            struct
-            {
-                Node* leftChild;
-            } split;
-        };
-    };
-
-    // Size of the memory block aligned down to a power of two.
-    VkDeviceSize m_UsableSize;
-    uint32_t m_LevelCount;
-
-    Node* m_Root;
-    struct {
-        Node* front;
-        Node* back;
-    } m_FreeList[MAX_LEVELS];
-    // Number of nodes in the tree with type == TYPE_ALLOCATION.
-    size_t m_AllocationCount;
-    // Number of nodes in the tree with type == TYPE_FREE.
-    size_t m_FreeCount;
-    // This includes space wasted due to internal fragmentation. Doesn't include unusable size.
-    VkDeviceSize m_SumFreeSize;
-
-    VkDeviceSize GetUnusableSize() const { return GetSize() - m_UsableSize; }
-    void DeleteNode(Node* node);
-    bool ValidateNode(ValidationContext& ctx, const Node* parent, const Node* curr, uint32_t level, VkDeviceSize levelNodeSize) const;
-    uint32_t AllocSizeToLevel(VkDeviceSize allocSize) const;
-    inline VkDeviceSize LevelToNodeSize(uint32_t level) const { return m_UsableSize >> level; }
-    // Alloc passed just for validation. Can be null.
-    void FreeAtOffset(VmaAllocation alloc, VkDeviceSize offset);
-    void CalcAllocationStatInfoNode(VmaStatInfo& outInfo, const Node* node, VkDeviceSize levelNodeSize) const;
-    // Adds node to the front of FreeList at given level.
-    // node->type must be FREE.
-    // node->free.prev, next can be undefined.
-    void AddToFreeListFront(uint32_t level, Node* node);
-    // Removes node from FreeList at given level.
-    // node->type must be FREE.
-    // node->free.prev, next stay untouched.
-    void RemoveFromFreeList(uint32_t level, Node* node);
-
-#if VMA_STATS_STRING_ENABLED
-    void PrintDetailedMapNode(class VmaJsonWriter& json, const Node* node, VkDeviceSize levelNodeSize) const;
-#endif
-};
-
-/*
-Represents a single block of device memory (`VkDeviceMemory`) with all the
-data about its regions (aka suballocations, #VmaAllocation), assigned and free.
-
-Thread-safety: This class must be externally synchronized.
-*/
-class VmaDeviceMemoryBlock
-{
-    VMA_CLASS_NO_COPY(VmaDeviceMemoryBlock)
-public:
-    VmaBlockMetadata* m_pMetadata;
-
-    VmaDeviceMemoryBlock(VmaAllocator hAllocator);
-
-    ~VmaDeviceMemoryBlock()
-    {
-        VMA_ASSERT(m_MapCount == 0 && "VkDeviceMemory block is being destroyed while it is still mapped.");
-        VMA_ASSERT(m_hMemory == VK_NULL_HANDLE);
-    }
-
-    // Always call after construction.
-    void Init(
-        VmaAllocator hAllocator,
-        VmaPool hParentPool,
-        uint32_t newMemoryTypeIndex,
-        VkDeviceMemory newMemory,
-        VkDeviceSize newSize,
-        uint32_t id,
-        uint32_t algorithm);
-    // Always call before destruction.
-    void Destroy(VmaAllocator allocator);
-    
-    VmaPool GetParentPool() const { return m_hParentPool; }
-    VkDeviceMemory GetDeviceMemory() const { return m_hMemory; }
-    uint32_t GetMemoryTypeIndex() const { return m_MemoryTypeIndex; }
-    uint32_t GetId() const { return m_Id; }
-    void* GetMappedData() const { return m_pMappedData; }
-
-    // Validates all data structures inside this object. If not valid, returns false.
-    bool Validate() const;
-
-    VkResult CheckCorruption(VmaAllocator hAllocator);
-
-    // ppData can be null.
-    VkResult Map(VmaAllocator hAllocator, uint32_t count, void** ppData);
-    void Unmap(VmaAllocator hAllocator, uint32_t count);
-
-    VkResult WriteMagicValueAroundAllocation(VmaAllocator hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize);
-    VkResult ValidateMagicValueAroundAllocation(VmaAllocator hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize);
-
-    VkResult BindBufferMemory(
-        const VmaAllocator hAllocator,
-        const VmaAllocation hAllocation,
-        VkDeviceSize allocationLocalOffset,
-        VkBuffer hBuffer,
-        const void* pNext);
-    VkResult BindImageMemory(
-        const VmaAllocator hAllocator,
-        const VmaAllocation hAllocation,
-        VkDeviceSize allocationLocalOffset,
-        VkImage hImage,
-        const void* pNext);
-
-private:
-    VmaPool m_hParentPool; // VK_NULL_HANDLE if not belongs to custom pool.
-    uint32_t m_MemoryTypeIndex;
-    uint32_t m_Id;
-    VkDeviceMemory m_hMemory;
-
-    /*
-    Protects access to m_hMemory so it's not used by multiple threads simultaneously, e.g. vkMapMemory, vkBindBufferMemory.
-    Also protects m_MapCount, m_pMappedData.
-    Allocations, deallocations, any change in m_pMetadata is protected by parent's VmaBlockVector::m_Mutex.
-    */
-    VMA_MUTEX m_Mutex;
-    uint32_t m_MapCount;
-    void* m_pMappedData;
-};
-
-struct VmaPointerLess
-{
-    bool operator()(const void* lhs, const void* rhs) const
-    {
-        return lhs < rhs;
-    }
-};
-
-struct VmaDefragmentationMove
-{
-    size_t srcBlockIndex;
-    size_t dstBlockIndex;
-    VkDeviceSize srcOffset;
-    VkDeviceSize dstOffset;
-    VkDeviceSize size;
-    VmaAllocation hAllocation;
-    VmaDeviceMemoryBlock* pSrcBlock;
-    VmaDeviceMemoryBlock* pDstBlock;
-};
-
-class VmaDefragmentationAlgorithm;
-
-/*
-Sequence of VmaDeviceMemoryBlock. Represents memory blocks allocated for a specific
-Vulkan memory type.
-
-Synchronized internally with a mutex.
-*/
-struct VmaBlockVector
-{
-    VMA_CLASS_NO_COPY(VmaBlockVector)
-public:
-    VmaBlockVector(
-        VmaAllocator hAllocator,
-        VmaPool hParentPool,
-        uint32_t memoryTypeIndex,
-        VkDeviceSize preferredBlockSize,
-        size_t minBlockCount,
-        size_t maxBlockCount,
-        VkDeviceSize bufferImageGranularity,
-        uint32_t frameInUseCount,
-        bool explicitBlockSize,
-        uint32_t algorithm);
-    ~VmaBlockVector();
-
-    VkResult CreateMinBlocks();
-
-    VmaAllocator GetAllocator() const { return m_hAllocator; }
-    VmaPool GetParentPool() const { return m_hParentPool; }
-    bool IsCustomPool() const { return m_hParentPool != VMA_NULL; }
-    uint32_t GetMemoryTypeIndex() const { return m_MemoryTypeIndex; }
-    VkDeviceSize GetPreferredBlockSize() const { return m_PreferredBlockSize; }
-    VkDeviceSize GetBufferImageGranularity() const { return m_BufferImageGranularity; }
-    uint32_t GetFrameInUseCount() const { return m_FrameInUseCount; }
-    uint32_t GetAlgorithm() const { return m_Algorithm; }
-
-    void GetPoolStats(VmaPoolStats* pStats);
-
-    bool IsEmpty();
-    bool IsCorruptionDetectionEnabled() const;
-
-    VkResult Allocate(
-        uint32_t currentFrameIndex,
-        VkDeviceSize size,
-        VkDeviceSize alignment,
-        const VmaAllocationCreateInfo& createInfo,
-        VmaSuballocationType suballocType,
-        size_t allocationCount,
-        VmaAllocation* pAllocations);
-
-    void Free(const VmaAllocation hAllocation);
-
-    // Adds statistics of this BlockVector to pStats.
-    void AddStats(VmaStats* pStats);
-
-#if VMA_STATS_STRING_ENABLED
-    void PrintDetailedMap(class VmaJsonWriter& json);
-#endif
-
-    void MakePoolAllocationsLost(
-        uint32_t currentFrameIndex,
-        size_t* pLostAllocationCount);
-    VkResult CheckCorruption();
-
-    // Saves results in pCtx->res.
-    void Defragment(
-        class VmaBlockVectorDefragmentationContext* pCtx,
-        VmaDefragmentationStats* pStats, VmaDefragmentationFlags flags,
-        VkDeviceSize& maxCpuBytesToMove, uint32_t& maxCpuAllocationsToMove,
-        VkDeviceSize& maxGpuBytesToMove, uint32_t& maxGpuAllocationsToMove,
-        VkCommandBuffer commandBuffer);
-    void DefragmentationEnd(
-        class VmaBlockVectorDefragmentationContext* pCtx,
-        uint32_t flags,
-        VmaDefragmentationStats* pStats);
-
-    uint32_t ProcessDefragmentations(
-        class VmaBlockVectorDefragmentationContext *pCtx,
-        VmaDefragmentationPassMoveInfo* pMove, uint32_t maxMoves);
-
-    void CommitDefragmentations(
-        class VmaBlockVectorDefragmentationContext *pCtx,
-        VmaDefragmentationStats* pStats);
-
-    ////////////////////////////////////////////////////////////////////////////////
-    // To be used only while the m_Mutex is locked. Used during defragmentation.
-
-    size_t GetBlockCount() const { return m_Blocks.size(); }
-    VmaDeviceMemoryBlock* GetBlock(size_t index) const { return m_Blocks[index]; }
-    size_t CalcAllocationCount() const;
-    bool IsBufferImageGranularityConflictPossible() const;
-
-private:
-    friend class VmaDefragmentationAlgorithm_Generic;
-
-    const VmaAllocator m_hAllocator;
-    const VmaPool m_hParentPool;
-    const uint32_t m_MemoryTypeIndex;
-    const VkDeviceSize m_PreferredBlockSize;
-    const size_t m_MinBlockCount;
-    const size_t m_MaxBlockCount;
-    const VkDeviceSize m_BufferImageGranularity;
-    const uint32_t m_FrameInUseCount;
-    const bool m_ExplicitBlockSize;
-    const uint32_t m_Algorithm;
-    VMA_RW_MUTEX m_Mutex;
-
-    /* There can be at most one allocation that is completely empty (except when minBlockCount > 0) -
-    a hysteresis to avoid pessimistic case of alternating creation and destruction of a VkDeviceMemory. */
-    bool m_HasEmptyBlock;
-    // Incrementally sorted by sumFreeSize, ascending.
-    VmaVector< VmaDeviceMemoryBlock*, VmaStlAllocator<VmaDeviceMemoryBlock*> > m_Blocks;
-    uint32_t m_NextBlockId;
-
-    VkDeviceSize CalcMaxBlockSize() const;
-
-    // Finds and removes given block from vector.
-    void Remove(VmaDeviceMemoryBlock* pBlock);
-
-    // Performs single step in sorting m_Blocks. They may not be fully sorted
-    // after this call.
-    void IncrementallySortBlocks();
-
-    VkResult AllocatePage(
-        uint32_t currentFrameIndex,
-        VkDeviceSize size,
-        VkDeviceSize alignment,
-        const VmaAllocationCreateInfo& createInfo,
-        VmaSuballocationType suballocType,
-        VmaAllocation* pAllocation);
-
-    // To be used only without CAN_MAKE_OTHER_LOST flag.
-    VkResult AllocateFromBlock(
-        VmaDeviceMemoryBlock* pBlock,
-        uint32_t currentFrameIndex,
-        VkDeviceSize size,
-        VkDeviceSize alignment,
-        VmaAllocationCreateFlags allocFlags,
-        void* pUserData,
-        VmaSuballocationType suballocType,
-        uint32_t strategy,
-        VmaAllocation* pAllocation);
-
-    VkResult CreateBlock(VkDeviceSize blockSize, size_t* pNewBlockIndex);
-
-    // Saves result to pCtx->res.
-    void ApplyDefragmentationMovesCpu(
-        class VmaBlockVectorDefragmentationContext* pDefragCtx,
-        const VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves);
-    // Saves result to pCtx->res.
-    void ApplyDefragmentationMovesGpu(
-        class VmaBlockVectorDefragmentationContext* pDefragCtx,
-        VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,
-        VkCommandBuffer commandBuffer);
-
-    /*
-    Used during defragmentation. pDefragmentationStats is optional. It's in/out
-    - updated with new data.
-    */
-    void FreeEmptyBlocks(VmaDefragmentationStats* pDefragmentationStats);
-
-    void UpdateHasEmptyBlock();
-};
-
-struct VmaPool_T
-{
-    VMA_CLASS_NO_COPY(VmaPool_T)
-public:
-    VmaBlockVector m_BlockVector;
-
-    VmaPool_T(
-        VmaAllocator hAllocator,
-        const VmaPoolCreateInfo& createInfo,
-        VkDeviceSize preferredBlockSize);
-    ~VmaPool_T();
-
-    uint32_t GetId() const { return m_Id; }
-    void SetId(uint32_t id) { VMA_ASSERT(m_Id == 0); m_Id = id; }
-
-    const char* GetName() const { return m_Name; }
-    void SetName(const char* pName);
-
-#if VMA_STATS_STRING_ENABLED
-    //void PrintDetailedMap(class VmaStringBuilder& sb);
-#endif
-
-private:
-    uint32_t m_Id;
-    char* m_Name;
-};
-
-/*
-Performs defragmentation:
-
-- Updates `pBlockVector->m_pMetadata`.
-- Updates allocations by calling ChangeBlockAllocation() or ChangeOffset().
-- Does not move actual data, only returns requested moves as `moves`.
-*/
-class VmaDefragmentationAlgorithm
-{
-    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm)
-public:
-    VmaDefragmentationAlgorithm(
-        VmaAllocator hAllocator,
-        VmaBlockVector* pBlockVector,
-        uint32_t currentFrameIndex) :
-        m_hAllocator(hAllocator),
-        m_pBlockVector(pBlockVector),
-        m_CurrentFrameIndex(currentFrameIndex)
-    {
-    }
-    virtual ~VmaDefragmentationAlgorithm()
-    {
-    }
-
-    virtual void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged) = 0;
-    virtual void AddAll() = 0;
-
-    virtual VkResult Defragment(
-        VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,
-        VkDeviceSize maxBytesToMove,
-        uint32_t maxAllocationsToMove,
-        VmaDefragmentationFlags flags) = 0;
-
-    virtual VkDeviceSize GetBytesMoved() const = 0;
-    virtual uint32_t GetAllocationsMoved() const = 0;
-
-protected:
-    VmaAllocator const m_hAllocator;
-    VmaBlockVector* const m_pBlockVector;
-    const uint32_t m_CurrentFrameIndex;
-
-    struct AllocationInfo
-    {
-        VmaAllocation m_hAllocation;
-        VkBool32* m_pChanged;
-
-        AllocationInfo() :
-            m_hAllocation(VK_NULL_HANDLE),
-            m_pChanged(VMA_NULL)
-        {
-        }
-        AllocationInfo(VmaAllocation hAlloc, VkBool32* pChanged) :
-            m_hAllocation(hAlloc),
-            m_pChanged(pChanged)
-        {
-        }
-    };
-};
-
-class VmaDefragmentationAlgorithm_Generic : public VmaDefragmentationAlgorithm
-{
-    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm_Generic)
-public:
-    VmaDefragmentationAlgorithm_Generic(
-        VmaAllocator hAllocator,
-        VmaBlockVector* pBlockVector,
-        uint32_t currentFrameIndex,
-        bool overlappingMoveSupported);
-    virtual ~VmaDefragmentationAlgorithm_Generic();
-
-    virtual void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged);
-    virtual void AddAll() { m_AllAllocations = true; }
-
-    virtual VkResult Defragment(
-        VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,
-        VkDeviceSize maxBytesToMove,
-        uint32_t maxAllocationsToMove,
-        VmaDefragmentationFlags flags);
-
-    virtual VkDeviceSize GetBytesMoved() const { return m_BytesMoved; }
-    virtual uint32_t GetAllocationsMoved() const { return m_AllocationsMoved; }
-
-private:
-    uint32_t m_AllocationCount;
-    bool m_AllAllocations;
-
-    VkDeviceSize m_BytesMoved;
-    uint32_t m_AllocationsMoved;
-
-    struct AllocationInfoSizeGreater
-    {
-        bool operator()(const AllocationInfo& lhs, const AllocationInfo& rhs) const
-        {
-            return lhs.m_hAllocation->GetSize() > rhs.m_hAllocation->GetSize();
-        }
-    };
-
-    struct AllocationInfoOffsetGreater
-    {
-        bool operator()(const AllocationInfo& lhs, const AllocationInfo& rhs) const
-        {
-            return lhs.m_hAllocation->GetOffset() > rhs.m_hAllocation->GetOffset();
-        }
-    };
-
-    struct BlockInfo
-    {
-        size_t m_OriginalBlockIndex;
-        VmaDeviceMemoryBlock* m_pBlock;
-        bool m_HasNonMovableAllocations;
-        VmaVector< AllocationInfo, VmaStlAllocator<AllocationInfo> > m_Allocations;
-
-        BlockInfo(const VkAllocationCallbacks* pAllocationCallbacks) :
-            m_OriginalBlockIndex(SIZE_MAX),
-            m_pBlock(VMA_NULL),
-            m_HasNonMovableAllocations(true),
-            m_Allocations(pAllocationCallbacks)
-        {
-        }
-
-        void CalcHasNonMovableAllocations()
-        {
-            const size_t blockAllocCount = m_pBlock->m_pMetadata->GetAllocationCount();
-            const size_t defragmentAllocCount = m_Allocations.size();
-            m_HasNonMovableAllocations = blockAllocCount != defragmentAllocCount;
-        }
-
-        void SortAllocationsBySizeDescending()
-        {
-            VMA_SORT(m_Allocations.begin(), m_Allocations.end(), AllocationInfoSizeGreater());
-        }
-
-        void SortAllocationsByOffsetDescending()
-        {
-            VMA_SORT(m_Allocations.begin(), m_Allocations.end(), AllocationInfoOffsetGreater());
-        }
-    };
-
-    struct BlockPointerLess
-    {
-        bool operator()(const BlockInfo* pLhsBlockInfo, const VmaDeviceMemoryBlock* pRhsBlock) const
-        {
-            return pLhsBlockInfo->m_pBlock < pRhsBlock;
-        }
-        bool operator()(const BlockInfo* pLhsBlockInfo, const BlockInfo* pRhsBlockInfo) const
-        {
-            return pLhsBlockInfo->m_pBlock < pRhsBlockInfo->m_pBlock;
-        }
-    };
-
-    // 1. Blocks with some non-movable allocations go first.
-    // 2. Blocks with smaller sumFreeSize go first.
-    struct BlockInfoCompareMoveDestination
-    {
-        bool operator()(const BlockInfo* pLhsBlockInfo, const BlockInfo* pRhsBlockInfo) const
-        {
-            if(pLhsBlockInfo->m_HasNonMovableAllocations && !pRhsBlockInfo->m_HasNonMovableAllocations)
-            {
-                return true;
-            }
-            if(!pLhsBlockInfo->m_HasNonMovableAllocations && pRhsBlockInfo->m_HasNonMovableAllocations)
-            {
-                return false;
-            }
-            if(pLhsBlockInfo->m_pBlock->m_pMetadata->GetSumFreeSize() < pRhsBlockInfo->m_pBlock->m_pMetadata->GetSumFreeSize())
-            {
-                return true;
-            }
-            return false;
-        }
-    };
-
-    typedef VmaVector< BlockInfo*, VmaStlAllocator<BlockInfo*> > BlockInfoVector;
-    BlockInfoVector m_Blocks;
-
-    VkResult DefragmentRound(
-        VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,
-        VkDeviceSize maxBytesToMove,
-        uint32_t maxAllocationsToMove,
-        bool freeOldAllocations);
-
-    size_t CalcBlocksWithNonMovableCount() const;
-
-    static bool MoveMakesSense(
-        size_t dstBlockIndex, VkDeviceSize dstOffset,
-        size_t srcBlockIndex, VkDeviceSize srcOffset);
-};
-
-class VmaDefragmentationAlgorithm_Fast : public VmaDefragmentationAlgorithm
-{
-    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm_Fast)
-public:
-    VmaDefragmentationAlgorithm_Fast(
-        VmaAllocator hAllocator,
-        VmaBlockVector* pBlockVector,
-        uint32_t currentFrameIndex,
-        bool overlappingMoveSupported);
-    virtual ~VmaDefragmentationAlgorithm_Fast();
-
-    virtual void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged) { ++m_AllocationCount; }
-    virtual void AddAll() { m_AllAllocations = true; }
-
-    virtual VkResult Defragment(
-        VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,
-        VkDeviceSize maxBytesToMove,
-        uint32_t maxAllocationsToMove,
-        VmaDefragmentationFlags flags);
-
-    virtual VkDeviceSize GetBytesMoved() const { return m_BytesMoved; }
-    virtual uint32_t GetAllocationsMoved() const { return m_AllocationsMoved; }
-
-private:
-    struct BlockInfo
-    {
-        size_t origBlockIndex;
-    };
-
-    class FreeSpaceDatabase
-    {
-    public:
-        FreeSpaceDatabase()
-        {
-            FreeSpace s = {};
-            s.blockInfoIndex = SIZE_MAX;
-            for(size_t i = 0; i < MAX_COUNT; ++i)
-            {
-                m_FreeSpaces[i] = s;
-            }
-        }
-
-        void Register(size_t blockInfoIndex, VkDeviceSize offset, VkDeviceSize size)
-        {
-            if(size < VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)
-            {
-                return;
-            }
-
-            // Find first invalid or the smallest structure.
-            size_t bestIndex = SIZE_MAX;
-            for(size_t i = 0; i < MAX_COUNT; ++i)
-            {
-                // Empty structure.
-                if(m_FreeSpaces[i].blockInfoIndex == SIZE_MAX)
-                {
-                    bestIndex = i;
-                    break;
-                }
-                if(m_FreeSpaces[i].size < size &&
-                    (bestIndex == SIZE_MAX || m_FreeSpaces[bestIndex].size > m_FreeSpaces[i].size))
-                {
-                    bestIndex = i;
-                }
-            }
-
-            if(bestIndex != SIZE_MAX)
-            {
-                m_FreeSpaces[bestIndex].blockInfoIndex = blockInfoIndex;
-                m_FreeSpaces[bestIndex].offset = offset;
-                m_FreeSpaces[bestIndex].size = size;
-            }
-        }
-
-        bool Fetch(VkDeviceSize alignment, VkDeviceSize size,
-            size_t& outBlockInfoIndex, VkDeviceSize& outDstOffset)
-        {
-            size_t bestIndex = SIZE_MAX;
-            VkDeviceSize bestFreeSpaceAfter = 0;
-            for(size_t i = 0; i < MAX_COUNT; ++i)
-            {
-                // Structure is valid.
-                if(m_FreeSpaces[i].blockInfoIndex != SIZE_MAX)
-                {
-                    const VkDeviceSize dstOffset = VmaAlignUp(m_FreeSpaces[i].offset, alignment);
-                    // Allocation fits into this structure.
-                    if(dstOffset + size <= m_FreeSpaces[i].offset + m_FreeSpaces[i].size)
-                    {
-                        const VkDeviceSize freeSpaceAfter = (m_FreeSpaces[i].offset + m_FreeSpaces[i].size) -
-                            (dstOffset + size);
-                        if(bestIndex == SIZE_MAX || freeSpaceAfter > bestFreeSpaceAfter)
-                        {
-                            bestIndex = i;
-                            bestFreeSpaceAfter = freeSpaceAfter;
-                        }
-                    }
-                }
-            }
-            
-            if(bestIndex != SIZE_MAX)
-            {
-                outBlockInfoIndex = m_FreeSpaces[bestIndex].blockInfoIndex;
-                outDstOffset = VmaAlignUp(m_FreeSpaces[bestIndex].offset, alignment);
-
-                if(bestFreeSpaceAfter >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)
-                {
-                    // Leave this structure for remaining empty space.
-                    const VkDeviceSize alignmentPlusSize = (outDstOffset - m_FreeSpaces[bestIndex].offset) + size;
-                    m_FreeSpaces[bestIndex].offset += alignmentPlusSize;
-                    m_FreeSpaces[bestIndex].size -= alignmentPlusSize;
-                }
-                else
-                {
-                    // This structure becomes invalid.
-                    m_FreeSpaces[bestIndex].blockInfoIndex = SIZE_MAX;
-                }
-
-                return true;
-            }
-
-            return false;
-        }
-
-    private:
-        static const size_t MAX_COUNT = 4;
-
-        struct FreeSpace
-        {
-            size_t blockInfoIndex; // SIZE_MAX means this structure is invalid.
-            VkDeviceSize offset;
-            VkDeviceSize size;
-        } m_FreeSpaces[MAX_COUNT];
-    };
-
-    const bool m_OverlappingMoveSupported;
-
-    uint32_t m_AllocationCount;
-    bool m_AllAllocations;
-
-    VkDeviceSize m_BytesMoved;
-    uint32_t m_AllocationsMoved;
-
-    VmaVector< BlockInfo, VmaStlAllocator<BlockInfo> > m_BlockInfos;
-
-    void PreprocessMetadata();
-    void PostprocessMetadata();
-    void InsertSuballoc(VmaBlockMetadata_Generic* pMetadata, const VmaSuballocation& suballoc);
-};
-
-struct VmaBlockDefragmentationContext
-{
-    enum BLOCK_FLAG
-    {
-        BLOCK_FLAG_USED = 0x00000001,
-    };
-    uint32_t flags;
-    VkBuffer hBuffer;
-};
-
-class VmaBlockVectorDefragmentationContext
-{
-    VMA_CLASS_NO_COPY(VmaBlockVectorDefragmentationContext)
-public:
-    VkResult res;
-    bool mutexLocked;
-    VmaVector< VmaBlockDefragmentationContext, VmaStlAllocator<VmaBlockDefragmentationContext> > blockContexts;
-    VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> > defragmentationMoves;
-    uint32_t defragmentationMovesProcessed;
-    uint32_t defragmentationMovesCommitted;
-    bool hasDefragmentationPlan;
-
-    VmaBlockVectorDefragmentationContext(
-        VmaAllocator hAllocator,
-        VmaPool hCustomPool, // Optional.
-        VmaBlockVector* pBlockVector,
-        uint32_t currFrameIndex);
-    ~VmaBlockVectorDefragmentationContext();
-
-    VmaPool GetCustomPool() const { return m_hCustomPool; }
-    VmaBlockVector* GetBlockVector() const { return m_pBlockVector; }
-    VmaDefragmentationAlgorithm* GetAlgorithm() const { return m_pAlgorithm; }
-
-    void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged);
-    void AddAll() { m_AllAllocations = true; }
-
-    void Begin(bool overlappingMoveSupported, VmaDefragmentationFlags flags);
-
-private:
-    const VmaAllocator m_hAllocator;
-    // Null if not from custom pool.
-    const VmaPool m_hCustomPool;
-    // Redundant, for convenience not to fetch from m_hCustomPool->m_BlockVector or m_hAllocator->m_pBlockVectors.
-    VmaBlockVector* const m_pBlockVector;
-    const uint32_t m_CurrFrameIndex;
-    // Owner of this object.
-    VmaDefragmentationAlgorithm* m_pAlgorithm;
-
-    struct AllocInfo
-    {
-        VmaAllocation hAlloc;
-        VkBool32* pChanged;
-    };
-    // Used between constructor and Begin.
-    VmaVector< AllocInfo, VmaStlAllocator<AllocInfo> > m_Allocations;
-    bool m_AllAllocations;
-};
-
-struct VmaDefragmentationContext_T
-{
-private:
-    VMA_CLASS_NO_COPY(VmaDefragmentationContext_T)
-public:
-    VmaDefragmentationContext_T(
-        VmaAllocator hAllocator,
-        uint32_t currFrameIndex,
-        uint32_t flags,
-        VmaDefragmentationStats* pStats);
-    ~VmaDefragmentationContext_T();
-
-    void AddPools(uint32_t poolCount, const VmaPool* pPools);
-    void AddAllocations(
-        uint32_t allocationCount,
-        const VmaAllocation* pAllocations,
-        VkBool32* pAllocationsChanged);
-
-    /*
-    Returns:
-    - `VK_SUCCESS` if succeeded and object can be destroyed immediately.
-    - `VK_NOT_READY` if succeeded but the object must remain alive until vmaDefragmentationEnd().
-    - Negative value if error occured and object can be destroyed immediately.
-    */
-    VkResult Defragment(
-        VkDeviceSize maxCpuBytesToMove, uint32_t maxCpuAllocationsToMove,
-        VkDeviceSize maxGpuBytesToMove, uint32_t maxGpuAllocationsToMove,
-        VkCommandBuffer commandBuffer, VmaDefragmentationStats* pStats, VmaDefragmentationFlags flags);
-
-    VkResult DefragmentPassBegin(VmaDefragmentationPassInfo* pInfo);
-    VkResult DefragmentPassEnd();
-
-private:
-    const VmaAllocator m_hAllocator;
-    const uint32_t m_CurrFrameIndex;
-    const uint32_t m_Flags;
-    VmaDefragmentationStats* const m_pStats;
-
-    VkDeviceSize m_MaxCpuBytesToMove;
-    uint32_t m_MaxCpuAllocationsToMove;
-    VkDeviceSize m_MaxGpuBytesToMove;
-    uint32_t m_MaxGpuAllocationsToMove;
-
-    // Owner of these objects.
-    VmaBlockVectorDefragmentationContext* m_DefaultPoolContexts[VK_MAX_MEMORY_TYPES];
-    // Owner of these objects.
-    VmaVector< VmaBlockVectorDefragmentationContext*, VmaStlAllocator<VmaBlockVectorDefragmentationContext*> > m_CustomPoolContexts;
-};
-
-#if VMA_RECORDING_ENABLED
-
-class VmaRecorder
-{
-public:
-    VmaRecorder();
-    VkResult Init(const VmaRecordSettings& settings, bool useMutex);
-    void WriteConfiguration(
-        const VkPhysicalDeviceProperties& devProps,
-        const VkPhysicalDeviceMemoryProperties& memProps,
-        uint32_t vulkanApiVersion,
-        bool dedicatedAllocationExtensionEnabled,
-        bool bindMemory2ExtensionEnabled,
-        bool memoryBudgetExtensionEnabled,
-        bool deviceCoherentMemoryExtensionEnabled);
-    ~VmaRecorder();
-
-    void RecordCreateAllocator(uint32_t frameIndex);
-    void RecordDestroyAllocator(uint32_t frameIndex);
-    void RecordCreatePool(uint32_t frameIndex,
-        const VmaPoolCreateInfo& createInfo,
-        VmaPool pool);
-    void RecordDestroyPool(uint32_t frameIndex, VmaPool pool);
-    void RecordAllocateMemory(uint32_t frameIndex,
-        const VkMemoryRequirements& vkMemReq,
-        const VmaAllocationCreateInfo& createInfo,
-        VmaAllocation allocation);
-    void RecordAllocateMemoryPages(uint32_t frameIndex,
-        const VkMemoryRequirements& vkMemReq,
-        const VmaAllocationCreateInfo& createInfo,
-        uint64_t allocationCount,
-        const VmaAllocation* pAllocations);
-    void RecordAllocateMemoryForBuffer(uint32_t frameIndex,
-        const VkMemoryRequirements& vkMemReq,
-        bool requiresDedicatedAllocation,
-        bool prefersDedicatedAllocation,
-        const VmaAllocationCreateInfo& createInfo,
-        VmaAllocation allocation);
-    void RecordAllocateMemoryForImage(uint32_t frameIndex,
-        const VkMemoryRequirements& vkMemReq,
-        bool requiresDedicatedAllocation,
-        bool prefersDedicatedAllocation,
-        const VmaAllocationCreateInfo& createInfo,
-        VmaAllocation allocation);
-    void RecordFreeMemory(uint32_t frameIndex,
-        VmaAllocation allocation);
-    void RecordFreeMemoryPages(uint32_t frameIndex,
-        uint64_t allocationCount,
-        const VmaAllocation* pAllocations);
-    void RecordSetAllocationUserData(uint32_t frameIndex,
-        VmaAllocation allocation,
-        const void* pUserData);
-    void RecordCreateLostAllocation(uint32_t frameIndex,
-        VmaAllocation allocation);
-    void RecordMapMemory(uint32_t frameIndex,
-        VmaAllocation allocation);
-    void RecordUnmapMemory(uint32_t frameIndex,
-        VmaAllocation allocation);
-    void RecordFlushAllocation(uint32_t frameIndex,
-        VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size);
-    void RecordInvalidateAllocation(uint32_t frameIndex,
-        VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size);
-    void RecordCreateBuffer(uint32_t frameIndex,
-        const VkBufferCreateInfo& bufCreateInfo,
-        const VmaAllocationCreateInfo& allocCreateInfo,
-        VmaAllocation allocation);
-    void RecordCreateImage(uint32_t frameIndex,
-        const VkImageCreateInfo& imageCreateInfo,
-        const VmaAllocationCreateInfo& allocCreateInfo,
-        VmaAllocation allocation);
-    void RecordDestroyBuffer(uint32_t frameIndex,
-        VmaAllocation allocation);
-    void RecordDestroyImage(uint32_t frameIndex,
-        VmaAllocation allocation);
-    void RecordTouchAllocation(uint32_t frameIndex,
-        VmaAllocation allocation);
-    void RecordGetAllocationInfo(uint32_t frameIndex,
-        VmaAllocation allocation);
-    void RecordMakePoolAllocationsLost(uint32_t frameIndex,
-        VmaPool pool);
-    void RecordDefragmentationBegin(uint32_t frameIndex,
-        const VmaDefragmentationInfo2& info,
-        VmaDefragmentationContext ctx);
-    void RecordDefragmentationEnd(uint32_t frameIndex,
-        VmaDefragmentationContext ctx);
-    void RecordSetPoolName(uint32_t frameIndex,
-        VmaPool pool,
-        const char* name);
-
-private:
-    struct CallParams
-    {
-        uint32_t threadId;
-        double time;
-    };
-
-    class UserDataString
-    {
-    public:
-        UserDataString(VmaAllocationCreateFlags allocFlags, const void* pUserData);
-        const char* GetString() const { return m_Str; }
-
-    private:
-        char m_PtrStr[17];
-        const char* m_Str;
-    };
-
-    bool m_UseMutex;
-    VmaRecordFlags m_Flags;
-    FILE* m_File;
-    VMA_MUTEX m_FileMutex;
-    int64_t m_Freq;
-    int64_t m_StartCounter;
-
-    void GetBasicParams(CallParams& outParams);
-
-    // T must be a pointer type, e.g. VmaAllocation, VmaPool.
-    template<typename T>
-    void PrintPointerList(uint64_t count, const T* pItems)
-    {
-        if(count)
-        {
-            fprintf(m_File, "%p", pItems[0]);
-            for(uint64_t i = 1; i < count; ++i)
-            {
-                fprintf(m_File, " %p", pItems[i]);
-            }
-        }
-    }
-
-    void PrintPointerList(uint64_t count, const VmaAllocation* pItems);
-    void Flush();
-};
-
-#endif // #if VMA_RECORDING_ENABLED
-
-/*
-Thread-safe wrapper over VmaPoolAllocator free list, for allocation of VmaAllocation_T objects.
-*/
-class VmaAllocationObjectAllocator
-{
-    VMA_CLASS_NO_COPY(VmaAllocationObjectAllocator)
-public:
-    VmaAllocationObjectAllocator(const VkAllocationCallbacks* pAllocationCallbacks);
-
-    template<typename... Types> VmaAllocation Allocate(Types... args);
-    void Free(VmaAllocation hAlloc);
-
-private:
-    VMA_MUTEX m_Mutex;
-    VmaPoolAllocator<VmaAllocation_T> m_Allocator;
-};
-
-struct VmaCurrentBudgetData
-{
-    VMA_ATOMIC_UINT64 m_BlockBytes[VK_MAX_MEMORY_HEAPS];
-    VMA_ATOMIC_UINT64 m_AllocationBytes[VK_MAX_MEMORY_HEAPS];
-
-#if VMA_MEMORY_BUDGET
-    VMA_ATOMIC_UINT32 m_OperationsSinceBudgetFetch;
-    VMA_RW_MUTEX m_BudgetMutex;
-    uint64_t m_VulkanUsage[VK_MAX_MEMORY_HEAPS];
-    uint64_t m_VulkanBudget[VK_MAX_MEMORY_HEAPS];
-    uint64_t m_BlockBytesAtBudgetFetch[VK_MAX_MEMORY_HEAPS];
-#endif // #if VMA_MEMORY_BUDGET
-
-    VmaCurrentBudgetData()
-    {
-        for(uint32_t heapIndex = 0; heapIndex < VK_MAX_MEMORY_HEAPS; ++heapIndex)
-        {
-            m_BlockBytes[heapIndex] = 0;
-            m_AllocationBytes[heapIndex] = 0;
-#if VMA_MEMORY_BUDGET
-            m_VulkanUsage[heapIndex] = 0;
-            m_VulkanBudget[heapIndex] = 0;
-            m_BlockBytesAtBudgetFetch[heapIndex] = 0;
-#endif
-        }
-
-#if VMA_MEMORY_BUDGET
-        m_OperationsSinceBudgetFetch = 0;
-#endif
-    }
-
-    void AddAllocation(uint32_t heapIndex, VkDeviceSize allocationSize)
-    {
-        m_AllocationBytes[heapIndex] += allocationSize;
-#if VMA_MEMORY_BUDGET
-        ++m_OperationsSinceBudgetFetch;
-#endif
-    }
-
-    void RemoveAllocation(uint32_t heapIndex, VkDeviceSize allocationSize)
-    {
-        VMA_ASSERT(m_AllocationBytes[heapIndex] >= allocationSize); // DELME
-        m_AllocationBytes[heapIndex] -= allocationSize;
-#if VMA_MEMORY_BUDGET
-        ++m_OperationsSinceBudgetFetch;
-#endif
-    }
-};
-
-// Main allocator object.
-struct VmaAllocator_T
-{
-    VMA_CLASS_NO_COPY(VmaAllocator_T)
-public:
-    bool m_UseMutex;
-    uint32_t m_VulkanApiVersion;
-    bool m_UseKhrDedicatedAllocation; // Can be set only if m_VulkanApiVersion < VK_MAKE_VERSION(1, 1, 0).
-    bool m_UseKhrBindMemory2; // Can be set only if m_VulkanApiVersion < VK_MAKE_VERSION(1, 1, 0).
-    bool m_UseExtMemoryBudget;
-    bool m_UseAmdDeviceCoherentMemory;
-    bool m_UseKhrBufferDeviceAddress;
-    VkDevice m_hDevice;
-    VkInstance m_hInstance;
-    bool m_AllocationCallbacksSpecified;
-    VkAllocationCallbacks m_AllocationCallbacks;
-    VmaDeviceMemoryCallbacks m_DeviceMemoryCallbacks;
-    VmaAllocationObjectAllocator m_AllocationObjectAllocator;
-    
-    // Each bit (1 << i) is set if HeapSizeLimit is enabled for that heap, so cannot allocate more than the heap size.
-    uint32_t m_HeapSizeLimitMask;
-
-    VkPhysicalDeviceProperties m_PhysicalDeviceProperties;
-    VkPhysicalDeviceMemoryProperties m_MemProps;
-
-    // Default pools.
-    VmaBlockVector* m_pBlockVectors[VK_MAX_MEMORY_TYPES];
-
-    // Each vector is sorted by memory (handle value).
-    typedef VmaVector< VmaAllocation, VmaStlAllocator<VmaAllocation> > AllocationVectorType;
-    AllocationVectorType* m_pDedicatedAllocations[VK_MAX_MEMORY_TYPES];
-    VMA_RW_MUTEX m_DedicatedAllocationsMutex[VK_MAX_MEMORY_TYPES];
-
-    VmaCurrentBudgetData m_Budget;
-
-    VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo);
-    VkResult Init(const VmaAllocatorCreateInfo* pCreateInfo);
-    ~VmaAllocator_T();
-
-    const VkAllocationCallbacks* GetAllocationCallbacks() const
-    {
-        return m_AllocationCallbacksSpecified ? &m_AllocationCallbacks : 0;
-    }
-    const VmaVulkanFunctions& GetVulkanFunctions() const
-    {
-        return m_VulkanFunctions;
-    }
-
-    VkPhysicalDevice GetPhysicalDevice() const { return m_PhysicalDevice; }
-
-    VkDeviceSize GetBufferImageGranularity() const
-    {
-        return VMA_MAX(
-            static_cast<VkDeviceSize>(VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY),
-            m_PhysicalDeviceProperties.limits.bufferImageGranularity);
-    }
-
-    uint32_t GetMemoryHeapCount() const { return m_MemProps.memoryHeapCount; }
-    uint32_t GetMemoryTypeCount() const { return m_MemProps.memoryTypeCount; }
-
-    uint32_t MemoryTypeIndexToHeapIndex(uint32_t memTypeIndex) const
-    {
-        VMA_ASSERT(memTypeIndex < m_MemProps.memoryTypeCount);
-        return m_MemProps.memoryTypes[memTypeIndex].heapIndex;
-    }
-    // True when specific memory type is HOST_VISIBLE but not HOST_COHERENT.
-    bool IsMemoryTypeNonCoherent(uint32_t memTypeIndex) const
-    {
-        return (m_MemProps.memoryTypes[memTypeIndex].propertyFlags & (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) ==
-            VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
-    }
-    // Minimum alignment for all allocations in specific memory type.
-    VkDeviceSize GetMemoryTypeMinAlignment(uint32_t memTypeIndex) const
-    {
-        return IsMemoryTypeNonCoherent(memTypeIndex) ?
-            VMA_MAX((VkDeviceSize)VMA_DEBUG_ALIGNMENT, m_PhysicalDeviceProperties.limits.nonCoherentAtomSize) :
-            (VkDeviceSize)VMA_DEBUG_ALIGNMENT;
-    }
-
-    bool IsIntegratedGpu() const
-    {
-        return m_PhysicalDeviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;
-    }
-
-    uint32_t GetGlobalMemoryTypeBits() const { return m_GlobalMemoryTypeBits; }
-
-#if VMA_RECORDING_ENABLED
-    VmaRecorder* GetRecorder() const { return m_pRecorder; }
-#endif
-
-    void GetBufferMemoryRequirements(
-        VkBuffer hBuffer,
-        VkMemoryRequirements& memReq,
-        bool& requiresDedicatedAllocation,
-        bool& prefersDedicatedAllocation) const;
-    void GetImageMemoryRequirements(
-        VkImage hImage,
-        VkMemoryRequirements& memReq,
-        bool& requiresDedicatedAllocation,
-        bool& prefersDedicatedAllocation) const;
-
-    // Main allocation function.
-    VkResult AllocateMemory(
-        const VkMemoryRequirements& vkMemReq,
-        bool requiresDedicatedAllocation,
-        bool prefersDedicatedAllocation,
-        VkBuffer dedicatedBuffer,
-        VkBufferUsageFlags dedicatedBufferUsage, // UINT32_MAX when unknown.
-        VkImage dedicatedImage,
-        const VmaAllocationCreateInfo& createInfo,
-        VmaSuballocationType suballocType,
-        size_t allocationCount,
-        VmaAllocation* pAllocations);
-
-    // Main deallocation function.
-    void FreeMemory(
-        size_t allocationCount,
-        const VmaAllocation* pAllocations);
-
-    VkResult ResizeAllocation(
-        const VmaAllocation alloc,
-        VkDeviceSize newSize);
-
-    void CalculateStats(VmaStats* pStats);
-
-    void GetBudget(
-        VmaBudget* outBudget, uint32_t firstHeap, uint32_t heapCount);
-
-#if VMA_STATS_STRING_ENABLED
-    void PrintDetailedMap(class VmaJsonWriter& json);
-#endif
-
-    VkResult DefragmentationBegin(
-        const VmaDefragmentationInfo2& info,
-        VmaDefragmentationStats* pStats,
-        VmaDefragmentationContext* pContext);
-    VkResult DefragmentationEnd(
-        VmaDefragmentationContext context);
-
-    VkResult DefragmentationPassBegin(
-        VmaDefragmentationPassInfo* pInfo,
-        VmaDefragmentationContext context);
-    VkResult DefragmentationPassEnd(
-        VmaDefragmentationContext context);
-
-    void GetAllocationInfo(VmaAllocation hAllocation, VmaAllocationInfo* pAllocationInfo);
-    bool TouchAllocation(VmaAllocation hAllocation);
-
-    VkResult CreatePool(const VmaPoolCreateInfo* pCreateInfo, VmaPool* pPool);
-    void DestroyPool(VmaPool pool);
-    void GetPoolStats(VmaPool pool, VmaPoolStats* pPoolStats);
-
-    void SetCurrentFrameIndex(uint32_t frameIndex);
-    uint32_t GetCurrentFrameIndex() const { return m_CurrentFrameIndex.load(); }
-
-    void MakePoolAllocationsLost(
-        VmaPool hPool,
-        size_t* pLostAllocationCount);
-    VkResult CheckPoolCorruption(VmaPool hPool);
-    VkResult CheckCorruption(uint32_t memoryTypeBits);
-
-    void CreateLostAllocation(VmaAllocation* pAllocation);
-
-    // Call to Vulkan function vkAllocateMemory with accompanying bookkeeping.
-    VkResult AllocateVulkanMemory(const VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory);
-    // Call to Vulkan function vkFreeMemory with accompanying bookkeeping.
-    void FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, VkDeviceMemory hMemory);
-    // Call to Vulkan function vkBindBufferMemory or vkBindBufferMemory2KHR.
-    VkResult BindVulkanBuffer(
-        VkDeviceMemory memory,
-        VkDeviceSize memoryOffset,
-        VkBuffer buffer,
-        const void* pNext);
-    // Call to Vulkan function vkBindImageMemory or vkBindImageMemory2KHR.
-    VkResult BindVulkanImage(
-        VkDeviceMemory memory,
-        VkDeviceSize memoryOffset,
-        VkImage image,
-        const void* pNext);
-
-    VkResult Map(VmaAllocation hAllocation, void** ppData);
-    void Unmap(VmaAllocation hAllocation);
-
-    VkResult BindBufferMemory(
-        VmaAllocation hAllocation,
-        VkDeviceSize allocationLocalOffset,
-        VkBuffer hBuffer,
-        const void* pNext);
-    VkResult BindImageMemory(
-        VmaAllocation hAllocation,
-        VkDeviceSize allocationLocalOffset,
-        VkImage hImage,
-        const void* pNext);
-
-    VkResult FlushOrInvalidateAllocation(
-        VmaAllocation hAllocation,
-        VkDeviceSize offset, VkDeviceSize size,
-        VMA_CACHE_OPERATION op);
-
-    void FillAllocation(const VmaAllocation hAllocation, uint8_t pattern);
-
-    /*
-    Returns bit mask of memory types that can support defragmentation on GPU as
-    they support creation of required buffer for copy operations.
-    */
-    uint32_t GetGpuDefragmentationMemoryTypeBits();
-
-private:
-    VkDeviceSize m_PreferredLargeHeapBlockSize;
-
-    VkPhysicalDevice m_PhysicalDevice;
-    VMA_ATOMIC_UINT32 m_CurrentFrameIndex;
-    VMA_ATOMIC_UINT32 m_GpuDefragmentationMemoryTypeBits; // UINT32_MAX means uninitialized.
-    
-    VMA_RW_MUTEX m_PoolsMutex;
-    // Protected by m_PoolsMutex. Sorted by pointer value.
-    VmaVector<VmaPool, VmaStlAllocator<VmaPool> > m_Pools;
-    uint32_t m_NextPoolId;
-
-    VmaVulkanFunctions m_VulkanFunctions;
-
-    // Global bit mask AND-ed with any memoryTypeBits to disallow certain memory types.
-    uint32_t m_GlobalMemoryTypeBits;
-
-#if VMA_RECORDING_ENABLED
-    VmaRecorder* m_pRecorder;
-#endif
-
-    void ImportVulkanFunctions(const VmaVulkanFunctions* pVulkanFunctions);
-
-#if VMA_STATIC_VULKAN_FUNCTIONS == 1
-    void ImportVulkanFunctions_Static();
-#endif
-
-    void ImportVulkanFunctions_Custom(const VmaVulkanFunctions* pVulkanFunctions);
-
-#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1
-    void ImportVulkanFunctions_Dynamic();
-#endif
-
-    void ValidateVulkanFunctions();
-
-    VkDeviceSize CalcPreferredBlockSize(uint32_t memTypeIndex);
-
-    VkResult AllocateMemoryOfType(
-        VkDeviceSize size,
-        VkDeviceSize alignment,
-        bool dedicatedAllocation,
-        VkBuffer dedicatedBuffer,
-        VkBufferUsageFlags dedicatedBufferUsage,
-        VkImage dedicatedImage,
-        const VmaAllocationCreateInfo& createInfo,
-        uint32_t memTypeIndex,
-        VmaSuballocationType suballocType,
-        size_t allocationCount,
-        VmaAllocation* pAllocations);
-
-    // Helper function only to be used inside AllocateDedicatedMemory.
-    VkResult AllocateDedicatedMemoryPage(
-        VkDeviceSize size,
-        VmaSuballocationType suballocType,
-        uint32_t memTypeIndex,
-        const VkMemoryAllocateInfo& allocInfo,
-        bool map,
-        bool isUserDataString,
-        void* pUserData,
-        VmaAllocation* pAllocation);
-
-    // Allocates and registers new VkDeviceMemory specifically for dedicated allocations.
-    VkResult AllocateDedicatedMemory(
-        VkDeviceSize size,
-        VmaSuballocationType suballocType,
-        uint32_t memTypeIndex,
-        bool withinBudget,
-        bool map,
-        bool isUserDataString,
-        void* pUserData,
-        VkBuffer dedicatedBuffer,
-        VkBufferUsageFlags dedicatedBufferUsage,
-        VkImage dedicatedImage,
-        size_t allocationCount,
-        VmaAllocation* pAllocations);
-
-    void FreeDedicatedMemory(const VmaAllocation allocation);
-
-    /*
-    Calculates and returns bit mask of memory types that can support defragmentation
-    on GPU as they support creation of required buffer for copy operations.
-    */
-    uint32_t CalculateGpuDefragmentationMemoryTypeBits() const;
-
-    uint32_t CalculateGlobalMemoryTypeBits() const;
-
-#if VMA_MEMORY_BUDGET
-    void UpdateVulkanBudget();
-#endif // #if VMA_MEMORY_BUDGET
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// Memory allocation #2 after VmaAllocator_T definition
-
-static void* VmaMalloc(VmaAllocator hAllocator, size_t size, size_t alignment)
-{
-    return VmaMalloc(&hAllocator->m_AllocationCallbacks, size, alignment);
-}
-
-static void VmaFree(VmaAllocator hAllocator, void* ptr)
-{
-    VmaFree(&hAllocator->m_AllocationCallbacks, ptr);
-}
-
-template<typename T>
-static T* VmaAllocate(VmaAllocator hAllocator)
-{
-    return (T*)VmaMalloc(hAllocator, sizeof(T), VMA_ALIGN_OF(T));
-}
-
-template<typename T>
-static T* VmaAllocateArray(VmaAllocator hAllocator, size_t count)
-{
-    return (T*)VmaMalloc(hAllocator, sizeof(T) * count, VMA_ALIGN_OF(T));
-}
-
-template<typename T>
-static void vma_delete(VmaAllocator hAllocator, T* ptr)
-{
-    if(ptr != VMA_NULL)
-    {
-        ptr->~T();
-        VmaFree(hAllocator, ptr);
-    }
-}
-
-template<typename T>
-static void vma_delete_array(VmaAllocator hAllocator, T* ptr, size_t count)
-{
-    if(ptr != VMA_NULL)
-    {
-        for(size_t i = count; i--; )
-            ptr[i].~T();
-        VmaFree(hAllocator, ptr);
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VmaStringBuilder
-
-#if VMA_STATS_STRING_ENABLED
-
-class VmaStringBuilder
-{
-public:
-    VmaStringBuilder(VmaAllocator alloc) : m_Data(VmaStlAllocator<char>(alloc->GetAllocationCallbacks())) { }
-    size_t GetLength() const { return m_Data.size(); }
-    const char* GetData() const { return m_Data.data(); }
-
-    void Add(char ch) { m_Data.push_back(ch); }
-    void Add(const char* pStr);
-    void AddNewLine() { Add('\n'); }
-    void AddNumber(uint32_t num);
-    void AddNumber(uint64_t num);
-    void AddPointer(const void* ptr);
-
-private:
-    VmaVector< char, VmaStlAllocator<char> > m_Data;
-};
-
-void VmaStringBuilder::Add(const char* pStr)
-{
-    const size_t strLen = strlen(pStr);
-    if(strLen > 0)
-    {
-        const size_t oldCount = m_Data.size();
-        m_Data.resize(oldCount + strLen);
-        memcpy(m_Data.data() + oldCount, pStr, strLen);
-    }
-}
-
-void VmaStringBuilder::AddNumber(uint32_t num)
-{
-    char buf[11];
-    buf[10] = '\0';
-    char *p = &buf[10];
-    do
-    {
-        *--p = '0' + (num % 10);
-        num /= 10;
-    }
-    while(num);
-    Add(p);
-}
-
-void VmaStringBuilder::AddNumber(uint64_t num)
-{
-    char buf[21];
-    buf[20] = '\0';
-    char *p = &buf[20];
-    do
-    {
-        *--p = '0' + (num % 10);
-        num /= 10;
-    }
-    while(num);
-    Add(p);
-}
-
-void VmaStringBuilder::AddPointer(const void* ptr)
-{
-    char buf[21];
-    VmaPtrToStr(buf, sizeof(buf), ptr);
-    Add(buf);
-}
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-////////////////////////////////////////////////////////////////////////////////
-// VmaJsonWriter
-
-#if VMA_STATS_STRING_ENABLED
-
-class VmaJsonWriter
-{
-    VMA_CLASS_NO_COPY(VmaJsonWriter)
-public:
-    VmaJsonWriter(const VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder& sb);
-    ~VmaJsonWriter();
-
-    void BeginObject(bool singleLine = false);
-    void EndObject();
-    
-    void BeginArray(bool singleLine = false);
-    void EndArray();
-    
-    void WriteString(const char* pStr);
-    void BeginString(const char* pStr = VMA_NULL);
-    void ContinueString(const char* pStr);
-    void ContinueString(uint32_t n);
-    void ContinueString(uint64_t n);
-    void ContinueString_Pointer(const void* ptr);
-    void EndString(const char* pStr = VMA_NULL);
-    
-    void WriteNumber(uint32_t n);
-    void WriteNumber(uint64_t n);
-    void WriteBool(bool b);
-    void WriteNull();
-
-private:
-    static const char* const INDENT;
-
-    enum COLLECTION_TYPE
-    {
-        COLLECTION_TYPE_OBJECT,
-        COLLECTION_TYPE_ARRAY,
-    };
-    struct StackItem
-    {
-        COLLECTION_TYPE type;
-        uint32_t valueCount;
-        bool singleLineMode;
-    };
-
-    VmaStringBuilder& m_SB;
-    VmaVector< StackItem, VmaStlAllocator<StackItem> > m_Stack;
-    bool m_InsideString;
-
-    void BeginValue(bool isString);
-    void WriteIndent(bool oneLess = false);
-};
-
-const char* const VmaJsonWriter::INDENT = "  ";
-
-VmaJsonWriter::VmaJsonWriter(const VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder& sb) :
-    m_SB(sb),
-    m_Stack(VmaStlAllocator<StackItem>(pAllocationCallbacks)),
-    m_InsideString(false)
-{
-}
-
-VmaJsonWriter::~VmaJsonWriter()
-{
-    VMA_ASSERT(!m_InsideString);
-    VMA_ASSERT(m_Stack.empty());
-}
-
-void VmaJsonWriter::BeginObject(bool singleLine)
-{
-    VMA_ASSERT(!m_InsideString);
-
-    BeginValue(false);
-    m_SB.Add('{');
-
-    StackItem item;
-    item.type = COLLECTION_TYPE_OBJECT;
-    item.valueCount = 0;
-    item.singleLineMode = singleLine;
-    m_Stack.push_back(item);
-}
-
-void VmaJsonWriter::EndObject()
-{
-    VMA_ASSERT(!m_InsideString);
-
-    WriteIndent(true);
-    m_SB.Add('}');
-
-    VMA_ASSERT(!m_Stack.empty() && m_Stack.back().type == COLLECTION_TYPE_OBJECT);
-    m_Stack.pop_back();
-}
-
-void VmaJsonWriter::BeginArray(bool singleLine)
-{
-    VMA_ASSERT(!m_InsideString);
-
-    BeginValue(false);
-    m_SB.Add('[');
-
-    StackItem item;
-    item.type = COLLECTION_TYPE_ARRAY;
-    item.valueCount = 0;
-    item.singleLineMode = singleLine;
-    m_Stack.push_back(item);
-}
-
-void VmaJsonWriter::EndArray()
-{
-    VMA_ASSERT(!m_InsideString);
-
-    WriteIndent(true);
-    m_SB.Add(']');
-
-    VMA_ASSERT(!m_Stack.empty() && m_Stack.back().type == COLLECTION_TYPE_ARRAY);
-    m_Stack.pop_back();
-}
-
-void VmaJsonWriter::WriteString(const char* pStr)
-{
-    BeginString(pStr);
-    EndString();
-}
-
-void VmaJsonWriter::BeginString(const char* pStr)
-{
-    VMA_ASSERT(!m_InsideString);
-
-    BeginValue(true);
-    m_SB.Add('"');
-    m_InsideString = true;
-    if(pStr != VMA_NULL && pStr[0] != '\0')
-    {
-        ContinueString(pStr);
-    }
-}
-
-void VmaJsonWriter::ContinueString(const char* pStr)
-{
-    VMA_ASSERT(m_InsideString);
-
-    const size_t strLen = strlen(pStr);
-    for(size_t i = 0; i < strLen; ++i)
-    {
-        char ch = pStr[i];
-        if(ch == '\\')
-        {
-            m_SB.Add("\\\\");
-        }
-        else if(ch == '"')
-        {
-            m_SB.Add("\\\"");
-        }
-        else if(ch >= 32)
-        {
-            m_SB.Add(ch);
-        }
-        else switch(ch)
-        {
-        case '\b':
-            m_SB.Add("\\b");
-            break;
-        case '\f':
-            m_SB.Add("\\f");
-            break;
-        case '\n':
-            m_SB.Add("\\n");
-            break;
-        case '\r':
-            m_SB.Add("\\r");
-            break;
-        case '\t':
-            m_SB.Add("\\t");
-            break;
-        default:
-            VMA_ASSERT(0 && "Character not currently supported.");
-            break;
-        }
-    }
-}
-
-void VmaJsonWriter::ContinueString(uint32_t n)
-{
-    VMA_ASSERT(m_InsideString);
-    m_SB.AddNumber(n);
-}
-
-void VmaJsonWriter::ContinueString(uint64_t n)
-{
-    VMA_ASSERT(m_InsideString);
-    m_SB.AddNumber(n);
-}
-
-void VmaJsonWriter::ContinueString_Pointer(const void* ptr)
-{
-    VMA_ASSERT(m_InsideString);
-    m_SB.AddPointer(ptr);
-}
-
-void VmaJsonWriter::EndString(const char* pStr)
-{
-    VMA_ASSERT(m_InsideString);
-    if(pStr != VMA_NULL && pStr[0] != '\0')
-    {
-        ContinueString(pStr);
-    }
-    m_SB.Add('"');
-    m_InsideString = false;
-}
-
-void VmaJsonWriter::WriteNumber(uint32_t n)
-{
-    VMA_ASSERT(!m_InsideString);
-    BeginValue(false);
-    m_SB.AddNumber(n);
-}
-
-void VmaJsonWriter::WriteNumber(uint64_t n)
-{
-    VMA_ASSERT(!m_InsideString);
-    BeginValue(false);
-    m_SB.AddNumber(n);
-}
-
-void VmaJsonWriter::WriteBool(bool b)
-{
-    VMA_ASSERT(!m_InsideString);
-    BeginValue(false);
-    m_SB.Add(b ? "true" : "false");
-}
-
-void VmaJsonWriter::WriteNull()
-{
-    VMA_ASSERT(!m_InsideString);
-    BeginValue(false);
-    m_SB.Add("null");
-}
-
-void VmaJsonWriter::BeginValue(bool isString)
-{
-    if(!m_Stack.empty())
-    {
-        StackItem& currItem = m_Stack.back();
-        if(currItem.type == COLLECTION_TYPE_OBJECT &&
-            currItem.valueCount % 2 == 0)
-        {
-            VMA_ASSERT(isString);
-        }
-
-        if(currItem.type == COLLECTION_TYPE_OBJECT &&
-            currItem.valueCount % 2 != 0)
-        {
-            m_SB.Add(": ");
-        }
-        else if(currItem.valueCount > 0)
-        {
-            m_SB.Add(", ");
-            WriteIndent();
-        }
-        else
-        {
-            WriteIndent();
-        }
-        ++currItem.valueCount;
-    }
-}
-
-void VmaJsonWriter::WriteIndent(bool oneLess)
-{
-    if(!m_Stack.empty() && !m_Stack.back().singleLineMode)
-    {
-        m_SB.AddNewLine();
-        
-        size_t count = m_Stack.size();
-        if(count > 0 && oneLess)
-        {
-            --count;
-        }
-        for(size_t i = 0; i < count; ++i)
-        {
-            m_SB.Add(INDENT);
-        }
-    }
-}
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-////////////////////////////////////////////////////////////////////////////////
-
-void VmaAllocation_T::SetUserData(VmaAllocator hAllocator, void* pUserData)
-{
-    if(IsUserDataString())
-    {
-        VMA_ASSERT(pUserData == VMA_NULL || pUserData != m_pUserData);
-
-        FreeUserDataString(hAllocator);
-
-        if(pUserData != VMA_NULL)
-        {
-            m_pUserData = VmaCreateStringCopy(hAllocator->GetAllocationCallbacks(), (const char*)pUserData);
-        }
-    }
-    else
-    {
-        m_pUserData = pUserData;
-    }
-}
-
-void VmaAllocation_T::ChangeBlockAllocation(
-    VmaAllocator hAllocator,
-    VmaDeviceMemoryBlock* block,
-    VkDeviceSize offset)
-{
-    VMA_ASSERT(block != VMA_NULL);
-    VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);
-
-    // Move mapping reference counter from old block to new block.
-    if(block != m_BlockAllocation.m_Block)
-    {
-        uint32_t mapRefCount = m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP;
-        if(IsPersistentMap())
-            ++mapRefCount;
-        m_BlockAllocation.m_Block->Unmap(hAllocator, mapRefCount);
-        block->Map(hAllocator, mapRefCount, VMA_NULL);
-    }
-
-    m_BlockAllocation.m_Block = block;
-    m_BlockAllocation.m_Offset = offset;
-}
-
-void VmaAllocation_T::ChangeOffset(VkDeviceSize newOffset)
-{
-    VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);
-    m_BlockAllocation.m_Offset = newOffset;
-}
-
-VkDeviceSize VmaAllocation_T::GetOffset() const
-{
-    switch(m_Type)
-    {
-    case ALLOCATION_TYPE_BLOCK:
-        return m_BlockAllocation.m_Offset;
-    case ALLOCATION_TYPE_DEDICATED:
-        return 0;
-    default:
-        VMA_ASSERT(0);
-        return 0;
-    }
-}
-
-VkDeviceMemory VmaAllocation_T::GetMemory() const
-{
-    switch(m_Type)
-    {
-    case ALLOCATION_TYPE_BLOCK:
-        return m_BlockAllocation.m_Block->GetDeviceMemory();
-    case ALLOCATION_TYPE_DEDICATED:
-        return m_DedicatedAllocation.m_hMemory;
-    default:
-        VMA_ASSERT(0);
-        return VK_NULL_HANDLE;
-    }
-}
-
-void* VmaAllocation_T::GetMappedData() const
-{
-    switch(m_Type)
-    {
-    case ALLOCATION_TYPE_BLOCK:
-        if(m_MapCount != 0)
-        {
-            void* pBlockData = m_BlockAllocation.m_Block->GetMappedData();
-            VMA_ASSERT(pBlockData != VMA_NULL);
-            return (char*)pBlockData + m_BlockAllocation.m_Offset;
-        }
-        else
-        {
-            return VMA_NULL;
-        }
-        break;
-    case ALLOCATION_TYPE_DEDICATED:
-        VMA_ASSERT((m_DedicatedAllocation.m_pMappedData != VMA_NULL) == (m_MapCount != 0));
-        return m_DedicatedAllocation.m_pMappedData;
-    default:
-        VMA_ASSERT(0);
-        return VMA_NULL;
-    }
-}
-
-bool VmaAllocation_T::CanBecomeLost() const
-{
-    switch(m_Type)
-    {
-    case ALLOCATION_TYPE_BLOCK:
-        return m_BlockAllocation.m_CanBecomeLost;
-    case ALLOCATION_TYPE_DEDICATED:
-        return false;
-    default:
-        VMA_ASSERT(0);
-        return false;
-    }
-}
-
-bool VmaAllocation_T::MakeLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)
-{
-    VMA_ASSERT(CanBecomeLost());
-
-    /*
-    Warning: This is a carefully designed algorithm.
-    Do not modify unless you really know what you're doing :)
-    */
-    uint32_t localLastUseFrameIndex = GetLastUseFrameIndex();
-    for(;;)
-    {
-        if(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)
-        {
-            VMA_ASSERT(0);
-            return false;
-        }
-        else if(localLastUseFrameIndex + frameInUseCount >= currentFrameIndex)
-        {
-            return false;
-        }
-        else // Last use time earlier than current time.
-        {
-            if(CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, VMA_FRAME_INDEX_LOST))
-            {
-                // Setting hAllocation.LastUseFrameIndex atomic to VMA_FRAME_INDEX_LOST is enough to mark it as LOST.
-                // Calling code just needs to unregister this allocation in owning VmaDeviceMemoryBlock.
-                return true;
-            }
-        }
-    }
-}
-
-#if VMA_STATS_STRING_ENABLED
-
-// Correspond to values of enum VmaSuballocationType.
-static const char* VMA_SUBALLOCATION_TYPE_NAMES[] = {
-    "FREE",
-    "UNKNOWN",
-    "BUFFER",
-    "IMAGE_UNKNOWN",
-    "IMAGE_LINEAR",
-    "IMAGE_OPTIMAL",
-};
-
-void VmaAllocation_T::PrintParameters(class VmaJsonWriter& json) const
-{
-    json.WriteString("Type");
-    json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[m_SuballocationType]);
-
-    json.WriteString("Size");
-    json.WriteNumber(m_Size);
-
-    if(m_pUserData != VMA_NULL)
-    {
-        json.WriteString("UserData");
-        if(IsUserDataString())
-        {
-            json.WriteString((const char*)m_pUserData);
-        }
-        else
-        {
-            json.BeginString();
-            json.ContinueString_Pointer(m_pUserData);
-            json.EndString();
-        }
-    }
-
-    json.WriteString("CreationFrameIndex");
-    json.WriteNumber(m_CreationFrameIndex);
-
-    json.WriteString("LastUseFrameIndex");
-    json.WriteNumber(GetLastUseFrameIndex());
-
-    if(m_BufferImageUsage != 0)
-    {
-        json.WriteString("Usage");
-        json.WriteNumber(m_BufferImageUsage);
-    }
-}
-
-#endif
-
-void VmaAllocation_T::FreeUserDataString(VmaAllocator hAllocator)
-{
-    VMA_ASSERT(IsUserDataString());
-    VmaFreeString(hAllocator->GetAllocationCallbacks(), (char*)m_pUserData);
-    m_pUserData = VMA_NULL;
-}
-
-void VmaAllocation_T::BlockAllocMap()
-{
-    VMA_ASSERT(GetType() == ALLOCATION_TYPE_BLOCK);
-
-    if((m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP) < 0x7F)
-    {
-        ++m_MapCount;
-    }
-    else
-    {
-        VMA_ASSERT(0 && "Allocation mapped too many times simultaneously.");
-    }
-}
-
-void VmaAllocation_T::BlockAllocUnmap()
-{
-    VMA_ASSERT(GetType() == ALLOCATION_TYPE_BLOCK);
-
-    if((m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP) != 0)
-    {
-        --m_MapCount;
-    }
-    else
-    {
-        VMA_ASSERT(0 && "Unmapping allocation not previously mapped.");
-    }
-}
-
-VkResult VmaAllocation_T::DedicatedAllocMap(VmaAllocator hAllocator, void** ppData)
-{
-    VMA_ASSERT(GetType() == ALLOCATION_TYPE_DEDICATED);
-
-    if(m_MapCount != 0)
-    {
-        if((m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP) < 0x7F)
-        {
-            VMA_ASSERT(m_DedicatedAllocation.m_pMappedData != VMA_NULL);
-            *ppData = m_DedicatedAllocation.m_pMappedData;
-            ++m_MapCount;
-            return VK_SUCCESS;
-        }
-        else
-        {
-            VMA_ASSERT(0 && "Dedicated allocation mapped too many times simultaneously.");
-            return VK_ERROR_MEMORY_MAP_FAILED;
-        }
-    }
-    else
-    {
-        VkResult result = (*hAllocator->GetVulkanFunctions().vkMapMemory)(
-            hAllocator->m_hDevice,
-            m_DedicatedAllocation.m_hMemory,
-            0, // offset
-            VK_WHOLE_SIZE,
-            0, // flags
-            ppData);
-        if(result == VK_SUCCESS)
-        {
-            m_DedicatedAllocation.m_pMappedData = *ppData;
-            m_MapCount = 1;
-        }
-        return result;
-    }
-}
-
-void VmaAllocation_T::DedicatedAllocUnmap(VmaAllocator hAllocator)
-{
-    VMA_ASSERT(GetType() == ALLOCATION_TYPE_DEDICATED);
-
-    if((m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP) != 0)
-    {
-        --m_MapCount;
-        if(m_MapCount == 0)
-        {
-            m_DedicatedAllocation.m_pMappedData = VMA_NULL;
-            (*hAllocator->GetVulkanFunctions().vkUnmapMemory)(
-                hAllocator->m_hDevice,
-                m_DedicatedAllocation.m_hMemory);
-        }
-    }
-    else
-    {
-        VMA_ASSERT(0 && "Unmapping dedicated allocation not previously mapped.");
-    }
-}
-
-#if VMA_STATS_STRING_ENABLED
-
-static void VmaPrintStatInfo(VmaJsonWriter& json, const VmaStatInfo& stat)
-{
-    json.BeginObject();
-
-    json.WriteString("Blocks");
-    json.WriteNumber(stat.blockCount);
-
-    json.WriteString("Allocations");
-    json.WriteNumber(stat.allocationCount);
-
-    json.WriteString("UnusedRanges");
-    json.WriteNumber(stat.unusedRangeCount);
-
-    json.WriteString("UsedBytes");
-    json.WriteNumber(stat.usedBytes);
-
-    json.WriteString("UnusedBytes");
-    json.WriteNumber(stat.unusedBytes);
-
-    if(stat.allocationCount > 1)
-    {
-        json.WriteString("AllocationSize");
-        json.BeginObject(true);
-        json.WriteString("Min");
-        json.WriteNumber(stat.allocationSizeMin);
-        json.WriteString("Avg");
-        json.WriteNumber(stat.allocationSizeAvg);
-        json.WriteString("Max");
-        json.WriteNumber(stat.allocationSizeMax);
-        json.EndObject();
-    }
-
-    if(stat.unusedRangeCount > 1)
-    {
-        json.WriteString("UnusedRangeSize");
-        json.BeginObject(true);
-        json.WriteString("Min");
-        json.WriteNumber(stat.unusedRangeSizeMin);
-        json.WriteString("Avg");
-        json.WriteNumber(stat.unusedRangeSizeAvg);
-        json.WriteString("Max");
-        json.WriteNumber(stat.unusedRangeSizeMax);
-        json.EndObject();
-    }
-
-    json.EndObject();
-}
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-struct VmaSuballocationItemSizeLess
-{
-    bool operator()(
-        const VmaSuballocationList::iterator lhs,
-        const VmaSuballocationList::iterator rhs) const
-    {
-        return lhs->size < rhs->size;
-    }
-    bool operator()(
-        const VmaSuballocationList::iterator lhs,
-        VkDeviceSize rhsSize) const
-    {
-        return lhs->size < rhsSize;
-    }
-};
-
-
-////////////////////////////////////////////////////////////////////////////////
-// class VmaBlockMetadata
-
-VmaBlockMetadata::VmaBlockMetadata(VmaAllocator hAllocator) :
-    m_Size(0),
-    m_pAllocationCallbacks(hAllocator->GetAllocationCallbacks())
-{
-}
-
-#if VMA_STATS_STRING_ENABLED
-
-void VmaBlockMetadata::PrintDetailedMap_Begin(class VmaJsonWriter& json,
-    VkDeviceSize unusedBytes,
-    size_t allocationCount,
-    size_t unusedRangeCount) const
-{
-    json.BeginObject();
-
-    json.WriteString("TotalBytes");
-    json.WriteNumber(GetSize());
-
-    json.WriteString("UnusedBytes");
-    json.WriteNumber(unusedBytes);
-
-    json.WriteString("Allocations");
-    json.WriteNumber((uint64_t)allocationCount);
-
-    json.WriteString("UnusedRanges");
-    json.WriteNumber((uint64_t)unusedRangeCount);
-
-    json.WriteString("Suballocations");
-    json.BeginArray();
-}
-
-void VmaBlockMetadata::PrintDetailedMap_Allocation(class VmaJsonWriter& json,
-    VkDeviceSize offset,
-    VmaAllocation hAllocation) const
-{
-    json.BeginObject(true);
-        
-    json.WriteString("Offset");
-    json.WriteNumber(offset);
-
-    hAllocation->PrintParameters(json);
-
-    json.EndObject();
-}
-
-void VmaBlockMetadata::PrintDetailedMap_UnusedRange(class VmaJsonWriter& json,
-    VkDeviceSize offset,
-    VkDeviceSize size) const
-{
-    json.BeginObject(true);
-        
-    json.WriteString("Offset");
-    json.WriteNumber(offset);
-
-    json.WriteString("Type");
-    json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[VMA_SUBALLOCATION_TYPE_FREE]);
-
-    json.WriteString("Size");
-    json.WriteNumber(size);
-
-    json.EndObject();
-}
-
-void VmaBlockMetadata::PrintDetailedMap_End(class VmaJsonWriter& json) const
-{
-    json.EndArray();
-    json.EndObject();
-}
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-////////////////////////////////////////////////////////////////////////////////
-// class VmaBlockMetadata_Generic
-
-VmaBlockMetadata_Generic::VmaBlockMetadata_Generic(VmaAllocator hAllocator) :
-    VmaBlockMetadata(hAllocator),
-    m_FreeCount(0),
-    m_SumFreeSize(0),
-    m_Suballocations(VmaStlAllocator<VmaSuballocation>(hAllocator->GetAllocationCallbacks())),
-    m_FreeSuballocationsBySize(VmaStlAllocator<VmaSuballocationList::iterator>(hAllocator->GetAllocationCallbacks()))
-{
-}
-
-VmaBlockMetadata_Generic::~VmaBlockMetadata_Generic()
-{
-}
-
-void VmaBlockMetadata_Generic::Init(VkDeviceSize size)
-{
-    VmaBlockMetadata::Init(size);
-
-    m_FreeCount = 1;
-    m_SumFreeSize = size;
-
-    VmaSuballocation suballoc = {};
-    suballoc.offset = 0;
-    suballoc.size = size;
-    suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;
-    suballoc.hAllocation = VK_NULL_HANDLE;
-
-    VMA_ASSERT(size > VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER);
-    m_Suballocations.push_back(suballoc);
-    VmaSuballocationList::iterator suballocItem = m_Suballocations.end();
-    --suballocItem;
-    m_FreeSuballocationsBySize.push_back(suballocItem);
-}
-
-bool VmaBlockMetadata_Generic::Validate() const
-{
-    VMA_VALIDATE(!m_Suballocations.empty());
-    
-    // Expected offset of new suballocation as calculated from previous ones.
-    VkDeviceSize calculatedOffset = 0;
-    // Expected number of free suballocations as calculated from traversing their list.
-    uint32_t calculatedFreeCount = 0;
-    // Expected sum size of free suballocations as calculated from traversing their list.
-    VkDeviceSize calculatedSumFreeSize = 0;
-    // Expected number of free suballocations that should be registered in
-    // m_FreeSuballocationsBySize calculated from traversing their list.
-    size_t freeSuballocationsToRegister = 0;
-    // True if previous visited suballocation was free.
-    bool prevFree = false;
-
-    for(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();
-        suballocItem != m_Suballocations.cend();
-        ++suballocItem)
-    {
-        const VmaSuballocation& subAlloc = *suballocItem;
-        
-        // Actual offset of this suballocation doesn't match expected one.
-        VMA_VALIDATE(subAlloc.offset == calculatedOffset);
-
-        const bool currFree = (subAlloc.type == VMA_SUBALLOCATION_TYPE_FREE);
-        // Two adjacent free suballocations are invalid. They should be merged.
-        VMA_VALIDATE(!prevFree || !currFree);
-
-        VMA_VALIDATE(currFree == (subAlloc.hAllocation == VK_NULL_HANDLE));
-
-        if(currFree)
-        {
-            calculatedSumFreeSize += subAlloc.size;
-            ++calculatedFreeCount;
-            if(subAlloc.size >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)
-            {
-                ++freeSuballocationsToRegister;
-            }
-
-            // Margin required between allocations - every free space must be at least that large.
-            VMA_VALIDATE(subAlloc.size >= VMA_DEBUG_MARGIN);
-        }
-        else
-        {
-            VMA_VALIDATE(subAlloc.hAllocation->GetOffset() == subAlloc.offset);
-            VMA_VALIDATE(subAlloc.hAllocation->GetSize() == subAlloc.size);
-
-            // Margin required between allocations - previous allocation must be free.
-            VMA_VALIDATE(VMA_DEBUG_MARGIN == 0 || prevFree);
-        }
-
-        calculatedOffset += subAlloc.size;
-        prevFree = currFree;
-    }
-
-    // Number of free suballocations registered in m_FreeSuballocationsBySize doesn't
-    // match expected one.
-    VMA_VALIDATE(m_FreeSuballocationsBySize.size() == freeSuballocationsToRegister);
-
-    VkDeviceSize lastSize = 0;
-    for(size_t i = 0; i < m_FreeSuballocationsBySize.size(); ++i)
-    {
-        VmaSuballocationList::iterator suballocItem = m_FreeSuballocationsBySize[i];
-        
-        // Only free suballocations can be registered in m_FreeSuballocationsBySize.
-        VMA_VALIDATE(suballocItem->type == VMA_SUBALLOCATION_TYPE_FREE);
-        // They must be sorted by size ascending.
-        VMA_VALIDATE(suballocItem->size >= lastSize);
-
-        lastSize = suballocItem->size;
-    }
-
-    // Check if totals match calculacted values.
-    VMA_VALIDATE(ValidateFreeSuballocationList());
-    VMA_VALIDATE(calculatedOffset == GetSize());
-    VMA_VALIDATE(calculatedSumFreeSize == m_SumFreeSize);
-    VMA_VALIDATE(calculatedFreeCount == m_FreeCount);
-
-    return true;
-}
-
-VkDeviceSize VmaBlockMetadata_Generic::GetUnusedRangeSizeMax() const
-{
-    if(!m_FreeSuballocationsBySize.empty())
-    {
-        return m_FreeSuballocationsBySize.back()->size;
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-bool VmaBlockMetadata_Generic::IsEmpty() const
-{
-    return (m_Suballocations.size() == 1) && (m_FreeCount == 1);
-}
-
-void VmaBlockMetadata_Generic::CalcAllocationStatInfo(VmaStatInfo& outInfo) const
-{
-    outInfo.blockCount = 1;
-
-    const uint32_t rangeCount = (uint32_t)m_Suballocations.size();
-    outInfo.allocationCount = rangeCount - m_FreeCount;
-    outInfo.unusedRangeCount = m_FreeCount;
-    
-    outInfo.unusedBytes = m_SumFreeSize;
-    outInfo.usedBytes = GetSize() - outInfo.unusedBytes;
-
-    outInfo.allocationSizeMin = UINT64_MAX;
-    outInfo.allocationSizeMax = 0;
-    outInfo.unusedRangeSizeMin = UINT64_MAX;
-    outInfo.unusedRangeSizeMax = 0;
-
-    for(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();
-        suballocItem != m_Suballocations.cend();
-        ++suballocItem)
-    {
-        const VmaSuballocation& suballoc = *suballocItem;
-        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)
-        {
-            outInfo.allocationSizeMin = VMA_MIN(outInfo.allocationSizeMin, suballoc.size);
-            outInfo.allocationSizeMax = VMA_MAX(outInfo.allocationSizeMax, suballoc.size);
-        }
-        else
-        {
-            outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, suballoc.size);
-            outInfo.unusedRangeSizeMax = VMA_MAX(outInfo.unusedRangeSizeMax, suballoc.size);
-        }
-    }
-}
-
-void VmaBlockMetadata_Generic::AddPoolStats(VmaPoolStats& inoutStats) const
-{
-    const uint32_t rangeCount = (uint32_t)m_Suballocations.size();
-
-    inoutStats.size += GetSize();
-    inoutStats.unusedSize += m_SumFreeSize;
-    inoutStats.allocationCount += rangeCount - m_FreeCount;
-    inoutStats.unusedRangeCount += m_FreeCount;
-    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, GetUnusedRangeSizeMax());
-}
-
-#if VMA_STATS_STRING_ENABLED
-
-void VmaBlockMetadata_Generic::PrintDetailedMap(class VmaJsonWriter& json) const
-{
-    PrintDetailedMap_Begin(json,
-        m_SumFreeSize, // unusedBytes
-        m_Suballocations.size() - (size_t)m_FreeCount, // allocationCount
-        m_FreeCount); // unusedRangeCount
-
-    size_t i = 0;
-    for(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();
-        suballocItem != m_Suballocations.cend();
-        ++suballocItem, ++i)
-    {
-        if(suballocItem->type == VMA_SUBALLOCATION_TYPE_FREE)
-        {
-            PrintDetailedMap_UnusedRange(json, suballocItem->offset, suballocItem->size);
-        }
-        else
-        {
-            PrintDetailedMap_Allocation(json, suballocItem->offset, suballocItem->hAllocation);
-        }
-    }
-
-    PrintDetailedMap_End(json);
-}
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-bool VmaBlockMetadata_Generic::CreateAllocationRequest(
-    uint32_t currentFrameIndex,
-    uint32_t frameInUseCount,
-    VkDeviceSize bufferImageGranularity,
-    VkDeviceSize allocSize,
-    VkDeviceSize allocAlignment,
-    bool upperAddress,
-    VmaSuballocationType allocType,
-    bool canMakeOtherLost,
-    uint32_t strategy,
-    VmaAllocationRequest* pAllocationRequest)
-{
-    VMA_ASSERT(allocSize > 0);
-    VMA_ASSERT(!upperAddress);
-    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);
-    VMA_ASSERT(pAllocationRequest != VMA_NULL);
-    VMA_HEAVY_ASSERT(Validate());
-
-    pAllocationRequest->type = VmaAllocationRequestType::Normal;
-
-    // There is not enough total free space in this block to fullfill the request: Early return.
-    if(canMakeOtherLost == false &&
-        m_SumFreeSize < allocSize + 2 * VMA_DEBUG_MARGIN)
-    {
-        return false;
-    }
-
-    // New algorithm, efficiently searching freeSuballocationsBySize.
-    const size_t freeSuballocCount = m_FreeSuballocationsBySize.size();
-    if(freeSuballocCount > 0)
-    {
-        if(strategy == VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT)
-        {
-            // Find first free suballocation with size not less than allocSize + 2 * VMA_DEBUG_MARGIN.
-            VmaSuballocationList::iterator* const it = VmaBinaryFindFirstNotLess(
-                m_FreeSuballocationsBySize.data(),
-                m_FreeSuballocationsBySize.data() + freeSuballocCount,
-                allocSize + 2 * VMA_DEBUG_MARGIN,
-                VmaSuballocationItemSizeLess());
-            size_t index = it - m_FreeSuballocationsBySize.data();
-            for(; index < freeSuballocCount; ++index)
-            {
-                if(CheckAllocation(
-                    currentFrameIndex,
-                    frameInUseCount,
-                    bufferImageGranularity,
-                    allocSize,
-                    allocAlignment,
-                    allocType,
-                    m_FreeSuballocationsBySize[index],
-                    false, // canMakeOtherLost
-                    &pAllocationRequest->offset,
-                    &pAllocationRequest->itemsToMakeLostCount,
-                    &pAllocationRequest->sumFreeSize,
-                    &pAllocationRequest->sumItemSize))
-                {
-                    pAllocationRequest->item = m_FreeSuballocationsBySize[index];
-                    return true;
-                }
-            }
-        }
-        else if(strategy == VMA_ALLOCATION_INTERNAL_STRATEGY_MIN_OFFSET)
-        {
-            for(VmaSuballocationList::iterator it = m_Suballocations.begin();
-                it != m_Suballocations.end();
-                ++it)
-            {
-                if(it->type == VMA_SUBALLOCATION_TYPE_FREE && CheckAllocation(
-                    currentFrameIndex,
-                    frameInUseCount,
-                    bufferImageGranularity,
-                    allocSize,
-                    allocAlignment,
-                    allocType,
-                    it,
-                    false, // canMakeOtherLost
-                    &pAllocationRequest->offset,
-                    &pAllocationRequest->itemsToMakeLostCount,
-                    &pAllocationRequest->sumFreeSize,
-                    &pAllocationRequest->sumItemSize))
-                {
-                    pAllocationRequest->item = it;
-                    return true;
-                }
-            }
-        }
-        else // WORST_FIT, FIRST_FIT
-        {
-            // Search staring from biggest suballocations.
-            for(size_t index = freeSuballocCount; index--; )
-            {
-                if(CheckAllocation(
-                    currentFrameIndex,
-                    frameInUseCount,
-                    bufferImageGranularity,
-                    allocSize,
-                    allocAlignment,
-                    allocType,
-                    m_FreeSuballocationsBySize[index],
-                    false, // canMakeOtherLost
-                    &pAllocationRequest->offset,
-                    &pAllocationRequest->itemsToMakeLostCount,
-                    &pAllocationRequest->sumFreeSize,
-                    &pAllocationRequest->sumItemSize))
-                {
-                    pAllocationRequest->item = m_FreeSuballocationsBySize[index];
-                    return true;
-                }
-            }
-        }
-    }
-
-    if(canMakeOtherLost)
-    {
-        // Brute-force algorithm. TODO: Come up with something better.
-
-        bool found = false;
-        VmaAllocationRequest tmpAllocRequest = {};
-        tmpAllocRequest.type = VmaAllocationRequestType::Normal;
-        for(VmaSuballocationList::iterator suballocIt = m_Suballocations.begin();
-            suballocIt != m_Suballocations.end();
-            ++suballocIt)
-        {
-            if(suballocIt->type == VMA_SUBALLOCATION_TYPE_FREE ||
-                suballocIt->hAllocation->CanBecomeLost())
-            {
-                if(CheckAllocation(
-                    currentFrameIndex,
-                    frameInUseCount,
-                    bufferImageGranularity,
-                    allocSize,
-                    allocAlignment,
-                    allocType,
-                    suballocIt,
-                    canMakeOtherLost,
-                    &tmpAllocRequest.offset,
-                    &tmpAllocRequest.itemsToMakeLostCount,
-                    &tmpAllocRequest.sumFreeSize,
-                    &tmpAllocRequest.sumItemSize))
-                {
-                    if(strategy == VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT)
-                    {
-                        *pAllocationRequest = tmpAllocRequest;
-                        pAllocationRequest->item = suballocIt;
-                        break;
-                    }
-                    if(!found || tmpAllocRequest.CalcCost() < pAllocationRequest->CalcCost())
-                    {
-                        *pAllocationRequest = tmpAllocRequest;
-                        pAllocationRequest->item = suballocIt;
-                        found = true;
-                    }
-                }
-            }
-        }
-
-        return found;
-    }
-
-    return false;
-}
-
-bool VmaBlockMetadata_Generic::MakeRequestedAllocationsLost(
-    uint32_t currentFrameIndex,
-    uint32_t frameInUseCount,
-    VmaAllocationRequest* pAllocationRequest)
-{
-    VMA_ASSERT(pAllocationRequest && pAllocationRequest->type == VmaAllocationRequestType::Normal);
-
-    while(pAllocationRequest->itemsToMakeLostCount > 0)
-    {
-        if(pAllocationRequest->item->type == VMA_SUBALLOCATION_TYPE_FREE)
-        {
-            ++pAllocationRequest->item;
-        }
-        VMA_ASSERT(pAllocationRequest->item != m_Suballocations.end());
-        VMA_ASSERT(pAllocationRequest->item->hAllocation != VK_NULL_HANDLE);
-        VMA_ASSERT(pAllocationRequest->item->hAllocation->CanBecomeLost());
-        if(pAllocationRequest->item->hAllocation->MakeLost(currentFrameIndex, frameInUseCount))
-        {
-            pAllocationRequest->item = FreeSuballocation(pAllocationRequest->item);
-            --pAllocationRequest->itemsToMakeLostCount;
-        }
-        else
-        {
-            return false;
-        }
-    }
-
-    VMA_HEAVY_ASSERT(Validate());
-    VMA_ASSERT(pAllocationRequest->item != m_Suballocations.end());
-    VMA_ASSERT(pAllocationRequest->item->type == VMA_SUBALLOCATION_TYPE_FREE);
-    
-    return true;
-}
-
-uint32_t VmaBlockMetadata_Generic::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)
-{
-    uint32_t lostAllocationCount = 0;
-    for(VmaSuballocationList::iterator it = m_Suballocations.begin();
-        it != m_Suballocations.end();
-        ++it)
-    {
-        if(it->type != VMA_SUBALLOCATION_TYPE_FREE &&
-            it->hAllocation->CanBecomeLost() &&
-            it->hAllocation->MakeLost(currentFrameIndex, frameInUseCount))
-        {
-            it = FreeSuballocation(it);
-            ++lostAllocationCount;
-        }
-    }
-    return lostAllocationCount;
-}
-
-VkResult VmaBlockMetadata_Generic::CheckCorruption(const void* pBlockData)
-{
-    for(VmaSuballocationList::iterator it = m_Suballocations.begin();
-        it != m_Suballocations.end();
-        ++it)
-    {
-        if(it->type != VMA_SUBALLOCATION_TYPE_FREE)
-        {
-            if(!VmaValidateMagicValue(pBlockData, it->offset - VMA_DEBUG_MARGIN))
-            {
-                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!");
-                return VK_ERROR_VALIDATION_FAILED_EXT;
-            }
-            if(!VmaValidateMagicValue(pBlockData, it->offset + it->size))
-            {
-                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!");
-                return VK_ERROR_VALIDATION_FAILED_EXT;
-            }
-        }
-    }
-
-    return VK_SUCCESS;
-}
-
-void VmaBlockMetadata_Generic::Alloc(
-    const VmaAllocationRequest& request,
-    VmaSuballocationType type,
-    VkDeviceSize allocSize,
-    VmaAllocation hAllocation)
-{
-    VMA_ASSERT(request.type == VmaAllocationRequestType::Normal);
-    VMA_ASSERT(request.item != m_Suballocations.end());
-    VmaSuballocation& suballoc = *request.item;
-    // Given suballocation is a free block.
-    VMA_ASSERT(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);
-    // Given offset is inside this suballocation.
-    VMA_ASSERT(request.offset >= suballoc.offset);
-    const VkDeviceSize paddingBegin = request.offset - suballoc.offset;
-    VMA_ASSERT(suballoc.size >= paddingBegin + allocSize);
-    const VkDeviceSize paddingEnd = suballoc.size - paddingBegin - allocSize;
-
-    // Unregister this free suballocation from m_FreeSuballocationsBySize and update
-    // it to become used.
-    UnregisterFreeSuballocation(request.item);
-
-    suballoc.offset = request.offset;
-    suballoc.size = allocSize;
-    suballoc.type = type;
-    suballoc.hAllocation = hAllocation;
-
-    // If there are any free bytes remaining at the end, insert new free suballocation after current one.
-    if(paddingEnd)
-    {
-        VmaSuballocation paddingSuballoc = {};
-        paddingSuballoc.offset = request.offset + allocSize;
-        paddingSuballoc.size = paddingEnd;
-        paddingSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;
-        VmaSuballocationList::iterator next = request.item;
-        ++next;
-        const VmaSuballocationList::iterator paddingEndItem =
-            m_Suballocations.insert(next, paddingSuballoc);
-        RegisterFreeSuballocation(paddingEndItem);
-    }
-
-    // If there are any free bytes remaining at the beginning, insert new free suballocation before current one.
-    if(paddingBegin)
-    {
-        VmaSuballocation paddingSuballoc = {};
-        paddingSuballoc.offset = request.offset - paddingBegin;
-        paddingSuballoc.size = paddingBegin;
-        paddingSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;
-        const VmaSuballocationList::iterator paddingBeginItem =
-            m_Suballocations.insert(request.item, paddingSuballoc);
-        RegisterFreeSuballocation(paddingBeginItem);
-    }
-
-    // Update totals.
-    m_FreeCount = m_FreeCount - 1;
-    if(paddingBegin > 0)
-    {
-        ++m_FreeCount;
-    }
-    if(paddingEnd > 0)
-    {
-        ++m_FreeCount;
-    }
-    m_SumFreeSize -= allocSize;
-}
-
-void VmaBlockMetadata_Generic::Free(const VmaAllocation allocation)
-{
-    for(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();
-        suballocItem != m_Suballocations.end();
-        ++suballocItem)
-    {
-        VmaSuballocation& suballoc = *suballocItem;
-        if(suballoc.hAllocation == allocation)
-        {
-            FreeSuballocation(suballocItem);
-            VMA_HEAVY_ASSERT(Validate());
-            return;
-        }
-    }
-    VMA_ASSERT(0 && "Not found!");
-}
-
-void VmaBlockMetadata_Generic::FreeAtOffset(VkDeviceSize offset)
-{
-    for(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();
-        suballocItem != m_Suballocations.end();
-        ++suballocItem)
-    {
-        VmaSuballocation& suballoc = *suballocItem;
-        if(suballoc.offset == offset)
-        {
-            FreeSuballocation(suballocItem);
-            return;
-        }
-    }
-    VMA_ASSERT(0 && "Not found!");
-}
-
-bool VmaBlockMetadata_Generic::ValidateFreeSuballocationList() const
-{
-    VkDeviceSize lastSize = 0;
-    for(size_t i = 0, count = m_FreeSuballocationsBySize.size(); i < count; ++i)
-    {
-        const VmaSuballocationList::iterator it = m_FreeSuballocationsBySize[i];
-
-        VMA_VALIDATE(it->type == VMA_SUBALLOCATION_TYPE_FREE);
-        VMA_VALIDATE(it->size >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER);
-        VMA_VALIDATE(it->size >= lastSize);
-        lastSize = it->size;
-    }
-    return true;
-}
-
-bool VmaBlockMetadata_Generic::CheckAllocation(
-    uint32_t currentFrameIndex,
-    uint32_t frameInUseCount,
-    VkDeviceSize bufferImageGranularity,
-    VkDeviceSize allocSize,
-    VkDeviceSize allocAlignment,
-    VmaSuballocationType allocType,
-    VmaSuballocationList::const_iterator suballocItem,
-    bool canMakeOtherLost,
-    VkDeviceSize* pOffset,
-    size_t* itemsToMakeLostCount,
-    VkDeviceSize* pSumFreeSize,
-    VkDeviceSize* pSumItemSize) const
-{
-    VMA_ASSERT(allocSize > 0);
-    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);
-    VMA_ASSERT(suballocItem != m_Suballocations.cend());
-    VMA_ASSERT(pOffset != VMA_NULL);
-    
-    *itemsToMakeLostCount = 0;
-    *pSumFreeSize = 0;
-    *pSumItemSize = 0;
-
-    if(canMakeOtherLost)
-    {
-        if(suballocItem->type == VMA_SUBALLOCATION_TYPE_FREE)
-        {
-            *pSumFreeSize = suballocItem->size;
-        }
-        else
-        {
-            if(suballocItem->hAllocation->CanBecomeLost() &&
-                suballocItem->hAllocation->GetLastUseFrameIndex() + frameInUseCount < currentFrameIndex)
-            {
-                ++*itemsToMakeLostCount;
-                *pSumItemSize = suballocItem->size;
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        // Remaining size is too small for this request: Early return.
-        if(GetSize() - suballocItem->offset < allocSize)
-        {
-            return false;
-        }
-
-        // Start from offset equal to beginning of this suballocation.
-        *pOffset = suballocItem->offset;
-    
-        // Apply VMA_DEBUG_MARGIN at the beginning.
-        if(VMA_DEBUG_MARGIN > 0)
-        {
-            *pOffset += VMA_DEBUG_MARGIN;
-        }
-    
-        // Apply alignment.
-        *pOffset = VmaAlignUp(*pOffset, allocAlignment);
-
-        // Check previous suballocations for BufferImageGranularity conflicts.
-        // Make bigger alignment if necessary.
-        if(bufferImageGranularity > 1)
-        {
-            bool bufferImageGranularityConflict = false;
-            VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;
-            while(prevSuballocItem != m_Suballocations.cbegin())
-            {
-                --prevSuballocItem;
-                const VmaSuballocation& prevSuballoc = *prevSuballocItem;
-                if(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, *pOffset, bufferImageGranularity))
-                {
-                    if(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))
-                    {
-                        bufferImageGranularityConflict = true;
-                        break;
-                    }
-                }
-                else
-                    // Already on previous page.
-                    break;
-            }
-            if(bufferImageGranularityConflict)
-            {
-                *pOffset = VmaAlignUp(*pOffset, bufferImageGranularity);
-            }
-        }
-    
-        // Now that we have final *pOffset, check if we are past suballocItem.
-        // If yes, return false - this function should be called for another suballocItem as starting point.
-        if(*pOffset >= suballocItem->offset + suballocItem->size)
-        {
-            return false;
-        }
-    
-        // Calculate padding at the beginning based on current offset.
-        const VkDeviceSize paddingBegin = *pOffset - suballocItem->offset;
-
-        // Calculate required margin at the end.
-        const VkDeviceSize requiredEndMargin = VMA_DEBUG_MARGIN;
-
-        const VkDeviceSize totalSize = paddingBegin + allocSize + requiredEndMargin;
-        // Another early return check.
-        if(suballocItem->offset + totalSize > GetSize())
-        {
-            return false;
-        }
-
-        // Advance lastSuballocItem until desired size is reached.
-        // Update itemsToMakeLostCount.
-        VmaSuballocationList::const_iterator lastSuballocItem = suballocItem;
-        if(totalSize > suballocItem->size)
-        {
-            VkDeviceSize remainingSize = totalSize - suballocItem->size;
-            while(remainingSize > 0)
-            {
-                ++lastSuballocItem;
-                if(lastSuballocItem == m_Suballocations.cend())
-                {
-                    return false;
-                }
-                if(lastSuballocItem->type == VMA_SUBALLOCATION_TYPE_FREE)
-                {
-                    *pSumFreeSize += lastSuballocItem->size;
-                }
-                else
-                {
-                    VMA_ASSERT(lastSuballocItem->hAllocation != VK_NULL_HANDLE);
-                    if(lastSuballocItem->hAllocation->CanBecomeLost() &&
-                        lastSuballocItem->hAllocation->GetLastUseFrameIndex() + frameInUseCount < currentFrameIndex)
-                    {
-                        ++*itemsToMakeLostCount;
-                        *pSumItemSize += lastSuballocItem->size;
-                    }
-                    else
-                    {
-                        return false;
-                    }
-                }
-                remainingSize = (lastSuballocItem->size < remainingSize) ?
-                    remainingSize - lastSuballocItem->size : 0;
-            }
-        }
-
-        // Check next suballocations for BufferImageGranularity conflicts.
-        // If conflict exists, we must mark more allocations lost or fail.
-        if(bufferImageGranularity > 1)
-        {
-            VmaSuballocationList::const_iterator nextSuballocItem = lastSuballocItem;
-            ++nextSuballocItem;
-            while(nextSuballocItem != m_Suballocations.cend())
-            {
-                const VmaSuballocation& nextSuballoc = *nextSuballocItem;
-                if(VmaBlocksOnSamePage(*pOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))
-                {
-                    if(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))
-                    {
-                        VMA_ASSERT(nextSuballoc.hAllocation != VK_NULL_HANDLE);
-                        if(nextSuballoc.hAllocation->CanBecomeLost() &&
-                            nextSuballoc.hAllocation->GetLastUseFrameIndex() + frameInUseCount < currentFrameIndex)
-                        {
-                            ++*itemsToMakeLostCount;
-                        }
-                        else
-                        {
-                            return false;
-                        }
-                    }
-                }
-                else
-                {
-                    // Already on next page.
-                    break;
-                }
-                ++nextSuballocItem;
-            }
-        }
-    }
-    else
-    {
-        const VmaSuballocation& suballoc = *suballocItem;
-        VMA_ASSERT(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);
-
-        *pSumFreeSize = suballoc.size;
-
-        // Size of this suballocation is too small for this request: Early return.
-        if(suballoc.size < allocSize)
-        {
-            return false;
-        }
-
-        // Start from offset equal to beginning of this suballocation.
-        *pOffset = suballoc.offset;
-    
-        // Apply VMA_DEBUG_MARGIN at the beginning.
-        if(VMA_DEBUG_MARGIN > 0)
-        {
-            *pOffset += VMA_DEBUG_MARGIN;
-        }
-    
-        // Apply alignment.
-        *pOffset = VmaAlignUp(*pOffset, allocAlignment);
-    
-        // Check previous suballocations for BufferImageGranularity conflicts.
-        // Make bigger alignment if necessary.
-        if(bufferImageGranularity > 1)
-        {
-            bool bufferImageGranularityConflict = false;
-            VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;
-            while(prevSuballocItem != m_Suballocations.cbegin())
-            {
-                --prevSuballocItem;
-                const VmaSuballocation& prevSuballoc = *prevSuballocItem;
-                if(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, *pOffset, bufferImageGranularity))
-                {
-                    if(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))
-                    {
-                        bufferImageGranularityConflict = true;
-                        break;
-                    }
-                }
-                else
-                    // Already on previous page.
-                    break;
-            }
-            if(bufferImageGranularityConflict)
-            {
-                *pOffset = VmaAlignUp(*pOffset, bufferImageGranularity);
-            }
-        }
-    
-        // Calculate padding at the beginning based on current offset.
-        const VkDeviceSize paddingBegin = *pOffset - suballoc.offset;
-
-        // Calculate required margin at the end.
-        const VkDeviceSize requiredEndMargin = VMA_DEBUG_MARGIN;
-
-        // Fail if requested size plus margin before and after is bigger than size of this suballocation.
-        if(paddingBegin + allocSize + requiredEndMargin > suballoc.size)
-        {
-            return false;
-        }
-
-        // Check next suballocations for BufferImageGranularity conflicts.
-        // If conflict exists, allocation cannot be made here.
-        if(bufferImageGranularity > 1)
-        {
-            VmaSuballocationList::const_iterator nextSuballocItem = suballocItem;
-            ++nextSuballocItem;
-            while(nextSuballocItem != m_Suballocations.cend())
-            {
-                const VmaSuballocation& nextSuballoc = *nextSuballocItem;
-                if(VmaBlocksOnSamePage(*pOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))
-                {
-                    if(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))
-                    {
-                        return false;
-                    }
-                }
-                else
-                {
-                    // Already on next page.
-                    break;
-                }
-                ++nextSuballocItem;
-            }
-        }
-    }
-
-    // All tests passed: Success. pOffset is already filled.
-    return true;
-}
-
-void VmaBlockMetadata_Generic::MergeFreeWithNext(VmaSuballocationList::iterator item)
-{
-    VMA_ASSERT(item != m_Suballocations.end());
-    VMA_ASSERT(item->type == VMA_SUBALLOCATION_TYPE_FREE);
-    
-    VmaSuballocationList::iterator nextItem = item;
-    ++nextItem;
-    VMA_ASSERT(nextItem != m_Suballocations.end());
-    VMA_ASSERT(nextItem->type == VMA_SUBALLOCATION_TYPE_FREE);
-
-    item->size += nextItem->size;
-    --m_FreeCount;
-    m_Suballocations.erase(nextItem);
-}
-
-VmaSuballocationList::iterator VmaBlockMetadata_Generic::FreeSuballocation(VmaSuballocationList::iterator suballocItem)
-{
-    // Change this suballocation to be marked as free.
-    VmaSuballocation& suballoc = *suballocItem;
-    suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;
-    suballoc.hAllocation = VK_NULL_HANDLE;
-    
-    // Update totals.
-    ++m_FreeCount;
-    m_SumFreeSize += suballoc.size;
-
-    // Merge with previous and/or next suballocation if it's also free.
-    bool mergeWithNext = false;
-    bool mergeWithPrev = false;
-    
-    VmaSuballocationList::iterator nextItem = suballocItem;
-    ++nextItem;
-    if((nextItem != m_Suballocations.end()) && (nextItem->type == VMA_SUBALLOCATION_TYPE_FREE))
-    {
-        mergeWithNext = true;
-    }
-
-    VmaSuballocationList::iterator prevItem = suballocItem;
-    if(suballocItem != m_Suballocations.begin())
-    {
-        --prevItem;
-        if(prevItem->type == VMA_SUBALLOCATION_TYPE_FREE)
-        {
-            mergeWithPrev = true;
-        }
-    }
-
-    if(mergeWithNext)
-    {
-        UnregisterFreeSuballocation(nextItem);
-        MergeFreeWithNext(suballocItem);
-    }
-
-    if(mergeWithPrev)
-    {
-        UnregisterFreeSuballocation(prevItem);
-        MergeFreeWithNext(prevItem);
-        RegisterFreeSuballocation(prevItem);
-        return prevItem;
-    }
-    else
-    {
-        RegisterFreeSuballocation(suballocItem);
-        return suballocItem;
-    }
-}
-
-void VmaBlockMetadata_Generic::RegisterFreeSuballocation(VmaSuballocationList::iterator item)
-{
-    VMA_ASSERT(item->type == VMA_SUBALLOCATION_TYPE_FREE);
-    VMA_ASSERT(item->size > 0);
-
-    // You may want to enable this validation at the beginning or at the end of
-    // this function, depending on what do you want to check.
-    VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());
-
-    if(item->size >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)
-    {
-        if(m_FreeSuballocationsBySize.empty())
-        {
-            m_FreeSuballocationsBySize.push_back(item);
-        }
-        else
-        {
-            VmaVectorInsertSorted<VmaSuballocationItemSizeLess>(m_FreeSuballocationsBySize, item);
-        }
-    }
-
-    //VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());
-}
-
-
-void VmaBlockMetadata_Generic::UnregisterFreeSuballocation(VmaSuballocationList::iterator item)
-{
-    VMA_ASSERT(item->type == VMA_SUBALLOCATION_TYPE_FREE);
-    VMA_ASSERT(item->size > 0);
-
-    // You may want to enable this validation at the beginning or at the end of
-    // this function, depending on what do you want to check.
-    VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());
-
-    if(item->size >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)
-    {
-        VmaSuballocationList::iterator* const it = VmaBinaryFindFirstNotLess(
-            m_FreeSuballocationsBySize.data(),
-            m_FreeSuballocationsBySize.data() + m_FreeSuballocationsBySize.size(),
-            item,
-            VmaSuballocationItemSizeLess());
-        for(size_t index = it - m_FreeSuballocationsBySize.data();
-            index < m_FreeSuballocationsBySize.size();
-            ++index)
-        {
-            if(m_FreeSuballocationsBySize[index] == item)
-            {
-                VmaVectorRemove(m_FreeSuballocationsBySize, index);
-                return;
-            }
-            VMA_ASSERT((m_FreeSuballocationsBySize[index]->size == item->size) && "Not found.");
-        }
-        VMA_ASSERT(0 && "Not found.");
-    }
-
-    //VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());
-}
-
-bool VmaBlockMetadata_Generic::IsBufferImageGranularityConflictPossible(
-    VkDeviceSize bufferImageGranularity,
-    VmaSuballocationType& inOutPrevSuballocType) const
-{
-    if(bufferImageGranularity == 1 || IsEmpty())
-    {
-        return false;
-    }
-
-    VkDeviceSize minAlignment = VK_WHOLE_SIZE;
-    bool typeConflictFound = false;
-    for(VmaSuballocationList::const_iterator it = m_Suballocations.cbegin();
-        it != m_Suballocations.cend();
-        ++it)
-    {
-        const VmaSuballocationType suballocType = it->type;
-        if(suballocType != VMA_SUBALLOCATION_TYPE_FREE)
-        {
-            minAlignment = VMA_MIN(minAlignment, it->hAllocation->GetAlignment());
-            if(VmaIsBufferImageGranularityConflict(inOutPrevSuballocType, suballocType))
-            {
-                typeConflictFound = true;
-            }
-            inOutPrevSuballocType = suballocType;
-        }
-    }
-
-    return typeConflictFound || minAlignment >= bufferImageGranularity;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// class VmaBlockMetadata_Linear
-
-VmaBlockMetadata_Linear::VmaBlockMetadata_Linear(VmaAllocator hAllocator) :
-    VmaBlockMetadata(hAllocator),
-    m_SumFreeSize(0),
-    m_Suballocations0(VmaStlAllocator<VmaSuballocation>(hAllocator->GetAllocationCallbacks())),
-    m_Suballocations1(VmaStlAllocator<VmaSuballocation>(hAllocator->GetAllocationCallbacks())),
-    m_1stVectorIndex(0),
-    m_2ndVectorMode(SECOND_VECTOR_EMPTY),
-    m_1stNullItemsBeginCount(0),
-    m_1stNullItemsMiddleCount(0),
-    m_2ndNullItemsCount(0)
-{
-}
-
-VmaBlockMetadata_Linear::~VmaBlockMetadata_Linear()
-{
-}
-
-void VmaBlockMetadata_Linear::Init(VkDeviceSize size)
-{
-    VmaBlockMetadata::Init(size);
-    m_SumFreeSize = size;
-}
-
-bool VmaBlockMetadata_Linear::Validate() const
-{
-    const SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-    const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-
-    VMA_VALIDATE(suballocations2nd.empty() == (m_2ndVectorMode == SECOND_VECTOR_EMPTY));
-    VMA_VALIDATE(!suballocations1st.empty() ||
-        suballocations2nd.empty() ||
-        m_2ndVectorMode != SECOND_VECTOR_RING_BUFFER);
-
-    if(!suballocations1st.empty())
-    {
-        // Null item at the beginning should be accounted into m_1stNullItemsBeginCount.
-        VMA_VALIDATE(suballocations1st[m_1stNullItemsBeginCount].hAllocation != VK_NULL_HANDLE);
-        // Null item at the end should be just pop_back().
-        VMA_VALIDATE(suballocations1st.back().hAllocation != VK_NULL_HANDLE);
-    }
-    if(!suballocations2nd.empty())
-    {
-        // Null item at the end should be just pop_back().
-        VMA_VALIDATE(suballocations2nd.back().hAllocation != VK_NULL_HANDLE);
-    }
-
-    VMA_VALIDATE(m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount <= suballocations1st.size());
-    VMA_VALIDATE(m_2ndNullItemsCount <= suballocations2nd.size());
-
-    VkDeviceSize sumUsedSize = 0;
-    const size_t suballoc1stCount = suballocations1st.size();
-    VkDeviceSize offset = VMA_DEBUG_MARGIN;
-
-    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)
-    {
-        const size_t suballoc2ndCount = suballocations2nd.size();
-        size_t nullItem2ndCount = 0;
-        for(size_t i = 0; i < suballoc2ndCount; ++i)
-        {
-            const VmaSuballocation& suballoc = suballocations2nd[i];
-            const bool currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);
-
-            VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));
-            VMA_VALIDATE(suballoc.offset >= offset);
-
-            if(!currFree)
-            {
-                VMA_VALIDATE(suballoc.hAllocation->GetOffset() == suballoc.offset);
-                VMA_VALIDATE(suballoc.hAllocation->GetSize() == suballoc.size);
-                sumUsedSize += suballoc.size;
-            }
-            else
-            {
-                ++nullItem2ndCount;
-            }
-
-            offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;
-        }
-
-        VMA_VALIDATE(nullItem2ndCount == m_2ndNullItemsCount);
-    }
-
-    for(size_t i = 0; i < m_1stNullItemsBeginCount; ++i)
-    {
-        const VmaSuballocation& suballoc = suballocations1st[i];
-        VMA_VALIDATE(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE &&
-            suballoc.hAllocation == VK_NULL_HANDLE);
-    }
-
-    size_t nullItem1stCount = m_1stNullItemsBeginCount;
-
-    for(size_t i = m_1stNullItemsBeginCount; i < suballoc1stCount; ++i)
-    {
-        const VmaSuballocation& suballoc = suballocations1st[i];
-        const bool currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);
-
-        VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));
-        VMA_VALIDATE(suballoc.offset >= offset);
-        VMA_VALIDATE(i >= m_1stNullItemsBeginCount || currFree);
-
-        if(!currFree)
-        {
-            VMA_VALIDATE(suballoc.hAllocation->GetOffset() == suballoc.offset);
-            VMA_VALIDATE(suballoc.hAllocation->GetSize() == suballoc.size);
-            sumUsedSize += suballoc.size;
-        }
-        else
-        {
-            ++nullItem1stCount;
-        }
-
-        offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;
-    }
-    VMA_VALIDATE(nullItem1stCount == m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount);
-
-    if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)
-    {
-        const size_t suballoc2ndCount = suballocations2nd.size();
-        size_t nullItem2ndCount = 0;
-        for(size_t i = suballoc2ndCount; i--; )
-        {
-            const VmaSuballocation& suballoc = suballocations2nd[i];
-            const bool currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);
-
-            VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));
-            VMA_VALIDATE(suballoc.offset >= offset);
-
-            if(!currFree)
-            {
-                VMA_VALIDATE(suballoc.hAllocation->GetOffset() == suballoc.offset);
-                VMA_VALIDATE(suballoc.hAllocation->GetSize() == suballoc.size);
-                sumUsedSize += suballoc.size;
-            }
-            else
-            {
-                ++nullItem2ndCount;
-            }
-
-            offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;
-        }
-
-        VMA_VALIDATE(nullItem2ndCount == m_2ndNullItemsCount);
-    }
-
-    VMA_VALIDATE(offset <= GetSize());
-    VMA_VALIDATE(m_SumFreeSize == GetSize() - sumUsedSize);
-
-    return true;
-}
-
-size_t VmaBlockMetadata_Linear::GetAllocationCount() const
-{
-    return AccessSuballocations1st().size() - (m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount) +
-        AccessSuballocations2nd().size() - m_2ndNullItemsCount;
-}
-
-VkDeviceSize VmaBlockMetadata_Linear::GetUnusedRangeSizeMax() const
-{
-    const VkDeviceSize size = GetSize();
-
-    /*
-    We don't consider gaps inside allocation vectors with freed allocations because
-    they are not suitable for reuse in linear allocator. We consider only space that
-    is available for new allocations.
-    */
-    if(IsEmpty())
-    {
-        return size;
-    }
-    
-    const SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-
-    switch(m_2ndVectorMode)
-    {
-    case SECOND_VECTOR_EMPTY:
-        /*
-        Available space is after end of 1st, as well as before beginning of 1st (which
-        whould make it a ring buffer).
-        */
-        {
-            const size_t suballocations1stCount = suballocations1st.size();
-            VMA_ASSERT(suballocations1stCount > m_1stNullItemsBeginCount);
-            const VmaSuballocation& firstSuballoc = suballocations1st[m_1stNullItemsBeginCount];
-            const VmaSuballocation& lastSuballoc  = suballocations1st[suballocations1stCount - 1];
-            return VMA_MAX(
-                firstSuballoc.offset,
-                size - (lastSuballoc.offset + lastSuballoc.size));
-        }
-        break;
-
-    case SECOND_VECTOR_RING_BUFFER:
-        /*
-        Available space is only between end of 2nd and beginning of 1st.
-        */
-        {
-            const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-            const VmaSuballocation& lastSuballoc2nd = suballocations2nd.back();
-            const VmaSuballocation& firstSuballoc1st = suballocations1st[m_1stNullItemsBeginCount];
-            return firstSuballoc1st.offset - (lastSuballoc2nd.offset + lastSuballoc2nd.size);
-        }
-        break;
-
-    case SECOND_VECTOR_DOUBLE_STACK:
-        /*
-        Available space is only between end of 1st and top of 2nd.
-        */
-        {
-            const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-            const VmaSuballocation& topSuballoc2nd = suballocations2nd.back();
-            const VmaSuballocation& lastSuballoc1st = suballocations1st.back();
-            return topSuballoc2nd.offset - (lastSuballoc1st.offset + lastSuballoc1st.size);
-        }
-        break;
-
-    default:
-        VMA_ASSERT(0);
-        return 0;
-    }
-}
-
-void VmaBlockMetadata_Linear::CalcAllocationStatInfo(VmaStatInfo& outInfo) const
-{
-    const VkDeviceSize size = GetSize();
-    const SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-    const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-    const size_t suballoc1stCount = suballocations1st.size();
-    const size_t suballoc2ndCount = suballocations2nd.size();
-
-    outInfo.blockCount = 1;
-    outInfo.allocationCount = (uint32_t)GetAllocationCount();
-    outInfo.unusedRangeCount = 0;
-    outInfo.usedBytes = 0;
-    outInfo.allocationSizeMin = UINT64_MAX;
-    outInfo.allocationSizeMax = 0;
-    outInfo.unusedRangeSizeMin = UINT64_MAX;
-    outInfo.unusedRangeSizeMax = 0;
-
-    VkDeviceSize lastOffset = 0;
-
-    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)
-    {
-        const VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;
-        size_t nextAlloc2ndIndex = 0;
-        while(lastOffset < freeSpace2ndTo1stEnd)
-        {
-            // Find next non-null allocation or move nextAllocIndex to the end.
-            while(nextAlloc2ndIndex < suballoc2ndCount &&
-                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)
-            {
-                ++nextAlloc2ndIndex;
-            }
-
-            // Found non-null allocation.
-            if(nextAlloc2ndIndex < suballoc2ndCount)
-            {
-                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];
-            
-                // 1. Process free space before this allocation.
-                if(lastOffset < suballoc.offset)
-                {
-                    // There is free space from lastOffset to suballoc.offset.
-                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;
-                    ++outInfo.unusedRangeCount;
-                    outInfo.unusedBytes += unusedRangeSize;
-                    outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);
-                    outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);
-                }
-            
-                // 2. Process this allocation.
-                // There is allocation with suballoc.offset, suballoc.size.
-                outInfo.usedBytes += suballoc.size;
-                outInfo.allocationSizeMin = VMA_MIN(outInfo.allocationSizeMin, suballoc.size);
-                outInfo.allocationSizeMax = VMA_MIN(outInfo.allocationSizeMax, suballoc.size);
-            
-                // 3. Prepare for next iteration.
-                lastOffset = suballoc.offset + suballoc.size;
-                ++nextAlloc2ndIndex;
-            }
-            // We are at the end.
-            else
-            {
-                // There is free space from lastOffset to freeSpace2ndTo1stEnd.
-                if(lastOffset < freeSpace2ndTo1stEnd)
-                {
-                    const VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;
-                    ++outInfo.unusedRangeCount;
-                    outInfo.unusedBytes += unusedRangeSize;
-                    outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);
-                    outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);
-               }
-
-                // End of loop.
-                lastOffset = freeSpace2ndTo1stEnd;
-            }
-        }
-    }
-
-    size_t nextAlloc1stIndex = m_1stNullItemsBeginCount;
-    const VkDeviceSize freeSpace1stTo2ndEnd =
-        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;
-    while(lastOffset < freeSpace1stTo2ndEnd)
-    {
-        // Find next non-null allocation or move nextAllocIndex to the end.
-        while(nextAlloc1stIndex < suballoc1stCount &&
-            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)
-        {
-            ++nextAlloc1stIndex;
-        }
-
-        // Found non-null allocation.
-        if(nextAlloc1stIndex < suballoc1stCount)
-        {
-            const VmaSuballocation& suballoc = suballocations1st[nextAlloc1stIndex];
-            
-            // 1. Process free space before this allocation.
-            if(lastOffset < suballoc.offset)
-            {
-                // There is free space from lastOffset to suballoc.offset.
-                const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;
-                ++outInfo.unusedRangeCount;
-                outInfo.unusedBytes += unusedRangeSize;
-                outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);
-                outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);
-            }
-            
-            // 2. Process this allocation.
-            // There is allocation with suballoc.offset, suballoc.size.
-            outInfo.usedBytes += suballoc.size;
-            outInfo.allocationSizeMin = VMA_MIN(outInfo.allocationSizeMin, suballoc.size);
-            outInfo.allocationSizeMax = VMA_MIN(outInfo.allocationSizeMax, suballoc.size);
-            
-            // 3. Prepare for next iteration.
-            lastOffset = suballoc.offset + suballoc.size;
-            ++nextAlloc1stIndex;
-        }
-        // We are at the end.
-        else
-        {
-            // There is free space from lastOffset to freeSpace1stTo2ndEnd.
-            if(lastOffset < freeSpace1stTo2ndEnd)
-            {
-                const VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;
-                ++outInfo.unusedRangeCount;
-                outInfo.unusedBytes += unusedRangeSize;
-                outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);
-                outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);
-           }
-
-            // End of loop.
-            lastOffset = freeSpace1stTo2ndEnd;
-        }
-    }
-
-    if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)
-    {
-        size_t nextAlloc2ndIndex = suballocations2nd.size() - 1;
-        while(lastOffset < size)
-        {
-            // Find next non-null allocation or move nextAllocIndex to the end.
-            while(nextAlloc2ndIndex != SIZE_MAX &&
-                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)
-            {
-                --nextAlloc2ndIndex;
-            }
-
-            // Found non-null allocation.
-            if(nextAlloc2ndIndex != SIZE_MAX)
-            {
-                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];
-            
-                // 1. Process free space before this allocation.
-                if(lastOffset < suballoc.offset)
-                {
-                    // There is free space from lastOffset to suballoc.offset.
-                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;
-                    ++outInfo.unusedRangeCount;
-                    outInfo.unusedBytes += unusedRangeSize;
-                    outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);
-                    outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);
-                }
-            
-                // 2. Process this allocation.
-                // There is allocation with suballoc.offset, suballoc.size.
-                outInfo.usedBytes += suballoc.size;
-                outInfo.allocationSizeMin = VMA_MIN(outInfo.allocationSizeMin, suballoc.size);
-                outInfo.allocationSizeMax = VMA_MIN(outInfo.allocationSizeMax, suballoc.size);
-            
-                // 3. Prepare for next iteration.
-                lastOffset = suballoc.offset + suballoc.size;
-                --nextAlloc2ndIndex;
-            }
-            // We are at the end.
-            else
-            {
-                // There is free space from lastOffset to size.
-                if(lastOffset < size)
-                {
-                    const VkDeviceSize unusedRangeSize = size - lastOffset;
-                    ++outInfo.unusedRangeCount;
-                    outInfo.unusedBytes += unusedRangeSize;
-                    outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);
-                    outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);
-               }
-
-                // End of loop.
-                lastOffset = size;
-            }
-        }
-    }
-
-    outInfo.unusedBytes = size - outInfo.usedBytes;
-}
-
-void VmaBlockMetadata_Linear::AddPoolStats(VmaPoolStats& inoutStats) const
-{
-    const SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-    const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-    const VkDeviceSize size = GetSize();
-    const size_t suballoc1stCount = suballocations1st.size();
-    const size_t suballoc2ndCount = suballocations2nd.size();
-
-    inoutStats.size += size;
-
-    VkDeviceSize lastOffset = 0;
-
-    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)
-    {
-        const VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;
-        size_t nextAlloc2ndIndex = m_1stNullItemsBeginCount;
-        while(lastOffset < freeSpace2ndTo1stEnd)
-        {
-            // Find next non-null allocation or move nextAlloc2ndIndex to the end.
-            while(nextAlloc2ndIndex < suballoc2ndCount &&
-                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)
-            {
-                ++nextAlloc2ndIndex;
-            }
-
-            // Found non-null allocation.
-            if(nextAlloc2ndIndex < suballoc2ndCount)
-            {
-                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];
-            
-                // 1. Process free space before this allocation.
-                if(lastOffset < suballoc.offset)
-                {
-                    // There is free space from lastOffset to suballoc.offset.
-                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;
-                    inoutStats.unusedSize += unusedRangeSize;
-                    ++inoutStats.unusedRangeCount;
-                    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);
-                }
-            
-                // 2. Process this allocation.
-                // There is allocation with suballoc.offset, suballoc.size.
-                ++inoutStats.allocationCount;
-            
-                // 3. Prepare for next iteration.
-                lastOffset = suballoc.offset + suballoc.size;
-                ++nextAlloc2ndIndex;
-            }
-            // We are at the end.
-            else
-            {
-                if(lastOffset < freeSpace2ndTo1stEnd)
-                {
-                    // There is free space from lastOffset to freeSpace2ndTo1stEnd.
-                    const VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;
-                    inoutStats.unusedSize += unusedRangeSize;
-                    ++inoutStats.unusedRangeCount;
-                    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);
-                }
-
-                // End of loop.
-                lastOffset = freeSpace2ndTo1stEnd;
-            }
-        }
-    }
-
-    size_t nextAlloc1stIndex = m_1stNullItemsBeginCount;
-    const VkDeviceSize freeSpace1stTo2ndEnd =
-        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;
-    while(lastOffset < freeSpace1stTo2ndEnd)
-    {
-        // Find next non-null allocation or move nextAllocIndex to the end.
-        while(nextAlloc1stIndex < suballoc1stCount &&
-            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)
-        {
-            ++nextAlloc1stIndex;
-        }
-
-        // Found non-null allocation.
-        if(nextAlloc1stIndex < suballoc1stCount)
-        {
-            const VmaSuballocation& suballoc = suballocations1st[nextAlloc1stIndex];
-            
-            // 1. Process free space before this allocation.
-            if(lastOffset < suballoc.offset)
-            {
-                // There is free space from lastOffset to suballoc.offset.
-                const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;
-                inoutStats.unusedSize += unusedRangeSize;
-                ++inoutStats.unusedRangeCount;
-                inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);
-            }
-            
-            // 2. Process this allocation.
-            // There is allocation with suballoc.offset, suballoc.size.
-            ++inoutStats.allocationCount;
-            
-            // 3. Prepare for next iteration.
-            lastOffset = suballoc.offset + suballoc.size;
-            ++nextAlloc1stIndex;
-        }
-        // We are at the end.
-        else
-        {
-            if(lastOffset < freeSpace1stTo2ndEnd)
-            {
-                // There is free space from lastOffset to freeSpace1stTo2ndEnd.
-                const VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;
-                inoutStats.unusedSize += unusedRangeSize;
-                ++inoutStats.unusedRangeCount;
-                inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);
-            }
-
-            // End of loop.
-            lastOffset = freeSpace1stTo2ndEnd;
-        }
-    }
-
-    if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)
-    {
-        size_t nextAlloc2ndIndex = suballocations2nd.size() - 1;
-        while(lastOffset < size)
-        {
-            // Find next non-null allocation or move nextAlloc2ndIndex to the end.
-            while(nextAlloc2ndIndex != SIZE_MAX &&
-                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)
-            {
-                --nextAlloc2ndIndex;
-            }
-
-            // Found non-null allocation.
-            if(nextAlloc2ndIndex != SIZE_MAX)
-            {
-                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];
-            
-                // 1. Process free space before this allocation.
-                if(lastOffset < suballoc.offset)
-                {
-                    // There is free space from lastOffset to suballoc.offset.
-                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;
-                    inoutStats.unusedSize += unusedRangeSize;
-                    ++inoutStats.unusedRangeCount;
-                    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);
-                }
-            
-                // 2. Process this allocation.
-                // There is allocation with suballoc.offset, suballoc.size.
-                ++inoutStats.allocationCount;
-            
-                // 3. Prepare for next iteration.
-                lastOffset = suballoc.offset + suballoc.size;
-                --nextAlloc2ndIndex;
-            }
-            // We are at the end.
-            else
-            {
-                if(lastOffset < size)
-                {
-                    // There is free space from lastOffset to size.
-                    const VkDeviceSize unusedRangeSize = size - lastOffset;
-                    inoutStats.unusedSize += unusedRangeSize;
-                    ++inoutStats.unusedRangeCount;
-                    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);
-                }
-
-                // End of loop.
-                lastOffset = size;
-            }
-        }
-    }
-}
-
-#if VMA_STATS_STRING_ENABLED
-void VmaBlockMetadata_Linear::PrintDetailedMap(class VmaJsonWriter& json) const
-{
-    const VkDeviceSize size = GetSize();
-    const SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-    const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-    const size_t suballoc1stCount = suballocations1st.size();
-    const size_t suballoc2ndCount = suballocations2nd.size();
-
-    // FIRST PASS
-
-    size_t unusedRangeCount = 0;
-    VkDeviceSize usedBytes = 0;
-
-    VkDeviceSize lastOffset = 0;
-
-    size_t alloc2ndCount = 0;
-    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)
-    {
-        const VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;
-        size_t nextAlloc2ndIndex = 0;
-        while(lastOffset < freeSpace2ndTo1stEnd)
-        {
-            // Find next non-null allocation or move nextAlloc2ndIndex to the end.
-            while(nextAlloc2ndIndex < suballoc2ndCount &&
-                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)
-            {
-                ++nextAlloc2ndIndex;
-            }
-
-            // Found non-null allocation.
-            if(nextAlloc2ndIndex < suballoc2ndCount)
-            {
-                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];
-            
-                // 1. Process free space before this allocation.
-                if(lastOffset < suballoc.offset)
-                {
-                    // There is free space from lastOffset to suballoc.offset.
-                    ++unusedRangeCount;
-                }
-            
-                // 2. Process this allocation.
-                // There is allocation with suballoc.offset, suballoc.size.
-                ++alloc2ndCount;
-                usedBytes += suballoc.size;
-            
-                // 3. Prepare for next iteration.
-                lastOffset = suballoc.offset + suballoc.size;
-                ++nextAlloc2ndIndex;
-            }
-            // We are at the end.
-            else
-            {
-                if(lastOffset < freeSpace2ndTo1stEnd)
-                {
-                    // There is free space from lastOffset to freeSpace2ndTo1stEnd.
-                    ++unusedRangeCount;
-                }
-
-                // End of loop.
-                lastOffset = freeSpace2ndTo1stEnd;
-            }
-        }
-    }
-
-    size_t nextAlloc1stIndex = m_1stNullItemsBeginCount;
-    size_t alloc1stCount = 0;
-    const VkDeviceSize freeSpace1stTo2ndEnd =
-        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;
-    while(lastOffset < freeSpace1stTo2ndEnd)
-    {
-        // Find next non-null allocation or move nextAllocIndex to the end.
-        while(nextAlloc1stIndex < suballoc1stCount &&
-            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)
-        {
-            ++nextAlloc1stIndex;
-        }
-
-        // Found non-null allocation.
-        if(nextAlloc1stIndex < suballoc1stCount)
-        {
-            const VmaSuballocation& suballoc = suballocations1st[nextAlloc1stIndex];
-            
-            // 1. Process free space before this allocation.
-            if(lastOffset < suballoc.offset)
-            {
-                // There is free space from lastOffset to suballoc.offset.
-                ++unusedRangeCount;
-            }
-            
-            // 2. Process this allocation.
-            // There is allocation with suballoc.offset, suballoc.size.
-            ++alloc1stCount;
-            usedBytes += suballoc.size;
-            
-            // 3. Prepare for next iteration.
-            lastOffset = suballoc.offset + suballoc.size;
-            ++nextAlloc1stIndex;
-        }
-        // We are at the end.
-        else
-        {
-            if(lastOffset < size)
-            {
-                // There is free space from lastOffset to freeSpace1stTo2ndEnd.
-                ++unusedRangeCount;
-            }
-
-            // End of loop.
-            lastOffset = freeSpace1stTo2ndEnd;
-        }
-    }
-
-    if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)
-    {
-        size_t nextAlloc2ndIndex = suballocations2nd.size() - 1;
-        while(lastOffset < size)
-        {
-            // Find next non-null allocation or move nextAlloc2ndIndex to the end.
-            while(nextAlloc2ndIndex != SIZE_MAX &&
-                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)
-            {
-                --nextAlloc2ndIndex;
-            }
-
-            // Found non-null allocation.
-            if(nextAlloc2ndIndex != SIZE_MAX)
-            {
-                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];
-            
-                // 1. Process free space before this allocation.
-                if(lastOffset < suballoc.offset)
-                {
-                    // There is free space from lastOffset to suballoc.offset.
-                    ++unusedRangeCount;
-                }
-            
-                // 2. Process this allocation.
-                // There is allocation with suballoc.offset, suballoc.size.
-                ++alloc2ndCount;
-                usedBytes += suballoc.size;
-            
-                // 3. Prepare for next iteration.
-                lastOffset = suballoc.offset + suballoc.size;
-                --nextAlloc2ndIndex;
-            }
-            // We are at the end.
-            else
-            {
-                if(lastOffset < size)
-                {
-                    // There is free space from lastOffset to size.
-                    ++unusedRangeCount;
-                }
-
-                // End of loop.
-                lastOffset = size;
-            }
-        }
-    }
-
-    const VkDeviceSize unusedBytes = size - usedBytes;
-    PrintDetailedMap_Begin(json, unusedBytes, alloc1stCount + alloc2ndCount, unusedRangeCount);
-
-    // SECOND PASS
-    lastOffset = 0;
-
-    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)
-    {
-        const VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;
-        size_t nextAlloc2ndIndex = 0;
-        while(lastOffset < freeSpace2ndTo1stEnd)
-        {
-            // Find next non-null allocation or move nextAlloc2ndIndex to the end.
-            while(nextAlloc2ndIndex < suballoc2ndCount &&
-                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)
-            {
-                ++nextAlloc2ndIndex;
-            }
-
-            // Found non-null allocation.
-            if(nextAlloc2ndIndex < suballoc2ndCount)
-            {
-                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];
-            
-                // 1. Process free space before this allocation.
-                if(lastOffset < suballoc.offset)
-                {
-                    // There is free space from lastOffset to suballoc.offset.
-                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;
-                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);
-                }
-            
-                // 2. Process this allocation.
-                // There is allocation with suballoc.offset, suballoc.size.
-                PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);
-            
-                // 3. Prepare for next iteration.
-                lastOffset = suballoc.offset + suballoc.size;
-                ++nextAlloc2ndIndex;
-            }
-            // We are at the end.
-            else
-            {
-                if(lastOffset < freeSpace2ndTo1stEnd)
-                {
-                    // There is free space from lastOffset to freeSpace2ndTo1stEnd.
-                    const VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;
-                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);
-                }
-
-                // End of loop.
-                lastOffset = freeSpace2ndTo1stEnd;
-            }
-        }
-    }
-
-    nextAlloc1stIndex = m_1stNullItemsBeginCount;
-    while(lastOffset < freeSpace1stTo2ndEnd)
-    {
-        // Find next non-null allocation or move nextAllocIndex to the end.
-        while(nextAlloc1stIndex < suballoc1stCount &&
-            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)
-        {
-            ++nextAlloc1stIndex;
-        }
-
-        // Found non-null allocation.
-        if(nextAlloc1stIndex < suballoc1stCount)
-        {
-            const VmaSuballocation& suballoc = suballocations1st[nextAlloc1stIndex];
-            
-            // 1. Process free space before this allocation.
-            if(lastOffset < suballoc.offset)
-            {
-                // There is free space from lastOffset to suballoc.offset.
-                const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;
-                PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);
-            }
-            
-            // 2. Process this allocation.
-            // There is allocation with suballoc.offset, suballoc.size.
-            PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);
-            
-            // 3. Prepare for next iteration.
-            lastOffset = suballoc.offset + suballoc.size;
-            ++nextAlloc1stIndex;
-        }
-        // We are at the end.
-        else
-        {
-            if(lastOffset < freeSpace1stTo2ndEnd)
-            {
-                // There is free space from lastOffset to freeSpace1stTo2ndEnd.
-                const VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;
-                PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);
-            }
-
-            // End of loop.
-            lastOffset = freeSpace1stTo2ndEnd;
-        }
-    }
-
-    if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)
-    {
-        size_t nextAlloc2ndIndex = suballocations2nd.size() - 1;
-        while(lastOffset < size)
-        {
-            // Find next non-null allocation or move nextAlloc2ndIndex to the end.
-            while(nextAlloc2ndIndex != SIZE_MAX &&
-                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)
-            {
-                --nextAlloc2ndIndex;
-            }
-
-            // Found non-null allocation.
-            if(nextAlloc2ndIndex != SIZE_MAX)
-            {
-                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];
-            
-                // 1. Process free space before this allocation.
-                if(lastOffset < suballoc.offset)
-                {
-                    // There is free space from lastOffset to suballoc.offset.
-                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;
-                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);
-                }
-            
-                // 2. Process this allocation.
-                // There is allocation with suballoc.offset, suballoc.size.
-                PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);
-            
-                // 3. Prepare for next iteration.
-                lastOffset = suballoc.offset + suballoc.size;
-                --nextAlloc2ndIndex;
-            }
-            // We are at the end.
-            else
-            {
-                if(lastOffset < size)
-                {
-                    // There is free space from lastOffset to size.
-                    const VkDeviceSize unusedRangeSize = size - lastOffset;
-                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);
-                }
-
-                // End of loop.
-                lastOffset = size;
-            }
-        }
-    }
-
-    PrintDetailedMap_End(json);
-}
-#endif // #if VMA_STATS_STRING_ENABLED
-
-bool VmaBlockMetadata_Linear::CreateAllocationRequest(
-    uint32_t currentFrameIndex,
-    uint32_t frameInUseCount,
-    VkDeviceSize bufferImageGranularity,
-    VkDeviceSize allocSize,
-    VkDeviceSize allocAlignment,
-    bool upperAddress,
-    VmaSuballocationType allocType,
-    bool canMakeOtherLost,
-    uint32_t strategy,
-    VmaAllocationRequest* pAllocationRequest)
-{
-    VMA_ASSERT(allocSize > 0);
-    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);
-    VMA_ASSERT(pAllocationRequest != VMA_NULL);
-    VMA_HEAVY_ASSERT(Validate());
-    return upperAddress ?
-        CreateAllocationRequest_UpperAddress(
-            currentFrameIndex, frameInUseCount, bufferImageGranularity,
-            allocSize, allocAlignment, allocType, canMakeOtherLost, strategy, pAllocationRequest) :
-        CreateAllocationRequest_LowerAddress(
-            currentFrameIndex, frameInUseCount, bufferImageGranularity,
-            allocSize, allocAlignment, allocType, canMakeOtherLost, strategy, pAllocationRequest);
-}
-
-bool VmaBlockMetadata_Linear::CreateAllocationRequest_UpperAddress(
-    uint32_t currentFrameIndex,
-    uint32_t frameInUseCount,
-    VkDeviceSize bufferImageGranularity,
-    VkDeviceSize allocSize,
-    VkDeviceSize allocAlignment,
-    VmaSuballocationType allocType,
-    bool canMakeOtherLost,
-    uint32_t strategy,
-    VmaAllocationRequest* pAllocationRequest)
-{
-    const VkDeviceSize size = GetSize();
-    SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-
-    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)
-    {
-        VMA_ASSERT(0 && "Trying to use pool with linear algorithm as double stack, while it is already being used as ring buffer.");
-        return false;
-    }
-
-    // Try to allocate before 2nd.back(), or end of block if 2nd.empty().
-    if(allocSize > size)
-    {
-        return false;
-    }
-    VkDeviceSize resultBaseOffset = size - allocSize;
-    if(!suballocations2nd.empty())
-    {
-        const VmaSuballocation& lastSuballoc = suballocations2nd.back();
-        resultBaseOffset = lastSuballoc.offset - allocSize;
-        if(allocSize > lastSuballoc.offset)
-        {
-            return false;
-        }
-    }
-
-    // Start from offset equal to end of free space.
-    VkDeviceSize resultOffset = resultBaseOffset;
-
-    // Apply VMA_DEBUG_MARGIN at the end.
-    if(VMA_DEBUG_MARGIN > 0)
-    {
-        if(resultOffset < VMA_DEBUG_MARGIN)
-        {
-            return false;
-        }
-        resultOffset -= VMA_DEBUG_MARGIN;
-    }
-
-    // Apply alignment.
-    resultOffset = VmaAlignDown(resultOffset, allocAlignment);
-
-    // Check next suballocations from 2nd for BufferImageGranularity conflicts.
-    // Make bigger alignment if necessary.
-    if(bufferImageGranularity > 1 && !suballocations2nd.empty())
-    {
-        bool bufferImageGranularityConflict = false;
-        for(size_t nextSuballocIndex = suballocations2nd.size(); nextSuballocIndex--; )
-        {
-            const VmaSuballocation& nextSuballoc = suballocations2nd[nextSuballocIndex];
-            if(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))
-            {
-                if(VmaIsBufferImageGranularityConflict(nextSuballoc.type, allocType))
-                {
-                    bufferImageGranularityConflict = true;
-                    break;
-                }
-            }
-            else
-                // Already on previous page.
-                break;
-        }
-        if(bufferImageGranularityConflict)
-        {
-            resultOffset = VmaAlignDown(resultOffset, bufferImageGranularity);
-        }
-    }
-
-    // There is enough free space.
-    const VkDeviceSize endOf1st = !suballocations1st.empty() ?
-        suballocations1st.back().offset + suballocations1st.back().size :
-        0;
-    if(endOf1st + VMA_DEBUG_MARGIN <= resultOffset)
-    {
-        // Check previous suballocations for BufferImageGranularity conflicts.
-        // If conflict exists, allocation cannot be made here.
-        if(bufferImageGranularity > 1)
-        {
-            for(size_t prevSuballocIndex = suballocations1st.size(); prevSuballocIndex--; )
-            {
-                const VmaSuballocation& prevSuballoc = suballocations1st[prevSuballocIndex];
-                if(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))
-                {
-                    if(VmaIsBufferImageGranularityConflict(allocType, prevSuballoc.type))
-                    {
-                        return false;
-                    }
-                }
-                else
-                {
-                    // Already on next page.
-                    break;
-                }
-            }
-        }
-
-        // All tests passed: Success.
-        pAllocationRequest->offset = resultOffset;
-        pAllocationRequest->sumFreeSize = resultBaseOffset + allocSize - endOf1st;
-        pAllocationRequest->sumItemSize = 0;
-        // pAllocationRequest->item unused.
-        pAllocationRequest->itemsToMakeLostCount = 0;
-        pAllocationRequest->type = VmaAllocationRequestType::UpperAddress;
-        return true;
-    }
-
-    return false;
-}
-
-bool VmaBlockMetadata_Linear::CreateAllocationRequest_LowerAddress(
-    uint32_t currentFrameIndex,
-    uint32_t frameInUseCount,
-    VkDeviceSize bufferImageGranularity,
-    VkDeviceSize allocSize,
-    VkDeviceSize allocAlignment,
-    VmaSuballocationType allocType,
-    bool canMakeOtherLost,
-    uint32_t strategy,
-    VmaAllocationRequest* pAllocationRequest)
-{
-    const VkDeviceSize size = GetSize();
-    SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-
-    if(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)
-    {
-        // Try to allocate at the end of 1st vector.
-
-        VkDeviceSize resultBaseOffset = 0;
-        if(!suballocations1st.empty())
-        {
-            const VmaSuballocation& lastSuballoc = suballocations1st.back();
-            resultBaseOffset = lastSuballoc.offset + lastSuballoc.size;
-        }
-
-        // Start from offset equal to beginning of free space.
-        VkDeviceSize resultOffset = resultBaseOffset;
-
-        // Apply VMA_DEBUG_MARGIN at the beginning.
-        if(VMA_DEBUG_MARGIN > 0)
-        {
-            resultOffset += VMA_DEBUG_MARGIN;
-        }
-
-        // Apply alignment.
-        resultOffset = VmaAlignUp(resultOffset, allocAlignment);
-
-        // Check previous suballocations for BufferImageGranularity conflicts.
-        // Make bigger alignment if necessary.
-        if(bufferImageGranularity > 1 && !suballocations1st.empty())
-        {
-            bool bufferImageGranularityConflict = false;
-            for(size_t prevSuballocIndex = suballocations1st.size(); prevSuballocIndex--; )
-            {
-                const VmaSuballocation& prevSuballoc = suballocations1st[prevSuballocIndex];
-                if(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))
-                {
-                    if(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))
-                    {
-                        bufferImageGranularityConflict = true;
-                        break;
-                    }
-                }
-                else
-                    // Already on previous page.
-                    break;
-            }
-            if(bufferImageGranularityConflict)
-            {
-                resultOffset = VmaAlignUp(resultOffset, bufferImageGranularity);
-            }
-        }
-
-        const VkDeviceSize freeSpaceEnd = m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ?
-            suballocations2nd.back().offset : size;
-
-        // There is enough free space at the end after alignment.
-        if(resultOffset + allocSize + VMA_DEBUG_MARGIN <= freeSpaceEnd)
-        {
-            // Check next suballocations for BufferImageGranularity conflicts.
-            // If conflict exists, allocation cannot be made here.
-            if(bufferImageGranularity > 1 && m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)
-            {
-                for(size_t nextSuballocIndex = suballocations2nd.size(); nextSuballocIndex--; )
-                {
-                    const VmaSuballocation& nextSuballoc = suballocations2nd[nextSuballocIndex];
-                    if(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))
-                    {
-                        if(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))
-                        {
-                            return false;
-                        }
-                    }
-                    else
-                    {
-                        // Already on previous page.
-                        break;
-                    }
-                }
-            }
-
-            // All tests passed: Success.
-            pAllocationRequest->offset = resultOffset;
-            pAllocationRequest->sumFreeSize = freeSpaceEnd - resultBaseOffset;
-            pAllocationRequest->sumItemSize = 0;
-            // pAllocationRequest->item, customData unused.
-            pAllocationRequest->type = VmaAllocationRequestType::EndOf1st;
-            pAllocationRequest->itemsToMakeLostCount = 0;
-            return true;
-        }
-    }
-
-    // Wrap-around to end of 2nd vector. Try to allocate there, watching for the
-    // beginning of 1st vector as the end of free space.
-    if(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)
-    {
-        VMA_ASSERT(!suballocations1st.empty());
-
-        VkDeviceSize resultBaseOffset = 0;
-        if(!suballocations2nd.empty())
-        {
-            const VmaSuballocation& lastSuballoc = suballocations2nd.back();
-            resultBaseOffset = lastSuballoc.offset + lastSuballoc.size;
-        }
-
-        // Start from offset equal to beginning of free space.
-        VkDeviceSize resultOffset = resultBaseOffset;
-
-        // Apply VMA_DEBUG_MARGIN at the beginning.
-        if(VMA_DEBUG_MARGIN > 0)
-        {
-            resultOffset += VMA_DEBUG_MARGIN;
-        }
-
-        // Apply alignment.
-        resultOffset = VmaAlignUp(resultOffset, allocAlignment);
-
-        // Check previous suballocations for BufferImageGranularity conflicts.
-        // Make bigger alignment if necessary.
-        if(bufferImageGranularity > 1 && !suballocations2nd.empty())
-        {
-            bool bufferImageGranularityConflict = false;
-            for(size_t prevSuballocIndex = suballocations2nd.size(); prevSuballocIndex--; )
-            {
-                const VmaSuballocation& prevSuballoc = suballocations2nd[prevSuballocIndex];
-                if(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))
-                {
-                    if(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))
-                    {
-                        bufferImageGranularityConflict = true;
-                        break;
-                    }
-                }
-                else
-                    // Already on previous page.
-                    break;
-            }
-            if(bufferImageGranularityConflict)
-            {
-                resultOffset = VmaAlignUp(resultOffset, bufferImageGranularity);
-            }
-        }
-
-        pAllocationRequest->itemsToMakeLostCount = 0;
-        pAllocationRequest->sumItemSize = 0;
-        size_t index1st = m_1stNullItemsBeginCount;
-
-        if(canMakeOtherLost)
-        {
-            while(index1st < suballocations1st.size() &&
-                resultOffset + allocSize + VMA_DEBUG_MARGIN > suballocations1st[index1st].offset)
-            {
-                // Next colliding allocation at the beginning of 1st vector found. Try to make it lost.
-                const VmaSuballocation& suballoc = suballocations1st[index1st];
-                if(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE)
-                {
-                    // No problem.
-                }
-                else
-                {
-                    VMA_ASSERT(suballoc.hAllocation != VK_NULL_HANDLE);
-                    if(suballoc.hAllocation->CanBecomeLost() &&
-                        suballoc.hAllocation->GetLastUseFrameIndex() + frameInUseCount < currentFrameIndex)
-                    {
-                        ++pAllocationRequest->itemsToMakeLostCount;
-                        pAllocationRequest->sumItemSize += suballoc.size;
-                    }
-                    else
-                    {
-                        return false;
-                    }
-                }
-                ++index1st;
-            }
-
-            // Check next suballocations for BufferImageGranularity conflicts.
-            // If conflict exists, we must mark more allocations lost or fail.
-            if(bufferImageGranularity > 1)
-            {
-                while(index1st < suballocations1st.size())
-                {
-                    const VmaSuballocation& suballoc = suballocations1st[index1st];
-                    if(VmaBlocksOnSamePage(resultOffset, allocSize, suballoc.offset, bufferImageGranularity))
-                    {
-                        if(suballoc.hAllocation != VK_NULL_HANDLE)
-                        {
-                            // Not checking actual VmaIsBufferImageGranularityConflict(allocType, suballoc.type).
-                            if(suballoc.hAllocation->CanBecomeLost() &&
-                                suballoc.hAllocation->GetLastUseFrameIndex() + frameInUseCount < currentFrameIndex)
-                            {
-                                ++pAllocationRequest->itemsToMakeLostCount;
-                                pAllocationRequest->sumItemSize += suballoc.size;
-                            }
-                            else
-                            {
-                                return false;
-                            }
-                        }
-                    }
-                    else
-                    {
-                        // Already on next page.
-                        break;
-                    }
-                    ++index1st;
-                }
-            }
-
-            // Special case: There is not enough room at the end for this allocation, even after making all from the 1st lost.
-            if(index1st == suballocations1st.size() &&
-                resultOffset + allocSize + VMA_DEBUG_MARGIN > size)
-            {
-                // TODO: This is a known bug that it's not yet implemented and the allocation is failing.
-                VMA_DEBUG_LOG("Unsupported special case in custom pool with linear allocation algorithm used as ring buffer with allocations that can be lost.");
-            }
-        }
-
-        // There is enough free space at the end after alignment.
-        if((index1st == suballocations1st.size() && resultOffset + allocSize + VMA_DEBUG_MARGIN <= size) ||
-            (index1st < suballocations1st.size() && resultOffset + allocSize + VMA_DEBUG_MARGIN <= suballocations1st[index1st].offset))
-        {
-            // Check next suballocations for BufferImageGranularity conflicts.
-            // If conflict exists, allocation cannot be made here.
-            if(bufferImageGranularity > 1)
-            {
-                for(size_t nextSuballocIndex = index1st;
-                    nextSuballocIndex < suballocations1st.size();
-                    nextSuballocIndex++)
-                {
-                    const VmaSuballocation& nextSuballoc = suballocations1st[nextSuballocIndex];
-                    if(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))
-                    {
-                        if(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))
-                        {
-                            return false;
-                        }
-                    }
-                    else
-                    {
-                        // Already on next page.
-                        break;
-                    }
-                }
-            }
-
-            // All tests passed: Success.
-            pAllocationRequest->offset = resultOffset;
-            pAllocationRequest->sumFreeSize =
-                (index1st < suballocations1st.size() ? suballocations1st[index1st].offset : size)
-                - resultBaseOffset
-                - pAllocationRequest->sumItemSize;
-            pAllocationRequest->type = VmaAllocationRequestType::EndOf2nd;
-            // pAllocationRequest->item, customData unused.
-            return true;
-        }
-    }
-
-    return false;
-}
-
-bool VmaBlockMetadata_Linear::MakeRequestedAllocationsLost(
-    uint32_t currentFrameIndex,
-    uint32_t frameInUseCount,
-    VmaAllocationRequest* pAllocationRequest)
-{
-    if(pAllocationRequest->itemsToMakeLostCount == 0)
-    {
-        return true;
-    }
-
-    VMA_ASSERT(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER);
-    
-    // We always start from 1st.
-    SuballocationVectorType* suballocations = &AccessSuballocations1st();
-    size_t index = m_1stNullItemsBeginCount;
-    size_t madeLostCount = 0;
-    while(madeLostCount < pAllocationRequest->itemsToMakeLostCount)
-    {
-        if(index == suballocations->size())
-        {
-            index = 0;
-            // If we get to the end of 1st, we wrap around to beginning of 2nd of 1st.
-            if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)
-            {
-                suballocations = &AccessSuballocations2nd();
-            }
-            // else: m_2ndVectorMode == SECOND_VECTOR_EMPTY:
-            // suballocations continues pointing at AccessSuballocations1st().
-            VMA_ASSERT(!suballocations->empty());
-        }
-        VmaSuballocation& suballoc = (*suballocations)[index];
-        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)
-        {
-            VMA_ASSERT(suballoc.hAllocation != VK_NULL_HANDLE);
-            VMA_ASSERT(suballoc.hAllocation->CanBecomeLost());
-            if(suballoc.hAllocation->MakeLost(currentFrameIndex, frameInUseCount))
-            {
-                suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;
-                suballoc.hAllocation = VK_NULL_HANDLE;
-                m_SumFreeSize += suballoc.size;
-                if(suballocations == &AccessSuballocations1st())
-                {
-                    ++m_1stNullItemsMiddleCount;
-                }
-                else
-                {
-                    ++m_2ndNullItemsCount;
-                }
-                ++madeLostCount;
-            }
-            else
-            {
-                return false;
-            }
-        }
-        ++index;
-    }
-
-    CleanupAfterFree();
-    //VMA_HEAVY_ASSERT(Validate()); // Already called by ClanupAfterFree().
-    
-    return true;
-}
-
-uint32_t VmaBlockMetadata_Linear::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)
-{
-    uint32_t lostAllocationCount = 0;
-    
-    SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-    for(size_t i = m_1stNullItemsBeginCount, count = suballocations1st.size(); i < count; ++i)
-    {
-        VmaSuballocation& suballoc = suballocations1st[i];
-        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE &&
-            suballoc.hAllocation->CanBecomeLost() &&
-            suballoc.hAllocation->MakeLost(currentFrameIndex, frameInUseCount))
-        {
-            suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;
-            suballoc.hAllocation = VK_NULL_HANDLE;
-            ++m_1stNullItemsMiddleCount;
-            m_SumFreeSize += suballoc.size;
-            ++lostAllocationCount;
-        }
-    }
-
-    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-    for(size_t i = 0, count = suballocations2nd.size(); i < count; ++i)
-    {
-        VmaSuballocation& suballoc = suballocations2nd[i];
-        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE &&
-            suballoc.hAllocation->CanBecomeLost() &&
-            suballoc.hAllocation->MakeLost(currentFrameIndex, frameInUseCount))
-        {
-            suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;
-            suballoc.hAllocation = VK_NULL_HANDLE;
-            ++m_2ndNullItemsCount;
-            m_SumFreeSize += suballoc.size;
-            ++lostAllocationCount;
-        }
-    }
-
-    if(lostAllocationCount)
-    {
-        CleanupAfterFree();
-    }
-
-    return lostAllocationCount;
-}
-
-VkResult VmaBlockMetadata_Linear::CheckCorruption(const void* pBlockData)
-{
-    SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-    for(size_t i = m_1stNullItemsBeginCount, count = suballocations1st.size(); i < count; ++i)
-    {
-        const VmaSuballocation& suballoc = suballocations1st[i];
-        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)
-        {
-            if(!VmaValidateMagicValue(pBlockData, suballoc.offset - VMA_DEBUG_MARGIN))
-            {
-                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!");
-                return VK_ERROR_VALIDATION_FAILED_EXT;
-            }
-            if(!VmaValidateMagicValue(pBlockData, suballoc.offset + suballoc.size))
-            {
-                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!");
-                return VK_ERROR_VALIDATION_FAILED_EXT;
-            }
-        }
-    }
-
-    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-    for(size_t i = 0, count = suballocations2nd.size(); i < count; ++i)
-    {
-        const VmaSuballocation& suballoc = suballocations2nd[i];
-        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)
-        {
-            if(!VmaValidateMagicValue(pBlockData, suballoc.offset - VMA_DEBUG_MARGIN))
-            {
-                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!");
-                return VK_ERROR_VALIDATION_FAILED_EXT;
-            }
-            if(!VmaValidateMagicValue(pBlockData, suballoc.offset + suballoc.size))
-            {
-                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!");
-                return VK_ERROR_VALIDATION_FAILED_EXT;
-            }
-        }
-    }
-
-    return VK_SUCCESS;
-}
-
-void VmaBlockMetadata_Linear::Alloc(
-    const VmaAllocationRequest& request,
-    VmaSuballocationType type,
-    VkDeviceSize allocSize,
-    VmaAllocation hAllocation)
-{
-    const VmaSuballocation newSuballoc = { request.offset, allocSize, hAllocation, type };
-
-    switch(request.type)
-    {
-    case VmaAllocationRequestType::UpperAddress:
-        {
-            VMA_ASSERT(m_2ndVectorMode != SECOND_VECTOR_RING_BUFFER &&
-                "CRITICAL ERROR: Trying to use linear allocator as double stack while it was already used as ring buffer.");
-            SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-            suballocations2nd.push_back(newSuballoc);
-            m_2ndVectorMode = SECOND_VECTOR_DOUBLE_STACK;
-        }
-        break;
-    case VmaAllocationRequestType::EndOf1st:
-        {
-            SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-
-            VMA_ASSERT(suballocations1st.empty() ||
-                request.offset >= suballocations1st.back().offset + suballocations1st.back().size);
-            // Check if it fits before the end of the block.
-            VMA_ASSERT(request.offset + allocSize <= GetSize());
-
-            suballocations1st.push_back(newSuballoc);
-        }
-        break;
-    case VmaAllocationRequestType::EndOf2nd:
-        {
-            SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-            // New allocation at the end of 2-part ring buffer, so before first allocation from 1st vector.
-            VMA_ASSERT(!suballocations1st.empty() &&
-                request.offset + allocSize <= suballocations1st[m_1stNullItemsBeginCount].offset);
-            SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-
-            switch(m_2ndVectorMode)
-            {
-            case SECOND_VECTOR_EMPTY:
-                // First allocation from second part ring buffer.
-                VMA_ASSERT(suballocations2nd.empty());
-                m_2ndVectorMode = SECOND_VECTOR_RING_BUFFER;
-                break;
-            case SECOND_VECTOR_RING_BUFFER:
-                // 2-part ring buffer is already started.
-                VMA_ASSERT(!suballocations2nd.empty());
-                break;
-            case SECOND_VECTOR_DOUBLE_STACK:
-                VMA_ASSERT(0 && "CRITICAL ERROR: Trying to use linear allocator as ring buffer while it was already used as double stack.");
-                break;
-            default:
-                VMA_ASSERT(0);
-            }
-
-            suballocations2nd.push_back(newSuballoc);
-        }
-        break;
-    default:
-        VMA_ASSERT(0 && "CRITICAL INTERNAL ERROR.");
-    }
-
-    m_SumFreeSize -= newSuballoc.size;
-}
-
-void VmaBlockMetadata_Linear::Free(const VmaAllocation allocation)
-{
-    FreeAtOffset(allocation->GetOffset());
-}
-
-void VmaBlockMetadata_Linear::FreeAtOffset(VkDeviceSize offset)
-{
-    SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-
-    if(!suballocations1st.empty())
-    {
-        // First allocation: Mark it as next empty at the beginning.
-        VmaSuballocation& firstSuballoc = suballocations1st[m_1stNullItemsBeginCount];
-        if(firstSuballoc.offset == offset)
-        {
-            firstSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;
-            firstSuballoc.hAllocation = VK_NULL_HANDLE;
-            m_SumFreeSize += firstSuballoc.size;
-            ++m_1stNullItemsBeginCount;
-            CleanupAfterFree();
-            return;
-        }
-    }
-
-    // Last allocation in 2-part ring buffer or top of upper stack (same logic).
-    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER ||
-        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)
-    {
-        VmaSuballocation& lastSuballoc = suballocations2nd.back();
-        if(lastSuballoc.offset == offset)
-        {
-            m_SumFreeSize += lastSuballoc.size;
-            suballocations2nd.pop_back();
-            CleanupAfterFree();
-            return;
-        }
-    }
-    // Last allocation in 1st vector.
-    else if(m_2ndVectorMode == SECOND_VECTOR_EMPTY)
-    {
-        VmaSuballocation& lastSuballoc = suballocations1st.back();
-        if(lastSuballoc.offset == offset)
-        {
-            m_SumFreeSize += lastSuballoc.size;
-            suballocations1st.pop_back();
-            CleanupAfterFree();
-            return;
-        }
-    }
-
-    // Item from the middle of 1st vector.
-    {
-        VmaSuballocation refSuballoc;
-        refSuballoc.offset = offset;
-        // Rest of members stays uninitialized intentionally for better performance.
-        SuballocationVectorType::iterator it = VmaBinaryFindSorted(
-            suballocations1st.begin() + m_1stNullItemsBeginCount,
-            suballocations1st.end(),
-            refSuballoc,
-            VmaSuballocationOffsetLess());
-        if(it != suballocations1st.end())
-        {
-            it->type = VMA_SUBALLOCATION_TYPE_FREE;
-            it->hAllocation = VK_NULL_HANDLE;
-            ++m_1stNullItemsMiddleCount;
-            m_SumFreeSize += it->size;
-            CleanupAfterFree();
-            return;
-        }
-    }
-
-    if(m_2ndVectorMode != SECOND_VECTOR_EMPTY)
-    {
-        // Item from the middle of 2nd vector.
-        VmaSuballocation refSuballoc;
-        refSuballoc.offset = offset;
-        // Rest of members stays uninitialized intentionally for better performance.
-        SuballocationVectorType::iterator it = m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER ?
-            VmaBinaryFindSorted(suballocations2nd.begin(), suballocations2nd.end(), refSuballoc, VmaSuballocationOffsetLess()) :
-            VmaBinaryFindSorted(suballocations2nd.begin(), suballocations2nd.end(), refSuballoc, VmaSuballocationOffsetGreater());
-        if(it != suballocations2nd.end())
-        {
-            it->type = VMA_SUBALLOCATION_TYPE_FREE;
-            it->hAllocation = VK_NULL_HANDLE;
-            ++m_2ndNullItemsCount;
-            m_SumFreeSize += it->size;
-            CleanupAfterFree();
-            return;
-        }
-    }
-
-    VMA_ASSERT(0 && "Allocation to free not found in linear allocator!");
-}
-
-bool VmaBlockMetadata_Linear::ShouldCompact1st() const
-{
-    const size_t nullItemCount = m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount;
-    const size_t suballocCount = AccessSuballocations1st().size();
-    return suballocCount > 32 && nullItemCount * 2 >= (suballocCount - nullItemCount) * 3;
-}
-
-void VmaBlockMetadata_Linear::CleanupAfterFree()
-{
-    SuballocationVectorType& suballocations1st = AccessSuballocations1st();
-    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-
-    if(IsEmpty())
-    {
-        suballocations1st.clear();
-        suballocations2nd.clear();
-        m_1stNullItemsBeginCount = 0;
-        m_1stNullItemsMiddleCount = 0;
-        m_2ndNullItemsCount = 0;
-        m_2ndVectorMode = SECOND_VECTOR_EMPTY;
-    }
-    else
-    {
-        const size_t suballoc1stCount = suballocations1st.size();
-        const size_t nullItem1stCount = m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount;
-        VMA_ASSERT(nullItem1stCount <= suballoc1stCount);
-
-        // Find more null items at the beginning of 1st vector.
-        while(m_1stNullItemsBeginCount < suballoc1stCount &&
-            suballocations1st[m_1stNullItemsBeginCount].hAllocation == VK_NULL_HANDLE)
-        {
-            ++m_1stNullItemsBeginCount;
-            --m_1stNullItemsMiddleCount;
-        }
-
-        // Find more null items at the end of 1st vector.
-        while(m_1stNullItemsMiddleCount > 0 &&
-            suballocations1st.back().hAllocation == VK_NULL_HANDLE)
-        {
-            --m_1stNullItemsMiddleCount;
-            suballocations1st.pop_back();
-        }
-
-        // Find more null items at the end of 2nd vector.
-        while(m_2ndNullItemsCount > 0 &&
-            suballocations2nd.back().hAllocation == VK_NULL_HANDLE)
-        {
-            --m_2ndNullItemsCount;
-            suballocations2nd.pop_back();
-        }
-
-        // Find more null items at the beginning of 2nd vector.
-        while(m_2ndNullItemsCount > 0 &&
-            suballocations2nd[0].hAllocation == VK_NULL_HANDLE)
-        {
-            --m_2ndNullItemsCount;
-            VmaVectorRemove(suballocations2nd, 0);
-        }
-
-        if(ShouldCompact1st())
-        {
-            const size_t nonNullItemCount = suballoc1stCount - nullItem1stCount;
-            size_t srcIndex = m_1stNullItemsBeginCount;
-            for(size_t dstIndex = 0; dstIndex < nonNullItemCount; ++dstIndex)
-            {
-                while(suballocations1st[srcIndex].hAllocation == VK_NULL_HANDLE)
-                {
-                    ++srcIndex;
-                }
-                if(dstIndex != srcIndex)
-                {
-                    suballocations1st[dstIndex] = suballocations1st[srcIndex];
-                }
-                ++srcIndex;
-            }
-            suballocations1st.resize(nonNullItemCount);
-            m_1stNullItemsBeginCount = 0;
-            m_1stNullItemsMiddleCount = 0;
-        }
-
-        // 2nd vector became empty.
-        if(suballocations2nd.empty())
-        {
-            m_2ndVectorMode = SECOND_VECTOR_EMPTY;
-        }
-
-        // 1st vector became empty.
-        if(suballocations1st.size() - m_1stNullItemsBeginCount == 0)
-        {
-            suballocations1st.clear();
-            m_1stNullItemsBeginCount = 0;
-
-            if(!suballocations2nd.empty() && m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)
-            {
-                // Swap 1st with 2nd. Now 2nd is empty.
-                m_2ndVectorMode = SECOND_VECTOR_EMPTY;
-                m_1stNullItemsMiddleCount = m_2ndNullItemsCount;
-                while(m_1stNullItemsBeginCount < suballocations2nd.size() &&
-                    suballocations2nd[m_1stNullItemsBeginCount].hAllocation == VK_NULL_HANDLE)
-                {
-                    ++m_1stNullItemsBeginCount;
-                    --m_1stNullItemsMiddleCount;
-                }
-                m_2ndNullItemsCount = 0;
-                m_1stVectorIndex ^= 1;
-            }
-        }
-    }
-
-    VMA_HEAVY_ASSERT(Validate());
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// class VmaBlockMetadata_Buddy
-
-VmaBlockMetadata_Buddy::VmaBlockMetadata_Buddy(VmaAllocator hAllocator) :
-    VmaBlockMetadata(hAllocator),
-    m_Root(VMA_NULL),
-    m_AllocationCount(0),
-    m_FreeCount(1),
-    m_SumFreeSize(0)
-{
-    memset(m_FreeList, 0, sizeof(m_FreeList));
-}
-
-VmaBlockMetadata_Buddy::~VmaBlockMetadata_Buddy()
-{
-    DeleteNode(m_Root);
-}
-
-void VmaBlockMetadata_Buddy::Init(VkDeviceSize size)
-{
-    VmaBlockMetadata::Init(size);
-
-    m_UsableSize = VmaPrevPow2(size);
-    m_SumFreeSize = m_UsableSize;
-
-    // Calculate m_LevelCount.
-    m_LevelCount = 1;
-    while(m_LevelCount < MAX_LEVELS &&
-        LevelToNodeSize(m_LevelCount) >= MIN_NODE_SIZE)
-    {
-        ++m_LevelCount;
-    }
-
-    Node* rootNode = vma_new(GetAllocationCallbacks(), Node)();
-    rootNode->offset = 0;
-    rootNode->type = Node::TYPE_FREE;
-    rootNode->parent = VMA_NULL;
-    rootNode->buddy = VMA_NULL;
-
-    m_Root = rootNode;
-    AddToFreeListFront(0, rootNode);
-}
-
-bool VmaBlockMetadata_Buddy::Validate() const
-{
-    // Validate tree.
-    ValidationContext ctx;
-    if(!ValidateNode(ctx, VMA_NULL, m_Root, 0, LevelToNodeSize(0)))
-    {
-        VMA_VALIDATE(false && "ValidateNode failed.");
-    }
-    VMA_VALIDATE(m_AllocationCount == ctx.calculatedAllocationCount);
-    VMA_VALIDATE(m_SumFreeSize == ctx.calculatedSumFreeSize);
-
-    // Validate free node lists.
-    for(uint32_t level = 0; level < m_LevelCount; ++level)
-    {
-        VMA_VALIDATE(m_FreeList[level].front == VMA_NULL ||
-            m_FreeList[level].front->free.prev == VMA_NULL);
-
-        for(Node* node = m_FreeList[level].front;
-            node != VMA_NULL;
-            node = node->free.next)
-        {
-            VMA_VALIDATE(node->type == Node::TYPE_FREE);
-            
-            if(node->free.next == VMA_NULL)
-            {
-                VMA_VALIDATE(m_FreeList[level].back == node);
-            }
-            else
-            {
-                VMA_VALIDATE(node->free.next->free.prev == node);
-            }
-        }
-    }
-
-    // Validate that free lists ar higher levels are empty.
-    for(uint32_t level = m_LevelCount; level < MAX_LEVELS; ++level)
-    {
-        VMA_VALIDATE(m_FreeList[level].front == VMA_NULL && m_FreeList[level].back == VMA_NULL);
-    }
-
-    return true;
-}
-
-VkDeviceSize VmaBlockMetadata_Buddy::GetUnusedRangeSizeMax() const
-{
-    for(uint32_t level = 0; level < m_LevelCount; ++level)
-    {
-        if(m_FreeList[level].front != VMA_NULL)
-        {
-            return LevelToNodeSize(level);
-        }
-    }
-    return 0;
-}
-
-void VmaBlockMetadata_Buddy::CalcAllocationStatInfo(VmaStatInfo& outInfo) const
-{
-    const VkDeviceSize unusableSize = GetUnusableSize();
-
-    outInfo.blockCount = 1;
-
-    outInfo.allocationCount = outInfo.unusedRangeCount = 0;
-    outInfo.usedBytes = outInfo.unusedBytes = 0;
-
-    outInfo.allocationSizeMax = outInfo.unusedRangeSizeMax = 0;
-    outInfo.allocationSizeMin = outInfo.unusedRangeSizeMin = UINT64_MAX;
-    outInfo.allocationSizeAvg = outInfo.unusedRangeSizeAvg = 0; // Unused.
-
-    CalcAllocationStatInfoNode(outInfo, m_Root, LevelToNodeSize(0));
-
-    if(unusableSize > 0)
-    {
-        ++outInfo.unusedRangeCount;
-        outInfo.unusedBytes += unusableSize;
-        outInfo.unusedRangeSizeMax = VMA_MAX(outInfo.unusedRangeSizeMax, unusableSize);
-        outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusableSize);
-    }
-}
-
-void VmaBlockMetadata_Buddy::AddPoolStats(VmaPoolStats& inoutStats) const
-{
-    const VkDeviceSize unusableSize = GetUnusableSize();
-
-    inoutStats.size += GetSize();
-    inoutStats.unusedSize += m_SumFreeSize + unusableSize;
-    inoutStats.allocationCount += m_AllocationCount;
-    inoutStats.unusedRangeCount += m_FreeCount;
-    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, GetUnusedRangeSizeMax());
-
-    if(unusableSize > 0)
-    {
-        ++inoutStats.unusedRangeCount;
-        // Not updating inoutStats.unusedRangeSizeMax with unusableSize because this space is not available for allocations.
-    }
-}
-
-#if VMA_STATS_STRING_ENABLED
-
-void VmaBlockMetadata_Buddy::PrintDetailedMap(class VmaJsonWriter& json) const
-{
-    // TODO optimize
-    VmaStatInfo stat;
-    CalcAllocationStatInfo(stat);
-
-    PrintDetailedMap_Begin(
-        json,
-        stat.unusedBytes,
-        stat.allocationCount,
-        stat.unusedRangeCount);
-
-    PrintDetailedMapNode(json, m_Root, LevelToNodeSize(0));
-
-    const VkDeviceSize unusableSize = GetUnusableSize();
-    if(unusableSize > 0)
-    {
-        PrintDetailedMap_UnusedRange(json,
-            m_UsableSize, // offset
-            unusableSize); // size
-    }
-
-    PrintDetailedMap_End(json);
-}
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-bool VmaBlockMetadata_Buddy::CreateAllocationRequest(
-    uint32_t currentFrameIndex,
-    uint32_t frameInUseCount,
-    VkDeviceSize bufferImageGranularity,
-    VkDeviceSize allocSize,
-    VkDeviceSize allocAlignment,
-    bool upperAddress,
-    VmaSuballocationType allocType,
-    bool canMakeOtherLost,
-    uint32_t strategy,
-    VmaAllocationRequest* pAllocationRequest)
-{
-    VMA_ASSERT(!upperAddress && "VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT can be used only with linear algorithm.");
-
-    // Simple way to respect bufferImageGranularity. May be optimized some day.
-    // Whenever it might be an OPTIMAL image...
-    if(allocType == VMA_SUBALLOCATION_TYPE_UNKNOWN ||
-        allocType == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||
-        allocType == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL)
-    {
-        allocAlignment = VMA_MAX(allocAlignment, bufferImageGranularity);
-        allocSize = VMA_MAX(allocSize, bufferImageGranularity);
-    }
-
-    if(allocSize > m_UsableSize)
-    {
-        return false;
-    }
-
-    const uint32_t targetLevel = AllocSizeToLevel(allocSize);
-    for(uint32_t level = targetLevel + 1; level--; )
-    {
-        for(Node* freeNode = m_FreeList[level].front;
-            freeNode != VMA_NULL;
-            freeNode = freeNode->free.next)
-        {
-            if(freeNode->offset % allocAlignment == 0)
-            {
-                pAllocationRequest->type = VmaAllocationRequestType::Normal;
-                pAllocationRequest->offset = freeNode->offset;
-                pAllocationRequest->sumFreeSize = LevelToNodeSize(level);
-                pAllocationRequest->sumItemSize = 0;
-                pAllocationRequest->itemsToMakeLostCount = 0;
-                pAllocationRequest->customData = (void*)(uintptr_t)level;
-                return true;
-            }
-        }
-    }
-
-    return false;
-}
-
-bool VmaBlockMetadata_Buddy::MakeRequestedAllocationsLost(
-    uint32_t currentFrameIndex,
-    uint32_t frameInUseCount,
-    VmaAllocationRequest* pAllocationRequest)
-{
-    /*
-    Lost allocations are not supported in buddy allocator at the moment.
-    Support might be added in the future.
-    */
-    return pAllocationRequest->itemsToMakeLostCount == 0;
-}
-
-uint32_t VmaBlockMetadata_Buddy::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)
-{
-    /*
-    Lost allocations are not supported in buddy allocator at the moment.
-    Support might be added in the future.
-    */
-    return 0;
-}
-
-void VmaBlockMetadata_Buddy::Alloc(
-    const VmaAllocationRequest& request,
-    VmaSuballocationType type,
-    VkDeviceSize allocSize,
-    VmaAllocation hAllocation)
-{
-    VMA_ASSERT(request.type == VmaAllocationRequestType::Normal);
-
-    const uint32_t targetLevel = AllocSizeToLevel(allocSize);
-    uint32_t currLevel = (uint32_t)(uintptr_t)request.customData;
-    
-    Node* currNode = m_FreeList[currLevel].front;
-    VMA_ASSERT(currNode != VMA_NULL && currNode->type == Node::TYPE_FREE);
-    while(currNode->offset != request.offset)
-    {
-        currNode = currNode->free.next;
-        VMA_ASSERT(currNode != VMA_NULL && currNode->type == Node::TYPE_FREE);
-    }
-    
-    // Go down, splitting free nodes.
-    while(currLevel < targetLevel)
-    {
-        // currNode is already first free node at currLevel.
-        // Remove it from list of free nodes at this currLevel.
-        RemoveFromFreeList(currLevel, currNode);
-         
-        const uint32_t childrenLevel = currLevel + 1;
-
-        // Create two free sub-nodes.
-        Node* leftChild = vma_new(GetAllocationCallbacks(), Node)();
-        Node* rightChild = vma_new(GetAllocationCallbacks(), Node)();
-
-        leftChild->offset = currNode->offset;
-        leftChild->type = Node::TYPE_FREE;
-        leftChild->parent = currNode;
-        leftChild->buddy = rightChild;
-
-        rightChild->offset = currNode->offset + LevelToNodeSize(childrenLevel);
-        rightChild->type = Node::TYPE_FREE;
-        rightChild->parent = currNode;
-        rightChild->buddy = leftChild;
-
-        // Convert current currNode to split type.
-        currNode->type = Node::TYPE_SPLIT;
-        currNode->split.leftChild = leftChild;
-
-        // Add child nodes to free list. Order is important!
-        AddToFreeListFront(childrenLevel, rightChild);
-        AddToFreeListFront(childrenLevel, leftChild);
-
-        ++m_FreeCount;
-        //m_SumFreeSize -= LevelToNodeSize(currLevel) % 2; // Useful only when level node sizes can be non power of 2.
-        ++currLevel;
-        currNode = m_FreeList[currLevel].front;
-
-        /*
-        We can be sure that currNode, as left child of node previously split,
-        also fullfills the alignment requirement.
-        */
-    }
-
-    // Remove from free list.
-    VMA_ASSERT(currLevel == targetLevel &&
-        currNode != VMA_NULL &&
-        currNode->type == Node::TYPE_FREE);
-    RemoveFromFreeList(currLevel, currNode);
-
-    // Convert to allocation node.
-    currNode->type = Node::TYPE_ALLOCATION;
-    currNode->allocation.alloc = hAllocation;
-
-    ++m_AllocationCount;
-    --m_FreeCount;
-    m_SumFreeSize -= allocSize;
-}
-
-void VmaBlockMetadata_Buddy::DeleteNode(Node* node)
-{
-    if(node->type == Node::TYPE_SPLIT)
-    {
-        DeleteNode(node->split.leftChild->buddy);
-        DeleteNode(node->split.leftChild);
-    }
-
-    vma_delete(GetAllocationCallbacks(), node);
-}
-
-bool VmaBlockMetadata_Buddy::ValidateNode(ValidationContext& ctx, const Node* parent, const Node* curr, uint32_t level, VkDeviceSize levelNodeSize) const
-{
-    VMA_VALIDATE(level < m_LevelCount);
-    VMA_VALIDATE(curr->parent == parent);
-    VMA_VALIDATE((curr->buddy == VMA_NULL) == (parent == VMA_NULL));
-    VMA_VALIDATE(curr->buddy == VMA_NULL || curr->buddy->buddy == curr);
-    switch(curr->type)
-    {
-    case Node::TYPE_FREE:
-        // curr->free.prev, next are validated separately.
-        ctx.calculatedSumFreeSize += levelNodeSize;
-        ++ctx.calculatedFreeCount;
-        break;
-    case Node::TYPE_ALLOCATION:
-        ++ctx.calculatedAllocationCount;
-        ctx.calculatedSumFreeSize += levelNodeSize - curr->allocation.alloc->GetSize();
-        VMA_VALIDATE(curr->allocation.alloc != VK_NULL_HANDLE);
-        break;
-    case Node::TYPE_SPLIT:
-        {
-            const uint32_t childrenLevel = level + 1;
-            const VkDeviceSize childrenLevelNodeSize = levelNodeSize / 2;
-            const Node* const leftChild = curr->split.leftChild;
-            VMA_VALIDATE(leftChild != VMA_NULL);
-            VMA_VALIDATE(leftChild->offset == curr->offset);
-            if(!ValidateNode(ctx, curr, leftChild, childrenLevel, childrenLevelNodeSize))
-            {
-                VMA_VALIDATE(false && "ValidateNode for left child failed.");
-            }
-            const Node* const rightChild = leftChild->buddy;
-            VMA_VALIDATE(rightChild->offset == curr->offset + childrenLevelNodeSize);
-            if(!ValidateNode(ctx, curr, rightChild, childrenLevel, childrenLevelNodeSize))
-            {
-                VMA_VALIDATE(false && "ValidateNode for right child failed.");
-            }
-        }
-        break;
-    default:
-        return false;
-    }
-
-    return true;
-}
-
-uint32_t VmaBlockMetadata_Buddy::AllocSizeToLevel(VkDeviceSize allocSize) const
-{
-    // I know this could be optimized somehow e.g. by using std::log2p1 from C++20.
-    uint32_t level = 0;
-    VkDeviceSize currLevelNodeSize = m_UsableSize;
-    VkDeviceSize nextLevelNodeSize = currLevelNodeSize >> 1;
-    while(allocSize <= nextLevelNodeSize && level + 1 < m_LevelCount)
-    {
-        ++level;
-        currLevelNodeSize = nextLevelNodeSize;
-        nextLevelNodeSize = currLevelNodeSize >> 1;
-    }
-    return level;
-}
-
-void VmaBlockMetadata_Buddy::FreeAtOffset(VmaAllocation alloc, VkDeviceSize offset)
-{
-    // Find node and level.
-    Node* node = m_Root;
-    VkDeviceSize nodeOffset = 0;
-    uint32_t level = 0;
-    VkDeviceSize levelNodeSize = LevelToNodeSize(0);
-    while(node->type == Node::TYPE_SPLIT)
-    {
-        const VkDeviceSize nextLevelSize = levelNodeSize >> 1;
-        if(offset < nodeOffset + nextLevelSize)
-        {
-            node = node->split.leftChild;
-        }
-        else
-        {
-            node = node->split.leftChild->buddy;
-            nodeOffset += nextLevelSize;
-        }
-        ++level;
-        levelNodeSize = nextLevelSize;
-    }
-
-    VMA_ASSERT(node != VMA_NULL && node->type == Node::TYPE_ALLOCATION);
-    VMA_ASSERT(alloc == VK_NULL_HANDLE || node->allocation.alloc == alloc);
-
-    ++m_FreeCount;
-    --m_AllocationCount;
-    m_SumFreeSize += alloc->GetSize();
-
-    node->type = Node::TYPE_FREE;
-
-    // Join free nodes if possible.
-    while(level > 0 && node->buddy->type == Node::TYPE_FREE)
-    {
-        RemoveFromFreeList(level, node->buddy);
-        Node* const parent = node->parent;
-
-        vma_delete(GetAllocationCallbacks(), node->buddy);
-        vma_delete(GetAllocationCallbacks(), node);
-        parent->type = Node::TYPE_FREE;
-        
-        node = parent;
-        --level;
-        //m_SumFreeSize += LevelToNodeSize(level) % 2; // Useful only when level node sizes can be non power of 2.
-        --m_FreeCount;
-    }
-
-    AddToFreeListFront(level, node);
-}
-
-void VmaBlockMetadata_Buddy::CalcAllocationStatInfoNode(VmaStatInfo& outInfo, const Node* node, VkDeviceSize levelNodeSize) const
-{
-    switch(node->type)
-    {
-    case Node::TYPE_FREE:
-        ++outInfo.unusedRangeCount;
-        outInfo.unusedBytes += levelNodeSize;
-        outInfo.unusedRangeSizeMax = VMA_MAX(outInfo.unusedRangeSizeMax, levelNodeSize);
-        outInfo.unusedRangeSizeMin = VMA_MAX(outInfo.unusedRangeSizeMin, levelNodeSize);
-        break;
-    case Node::TYPE_ALLOCATION:
-        {
-            const VkDeviceSize allocSize = node->allocation.alloc->GetSize();
-            ++outInfo.allocationCount;
-            outInfo.usedBytes += allocSize;
-            outInfo.allocationSizeMax = VMA_MAX(outInfo.allocationSizeMax, allocSize);
-            outInfo.allocationSizeMin = VMA_MAX(outInfo.allocationSizeMin, allocSize);
-
-            const VkDeviceSize unusedRangeSize = levelNodeSize - allocSize;
-            if(unusedRangeSize > 0)
-            {
-                ++outInfo.unusedRangeCount;
-                outInfo.unusedBytes += unusedRangeSize;
-                outInfo.unusedRangeSizeMax = VMA_MAX(outInfo.unusedRangeSizeMax, unusedRangeSize);
-                outInfo.unusedRangeSizeMin = VMA_MAX(outInfo.unusedRangeSizeMin, unusedRangeSize);
-            }
-        }
-        break;
-    case Node::TYPE_SPLIT:
-        {
-            const VkDeviceSize childrenNodeSize = levelNodeSize / 2;
-            const Node* const leftChild = node->split.leftChild;
-            CalcAllocationStatInfoNode(outInfo, leftChild, childrenNodeSize);
-            const Node* const rightChild = leftChild->buddy;
-            CalcAllocationStatInfoNode(outInfo, rightChild, childrenNodeSize);
-        }
-        break;
-    default:
-        VMA_ASSERT(0);
-    }
-}
-
-void VmaBlockMetadata_Buddy::AddToFreeListFront(uint32_t level, Node* node)
-{
-    VMA_ASSERT(node->type == Node::TYPE_FREE);
-
-    // List is empty.
-    Node* const frontNode = m_FreeList[level].front;
-    if(frontNode == VMA_NULL)
-    {
-        VMA_ASSERT(m_FreeList[level].back == VMA_NULL);
-        node->free.prev = node->free.next = VMA_NULL;
-        m_FreeList[level].front = m_FreeList[level].back = node;
-    }
-    else
-    {
-        VMA_ASSERT(frontNode->free.prev == VMA_NULL);
-        node->free.prev = VMA_NULL;
-        node->free.next = frontNode;
-        frontNode->free.prev = node;
-        m_FreeList[level].front = node;
-    }
-}
-
-void VmaBlockMetadata_Buddy::RemoveFromFreeList(uint32_t level, Node* node)
-{
-    VMA_ASSERT(m_FreeList[level].front != VMA_NULL);
-
-    // It is at the front.
-    if(node->free.prev == VMA_NULL)
-    {
-        VMA_ASSERT(m_FreeList[level].front == node);
-        m_FreeList[level].front = node->free.next;
-    }
-    else
-    {
-        Node* const prevFreeNode = node->free.prev;
-        VMA_ASSERT(prevFreeNode->free.next == node);
-        prevFreeNode->free.next = node->free.next;
-    }
-
-    // It is at the back.
-    if(node->free.next == VMA_NULL)
-    {
-        VMA_ASSERT(m_FreeList[level].back == node);
-        m_FreeList[level].back = node->free.prev;
-    }
-    else
-    {
-        Node* const nextFreeNode = node->free.next;
-        VMA_ASSERT(nextFreeNode->free.prev == node);
-        nextFreeNode->free.prev = node->free.prev;
-    }
-}
-
-#if VMA_STATS_STRING_ENABLED
-void VmaBlockMetadata_Buddy::PrintDetailedMapNode(class VmaJsonWriter& json, const Node* node, VkDeviceSize levelNodeSize) const
-{
-    switch(node->type)
-    {
-    case Node::TYPE_FREE:
-        PrintDetailedMap_UnusedRange(json, node->offset, levelNodeSize);
-        break;
-    case Node::TYPE_ALLOCATION:
-        {   
-            PrintDetailedMap_Allocation(json, node->offset, node->allocation.alloc);
-            const VkDeviceSize allocSize = node->allocation.alloc->GetSize();
-            if(allocSize < levelNodeSize)
-            {
-                PrintDetailedMap_UnusedRange(json, node->offset + allocSize, levelNodeSize - allocSize);
-            }
-        }
-        break;
-    case Node::TYPE_SPLIT:
-        {
-            const VkDeviceSize childrenNodeSize = levelNodeSize / 2;
-            const Node* const leftChild = node->split.leftChild;
-            PrintDetailedMapNode(json, leftChild, childrenNodeSize);
-            const Node* const rightChild = leftChild->buddy;
-            PrintDetailedMapNode(json, rightChild, childrenNodeSize);
-        }
-        break;
-    default:
-        VMA_ASSERT(0);
-    }
-}
-#endif // #if VMA_STATS_STRING_ENABLED
-
-
-////////////////////////////////////////////////////////////////////////////////
-// class VmaDeviceMemoryBlock
-
-VmaDeviceMemoryBlock::VmaDeviceMemoryBlock(VmaAllocator hAllocator) :
-    m_pMetadata(VMA_NULL),
-    m_MemoryTypeIndex(UINT32_MAX),
-    m_Id(0),
-    m_hMemory(VK_NULL_HANDLE),
-    m_MapCount(0),
-    m_pMappedData(VMA_NULL)
-{
-}
-
-void VmaDeviceMemoryBlock::Init(
-    VmaAllocator hAllocator,
-    VmaPool hParentPool,
-    uint32_t newMemoryTypeIndex,
-    VkDeviceMemory newMemory,
-    VkDeviceSize newSize,
-    uint32_t id,
-    uint32_t algorithm)
-{
-    VMA_ASSERT(m_hMemory == VK_NULL_HANDLE);
-
-    m_hParentPool = hParentPool;
-    m_MemoryTypeIndex = newMemoryTypeIndex;
-    m_Id = id;
-    m_hMemory = newMemory;
-
-    switch(algorithm)
-    {
-    case VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT:
-        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Linear)(hAllocator);
-        break;
-    case VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT:
-        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Buddy)(hAllocator);
-        break;
-    default:
-        VMA_ASSERT(0);
-        // Fall-through.
-    case 0:
-        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Generic)(hAllocator);
-    }
-    m_pMetadata->Init(newSize);
-}
-
-void VmaDeviceMemoryBlock::Destroy(VmaAllocator allocator)
-{
-    // This is the most important assert in the entire library.
-    // Hitting it means you have some memory leak - unreleased VmaAllocation objects.
-    VMA_ASSERT(m_pMetadata->IsEmpty() && "Some allocations were not freed before destruction of this memory block!");
-
-    VMA_ASSERT(m_hMemory != VK_NULL_HANDLE);
-    allocator->FreeVulkanMemory(m_MemoryTypeIndex, m_pMetadata->GetSize(), m_hMemory);
-    m_hMemory = VK_NULL_HANDLE;
-
-    vma_delete(allocator, m_pMetadata);
-    m_pMetadata = VMA_NULL;
-}
-
-bool VmaDeviceMemoryBlock::Validate() const
-{
-    VMA_VALIDATE((m_hMemory != VK_NULL_HANDLE) &&
-        (m_pMetadata->GetSize() != 0));
-    
-    return m_pMetadata->Validate();
-}
-
-VkResult VmaDeviceMemoryBlock::CheckCorruption(VmaAllocator hAllocator)
-{
-    void* pData = nullptr;
-    VkResult res = Map(hAllocator, 1, &pData);
-    if(res != VK_SUCCESS)
-    {
-        return res;
-    }
-
-    res = m_pMetadata->CheckCorruption(pData);
-
-    Unmap(hAllocator, 1);
-
-    return res;
-}
-
-VkResult VmaDeviceMemoryBlock::Map(VmaAllocator hAllocator, uint32_t count, void** ppData)
-{
-    if(count == 0)
-    {
-        return VK_SUCCESS;
-    }
-
-    VmaMutexLock lock(m_Mutex, hAllocator->m_UseMutex);
-    if(m_MapCount != 0)
-    {
-        m_MapCount += count;
-        VMA_ASSERT(m_pMappedData != VMA_NULL);
-        if(ppData != VMA_NULL)
-        {
-            *ppData = m_pMappedData;
-        }
-        return VK_SUCCESS;
-    }
-    else
-    {
-        VkResult result = (*hAllocator->GetVulkanFunctions().vkMapMemory)(
-            hAllocator->m_hDevice,
-            m_hMemory,
-            0, // offset
-            VK_WHOLE_SIZE,
-            0, // flags
-            &m_pMappedData);
-        if(result == VK_SUCCESS)
-        {
-            if(ppData != VMA_NULL)
-            {
-                *ppData = m_pMappedData;
-            }
-            m_MapCount = count;
-        }
-        return result;
-    }
-}
-
-void VmaDeviceMemoryBlock::Unmap(VmaAllocator hAllocator, uint32_t count)
-{
-    if(count == 0)
-    {
-        return;
-    }
-
-    VmaMutexLock lock(m_Mutex, hAllocator->m_UseMutex);
-    if(m_MapCount >= count)
-    {
-        m_MapCount -= count;
-        if(m_MapCount == 0)
-        {
-            m_pMappedData = VMA_NULL;
-            (*hAllocator->GetVulkanFunctions().vkUnmapMemory)(hAllocator->m_hDevice, m_hMemory);
-        }
-    }
-    else
-    {
-        VMA_ASSERT(0 && "VkDeviceMemory block is being unmapped while it was not previously mapped.");
-    }
-}
-
-VkResult VmaDeviceMemoryBlock::WriteMagicValueAroundAllocation(VmaAllocator hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize)
-{
-    VMA_ASSERT(VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_MARGIN % 4 == 0 && VMA_DEBUG_DETECT_CORRUPTION);
-    VMA_ASSERT(allocOffset >= VMA_DEBUG_MARGIN);
-
-    void* pData;
-    VkResult res = Map(hAllocator, 1, &pData);
-    if(res != VK_SUCCESS)
-    {
-        return res;
-    }
-
-    VmaWriteMagicValue(pData, allocOffset - VMA_DEBUG_MARGIN);
-    VmaWriteMagicValue(pData, allocOffset + allocSize);
-
-    Unmap(hAllocator, 1);
-
-    return VK_SUCCESS;
-}
-
-VkResult VmaDeviceMemoryBlock::ValidateMagicValueAroundAllocation(VmaAllocator hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize)
-{
-    VMA_ASSERT(VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_MARGIN % 4 == 0 && VMA_DEBUG_DETECT_CORRUPTION);
-    VMA_ASSERT(allocOffset >= VMA_DEBUG_MARGIN);
-
-    void* pData;
-    VkResult res = Map(hAllocator, 1, &pData);
-    if(res != VK_SUCCESS)
-    {
-        return res;
-    }
-
-    if(!VmaValidateMagicValue(pData, allocOffset - VMA_DEBUG_MARGIN))
-    {
-        VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED BEFORE FREED ALLOCATION!");
-    }
-    else if(!VmaValidateMagicValue(pData, allocOffset + allocSize))
-    {
-        VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED AFTER FREED ALLOCATION!");
-    }
-
-    Unmap(hAllocator, 1);
-
-    return VK_SUCCESS;
-}
-
-VkResult VmaDeviceMemoryBlock::BindBufferMemory(
-    const VmaAllocator hAllocator,
-    const VmaAllocation hAllocation,
-    VkDeviceSize allocationLocalOffset,
-    VkBuffer hBuffer,
-    const void* pNext)
-{
-    VMA_ASSERT(hAllocation->GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK &&
-        hAllocation->GetBlock() == this);
-    VMA_ASSERT(allocationLocalOffset < hAllocation->GetSize() &&
-        "Invalid allocationLocalOffset. Did you forget that this offset is relative to the beginning of the allocation, not the whole memory block?");
-    const VkDeviceSize memoryOffset = hAllocation->GetOffset() + allocationLocalOffset;
-    // This lock is important so that we don't call vkBind... and/or vkMap... simultaneously on the same VkDeviceMemory from multiple threads.
-    VmaMutexLock lock(m_Mutex, hAllocator->m_UseMutex);
-    return hAllocator->BindVulkanBuffer(m_hMemory, memoryOffset, hBuffer, pNext);
-}
-
-VkResult VmaDeviceMemoryBlock::BindImageMemory(
-    const VmaAllocator hAllocator,
-    const VmaAllocation hAllocation,
-    VkDeviceSize allocationLocalOffset,
-    VkImage hImage,
-    const void* pNext)
-{
-    VMA_ASSERT(hAllocation->GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK &&
-        hAllocation->GetBlock() == this);
-    VMA_ASSERT(allocationLocalOffset < hAllocation->GetSize() &&
-        "Invalid allocationLocalOffset. Did you forget that this offset is relative to the beginning of the allocation, not the whole memory block?");
-    const VkDeviceSize memoryOffset = hAllocation->GetOffset() + allocationLocalOffset;
-    // This lock is important so that we don't call vkBind... and/or vkMap... simultaneously on the same VkDeviceMemory from multiple threads.
-    VmaMutexLock lock(m_Mutex, hAllocator->m_UseMutex);
-    return hAllocator->BindVulkanImage(m_hMemory, memoryOffset, hImage, pNext);
-}
-
-static void InitStatInfo(VmaStatInfo& outInfo)
-{
-    memset(&outInfo, 0, sizeof(outInfo));
-    outInfo.allocationSizeMin = UINT64_MAX;
-    outInfo.unusedRangeSizeMin = UINT64_MAX;
-}
-
-// Adds statistics srcInfo into inoutInfo, like: inoutInfo += srcInfo.
-static void VmaAddStatInfo(VmaStatInfo& inoutInfo, const VmaStatInfo& srcInfo)
-{
-    inoutInfo.blockCount += srcInfo.blockCount;
-    inoutInfo.allocationCount += srcInfo.allocationCount;
-    inoutInfo.unusedRangeCount += srcInfo.unusedRangeCount;
-    inoutInfo.usedBytes += srcInfo.usedBytes;
-    inoutInfo.unusedBytes += srcInfo.unusedBytes;
-    inoutInfo.allocationSizeMin = VMA_MIN(inoutInfo.allocationSizeMin, srcInfo.allocationSizeMin);
-    inoutInfo.allocationSizeMax = VMA_MAX(inoutInfo.allocationSizeMax, srcInfo.allocationSizeMax);
-    inoutInfo.unusedRangeSizeMin = VMA_MIN(inoutInfo.unusedRangeSizeMin, srcInfo.unusedRangeSizeMin);
-    inoutInfo.unusedRangeSizeMax = VMA_MAX(inoutInfo.unusedRangeSizeMax, srcInfo.unusedRangeSizeMax);
-}
-
-static void VmaPostprocessCalcStatInfo(VmaStatInfo& inoutInfo)
-{
-    inoutInfo.allocationSizeAvg = (inoutInfo.allocationCount > 0) ?
-        VmaRoundDiv<VkDeviceSize>(inoutInfo.usedBytes, inoutInfo.allocationCount) : 0;
-    inoutInfo.unusedRangeSizeAvg = (inoutInfo.unusedRangeCount > 0) ?
-        VmaRoundDiv<VkDeviceSize>(inoutInfo.unusedBytes, inoutInfo.unusedRangeCount) : 0;
-}
-
-VmaPool_T::VmaPool_T(
-    VmaAllocator hAllocator,
-    const VmaPoolCreateInfo& createInfo,
-    VkDeviceSize preferredBlockSize) :
-    m_BlockVector(
-        hAllocator,
-        this, // hParentPool
-        createInfo.memoryTypeIndex,
-        createInfo.blockSize != 0 ? createInfo.blockSize : preferredBlockSize,
-        createInfo.minBlockCount,
-        createInfo.maxBlockCount,
-        (createInfo.flags & VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT) != 0 ? 1 : hAllocator->GetBufferImageGranularity(),
-        createInfo.frameInUseCount,
-        createInfo.blockSize != 0, // explicitBlockSize
-        createInfo.flags & VMA_POOL_CREATE_ALGORITHM_MASK), // algorithm
-    m_Id(0),
-    m_Name(VMA_NULL)
-{
-}
-
-VmaPool_T::~VmaPool_T()
-{
-}
-
-void VmaPool_T::SetName(const char* pName)
-{
-    const VkAllocationCallbacks* allocs = m_BlockVector.GetAllocator()->GetAllocationCallbacks();
-    VmaFreeString(allocs, m_Name);
-    
-    if(pName != VMA_NULL)
-    {
-        m_Name = VmaCreateStringCopy(allocs, pName);
-    }
-    else
-    {
-        m_Name = VMA_NULL;
-    }
-}
-
-#if VMA_STATS_STRING_ENABLED
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-VmaBlockVector::VmaBlockVector(
-    VmaAllocator hAllocator,
-    VmaPool hParentPool,
-    uint32_t memoryTypeIndex,
-    VkDeviceSize preferredBlockSize,
-    size_t minBlockCount,
-    size_t maxBlockCount,
-    VkDeviceSize bufferImageGranularity,
-    uint32_t frameInUseCount,
-    bool explicitBlockSize,
-    uint32_t algorithm) :
-    m_hAllocator(hAllocator),
-    m_hParentPool(hParentPool),
-    m_MemoryTypeIndex(memoryTypeIndex),
-    m_PreferredBlockSize(preferredBlockSize),
-    m_MinBlockCount(minBlockCount),
-    m_MaxBlockCount(maxBlockCount),
-    m_BufferImageGranularity(bufferImageGranularity),
-    m_FrameInUseCount(frameInUseCount),
-    m_ExplicitBlockSize(explicitBlockSize),
-    m_Algorithm(algorithm),
-    m_HasEmptyBlock(false),
-    m_Blocks(VmaStlAllocator<VmaDeviceMemoryBlock*>(hAllocator->GetAllocationCallbacks())),
-    m_NextBlockId(0)
-{
-}
-
-VmaBlockVector::~VmaBlockVector()
-{
-    for(size_t i = m_Blocks.size(); i--; )
-    {
-        m_Blocks[i]->Destroy(m_hAllocator);
-        vma_delete(m_hAllocator, m_Blocks[i]);
-    }
-}
-
-VkResult VmaBlockVector::CreateMinBlocks()
-{
-    for(size_t i = 0; i < m_MinBlockCount; ++i)
-    {
-        VkResult res = CreateBlock(m_PreferredBlockSize, VMA_NULL);
-        if(res != VK_SUCCESS)
-        {
-            return res;
-        }
-    }
-    return VK_SUCCESS;
-}
-
-void VmaBlockVector::GetPoolStats(VmaPoolStats* pStats)
-{
-    VmaMutexLockRead lock(m_Mutex, m_hAllocator->m_UseMutex);
-
-    const size_t blockCount = m_Blocks.size();
-
-    pStats->size = 0;
-    pStats->unusedSize = 0;
-    pStats->allocationCount = 0;
-    pStats->unusedRangeCount = 0;
-    pStats->unusedRangeSizeMax = 0;
-    pStats->blockCount = blockCount;
-
-    for(uint32_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)
-    {
-        const VmaDeviceMemoryBlock* const pBlock = m_Blocks[blockIndex];
-        VMA_ASSERT(pBlock);
-        VMA_HEAVY_ASSERT(pBlock->Validate());
-        pBlock->m_pMetadata->AddPoolStats(*pStats);
-    }
-}
-
-bool VmaBlockVector::IsEmpty()
-{
-    VmaMutexLockRead lock(m_Mutex, m_hAllocator->m_UseMutex);
-    return m_Blocks.empty();
-}
-
-bool VmaBlockVector::IsCorruptionDetectionEnabled() const
-{
-    const uint32_t requiredMemFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
-    return (VMA_DEBUG_DETECT_CORRUPTION != 0) &&
-        (VMA_DEBUG_MARGIN > 0) &&
-        (m_Algorithm == 0 || m_Algorithm == VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT) &&
-        (m_hAllocator->m_MemProps.memoryTypes[m_MemoryTypeIndex].propertyFlags & requiredMemFlags) == requiredMemFlags;
-}
-
-static const uint32_t VMA_ALLOCATION_TRY_COUNT = 32;
-
-VkResult VmaBlockVector::Allocate(
-    uint32_t currentFrameIndex,
-    VkDeviceSize size,
-    VkDeviceSize alignment,
-    const VmaAllocationCreateInfo& createInfo,
-    VmaSuballocationType suballocType,
-    size_t allocationCount,
-    VmaAllocation* pAllocations)
-{
-    size_t allocIndex;
-    VkResult res = VK_SUCCESS;
-
-    if(IsCorruptionDetectionEnabled())
-    {
-        size = VmaAlignUp<VkDeviceSize>(size, sizeof(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));
-        alignment = VmaAlignUp<VkDeviceSize>(alignment, sizeof(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));
-    }
-
-    {
-        VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);
-        for(allocIndex = 0; allocIndex < allocationCount; ++allocIndex)
-        {
-            res = AllocatePage(
-                currentFrameIndex,
-                size,
-                alignment,
-                createInfo,
-                suballocType,
-                pAllocations + allocIndex);
-            if(res != VK_SUCCESS)
-            {
-                break;
-            }
-        }
-    }
-
-    if(res != VK_SUCCESS)
-    {
-        // Free all already created allocations.
-        while(allocIndex--)
-        {
-            Free(pAllocations[allocIndex]);
-        }
-        memset(pAllocations, 0, sizeof(VmaAllocation) * allocationCount);
-    }
-
-    return res;
-}
-
-VkResult VmaBlockVector::AllocatePage(
-    uint32_t currentFrameIndex,
-    VkDeviceSize size,
-    VkDeviceSize alignment,
-    const VmaAllocationCreateInfo& createInfo,
-    VmaSuballocationType suballocType,
-    VmaAllocation* pAllocation)
-{
-    const bool isUpperAddress = (createInfo.flags & VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT) != 0;
-    bool canMakeOtherLost = (createInfo.flags & VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT) != 0;
-    const bool mapped = (createInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0;
-    const bool isUserDataString = (createInfo.flags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0;
-    
-    VkDeviceSize freeMemory;
-    {
-        const uint32_t heapIndex = m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex);
-        VmaBudget heapBudget = {};
-        m_hAllocator->GetBudget(&heapBudget, heapIndex, 1);
-        freeMemory = (heapBudget.usage < heapBudget.budget) ? (heapBudget.budget - heapBudget.usage) : 0;
-    }
-    
-    const bool canFallbackToDedicated = !IsCustomPool();
-    const bool canCreateNewBlock =
-        ((createInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) == 0) &&
-        (m_Blocks.size() < m_MaxBlockCount) &&
-        (freeMemory >= size || !canFallbackToDedicated);
-    uint32_t strategy = createInfo.flags & VMA_ALLOCATION_CREATE_STRATEGY_MASK;
-
-    // If linearAlgorithm is used, canMakeOtherLost is available only when used as ring buffer.
-    // Which in turn is available only when maxBlockCount = 1.
-    if(m_Algorithm == VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT && m_MaxBlockCount > 1)
-    {
-        canMakeOtherLost = false;
-    }
-
-    // Upper address can only be used with linear allocator and within single memory block.
-    if(isUpperAddress &&
-        (m_Algorithm != VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT || m_MaxBlockCount > 1))
-    {
-        return VK_ERROR_FEATURE_NOT_PRESENT;
-    }
-
-    // Validate strategy.
-    switch(strategy)
-    {
-    case 0:
-        strategy = VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT;
-        break;
-    case VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT:
-    case VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT:
-    case VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT:
-        break;
-    default:
-        return VK_ERROR_FEATURE_NOT_PRESENT;
-    }
-
-    // Early reject: requested allocation size is larger that maximum block size for this block vector.
-    if(size + 2 * VMA_DEBUG_MARGIN > m_PreferredBlockSize)
-    {
-        return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-    }
-
-    /*
-    Under certain condition, this whole section can be skipped for optimization, so
-    we move on directly to trying to allocate with canMakeOtherLost. That's the case
-    e.g. for custom pools with linear algorithm.
-    */
-    if(!canMakeOtherLost || canCreateNewBlock)
-    {
-        // 1. Search existing allocations. Try to allocate without making other allocations lost.
-        VmaAllocationCreateFlags allocFlagsCopy = createInfo.flags;
-        allocFlagsCopy &= ~VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT;
-
-        if(m_Algorithm == VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT)
-        {
-            // Use only last block.
-            if(!m_Blocks.empty())
-            {
-                VmaDeviceMemoryBlock* const pCurrBlock = m_Blocks.back();
-                VMA_ASSERT(pCurrBlock);
-                VkResult res = AllocateFromBlock(
-                    pCurrBlock,
-                    currentFrameIndex,
-                    size,
-                    alignment,
-                    allocFlagsCopy,
-                    createInfo.pUserData,
-                    suballocType,
-                    strategy,
-                    pAllocation);
-                if(res == VK_SUCCESS)
-                {
-                    VMA_DEBUG_LOG("    Returned from last block #%u", pCurrBlock->GetId());
-                    return VK_SUCCESS;
-                }
-            }
-        }
-        else
-        {
-            if(strategy == VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT)
-            {
-                // Forward order in m_Blocks - prefer blocks with smallest amount of free space.
-                for(size_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex )
-                {
-                    VmaDeviceMemoryBlock* const pCurrBlock = m_Blocks[blockIndex];
-                    VMA_ASSERT(pCurrBlock);
-                    VkResult res = AllocateFromBlock(
-                        pCurrBlock,
-                        currentFrameIndex,
-                        size,
-                        alignment,
-                        allocFlagsCopy,
-                        createInfo.pUserData,
-                        suballocType,
-                        strategy,
-                        pAllocation);
-                    if(res == VK_SUCCESS)
-                    {
-                        VMA_DEBUG_LOG("    Returned from existing block #%u", pCurrBlock->GetId());
-                        return VK_SUCCESS;
-                    }
-                }
-            }
-            else // WORST_FIT, FIRST_FIT
-            {
-                // Backward order in m_Blocks - prefer blocks with largest amount of free space.
-                for(size_t blockIndex = m_Blocks.size(); blockIndex--; )
-                {
-                    VmaDeviceMemoryBlock* const pCurrBlock = m_Blocks[blockIndex];
-                    VMA_ASSERT(pCurrBlock);
-                    VkResult res = AllocateFromBlock(
-                        pCurrBlock,
-                        currentFrameIndex,
-                        size,
-                        alignment,
-                        allocFlagsCopy,
-                        createInfo.pUserData,
-                        suballocType,
-                        strategy,
-                        pAllocation);
-                    if(res == VK_SUCCESS)
-                    {
-                        VMA_DEBUG_LOG("    Returned from existing block #%u", pCurrBlock->GetId());
-                        return VK_SUCCESS;
-                    }
-                }
-            }
-        }
-
-        // 2. Try to create new block.
-        if(canCreateNewBlock)
-        {
-            // Calculate optimal size for new block.
-            VkDeviceSize newBlockSize = m_PreferredBlockSize;
-            uint32_t newBlockSizeShift = 0;
-            const uint32_t NEW_BLOCK_SIZE_SHIFT_MAX = 3;
-
-            if(!m_ExplicitBlockSize)
-            {
-                // Allocate 1/8, 1/4, 1/2 as first blocks.
-                const VkDeviceSize maxExistingBlockSize = CalcMaxBlockSize();
-                for(uint32_t i = 0; i < NEW_BLOCK_SIZE_SHIFT_MAX; ++i)
-                {
-                    const VkDeviceSize smallerNewBlockSize = newBlockSize / 2;
-                    if(smallerNewBlockSize > maxExistingBlockSize && smallerNewBlockSize >= size * 2)
-                    {
-                        newBlockSize = smallerNewBlockSize;
-                        ++newBlockSizeShift;
-                    }
-                    else
-                    {
-                        break;
-                    }
-                }
-            }
-
-            size_t newBlockIndex = 0;
-            VkResult res = (newBlockSize <= freeMemory || !canFallbackToDedicated) ?
-                CreateBlock(newBlockSize, &newBlockIndex) : VK_ERROR_OUT_OF_DEVICE_MEMORY;
-            // Allocation of this size failed? Try 1/2, 1/4, 1/8 of m_PreferredBlockSize.
-            if(!m_ExplicitBlockSize)
-            {
-                while(res < 0 && newBlockSizeShift < NEW_BLOCK_SIZE_SHIFT_MAX)
-                {
-                    const VkDeviceSize smallerNewBlockSize = newBlockSize / 2;
-                    if(smallerNewBlockSize >= size)
-                    {
-                        newBlockSize = smallerNewBlockSize;
-                        ++newBlockSizeShift;
-                        res = (newBlockSize <= freeMemory || !canFallbackToDedicated) ?
-                            CreateBlock(newBlockSize, &newBlockIndex) : VK_ERROR_OUT_OF_DEVICE_MEMORY;
-                    }
-                    else
-                    {
-                        break;
-                    }
-                }
-            }
-
-            if(res == VK_SUCCESS)
-            {
-                VmaDeviceMemoryBlock* const pBlock = m_Blocks[newBlockIndex];
-                VMA_ASSERT(pBlock->m_pMetadata->GetSize() >= size);
-
-                res = AllocateFromBlock(
-                    pBlock,
-                    currentFrameIndex,
-                    size,
-                    alignment,
-                    allocFlagsCopy,
-                    createInfo.pUserData,
-                    suballocType,
-                    strategy,
-                    pAllocation);
-                if(res == VK_SUCCESS)
-                {
-                    VMA_DEBUG_LOG("    Created new block #%u Size=%llu", pBlock->GetId(), newBlockSize);
-                    return VK_SUCCESS;
-                }
-                else
-                {
-                    // Allocation from new block failed, possibly due to VMA_DEBUG_MARGIN or alignment.
-                    return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-                }
-            }
-        }
-    }
-
-    // 3. Try to allocate from existing blocks with making other allocations lost.
-    if(canMakeOtherLost)
-    {
-        uint32_t tryIndex = 0;
-        for(; tryIndex < VMA_ALLOCATION_TRY_COUNT; ++tryIndex)
-        {
-            VmaDeviceMemoryBlock* pBestRequestBlock = VMA_NULL;
-            VmaAllocationRequest bestRequest = {};
-            VkDeviceSize bestRequestCost = VK_WHOLE_SIZE;
-
-            // 1. Search existing allocations.
-            if(strategy == VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT)
-            {
-                // Forward order in m_Blocks - prefer blocks with smallest amount of free space.
-                for(size_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex )
-                {
-                    VmaDeviceMemoryBlock* const pCurrBlock = m_Blocks[blockIndex];
-                    VMA_ASSERT(pCurrBlock);
-                    VmaAllocationRequest currRequest = {};
-                    if(pCurrBlock->m_pMetadata->CreateAllocationRequest(
-                        currentFrameIndex,
-                        m_FrameInUseCount,
-                        m_BufferImageGranularity,
-                        size,
-                        alignment,
-                        (createInfo.flags & VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT) != 0,
-                        suballocType,
-                        canMakeOtherLost,
-                        strategy,
-                        &currRequest))
-                    {
-                        const VkDeviceSize currRequestCost = currRequest.CalcCost();
-                        if(pBestRequestBlock == VMA_NULL ||
-                            currRequestCost < bestRequestCost)
-                        {
-                            pBestRequestBlock = pCurrBlock;
-                            bestRequest = currRequest;
-                            bestRequestCost = currRequestCost;
-
-                            if(bestRequestCost == 0)
-                            {
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-            else // WORST_FIT, FIRST_FIT
-            {
-                // Backward order in m_Blocks - prefer blocks with largest amount of free space.
-                for(size_t blockIndex = m_Blocks.size(); blockIndex--; )
-                {
-                    VmaDeviceMemoryBlock* const pCurrBlock = m_Blocks[blockIndex];
-                    VMA_ASSERT(pCurrBlock);
-                    VmaAllocationRequest currRequest = {};
-                    if(pCurrBlock->m_pMetadata->CreateAllocationRequest(
-                        currentFrameIndex,
-                        m_FrameInUseCount,
-                        m_BufferImageGranularity,
-                        size,
-                        alignment,
-                        (createInfo.flags & VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT) != 0,
-                        suballocType,
-                        canMakeOtherLost,
-                        strategy,
-                        &currRequest))
-                    {
-                        const VkDeviceSize currRequestCost = currRequest.CalcCost();
-                        if(pBestRequestBlock == VMA_NULL ||
-                            currRequestCost < bestRequestCost ||
-                            strategy == VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT)
-                        {
-                            pBestRequestBlock = pCurrBlock;
-                            bestRequest = currRequest;
-                            bestRequestCost = currRequestCost;
-
-                            if(bestRequestCost == 0 ||
-                                strategy == VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT)
-                            {
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-
-            if(pBestRequestBlock != VMA_NULL)
-            {
-                if(mapped)
-                {
-                    VkResult res = pBestRequestBlock->Map(m_hAllocator, 1, VMA_NULL);
-                    if(res != VK_SUCCESS)
-                    {
-                        return res;
-                    }
-                }
-
-                if(pBestRequestBlock->m_pMetadata->MakeRequestedAllocationsLost(
-                    currentFrameIndex,
-                    m_FrameInUseCount,
-                    &bestRequest))
-                {
-                    // Allocate from this pBlock.
-                    *pAllocation = m_hAllocator->m_AllocationObjectAllocator.Allocate(currentFrameIndex, isUserDataString);
-                    pBestRequestBlock->m_pMetadata->Alloc(bestRequest, suballocType, size, *pAllocation);
-                    UpdateHasEmptyBlock();
-                    (*pAllocation)->InitBlockAllocation(
-                        pBestRequestBlock,
-                        bestRequest.offset,
-                        alignment,
-                        size,
-                        m_MemoryTypeIndex,
-                        suballocType,
-                        mapped,
-                        (createInfo.flags & VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT) != 0);
-                    VMA_HEAVY_ASSERT(pBestRequestBlock->Validate());
-                    VMA_DEBUG_LOG("    Returned from existing block");
-                    (*pAllocation)->SetUserData(m_hAllocator, createInfo.pUserData);
-                    m_hAllocator->m_Budget.AddAllocation(m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex), size);
-                    if(VMA_DEBUG_INITIALIZE_ALLOCATIONS)
-                    {
-                        m_hAllocator->FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);
-                    }
-                    if(IsCorruptionDetectionEnabled())
-                    {
-                        VkResult res = pBestRequestBlock->WriteMagicValueAroundAllocation(m_hAllocator, bestRequest.offset, size);
-                        VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to write magic value.");
-                    }
-                    return VK_SUCCESS;
-                }
-                // else: Some allocations must have been touched while we are here. Next try.
-            }
-            else
-            {
-                // Could not find place in any of the blocks - break outer loop.
-                break;
-            }
-        }
-        /* Maximum number of tries exceeded - a very unlike event when many other
-        threads are simultaneously touching allocations making it impossible to make
-        lost at the same time as we try to allocate. */
-        if(tryIndex == VMA_ALLOCATION_TRY_COUNT)
-        {
-            return VK_ERROR_TOO_MANY_OBJECTS;
-        }
-    }
-
-    return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-}
-
-void VmaBlockVector::Free(
-    const VmaAllocation hAllocation)
-{
-    VmaDeviceMemoryBlock* pBlockToDelete = VMA_NULL;
-
-    bool budgetExceeded = false;
-    {
-        const uint32_t heapIndex = m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex);
-        VmaBudget heapBudget = {};
-        m_hAllocator->GetBudget(&heapBudget, heapIndex, 1);
-        budgetExceeded = heapBudget.usage >= heapBudget.budget;
-    }
-
-    // Scope for lock.
-    {
-        VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);
-
-        VmaDeviceMemoryBlock* pBlock = hAllocation->GetBlock();
-
-        if(IsCorruptionDetectionEnabled())
-        {
-            VkResult res = pBlock->ValidateMagicValueAroundAllocation(m_hAllocator, hAllocation->GetOffset(), hAllocation->GetSize());
-            VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to validate magic value.");
-        }
-
-        if(hAllocation->IsPersistentMap())
-        {
-            pBlock->Unmap(m_hAllocator, 1);
-        }
-
-        pBlock->m_pMetadata->Free(hAllocation);
-        VMA_HEAVY_ASSERT(pBlock->Validate());
-
-        VMA_DEBUG_LOG("  Freed from MemoryTypeIndex=%u", m_MemoryTypeIndex);
-
-        const bool canDeleteBlock = m_Blocks.size() > m_MinBlockCount;
-        // pBlock became empty after this deallocation.
-        if(pBlock->m_pMetadata->IsEmpty())
-        {
-            // Already has empty block. We don't want to have two, so delete this one.
-            if((m_HasEmptyBlock || budgetExceeded) && canDeleteBlock)
-            {
-                pBlockToDelete = pBlock;
-                Remove(pBlock);
-            }
-            // else: We now have an empty block - leave it.
-        }
-        // pBlock didn't become empty, but we have another empty block - find and free that one.
-        // (This is optional, heuristics.)
-        else if(m_HasEmptyBlock && canDeleteBlock)
-        {
-            VmaDeviceMemoryBlock* pLastBlock = m_Blocks.back();
-            if(pLastBlock->m_pMetadata->IsEmpty())
-            {
-                pBlockToDelete = pLastBlock;
-                m_Blocks.pop_back();
-            }
-        }
-
-        UpdateHasEmptyBlock();
-        IncrementallySortBlocks();
-    }
-
-    // Destruction of a free block. Deferred until this point, outside of mutex
-    // lock, for performance reason.
-    if(pBlockToDelete != VMA_NULL)
-    {
-        VMA_DEBUG_LOG("    Deleted empty block");
-        pBlockToDelete->Destroy(m_hAllocator);
-        vma_delete(m_hAllocator, pBlockToDelete);
-    }
-}
-
-VkDeviceSize VmaBlockVector::CalcMaxBlockSize() const
-{
-    VkDeviceSize result = 0;
-    for(size_t i = m_Blocks.size(); i--; )
-    {
-        result = VMA_MAX(result, m_Blocks[i]->m_pMetadata->GetSize());
-        if(result >= m_PreferredBlockSize)
-        {
-            break;
-        }
-    }
-    return result;
-}
-
-void VmaBlockVector::Remove(VmaDeviceMemoryBlock* pBlock)
-{
-    for(uint32_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex)
-    {
-        if(m_Blocks[blockIndex] == pBlock)
-        {
-            VmaVectorRemove(m_Blocks, blockIndex);
-            return;
-        }
-    }
-    VMA_ASSERT(0);
-}
-
-void VmaBlockVector::IncrementallySortBlocks()
-{
-    if(m_Algorithm != VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT)
-    {
-        // Bubble sort only until first swap.
-        for(size_t i = 1; i < m_Blocks.size(); ++i)
-        {
-            if(m_Blocks[i - 1]->m_pMetadata->GetSumFreeSize() > m_Blocks[i]->m_pMetadata->GetSumFreeSize())
-            {
-                VMA_SWAP(m_Blocks[i - 1], m_Blocks[i]);
-                return;
-            }
-        }
-    }
-}
-
-VkResult VmaBlockVector::AllocateFromBlock(
-    VmaDeviceMemoryBlock* pBlock,
-    uint32_t currentFrameIndex,
-    VkDeviceSize size,
-    VkDeviceSize alignment,
-    VmaAllocationCreateFlags allocFlags,
-    void* pUserData,
-    VmaSuballocationType suballocType,
-    uint32_t strategy,
-    VmaAllocation* pAllocation)
-{
-    VMA_ASSERT((allocFlags & VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT) == 0);
-    const bool isUpperAddress = (allocFlags & VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT) != 0;
-    const bool mapped = (allocFlags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0;
-    const bool isUserDataString = (allocFlags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0;
-
-    VmaAllocationRequest currRequest = {};
-    if(pBlock->m_pMetadata->CreateAllocationRequest(
-        currentFrameIndex,
-        m_FrameInUseCount,
-        m_BufferImageGranularity,
-        size,
-        alignment,
-        isUpperAddress,
-        suballocType,
-        false, // canMakeOtherLost
-        strategy,
-        &currRequest))
-    {
-        // Allocate from pCurrBlock.
-        VMA_ASSERT(currRequest.itemsToMakeLostCount == 0);
-
-        if(mapped)
-        {
-            VkResult res = pBlock->Map(m_hAllocator, 1, VMA_NULL);
-            if(res != VK_SUCCESS)
-            {
-                return res;
-            }
-        }
-            
-        *pAllocation = m_hAllocator->m_AllocationObjectAllocator.Allocate(currentFrameIndex, isUserDataString);
-        pBlock->m_pMetadata->Alloc(currRequest, suballocType, size, *pAllocation);
-        UpdateHasEmptyBlock();
-        (*pAllocation)->InitBlockAllocation(
-            pBlock,
-            currRequest.offset,
-            alignment,
-            size,
-            m_MemoryTypeIndex,
-            suballocType,
-            mapped,
-            (allocFlags & VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT) != 0);
-        VMA_HEAVY_ASSERT(pBlock->Validate());
-        (*pAllocation)->SetUserData(m_hAllocator, pUserData);
-        m_hAllocator->m_Budget.AddAllocation(m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex), size);
-        if(VMA_DEBUG_INITIALIZE_ALLOCATIONS)
-        {
-            m_hAllocator->FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);
-        }
-        if(IsCorruptionDetectionEnabled())
-        {
-            VkResult res = pBlock->WriteMagicValueAroundAllocation(m_hAllocator, currRequest.offset, size);
-            VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to write magic value.");
-        }
-        return VK_SUCCESS;
-    }
-    return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-}
-
-VkResult VmaBlockVector::CreateBlock(VkDeviceSize blockSize, size_t* pNewBlockIndex)
-{
-    VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };
-    allocInfo.memoryTypeIndex = m_MemoryTypeIndex;
-    allocInfo.allocationSize = blockSize;
-
-#if VMA_BUFFER_DEVICE_ADDRESS
-    // Every standalone block can potentially contain a buffer with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT - always enable the feature.
-    VkMemoryAllocateFlagsInfoKHR allocFlagsInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR };
-    if(m_hAllocator->m_UseKhrBufferDeviceAddress)
-    {
-        allocFlagsInfo.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;
-        VmaPnextChainPushFront(&allocInfo, &allocFlagsInfo);
-    }
-#endif // #if VMA_BUFFER_DEVICE_ADDRESS
-
-    VkDeviceMemory mem = VK_NULL_HANDLE;
-    VkResult res = m_hAllocator->AllocateVulkanMemory(&allocInfo, &mem);
-    if(res < 0)
-    {
-        return res;
-    }
-
-    // New VkDeviceMemory successfully created.
-
-    // Create new Allocation for it.
-    VmaDeviceMemoryBlock* const pBlock = vma_new(m_hAllocator, VmaDeviceMemoryBlock)(m_hAllocator);
-    pBlock->Init(
-        m_hAllocator,
-        m_hParentPool,
-        m_MemoryTypeIndex,
-        mem,
-        allocInfo.allocationSize,
-        m_NextBlockId++,
-        m_Algorithm);
-
-    m_Blocks.push_back(pBlock);
-    if(pNewBlockIndex != VMA_NULL)
-    {
-        *pNewBlockIndex = m_Blocks.size() - 1;
-    }
-
-    return VK_SUCCESS;
-}
-
-void VmaBlockVector::ApplyDefragmentationMovesCpu(
-    class VmaBlockVectorDefragmentationContext* pDefragCtx,
-    const VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves)
-{
-    const size_t blockCount = m_Blocks.size();
-    const bool isNonCoherent = m_hAllocator->IsMemoryTypeNonCoherent(m_MemoryTypeIndex);
-
-    enum BLOCK_FLAG
-    {
-        BLOCK_FLAG_USED = 0x00000001,
-        BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION = 0x00000002,
-    };
-
-    struct BlockInfo
-    {
-        uint32_t flags;
-        void* pMappedData;
-    };
-    VmaVector< BlockInfo, VmaStlAllocator<BlockInfo> >
-        blockInfo(blockCount, BlockInfo(), VmaStlAllocator<BlockInfo>(m_hAllocator->GetAllocationCallbacks()));
-    memset(blockInfo.data(), 0, blockCount * sizeof(BlockInfo));
-
-    // Go over all moves. Mark blocks that are used with BLOCK_FLAG_USED.
-    const size_t moveCount = moves.size();
-    for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)
-    {
-        const VmaDefragmentationMove& move = moves[moveIndex];
-        blockInfo[move.srcBlockIndex].flags |= BLOCK_FLAG_USED;
-        blockInfo[move.dstBlockIndex].flags |= BLOCK_FLAG_USED;
-    }
-
-    VMA_ASSERT(pDefragCtx->res == VK_SUCCESS);
-
-    // Go over all blocks. Get mapped pointer or map if necessary.
-    for(size_t blockIndex = 0; pDefragCtx->res == VK_SUCCESS && blockIndex < blockCount; ++blockIndex)
-    {
-        BlockInfo& currBlockInfo = blockInfo[blockIndex];
-        VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];
-        if((currBlockInfo.flags & BLOCK_FLAG_USED) != 0)
-        {
-            currBlockInfo.pMappedData = pBlock->GetMappedData();
-            // It is not originally mapped - map it.
-            if(currBlockInfo.pMappedData == VMA_NULL)
-            {
-                pDefragCtx->res = pBlock->Map(m_hAllocator, 1, &currBlockInfo.pMappedData);
-                if(pDefragCtx->res == VK_SUCCESS)
-                {
-                    currBlockInfo.flags |= BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION;
-                }
-            }
-        }
-    }
-
-    // Go over all moves. Do actual data transfer.
-    if(pDefragCtx->res == VK_SUCCESS)
-    {
-        const VkDeviceSize nonCoherentAtomSize = m_hAllocator->m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;
-        VkMappedMemoryRange memRange = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE };
-
-        for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)
-        {
-            const VmaDefragmentationMove& move = moves[moveIndex];
-
-            const BlockInfo& srcBlockInfo = blockInfo[move.srcBlockIndex];
-            const BlockInfo& dstBlockInfo = blockInfo[move.dstBlockIndex];
-
-            VMA_ASSERT(srcBlockInfo.pMappedData && dstBlockInfo.pMappedData);
-
-            // Invalidate source.
-            if(isNonCoherent)
-            {
-                VmaDeviceMemoryBlock* const pSrcBlock = m_Blocks[move.srcBlockIndex];
-                memRange.memory = pSrcBlock->GetDeviceMemory();
-                memRange.offset = VmaAlignDown(move.srcOffset, nonCoherentAtomSize);
-                memRange.size = VMA_MIN(
-                    VmaAlignUp(move.size + (move.srcOffset - memRange.offset), nonCoherentAtomSize),
-                    pSrcBlock->m_pMetadata->GetSize() - memRange.offset);
-                (*m_hAllocator->GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hAllocator->m_hDevice, 1, &memRange);
-            }
-
-            // THE PLACE WHERE ACTUAL DATA COPY HAPPENS.
-            memmove(
-                reinterpret_cast<char*>(dstBlockInfo.pMappedData) + move.dstOffset,
-                reinterpret_cast<char*>(srcBlockInfo.pMappedData) + move.srcOffset,
-                static_cast<size_t>(move.size));
-
-            if(IsCorruptionDetectionEnabled())
-            {
-                VmaWriteMagicValue(dstBlockInfo.pMappedData, move.dstOffset - VMA_DEBUG_MARGIN);
-                VmaWriteMagicValue(dstBlockInfo.pMappedData, move.dstOffset + move.size);
-            }
-
-            // Flush destination.
-            if(isNonCoherent)
-            {
-                VmaDeviceMemoryBlock* const pDstBlock = m_Blocks[move.dstBlockIndex];
-                memRange.memory = pDstBlock->GetDeviceMemory();
-                memRange.offset = VmaAlignDown(move.dstOffset, nonCoherentAtomSize);
-                memRange.size = VMA_MIN(
-                    VmaAlignUp(move.size + (move.dstOffset - memRange.offset), nonCoherentAtomSize),
-                    pDstBlock->m_pMetadata->GetSize() - memRange.offset);
-                (*m_hAllocator->GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hAllocator->m_hDevice, 1, &memRange);
-            }
-        }
-    }
-
-    // Go over all blocks in reverse order. Unmap those that were mapped just for defragmentation.
-    // Regardless of pCtx->res == VK_SUCCESS.
-    for(size_t blockIndex = blockCount; blockIndex--; )
-    {
-        const BlockInfo& currBlockInfo = blockInfo[blockIndex];
-        if((currBlockInfo.flags & BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION) != 0)
-        {
-            VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];
-            pBlock->Unmap(m_hAllocator, 1);
-        }
-    }
-}
-
-void VmaBlockVector::ApplyDefragmentationMovesGpu(
-    class VmaBlockVectorDefragmentationContext* pDefragCtx,
-    VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,
-    VkCommandBuffer commandBuffer)
-{
-    const size_t blockCount = m_Blocks.size();
-
-    pDefragCtx->blockContexts.resize(blockCount);
-    memset(pDefragCtx->blockContexts.data(), 0, blockCount * sizeof(VmaBlockDefragmentationContext));
-
-    // Go over all moves. Mark blocks that are used with BLOCK_FLAG_USED.
-    const size_t moveCount = moves.size();
-    for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)
-    {
-        const VmaDefragmentationMove& move = moves[moveIndex];
-
-        //if(move.type == VMA_ALLOCATION_TYPE_UNKNOWN)
-        {
-            // Old school move still require us to map the whole block
-            pDefragCtx->blockContexts[move.srcBlockIndex].flags |= VmaBlockDefragmentationContext::BLOCK_FLAG_USED;
-            pDefragCtx->blockContexts[move.dstBlockIndex].flags |= VmaBlockDefragmentationContext::BLOCK_FLAG_USED;
-        }
-    }
-
-    VMA_ASSERT(pDefragCtx->res == VK_SUCCESS);
-
-    // Go over all blocks. Create and bind buffer for whole block if necessary.
-    {
-        VkBufferCreateInfo bufCreateInfo;
-        VmaFillGpuDefragmentationBufferCreateInfo(bufCreateInfo);
-
-        for(size_t blockIndex = 0; pDefragCtx->res == VK_SUCCESS && blockIndex < blockCount; ++blockIndex)
-        {
-            VmaBlockDefragmentationContext& currBlockCtx = pDefragCtx->blockContexts[blockIndex];
-            VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];
-            if((currBlockCtx.flags & VmaBlockDefragmentationContext::BLOCK_FLAG_USED) != 0)
-            {
-                bufCreateInfo.size = pBlock->m_pMetadata->GetSize();
-                pDefragCtx->res = (*m_hAllocator->GetVulkanFunctions().vkCreateBuffer)(
-                    m_hAllocator->m_hDevice, &bufCreateInfo, m_hAllocator->GetAllocationCallbacks(), &currBlockCtx.hBuffer);
-                if(pDefragCtx->res == VK_SUCCESS)
-                {
-                    pDefragCtx->res = (*m_hAllocator->GetVulkanFunctions().vkBindBufferMemory)(
-                        m_hAllocator->m_hDevice, currBlockCtx.hBuffer, pBlock->GetDeviceMemory(), 0);
-                }
-            }
-        }
-    }
-
-    // Go over all moves. Post data transfer commands to command buffer.
-    if(pDefragCtx->res == VK_SUCCESS)
-    {
-        for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)
-        {
-            const VmaDefragmentationMove& move = moves[moveIndex];
-
-            const VmaBlockDefragmentationContext& srcBlockCtx = pDefragCtx->blockContexts[move.srcBlockIndex];
-            const VmaBlockDefragmentationContext& dstBlockCtx = pDefragCtx->blockContexts[move.dstBlockIndex];
-
-            VMA_ASSERT(srcBlockCtx.hBuffer && dstBlockCtx.hBuffer);
-
-            VkBufferCopy region = {
-                move.srcOffset,
-                move.dstOffset,
-                move.size };
-            (*m_hAllocator->GetVulkanFunctions().vkCmdCopyBuffer)(
-                commandBuffer, srcBlockCtx.hBuffer, dstBlockCtx.hBuffer, 1, &region);
-        }
-    }
-
-    // Save buffers to defrag context for later destruction.
-    if(pDefragCtx->res == VK_SUCCESS && moveCount > 0)
-    {
-        pDefragCtx->res = VK_NOT_READY;
-    }
-}
-
-void VmaBlockVector::FreeEmptyBlocks(VmaDefragmentationStats* pDefragmentationStats)
-{
-    for(size_t blockIndex = m_Blocks.size(); blockIndex--; )
-    {
-        VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];
-        if(pBlock->m_pMetadata->IsEmpty())
-        {
-            if(m_Blocks.size() > m_MinBlockCount)
-            {
-                if(pDefragmentationStats != VMA_NULL)
-                {
-                    ++pDefragmentationStats->deviceMemoryBlocksFreed;
-                    pDefragmentationStats->bytesFreed += pBlock->m_pMetadata->GetSize();
-                }
-
-                VmaVectorRemove(m_Blocks, blockIndex);
-                pBlock->Destroy(m_hAllocator);
-                vma_delete(m_hAllocator, pBlock);
-            }
-            else
-            {
-                break;
-            }
-        }
-    }
-    UpdateHasEmptyBlock();
-}
-
-void VmaBlockVector::UpdateHasEmptyBlock()
-{
-    m_HasEmptyBlock = false;
-    for(size_t index = 0, count = m_Blocks.size(); index < count; ++index)
-    {
-        VmaDeviceMemoryBlock* const pBlock = m_Blocks[index];
-        if(pBlock->m_pMetadata->IsEmpty())
-        {
-            m_HasEmptyBlock = true;
-            break;
-        }
-    }
-}
-
-#if VMA_STATS_STRING_ENABLED
-
-void VmaBlockVector::PrintDetailedMap(class VmaJsonWriter& json)
-{
-    VmaMutexLockRead lock(m_Mutex, m_hAllocator->m_UseMutex);
-
-    json.BeginObject();
-
-    if(IsCustomPool())
-    {
-        const char* poolName = m_hParentPool->GetName();
-        if(poolName != VMA_NULL && poolName[0] != '\0')
-        {
-            json.WriteString("Name");
-            json.WriteString(poolName);
-        }
-
-        json.WriteString("MemoryTypeIndex");
-        json.WriteNumber(m_MemoryTypeIndex);
-
-        json.WriteString("BlockSize");
-        json.WriteNumber(m_PreferredBlockSize);
-
-        json.WriteString("BlockCount");
-        json.BeginObject(true);
-        if(m_MinBlockCount > 0)
-        {
-            json.WriteString("Min");
-            json.WriteNumber((uint64_t)m_MinBlockCount);
-        }
-        if(m_MaxBlockCount < SIZE_MAX)
-        {
-            json.WriteString("Max");
-            json.WriteNumber((uint64_t)m_MaxBlockCount);
-        }
-        json.WriteString("Cur");
-        json.WriteNumber((uint64_t)m_Blocks.size());
-        json.EndObject();
-
-        if(m_FrameInUseCount > 0)
-        {
-            json.WriteString("FrameInUseCount");
-            json.WriteNumber(m_FrameInUseCount);
-        }
-
-        if(m_Algorithm != 0)
-        {
-            json.WriteString("Algorithm");
-            json.WriteString(VmaAlgorithmToStr(m_Algorithm));
-        }
-    }
-    else
-    {
-        json.WriteString("PreferredBlockSize");
-        json.WriteNumber(m_PreferredBlockSize);
-    }
-
-    json.WriteString("Blocks");
-    json.BeginObject();
-    for(size_t i = 0; i < m_Blocks.size(); ++i)
-    {
-        json.BeginString();
-        json.ContinueString(m_Blocks[i]->GetId());
-        json.EndString();
-
-        m_Blocks[i]->m_pMetadata->PrintDetailedMap(json);
-    }
-    json.EndObject();
-
-    json.EndObject();
-}
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-void VmaBlockVector::Defragment(
-    class VmaBlockVectorDefragmentationContext* pCtx,
-    VmaDefragmentationStats* pStats, VmaDefragmentationFlags flags,
-    VkDeviceSize& maxCpuBytesToMove, uint32_t& maxCpuAllocationsToMove,
-    VkDeviceSize& maxGpuBytesToMove, uint32_t& maxGpuAllocationsToMove,
-    VkCommandBuffer commandBuffer)
-{
-    pCtx->res = VK_SUCCESS;
-    
-    const VkMemoryPropertyFlags memPropFlags =
-        m_hAllocator->m_MemProps.memoryTypes[m_MemoryTypeIndex].propertyFlags;
-    const bool isHostVisible = (memPropFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0;
-
-    const bool canDefragmentOnCpu = maxCpuBytesToMove > 0 && maxCpuAllocationsToMove > 0 &&
-        isHostVisible;
-    const bool canDefragmentOnGpu = maxGpuBytesToMove > 0 && maxGpuAllocationsToMove > 0 &&
-        !IsCorruptionDetectionEnabled() &&
-        ((1u << m_MemoryTypeIndex) & m_hAllocator->GetGpuDefragmentationMemoryTypeBits()) != 0;
-
-    // There are options to defragment this memory type.
-    if(canDefragmentOnCpu || canDefragmentOnGpu)
-    {
-        bool defragmentOnGpu;
-        // There is only one option to defragment this memory type.
-        if(canDefragmentOnGpu != canDefragmentOnCpu)
-        {
-            defragmentOnGpu = canDefragmentOnGpu;
-        }
-        // Both options are available: Heuristics to choose the best one.
-        else
-        {
-            defragmentOnGpu = (memPropFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0 ||
-                m_hAllocator->IsIntegratedGpu();
-        }
-
-        bool overlappingMoveSupported = !defragmentOnGpu;
-
-        if(m_hAllocator->m_UseMutex)
-        {
-            if(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL)
-            {
-                if(!m_Mutex.TryLockWrite())
-                {
-                    pCtx->res = VK_ERROR_INITIALIZATION_FAILED;
-                    return;
-                }
-            }
-            else
-            {
-                m_Mutex.LockWrite();
-                pCtx->mutexLocked = true;
-            }
-        }
-
-        pCtx->Begin(overlappingMoveSupported, flags);
-
-        // Defragment.
-
-        const VkDeviceSize maxBytesToMove = defragmentOnGpu ? maxGpuBytesToMove : maxCpuBytesToMove;
-        const uint32_t maxAllocationsToMove = defragmentOnGpu ? maxGpuAllocationsToMove : maxCpuAllocationsToMove;
-        pCtx->res = pCtx->GetAlgorithm()->Defragment(pCtx->defragmentationMoves, maxBytesToMove, maxAllocationsToMove, flags);
-
-        // Accumulate statistics.
-        if(pStats != VMA_NULL)
-        {
-            const VkDeviceSize bytesMoved = pCtx->GetAlgorithm()->GetBytesMoved();
-            const uint32_t allocationsMoved = pCtx->GetAlgorithm()->GetAllocationsMoved();
-            pStats->bytesMoved += bytesMoved;
-            pStats->allocationsMoved += allocationsMoved;
-            VMA_ASSERT(bytesMoved <= maxBytesToMove);
-            VMA_ASSERT(allocationsMoved <= maxAllocationsToMove);
-            if(defragmentOnGpu)
-            {
-                maxGpuBytesToMove -= bytesMoved;
-                maxGpuAllocationsToMove -= allocationsMoved;
-            }
-            else
-            {
-                maxCpuBytesToMove -= bytesMoved;
-                maxCpuAllocationsToMove -= allocationsMoved;
-            }
-        }
-
-        if(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL)
-        {
-            if(m_hAllocator->m_UseMutex)
-                m_Mutex.UnlockWrite();
-            
-            if(pCtx->res >= VK_SUCCESS && !pCtx->defragmentationMoves.empty())
-                pCtx->res = VK_NOT_READY;
-
-            return;
-        }
-    
-        if(pCtx->res >= VK_SUCCESS)
-        {
-            if(defragmentOnGpu)
-            {
-                ApplyDefragmentationMovesGpu(pCtx, pCtx->defragmentationMoves, commandBuffer);
-            }
-            else
-            {
-                ApplyDefragmentationMovesCpu(pCtx, pCtx->defragmentationMoves);
-            }
-        }
-    }
-}
-
-void VmaBlockVector::DefragmentationEnd(
-    class VmaBlockVectorDefragmentationContext* pCtx,
-    uint32_t flags,
-    VmaDefragmentationStats* pStats)
-{
-    if(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL && m_hAllocator->m_UseMutex)
-    {
-        VMA_ASSERT(pCtx->mutexLocked == false);
-
-        // Incremental defragmentation doesn't hold the lock, so when we enter here we don't actually have any
-        // lock protecting us. Since we mutate state here, we have to take the lock out now
-        m_Mutex.LockWrite();
-        pCtx->mutexLocked = true;
-    }
-
-    // If the mutex isn't locked we didn't do any work and there is nothing to delete.
-    if(pCtx->mutexLocked || !m_hAllocator->m_UseMutex)
-    {
-        // Destroy buffers.
-        for(size_t blockIndex = pCtx->blockContexts.size(); blockIndex--;)
-        {
-            VmaBlockDefragmentationContext &blockCtx = pCtx->blockContexts[blockIndex];
-            if(blockCtx.hBuffer)
-            {
-                (*m_hAllocator->GetVulkanFunctions().vkDestroyBuffer)(m_hAllocator->m_hDevice, blockCtx.hBuffer, m_hAllocator->GetAllocationCallbacks());
-            }
-        }
-
-        if(pCtx->res >= VK_SUCCESS)
-        {
-            FreeEmptyBlocks(pStats);
-        }
-    }
-
-    if(pCtx->mutexLocked)
-    {
-        VMA_ASSERT(m_hAllocator->m_UseMutex);
-        m_Mutex.UnlockWrite();
-    }
-}
-
-uint32_t VmaBlockVector::ProcessDefragmentations(
-    class VmaBlockVectorDefragmentationContext *pCtx,
-    VmaDefragmentationPassMoveInfo* pMove, uint32_t maxMoves)
-{
-    VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);
-    
-    const uint32_t moveCount = std::min(uint32_t(pCtx->defragmentationMoves.size()) - pCtx->defragmentationMovesProcessed, maxMoves);
-
-    for(uint32_t i = 0; i < moveCount; ++ i)
-    {
-        VmaDefragmentationMove& move = pCtx->defragmentationMoves[pCtx->defragmentationMovesProcessed + i];
-
-        pMove->allocation = move.hAllocation;
-        pMove->memory = move.pDstBlock->GetDeviceMemory();
-        pMove->offset = move.dstOffset;
-
-        ++ pMove;
-    }
-
-    pCtx->defragmentationMovesProcessed += moveCount;
-
-    return moveCount;
-}
-
-void VmaBlockVector::CommitDefragmentations(
-    class VmaBlockVectorDefragmentationContext *pCtx,
-    VmaDefragmentationStats* pStats)
-{
-    VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);
-    
-    for(uint32_t i = pCtx->defragmentationMovesCommitted; i < pCtx->defragmentationMovesProcessed; ++ i)
-    {
-        const VmaDefragmentationMove &move = pCtx->defragmentationMoves[i];
-
-        move.pSrcBlock->m_pMetadata->FreeAtOffset(move.srcOffset);
-        move.hAllocation->ChangeBlockAllocation(m_hAllocator, move.pDstBlock, move.dstOffset);
-    }
-
-    pCtx->defragmentationMovesCommitted = pCtx->defragmentationMovesProcessed;
-    FreeEmptyBlocks(pStats);
-}
-
-size_t VmaBlockVector::CalcAllocationCount() const
-{
-    size_t result = 0;
-    for(size_t i = 0; i < m_Blocks.size(); ++i)
-    {
-        result += m_Blocks[i]->m_pMetadata->GetAllocationCount();
-    }
-    return result;
-}
-
-bool VmaBlockVector::IsBufferImageGranularityConflictPossible() const
-{
-    if(m_BufferImageGranularity == 1)
-    {
-        return false;
-    }
-    VmaSuballocationType lastSuballocType = VMA_SUBALLOCATION_TYPE_FREE;
-    for(size_t i = 0, count = m_Blocks.size(); i < count; ++i)
-    {
-        VmaDeviceMemoryBlock* const pBlock = m_Blocks[i];
-        VMA_ASSERT(m_Algorithm == 0);
-        VmaBlockMetadata_Generic* const pMetadata = (VmaBlockMetadata_Generic*)pBlock->m_pMetadata;
-        if(pMetadata->IsBufferImageGranularityConflictPossible(m_BufferImageGranularity, lastSuballocType))
-        {
-            return true;
-        }
-    }
-    return false;
-}
-
-void VmaBlockVector::MakePoolAllocationsLost(
-    uint32_t currentFrameIndex,
-    size_t* pLostAllocationCount)
-{
-    VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);
-    size_t lostAllocationCount = 0;
-    for(uint32_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex)
-    {
-        VmaDeviceMemoryBlock* const pBlock = m_Blocks[blockIndex];
-        VMA_ASSERT(pBlock);
-        lostAllocationCount += pBlock->m_pMetadata->MakeAllocationsLost(currentFrameIndex, m_FrameInUseCount);
-    }
-    if(pLostAllocationCount != VMA_NULL)
-    {
-        *pLostAllocationCount = lostAllocationCount;
-    }
-}
-
-VkResult VmaBlockVector::CheckCorruption()
-{
-    if(!IsCorruptionDetectionEnabled())
-    {
-        return VK_ERROR_FEATURE_NOT_PRESENT;
-    }
-
-    VmaMutexLockRead lock(m_Mutex, m_hAllocator->m_UseMutex);
-    for(uint32_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex)
-    {
-        VmaDeviceMemoryBlock* const pBlock = m_Blocks[blockIndex];
-        VMA_ASSERT(pBlock);
-        VkResult res = pBlock->CheckCorruption(m_hAllocator);
-        if(res != VK_SUCCESS)
-        {
-            return res;
-        }
-    }
-    return VK_SUCCESS;
-}
-
-void VmaBlockVector::AddStats(VmaStats* pStats)
-{
-    const uint32_t memTypeIndex = m_MemoryTypeIndex;
-    const uint32_t memHeapIndex = m_hAllocator->MemoryTypeIndexToHeapIndex(memTypeIndex);
-
-    VmaMutexLockRead lock(m_Mutex, m_hAllocator->m_UseMutex);
-
-    for(uint32_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex)
-    {
-        const VmaDeviceMemoryBlock* const pBlock = m_Blocks[blockIndex];
-        VMA_ASSERT(pBlock);
-        VMA_HEAVY_ASSERT(pBlock->Validate());
-        VmaStatInfo allocationStatInfo;
-        pBlock->m_pMetadata->CalcAllocationStatInfo(allocationStatInfo);
-        VmaAddStatInfo(pStats->total, allocationStatInfo);
-        VmaAddStatInfo(pStats->memoryType[memTypeIndex], allocationStatInfo);
-        VmaAddStatInfo(pStats->memoryHeap[memHeapIndex], allocationStatInfo);
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VmaDefragmentationAlgorithm_Generic members definition
-
-VmaDefragmentationAlgorithm_Generic::VmaDefragmentationAlgorithm_Generic(
-    VmaAllocator hAllocator,
-    VmaBlockVector* pBlockVector,
-    uint32_t currentFrameIndex,
-    bool overlappingMoveSupported) :
-    VmaDefragmentationAlgorithm(hAllocator, pBlockVector, currentFrameIndex),
-    m_AllocationCount(0),
-    m_AllAllocations(false),
-    m_BytesMoved(0),
-    m_AllocationsMoved(0),
-    m_Blocks(VmaStlAllocator<BlockInfo*>(hAllocator->GetAllocationCallbacks()))
-{
-    // Create block info for each block.
-    const size_t blockCount = m_pBlockVector->m_Blocks.size();
-    for(size_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)
-    {
-        BlockInfo* pBlockInfo = vma_new(m_hAllocator, BlockInfo)(m_hAllocator->GetAllocationCallbacks());
-        pBlockInfo->m_OriginalBlockIndex = blockIndex;
-        pBlockInfo->m_pBlock = m_pBlockVector->m_Blocks[blockIndex];
-        m_Blocks.push_back(pBlockInfo);
-    }
-
-    // Sort them by m_pBlock pointer value.
-    VMA_SORT(m_Blocks.begin(), m_Blocks.end(), BlockPointerLess());
-}
-
-VmaDefragmentationAlgorithm_Generic::~VmaDefragmentationAlgorithm_Generic()
-{
-    for(size_t i = m_Blocks.size(); i--; )
-    {
-        vma_delete(m_hAllocator, m_Blocks[i]);
-    }
-}
-
-void VmaDefragmentationAlgorithm_Generic::AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged)
-{
-    // Now as we are inside VmaBlockVector::m_Mutex, we can make final check if this allocation was not lost.
-    if(hAlloc->GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST)
-    {
-        VmaDeviceMemoryBlock* pBlock = hAlloc->GetBlock();
-        BlockInfoVector::iterator it = VmaBinaryFindFirstNotLess(m_Blocks.begin(), m_Blocks.end(), pBlock, BlockPointerLess());
-        if(it != m_Blocks.end() && (*it)->m_pBlock == pBlock)
-        {
-            AllocationInfo allocInfo = AllocationInfo(hAlloc, pChanged);
-            (*it)->m_Allocations.push_back(allocInfo);
-        }
-        else
-        {
-            VMA_ASSERT(0);
-        }
-
-        ++m_AllocationCount;
-    }
-}
-
-VkResult VmaDefragmentationAlgorithm_Generic::DefragmentRound(
-    VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,
-    VkDeviceSize maxBytesToMove,
-    uint32_t maxAllocationsToMove,
-    bool freeOldAllocations)
-{
-    if(m_Blocks.empty())
-    {
-        return VK_SUCCESS;
-    }
-
-    // This is a choice based on research.
-    // Option 1:
-    uint32_t strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT;
-    // Option 2:
-    //uint32_t strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT;
-    // Option 3:
-    //uint32_t strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT;
-
-    size_t srcBlockMinIndex = 0;
-    // When FAST_ALGORITHM, move allocations from only last out of blocks that contain non-movable allocations.
-    /*
-    if(m_AlgorithmFlags & VMA_DEFRAGMENTATION_FAST_ALGORITHM_BIT)
-    {
-        const size_t blocksWithNonMovableCount = CalcBlocksWithNonMovableCount();
-        if(blocksWithNonMovableCount > 0)
-        {
-            srcBlockMinIndex = blocksWithNonMovableCount - 1;
-        }
-    }
-    */
-
-    size_t srcBlockIndex = m_Blocks.size() - 1;
-    size_t srcAllocIndex = SIZE_MAX;
-    for(;;)
-    {
-        // 1. Find next allocation to move.
-        // 1.1. Start from last to first m_Blocks - they are sorted from most "destination" to most "source".
-        // 1.2. Then start from last to first m_Allocations.
-        while(srcAllocIndex >= m_Blocks[srcBlockIndex]->m_Allocations.size())
-        {
-            if(m_Blocks[srcBlockIndex]->m_Allocations.empty())
-            {
-                // Finished: no more allocations to process.
-                if(srcBlockIndex == srcBlockMinIndex)
-                {
-                    return VK_SUCCESS;
-                }
-                else
-                {
-                    --srcBlockIndex;
-                    srcAllocIndex = SIZE_MAX;
-                }
-            }
-            else
-            {
-                srcAllocIndex = m_Blocks[srcBlockIndex]->m_Allocations.size() - 1;
-            }
-        }
-        
-        BlockInfo* pSrcBlockInfo = m_Blocks[srcBlockIndex];
-        AllocationInfo& allocInfo = pSrcBlockInfo->m_Allocations[srcAllocIndex];
-
-        const VkDeviceSize size = allocInfo.m_hAllocation->GetSize();
-        const VkDeviceSize srcOffset = allocInfo.m_hAllocation->GetOffset();
-        const VkDeviceSize alignment = allocInfo.m_hAllocation->GetAlignment();
-        const VmaSuballocationType suballocType = allocInfo.m_hAllocation->GetSuballocationType();
-
-        // 2. Try to find new place for this allocation in preceding or current block.
-        for(size_t dstBlockIndex = 0; dstBlockIndex <= srcBlockIndex; ++dstBlockIndex)
-        {
-            BlockInfo* pDstBlockInfo = m_Blocks[dstBlockIndex];
-            VmaAllocationRequest dstAllocRequest;
-            if(pDstBlockInfo->m_pBlock->m_pMetadata->CreateAllocationRequest(
-                m_CurrentFrameIndex,
-                m_pBlockVector->GetFrameInUseCount(),
-                m_pBlockVector->GetBufferImageGranularity(),
-                size,
-                alignment,
-                false, // upperAddress
-                suballocType,
-                false, // canMakeOtherLost
-                strategy,
-                &dstAllocRequest) &&
-            MoveMakesSense(
-                dstBlockIndex, dstAllocRequest.offset, srcBlockIndex, srcOffset))
-            {
-                VMA_ASSERT(dstAllocRequest.itemsToMakeLostCount == 0);
-
-                // Reached limit on number of allocations or bytes to move.
-                if((m_AllocationsMoved + 1 > maxAllocationsToMove) ||
-                    (m_BytesMoved + size > maxBytesToMove))
-                {
-                    return VK_SUCCESS;
-                }
-
-                VmaDefragmentationMove move = {};
-                move.srcBlockIndex = pSrcBlockInfo->m_OriginalBlockIndex;
-                move.dstBlockIndex = pDstBlockInfo->m_OriginalBlockIndex;
-                move.srcOffset = srcOffset;
-                move.dstOffset = dstAllocRequest.offset;
-                move.size = size;
-                move.hAllocation = allocInfo.m_hAllocation;
-                move.pSrcBlock = pSrcBlockInfo->m_pBlock;
-                move.pDstBlock = pDstBlockInfo->m_pBlock;
-
-                moves.push_back(move);
-
-                pDstBlockInfo->m_pBlock->m_pMetadata->Alloc(
-                    dstAllocRequest,
-                    suballocType,
-                    size,
-                    allocInfo.m_hAllocation);
-
-                if(freeOldAllocations)
-                {
-                    pSrcBlockInfo->m_pBlock->m_pMetadata->FreeAtOffset(srcOffset);
-                    allocInfo.m_hAllocation->ChangeBlockAllocation(m_hAllocator, pDstBlockInfo->m_pBlock, dstAllocRequest.offset);
-                }
-                
-                if(allocInfo.m_pChanged != VMA_NULL)
-                {
-                    *allocInfo.m_pChanged = VK_TRUE;
-                }
-
-                ++m_AllocationsMoved;
-                m_BytesMoved += size;
-
-                VmaVectorRemove(pSrcBlockInfo->m_Allocations, srcAllocIndex);
-
-                break;
-            }
-        }
-
-        // If not processed, this allocInfo remains in pBlockInfo->m_Allocations for next round.
-
-        if(srcAllocIndex > 0)
-        {
-            --srcAllocIndex;
-        }
-        else
-        {
-            if(srcBlockIndex > 0)
-            {
-                --srcBlockIndex;
-                srcAllocIndex = SIZE_MAX;
-            }
-            else
-            {
-                return VK_SUCCESS;
-            }
-        }
-    }
-}
-
-size_t VmaDefragmentationAlgorithm_Generic::CalcBlocksWithNonMovableCount() const
-{
-    size_t result = 0;
-    for(size_t i = 0; i < m_Blocks.size(); ++i)
-    {
-        if(m_Blocks[i]->m_HasNonMovableAllocations)
-        {
-            ++result;
-        }
-    }
-    return result;
-}
-
-VkResult VmaDefragmentationAlgorithm_Generic::Defragment(
-    VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,
-    VkDeviceSize maxBytesToMove,
-    uint32_t maxAllocationsToMove,
-    VmaDefragmentationFlags flags)
-{
-    if(!m_AllAllocations && m_AllocationCount == 0)
-    {
-        return VK_SUCCESS;
-    }
-
-    const size_t blockCount = m_Blocks.size();
-    for(size_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)
-    {
-        BlockInfo* pBlockInfo = m_Blocks[blockIndex];
-
-        if(m_AllAllocations)
-        {
-            VmaBlockMetadata_Generic* pMetadata = (VmaBlockMetadata_Generic*)pBlockInfo->m_pBlock->m_pMetadata;
-            for(VmaSuballocationList::const_iterator it = pMetadata->m_Suballocations.begin();
-                it != pMetadata->m_Suballocations.end();
-                ++it)
-            {
-                if(it->type != VMA_SUBALLOCATION_TYPE_FREE)
-                {
-                    AllocationInfo allocInfo = AllocationInfo(it->hAllocation, VMA_NULL);
-                    pBlockInfo->m_Allocations.push_back(allocInfo);
-                }
-            }
-        }
-
-        pBlockInfo->CalcHasNonMovableAllocations();
-        
-        // This is a choice based on research.
-        // Option 1:
-        pBlockInfo->SortAllocationsByOffsetDescending();
-        // Option 2:
-        //pBlockInfo->SortAllocationsBySizeDescending();
-    }
-
-    // Sort m_Blocks this time by the main criterium, from most "destination" to most "source" blocks.
-    VMA_SORT(m_Blocks.begin(), m_Blocks.end(), BlockInfoCompareMoveDestination());
-
-    // This is a choice based on research.
-    const uint32_t roundCount = 2;
-
-    // Execute defragmentation rounds (the main part).
-    VkResult result = VK_SUCCESS;
-    for(uint32_t round = 0; (round < roundCount) && (result == VK_SUCCESS); ++round)
-    {
-        result = DefragmentRound(moves, maxBytesToMove, maxAllocationsToMove, !(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL));
-    }
-
-    return result;
-}
-
-bool VmaDefragmentationAlgorithm_Generic::MoveMakesSense(
-        size_t dstBlockIndex, VkDeviceSize dstOffset,
-        size_t srcBlockIndex, VkDeviceSize srcOffset)
-{
-    if(dstBlockIndex < srcBlockIndex)
-    {
-        return true;
-    }
-    if(dstBlockIndex > srcBlockIndex)
-    {
-        return false;
-    }
-    if(dstOffset < srcOffset)
-    {
-        return true;
-    }
-    return false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VmaDefragmentationAlgorithm_Fast
-
-VmaDefragmentationAlgorithm_Fast::VmaDefragmentationAlgorithm_Fast(
-    VmaAllocator hAllocator,
-    VmaBlockVector* pBlockVector,
-    uint32_t currentFrameIndex,
-    bool overlappingMoveSupported) :
-    VmaDefragmentationAlgorithm(hAllocator, pBlockVector, currentFrameIndex),
-    m_OverlappingMoveSupported(overlappingMoveSupported),
-    m_AllocationCount(0),
-    m_AllAllocations(false),
-    m_BytesMoved(0),
-    m_AllocationsMoved(0),
-    m_BlockInfos(VmaStlAllocator<BlockInfo>(hAllocator->GetAllocationCallbacks()))
-{
-    VMA_ASSERT(VMA_DEBUG_MARGIN == 0);
-
-}
-
-VmaDefragmentationAlgorithm_Fast::~VmaDefragmentationAlgorithm_Fast()
-{
-}
-
-VkResult VmaDefragmentationAlgorithm_Fast::Defragment(
-    VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,
-    VkDeviceSize maxBytesToMove,
-    uint32_t maxAllocationsToMove,
-    VmaDefragmentationFlags flags)
-{
-    VMA_ASSERT(m_AllAllocations || m_pBlockVector->CalcAllocationCount() == m_AllocationCount);
-
-    const size_t blockCount = m_pBlockVector->GetBlockCount();
-    if(blockCount == 0 || maxBytesToMove == 0 || maxAllocationsToMove == 0)
-    {
-        return VK_SUCCESS;
-    }
-
-    PreprocessMetadata();
-
-    // Sort blocks in order from most destination.
-
-    m_BlockInfos.resize(blockCount);
-    for(size_t i = 0; i < blockCount; ++i)
-    {
-        m_BlockInfos[i].origBlockIndex = i;
-    }
-
-    VMA_SORT(m_BlockInfos.begin(), m_BlockInfos.end(), [this](const BlockInfo& lhs, const BlockInfo& rhs) -> bool {
-        return m_pBlockVector->GetBlock(lhs.origBlockIndex)->m_pMetadata->GetSumFreeSize() <
-            m_pBlockVector->GetBlock(rhs.origBlockIndex)->m_pMetadata->GetSumFreeSize();
-    });
-
-    // THE MAIN ALGORITHM
-
-    FreeSpaceDatabase freeSpaceDb;
-
-    size_t dstBlockInfoIndex = 0;
-    size_t dstOrigBlockIndex = m_BlockInfos[dstBlockInfoIndex].origBlockIndex;
-    VmaDeviceMemoryBlock* pDstBlock = m_pBlockVector->GetBlock(dstOrigBlockIndex);
-    VmaBlockMetadata_Generic* pDstMetadata = (VmaBlockMetadata_Generic*)pDstBlock->m_pMetadata;
-    VkDeviceSize dstBlockSize = pDstMetadata->GetSize();
-    VkDeviceSize dstOffset = 0;
-
-    bool end = false;
-    for(size_t srcBlockInfoIndex = 0; !end && srcBlockInfoIndex < blockCount; ++srcBlockInfoIndex)
-    {
-        const size_t srcOrigBlockIndex = m_BlockInfos[srcBlockInfoIndex].origBlockIndex;
-        VmaDeviceMemoryBlock* const pSrcBlock = m_pBlockVector->GetBlock(srcOrigBlockIndex);
-        VmaBlockMetadata_Generic* const pSrcMetadata = (VmaBlockMetadata_Generic*)pSrcBlock->m_pMetadata;
-        for(VmaSuballocationList::iterator srcSuballocIt = pSrcMetadata->m_Suballocations.begin();
-            !end && srcSuballocIt != pSrcMetadata->m_Suballocations.end(); )
-        {
-            VmaAllocation_T* const pAlloc = srcSuballocIt->hAllocation;
-            const VkDeviceSize srcAllocAlignment = pAlloc->GetAlignment();
-            const VkDeviceSize srcAllocSize = srcSuballocIt->size;
-            if(m_AllocationsMoved == maxAllocationsToMove ||
-                m_BytesMoved + srcAllocSize > maxBytesToMove)
-            {
-                end = true;
-                break;
-            }
-            const VkDeviceSize srcAllocOffset = srcSuballocIt->offset;
-
-            VmaDefragmentationMove move = {};
-            // Try to place it in one of free spaces from the database.
-            size_t freeSpaceInfoIndex;
-            VkDeviceSize dstAllocOffset;
-            if(freeSpaceDb.Fetch(srcAllocAlignment, srcAllocSize,
-                freeSpaceInfoIndex, dstAllocOffset))
-            {
-                size_t freeSpaceOrigBlockIndex = m_BlockInfos[freeSpaceInfoIndex].origBlockIndex;
-                VmaDeviceMemoryBlock* pFreeSpaceBlock = m_pBlockVector->GetBlock(freeSpaceOrigBlockIndex);
-                VmaBlockMetadata_Generic* pFreeSpaceMetadata = (VmaBlockMetadata_Generic*)pFreeSpaceBlock->m_pMetadata;
-
-                // Same block
-                if(freeSpaceInfoIndex == srcBlockInfoIndex)
-                {
-                    VMA_ASSERT(dstAllocOffset <= srcAllocOffset);
-
-                    // MOVE OPTION 1: Move the allocation inside the same block by decreasing offset.
-
-                    VmaSuballocation suballoc = *srcSuballocIt;
-                    suballoc.offset = dstAllocOffset;
-                    suballoc.hAllocation->ChangeOffset(dstAllocOffset);
-                    m_BytesMoved += srcAllocSize;
-                    ++m_AllocationsMoved;
-                    
-                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;
-                    ++nextSuballocIt;
-                    pSrcMetadata->m_Suballocations.erase(srcSuballocIt);
-                    srcSuballocIt = nextSuballocIt;
-
-                    InsertSuballoc(pFreeSpaceMetadata, suballoc);
-
-                    move.srcBlockIndex = srcOrigBlockIndex;
-                    move.dstBlockIndex = freeSpaceOrigBlockIndex;
-                    move.srcOffset = srcAllocOffset;
-                    move.dstOffset = dstAllocOffset;
-                    move.size = srcAllocSize;
-                    
-                    moves.push_back(move);
-                }
-                // Different block
-                else
-                {
-                    // MOVE OPTION 2: Move the allocation to a different block.
-
-                    VMA_ASSERT(freeSpaceInfoIndex < srcBlockInfoIndex);
-
-                    VmaSuballocation suballoc = *srcSuballocIt;
-                    suballoc.offset = dstAllocOffset;
-                    suballoc.hAllocation->ChangeBlockAllocation(m_hAllocator, pFreeSpaceBlock, dstAllocOffset);
-                    m_BytesMoved += srcAllocSize;
-                    ++m_AllocationsMoved;
-
-                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;
-                    ++nextSuballocIt;
-                    pSrcMetadata->m_Suballocations.erase(srcSuballocIt);
-                    srcSuballocIt = nextSuballocIt;
-
-                    InsertSuballoc(pFreeSpaceMetadata, suballoc);
-
-                    move.srcBlockIndex = srcOrigBlockIndex;
-                    move.dstBlockIndex = freeSpaceOrigBlockIndex;
-                    move.srcOffset = srcAllocOffset;
-                    move.dstOffset = dstAllocOffset;
-                    move.size = srcAllocSize;
-                    
-                    moves.push_back(move);
-                }
-            }
-            else
-            {
-                dstAllocOffset = VmaAlignUp(dstOffset, srcAllocAlignment);
-
-                // If the allocation doesn't fit before the end of dstBlock, forward to next block.
-                while(dstBlockInfoIndex < srcBlockInfoIndex &&
-                    dstAllocOffset + srcAllocSize > dstBlockSize)
-                {
-                    // But before that, register remaining free space at the end of dst block.
-                    freeSpaceDb.Register(dstBlockInfoIndex, dstOffset, dstBlockSize - dstOffset);
-
-                    ++dstBlockInfoIndex;
-                    dstOrigBlockIndex = m_BlockInfos[dstBlockInfoIndex].origBlockIndex;
-                    pDstBlock = m_pBlockVector->GetBlock(dstOrigBlockIndex);
-                    pDstMetadata = (VmaBlockMetadata_Generic*)pDstBlock->m_pMetadata;
-                    dstBlockSize = pDstMetadata->GetSize();
-                    dstOffset = 0;
-                    dstAllocOffset = 0;
-                }
-
-                // Same block
-                if(dstBlockInfoIndex == srcBlockInfoIndex)
-                {
-                    VMA_ASSERT(dstAllocOffset <= srcAllocOffset);
-
-                    const bool overlap = dstAllocOffset + srcAllocSize > srcAllocOffset;
-
-                    bool skipOver = overlap;
-                    if(overlap && m_OverlappingMoveSupported && dstAllocOffset < srcAllocOffset)
-                    {
-                        // If destination and source place overlap, skip if it would move it
-                        // by only < 1/64 of its size.
-                        skipOver = (srcAllocOffset - dstAllocOffset) * 64 < srcAllocSize;
-                    }
-
-                    if(skipOver)
-                    {
-                        freeSpaceDb.Register(dstBlockInfoIndex, dstOffset, srcAllocOffset - dstOffset);
-
-                        dstOffset = srcAllocOffset + srcAllocSize;
-                        ++srcSuballocIt;
-                    }
-                    // MOVE OPTION 1: Move the allocation inside the same block by decreasing offset.
-                    else
-                    {
-                        srcSuballocIt->offset = dstAllocOffset;
-                        srcSuballocIt->hAllocation->ChangeOffset(dstAllocOffset);
-                        dstOffset = dstAllocOffset + srcAllocSize;
-                        m_BytesMoved += srcAllocSize;
-                        ++m_AllocationsMoved;
-                        ++srcSuballocIt;
-                        
-                        move.srcBlockIndex = srcOrigBlockIndex;
-                        move.dstBlockIndex = dstOrigBlockIndex;
-                        move.srcOffset = srcAllocOffset;
-                        move.dstOffset = dstAllocOffset;
-                        move.size = srcAllocSize;
-                        
-                        moves.push_back(move);
-                    }
-                }
-                // Different block
-                else
-                {
-                    // MOVE OPTION 2: Move the allocation to a different block.
-
-                    VMA_ASSERT(dstBlockInfoIndex < srcBlockInfoIndex);
-                    VMA_ASSERT(dstAllocOffset + srcAllocSize <= dstBlockSize);
-
-                    VmaSuballocation suballoc = *srcSuballocIt;
-                    suballoc.offset = dstAllocOffset;
-                    suballoc.hAllocation->ChangeBlockAllocation(m_hAllocator, pDstBlock, dstAllocOffset);
-                    dstOffset = dstAllocOffset + srcAllocSize;
-                    m_BytesMoved += srcAllocSize;
-                    ++m_AllocationsMoved;
-
-                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;
-                    ++nextSuballocIt;
-                    pSrcMetadata->m_Suballocations.erase(srcSuballocIt);
-                    srcSuballocIt = nextSuballocIt;
-
-                    pDstMetadata->m_Suballocations.push_back(suballoc);
-
-                    move.srcBlockIndex = srcOrigBlockIndex;
-                    move.dstBlockIndex = dstOrigBlockIndex;
-                    move.srcOffset = srcAllocOffset;
-                    move.dstOffset = dstAllocOffset;
-                    move.size = srcAllocSize;
-                    
-                    moves.push_back(move);
-                }
-            }
-        }
-    }
-
-    m_BlockInfos.clear();
-    
-    PostprocessMetadata();
-
-    return VK_SUCCESS;
-}
-
-void VmaDefragmentationAlgorithm_Fast::PreprocessMetadata()
-{
-    const size_t blockCount = m_pBlockVector->GetBlockCount();
-    for(size_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)
-    {
-        VmaBlockMetadata_Generic* const pMetadata =
-            (VmaBlockMetadata_Generic*)m_pBlockVector->GetBlock(blockIndex)->m_pMetadata;
-        pMetadata->m_FreeCount = 0;
-        pMetadata->m_SumFreeSize = pMetadata->GetSize();
-        pMetadata->m_FreeSuballocationsBySize.clear();
-        for(VmaSuballocationList::iterator it = pMetadata->m_Suballocations.begin();
-            it != pMetadata->m_Suballocations.end(); )
-        {
-            if(it->type == VMA_SUBALLOCATION_TYPE_FREE)
-            {
-                VmaSuballocationList::iterator nextIt = it;
-                ++nextIt;
-                pMetadata->m_Suballocations.erase(it);
-                it = nextIt;
-            }
-            else
-            {
-                ++it;
-            }
-        }
-    }
-}
-
-void VmaDefragmentationAlgorithm_Fast::PostprocessMetadata()
-{
-    const size_t blockCount = m_pBlockVector->GetBlockCount();
-    for(size_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)
-    {
-        VmaBlockMetadata_Generic* const pMetadata =
-            (VmaBlockMetadata_Generic*)m_pBlockVector->GetBlock(blockIndex)->m_pMetadata;
-        const VkDeviceSize blockSize = pMetadata->GetSize();
-        
-        // No allocations in this block - entire area is free.
-        if(pMetadata->m_Suballocations.empty())
-        {
-            pMetadata->m_FreeCount = 1;
-            //pMetadata->m_SumFreeSize is already set to blockSize.
-            VmaSuballocation suballoc = {
-                0, // offset
-                blockSize, // size
-                VMA_NULL, // hAllocation
-                VMA_SUBALLOCATION_TYPE_FREE };
-            pMetadata->m_Suballocations.push_back(suballoc);
-            pMetadata->RegisterFreeSuballocation(pMetadata->m_Suballocations.begin());
-        }
-        // There are some allocations in this block.
-        else
-        {
-            VkDeviceSize offset = 0;
-            VmaSuballocationList::iterator it;
-            for(it = pMetadata->m_Suballocations.begin();
-                it != pMetadata->m_Suballocations.end();
-                ++it)
-            {
-                VMA_ASSERT(it->type != VMA_SUBALLOCATION_TYPE_FREE);
-                VMA_ASSERT(it->offset >= offset);
-
-                // Need to insert preceding free space.
-                if(it->offset > offset)
-                {
-                    ++pMetadata->m_FreeCount;
-                    const VkDeviceSize freeSize = it->offset - offset;
-                    VmaSuballocation suballoc = {
-                        offset, // offset
-                        freeSize, // size
-                        VMA_NULL, // hAllocation
-                        VMA_SUBALLOCATION_TYPE_FREE };
-                    VmaSuballocationList::iterator precedingFreeIt = pMetadata->m_Suballocations.insert(it, suballoc);
-                    if(freeSize >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)
-                    {
-                        pMetadata->m_FreeSuballocationsBySize.push_back(precedingFreeIt);
-                    }
-                }
-
-                pMetadata->m_SumFreeSize -= it->size;
-                offset = it->offset + it->size;
-            }
-
-            // Need to insert trailing free space.
-            if(offset < blockSize)
-            {
-                ++pMetadata->m_FreeCount;
-                const VkDeviceSize freeSize = blockSize - offset;
-                VmaSuballocation suballoc = {
-                    offset, // offset
-                    freeSize, // size
-                    VMA_NULL, // hAllocation
-                    VMA_SUBALLOCATION_TYPE_FREE };
-                VMA_ASSERT(it == pMetadata->m_Suballocations.end());
-                VmaSuballocationList::iterator trailingFreeIt = pMetadata->m_Suballocations.insert(it, suballoc);
-                if(freeSize > VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)
-                {
-                    pMetadata->m_FreeSuballocationsBySize.push_back(trailingFreeIt);
-                }
-            }
-
-            VMA_SORT(
-                pMetadata->m_FreeSuballocationsBySize.begin(),
-                pMetadata->m_FreeSuballocationsBySize.end(),
-                VmaSuballocationItemSizeLess());
-        }
-
-        VMA_HEAVY_ASSERT(pMetadata->Validate());
-    }
-}
-
-void VmaDefragmentationAlgorithm_Fast::InsertSuballoc(VmaBlockMetadata_Generic* pMetadata, const VmaSuballocation& suballoc)
-{
-    // TODO: Optimize somehow. Remember iterator instead of searching for it linearly.
-    VmaSuballocationList::iterator it = pMetadata->m_Suballocations.begin();
-    while(it != pMetadata->m_Suballocations.end())
-    {
-        if(it->offset < suballoc.offset)
-        {
-            ++it;
-        }
-    }
-    pMetadata->m_Suballocations.insert(it, suballoc);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VmaBlockVectorDefragmentationContext
-
-VmaBlockVectorDefragmentationContext::VmaBlockVectorDefragmentationContext(
-    VmaAllocator hAllocator,
-    VmaPool hCustomPool,
-    VmaBlockVector* pBlockVector,
-    uint32_t currFrameIndex) :
-    res(VK_SUCCESS),
-    mutexLocked(false),
-    blockContexts(VmaStlAllocator<VmaBlockDefragmentationContext>(hAllocator->GetAllocationCallbacks())),
-    defragmentationMoves(VmaStlAllocator<VmaDefragmentationMove>(hAllocator->GetAllocationCallbacks())),
-    defragmentationMovesProcessed(0),
-    defragmentationMovesCommitted(0),
-    hasDefragmentationPlan(0),
-    m_hAllocator(hAllocator),
-    m_hCustomPool(hCustomPool),
-    m_pBlockVector(pBlockVector),
-    m_CurrFrameIndex(currFrameIndex),
-    m_pAlgorithm(VMA_NULL),
-    m_Allocations(VmaStlAllocator<AllocInfo>(hAllocator->GetAllocationCallbacks())),
-    m_AllAllocations(false)
-{
-}
-
-VmaBlockVectorDefragmentationContext::~VmaBlockVectorDefragmentationContext()
-{
-    vma_delete(m_hAllocator, m_pAlgorithm);
-}
-
-void VmaBlockVectorDefragmentationContext::AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged)
-{
-    AllocInfo info = { hAlloc, pChanged };
-    m_Allocations.push_back(info);
-}
-
-void VmaBlockVectorDefragmentationContext::Begin(bool overlappingMoveSupported, VmaDefragmentationFlags flags)
-{
-    const bool allAllocations = m_AllAllocations ||
-        m_Allocations.size() == m_pBlockVector->CalcAllocationCount();
-
-    /********************************
-    HERE IS THE CHOICE OF DEFRAGMENTATION ALGORITHM.
-    ********************************/
-
-    /*
-    Fast algorithm is supported only when certain criteria are met:
-    - VMA_DEBUG_MARGIN is 0.
-    - All allocations in this block vector are moveable.
-    - There is no possibility of image/buffer granularity conflict.
-    - The defragmentation is not incremental
-    */
-    if(VMA_DEBUG_MARGIN == 0 &&
-        allAllocations &&
-        !m_pBlockVector->IsBufferImageGranularityConflictPossible() &&
-        !(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL))
-    {
-        m_pAlgorithm = vma_new(m_hAllocator, VmaDefragmentationAlgorithm_Fast)(
-            m_hAllocator, m_pBlockVector, m_CurrFrameIndex, overlappingMoveSupported);
-    }
-    else
-    {
-        m_pAlgorithm = vma_new(m_hAllocator, VmaDefragmentationAlgorithm_Generic)(
-            m_hAllocator, m_pBlockVector, m_CurrFrameIndex, overlappingMoveSupported);
-    }
-
-    if(allAllocations)
-    {
-        m_pAlgorithm->AddAll();
-    }
-    else
-    {
-        for(size_t i = 0, count = m_Allocations.size(); i < count; ++i)
-        {
-            m_pAlgorithm->AddAllocation(m_Allocations[i].hAlloc, m_Allocations[i].pChanged);
-        }
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VmaDefragmentationContext
-
-VmaDefragmentationContext_T::VmaDefragmentationContext_T(
-    VmaAllocator hAllocator,
-    uint32_t currFrameIndex,
-    uint32_t flags,
-    VmaDefragmentationStats* pStats) :
-    m_hAllocator(hAllocator),
-    m_CurrFrameIndex(currFrameIndex),
-    m_Flags(flags),
-    m_pStats(pStats),
-    m_CustomPoolContexts(VmaStlAllocator<VmaBlockVectorDefragmentationContext*>(hAllocator->GetAllocationCallbacks()))
-{
-    memset(m_DefaultPoolContexts, 0, sizeof(m_DefaultPoolContexts));
-}
-
-VmaDefragmentationContext_T::~VmaDefragmentationContext_T()
-{
-    for(size_t i = m_CustomPoolContexts.size(); i--; )
-    {
-        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_CustomPoolContexts[i];
-        pBlockVectorCtx->GetBlockVector()->DefragmentationEnd(pBlockVectorCtx, m_Flags, m_pStats);
-        vma_delete(m_hAllocator, pBlockVectorCtx);
-    }
-    for(size_t i = m_hAllocator->m_MemProps.memoryTypeCount; i--; )
-    {
-        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_DefaultPoolContexts[i];
-        if(pBlockVectorCtx)
-        {
-            pBlockVectorCtx->GetBlockVector()->DefragmentationEnd(pBlockVectorCtx, m_Flags, m_pStats);
-            vma_delete(m_hAllocator, pBlockVectorCtx);
-        }
-    }
-}
-
-void VmaDefragmentationContext_T::AddPools(uint32_t poolCount, const VmaPool* pPools)
-{
-    for(uint32_t poolIndex = 0; poolIndex < poolCount; ++poolIndex)
-    {
-        VmaPool pool = pPools[poolIndex];
-        VMA_ASSERT(pool);
-        // Pools with algorithm other than default are not defragmented.
-        if(pool->m_BlockVector.GetAlgorithm() == 0)
-        {
-            VmaBlockVectorDefragmentationContext* pBlockVectorDefragCtx = VMA_NULL;
-            
-            for(size_t i = m_CustomPoolContexts.size(); i--; )
-            {
-                if(m_CustomPoolContexts[i]->GetCustomPool() == pool)
-                {
-                    pBlockVectorDefragCtx = m_CustomPoolContexts[i];
-                    break;
-                }
-            }
-            
-            if(!pBlockVectorDefragCtx)
-            {
-                pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(
-                    m_hAllocator,
-                    pool,
-                    &pool->m_BlockVector,
-                    m_CurrFrameIndex);
-                m_CustomPoolContexts.push_back(pBlockVectorDefragCtx);
-            }
-
-            pBlockVectorDefragCtx->AddAll();
-        }
-    }
-}
-
-void VmaDefragmentationContext_T::AddAllocations(
-    uint32_t allocationCount,
-    const VmaAllocation* pAllocations,
-    VkBool32* pAllocationsChanged)
-{
-    // Dispatch pAllocations among defragmentators. Create them when necessary.
-    for(uint32_t allocIndex = 0; allocIndex < allocationCount; ++allocIndex)
-    {
-        const VmaAllocation hAlloc = pAllocations[allocIndex];
-        VMA_ASSERT(hAlloc);
-        // DedicatedAlloc cannot be defragmented.
-        if((hAlloc->GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK) &&
-            // Lost allocation cannot be defragmented.
-            (hAlloc->GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST))
-        {
-            VmaBlockVectorDefragmentationContext* pBlockVectorDefragCtx = VMA_NULL;
-
-            const VmaPool hAllocPool = hAlloc->GetBlock()->GetParentPool();
-            // This allocation belongs to custom pool.
-            if(hAllocPool != VK_NULL_HANDLE)
-            {
-                // Pools with algorithm other than default are not defragmented.
-                if(hAllocPool->m_BlockVector.GetAlgorithm() == 0)
-                {
-                    for(size_t i = m_CustomPoolContexts.size(); i--; )
-                    {
-                        if(m_CustomPoolContexts[i]->GetCustomPool() == hAllocPool)
-                        {
-                            pBlockVectorDefragCtx = m_CustomPoolContexts[i];
-                            break;
-                        }
-                    }
-                    if(!pBlockVectorDefragCtx)
-                    {
-                        pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(
-                            m_hAllocator,
-                            hAllocPool,
-                            &hAllocPool->m_BlockVector,
-                            m_CurrFrameIndex);
-                        m_CustomPoolContexts.push_back(pBlockVectorDefragCtx);
-                    }
-                }
-            }
-            // This allocation belongs to default pool.
-            else
-            {
-                const uint32_t memTypeIndex = hAlloc->GetMemoryTypeIndex();
-                pBlockVectorDefragCtx = m_DefaultPoolContexts[memTypeIndex];
-                if(!pBlockVectorDefragCtx)
-                {
-                    pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(
-                        m_hAllocator,
-                        VMA_NULL, // hCustomPool
-                        m_hAllocator->m_pBlockVectors[memTypeIndex],
-                        m_CurrFrameIndex);
-                    m_DefaultPoolContexts[memTypeIndex] = pBlockVectorDefragCtx;
-                }
-            }
-
-            if(pBlockVectorDefragCtx)
-            {
-                VkBool32* const pChanged = (pAllocationsChanged != VMA_NULL) ?
-                    &pAllocationsChanged[allocIndex] : VMA_NULL;
-                pBlockVectorDefragCtx->AddAllocation(hAlloc, pChanged);
-            }
-        }
-    }
-}
-
-VkResult VmaDefragmentationContext_T::Defragment(
-    VkDeviceSize maxCpuBytesToMove, uint32_t maxCpuAllocationsToMove,
-    VkDeviceSize maxGpuBytesToMove, uint32_t maxGpuAllocationsToMove,
-    VkCommandBuffer commandBuffer, VmaDefragmentationStats* pStats, VmaDefragmentationFlags flags)
-{
-    if(pStats)
-    {
-        memset(pStats, 0, sizeof(VmaDefragmentationStats));
-    }
-
-    if(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL)
-    {
-        // For incremental defragmetnations, we just earmark how much we can move
-        // The real meat is in the defragmentation steps
-        m_MaxCpuBytesToMove = maxCpuBytesToMove;
-        m_MaxCpuAllocationsToMove = maxCpuAllocationsToMove;
-
-        m_MaxGpuBytesToMove = maxGpuBytesToMove;
-        m_MaxGpuAllocationsToMove = maxGpuAllocationsToMove;
-
-        if(m_MaxCpuBytesToMove == 0 && m_MaxCpuAllocationsToMove == 0 &&
-            m_MaxGpuBytesToMove == 0 && m_MaxGpuAllocationsToMove == 0)
-            return VK_SUCCESS;
-
-        return VK_NOT_READY;
-    }
-
-    if(commandBuffer == VK_NULL_HANDLE)
-    {
-        maxGpuBytesToMove = 0;
-        maxGpuAllocationsToMove = 0;
-    }
-
-    VkResult res = VK_SUCCESS;
-
-    // Process default pools.
-    for(uint32_t memTypeIndex = 0;
-        memTypeIndex < m_hAllocator->GetMemoryTypeCount() && res >= VK_SUCCESS;
-        ++memTypeIndex)
-    {
-        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];
-        if(pBlockVectorCtx)
-        {
-            VMA_ASSERT(pBlockVectorCtx->GetBlockVector());
-            pBlockVectorCtx->GetBlockVector()->Defragment(
-                pBlockVectorCtx,
-                pStats, flags,
-                maxCpuBytesToMove, maxCpuAllocationsToMove,
-                maxGpuBytesToMove, maxGpuAllocationsToMove,
-                commandBuffer);
-            if(pBlockVectorCtx->res != VK_SUCCESS)
-            {
-                res = pBlockVectorCtx->res;
-            }
-        }
-    }
-
-    // Process custom pools.
-    for(size_t customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();
-        customCtxIndex < customCtxCount && res >= VK_SUCCESS;
-        ++customCtxIndex)
-    {
-        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];
-        VMA_ASSERT(pBlockVectorCtx && pBlockVectorCtx->GetBlockVector());
-        pBlockVectorCtx->GetBlockVector()->Defragment(
-            pBlockVectorCtx,
-            pStats, flags,
-            maxCpuBytesToMove, maxCpuAllocationsToMove,
-            maxGpuBytesToMove, maxGpuAllocationsToMove,
-            commandBuffer);
-        if(pBlockVectorCtx->res != VK_SUCCESS)
-        {
-            res = pBlockVectorCtx->res;
-        }
-    }
-
-    return res;
-}
-
-VkResult VmaDefragmentationContext_T::DefragmentPassBegin(VmaDefragmentationPassInfo* pInfo)
-{
-    VmaDefragmentationPassMoveInfo* pCurrentMove = pInfo->pMoves;
-    uint32_t movesLeft = pInfo->moveCount;
-
-    // Process default pools.
-    for(uint32_t memTypeIndex = 0;
-        memTypeIndex < m_hAllocator->GetMemoryTypeCount();
-        ++memTypeIndex)
-    {
-        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];
-        if(pBlockVectorCtx)
-        {
-            VMA_ASSERT(pBlockVectorCtx->GetBlockVector());
-
-            if(!pBlockVectorCtx->hasDefragmentationPlan)
-            {
-                pBlockVectorCtx->GetBlockVector()->Defragment(
-                    pBlockVectorCtx,
-                    m_pStats, m_Flags,
-                    m_MaxCpuBytesToMove, m_MaxCpuAllocationsToMove,
-                    m_MaxGpuBytesToMove, m_MaxGpuAllocationsToMove,
-                    VK_NULL_HANDLE);
-
-                if(pBlockVectorCtx->res < VK_SUCCESS)
-                    continue;
-
-                pBlockVectorCtx->hasDefragmentationPlan = true;
-            }
-
-            const uint32_t processed = pBlockVectorCtx->GetBlockVector()->ProcessDefragmentations(
-                pBlockVectorCtx,
-                pCurrentMove, movesLeft);
-
-            movesLeft -= processed;
-            pCurrentMove += processed;
-        }
-    }
-
-    // Process custom pools.
-    for(size_t customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();
-        customCtxIndex < customCtxCount;
-        ++customCtxIndex)
-    {
-        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];
-        VMA_ASSERT(pBlockVectorCtx && pBlockVectorCtx->GetBlockVector());
-
-        if(!pBlockVectorCtx->hasDefragmentationPlan)
-        {
-            pBlockVectorCtx->GetBlockVector()->Defragment(
-                pBlockVectorCtx,
-                m_pStats, m_Flags,
-                m_MaxCpuBytesToMove, m_MaxCpuAllocationsToMove,
-                m_MaxGpuBytesToMove, m_MaxGpuAllocationsToMove,
-                VK_NULL_HANDLE);
-
-            if(pBlockVectorCtx->res < VK_SUCCESS)
-                continue;
-
-            pBlockVectorCtx->hasDefragmentationPlan = true;
-        }
-
-        const uint32_t processed = pBlockVectorCtx->GetBlockVector()->ProcessDefragmentations(
-            pBlockVectorCtx,
-            pCurrentMove, movesLeft);
-
-        movesLeft -= processed;
-        pCurrentMove += processed;
-    }
-
-    pInfo->moveCount = pInfo->moveCount - movesLeft;
-
-    return VK_SUCCESS;
-}
-VkResult VmaDefragmentationContext_T::DefragmentPassEnd()
-{
-    VkResult res = VK_SUCCESS;
-
-    // Process default pools.
-    for(uint32_t memTypeIndex = 0;
-        memTypeIndex < m_hAllocator->GetMemoryTypeCount();
-        ++memTypeIndex)
-    {
-        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];
-        if(pBlockVectorCtx)
-        {
-            VMA_ASSERT(pBlockVectorCtx->GetBlockVector());
-
-            if(!pBlockVectorCtx->hasDefragmentationPlan)
-            {
-                res = VK_NOT_READY;
-                continue;
-            }
-
-            pBlockVectorCtx->GetBlockVector()->CommitDefragmentations(
-                pBlockVectorCtx, m_pStats);
-
-            if(pBlockVectorCtx->defragmentationMoves.size() != pBlockVectorCtx->defragmentationMovesCommitted)
-                res = VK_NOT_READY;
-        }
-    }
-
-    // Process custom pools.
-    for(size_t customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();
-        customCtxIndex < customCtxCount;
-        ++customCtxIndex)
-    {
-        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];
-        VMA_ASSERT(pBlockVectorCtx && pBlockVectorCtx->GetBlockVector());
-
-        if(!pBlockVectorCtx->hasDefragmentationPlan)
-        {
-            res = VK_NOT_READY;
-            continue;
-        }
-
-        pBlockVectorCtx->GetBlockVector()->CommitDefragmentations(
-            pBlockVectorCtx, m_pStats);
-
-        if(pBlockVectorCtx->defragmentationMoves.size() != pBlockVectorCtx->defragmentationMovesCommitted)
-            res = VK_NOT_READY;
-    }
-
-    return res;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VmaRecorder
-
-#if VMA_RECORDING_ENABLED
-
-VmaRecorder::VmaRecorder() :
-    m_UseMutex(true),
-    m_Flags(0),
-    m_File(VMA_NULL),
-    m_Freq(INT64_MAX),
-    m_StartCounter(INT64_MAX)
-{
-}
-
-VkResult VmaRecorder::Init(const VmaRecordSettings& settings, bool useMutex)
-{
-    m_UseMutex = useMutex;
-    m_Flags = settings.flags;
-
-    QueryPerformanceFrequency((LARGE_INTEGER*)&m_Freq);
-    QueryPerformanceCounter((LARGE_INTEGER*)&m_StartCounter);
-
-    // Open file for writing.
-    errno_t err = fopen_s(&m_File, settings.pFilePath, "wb");
-    if(err != 0)
-    {
-        return VK_ERROR_INITIALIZATION_FAILED;
-    }
-
-    // Write header.
-    fprintf(m_File, "%s\n", "Vulkan Memory Allocator,Calls recording");
-    fprintf(m_File, "%s\n", "1,8");
-
-    return VK_SUCCESS;
-}
-
-VmaRecorder::~VmaRecorder()
-{
-    if(m_File != VMA_NULL)
-    {
-        fclose(m_File);
-    }
-}
-
-void VmaRecorder::RecordCreateAllocator(uint32_t frameIndex)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaCreateAllocator\n", callParams.threadId, callParams.time, frameIndex);
-    Flush();
-}
-
-void VmaRecorder::RecordDestroyAllocator(uint32_t frameIndex)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaDestroyAllocator\n", callParams.threadId, callParams.time, frameIndex);
-    Flush();
-}
-
-void VmaRecorder::RecordCreatePool(uint32_t frameIndex, const VmaPoolCreateInfo& createInfo, VmaPool pool)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaCreatePool,%u,%u,%llu,%llu,%llu,%u,%p\n", callParams.threadId, callParams.time, frameIndex,
-        createInfo.memoryTypeIndex,
-        createInfo.flags,
-        createInfo.blockSize,
-        (uint64_t)createInfo.minBlockCount,
-        (uint64_t)createInfo.maxBlockCount,
-        createInfo.frameInUseCount,
-        pool);
-    Flush();
-}
-
-void VmaRecorder::RecordDestroyPool(uint32_t frameIndex, VmaPool pool)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaDestroyPool,%p\n", callParams.threadId, callParams.time, frameIndex,
-        pool);
-    Flush();
-}
-
-void VmaRecorder::RecordAllocateMemory(uint32_t frameIndex,
-        const VkMemoryRequirements& vkMemReq,
-        const VmaAllocationCreateInfo& createInfo,
-        VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    UserDataString userDataStr(createInfo.flags, createInfo.pUserData);
-    fprintf(m_File, "%u,%.3f,%u,vmaAllocateMemory,%llu,%llu,%u,%u,%u,%u,%u,%u,%p,%p,%s\n", callParams.threadId, callParams.time, frameIndex,
-        vkMemReq.size,
-        vkMemReq.alignment,
-        vkMemReq.memoryTypeBits,
-        createInfo.flags,
-        createInfo.usage,
-        createInfo.requiredFlags,
-        createInfo.preferredFlags,
-        createInfo.memoryTypeBits,
-        createInfo.pool,
-        allocation,
-        userDataStr.GetString());
-    Flush();
-}
-
-void VmaRecorder::RecordAllocateMemoryPages(uint32_t frameIndex,
-    const VkMemoryRequirements& vkMemReq,
-    const VmaAllocationCreateInfo& createInfo,
-    uint64_t allocationCount,
-    const VmaAllocation* pAllocations)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    UserDataString userDataStr(createInfo.flags, createInfo.pUserData);
-    fprintf(m_File, "%u,%.3f,%u,vmaAllocateMemoryPages,%llu,%llu,%u,%u,%u,%u,%u,%u,%p,", callParams.threadId, callParams.time, frameIndex,
-        vkMemReq.size,
-        vkMemReq.alignment,
-        vkMemReq.memoryTypeBits,
-        createInfo.flags,
-        createInfo.usage,
-        createInfo.requiredFlags,
-        createInfo.preferredFlags,
-        createInfo.memoryTypeBits,
-        createInfo.pool);
-    PrintPointerList(allocationCount, pAllocations);
-    fprintf(m_File, ",%s\n", userDataStr.GetString());
-    Flush();
-}
-
-void VmaRecorder::RecordAllocateMemoryForBuffer(uint32_t frameIndex,
-    const VkMemoryRequirements& vkMemReq,
-    bool requiresDedicatedAllocation,
-    bool prefersDedicatedAllocation,
-    const VmaAllocationCreateInfo& createInfo,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    UserDataString userDataStr(createInfo.flags, createInfo.pUserData);
-    fprintf(m_File, "%u,%.3f,%u,vmaAllocateMemoryForBuffer,%llu,%llu,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n", callParams.threadId, callParams.time, frameIndex,
-        vkMemReq.size,
-        vkMemReq.alignment,
-        vkMemReq.memoryTypeBits,
-        requiresDedicatedAllocation ? 1 : 0,
-        prefersDedicatedAllocation ? 1 : 0,
-        createInfo.flags,
-        createInfo.usage,
-        createInfo.requiredFlags,
-        createInfo.preferredFlags,
-        createInfo.memoryTypeBits,
-        createInfo.pool,
-        allocation,
-        userDataStr.GetString());
-    Flush();
-}
-
-void VmaRecorder::RecordAllocateMemoryForImage(uint32_t frameIndex,
-    const VkMemoryRequirements& vkMemReq,
-    bool requiresDedicatedAllocation,
-    bool prefersDedicatedAllocation,
-    const VmaAllocationCreateInfo& createInfo,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    UserDataString userDataStr(createInfo.flags, createInfo.pUserData);
-    fprintf(m_File, "%u,%.3f,%u,vmaAllocateMemoryForImage,%llu,%llu,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n", callParams.threadId, callParams.time, frameIndex,
-        vkMemReq.size,
-        vkMemReq.alignment,
-        vkMemReq.memoryTypeBits,
-        requiresDedicatedAllocation ? 1 : 0,
-        prefersDedicatedAllocation ? 1 : 0,
-        createInfo.flags,
-        createInfo.usage,
-        createInfo.requiredFlags,
-        createInfo.preferredFlags,
-        createInfo.memoryTypeBits,
-        createInfo.pool,
-        allocation,
-        userDataStr.GetString());
-    Flush();
-}
-
-void VmaRecorder::RecordFreeMemory(uint32_t frameIndex,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaFreeMemory,%p\n", callParams.threadId, callParams.time, frameIndex,
-        allocation);
-    Flush();
-}
-
-void VmaRecorder::RecordFreeMemoryPages(uint32_t frameIndex,
-    uint64_t allocationCount,
-    const VmaAllocation* pAllocations)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaFreeMemoryPages,", callParams.threadId, callParams.time, frameIndex);
-    PrintPointerList(allocationCount, pAllocations);
-    fprintf(m_File, "\n");
-    Flush();
-}
-
-void VmaRecorder::RecordSetAllocationUserData(uint32_t frameIndex,
-    VmaAllocation allocation,
-    const void* pUserData)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    UserDataString userDataStr(
-        allocation->IsUserDataString() ? VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT : 0,
-        pUserData);
-    fprintf(m_File, "%u,%.3f,%u,vmaSetAllocationUserData,%p,%s\n", callParams.threadId, callParams.time, frameIndex,
-        allocation,
-        userDataStr.GetString());
-    Flush();
-}
-
-void VmaRecorder::RecordCreateLostAllocation(uint32_t frameIndex,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaCreateLostAllocation,%p\n", callParams.threadId, callParams.time, frameIndex,
-        allocation);
-    Flush();
-}
-
-void VmaRecorder::RecordMapMemory(uint32_t frameIndex,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaMapMemory,%p\n", callParams.threadId, callParams.time, frameIndex,
-        allocation);
-    Flush();
-}
-
-void VmaRecorder::RecordUnmapMemory(uint32_t frameIndex,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaUnmapMemory,%p\n", callParams.threadId, callParams.time, frameIndex,
-        allocation);
-    Flush();
-}
-
-void VmaRecorder::RecordFlushAllocation(uint32_t frameIndex,
-    VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaFlushAllocation,%p,%llu,%llu\n", callParams.threadId, callParams.time, frameIndex,
-        allocation,
-        offset,
-        size);
-    Flush();
-}
-
-void VmaRecorder::RecordInvalidateAllocation(uint32_t frameIndex,
-    VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaInvalidateAllocation,%p,%llu,%llu\n", callParams.threadId, callParams.time, frameIndex,
-        allocation,
-        offset,
-        size);
-    Flush();
-}
-
-void VmaRecorder::RecordCreateBuffer(uint32_t frameIndex,
-    const VkBufferCreateInfo& bufCreateInfo,
-    const VmaAllocationCreateInfo& allocCreateInfo,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    UserDataString userDataStr(allocCreateInfo.flags, allocCreateInfo.pUserData);
-    fprintf(m_File, "%u,%.3f,%u,vmaCreateBuffer,%u,%llu,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n", callParams.threadId, callParams.time, frameIndex,
-        bufCreateInfo.flags,
-        bufCreateInfo.size,
-        bufCreateInfo.usage,
-        bufCreateInfo.sharingMode,
-        allocCreateInfo.flags,
-        allocCreateInfo.usage,
-        allocCreateInfo.requiredFlags,
-        allocCreateInfo.preferredFlags,
-        allocCreateInfo.memoryTypeBits,
-        allocCreateInfo.pool,
-        allocation,
-        userDataStr.GetString());
-    Flush();
-}
-
-void VmaRecorder::RecordCreateImage(uint32_t frameIndex,
-    const VkImageCreateInfo& imageCreateInfo,
-    const VmaAllocationCreateInfo& allocCreateInfo,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    UserDataString userDataStr(allocCreateInfo.flags, allocCreateInfo.pUserData);
-    fprintf(m_File, "%u,%.3f,%u,vmaCreateImage,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n", callParams.threadId, callParams.time, frameIndex,
-        imageCreateInfo.flags,
-        imageCreateInfo.imageType,
-        imageCreateInfo.format,
-        imageCreateInfo.extent.width,
-        imageCreateInfo.extent.height,
-        imageCreateInfo.extent.depth,
-        imageCreateInfo.mipLevels,
-        imageCreateInfo.arrayLayers,
-        imageCreateInfo.samples,
-        imageCreateInfo.tiling,
-        imageCreateInfo.usage,
-        imageCreateInfo.sharingMode,
-        imageCreateInfo.initialLayout,
-        allocCreateInfo.flags,
-        allocCreateInfo.usage,
-        allocCreateInfo.requiredFlags,
-        allocCreateInfo.preferredFlags,
-        allocCreateInfo.memoryTypeBits,
-        allocCreateInfo.pool,
-        allocation,
-        userDataStr.GetString());
-    Flush();
-}
-
-void VmaRecorder::RecordDestroyBuffer(uint32_t frameIndex,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaDestroyBuffer,%p\n", callParams.threadId, callParams.time, frameIndex,
-        allocation);
-    Flush();
-}
-
-void VmaRecorder::RecordDestroyImage(uint32_t frameIndex,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaDestroyImage,%p\n", callParams.threadId, callParams.time, frameIndex,
-        allocation);
-    Flush();
-}
-
-void VmaRecorder::RecordTouchAllocation(uint32_t frameIndex,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaTouchAllocation,%p\n", callParams.threadId, callParams.time, frameIndex,
-        allocation);
-    Flush();
-}
-
-void VmaRecorder::RecordGetAllocationInfo(uint32_t frameIndex,
-    VmaAllocation allocation)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaGetAllocationInfo,%p\n", callParams.threadId, callParams.time, frameIndex,
-        allocation);
-    Flush();
-}
-
-void VmaRecorder::RecordMakePoolAllocationsLost(uint32_t frameIndex,
-    VmaPool pool)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaMakePoolAllocationsLost,%p\n", callParams.threadId, callParams.time, frameIndex,
-        pool);
-    Flush();
-}
-
-void VmaRecorder::RecordDefragmentationBegin(uint32_t frameIndex,
-    const VmaDefragmentationInfo2& info,
-    VmaDefragmentationContext ctx)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaDefragmentationBegin,%u,", callParams.threadId, callParams.time, frameIndex,
-        info.flags);
-    PrintPointerList(info.allocationCount, info.pAllocations);
-    fprintf(m_File, ",");
-    PrintPointerList(info.poolCount, info.pPools);
-    fprintf(m_File, ",%llu,%u,%llu,%u,%p,%p\n",
-        info.maxCpuBytesToMove,
-        info.maxCpuAllocationsToMove,
-        info.maxGpuBytesToMove,
-        info.maxGpuAllocationsToMove,
-        info.commandBuffer,
-        ctx);
-    Flush();
-}
-
-void VmaRecorder::RecordDefragmentationEnd(uint32_t frameIndex,
-    VmaDefragmentationContext ctx)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaDefragmentationEnd,%p\n", callParams.threadId, callParams.time, frameIndex,
-        ctx);
-    Flush();
-}
-
-void VmaRecorder::RecordSetPoolName(uint32_t frameIndex,
-    VmaPool pool,
-    const char* name)
-{
-    CallParams callParams;
-    GetBasicParams(callParams);
-
-    VmaMutexLock lock(m_FileMutex, m_UseMutex);
-    fprintf(m_File, "%u,%.3f,%u,vmaSetPoolName,%p,%s\n", callParams.threadId, callParams.time, frameIndex,
-        pool, name != VMA_NULL ? name : "");
-    Flush();
-}
-
-VmaRecorder::UserDataString::UserDataString(VmaAllocationCreateFlags allocFlags, const void* pUserData)
-{
-    if(pUserData != VMA_NULL)
-    {
-        if((allocFlags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0)
-        {
-            m_Str = (const char*)pUserData;
-        }
-        else
-        {
-            sprintf_s(m_PtrStr, "%p", pUserData);
-            m_Str = m_PtrStr;
-        }
-    }
-    else
-    {
-        m_Str = "";
-    }
-}
-
-void VmaRecorder::WriteConfiguration(
-    const VkPhysicalDeviceProperties& devProps,
-    const VkPhysicalDeviceMemoryProperties& memProps,
-    uint32_t vulkanApiVersion,
-    bool dedicatedAllocationExtensionEnabled,
-    bool bindMemory2ExtensionEnabled,
-    bool memoryBudgetExtensionEnabled,
-    bool deviceCoherentMemoryExtensionEnabled)
-{
-    fprintf(m_File, "Config,Begin\n");
-
-    fprintf(m_File, "VulkanApiVersion,%u,%u\n", VK_VERSION_MAJOR(vulkanApiVersion), VK_VERSION_MINOR(vulkanApiVersion));
-
-    fprintf(m_File, "PhysicalDevice,apiVersion,%u\n", devProps.apiVersion);
-    fprintf(m_File, "PhysicalDevice,driverVersion,%u\n", devProps.driverVersion);
-    fprintf(m_File, "PhysicalDevice,vendorID,%u\n", devProps.vendorID);
-    fprintf(m_File, "PhysicalDevice,deviceID,%u\n", devProps.deviceID);
-    fprintf(m_File, "PhysicalDevice,deviceType,%u\n", devProps.deviceType);
-    fprintf(m_File, "PhysicalDevice,deviceName,%s\n", devProps.deviceName);
-
-    fprintf(m_File, "PhysicalDeviceLimits,maxMemoryAllocationCount,%u\n", devProps.limits.maxMemoryAllocationCount);
-    fprintf(m_File, "PhysicalDeviceLimits,bufferImageGranularity,%llu\n", devProps.limits.bufferImageGranularity);
-    fprintf(m_File, "PhysicalDeviceLimits,nonCoherentAtomSize,%llu\n", devProps.limits.nonCoherentAtomSize);
-
-    fprintf(m_File, "PhysicalDeviceMemory,HeapCount,%u\n", memProps.memoryHeapCount);
-    for(uint32_t i = 0; i < memProps.memoryHeapCount; ++i)
-    {
-        fprintf(m_File, "PhysicalDeviceMemory,Heap,%u,size,%llu\n", i, memProps.memoryHeaps[i].size);
-        fprintf(m_File, "PhysicalDeviceMemory,Heap,%u,flags,%u\n", i, memProps.memoryHeaps[i].flags);
-    }
-    fprintf(m_File, "PhysicalDeviceMemory,TypeCount,%u\n", memProps.memoryTypeCount);
-    for(uint32_t i = 0; i < memProps.memoryTypeCount; ++i)
-    {
-        fprintf(m_File, "PhysicalDeviceMemory,Type,%u,heapIndex,%u\n", i, memProps.memoryTypes[i].heapIndex);
-        fprintf(m_File, "PhysicalDeviceMemory,Type,%u,propertyFlags,%u\n", i, memProps.memoryTypes[i].propertyFlags);
-    }
-
-    fprintf(m_File, "Extension,VK_KHR_dedicated_allocation,%u\n", dedicatedAllocationExtensionEnabled ? 1 : 0);
-    fprintf(m_File, "Extension,VK_KHR_bind_memory2,%u\n", bindMemory2ExtensionEnabled ? 1 : 0);
-    fprintf(m_File, "Extension,VK_EXT_memory_budget,%u\n", memoryBudgetExtensionEnabled ? 1 : 0);
-    fprintf(m_File, "Extension,VK_AMD_device_coherent_memory,%u\n", deviceCoherentMemoryExtensionEnabled ? 1 : 0);
-
-    fprintf(m_File, "Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,%u\n", VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ? 1 : 0);
-    fprintf(m_File, "Macro,VMA_DEBUG_ALIGNMENT,%llu\n", (VkDeviceSize)VMA_DEBUG_ALIGNMENT);
-    fprintf(m_File, "Macro,VMA_DEBUG_MARGIN,%llu\n", (VkDeviceSize)VMA_DEBUG_MARGIN);
-    fprintf(m_File, "Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,%u\n", VMA_DEBUG_INITIALIZE_ALLOCATIONS ? 1 : 0);
-    fprintf(m_File, "Macro,VMA_DEBUG_DETECT_CORRUPTION,%u\n", VMA_DEBUG_DETECT_CORRUPTION ? 1 : 0);
-    fprintf(m_File, "Macro,VMA_DEBUG_GLOBAL_MUTEX,%u\n", VMA_DEBUG_GLOBAL_MUTEX ? 1 : 0);
-    fprintf(m_File, "Macro,VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY,%llu\n", (VkDeviceSize)VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY);
-    fprintf(m_File, "Macro,VMA_SMALL_HEAP_MAX_SIZE,%llu\n", (VkDeviceSize)VMA_SMALL_HEAP_MAX_SIZE);
-    fprintf(m_File, "Macro,VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE,%llu\n", (VkDeviceSize)VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE);
-
-    fprintf(m_File, "Config,End\n");
-}
-
-void VmaRecorder::GetBasicParams(CallParams& outParams)
-{
-    outParams.threadId = GetCurrentThreadId();
-
-    LARGE_INTEGER counter;
-    QueryPerformanceCounter(&counter);
-    outParams.time = (double)(counter.QuadPart - m_StartCounter) / (double)m_Freq;
-}
-
-void VmaRecorder::PrintPointerList(uint64_t count, const VmaAllocation* pItems)
-{
-    if(count)
-    {
-        fprintf(m_File, "%p", pItems[0]);
-        for(uint64_t i = 1; i < count; ++i)
-        {
-            fprintf(m_File, " %p", pItems[i]);
-        }
-    }
-}
-
-void VmaRecorder::Flush()
-{
-    if((m_Flags & VMA_RECORD_FLUSH_AFTER_CALL_BIT) != 0)
-    {
-        fflush(m_File);
-    }
-}
-
-#endif // #if VMA_RECORDING_ENABLED
-
-////////////////////////////////////////////////////////////////////////////////
-// VmaAllocationObjectAllocator
-
-VmaAllocationObjectAllocator::VmaAllocationObjectAllocator(const VkAllocationCallbacks* pAllocationCallbacks) :
-    m_Allocator(pAllocationCallbacks, 1024)
-{
-}
-
-template<typename... Types> VmaAllocation VmaAllocationObjectAllocator::Allocate(Types... args)
-{
-    VmaMutexLock mutexLock(m_Mutex);
-    return m_Allocator.Alloc<Types...>(std::forward<Types>(args)...);
-}
-
-void VmaAllocationObjectAllocator::Free(VmaAllocation hAlloc)
-{
-    VmaMutexLock mutexLock(m_Mutex);
-    m_Allocator.Free(hAlloc);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VmaAllocator_T
-
-VmaAllocator_T::VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo) :
-    m_UseMutex((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT) == 0),
-    m_VulkanApiVersion(pCreateInfo->vulkanApiVersion != 0 ? pCreateInfo->vulkanApiVersion : VK_API_VERSION_1_0),
-    m_UseKhrDedicatedAllocation((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT) != 0),
-    m_UseKhrBindMemory2((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT) != 0),
-    m_UseExtMemoryBudget((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT) != 0),
-    m_UseAmdDeviceCoherentMemory((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT) != 0),
-    m_UseKhrBufferDeviceAddress((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT) != 0),
-    m_hDevice(pCreateInfo->device),
-    m_hInstance(pCreateInfo->instance),
-    m_AllocationCallbacksSpecified(pCreateInfo->pAllocationCallbacks != VMA_NULL),
-    m_AllocationCallbacks(pCreateInfo->pAllocationCallbacks ?
-        *pCreateInfo->pAllocationCallbacks : VmaEmptyAllocationCallbacks),
-    m_AllocationObjectAllocator(&m_AllocationCallbacks),
-    m_HeapSizeLimitMask(0),
-    m_PreferredLargeHeapBlockSize(0),
-    m_PhysicalDevice(pCreateInfo->physicalDevice),
-    m_CurrentFrameIndex(0),
-    m_GpuDefragmentationMemoryTypeBits(UINT32_MAX),
-    m_Pools(VmaStlAllocator<VmaPool>(GetAllocationCallbacks())),
-    m_NextPoolId(0),
-    m_GlobalMemoryTypeBits(UINT32_MAX)
-#if VMA_RECORDING_ENABLED
-    ,m_pRecorder(VMA_NULL)
-#endif
-{
-    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
-    {
-        m_UseKhrDedicatedAllocation = false;
-        m_UseKhrBindMemory2 = false;
-    }
-
-    if(VMA_DEBUG_DETECT_CORRUPTION)
-    {
-        // Needs to be multiply of uint32_t size because we are going to write VMA_CORRUPTION_DETECTION_MAGIC_VALUE to it.
-        VMA_ASSERT(VMA_DEBUG_MARGIN % sizeof(uint32_t) == 0);
-    }
-
-    VMA_ASSERT(pCreateInfo->physicalDevice && pCreateInfo->device && pCreateInfo->instance);
-
-    if(m_VulkanApiVersion < VK_MAKE_VERSION(1, 1, 0))
-    {
-#if !(VMA_DEDICATED_ALLOCATION)
-        if((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT) != 0)
-        {
-            VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT set but required extensions are disabled by preprocessor macros.");
-        }
-#endif
-#if !(VMA_BIND_MEMORY2)
-        if((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT) != 0)
-        {
-            VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT set but required extension is disabled by preprocessor macros.");
-        }
-#endif
-    }
-#if !(VMA_MEMORY_BUDGET)
-    if((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT) != 0)
-    {
-        VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT set but required extension is disabled by preprocessor macros.");
-    }
-#endif
-#if !(VMA_BUFFER_DEVICE_ADDRESS)
-    if(m_UseKhrBufferDeviceAddress)
-    {
-        VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT is set but required extension or Vulkan 1.2 is not available in your Vulkan header or its support in VMA has been disabled by a preprocessor macro.");
-    }
-#endif
-#if VMA_VULKAN_VERSION < 1002000
-    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 2, 0))
-    {
-        VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros.");
-    }
-#endif
-#if VMA_VULKAN_VERSION < 1001000
-    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
-    {
-        VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_1 but required Vulkan version is disabled by preprocessor macros.");
-    }
-#endif
-
-    memset(&m_DeviceMemoryCallbacks, 0 ,sizeof(m_DeviceMemoryCallbacks));
-    memset(&m_PhysicalDeviceProperties, 0, sizeof(m_PhysicalDeviceProperties));
-    memset(&m_MemProps, 0, sizeof(m_MemProps));
-        
-    memset(&m_pBlockVectors, 0, sizeof(m_pBlockVectors));
-    memset(&m_pDedicatedAllocations, 0, sizeof(m_pDedicatedAllocations));
-    memset(&m_VulkanFunctions, 0, sizeof(m_VulkanFunctions));
-
-    if(pCreateInfo->pDeviceMemoryCallbacks != VMA_NULL)
-    {
-        m_DeviceMemoryCallbacks.pUserData = pCreateInfo->pDeviceMemoryCallbacks->pUserData;
-        m_DeviceMemoryCallbacks.pfnAllocate = pCreateInfo->pDeviceMemoryCallbacks->pfnAllocate;
-        m_DeviceMemoryCallbacks.pfnFree = pCreateInfo->pDeviceMemoryCallbacks->pfnFree;
-    }
-
-    ImportVulkanFunctions(pCreateInfo->pVulkanFunctions);
-
-    (*m_VulkanFunctions.vkGetPhysicalDeviceProperties)(m_PhysicalDevice, &m_PhysicalDeviceProperties);
-    (*m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties)(m_PhysicalDevice, &m_MemProps);
-
-    VMA_ASSERT(VmaIsPow2(VMA_DEBUG_ALIGNMENT));
-    VMA_ASSERT(VmaIsPow2(VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY));
-    VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.bufferImageGranularity));
-    VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.nonCoherentAtomSize));
-
-    m_PreferredLargeHeapBlockSize = (pCreateInfo->preferredLargeHeapBlockSize != 0) ?
-        pCreateInfo->preferredLargeHeapBlockSize : static_cast<VkDeviceSize>(VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE);
-
-    m_GlobalMemoryTypeBits = CalculateGlobalMemoryTypeBits();
-
-    if(pCreateInfo->pHeapSizeLimit != VMA_NULL)
-    {
-        for(uint32_t heapIndex = 0; heapIndex < GetMemoryHeapCount(); ++heapIndex)
-        {
-            const VkDeviceSize limit = pCreateInfo->pHeapSizeLimit[heapIndex];
-            if(limit != VK_WHOLE_SIZE)
-            {
-                m_HeapSizeLimitMask |= 1u << heapIndex;
-                if(limit < m_MemProps.memoryHeaps[heapIndex].size)
-                {
-                    m_MemProps.memoryHeaps[heapIndex].size = limit;
-                }
-            }
-        }
-    }
-
-    for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)
-    {
-        const VkDeviceSize preferredBlockSize = CalcPreferredBlockSize(memTypeIndex);
-
-        m_pBlockVectors[memTypeIndex] = vma_new(this, VmaBlockVector)(
-            this,
-            VK_NULL_HANDLE, // hParentPool
-            memTypeIndex,
-            preferredBlockSize,
-            0,
-            SIZE_MAX,
-            GetBufferImageGranularity(),
-            pCreateInfo->frameInUseCount,
-            false, // explicitBlockSize
-            false); // linearAlgorithm
-        // No need to call m_pBlockVectors[memTypeIndex][blockVectorTypeIndex]->CreateMinBlocks here,
-        // becase minBlockCount is 0.
-        m_pDedicatedAllocations[memTypeIndex] = vma_new(this, AllocationVectorType)(VmaStlAllocator<VmaAllocation>(GetAllocationCallbacks()));
-
-    }
-}
-
-VkResult VmaAllocator_T::Init(const VmaAllocatorCreateInfo* pCreateInfo)
-{
-    VkResult res = VK_SUCCESS;
-
-    if(pCreateInfo->pRecordSettings != VMA_NULL &&
-        !VmaStrIsEmpty(pCreateInfo->pRecordSettings->pFilePath))
-    {
-#if VMA_RECORDING_ENABLED
-        m_pRecorder = vma_new(this, VmaRecorder)();
-        res = m_pRecorder->Init(*pCreateInfo->pRecordSettings, m_UseMutex);
-        if(res != VK_SUCCESS)
-        {
-            return res;
-        }
-        m_pRecorder->WriteConfiguration(
-            m_PhysicalDeviceProperties,
-            m_MemProps,
-            m_VulkanApiVersion,
-            m_UseKhrDedicatedAllocation,
-            m_UseKhrBindMemory2,
-            m_UseExtMemoryBudget,
-            m_UseAmdDeviceCoherentMemory);
-        m_pRecorder->RecordCreateAllocator(GetCurrentFrameIndex());
-#else
-        VMA_ASSERT(0 && "VmaAllocatorCreateInfo::pRecordSettings used, but not supported due to VMA_RECORDING_ENABLED not defined to 1.");
-        return VK_ERROR_FEATURE_NOT_PRESENT;
-#endif
-    }
-
-#if VMA_MEMORY_BUDGET
-    if(m_UseExtMemoryBudget)
-    {
-        UpdateVulkanBudget();
-    }
-#endif // #if VMA_MEMORY_BUDGET
-
-    return res;
-}
-
-VmaAllocator_T::~VmaAllocator_T()
-{
-#if VMA_RECORDING_ENABLED
-    if(m_pRecorder != VMA_NULL)
-    {
-        m_pRecorder->RecordDestroyAllocator(GetCurrentFrameIndex());
-        vma_delete(this, m_pRecorder);
-    }
-#endif
-    
-    VMA_ASSERT(m_Pools.empty());
-
-    for(size_t i = GetMemoryTypeCount(); i--; )
-    {
-        if(m_pDedicatedAllocations[i] != VMA_NULL && !m_pDedicatedAllocations[i]->empty())
-        {
-            VMA_ASSERT(0 && "Unfreed dedicated allocations found.");
-        }
-
-        vma_delete(this, m_pDedicatedAllocations[i]);
-        vma_delete(this, m_pBlockVectors[i]);
-    }
-}
-
-void VmaAllocator_T::ImportVulkanFunctions(const VmaVulkanFunctions* pVulkanFunctions)
-{
-#if VMA_STATIC_VULKAN_FUNCTIONS == 1
-    ImportVulkanFunctions_Static();
-#endif
-
-    if(pVulkanFunctions != VMA_NULL)
-    {
-        ImportVulkanFunctions_Custom(pVulkanFunctions);
-    }
-
-#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1
-    ImportVulkanFunctions_Dynamic();
-#endif
-
-    ValidateVulkanFunctions();
-}
-
-#if VMA_STATIC_VULKAN_FUNCTIONS == 1
-
-void VmaAllocator_T::ImportVulkanFunctions_Static()
-{
-    // Vulkan 1.0
-    m_VulkanFunctions.vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties)vkGetPhysicalDeviceProperties;
-    m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties)vkGetPhysicalDeviceMemoryProperties;
-    m_VulkanFunctions.vkAllocateMemory = (PFN_vkAllocateMemory)vkAllocateMemory;
-    m_VulkanFunctions.vkFreeMemory = (PFN_vkFreeMemory)vkFreeMemory;
-    m_VulkanFunctions.vkMapMemory = (PFN_vkMapMemory)vkMapMemory;
-    m_VulkanFunctions.vkUnmapMemory = (PFN_vkUnmapMemory)vkUnmapMemory;
-    m_VulkanFunctions.vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges)vkFlushMappedMemoryRanges;
-    m_VulkanFunctions.vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges)vkInvalidateMappedMemoryRanges;
-    m_VulkanFunctions.vkBindBufferMemory = (PFN_vkBindBufferMemory)vkBindBufferMemory;
-    m_VulkanFunctions.vkBindImageMemory = (PFN_vkBindImageMemory)vkBindImageMemory;
-    m_VulkanFunctions.vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements)vkGetBufferMemoryRequirements;
-    m_VulkanFunctions.vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements)vkGetImageMemoryRequirements;
-    m_VulkanFunctions.vkCreateBuffer = (PFN_vkCreateBuffer)vkCreateBuffer;
-    m_VulkanFunctions.vkDestroyBuffer = (PFN_vkDestroyBuffer)vkDestroyBuffer;
-    m_VulkanFunctions.vkCreateImage = (PFN_vkCreateImage)vkCreateImage;
-    m_VulkanFunctions.vkDestroyImage = (PFN_vkDestroyImage)vkDestroyImage;
-    m_VulkanFunctions.vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer)vkCmdCopyBuffer;
-
-    // Vulkan 1.1
-#if VMA_VULKAN_VERSION >= 1001000
-    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
-    {
-        m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR = (PFN_vkGetBufferMemoryRequirements2)vkGetBufferMemoryRequirements2;
-        m_VulkanFunctions.vkGetImageMemoryRequirements2KHR = (PFN_vkGetImageMemoryRequirements2)vkGetImageMemoryRequirements2;
-        m_VulkanFunctions.vkBindBufferMemory2KHR = (PFN_vkBindBufferMemory2)vkBindBufferMemory2;
-        m_VulkanFunctions.vkBindImageMemory2KHR = (PFN_vkBindImageMemory2)vkBindImageMemory2;
-        m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties2KHR = (PFN_vkGetPhysicalDeviceMemoryProperties2)vkGetPhysicalDeviceMemoryProperties2;
-    }
-#endif
-}
-
-#endif // #if VMA_STATIC_VULKAN_FUNCTIONS == 1
-
-void VmaAllocator_T::ImportVulkanFunctions_Custom(const VmaVulkanFunctions* pVulkanFunctions)
-{
-    VMA_ASSERT(pVulkanFunctions != VMA_NULL);
-
-#define VMA_COPY_IF_NOT_NULL(funcName) \
-    if(pVulkanFunctions->funcName != VMA_NULL) m_VulkanFunctions.funcName = pVulkanFunctions->funcName;
-
-    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceProperties);
-    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceMemoryProperties);
-    VMA_COPY_IF_NOT_NULL(vkAllocateMemory);
-    VMA_COPY_IF_NOT_NULL(vkFreeMemory);
-    VMA_COPY_IF_NOT_NULL(vkMapMemory);
-    VMA_COPY_IF_NOT_NULL(vkUnmapMemory);
-    VMA_COPY_IF_NOT_NULL(vkFlushMappedMemoryRanges);
-    VMA_COPY_IF_NOT_NULL(vkInvalidateMappedMemoryRanges);
-    VMA_COPY_IF_NOT_NULL(vkBindBufferMemory);
-    VMA_COPY_IF_NOT_NULL(vkBindImageMemory);
-    VMA_COPY_IF_NOT_NULL(vkGetBufferMemoryRequirements);
-    VMA_COPY_IF_NOT_NULL(vkGetImageMemoryRequirements);
-    VMA_COPY_IF_NOT_NULL(vkCreateBuffer);
-    VMA_COPY_IF_NOT_NULL(vkDestroyBuffer);
-    VMA_COPY_IF_NOT_NULL(vkCreateImage);
-    VMA_COPY_IF_NOT_NULL(vkDestroyImage);
-    VMA_COPY_IF_NOT_NULL(vkCmdCopyBuffer);
-
-#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
-    VMA_COPY_IF_NOT_NULL(vkGetBufferMemoryRequirements2KHR);
-    VMA_COPY_IF_NOT_NULL(vkGetImageMemoryRequirements2KHR);
-#endif
-
-#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION >= 1001000
-    VMA_COPY_IF_NOT_NULL(vkBindBufferMemory2KHR);
-    VMA_COPY_IF_NOT_NULL(vkBindImageMemory2KHR);
-#endif
-
-#if VMA_MEMORY_BUDGET
-    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceMemoryProperties2KHR);
-#endif
-
-#undef VMA_COPY_IF_NOT_NULL
-}
-
-#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1
-
-void VmaAllocator_T::ImportVulkanFunctions_Dynamic()
-{
-#define VMA_FETCH_INSTANCE_FUNC(memberName, functionPointerType, functionNameString) \
-    if(m_VulkanFunctions.memberName == VMA_NULL) \
-        m_VulkanFunctions.memberName = \
-            (functionPointerType)vkGetInstanceProcAddr(m_hInstance, functionNameString);
-#define VMA_FETCH_DEVICE_FUNC(memberName, functionPointerType, functionNameString) \
-    if(m_VulkanFunctions.memberName == VMA_NULL) \
-        m_VulkanFunctions.memberName = \
-            (functionPointerType)vkGetDeviceProcAddr(m_hDevice, functionNameString);
-
-    VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceProperties, PFN_vkGetPhysicalDeviceProperties, "vkGetPhysicalDeviceProperties");
-    VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceMemoryProperties, PFN_vkGetPhysicalDeviceMemoryProperties, "vkGetPhysicalDeviceMemoryProperties");
-    VMA_FETCH_DEVICE_FUNC(vkAllocateMemory, PFN_vkAllocateMemory, "vkAllocateMemory");
-    VMA_FETCH_DEVICE_FUNC(vkFreeMemory, PFN_vkFreeMemory, "vkFreeMemory");
-    VMA_FETCH_DEVICE_FUNC(vkMapMemory, PFN_vkMapMemory, "vkMapMemory");
-    VMA_FETCH_DEVICE_FUNC(vkUnmapMemory, PFN_vkUnmapMemory, "vkUnmapMemory");
-    VMA_FETCH_DEVICE_FUNC(vkFlushMappedMemoryRanges, PFN_vkFlushMappedMemoryRanges, "vkFlushMappedMemoryRanges");
-    VMA_FETCH_DEVICE_FUNC(vkInvalidateMappedMemoryRanges, PFN_vkInvalidateMappedMemoryRanges, "vkInvalidateMappedMemoryRanges");
-    VMA_FETCH_DEVICE_FUNC(vkBindBufferMemory, PFN_vkBindBufferMemory, "vkBindBufferMemory");
-    VMA_FETCH_DEVICE_FUNC(vkBindImageMemory, PFN_vkBindImageMemory, "vkBindImageMemory");
-    VMA_FETCH_DEVICE_FUNC(vkGetBufferMemoryRequirements, PFN_vkGetBufferMemoryRequirements, "vkGetBufferMemoryRequirements");
-    VMA_FETCH_DEVICE_FUNC(vkGetImageMemoryRequirements, PFN_vkGetImageMemoryRequirements, "vkGetImageMemoryRequirements");
-    VMA_FETCH_DEVICE_FUNC(vkCreateBuffer, PFN_vkCreateBuffer, "vkCreateBuffer");
-    VMA_FETCH_DEVICE_FUNC(vkDestroyBuffer, PFN_vkDestroyBuffer, "vkDestroyBuffer");
-    VMA_FETCH_DEVICE_FUNC(vkCreateImage, PFN_vkCreateImage, "vkCreateImage");
-    VMA_FETCH_DEVICE_FUNC(vkDestroyImage, PFN_vkDestroyImage, "vkDestroyImage");
-    VMA_FETCH_DEVICE_FUNC(vkCmdCopyBuffer, PFN_vkCmdCopyBuffer, "vkCmdCopyBuffer");
-
-#if VMA_DEDICATED_ALLOCATION
-    if(m_UseKhrDedicatedAllocation)
-    {
-        VMA_FETCH_DEVICE_FUNC(vkGetBufferMemoryRequirements2KHR, PFN_vkGetBufferMemoryRequirements2KHR, "vkGetBufferMemoryRequirements2KHR");
-        VMA_FETCH_DEVICE_FUNC(vkGetImageMemoryRequirements2KHR, PFN_vkGetImageMemoryRequirements2KHR, "vkGetImageMemoryRequirements2KHR");
-    }
-#endif
-
-#if VMA_BIND_MEMORY2
-    if(m_UseKhrBindMemory2)
-    {
-        VMA_FETCH_DEVICE_FUNC(vkBindBufferMemory2KHR, PFN_vkBindBufferMemory2KHR, "vkBindBufferMemory2KHR");
-        VMA_FETCH_DEVICE_FUNC(vkBindImageMemory2KHR, PFN_vkBindImageMemory2KHR, "vkBindImageMemory2KHR");
-    }
-#endif // #if VMA_BIND_MEMORY2
-
-#if VMA_MEMORY_BUDGET
-    if(m_UseExtMemoryBudget && m_VulkanApiVersion < VK_MAKE_VERSION(1, 1, 0))
-    {
-        VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceMemoryProperties2KHR, PFN_vkGetPhysicalDeviceMemoryProperties2KHR, "vkGetPhysicalDeviceMemoryProperties2KHR");
-    }
-#endif // #if VMA_MEMORY_BUDGET
-
-#undef VMA_FETCH_DEVICE_FUNC
-#undef VMA_FETCH_INSTANCE_FUNC
-}
-
-#endif // #if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1
-
-void VmaAllocator_T::ValidateVulkanFunctions()
-{
-    VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceProperties != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkAllocateMemory != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkFreeMemory != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkMapMemory != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkUnmapMemory != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkFlushMappedMemoryRanges != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkInvalidateMappedMemoryRanges != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkBindBufferMemory != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkBindImageMemory != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkGetBufferMemoryRequirements != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkGetImageMemoryRequirements != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkCreateBuffer != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkDestroyBuffer != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkCreateImage != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkDestroyImage != VMA_NULL);
-    VMA_ASSERT(m_VulkanFunctions.vkCmdCopyBuffer != VMA_NULL);
-
-#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
-    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0) || m_UseKhrDedicatedAllocation)
-    {
-        VMA_ASSERT(m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR != VMA_NULL);
-        VMA_ASSERT(m_VulkanFunctions.vkGetImageMemoryRequirements2KHR != VMA_NULL);
-    }
-#endif
-
-#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION >= 1001000
-    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0) || m_UseKhrBindMemory2)
-    {
-        VMA_ASSERT(m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL);
-        VMA_ASSERT(m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL);
-    }
-#endif
-
-#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION >= 1001000
-    if(m_UseExtMemoryBudget || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
-    {
-        VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties2KHR != VMA_NULL);
-    }
-#endif
-}
-
-VkDeviceSize VmaAllocator_T::CalcPreferredBlockSize(uint32_t memTypeIndex)
-{
-    const uint32_t heapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);
-    const VkDeviceSize heapSize = m_MemProps.memoryHeaps[heapIndex].size;
-    const bool isSmallHeap = heapSize <= VMA_SMALL_HEAP_MAX_SIZE;
-    return VmaAlignUp(isSmallHeap ? (heapSize / 8) : m_PreferredLargeHeapBlockSize, (VkDeviceSize)32);
-}
-
-VkResult VmaAllocator_T::AllocateMemoryOfType(
-    VkDeviceSize size,
-    VkDeviceSize alignment,
-    bool dedicatedAllocation,
-    VkBuffer dedicatedBuffer,
-    VkBufferUsageFlags dedicatedBufferUsage,
-    VkImage dedicatedImage,
-    const VmaAllocationCreateInfo& createInfo,
-    uint32_t memTypeIndex,
-    VmaSuballocationType suballocType,
-    size_t allocationCount,
-    VmaAllocation* pAllocations)
-{
-    VMA_ASSERT(pAllocations != VMA_NULL);
-    VMA_DEBUG_LOG("  AllocateMemory: MemoryTypeIndex=%u, AllocationCount=%zu, Size=%llu", memTypeIndex, allocationCount, size);
-
-    VmaAllocationCreateInfo finalCreateInfo = createInfo;
-
-    // If memory type is not HOST_VISIBLE, disable MAPPED.
-    if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0 &&
-        (m_MemProps.memoryTypes[memTypeIndex].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
-    {
-        finalCreateInfo.flags &= ~VMA_ALLOCATION_CREATE_MAPPED_BIT;
-    }
-    // If memory is lazily allocated, it should be always dedicated.
-    if(finalCreateInfo.usage == VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED)
-    {
-        finalCreateInfo.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
-    }
-
-    VmaBlockVector* const blockVector = m_pBlockVectors[memTypeIndex];
-    VMA_ASSERT(blockVector);
-
-    const VkDeviceSize preferredBlockSize = blockVector->GetPreferredBlockSize();
-    bool preferDedicatedMemory =
-        VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ||
-        dedicatedAllocation ||
-        // Heuristics: Allocate dedicated memory if requested size if greater than half of preferred block size.
-        size > preferredBlockSize / 2;
-
-    if(preferDedicatedMemory &&
-        (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) == 0 &&
-        finalCreateInfo.pool == VK_NULL_HANDLE)
-    {
-        finalCreateInfo.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
-    }
-
-    if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT) != 0)
-    {
-        if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) != 0)
-        {
-            return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-        }
-        else
-        {
-            return AllocateDedicatedMemory(
-                size,
-                suballocType,
-                memTypeIndex,
-                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT) != 0,
-                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0,
-                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0,
-                finalCreateInfo.pUserData,
-                dedicatedBuffer,
-                dedicatedBufferUsage,
-                dedicatedImage,
-                allocationCount,
-                pAllocations);
-        }
-    }
-    else
-    {
-        VkResult res = blockVector->Allocate(
-            m_CurrentFrameIndex.load(),
-            size,
-            alignment,
-            finalCreateInfo,
-            suballocType,
-            allocationCount,
-            pAllocations);
-        if(res == VK_SUCCESS)
-        {
-            return res;
-        }
-
-        // 5. Try dedicated memory.
-        if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) != 0)
-        {
-            return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-        }
-        else
-        {
-            res = AllocateDedicatedMemory(
-                size,
-                suballocType,
-                memTypeIndex,
-                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT) != 0,
-                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0,
-                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0,
-                finalCreateInfo.pUserData,
-                dedicatedBuffer,
-                dedicatedBufferUsage,
-                dedicatedImage,
-                allocationCount,
-                pAllocations);
-            if(res == VK_SUCCESS)
-            {
-                // Succeeded: AllocateDedicatedMemory function already filld pMemory, nothing more to do here.
-                VMA_DEBUG_LOG("    Allocated as DedicatedMemory");
-                return VK_SUCCESS;
-            }
-            else
-            {
-                // Everything failed: Return error code.
-                VMA_DEBUG_LOG("    vkAllocateMemory FAILED");
-                return res;
-            }
-        }
-    }
-}
-
-VkResult VmaAllocator_T::AllocateDedicatedMemory(
-    VkDeviceSize size,
-    VmaSuballocationType suballocType,
-    uint32_t memTypeIndex,
-    bool withinBudget,
-    bool map,
-    bool isUserDataString,
-    void* pUserData,
-    VkBuffer dedicatedBuffer,
-    VkBufferUsageFlags dedicatedBufferUsage,
-    VkImage dedicatedImage,
-    size_t allocationCount,
-    VmaAllocation* pAllocations)
-{
-    VMA_ASSERT(allocationCount > 0 && pAllocations);
-
-    if(withinBudget)
-    {
-        const uint32_t heapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);
-        VmaBudget heapBudget = {};
-        GetBudget(&heapBudget, heapIndex, 1);
-        if(heapBudget.usage + size * allocationCount > heapBudget.budget)
-        {
-            return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-        }
-    }
-
-    VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };
-    allocInfo.memoryTypeIndex = memTypeIndex;
-    allocInfo.allocationSize = size;
-
-#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
-    VkMemoryDedicatedAllocateInfoKHR dedicatedAllocInfo = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR };
-    if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
-    {
-        if(dedicatedBuffer != VK_NULL_HANDLE)
-        {
-            VMA_ASSERT(dedicatedImage == VK_NULL_HANDLE);
-            dedicatedAllocInfo.buffer = dedicatedBuffer;
-            VmaPnextChainPushFront(&allocInfo, &dedicatedAllocInfo);
-        }
-        else if(dedicatedImage != VK_NULL_HANDLE)
-        {
-            dedicatedAllocInfo.image = dedicatedImage;
-            VmaPnextChainPushFront(&allocInfo, &dedicatedAllocInfo);
-        }
-    }
-#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
-
-#if VMA_BUFFER_DEVICE_ADDRESS
-    VkMemoryAllocateFlagsInfoKHR allocFlagsInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR };
-    if(m_UseKhrBufferDeviceAddress)
-    {
-        bool canContainBufferWithDeviceAddress = true;
-        if(dedicatedBuffer != VK_NULL_HANDLE)
-        {
-            canContainBufferWithDeviceAddress = dedicatedBufferUsage == UINT32_MAX || // Usage flags unknown
-                (dedicatedBufferUsage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT) != 0;
-        }
-        else if(dedicatedImage != VK_NULL_HANDLE)
-        {
-            canContainBufferWithDeviceAddress = false;
-        }
-        if(canContainBufferWithDeviceAddress)
-        {
-            allocFlagsInfo.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;
-            VmaPnextChainPushFront(&allocInfo, &allocFlagsInfo);
-        }
-    }
-#endif // #if VMA_BUFFER_DEVICE_ADDRESS
-
-    size_t allocIndex;
-    VkResult res = VK_SUCCESS;
-    for(allocIndex = 0; allocIndex < allocationCount; ++allocIndex)
-    {
-        res = AllocateDedicatedMemoryPage(
-            size,
-            suballocType,
-            memTypeIndex,
-            allocInfo,
-            map,
-            isUserDataString,
-            pUserData,
-            pAllocations + allocIndex);
-        if(res != VK_SUCCESS)
-        {
-            break;
-        }
-    }
-
-    if(res == VK_SUCCESS)
-    {
-        // Register them in m_pDedicatedAllocations.
-        {
-            VmaMutexLockWrite lock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);
-            AllocationVectorType* pDedicatedAllocations = m_pDedicatedAllocations[memTypeIndex];
-            VMA_ASSERT(pDedicatedAllocations);
-            for(allocIndex = 0; allocIndex < allocationCount; ++allocIndex)
-            {
-                VmaVectorInsertSorted<VmaPointerLess>(*pDedicatedAllocations, pAllocations[allocIndex]);
-            }
-        }
-
-        VMA_DEBUG_LOG("    Allocated DedicatedMemory Count=%zu, MemoryTypeIndex=#%u", allocationCount, memTypeIndex);
-    }
-    else
-    {
-        // Free all already created allocations.
-        while(allocIndex--)
-        {
-            VmaAllocation currAlloc = pAllocations[allocIndex];
-            VkDeviceMemory hMemory = currAlloc->GetMemory();
-    
-            /*
-            There is no need to call this, because Vulkan spec allows to skip vkUnmapMemory
-            before vkFreeMemory.
-
-            if(currAlloc->GetMappedData() != VMA_NULL)
-            {
-                (*m_VulkanFunctions.vkUnmapMemory)(m_hDevice, hMemory);
-            }
-            */
-    
-            FreeVulkanMemory(memTypeIndex, currAlloc->GetSize(), hMemory);
-            m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(memTypeIndex), currAlloc->GetSize());
-            currAlloc->SetUserData(this, VMA_NULL);
-            m_AllocationObjectAllocator.Free(currAlloc);
-        }
-
-        memset(pAllocations, 0, sizeof(VmaAllocation) * allocationCount);
-    }
-
-    return res;
-}
-
-VkResult VmaAllocator_T::AllocateDedicatedMemoryPage(
-    VkDeviceSize size,
-    VmaSuballocationType suballocType,
-    uint32_t memTypeIndex,
-    const VkMemoryAllocateInfo& allocInfo,
-    bool map,
-    bool isUserDataString,
-    void* pUserData,
-    VmaAllocation* pAllocation)
-{
-    VkDeviceMemory hMemory = VK_NULL_HANDLE;
-    VkResult res = AllocateVulkanMemory(&allocInfo, &hMemory);
-    if(res < 0)
-    {
-        VMA_DEBUG_LOG("    vkAllocateMemory FAILED");
-        return res;
-    }
-
-    void* pMappedData = VMA_NULL;
-    if(map)
-    {
-        res = (*m_VulkanFunctions.vkMapMemory)(
-            m_hDevice,
-            hMemory,
-            0,
-            VK_WHOLE_SIZE,
-            0,
-            &pMappedData);
-        if(res < 0)
-        {
-            VMA_DEBUG_LOG("    vkMapMemory FAILED");
-            FreeVulkanMemory(memTypeIndex, size, hMemory);
-            return res;
-        }
-    }
-
-    *pAllocation = m_AllocationObjectAllocator.Allocate(m_CurrentFrameIndex.load(), isUserDataString);
-    (*pAllocation)->InitDedicatedAllocation(memTypeIndex, hMemory, suballocType, pMappedData, size);
-    (*pAllocation)->SetUserData(this, pUserData);
-    m_Budget.AddAllocation(MemoryTypeIndexToHeapIndex(memTypeIndex), size);
-    if(VMA_DEBUG_INITIALIZE_ALLOCATIONS)
-    {
-        FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);
-    }
-
-    return VK_SUCCESS;
-}
-
-void VmaAllocator_T::GetBufferMemoryRequirements(
-    VkBuffer hBuffer,
-    VkMemoryRequirements& memReq,
-    bool& requiresDedicatedAllocation,
-    bool& prefersDedicatedAllocation) const
-{
-#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
-    if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
-    {
-        VkBufferMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR };
-        memReqInfo.buffer = hBuffer;
-
-        VkMemoryDedicatedRequirementsKHR memDedicatedReq = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR };
-
-        VkMemoryRequirements2KHR memReq2 = { VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR };
-        VmaPnextChainPushFront(&memReq2, &memDedicatedReq);
-
-        (*m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR)(m_hDevice, &memReqInfo, &memReq2);
-
-        memReq = memReq2.memoryRequirements;
-        requiresDedicatedAllocation = (memDedicatedReq.requiresDedicatedAllocation != VK_FALSE);
-        prefersDedicatedAllocation  = (memDedicatedReq.prefersDedicatedAllocation  != VK_FALSE);
-    }
-    else
-#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
-    {
-        (*m_VulkanFunctions.vkGetBufferMemoryRequirements)(m_hDevice, hBuffer, &memReq);
-        requiresDedicatedAllocation = false;
-        prefersDedicatedAllocation  = false;
-    }
-}
-
-void VmaAllocator_T::GetImageMemoryRequirements(
-    VkImage hImage,
-    VkMemoryRequirements& memReq,
-    bool& requiresDedicatedAllocation,
-    bool& prefersDedicatedAllocation) const
-{
-#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
-    if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
-    {
-        VkImageMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR };
-        memReqInfo.image = hImage;
-
-        VkMemoryDedicatedRequirementsKHR memDedicatedReq = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR };
-
-        VkMemoryRequirements2KHR memReq2 = { VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR };
-        VmaPnextChainPushFront(&memReq2, &memDedicatedReq);
-
-        (*m_VulkanFunctions.vkGetImageMemoryRequirements2KHR)(m_hDevice, &memReqInfo, &memReq2);
-
-        memReq = memReq2.memoryRequirements;
-        requiresDedicatedAllocation = (memDedicatedReq.requiresDedicatedAllocation != VK_FALSE);
-        prefersDedicatedAllocation  = (memDedicatedReq.prefersDedicatedAllocation  != VK_FALSE);
-    }
-    else
-#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
-    {
-        (*m_VulkanFunctions.vkGetImageMemoryRequirements)(m_hDevice, hImage, &memReq);
-        requiresDedicatedAllocation = false;
-        prefersDedicatedAllocation  = false;
-    }
-}
-
-VkResult VmaAllocator_T::AllocateMemory(
-    const VkMemoryRequirements& vkMemReq,
-    bool requiresDedicatedAllocation,
-    bool prefersDedicatedAllocation,
-    VkBuffer dedicatedBuffer,
-    VkBufferUsageFlags dedicatedBufferUsage,
-    VkImage dedicatedImage,
-    const VmaAllocationCreateInfo& createInfo,
-    VmaSuballocationType suballocType,
-    size_t allocationCount,
-    VmaAllocation* pAllocations)
-{
-    memset(pAllocations, 0, sizeof(VmaAllocation) * allocationCount);
-
-    VMA_ASSERT(VmaIsPow2(vkMemReq.alignment));
-
-    if(vkMemReq.size == 0)
-    {
-        return VK_ERROR_VALIDATION_FAILED_EXT;
-    }
-    if((createInfo.flags & VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT) != 0 &&
-        (createInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) != 0)
-    {
-        VMA_ASSERT(0 && "Specifying VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT together with VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT makes no sense.");
-        return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-    }
-    if((createInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0 &&
-        (createInfo.flags & VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT) != 0)
-    {
-        VMA_ASSERT(0 && "Specifying VMA_ALLOCATION_CREATE_MAPPED_BIT together with VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT is invalid.");
-        return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-    }
-    if(requiresDedicatedAllocation)
-    {
-        if((createInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) != 0)
-        {
-            VMA_ASSERT(0 && "VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT specified while dedicated allocation is required.");
-            return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-        }
-        if(createInfo.pool != VK_NULL_HANDLE)
-        {
-            VMA_ASSERT(0 && "Pool specified while dedicated allocation is required.");
-            return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-        }
-    }
-    if((createInfo.pool != VK_NULL_HANDLE) &&
-        ((createInfo.flags & (VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT)) != 0))
-    {
-        VMA_ASSERT(0 && "Specifying VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT when pool != null is invalid.");
-        return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-    }
-
-    if(createInfo.pool != VK_NULL_HANDLE)
-    {
-        const VkDeviceSize alignmentForPool = VMA_MAX(
-            vkMemReq.alignment,
-            GetMemoryTypeMinAlignment(createInfo.pool->m_BlockVector.GetMemoryTypeIndex()));
-
-        VmaAllocationCreateInfo createInfoForPool = createInfo;
-        // If memory type is not HOST_VISIBLE, disable MAPPED.
-        if((createInfoForPool.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0 &&
-            (m_MemProps.memoryTypes[createInfo.pool->m_BlockVector.GetMemoryTypeIndex()].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
-        {
-            createInfoForPool.flags &= ~VMA_ALLOCATION_CREATE_MAPPED_BIT;
-        }
-
-        return createInfo.pool->m_BlockVector.Allocate(
-            m_CurrentFrameIndex.load(),
-            vkMemReq.size,
-            alignmentForPool,
-            createInfoForPool,
-            suballocType,
-            allocationCount,
-            pAllocations);
-    }
-    else
-    {
-        // Bit mask of memory Vulkan types acceptable for this allocation.
-        uint32_t memoryTypeBits = vkMemReq.memoryTypeBits;
-        uint32_t memTypeIndex = UINT32_MAX;
-        VkResult res = vmaFindMemoryTypeIndex(this, memoryTypeBits, &createInfo, &memTypeIndex);
-        if(res == VK_SUCCESS)
-        {
-            VkDeviceSize alignmentForMemType = VMA_MAX(
-                vkMemReq.alignment,
-                GetMemoryTypeMinAlignment(memTypeIndex));
-
-            res = AllocateMemoryOfType(
-                vkMemReq.size,
-                alignmentForMemType,
-                requiresDedicatedAllocation || prefersDedicatedAllocation,
-                dedicatedBuffer,
-                dedicatedBufferUsage,
-                dedicatedImage,
-                createInfo,
-                memTypeIndex,
-                suballocType,
-                allocationCount,
-                pAllocations);
-            // Succeeded on first try.
-            if(res == VK_SUCCESS)
-            {
-                return res;
-            }
-            // Allocation from this memory type failed. Try other compatible memory types.
-            else
-            {
-                for(;;)
-                {
-                    // Remove old memTypeIndex from list of possibilities.
-                    memoryTypeBits &= ~(1u << memTypeIndex);
-                    // Find alternative memTypeIndex.
-                    res = vmaFindMemoryTypeIndex(this, memoryTypeBits, &createInfo, &memTypeIndex);
-                    if(res == VK_SUCCESS)
-                    {
-                        alignmentForMemType = VMA_MAX(
-                            vkMemReq.alignment,
-                            GetMemoryTypeMinAlignment(memTypeIndex));
-                        
-                        res = AllocateMemoryOfType(
-                            vkMemReq.size,
-                            alignmentForMemType,
-                            requiresDedicatedAllocation || prefersDedicatedAllocation,
-                            dedicatedBuffer,
-                            dedicatedBufferUsage,
-                            dedicatedImage,
-                            createInfo,
-                            memTypeIndex,
-                            suballocType,
-                            allocationCount,
-                            pAllocations);
-                        // Allocation from this alternative memory type succeeded.
-                        if(res == VK_SUCCESS)
-                        {
-                            return res;
-                        }
-                        // else: Allocation from this memory type failed. Try next one - next loop iteration.
-                    }
-                    // No other matching memory type index could be found.
-                    else
-                    {
-                        // Not returning res, which is VK_ERROR_FEATURE_NOT_PRESENT, because we already failed to allocate once.
-                        return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-                    }
-                }
-            }
-        }
-        // Can't find any single memory type maching requirements. res is VK_ERROR_FEATURE_NOT_PRESENT.
-        else
-            return res;
-    }
-}
-
-void VmaAllocator_T::FreeMemory(
-    size_t allocationCount,
-    const VmaAllocation* pAllocations)
-{
-    VMA_ASSERT(pAllocations);
-
-    for(size_t allocIndex = allocationCount; allocIndex--; )
-    {
-        VmaAllocation allocation = pAllocations[allocIndex];
-
-        if(allocation != VK_NULL_HANDLE)
-        {
-            if(TouchAllocation(allocation))
-            {
-                if(VMA_DEBUG_INITIALIZE_ALLOCATIONS)
-                {
-                    FillAllocation(allocation, VMA_ALLOCATION_FILL_PATTERN_DESTROYED);
-                }
-
-                switch(allocation->GetType())
-                {
-                case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:
-                    {
-                        VmaBlockVector* pBlockVector = VMA_NULL;
-                        VmaPool hPool = allocation->GetBlock()->GetParentPool();
-                        if(hPool != VK_NULL_HANDLE)
-                        {
-                            pBlockVector = &hPool->m_BlockVector;
-                        }
-                        else
-                        {
-                            const uint32_t memTypeIndex = allocation->GetMemoryTypeIndex();
-                            pBlockVector = m_pBlockVectors[memTypeIndex];
-                        }
-                        pBlockVector->Free(allocation);
-                    }
-                    break;
-                case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:
-                    FreeDedicatedMemory(allocation);
-                    break;
-                default:
-                    VMA_ASSERT(0);
-                }
-            }
-
-            // Do this regardless of whether the allocation is lost. Lost allocations still account to Budget.AllocationBytes.
-            m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(allocation->GetMemoryTypeIndex()), allocation->GetSize());
-            allocation->SetUserData(this, VMA_NULL);
-            m_AllocationObjectAllocator.Free(allocation);
-        }
-    }
-}
-
-VkResult VmaAllocator_T::ResizeAllocation(
-    const VmaAllocation alloc,
-    VkDeviceSize newSize)
-{
-    // This function is deprecated and so it does nothing. It's left for backward compatibility.
-    if(newSize == 0 || alloc->GetLastUseFrameIndex() == VMA_FRAME_INDEX_LOST)
-    {
-        return VK_ERROR_VALIDATION_FAILED_EXT;
-    }
-    if(newSize == alloc->GetSize())
-    {
-        return VK_SUCCESS;
-    }
-    return VK_ERROR_OUT_OF_POOL_MEMORY;
-}
-
-void VmaAllocator_T::CalculateStats(VmaStats* pStats)
-{
-    // Initialize.
-    InitStatInfo(pStats->total);
-    for(size_t i = 0; i < VK_MAX_MEMORY_TYPES; ++i)
-        InitStatInfo(pStats->memoryType[i]);
-    for(size_t i = 0; i < VK_MAX_MEMORY_HEAPS; ++i)
-        InitStatInfo(pStats->memoryHeap[i]);
-    
-    // Process default pools.
-    for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)
-    {
-        VmaBlockVector* const pBlockVector = m_pBlockVectors[memTypeIndex];
-        VMA_ASSERT(pBlockVector);
-        pBlockVector->AddStats(pStats);
-    }
-
-    // Process custom pools.
-    {
-        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);
-        for(size_t poolIndex = 0, poolCount = m_Pools.size(); poolIndex < poolCount; ++poolIndex)
-        {
-            m_Pools[poolIndex]->m_BlockVector.AddStats(pStats);
-        }
-    }
-
-    // Process dedicated allocations.
-    for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)
-    {
-        const uint32_t memHeapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);
-        VmaMutexLockRead dedicatedAllocationsLock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);
-        AllocationVectorType* const pDedicatedAllocVector = m_pDedicatedAllocations[memTypeIndex];
-        VMA_ASSERT(pDedicatedAllocVector);
-        for(size_t allocIndex = 0, allocCount = pDedicatedAllocVector->size(); allocIndex < allocCount; ++allocIndex)
-        {
-            VmaStatInfo allocationStatInfo;
-            (*pDedicatedAllocVector)[allocIndex]->DedicatedAllocCalcStatsInfo(allocationStatInfo);
-            VmaAddStatInfo(pStats->total, allocationStatInfo);
-            VmaAddStatInfo(pStats->memoryType[memTypeIndex], allocationStatInfo);
-            VmaAddStatInfo(pStats->memoryHeap[memHeapIndex], allocationStatInfo);
-        }
-    }
-
-    // Postprocess.
-    VmaPostprocessCalcStatInfo(pStats->total);
-    for(size_t i = 0; i < GetMemoryTypeCount(); ++i)
-        VmaPostprocessCalcStatInfo(pStats->memoryType[i]);
-    for(size_t i = 0; i < GetMemoryHeapCount(); ++i)
-        VmaPostprocessCalcStatInfo(pStats->memoryHeap[i]);
-}
-
-void VmaAllocator_T::GetBudget(VmaBudget* outBudget, uint32_t firstHeap, uint32_t heapCount)
-{
-#if VMA_MEMORY_BUDGET
-    if(m_UseExtMemoryBudget)
-    {
-        if(m_Budget.m_OperationsSinceBudgetFetch < 30)
-        {
-            VmaMutexLockRead lockRead(m_Budget.m_BudgetMutex, m_UseMutex);
-            for(uint32_t i = 0; i < heapCount; ++i, ++outBudget)
-            {
-                const uint32_t heapIndex = firstHeap + i;
-
-                outBudget->blockBytes = m_Budget.m_BlockBytes[heapIndex];
-                outBudget->allocationBytes = m_Budget.m_AllocationBytes[heapIndex];
-
-                if(m_Budget.m_VulkanUsage[heapIndex] + outBudget->blockBytes > m_Budget.m_BlockBytesAtBudgetFetch[heapIndex])
-                {
-                    outBudget->usage = m_Budget.m_VulkanUsage[heapIndex] +
-                        outBudget->blockBytes - m_Budget.m_BlockBytesAtBudgetFetch[heapIndex];
-                }
-                else
-                {
-                    outBudget->usage = 0;
-                }
-
-                // Have to take MIN with heap size because explicit HeapSizeLimit is included in it.
-                outBudget->budget = VMA_MIN(
-                    m_Budget.m_VulkanBudget[heapIndex], m_MemProps.memoryHeaps[heapIndex].size);
-            }
-        }
-        else
-        {
-            UpdateVulkanBudget(); // Outside of mutex lock
-            GetBudget(outBudget, firstHeap, heapCount); // Recursion
-        }
-    }
-    else
-#endif
-    {
-        for(uint32_t i = 0; i < heapCount; ++i, ++outBudget)
-        {
-            const uint32_t heapIndex = firstHeap + i;
-
-            outBudget->blockBytes = m_Budget.m_BlockBytes[heapIndex];
-            outBudget->allocationBytes = m_Budget.m_AllocationBytes[heapIndex];
-
-            outBudget->usage = outBudget->blockBytes;
-            outBudget->budget = m_MemProps.memoryHeaps[heapIndex].size * 8 / 10; // 80% heuristics.
-        }
-    }
-}
-
-static const uint32_t VMA_VENDOR_ID_AMD = 4098;
-
-VkResult VmaAllocator_T::DefragmentationBegin(
-    const VmaDefragmentationInfo2& info,
-    VmaDefragmentationStats* pStats,
-    VmaDefragmentationContext* pContext)
-{
-    if(info.pAllocationsChanged != VMA_NULL)
-    {
-        memset(info.pAllocationsChanged, 0, info.allocationCount * sizeof(VkBool32));
-    }
-
-    *pContext = vma_new(this, VmaDefragmentationContext_T)(
-        this, m_CurrentFrameIndex.load(), info.flags, pStats);
-
-    (*pContext)->AddPools(info.poolCount, info.pPools);
-    (*pContext)->AddAllocations(
-        info.allocationCount, info.pAllocations, info.pAllocationsChanged);
-
-    VkResult res = (*pContext)->Defragment(
-        info.maxCpuBytesToMove, info.maxCpuAllocationsToMove,
-        info.maxGpuBytesToMove, info.maxGpuAllocationsToMove,
-        info.commandBuffer, pStats, info.flags);
-
-    if(res != VK_NOT_READY)
-    {
-        vma_delete(this, *pContext);
-        *pContext = VMA_NULL;
-    }
-
-    return res;
-}
-
-VkResult VmaAllocator_T::DefragmentationEnd(
-    VmaDefragmentationContext context)
-{
-    vma_delete(this, context);
-    return VK_SUCCESS;
-}
-
-VkResult VmaAllocator_T::DefragmentationPassBegin(
-    VmaDefragmentationPassInfo* pInfo,
-    VmaDefragmentationContext context)
-{
-    return context->DefragmentPassBegin(pInfo);
-}
-VkResult VmaAllocator_T::DefragmentationPassEnd(
-    VmaDefragmentationContext context)
-{
-    return context->DefragmentPassEnd();
-    
-}
-
-void VmaAllocator_T::GetAllocationInfo(VmaAllocation hAllocation, VmaAllocationInfo* pAllocationInfo)
-{
-    if(hAllocation->CanBecomeLost())
-    {
-        /*
-        Warning: This is a carefully designed algorithm.
-        Do not modify unless you really know what you're doing :)
-        */
-        const uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();
-        uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();
-        for(;;)
-        {
-            if(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)
-            {
-                pAllocationInfo->memoryType = UINT32_MAX;
-                pAllocationInfo->deviceMemory = VK_NULL_HANDLE;
-                pAllocationInfo->offset = 0;
-                pAllocationInfo->size = hAllocation->GetSize();
-                pAllocationInfo->pMappedData = VMA_NULL;
-                pAllocationInfo->pUserData = hAllocation->GetUserData();
-                return;
-            }
-            else if(localLastUseFrameIndex == localCurrFrameIndex)
-            {
-                pAllocationInfo->memoryType = hAllocation->GetMemoryTypeIndex();
-                pAllocationInfo->deviceMemory = hAllocation->GetMemory();
-                pAllocationInfo->offset = hAllocation->GetOffset();
-                pAllocationInfo->size = hAllocation->GetSize();
-                pAllocationInfo->pMappedData = VMA_NULL;
-                pAllocationInfo->pUserData = hAllocation->GetUserData();
-                return;
-            }
-            else // Last use time earlier than current time.
-            {
-                if(hAllocation->CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))
-                {
-                    localLastUseFrameIndex = localCurrFrameIndex;
-                }
-            }
-        }
-    }
-    else
-    {
-#if VMA_STATS_STRING_ENABLED
-        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();
-        uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();
-        for(;;)
-        {
-            VMA_ASSERT(localLastUseFrameIndex != VMA_FRAME_INDEX_LOST);
-            if(localLastUseFrameIndex == localCurrFrameIndex)
-            {
-                break;
-            }
-            else // Last use time earlier than current time.
-            {
-                if(hAllocation->CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))
-                {
-                    localLastUseFrameIndex = localCurrFrameIndex;
-                }
-            }
-        }
-#endif
-
-        pAllocationInfo->memoryType = hAllocation->GetMemoryTypeIndex();
-        pAllocationInfo->deviceMemory = hAllocation->GetMemory();
-        pAllocationInfo->offset = hAllocation->GetOffset();
-        pAllocationInfo->size = hAllocation->GetSize();
-        pAllocationInfo->pMappedData = hAllocation->GetMappedData();
-        pAllocationInfo->pUserData = hAllocation->GetUserData();
-    }
-}
-
-bool VmaAllocator_T::TouchAllocation(VmaAllocation hAllocation)
-{
-    // This is a stripped-down version of VmaAllocator_T::GetAllocationInfo.
-    if(hAllocation->CanBecomeLost())
-    {
-        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();
-        uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();
-        for(;;)
-        {
-            if(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)
-            {
-                return false;
-            }
-            else if(localLastUseFrameIndex == localCurrFrameIndex)
-            {
-                return true;
-            }
-            else // Last use time earlier than current time.
-            {
-                if(hAllocation->CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))
-                {
-                    localLastUseFrameIndex = localCurrFrameIndex;
-                }
-            }
-        }
-    }
-    else
-    {
-#if VMA_STATS_STRING_ENABLED
-        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();
-        uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();
-        for(;;)
-        {
-            VMA_ASSERT(localLastUseFrameIndex != VMA_FRAME_INDEX_LOST);
-            if(localLastUseFrameIndex == localCurrFrameIndex)
-            {
-                break;
-            }
-            else // Last use time earlier than current time.
-            {
-                if(hAllocation->CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))
-                {
-                    localLastUseFrameIndex = localCurrFrameIndex;
-                }
-            }
-        }
-#endif
-
-        return true;
-    }
-}
-
-VkResult VmaAllocator_T::CreatePool(const VmaPoolCreateInfo* pCreateInfo, VmaPool* pPool)
-{
-    VMA_DEBUG_LOG("  CreatePool: MemoryTypeIndex=%u, flags=%u", pCreateInfo->memoryTypeIndex, pCreateInfo->flags);
-
-    VmaPoolCreateInfo newCreateInfo = *pCreateInfo;
-
-    if(newCreateInfo.maxBlockCount == 0)
-    {
-        newCreateInfo.maxBlockCount = SIZE_MAX;
-    }
-    if(newCreateInfo.minBlockCount > newCreateInfo.maxBlockCount)
-    {
-        return VK_ERROR_INITIALIZATION_FAILED;
-    }
-    // Memory type index out of range or forbidden.
-    if(pCreateInfo->memoryTypeIndex >= GetMemoryTypeCount() ||
-        ((1u << pCreateInfo->memoryTypeIndex) & m_GlobalMemoryTypeBits) == 0)
-    {
-        return VK_ERROR_FEATURE_NOT_PRESENT;
-    }
-
-    const VkDeviceSize preferredBlockSize = CalcPreferredBlockSize(newCreateInfo.memoryTypeIndex);
-
-    *pPool = vma_new(this, VmaPool_T)(this, newCreateInfo, preferredBlockSize);
-
-    VkResult res = (*pPool)->m_BlockVector.CreateMinBlocks();
-    if(res != VK_SUCCESS)
-    {
-        vma_delete(this, *pPool);
-        *pPool = VMA_NULL;
-        return res;
-    }
-
-    // Add to m_Pools.
-    {
-        VmaMutexLockWrite lock(m_PoolsMutex, m_UseMutex);
-        (*pPool)->SetId(m_NextPoolId++);
-        VmaVectorInsertSorted<VmaPointerLess>(m_Pools, *pPool);
-    }
-
-    return VK_SUCCESS;
-}
-
-void VmaAllocator_T::DestroyPool(VmaPool pool)
-{
-    // Remove from m_Pools.
-    {
-        VmaMutexLockWrite lock(m_PoolsMutex, m_UseMutex);
-        bool success = VmaVectorRemoveSorted<VmaPointerLess>(m_Pools, pool);
-        VMA_ASSERT(success && "Pool not found in Allocator.");
-    }
-
-    vma_delete(this, pool);
-}
-
-void VmaAllocator_T::GetPoolStats(VmaPool pool, VmaPoolStats* pPoolStats)
-{
-    pool->m_BlockVector.GetPoolStats(pPoolStats);
-}
-
-void VmaAllocator_T::SetCurrentFrameIndex(uint32_t frameIndex)
-{
-    m_CurrentFrameIndex.store(frameIndex);
-
-#if VMA_MEMORY_BUDGET
-    if(m_UseExtMemoryBudget)
-    {
-        UpdateVulkanBudget();
-    }
-#endif // #if VMA_MEMORY_BUDGET
-}
-
-void VmaAllocator_T::MakePoolAllocationsLost(
-    VmaPool hPool,
-    size_t* pLostAllocationCount)
-{
-    hPool->m_BlockVector.MakePoolAllocationsLost(
-        m_CurrentFrameIndex.load(),
-        pLostAllocationCount);
-}
-
-VkResult VmaAllocator_T::CheckPoolCorruption(VmaPool hPool)
-{
-    return hPool->m_BlockVector.CheckCorruption();
-}
-
-VkResult VmaAllocator_T::CheckCorruption(uint32_t memoryTypeBits)
-{
-    VkResult finalRes = VK_ERROR_FEATURE_NOT_PRESENT;
-
-    // Process default pools.
-    for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)
-    {
-        if(((1u << memTypeIndex) & memoryTypeBits) != 0)
-        {
-            VmaBlockVector* const pBlockVector = m_pBlockVectors[memTypeIndex];
-            VMA_ASSERT(pBlockVector);
-            VkResult localRes = pBlockVector->CheckCorruption();
-            switch(localRes)
-            {
-            case VK_ERROR_FEATURE_NOT_PRESENT:
-                break;
-            case VK_SUCCESS:
-                finalRes = VK_SUCCESS;
-                break;
-            default:
-                return localRes;
-            }
-        }
-    }
-
-    // Process custom pools.
-    {
-        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);
-        for(size_t poolIndex = 0, poolCount = m_Pools.size(); poolIndex < poolCount; ++poolIndex)
-        {
-            if(((1u << m_Pools[poolIndex]->m_BlockVector.GetMemoryTypeIndex()) & memoryTypeBits) != 0)
-            {
-                VkResult localRes = m_Pools[poolIndex]->m_BlockVector.CheckCorruption();
-                switch(localRes)
-                {
-                case VK_ERROR_FEATURE_NOT_PRESENT:
-                    break;
-                case VK_SUCCESS:
-                    finalRes = VK_SUCCESS;
-                    break;
-                default:
-                    return localRes;
-                }
-            }
-        }
-    }
-
-    return finalRes;
-}
-
-void VmaAllocator_T::CreateLostAllocation(VmaAllocation* pAllocation)
-{
-    *pAllocation = m_AllocationObjectAllocator.Allocate(VMA_FRAME_INDEX_LOST, false);
-    (*pAllocation)->InitLost();
-}
-
-VkResult VmaAllocator_T::AllocateVulkanMemory(const VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory)
-{
-    const uint32_t heapIndex = MemoryTypeIndexToHeapIndex(pAllocateInfo->memoryTypeIndex);
-
-    // HeapSizeLimit is in effect for this heap.
-    if((m_HeapSizeLimitMask & (1u << heapIndex)) != 0)
-    {
-        const VkDeviceSize heapSize = m_MemProps.memoryHeaps[heapIndex].size;
-        VkDeviceSize blockBytes = m_Budget.m_BlockBytes[heapIndex];
-        for(;;)
-        {
-            const VkDeviceSize blockBytesAfterAllocation = blockBytes + pAllocateInfo->allocationSize;
-            if(blockBytesAfterAllocation > heapSize)
-            {
-                return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-            }
-            if(m_Budget.m_BlockBytes[heapIndex].compare_exchange_strong(blockBytes, blockBytesAfterAllocation))
-            {
-                break;
-            }
-        }
-    }
-    else
-    {
-        m_Budget.m_BlockBytes[heapIndex] += pAllocateInfo->allocationSize;
-    }
-
-    // VULKAN CALL vkAllocateMemory.
-    VkResult res = (*m_VulkanFunctions.vkAllocateMemory)(m_hDevice, pAllocateInfo, GetAllocationCallbacks(), pMemory);
-
-    if(res == VK_SUCCESS)
-    {
-#if VMA_MEMORY_BUDGET
-        ++m_Budget.m_OperationsSinceBudgetFetch;
-#endif
-
-        // Informative callback.
-        if(m_DeviceMemoryCallbacks.pfnAllocate != VMA_NULL)
-        {
-            (*m_DeviceMemoryCallbacks.pfnAllocate)(this, pAllocateInfo->memoryTypeIndex, *pMemory, pAllocateInfo->allocationSize, m_DeviceMemoryCallbacks.pUserData);
-        }
-    }
-    else
-    {
-        m_Budget.m_BlockBytes[heapIndex] -= pAllocateInfo->allocationSize;
-    }
-
-    return res;
-}
-
-void VmaAllocator_T::FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, VkDeviceMemory hMemory)
-{
-    // Informative callback.
-    if(m_DeviceMemoryCallbacks.pfnFree != VMA_NULL)
-    {
-        (*m_DeviceMemoryCallbacks.pfnFree)(this, memoryType, hMemory, size, m_DeviceMemoryCallbacks.pUserData);
-    }
-
-    // VULKAN CALL vkFreeMemory.
-    (*m_VulkanFunctions.vkFreeMemory)(m_hDevice, hMemory, GetAllocationCallbacks());
-
-    m_Budget.m_BlockBytes[MemoryTypeIndexToHeapIndex(memoryType)] -= size;
-}
-
-VkResult VmaAllocator_T::BindVulkanBuffer(
-    VkDeviceMemory memory,
-    VkDeviceSize memoryOffset,
-    VkBuffer buffer,
-    const void* pNext)
-{
-    if(pNext != VMA_NULL)
-    {
-#if VMA_VULKAN_VERSION >= 1001000 || VMA_BIND_MEMORY2
-        if((m_UseKhrBindMemory2 || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0)) &&
-            m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL)
-        {
-            VkBindBufferMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR };
-            bindBufferMemoryInfo.pNext = pNext;
-            bindBufferMemoryInfo.buffer = buffer;
-            bindBufferMemoryInfo.memory = memory;
-            bindBufferMemoryInfo.memoryOffset = memoryOffset;
-            return (*m_VulkanFunctions.vkBindBufferMemory2KHR)(m_hDevice, 1, &bindBufferMemoryInfo);
-        }
-        else
-#endif // #if VMA_VULKAN_VERSION >= 1001000 || VMA_BIND_MEMORY2
-        {
-            return VK_ERROR_EXTENSION_NOT_PRESENT;
-        }
-    }
-    else
-    {
-        return (*m_VulkanFunctions.vkBindBufferMemory)(m_hDevice, buffer, memory, memoryOffset);
-    }
-}
-
-VkResult VmaAllocator_T::BindVulkanImage(
-    VkDeviceMemory memory,
-    VkDeviceSize memoryOffset,
-    VkImage image,
-    const void* pNext)
-{
-    if(pNext != VMA_NULL)
-    {
-#if VMA_VULKAN_VERSION >= 1001000 || VMA_BIND_MEMORY2
-        if((m_UseKhrBindMemory2 || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0)) &&
-            m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL)
-        {
-            VkBindImageMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR };
-            bindBufferMemoryInfo.pNext = pNext;
-            bindBufferMemoryInfo.image = image;
-            bindBufferMemoryInfo.memory = memory;
-            bindBufferMemoryInfo.memoryOffset = memoryOffset;
-            return (*m_VulkanFunctions.vkBindImageMemory2KHR)(m_hDevice, 1, &bindBufferMemoryInfo);
-        }
-        else
-#endif // #if VMA_BIND_MEMORY2
-        {
-            return VK_ERROR_EXTENSION_NOT_PRESENT;
-        }
-    }
-    else
-    {
-        return (*m_VulkanFunctions.vkBindImageMemory)(m_hDevice, image, memory, memoryOffset);
-    }
-}
-
-VkResult VmaAllocator_T::Map(VmaAllocation hAllocation, void** ppData)
-{
-    if(hAllocation->CanBecomeLost())
-    {
-        return VK_ERROR_MEMORY_MAP_FAILED;
-    }
-
-    switch(hAllocation->GetType())
-    {
-    case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:
-        {
-            VmaDeviceMemoryBlock* const pBlock = hAllocation->GetBlock();
-            char *pBytes = VMA_NULL;
-            VkResult res = pBlock->Map(this, 1, (void**)&pBytes);
-            if(res == VK_SUCCESS)
-            {
-                *ppData = pBytes + (ptrdiff_t)hAllocation->GetOffset();
-                hAllocation->BlockAllocMap();
-            }
-            return res;
-        }
-    case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:
-        return hAllocation->DedicatedAllocMap(this, ppData);
-    default:
-        VMA_ASSERT(0);
-        return VK_ERROR_MEMORY_MAP_FAILED;
-    }
-}
-
-void VmaAllocator_T::Unmap(VmaAllocation hAllocation)
-{
-    switch(hAllocation->GetType())
-    {
-    case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:
-        {
-            VmaDeviceMemoryBlock* const pBlock = hAllocation->GetBlock();
-            hAllocation->BlockAllocUnmap();
-            pBlock->Unmap(this, 1);
-        }
-        break;
-    case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:
-        hAllocation->DedicatedAllocUnmap(this);
-        break;
-    default:
-        VMA_ASSERT(0);
-    }
-}
-
-VkResult VmaAllocator_T::BindBufferMemory(
-    VmaAllocation hAllocation,
-    VkDeviceSize allocationLocalOffset,
-    VkBuffer hBuffer,
-    const void* pNext)
-{
-    VkResult res = VK_SUCCESS;
-    switch(hAllocation->GetType())
-    {
-    case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:
-        res = BindVulkanBuffer(hAllocation->GetMemory(), allocationLocalOffset, hBuffer, pNext);
-        break;
-    case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:
-    {
-        VmaDeviceMemoryBlock* const pBlock = hAllocation->GetBlock();
-        VMA_ASSERT(pBlock && "Binding buffer to allocation that doesn't belong to any block. Is the allocation lost?");
-        res = pBlock->BindBufferMemory(this, hAllocation, allocationLocalOffset, hBuffer, pNext);
-        break;
-    }
-    default:
-        VMA_ASSERT(0);
-    }
-    return res;
-}
-
-VkResult VmaAllocator_T::BindImageMemory(
-    VmaAllocation hAllocation,
-    VkDeviceSize allocationLocalOffset,
-    VkImage hImage,
-    const void* pNext)
-{
-    VkResult res = VK_SUCCESS;
-    switch(hAllocation->GetType())
-    {
-    case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:
-        res = BindVulkanImage(hAllocation->GetMemory(), allocationLocalOffset, hImage, pNext);
-        break;
-    case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:
-    {
-        VmaDeviceMemoryBlock* pBlock = hAllocation->GetBlock();
-        VMA_ASSERT(pBlock && "Binding image to allocation that doesn't belong to any block. Is the allocation lost?");
-        res = pBlock->BindImageMemory(this, hAllocation, allocationLocalOffset, hImage, pNext);
-        break;
-    }
-    default:
-        VMA_ASSERT(0);
-    }
-    return res;
-}
-
-VkResult VmaAllocator_T::FlushOrInvalidateAllocation(
-    VmaAllocation hAllocation,
-    VkDeviceSize offset, VkDeviceSize size,
-    VMA_CACHE_OPERATION op)
-{
-    const uint32_t memTypeIndex = hAllocation->GetMemoryTypeIndex();
-    VkResult res = VK_SUCCESS;
-    if(size > 0 && IsMemoryTypeNonCoherent(memTypeIndex))
-    {
-        const VkDeviceSize allocationSize = hAllocation->GetSize();
-        VMA_ASSERT(offset <= allocationSize);
-
-        const VkDeviceSize nonCoherentAtomSize = m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;
-
-        VkMappedMemoryRange memRange = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE };
-        memRange.memory = hAllocation->GetMemory();
-        
-        switch(hAllocation->GetType())
-        {
-        case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:
-            memRange.offset = VmaAlignDown(offset, nonCoherentAtomSize);
-            if(size == VK_WHOLE_SIZE)
-            {
-                memRange.size = allocationSize - memRange.offset;
-            }
-            else
-            {
-                VMA_ASSERT(offset + size <= allocationSize);
-                memRange.size = VMA_MIN(
-                    VmaAlignUp(size + (offset - memRange.offset), nonCoherentAtomSize),
-                    allocationSize - memRange.offset);
-            }
-            break;
-
-        case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:
-        {
-            // 1. Still within this allocation.
-            memRange.offset = VmaAlignDown(offset, nonCoherentAtomSize);
-            if(size == VK_WHOLE_SIZE)
-            {
-                size = allocationSize - offset;
-            }
-            else
-            {
-                VMA_ASSERT(offset + size <= allocationSize);
-            }
-            memRange.size = VmaAlignUp(size + (offset - memRange.offset), nonCoherentAtomSize);
-
-            // 2. Adjust to whole block.
-            const VkDeviceSize allocationOffset = hAllocation->GetOffset();
-            VMA_ASSERT(allocationOffset % nonCoherentAtomSize == 0);
-            const VkDeviceSize blockSize = hAllocation->GetBlock()->m_pMetadata->GetSize();
-            memRange.offset += allocationOffset;
-            memRange.size = VMA_MIN(memRange.size, blockSize - memRange.offset);
-            
-            break;
-        }
-        
-        default:
-            VMA_ASSERT(0);
-        }
-
-        switch(op)
-        {
-        case VMA_CACHE_FLUSH:
-            res = (*GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hDevice, 1, &memRange);
-            break;
-        case VMA_CACHE_INVALIDATE:
-            res = (*GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hDevice, 1, &memRange);
-            break;
-        default:
-            VMA_ASSERT(0);
-        }
-    }
-    // else: Just ignore this call.
-    return res;
-}
-
-void VmaAllocator_T::FreeDedicatedMemory(const VmaAllocation allocation)
-{
-    VMA_ASSERT(allocation && allocation->GetType() == VmaAllocation_T::ALLOCATION_TYPE_DEDICATED);
-
-    const uint32_t memTypeIndex = allocation->GetMemoryTypeIndex();
-    {
-        VmaMutexLockWrite lock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);
-        AllocationVectorType* const pDedicatedAllocations = m_pDedicatedAllocations[memTypeIndex];
-        VMA_ASSERT(pDedicatedAllocations);
-        bool success = VmaVectorRemoveSorted<VmaPointerLess>(*pDedicatedAllocations, allocation);
-        VMA_ASSERT(success);
-    }
-
-    VkDeviceMemory hMemory = allocation->GetMemory();
-    
-    /*
-    There is no need to call this, because Vulkan spec allows to skip vkUnmapMemory
-    before vkFreeMemory.
-
-    if(allocation->GetMappedData() != VMA_NULL)
-    {
-        (*m_VulkanFunctions.vkUnmapMemory)(m_hDevice, hMemory);
-    }
-    */
-    
-    FreeVulkanMemory(memTypeIndex, allocation->GetSize(), hMemory);
-
-    VMA_DEBUG_LOG("    Freed DedicatedMemory MemoryTypeIndex=%u", memTypeIndex);
-}
-
-uint32_t VmaAllocator_T::CalculateGpuDefragmentationMemoryTypeBits() const
-{
-    VkBufferCreateInfo dummyBufCreateInfo;
-    VmaFillGpuDefragmentationBufferCreateInfo(dummyBufCreateInfo);
-
-    uint32_t memoryTypeBits = 0;
-
-    // Create buffer.
-    VkBuffer buf = VK_NULL_HANDLE;
-    VkResult res = (*GetVulkanFunctions().vkCreateBuffer)(
-        m_hDevice, &dummyBufCreateInfo, GetAllocationCallbacks(), &buf);
-    if(res == VK_SUCCESS)
-    {
-        // Query for supported memory types.
-        VkMemoryRequirements memReq;
-        (*GetVulkanFunctions().vkGetBufferMemoryRequirements)(m_hDevice, buf, &memReq);
-        memoryTypeBits = memReq.memoryTypeBits;
-
-        // Destroy buffer.
-        (*GetVulkanFunctions().vkDestroyBuffer)(m_hDevice, buf, GetAllocationCallbacks());
-    }
-
-    return memoryTypeBits;
-}
-
-uint32_t VmaAllocator_T::CalculateGlobalMemoryTypeBits() const
-{
-    // Make sure memory information is already fetched.
-    VMA_ASSERT(GetMemoryTypeCount() > 0);
-
-    uint32_t memoryTypeBits = UINT32_MAX;
-
-    if(!m_UseAmdDeviceCoherentMemory)
-    {
-        // Exclude memory types that have VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD.
-        for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)
-        {
-            if((m_MemProps.memoryTypes[memTypeIndex].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY) != 0)
-            {
-                memoryTypeBits &= ~(1u << memTypeIndex);
-            }
-        }
-    }
-
-    return memoryTypeBits;
-}
-
-#if VMA_MEMORY_BUDGET
-
-void VmaAllocator_T::UpdateVulkanBudget()
-{
-    VMA_ASSERT(m_UseExtMemoryBudget);
-
-    VkPhysicalDeviceMemoryProperties2KHR memProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR };
-
-    VkPhysicalDeviceMemoryBudgetPropertiesEXT budgetProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT };
-    VmaPnextChainPushFront(&memProps, &budgetProps);
-
-    GetVulkanFunctions().vkGetPhysicalDeviceMemoryProperties2KHR(m_PhysicalDevice, &memProps);
-
-    {
-        VmaMutexLockWrite lockWrite(m_Budget.m_BudgetMutex, m_UseMutex);
-
-        for(uint32_t heapIndex = 0; heapIndex < GetMemoryHeapCount(); ++heapIndex)
-        {
-            m_Budget.m_VulkanUsage[heapIndex] = budgetProps.heapUsage[heapIndex];
-            m_Budget.m_VulkanBudget[heapIndex] = budgetProps.heapBudget[heapIndex];
-            m_Budget.m_BlockBytesAtBudgetFetch[heapIndex] = m_Budget.m_BlockBytes[heapIndex].load();
-
-            // Some bugged drivers return the budget incorrectly, e.g. 0 or much bigger than heap size.
-            if(m_Budget.m_VulkanBudget[heapIndex] == 0)
-            {
-                m_Budget.m_VulkanBudget[heapIndex] = m_MemProps.memoryHeaps[heapIndex].size * 8 / 10; // 80% heuristics.
-            }
-            else if(m_Budget.m_VulkanBudget[heapIndex] > m_MemProps.memoryHeaps[heapIndex].size)
-            {
-                m_Budget.m_VulkanBudget[heapIndex] = m_MemProps.memoryHeaps[heapIndex].size;
-            }
-            if(m_Budget.m_VulkanUsage[heapIndex] == 0 && m_Budget.m_BlockBytesAtBudgetFetch[heapIndex] > 0)
-            {
-                m_Budget.m_VulkanUsage[heapIndex] = m_Budget.m_BlockBytesAtBudgetFetch[heapIndex];
-            }
-        }
-        m_Budget.m_OperationsSinceBudgetFetch = 0;
-    }
-}
-
-#endif // #if VMA_MEMORY_BUDGET
-
-void VmaAllocator_T::FillAllocation(const VmaAllocation hAllocation, uint8_t pattern)
-{
-    if(VMA_DEBUG_INITIALIZE_ALLOCATIONS &&
-        !hAllocation->CanBecomeLost() &&
-        (m_MemProps.memoryTypes[hAllocation->GetMemoryTypeIndex()].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)
-    {
-        void* pData = VMA_NULL;
-        VkResult res = Map(hAllocation, &pData);
-        if(res == VK_SUCCESS)
-        {
-            memset(pData, (int)pattern, (size_t)hAllocation->GetSize());
-            FlushOrInvalidateAllocation(hAllocation, 0, VK_WHOLE_SIZE, VMA_CACHE_FLUSH);
-            Unmap(hAllocation);
-        }
-        else
-        {
-            VMA_ASSERT(0 && "VMA_DEBUG_INITIALIZE_ALLOCATIONS is enabled, but couldn't map memory to fill allocation.");
-        }
-    }
-}
-
-uint32_t VmaAllocator_T::GetGpuDefragmentationMemoryTypeBits()
-{
-    uint32_t memoryTypeBits = m_GpuDefragmentationMemoryTypeBits.load();
-    if(memoryTypeBits == UINT32_MAX)
-    {
-        memoryTypeBits = CalculateGpuDefragmentationMemoryTypeBits();
-        m_GpuDefragmentationMemoryTypeBits.store(memoryTypeBits);
-    }
-    return memoryTypeBits;
-}
-
-#if VMA_STATS_STRING_ENABLED
-
-void VmaAllocator_T::PrintDetailedMap(VmaJsonWriter& json)
-{
-    bool dedicatedAllocationsStarted = false;
-    for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)
-    {
-        VmaMutexLockRead dedicatedAllocationsLock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);
-        AllocationVectorType* const pDedicatedAllocVector = m_pDedicatedAllocations[memTypeIndex];
-        VMA_ASSERT(pDedicatedAllocVector);
-        if(pDedicatedAllocVector->empty() == false)
-        {
-            if(dedicatedAllocationsStarted == false)
-            {
-                dedicatedAllocationsStarted = true;
-                json.WriteString("DedicatedAllocations");
-                json.BeginObject();
-            }
-
-            json.BeginString("Type ");
-            json.ContinueString(memTypeIndex);
-            json.EndString();
-                
-            json.BeginArray();
-
-            for(size_t i = 0; i < pDedicatedAllocVector->size(); ++i)
-            {
-                json.BeginObject(true);
-                const VmaAllocation hAlloc = (*pDedicatedAllocVector)[i];
-                hAlloc->PrintParameters(json);
-                json.EndObject();
-            }
-
-            json.EndArray();
-        }
-    }
-    if(dedicatedAllocationsStarted)
-    {
-        json.EndObject();
-    }
-
-    {
-        bool allocationsStarted = false;
-        for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)
-        {
-            if(m_pBlockVectors[memTypeIndex]->IsEmpty() == false)
-            {
-                if(allocationsStarted == false)
-                {
-                    allocationsStarted = true;
-                    json.WriteString("DefaultPools");
-                    json.BeginObject();
-                }
-
-                json.BeginString("Type ");
-                json.ContinueString(memTypeIndex);
-                json.EndString();
-
-                m_pBlockVectors[memTypeIndex]->PrintDetailedMap(json);
-            }
-        }
-        if(allocationsStarted)
-        {
-            json.EndObject();
-        }
-    }
-
-    // Custom pools
-    {
-        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);
-        const size_t poolCount = m_Pools.size();
-        if(poolCount > 0)
-        {
-            json.WriteString("Pools");
-            json.BeginObject();
-            for(size_t poolIndex = 0; poolIndex < poolCount; ++poolIndex)
-            {
-                json.BeginString();
-                json.ContinueString(m_Pools[poolIndex]->GetId());
-                json.EndString();
-
-                m_Pools[poolIndex]->m_BlockVector.PrintDetailedMap(json);
-            }
-            json.EndObject();
-        }
-    }
-}
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-////////////////////////////////////////////////////////////////////////////////
-// Public interface
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAllocator(
-    const VmaAllocatorCreateInfo* pCreateInfo,
-    VmaAllocator* pAllocator)
-{
-    VMA_ASSERT(pCreateInfo && pAllocator);
-    VMA_ASSERT(pCreateInfo->vulkanApiVersion == 0 ||
-        (VK_VERSION_MAJOR(pCreateInfo->vulkanApiVersion) == 1 && VK_VERSION_MINOR(pCreateInfo->vulkanApiVersion) <= 2));
-    VMA_DEBUG_LOG("vmaCreateAllocator");
-    *pAllocator = vma_new(pCreateInfo->pAllocationCallbacks, VmaAllocator_T)(pCreateInfo);
-    return (*pAllocator)->Init(pCreateInfo);
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaDestroyAllocator(
-    VmaAllocator allocator)
-{
-    if(allocator != VK_NULL_HANDLE)
-    {
-        VMA_DEBUG_LOG("vmaDestroyAllocator");
-        VkAllocationCallbacks allocationCallbacks = allocator->m_AllocationCallbacks;
-        vma_delete(&allocationCallbacks, allocator);
-    }
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocatorInfo(VmaAllocator allocator, VmaAllocatorInfo* pAllocatorInfo)
-{
-    VMA_ASSERT(allocator && pAllocatorInfo);
-    pAllocatorInfo->instance = allocator->m_hInstance;
-    pAllocatorInfo->physicalDevice = allocator->GetPhysicalDevice();
-    pAllocatorInfo->device = allocator->m_hDevice;
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaGetPhysicalDeviceProperties(
-    VmaAllocator allocator,
-    const VkPhysicalDeviceProperties **ppPhysicalDeviceProperties)
-{
-    VMA_ASSERT(allocator && ppPhysicalDeviceProperties);
-    *ppPhysicalDeviceProperties = &allocator->m_PhysicalDeviceProperties;
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryProperties(
-    VmaAllocator allocator,
-    const VkPhysicalDeviceMemoryProperties** ppPhysicalDeviceMemoryProperties)
-{
-    VMA_ASSERT(allocator && ppPhysicalDeviceMemoryProperties);
-    *ppPhysicalDeviceMemoryProperties = &allocator->m_MemProps;
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryTypeProperties(
-    VmaAllocator allocator,
-    uint32_t memoryTypeIndex,
-    VkMemoryPropertyFlags* pFlags)
-{
-    VMA_ASSERT(allocator && pFlags);
-    VMA_ASSERT(memoryTypeIndex < allocator->GetMemoryTypeCount());
-    *pFlags = allocator->m_MemProps.memoryTypes[memoryTypeIndex].propertyFlags;
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaSetCurrentFrameIndex(
-    VmaAllocator allocator,
-    uint32_t frameIndex)
-{
-    VMA_ASSERT(allocator);
-    VMA_ASSERT(frameIndex != VMA_FRAME_INDEX_LOST);
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    allocator->SetCurrentFrameIndex(frameIndex);
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaCalculateStats(
-    VmaAllocator allocator,
-    VmaStats* pStats)
-{
-    VMA_ASSERT(allocator && pStats);
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-    allocator->CalculateStats(pStats);
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaGetBudget(
-    VmaAllocator allocator,
-    VmaBudget* pBudget)
-{
-    VMA_ASSERT(allocator && pBudget);
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-    allocator->GetBudget(pBudget, 0, allocator->GetMemoryHeapCount());
-}
-
-#if VMA_STATS_STRING_ENABLED
-
-VMA_CALL_PRE void VMA_CALL_POST vmaBuildStatsString(
-    VmaAllocator allocator,
-    char** ppStatsString,
-    VkBool32 detailedMap)
-{
-    VMA_ASSERT(allocator && ppStatsString);
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    VmaStringBuilder sb(allocator);
-    {
-        VmaJsonWriter json(allocator->GetAllocationCallbacks(), sb);
-        json.BeginObject();
-
-        VmaBudget budget[VK_MAX_MEMORY_HEAPS];
-        allocator->GetBudget(budget, 0, allocator->GetMemoryHeapCount());
-
-        VmaStats stats;
-        allocator->CalculateStats(&stats);
-
-        json.WriteString("Total");
-        VmaPrintStatInfo(json, stats.total);
-    
-        for(uint32_t heapIndex = 0; heapIndex < allocator->GetMemoryHeapCount(); ++heapIndex)
-        {
-            json.BeginString("Heap ");
-            json.ContinueString(heapIndex);
-            json.EndString();
-            json.BeginObject();
-
-            json.WriteString("Size");
-            json.WriteNumber(allocator->m_MemProps.memoryHeaps[heapIndex].size);
-
-            json.WriteString("Flags");
-            json.BeginArray(true);
-            if((allocator->m_MemProps.memoryHeaps[heapIndex].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) != 0)
-            {
-                json.WriteString("DEVICE_LOCAL");
-            }
-            json.EndArray();
-
-            json.WriteString("Budget");
-            json.BeginObject();
-            {
-                json.WriteString("BlockBytes");
-                json.WriteNumber(budget[heapIndex].blockBytes);
-                json.WriteString("AllocationBytes");
-                json.WriteNumber(budget[heapIndex].allocationBytes);
-                json.WriteString("Usage");
-                json.WriteNumber(budget[heapIndex].usage);
-                json.WriteString("Budget");
-                json.WriteNumber(budget[heapIndex].budget);
-            }
-            json.EndObject();
-
-            if(stats.memoryHeap[heapIndex].blockCount > 0)
-            {
-                json.WriteString("Stats");
-                VmaPrintStatInfo(json, stats.memoryHeap[heapIndex]);
-            }
-
-            for(uint32_t typeIndex = 0; typeIndex < allocator->GetMemoryTypeCount(); ++typeIndex)
-            {
-                if(allocator->MemoryTypeIndexToHeapIndex(typeIndex) == heapIndex)
-                {
-                    json.BeginString("Type ");
-                    json.ContinueString(typeIndex);
-                    json.EndString();
-
-                    json.BeginObject();
-
-                    json.WriteString("Flags");
-                    json.BeginArray(true);
-                    VkMemoryPropertyFlags flags = allocator->m_MemProps.memoryTypes[typeIndex].propertyFlags;
-                    if((flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0)
-                    {
-                        json.WriteString("DEVICE_LOCAL");
-                    }
-                    if((flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)
-                    {
-                        json.WriteString("HOST_VISIBLE");
-                    }
-                    if((flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) != 0)
-                    {
-                        json.WriteString("HOST_COHERENT");
-                    }
-                    if((flags & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) != 0)
-                    {
-                        json.WriteString("HOST_CACHED");
-                    }
-                    if((flags & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) != 0)
-                    {
-                        json.WriteString("LAZILY_ALLOCATED");
-                    }
-                    if((flags & VK_MEMORY_PROPERTY_PROTECTED_BIT) != 0)
-                    {
-                        json.WriteString(" PROTECTED");
-                    }
-                    if((flags & VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY) != 0)
-                    {
-                        json.WriteString(" DEVICE_COHERENT");
-                    }
-                    if((flags & VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY) != 0)
-                    {
-                        json.WriteString(" DEVICE_UNCACHED");
-                    }
-                    json.EndArray();
-
-                    if(stats.memoryType[typeIndex].blockCount > 0)
-                    {
-                        json.WriteString("Stats");
-                        VmaPrintStatInfo(json, stats.memoryType[typeIndex]);
-                    }
-
-                    json.EndObject();
-                }
-            }
-
-            json.EndObject();
-        }
-        if(detailedMap == VK_TRUE)
-        {
-            allocator->PrintDetailedMap(json);
-        }
-
-        json.EndObject();
-    }
-
-    const size_t len = sb.GetLength();
-    char* const pChars = vma_new_array(allocator, char, len + 1);
-    if(len > 0)
-    {
-        memcpy(pChars, sb.GetData(), len);
-    }
-    pChars[len] = '\0';
-    *ppStatsString = pChars;
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(
-    VmaAllocator allocator,
-    char* pStatsString)
-{
-    if(pStatsString != VMA_NULL)
-    {
-        VMA_ASSERT(allocator);
-        size_t len = strlen(pStatsString);
-        vma_delete_array(allocator, pStatsString, len + 1);
-    }
-}
-
-#endif // #if VMA_STATS_STRING_ENABLED
-
-/*
-This function is not protected by any mutex because it just reads immutable data.
-*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndex(
-    VmaAllocator allocator,
-    uint32_t memoryTypeBits,
-    const VmaAllocationCreateInfo* pAllocationCreateInfo,
-    uint32_t* pMemoryTypeIndex)
-{
-    VMA_ASSERT(allocator != VK_NULL_HANDLE);
-    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);
-    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);
-
-    memoryTypeBits &= allocator->GetGlobalMemoryTypeBits();
-
-    if(pAllocationCreateInfo->memoryTypeBits != 0)
-    {
-        memoryTypeBits &= pAllocationCreateInfo->memoryTypeBits;
-    }
-    
-    uint32_t requiredFlags = pAllocationCreateInfo->requiredFlags;
-    uint32_t preferredFlags = pAllocationCreateInfo->preferredFlags;
-    uint32_t notPreferredFlags = 0;
-
-    // Convert usage to requiredFlags and preferredFlags.
-    switch(pAllocationCreateInfo->usage)
-    {
-    case VMA_MEMORY_USAGE_UNKNOWN:
-        break;
-    case VMA_MEMORY_USAGE_GPU_ONLY:
-        if(!allocator->IsIntegratedGpu() || (preferredFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
-        {
-            preferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
-        }
-        break;
-    case VMA_MEMORY_USAGE_CPU_ONLY:
-        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
-        break;
-    case VMA_MEMORY_USAGE_CPU_TO_GPU:
-        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
-        if(!allocator->IsIntegratedGpu() || (preferredFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
-        {
-            preferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
-        }
-        break;
-    case VMA_MEMORY_USAGE_GPU_TO_CPU:
-        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
-        preferredFlags |= VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
-        break;
-    case VMA_MEMORY_USAGE_CPU_COPY:
-        notPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
-        break;
-    case VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED:
-        requiredFlags |= VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT;
-        break;
-    default:
-        VMA_ASSERT(0);
-        break;
-    }
-
-    // Avoid DEVICE_COHERENT unless explicitly requested.
-    if(((pAllocationCreateInfo->requiredFlags | pAllocationCreateInfo->preferredFlags) &
-        (VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY | VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY)) == 0)
-    {
-        notPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY;
-    }
-
-    *pMemoryTypeIndex = UINT32_MAX;
-    uint32_t minCost = UINT32_MAX;
-    for(uint32_t memTypeIndex = 0, memTypeBit = 1;
-        memTypeIndex < allocator->GetMemoryTypeCount();
-        ++memTypeIndex, memTypeBit <<= 1)
-    {
-        // This memory type is acceptable according to memoryTypeBits bitmask.
-        if((memTypeBit & memoryTypeBits) != 0)
-        {
-            const VkMemoryPropertyFlags currFlags =
-                allocator->m_MemProps.memoryTypes[memTypeIndex].propertyFlags;
-            // This memory type contains requiredFlags.
-            if((requiredFlags & ~currFlags) == 0)
-            {
-                // Calculate cost as number of bits from preferredFlags not present in this memory type.
-                uint32_t currCost = VmaCountBitsSet(preferredFlags & ~currFlags) +
-                    VmaCountBitsSet(currFlags & notPreferredFlags);
-                // Remember memory type with lowest cost.
-                if(currCost < minCost)
-                {
-                    *pMemoryTypeIndex = memTypeIndex;
-                    if(currCost == 0)
-                    {
-                        return VK_SUCCESS;
-                    }
-                    minCost = currCost;
-                }
-            }
-        }
-    }
-    return (*pMemoryTypeIndex != UINT32_MAX) ? VK_SUCCESS : VK_ERROR_FEATURE_NOT_PRESENT;
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForBufferInfo(
-    VmaAllocator allocator,
-    const VkBufferCreateInfo* pBufferCreateInfo,
-    const VmaAllocationCreateInfo* pAllocationCreateInfo,
-    uint32_t* pMemoryTypeIndex)
-{
-    VMA_ASSERT(allocator != VK_NULL_HANDLE);
-    VMA_ASSERT(pBufferCreateInfo != VMA_NULL);
-    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);
-    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);
-
-    const VkDevice hDev = allocator->m_hDevice;
-    VkBuffer hBuffer = VK_NULL_HANDLE;
-    VkResult res = allocator->GetVulkanFunctions().vkCreateBuffer(
-        hDev, pBufferCreateInfo, allocator->GetAllocationCallbacks(), &hBuffer);
-    if(res == VK_SUCCESS)
-    {
-        VkMemoryRequirements memReq = {};
-        allocator->GetVulkanFunctions().vkGetBufferMemoryRequirements(
-            hDev, hBuffer, &memReq);
-
-        res = vmaFindMemoryTypeIndex(
-            allocator,
-            memReq.memoryTypeBits,
-            pAllocationCreateInfo,
-            pMemoryTypeIndex);
-
-        allocator->GetVulkanFunctions().vkDestroyBuffer(
-            hDev, hBuffer, allocator->GetAllocationCallbacks());
-    }
-    return res;
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForImageInfo(
-    VmaAllocator allocator,
-    const VkImageCreateInfo* pImageCreateInfo,
-    const VmaAllocationCreateInfo* pAllocationCreateInfo,
-    uint32_t* pMemoryTypeIndex)
-{
-    VMA_ASSERT(allocator != VK_NULL_HANDLE);
-    VMA_ASSERT(pImageCreateInfo != VMA_NULL);
-    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);
-    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);
-
-    const VkDevice hDev = allocator->m_hDevice;
-    VkImage hImage = VK_NULL_HANDLE;
-    VkResult res = allocator->GetVulkanFunctions().vkCreateImage(
-        hDev, pImageCreateInfo, allocator->GetAllocationCallbacks(), &hImage);
-    if(res == VK_SUCCESS)
-    {
-        VkMemoryRequirements memReq = {};
-        allocator->GetVulkanFunctions().vkGetImageMemoryRequirements(
-            hDev, hImage, &memReq);
-
-        res = vmaFindMemoryTypeIndex(
-            allocator,
-            memReq.memoryTypeBits,
-            pAllocationCreateInfo,
-            pMemoryTypeIndex);
-
-        allocator->GetVulkanFunctions().vkDestroyImage(
-            hDev, hImage, allocator->GetAllocationCallbacks());
-    }
-    return res;
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreatePool(
-	VmaAllocator allocator,
-	const VmaPoolCreateInfo* pCreateInfo,
-	VmaPool* pPool)
-{
-    VMA_ASSERT(allocator && pCreateInfo && pPool);
-    
-    VMA_DEBUG_LOG("vmaCreatePool");
-    
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-    
-    VkResult res = allocator->CreatePool(pCreateInfo, pPool);
-    
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordCreatePool(allocator->GetCurrentFrameIndex(), *pCreateInfo, *pPool);
-    }
-#endif
-    
-    return res;
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaDestroyPool(
-    VmaAllocator allocator,
-    VmaPool pool)
-{
-    VMA_ASSERT(allocator);
-    
-    if(pool == VK_NULL_HANDLE)
-    {
-        return;
-    }
-    
-    VMA_DEBUG_LOG("vmaDestroyPool");
-    
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-    
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordDestroyPool(allocator->GetCurrentFrameIndex(), pool);
-    }
-#endif
-
-    allocator->DestroyPool(pool);
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolStats(
-    VmaAllocator allocator,
-    VmaPool pool,
-    VmaPoolStats* pPoolStats)
-{
-    VMA_ASSERT(allocator && pool && pPoolStats);
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    allocator->GetPoolStats(pool, pPoolStats);
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaMakePoolAllocationsLost(
-    VmaAllocator allocator,
-    VmaPool pool,
-    size_t* pLostAllocationCount)
-{
-    VMA_ASSERT(allocator && pool);
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordMakePoolAllocationsLost(allocator->GetCurrentFrameIndex(), pool);
-    }
-#endif
-
-    allocator->MakePoolAllocationsLost(pool, pLostAllocationCount);
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckPoolCorruption(VmaAllocator allocator, VmaPool pool)
-{
-    VMA_ASSERT(allocator && pool);
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    VMA_DEBUG_LOG("vmaCheckPoolCorruption");
-
-    return allocator->CheckPoolCorruption(pool);
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolName(
-    VmaAllocator allocator,
-    VmaPool pool,
-    const char** ppName)
-{
-    VMA_ASSERT(allocator && pool && ppName);
-    
-    VMA_DEBUG_LOG("vmaGetPoolName");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    *ppName = pool->GetName();
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaSetPoolName(
-    VmaAllocator allocator,
-    VmaPool pool,
-    const char* pName)
-{
-    VMA_ASSERT(allocator && pool);
-
-    VMA_DEBUG_LOG("vmaSetPoolName");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    pool->SetName(pName);
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordSetPoolName(allocator->GetCurrentFrameIndex(), pool, pName);
-    }
-#endif
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemory(
-    VmaAllocator allocator,
-    const VkMemoryRequirements* pVkMemoryRequirements,
-    const VmaAllocationCreateInfo* pCreateInfo,
-    VmaAllocation* pAllocation,
-    VmaAllocationInfo* pAllocationInfo)
-{
-    VMA_ASSERT(allocator && pVkMemoryRequirements && pCreateInfo && pAllocation);
-
-    VMA_DEBUG_LOG("vmaAllocateMemory");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-	VkResult result = allocator->AllocateMemory(
-        *pVkMemoryRequirements,
-        false, // requiresDedicatedAllocation
-        false, // prefersDedicatedAllocation
-        VK_NULL_HANDLE, // dedicatedBuffer
-        UINT32_MAX, // dedicatedBufferUsage
-        VK_NULL_HANDLE, // dedicatedImage
-        *pCreateInfo,
-        VMA_SUBALLOCATION_TYPE_UNKNOWN,
-        1, // allocationCount
-        pAllocation);
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordAllocateMemory(
-            allocator->GetCurrentFrameIndex(),
-            *pVkMemoryRequirements,
-            *pCreateInfo,
-            *pAllocation);
-    }
-#endif
-        
-    if(pAllocationInfo != VMA_NULL && result == VK_SUCCESS)
-    {
-        allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);
-    }
-
-	return result;
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryPages(
-    VmaAllocator allocator,
-    const VkMemoryRequirements* pVkMemoryRequirements,
-    const VmaAllocationCreateInfo* pCreateInfo,
-    size_t allocationCount,
-    VmaAllocation* pAllocations,
-    VmaAllocationInfo* pAllocationInfo)
-{
-    if(allocationCount == 0)
-    {
-        return VK_SUCCESS;
-    }
-
-    VMA_ASSERT(allocator && pVkMemoryRequirements && pCreateInfo && pAllocations);
-
-    VMA_DEBUG_LOG("vmaAllocateMemoryPages");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-	VkResult result = allocator->AllocateMemory(
-        *pVkMemoryRequirements,
-        false, // requiresDedicatedAllocation
-        false, // prefersDedicatedAllocation
-        VK_NULL_HANDLE, // dedicatedBuffer
-        UINT32_MAX, // dedicatedBufferUsage
-        VK_NULL_HANDLE, // dedicatedImage
-        *pCreateInfo,
-        VMA_SUBALLOCATION_TYPE_UNKNOWN,
-        allocationCount,
-        pAllocations);
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordAllocateMemoryPages(
-            allocator->GetCurrentFrameIndex(),
-            *pVkMemoryRequirements,
-            *pCreateInfo,
-            (uint64_t)allocationCount,
-            pAllocations);
-    }
-#endif
-        
-    if(pAllocationInfo != VMA_NULL && result == VK_SUCCESS)
-    {
-        for(size_t i = 0; i < allocationCount; ++i)
-        {
-            allocator->GetAllocationInfo(pAllocations[i], pAllocationInfo + i);
-        }
-    }
-
-	return result;
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForBuffer(
-    VmaAllocator allocator,
-    VkBuffer buffer,
-    const VmaAllocationCreateInfo* pCreateInfo,
-    VmaAllocation* pAllocation,
-    VmaAllocationInfo* pAllocationInfo)
-{
-    VMA_ASSERT(allocator && buffer != VK_NULL_HANDLE && pCreateInfo && pAllocation);
-
-    VMA_DEBUG_LOG("vmaAllocateMemoryForBuffer");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    VkMemoryRequirements vkMemReq = {};
-    bool requiresDedicatedAllocation = false;
-    bool prefersDedicatedAllocation = false;
-    allocator->GetBufferMemoryRequirements(buffer, vkMemReq,
-        requiresDedicatedAllocation,
-        prefersDedicatedAllocation);
-
-    VkResult result = allocator->AllocateMemory(
-        vkMemReq,
-        requiresDedicatedAllocation,
-        prefersDedicatedAllocation,
-        buffer, // dedicatedBuffer
-        UINT32_MAX, // dedicatedBufferUsage
-        VK_NULL_HANDLE, // dedicatedImage
-        *pCreateInfo,
-        VMA_SUBALLOCATION_TYPE_BUFFER,
-        1, // allocationCount
-        pAllocation);
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordAllocateMemoryForBuffer(
-            allocator->GetCurrentFrameIndex(),
-            vkMemReq,
-            requiresDedicatedAllocation,
-            prefersDedicatedAllocation,
-            *pCreateInfo,
-            *pAllocation);
-    }
-#endif
-
-    if(pAllocationInfo && result == VK_SUCCESS)
-    {
-        allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);
-    }
-
-	return result;
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForImage(
-    VmaAllocator allocator,
-    VkImage image,
-    const VmaAllocationCreateInfo* pCreateInfo,
-    VmaAllocation* pAllocation,
-    VmaAllocationInfo* pAllocationInfo)
-{
-    VMA_ASSERT(allocator && image != VK_NULL_HANDLE && pCreateInfo && pAllocation);
-
-    VMA_DEBUG_LOG("vmaAllocateMemoryForImage");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    VkMemoryRequirements vkMemReq = {};
-    bool requiresDedicatedAllocation = false;
-    bool prefersDedicatedAllocation  = false;
-    allocator->GetImageMemoryRequirements(image, vkMemReq,
-        requiresDedicatedAllocation, prefersDedicatedAllocation);
-
-    VkResult result = allocator->AllocateMemory(
-        vkMemReq,
-        requiresDedicatedAllocation,
-        prefersDedicatedAllocation,
-        VK_NULL_HANDLE, // dedicatedBuffer
-        UINT32_MAX, // dedicatedBufferUsage
-        image, // dedicatedImage
-        *pCreateInfo,
-        VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN,
-        1, // allocationCount
-        pAllocation);
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordAllocateMemoryForImage(
-            allocator->GetCurrentFrameIndex(),
-            vkMemReq,
-            requiresDedicatedAllocation,
-            prefersDedicatedAllocation,
-            *pCreateInfo,
-            *pAllocation);
-    }
-#endif
-
-    if(pAllocationInfo && result == VK_SUCCESS)
-    {
-        allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);
-    }
-
-	return result;
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemory(
-    VmaAllocator allocator,
-    VmaAllocation allocation)
-{
-    VMA_ASSERT(allocator);
-    
-    if(allocation == VK_NULL_HANDLE)
-    {
-        return;
-    }
-    
-    VMA_DEBUG_LOG("vmaFreeMemory");
-    
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordFreeMemory(
-            allocator->GetCurrentFrameIndex(),
-            allocation);
-    }
-#endif
-    
-    allocator->FreeMemory(
-        1, // allocationCount
-        &allocation);
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemoryPages(
-    VmaAllocator allocator,
-    size_t allocationCount,
-    const VmaAllocation* pAllocations)
-{
-    if(allocationCount == 0)
-    {
-        return;
-    }
-
-    VMA_ASSERT(allocator);
-    
-    VMA_DEBUG_LOG("vmaFreeMemoryPages");
-    
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordFreeMemoryPages(
-            allocator->GetCurrentFrameIndex(),
-            (uint64_t)allocationCount,
-            pAllocations);
-    }
-#endif
-    
-    allocator->FreeMemory(allocationCount, pAllocations);
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaResizeAllocation(
-    VmaAllocator allocator,
-    VmaAllocation allocation,
-    VkDeviceSize newSize)
-{
-    VMA_ASSERT(allocator && allocation);
-    
-    VMA_DEBUG_LOG("vmaResizeAllocation");
-    
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    return allocator->ResizeAllocation(allocation, newSize);
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocationInfo(
-    VmaAllocator allocator,
-    VmaAllocation allocation,
-    VmaAllocationInfo* pAllocationInfo)
-{
-    VMA_ASSERT(allocator && allocation && pAllocationInfo);
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordGetAllocationInfo(
-            allocator->GetCurrentFrameIndex(),
-            allocation);
-    }
-#endif
-
-    allocator->GetAllocationInfo(allocation, pAllocationInfo);
-}
-
-VMA_CALL_PRE VkBool32 VMA_CALL_POST vmaTouchAllocation(
-    VmaAllocator allocator,
-    VmaAllocation allocation)
-{
-    VMA_ASSERT(allocator && allocation);
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordTouchAllocation(
-            allocator->GetCurrentFrameIndex(),
-            allocation);
-    }
-#endif
-
-    return allocator->TouchAllocation(allocation);
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaSetAllocationUserData(
-    VmaAllocator allocator,
-    VmaAllocation allocation,
-    void* pUserData)
-{
-    VMA_ASSERT(allocator && allocation);
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    allocation->SetUserData(allocator, pUserData);
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordSetAllocationUserData(
-            allocator->GetCurrentFrameIndex(),
-            allocation,
-            pUserData);
-    }
-#endif
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaCreateLostAllocation(
-    VmaAllocator allocator,
-    VmaAllocation* pAllocation)
-{
-    VMA_ASSERT(allocator && pAllocation);
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK;
-
-    allocator->CreateLostAllocation(pAllocation);
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordCreateLostAllocation(
-            allocator->GetCurrentFrameIndex(),
-            *pAllocation);
-    }
-#endif
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaMapMemory(
-    VmaAllocator allocator,
-    VmaAllocation allocation,
-    void** ppData)
-{
-    VMA_ASSERT(allocator && allocation && ppData);
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    VkResult res = allocator->Map(allocation, ppData);
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordMapMemory(
-            allocator->GetCurrentFrameIndex(),
-            allocation);
-    }
-#endif
-
-    return res;
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaUnmapMemory(
-    VmaAllocator allocator,
-    VmaAllocation allocation)
-{
-    VMA_ASSERT(allocator && allocation);
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordUnmapMemory(
-            allocator->GetCurrentFrameIndex(),
-            allocation);
-    }
-#endif
-
-    allocator->Unmap(allocation);
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaFlushAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)
-{
-    VMA_ASSERT(allocator && allocation);
-
-    VMA_DEBUG_LOG("vmaFlushAllocation");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    VkResult res = allocator->FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_FLUSH);
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordFlushAllocation(
-            allocator->GetCurrentFrameIndex(),
-            allocation, offset, size);
-    }
-#endif
-
-    return res;
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaInvalidateAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)
-{
-    VMA_ASSERT(allocator && allocation);
-
-    VMA_DEBUG_LOG("vmaInvalidateAllocation");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    VkResult res = allocator->FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_INVALIDATE);
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordInvalidateAllocation(
-            allocator->GetCurrentFrameIndex(),
-            allocation, offset, size);
-    }
-#endif
-
-    return res;
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckCorruption(VmaAllocator allocator, uint32_t memoryTypeBits)
-{
-    VMA_ASSERT(allocator);
-
-    VMA_DEBUG_LOG("vmaCheckCorruption");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    return allocator->CheckCorruption(memoryTypeBits);
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragment(
-    VmaAllocator allocator,
-    const VmaAllocation* pAllocations,
-    size_t allocationCount,
-    VkBool32* pAllocationsChanged,
-    const VmaDefragmentationInfo *pDefragmentationInfo,
-    VmaDefragmentationStats* pDefragmentationStats)
-{
-    // Deprecated interface, reimplemented using new one.
-
-    VmaDefragmentationInfo2 info2 = {};
-    info2.allocationCount = (uint32_t)allocationCount;
-    info2.pAllocations = pAllocations;
-    info2.pAllocationsChanged = pAllocationsChanged;
-    if(pDefragmentationInfo != VMA_NULL)
-    {
-        info2.maxCpuAllocationsToMove = pDefragmentationInfo->maxAllocationsToMove;
-        info2.maxCpuBytesToMove = pDefragmentationInfo->maxBytesToMove;
-    }
-    else
-    {
-        info2.maxCpuAllocationsToMove = UINT32_MAX;
-        info2.maxCpuBytesToMove = VK_WHOLE_SIZE;
-    }
-    // info2.flags, maxGpuAllocationsToMove, maxGpuBytesToMove, commandBuffer deliberately left zero.
-
-    VmaDefragmentationContext ctx;
-    VkResult res = vmaDefragmentationBegin(allocator, &info2, pDefragmentationStats, &ctx);
-    if(res == VK_NOT_READY)
-    {
-        res = vmaDefragmentationEnd( allocator, ctx);
-    }
-    return res;
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragmentationBegin(
-    VmaAllocator allocator,
-    const VmaDefragmentationInfo2* pInfo,
-    VmaDefragmentationStats* pStats,
-    VmaDefragmentationContext *pContext)
-{
-    VMA_ASSERT(allocator && pInfo && pContext);
-
-    // Degenerate case: Nothing to defragment.
-    if(pInfo->allocationCount == 0 && pInfo->poolCount == 0)
-    {
-        return VK_SUCCESS;
-    }
-
-    VMA_ASSERT(pInfo->allocationCount == 0 || pInfo->pAllocations != VMA_NULL);
-    VMA_ASSERT(pInfo->poolCount == 0 || pInfo->pPools != VMA_NULL);
-    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo->allocationCount, pInfo->pAllocations));
-    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo->poolCount, pInfo->pPools));
-
-    VMA_DEBUG_LOG("vmaDefragmentationBegin");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    VkResult res = allocator->DefragmentationBegin(*pInfo, pStats, pContext);
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordDefragmentationBegin(
-            allocator->GetCurrentFrameIndex(), *pInfo, *pContext);
-    }
-#endif
-
-    return res;
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragmentationEnd(
-    VmaAllocator allocator,
-    VmaDefragmentationContext context)
-{
-    VMA_ASSERT(allocator);
-
-    VMA_DEBUG_LOG("vmaDefragmentationEnd");
-
-    if(context != VK_NULL_HANDLE)
-    {
-        VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-#if VMA_RECORDING_ENABLED
-        if(allocator->GetRecorder() != VMA_NULL)
-        {
-            allocator->GetRecorder()->RecordDefragmentationEnd(
-                allocator->GetCurrentFrameIndex(), context);
-        }
-#endif
-
-        return allocator->DefragmentationEnd(context);
-    }
-    else
-    {
-        return VK_SUCCESS;
-    }
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentationPass(
-    VmaAllocator allocator,
-    VmaDefragmentationContext context,
-    VmaDefragmentationPassInfo* pInfo
-    )
-{
-    VMA_ASSERT(allocator);
-    VMA_ASSERT(pInfo);
-    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo->moveCount, pInfo->pMoves));
-
-    VMA_DEBUG_LOG("vmaBeginDefragmentationPass");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    if(context == VK_NULL_HANDLE)
-    {
-        pInfo->moveCount = 0;
-        return VK_SUCCESS;
-    }
-
-    return allocator->DefragmentationPassBegin(pInfo, context);
-}
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentationPass(
-    VmaAllocator allocator,
-    VmaDefragmentationContext context)
-{
-    VMA_ASSERT(allocator);
-
-    VMA_DEBUG_LOG("vmaEndDefragmentationPass");
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    if(context == VK_NULL_HANDLE)
-        return VK_SUCCESS;
-
-    return allocator->DefragmentationPassEnd(context);
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory(
-    VmaAllocator allocator,
-    VmaAllocation allocation,
-    VkBuffer buffer)
-{
-    VMA_ASSERT(allocator && allocation && buffer);
-
-    VMA_DEBUG_LOG("vmaBindBufferMemory");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    return allocator->BindBufferMemory(allocation, 0, buffer, VMA_NULL);
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory2(
-    VmaAllocator allocator,
-    VmaAllocation allocation,
-    VkDeviceSize allocationLocalOffset,
-    VkBuffer buffer,
-    const void* pNext)
-{
-    VMA_ASSERT(allocator && allocation && buffer);
-
-    VMA_DEBUG_LOG("vmaBindBufferMemory2");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    return allocator->BindBufferMemory(allocation, allocationLocalOffset, buffer, pNext);
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory(
-    VmaAllocator allocator,
-    VmaAllocation allocation,
-    VkImage image)
-{
-    VMA_ASSERT(allocator && allocation && image);
-
-    VMA_DEBUG_LOG("vmaBindImageMemory");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    return allocator->BindImageMemory(allocation, 0, image, VMA_NULL);
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory2(
-    VmaAllocator allocator,
-    VmaAllocation allocation,
-    VkDeviceSize allocationLocalOffset,
-    VkImage image,
-    const void* pNext)
-{
-    VMA_ASSERT(allocator && allocation && image);
-
-    VMA_DEBUG_LOG("vmaBindImageMemory2");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-        return allocator->BindImageMemory(allocation, allocationLocalOffset, image, pNext);
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateBuffer(
-    VmaAllocator allocator,
-    const VkBufferCreateInfo* pBufferCreateInfo,
-    const VmaAllocationCreateInfo* pAllocationCreateInfo,
-    VkBuffer* pBuffer,
-    VmaAllocation* pAllocation,
-    VmaAllocationInfo* pAllocationInfo)
-{
-    VMA_ASSERT(allocator && pBufferCreateInfo && pAllocationCreateInfo && pBuffer && pAllocation);
-
-    if(pBufferCreateInfo->size == 0)
-    {
-        return VK_ERROR_VALIDATION_FAILED_EXT;
-    }
-    if((pBufferCreateInfo->usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_COPY) != 0 &&
-        !allocator->m_UseKhrBufferDeviceAddress)
-    {
-        VMA_ASSERT(0 && "Creating a buffer with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT is not valid if VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT was not used.");
-        return VK_ERROR_VALIDATION_FAILED_EXT;
-    }
-    
-    VMA_DEBUG_LOG("vmaCreateBuffer");
-    
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    *pBuffer = VK_NULL_HANDLE;
-    *pAllocation = VK_NULL_HANDLE;
-
-    // 1. Create VkBuffer.
-    VkResult res = (*allocator->GetVulkanFunctions().vkCreateBuffer)(
-        allocator->m_hDevice,
-        pBufferCreateInfo,
-        allocator->GetAllocationCallbacks(),
-        pBuffer);
-    if(res >= 0)
-    {
-        // 2. vkGetBufferMemoryRequirements.
-        VkMemoryRequirements vkMemReq = {};
-        bool requiresDedicatedAllocation = false;
-        bool prefersDedicatedAllocation  = false;
-        allocator->GetBufferMemoryRequirements(*pBuffer, vkMemReq,
-            requiresDedicatedAllocation, prefersDedicatedAllocation);
-
-        // 3. Allocate memory using allocator.
-        res = allocator->AllocateMemory(
-            vkMemReq,
-            requiresDedicatedAllocation,
-            prefersDedicatedAllocation,
-            *pBuffer, // dedicatedBuffer
-            pBufferCreateInfo->usage, // dedicatedBufferUsage
-            VK_NULL_HANDLE, // dedicatedImage
-            *pAllocationCreateInfo,
-            VMA_SUBALLOCATION_TYPE_BUFFER,
-            1, // allocationCount
-            pAllocation);
-
-#if VMA_RECORDING_ENABLED
-        if(allocator->GetRecorder() != VMA_NULL)
-        {
-            allocator->GetRecorder()->RecordCreateBuffer(
-                allocator->GetCurrentFrameIndex(),
-                *pBufferCreateInfo,
-                *pAllocationCreateInfo,
-                *pAllocation);
-        }
-#endif
-
-        if(res >= 0)
-        {
-            // 3. Bind buffer with memory.
-            if((pAllocationCreateInfo->flags & VMA_ALLOCATION_CREATE_DONT_BIND_BIT) == 0)
-            {
-                res = allocator->BindBufferMemory(*pAllocation, 0, *pBuffer, VMA_NULL);
-            }
-            if(res >= 0)
-            {
-                // All steps succeeded.
-                #if VMA_STATS_STRING_ENABLED
-                    (*pAllocation)->InitBufferImageUsage(pBufferCreateInfo->usage);
-                #endif
-                if(pAllocationInfo != VMA_NULL)
-                {
-                    allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);
-                }
-
-                return VK_SUCCESS;
-            }
-            allocator->FreeMemory(
-                1, // allocationCount
-                pAllocation);
-            *pAllocation = VK_NULL_HANDLE;
-            (*allocator->GetVulkanFunctions().vkDestroyBuffer)(allocator->m_hDevice, *pBuffer, allocator->GetAllocationCallbacks());
-            *pBuffer = VK_NULL_HANDLE;
-            return res;
-        }
-        (*allocator->GetVulkanFunctions().vkDestroyBuffer)(allocator->m_hDevice, *pBuffer, allocator->GetAllocationCallbacks());
-        *pBuffer = VK_NULL_HANDLE;
-        return res;
-    }
-    return res;
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaDestroyBuffer(
-    VmaAllocator allocator,
-    VkBuffer buffer,
-    VmaAllocation allocation)
-{
-    VMA_ASSERT(allocator);
-
-    if(buffer == VK_NULL_HANDLE && allocation == VK_NULL_HANDLE)
-    {
-        return;
-    }
-
-    VMA_DEBUG_LOG("vmaDestroyBuffer");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordDestroyBuffer(
-            allocator->GetCurrentFrameIndex(),
-            allocation);
-    }
-#endif
-
-    if(buffer != VK_NULL_HANDLE)
-    {
-        (*allocator->GetVulkanFunctions().vkDestroyBuffer)(allocator->m_hDevice, buffer, allocator->GetAllocationCallbacks());
-    }
-
-    if(allocation != VK_NULL_HANDLE)
-    {
-        allocator->FreeMemory(
-            1, // allocationCount
-            &allocation);
-    }
-}
-
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateImage(
-    VmaAllocator allocator,
-    const VkImageCreateInfo* pImageCreateInfo,
-    const VmaAllocationCreateInfo* pAllocationCreateInfo,
-    VkImage* pImage,
-    VmaAllocation* pAllocation,
-    VmaAllocationInfo* pAllocationInfo)
-{
-    VMA_ASSERT(allocator && pImageCreateInfo && pAllocationCreateInfo && pImage && pAllocation);
-
-    if(pImageCreateInfo->extent.width == 0 ||
-        pImageCreateInfo->extent.height == 0 ||
-        pImageCreateInfo->extent.depth == 0 ||
-        pImageCreateInfo->mipLevels == 0 ||
-        pImageCreateInfo->arrayLayers == 0)
-    {
-        return VK_ERROR_VALIDATION_FAILED_EXT;
-    }
-
-    VMA_DEBUG_LOG("vmaCreateImage");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-    *pImage = VK_NULL_HANDLE;
-    *pAllocation = VK_NULL_HANDLE;
-
-    // 1. Create VkImage.
-    VkResult res = (*allocator->GetVulkanFunctions().vkCreateImage)(
-        allocator->m_hDevice,
-        pImageCreateInfo,
-        allocator->GetAllocationCallbacks(),
-        pImage);
-    if(res >= 0)
-    {
-        VmaSuballocationType suballocType = pImageCreateInfo->tiling == VK_IMAGE_TILING_OPTIMAL ?
-            VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL :
-            VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR;
-        
-        // 2. Allocate memory using allocator.
-        VkMemoryRequirements vkMemReq = {};
-        bool requiresDedicatedAllocation = false;
-        bool prefersDedicatedAllocation  = false;
-        allocator->GetImageMemoryRequirements(*pImage, vkMemReq,
-            requiresDedicatedAllocation, prefersDedicatedAllocation);
-
-        res = allocator->AllocateMemory(
-            vkMemReq,
-            requiresDedicatedAllocation,
-            prefersDedicatedAllocation,
-            VK_NULL_HANDLE, // dedicatedBuffer
-            UINT32_MAX, // dedicatedBufferUsage
-            *pImage, // dedicatedImage
-            *pAllocationCreateInfo,
-            suballocType,
-            1, // allocationCount
-            pAllocation);
-
-#if VMA_RECORDING_ENABLED
-        if(allocator->GetRecorder() != VMA_NULL)
-        {
-            allocator->GetRecorder()->RecordCreateImage(
-                allocator->GetCurrentFrameIndex(),
-                *pImageCreateInfo,
-                *pAllocationCreateInfo,
-                *pAllocation);
-        }
-#endif
-
-        if(res >= 0)
-        {
-            // 3. Bind image with memory.
-            if((pAllocationCreateInfo->flags & VMA_ALLOCATION_CREATE_DONT_BIND_BIT) == 0)
-            {
-                res = allocator->BindImageMemory(*pAllocation, 0, *pImage, VMA_NULL);
-            }
-            if(res >= 0)
-            {
-                // All steps succeeded.
-                #if VMA_STATS_STRING_ENABLED
-                    (*pAllocation)->InitBufferImageUsage(pImageCreateInfo->usage);
-                #endif
-                if(pAllocationInfo != VMA_NULL)
-                {
-                    allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);
-                }
-
-                return VK_SUCCESS;
-            }
-            allocator->FreeMemory(
-                1, // allocationCount
-                pAllocation);
-            *pAllocation = VK_NULL_HANDLE;
-            (*allocator->GetVulkanFunctions().vkDestroyImage)(allocator->m_hDevice, *pImage, allocator->GetAllocationCallbacks());
-            *pImage = VK_NULL_HANDLE;
-            return res;
-        }
-        (*allocator->GetVulkanFunctions().vkDestroyImage)(allocator->m_hDevice, *pImage, allocator->GetAllocationCallbacks());
-        *pImage = VK_NULL_HANDLE;
-        return res;
-    }
-    return res;
-}
-
-VMA_CALL_PRE void VMA_CALL_POST vmaDestroyImage(
-    VmaAllocator allocator,
-    VkImage image,
-    VmaAllocation allocation)
-{
-    VMA_ASSERT(allocator);
-
-    if(image == VK_NULL_HANDLE && allocation == VK_NULL_HANDLE)
-    {
-        return;
-    }
-
-    VMA_DEBUG_LOG("vmaDestroyImage");
-
-    VMA_DEBUG_GLOBAL_MUTEX_LOCK
-
-#if VMA_RECORDING_ENABLED
-    if(allocator->GetRecorder() != VMA_NULL)
-    {
-        allocator->GetRecorder()->RecordDestroyImage(
-            allocator->GetCurrentFrameIndex(),
-            allocation);
-    }
-#endif
-
-    if(image != VK_NULL_HANDLE)
-    {
-        (*allocator->GetVulkanFunctions().vkDestroyImage)(allocator->m_hDevice, image, allocator->GetAllocationCallbacks());
-    }
-    if(allocation != VK_NULL_HANDLE)
-    {
-        allocator->FreeMemory(
-            1, // allocationCount
-            &allocation);
-    }
-}
-
-#endif // #ifdef VMA_IMPLEMENTATION
+//

+// Copyright (c) 2017-2020 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

+// in the Software without restriction, including without limitation the rights

+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

+// copies of the Software, and to permit persons to whom the Software is

+// furnished to do so, subject to the following conditions:

+//

+// The above copyright notice and this permission notice shall be included in

+// all copies or substantial portions of the Software.

+//

+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE

+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN

+// THE SOFTWARE.

+//

+

+#ifndef AMD_VULKAN_MEMORY_ALLOCATOR_H

+#define AMD_VULKAN_MEMORY_ALLOCATOR_H

+

+#ifdef __cplusplus

+extern "C" {

+#endif

+

+/** \mainpage Vulkan Memory Allocator

+

+<b>Version 3.0.0-development</b> (2020-03-23)

+

+Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved. \n

+License: MIT

+

+Documentation of all members: vk_mem_alloc.h

+

+\section main_table_of_contents Table of contents

+

+- <b>User guide</b>

+  - \subpage quick_start

+    - [Project setup](@ref quick_start_project_setup)

+    - [Initialization](@ref quick_start_initialization)

+    - [Resource allocation](@ref quick_start_resource_allocation)

+  - \subpage choosing_memory_type

+    - [Usage](@ref choosing_memory_type_usage)

+    - [Required and preferred flags](@ref choosing_memory_type_required_preferred_flags)

+    - [Explicit memory types](@ref choosing_memory_type_explicit_memory_types)

+    - [Custom memory pools](@ref choosing_memory_type_custom_memory_pools)

+    - [Dedicated allocations](@ref choosing_memory_type_dedicated_allocations)

+  - \subpage memory_mapping

+    - [Mapping functions](@ref memory_mapping_mapping_functions)

+    - [Persistently mapped memory](@ref memory_mapping_persistently_mapped_memory)

+    - [Cache flush and invalidate](@ref memory_mapping_cache_control)

+    - [Finding out if memory is mappable](@ref memory_mapping_finding_if_memory_mappable)

+  - \subpage staying_within_budget

+    - [Querying for budget](@ref staying_within_budget_querying_for_budget)

+    - [Controlling memory usage](@ref staying_within_budget_controlling_memory_usage)

+  - \subpage custom_memory_pools

+    - [Choosing memory type index](@ref custom_memory_pools_MemTypeIndex)

+    - [Linear allocation algorithm](@ref linear_algorithm)

+      - [Free-at-once](@ref linear_algorithm_free_at_once)

+      - [Stack](@ref linear_algorithm_stack)

+      - [Double stack](@ref linear_algorithm_double_stack)

+      - [Ring buffer](@ref linear_algorithm_ring_buffer)

+    - [Buddy allocation algorithm](@ref buddy_algorithm)

+  - \subpage defragmentation

+  	- [Defragmenting CPU memory](@ref defragmentation_cpu)

+  	- [Defragmenting GPU memory](@ref defragmentation_gpu)

+  	- [Additional notes](@ref defragmentation_additional_notes)

+  	- [Writing custom allocation algorithm](@ref defragmentation_custom_algorithm)

+  - \subpage lost_allocations

+  - \subpage statistics

+    - [Numeric statistics](@ref statistics_numeric_statistics)

+    - [JSON dump](@ref statistics_json_dump)

+  - \subpage allocation_annotation

+    - [Allocation user data](@ref allocation_user_data)

+    - [Allocation names](@ref allocation_names)

+  - \subpage debugging_memory_usage

+    - [Memory initialization](@ref debugging_memory_usage_initialization)

+    - [Margins](@ref debugging_memory_usage_margins)

+    - [Corruption detection](@ref debugging_memory_usage_corruption_detection)

+  - \subpage record_and_replay

+- \subpage usage_patterns

+  - [Common mistakes](@ref usage_patterns_common_mistakes)

+  - [Simple patterns](@ref usage_patterns_simple)

+  - [Advanced patterns](@ref usage_patterns_advanced)

+- \subpage configuration

+  - [Pointers to Vulkan functions](@ref config_Vulkan_functions)

+  - [Custom host memory allocator](@ref custom_memory_allocator)

+  - [Device memory allocation callbacks](@ref allocation_callbacks)

+  - [Device heap memory limit](@ref heap_memory_limit)

+  - \subpage vk_khr_dedicated_allocation

+  - \subpage enabling_buffer_device_address

+  - \subpage vk_amd_device_coherent_memory

+- \subpage general_considerations

+  - [Thread safety](@ref general_considerations_thread_safety)

+  - [Validation layer warnings](@ref general_considerations_validation_layer_warnings)

+  - [Allocation algorithm](@ref general_considerations_allocation_algorithm)

+  - [Features not supported](@ref general_considerations_features_not_supported)

+

+\section main_see_also See also

+

+- [Product page on GPUOpen](https://gpuopen.com/gaming-product/vulkan-memory-allocator/)

+- [Source repository on GitHub](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator)

+

+

+

+

+\page quick_start Quick start

+

+\section quick_start_project_setup Project setup

+

+Vulkan Memory Allocator comes in form of a "stb-style" single header file.

+You don't need to build it as a separate library project.

+You can add this file directly to your project and submit it to code repository next to your other source files.

+

+"Single header" doesn't mean that everything is contained in C/C++ declarations,

+like it tends to be in case of inline functions or C++ templates.

+It means that implementation is bundled with interface in a single file and needs to be extracted using preprocessor macro.

+If you don't do it properly, you will get linker errors.

+

+To do it properly:

+

+-# Include "vk_mem_alloc.h" file in each CPP file where you want to use the library.

+   This includes declarations of all members of the library.

+-# In exacly one CPP file define following macro before this include.

+   It enables also internal definitions.

+

+\code

+#define VMA_IMPLEMENTATION

+#include "vk_mem_alloc.h"

+\endcode

+

+It may be a good idea to create dedicated CPP file just for this purpose.

+

+Note on language: This library is written in C++, but has C-compatible interface.

+Thus you can include and use vk_mem_alloc.h in C or C++ code, but full

+implementation with `VMA_IMPLEMENTATION` macro must be compiled as C++, NOT as C.

+

+Please note that this library includes header `<vulkan/vulkan.h>`, which in turn

+includes `<windows.h>` on Windows. If you need some specific macros defined

+before including these headers (like `WIN32_LEAN_AND_MEAN` or

+`WINVER` for Windows, `VK_USE_PLATFORM_WIN32_KHR` for Vulkan), you must define

+them before every `#include` of this library.

+

+

+\section quick_start_initialization Initialization

+

+At program startup:

+

+-# Initialize Vulkan to have `VkPhysicalDevice` and `VkDevice` object.

+-# Fill VmaAllocatorCreateInfo structure and create #VmaAllocator object by

+   calling vmaCreateAllocator().

+

+\code

+VmaAllocatorCreateInfo allocatorInfo = {};

+allocatorInfo.physicalDevice = physicalDevice;

+allocatorInfo.device = device;

+

+VmaAllocator allocator;

+vmaCreateAllocator(&allocatorInfo, &allocator);

+\endcode

+

+\section quick_start_resource_allocation Resource allocation

+

+When you want to create a buffer or image:

+

+-# Fill `VkBufferCreateInfo` / `VkImageCreateInfo` structure.

+-# Fill VmaAllocationCreateInfo structure.

+-# Call vmaCreateBuffer() / vmaCreateImage() to get `VkBuffer`/`VkImage` with memory

+   already allocated and bound to it.

+

+\code

+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_GPU_ONLY;

+

+VkBuffer buffer;

+VmaAllocation allocation;

+vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);

+\endcode

+

+Don't forget to destroy your objects when no longer needed:

+

+\code

+vmaDestroyBuffer(allocator, buffer, allocation);

+vmaDestroyAllocator(allocator);

+\endcode

+

+

+\page choosing_memory_type Choosing memory type

+

+Physical devices in Vulkan support various combinations of memory heaps and

+types. Help with choosing correct and optimal memory type for your specific

+resource is one of the key features of this library. You can use it by filling

+appropriate members of VmaAllocationCreateInfo structure, as described below.

+You can also combine multiple methods.

+

+-# If you just want to find memory type index that meets your requirements, you

+   can use function: vmaFindMemoryTypeIndex(), vmaFindMemoryTypeIndexForBufferInfo(),

+   vmaFindMemoryTypeIndexForImageInfo().

+-# If you want to allocate a region of device memory without association with any

+   specific image or buffer, you can use function vmaAllocateMemory(). Usage of

+   this function is not recommended and usually not needed.

+   vmaAllocateMemoryPages() function is also provided for creating multiple allocations at once,

+   which may be useful for sparse binding.

+-# If you already have a buffer or an image created, you want to allocate memory

+   for it and then you will bind it yourself, you can use function

+   vmaAllocateMemoryForBuffer(), vmaAllocateMemoryForImage().

+   For binding you should use functions: vmaBindBufferMemory(), vmaBindImageMemory()

+   or their extended versions: vmaBindBufferMemory2(), vmaBindImageMemory2().

+-# If you want to create a buffer or an image, allocate memory for it and bind

+   them together, all in one call, you can use function vmaCreateBuffer(),

+   vmaCreateImage(). This is the easiest and recommended way to use this library.

+

+When using 3. or 4., the library internally queries Vulkan for memory types

+supported for that buffer or image (function `vkGetBufferMemoryRequirements()`)

+and uses only one of these types.

+

+If no memory type can be found that meets all the requirements, these functions

+return `VK_ERROR_FEATURE_NOT_PRESENT`.

+

+You can leave VmaAllocationCreateInfo structure completely filled with zeros.

+It means no requirements are specified for memory type.

+It is valid, although not very useful.

+

+\section choosing_memory_type_usage Usage

+

+The easiest way to specify memory requirements is to fill member

+VmaAllocationCreateInfo::usage using one of the values of enum #VmaMemoryUsage.

+It defines high level, common usage types.

+For more details, see description of this enum.

+

+For example, if you want to create a uniform buffer that will be filled using

+transfer only once or infrequently and used for rendering every frame, you can

+do it using following code:

+

+\code

+VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };

+bufferInfo.size = 65536;

+bufferInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;

+

+VmaAllocationCreateInfo allocInfo = {};

+allocInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;

+

+VkBuffer buffer;

+VmaAllocation allocation;

+vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);

+\endcode

+

+\section choosing_memory_type_required_preferred_flags Required and preferred flags

+

+You can specify more detailed requirements by filling members

+VmaAllocationCreateInfo::requiredFlags and VmaAllocationCreateInfo::preferredFlags

+with a combination of bits from enum `VkMemoryPropertyFlags`. For example,

+if you want to create a buffer that will be persistently mapped on host (so it

+must be `HOST_VISIBLE`) and preferably will also be `HOST_COHERENT` and `HOST_CACHED`,

+use following code:

+

+\code

+VmaAllocationCreateInfo allocInfo = {};

+allocInfo.requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;

+allocInfo.preferredFlags = VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT;

+allocInfo.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT;

+

+VkBuffer buffer;

+VmaAllocation allocation;

+vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);

+\endcode

+

+A memory type is chosen that has all the required flags and as many preferred

+flags set as possible.

+

+If you use VmaAllocationCreateInfo::usage, it is just internally converted to

+a set of required and preferred flags.

+

+\section choosing_memory_type_explicit_memory_types Explicit memory types

+

+If you inspected memory types available on the physical device and you have

+a preference for memory types that you want to use, you can fill member

+VmaAllocationCreateInfo::memoryTypeBits. It is a bit mask, where each bit set

+means that a memory type with that index is allowed to be used for the

+allocation. Special value 0, just like `UINT32_MAX`, means there are no

+restrictions to memory type index.

+

+Please note that this member is NOT just a memory type index.

+Still you can use it to choose just one, specific memory type.

+For example, if you already determined that your buffer should be created in

+memory type 2, use following code:

+

+\code

+uint32_t memoryTypeIndex = 2;

+

+VmaAllocationCreateInfo allocInfo = {};

+allocInfo.memoryTypeBits = 1u << memoryTypeIndex;

+

+VkBuffer buffer;

+VmaAllocation allocation;

+vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);

+\endcode

+

+\section choosing_memory_type_custom_memory_pools Custom memory pools

+

+If you allocate from custom memory pool, all the ways of specifying memory

+requirements described above are not applicable and the aforementioned members

+of VmaAllocationCreateInfo 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 \ref custom_memory_pools.

+

+\section choosing_memory_type_dedicated_allocations Dedicated allocations

+

+Memory for allocations is reserved out of larger block of `VkDeviceMemory`

+allocated from Vulkan internally. That's 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 #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.

+The library can also internally decide to use dedicated allocation in some cases, e.g.:

+

+- When the size of the allocation is large.

+- When [VK_KHR_dedicated_allocation](@ref vk_khr_dedicated_allocation) extension is enabled

+  and it reports that dedicated allocation is required or recommended for the resource.

+- When allocation of next big memory block fails due to not enough device memory,

+  but allocation with the exact requested size succeeds.

+

+

+\page memory_mapping Memory mapping

+

+To "map memory" in Vulkan means to obtain a CPU pointer to `VkDeviceMemory`,

+to be able to read from it or write to it in CPU code.

+Mapping is possible only of memory allocated from a memory type that has

+`VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` flag.

+Functions `vkMapMemory()`, `vkUnmapMemory()` are designed for this purpose.

+You can use them directly with memory allocated by this library,

+but it is not recommended because of following issue:

+Mapping the same `VkDeviceMemory` block multiple times is illegal - only one mapping at a time is allowed.

+This includes mapping disjoint regions. Mapping is not reference-counted internally by Vulkan.

+Because of this, Vulkan Memory Allocator provides following facilities:

+

+\section memory_mapping_mapping_functions Mapping functions

+

+The library provides following functions for mapping of a specific #VmaAllocation: vmaMapMemory(), vmaUnmapMemory().

+They are safer and more convenient to use than standard Vulkan functions.

+You can map an allocation multiple times simultaneously - mapping is reference-counted internally.

+You can also map different allocations simultaneously regardless of whether they use the same `VkDeviceMemory` block.

+The way it's implemented is that the library always maps entire memory block, not just region of the allocation.

+For further details, see description of vmaMapMemory() function.

+Example:

+

+\code

+// Having these objects initialized:

+

+struct ConstantBuffer

+{

+    ...

+};

+ConstantBuffer constantBufferData;

+

+VmaAllocator allocator;

+VkBuffer constantBuffer;

+VmaAllocation constantBufferAllocation;

+

+// You can map and fill your buffer using following code:

+

+void* mappedData;

+vmaMapMemory(allocator, constantBufferAllocation, &mappedData);

+memcpy(mappedData, &constantBufferData, sizeof(constantBufferData));

+vmaUnmapMemory(allocator, constantBufferAllocation);

+\endcode

+

+When mapping, you may see a warning from Vulkan validation layer similar to this one:

+

+<i>Mapping an image with layout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL can result in undefined behavior if this memory is used by the device. Only GENERAL or PREINITIALIZED should be used.</i>

+

+It happens because the library maps entire `VkDeviceMemory` block, where different

+types of images and buffers may end up together, especially on GPUs with unified memory like Intel.

+You can safely ignore it if you are sure you access only memory of the intended

+object that you wanted to map.

+

+

+\section memory_mapping_persistently_mapped_memory Persistently mapped memory

+

+Kepping your memory persistently mapped is generally OK in Vulkan.

+You don't need to unmap it before using its data on the GPU.

+The library provides a special feature designed for that:

+Allocations made with #VMA_ALLOCATION_CREATE_MAPPED_BIT flag set in

+VmaAllocationCreateInfo::flags stay mapped all the time,

+so you can just access CPU pointer to it any time

+without a need to call any "map" or "unmap" function.

+Example:

+

+\code

+VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };

+bufCreateInfo.size = sizeof(ConstantBuffer);

+bufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;

+

+VmaAllocationCreateInfo allocCreateInfo = {};

+allocCreateInfo.usage = VMA_MEMORY_USAGE_CPU_ONLY;

+allocCreateInfo.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT;

+

+VkBuffer buf;

+VmaAllocation alloc;

+VmaAllocationInfo allocInfo;

+vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);

+

+// Buffer is already mapped. You can access its memory.

+memcpy(allocInfo.pMappedData, &constantBufferData, sizeof(constantBufferData));

+\endcode

+

+There are some exceptions though, when you should consider mapping memory only for a short period of time:

+

+- When operating system is Windows 7 or 8.x (Windows 10 is not affected because it uses WDDM2),

+  device is discrete AMD GPU,

+  and memory type is the special 256 MiB pool of `DEVICE_LOCAL + HOST_VISIBLE` memory

+  (selected when you use #VMA_MEMORY_USAGE_CPU_TO_GPU),

+  then whenever a memory block allocated from this memory type stays mapped

+  for the time of any call to `vkQueueSubmit()` or `vkQueuePresentKHR()`, this

+  block is migrated by WDDM to system RAM, which degrades performance. It doesn't

+  matter if that particular memory block is actually used by the command buffer

+  being submitted.

+- On Mac/MoltenVK there is a known bug - [Issue #175](https://github.com/KhronosGroup/MoltenVK/issues/175)

+  which requires unmapping before GPU can see updated texture.

+- Keeping many large memory blocks mapped may impact performance or stability of some debugging tools.

+

+\section memory_mapping_cache_control Cache flush and invalidate

+  

+Memory in Vulkan doesn't need to be unmapped before using it on GPU,

+but unless a memory types has `VK_MEMORY_PROPERTY_HOST_COHERENT_BIT` flag set,

+you need to manually **invalidate** cache before reading of mapped pointer

+and **flush** cache after writing to mapped pointer.

+Map/unmap operations don't do that automatically.

+Vulkan provides following functions for this purpose `vkFlushMappedMemoryRanges()`,

+`vkInvalidateMappedMemoryRanges()`, but this library provides more convenient

+functions that refer to given allocation object: vmaFlushAllocation(),

+vmaInvalidateAllocation(),

+or multiple objects at once: vmaFlushAllocations(), vmaInvalidateAllocations().

+

+Regions of memory specified for flush/invalidate must be aligned to

+`VkPhysicalDeviceLimits::nonCoherentAtomSize`. This is automatically ensured by the library.

+In any memory type that is `HOST_VISIBLE` but not `HOST_COHERENT`, all allocations

+within blocks are aligned to this value, so their offsets are always multiply of

+`nonCoherentAtomSize` and two different allocations never share same "line" of this size.

+

+Please note that memory allocated with #VMA_MEMORY_USAGE_CPU_ONLY is guaranteed to be `HOST_COHERENT`.

+

+Also, Windows drivers from all 3 **PC** GPU vendors (AMD, Intel, NVIDIA)

+currently provide `HOST_COHERENT` flag on all memory types that are

+`HOST_VISIBLE`, so on this platform you may not need to bother.

+

+\section memory_mapping_finding_if_memory_mappable Finding out if memory is mappable

+

+It may happen that your allocation ends up in memory that is `HOST_VISIBLE` (available for mapping)

+despite it wasn't explicitly requested.

+For example, application may work on integrated graphics with unified memory (like Intel) or

+allocation from video memory might have failed, so the library chose system memory as fallback.

+

+You can detect this case and map such allocation to access its memory on CPU directly,

+instead of launching a transfer operation.

+In order to do that: inspect `allocInfo.memoryType`, call vmaGetMemoryTypeProperties(),

+and look for `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` flag in properties of that memory type.

+

+\code

+VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };

+bufCreateInfo.size = sizeof(ConstantBuffer);

+bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;

+

+VmaAllocationCreateInfo allocCreateInfo = {};

+allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;

+allocCreateInfo.preferredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;

+

+VkBuffer buf;

+VmaAllocation alloc;

+VmaAllocationInfo allocInfo;

+vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);

+

+VkMemoryPropertyFlags memFlags;

+vmaGetMemoryTypeProperties(allocator, allocInfo.memoryType, &memFlags);

+if((memFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)

+{

+    // Allocation ended up in mappable memory. You can map it and access it directly.

+    void* mappedData;

+    vmaMapMemory(allocator, alloc, &mappedData);

+    memcpy(mappedData, &constantBufferData, sizeof(constantBufferData));

+    vmaUnmapMemory(allocator, alloc);

+}

+else

+{

+    // Allocation ended up in non-mappable memory.

+    // You need to create CPU-side buffer in VMA_MEMORY_USAGE_CPU_ONLY and make a transfer.

+}

+\endcode

+

+You can even use #VMA_ALLOCATION_CREATE_MAPPED_BIT flag while creating allocations

+that are not necessarily `HOST_VISIBLE` (e.g. using #VMA_MEMORY_USAGE_GPU_ONLY).

+If the allocation ends up in memory type that is `HOST_VISIBLE`, it will be persistently mapped and you can use it directly.

+If not, the flag is just ignored.

+Example:

+

+\code

+VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };

+bufCreateInfo.size = sizeof(ConstantBuffer);

+bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;

+

+VmaAllocationCreateInfo allocCreateInfo = {};

+allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;

+allocCreateInfo.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT;

+

+VkBuffer buf;

+VmaAllocation alloc;

+VmaAllocationInfo allocInfo;

+vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);

+

+if(allocInfo.pUserData != nullptr)

+{

+    // Allocation ended up in mappable memory.

+    // It's persistently mapped. You can access it directly.

+    memcpy(allocInfo.pMappedData, &constantBufferData, sizeof(constantBufferData));

+}

+else

+{

+    // Allocation ended up in non-mappable memory.

+    // You need to create CPU-side buffer in VMA_MEMORY_USAGE_CPU_ONLY and make a transfer.

+}

+\endcode

+

+

+\page staying_within_budget Staying within budget

+

+When developing a graphics-intensive game or program, it is important to avoid allocating

+more GPU memory than it's physically available. When the memory is over-committed,

+various bad things can happen, depending on the specific GPU, graphics driver, and

+operating system:

+

+- It may just work without any problems.

+- The application may slow down because some memory blocks are moved to system RAM

+  and the GPU has to access them through PCI Express bus.

+- A new allocation may take very long time to complete, even few seconds, and possibly

+  freeze entire system.

+- The new allocation may fail with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.

+- It may even result in GPU crash (TDR), observed as `VK_ERROR_DEVICE_LOST`

+  returned somewhere later.

+

+\section staying_within_budget_querying_for_budget Querying for budget

+

+To query for current memory usage and available budget, use function vmaGetBudget().

+Returned structure #VmaBudget contains quantities expressed in bytes, per Vulkan memory heap.

+

+Please note that this function returns different information and works faster than

+vmaCalculateStats(). vmaGetBudget() can be called every frame or even before every

+allocation, while vmaCalculateStats() is intended to be used rarely,

+only to obtain statistical information, e.g. for debugging purposes.

+

+It is recommended to use <b>VK_EXT_memory_budget</b> device extension to obtain information

+about the budget from Vulkan device. VMA is able to use this extension automatically.

+When not enabled, the allocator behaves same way, but then it estimates current usage

+and available budget based on its internal information and Vulkan memory heap sizes,

+which may be less precise. In order to use this extension:

+

+1. Make sure extensions VK_EXT_memory_budget and VK_KHR_get_physical_device_properties2

+   required by it are available and enable them. Please note that the first is a device

+   extension and the second is instance extension!

+2. Use flag #VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT when creating #VmaAllocator object.

+3. Make sure to call vmaSetCurrentFrameIndex() every frame. Budget is queried from

+   Vulkan inside of it to avoid overhead of querying it with every allocation.

+

+\section staying_within_budget_controlling_memory_usage Controlling memory usage

+

+There are many ways in which you can try to stay within the budget.

+

+First, when making new allocation requires allocating a new memory block, the library

+tries not to exceed the budget automatically. If a block with default recommended size

+(e.g. 256 MB) would go over budget, a smaller block is allocated, possibly even

+dedicated memory for just this resource.

+

+If the size of the requested resource plus current memory usage is more than the

+budget, by default the library still tries to create it, leaving it to the Vulkan

+implementation whether the allocation succeeds or fails. You can change this behavior

+by using #VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT flag. With it, the allocation is

+not made if it would exceed the budget or if the budget is already exceeded.

+Some other allocations become lost instead to make room for it, if the mechanism of

+[lost allocations](@ref lost_allocations) is used.

+If that is not possible, the allocation fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.

+Example usage pattern may be to pass the #VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT flag

+when creating resources that are not essential for the application (e.g. the texture

+of a specific object) and not to pass it when creating critically important resources

+(e.g. render targets).

+

+Finally, you can also use #VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT flag to make sure

+a new allocation is created only when it fits inside one of the existing memory blocks.

+If it would require to allocate a new block, if fails instead with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.

+This also ensures that the function call is very fast because it never goes to Vulkan

+to obtain a new block.

+

+Please note that creating \ref custom_memory_pools with VmaPoolCreateInfo::minBlockCount

+set to more than 0 will try to allocate memory blocks without checking whether they

+fit within budget.

+

+

+\page custom_memory_pools Custom memory pools

+

+A memory pool contains a number of `VkDeviceMemory` blocks.

+The library automatically creates and manages default pool for each memory type available on the device.

+Default memory pool automatically grows in size.

+Size of allocated blocks is also variable and managed automatically.

+

+You can create custom pool and allocate memory out of it.

+It can be useful if you want to:

+

+- Keep certain kind of allocations separate from others.

+- Enforce particular, fixed size of Vulkan memory blocks.

+- Limit maximum amount of Vulkan memory allocated for that pool.

+- Reserve minimum or fixed amount of Vulkan memory always preallocated for that pool.

+

+To use custom memory pools:

+

+-# Fill VmaPoolCreateInfo structure.

+-# Call vmaCreatePool() to obtain #VmaPool handle.

+-# When making an allocation, set VmaAllocationCreateInfo::pool to this handle.

+   You don't need to specify any other parameters of this structure, like `usage`.

+

+Example:

+

+\code

+// Create a pool that can have at most 2 blocks, 128 MiB each.

+VmaPoolCreateInfo poolCreateInfo = {};

+poolCreateInfo.memoryTypeIndex = ...

+poolCreateInfo.blockSize = 128ull * 1024 * 1024;

+poolCreateInfo.maxBlockCount = 2;

+

+VmaPool pool;

+vmaCreatePool(allocator, &poolCreateInfo, &pool);

+

+// Allocate a buffer out of it.

+VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };

+bufCreateInfo.size = 1024;

+bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;

+

+VmaAllocationCreateInfo allocCreateInfo = {};

+allocCreateInfo.pool = pool;

+

+VkBuffer buf;

+VmaAllocation alloc;

+VmaAllocationInfo allocInfo;

+vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);

+\endcode

+

+You have to free all allocations made from this pool before destroying it.

+

+\code

+vmaDestroyBuffer(allocator, buf, alloc);

+vmaDestroyPool(allocator, pool);

+\endcode

+

+\section custom_memory_pools_MemTypeIndex Choosing memory type index

+

+When creating a pool, you must explicitly specify memory type index.

+To find the one suitable for your buffers or images, you can use helper functions

+vmaFindMemoryTypeIndexForBufferInfo(), vmaFindMemoryTypeIndexForImageInfo().

+You need to provide structures with example parameters of buffers or images

+that you are going to create in that pool.

+

+\code

+VkBufferCreateInfo exampleBufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };

+exampleBufCreateInfo.size = 1024; // Whatever.

+exampleBufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT; // Change if needed.

+

+VmaAllocationCreateInfo allocCreateInfo = {};

+allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY; // Change if needed.

+

+uint32_t memTypeIndex;

+vmaFindMemoryTypeIndexForBufferInfo(allocator, &exampleBufCreateInfo, &allocCreateInfo, &memTypeIndex);

+

+VmaPoolCreateInfo poolCreateInfo = {};

+poolCreateInfo.memoryTypeIndex = memTypeIndex;

+// ...

+\endcode

+

+When creating buffers/images allocated in that pool, provide following parameters:

+

+- `VkBufferCreateInfo`: Prefer to pass same parameters as above.

+  Otherwise you risk creating resources in a memory type that is not suitable for them, which may result in undefined behavior.

+  Using different `VK_BUFFER_USAGE_` flags may work, but you shouldn't create images in a pool intended for buffers

+  or the other way around.

+- VmaAllocationCreateInfo: You don't need to pass same parameters. Fill only `pool` member.

+  Other members are ignored anyway.

+

+\section linear_algorithm Linear allocation algorithm

+

+Each Vulkan memory block managed by this library has accompanying metadata that

+keeps track of used and unused regions. By default, the metadata structure and

+algorithm tries to find best place for new allocations among free regions to

+optimize memory usage. This way you can allocate and free objects in any order.

+

+![Default allocation algorithm](../gfx/Linear_allocator_1_algo_default.png)

+

+Sometimes there is a need to use simpler, linear allocation algorithm. You can

+create custom pool that uses such algorithm by adding flag

+#VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT to VmaPoolCreateInfo::flags while creating

+#VmaPool object. Then an alternative metadata management is used. It always

+creates new allocations after last one and doesn't reuse free regions after

+allocations freed in the middle. It results in better allocation performance and

+less memory consumed by metadata.

+

+![Linear allocation algorithm](../gfx/Linear_allocator_2_algo_linear.png)

+

+With this one flag, you can create a custom pool that can be used in many ways:

+free-at-once, stack, double stack, and ring buffer. See below for details.

+

+\subsection linear_algorithm_free_at_once Free-at-once

+

+In a pool that uses linear algorithm, you still need to free all the allocations

+individually, e.g. by using vmaFreeMemory() or vmaDestroyBuffer(). You can free

+them in any order. New allocations are always made after last one - free space

+in the middle is not reused. However, when you release all the allocation and

+the pool becomes empty, allocation starts from the beginning again. This way you

+can use linear algorithm to speed up creation of allocations that you are going

+to release all at once.

+

+![Free-at-once](../gfx/Linear_allocator_3_free_at_once.png)

+

+This mode is also available for pools created with VmaPoolCreateInfo::maxBlockCount

+value that allows multiple memory blocks.

+

+\subsection linear_algorithm_stack Stack

+

+When you free an allocation that was created last, its space can be reused.

+Thanks to this, if you always release allocations in the order opposite to their

+creation (LIFO - Last In First Out), you can achieve behavior of a stack.

+

+![Stack](../gfx/Linear_allocator_4_stack.png)

+

+This mode is also available for pools created with VmaPoolCreateInfo::maxBlockCount

+value that allows multiple memory blocks.

+

+\subsection linear_algorithm_double_stack Double stack

+

+The space reserved by a custom pool with linear algorithm may be used by two

+stacks:

+

+- First, default one, growing up from offset 0.

+- Second, "upper" one, growing down from the end towards lower offsets.

+

+To make allocation from upper stack, add flag #VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT

+to VmaAllocationCreateInfo::flags.

+

+![Double stack](../gfx/Linear_allocator_7_double_stack.png)

+

+Double stack is available only in pools with one memory block -

+VmaPoolCreateInfo::maxBlockCount must be 1. Otherwise behavior is undefined.

+

+When the two stacks' ends meet so there is not enough space between them for a

+new allocation, such allocation fails with usual

+`VK_ERROR_OUT_OF_DEVICE_MEMORY` error.

+

+\subsection linear_algorithm_ring_buffer Ring buffer

+

+When you free some allocations from the beginning and there is not enough free space

+for a new one at the end of a pool, allocator's "cursor" wraps around to the

+beginning and starts allocation there. Thanks to this, if you always release

+allocations in the same order as you created them (FIFO - First In First Out),

+you can achieve behavior of a ring buffer / queue.

+

+![Ring buffer](../gfx/Linear_allocator_5_ring_buffer.png)

+

+Pools with linear algorithm support [lost allocations](@ref lost_allocations) when used as ring buffer.

+If there is not enough free space for a new allocation, but existing allocations

+from the front of the queue can become lost, they become lost and the allocation

+succeeds.

+

+![Ring buffer with lost allocations](../gfx/Linear_allocator_6_ring_buffer_lost.png)

+

+Ring buffer is available only in pools with one memory block -

+VmaPoolCreateInfo::maxBlockCount must be 1. Otherwise behavior is undefined.

+

+\section buddy_algorithm Buddy allocation algorithm

+

+There is another allocation algorithm that can be used with custom pools, called

+"buddy". Its internal data structure is based on a tree of blocks, each having

+size that is a power of two and a half of its parent's size. When you want to

+allocate memory of certain size, a free node in the tree is located. If it's too

+large, it is recursively split into two halves (called "buddies"). However, if

+requested allocation size is not a power of two, the size of a tree node is

+aligned up to the nearest power of two and the remaining space is wasted. When

+two buddy nodes become free, they are merged back into one larger node.

+

+![Buddy allocator](../gfx/Buddy_allocator.png)

+

+The advantage of buddy allocation algorithm over default algorithm is faster

+allocation and deallocation, as well as smaller external fragmentation. The

+disadvantage is more wasted space (internal fragmentation).

+

+For more information, please read ["Buddy memory allocation" on Wikipedia](https://en.wikipedia.org/wiki/Buddy_memory_allocation)

+or other sources that describe this concept in general.

+

+To use buddy allocation algorithm with a custom pool, add flag

+#VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT to VmaPoolCreateInfo::flags while creating

+#VmaPool object.

+

+Several limitations apply to pools that use buddy algorithm:

+

+- It is recommended to use VmaPoolCreateInfo::blockSize that is a power of two.

+  Otherwise, only largest power of two smaller than the size is used for

+  allocations. The remaining space always stays unused.

+- [Margins](@ref debugging_memory_usage_margins) and

+  [corruption detection](@ref debugging_memory_usage_corruption_detection)

+  don't work in such pools.

+- [Lost allocations](@ref lost_allocations) don't work in such pools. You can

+  use them, but they never become lost. Support may be added in the future.

+- [Defragmentation](@ref defragmentation) doesn't work with allocations made from

+  such pool.

+

+\page defragmentation Defragmentation

+

+Interleaved allocations and deallocations of many objects of varying size can

+cause fragmentation over time, which can lead to a situation where the library is unable

+to find a continuous range of free memory for a new allocation despite there is

+enough free space, just scattered across many small free ranges between existing

+allocations.

+

+To mitigate this problem, you can use defragmentation feature:

+structure #VmaDefragmentationInfo2, function vmaDefragmentationBegin(), vmaDefragmentationEnd().

+Given set of allocations, 

+this function can move them to compact used memory, ensure more continuous free

+space and possibly also free some `VkDeviceMemory` blocks.

+

+What the defragmentation does is:

+

+- Updates #VmaAllocation objects to point to new `VkDeviceMemory` and offset.

+  After allocation has been moved, its VmaAllocationInfo::deviceMemory and/or

+  VmaAllocationInfo::offset changes. You must query them again using

+  vmaGetAllocationInfo() if you need them.

+- Moves actual data in memory.

+

+What it doesn't do, so you need to do it yourself:

+

+- Recreate buffers and images that were bound to allocations that were defragmented and

+  bind them with their new places in memory.

+  You must use `vkDestroyBuffer()`, `vkDestroyImage()`,

+  `vkCreateBuffer()`, `vkCreateImage()`, vmaBindBufferMemory(), vmaBindImageMemory()

+  for that purpose and NOT vmaDestroyBuffer(),

+  vmaDestroyImage(), vmaCreateBuffer(), vmaCreateImage(), because you don't need to

+  destroy or create allocation objects!

+- Recreate views and update descriptors that point to these buffers and images.

+

+\section defragmentation_cpu Defragmenting CPU memory

+

+Following example demonstrates how you can run defragmentation on CPU.

+Only allocations created in memory types that are `HOST_VISIBLE` can be defragmented.

+Others are ignored.

+

+The way it works is:

+

+- It temporarily maps entire memory blocks when necessary.

+- It moves data using `memmove()` function.

+

+\code

+// Given following variables already initialized:

+VkDevice device;

+VmaAllocator allocator;

+std::vector<VkBuffer> buffers;

+std::vector<VmaAllocation> allocations;

+

+

+const uint32_t allocCount = (uint32_t)allocations.size();

+std::vector<VkBool32> allocationsChanged(allocCount);

+

+VmaDefragmentationInfo2 defragInfo = {};

+defragInfo.allocationCount = allocCount;

+defragInfo.pAllocations = allocations.data();

+defragInfo.pAllocationsChanged = allocationsChanged.data();

+defragInfo.maxCpuBytesToMove = VK_WHOLE_SIZE; // No limit.

+defragInfo.maxCpuAllocationsToMove = UINT32_MAX; // No limit.

+

+VmaDefragmentationContext defragCtx;

+vmaDefragmentationBegin(allocator, &defragInfo, nullptr, &defragCtx);

+vmaDefragmentationEnd(allocator, defragCtx);

+

+for(uint32_t i = 0; i < allocCount; ++i)

+{

+    if(allocationsChanged[i])

+    {

+        // Destroy buffer that is immutably bound to memory region which is no longer valid.

+        vkDestroyBuffer(device, buffers[i], nullptr);

+

+        // Create new buffer with same parameters.

+        VkBufferCreateInfo bufferInfo = ...;

+        vkCreateBuffer(device, &bufferInfo, nullptr, &buffers[i]);

+            

+        // You can make dummy call to vkGetBufferMemoryRequirements here to silence validation layer warning.

+            

+        // Bind new buffer to new memory region. Data contained in it is already moved.

+        VmaAllocationInfo allocInfo;

+        vmaGetAllocationInfo(allocator, allocations[i], &allocInfo);

+        vmaBindBufferMemory(allocator, allocations[i], buffers[i]);

+    }

+}

+\endcode

+

+Setting VmaDefragmentationInfo2::pAllocationsChanged is optional.

+This output array tells whether particular allocation in VmaDefragmentationInfo2::pAllocations at the same index

+has been modified during defragmentation.

+You can pass null, but you then need to query every allocation passed to defragmentation

+for new parameters using vmaGetAllocationInfo() if you might need to recreate and rebind a buffer or image associated with it.

+

+If you use [Custom memory pools](@ref choosing_memory_type_custom_memory_pools),

+you can fill VmaDefragmentationInfo2::poolCount and VmaDefragmentationInfo2::pPools

+instead of VmaDefragmentationInfo2::allocationCount and VmaDefragmentationInfo2::pAllocations

+to defragment all allocations in given pools.

+You cannot use VmaDefragmentationInfo2::pAllocationsChanged in that case.

+You can also combine both methods.

+

+\section defragmentation_gpu Defragmenting GPU memory

+

+It is also possible to defragment allocations created in memory types that are not `HOST_VISIBLE`.

+To do that, you need to pass a command buffer that meets requirements as described in

+VmaDefragmentationInfo2::commandBuffer. The way it works is:

+

+- It creates temporary buffers and binds them to entire memory blocks when necessary.

+- It issues `vkCmdCopyBuffer()` to passed command buffer.

+

+Example:

+

+\code

+// Given following variables already initialized:

+VkDevice device;

+VmaAllocator allocator;

+VkCommandBuffer commandBuffer;

+std::vector<VkBuffer> buffers;

+std::vector<VmaAllocation> allocations;

+

+

+const uint32_t allocCount = (uint32_t)allocations.size();

+std::vector<VkBool32> allocationsChanged(allocCount);

+

+VkCommandBufferBeginInfo cmdBufBeginInfo = ...;

+vkBeginCommandBuffer(commandBuffer, &cmdBufBeginInfo);

+

+VmaDefragmentationInfo2 defragInfo = {};

+defragInfo.allocationCount = allocCount;

+defragInfo.pAllocations = allocations.data();

+defragInfo.pAllocationsChanged = allocationsChanged.data();

+defragInfo.maxGpuBytesToMove = VK_WHOLE_SIZE; // Notice it's "GPU" this time.

+defragInfo.maxGpuAllocationsToMove = UINT32_MAX; // Notice it's "GPU" this time.

+defragInfo.commandBuffer = commandBuffer;

+

+VmaDefragmentationContext defragCtx;

+vmaDefragmentationBegin(allocator, &defragInfo, nullptr, &defragCtx);

+

+vkEndCommandBuffer(commandBuffer);

+

+// Submit commandBuffer.

+// Wait for a fence that ensures commandBuffer execution finished.

+

+vmaDefragmentationEnd(allocator, defragCtx);

+

+for(uint32_t i = 0; i < allocCount; ++i)

+{

+    if(allocationsChanged[i])

+    {

+        // Destroy buffer that is immutably bound to memory region which is no longer valid.

+        vkDestroyBuffer(device, buffers[i], nullptr);

+

+        // Create new buffer with same parameters.

+        VkBufferCreateInfo bufferInfo = ...;

+        vkCreateBuffer(device, &bufferInfo, nullptr, &buffers[i]);

+            

+        // You can make dummy call to vkGetBufferMemoryRequirements here to silence validation layer warning.

+            

+        // Bind new buffer to new memory region. Data contained in it is already moved.

+        VmaAllocationInfo allocInfo;

+        vmaGetAllocationInfo(allocator, allocations[i], &allocInfo);

+        vmaBindBufferMemory(allocator, allocations[i], buffers[i]);

+    }

+}

+\endcode

+

+You can combine these two methods by specifying non-zero `maxGpu*` as well as `maxCpu*` parameters.

+The library automatically chooses best method to defragment each memory pool.

+

+You may try not to block your entire program to wait until defragmentation finishes,

+but do it in the background, as long as you carefully fullfill requirements described

+in function vmaDefragmentationBegin().

+

+\section defragmentation_additional_notes Additional notes

+

+It is only legal to defragment allocations bound to:

+

+- buffers

+- images created with `VK_IMAGE_CREATE_ALIAS_BIT`, `VK_IMAGE_TILING_LINEAR`, and

+  being currently in `VK_IMAGE_LAYOUT_GENERAL` or `VK_IMAGE_LAYOUT_PREINITIALIZED`.

+

+Defragmentation of images created with `VK_IMAGE_TILING_OPTIMAL` or in any other

+layout may give undefined results.

+

+If you defragment allocations bound to images, new images to be bound to new

+memory region after defragmentation should be created with `VK_IMAGE_LAYOUT_PREINITIALIZED`

+and then transitioned to their original layout from before defragmentation if

+needed using an image memory barrier.

+

+While using defragmentation, you may experience validation layer warnings, which you just need to ignore.

+See [Validation layer warnings](@ref general_considerations_validation_layer_warnings).

+

+Please don't expect memory to be fully compacted after defragmentation.

+Algorithms inside are based on some heuristics that try to maximize number of Vulkan

+memory blocks to make totally empty to release them, as well as to maximimze continuous

+empty space inside remaining blocks, while minimizing the number and size of allocations that

+need to be moved. Some fragmentation may still remain - this is normal.

+

+\section defragmentation_custom_algorithm Writing custom defragmentation algorithm

+

+If you want to implement your own, custom defragmentation algorithm,

+there is infrastructure prepared for that,

+but it is not exposed through the library API - you need to hack its source code.

+Here are steps needed to do this:

+

+-# Main thing you need to do is to define your own class derived from base abstract

+   class `VmaDefragmentationAlgorithm` and implement your version of its pure virtual methods.

+   See definition and comments of this class for details.

+-# Your code needs to interact with device memory block metadata.

+   If you need more access to its data than it's provided by its public interface,

+   declare your new class as a friend class e.g. in class `VmaBlockMetadata_Generic`.

+-# If you want to create a flag that would enable your algorithm or pass some additional

+   flags to configure it, add them to `VmaDefragmentationFlagBits` and use them in

+   VmaDefragmentationInfo2::flags.

+-# Modify function `VmaBlockVectorDefragmentationContext::Begin` to create object

+   of your new class whenever needed.

+

+

+\page lost_allocations Lost allocations

+

+If your game oversubscribes video memory, if may work OK in previous-generation

+graphics APIs (DirectX 9, 10, 11, OpenGL) because resources are automatically

+paged to system RAM. In Vulkan you can't do it because when you run out of

+memory, an allocation just fails. If you have more data (e.g. textures) that can

+fit into VRAM and you don't need it all at once, you may want to upload them to

+GPU on demand and "push out" ones that are not used for a long time to make room

+for the new ones, effectively using VRAM (or a cartain memory pool) as a form of

+cache. Vulkan Memory Allocator can help you with that by supporting a concept of

+"lost allocations".

+

+To create an allocation that can become lost, include #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT

+flag in VmaAllocationCreateInfo::flags. Before using a buffer or image bound to

+such allocation in every new frame, you need to query it if it's not lost.

+To check it, call vmaTouchAllocation().

+If the allocation is lost, you should not use it or buffer/image bound to it.

+You mustn't forget to destroy this allocation and this buffer/image.

+vmaGetAllocationInfo() can also be used for checking status of the allocation.

+Allocation is lost when returned VmaAllocationInfo::deviceMemory == `VK_NULL_HANDLE`.

+

+To create an allocation that can make some other allocations lost to make room

+for it, use #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flag. You will

+usually use both flags #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT and

+#VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT at the same time.

+

+Warning! Current implementation uses quite naive, brute force algorithm,

+which can make allocation calls that use #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT

+flag quite slow. A new, more optimal algorithm and data structure to speed this

+up is planned for the future.

+

+<b>Q: When interleaving creation of new allocations with usage of existing ones,

+how do you make sure that an allocation won't become lost while it's used in the

+current frame?</b>

+

+It is ensured because vmaTouchAllocation() / vmaGetAllocationInfo() not only returns allocation

+status/parameters and checks whether it's not lost, but when it's not, it also

+atomically marks it as used in the current frame, which makes it impossible to

+become lost in that frame. It uses lockless algorithm, so it works fast and

+doesn't involve locking any internal mutex.

+

+<b>Q: What if my allocation may still be in use by the GPU when it's rendering a

+previous frame while I already submit new frame on the CPU?</b>

+

+You can make sure that allocations "touched" by vmaTouchAllocation() / vmaGetAllocationInfo() will not

+become lost for a number of additional frames back from the current one by

+specifying this number as VmaAllocatorCreateInfo::frameInUseCount (for default

+memory pool) and VmaPoolCreateInfo::frameInUseCount (for custom pool).

+

+<b>Q: How do you inform the library when new frame starts?</b>

+

+You need to call function vmaSetCurrentFrameIndex().

+

+Example code:

+

+\code

+struct MyBuffer

+{

+    VkBuffer m_Buf = nullptr;

+    VmaAllocation m_Alloc = nullptr;

+

+    // Called when the buffer is really needed in the current frame.

+    void EnsureBuffer();

+};

+

+void MyBuffer::EnsureBuffer()

+{

+    // Buffer has been created.

+    if(m_Buf != VK_NULL_HANDLE)

+    {

+        // Check if its allocation is not lost + mark it as used in current frame.

+        if(vmaTouchAllocation(allocator, m_Alloc))

+        {

+            // It's all OK - safe to use m_Buf.

+            return;

+        }

+    }

+

+    // Buffer not yet exists or lost - destroy and recreate it.

+

+    vmaDestroyBuffer(allocator, m_Buf, m_Alloc);

+

+    VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };

+    bufCreateInfo.size = 1024;

+    bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;

+

+    VmaAllocationCreateInfo allocCreateInfo = {};

+    allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;

+    allocCreateInfo.flags = VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT |

+        VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT;

+

+    vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &m_Buf, &m_Alloc, nullptr);

+}

+\endcode

+

+When using lost allocations, you may see some Vulkan validation layer warnings

+about overlapping regions of memory bound to different kinds of buffers and

+images. This is still valid as long as you implement proper handling of lost

+allocations (like in the example above) and don't use them.

+

+You can create an allocation that is already in lost state from the beginning using function

+vmaCreateLostAllocation(). It may be useful if you need a "dummy" allocation that is not null.

+

+You can call function vmaMakePoolAllocationsLost() to set all eligible allocations

+in a specified custom pool to lost state.

+Allocations that have been "touched" in current frame or VmaPoolCreateInfo::frameInUseCount frames back

+cannot become lost.

+

+<b>Q: Can I touch allocation that cannot become lost?</b>

+

+Yes, although it has no visible effect.

+Calls to vmaGetAllocationInfo() and vmaTouchAllocation() update last use frame index

+also for allocations that cannot become lost, but the only way to observe it is to dump

+internal allocator state using vmaBuildStatsString().

+You can use this feature for debugging purposes to explicitly mark allocations that you use

+in current frame and then analyze JSON dump to see for how long each allocation stays unused.

+

+

+\page statistics Statistics

+

+This library contains functions that return information about its internal state,

+especially the amount of memory allocated from Vulkan.

+Please keep in mind that these functions need to traverse all internal data structures

+to gather these information, so they may be quite time-consuming.

+Don't call them too often.

+

+\section statistics_numeric_statistics Numeric statistics

+

+You can query for overall statistics of the allocator using function vmaCalculateStats().

+Information are returned using structure #VmaStats.

+It contains #VmaStatInfo - number of allocated blocks, number of allocations

+(occupied ranges in these blocks), number of unused (free) ranges in these blocks,

+number of bytes used and unused (but still allocated from Vulkan) and other information.

+They are summed across memory heaps, memory types and total for whole allocator.

+

+You can query for statistics of a custom pool using function vmaGetPoolStats().

+Information are returned using structure #VmaPoolStats.

+

+You can query for information about specific allocation using function vmaGetAllocationInfo().

+It fill structure #VmaAllocationInfo.

+

+\section statistics_json_dump JSON dump

+

+You can dump internal state of the allocator to a string in JSON format using function vmaBuildStatsString().

+The result is guaranteed to be correct JSON.

+It uses ANSI encoding.

+Any strings provided by user (see [Allocation names](@ref allocation_names))

+are copied as-is and properly escaped for JSON, so if they use UTF-8, ISO-8859-2 or any other encoding,

+this JSON string can be treated as using this encoding.

+It must be freed using function vmaFreeStatsString().

+

+The format of this JSON string is not part of official documentation of the library,

+but it will not change in backward-incompatible way without increasing library major version number

+and appropriate mention in changelog.

+

+The JSON string contains all the data that can be obtained using vmaCalculateStats().

+It can also contain detailed map of allocated memory blocks and their regions -

+free and occupied by allocations.

+This allows e.g. to visualize the memory or assess fragmentation.

+

+

+\page allocation_annotation Allocation names and user data

+

+\section allocation_user_data Allocation user data

+

+You can annotate allocations with your own information, e.g. for debugging purposes.

+To do that, fill VmaAllocationCreateInfo::pUserData field when creating

+an allocation. It's an opaque `void*` 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.

+

+\code

+VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };

+// Fill bufferInfo...

+

+MyBufferMetadata* pMetadata = CreateBufferMetadata();

+

+VmaAllocationCreateInfo allocCreateInfo = {};

+allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;

+allocCreateInfo.pUserData = pMetadata;

+

+VkBuffer buffer;

+VmaAllocation allocation;

+vmaCreateBuffer(allocator, &bufferInfo, &allocCreateInfo, &buffer, &allocation, nullptr);

+\endcode

+

+The pointer may be later retrieved as VmaAllocationInfo::pUserData:

+

+\code

+VmaAllocationInfo allocInfo;

+vmaGetAllocationInfo(allocator, allocation, &allocInfo);

+MyBufferMetadata* pMetadata = (MyBufferMetadata*)allocInfo.pUserData;

+\endcode

+

+It can also be changed using function vmaSetAllocationUserData().

+

+Values of (non-zero) allocations' `pUserData` are printed in JSON report created by

+vmaBuildStatsString(), in hexadecimal form.

+

+\section allocation_names Allocation names

+

+There is alternative mode available where `pUserData` pointer is used to point to

+a null-terminated string, giving a name to the allocation. To use this mode,

+set #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT flag in VmaAllocationCreateInfo::flags.

+Then `pUserData` passed as VmaAllocationCreateInfo::pUserData or argument to

+vmaSetAllocationUserData() must be either null or pointer to a null-terminated string.

+The library creates internal copy of the string, so the pointer you pass doesn't need

+to be valid for whole lifetime of the allocation. You can free it after the call.

+

+\code

+VkImageCreateInfo imageInfo = { VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO };

+// Fill imageInfo...

+

+std::string imageName = "Texture: ";

+imageName += fileName;

+

+VmaAllocationCreateInfo allocCreateInfo = {};

+allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;

+allocCreateInfo.flags = VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT;

+allocCreateInfo.pUserData = imageName.c_str();

+

+VkImage image;

+VmaAllocation allocation;

+vmaCreateImage(allocator, &imageInfo, &allocCreateInfo, &image, &allocation, nullptr);

+\endcode

+

+The value of `pUserData` pointer of the allocation will be different than the one

+you passed when setting allocation's name - pointing to a buffer managed

+internally that holds copy of the string.

+

+\code

+VmaAllocationInfo allocInfo;

+vmaGetAllocationInfo(allocator, allocation, &allocInfo);

+const char* imageName = (const char*)allocInfo.pUserData;

+printf("Image name: %s\n", imageName);

+\endcode

+

+That string is also printed in JSON report created by vmaBuildStatsString().

+

+\note Passing string name to VMA allocation doesn't automatically set it to the Vulkan buffer or image created with it.

+You must do it manually using an extension like VK_EXT_debug_utils, which is independent of this library.

+

+

+\page debugging_memory_usage Debugging incorrect memory usage

+

+If you suspect a bug with memory usage, like usage of uninitialized memory or

+memory being overwritten out of bounds of an allocation,

+you can use debug features of this library to verify this.

+

+\section debugging_memory_usage_initialization Memory initialization

+

+If you experience a bug with incorrect and nondeterministic data in your program and you suspect uninitialized memory to be used,

+you can enable automatic memory initialization to verify this.

+To do it, define macro `VMA_DEBUG_INITIALIZE_ALLOCATIONS` to 1.

+

+\code

+#define VMA_DEBUG_INITIALIZE_ALLOCATIONS 1

+#include "vk_mem_alloc.h"

+\endcode

+

+It makes memory of all new allocations initialized to bit pattern `0xDCDCDCDC`.

+Before an allocation is destroyed, its memory is filled with bit pattern `0xEFEFEFEF`.

+Memory is automatically mapped and unmapped if necessary.

+

+If you find these values while debugging your program, good chances are that you incorrectly

+read Vulkan memory that is allocated but not initialized, or already freed, respectively.

+

+Memory initialization works only with memory types that are `HOST_VISIBLE`.

+It works also with dedicated allocations.

+It doesn't work with allocations created with #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag,

+as they cannot be mapped.

+

+\section debugging_memory_usage_margins Margins

+

+By default, allocations are laid out in memory blocks next to each other if possible

+(considering required alignment, `bufferImageGranularity`, and `nonCoherentAtomSize`).

+

+![Allocations without margin](../gfx/Margins_1.png)

+

+Define macro `VMA_DEBUG_MARGIN` to some non-zero value (e.g. 16) to enforce specified

+number of bytes as a margin before and after every allocation.

+

+\code

+#define VMA_DEBUG_MARGIN 16

+#include "vk_mem_alloc.h"

+\endcode

+

+![Allocations with margin](../gfx/Margins_2.png)

+

+If your bug goes away after enabling margins, it means it may be caused by memory

+being overwritten outside of allocation boundaries. It is not 100% certain though.

+Change in application behavior may also be caused by different order and distribution

+of allocations across memory blocks after margins are applied.

+

+The margin is applied also before first and after last allocation in a block.

+It may occur only once between two adjacent allocations.

+

+Margins work with all types of memory.

+

+Margin is applied only to allocations made out of memory blocks and not to dedicated

+allocations, which have their own memory block of specific size.

+It is thus not applied to allocations made using #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT flag

+or those automatically decided to put into dedicated allocations, e.g. due to its

+large size or recommended by VK_KHR_dedicated_allocation extension.

+Margins are also not active in custom pools created with #VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT flag.

+

+Margins appear in [JSON dump](@ref statistics_json_dump) as part of free space.

+

+Note that enabling margins increases memory usage and fragmentation.

+

+\section debugging_memory_usage_corruption_detection Corruption detection

+

+You can additionally define macro `VMA_DEBUG_DETECT_CORRUPTION` to 1 to enable validation

+of contents of the margins.

+

+\code

+#define VMA_DEBUG_MARGIN 16

+#define VMA_DEBUG_DETECT_CORRUPTION 1

+#include "vk_mem_alloc.h"

+\endcode

+

+When this feature is enabled, number of bytes specified as `VMA_DEBUG_MARGIN`

+(it must be multiply of 4) before and after every allocation is filled with a magic number.

+This idea is also know as "canary".

+Memory is automatically mapped and unmapped if necessary.

+

+This number is validated automatically when the allocation is destroyed.

+If it's not equal to the expected value, `VMA_ASSERT()` is executed.

+It clearly means that either CPU or GPU overwritten the memory outside of boundaries of the allocation,

+which indicates a serious bug.

+

+You can also explicitly request checking margins of all allocations in all memory blocks

+that belong to specified memory types by using function vmaCheckCorruption(),

+or in memory blocks that belong to specified custom pool, by using function 

+vmaCheckPoolCorruption().

+

+Margin validation (corruption detection) works only for memory types that are

+`HOST_VISIBLE` and `HOST_COHERENT`.

+

+

+\page record_and_replay Record and replay

+

+\section record_and_replay_introduction Introduction

+

+While using the library, sequence of calls to its functions together with their

+parameters can be recorded to a file and later replayed using standalone player

+application. It can be useful to:

+

+- Test correctness - check if same sequence of calls will not cause crash or

+  failures on a target platform.

+- Gather statistics - see number of allocations, peak memory usage, number of

+  calls etc.

+- Benchmark performance - see how much time it takes to replay the whole

+  sequence.

+

+\section record_and_replay_usage Usage

+

+Recording functionality is disabled by default.

+To enable it, define following macro before every include of this library:

+

+\code

+#define VMA_RECORDING_ENABLED 1

+\endcode

+

+<b>To record sequence of calls to a file:</b> Fill in

+VmaAllocatorCreateInfo::pRecordSettings member while creating #VmaAllocator

+object. File is opened and written during whole lifetime of the allocator.

+

+<b>To replay file:</b> Use VmaReplay - standalone command-line program.

+Precompiled binary can be found in "bin" directory.

+Its source can be found in "src/VmaReplay" directory.

+Its project is generated by Premake.

+Command line syntax is printed when the program is launched without parameters.

+Basic usage:

+

+    VmaReplay.exe MyRecording.csv

+

+<b>Documentation of file format</b> can be found in file: "docs/Recording file format.md".

+It's a human-readable, text file in CSV format (Comma Separated Values).

+

+\section record_and_replay_additional_considerations Additional considerations

+

+- Replaying file that was recorded on a different GPU (with different parameters

+  like `bufferImageGranularity`, `nonCoherentAtomSize`, and especially different

+  set of memory heaps and types) may give different performance and memory usage

+  results, as well as issue some warnings and errors.

+- Current implementation of recording in VMA, as well as VmaReplay application, is

+  coded and tested only on Windows. Inclusion of recording code is driven by

+  `VMA_RECORDING_ENABLED` macro. Support for other platforms should be easy to

+  add. Contributions are welcomed.

+

+

+\page usage_patterns Recommended usage patterns

+

+See also slides from talk:

+[Sawicki, Adam. Advanced Graphics Techniques Tutorial: Memory management in Vulkan and DX12. Game Developers Conference, 2018](https://www.gdcvault.com/play/1025458/Advanced-Graphics-Techniques-Tutorial-New)

+

+

+\section usage_patterns_common_mistakes Common mistakes

+

+<b>Use of CPU_TO_GPU instead of CPU_ONLY memory</b>

+

+#VMA_MEMORY_USAGE_CPU_TO_GPU is recommended only for resources that will be

+mapped and written by the CPU, as well as read directly by the GPU - like some

+buffers or textures updated every frame (dynamic). If you create a staging copy

+of a resource to be written by CPU and then used as a source of transfer to

+another resource placed in the GPU memory, that staging resource should be

+created with #VMA_MEMORY_USAGE_CPU_ONLY. Please read the descriptions of these

+enums carefully for details.

+

+<b>Unnecessary use of custom pools</b>

+

+\ref custom_memory_pools may be useful for special purposes - when you want to

+keep certain type of resources separate e.g. to reserve minimum amount of memory

+for them, limit maximum amount of memory they can occupy, or make some of them

+push out the other through the mechanism of \ref lost_allocations. For most

+resources this is not needed and so it is not recommended to create #VmaPool

+objects and allocations out of them. Allocating from the default pool is sufficient.

+

+\section usage_patterns_simple Simple patterns

+

+\subsection usage_patterns_simple_render_targets Render targets

+

+<b>When:</b>

+Any resources that you frequently write and read on GPU,

+e.g. images used as color attachments (aka "render targets"), depth-stencil attachments,

+images/buffers used as storage image/buffer (aka "Unordered Access View (UAV)").

+

+<b>What to do:</b>

+Create them in video memory that is fastest to access from GPU using

+#VMA_MEMORY_USAGE_GPU_ONLY.

+

+Consider using [VK_KHR_dedicated_allocation](@ref vk_khr_dedicated_allocation) extension

+and/or manually creating them as dedicated allocations using #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT,

+especially if they are large or if you plan to destroy and recreate them e.g. when

+display resolution changes.

+Prefer to create such resources first and all other GPU resources (like textures and vertex buffers) later.

+

+\subsection usage_patterns_simple_immutable_resources Immutable resources

+

+<b>When:</b>

+Any resources that you fill on CPU only once (aka "immutable") or infrequently

+and then read frequently on GPU,

+e.g. textures, vertex and index buffers, constant buffers that don't change often.

+

+<b>What to do:</b>

+Create them in video memory that is fastest to access from GPU using

+#VMA_MEMORY_USAGE_GPU_ONLY.

+

+To initialize content of such resource, create a CPU-side (aka "staging") copy of it

+in system memory - #VMA_MEMORY_USAGE_CPU_ONLY, map it, fill it,

+and submit a transfer from it to the GPU resource.

+You can keep the staging copy if you need it for another upload transfer in the future.

+If you don't, you can destroy it or reuse this buffer for uploading different resource

+after the transfer finishes.

+

+Prefer to create just buffers in system memory rather than images, even for uploading textures.

+Use `vkCmdCopyBufferToImage()`.

+Dont use images with `VK_IMAGE_TILING_LINEAR`.

+

+\subsection usage_patterns_dynamic_resources Dynamic resources

+

+<b>When:</b>

+Any resources that change frequently (aka "dynamic"), e.g. every frame or every draw call,

+written on CPU, read on GPU.

+

+<b>What to do:</b>

+Create them using #VMA_MEMORY_USAGE_CPU_TO_GPU.

+You can map it and write to it directly on CPU, as well as read from it on GPU.

+

+This is a more complex situation. Different solutions are possible,

+and the best one depends on specific GPU type, but you can use this simple approach for the start.

+Prefer to write to such resource sequentially (e.g. using `memcpy`).

+Don't perform random access or any reads from it on CPU, as it may be very slow.

+

+\subsection usage_patterns_readback Readback

+

+<b>When:</b>

+Resources that contain data written by GPU that you want to read back on CPU,

+e.g. results of some computations.

+

+<b>What to do:</b>

+Create them using #VMA_MEMORY_USAGE_GPU_TO_CPU.

+You can write to them directly on GPU, as well as map and read them on CPU.

+

+\section usage_patterns_advanced Advanced patterns

+

+\subsection usage_patterns_integrated_graphics Detecting integrated graphics

+

+You can support integrated graphics (like Intel HD Graphics, AMD APU) better

+by detecting it in Vulkan.

+To do it, call `vkGetPhysicalDeviceProperties()`, inspect

+`VkPhysicalDeviceProperties::deviceType` and look for `VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU`.

+When you find it, you can assume that memory is unified and all memory types are comparably fast

+to access from GPU, regardless of `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`.

+

+You can then sum up sizes of all available memory heaps and treat them as useful for

+your GPU resources, instead of only `DEVICE_LOCAL` ones.

+You can also prefer to create your resources in memory types that are `HOST_VISIBLE` to map them

+directly instead of submitting explicit transfer (see below).

+

+\subsection usage_patterns_direct_vs_transfer Direct access versus transfer

+

+For resources that you frequently write on CPU and read on GPU, many solutions are possible:

+

+-# Create one copy in video memory using #VMA_MEMORY_USAGE_GPU_ONLY,

+   second copy in system memory using #VMA_MEMORY_USAGE_CPU_ONLY and submit explicit tranfer each time.

+-# Create just single copy using #VMA_MEMORY_USAGE_CPU_TO_GPU, map it and fill it on CPU,

+   read it directly on GPU.

+-# Create just single copy using #VMA_MEMORY_USAGE_CPU_ONLY, map it and fill it on CPU,

+   read it directly on GPU.

+

+Which solution is the most efficient depends on your resource and especially on the GPU.

+It is best to measure it and then make the decision.

+Some general recommendations:

+

+- On integrated graphics use (2) or (3) to avoid unnecesary time and memory overhead

+  related to using a second copy and making transfer.

+- For small resources (e.g. constant buffers) use (2).

+  Discrete AMD cards have special 256 MiB pool of video memory that is directly mappable.

+  Even if the resource ends up in system memory, its data may be cached on GPU after first

+  fetch over PCIe bus.

+- For larger resources (e.g. textures), decide between (1) and (2).

+  You may want to differentiate NVIDIA and AMD, e.g. by looking for memory type that is

+  both `DEVICE_LOCAL` and `HOST_VISIBLE`. When you find it, use (2), otherwise use (1).

+

+Similarly, for resources that you frequently write on GPU and read on CPU, multiple

+solutions are possible:

+

+-# Create one copy in video memory using #VMA_MEMORY_USAGE_GPU_ONLY,

+   second copy in system memory using #VMA_MEMORY_USAGE_GPU_TO_CPU and submit explicit tranfer each time.

+-# Create just single copy using #VMA_MEMORY_USAGE_GPU_TO_CPU, write to it directly on GPU,

+   map it and read it on CPU.

+

+You should take some measurements to decide which option is faster in case of your specific

+resource.

+

+If you don't want to specialize your code for specific types of GPUs, you can still make

+an simple optimization for cases when your resource ends up in mappable memory to use it

+directly in this case instead of creating CPU-side staging copy.

+For details see [Finding out if memory is mappable](@ref memory_mapping_finding_if_memory_mappable).

+

+

+\page configuration Configuration

+

+Please check "CONFIGURATION SECTION" in the code to find macros that you can define

+before each include of this file or change directly in this file to provide

+your own implementation of basic facilities like assert, `min()` and `max()` functions,

+mutex, atomic etc.

+The library uses its own implementation of containers by default, but you can switch to using

+STL containers instead.

+

+For example, define `VMA_ASSERT(expr)` before including the library to provide

+custom implementation of the assertion, compatible with your project.

+By default it is defined to standard C `assert(expr)` in `_DEBUG` configuration

+and empty otherwise.

+

+\section config_Vulkan_functions Pointers to Vulkan functions

+

+There are multiple ways to import pointers to Vulkan functions in the library.

+In the simplest case you don't need to do anything.

+If the compilation or linking of your program or the initialization of the #VmaAllocator

+doesn't work for you, you can try to reconfigure it.

+

+First, the allocator tries to fetch pointers to Vulkan functions linked statically,

+like this:

+

+\code

+m_VulkanFunctions.vkAllocateMemory = (PFN_vkAllocateMemory)vkAllocateMemory;

+\endcode

+

+If you want to disable this feature, set configuration macro: `#define VMA_STATIC_VULKAN_FUNCTIONS 0`.

+

+Second, you can provide the pointers yourself by setting member VmaAllocatorCreateInfo::pVulkanFunctions.

+You can fetch them e.g. using functions `vkGetInstanceProcAddr` and `vkGetDeviceProcAddr` or

+by using a helper library like [volk](https://github.com/zeux/volk).

+

+Third, VMA tries to fetch remaining pointers that are still null by calling

+`vkGetInstanceProcAddr` and `vkGetDeviceProcAddr` on its own.

+If you want to disable this feature, set configuration macro: `#define VMA_DYNAMIC_VULKAN_FUNCTIONS 0`.

+

+Finally, all the function pointers required by the library (considering selected

+Vulkan version and enabled extensions) are checked with `VMA_ASSERT` if they are not null.

+

+

+\section custom_memory_allocator Custom host memory allocator

+

+If you use custom allocator for CPU memory rather than default operator `new`

+and `delete` from C++, you can make this library using your allocator as well

+by filling optional member VmaAllocatorCreateInfo::pAllocationCallbacks. These

+functions will be passed to Vulkan, as well as used by the library itself to

+make any CPU-side allocations.

+

+\section allocation_callbacks Device memory allocation callbacks

+

+The library makes calls to `vkAllocateMemory()` and `vkFreeMemory()` internally.

+You can setup callbacks to be informed about these calls, e.g. for the purpose

+of gathering some statistics. To do it, fill optional member

+VmaAllocatorCreateInfo::pDeviceMemoryCallbacks.

+

+\section heap_memory_limit Device heap memory limit

+

+When device memory of certain heap runs out of free space, new allocations may

+fail (returning error code) or they may succeed, silently pushing some existing

+memory blocks from GPU VRAM to system RAM (which degrades performance). This

+behavior is implementation-dependant - it depends on GPU vendor and graphics

+driver.

+

+On AMD cards it can be controlled while creating Vulkan device object by using

+VK_AMD_memory_overallocation_behavior extension, if available.

+

+Alternatively, if you want to test how your program behaves with limited amount of Vulkan device

+memory available without switching your graphics card to one that really has

+smaller VRAM, you can use a feature of this library intended for this purpose.

+To do it, fill optional member VmaAllocatorCreateInfo::pHeapSizeLimit.

+

+

+

+\page vk_khr_dedicated_allocation VK_KHR_dedicated_allocation

+

+VK_KHR_dedicated_allocation is a Vulkan extension which can be used to improve

+performance on some GPUs. It augments Vulkan API with possibility to query

+driver whether it prefers particular buffer or image to have its own, dedicated

+allocation (separate `VkDeviceMemory` block) for better efficiency - to be able

+to do some internal optimizations.

+

+The extension is supported by this library. It will be used automatically when

+enabled. To enable it:

+

+1 . When creating Vulkan device, check if following 2 device extensions are

+supported (call `vkEnumerateDeviceExtensionProperties()`).

+If yes, enable them (fill `VkDeviceCreateInfo::ppEnabledExtensionNames`).

+

+- VK_KHR_get_memory_requirements2

+- VK_KHR_dedicated_allocation

+

+If you enabled these extensions:

+

+2 . Use #VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT flag when creating

+your #VmaAllocator`to inform the library that you enabled required extensions

+and you want the library to use them.

+

+\code

+allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT;

+

+vmaCreateAllocator(&allocatorInfo, &allocator);

+\endcode

+

+That's all. The extension will be automatically used whenever you create a

+buffer using vmaCreateBuffer() or image using vmaCreateImage().

+

+When using the extension together with Vulkan Validation Layer, you will receive

+warnings like this:

+

+    vkBindBufferMemory(): Binding memory to buffer 0x33 but vkGetBufferMemoryRequirements() has not been called on that buffer.

+

+It is OK, you should just ignore it. It happens because you use function

+`vkGetBufferMemoryRequirements2KHR()` instead of standard

+`vkGetBufferMemoryRequirements()`, while the validation layer seems to be

+unaware of it.

+

+To learn more about this extension, see:

+

+- [VK_KHR_dedicated_allocation in Vulkan specification](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap44.html#VK_KHR_dedicated_allocation)

+- [VK_KHR_dedicated_allocation unofficial manual](http://asawicki.info/articles/VK_KHR_dedicated_allocation.php5)

+

+

+

+\page vk_amd_device_coherent_memory VK_AMD_device_coherent_memory

+

+VK_AMD_device_coherent_memory is a device extension that enables access to

+additional memory types with `VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD` and

+`VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD` flag. It is useful mostly for

+allocation of buffers intended for writing "breadcrumb markers" in between passes

+or draw calls, which in turn are useful for debugging GPU crash/hang/TDR cases.

+

+When the extension is available but has not been enabled, Vulkan physical device

+still exposes those memory types, but their usage is forbidden. VMA automatically

+takes care of that - it returns `VK_ERROR_FEATURE_NOT_PRESENT` when an attempt

+to allocate memory of such type is made.

+

+If you want to use this extension in connection with VMA, follow these steps:

+

+\section vk_amd_device_coherent_memory_initialization Initialization

+

+1) Call `vkEnumerateDeviceExtensionProperties` for the physical device.

+Check if the extension is supported - if returned array of `VkExtensionProperties` contains "VK_AMD_device_coherent_memory".

+

+2) Call `vkGetPhysicalDeviceFeatures2` for the physical device instead of old `vkGetPhysicalDeviceFeatures`.

+Attach additional structure `VkPhysicalDeviceCoherentMemoryFeaturesAMD` to `VkPhysicalDeviceFeatures2::pNext` to be returned.

+Check if the device feature is really supported - check if `VkPhysicalDeviceCoherentMemoryFeaturesAMD::deviceCoherentMemory` is true.

+

+3) While creating device with `vkCreateDevice`, enable this extension - add "VK_AMD_device_coherent_memory"

+to the list passed as `VkDeviceCreateInfo::ppEnabledExtensionNames`.

+

+4) While creating the device, also don't set `VkDeviceCreateInfo::pEnabledFeatures`.

+Fill in `VkPhysicalDeviceFeatures2` structure instead and pass it as `VkDeviceCreateInfo::pNext`.

+Enable this device feature - attach additional structure `VkPhysicalDeviceCoherentMemoryFeaturesAMD` to

+`VkPhysicalDeviceFeatures2::pNext` and set its member `deviceCoherentMemory` to `VK_TRUE`.

+

+5) While creating #VmaAllocator with vmaCreateAllocator() inform VMA that you

+have enabled this extension and feature - add #VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT

+to VmaAllocatorCreateInfo::flags.

+

+\section vk_amd_device_coherent_memory_usage Usage

+

+After following steps described above, you can create VMA allocations and custom pools

+out of the special `DEVICE_COHERENT` and `DEVICE_UNCACHED` memory types on eligible

+devices. There are multiple ways to do it, for example:

+

+- You can request or prefer to allocate out of such memory types by adding

+  `VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD` to VmaAllocationCreateInfo::requiredFlags

+  or VmaAllocationCreateInfo::preferredFlags. Those flags can be freely mixed with

+  other ways of \ref choosing_memory_type, like setting VmaAllocationCreateInfo::usage.

+- If you manually found memory type index to use for this purpose, force allocation

+  from this specific index by setting VmaAllocationCreateInfo::memoryTypeBits `= 1u << index`.

+

+\section vk_amd_device_coherent_memory_more_information More information

+

+To learn more about this extension, see [VK_AMD_device_coherent_memory in Vulkan specification](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap44.html#VK_AMD_device_coherent_memory)

+

+Example use of this extension can be found in the code of the sample and test suite

+accompanying this library.

+

+

+\page enabling_buffer_device_address Enabling buffer device address

+

+Device extension VK_KHR_buffer_device_address

+allow to fetch raw GPU pointer to a buffer and pass it for usage in a shader code.

+It is promoted to core Vulkan 1.2.

+

+If you want to use this feature in connection with VMA, follow these steps:

+

+\section enabling_buffer_device_address_initialization Initialization

+

+1) (For Vulkan version < 1.2) Call `vkEnumerateDeviceExtensionProperties` for the physical device.

+Check if the extension is supported - if returned array of `VkExtensionProperties` contains

+"VK_KHR_buffer_device_address".

+

+2) Call `vkGetPhysicalDeviceFeatures2` for the physical device instead of old `vkGetPhysicalDeviceFeatures`.

+Attach additional structure `VkPhysicalDeviceBufferDeviceAddressFeatures*` to `VkPhysicalDeviceFeatures2::pNext` to be returned.

+Check if the device feature is really supported - check if `VkPhysicalDeviceBufferDeviceAddressFeatures*::bufferDeviceAddress` is true.

+

+3) (For Vulkan version < 1.2) While creating device with `vkCreateDevice`, enable this extension - add

+"VK_KHR_buffer_device_address" to the list passed as `VkDeviceCreateInfo::ppEnabledExtensionNames`.

+

+4) While creating the device, also don't set `VkDeviceCreateInfo::pEnabledFeatures`.

+Fill in `VkPhysicalDeviceFeatures2` structure instead and pass it as `VkDeviceCreateInfo::pNext`.

+Enable this device feature - attach additional structure `VkPhysicalDeviceBufferDeviceAddressFeatures*` to

+`VkPhysicalDeviceFeatures2::pNext` and set its member `bufferDeviceAddress` to `VK_TRUE`.

+

+5) While creating #VmaAllocator with vmaCreateAllocator() inform VMA that you

+have enabled this feature - add #VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT

+to VmaAllocatorCreateInfo::flags.

+

+\section enabling_buffer_device_address_usage Usage

+

+After following steps described above, you can create buffers with `VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT*` using VMA.

+The library automatically adds `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT*` to

+allocated memory blocks wherever it might be needed.

+

+Please note that the library supports only `VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT*`.

+The second part of this functionality related to "capture and replay" is not supported,

+as it is intended for usage in debugging tools like RenderDoc, not in everyday Vulkan usage.

+

+\section enabling_buffer_device_address_more_information More information

+

+To learn more about this extension, see [VK_KHR_buffer_device_address in Vulkan specification](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap46.html#VK_KHR_buffer_device_address)

+

+Example use of this extension can be found in the code of the sample and test suite

+accompanying this library.

+

+\page general_considerations General considerations

+

+\section general_considerations_thread_safety Thread safety

+

+- The library has no global state, so separate #VmaAllocator objects can be used

+  independently.

+  There should be no need to create multiple such objects though - one per `VkDevice` is enough.

+- By default, all calls to functions that take #VmaAllocator as first parameter

+  are safe to call from multiple threads simultaneously because they are

+  synchronized internally when needed.

+- When the allocator is created with #VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT

+  flag, calls to functions that take such #VmaAllocator object must be

+  synchronized externally.

+- Access to a #VmaAllocation object must be externally synchronized. For example,

+  you must not call vmaGetAllocationInfo() and vmaMapMemory() from different

+  threads at the same time if you pass the same #VmaAllocation object to these

+  functions.

+

+\section general_considerations_validation_layer_warnings Validation layer warnings

+

+When using this library, you can meet following types of warnings issued by

+Vulkan validation layer. They don't necessarily indicate a bug, so you may need

+to just ignore them.

+

+- *vkBindBufferMemory(): Binding memory to buffer 0xeb8e4 but vkGetBufferMemoryRequirements() has not been called on that buffer.*

+  - It happens when VK_KHR_dedicated_allocation extension is enabled.

+    `vkGetBufferMemoryRequirements2KHR` function is used instead, while validation layer seems to be unaware of it.

+- *Mapping an image with layout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL can result in undefined behavior if this memory is used by the device. Only GENERAL or PREINITIALIZED should be used.*

+  - It happens when you map a buffer or image, because the library maps entire

+    `VkDeviceMemory` block, where different types of images and buffers may end

+    up together, especially on GPUs with unified memory like Intel.

+- *Non-linear image 0xebc91 is aliased with linear buffer 0xeb8e4 which may indicate a bug.*

+  - It happens when you use lost allocations, and a new image or buffer is

+    created in place of an existing object that bacame lost.

+  - It may happen also when you use [defragmentation](@ref defragmentation).

+

+\section general_considerations_allocation_algorithm Allocation algorithm

+

+The library uses following algorithm for allocation, in order:

+

+-# Try to find free range of memory in existing blocks.

+-# If failed, try to create a new block of `VkDeviceMemory`, with preferred block size.

+-# If failed, try to create such block with size/2, size/4, size/8.

+-# If failed and #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flag was

+   specified, try to find space in existing blocks, possilby making some other

+   allocations lost.

+-# If failed, try to allocate separate `VkDeviceMemory` for this allocation,

+   just like when you use #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.

+-# If failed, choose other memory type that meets the requirements specified in

+   VmaAllocationCreateInfo and go to point 1.

+-# If failed, return `VK_ERROR_OUT_OF_DEVICE_MEMORY`.

+

+\section general_considerations_features_not_supported Features not supported

+

+Features deliberately excluded from the scope of this library:

+

+- Data transfer. Uploading (straming) and downloading data of buffers and images

+  between CPU and GPU memory and related synchronization is responsibility of the user.

+  Defining some "texture" object that would automatically stream its data from a

+  staging copy in CPU memory to GPU memory would rather be a feature of another,

+  higher-level library implemented on top of VMA.

+- Allocations for imported/exported external memory. They tend to require

+  explicit memory type index and dedicated allocation anyway, so they don't

+  interact with main features of this library. Such special purpose allocations

+  should be made manually, using `vkCreateBuffer()` and `vkAllocateMemory()`.

+- Recreation of buffers and images. Although the library has functions for

+  buffer and image creation (vmaCreateBuffer(), vmaCreateImage()), you need to

+  recreate these objects yourself after defragmentation. That's because the big

+  structures `VkBufferCreateInfo`, `VkImageCreateInfo` are not stored in

+  #VmaAllocation object.

+- Handling CPU memory allocation failures. When dynamically creating small C++

+  objects in CPU memory (not Vulkan memory), allocation failures are not checked

+  and handled gracefully, because that would complicate code significantly and

+  is usually not needed in desktop PC applications anyway.

+- Code free of any compiler warnings. Maintaining the library to compile and

+  work correctly on so many different platforms is hard enough. Being free of 

+  any warnings, on any version of any compiler, is simply not feasible.

+- This is a C++ library with C interface.

+  Bindings or ports to any other programming languages are welcomed as external projects and

+  are not going to be included into this repository.

+

+*/

+

+/*

+Define this macro to 0/1 to disable/enable support for recording functionality,

+available through VmaAllocatorCreateInfo::pRecordSettings.

+*/

+#ifndef VMA_RECORDING_ENABLED

+    #define VMA_RECORDING_ENABLED 0

+#endif

+

+#ifndef NOMINMAX

+    #define NOMINMAX // For windows.h

+#endif

+

+#if defined(__ANDROID__) && defined(VK_NO_PROTOTYPES) && VMA_STATIC_VULKAN_FUNCTIONS

+    extern PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;

+    extern PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;

+    extern PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;

+    extern PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;

+    extern PFN_vkAllocateMemory vkAllocateMemory;

+    extern PFN_vkFreeMemory vkFreeMemory;

+    extern PFN_vkMapMemory vkMapMemory;

+    extern PFN_vkUnmapMemory vkUnmapMemory;

+    extern PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;

+    extern PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges;

+    extern PFN_vkBindBufferMemory vkBindBufferMemory;

+    extern PFN_vkBindImageMemory vkBindImageMemory;

+    extern PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;

+    extern PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;

+    extern PFN_vkCreateBuffer vkCreateBuffer;

+    extern PFN_vkDestroyBuffer vkDestroyBuffer;

+    extern PFN_vkCreateImage vkCreateImage;

+    extern PFN_vkDestroyImage vkDestroyImage;

+    extern PFN_vkCmdCopyBuffer vkCmdCopyBuffer;

+    #if VMA_VULKAN_VERSION >= 1001000

+        extern PFN_vkGetBufferMemoryRequirements2 vkGetBufferMemoryRequirements2;

+        extern PFN_vkGetImageMemoryRequirements2 vkGetImageMemoryRequirements2;

+        extern PFN_vkBindBufferMemory2 vkBindBufferMemory2;

+        extern PFN_vkBindImageMemory2 vkBindImageMemory2;

+        extern PFN_vkGetPhysicalDeviceMemoryProperties2 vkGetPhysicalDeviceMemoryProperties2;

+    #endif // #if VMA_VULKAN_VERSION >= 1001000

+#endif // #if defined(__ANDROID__) && VMA_STATIC_VULKAN_FUNCTIONS && VK_NO_PROTOTYPES

+

+#ifndef VULKAN_H_

+    #include <vulkan/vulkan.h>

+#endif

+

+#if VMA_RECORDING_ENABLED

+    #if defined(_WIN32)

+        #include <windows.h>

+    #else

+        #error VMA Recording functionality is not yet available for non-Windows platforms

+    #endif

+#endif

+

+// Define this macro to declare maximum supported Vulkan version in format AAABBBCCC,

+// where AAA = major, BBB = minor, CCC = patch.

+// If you want to use version > 1.0, it still needs to be enabled via VmaAllocatorCreateInfo::vulkanApiVersion.

+#if !defined(VMA_VULKAN_VERSION)

+    #if defined(VK_VERSION_1_2)

+        #define VMA_VULKAN_VERSION 1002000

+    #elif defined(VK_VERSION_1_1)

+        #define VMA_VULKAN_VERSION 1001000

+    #else

+        #define VMA_VULKAN_VERSION 1000000

+    #endif

+#endif

+

+#if !defined(VMA_DEDICATED_ALLOCATION)

+    #if VK_KHR_get_memory_requirements2 && VK_KHR_dedicated_allocation

+        #define VMA_DEDICATED_ALLOCATION 1

+    #else

+        #define VMA_DEDICATED_ALLOCATION 0

+    #endif

+#endif

+

+#if !defined(VMA_BIND_MEMORY2)

+    #if VK_KHR_bind_memory2

+        #define VMA_BIND_MEMORY2 1

+    #else

+        #define VMA_BIND_MEMORY2 0

+    #endif

+#endif

+

+#if !defined(VMA_MEMORY_BUDGET)

+    #if VK_EXT_memory_budget && (VK_KHR_get_physical_device_properties2 || VMA_VULKAN_VERSION >= 1001000)

+        #define VMA_MEMORY_BUDGET 1

+    #else

+        #define VMA_MEMORY_BUDGET 0

+    #endif

+#endif

+

+// Defined to 1 when VK_KHR_buffer_device_address device extension or equivalent core Vulkan 1.2 feature is defined in its headers.

+#if !defined(VMA_BUFFER_DEVICE_ADDRESS)

+    #if VK_KHR_buffer_device_address || VMA_VULKAN_VERSION >= 1002000

+        #define VMA_BUFFER_DEVICE_ADDRESS 1

+    #else

+        #define VMA_BUFFER_DEVICE_ADDRESS 0

+    #endif

+#endif

+

+// Define these macros to decorate all public functions with additional code,

+// before and after returned type, appropriately. This may be useful for

+// exporing the functions when compiling VMA as a separate library. Example:

+// #define VMA_CALL_PRE  __declspec(dllexport)

+// #define VMA_CALL_POST __cdecl

+#ifndef VMA_CALL_PRE

+    #define VMA_CALL_PRE

+#endif

+#ifndef VMA_CALL_POST

+    #define VMA_CALL_POST

+#endif

+

+// Define this macro to decorate pointers with an attribute specifying the

+// length of the array they point to if they are not null.

+//

+// The length may be one of

+// - The name of another parameter in the argument list where the pointer is declared

+// - The name of another member in the struct where the pointer is declared

+// - The name of a member of a struct type, meaning the value of that member in

+//   the context of the call. For example

+//   VMA_LEN_IF_NOT_NULL("VkPhysicalDeviceMemoryProperties::memoryHeapCount"),

+//   this means the number of memory heaps available in the device associated

+//   with the VmaAllocator being dealt with.

+#ifndef VMA_LEN_IF_NOT_NULL

+    #define VMA_LEN_IF_NOT_NULL(len)

+#endif

+

+// The VMA_NULLABLE macro is defined to be _Nullable when compiling with Clang.

+// see: https://clang.llvm.org/docs/AttributeReference.html#nullable

+#ifndef VMA_NULLABLE

+    #ifdef __clang__

+        #define VMA_NULLABLE _Nullable

+    #else

+        #define VMA_NULLABLE

+    #endif

+#endif

+

+// The VMA_NOT_NULL macro is defined to be _Nonnull when compiling with Clang.

+// see: https://clang.llvm.org/docs/AttributeReference.html#nonnull

+#ifndef VMA_NOT_NULL

+    #ifdef __clang__

+        #define VMA_NOT_NULL _Nonnull

+    #else

+        #define VMA_NOT_NULL

+    #endif

+#endif

+

+// If non-dispatchable handles are represented as pointers then we can give

+// then nullability annotations

+#ifndef VMA_NOT_NULL_NON_DISPATCHABLE

+    #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)

+        #define VMA_NOT_NULL_NON_DISPATCHABLE VMA_NOT_NULL

+    #else

+        #define VMA_NOT_NULL_NON_DISPATCHABLE

+    #endif

+#endif

+

+#ifndef VMA_NULLABLE_NON_DISPATCHABLE

+    #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)

+        #define VMA_NULLABLE_NON_DISPATCHABLE VMA_NULLABLE

+    #else

+        #define VMA_NULLABLE_NON_DISPATCHABLE

+    #endif

+#endif

+

+/** \struct VmaAllocator

+\brief Represents main object of this library initialized.

+

+Fill structure #VmaAllocatorCreateInfo and call function vmaCreateAllocator() to create it.

+Call function vmaDestroyAllocator() to destroy it.

+

+It is recommended to create just one object of this type per `VkDevice` object,

+right after Vulkan is initialized and keep it alive until before Vulkan device is destroyed.

+*/

+VK_DEFINE_HANDLE(VmaAllocator)

+

+/// Callback function called after successful vkAllocateMemory.

+typedef void (VKAPI_PTR *PFN_vmaAllocateDeviceMemoryFunction)(

+    VmaAllocator VMA_NOT_NULL                    allocator,

+    uint32_t                                     memoryType,

+    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,

+    VkDeviceSize                                 size,

+    void* VMA_NULLABLE                           pUserData);

+/// Callback function called before vkFreeMemory.

+typedef void (VKAPI_PTR *PFN_vmaFreeDeviceMemoryFunction)(

+    VmaAllocator VMA_NOT_NULL                    allocator,

+    uint32_t                                     memoryType,

+    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,

+    VkDeviceSize                                 size,

+    void* VMA_NULLABLE                           pUserData);

+

+/** \brief Set of callbacks that the library will call for `vkAllocateMemory` and `vkFreeMemory`.

+

+Provided for informative purpose, e.g. to gather statistics about number of

+allocations or total amount of memory allocated in Vulkan.

+

+Used in VmaAllocatorCreateInfo::pDeviceMemoryCallbacks.

+*/

+typedef struct VmaDeviceMemoryCallbacks {

+    /// Optional, can be null.

+    PFN_vmaAllocateDeviceMemoryFunction VMA_NULLABLE pfnAllocate;

+    /// Optional, can be null.

+    PFN_vmaFreeDeviceMemoryFunction VMA_NULLABLE pfnFree;

+    /// Optional, can be null.

+    void* VMA_NULLABLE pUserData;

+} VmaDeviceMemoryCallbacks;

+

+/// Flags for created #VmaAllocator.

+typedef enum VmaAllocatorCreateFlagBits {

+    /** \brief Allocator and all objects created from it will not be synchronized internally, so you must guarantee they are used from only one thread at a time or synchronized externally by you.

+

+    Using this flag may increase performance because internal mutexes are not used.

+    */

+    VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT = 0x00000001,

+    /** \brief Enables usage of VK_KHR_dedicated_allocation extension.

+

+    The flag works only if VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_0`.

+    When it's `VK_API_VERSION_1_1`, the flag is ignored because the extension has been promoted to Vulkan 1.1.

+

+    Using this extenion will automatically allocate dedicated blocks of memory for

+    some buffers and images instead of suballocating place for them out of bigger

+    memory blocks (as if you explicitly used #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT

+    flag) when it is recommended by the driver. It may improve performance on some

+    GPUs.

+

+    You may set this flag only if you found out that following device extensions are

+    supported, you enabled them while creating Vulkan device passed as

+    VmaAllocatorCreateInfo::device, and you want them to be used internally by this

+    library:

+

+    - VK_KHR_get_memory_requirements2 (device extension)

+    - VK_KHR_dedicated_allocation (device extension)

+

+    When this flag is set, you can experience following warnings reported by Vulkan

+    validation layer. You can ignore them.

+

+    > vkBindBufferMemory(): Binding memory to buffer 0x2d but vkGetBufferMemoryRequirements() has not been called on that buffer.

+    */

+    VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT = 0x00000002,

+    /**

+    Enables usage of VK_KHR_bind_memory2 extension.

+

+    The flag works only if VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_0`.

+    When it's `VK_API_VERSION_1_1`, the flag is ignored because the extension has been promoted to Vulkan 1.1.

+

+    You may set this flag only if you found out that this device extension is supported,

+    you enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,

+    and you want it to be used internally by this library.

+

+    The extension provides functions `vkBindBufferMemory2KHR` and `vkBindImageMemory2KHR`,

+    which allow to pass a chain of `pNext` structures while binding.

+    This flag is required if you use `pNext` parameter in vmaBindBufferMemory2() or vmaBindImageMemory2().

+    */

+    VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT = 0x00000004,

+    /**

+    Enables usage of VK_EXT_memory_budget extension.

+

+    You may set this flag only if you found out that this device extension is supported,

+    you enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,

+    and you want it to be used internally by this library, along with another instance extension

+    VK_KHR_get_physical_device_properties2, which is required by it (or Vulkan 1.1, where this extension is promoted).

+

+    The extension provides query for current memory usage and budget, which will probably

+    be more accurate than an estimation used by the library otherwise.

+    */

+    VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT = 0x00000008,

+    /**

+    Enables usage of VK_AMD_device_coherent_memory extension.

+    

+    You may set this flag only if you:

+

+    - found out that this device extension is supported and enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,

+    - checked that `VkPhysicalDeviceCoherentMemoryFeaturesAMD::deviceCoherentMemory` is true and set it while creating the Vulkan device,

+    - want it to be used internally by this library.

+

+    The extension and accompanying device feature provide access to memory types with

+    `VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD` and `VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD` flags.

+    They are useful mostly for writing breadcrumb markers - a common method for debugging GPU crash/hang/TDR.

+    

+    When the extension is not enabled, such memory types are still enumerated, but their usage is illegal.

+    To protect from this error, if you don't create the allocator with this flag, it will refuse to allocate any memory or create a custom pool in such memory type,

+    returning `VK_ERROR_FEATURE_NOT_PRESENT`.

+    */

+    VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT = 0x00000010,

+    /**

+    Enables usage of "buffer device address" feature, which allows you to use function

+    `vkGetBufferDeviceAddress*` to get raw GPU pointer to a buffer and pass it for usage inside a shader.

+

+    You may set this flag only if you:

+

+    1. (For Vulkan version < 1.2) Found as available and enabled device extension

+    VK_KHR_buffer_device_address.

+    This extension is promoted to core Vulkan 1.2.

+    2. Found as available and enabled device feature `VkPhysicalDeviceBufferDeviceAddressFeatures*::bufferDeviceAddress`.

+

+    When this flag is set, you can create buffers with `VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT*` using VMA.

+    The library automatically adds `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT*` to

+    allocated memory blocks wherever it might be needed.

+

+    For more information, see documentation chapter \ref enabling_buffer_device_address.

+    */

+    VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT = 0x00000020,

+

+    VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF

+} VmaAllocatorCreateFlagBits;

+typedef VkFlags VmaAllocatorCreateFlags;

+

+/** \brief Pointers to some Vulkan functions - a subset used by the library.

+

+Used in VmaAllocatorCreateInfo::pVulkanFunctions.

+*/

+typedef struct VmaVulkanFunctions {

+    PFN_vkGetPhysicalDeviceProperties VMA_NULLABLE vkGetPhysicalDeviceProperties;

+    PFN_vkGetPhysicalDeviceMemoryProperties VMA_NULLABLE vkGetPhysicalDeviceMemoryProperties;

+    PFN_vkAllocateMemory VMA_NULLABLE vkAllocateMemory;

+    PFN_vkFreeMemory VMA_NULLABLE vkFreeMemory;

+    PFN_vkMapMemory VMA_NULLABLE vkMapMemory;

+    PFN_vkUnmapMemory VMA_NULLABLE vkUnmapMemory;

+    PFN_vkFlushMappedMemoryRanges VMA_NULLABLE vkFlushMappedMemoryRanges;

+    PFN_vkInvalidateMappedMemoryRanges VMA_NULLABLE vkInvalidateMappedMemoryRanges;

+    PFN_vkBindBufferMemory VMA_NULLABLE vkBindBufferMemory;

+    PFN_vkBindImageMemory VMA_NULLABLE vkBindImageMemory;

+    PFN_vkGetBufferMemoryRequirements VMA_NULLABLE vkGetBufferMemoryRequirements;

+    PFN_vkGetImageMemoryRequirements VMA_NULLABLE vkGetImageMemoryRequirements;

+    PFN_vkCreateBuffer VMA_NULLABLE vkCreateBuffer;

+    PFN_vkDestroyBuffer VMA_NULLABLE vkDestroyBuffer;

+    PFN_vkCreateImage VMA_NULLABLE vkCreateImage;

+    PFN_vkDestroyImage VMA_NULLABLE vkDestroyImage;

+    PFN_vkCmdCopyBuffer VMA_NULLABLE vkCmdCopyBuffer;

+#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000

+    PFN_vkGetBufferMemoryRequirements2KHR VMA_NULLABLE vkGetBufferMemoryRequirements2KHR;

+    PFN_vkGetImageMemoryRequirements2KHR VMA_NULLABLE vkGetImageMemoryRequirements2KHR;

+#endif

+#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION >= 1001000

+    PFN_vkBindBufferMemory2KHR VMA_NULLABLE vkBindBufferMemory2KHR;

+    PFN_vkBindImageMemory2KHR VMA_NULLABLE vkBindImageMemory2KHR;

+#endif

+#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION >= 1001000

+    PFN_vkGetPhysicalDeviceMemoryProperties2KHR VMA_NULLABLE vkGetPhysicalDeviceMemoryProperties2KHR;

+#endif

+} VmaVulkanFunctions;

+

+/// Flags to be used in VmaRecordSettings::flags.

+typedef enum VmaRecordFlagBits {

+    /** \brief Enables flush after recording every function call.

+

+    Enable it if you expect your application to crash, which may leave recording file truncated.

+    It may degrade performance though.

+    */

+    VMA_RECORD_FLUSH_AFTER_CALL_BIT = 0x00000001,

+    

+    VMA_RECORD_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF

+} VmaRecordFlagBits;

+typedef VkFlags VmaRecordFlags;

+

+/// Parameters for recording calls to VMA functions. To be used in VmaAllocatorCreateInfo::pRecordSettings.

+typedef struct VmaRecordSettings

+{

+    /// Flags for recording. Use #VmaRecordFlagBits enum.

+    VmaRecordFlags flags;

+    /** \brief Path to the file that should be written by the recording.

+

+    Suggested extension: "csv".

+    If the file already exists, it will be overwritten.

+    It will be opened for the whole time #VmaAllocator object is alive.

+    If opening this file fails, creation of the whole allocator object fails.

+    */

+    const char* VMA_NOT_NULL pFilePath;

+} VmaRecordSettings;

+

+/// Description of a Allocator to be created.

+typedef struct VmaAllocatorCreateInfo

+{

+    /// Flags for created allocator. Use #VmaAllocatorCreateFlagBits enum.

+    VmaAllocatorCreateFlags flags;

+    /// Vulkan physical device.

+    /** It must be valid throughout whole lifetime of created allocator. */

+    VkPhysicalDevice VMA_NOT_NULL physicalDevice;

+    /// Vulkan device.

+    /** It must be valid throughout whole lifetime of created allocator. */

+    VkDevice VMA_NOT_NULL device;

+    /// Preferred size of a single `VkDeviceMemory` block to be allocated from large heaps > 1 GiB. Optional.

+    /** Set to 0 to use default, which is currently 256 MiB. */

+    VkDeviceSize preferredLargeHeapBlockSize;

+    /// Custom CPU memory allocation callbacks. Optional.

+    /** Optional, can be null. When specified, will also be used for all CPU-side memory allocations. */

+    const VkAllocationCallbacks* VMA_NULLABLE pAllocationCallbacks;

+    /// Informative callbacks for `vkAllocateMemory`, `vkFreeMemory`. Optional.

+    /** Optional, can be null. */

+    const VmaDeviceMemoryCallbacks* VMA_NULLABLE pDeviceMemoryCallbacks;

+    /** \brief Maximum number of additional frames that are in use at the same time as current frame.

+

+    This value is used only when you make allocations with

+    VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag. Such allocation cannot become

+    lost if allocation.lastUseFrameIndex >= allocator.currentFrameIndex - frameInUseCount.

+

+    For example, if you double-buffer your command buffers, so resources used for

+    rendering in previous frame may still be in use by the GPU at the moment you

+    allocate resources needed for the current frame, set this value to 1.

+

+    If you want to allow any allocations other than used in the current frame to

+    become lost, set this value to 0.

+    */

+    uint32_t frameInUseCount;

+    /** \brief Either null or a pointer to an array of limits on maximum number of bytes that can be allocated out of particular Vulkan memory heap.

+

+    If not NULL, it must be a pointer to an array of

+    `VkPhysicalDeviceMemoryProperties::memoryHeapCount` elements, defining limit on

+    maximum number of bytes that can be allocated out of particular Vulkan memory

+    heap.

+

+    Any of the elements may be equal to `VK_WHOLE_SIZE`, which means no limit on that

+    heap. This is also the default in case of `pHeapSizeLimit` = NULL.

+

+    If there is a limit defined for a heap:

+

+    - If user tries to allocate more memory from that heap using this allocator,

+      the allocation fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.

+    - If the limit is smaller than heap size reported in `VkMemoryHeap::size`, the

+      value of this limit will be reported instead when using vmaGetMemoryProperties().

+

+    Warning! Using this feature may not be equivalent to installing a GPU with

+    smaller amount of memory, because graphics driver doesn't necessary fail new

+    allocations with `VK_ERROR_OUT_OF_DEVICE_MEMORY` result when memory capacity is

+    exceeded. It may return success and just silently migrate some device memory

+    blocks to system RAM. This driver behavior can also be controlled using

+    VK_AMD_memory_overallocation_behavior extension.

+    */

+    const VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL("VkPhysicalDeviceMemoryProperties::memoryHeapCount") pHeapSizeLimit;

+

+    /** \brief Pointers to Vulkan functions. Can be null.

+

+    For details see [Pointers to Vulkan functions](@ref config_Vulkan_functions).

+    */

+    const VmaVulkanFunctions* VMA_NULLABLE pVulkanFunctions;

+    /** \brief Parameters for recording of VMA calls. Can be null.

+

+    If not null, it enables recording of calls to VMA functions to a file.

+    If support for recording is not enabled using `VMA_RECORDING_ENABLED` macro,

+    creation of the allocator object fails with `VK_ERROR_FEATURE_NOT_PRESENT`.

+    */

+    const VmaRecordSettings* VMA_NULLABLE pRecordSettings;

+    /** \brief Handle to Vulkan instance object.

+

+    Starting from version 3.0.0 this member is no longer optional, it must be set!

+    */

+    VkInstance VMA_NOT_NULL instance;

+    /** \brief Optional. The highest version of Vulkan that the application is designed to use.

+    

+    It must be a value in the format as created by macro `VK_MAKE_VERSION` or a constant like: `VK_API_VERSION_1_1`, `VK_API_VERSION_1_0`.

+    The patch version number specified is ignored. Only the major and minor versions are considered.

+    It must be less or equal (preferably equal) to value as passed to `vkCreateInstance` as `VkApplicationInfo::apiVersion`.

+    Only versions 1.0 and 1.1 are supported by the current implementation.

+    Leaving it initialized to zero is equivalent to `VK_API_VERSION_1_0`.

+    */

+    uint32_t vulkanApiVersion;

+} VmaAllocatorCreateInfo;

+

+/// Creates Allocator object.

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAllocator(

+    const VmaAllocatorCreateInfo* VMA_NOT_NULL pCreateInfo,

+    VmaAllocator VMA_NULLABLE * VMA_NOT_NULL pAllocator);

+

+/// Destroys allocator object.

+VMA_CALL_PRE void VMA_CALL_POST vmaDestroyAllocator(

+    VmaAllocator VMA_NULLABLE allocator);

+

+/** \brief Information about existing #VmaAllocator object.

+*/

+typedef struct VmaAllocatorInfo

+{

+    /** \brief Handle to Vulkan instance object.

+

+    This is the same value as has been passed through VmaAllocatorCreateInfo::instance.

+    */

+    VkInstance VMA_NOT_NULL instance;

+    /** \brief Handle to Vulkan physical device object.

+

+    This is the same value as has been passed through VmaAllocatorCreateInfo::physicalDevice.

+    */

+    VkPhysicalDevice VMA_NOT_NULL physicalDevice;

+    /** \brief Handle to Vulkan device object.

+

+    This is the same value as has been passed through VmaAllocatorCreateInfo::device.

+    */

+    VkDevice VMA_NOT_NULL device;

+} VmaAllocatorInfo;

+

+/** \brief Returns information about existing #VmaAllocator object - handle to Vulkan device etc.

+

+It might be useful if you want to keep just the #VmaAllocator handle and fetch other required handles to

+`VkPhysicalDevice`, `VkDevice` etc. every time using this function.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocatorInfo(VmaAllocator VMA_NOT_NULL allocator, VmaAllocatorInfo* VMA_NOT_NULL pAllocatorInfo);

+

+/**

+PhysicalDeviceProperties are fetched from physicalDevice by the allocator.

+You can access it here, without fetching it again on your own.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaGetPhysicalDeviceProperties(

+    VmaAllocator VMA_NOT_NULL allocator,

+    const VkPhysicalDeviceProperties* VMA_NULLABLE * VMA_NOT_NULL ppPhysicalDeviceProperties);

+

+/**

+PhysicalDeviceMemoryProperties are fetched from physicalDevice by the allocator.

+You can access it here, without fetching it again on your own.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryProperties(

+    VmaAllocator VMA_NOT_NULL allocator,

+    const VkPhysicalDeviceMemoryProperties* VMA_NULLABLE * VMA_NOT_NULL ppPhysicalDeviceMemoryProperties);

+

+/**

+\brief Given Memory Type Index, returns Property Flags of this memory type.

+

+This is just a convenience function. Same information can be obtained using

+vmaGetMemoryProperties().

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryTypeProperties(

+    VmaAllocator VMA_NOT_NULL allocator,

+    uint32_t memoryTypeIndex,

+    VkMemoryPropertyFlags* VMA_NOT_NULL pFlags);

+

+/** \brief Sets index of the current frame.

+

+This function must be used if you make allocations with

+#VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT and

+#VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flags to inform the allocator

+when a new frame begins. Allocations queried using vmaGetAllocationInfo() cannot

+become lost in the current frame.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaSetCurrentFrameIndex(

+    VmaAllocator VMA_NOT_NULL allocator,

+    uint32_t frameIndex);

+

+/** \brief Calculated statistics of memory usage in entire allocator.

+*/

+typedef struct VmaStatInfo

+{

+    /// Number of `VkDeviceMemory` Vulkan memory blocks allocated.

+    uint32_t blockCount;

+    /// Number of #VmaAllocation allocation objects allocated.

+    uint32_t allocationCount;

+    /// Number of free ranges of memory between allocations.

+    uint32_t unusedRangeCount;

+    /// Total number of bytes occupied by all allocations.

+    VkDeviceSize usedBytes;

+    /// Total number of bytes occupied by unused ranges.

+    VkDeviceSize unusedBytes;

+    VkDeviceSize allocationSizeMin, allocationSizeAvg, allocationSizeMax;

+    VkDeviceSize unusedRangeSizeMin, unusedRangeSizeAvg, unusedRangeSizeMax;

+} VmaStatInfo;

+

+/// General statistics from current state of Allocator.

+typedef struct VmaStats

+{

+    VmaStatInfo memoryType[VK_MAX_MEMORY_TYPES];

+    VmaStatInfo memoryHeap[VK_MAX_MEMORY_HEAPS];

+    VmaStatInfo total;

+} VmaStats;

+

+/** \brief Retrieves statistics from current state of the Allocator.

+

+This function is called "calculate" not "get" because it has to traverse all

+internal data structures, so it may be quite slow. For faster but more brief statistics

+suitable to be called every frame or every allocation, use vmaGetBudget().

+

+Note that when using allocator from multiple threads, returned information may immediately

+become outdated.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaCalculateStats(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaStats* VMA_NOT_NULL pStats);

+

+/** \brief Statistics of current memory usage and available budget, in bytes, for specific memory heap.

+*/

+typedef struct VmaBudget

+{

+    /** \brief Sum size of all `VkDeviceMemory` blocks allocated from particular heap, in bytes.

+    */

+    VkDeviceSize blockBytes;

+    

+    /** \brief Sum size of all allocations created in particular heap, in bytes.

+    

+    Usually less or equal than `blockBytes`.

+    Difference `blockBytes - allocationBytes` is the amount of memory allocated but unused -

+    available for new allocations or wasted due to fragmentation.

+    

+    It might be greater than `blockBytes` if there are some allocations in lost state, as they account

+    to this value as well.

+    */

+    VkDeviceSize allocationBytes;

+    

+    /** \brief Estimated current memory usage of the program, in bytes.

+    

+    Fetched from system using `VK_EXT_memory_budget` extension if enabled.

+    

+    It might be different than `blockBytes` (usually higher) due to additional implicit objects

+    also occupying the memory, like swapchain, pipelines, descriptor heaps, command buffers, or

+    `VkDeviceMemory` blocks allocated outside of this library, if any.

+    */

+    VkDeviceSize usage;

+    

+    /** \brief Estimated amount of memory available to the program, in bytes.

+    

+    Fetched from system using `VK_EXT_memory_budget` extension if enabled.

+    

+    It might be different (most probably smaller) than `VkMemoryHeap::size[heapIndex]` due to factors

+    external to the program, like other programs also consuming system resources.

+    Difference `budget - usage` is the amount of additional memory that can probably

+    be allocated without problems. Exceeding the budget may result in various problems.

+    */

+    VkDeviceSize budget;

+} VmaBudget;

+

+/** \brief Retrieves information about current memory budget for all memory heaps.

+

+\param[out] pBudget Must point to array with number of elements at least equal to number of memory heaps in physical device used.

+

+This function is called "get" not "calculate" because it is very fast, suitable to be called

+every frame or every allocation. For more detailed statistics use vmaCalculateStats().

+

+Note that when using allocator from multiple threads, returned information may immediately

+become outdated.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaGetBudget(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaBudget* VMA_NOT_NULL pBudget);

+

+#ifndef VMA_STATS_STRING_ENABLED

+#define VMA_STATS_STRING_ENABLED 1

+#endif

+

+#if VMA_STATS_STRING_ENABLED

+

+/// Builds and returns statistics as string in JSON format.

+/** @param[out] ppStatsString Must be freed using vmaFreeStatsString() function.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaBuildStatsString(

+    VmaAllocator VMA_NOT_NULL allocator,

+    char* VMA_NULLABLE * VMA_NOT_NULL ppStatsString,

+    VkBool32 detailedMap);

+

+VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(

+    VmaAllocator VMA_NOT_NULL allocator,

+    char* VMA_NULLABLE pStatsString);

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+/** \struct VmaPool

+\brief Represents custom memory pool

+

+Fill structure VmaPoolCreateInfo and call function vmaCreatePool() to create it.

+Call function vmaDestroyPool() to destroy it.

+

+For more information see [Custom memory pools](@ref choosing_memory_type_custom_memory_pools).

+*/

+VK_DEFINE_HANDLE(VmaPool)

+

+typedef enum VmaMemoryUsage

+{

+    /** No intended memory usage specified.

+    Use other members of VmaAllocationCreateInfo to specify your requirements.

+    */

+    VMA_MEMORY_USAGE_UNKNOWN = 0,

+    /** Memory will be used on device only, so fast access from the device is preferred.

+    It usually means device-local GPU (video) memory.

+    No need to be mappable on host.

+    It is roughly equivalent of `D3D12_HEAP_TYPE_DEFAULT`.

+

+    Usage:

+    

+    - Resources written and read by device, e.g. images used as attachments.

+    - Resources transferred from host once (immutable) or infrequently and read by

+      device multiple times, e.g. textures to be sampled, vertex buffers, uniform

+      (constant) buffers, and majority of other types of resources used on GPU.

+

+    Allocation may still end up in `HOST_VISIBLE` memory on some implementations.

+    In such case, you are free to map it.

+    You can use #VMA_ALLOCATION_CREATE_MAPPED_BIT with this usage type.

+    */

+    VMA_MEMORY_USAGE_GPU_ONLY = 1,

+    /** Memory will be mappable on host.

+    It usually means CPU (system) memory.

+    Guarantees to be `HOST_VISIBLE` and `HOST_COHERENT`.

+    CPU access is typically uncached. Writes may be write-combined.

+    Resources created in this pool may still be accessible to the device, but access to them can be slow.

+    It is roughly equivalent of `D3D12_HEAP_TYPE_UPLOAD`.

+

+    Usage: Staging copy of resources used as transfer source.

+    */

+    VMA_MEMORY_USAGE_CPU_ONLY = 2,

+    /**

+    Memory that is both mappable on host (guarantees to be `HOST_VISIBLE`) and preferably fast to access by GPU.

+    CPU access is typically uncached. Writes may be write-combined.

+

+    Usage: Resources written frequently by host (dynamic), read by device. E.g. textures, vertex buffers, uniform buffers updated every frame or every draw call.

+    */

+    VMA_MEMORY_USAGE_CPU_TO_GPU = 3,

+    /** Memory mappable on host (guarantees to be `HOST_VISIBLE`) and cached.

+    It is roughly equivalent of `D3D12_HEAP_TYPE_READBACK`.

+

+    Usage:

+

+    - Resources written by device, read by host - results of some computations, e.g. screen capture, average scene luminance for HDR tone mapping.

+    - Any resources read or accessed randomly on host, e.g. CPU-side copy of vertex buffer used as source of transfer, but also used for collision detection.

+    */

+    VMA_MEMORY_USAGE_GPU_TO_CPU = 4,

+    /** CPU memory - memory that is preferably not `DEVICE_LOCAL`, but also not guaranteed to be `HOST_VISIBLE`.

+

+    Usage: Staging copy of resources moved from GPU memory to CPU memory as part

+    of custom paging/residency mechanism, to be moved back to GPU memory when needed.

+    */

+    VMA_MEMORY_USAGE_CPU_COPY = 5,

+    /** Lazily allocated GPU memory having `VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT`.

+    Exists mostly on mobile platforms. Using it on desktop PC or other GPUs with no such memory type present will fail the allocation.

+    

+    Usage: Memory for transient attachment images (color attachments, depth attachments etc.), created with `VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT`.

+

+    Allocations with this usage are always created as dedicated - it implies #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.

+    */

+    VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED = 6,

+

+    VMA_MEMORY_USAGE_MAX_ENUM = 0x7FFFFFFF

+} VmaMemoryUsage;

+

+/// Flags to be passed as VmaAllocationCreateInfo::flags.

+typedef enum VmaAllocationCreateFlagBits {

+    /** \brief Set this flag if the allocation should have its own memory block.

+    

+    Use it for special, big resources, like fullscreen images used as attachments.

+   

+    You should not use this flag if VmaAllocationCreateInfo::pool is not null.

+    */

+    VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT = 0x00000001,

+

+    /** \brief Set this flag to only try to allocate from existing `VkDeviceMemory` blocks and never create new such block.

+    

+    If new allocation cannot be placed in any of the existing blocks, allocation

+    fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY` error.

+    

+    You should not use #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT and

+    #VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT at the same time. It makes no sense.

+    

+    If VmaAllocationCreateInfo::pool is not null, this flag is implied and ignored. */

+    VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT = 0x00000002,

+    /** \brief Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.

+    

+    Pointer to mapped memory will be returned through VmaAllocationInfo::pMappedData.

+

+    Is it valid to use this flag for allocation made from memory type that is not

+    `HOST_VISIBLE`. This flag is then ignored and memory is not mapped. This is

+    useful if you need an allocation that is efficient to use on GPU

+    (`DEVICE_LOCAL`) and still want to map it directly if possible on platforms that

+    support it (e.g. Intel GPU).

+

+    You should not use this flag together with #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT.

+    */

+    VMA_ALLOCATION_CREATE_MAPPED_BIT = 0x00000004,

+    /** Allocation created with this flag can become lost as a result of another

+    allocation with #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flag, so you

+    must check it before use.

+

+    To check if allocation is not lost, call vmaGetAllocationInfo() and check if

+    VmaAllocationInfo::deviceMemory is not `VK_NULL_HANDLE`.

+

+    For details about supporting lost allocations, see Lost Allocations

+    chapter of User Guide on Main Page.

+

+    You should not use this flag together with #VMA_ALLOCATION_CREATE_MAPPED_BIT.

+    */

+    VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT = 0x00000008,

+    /** While creating allocation using this flag, other allocations that were

+    created with flag #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT can become lost.

+

+    For details about supporting lost allocations, see Lost Allocations

+    chapter of User Guide on Main Page.

+    */

+    VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT = 0x00000010,

+    /** Set this flag to treat VmaAllocationCreateInfo::pUserData as pointer to a

+    null-terminated string. Instead of copying pointer value, a local copy of the

+    string is made and stored in allocation's `pUserData`. The string is automatically

+    freed together with the allocation. It is also used in vmaBuildStatsString().

+    */

+    VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT = 0x00000020,

+    /** Allocation will be created from upper stack in a double stack pool.

+

+    This flag is only allowed for custom pools created with #VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT flag.

+    */

+    VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT = 0x00000040,

+    /** Create both buffer/image and allocation, but don't bind them together.

+    It is useful when you want to bind yourself to do some more advanced binding, e.g. using some extensions.

+    The flag is meaningful only with functions that bind by default: vmaCreateBuffer(), vmaCreateImage().

+    Otherwise it is ignored.

+    */

+    VMA_ALLOCATION_CREATE_DONT_BIND_BIT = 0x00000080,

+    /** Create allocation only if additional device memory required for it, if any, won't exceed

+    memory budget. Otherwise return `VK_ERROR_OUT_OF_DEVICE_MEMORY`.

+    */

+    VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT = 0x00000100,

+

+    /** Allocation strategy that chooses smallest possible free range for the

+    allocation.

+    */

+    VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT  = 0x00010000,

+    /** Allocation strategy that chooses biggest possible free range for the

+    allocation.

+    */

+    VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT = 0x00020000,

+    /** Allocation strategy that chooses first suitable free range for the

+    allocation.

+

+    "First" doesn't necessarily means the one with smallest offset in memory,

+    but rather the one that is easiest and fastest to find.

+    */

+    VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT = 0x00040000,

+

+    /** Allocation strategy that tries to minimize memory usage.

+    */

+    VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT = VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT,

+    /** Allocation strategy that tries to minimize allocation time.

+    */

+    VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT = VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT,

+    /** Allocation strategy that tries to minimize memory fragmentation.

+    */

+    VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT = VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT,

+

+    /** A bit mask to extract only `STRATEGY` bits from entire set of flags.

+    */

+    VMA_ALLOCATION_CREATE_STRATEGY_MASK =

+        VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT |

+        VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT |

+        VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT,

+

+    VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF

+} VmaAllocationCreateFlagBits;

+typedef VkFlags VmaAllocationCreateFlags;

+

+typedef struct VmaAllocationCreateInfo

+{

+    /// Use #VmaAllocationCreateFlagBits enum.

+    VmaAllocationCreateFlags flags;

+    /** \brief Intended usage of memory.

+    

+    You can leave #VMA_MEMORY_USAGE_UNKNOWN if you specify memory requirements in other way. \n

+    If `pool` is not null, this member is ignored.

+    */

+    VmaMemoryUsage usage;

+    /** \brief Flags that must be set in a Memory Type chosen for an allocation.

+    

+    Leave 0 if you specify memory requirements in other way. \n

+    If `pool` is not null, this member is ignored.*/

+    VkMemoryPropertyFlags requiredFlags;

+    /** \brief Flags that preferably should be set in a memory type chosen for an allocation.

+    

+    Set to 0 if no additional flags are prefered. \n

+    If `pool` is not null, this member is ignored. */

+    VkMemoryPropertyFlags preferredFlags;

+    /** \brief Bitmask containing one bit set for every memory type acceptable for this allocation.

+

+    Value 0 is equivalent to `UINT32_MAX` - it means any memory type is accepted if

+    it meets other requirements specified by this structure, with no further

+    restrictions on memory type index. \n

+    If `pool` is not null, this member is ignored.

+    */

+    uint32_t memoryTypeBits;

+    /** \brief Pool that this allocation should be created in.

+

+    Leave `VK_NULL_HANDLE` to allocate from default pool. If not null, members:

+    `usage`, `requiredFlags`, `preferredFlags`, `memoryTypeBits` are ignored.

+    */

+    VmaPool VMA_NULLABLE pool;

+    /** \brief Custom general-purpose pointer that will be stored in #VmaAllocation, can be read as VmaAllocationInfo::pUserData and changed using vmaSetAllocationUserData().

+    

+    If #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT is used, it must be either

+    null or pointer to a null-terminated string. The string will be then copied to

+    internal buffer, so it doesn't need to be valid after allocation call.

+    */

+    void* VMA_NULLABLE pUserData;

+} VmaAllocationCreateInfo;

+

+/**

+\brief Helps to find memoryTypeIndex, given memoryTypeBits and VmaAllocationCreateInfo.

+

+This algorithm tries to find a memory type that:

+

+- Is allowed by memoryTypeBits.

+- Contains all the flags from pAllocationCreateInfo->requiredFlags.

+- Matches intended usage.

+- Has as many flags from pAllocationCreateInfo->preferredFlags as possible.

+

+\return Returns VK_ERROR_FEATURE_NOT_PRESENT if not found. Receiving such result

+from this function or any other allocating function probably means that your

+device doesn't support any memory type with requested features for the specific

+type of resource you want to use it for. Please check parameters of your

+resource, like image layout (OPTIMAL versus LINEAR) or mip level count.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndex(

+    VmaAllocator VMA_NOT_NULL allocator,

+    uint32_t memoryTypeBits,

+    const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,

+    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);

+

+/**

+\brief Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.

+

+It can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex.

+It internally creates a temporary, dummy buffer that never has memory bound.

+It is just a convenience function, equivalent to calling:

+

+- `vkCreateBuffer`

+- `vkGetBufferMemoryRequirements`

+- `vmaFindMemoryTypeIndex`

+- `vkDestroyBuffer`

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForBufferInfo(

+    VmaAllocator VMA_NOT_NULL allocator,

+    const VkBufferCreateInfo* VMA_NOT_NULL pBufferCreateInfo,

+    const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,

+    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);

+

+/**

+\brief Helps to find memoryTypeIndex, given VkImageCreateInfo and VmaAllocationCreateInfo.

+

+It can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex.

+It internally creates a temporary, dummy image that never has memory bound.

+It is just a convenience function, equivalent to calling:

+

+- `vkCreateImage`

+- `vkGetImageMemoryRequirements`

+- `vmaFindMemoryTypeIndex`

+- `vkDestroyImage`

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForImageInfo(

+    VmaAllocator VMA_NOT_NULL allocator,

+    const VkImageCreateInfo* VMA_NOT_NULL pImageCreateInfo,

+    const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,

+    uint32_t* VMA_NOT_NULL pMemoryTypeIndex);

+

+/// Flags to be passed as VmaPoolCreateInfo::flags.

+typedef enum VmaPoolCreateFlagBits {

+    /** \brief Use this flag if you always allocate only buffers and linear images or only optimal images out of this pool and so Buffer-Image Granularity can be ignored.

+

+    This is an optional optimization flag.

+

+    If you always allocate using vmaCreateBuffer(), vmaCreateImage(),

+    vmaAllocateMemoryForBuffer(), then you don't need to use it because allocator

+    knows exact type of your allocations so it can handle Buffer-Image Granularity

+    in the optimal way.

+

+    If you also allocate using vmaAllocateMemoryForImage() or vmaAllocateMemory(),

+    exact type of such allocations is not known, so allocator must be conservative

+    in handling Buffer-Image Granularity, which can lead to suboptimal allocation

+    (wasted memory). In that case, if you can make sure you always allocate only

+    buffers and linear images or only optimal images out of this pool, use this flag

+    to make allocator disregard Buffer-Image Granularity and so make allocations

+    faster and more optimal.

+    */

+    VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT = 0x00000002,

+

+    /** \brief Enables alternative, linear allocation algorithm in this pool.

+

+    Specify this flag to enable linear allocation algorithm, which always creates

+    new allocations after last one and doesn't reuse space from allocations freed in

+    between. It trades memory consumption for simplified algorithm and data

+    structure, which has better performance and uses less memory for metadata.

+

+    By using this flag, you can achieve behavior of free-at-once, stack,

+    ring buffer, and double stack. For details, see documentation chapter

+    \ref linear_algorithm.

+

+    When using this flag, you must specify VmaPoolCreateInfo::maxBlockCount == 1 (or 0 for default).

+

+    For more details, see [Linear allocation algorithm](@ref linear_algorithm).

+    */

+    VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT = 0x00000004,

+

+    /** \brief Enables alternative, buddy allocation algorithm in this pool.

+

+    It operates on a tree of blocks, each having size that is a power of two and

+    a half of its parent's size. Comparing to default algorithm, this one provides

+    faster allocation and deallocation and decreased external fragmentation,

+    at the expense of more memory wasted (internal fragmentation).

+

+    For more details, see [Buddy allocation algorithm](@ref buddy_algorithm).

+    */

+    VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT = 0x00000008,

+

+    /** Bit mask to extract only `ALGORITHM` bits from entire set of flags.

+    */

+    VMA_POOL_CREATE_ALGORITHM_MASK =

+        VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT |

+        VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT,

+

+    VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF

+} VmaPoolCreateFlagBits;

+typedef VkFlags VmaPoolCreateFlags;

+

+/** \brief Describes parameter of created #VmaPool.

+*/

+typedef struct VmaPoolCreateInfo {

+    /** \brief Vulkan memory type index to allocate this pool from.

+    */

+    uint32_t memoryTypeIndex;

+    /** \brief Use combination of #VmaPoolCreateFlagBits.

+    */

+    VmaPoolCreateFlags flags;

+    /** \brief Size of a single `VkDeviceMemory` block to be allocated as part of this pool, in bytes. Optional.

+

+    Specify nonzero to set explicit, constant size of memory blocks used by this

+    pool.

+

+    Leave 0 to use default and let the library manage block sizes automatically.

+    Sizes of particular blocks may vary.

+    */

+    VkDeviceSize blockSize;

+    /** \brief Minimum number of blocks to be always allocated in this pool, even if they stay empty.

+

+    Set to 0 to have no preallocated blocks and allow the pool be completely empty.

+    */

+    size_t minBlockCount;

+    /** \brief Maximum number of blocks that can be allocated in this pool. Optional.

+

+    Set to 0 to use default, which is `SIZE_MAX`, which means no limit.

+    

+    Set to same value as VmaPoolCreateInfo::minBlockCount to have fixed amount of memory allocated

+    throughout whole lifetime of this pool.

+    */

+    size_t maxBlockCount;

+    /** \brief Maximum number of additional frames that are in use at the same time as current frame.

+

+    This value is used only when you make allocations with

+    #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag. Such allocation cannot become

+    lost if allocation.lastUseFrameIndex >= allocator.currentFrameIndex - frameInUseCount.

+

+    For example, if you double-buffer your command buffers, so resources used for

+    rendering in previous frame may still be in use by the GPU at the moment you

+    allocate resources needed for the current frame, set this value to 1.

+

+    If you want to allow any allocations other than used in the current frame to

+    become lost, set this value to 0.

+    */

+    uint32_t frameInUseCount;

+} VmaPoolCreateInfo;

+

+/** \brief Describes parameter of existing #VmaPool.

+*/

+typedef struct VmaPoolStats {

+    /** \brief Total amount of `VkDeviceMemory` allocated from Vulkan for this pool, in bytes.

+    */

+    VkDeviceSize size;

+    /** \brief Total number of bytes in the pool not used by any #VmaAllocation.

+    */

+    VkDeviceSize unusedSize;

+    /** \brief Number of #VmaAllocation objects created from this pool that were not destroyed or lost.

+    */

+    size_t allocationCount;

+    /** \brief Number of continuous memory ranges in the pool not used by any #VmaAllocation.

+    */

+    size_t unusedRangeCount;

+    /** \brief Size of the largest continuous free memory region available for new allocation.

+

+    Making a new allocation of that size is not guaranteed to succeed because of

+    possible additional margin required to respect alignment and buffer/image

+    granularity.

+    */

+    VkDeviceSize unusedRangeSizeMax;

+    /** \brief Number of `VkDeviceMemory` blocks allocated for this pool.

+    */

+    size_t blockCount;

+} VmaPoolStats;

+

+/** \brief Allocates Vulkan device memory and creates #VmaPool object.

+

+@param allocator Allocator object.

+@param pCreateInfo Parameters of pool to create.

+@param[out] pPool Handle to created pool.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreatePool(

+	VmaAllocator VMA_NOT_NULL allocator,

+	const VmaPoolCreateInfo* VMA_NOT_NULL pCreateInfo,

+	VmaPool VMA_NULLABLE * VMA_NOT_NULL pPool);

+

+/** \brief Destroys #VmaPool object and frees Vulkan device memory.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaDestroyPool(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaPool VMA_NULLABLE pool);

+

+/** \brief Retrieves statistics of existing #VmaPool object.

+

+@param allocator Allocator object.

+@param pool Pool object.

+@param[out] pPoolStats Statistics of specified pool.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolStats(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaPool VMA_NOT_NULL pool,

+    VmaPoolStats* VMA_NOT_NULL pPoolStats);

+

+/** \brief Marks all allocations in given pool as lost if they are not used in current frame or VmaPoolCreateInfo::frameInUseCount back from now.

+

+@param allocator Allocator object.

+@param pool Pool.

+@param[out] pLostAllocationCount Number of allocations marked as lost. Optional - pass null if you don't need this information.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaMakePoolAllocationsLost(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaPool VMA_NOT_NULL pool,

+    size_t* VMA_NULLABLE pLostAllocationCount);

+

+/** \brief Checks magic number in margins around all allocations in given memory pool in search for corruptions.

+

+Corruption detection is enabled only when `VMA_DEBUG_DETECT_CORRUPTION` macro is defined to nonzero,

+`VMA_DEBUG_MARGIN` is defined to nonzero and the pool is created in memory type that is

+`HOST_VISIBLE` and `HOST_COHERENT`. For more information, see [Corruption detection](@ref debugging_memory_usage_corruption_detection).

+

+Possible return values:

+

+- `VK_ERROR_FEATURE_NOT_PRESENT` - corruption detection is not enabled for specified pool.

+- `VK_SUCCESS` - corruption detection has been performed and succeeded.

+- `VK_ERROR_VALIDATION_FAILED_EXT` - corruption detection has been performed and found memory corruptions around one of the allocations.

+  `VMA_ASSERT` is also fired in that case.

+- Other value: Error returned by Vulkan, e.g. memory mapping failure.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckPoolCorruption(VmaAllocator VMA_NOT_NULL allocator, VmaPool VMA_NOT_NULL pool);

+

+/** \brief Retrieves name of a custom pool.

+

+After the call `ppName` is either null or points to an internally-owned null-terminated string

+containing name of the pool that was previously set. The pointer becomes invalid when the pool is

+destroyed or its name is changed using vmaSetPoolName().

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolName(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaPool VMA_NOT_NULL pool,

+    const char* VMA_NULLABLE * VMA_NOT_NULL ppName);

+

+/** \brief Sets name of a custom pool.

+

+`pName` can be either null or pointer to a null-terminated string with new name for the pool.

+Function makes internal copy of the string, so it can be changed or freed immediately after this call.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaSetPoolName(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaPool VMA_NOT_NULL pool,

+    const char* VMA_NULLABLE pName);

+

+/** \struct VmaAllocation

+\brief Represents single memory allocation.

+

+It may be either dedicated block of `VkDeviceMemory` or a specific region of a bigger block of this type

+plus unique offset.

+

+There are multiple ways to create such object.

+You need to fill structure VmaAllocationCreateInfo.

+For more information see [Choosing memory type](@ref choosing_memory_type).

+

+Although the library provides convenience functions that create Vulkan buffer or image,

+allocate memory for it and bind them together,

+binding of the allocation to a buffer or an image is out of scope of the allocation itself.

+Allocation object can exist without buffer/image bound,

+binding can be done manually by the user, and destruction of it can be done

+independently of destruction of the allocation.

+

+The object also remembers its size and some other information.

+To retrieve this information, use function vmaGetAllocationInfo() and inspect

+returned structure VmaAllocationInfo.

+

+Some kinds allocations can be in lost state.

+For more information, see [Lost allocations](@ref lost_allocations).

+*/

+VK_DEFINE_HANDLE(VmaAllocation)

+

+/** \brief Parameters of #VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().

+*/

+typedef struct VmaAllocationInfo {

+    /** \brief Memory type index that this allocation was allocated from.

+    

+    It never changes.

+    */

+    uint32_t memoryType;

+    /** \brief Handle to Vulkan memory object.

+

+    Same memory object can be shared by multiple allocations.

+    

+    It can change after call to vmaDefragment() if this allocation is passed to the function, or if allocation is lost.

+

+    If the allocation is lost, it is equal to `VK_NULL_HANDLE`.

+    */

+    VkDeviceMemory VMA_NULLABLE_NON_DISPATCHABLE deviceMemory;

+    /** \brief Offset into deviceMemory object to the beginning of this allocation, in bytes. (deviceMemory, offset) pair is unique to this allocation.

+

+    It can change after call to vmaDefragment() if this allocation is passed to the function, or if allocation is lost.

+    */

+    VkDeviceSize offset;

+    /** \brief Size of this allocation, in bytes.

+

+    It never changes, unless allocation is lost.

+    */

+    VkDeviceSize size;

+    /** \brief Pointer to the beginning of this allocation as mapped data.

+

+    If the allocation hasn't been mapped using vmaMapMemory() and hasn't been

+    created with #VMA_ALLOCATION_CREATE_MAPPED_BIT flag, this value is null.

+

+    It can change after call to vmaMapMemory(), vmaUnmapMemory().

+    It can also change after call to vmaDefragment() if this allocation is passed to the function.

+    */

+    void* VMA_NULLABLE pMappedData;

+    /** \brief Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vmaSetAllocationUserData().

+

+    It can change after call to vmaSetAllocationUserData() for this allocation.

+    */

+    void* VMA_NULLABLE pUserData;

+} VmaAllocationInfo;

+

+/** \brief General purpose memory allocation.

+

+@param[out] pAllocation Handle to allocated memory.

+@param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().

+

+You should free the memory using vmaFreeMemory() or vmaFreeMemoryPages().

+

+It is recommended to use vmaAllocateMemoryForBuffer(), vmaAllocateMemoryForImage(),

+vmaCreateBuffer(), vmaCreateImage() instead whenever possible.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemory(

+    VmaAllocator VMA_NOT_NULL allocator,

+    const VkMemoryRequirements* VMA_NOT_NULL pVkMemoryRequirements,

+    const VmaAllocationCreateInfo* VMA_NOT_NULL pCreateInfo,

+    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,

+    VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);

+

+/** \brief General purpose memory allocation for multiple allocation objects at once.

+

+@param allocator Allocator object.

+@param pVkMemoryRequirements Memory requirements for each allocation.

+@param pCreateInfo Creation parameters for each alloction.

+@param allocationCount Number of allocations to make.

+@param[out] pAllocations Pointer to array that will be filled with handles to created allocations.

+@param[out] pAllocationInfo Optional. Pointer to array that will be filled with parameters of created allocations.

+

+You should free the memory using vmaFreeMemory() or vmaFreeMemoryPages().

+

+Word "pages" is just a suggestion to use this function to allocate pieces of memory needed for sparse binding.

+It is just a general purpose allocation function able to make multiple allocations at once.

+It may be internally optimized to be more efficient than calling vmaAllocateMemory() `allocationCount` times.

+

+All allocations are made using same parameters. All of them are created out of the same memory pool and type.

+If any allocation fails, all allocations already made within this function call are also freed, so that when

+returned result is not `VK_SUCCESS`, `pAllocation` array is always entirely filled with `VK_NULL_HANDLE`.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryPages(

+    VmaAllocator VMA_NOT_NULL allocator,

+    const VkMemoryRequirements* VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pVkMemoryRequirements,

+    const VmaAllocationCreateInfo* VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pCreateInfo,

+    size_t allocationCount,

+    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations,

+    VmaAllocationInfo* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationInfo);

+

+/**

+@param[out] pAllocation Handle to allocated memory.

+@param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().

+

+You should free the memory using vmaFreeMemory().

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForBuffer(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer,

+    const VmaAllocationCreateInfo* VMA_NOT_NULL pCreateInfo,

+    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,

+    VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);

+

+/// Function similar to vmaAllocateMemoryForBuffer().

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForImage(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image,

+    const VmaAllocationCreateInfo* VMA_NOT_NULL pCreateInfo,

+    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,

+    VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);

+

+/** \brief Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(), or vmaAllocateMemoryForImage().

+

+Passing `VK_NULL_HANDLE` as `allocation` is valid. Such function call is just skipped.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemory(

+    VmaAllocator VMA_NOT_NULL allocator,

+    const VmaAllocation VMA_NULLABLE allocation);

+

+/** \brief Frees memory and destroys multiple allocations.

+

+Word "pages" is just a suggestion to use this function to free pieces of memory used for sparse binding.

+It is just a general purpose function to free memory and destroy allocations made using e.g. vmaAllocateMemory(),

+vmaAllocateMemoryPages() and other functions.

+It may be internally optimized to be more efficient than calling vmaFreeMemory() `allocationCount` times.

+

+Allocations in `pAllocations` array can come from any memory pools and types.

+Passing `VK_NULL_HANDLE` as elements of `pAllocations` array is valid. Such entries are just skipped.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemoryPages(

+    VmaAllocator VMA_NOT_NULL allocator,

+    size_t allocationCount,

+    const VmaAllocation VMA_NULLABLE * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations);

+

+/** \brief Deprecated.

+

+\deprecated

+In version 2.2.0 it used to try to change allocation's size without moving or reallocating it.

+In current version it returns `VK_SUCCESS` only if `newSize` equals current allocation's size.

+Otherwise returns `VK_ERROR_OUT_OF_POOL_MEMORY`, indicating that allocation's size could not be changed.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaResizeAllocation(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation,

+    VkDeviceSize newSize);

+

+/** \brief Returns current information about specified allocation and atomically marks it as used in current frame.

+

+Current paramters of given allocation are returned in `pAllocationInfo`.

+

+This function also atomically "touches" allocation - marks it as used in current frame,

+just like vmaTouchAllocation().

+If the allocation is in lost state, `pAllocationInfo->deviceMemory == VK_NULL_HANDLE`.

+

+Although this function uses atomics and doesn't lock any mutex, so it should be quite efficient,

+you can avoid calling it too often.

+

+- You can retrieve same VmaAllocationInfo structure while creating your resource, from function

+  vmaCreateBuffer(), vmaCreateImage(). You can remember it if you are sure parameters don't change

+  (e.g. due to defragmentation or allocation becoming lost).

+- If you just want to check if allocation is not lost, vmaTouchAllocation() will work faster.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocationInfo(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation,

+    VmaAllocationInfo* VMA_NOT_NULL pAllocationInfo);

+

+/** \brief Returns `VK_TRUE` if allocation is not lost and atomically marks it as used in current frame.

+

+If the allocation has been created with #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag,

+this function returns `VK_TRUE` if it's not in lost state, so it can still be used.

+It then also atomically "touches" the allocation - marks it as used in current frame,

+so that you can be sure it won't become lost in current frame or next `frameInUseCount` frames.

+

+If the allocation is in lost state, the function returns `VK_FALSE`.

+Memory of such allocation, as well as buffer or image bound to it, should not be used.

+Lost allocation and the buffer/image still need to be destroyed.

+

+If the allocation has been created without #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag,

+this function always returns `VK_TRUE`.

+*/

+VMA_CALL_PRE VkBool32 VMA_CALL_POST vmaTouchAllocation(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation);

+

+/** \brief Sets pUserData in given allocation to new value.

+

+If the allocation was created with VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT,

+pUserData must be either null, or pointer to a null-terminated string. The function

+makes local copy of the string and sets it as allocation's `pUserData`. String

+passed as pUserData doesn't need to be valid for whole lifetime of the allocation -

+you can free it after this call. String previously pointed by allocation's

+pUserData is freed from memory.

+

+If the flag was not used, the value of pointer `pUserData` is just copied to

+allocation's `pUserData`. It is opaque, so you can use it however you want - e.g.

+as a pointer, ordinal number or some handle to you own data.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaSetAllocationUserData(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation,

+    void* VMA_NULLABLE pUserData);

+

+/** \brief Creates new allocation that is in lost state from the beginning.

+

+It can be useful if you need a dummy, non-null allocation.

+

+You still need to destroy created object using vmaFreeMemory().

+

+Returned allocation is not tied to any specific memory pool or memory type and

+not bound to any image or buffer. It has size = 0. It cannot be turned into

+a real, non-empty allocation.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaCreateLostAllocation(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation);

+

+/** \brief Maps memory represented by given allocation and returns pointer to it.

+

+Maps memory represented by given allocation to make it accessible to CPU code.

+When succeeded, `*ppData` contains pointer to first byte of this memory.

+If the allocation is part of bigger `VkDeviceMemory` block, the pointer is

+correctly offseted to the beginning of region assigned to this particular

+allocation.

+

+Mapping is internally reference-counted and synchronized, so despite raw Vulkan

+function `vkMapMemory()` cannot be used to map same block of `VkDeviceMemory`

+multiple times simultaneously, it is safe to call this function on allocations

+assigned to the same memory block. Actual Vulkan memory will be mapped on first

+mapping and unmapped on last unmapping.

+

+If the function succeeded, you must call vmaUnmapMemory() to unmap the

+allocation when mapping is no longer needed or before freeing the allocation, at

+the latest.

+

+It also safe to call this function multiple times on the same allocation. You

+must call vmaUnmapMemory() same number of times as you called vmaMapMemory().

+

+It is also safe to call this function on allocation created with

+#VMA_ALLOCATION_CREATE_MAPPED_BIT flag. Its memory stays mapped all the time.

+You must still call vmaUnmapMemory() same number of times as you called

+vmaMapMemory(). You must not call vmaUnmapMemory() additional time to free the

+"0-th" mapping made automatically due to #VMA_ALLOCATION_CREATE_MAPPED_BIT flag.

+

+This function fails when used on allocation made in memory type that is not

+`HOST_VISIBLE`.

+

+This function always fails when called for allocation that was created with

+#VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag. Such allocations cannot be

+mapped.

+

+This function doesn't automatically flush or invalidate caches.

+If the allocation is made from a memory types that is not `HOST_COHERENT`,

+you also need to use vmaInvalidateAllocation() / vmaFlushAllocation(), as required by Vulkan specification.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaMapMemory(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation,

+    void* VMA_NULLABLE * VMA_NOT_NULL ppData);

+

+/** \brief Unmaps memory represented by given allocation, mapped previously using vmaMapMemory().

+

+For details, see description of vmaMapMemory().

+

+This function doesn't automatically flush or invalidate caches.

+If the allocation is made from a memory types that is not `HOST_COHERENT`,

+you also need to use vmaInvalidateAllocation() / vmaFlushAllocation(), as required by Vulkan specification.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaUnmapMemory(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation);

+

+/** \brief Flushes memory of given allocation.

+

+Calls `vkFlushMappedMemoryRanges()` for memory associated with given range of given allocation.

+It needs to be called after writing to a mapped memory for memory types that are not `HOST_COHERENT`.

+Unmap operation doesn't do that automatically.

+

+- `offset` must be relative to the beginning of allocation.

+- `size` can be `VK_WHOLE_SIZE`. It means all memory from `offset` the the end of given allocation.

+- `offset` and `size` don't have to be aligned.

+  They are internally rounded down/up to multiply of `nonCoherentAtomSize`.

+- If `size` is 0, this call is ignored.

+- If memory type that the `allocation` belongs to is not `HOST_VISIBLE` or it is `HOST_COHERENT`,

+  this call is ignored.

+

+Warning! `offset` and `size` are relative to the contents of given `allocation`.

+If you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.

+Do not pass allocation's offset as `offset`!!!

+

+This function returns the `VkResult` from `vkFlushMappedMemoryRanges` if it is

+called, otherwise `VK_SUCCESS`.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaFlushAllocation(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation,

+    VkDeviceSize offset,

+    VkDeviceSize size);

+

+/** \brief Invalidates memory of given allocation.

+

+Calls `vkInvalidateMappedMemoryRanges()` for memory associated with given range of given allocation.

+It needs to be called before reading from a mapped memory for memory types that are not `HOST_COHERENT`.

+Map operation doesn't do that automatically.

+

+- `offset` must be relative to the beginning of allocation.

+- `size` can be `VK_WHOLE_SIZE`. It means all memory from `offset` the the end of given allocation.

+- `offset` and `size` don't have to be aligned.

+  They are internally rounded down/up to multiply of `nonCoherentAtomSize`.

+- If `size` is 0, this call is ignored.

+- If memory type that the `allocation` belongs to is not `HOST_VISIBLE` or it is `HOST_COHERENT`,

+  this call is ignored.

+

+Warning! `offset` and `size` are relative to the contents of given `allocation`.

+If you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.

+Do not pass allocation's offset as `offset`!!!

+

+This function returns the `VkResult` from `vkInvalidateMappedMemoryRanges` if

+it is called, otherwise `VK_SUCCESS`.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaInvalidateAllocation(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation,

+    VkDeviceSize offset,

+    VkDeviceSize size);

+

+/** \brief Flushes memory of given set of allocations.

+

+Calls `vkFlushMappedMemoryRanges()` for memory associated with given ranges of given allocations.

+For more information, see documentation of vmaFlushAllocation().

+

+\param allocator

+\param allocationCount

+\param allocations

+\param offsets If not null, it must point to an array of offsets of regions to flush, relative to the beginning of respective allocations. Null means all ofsets are zero.

+\param sizes If not null, it must point to an array of sizes of regions to flush in respective allocations. Null means `VK_WHOLE_SIZE` for all allocations.

+

+This function returns the `VkResult` from `vkFlushMappedMemoryRanges` if it is

+called, otherwise `VK_SUCCESS`.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaFlushAllocations(

+    VmaAllocator VMA_NOT_NULL allocator,

+    uint32_t allocationCount,

+    const VmaAllocation VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) allocations,

+    const VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) offsets,

+    const VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) sizes);

+

+/** \brief Invalidates memory of given set of allocations.

+

+Calls `vkInvalidateMappedMemoryRanges()` for memory associated with given ranges of given allocations.

+For more information, see documentation of vmaInvalidateAllocation().

+

+\param allocator

+\param allocationCount

+\param allocations

+\param offsets If not null, it must point to an array of offsets of regions to flush, relative to the beginning of respective allocations. Null means all ofsets are zero.

+\param sizes If not null, it must point to an array of sizes of regions to flush in respective allocations. Null means `VK_WHOLE_SIZE` for all allocations.

+

+This function returns the `VkResult` from `vkInvalidateMappedMemoryRanges` if it is

+called, otherwise `VK_SUCCESS`.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaInvalidateAllocations(

+    VmaAllocator VMA_NOT_NULL allocator,

+    uint32_t allocationCount,

+    const VmaAllocation VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) allocations,

+    const VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) offsets,

+    const VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) sizes);

+

+/** \brief Checks magic number in margins around all allocations in given memory types (in both default and custom pools) in search for corruptions.

+

+@param memoryTypeBits Bit mask, where each bit set means that a memory type with that index should be checked.

+

+Corruption detection is enabled only when `VMA_DEBUG_DETECT_CORRUPTION` macro is defined to nonzero,

+`VMA_DEBUG_MARGIN` is defined to nonzero and only for memory types that are

+`HOST_VISIBLE` and `HOST_COHERENT`. For more information, see [Corruption detection](@ref debugging_memory_usage_corruption_detection).

+

+Possible return values:

+

+- `VK_ERROR_FEATURE_NOT_PRESENT` - corruption detection is not enabled for any of specified memory types.

+- `VK_SUCCESS` - corruption detection has been performed and succeeded.

+- `VK_ERROR_VALIDATION_FAILED_EXT` - corruption detection has been performed and found memory corruptions around one of the allocations.

+  `VMA_ASSERT` is also fired in that case.

+- Other value: Error returned by Vulkan, e.g. memory mapping failure.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckCorruption(VmaAllocator VMA_NOT_NULL allocator, uint32_t memoryTypeBits);

+

+/** \struct VmaDefragmentationContext

+\brief Represents Opaque object that represents started defragmentation process.

+

+Fill structure #VmaDefragmentationInfo2 and call function vmaDefragmentationBegin() to create it.

+Call function vmaDefragmentationEnd() to destroy it.

+*/

+VK_DEFINE_HANDLE(VmaDefragmentationContext)

+

+/// Flags to be used in vmaDefragmentationBegin(). None at the moment. Reserved for future use.

+typedef enum VmaDefragmentationFlagBits {

+    VMA_DEFRAGMENTATION_FLAG_INCREMENTAL = 0x1,

+    VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF

+} VmaDefragmentationFlagBits;

+typedef VkFlags VmaDefragmentationFlags;

+

+/** \brief Parameters for defragmentation.

+

+To be used with function vmaDefragmentationBegin().

+*/

+typedef struct VmaDefragmentationInfo2 {

+    /** \brief Reserved for future use. Should be 0.

+    */

+    VmaDefragmentationFlags flags;

+    /** \brief Number of allocations in `pAllocations` array.

+    */

+    uint32_t allocationCount;

+    /** \brief Pointer to array of allocations that can be defragmented.

+

+    The array should have `allocationCount` elements.

+    The array should not contain nulls.

+    Elements in the array should be unique - same allocation cannot occur twice.

+    It is safe to pass allocations that are in the lost state - they are ignored.

+    All allocations not present in this array are considered non-moveable during this defragmentation.

+    */

+    const VmaAllocation VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations;

+    /** \brief Optional, output. Pointer to array that will be filled with information whether the allocation at certain index has been changed during defragmentation.

+

+    The array should have `allocationCount` elements.

+    You can pass null if you are not interested in this information.

+    */

+    VkBool32* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationsChanged;

+    /** \brief Numer of pools in `pPools` array.

+    */

+    uint32_t poolCount;

+    /** \brief Either null or pointer to array of pools to be defragmented.

+

+    All the allocations in the specified pools can be moved during defragmentation

+    and there is no way to check if they were really moved as in `pAllocationsChanged`,

+    so you must query all the allocations in all these pools for new `VkDeviceMemory`

+    and offset using vmaGetAllocationInfo() if you might need to recreate buffers

+    and images bound to them.

+

+    The array should have `poolCount` elements.

+    The array should not contain nulls.

+    Elements in the array should be unique - same pool cannot occur twice.

+

+    Using this array is equivalent to specifying all allocations from the pools in `pAllocations`.

+    It might be more efficient.

+    */

+    const VmaPool VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(poolCount) pPools;

+    /** \brief Maximum total numbers of bytes that can be copied while moving allocations to different places using transfers on CPU side, like `memcpy()`, `memmove()`.

+    

+    `VK_WHOLE_SIZE` means no limit.

+    */

+    VkDeviceSize maxCpuBytesToMove;

+    /** \brief Maximum number of allocations that can be moved to a different place using transfers on CPU side, like `memcpy()`, `memmove()`.

+

+    `UINT32_MAX` means no limit.

+    */

+    uint32_t maxCpuAllocationsToMove;

+    /** \brief Maximum total numbers of bytes that can be copied while moving allocations to different places using transfers on GPU side, posted to `commandBuffer`.

+    

+    `VK_WHOLE_SIZE` means no limit.

+    */

+    VkDeviceSize maxGpuBytesToMove;

+    /** \brief Maximum number of allocations that can be moved to a different place using transfers on GPU side, posted to `commandBuffer`.

+

+    `UINT32_MAX` means no limit.

+    */

+    uint32_t maxGpuAllocationsToMove;

+    /** \brief Optional. Command buffer where GPU copy commands will be posted.

+

+    If not null, it must be a valid command buffer handle that supports Transfer queue type.

+    It must be in the recording state and outside of a render pass instance.

+    You need to submit it and make sure it finished execution before calling vmaDefragmentationEnd().

+

+    Passing null means that only CPU defragmentation will be performed.

+    */

+    VkCommandBuffer VMA_NULLABLE commandBuffer;

+} VmaDefragmentationInfo2;

+

+typedef struct VmaDefragmentationPassMoveInfo {

+    VmaAllocation VMA_NOT_NULL allocation;

+    VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory;

+    VkDeviceSize offset;

+} VmaDefragmentationPassMoveInfo;

+

+/** \brief Parameters for incremental defragmentation steps.

+

+To be used with function vmaBeginDefragmentationPass().

+*/

+typedef struct VmaDefragmentationPassInfo {

+    uint32_t moveCount;

+    VmaDefragmentationPassMoveInfo* VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(moveCount) pMoves;

+} VmaDefragmentationPassInfo;

+

+/** \brief Deprecated. Optional configuration parameters to be passed to function vmaDefragment().

+

+\deprecated This is a part of the old interface. It is recommended to use structure #VmaDefragmentationInfo2 and function vmaDefragmentationBegin() instead.

+*/

+typedef struct VmaDefragmentationInfo {

+    /** \brief Maximum total numbers of bytes that can be copied while moving allocations to different places.

+    

+    Default is `VK_WHOLE_SIZE`, which means no limit.

+    */

+    VkDeviceSize maxBytesToMove;

+    /** \brief Maximum number of allocations that can be moved to different place.

+

+    Default is `UINT32_MAX`, which means no limit.

+    */

+    uint32_t maxAllocationsToMove;

+} VmaDefragmentationInfo;

+

+/** \brief Statistics returned by function vmaDefragment(). */

+typedef struct VmaDefragmentationStats {

+    /// Total number of bytes that have been copied while moving allocations to different places.

+    VkDeviceSize bytesMoved;

+    /// Total number of bytes that have been released to the system by freeing empty `VkDeviceMemory` objects.

+    VkDeviceSize bytesFreed;

+    /// Number of allocations that have been moved to different places.

+    uint32_t allocationsMoved;

+    /// Number of empty `VkDeviceMemory` objects that have been released to the system.

+    uint32_t deviceMemoryBlocksFreed;

+} VmaDefragmentationStats;

+

+/** \brief Begins defragmentation process.

+

+@param allocator Allocator object.

+@param pInfo Structure filled with parameters of defragmentation.

+@param[out] pStats Optional. Statistics of defragmentation. You can pass null if you are not interested in this information.

+@param[out] pContext Context object that must be passed to vmaDefragmentationEnd() to finish defragmentation.

+@return `VK_SUCCESS` and `*pContext == null` if defragmentation finished within this function call. `VK_NOT_READY` and `*pContext != null` if defragmentation has been started and you need to call vmaDefragmentationEnd() to finish it. Negative value in case of error.

+

+Use this function instead of old, deprecated vmaDefragment().

+

+Warning! Between the call to vmaDefragmentationBegin() and vmaDefragmentationEnd():

+

+- You should not use any of allocations passed as `pInfo->pAllocations` or

+  any allocations that belong to pools passed as `pInfo->pPools`,

+  including calling vmaGetAllocationInfo(), vmaTouchAllocation(), or access

+  their data.

+- Some mutexes protecting internal data structures may be locked, so trying to

+  make or free any allocations, bind buffers or images, map memory, or launch

+  another simultaneous defragmentation in between may cause stall (when done on

+  another thread) or deadlock (when done on the same thread), unless you are

+  100% sure that defragmented allocations are in different pools.

+- Information returned via `pStats` and `pInfo->pAllocationsChanged` are undefined.

+  They become valid after call to vmaDefragmentationEnd().

+- If `pInfo->commandBuffer` is not null, you must submit that command buffer

+  and make sure it finished execution before calling vmaDefragmentationEnd().

+

+For more information and important limitations regarding defragmentation, see documentation chapter:

+[Defragmentation](@ref defragmentation).

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragmentationBegin(

+    VmaAllocator VMA_NOT_NULL allocator,

+    const VmaDefragmentationInfo2* VMA_NOT_NULL pInfo,

+    VmaDefragmentationStats* VMA_NULLABLE pStats,

+    VmaDefragmentationContext VMA_NULLABLE * VMA_NOT_NULL pContext);

+

+/** \brief Ends defragmentation process.

+

+Use this function to finish defragmentation started by vmaDefragmentationBegin().

+It is safe to pass `context == null`. The function then does nothing.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragmentationEnd(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaDefragmentationContext VMA_NULLABLE context);

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentationPass(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaDefragmentationContext VMA_NULLABLE context,

+    VmaDefragmentationPassInfo* VMA_NOT_NULL pInfo

+);

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentationPass(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaDefragmentationContext VMA_NULLABLE context

+);

+

+/** \brief Deprecated. Compacts memory by moving allocations.

+

+@param pAllocations Array of allocations that can be moved during this compation.

+@param allocationCount Number of elements in pAllocations and pAllocationsChanged arrays.

+@param[out] pAllocationsChanged Array of boolean values that will indicate whether matching allocation in pAllocations array has been moved. This parameter is optional. Pass null if you don't need this information.

+@param pDefragmentationInfo Configuration parameters. Optional - pass null to use default values.

+@param[out] pDefragmentationStats Statistics returned by the function. Optional - pass null if you don't need this information.

+@return `VK_SUCCESS` if completed, negative error code in case of error.

+

+\deprecated This is a part of the old interface. It is recommended to use structure #VmaDefragmentationInfo2 and function vmaDefragmentationBegin() instead.

+

+This function works by moving allocations to different places (different

+`VkDeviceMemory` objects and/or different offsets) in order to optimize memory

+usage. Only allocations that are in `pAllocations` array can be moved. All other

+allocations are considered nonmovable in this call. Basic rules:

+

+- Only allocations made in memory types that have

+  `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` and `VK_MEMORY_PROPERTY_HOST_COHERENT_BIT`

+  flags can be compacted. You may pass other allocations but it makes no sense -

+  these will never be moved.

+- Custom pools created with #VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT or

+  #VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT flag are not defragmented. Allocations

+  passed to this function that come from such pools are ignored.

+- Allocations created with #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT or

+  created as dedicated allocations for any other reason are also ignored.

+- Both allocations made with or without #VMA_ALLOCATION_CREATE_MAPPED_BIT

+  flag can be compacted. If not persistently mapped, memory will be mapped

+  temporarily inside this function if needed.

+- You must not pass same #VmaAllocation object multiple times in `pAllocations` array.

+

+The function also frees empty `VkDeviceMemory` blocks.

+

+Warning: This function may be time-consuming, so you shouldn't call it too often

+(like after every resource creation/destruction).

+You can call it on special occasions (like when reloading a game level or

+when you just destroyed a lot of objects). Calling it every frame may be OK, but

+you should measure that on your platform.

+

+For more information, see [Defragmentation](@ref defragmentation) chapter.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragment(

+    VmaAllocator VMA_NOT_NULL allocator,

+    const VmaAllocation VMA_NOT_NULL * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations,

+    size_t allocationCount,

+    VkBool32* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationsChanged,

+    const VmaDefragmentationInfo* VMA_NULLABLE pDefragmentationInfo,

+    VmaDefragmentationStats* VMA_NULLABLE pDefragmentationStats);

+

+/** \brief Binds buffer to allocation.

+

+Binds specified buffer to region of memory represented by specified allocation.

+Gets `VkDeviceMemory` handle and offset from the allocation.

+If you want to create a buffer, allocate memory for it and bind them together separately,

+you should use this function for binding instead of standard `vkBindBufferMemory()`,

+because it ensures proper synchronization so that when a `VkDeviceMemory` object is used by multiple

+allocations, calls to `vkBind*Memory()` or `vkMapMemory()` won't happen from multiple threads simultaneously

+(which is illegal in Vulkan).

+

+It is recommended to use function vmaCreateBuffer() instead of this one.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation,

+    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer);

+

+/** \brief Binds buffer to allocation with additional parameters.

+

+@param allocationLocalOffset Additional offset to be added while binding, relative to the beginnig of the `allocation`. Normally it should be 0.

+@param pNext A chain of structures to be attached to `VkBindBufferMemoryInfoKHR` structure used internally. Normally it should be null.

+

+This function is similar to vmaBindBufferMemory(), but it provides additional parameters.

+

+If `pNext` is not null, #VmaAllocator object must have been created with #VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT flag

+or with VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_1`. Otherwise the call fails.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory2(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation,

+    VkDeviceSize allocationLocalOffset,

+    VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer,

+    const void* VMA_NULLABLE pNext);

+

+/** \brief Binds image to allocation.

+

+Binds specified image to region of memory represented by specified allocation.

+Gets `VkDeviceMemory` handle and offset from the allocation.

+If you want to create an image, allocate memory for it and bind them together separately,

+you should use this function for binding instead of standard `vkBindImageMemory()`,

+because it ensures proper synchronization so that when a `VkDeviceMemory` object is used by multiple

+allocations, calls to `vkBind*Memory()` or `vkMapMemory()` won't happen from multiple threads simultaneously

+(which is illegal in Vulkan).

+

+It is recommended to use function vmaCreateImage() instead of this one.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation,

+    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image);

+

+/** \brief Binds image to allocation with additional parameters.

+

+@param allocationLocalOffset Additional offset to be added while binding, relative to the beginnig of the `allocation`. Normally it should be 0.

+@param pNext A chain of structures to be attached to `VkBindImageMemoryInfoKHR` structure used internally. Normally it should be null.

+

+This function is similar to vmaBindImageMemory(), but it provides additional parameters.

+

+If `pNext` is not null, #VmaAllocator object must have been created with #VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT flag

+or with VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_1`. Otherwise the call fails.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory2(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VmaAllocation VMA_NOT_NULL allocation,

+    VkDeviceSize allocationLocalOffset,

+    VkImage VMA_NOT_NULL_NON_DISPATCHABLE image,

+    const void* VMA_NULLABLE pNext);

+

+/**

+@param[out] pBuffer Buffer that was created.

+@param[out] pAllocation Allocation that was created.

+@param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().

+

+This function automatically:

+

+-# Creates buffer.

+-# Allocates appropriate memory for it.

+-# Binds the buffer with the memory.

+

+If any of these operations fail, buffer and allocation are not created,

+returned value is negative error code, *pBuffer and *pAllocation are null.

+

+If the function succeeded, you must destroy both buffer and allocation when you

+no longer need them using either convenience function vmaDestroyBuffer() or

+separately, using `vkDestroyBuffer()` and vmaFreeMemory().

+

+If VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT flag was used,

+VK_KHR_dedicated_allocation extension is used internally to query driver whether

+it requires or prefers the new buffer to have dedicated allocation. If yes,

+and if dedicated allocation is possible (VmaAllocationCreateInfo::pool is null

+and VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT is not used), it creates dedicated

+allocation for this buffer, just like when using

+VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateBuffer(

+    VmaAllocator VMA_NOT_NULL allocator,

+    const VkBufferCreateInfo* VMA_NOT_NULL pBufferCreateInfo,

+    const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,

+    VkBuffer VMA_NULLABLE_NON_DISPATCHABLE * VMA_NOT_NULL pBuffer,

+    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,

+    VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);

+

+/** \brief Destroys Vulkan buffer and frees allocated memory.

+

+This is just a convenience function equivalent to:

+

+\code

+vkDestroyBuffer(device, buffer, allocationCallbacks);

+vmaFreeMemory(allocator, allocation);

+\endcode

+

+It it safe to pass null as buffer and/or allocation.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaDestroyBuffer(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VkBuffer VMA_NULLABLE_NON_DISPATCHABLE buffer,

+    VmaAllocation VMA_NULLABLE allocation);

+

+/// Function similar to vmaCreateBuffer().

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateImage(

+    VmaAllocator VMA_NOT_NULL allocator,

+    const VkImageCreateInfo* VMA_NOT_NULL pImageCreateInfo,

+    const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,

+    VkImage VMA_NULLABLE_NON_DISPATCHABLE * VMA_NOT_NULL pImage,

+    VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,

+    VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);

+

+/** \brief Destroys Vulkan image and frees allocated memory.

+

+This is just a convenience function equivalent to:

+

+\code

+vkDestroyImage(device, image, allocationCallbacks);

+vmaFreeMemory(allocator, allocation);

+\endcode

+

+It it safe to pass null as image and/or allocation.

+*/

+VMA_CALL_PRE void VMA_CALL_POST vmaDestroyImage(

+    VmaAllocator VMA_NOT_NULL allocator,

+    VkImage VMA_NULLABLE_NON_DISPATCHABLE image,

+    VmaAllocation VMA_NULLABLE allocation);

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif // AMD_VULKAN_MEMORY_ALLOCATOR_H

+

+// For Visual Studio IntelliSense.

+#if defined(__cplusplus) && defined(__INTELLISENSE__)

+#define VMA_IMPLEMENTATION

+#endif

+

+#ifdef VMA_IMPLEMENTATION

+#undef VMA_IMPLEMENTATION

+

+#include <cstdint>

+#include <cstdlib>

+#include <cstring>

+#include <utility>

+

+/*******************************************************************************

+CONFIGURATION SECTION

+

+Define some of these macros before each #include of this header or change them

+here if you need other then default behavior depending on your environment.

+*/

+

+/*

+Define this macro to 1 to make the library fetch pointers to Vulkan functions

+internally, like:

+

+    vulkanFunctions.vkAllocateMemory = &vkAllocateMemory;

+*/

+#if !defined(VMA_STATIC_VULKAN_FUNCTIONS) && !defined(VK_NO_PROTOTYPES)

+    #define VMA_STATIC_VULKAN_FUNCTIONS 1

+#endif

+

+/*

+Define this macro to 1 to make the library fetch pointers to Vulkan functions

+internally, like:

+

+    vulkanFunctions.vkAllocateMemory = (PFN_vkAllocateMemory)vkGetDeviceProcAddr(m_hDevice, vkAllocateMemory);

+*/

+#if !defined(VMA_DYNAMIC_VULKAN_FUNCTIONS)

+    #define VMA_DYNAMIC_VULKAN_FUNCTIONS 1

+#endif

+

+// Define this macro to 1 to make the library use STL containers instead of its own implementation.

+//#define VMA_USE_STL_CONTAINERS 1

+

+/* Set this macro to 1 to make the library including and using STL containers:

+std::pair, std::vector, std::list, std::unordered_map.

+

+Set it to 0 or undefined to make the library using its own implementation of

+the containers.

+*/

+#if VMA_USE_STL_CONTAINERS

+   #define VMA_USE_STL_VECTOR 1

+   #define VMA_USE_STL_UNORDERED_MAP 1

+   #define VMA_USE_STL_LIST 1

+#endif

+

+#ifndef VMA_USE_STL_SHARED_MUTEX

+    // Compiler conforms to C++17.

+    #if __cplusplus >= 201703L

+        #define VMA_USE_STL_SHARED_MUTEX 1

+    // Visual studio defines __cplusplus properly only when passed additional parameter: /Zc:__cplusplus

+    // Otherwise it's always 199711L, despite shared_mutex works since Visual Studio 2015 Update 2.

+    // See: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/

+    #elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023918 && __cplusplus == 199711L && _MSVC_LANG >= 201703L

+        #define VMA_USE_STL_SHARED_MUTEX 1

+    #else

+        #define VMA_USE_STL_SHARED_MUTEX 0

+    #endif

+#endif

+

+/*

+THESE INCLUDES ARE NOT ENABLED BY DEFAULT.

+Library has its own container implementation.

+*/

+#if VMA_USE_STL_VECTOR

+   #include <vector>

+#endif

+

+#if VMA_USE_STL_UNORDERED_MAP

+   #include <unordered_map>

+#endif

+

+#if VMA_USE_STL_LIST

+   #include <list>

+#endif

+

+/*

+Following headers are used in this CONFIGURATION section only, so feel free to

+remove them if not needed.

+*/

+#include <cassert> // for assert

+#include <algorithm> // for min, max

+#include <mutex>

+

+#ifndef VMA_NULL

+   // Value used as null pointer. Define it to e.g.: nullptr, NULL, 0, (void*)0.

+   #define VMA_NULL   nullptr

+#endif

+

+#if defined(__ANDROID_API__) && (__ANDROID_API__ < 16)

+#include <cstdlib>

+void *aligned_alloc(size_t alignment, size_t size)

+{

+    // alignment must be >= sizeof(void*)

+    if(alignment < sizeof(void*))

+    {

+        alignment = sizeof(void*);

+    }

+

+    return memalign(alignment, size);

+}

+#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))

+#include <cstdlib>

+void *aligned_alloc(size_t alignment, size_t size)

+{

+    // alignment must be >= sizeof(void*)

+    if(alignment < sizeof(void*))

+    {

+        alignment = sizeof(void*);

+    }

+

+    void *pointer;

+    if(posix_memalign(&pointer, alignment, size) == 0)

+        return pointer;

+    return VMA_NULL;

+}

+#endif

+

+// If your compiler is not compatible with C++11 and definition of

+// aligned_alloc() function is missing, uncommeting following line may help:

+

+//#include <malloc.h>

+

+// Normal assert to check for programmer's errors, especially in Debug configuration.

+#ifndef VMA_ASSERT

+   #ifdef NDEBUG

+       #define VMA_ASSERT(expr)

+   #else

+       #define VMA_ASSERT(expr)         assert(expr)

+   #endif

+#endif

+

+// Assert that will be called very often, like inside data structures e.g. operator[].

+// Making it non-empty can make program slow.

+#ifndef VMA_HEAVY_ASSERT

+   #ifdef NDEBUG

+       #define VMA_HEAVY_ASSERT(expr)

+   #else

+       #define VMA_HEAVY_ASSERT(expr)   //VMA_ASSERT(expr)

+   #endif

+#endif

+

+#ifndef VMA_ALIGN_OF

+   #define VMA_ALIGN_OF(type)       (__alignof(type))

+#endif

+

+#ifndef VMA_SYSTEM_ALIGNED_MALLOC

+   #if defined(_WIN32)

+       #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment)   (_aligned_malloc((size), (alignment)))

+   #else

+       #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment)   (aligned_alloc((alignment), (size) ))

+   #endif

+#endif

+

+#ifndef VMA_SYSTEM_FREE

+   #if defined(_WIN32)

+       #define VMA_SYSTEM_FREE(ptr)   _aligned_free(ptr)

+   #else

+       #define VMA_SYSTEM_FREE(ptr)   free(ptr)

+   #endif

+#endif

+

+#ifndef VMA_MIN

+   #define VMA_MIN(v1, v2)    (std::min((v1), (v2)))

+#endif

+

+#ifndef VMA_MAX

+   #define VMA_MAX(v1, v2)    (std::max((v1), (v2)))

+#endif

+

+#ifndef VMA_SWAP

+   #define VMA_SWAP(v1, v2)   std::swap((v1), (v2))

+#endif

+

+#ifndef VMA_SORT

+   #define VMA_SORT(beg, end, cmp)  std::sort(beg, end, cmp)

+#endif

+

+#ifndef VMA_DEBUG_LOG

+   #define VMA_DEBUG_LOG(format, ...)

+   /*

+   #define VMA_DEBUG_LOG(format, ...) do { \

+       printf(format, __VA_ARGS__); \

+       printf("\n"); \

+   } while(false)

+   */

+#endif

+

+// Define this macro to 1 to enable functions: vmaBuildStatsString, vmaFreeStatsString.

+#if VMA_STATS_STRING_ENABLED

+    static inline void VmaUint32ToStr(char* outStr, size_t strLen, uint32_t num)

+    {

+        snprintf(outStr, strLen, "%u", static_cast<unsigned int>(num));

+    }

+    static inline void VmaUint64ToStr(char* outStr, size_t strLen, uint64_t num)

+    {

+        snprintf(outStr, strLen, "%llu", static_cast<unsigned long long>(num));

+    }

+    static inline void VmaPtrToStr(char* outStr, size_t strLen, const void* ptr)

+    {

+        snprintf(outStr, strLen, "%p", ptr);

+    }

+#endif

+

+#ifndef VMA_MUTEX

+    class VmaMutex

+    {

+    public:

+        void Lock() { m_Mutex.lock(); }

+        void Unlock() { m_Mutex.unlock(); }

+        bool TryLock() { return m_Mutex.try_lock(); }

+    private:

+        std::mutex m_Mutex;

+    };

+    #define VMA_MUTEX VmaMutex

+#endif

+

+// Read-write mutex, where "read" is shared access, "write" is exclusive access.

+#ifndef VMA_RW_MUTEX

+    #if VMA_USE_STL_SHARED_MUTEX

+        // Use std::shared_mutex from C++17.

+        #include <shared_mutex>

+        class VmaRWMutex

+        {

+        public:

+            void LockRead() { m_Mutex.lock_shared(); }

+            void UnlockRead() { m_Mutex.unlock_shared(); }

+            bool TryLockRead() { return m_Mutex.try_lock_shared(); }

+            void LockWrite() { m_Mutex.lock(); }

+            void UnlockWrite() { m_Mutex.unlock(); }

+            bool TryLockWrite() { return m_Mutex.try_lock(); }

+        private:

+            std::shared_mutex m_Mutex;

+        };

+        #define VMA_RW_MUTEX VmaRWMutex

+    #elif defined(_WIN32) && defined(WINVER) && WINVER >= 0x0600

+        // Use SRWLOCK from WinAPI.

+        // Minimum supported client = Windows Vista, server = Windows Server 2008.

+        class VmaRWMutex

+        {

+        public:

+            VmaRWMutex() { InitializeSRWLock(&m_Lock); }

+            void LockRead() { AcquireSRWLockShared(&m_Lock); }

+            void UnlockRead() { ReleaseSRWLockShared(&m_Lock); }

+            bool TryLockRead() { return TryAcquireSRWLockShared(&m_Lock) != FALSE; }

+            void LockWrite() { AcquireSRWLockExclusive(&m_Lock); }

+            void UnlockWrite() { ReleaseSRWLockExclusive(&m_Lock); }

+            bool TryLockWrite() { return TryAcquireSRWLockExclusive(&m_Lock) != FALSE; }

+        private:

+            SRWLOCK m_Lock;

+        };

+        #define VMA_RW_MUTEX VmaRWMutex

+    #else

+        // Less efficient fallback: Use normal mutex.

+        class VmaRWMutex

+        {

+        public:

+            void LockRead() { m_Mutex.Lock(); }

+            void UnlockRead() { m_Mutex.Unlock(); }

+            bool TryLockRead() { return m_Mutex.TryLock(); }

+            void LockWrite() { m_Mutex.Lock(); }

+            void UnlockWrite() { m_Mutex.Unlock(); }

+            bool TryLockWrite() { return m_Mutex.TryLock(); }

+        private:

+            VMA_MUTEX m_Mutex;

+        };

+        #define VMA_RW_MUTEX VmaRWMutex

+    #endif // #if VMA_USE_STL_SHARED_MUTEX

+#endif // #ifndef VMA_RW_MUTEX

+

+/*

+If providing your own implementation, you need to implement a subset of std::atomic.

+*/

+#ifndef VMA_ATOMIC_UINT32

+    #include <atomic>

+    #define VMA_ATOMIC_UINT32 std::atomic<uint32_t>

+#endif

+

+#ifndef VMA_ATOMIC_UINT64

+    #include <atomic>

+    #define VMA_ATOMIC_UINT64 std::atomic<uint64_t>

+#endif

+

+#ifndef VMA_DEBUG_ALWAYS_DEDICATED_MEMORY

+    /**

+    Every allocation will have its own memory block.

+    Define to 1 for debugging purposes only.

+    */

+    #define VMA_DEBUG_ALWAYS_DEDICATED_MEMORY (0)

+#endif

+

+#ifndef VMA_DEBUG_ALIGNMENT

+    /**

+    Minimum alignment of all allocations, in bytes.

+    Set to more than 1 for debugging purposes only. Must be power of two.

+    */

+    #define VMA_DEBUG_ALIGNMENT (1)

+#endif

+

+#ifndef VMA_DEBUG_MARGIN

+    /**

+    Minimum margin before and after every allocation, in bytes.

+    Set nonzero for debugging purposes only.

+    */

+    #define VMA_DEBUG_MARGIN (0)

+#endif

+

+#ifndef VMA_DEBUG_INITIALIZE_ALLOCATIONS

+    /**

+    Define this macro to 1 to automatically fill new allocations and destroyed

+    allocations with some bit pattern.

+    */

+    #define VMA_DEBUG_INITIALIZE_ALLOCATIONS (0)

+#endif

+

+#ifndef VMA_DEBUG_DETECT_CORRUPTION

+    /**

+    Define this macro to 1 together with non-zero value of VMA_DEBUG_MARGIN to

+    enable writing magic value to the margin before and after every allocation and

+    validating it, so that memory corruptions (out-of-bounds writes) are detected.

+    */

+    #define VMA_DEBUG_DETECT_CORRUPTION (0)

+#endif

+

+#ifndef VMA_DEBUG_GLOBAL_MUTEX

+    /**

+    Set this to 1 for debugging purposes only, to enable single mutex protecting all

+    entry calls to the library. Can be useful for debugging multithreading issues.

+    */

+    #define VMA_DEBUG_GLOBAL_MUTEX (0)

+#endif

+

+#ifndef VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY

+    /**

+    Minimum value for VkPhysicalDeviceLimits::bufferImageGranularity.

+    Set to more than 1 for debugging purposes only. Must be power of two.

+    */

+    #define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY (1)

+#endif

+

+#ifndef VMA_SMALL_HEAP_MAX_SIZE

+   /// Maximum size of a memory heap in Vulkan to consider it "small".

+   #define VMA_SMALL_HEAP_MAX_SIZE (1024ull * 1024 * 1024)

+#endif

+

+#ifndef VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE

+   /// Default size of a block allocated as single VkDeviceMemory from a "large" heap.

+   #define VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE (256ull * 1024 * 1024)

+#endif

+

+#ifndef VMA_CLASS_NO_COPY

+    #define VMA_CLASS_NO_COPY(className) \

+        private: \

+            className(const className&) = delete; \

+            className& operator=(const className&) = delete;

+#endif

+

+static const uint32_t VMA_FRAME_INDEX_LOST = UINT32_MAX;

+

+// Decimal 2139416166, float NaN, little-endian binary 66 E6 84 7F.

+static const uint32_t VMA_CORRUPTION_DETECTION_MAGIC_VALUE = 0x7F84E666;

+

+static const uint8_t VMA_ALLOCATION_FILL_PATTERN_CREATED   = 0xDC;

+static const uint8_t VMA_ALLOCATION_FILL_PATTERN_DESTROYED = 0xEF;

+

+/*******************************************************************************

+END OF CONFIGURATION

+*/

+

+// # Copy of some Vulkan definitions so we don't need to check their existence just to handle few constants.

+

+static const uint32_t VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY = 0x00000040;

+static const uint32_t VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY = 0x00000080;

+static const uint32_t VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_COPY = 0x00020000;

+

+static const uint32_t VMA_ALLOCATION_INTERNAL_STRATEGY_MIN_OFFSET = 0x10000000u;

+

+static VkAllocationCallbacks VmaEmptyAllocationCallbacks = {

+    VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL };

+

+// Returns number of bits set to 1 in (v).

+static inline uint32_t VmaCountBitsSet(uint32_t v)

+{

+	uint32_t c = v - ((v >> 1) & 0x55555555);

+	c = ((c >>  2) & 0x33333333) + (c & 0x33333333);

+	c = ((c >>  4) + c) & 0x0F0F0F0F;

+	c = ((c >>  8) + c) & 0x00FF00FF;

+	c = ((c >> 16) + c) & 0x0000FFFF;

+	return c;

+}

+

+// Aligns given value up to nearest multiply of align value. For example: VmaAlignUp(11, 8) = 16.

+// Use types like uint32_t, uint64_t as T.

+template <typename T>

+static inline T VmaAlignUp(T val, T align)

+{

+	return (val + align - 1) / align * align;

+}

+// Aligns given value down to nearest multiply of align value. For example: VmaAlignUp(11, 8) = 8.

+// Use types like uint32_t, uint64_t as T.

+template <typename T>

+static inline T VmaAlignDown(T val, T align)

+{

+    return val / align * align;

+}

+

+// Division with mathematical rounding to nearest number.

+template <typename T>

+static inline T VmaRoundDiv(T x, T y)

+{

+	return (x + (y / (T)2)) / y;

+}

+

+/*

+Returns true if given number is a power of two.

+T must be unsigned integer number or signed integer but always nonnegative.

+For 0 returns true.

+*/

+template <typename T>

+inline bool VmaIsPow2(T x)

+{

+    return (x & (x-1)) == 0;

+}

+

+// Returns smallest power of 2 greater or equal to v.

+static inline uint32_t VmaNextPow2(uint32_t v)

+{

+	v--;

+    v |= v >> 1;

+    v |= v >> 2;

+    v |= v >> 4;

+    v |= v >> 8;

+    v |= v >> 16;

+    v++;

+    return v;

+}

+static inline uint64_t VmaNextPow2(uint64_t v)

+{

+	v--;

+    v |= v >> 1;

+    v |= v >> 2;

+    v |= v >> 4;

+    v |= v >> 8;

+    v |= v >> 16;

+    v |= v >> 32;

+    v++;

+    return v;

+}

+

+// Returns largest power of 2 less or equal to v.

+static inline uint32_t VmaPrevPow2(uint32_t v)

+{

+    v |= v >> 1;

+    v |= v >> 2;

+    v |= v >> 4;

+    v |= v >> 8;

+    v |= v >> 16;

+    v = v ^ (v >> 1);

+    return v;

+}

+static inline uint64_t VmaPrevPow2(uint64_t v)

+{

+    v |= v >> 1;

+    v |= v >> 2;

+    v |= v >> 4;

+    v |= v >> 8;

+    v |= v >> 16;

+    v |= v >> 32;

+    v = v ^ (v >> 1);

+    return v;

+}

+

+static inline bool VmaStrIsEmpty(const char* pStr)

+{

+    return pStr == VMA_NULL || *pStr == '\0';

+}

+

+#if VMA_STATS_STRING_ENABLED

+

+static const char* VmaAlgorithmToStr(uint32_t algorithm)

+{

+    switch(algorithm)

+    {

+    case VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT:

+        return "Linear";

+    case VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT:

+        return "Buddy";

+    case 0:

+        return "Default";

+    default:

+        VMA_ASSERT(0);

+        return "";

+    }

+}

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+#ifndef VMA_SORT

+

+template<typename Iterator, typename Compare>

+Iterator VmaQuickSortPartition(Iterator beg, Iterator end, Compare cmp)

+{

+    Iterator centerValue = end; --centerValue;

+    Iterator insertIndex = beg;

+    for(Iterator memTypeIndex = beg; memTypeIndex < centerValue; ++memTypeIndex)

+    {

+        if(cmp(*memTypeIndex, *centerValue))

+        {

+            if(insertIndex != memTypeIndex)

+            {

+                VMA_SWAP(*memTypeIndex, *insertIndex);

+            }

+            ++insertIndex;

+        }

+    }

+    if(insertIndex != centerValue)

+    {

+        VMA_SWAP(*insertIndex, *centerValue);

+    }

+    return insertIndex;

+}

+

+template<typename Iterator, typename Compare>

+void VmaQuickSort(Iterator beg, Iterator end, Compare cmp)

+{

+    if(beg < end)

+    {

+        Iterator it = VmaQuickSortPartition<Iterator, Compare>(beg, end, cmp);

+        VmaQuickSort<Iterator, Compare>(beg, it, cmp);

+        VmaQuickSort<Iterator, Compare>(it + 1, end, cmp);

+    }

+}

+

+#define VMA_SORT(beg, end, cmp) VmaQuickSort(beg, end, cmp)

+

+#endif // #ifndef VMA_SORT

+

+/*

+Returns true if two memory blocks occupy overlapping pages.

+ResourceA must be in less memory offset than ResourceB.

+

+Algorithm is based on "Vulkan 1.0.39 - A Specification (with all registered Vulkan extensions)"

+chapter 11.6 "Resource Memory Association", paragraph "Buffer-Image Granularity".

+*/

+static inline bool VmaBlocksOnSamePage(

+    VkDeviceSize resourceAOffset,

+    VkDeviceSize resourceASize,

+    VkDeviceSize resourceBOffset,

+    VkDeviceSize pageSize)

+{

+    VMA_ASSERT(resourceAOffset + resourceASize <= resourceBOffset && resourceASize > 0 && pageSize > 0);

+    VkDeviceSize resourceAEnd = resourceAOffset + resourceASize - 1;

+    VkDeviceSize resourceAEndPage = resourceAEnd & ~(pageSize - 1);

+    VkDeviceSize resourceBStart = resourceBOffset;

+    VkDeviceSize resourceBStartPage = resourceBStart & ~(pageSize - 1);

+    return resourceAEndPage == resourceBStartPage;

+}

+

+enum VmaSuballocationType

+{

+    VMA_SUBALLOCATION_TYPE_FREE = 0,

+    VMA_SUBALLOCATION_TYPE_UNKNOWN = 1,

+    VMA_SUBALLOCATION_TYPE_BUFFER = 2,

+    VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN = 3,

+    VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR = 4,

+    VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL = 5,

+    VMA_SUBALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF

+};

+

+/*

+Returns true if given suballocation types could conflict and must respect

+VkPhysicalDeviceLimits::bufferImageGranularity. They conflict if one is buffer

+or linear image and another one is optimal image. If type is unknown, behave

+conservatively.

+*/

+static inline bool VmaIsBufferImageGranularityConflict(

+    VmaSuballocationType suballocType1,

+    VmaSuballocationType suballocType2)

+{

+    if(suballocType1 > suballocType2)

+    {

+        VMA_SWAP(suballocType1, suballocType2);

+    }

+    

+    switch(suballocType1)

+    {

+    case VMA_SUBALLOCATION_TYPE_FREE:

+        return false;

+    case VMA_SUBALLOCATION_TYPE_UNKNOWN:

+        return true;

+    case VMA_SUBALLOCATION_TYPE_BUFFER:

+        return

+            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||

+            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;

+    case VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN:

+        return

+            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||

+            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR ||

+            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;

+    case VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR:

+        return

+            suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;

+    case VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL:

+        return false;

+    default:

+        VMA_ASSERT(0);

+        return true;

+    }

+}

+

+static void VmaWriteMagicValue(void* pData, VkDeviceSize offset)

+{

+#if VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_DETECT_CORRUPTION

+    uint32_t* pDst = (uint32_t*)((char*)pData + offset);

+    const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);

+    for(size_t i = 0; i < numberCount; ++i, ++pDst)

+    {

+        *pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;

+    }

+#else

+    // no-op

+#endif

+}

+

+static bool VmaValidateMagicValue(const void* pData, VkDeviceSize offset)

+{

+#if VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_DETECT_CORRUPTION

+    const uint32_t* pSrc = (const uint32_t*)((const char*)pData + offset);

+    const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);

+    for(size_t i = 0; i < numberCount; ++i, ++pSrc)

+    {

+        if(*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE)

+        {

+            return false;

+        }

+    }

+#endif

+    return true;

+}

+

+/*

+Fills structure with parameters of an example buffer to be used for transfers

+during GPU memory defragmentation.

+*/

+static void VmaFillGpuDefragmentationBufferCreateInfo(VkBufferCreateInfo& outBufCreateInfo)

+{

+    memset(&outBufCreateInfo, 0, sizeof(outBufCreateInfo));

+    outBufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;

+    outBufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;

+    outBufCreateInfo.size = (VkDeviceSize)VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE; // Example size.

+}

+

+// Helper RAII class to lock a mutex in constructor and unlock it in destructor (at the end of scope).

+struct VmaMutexLock

+{

+    VMA_CLASS_NO_COPY(VmaMutexLock)

+public:

+    VmaMutexLock(VMA_MUTEX& mutex, bool useMutex = true) :

+        m_pMutex(useMutex ? &mutex : VMA_NULL)

+    { if(m_pMutex) { m_pMutex->Lock(); } }

+    ~VmaMutexLock()

+    { if(m_pMutex) { m_pMutex->Unlock(); } }

+private:

+    VMA_MUTEX* m_pMutex;

+};

+

+// Helper RAII class to lock a RW mutex in constructor and unlock it in destructor (at the end of scope), for reading.

+struct VmaMutexLockRead

+{

+    VMA_CLASS_NO_COPY(VmaMutexLockRead)

+public:

+    VmaMutexLockRead(VMA_RW_MUTEX& mutex, bool useMutex) :

+        m_pMutex(useMutex ? &mutex : VMA_NULL)

+    { if(m_pMutex) { m_pMutex->LockRead(); } }

+    ~VmaMutexLockRead() { if(m_pMutex) { m_pMutex->UnlockRead(); } }

+private:

+    VMA_RW_MUTEX* m_pMutex;

+};

+

+// Helper RAII class to lock a RW mutex in constructor and unlock it in destructor (at the end of scope), for writing.

+struct VmaMutexLockWrite

+{

+    VMA_CLASS_NO_COPY(VmaMutexLockWrite)

+public:

+    VmaMutexLockWrite(VMA_RW_MUTEX& mutex, bool useMutex) :

+        m_pMutex(useMutex ? &mutex : VMA_NULL)

+    { if(m_pMutex) { m_pMutex->LockWrite(); } }

+    ~VmaMutexLockWrite() { if(m_pMutex) { m_pMutex->UnlockWrite(); } }

+private:

+    VMA_RW_MUTEX* m_pMutex;

+};

+

+#if VMA_DEBUG_GLOBAL_MUTEX

+    static VMA_MUTEX gDebugGlobalMutex;

+    #define VMA_DEBUG_GLOBAL_MUTEX_LOCK VmaMutexLock debugGlobalMutexLock(gDebugGlobalMutex, true);

+#else

+    #define VMA_DEBUG_GLOBAL_MUTEX_LOCK

+#endif

+

+// Minimum size of a free suballocation to register it in the free suballocation collection.

+static const VkDeviceSize VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER = 16;

+

+/*

+Performs binary search and returns iterator to first element that is greater or

+equal to (key), according to comparison (cmp).

+

+Cmp should return true if first argument is less than second argument.

+

+Returned value is the found element, if present in the collection or place where

+new element with value (key) should be inserted.

+*/

+template <typename CmpLess, typename IterT, typename KeyT>

+static IterT VmaBinaryFindFirstNotLess(IterT beg, IterT end, const KeyT &key, const CmpLess& cmp)

+{

+    size_t down = 0, up = (end - beg);

+    while(down < up)

+    {

+        const size_t mid = (down + up) / 2;

+        if(cmp(*(beg+mid), key))

+        {

+            down = mid + 1;

+        }

+        else

+        {

+            up = mid;

+        }

+    }

+    return beg + down;

+}

+

+template<typename CmpLess, typename IterT, typename KeyT>

+IterT VmaBinaryFindSorted(const IterT& beg, const IterT& end, const KeyT& value, const CmpLess& cmp)

+{

+    IterT it = VmaBinaryFindFirstNotLess<CmpLess, IterT, KeyT>(

+        beg, end, value, cmp);

+    if(it == end ||

+        (!cmp(*it, value) && !cmp(value, *it)))

+    {

+        return it;

+    }

+    return end;

+}

+

+/*

+Returns true if all pointers in the array are not-null and unique.

+Warning! O(n^2) complexity. Use only inside VMA_HEAVY_ASSERT.

+T must be pointer type, e.g. VmaAllocation, VmaPool.

+*/

+template<typename T>

+static bool VmaValidatePointerArray(uint32_t count, const T* arr)

+{

+    for(uint32_t i = 0; i < count; ++i)

+    {

+        const T iPtr = arr[i];

+        if(iPtr == VMA_NULL)

+        {

+            return false;

+        }

+        for(uint32_t j = i + 1; j < count; ++j)

+        {

+            if(iPtr == arr[j])

+            {

+                return false;

+            }

+        }

+    }

+    return true;

+}

+

+template<typename MainT, typename NewT>

+static inline void VmaPnextChainPushFront(MainT* mainStruct, NewT* newStruct)

+{

+    newStruct->pNext = mainStruct->pNext;

+    mainStruct->pNext = newStruct;

+}

+

+////////////////////////////////////////////////////////////////////////////////

+// Memory allocation

+

+static void* VmaMalloc(const VkAllocationCallbacks* pAllocationCallbacks, size_t size, size_t alignment)

+{

+    if((pAllocationCallbacks != VMA_NULL) &&

+        (pAllocationCallbacks->pfnAllocation != VMA_NULL))

+    {

+        return (*pAllocationCallbacks->pfnAllocation)(

+            pAllocationCallbacks->pUserData,

+            size,

+            alignment,

+            VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);

+    }

+    else

+    {

+        return VMA_SYSTEM_ALIGNED_MALLOC(size, alignment);

+    }

+}

+

+static void VmaFree(const VkAllocationCallbacks* pAllocationCallbacks, void* ptr)

+{

+    if((pAllocationCallbacks != VMA_NULL) &&

+        (pAllocationCallbacks->pfnFree != VMA_NULL))

+    {

+        (*pAllocationCallbacks->pfnFree)(pAllocationCallbacks->pUserData, ptr);

+    }

+    else

+    {

+        VMA_SYSTEM_FREE(ptr);

+    }

+}

+

+template<typename T>

+static T* VmaAllocate(const VkAllocationCallbacks* pAllocationCallbacks)

+{

+    return (T*)VmaMalloc(pAllocationCallbacks, sizeof(T), VMA_ALIGN_OF(T));

+}

+

+template<typename T>

+static T* VmaAllocateArray(const VkAllocationCallbacks* pAllocationCallbacks, size_t count)

+{

+    return (T*)VmaMalloc(pAllocationCallbacks, sizeof(T) * count, VMA_ALIGN_OF(T));

+}

+

+#define vma_new(allocator, type)   new(VmaAllocate<type>(allocator))(type)

+

+#define vma_new_array(allocator, type, count)   new(VmaAllocateArray<type>((allocator), (count)))(type)

+

+template<typename T>

+static void vma_delete(const VkAllocationCallbacks* pAllocationCallbacks, T* ptr)

+{

+    ptr->~T();

+    VmaFree(pAllocationCallbacks, ptr);

+}

+

+template<typename T>

+static void vma_delete_array(const VkAllocationCallbacks* pAllocationCallbacks, T* ptr, size_t count)

+{

+    if(ptr != VMA_NULL)

+    {

+        for(size_t i = count; i--; )

+        {

+            ptr[i].~T();

+        }

+        VmaFree(pAllocationCallbacks, ptr);

+    }

+}

+

+static char* VmaCreateStringCopy(const VkAllocationCallbacks* allocs, const char* srcStr)

+{

+    if(srcStr != VMA_NULL)

+    {

+        const size_t len = strlen(srcStr);

+        char* const result = vma_new_array(allocs, char, len + 1);

+        memcpy(result, srcStr, len + 1);

+        return result;

+    }

+    else

+    {

+        return VMA_NULL;

+    }

+}

+

+static void VmaFreeString(const VkAllocationCallbacks* allocs, char* str)

+{

+    if(str != VMA_NULL)

+    {

+        const size_t len = strlen(str);

+        vma_delete_array(allocs, str, len + 1);

+    }

+}

+

+// STL-compatible allocator.

+template<typename T>

+class VmaStlAllocator

+{

+public:

+    const VkAllocationCallbacks* const m_pCallbacks;

+    typedef T value_type;

+    

+    VmaStlAllocator(const VkAllocationCallbacks* pCallbacks) : m_pCallbacks(pCallbacks) { }

+    template<typename U> VmaStlAllocator(const VmaStlAllocator<U>& src) : m_pCallbacks(src.m_pCallbacks) { }

+

+    T* allocate(size_t n) { return VmaAllocateArray<T>(m_pCallbacks, n); }

+    void deallocate(T* p, size_t n) { VmaFree(m_pCallbacks, p); }

+

+    template<typename U>

+    bool operator==(const VmaStlAllocator<U>& rhs) const

+    {

+        return m_pCallbacks == rhs.m_pCallbacks;

+    }

+    template<typename U>

+    bool operator!=(const VmaStlAllocator<U>& rhs) const

+    {

+        return m_pCallbacks != rhs.m_pCallbacks;

+    }

+

+    VmaStlAllocator& operator=(const VmaStlAllocator& x) = delete;

+};

+

+#if VMA_USE_STL_VECTOR

+

+#define VmaVector std::vector

+

+template<typename T, typename allocatorT>

+static void VmaVectorInsert(std::vector<T, allocatorT>& vec, size_t index, const T& item)

+{

+    vec.insert(vec.begin() + index, item);

+}

+

+template<typename T, typename allocatorT>

+static void VmaVectorRemove(std::vector<T, allocatorT>& vec, size_t index)

+{

+    vec.erase(vec.begin() + index);

+}

+

+#else // #if VMA_USE_STL_VECTOR

+

+/* Class with interface compatible with subset of std::vector.

+T must be POD because constructors and destructors are not called and memcpy is

+used for these objects. */

+template<typename T, typename AllocatorT>

+class VmaVector

+{

+public:

+    typedef T value_type;

+

+    VmaVector(const AllocatorT& allocator) :

+        m_Allocator(allocator),

+        m_pArray(VMA_NULL),

+        m_Count(0),

+        m_Capacity(0)

+    {

+    }

+

+    VmaVector(size_t count, const AllocatorT& allocator) :

+        m_Allocator(allocator),

+        m_pArray(count ? (T*)VmaAllocateArray<T>(allocator.m_pCallbacks, count) : VMA_NULL),

+        m_Count(count),

+        m_Capacity(count)

+    {

+    }

+    

+    // This version of the constructor is here for compatibility with pre-C++14 std::vector.

+    // value is unused.

+    VmaVector(size_t count, const T& value, const AllocatorT& allocator)

+        : VmaVector(count, allocator) {}

+    

+    VmaVector(const VmaVector<T, AllocatorT>& src) :

+        m_Allocator(src.m_Allocator),

+        m_pArray(src.m_Count ? (T*)VmaAllocateArray<T>(src.m_Allocator.m_pCallbacks, src.m_Count) : VMA_NULL),

+        m_Count(src.m_Count),

+        m_Capacity(src.m_Count)

+    {

+        if(m_Count != 0)

+        {

+            memcpy(m_pArray, src.m_pArray, m_Count * sizeof(T));

+        }

+    }

+    

+    ~VmaVector()

+    {

+        VmaFree(m_Allocator.m_pCallbacks, m_pArray);

+    }

+

+    VmaVector& operator=(const VmaVector<T, AllocatorT>& rhs)

+    {

+        if(&rhs != this)

+        {

+            resize(rhs.m_Count);

+            if(m_Count != 0)

+            {

+                memcpy(m_pArray, rhs.m_pArray, m_Count * sizeof(T));

+            }

+        }

+        return *this;

+    }

+    

+    bool empty() const { return m_Count == 0; }

+    size_t size() const { return m_Count; }

+    T* data() { return m_pArray; }

+    const T* data() const { return m_pArray; }

+    

+    T& operator[](size_t index)

+    {

+        VMA_HEAVY_ASSERT(index < m_Count);

+        return m_pArray[index];

+    }

+    const T& operator[](size_t index) const

+    {

+        VMA_HEAVY_ASSERT(index < m_Count);

+        return m_pArray[index];

+    }

+

+    T& front()

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        return m_pArray[0];

+    }

+    const T& front() const

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        return m_pArray[0];

+    }

+    T& back()

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        return m_pArray[m_Count - 1];

+    }

+    const T& back() const

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        return m_pArray[m_Count - 1];

+    }

+

+    void reserve(size_t newCapacity, bool freeMemory = false)

+    {

+        newCapacity = VMA_MAX(newCapacity, m_Count);

+        

+        if((newCapacity < m_Capacity) && !freeMemory)

+        {

+            newCapacity = m_Capacity;

+        }

+        

+        if(newCapacity != m_Capacity)

+        {

+            T* const newArray = newCapacity ? VmaAllocateArray<T>(m_Allocator, newCapacity) : VMA_NULL;

+            if(m_Count != 0)

+            {

+                memcpy(newArray, m_pArray, m_Count * sizeof(T));

+            }

+            VmaFree(m_Allocator.m_pCallbacks, m_pArray);

+            m_Capacity = newCapacity;

+            m_pArray = newArray;

+        }

+    }

+

+    void resize(size_t newCount, bool freeMemory = false)

+    {

+        size_t newCapacity = m_Capacity;

+        if(newCount > m_Capacity)

+        {

+            newCapacity = VMA_MAX(newCount, VMA_MAX(m_Capacity * 3 / 2, (size_t)8));

+        }

+        else if(freeMemory)

+        {

+            newCapacity = newCount;

+        }

+

+        if(newCapacity != m_Capacity)

+        {

+            T* const newArray = newCapacity ? VmaAllocateArray<T>(m_Allocator.m_pCallbacks, newCapacity) : VMA_NULL;

+            const size_t elementsToCopy = VMA_MIN(m_Count, newCount);

+            if(elementsToCopy != 0)

+            {

+                memcpy(newArray, m_pArray, elementsToCopy * sizeof(T));

+            }

+            VmaFree(m_Allocator.m_pCallbacks, m_pArray);

+            m_Capacity = newCapacity;

+            m_pArray = newArray;

+        }

+

+        m_Count = newCount;

+    }

+

+    void clear(bool freeMemory = false)

+    {

+        resize(0, freeMemory);

+    }

+

+    void insert(size_t index, const T& src)

+    {

+        VMA_HEAVY_ASSERT(index <= m_Count);

+        const size_t oldCount = size();

+        resize(oldCount + 1);

+        if(index < oldCount)

+        {

+            memmove(m_pArray + (index + 1), m_pArray + index, (oldCount - index) * sizeof(T));

+        }

+        m_pArray[index] = src;

+    }

+

+    void remove(size_t index)

+    {

+        VMA_HEAVY_ASSERT(index < m_Count);

+        const size_t oldCount = size();

+        if(index < oldCount - 1)

+        {

+            memmove(m_pArray + index, m_pArray + (index + 1), (oldCount - index - 1) * sizeof(T));

+        }

+        resize(oldCount - 1);

+    }

+

+    void push_back(const T& src)

+    {

+        const size_t newIndex = size();

+        resize(newIndex + 1);

+        m_pArray[newIndex] = src;

+    }

+

+    void pop_back()

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        resize(size() - 1);

+    }

+

+    void push_front(const T& src)

+    {

+        insert(0, src);

+    }

+

+    void pop_front()

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        remove(0);

+    }

+

+    typedef T* iterator;

+

+    iterator begin() { return m_pArray; }

+    iterator end() { return m_pArray + m_Count; }

+

+private:

+    AllocatorT m_Allocator;

+    T* m_pArray;

+    size_t m_Count;

+    size_t m_Capacity;

+};

+

+template<typename T, typename allocatorT>

+static void VmaVectorInsert(VmaVector<T, allocatorT>& vec, size_t index, const T& item)

+{

+    vec.insert(index, item);

+}

+

+template<typename T, typename allocatorT>

+static void VmaVectorRemove(VmaVector<T, allocatorT>& vec, size_t index)

+{

+    vec.remove(index);

+}

+

+#endif // #if VMA_USE_STL_VECTOR

+

+template<typename CmpLess, typename VectorT>

+size_t VmaVectorInsertSorted(VectorT& vector, const typename VectorT::value_type& value)

+{

+    const size_t indexToInsert = VmaBinaryFindFirstNotLess(

+        vector.data(),

+        vector.data() + vector.size(),

+        value,

+        CmpLess()) - vector.data();

+    VmaVectorInsert(vector, indexToInsert, value);

+    return indexToInsert;

+}

+

+template<typename CmpLess, typename VectorT>

+bool VmaVectorRemoveSorted(VectorT& vector, const typename VectorT::value_type& value)

+{

+    CmpLess comparator;

+    typename VectorT::iterator it = VmaBinaryFindFirstNotLess(

+        vector.begin(),

+        vector.end(),

+        value,

+        comparator);

+    if((it != vector.end()) && !comparator(*it, value) && !comparator(value, *it))

+    {

+        size_t indexToRemove = it - vector.begin();

+        VmaVectorRemove(vector, indexToRemove);

+        return true;

+    }

+    return false;

+}

+

+////////////////////////////////////////////////////////////////////////////////

+// class VmaSmallVector

+

+/*

+This is a vector (a variable-sized array), optimized for the case when the array is small.

+

+It contains some number of elements in-place, which allows it to avoid heap allocation

+when the actual number of elements is below that threshold. This allows normal "small"

+cases to be fast without losing generality for large inputs.

+*/

+

+template<typename T, typename AllocatorT, size_t N>

+class VmaSmallVector

+{

+public:

+    typedef T value_type;

+

+    VmaSmallVector(const AllocatorT& allocator) :

+        m_Count(0),

+        m_DynamicArray(allocator)

+    {

+    }

+    VmaSmallVector(size_t count, const AllocatorT& allocator) :

+        m_Count(count),

+        m_DynamicArray(count > N ? count : 0, allocator)

+    {

+    }

+    template<typename SrcT, typename SrcAllocatorT, size_t SrcN>

+    VmaSmallVector(const VmaSmallVector<SrcT, SrcAllocatorT, SrcN>& src) = delete;

+    template<typename SrcT, typename SrcAllocatorT, size_t SrcN>

+    VmaSmallVector<T, AllocatorT, N>& operator=(const VmaSmallVector<SrcT, SrcAllocatorT, SrcN>& rhs) = delete;

+

+    bool empty() const { return m_Count == 0; }

+    size_t size() const { return m_Count; }

+    T* data() { return m_Count > N ? m_DynamicArray.data() : m_StaticArray; }

+    const T* data() const { return m_Count > N ? m_DynamicArray.data() : m_StaticArray; }

+

+    T& operator[](size_t index)

+    {

+        VMA_HEAVY_ASSERT(index < m_Count);

+        return data()[index];

+    }

+    const T& operator[](size_t index) const

+    {

+        VMA_HEAVY_ASSERT(index < m_Count);

+        return data()[index];

+    }

+

+    T& front()

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        return data()[0];

+    }

+    const T& front() const

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        return data()[0];

+    }

+    T& back()

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        return data()[m_Count - 1];

+    }

+    const T& back() const

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        return data()[m_Count - 1];

+    }

+

+    void resize(size_t newCount, bool freeMemory = false)

+    {

+        if(newCount > N && m_Count > N)

+        {

+            // Any direction, staying in m_DynamicArray

+            m_DynamicArray.resize(newCount, freeMemory);

+        }

+        else if(newCount > N && m_Count <= N)

+        {

+            // Growing, moving from m_StaticArray to m_DynamicArray

+            m_DynamicArray.resize(newCount, freeMemory);

+            if(m_Count > 0)

+            {

+                memcpy(m_DynamicArray.data(), m_StaticArray, m_Count * sizeof(T));

+            }

+        }

+        else if(newCount <= N && m_Count > N)

+        {

+            // Shrinking, moving from m_DynamicArray to m_StaticArray

+            if(newCount > 0)

+            {

+                memcpy(m_StaticArray, m_DynamicArray.data(), newCount * sizeof(T));

+            }

+            m_DynamicArray.resize(0, freeMemory);

+        }

+        else

+        {

+            // Any direction, staying in m_StaticArray - nothing to do here

+        }

+        m_Count = newCount;

+    }

+

+    void clear(bool freeMemory = false)

+    {

+        m_DynamicArray.clear(freeMemory);

+        m_Count = 0;

+    }

+

+    void insert(size_t index, const T& src)

+    {

+        VMA_HEAVY_ASSERT(index <= m_Count);

+        const size_t oldCount = size();

+        resize(oldCount + 1);

+        T* const dataPtr = data();

+        if(index < oldCount)

+        {

+            //  I know, this could be more optimal for case where memmove can be memcpy directly from m_StaticArray to m_DynamicArray.

+            memmove(dataPtr + (index + 1), dataPtr + index, (oldCount - index) * sizeof(T));

+        }

+        dataPtr[index] = src;

+    }

+

+    void remove(size_t index)

+    {

+        VMA_HEAVY_ASSERT(index < m_Count);

+        const size_t oldCount = size();

+        if(index < oldCount - 1)

+        {

+            //  I know, this could be more optimal for case where memmove can be memcpy directly from m_DynamicArray to m_StaticArray.

+            T* const dataPtr = data();

+            memmove(dataPtr + index, dataPtr + (index + 1), (oldCount - index - 1) * sizeof(T));

+        }

+        resize(oldCount - 1);

+    }

+

+    void push_back(const T& src)

+    {

+        const size_t newIndex = size();

+        resize(newIndex + 1);

+        data()[newIndex] = src;

+    }

+

+    void pop_back()

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        resize(size() - 1);

+    }

+

+    void push_front(const T& src)

+    {

+        insert(0, src);

+    }

+

+    void pop_front()

+    {

+        VMA_HEAVY_ASSERT(m_Count > 0);

+        remove(0);

+    }

+

+    typedef T* iterator;

+

+    iterator begin() { return data(); }

+    iterator end() { return data() + m_Count; }

+

+private:

+    size_t m_Count;

+    T m_StaticArray[N]; // Used when m_Size <= N

+    VmaVector<T, AllocatorT> m_DynamicArray; // Used when m_Size > N

+};

+

+////////////////////////////////////////////////////////////////////////////////

+// class VmaPoolAllocator

+

+/*

+Allocator for objects of type T using a list of arrays (pools) to speed up

+allocation. Number of elements that can be allocated is not bounded because

+allocator can create multiple blocks.

+*/

+template<typename T>

+class VmaPoolAllocator

+{

+    VMA_CLASS_NO_COPY(VmaPoolAllocator)

+public:

+    VmaPoolAllocator(const VkAllocationCallbacks* pAllocationCallbacks, uint32_t firstBlockCapacity);

+    ~VmaPoolAllocator();

+    template<typename... Types> T* Alloc(Types... args);

+    void Free(T* ptr);

+

+private:

+    union Item

+    {

+        uint32_t NextFreeIndex;

+        alignas(T) char Value[sizeof(T)];

+    };

+

+    struct ItemBlock

+    {

+        Item* pItems;

+        uint32_t Capacity;

+        uint32_t FirstFreeIndex;

+    };

+    

+    const VkAllocationCallbacks* m_pAllocationCallbacks;

+    const uint32_t m_FirstBlockCapacity;

+    VmaVector< ItemBlock, VmaStlAllocator<ItemBlock> > m_ItemBlocks;

+

+    ItemBlock& CreateNewBlock();

+};

+

+template<typename T>

+VmaPoolAllocator<T>::VmaPoolAllocator(const VkAllocationCallbacks* pAllocationCallbacks, uint32_t firstBlockCapacity) :

+    m_pAllocationCallbacks(pAllocationCallbacks),

+    m_FirstBlockCapacity(firstBlockCapacity),

+    m_ItemBlocks(VmaStlAllocator<ItemBlock>(pAllocationCallbacks))

+{

+    VMA_ASSERT(m_FirstBlockCapacity > 1);

+}

+

+template<typename T>

+VmaPoolAllocator<T>::~VmaPoolAllocator()

+{

+    for(size_t i = m_ItemBlocks.size(); i--; )

+        vma_delete_array(m_pAllocationCallbacks, m_ItemBlocks[i].pItems, m_ItemBlocks[i].Capacity);

+    m_ItemBlocks.clear();

+}

+

+template<typename T>

+template<typename... Types> T* VmaPoolAllocator<T>::Alloc(Types... args)

+{

+    for(size_t i = m_ItemBlocks.size(); i--; )

+    {

+        ItemBlock& block = m_ItemBlocks[i];

+        // This block has some free items: Use first one.

+        if(block.FirstFreeIndex != UINT32_MAX)

+        {

+            Item* const pItem = &block.pItems[block.FirstFreeIndex];

+            block.FirstFreeIndex = pItem->NextFreeIndex;

+            T* result = (T*)&pItem->Value;

+            new(result)T(std::forward<Types>(args)...); // Explicit constructor call.

+            return result;

+        }

+    }

+

+    // No block has free item: Create new one and use it.

+    ItemBlock& newBlock = CreateNewBlock();

+    Item* const pItem = &newBlock.pItems[0];

+    newBlock.FirstFreeIndex = pItem->NextFreeIndex;

+    T* result = (T*)&pItem->Value;

+    new(result)T(std::forward<Types>(args)...); // Explicit constructor call.

+    return result;

+}

+

+template<typename T>

+void VmaPoolAllocator<T>::Free(T* ptr)

+{

+    // Search all memory blocks to find ptr.

+    for(size_t i = m_ItemBlocks.size(); i--; )

+    {

+        ItemBlock& block = m_ItemBlocks[i];

+        

+        // Casting to union.

+        Item* pItemPtr;

+        memcpy(&pItemPtr, &ptr, sizeof(pItemPtr));

+        

+        // Check if pItemPtr is in address range of this block.

+        if((pItemPtr >= block.pItems) && (pItemPtr < block.pItems + block.Capacity))

+        {

+            ptr->~T(); // Explicit destructor call.

+            const uint32_t index = static_cast<uint32_t>(pItemPtr - block.pItems);

+            pItemPtr->NextFreeIndex = block.FirstFreeIndex;

+            block.FirstFreeIndex = index;

+            return;

+        }

+    }

+    VMA_ASSERT(0 && "Pointer doesn't belong to this memory pool.");

+}

+

+template<typename T>

+typename VmaPoolAllocator<T>::ItemBlock& VmaPoolAllocator<T>::CreateNewBlock()

+{

+    const uint32_t newBlockCapacity = m_ItemBlocks.empty() ?

+        m_FirstBlockCapacity : m_ItemBlocks.back().Capacity * 3 / 2;

+

+    const ItemBlock newBlock = {

+        vma_new_array(m_pAllocationCallbacks, Item, newBlockCapacity),

+        newBlockCapacity,

+        0 };

+

+    m_ItemBlocks.push_back(newBlock);

+

+    // Setup singly-linked list of all free items in this block.

+    for(uint32_t i = 0; i < newBlockCapacity - 1; ++i)

+        newBlock.pItems[i].NextFreeIndex = i + 1;

+    newBlock.pItems[newBlockCapacity - 1].NextFreeIndex = UINT32_MAX;

+    return m_ItemBlocks.back();

+}

+

+////////////////////////////////////////////////////////////////////////////////

+// class VmaRawList, VmaList

+

+#if VMA_USE_STL_LIST

+

+#define VmaList std::list

+

+#else // #if VMA_USE_STL_LIST

+

+template<typename T>

+struct VmaListItem

+{

+    VmaListItem* pPrev;

+    VmaListItem* pNext;

+    T Value;

+};

+

+// Doubly linked list.

+template<typename T>

+class VmaRawList

+{

+    VMA_CLASS_NO_COPY(VmaRawList)

+public:

+    typedef VmaListItem<T> ItemType;

+

+    VmaRawList(const VkAllocationCallbacks* pAllocationCallbacks);

+    ~VmaRawList();

+    void Clear();

+

+    size_t GetCount() const { return m_Count; }

+    bool IsEmpty() const { return m_Count == 0; }

+

+    ItemType* Front() { return m_pFront; }

+    const ItemType* Front() const { return m_pFront; }

+    ItemType* Back() { return m_pBack; }

+    const ItemType* Back() const { return m_pBack; }

+

+    ItemType* PushBack();

+    ItemType* PushFront();

+    ItemType* PushBack(const T& value);

+    ItemType* PushFront(const T& value);

+    void PopBack();

+    void PopFront();

+    

+    // Item can be null - it means PushBack.

+    ItemType* InsertBefore(ItemType* pItem);

+    // Item can be null - it means PushFront.

+    ItemType* InsertAfter(ItemType* pItem);

+

+    ItemType* InsertBefore(ItemType* pItem, const T& value);

+    ItemType* InsertAfter(ItemType* pItem, const T& value);

+

+    void Remove(ItemType* pItem);

+

+private:

+    const VkAllocationCallbacks* const m_pAllocationCallbacks;

+    VmaPoolAllocator<ItemType> m_ItemAllocator;

+    ItemType* m_pFront;

+    ItemType* m_pBack;

+    size_t m_Count;

+};

+

+template<typename T>

+VmaRawList<T>::VmaRawList(const VkAllocationCallbacks* pAllocationCallbacks) :

+    m_pAllocationCallbacks(pAllocationCallbacks),

+    m_ItemAllocator(pAllocationCallbacks, 128),

+    m_pFront(VMA_NULL),

+    m_pBack(VMA_NULL),

+    m_Count(0)

+{

+}

+

+template<typename T>

+VmaRawList<T>::~VmaRawList()

+{

+    // Intentionally not calling Clear, because that would be unnecessary

+    // computations to return all items to m_ItemAllocator as free.

+}

+

+template<typename T>

+void VmaRawList<T>::Clear()

+{

+    if(IsEmpty() == false)

+    {

+        ItemType* pItem = m_pBack;

+        while(pItem != VMA_NULL)

+        {

+            ItemType* const pPrevItem = pItem->pPrev;

+            m_ItemAllocator.Free(pItem);

+            pItem = pPrevItem;

+        }

+        m_pFront = VMA_NULL;

+        m_pBack = VMA_NULL;

+        m_Count = 0;

+    }

+}

+

+template<typename T>

+VmaListItem<T>* VmaRawList<T>::PushBack()

+{

+    ItemType* const pNewItem = m_ItemAllocator.Alloc();

+    pNewItem->pNext = VMA_NULL;

+    if(IsEmpty())

+    {

+        pNewItem->pPrev = VMA_NULL;

+        m_pFront = pNewItem;

+        m_pBack = pNewItem;

+        m_Count = 1;

+    }

+    else

+    {

+        pNewItem->pPrev = m_pBack;

+        m_pBack->pNext = pNewItem;

+        m_pBack = pNewItem;

+        ++m_Count;

+    }

+    return pNewItem;

+}

+

+template<typename T>

+VmaListItem<T>* VmaRawList<T>::PushFront()

+{

+    ItemType* const pNewItem = m_ItemAllocator.Alloc();

+    pNewItem->pPrev = VMA_NULL;

+    if(IsEmpty())

+    {

+        pNewItem->pNext = VMA_NULL;

+        m_pFront = pNewItem;

+        m_pBack = pNewItem;

+        m_Count = 1;

+    }

+    else

+    {

+        pNewItem->pNext = m_pFront;

+        m_pFront->pPrev = pNewItem;

+        m_pFront = pNewItem;

+        ++m_Count;

+    }

+    return pNewItem;

+}

+

+template<typename T>

+VmaListItem<T>* VmaRawList<T>::PushBack(const T& value)

+{

+    ItemType* const pNewItem = PushBack();

+    pNewItem->Value = value;

+    return pNewItem;

+}

+

+template<typename T>

+VmaListItem<T>* VmaRawList<T>::PushFront(const T& value)

+{

+    ItemType* const pNewItem = PushFront();

+    pNewItem->Value = value;

+    return pNewItem;

+}

+

+template<typename T>

+void VmaRawList<T>::PopBack()

+{

+    VMA_HEAVY_ASSERT(m_Count > 0);

+    ItemType* const pBackItem = m_pBack;

+    ItemType* const pPrevItem = pBackItem->pPrev;

+    if(pPrevItem != VMA_NULL)

+    {

+        pPrevItem->pNext = VMA_NULL;

+    }

+    m_pBack = pPrevItem;

+    m_ItemAllocator.Free(pBackItem);

+    --m_Count;

+}

+

+template<typename T>

+void VmaRawList<T>::PopFront()

+{

+    VMA_HEAVY_ASSERT(m_Count > 0);

+    ItemType* const pFrontItem = m_pFront;

+    ItemType* const pNextItem = pFrontItem->pNext;

+    if(pNextItem != VMA_NULL)

+    {

+        pNextItem->pPrev = VMA_NULL;

+    }

+    m_pFront = pNextItem;

+    m_ItemAllocator.Free(pFrontItem);

+    --m_Count;

+}

+

+template<typename T>

+void VmaRawList<T>::Remove(ItemType* pItem)

+{

+    VMA_HEAVY_ASSERT(pItem != VMA_NULL);

+    VMA_HEAVY_ASSERT(m_Count > 0);

+

+    if(pItem->pPrev != VMA_NULL)

+    {

+        pItem->pPrev->pNext = pItem->pNext;

+    }

+    else

+    {

+        VMA_HEAVY_ASSERT(m_pFront == pItem);

+        m_pFront = pItem->pNext;

+    }

+

+    if(pItem->pNext != VMA_NULL)

+    {

+        pItem->pNext->pPrev = pItem->pPrev;

+    }

+    else

+    {

+        VMA_HEAVY_ASSERT(m_pBack == pItem);

+        m_pBack = pItem->pPrev;

+    }

+

+    m_ItemAllocator.Free(pItem);

+    --m_Count;

+}

+

+template<typename T>

+VmaListItem<T>* VmaRawList<T>::InsertBefore(ItemType* pItem)

+{

+    if(pItem != VMA_NULL)

+    {

+        ItemType* const prevItem = pItem->pPrev;

+        ItemType* const newItem = m_ItemAllocator.Alloc();

+        newItem->pPrev = prevItem;

+        newItem->pNext = pItem;

+        pItem->pPrev = newItem;

+        if(prevItem != VMA_NULL)

+        {

+            prevItem->pNext = newItem;

+        }

+        else

+        {

+            VMA_HEAVY_ASSERT(m_pFront == pItem);

+            m_pFront = newItem;

+        }

+        ++m_Count;

+        return newItem;

+    }

+    else

+        return PushBack();

+}

+

+template<typename T>

+VmaListItem<T>* VmaRawList<T>::InsertAfter(ItemType* pItem)

+{

+    if(pItem != VMA_NULL)

+    {

+        ItemType* const nextItem = pItem->pNext;

+        ItemType* const newItem = m_ItemAllocator.Alloc();

+        newItem->pNext = nextItem;

+        newItem->pPrev = pItem;

+        pItem->pNext = newItem;

+        if(nextItem != VMA_NULL)

+        {

+            nextItem->pPrev = newItem;

+        }

+        else

+        {

+            VMA_HEAVY_ASSERT(m_pBack == pItem);

+            m_pBack = newItem;

+        }

+        ++m_Count;

+        return newItem;

+    }

+    else

+        return PushFront();

+}

+

+template<typename T>

+VmaListItem<T>* VmaRawList<T>::InsertBefore(ItemType* pItem, const T& value)

+{

+    ItemType* const newItem = InsertBefore(pItem);

+    newItem->Value = value;

+    return newItem;

+}

+

+template<typename T>

+VmaListItem<T>* VmaRawList<T>::InsertAfter(ItemType* pItem, const T& value)

+{

+    ItemType* const newItem = InsertAfter(pItem);

+    newItem->Value = value;

+    return newItem;

+}

+

+template<typename T, typename AllocatorT>

+class VmaList

+{

+    VMA_CLASS_NO_COPY(VmaList)

+public:

+    class iterator

+    {

+    public:

+        iterator() :

+            m_pList(VMA_NULL),

+            m_pItem(VMA_NULL)

+        {

+        }

+

+        T& operator*() const

+        {

+            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);

+            return m_pItem->Value;

+        }

+        T* operator->() const

+        {

+            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);

+            return &m_pItem->Value;

+        }

+

+        iterator& operator++()

+        {

+            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);

+            m_pItem = m_pItem->pNext;

+            return *this;

+        }

+        iterator& operator--()

+        {

+            if(m_pItem != VMA_NULL)

+            {

+                m_pItem = m_pItem->pPrev;

+            }

+            else

+            {

+                VMA_HEAVY_ASSERT(!m_pList->IsEmpty());

+                m_pItem = m_pList->Back();

+            }

+            return *this;

+        }

+

+        iterator operator++(int)

+        {

+            iterator result = *this;

+            ++*this;

+            return result;

+        }

+        iterator operator--(int)

+        {

+            iterator result = *this;

+            --*this;

+            return result;

+        }

+

+        bool operator==(const iterator& rhs) const

+        {

+            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);

+            return m_pItem == rhs.m_pItem;

+        }

+        bool operator!=(const iterator& rhs) const

+        {

+            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);

+            return m_pItem != rhs.m_pItem;

+        }

+        

+    private:

+        VmaRawList<T>* m_pList;

+        VmaListItem<T>* m_pItem;

+

+        iterator(VmaRawList<T>* pList, VmaListItem<T>* pItem) :

+            m_pList(pList),

+            m_pItem(pItem)

+        {

+        }

+

+        friend class VmaList<T, AllocatorT>;

+    };

+

+    class const_iterator

+    {

+    public:

+        const_iterator() :

+            m_pList(VMA_NULL),

+            m_pItem(VMA_NULL)

+        {

+        }

+

+        const_iterator(const iterator& src) :

+            m_pList(src.m_pList),

+            m_pItem(src.m_pItem)

+        {

+        }

+        

+        const T& operator*() const

+        {

+            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);

+            return m_pItem->Value;

+        }

+        const T* operator->() const

+        {

+            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);

+            return &m_pItem->Value;

+        }

+

+        const_iterator& operator++()

+        {

+            VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);

+            m_pItem = m_pItem->pNext;

+            return *this;

+        }

+        const_iterator& operator--()

+        {

+            if(m_pItem != VMA_NULL)

+            {

+                m_pItem = m_pItem->pPrev;

+            }

+            else

+            {

+                VMA_HEAVY_ASSERT(!m_pList->IsEmpty());

+                m_pItem = m_pList->Back();

+            }

+            return *this;

+        }

+

+        const_iterator operator++(int)

+        {

+            const_iterator result = *this;

+            ++*this;

+            return result;

+        }

+        const_iterator operator--(int)

+        {

+            const_iterator result = *this;

+            --*this;

+            return result;

+        }

+

+        bool operator==(const const_iterator& rhs) const

+        {

+            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);

+            return m_pItem == rhs.m_pItem;

+        }

+        bool operator!=(const const_iterator& rhs) const

+        {

+            VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);

+            return m_pItem != rhs.m_pItem;

+        }

+        

+    private:

+        const_iterator(const VmaRawList<T>* pList, const VmaListItem<T>* pItem) :

+            m_pList(pList),

+            m_pItem(pItem)

+        {

+        }

+

+        const VmaRawList<T>* m_pList;

+        const VmaListItem<T>* m_pItem;

+

+        friend class VmaList<T, AllocatorT>;

+    };

+

+    VmaList(const AllocatorT& allocator) : m_RawList(allocator.m_pCallbacks) { }

+

+    bool empty() const { return m_RawList.IsEmpty(); }

+    size_t size() const { return m_RawList.GetCount(); }

+

+    iterator begin() { return iterator(&m_RawList, m_RawList.Front()); }

+    iterator end() { return iterator(&m_RawList, VMA_NULL); }

+

+    const_iterator cbegin() const { return const_iterator(&m_RawList, m_RawList.Front()); }

+    const_iterator cend() const { return const_iterator(&m_RawList, VMA_NULL); }

+

+    void clear() { m_RawList.Clear(); }

+    void push_back(const T& value) { m_RawList.PushBack(value); }

+    void erase(iterator it) { m_RawList.Remove(it.m_pItem); }

+    iterator insert(iterator it, const T& value) { return iterator(&m_RawList, m_RawList.InsertBefore(it.m_pItem, value)); }

+

+private:

+    VmaRawList<T> m_RawList;

+};

+

+#endif // #if VMA_USE_STL_LIST

+

+////////////////////////////////////////////////////////////////////////////////

+// class VmaMap

+

+// Unused in this version.

+#if 0

+

+#if VMA_USE_STL_UNORDERED_MAP

+

+#define VmaPair std::pair

+

+#define VMA_MAP_TYPE(KeyT, ValueT) \

+    std::unordered_map< KeyT, ValueT, std::hash<KeyT>, std::equal_to<KeyT>, VmaStlAllocator< std::pair<KeyT, ValueT> > >

+

+#else // #if VMA_USE_STL_UNORDERED_MAP

+

+template<typename T1, typename T2>

+struct VmaPair

+{

+    T1 first;

+    T2 second;

+

+    VmaPair() : first(), second() { }

+    VmaPair(const T1& firstSrc, const T2& secondSrc) : first(firstSrc), second(secondSrc) { }

+};

+

+/* Class compatible with subset of interface of std::unordered_map.

+KeyT, ValueT must be POD because they will be stored in VmaVector.

+*/

+template<typename KeyT, typename ValueT>

+class VmaMap

+{

+public:

+    typedef VmaPair<KeyT, ValueT> PairType;

+    typedef PairType* iterator;

+

+    VmaMap(const VmaStlAllocator<PairType>& allocator) : m_Vector(allocator) { }

+

+    iterator begin() { return m_Vector.begin(); }

+    iterator end() { return m_Vector.end(); }

+

+    void insert(const PairType& pair);

+    iterator find(const KeyT& key);

+    void erase(iterator it);

+    

+private:

+    VmaVector< PairType, VmaStlAllocator<PairType> > m_Vector;

+};

+

+#define VMA_MAP_TYPE(KeyT, ValueT) VmaMap<KeyT, ValueT>

+

+template<typename FirstT, typename SecondT>

+struct VmaPairFirstLess

+{

+    bool operator()(const VmaPair<FirstT, SecondT>& lhs, const VmaPair<FirstT, SecondT>& rhs) const

+    {

+        return lhs.first < rhs.first;

+    }

+    bool operator()(const VmaPair<FirstT, SecondT>& lhs, const FirstT& rhsFirst) const

+    {

+        return lhs.first < rhsFirst;

+    }

+};

+

+template<typename KeyT, typename ValueT>

+void VmaMap<KeyT, ValueT>::insert(const PairType& pair)

+{

+    const size_t indexToInsert = VmaBinaryFindFirstNotLess(

+        m_Vector.data(),

+        m_Vector.data() + m_Vector.size(),

+        pair,

+        VmaPairFirstLess<KeyT, ValueT>()) - m_Vector.data();

+    VmaVectorInsert(m_Vector, indexToInsert, pair);

+}

+

+template<typename KeyT, typename ValueT>

+VmaPair<KeyT, ValueT>* VmaMap<KeyT, ValueT>::find(const KeyT& key)

+{

+    PairType* it = VmaBinaryFindFirstNotLess(

+        m_Vector.data(),

+        m_Vector.data() + m_Vector.size(),

+        key,

+        VmaPairFirstLess<KeyT, ValueT>());

+    if((it != m_Vector.end()) && (it->first == key))

+    {

+        return it;

+    }

+    else

+    {

+        return m_Vector.end();

+    }

+}

+

+template<typename KeyT, typename ValueT>

+void VmaMap<KeyT, ValueT>::erase(iterator it)

+{

+    VmaVectorRemove(m_Vector, it - m_Vector.begin());

+}

+

+#endif // #if VMA_USE_STL_UNORDERED_MAP

+

+#endif // #if 0

+

+////////////////////////////////////////////////////////////////////////////////

+

+class VmaDeviceMemoryBlock;

+

+enum VMA_CACHE_OPERATION { VMA_CACHE_FLUSH, VMA_CACHE_INVALIDATE };

+

+struct VmaAllocation_T

+{

+private:

+    static const uint8_t MAP_COUNT_FLAG_PERSISTENT_MAP = 0x80;

+

+    enum FLAGS

+    {

+        FLAG_USER_DATA_STRING = 0x01,

+    };

+

+public:

+    enum ALLOCATION_TYPE

+    {

+        ALLOCATION_TYPE_NONE,

+        ALLOCATION_TYPE_BLOCK,

+        ALLOCATION_TYPE_DEDICATED,

+    };

+

+    /*

+    This struct is allocated using VmaPoolAllocator.

+    */

+

+    VmaAllocation_T(uint32_t currentFrameIndex, bool userDataString) :

+        m_Alignment{1},

+        m_Size{0},

+        m_pUserData{VMA_NULL},

+        m_LastUseFrameIndex{currentFrameIndex},

+        m_MemoryTypeIndex{0},

+        m_Type{(uint8_t)ALLOCATION_TYPE_NONE},

+        m_SuballocationType{(uint8_t)VMA_SUBALLOCATION_TYPE_UNKNOWN},

+        m_MapCount{0},

+        m_Flags{userDataString ? (uint8_t)FLAG_USER_DATA_STRING : (uint8_t)0}

+    {

+#if VMA_STATS_STRING_ENABLED

+        m_CreationFrameIndex = currentFrameIndex;

+        m_BufferImageUsage = 0;

+#endif

+    }

+

+    ~VmaAllocation_T()

+    {

+        VMA_ASSERT((m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP) == 0 && "Allocation was not unmapped before destruction.");

+

+        // Check if owned string was freed.

+        VMA_ASSERT(m_pUserData == VMA_NULL);

+    }

+

+    void InitBlockAllocation(

+        VmaDeviceMemoryBlock* block,

+        VkDeviceSize offset,

+        VkDeviceSize alignment,

+        VkDeviceSize size,

+        uint32_t memoryTypeIndex,

+        VmaSuballocationType suballocationType,

+        bool mapped,

+        bool canBecomeLost)

+    {

+        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);

+        VMA_ASSERT(block != VMA_NULL);

+        m_Type = (uint8_t)ALLOCATION_TYPE_BLOCK;

+        m_Alignment = alignment;

+        m_Size = size;

+        m_MemoryTypeIndex = memoryTypeIndex;

+        m_MapCount = mapped ? MAP_COUNT_FLAG_PERSISTENT_MAP : 0;

+        m_SuballocationType = (uint8_t)suballocationType;

+        m_BlockAllocation.m_Block = block;

+        m_BlockAllocation.m_Offset = offset;

+        m_BlockAllocation.m_CanBecomeLost = canBecomeLost;

+    }

+

+    void InitLost()

+    {

+        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);

+        VMA_ASSERT(m_LastUseFrameIndex.load() == VMA_FRAME_INDEX_LOST);

+        m_Type = (uint8_t)ALLOCATION_TYPE_BLOCK;

+        m_MemoryTypeIndex = 0;

+        m_BlockAllocation.m_Block = VMA_NULL;

+        m_BlockAllocation.m_Offset = 0;

+        m_BlockAllocation.m_CanBecomeLost = true;

+    }

+

+    void ChangeBlockAllocation(

+        VmaAllocator hAllocator,

+        VmaDeviceMemoryBlock* block,

+        VkDeviceSize offset); 

+

+    void ChangeOffset(VkDeviceSize newOffset);

+

+    // pMappedData not null means allocation is created with MAPPED flag.

+    void InitDedicatedAllocation(

+        uint32_t memoryTypeIndex,

+        VkDeviceMemory hMemory,

+        VmaSuballocationType suballocationType,

+        void* pMappedData,

+        VkDeviceSize size)

+    {

+        VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);

+        VMA_ASSERT(hMemory != VK_NULL_HANDLE);

+        m_Type = (uint8_t)ALLOCATION_TYPE_DEDICATED;

+        m_Alignment = 0;

+        m_Size = size;

+        m_MemoryTypeIndex = memoryTypeIndex;

+        m_SuballocationType = (uint8_t)suballocationType;

+        m_MapCount = (pMappedData != VMA_NULL) ? MAP_COUNT_FLAG_PERSISTENT_MAP : 0;

+        m_DedicatedAllocation.m_hMemory = hMemory;

+        m_DedicatedAllocation.m_pMappedData = pMappedData;

+    }

+

+    ALLOCATION_TYPE GetType() const { return (ALLOCATION_TYPE)m_Type; }

+    VkDeviceSize GetAlignment() const { return m_Alignment; }

+    VkDeviceSize GetSize() const { return m_Size; }

+    bool IsUserDataString() const { return (m_Flags & FLAG_USER_DATA_STRING) != 0; }

+    void* GetUserData() const { return m_pUserData; }

+    void SetUserData(VmaAllocator hAllocator, void* pUserData);

+    VmaSuballocationType GetSuballocationType() const { return (VmaSuballocationType)m_SuballocationType; }

+

+    VmaDeviceMemoryBlock* GetBlock() const

+    {

+        VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);

+        return m_BlockAllocation.m_Block;

+    }

+    VkDeviceSize GetOffset() const;

+    VkDeviceMemory GetMemory() const;

+    uint32_t GetMemoryTypeIndex() const { return m_MemoryTypeIndex; }

+    bool IsPersistentMap() const { return (m_MapCount & MAP_COUNT_FLAG_PERSISTENT_MAP) != 0; }

+    void* GetMappedData() const;

+    bool CanBecomeLost() const;

+    

+    uint32_t GetLastUseFrameIndex() const

+    {

+        return m_LastUseFrameIndex.load();

+    }

+    bool CompareExchangeLastUseFrameIndex(uint32_t& expected, uint32_t desired)

+    {

+        return m_LastUseFrameIndex.compare_exchange_weak(expected, desired);

+    }

+    /*

+    - If hAllocation.LastUseFrameIndex + frameInUseCount < allocator.CurrentFrameIndex,

+      makes it lost by setting LastUseFrameIndex = VMA_FRAME_INDEX_LOST and returns true.

+    - Else, returns false.

+    

+    If hAllocation is already lost, assert - you should not call it then.

+    If hAllocation was not created with CAN_BECOME_LOST_BIT, assert.

+    */

+    bool MakeLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);

+

+    void DedicatedAllocCalcStatsInfo(VmaStatInfo& outInfo)

+    {

+        VMA_ASSERT(m_Type == ALLOCATION_TYPE_DEDICATED);

+        outInfo.blockCount = 1;

+        outInfo.allocationCount = 1;

+        outInfo.unusedRangeCount = 0;

+        outInfo.usedBytes = m_Size;

+        outInfo.unusedBytes = 0;

+        outInfo.allocationSizeMin = outInfo.allocationSizeMax = m_Size;

+        outInfo.unusedRangeSizeMin = UINT64_MAX;

+        outInfo.unusedRangeSizeMax = 0;

+    }

+

+    void BlockAllocMap();

+    void BlockAllocUnmap();

+    VkResult DedicatedAllocMap(VmaAllocator hAllocator, void** ppData);

+    void DedicatedAllocUnmap(VmaAllocator hAllocator);

+

+#if VMA_STATS_STRING_ENABLED

+    uint32_t GetCreationFrameIndex() const { return m_CreationFrameIndex; }

+    uint32_t GetBufferImageUsage() const { return m_BufferImageUsage; }

+

+    void InitBufferImageUsage(uint32_t bufferImageUsage)

+    {

+        VMA_ASSERT(m_BufferImageUsage == 0);

+        m_BufferImageUsage = bufferImageUsage;

+    }

+

+    void PrintParameters(class VmaJsonWriter& json) const;

+#endif

+

+private:

+    VkDeviceSize m_Alignment;

+    VkDeviceSize m_Size;

+    void* m_pUserData;

+    VMA_ATOMIC_UINT32 m_LastUseFrameIndex;

+    uint32_t m_MemoryTypeIndex;

+    uint8_t m_Type; // ALLOCATION_TYPE

+    uint8_t m_SuballocationType; // VmaSuballocationType

+    // Bit 0x80 is set when allocation was created with VMA_ALLOCATION_CREATE_MAPPED_BIT.

+    // Bits with mask 0x7F are reference counter for vmaMapMemory()/vmaUnmapMemory().

+    uint8_t m_MapCount;

+    uint8_t m_Flags; // enum FLAGS

+

+    // Allocation out of VmaDeviceMemoryBlock.

+    struct BlockAllocation

+    {

+        VmaDeviceMemoryBlock* m_Block;

+        VkDeviceSize m_Offset;

+        bool m_CanBecomeLost;

+    };

+

+    // Allocation for an object that has its own private VkDeviceMemory.

+    struct DedicatedAllocation

+    {

+        VkDeviceMemory m_hMemory;

+        void* m_pMappedData; // Not null means memory is mapped.

+    };

+

+    union

+    {

+        // Allocation out of VmaDeviceMemoryBlock.

+        BlockAllocation m_BlockAllocation;

+        // Allocation for an object that has its own private VkDeviceMemory.

+        DedicatedAllocation m_DedicatedAllocation;

+    };

+

+#if VMA_STATS_STRING_ENABLED

+    uint32_t m_CreationFrameIndex;

+    uint32_t m_BufferImageUsage; // 0 if unknown.

+#endif

+

+    void FreeUserDataString(VmaAllocator hAllocator);

+};

+

+/*

+Represents a region of VmaDeviceMemoryBlock that is either assigned and returned as

+allocated memory block or free.

+*/

+struct VmaSuballocation

+{

+    VkDeviceSize offset;

+    VkDeviceSize size;

+    VmaAllocation hAllocation;

+    VmaSuballocationType type;

+};

+

+// Comparator for offsets.

+struct VmaSuballocationOffsetLess

+{

+    bool operator()(const VmaSuballocation& lhs, const VmaSuballocation& rhs) const

+    {

+        return lhs.offset < rhs.offset;

+    }

+};

+struct VmaSuballocationOffsetGreater

+{

+    bool operator()(const VmaSuballocation& lhs, const VmaSuballocation& rhs) const

+    {

+        return lhs.offset > rhs.offset;

+    }

+};

+

+typedef VmaList< VmaSuballocation, VmaStlAllocator<VmaSuballocation> > VmaSuballocationList;

+

+// Cost of one additional allocation lost, as equivalent in bytes.

+static const VkDeviceSize VMA_LOST_ALLOCATION_COST = 1048576;

+

+enum class VmaAllocationRequestType

+{

+    Normal,

+    // Used by "Linear" algorithm.

+    UpperAddress,

+    EndOf1st,

+    EndOf2nd,

+};

+

+/*

+Parameters of planned allocation inside a VmaDeviceMemoryBlock.

+

+If canMakeOtherLost was false:

+- item points to a FREE suballocation.

+- itemsToMakeLostCount is 0.

+

+If canMakeOtherLost was true:

+- item points to first of sequence of suballocations, which are either FREE,

+  or point to VmaAllocations that can become lost.

+- itemsToMakeLostCount is the number of VmaAllocations that need to be made lost for

+  the requested allocation to succeed.

+*/

+struct VmaAllocationRequest

+{

+    VkDeviceSize offset;

+    VkDeviceSize sumFreeSize; // Sum size of free items that overlap with proposed allocation.

+    VkDeviceSize sumItemSize; // Sum size of items to make lost that overlap with proposed allocation.

+    VmaSuballocationList::iterator item;

+    size_t itemsToMakeLostCount;

+    void* customData;

+    VmaAllocationRequestType type;

+

+    VkDeviceSize CalcCost() const

+    {

+        return sumItemSize + itemsToMakeLostCount * VMA_LOST_ALLOCATION_COST;

+    }

+};

+

+/*

+Data structure used for bookkeeping of allocations and unused ranges of memory

+in a single VkDeviceMemory block.

+*/

+class VmaBlockMetadata

+{

+public:

+    VmaBlockMetadata(VmaAllocator hAllocator);

+    virtual ~VmaBlockMetadata() { }

+    virtual void Init(VkDeviceSize size) { m_Size = size; }

+

+    // Validates all data structures inside this object. If not valid, returns false.

+    virtual bool Validate() const = 0;

+    VkDeviceSize GetSize() const { return m_Size; }

+    virtual size_t GetAllocationCount() const = 0;

+    virtual VkDeviceSize GetSumFreeSize() const = 0;

+    virtual VkDeviceSize GetUnusedRangeSizeMax() const = 0;

+    // Returns true if this block is empty - contains only single free suballocation.

+    virtual bool IsEmpty() const = 0;

+

+    virtual void CalcAllocationStatInfo(VmaStatInfo& outInfo) const = 0;

+    // Shouldn't modify blockCount.

+    virtual void AddPoolStats(VmaPoolStats& inoutStats) const = 0;

+

+#if VMA_STATS_STRING_ENABLED

+    virtual void PrintDetailedMap(class VmaJsonWriter& json) const = 0;

+#endif

+

+    // Tries to find a place for suballocation with given parameters inside this block.

+    // If succeeded, fills pAllocationRequest and returns true.

+    // If failed, returns false.

+    virtual bool CreateAllocationRequest(

+        uint32_t currentFrameIndex,

+        uint32_t frameInUseCount,

+        VkDeviceSize bufferImageGranularity,

+        VkDeviceSize allocSize,

+        VkDeviceSize allocAlignment,

+        bool upperAddress,

+        VmaSuballocationType allocType,

+        bool canMakeOtherLost,

+        // Always one of VMA_ALLOCATION_CREATE_STRATEGY_* or VMA_ALLOCATION_INTERNAL_STRATEGY_* flags.

+        uint32_t strategy,

+        VmaAllocationRequest* pAllocationRequest) = 0;

+

+    virtual bool MakeRequestedAllocationsLost(

+        uint32_t currentFrameIndex,

+        uint32_t frameInUseCount,

+        VmaAllocationRequest* pAllocationRequest) = 0;

+

+    virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount) = 0;

+

+    virtual VkResult CheckCorruption(const void* pBlockData) = 0;

+

+    // Makes actual allocation based on request. Request must already be checked and valid.

+    virtual void Alloc(

+        const VmaAllocationRequest& request,

+        VmaSuballocationType type,

+        VkDeviceSize allocSize,

+        VmaAllocation hAllocation) = 0;

+

+    // Frees suballocation assigned to given memory region.

+    virtual void Free(const VmaAllocation allocation) = 0;

+    virtual void FreeAtOffset(VkDeviceSize offset) = 0;

+

+protected:

+    const VkAllocationCallbacks* GetAllocationCallbacks() const { return m_pAllocationCallbacks; }

+

+#if VMA_STATS_STRING_ENABLED

+    void PrintDetailedMap_Begin(class VmaJsonWriter& json,

+        VkDeviceSize unusedBytes,

+        size_t allocationCount,

+        size_t unusedRangeCount) const;

+    void PrintDetailedMap_Allocation(class VmaJsonWriter& json,

+        VkDeviceSize offset,

+        VmaAllocation hAllocation) const;

+    void PrintDetailedMap_UnusedRange(class VmaJsonWriter& json,

+        VkDeviceSize offset,

+        VkDeviceSize size) const;

+    void PrintDetailedMap_End(class VmaJsonWriter& json) const;

+#endif

+

+private:

+    VkDeviceSize m_Size;

+    const VkAllocationCallbacks* m_pAllocationCallbacks;

+};

+

+#define VMA_VALIDATE(cond) do { if(!(cond)) { \

+        VMA_ASSERT(0 && "Validation failed: " #cond); \

+        return false; \

+    } } while(false)

+

+class VmaBlockMetadata_Generic : public VmaBlockMetadata

+{

+    VMA_CLASS_NO_COPY(VmaBlockMetadata_Generic)

+public:

+    VmaBlockMetadata_Generic(VmaAllocator hAllocator);

+    virtual ~VmaBlockMetadata_Generic();

+    virtual void Init(VkDeviceSize size);

+

+    virtual bool Validate() const;

+    virtual size_t GetAllocationCount() const { return m_Suballocations.size() - m_FreeCount; }

+    virtual VkDeviceSize GetSumFreeSize() const { return m_SumFreeSize; }

+    virtual VkDeviceSize GetUnusedRangeSizeMax() const;

+    virtual bool IsEmpty() const;

+

+    virtual void CalcAllocationStatInfo(VmaStatInfo& outInfo) const;

+    virtual void AddPoolStats(VmaPoolStats& inoutStats) const;

+

+#if VMA_STATS_STRING_ENABLED

+    virtual void PrintDetailedMap(class VmaJsonWriter& json) const;

+#endif

+

+    virtual bool CreateAllocationRequest(

+        uint32_t currentFrameIndex,

+        uint32_t frameInUseCount,

+        VkDeviceSize bufferImageGranularity,

+        VkDeviceSize allocSize,

+        VkDeviceSize allocAlignment,

+        bool upperAddress,

+        VmaSuballocationType allocType,

+        bool canMakeOtherLost,

+        uint32_t strategy,

+        VmaAllocationRequest* pAllocationRequest);

+

+    virtual bool MakeRequestedAllocationsLost(

+        uint32_t currentFrameIndex,

+        uint32_t frameInUseCount,

+        VmaAllocationRequest* pAllocationRequest);

+

+    virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);

+

+    virtual VkResult CheckCorruption(const void* pBlockData);

+

+    virtual void Alloc(

+        const VmaAllocationRequest& request,

+        VmaSuballocationType type,

+        VkDeviceSize allocSize,

+        VmaAllocation hAllocation);

+

+    virtual void Free(const VmaAllocation allocation);

+    virtual void FreeAtOffset(VkDeviceSize offset);

+

+    ////////////////////////////////////////////////////////////////////////////////

+    // For defragmentation

+    

+    bool IsBufferImageGranularityConflictPossible(

+        VkDeviceSize bufferImageGranularity,

+        VmaSuballocationType& inOutPrevSuballocType) const;

+

+private:

+    friend class VmaDefragmentationAlgorithm_Generic;

+    friend class VmaDefragmentationAlgorithm_Fast;

+

+    uint32_t m_FreeCount;

+    VkDeviceSize m_SumFreeSize;

+    VmaSuballocationList m_Suballocations;

+    // Suballocations that are free and have size greater than certain threshold.

+    // Sorted by size, ascending.

+    VmaVector< VmaSuballocationList::iterator, VmaStlAllocator< VmaSuballocationList::iterator > > m_FreeSuballocationsBySize;

+

+    bool ValidateFreeSuballocationList() const;

+

+    // Checks if requested suballocation with given parameters can be placed in given pFreeSuballocItem.

+    // If yes, fills pOffset and returns true. If no, returns false.

+    bool CheckAllocation(

+        uint32_t currentFrameIndex,

+        uint32_t frameInUseCount,

+        VkDeviceSize bufferImageGranularity,

+        VkDeviceSize allocSize,

+        VkDeviceSize allocAlignment,

+        VmaSuballocationType allocType,

+        VmaSuballocationList::const_iterator suballocItem,

+        bool canMakeOtherLost,

+        VkDeviceSize* pOffset,

+        size_t* itemsToMakeLostCount,

+        VkDeviceSize* pSumFreeSize,

+        VkDeviceSize* pSumItemSize) const;

+    // Given free suballocation, it merges it with following one, which must also be free.

+    void MergeFreeWithNext(VmaSuballocationList::iterator item);

+    // Releases given suballocation, making it free.

+    // Merges it with adjacent free suballocations if applicable.

+    // Returns iterator to new free suballocation at this place.

+    VmaSuballocationList::iterator FreeSuballocation(VmaSuballocationList::iterator suballocItem);

+    // Given free suballocation, it inserts it into sorted list of

+    // m_FreeSuballocationsBySize if it's suitable.

+    void RegisterFreeSuballocation(VmaSuballocationList::iterator item);

+    // Given free suballocation, it removes it from sorted list of

+    // m_FreeSuballocationsBySize if it's suitable.

+    void UnregisterFreeSuballocation(VmaSuballocationList::iterator item);

+};

+

+/*

+Allocations and their references in internal data structure look like this:

+

+if(m_2ndVectorMode == SECOND_VECTOR_EMPTY):

+

+        0 +-------+

+          |       |

+          |       |

+          |       |

+          +-------+

+          | Alloc |  1st[m_1stNullItemsBeginCount]

+          +-------+

+          | Alloc |  1st[m_1stNullItemsBeginCount + 1]

+          +-------+

+          |  ...  |

+          +-------+

+          | Alloc |  1st[1st.size() - 1]

+          +-------+

+          |       |

+          |       |

+          |       |

+GetSize() +-------+

+

+if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER):

+

+        0 +-------+

+          | Alloc |  2nd[0]

+          +-------+

+          | Alloc |  2nd[1]

+          +-------+

+          |  ...  |

+          +-------+

+          | Alloc |  2nd[2nd.size() - 1]

+          +-------+

+          |       |

+          |       |

+          |       |

+          +-------+

+          | Alloc |  1st[m_1stNullItemsBeginCount]

+          +-------+

+          | Alloc |  1st[m_1stNullItemsBeginCount + 1]

+          +-------+

+          |  ...  |

+          +-------+

+          | Alloc |  1st[1st.size() - 1]

+          +-------+

+          |       |

+GetSize() +-------+

+

+if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK):

+

+        0 +-------+

+          |       |

+          |       |

+          |       |

+          +-------+

+          | Alloc |  1st[m_1stNullItemsBeginCount]

+          +-------+

+          | Alloc |  1st[m_1stNullItemsBeginCount + 1]

+          +-------+

+          |  ...  |

+          +-------+

+          | Alloc |  1st[1st.size() - 1]

+          +-------+

+          |       |

+          |       |

+          |       |

+          +-------+

+          | Alloc |  2nd[2nd.size() - 1]

+          +-------+

+          |  ...  |

+          +-------+

+          | Alloc |  2nd[1]

+          +-------+

+          | Alloc |  2nd[0]

+GetSize() +-------+

+

+*/

+class VmaBlockMetadata_Linear : public VmaBlockMetadata

+{

+    VMA_CLASS_NO_COPY(VmaBlockMetadata_Linear)

+public:

+    VmaBlockMetadata_Linear(VmaAllocator hAllocator);

+    virtual ~VmaBlockMetadata_Linear();

+    virtual void Init(VkDeviceSize size);

+

+    virtual bool Validate() const;

+    virtual size_t GetAllocationCount() const;

+    virtual VkDeviceSize GetSumFreeSize() const { return m_SumFreeSize; }

+    virtual VkDeviceSize GetUnusedRangeSizeMax() const;

+    virtual bool IsEmpty() const { return GetAllocationCount() == 0; }

+

+    virtual void CalcAllocationStatInfo(VmaStatInfo& outInfo) const;

+    virtual void AddPoolStats(VmaPoolStats& inoutStats) const;

+

+#if VMA_STATS_STRING_ENABLED

+    virtual void PrintDetailedMap(class VmaJsonWriter& json) const;

+#endif

+

+    virtual bool CreateAllocationRequest(

+        uint32_t currentFrameIndex,

+        uint32_t frameInUseCount,

+        VkDeviceSize bufferImageGranularity,

+        VkDeviceSize allocSize,

+        VkDeviceSize allocAlignment,

+        bool upperAddress,

+        VmaSuballocationType allocType,

+        bool canMakeOtherLost,

+        uint32_t strategy,

+        VmaAllocationRequest* pAllocationRequest);

+

+    virtual bool MakeRequestedAllocationsLost(

+        uint32_t currentFrameIndex,

+        uint32_t frameInUseCount,

+        VmaAllocationRequest* pAllocationRequest);

+

+    virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);

+

+    virtual VkResult CheckCorruption(const void* pBlockData);

+

+    virtual void Alloc(

+        const VmaAllocationRequest& request,

+        VmaSuballocationType type,

+        VkDeviceSize allocSize,

+        VmaAllocation hAllocation);

+

+    virtual void Free(const VmaAllocation allocation);

+    virtual void FreeAtOffset(VkDeviceSize offset);

+

+private:

+    /*

+    There are two suballocation vectors, used in ping-pong way.

+    The one with index m_1stVectorIndex is called 1st.

+    The one with index (m_1stVectorIndex ^ 1) is called 2nd.

+    2nd can be non-empty only when 1st is not empty.

+    When 2nd is not empty, m_2ndVectorMode indicates its mode of operation.

+    */

+    typedef VmaVector< VmaSuballocation, VmaStlAllocator<VmaSuballocation> > SuballocationVectorType;

+

+    enum SECOND_VECTOR_MODE

+    {

+        SECOND_VECTOR_EMPTY,

+        /*

+        Suballocations in 2nd vector are created later than the ones in 1st, but they

+        all have smaller offset.

+        */

+        SECOND_VECTOR_RING_BUFFER,

+        /*

+        Suballocations in 2nd vector are upper side of double stack.

+        They all have offsets higher than those in 1st vector.

+        Top of this stack means smaller offsets, but higher indices in this vector.

+        */

+        SECOND_VECTOR_DOUBLE_STACK,

+    };

+

+    VkDeviceSize m_SumFreeSize;

+    SuballocationVectorType m_Suballocations0, m_Suballocations1;

+    uint32_t m_1stVectorIndex;

+    SECOND_VECTOR_MODE m_2ndVectorMode;

+

+    SuballocationVectorType& AccessSuballocations1st() { return m_1stVectorIndex ? m_Suballocations1 : m_Suballocations0; }

+    SuballocationVectorType& AccessSuballocations2nd() { return m_1stVectorIndex ? m_Suballocations0 : m_Suballocations1; }

+    const SuballocationVectorType& AccessSuballocations1st() const { return m_1stVectorIndex ? m_Suballocations1 : m_Suballocations0; }

+    const SuballocationVectorType& AccessSuballocations2nd() const { return m_1stVectorIndex ? m_Suballocations0 : m_Suballocations1; }

+    

+    // Number of items in 1st vector with hAllocation = null at the beginning.

+    size_t m_1stNullItemsBeginCount;

+    // Number of other items in 1st vector with hAllocation = null somewhere in the middle.

+    size_t m_1stNullItemsMiddleCount;

+    // Number of items in 2nd vector with hAllocation = null.

+    size_t m_2ndNullItemsCount;

+

+    bool ShouldCompact1st() const;

+    void CleanupAfterFree();

+

+    bool CreateAllocationRequest_LowerAddress(

+        uint32_t currentFrameIndex,

+        uint32_t frameInUseCount,

+        VkDeviceSize bufferImageGranularity,

+        VkDeviceSize allocSize,

+        VkDeviceSize allocAlignment,

+        VmaSuballocationType allocType,

+        bool canMakeOtherLost,

+        uint32_t strategy,

+        VmaAllocationRequest* pAllocationRequest);

+    bool CreateAllocationRequest_UpperAddress(

+        uint32_t currentFrameIndex,

+        uint32_t frameInUseCount,

+        VkDeviceSize bufferImageGranularity,

+        VkDeviceSize allocSize,

+        VkDeviceSize allocAlignment,

+        VmaSuballocationType allocType,

+        bool canMakeOtherLost,

+        uint32_t strategy,

+        VmaAllocationRequest* pAllocationRequest);

+};

+

+/*

+- GetSize() is the original size of allocated memory block.

+- m_UsableSize is this size aligned down to a power of two.

+  All allocations and calculations happen relative to m_UsableSize.

+- GetUnusableSize() is the difference between them.

+  It is repoted as separate, unused range, not available for allocations.

+

+Node at level 0 has size = m_UsableSize.

+Each next level contains nodes with size 2 times smaller than current level.

+m_LevelCount is the maximum number of levels to use in the current object.

+*/

+class VmaBlockMetadata_Buddy : public VmaBlockMetadata

+{

+    VMA_CLASS_NO_COPY(VmaBlockMetadata_Buddy)

+public:

+    VmaBlockMetadata_Buddy(VmaAllocator hAllocator);

+    virtual ~VmaBlockMetadata_Buddy();

+    virtual void Init(VkDeviceSize size);

+

+    virtual bool Validate() const;

+    virtual size_t GetAllocationCount() const { return m_AllocationCount; }

+    virtual VkDeviceSize GetSumFreeSize() const { return m_SumFreeSize + GetUnusableSize(); }

+    virtual VkDeviceSize GetUnusedRangeSizeMax() const;

+    virtual bool IsEmpty() const { return m_Root->type == Node::TYPE_FREE; }

+

+    virtual void CalcAllocationStatInfo(VmaStatInfo& outInfo) const;

+    virtual void AddPoolStats(VmaPoolStats& inoutStats) const;

+

+#if VMA_STATS_STRING_ENABLED

+    virtual void PrintDetailedMap(class VmaJsonWriter& json) const;

+#endif

+

+    virtual bool CreateAllocationRequest(

+        uint32_t currentFrameIndex,

+        uint32_t frameInUseCount,

+        VkDeviceSize bufferImageGranularity,

+        VkDeviceSize allocSize,

+        VkDeviceSize allocAlignment,

+        bool upperAddress,

+        VmaSuballocationType allocType,

+        bool canMakeOtherLost,

+        uint32_t strategy,

+        VmaAllocationRequest* pAllocationRequest);

+

+    virtual bool MakeRequestedAllocationsLost(

+        uint32_t currentFrameIndex,

+        uint32_t frameInUseCount,

+        VmaAllocationRequest* pAllocationRequest);

+

+    virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);

+

+    virtual VkResult CheckCorruption(const void* pBlockData) { return VK_ERROR_FEATURE_NOT_PRESENT; }

+

+    virtual void Alloc(

+        const VmaAllocationRequest& request,

+        VmaSuballocationType type,

+        VkDeviceSize allocSize,

+        VmaAllocation hAllocation);

+

+    virtual void Free(const VmaAllocation allocation) { FreeAtOffset(allocation, allocation->GetOffset()); }

+    virtual void FreeAtOffset(VkDeviceSize offset) { FreeAtOffset(VMA_NULL, offset); }

+

+private:

+    static const VkDeviceSize MIN_NODE_SIZE = 32;

+    static const size_t MAX_LEVELS = 30;

+

+    struct ValidationContext

+    {

+        size_t calculatedAllocationCount;

+        size_t calculatedFreeCount;

+        VkDeviceSize calculatedSumFreeSize;

+

+        ValidationContext() :

+            calculatedAllocationCount(0),

+            calculatedFreeCount(0),

+            calculatedSumFreeSize(0) { }

+    };

+

+    struct Node

+    {

+        VkDeviceSize offset;

+        enum TYPE

+        {

+            TYPE_FREE,

+            TYPE_ALLOCATION,

+            TYPE_SPLIT,

+            TYPE_COUNT

+        } type;

+        Node* parent;

+        Node* buddy;

+

+        union

+        {

+            struct

+            {

+                Node* prev;

+                Node* next;

+            } free;

+            struct

+            {

+                VmaAllocation alloc;

+            } allocation;

+            struct

+            {

+                Node* leftChild;

+            } split;

+        };

+    };

+

+    // Size of the memory block aligned down to a power of two.

+    VkDeviceSize m_UsableSize;

+    uint32_t m_LevelCount;

+

+    Node* m_Root;

+    struct {

+        Node* front;

+        Node* back;

+    } m_FreeList[MAX_LEVELS];

+    // Number of nodes in the tree with type == TYPE_ALLOCATION.

+    size_t m_AllocationCount;

+    // Number of nodes in the tree with type == TYPE_FREE.

+    size_t m_FreeCount;

+    // This includes space wasted due to internal fragmentation. Doesn't include unusable size.

+    VkDeviceSize m_SumFreeSize;

+

+    VkDeviceSize GetUnusableSize() const { return GetSize() - m_UsableSize; }

+    void DeleteNode(Node* node);

+    bool ValidateNode(ValidationContext& ctx, const Node* parent, const Node* curr, uint32_t level, VkDeviceSize levelNodeSize) const;

+    uint32_t AllocSizeToLevel(VkDeviceSize allocSize) const;

+    inline VkDeviceSize LevelToNodeSize(uint32_t level) const { return m_UsableSize >> level; }

+    // Alloc passed just for validation. Can be null.

+    void FreeAtOffset(VmaAllocation alloc, VkDeviceSize offset);

+    void CalcAllocationStatInfoNode(VmaStatInfo& outInfo, const Node* node, VkDeviceSize levelNodeSize) const;

+    // Adds node to the front of FreeList at given level.

+    // node->type must be FREE.

+    // node->free.prev, next can be undefined.

+    void AddToFreeListFront(uint32_t level, Node* node);

+    // Removes node from FreeList at given level.

+    // node->type must be FREE.

+    // node->free.prev, next stay untouched.

+    void RemoveFromFreeList(uint32_t level, Node* node);

+

+#if VMA_STATS_STRING_ENABLED

+    void PrintDetailedMapNode(class VmaJsonWriter& json, const Node* node, VkDeviceSize levelNodeSize) const;

+#endif

+};

+

+/*

+Represents a single block of device memory (`VkDeviceMemory`) with all the

+data about its regions (aka suballocations, #VmaAllocation), assigned and free.

+

+Thread-safety: This class must be externally synchronized.

+*/

+class VmaDeviceMemoryBlock

+{

+    VMA_CLASS_NO_COPY(VmaDeviceMemoryBlock)

+public:

+    VmaBlockMetadata* m_pMetadata;

+

+    VmaDeviceMemoryBlock(VmaAllocator hAllocator);

+

+    ~VmaDeviceMemoryBlock()

+    {

+        VMA_ASSERT(m_MapCount == 0 && "VkDeviceMemory block is being destroyed while it is still mapped.");

+        VMA_ASSERT(m_hMemory == VK_NULL_HANDLE);

+    }

+

+    // Always call after construction.

+    void Init(

+        VmaAllocator hAllocator,

+        VmaPool hParentPool,

+        uint32_t newMemoryTypeIndex,

+        VkDeviceMemory newMemory,

+        VkDeviceSize newSize,

+        uint32_t id,

+        uint32_t algorithm);

+    // Always call before destruction.

+    void Destroy(VmaAllocator allocator);

+    

+    VmaPool GetParentPool() const { return m_hParentPool; }

+    VkDeviceMemory GetDeviceMemory() const { return m_hMemory; }

+    uint32_t GetMemoryTypeIndex() const { return m_MemoryTypeIndex; }

+    uint32_t GetId() const { return m_Id; }

+    void* GetMappedData() const { return m_pMappedData; }

+

+    // Validates all data structures inside this object. If not valid, returns false.

+    bool Validate() const;

+

+    VkResult CheckCorruption(VmaAllocator hAllocator);

+

+    // ppData can be null.

+    VkResult Map(VmaAllocator hAllocator, uint32_t count, void** ppData);

+    void Unmap(VmaAllocator hAllocator, uint32_t count);

+

+    VkResult WriteMagicValueAroundAllocation(VmaAllocator hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize);

+    VkResult ValidateMagicValueAroundAllocation(VmaAllocator hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize);

+

+    VkResult BindBufferMemory(

+        const VmaAllocator hAllocator,

+        const VmaAllocation hAllocation,

+        VkDeviceSize allocationLocalOffset,

+        VkBuffer hBuffer,

+        const void* pNext);

+    VkResult BindImageMemory(

+        const VmaAllocator hAllocator,

+        const VmaAllocation hAllocation,

+        VkDeviceSize allocationLocalOffset,

+        VkImage hImage,

+        const void* pNext);

+

+private:

+    VmaPool m_hParentPool; // VK_NULL_HANDLE if not belongs to custom pool.

+    uint32_t m_MemoryTypeIndex;

+    uint32_t m_Id;

+    VkDeviceMemory m_hMemory;

+

+    /*

+    Protects access to m_hMemory so it's not used by multiple threads simultaneously, e.g. vkMapMemory, vkBindBufferMemory.

+    Also protects m_MapCount, m_pMappedData.

+    Allocations, deallocations, any change in m_pMetadata is protected by parent's VmaBlockVector::m_Mutex.

+    */

+    VMA_MUTEX m_Mutex;

+    uint32_t m_MapCount;

+    void* m_pMappedData;

+};

+

+struct VmaPointerLess

+{

+    bool operator()(const void* lhs, const void* rhs) const

+    {

+        return lhs < rhs;

+    }

+};

+

+struct VmaDefragmentationMove

+{

+    size_t srcBlockIndex;

+    size_t dstBlockIndex;

+    VkDeviceSize srcOffset;

+    VkDeviceSize dstOffset;

+    VkDeviceSize size;

+    VmaAllocation hAllocation;

+    VmaDeviceMemoryBlock* pSrcBlock;

+    VmaDeviceMemoryBlock* pDstBlock;

+};

+

+class VmaDefragmentationAlgorithm;

+

+/*

+Sequence of VmaDeviceMemoryBlock. Represents memory blocks allocated for a specific

+Vulkan memory type.

+

+Synchronized internally with a mutex.

+*/

+struct VmaBlockVector

+{

+    VMA_CLASS_NO_COPY(VmaBlockVector)

+public:

+    VmaBlockVector(

+        VmaAllocator hAllocator,

+        VmaPool hParentPool,

+        uint32_t memoryTypeIndex,

+        VkDeviceSize preferredBlockSize,

+        size_t minBlockCount,

+        size_t maxBlockCount,

+        VkDeviceSize bufferImageGranularity,

+        uint32_t frameInUseCount,

+        bool explicitBlockSize,

+        uint32_t algorithm);

+    ~VmaBlockVector();

+

+    VkResult CreateMinBlocks();

+

+    VmaAllocator GetAllocator() const { return m_hAllocator; }

+    VmaPool GetParentPool() const { return m_hParentPool; }

+    bool IsCustomPool() const { return m_hParentPool != VMA_NULL; }

+    uint32_t GetMemoryTypeIndex() const { return m_MemoryTypeIndex; }

+    VkDeviceSize GetPreferredBlockSize() const { return m_PreferredBlockSize; }

+    VkDeviceSize GetBufferImageGranularity() const { return m_BufferImageGranularity; }

+    uint32_t GetFrameInUseCount() const { return m_FrameInUseCount; }

+    uint32_t GetAlgorithm() const { return m_Algorithm; }

+

+    void GetPoolStats(VmaPoolStats* pStats);

+

+    bool IsEmpty();

+    bool IsCorruptionDetectionEnabled() const;

+

+    VkResult Allocate(

+        uint32_t currentFrameIndex,

+        VkDeviceSize size,

+        VkDeviceSize alignment,

+        const VmaAllocationCreateInfo& createInfo,

+        VmaSuballocationType suballocType,

+        size_t allocationCount,

+        VmaAllocation* pAllocations);

+

+    void Free(const VmaAllocation hAllocation);

+

+    // Adds statistics of this BlockVector to pStats.

+    void AddStats(VmaStats* pStats);

+

+#if VMA_STATS_STRING_ENABLED

+    void PrintDetailedMap(class VmaJsonWriter& json);

+#endif

+

+    void MakePoolAllocationsLost(

+        uint32_t currentFrameIndex,

+        size_t* pLostAllocationCount);

+    VkResult CheckCorruption();

+

+    // Saves results in pCtx->res.

+    void Defragment(

+        class VmaBlockVectorDefragmentationContext* pCtx,

+        VmaDefragmentationStats* pStats, VmaDefragmentationFlags flags,

+        VkDeviceSize& maxCpuBytesToMove, uint32_t& maxCpuAllocationsToMove,

+        VkDeviceSize& maxGpuBytesToMove, uint32_t& maxGpuAllocationsToMove,

+        VkCommandBuffer commandBuffer);

+    void DefragmentationEnd(

+        class VmaBlockVectorDefragmentationContext* pCtx,

+        uint32_t flags,

+        VmaDefragmentationStats* pStats);

+

+    uint32_t ProcessDefragmentations(

+        class VmaBlockVectorDefragmentationContext *pCtx,

+        VmaDefragmentationPassMoveInfo* pMove, uint32_t maxMoves);

+

+    void CommitDefragmentations(

+        class VmaBlockVectorDefragmentationContext *pCtx,

+        VmaDefragmentationStats* pStats);

+

+    ////////////////////////////////////////////////////////////////////////////////

+    // To be used only while the m_Mutex is locked. Used during defragmentation.

+

+    size_t GetBlockCount() const { return m_Blocks.size(); }

+    VmaDeviceMemoryBlock* GetBlock(size_t index) const { return m_Blocks[index]; }

+    size_t CalcAllocationCount() const;

+    bool IsBufferImageGranularityConflictPossible() const;

+

+private:

+    friend class VmaDefragmentationAlgorithm_Generic;

+

+    const VmaAllocator m_hAllocator;

+    const VmaPool m_hParentPool;

+    const uint32_t m_MemoryTypeIndex;

+    const VkDeviceSize m_PreferredBlockSize;

+    const size_t m_MinBlockCount;

+    const size_t m_MaxBlockCount;

+    const VkDeviceSize m_BufferImageGranularity;

+    const uint32_t m_FrameInUseCount;

+    const bool m_ExplicitBlockSize;

+    const uint32_t m_Algorithm;

+    VMA_RW_MUTEX m_Mutex;

+

+    /* There can be at most one allocation that is completely empty (except when minBlockCount > 0) -

+    a hysteresis to avoid pessimistic case of alternating creation and destruction of a VkDeviceMemory. */

+    bool m_HasEmptyBlock;

+    // Incrementally sorted by sumFreeSize, ascending.

+    VmaVector< VmaDeviceMemoryBlock*, VmaStlAllocator<VmaDeviceMemoryBlock*> > m_Blocks;

+    uint32_t m_NextBlockId;

+

+    VkDeviceSize CalcMaxBlockSize() const;

+

+    // Finds and removes given block from vector.

+    void Remove(VmaDeviceMemoryBlock* pBlock);

+

+    // Performs single step in sorting m_Blocks. They may not be fully sorted

+    // after this call.

+    void IncrementallySortBlocks();

+

+    VkResult AllocatePage(

+        uint32_t currentFrameIndex,

+        VkDeviceSize size,

+        VkDeviceSize alignment,

+        const VmaAllocationCreateInfo& createInfo,

+        VmaSuballocationType suballocType,

+        VmaAllocation* pAllocation);

+

+    // To be used only without CAN_MAKE_OTHER_LOST flag.

+    VkResult AllocateFromBlock(

+        VmaDeviceMemoryBlock* pBlock,

+        uint32_t currentFrameIndex,

+        VkDeviceSize size,

+        VkDeviceSize alignment,

+        VmaAllocationCreateFlags allocFlags,

+        void* pUserData,

+        VmaSuballocationType suballocType,

+        uint32_t strategy,

+        VmaAllocation* pAllocation);

+

+    VkResult CreateBlock(VkDeviceSize blockSize, size_t* pNewBlockIndex);

+

+    // Saves result to pCtx->res.

+    void ApplyDefragmentationMovesCpu(

+        class VmaBlockVectorDefragmentationContext* pDefragCtx,

+        const VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves);

+    // Saves result to pCtx->res.

+    void ApplyDefragmentationMovesGpu(

+        class VmaBlockVectorDefragmentationContext* pDefragCtx,

+        VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,

+        VkCommandBuffer commandBuffer);

+

+    /*

+    Used during defragmentation. pDefragmentationStats is optional. It's in/out

+    - updated with new data.

+    */

+    void FreeEmptyBlocks(VmaDefragmentationStats* pDefragmentationStats);

+

+    void UpdateHasEmptyBlock();

+};

+

+struct VmaPool_T

+{

+    VMA_CLASS_NO_COPY(VmaPool_T)

+public:

+    VmaBlockVector m_BlockVector;

+

+    VmaPool_T(

+        VmaAllocator hAllocator,

+        const VmaPoolCreateInfo& createInfo,

+        VkDeviceSize preferredBlockSize);

+    ~VmaPool_T();

+

+    uint32_t GetId() const { return m_Id; }

+    void SetId(uint32_t id) { VMA_ASSERT(m_Id == 0); m_Id = id; }

+

+    const char* GetName() const { return m_Name; }

+    void SetName(const char* pName);

+

+#if VMA_STATS_STRING_ENABLED

+    //void PrintDetailedMap(class VmaStringBuilder& sb);

+#endif

+

+private:

+    uint32_t m_Id;

+    char* m_Name;

+};

+

+/*

+Performs defragmentation:

+

+- Updates `pBlockVector->m_pMetadata`.

+- Updates allocations by calling ChangeBlockAllocation() or ChangeOffset().

+- Does not move actual data, only returns requested moves as `moves`.

+*/

+class VmaDefragmentationAlgorithm

+{

+    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm)

+public:

+    VmaDefragmentationAlgorithm(

+        VmaAllocator hAllocator,

+        VmaBlockVector* pBlockVector,

+        uint32_t currentFrameIndex) :

+        m_hAllocator(hAllocator),

+        m_pBlockVector(pBlockVector),

+        m_CurrentFrameIndex(currentFrameIndex)

+    {

+    }

+    virtual ~VmaDefragmentationAlgorithm()

+    {

+    }

+

+    virtual void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged) = 0;

+    virtual void AddAll() = 0;

+

+    virtual VkResult Defragment(

+        VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,

+        VkDeviceSize maxBytesToMove,

+        uint32_t maxAllocationsToMove,

+        VmaDefragmentationFlags flags) = 0;

+

+    virtual VkDeviceSize GetBytesMoved() const = 0;

+    virtual uint32_t GetAllocationsMoved() const = 0;

+

+protected:

+    VmaAllocator const m_hAllocator;

+    VmaBlockVector* const m_pBlockVector;

+    const uint32_t m_CurrentFrameIndex;

+

+    struct AllocationInfo

+    {

+        VmaAllocation m_hAllocation;

+        VkBool32* m_pChanged;

+

+        AllocationInfo() :

+            m_hAllocation(VK_NULL_HANDLE),

+            m_pChanged(VMA_NULL)

+        {

+        }

+        AllocationInfo(VmaAllocation hAlloc, VkBool32* pChanged) :

+            m_hAllocation(hAlloc),

+            m_pChanged(pChanged)

+        {

+        }

+    };

+};

+

+class VmaDefragmentationAlgorithm_Generic : public VmaDefragmentationAlgorithm

+{

+    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm_Generic)

+public:

+    VmaDefragmentationAlgorithm_Generic(

+        VmaAllocator hAllocator,

+        VmaBlockVector* pBlockVector,

+        uint32_t currentFrameIndex,

+        bool overlappingMoveSupported);

+    virtual ~VmaDefragmentationAlgorithm_Generic();

+

+    virtual void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged);

+    virtual void AddAll() { m_AllAllocations = true; }

+

+    virtual VkResult Defragment(

+        VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,

+        VkDeviceSize maxBytesToMove,

+        uint32_t maxAllocationsToMove,

+        VmaDefragmentationFlags flags);

+

+    virtual VkDeviceSize GetBytesMoved() const { return m_BytesMoved; }

+    virtual uint32_t GetAllocationsMoved() const { return m_AllocationsMoved; }

+

+private:

+    uint32_t m_AllocationCount;

+    bool m_AllAllocations;

+

+    VkDeviceSize m_BytesMoved;

+    uint32_t m_AllocationsMoved;

+

+    struct AllocationInfoSizeGreater

+    {

+        bool operator()(const AllocationInfo& lhs, const AllocationInfo& rhs) const

+        {

+            return lhs.m_hAllocation->GetSize() > rhs.m_hAllocation->GetSize();

+        }

+    };

+

+    struct AllocationInfoOffsetGreater

+    {

+        bool operator()(const AllocationInfo& lhs, const AllocationInfo& rhs) const

+        {

+            return lhs.m_hAllocation->GetOffset() > rhs.m_hAllocation->GetOffset();

+        }

+    };

+

+    struct BlockInfo

+    {

+        size_t m_OriginalBlockIndex;

+        VmaDeviceMemoryBlock* m_pBlock;

+        bool m_HasNonMovableAllocations;

+        VmaVector< AllocationInfo, VmaStlAllocator<AllocationInfo> > m_Allocations;

+

+        BlockInfo(const VkAllocationCallbacks* pAllocationCallbacks) :

+            m_OriginalBlockIndex(SIZE_MAX),

+            m_pBlock(VMA_NULL),

+            m_HasNonMovableAllocations(true),

+            m_Allocations(pAllocationCallbacks)

+        {

+        }

+

+        void CalcHasNonMovableAllocations()

+        {

+            const size_t blockAllocCount = m_pBlock->m_pMetadata->GetAllocationCount();

+            const size_t defragmentAllocCount = m_Allocations.size();

+            m_HasNonMovableAllocations = blockAllocCount != defragmentAllocCount;

+        }

+

+        void SortAllocationsBySizeDescending()

+        {

+            VMA_SORT(m_Allocations.begin(), m_Allocations.end(), AllocationInfoSizeGreater());

+        }

+

+        void SortAllocationsByOffsetDescending()

+        {

+            VMA_SORT(m_Allocations.begin(), m_Allocations.end(), AllocationInfoOffsetGreater());

+        }

+    };

+

+    struct BlockPointerLess

+    {

+        bool operator()(const BlockInfo* pLhsBlockInfo, const VmaDeviceMemoryBlock* pRhsBlock) const

+        {

+            return pLhsBlockInfo->m_pBlock < pRhsBlock;

+        }

+        bool operator()(const BlockInfo* pLhsBlockInfo, const BlockInfo* pRhsBlockInfo) const

+        {

+            return pLhsBlockInfo->m_pBlock < pRhsBlockInfo->m_pBlock;

+        }

+    };

+

+    // 1. Blocks with some non-movable allocations go first.

+    // 2. Blocks with smaller sumFreeSize go first.

+    struct BlockInfoCompareMoveDestination

+    {

+        bool operator()(const BlockInfo* pLhsBlockInfo, const BlockInfo* pRhsBlockInfo) const

+        {

+            if(pLhsBlockInfo->m_HasNonMovableAllocations && !pRhsBlockInfo->m_HasNonMovableAllocations)

+            {

+                return true;

+            }

+            if(!pLhsBlockInfo->m_HasNonMovableAllocations && pRhsBlockInfo->m_HasNonMovableAllocations)

+            {

+                return false;

+            }

+            if(pLhsBlockInfo->m_pBlock->m_pMetadata->GetSumFreeSize() < pRhsBlockInfo->m_pBlock->m_pMetadata->GetSumFreeSize())

+            {

+                return true;

+            }

+            return false;

+        }

+    };

+

+    typedef VmaVector< BlockInfo*, VmaStlAllocator<BlockInfo*> > BlockInfoVector;

+    BlockInfoVector m_Blocks;

+

+    VkResult DefragmentRound(

+        VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,

+        VkDeviceSize maxBytesToMove,

+        uint32_t maxAllocationsToMove,

+        bool freeOldAllocations);

+

+    size_t CalcBlocksWithNonMovableCount() const;

+

+    static bool MoveMakesSense(

+        size_t dstBlockIndex, VkDeviceSize dstOffset,

+        size_t srcBlockIndex, VkDeviceSize srcOffset);

+};

+

+class VmaDefragmentationAlgorithm_Fast : public VmaDefragmentationAlgorithm

+{

+    VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm_Fast)

+public:

+    VmaDefragmentationAlgorithm_Fast(

+        VmaAllocator hAllocator,

+        VmaBlockVector* pBlockVector,

+        uint32_t currentFrameIndex,

+        bool overlappingMoveSupported);

+    virtual ~VmaDefragmentationAlgorithm_Fast();

+

+    virtual void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged) { ++m_AllocationCount; }

+    virtual void AddAll() { m_AllAllocations = true; }

+

+    virtual VkResult Defragment(

+        VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,

+        VkDeviceSize maxBytesToMove,

+        uint32_t maxAllocationsToMove,

+        VmaDefragmentationFlags flags);

+

+    virtual VkDeviceSize GetBytesMoved() const { return m_BytesMoved; }

+    virtual uint32_t GetAllocationsMoved() const { return m_AllocationsMoved; }

+

+private:

+    struct BlockInfo

+    {

+        size_t origBlockIndex;

+    };

+

+    class FreeSpaceDatabase

+    {

+    public:

+        FreeSpaceDatabase()

+        {

+            FreeSpace s = {};

+            s.blockInfoIndex = SIZE_MAX;

+            for(size_t i = 0; i < MAX_COUNT; ++i)

+            {

+                m_FreeSpaces[i] = s;

+            }

+        }

+

+        void Register(size_t blockInfoIndex, VkDeviceSize offset, VkDeviceSize size)

+        {

+            if(size < VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)

+            {

+                return;

+            }

+

+            // Find first invalid or the smallest structure.

+            size_t bestIndex = SIZE_MAX;

+            for(size_t i = 0; i < MAX_COUNT; ++i)

+            {

+                // Empty structure.

+                if(m_FreeSpaces[i].blockInfoIndex == SIZE_MAX)

+                {

+                    bestIndex = i;

+                    break;

+                }

+                if(m_FreeSpaces[i].size < size &&

+                    (bestIndex == SIZE_MAX || m_FreeSpaces[bestIndex].size > m_FreeSpaces[i].size))

+                {

+                    bestIndex = i;

+                }

+            }

+

+            if(bestIndex != SIZE_MAX)

+            {

+                m_FreeSpaces[bestIndex].blockInfoIndex = blockInfoIndex;

+                m_FreeSpaces[bestIndex].offset = offset;

+                m_FreeSpaces[bestIndex].size = size;

+            }

+        }

+

+        bool Fetch(VkDeviceSize alignment, VkDeviceSize size,

+            size_t& outBlockInfoIndex, VkDeviceSize& outDstOffset)

+        {

+            size_t bestIndex = SIZE_MAX;

+            VkDeviceSize bestFreeSpaceAfter = 0;

+            for(size_t i = 0; i < MAX_COUNT; ++i)

+            {

+                // Structure is valid.

+                if(m_FreeSpaces[i].blockInfoIndex != SIZE_MAX)

+                {

+                    const VkDeviceSize dstOffset = VmaAlignUp(m_FreeSpaces[i].offset, alignment);

+                    // Allocation fits into this structure.

+                    if(dstOffset + size <= m_FreeSpaces[i].offset + m_FreeSpaces[i].size)

+                    {

+                        const VkDeviceSize freeSpaceAfter = (m_FreeSpaces[i].offset + m_FreeSpaces[i].size) -

+                            (dstOffset + size);

+                        if(bestIndex == SIZE_MAX || freeSpaceAfter > bestFreeSpaceAfter)

+                        {

+                            bestIndex = i;

+                            bestFreeSpaceAfter = freeSpaceAfter;

+                        }

+                    }

+                }

+            }

+            

+            if(bestIndex != SIZE_MAX)

+            {

+                outBlockInfoIndex = m_FreeSpaces[bestIndex].blockInfoIndex;

+                outDstOffset = VmaAlignUp(m_FreeSpaces[bestIndex].offset, alignment);

+

+                if(bestFreeSpaceAfter >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)

+                {

+                    // Leave this structure for remaining empty space.

+                    const VkDeviceSize alignmentPlusSize = (outDstOffset - m_FreeSpaces[bestIndex].offset) + size;

+                    m_FreeSpaces[bestIndex].offset += alignmentPlusSize;

+                    m_FreeSpaces[bestIndex].size -= alignmentPlusSize;

+                }

+                else

+                {

+                    // This structure becomes invalid.

+                    m_FreeSpaces[bestIndex].blockInfoIndex = SIZE_MAX;

+                }

+

+                return true;

+            }

+

+            return false;

+        }

+

+    private:

+        static const size_t MAX_COUNT = 4;

+

+        struct FreeSpace

+        {

+            size_t blockInfoIndex; // SIZE_MAX means this structure is invalid.

+            VkDeviceSize offset;

+            VkDeviceSize size;

+        } m_FreeSpaces[MAX_COUNT];

+    };

+

+    const bool m_OverlappingMoveSupported;

+

+    uint32_t m_AllocationCount;

+    bool m_AllAllocations;

+

+    VkDeviceSize m_BytesMoved;

+    uint32_t m_AllocationsMoved;

+

+    VmaVector< BlockInfo, VmaStlAllocator<BlockInfo> > m_BlockInfos;

+

+    void PreprocessMetadata();

+    void PostprocessMetadata();

+    void InsertSuballoc(VmaBlockMetadata_Generic* pMetadata, const VmaSuballocation& suballoc);

+};

+

+struct VmaBlockDefragmentationContext

+{

+    enum BLOCK_FLAG

+    {

+        BLOCK_FLAG_USED = 0x00000001,

+    };

+    uint32_t flags;

+    VkBuffer hBuffer;

+};

+

+class VmaBlockVectorDefragmentationContext

+{

+    VMA_CLASS_NO_COPY(VmaBlockVectorDefragmentationContext)

+public:

+    VkResult res;

+    bool mutexLocked;

+    VmaVector< VmaBlockDefragmentationContext, VmaStlAllocator<VmaBlockDefragmentationContext> > blockContexts;

+    VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> > defragmentationMoves;

+    uint32_t defragmentationMovesProcessed;

+    uint32_t defragmentationMovesCommitted;

+    bool hasDefragmentationPlan;

+

+    VmaBlockVectorDefragmentationContext(

+        VmaAllocator hAllocator,

+        VmaPool hCustomPool, // Optional.

+        VmaBlockVector* pBlockVector,

+        uint32_t currFrameIndex);

+    ~VmaBlockVectorDefragmentationContext();

+

+    VmaPool GetCustomPool() const { return m_hCustomPool; }

+    VmaBlockVector* GetBlockVector() const { return m_pBlockVector; }

+    VmaDefragmentationAlgorithm* GetAlgorithm() const { return m_pAlgorithm; }

+

+    void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged);

+    void AddAll() { m_AllAllocations = true; }

+

+    void Begin(bool overlappingMoveSupported, VmaDefragmentationFlags flags);

+

+private:

+    const VmaAllocator m_hAllocator;

+    // Null if not from custom pool.

+    const VmaPool m_hCustomPool;

+    // Redundant, for convenience not to fetch from m_hCustomPool->m_BlockVector or m_hAllocator->m_pBlockVectors.

+    VmaBlockVector* const m_pBlockVector;

+    const uint32_t m_CurrFrameIndex;

+    // Owner of this object.

+    VmaDefragmentationAlgorithm* m_pAlgorithm;

+

+    struct AllocInfo

+    {

+        VmaAllocation hAlloc;

+        VkBool32* pChanged;

+    };

+    // Used between constructor and Begin.

+    VmaVector< AllocInfo, VmaStlAllocator<AllocInfo> > m_Allocations;

+    bool m_AllAllocations;

+};

+

+struct VmaDefragmentationContext_T

+{

+private:

+    VMA_CLASS_NO_COPY(VmaDefragmentationContext_T)

+public:

+    VmaDefragmentationContext_T(

+        VmaAllocator hAllocator,

+        uint32_t currFrameIndex,

+        uint32_t flags,

+        VmaDefragmentationStats* pStats);

+    ~VmaDefragmentationContext_T();

+

+    void AddPools(uint32_t poolCount, const VmaPool* pPools);

+    void AddAllocations(

+        uint32_t allocationCount,

+        const VmaAllocation* pAllocations,

+        VkBool32* pAllocationsChanged);

+

+    /*

+    Returns:

+    - `VK_SUCCESS` if succeeded and object can be destroyed immediately.

+    - `VK_NOT_READY` if succeeded but the object must remain alive until vmaDefragmentationEnd().

+    - Negative value if error occured and object can be destroyed immediately.

+    */

+    VkResult Defragment(

+        VkDeviceSize maxCpuBytesToMove, uint32_t maxCpuAllocationsToMove,

+        VkDeviceSize maxGpuBytesToMove, uint32_t maxGpuAllocationsToMove,

+        VkCommandBuffer commandBuffer, VmaDefragmentationStats* pStats, VmaDefragmentationFlags flags);

+

+    VkResult DefragmentPassBegin(VmaDefragmentationPassInfo* pInfo);

+    VkResult DefragmentPassEnd();

+

+private:

+    const VmaAllocator m_hAllocator;

+    const uint32_t m_CurrFrameIndex;

+    const uint32_t m_Flags;

+    VmaDefragmentationStats* const m_pStats;

+

+    VkDeviceSize m_MaxCpuBytesToMove;

+    uint32_t m_MaxCpuAllocationsToMove;

+    VkDeviceSize m_MaxGpuBytesToMove;

+    uint32_t m_MaxGpuAllocationsToMove;

+

+    // Owner of these objects.

+    VmaBlockVectorDefragmentationContext* m_DefaultPoolContexts[VK_MAX_MEMORY_TYPES];

+    // Owner of these objects.

+    VmaVector< VmaBlockVectorDefragmentationContext*, VmaStlAllocator<VmaBlockVectorDefragmentationContext*> > m_CustomPoolContexts;

+};

+

+#if VMA_RECORDING_ENABLED

+

+class VmaRecorder

+{

+public:

+    VmaRecorder();

+    VkResult Init(const VmaRecordSettings& settings, bool useMutex);

+    void WriteConfiguration(

+        const VkPhysicalDeviceProperties& devProps,

+        const VkPhysicalDeviceMemoryProperties& memProps,

+        uint32_t vulkanApiVersion,

+        bool dedicatedAllocationExtensionEnabled,

+        bool bindMemory2ExtensionEnabled,

+        bool memoryBudgetExtensionEnabled,

+        bool deviceCoherentMemoryExtensionEnabled);

+    ~VmaRecorder();

+

+    void RecordCreateAllocator(uint32_t frameIndex);

+    void RecordDestroyAllocator(uint32_t frameIndex);

+    void RecordCreatePool(uint32_t frameIndex,

+        const VmaPoolCreateInfo& createInfo,

+        VmaPool pool);

+    void RecordDestroyPool(uint32_t frameIndex, VmaPool pool);

+    void RecordAllocateMemory(uint32_t frameIndex,

+        const VkMemoryRequirements& vkMemReq,

+        const VmaAllocationCreateInfo& createInfo,

+        VmaAllocation allocation);

+    void RecordAllocateMemoryPages(uint32_t frameIndex,

+        const VkMemoryRequirements& vkMemReq,

+        const VmaAllocationCreateInfo& createInfo,

+        uint64_t allocationCount,

+        const VmaAllocation* pAllocations);

+    void RecordAllocateMemoryForBuffer(uint32_t frameIndex,

+        const VkMemoryRequirements& vkMemReq,

+        bool requiresDedicatedAllocation,

+        bool prefersDedicatedAllocation,

+        const VmaAllocationCreateInfo& createInfo,

+        VmaAllocation allocation);

+    void RecordAllocateMemoryForImage(uint32_t frameIndex,

+        const VkMemoryRequirements& vkMemReq,

+        bool requiresDedicatedAllocation,

+        bool prefersDedicatedAllocation,

+        const VmaAllocationCreateInfo& createInfo,

+        VmaAllocation allocation);

+    void RecordFreeMemory(uint32_t frameIndex,

+        VmaAllocation allocation);

+    void RecordFreeMemoryPages(uint32_t frameIndex,

+        uint64_t allocationCount,

+        const VmaAllocation* pAllocations);

+    void RecordSetAllocationUserData(uint32_t frameIndex,

+        VmaAllocation allocation,

+        const void* pUserData);

+    void RecordCreateLostAllocation(uint32_t frameIndex,

+        VmaAllocation allocation);

+    void RecordMapMemory(uint32_t frameIndex,

+        VmaAllocation allocation);

+    void RecordUnmapMemory(uint32_t frameIndex,

+        VmaAllocation allocation);

+    void RecordFlushAllocation(uint32_t frameIndex,

+        VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size);

+    void RecordInvalidateAllocation(uint32_t frameIndex,

+        VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size);

+    void RecordCreateBuffer(uint32_t frameIndex,

+        const VkBufferCreateInfo& bufCreateInfo,

+        const VmaAllocationCreateInfo& allocCreateInfo,

+        VmaAllocation allocation);

+    void RecordCreateImage(uint32_t frameIndex,

+        const VkImageCreateInfo& imageCreateInfo,

+        const VmaAllocationCreateInfo& allocCreateInfo,

+        VmaAllocation allocation);

+    void RecordDestroyBuffer(uint32_t frameIndex,

+        VmaAllocation allocation);

+    void RecordDestroyImage(uint32_t frameIndex,

+        VmaAllocation allocation);

+    void RecordTouchAllocation(uint32_t frameIndex,

+        VmaAllocation allocation);

+    void RecordGetAllocationInfo(uint32_t frameIndex,

+        VmaAllocation allocation);

+    void RecordMakePoolAllocationsLost(uint32_t frameIndex,

+        VmaPool pool);

+    void RecordDefragmentationBegin(uint32_t frameIndex,

+        const VmaDefragmentationInfo2& info,

+        VmaDefragmentationContext ctx);

+    void RecordDefragmentationEnd(uint32_t frameIndex,

+        VmaDefragmentationContext ctx);

+    void RecordSetPoolName(uint32_t frameIndex,

+        VmaPool pool,

+        const char* name);

+

+private:

+    struct CallParams

+    {

+        uint32_t threadId;

+        double time;

+    };

+

+    class UserDataString

+    {

+    public:

+        UserDataString(VmaAllocationCreateFlags allocFlags, const void* pUserData);

+        const char* GetString() const { return m_Str; }

+

+    private:

+        char m_PtrStr[17];

+        const char* m_Str;

+    };

+

+    bool m_UseMutex;

+    VmaRecordFlags m_Flags;

+    FILE* m_File;

+    VMA_MUTEX m_FileMutex;

+    int64_t m_Freq;

+    int64_t m_StartCounter;

+

+    void GetBasicParams(CallParams& outParams);

+

+    // T must be a pointer type, e.g. VmaAllocation, VmaPool.

+    template<typename T>

+    void PrintPointerList(uint64_t count, const T* pItems)

+    {

+        if(count)

+        {

+            fprintf(m_File, "%p", pItems[0]);

+            for(uint64_t i = 1; i < count; ++i)

+            {

+                fprintf(m_File, " %p", pItems[i]);

+            }

+        }

+    }

+

+    void PrintPointerList(uint64_t count, const VmaAllocation* pItems);

+    void Flush();

+};

+

+#endif // #if VMA_RECORDING_ENABLED

+

+/*

+Thread-safe wrapper over VmaPoolAllocator free list, for allocation of VmaAllocation_T objects.

+*/

+class VmaAllocationObjectAllocator

+{

+    VMA_CLASS_NO_COPY(VmaAllocationObjectAllocator)

+public:

+    VmaAllocationObjectAllocator(const VkAllocationCallbacks* pAllocationCallbacks);

+

+    template<typename... Types> VmaAllocation Allocate(Types... args);

+    void Free(VmaAllocation hAlloc);

+

+private:

+    VMA_MUTEX m_Mutex;

+    VmaPoolAllocator<VmaAllocation_T> m_Allocator;

+};

+

+struct VmaCurrentBudgetData

+{

+    VMA_ATOMIC_UINT64 m_BlockBytes[VK_MAX_MEMORY_HEAPS];

+    VMA_ATOMIC_UINT64 m_AllocationBytes[VK_MAX_MEMORY_HEAPS];

+

+#if VMA_MEMORY_BUDGET

+    VMA_ATOMIC_UINT32 m_OperationsSinceBudgetFetch;

+    VMA_RW_MUTEX m_BudgetMutex;

+    uint64_t m_VulkanUsage[VK_MAX_MEMORY_HEAPS];

+    uint64_t m_VulkanBudget[VK_MAX_MEMORY_HEAPS];

+    uint64_t m_BlockBytesAtBudgetFetch[VK_MAX_MEMORY_HEAPS];

+#endif // #if VMA_MEMORY_BUDGET

+

+    VmaCurrentBudgetData()

+    {

+        for(uint32_t heapIndex = 0; heapIndex < VK_MAX_MEMORY_HEAPS; ++heapIndex)

+        {

+            m_BlockBytes[heapIndex] = 0;

+            m_AllocationBytes[heapIndex] = 0;

+#if VMA_MEMORY_BUDGET

+            m_VulkanUsage[heapIndex] = 0;

+            m_VulkanBudget[heapIndex] = 0;

+            m_BlockBytesAtBudgetFetch[heapIndex] = 0;

+#endif

+        }

+

+#if VMA_MEMORY_BUDGET

+        m_OperationsSinceBudgetFetch = 0;

+#endif

+    }

+

+    void AddAllocation(uint32_t heapIndex, VkDeviceSize allocationSize)

+    {

+        m_AllocationBytes[heapIndex] += allocationSize;

+#if VMA_MEMORY_BUDGET

+        ++m_OperationsSinceBudgetFetch;

+#endif

+    }

+

+    void RemoveAllocation(uint32_t heapIndex, VkDeviceSize allocationSize)

+    {

+        VMA_ASSERT(m_AllocationBytes[heapIndex] >= allocationSize); // DELME

+        m_AllocationBytes[heapIndex] -= allocationSize;

+#if VMA_MEMORY_BUDGET

+        ++m_OperationsSinceBudgetFetch;

+#endif

+    }

+};

+

+// Main allocator object.

+struct VmaAllocator_T

+{

+    VMA_CLASS_NO_COPY(VmaAllocator_T)

+public:

+    bool m_UseMutex;

+    uint32_t m_VulkanApiVersion;

+    bool m_UseKhrDedicatedAllocation; // Can be set only if m_VulkanApiVersion < VK_MAKE_VERSION(1, 1, 0).

+    bool m_UseKhrBindMemory2; // Can be set only if m_VulkanApiVersion < VK_MAKE_VERSION(1, 1, 0).

+    bool m_UseExtMemoryBudget;

+    bool m_UseAmdDeviceCoherentMemory;

+    bool m_UseKhrBufferDeviceAddress;

+    VkDevice m_hDevice;

+    VkInstance m_hInstance;

+    bool m_AllocationCallbacksSpecified;

+    VkAllocationCallbacks m_AllocationCallbacks;

+    VmaDeviceMemoryCallbacks m_DeviceMemoryCallbacks;

+    VmaAllocationObjectAllocator m_AllocationObjectAllocator;

+    

+    // Each bit (1 << i) is set if HeapSizeLimit is enabled for that heap, so cannot allocate more than the heap size.

+    uint32_t m_HeapSizeLimitMask;

+

+    VkPhysicalDeviceProperties m_PhysicalDeviceProperties;

+    VkPhysicalDeviceMemoryProperties m_MemProps;

+

+    // Default pools.

+    VmaBlockVector* m_pBlockVectors[VK_MAX_MEMORY_TYPES];

+

+    // Each vector is sorted by memory (handle value).

+    typedef VmaVector< VmaAllocation, VmaStlAllocator<VmaAllocation> > AllocationVectorType;

+    AllocationVectorType* m_pDedicatedAllocations[VK_MAX_MEMORY_TYPES];

+    VMA_RW_MUTEX m_DedicatedAllocationsMutex[VK_MAX_MEMORY_TYPES];

+

+    VmaCurrentBudgetData m_Budget;

+

+    VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo);

+    VkResult Init(const VmaAllocatorCreateInfo* pCreateInfo);

+    ~VmaAllocator_T();

+

+    const VkAllocationCallbacks* GetAllocationCallbacks() const

+    {

+        return m_AllocationCallbacksSpecified ? &m_AllocationCallbacks : 0;

+    }

+    const VmaVulkanFunctions& GetVulkanFunctions() const

+    {

+        return m_VulkanFunctions;

+    }

+

+    VkPhysicalDevice GetPhysicalDevice() const { return m_PhysicalDevice; }

+

+    VkDeviceSize GetBufferImageGranularity() const

+    {

+        return VMA_MAX(

+            static_cast<VkDeviceSize>(VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY),

+            m_PhysicalDeviceProperties.limits.bufferImageGranularity);

+    }

+

+    uint32_t GetMemoryHeapCount() const { return m_MemProps.memoryHeapCount; }

+    uint32_t GetMemoryTypeCount() const { return m_MemProps.memoryTypeCount; }

+

+    uint32_t MemoryTypeIndexToHeapIndex(uint32_t memTypeIndex) const

+    {

+        VMA_ASSERT(memTypeIndex < m_MemProps.memoryTypeCount);

+        return m_MemProps.memoryTypes[memTypeIndex].heapIndex;

+    }

+    // True when specific memory type is HOST_VISIBLE but not HOST_COHERENT.

+    bool IsMemoryTypeNonCoherent(uint32_t memTypeIndex) const

+    {

+        return (m_MemProps.memoryTypes[memTypeIndex].propertyFlags & (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) ==

+            VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;

+    }

+    // Minimum alignment for all allocations in specific memory type.

+    VkDeviceSize GetMemoryTypeMinAlignment(uint32_t memTypeIndex) const

+    {

+        return IsMemoryTypeNonCoherent(memTypeIndex) ?

+            VMA_MAX((VkDeviceSize)VMA_DEBUG_ALIGNMENT, m_PhysicalDeviceProperties.limits.nonCoherentAtomSize) :

+            (VkDeviceSize)VMA_DEBUG_ALIGNMENT;

+    }

+

+    bool IsIntegratedGpu() const

+    {

+        return m_PhysicalDeviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;

+    }

+

+    uint32_t GetGlobalMemoryTypeBits() const { return m_GlobalMemoryTypeBits; }

+

+#if VMA_RECORDING_ENABLED

+    VmaRecorder* GetRecorder() const { return m_pRecorder; }

+#endif

+

+    void GetBufferMemoryRequirements(

+        VkBuffer hBuffer,

+        VkMemoryRequirements& memReq,

+        bool& requiresDedicatedAllocation,

+        bool& prefersDedicatedAllocation) const;

+    void GetImageMemoryRequirements(

+        VkImage hImage,

+        VkMemoryRequirements& memReq,

+        bool& requiresDedicatedAllocation,

+        bool& prefersDedicatedAllocation) const;

+

+    // Main allocation function.

+    VkResult AllocateMemory(

+        const VkMemoryRequirements& vkMemReq,

+        bool requiresDedicatedAllocation,

+        bool prefersDedicatedAllocation,

+        VkBuffer dedicatedBuffer,

+        VkBufferUsageFlags dedicatedBufferUsage, // UINT32_MAX when unknown.

+        VkImage dedicatedImage,

+        const VmaAllocationCreateInfo& createInfo,

+        VmaSuballocationType suballocType,

+        size_t allocationCount,

+        VmaAllocation* pAllocations);

+

+    // Main deallocation function.

+    void FreeMemory(

+        size_t allocationCount,

+        const VmaAllocation* pAllocations);

+

+    VkResult ResizeAllocation(

+        const VmaAllocation alloc,

+        VkDeviceSize newSize);

+

+    void CalculateStats(VmaStats* pStats);

+

+    void GetBudget(

+        VmaBudget* outBudget, uint32_t firstHeap, uint32_t heapCount);

+

+#if VMA_STATS_STRING_ENABLED

+    void PrintDetailedMap(class VmaJsonWriter& json);

+#endif

+

+    VkResult DefragmentationBegin(

+        const VmaDefragmentationInfo2& info,

+        VmaDefragmentationStats* pStats,

+        VmaDefragmentationContext* pContext);

+    VkResult DefragmentationEnd(

+        VmaDefragmentationContext context);

+

+    VkResult DefragmentationPassBegin(

+        VmaDefragmentationPassInfo* pInfo,

+        VmaDefragmentationContext context);

+    VkResult DefragmentationPassEnd(

+        VmaDefragmentationContext context);

+

+    void GetAllocationInfo(VmaAllocation hAllocation, VmaAllocationInfo* pAllocationInfo);

+    bool TouchAllocation(VmaAllocation hAllocation);

+

+    VkResult CreatePool(const VmaPoolCreateInfo* pCreateInfo, VmaPool* pPool);

+    void DestroyPool(VmaPool pool);

+    void GetPoolStats(VmaPool pool, VmaPoolStats* pPoolStats);

+

+    void SetCurrentFrameIndex(uint32_t frameIndex);

+    uint32_t GetCurrentFrameIndex() const { return m_CurrentFrameIndex.load(); }

+

+    void MakePoolAllocationsLost(

+        VmaPool hPool,

+        size_t* pLostAllocationCount);

+    VkResult CheckPoolCorruption(VmaPool hPool);

+    VkResult CheckCorruption(uint32_t memoryTypeBits);

+

+    void CreateLostAllocation(VmaAllocation* pAllocation);

+

+    // Call to Vulkan function vkAllocateMemory with accompanying bookkeeping.

+    VkResult AllocateVulkanMemory(const VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory);

+    // Call to Vulkan function vkFreeMemory with accompanying bookkeeping.

+    void FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, VkDeviceMemory hMemory);

+    // Call to Vulkan function vkBindBufferMemory or vkBindBufferMemory2KHR.

+    VkResult BindVulkanBuffer(

+        VkDeviceMemory memory,

+        VkDeviceSize memoryOffset,

+        VkBuffer buffer,

+        const void* pNext);

+    // Call to Vulkan function vkBindImageMemory or vkBindImageMemory2KHR.

+    VkResult BindVulkanImage(

+        VkDeviceMemory memory,

+        VkDeviceSize memoryOffset,

+        VkImage image,

+        const void* pNext);

+

+    VkResult Map(VmaAllocation hAllocation, void** ppData);

+    void Unmap(VmaAllocation hAllocation);

+

+    VkResult BindBufferMemory(

+        VmaAllocation hAllocation,

+        VkDeviceSize allocationLocalOffset,

+        VkBuffer hBuffer,

+        const void* pNext);

+    VkResult BindImageMemory(

+        VmaAllocation hAllocation,

+        VkDeviceSize allocationLocalOffset,

+        VkImage hImage,

+        const void* pNext);

+

+    VkResult FlushOrInvalidateAllocation(

+        VmaAllocation hAllocation,

+        VkDeviceSize offset, VkDeviceSize size,

+        VMA_CACHE_OPERATION op);

+    VkResult FlushOrInvalidateAllocations(

+        uint32_t allocationCount,

+        const VmaAllocation* allocations,

+        const VkDeviceSize* offsets, const VkDeviceSize* sizes,

+        VMA_CACHE_OPERATION op);

+

+    void FillAllocation(const VmaAllocation hAllocation, uint8_t pattern);

+

+    /*

+    Returns bit mask of memory types that can support defragmentation on GPU as

+    they support creation of required buffer for copy operations.

+    */

+    uint32_t GetGpuDefragmentationMemoryTypeBits();

+

+private:

+    VkDeviceSize m_PreferredLargeHeapBlockSize;

+

+    VkPhysicalDevice m_PhysicalDevice;

+    VMA_ATOMIC_UINT32 m_CurrentFrameIndex;

+    VMA_ATOMIC_UINT32 m_GpuDefragmentationMemoryTypeBits; // UINT32_MAX means uninitialized.

+    

+    VMA_RW_MUTEX m_PoolsMutex;

+    // Protected by m_PoolsMutex. Sorted by pointer value.

+    VmaVector<VmaPool, VmaStlAllocator<VmaPool> > m_Pools;

+    uint32_t m_NextPoolId;

+

+    VmaVulkanFunctions m_VulkanFunctions;

+

+    // Global bit mask AND-ed with any memoryTypeBits to disallow certain memory types.

+    uint32_t m_GlobalMemoryTypeBits;

+

+#if VMA_RECORDING_ENABLED

+    VmaRecorder* m_pRecorder;

+#endif

+

+    void ImportVulkanFunctions(const VmaVulkanFunctions* pVulkanFunctions);

+

+#if VMA_STATIC_VULKAN_FUNCTIONS == 1

+    void ImportVulkanFunctions_Static();

+#endif

+

+    void ImportVulkanFunctions_Custom(const VmaVulkanFunctions* pVulkanFunctions);

+

+#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1

+    void ImportVulkanFunctions_Dynamic();

+#endif

+

+    void ValidateVulkanFunctions();

+

+    VkDeviceSize CalcPreferredBlockSize(uint32_t memTypeIndex);

+

+    VkResult AllocateMemoryOfType(

+        VkDeviceSize size,

+        VkDeviceSize alignment,

+        bool dedicatedAllocation,

+        VkBuffer dedicatedBuffer,

+        VkBufferUsageFlags dedicatedBufferUsage,

+        VkImage dedicatedImage,

+        const VmaAllocationCreateInfo& createInfo,

+        uint32_t memTypeIndex,

+        VmaSuballocationType suballocType,

+        size_t allocationCount,

+        VmaAllocation* pAllocations);

+

+    // Helper function only to be used inside AllocateDedicatedMemory.

+    VkResult AllocateDedicatedMemoryPage(

+        VkDeviceSize size,

+        VmaSuballocationType suballocType,

+        uint32_t memTypeIndex,

+        const VkMemoryAllocateInfo& allocInfo,

+        bool map,

+        bool isUserDataString,

+        void* pUserData,

+        VmaAllocation* pAllocation);

+

+    // Allocates and registers new VkDeviceMemory specifically for dedicated allocations.

+    VkResult AllocateDedicatedMemory(

+        VkDeviceSize size,

+        VmaSuballocationType suballocType,

+        uint32_t memTypeIndex,

+        bool withinBudget,

+        bool map,

+        bool isUserDataString,

+        void* pUserData,

+        VkBuffer dedicatedBuffer,

+        VkBufferUsageFlags dedicatedBufferUsage,

+        VkImage dedicatedImage,

+        size_t allocationCount,

+        VmaAllocation* pAllocations);

+

+    void FreeDedicatedMemory(const VmaAllocation allocation);

+

+    /*

+    Calculates and returns bit mask of memory types that can support defragmentation

+    on GPU as they support creation of required buffer for copy operations.

+    */

+    uint32_t CalculateGpuDefragmentationMemoryTypeBits() const;

+

+    uint32_t CalculateGlobalMemoryTypeBits() const;

+

+    bool GetFlushOrInvalidateRange(

+        VmaAllocation allocation,

+        VkDeviceSize offset, VkDeviceSize size,

+        VkMappedMemoryRange& outRange) const;

+

+#if VMA_MEMORY_BUDGET

+    void UpdateVulkanBudget();

+#endif // #if VMA_MEMORY_BUDGET

+};

+

+////////////////////////////////////////////////////////////////////////////////

+// Memory allocation #2 after VmaAllocator_T definition

+

+static void* VmaMalloc(VmaAllocator hAllocator, size_t size, size_t alignment)

+{

+    return VmaMalloc(&hAllocator->m_AllocationCallbacks, size, alignment);

+}

+

+static void VmaFree(VmaAllocator hAllocator, void* ptr)

+{

+    VmaFree(&hAllocator->m_AllocationCallbacks, ptr);

+}

+

+template<typename T>

+static T* VmaAllocate(VmaAllocator hAllocator)

+{

+    return (T*)VmaMalloc(hAllocator, sizeof(T), VMA_ALIGN_OF(T));

+}

+

+template<typename T>

+static T* VmaAllocateArray(VmaAllocator hAllocator, size_t count)

+{

+    return (T*)VmaMalloc(hAllocator, sizeof(T) * count, VMA_ALIGN_OF(T));

+}

+

+template<typename T>

+static void vma_delete(VmaAllocator hAllocator, T* ptr)

+{

+    if(ptr != VMA_NULL)

+    {

+        ptr->~T();

+        VmaFree(hAllocator, ptr);

+    }

+}

+

+template<typename T>

+static void vma_delete_array(VmaAllocator hAllocator, T* ptr, size_t count)

+{

+    if(ptr != VMA_NULL)

+    {

+        for(size_t i = count; i--; )

+            ptr[i].~T();

+        VmaFree(hAllocator, ptr);

+    }

+}

+

+////////////////////////////////////////////////////////////////////////////////

+// VmaStringBuilder

+

+#if VMA_STATS_STRING_ENABLED

+

+class VmaStringBuilder

+{

+public:

+    VmaStringBuilder(VmaAllocator alloc) : m_Data(VmaStlAllocator<char>(alloc->GetAllocationCallbacks())) { }

+    size_t GetLength() const { return m_Data.size(); }

+    const char* GetData() const { return m_Data.data(); }

+

+    void Add(char ch) { m_Data.push_back(ch); }

+    void Add(const char* pStr);

+    void AddNewLine() { Add('\n'); }

+    void AddNumber(uint32_t num);

+    void AddNumber(uint64_t num);

+    void AddPointer(const void* ptr);

+

+private:

+    VmaVector< char, VmaStlAllocator<char> > m_Data;

+};

+

+void VmaStringBuilder::Add(const char* pStr)

+{

+    const size_t strLen = strlen(pStr);

+    if(strLen > 0)

+    {

+        const size_t oldCount = m_Data.size();

+        m_Data.resize(oldCount + strLen);

+        memcpy(m_Data.data() + oldCount, pStr, strLen);

+    }

+}

+

+void VmaStringBuilder::AddNumber(uint32_t num)

+{

+    char buf[11];

+    buf[10] = '\0';

+    char *p = &buf[10];

+    do

+    {

+        *--p = '0' + (num % 10);

+        num /= 10;

+    }

+    while(num);

+    Add(p);

+}

+

+void VmaStringBuilder::AddNumber(uint64_t num)

+{

+    char buf[21];

+    buf[20] = '\0';

+    char *p = &buf[20];

+    do

+    {

+        *--p = '0' + (num % 10);

+        num /= 10;

+    }

+    while(num);

+    Add(p);

+}

+

+void VmaStringBuilder::AddPointer(const void* ptr)

+{

+    char buf[21];

+    VmaPtrToStr(buf, sizeof(buf), ptr);

+    Add(buf);

+}

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+////////////////////////////////////////////////////////////////////////////////

+// VmaJsonWriter

+

+#if VMA_STATS_STRING_ENABLED

+

+class VmaJsonWriter

+{

+    VMA_CLASS_NO_COPY(VmaJsonWriter)

+public:

+    VmaJsonWriter(const VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder& sb);

+    ~VmaJsonWriter();

+

+    void BeginObject(bool singleLine = false);

+    void EndObject();

+    

+    void BeginArray(bool singleLine = false);

+    void EndArray();

+    

+    void WriteString(const char* pStr);

+    void BeginString(const char* pStr = VMA_NULL);

+    void ContinueString(const char* pStr);

+    void ContinueString(uint32_t n);

+    void ContinueString(uint64_t n);

+    void ContinueString_Pointer(const void* ptr);

+    void EndString(const char* pStr = VMA_NULL);

+    

+    void WriteNumber(uint32_t n);

+    void WriteNumber(uint64_t n);

+    void WriteBool(bool b);

+    void WriteNull();

+

+private:

+    static const char* const INDENT;

+

+    enum COLLECTION_TYPE

+    {

+        COLLECTION_TYPE_OBJECT,

+        COLLECTION_TYPE_ARRAY,

+    };

+    struct StackItem

+    {

+        COLLECTION_TYPE type;

+        uint32_t valueCount;

+        bool singleLineMode;

+    };

+

+    VmaStringBuilder& m_SB;

+    VmaVector< StackItem, VmaStlAllocator<StackItem> > m_Stack;

+    bool m_InsideString;

+

+    void BeginValue(bool isString);

+    void WriteIndent(bool oneLess = false);

+};

+

+const char* const VmaJsonWriter::INDENT = "  ";

+

+VmaJsonWriter::VmaJsonWriter(const VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder& sb) :

+    m_SB(sb),

+    m_Stack(VmaStlAllocator<StackItem>(pAllocationCallbacks)),

+    m_InsideString(false)

+{

+}

+

+VmaJsonWriter::~VmaJsonWriter()

+{

+    VMA_ASSERT(!m_InsideString);

+    VMA_ASSERT(m_Stack.empty());

+}

+

+void VmaJsonWriter::BeginObject(bool singleLine)

+{

+    VMA_ASSERT(!m_InsideString);

+

+    BeginValue(false);

+    m_SB.Add('{');

+

+    StackItem item;

+    item.type = COLLECTION_TYPE_OBJECT;

+    item.valueCount = 0;

+    item.singleLineMode = singleLine;

+    m_Stack.push_back(item);

+}

+

+void VmaJsonWriter::EndObject()

+{

+    VMA_ASSERT(!m_InsideString);

+

+    WriteIndent(true);

+    m_SB.Add('}');

+

+    VMA_ASSERT(!m_Stack.empty() && m_Stack.back().type == COLLECTION_TYPE_OBJECT);

+    m_Stack.pop_back();

+}

+

+void VmaJsonWriter::BeginArray(bool singleLine)

+{

+    VMA_ASSERT(!m_InsideString);

+

+    BeginValue(false);

+    m_SB.Add('[');

+

+    StackItem item;

+    item.type = COLLECTION_TYPE_ARRAY;

+    item.valueCount = 0;

+    item.singleLineMode = singleLine;

+    m_Stack.push_back(item);

+}

+

+void VmaJsonWriter::EndArray()

+{

+    VMA_ASSERT(!m_InsideString);

+

+    WriteIndent(true);

+    m_SB.Add(']');

+

+    VMA_ASSERT(!m_Stack.empty() && m_Stack.back().type == COLLECTION_TYPE_ARRAY);

+    m_Stack.pop_back();

+}

+

+void VmaJsonWriter::WriteString(const char* pStr)

+{

+    BeginString(pStr);

+    EndString();

+}

+

+void VmaJsonWriter::BeginString(const char* pStr)

+{

+    VMA_ASSERT(!m_InsideString);

+

+    BeginValue(true);

+    m_SB.Add('"');

+    m_InsideString = true;

+    if(pStr != VMA_NULL && pStr[0] != '\0')

+    {

+        ContinueString(pStr);

+    }

+}

+

+void VmaJsonWriter::ContinueString(const char* pStr)

+{

+    VMA_ASSERT(m_InsideString);

+

+    const size_t strLen = strlen(pStr);

+    for(size_t i = 0; i < strLen; ++i)

+    {

+        char ch = pStr[i];

+        if(ch == '\\')

+        {

+            m_SB.Add("\\\\");

+        }

+        else if(ch == '"')

+        {

+            m_SB.Add("\\\"");

+        }

+        else if(ch >= 32)

+        {

+            m_SB.Add(ch);

+        }

+        else switch(ch)

+        {

+        case '\b':

+            m_SB.Add("\\b");

+            break;

+        case '\f':

+            m_SB.Add("\\f");

+            break;

+        case '\n':

+            m_SB.Add("\\n");

+            break;

+        case '\r':

+            m_SB.Add("\\r");

+            break;

+        case '\t':

+            m_SB.Add("\\t");

+            break;

+        default:

+            VMA_ASSERT(0 && "Character not currently supported.");

+            break;

+        }

+    }

+}

+

+void VmaJsonWriter::ContinueString(uint32_t n)

+{

+    VMA_ASSERT(m_InsideString);

+    m_SB.AddNumber(n);

+}

+

+void VmaJsonWriter::ContinueString(uint64_t n)

+{

+    VMA_ASSERT(m_InsideString);

+    m_SB.AddNumber(n);

+}

+

+void VmaJsonWriter::ContinueString_Pointer(const void* ptr)

+{

+    VMA_ASSERT(m_InsideString);

+    m_SB.AddPointer(ptr);

+}

+

+void VmaJsonWriter::EndString(const char* pStr)

+{

+    VMA_ASSERT(m_InsideString);

+    if(pStr != VMA_NULL && pStr[0] != '\0')

+    {

+        ContinueString(pStr);

+    }

+    m_SB.Add('"');

+    m_InsideString = false;

+}

+

+void VmaJsonWriter::WriteNumber(uint32_t n)

+{

+    VMA_ASSERT(!m_InsideString);

+    BeginValue(false);

+    m_SB.AddNumber(n);

+}

+

+void VmaJsonWriter::WriteNumber(uint64_t n)

+{

+    VMA_ASSERT(!m_InsideString);

+    BeginValue(false);

+    m_SB.AddNumber(n);

+}

+

+void VmaJsonWriter::WriteBool(bool b)

+{

+    VMA_ASSERT(!m_InsideString);

+    BeginValue(false);

+    m_SB.Add(b ? "true" : "false");

+}

+

+void VmaJsonWriter::WriteNull()

+{

+    VMA_ASSERT(!m_InsideString);

+    BeginValue(false);

+    m_SB.Add("null");

+}

+

+void VmaJsonWriter::BeginValue(bool isString)

+{

+    if(!m_Stack.empty())

+    {

+        StackItem& currItem = m_Stack.back();

+        if(currItem.type == COLLECTION_TYPE_OBJECT &&

+            currItem.valueCount % 2 == 0)

+        {

+            VMA_ASSERT(isString);

+        }

+

+        if(currItem.type == COLLECTION_TYPE_OBJECT &&

+            currItem.valueCount % 2 != 0)

+        {

+            m_SB.Add(": ");

+        }

+        else if(currItem.valueCount > 0)

+        {

+            m_SB.Add(", ");

+            WriteIndent();

+        }

+        else

+        {

+            WriteIndent();

+        }

+        ++currItem.valueCount;

+    }

+}

+

+void VmaJsonWriter::WriteIndent(bool oneLess)

+{

+    if(!m_Stack.empty() && !m_Stack.back().singleLineMode)

+    {

+        m_SB.AddNewLine();

+        

+        size_t count = m_Stack.size();

+        if(count > 0 && oneLess)

+        {

+            --count;

+        }

+        for(size_t i = 0; i < count; ++i)

+        {

+            m_SB.Add(INDENT);

+        }

+    }

+}

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+////////////////////////////////////////////////////////////////////////////////

+

+void VmaAllocation_T::SetUserData(VmaAllocator hAllocator, void* pUserData)

+{

+    if(IsUserDataString())

+    {

+        VMA_ASSERT(pUserData == VMA_NULL || pUserData != m_pUserData);

+

+        FreeUserDataString(hAllocator);

+

+        if(pUserData != VMA_NULL)

+        {

+            m_pUserData = VmaCreateStringCopy(hAllocator->GetAllocationCallbacks(), (const char*)pUserData);

+        }

+    }

+    else

+    {

+        m_pUserData = pUserData;

+    }

+}

+

+void VmaAllocation_T::ChangeBlockAllocation(

+    VmaAllocator hAllocator,

+    VmaDeviceMemoryBlock* block,

+    VkDeviceSize offset)

+{

+    VMA_ASSERT(block != VMA_NULL);

+    VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);

+

+    // Move mapping reference counter from old block to new block.

+    if(block != m_BlockAllocation.m_Block)

+    {

+        uint32_t mapRefCount = m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP;

+        if(IsPersistentMap())

+            ++mapRefCount;

+        m_BlockAllocation.m_Block->Unmap(hAllocator, mapRefCount);

+        block->Map(hAllocator, mapRefCount, VMA_NULL);

+    }

+

+    m_BlockAllocation.m_Block = block;

+    m_BlockAllocation.m_Offset = offset;

+}

+

+void VmaAllocation_T::ChangeOffset(VkDeviceSize newOffset)

+{

+    VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);

+    m_BlockAllocation.m_Offset = newOffset;

+}

+

+VkDeviceSize VmaAllocation_T::GetOffset() const

+{

+    switch(m_Type)

+    {

+    case ALLOCATION_TYPE_BLOCK:

+        return m_BlockAllocation.m_Offset;

+    case ALLOCATION_TYPE_DEDICATED:

+        return 0;

+    default:

+        VMA_ASSERT(0);

+        return 0;

+    }

+}

+

+VkDeviceMemory VmaAllocation_T::GetMemory() const

+{

+    switch(m_Type)

+    {

+    case ALLOCATION_TYPE_BLOCK:

+        return m_BlockAllocation.m_Block->GetDeviceMemory();

+    case ALLOCATION_TYPE_DEDICATED:

+        return m_DedicatedAllocation.m_hMemory;

+    default:

+        VMA_ASSERT(0);

+        return VK_NULL_HANDLE;

+    }

+}

+

+void* VmaAllocation_T::GetMappedData() const

+{

+    switch(m_Type)

+    {

+    case ALLOCATION_TYPE_BLOCK:

+        if(m_MapCount != 0)

+        {

+            void* pBlockData = m_BlockAllocation.m_Block->GetMappedData();

+            VMA_ASSERT(pBlockData != VMA_NULL);

+            return (char*)pBlockData + m_BlockAllocation.m_Offset;

+        }

+        else

+        {

+            return VMA_NULL;

+        }

+        break;

+    case ALLOCATION_TYPE_DEDICATED:

+        VMA_ASSERT((m_DedicatedAllocation.m_pMappedData != VMA_NULL) == (m_MapCount != 0));

+        return m_DedicatedAllocation.m_pMappedData;

+    default:

+        VMA_ASSERT(0);

+        return VMA_NULL;

+    }

+}

+

+bool VmaAllocation_T::CanBecomeLost() const

+{

+    switch(m_Type)

+    {

+    case ALLOCATION_TYPE_BLOCK:

+        return m_BlockAllocation.m_CanBecomeLost;

+    case ALLOCATION_TYPE_DEDICATED:

+        return false;

+    default:

+        VMA_ASSERT(0);

+        return false;

+    }

+}

+

+bool VmaAllocation_T::MakeLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)

+{

+    VMA_ASSERT(CanBecomeLost());

+

+    /*

+    Warning: This is a carefully designed algorithm.

+    Do not modify unless you really know what you're doing :)

+    */

+    uint32_t localLastUseFrameIndex = GetLastUseFrameIndex();

+    for(;;)

+    {

+        if(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)

+        {

+            VMA_ASSERT(0);

+            return false;

+        }

+        else if(localLastUseFrameIndex + frameInUseCount >= currentFrameIndex)

+        {

+            return false;

+        }

+        else // Last use time earlier than current time.

+        {

+            if(CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, VMA_FRAME_INDEX_LOST))

+            {

+                // Setting hAllocation.LastUseFrameIndex atomic to VMA_FRAME_INDEX_LOST is enough to mark it as LOST.

+                // Calling code just needs to unregister this allocation in owning VmaDeviceMemoryBlock.

+                return true;

+            }

+        }

+    }

+}

+

+#if VMA_STATS_STRING_ENABLED

+

+// Correspond to values of enum VmaSuballocationType.

+static const char* VMA_SUBALLOCATION_TYPE_NAMES[] = {

+    "FREE",

+    "UNKNOWN",

+    "BUFFER",

+    "IMAGE_UNKNOWN",

+    "IMAGE_LINEAR",

+    "IMAGE_OPTIMAL",

+};

+

+void VmaAllocation_T::PrintParameters(class VmaJsonWriter& json) const

+{

+    json.WriteString("Type");

+    json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[m_SuballocationType]);

+

+    json.WriteString("Size");

+    json.WriteNumber(m_Size);

+

+    if(m_pUserData != VMA_NULL)

+    {

+        json.WriteString("UserData");

+        if(IsUserDataString())

+        {

+            json.WriteString((const char*)m_pUserData);

+        }

+        else

+        {

+            json.BeginString();

+            json.ContinueString_Pointer(m_pUserData);

+            json.EndString();

+        }

+    }

+

+    json.WriteString("CreationFrameIndex");

+    json.WriteNumber(m_CreationFrameIndex);

+

+    json.WriteString("LastUseFrameIndex");

+    json.WriteNumber(GetLastUseFrameIndex());

+

+    if(m_BufferImageUsage != 0)

+    {

+        json.WriteString("Usage");

+        json.WriteNumber(m_BufferImageUsage);

+    }

+}

+

+#endif

+

+void VmaAllocation_T::FreeUserDataString(VmaAllocator hAllocator)

+{

+    VMA_ASSERT(IsUserDataString());

+    VmaFreeString(hAllocator->GetAllocationCallbacks(), (char*)m_pUserData);

+    m_pUserData = VMA_NULL;

+}

+

+void VmaAllocation_T::BlockAllocMap()

+{

+    VMA_ASSERT(GetType() == ALLOCATION_TYPE_BLOCK);

+

+    if((m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP) < 0x7F)

+    {

+        ++m_MapCount;

+    }

+    else

+    {

+        VMA_ASSERT(0 && "Allocation mapped too many times simultaneously.");

+    }

+}

+

+void VmaAllocation_T::BlockAllocUnmap()

+{

+    VMA_ASSERT(GetType() == ALLOCATION_TYPE_BLOCK);

+

+    if((m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP) != 0)

+    {

+        --m_MapCount;

+    }

+    else

+    {

+        VMA_ASSERT(0 && "Unmapping allocation not previously mapped.");

+    }

+}

+

+VkResult VmaAllocation_T::DedicatedAllocMap(VmaAllocator hAllocator, void** ppData)

+{

+    VMA_ASSERT(GetType() == ALLOCATION_TYPE_DEDICATED);

+

+    if(m_MapCount != 0)

+    {

+        if((m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP) < 0x7F)

+        {

+            VMA_ASSERT(m_DedicatedAllocation.m_pMappedData != VMA_NULL);

+            *ppData = m_DedicatedAllocation.m_pMappedData;

+            ++m_MapCount;

+            return VK_SUCCESS;

+        }

+        else

+        {

+            VMA_ASSERT(0 && "Dedicated allocation mapped too many times simultaneously.");

+            return VK_ERROR_MEMORY_MAP_FAILED;

+        }

+    }

+    else

+    {

+        VkResult result = (*hAllocator->GetVulkanFunctions().vkMapMemory)(

+            hAllocator->m_hDevice,

+            m_DedicatedAllocation.m_hMemory,

+            0, // offset

+            VK_WHOLE_SIZE,

+            0, // flags

+            ppData);

+        if(result == VK_SUCCESS)

+        {

+            m_DedicatedAllocation.m_pMappedData = *ppData;

+            m_MapCount = 1;

+        }

+        return result;

+    }

+}

+

+void VmaAllocation_T::DedicatedAllocUnmap(VmaAllocator hAllocator)

+{

+    VMA_ASSERT(GetType() == ALLOCATION_TYPE_DEDICATED);

+

+    if((m_MapCount & ~MAP_COUNT_FLAG_PERSISTENT_MAP) != 0)

+    {

+        --m_MapCount;

+        if(m_MapCount == 0)

+        {

+            m_DedicatedAllocation.m_pMappedData = VMA_NULL;

+            (*hAllocator->GetVulkanFunctions().vkUnmapMemory)(

+                hAllocator->m_hDevice,

+                m_DedicatedAllocation.m_hMemory);

+        }

+    }

+    else

+    {

+        VMA_ASSERT(0 && "Unmapping dedicated allocation not previously mapped.");

+    }

+}

+

+#if VMA_STATS_STRING_ENABLED

+

+static void VmaPrintStatInfo(VmaJsonWriter& json, const VmaStatInfo& stat)

+{

+    json.BeginObject();

+

+    json.WriteString("Blocks");

+    json.WriteNumber(stat.blockCount);

+

+    json.WriteString("Allocations");

+    json.WriteNumber(stat.allocationCount);

+

+    json.WriteString("UnusedRanges");

+    json.WriteNumber(stat.unusedRangeCount);

+

+    json.WriteString("UsedBytes");

+    json.WriteNumber(stat.usedBytes);

+

+    json.WriteString("UnusedBytes");

+    json.WriteNumber(stat.unusedBytes);

+

+    if(stat.allocationCount > 1)

+    {

+        json.WriteString("AllocationSize");

+        json.BeginObject(true);

+        json.WriteString("Min");

+        json.WriteNumber(stat.allocationSizeMin);

+        json.WriteString("Avg");

+        json.WriteNumber(stat.allocationSizeAvg);

+        json.WriteString("Max");

+        json.WriteNumber(stat.allocationSizeMax);

+        json.EndObject();

+    }

+

+    if(stat.unusedRangeCount > 1)

+    {

+        json.WriteString("UnusedRangeSize");

+        json.BeginObject(true);

+        json.WriteString("Min");

+        json.WriteNumber(stat.unusedRangeSizeMin);

+        json.WriteString("Avg");

+        json.WriteNumber(stat.unusedRangeSizeAvg);

+        json.WriteString("Max");

+        json.WriteNumber(stat.unusedRangeSizeMax);

+        json.EndObject();

+    }

+

+    json.EndObject();

+}

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+struct VmaSuballocationItemSizeLess

+{

+    bool operator()(

+        const VmaSuballocationList::iterator lhs,

+        const VmaSuballocationList::iterator rhs) const

+    {

+        return lhs->size < rhs->size;

+    }

+    bool operator()(

+        const VmaSuballocationList::iterator lhs,

+        VkDeviceSize rhsSize) const

+    {

+        return lhs->size < rhsSize;

+    }

+};

+

+

+////////////////////////////////////////////////////////////////////////////////

+// class VmaBlockMetadata

+

+VmaBlockMetadata::VmaBlockMetadata(VmaAllocator hAllocator) :

+    m_Size(0),

+    m_pAllocationCallbacks(hAllocator->GetAllocationCallbacks())

+{

+}

+

+#if VMA_STATS_STRING_ENABLED

+

+void VmaBlockMetadata::PrintDetailedMap_Begin(class VmaJsonWriter& json,

+    VkDeviceSize unusedBytes,

+    size_t allocationCount,

+    size_t unusedRangeCount) const

+{

+    json.BeginObject();

+

+    json.WriteString("TotalBytes");

+    json.WriteNumber(GetSize());

+

+    json.WriteString("UnusedBytes");

+    json.WriteNumber(unusedBytes);

+

+    json.WriteString("Allocations");

+    json.WriteNumber((uint64_t)allocationCount);

+

+    json.WriteString("UnusedRanges");

+    json.WriteNumber((uint64_t)unusedRangeCount);

+

+    json.WriteString("Suballocations");

+    json.BeginArray();

+}

+

+void VmaBlockMetadata::PrintDetailedMap_Allocation(class VmaJsonWriter& json,

+    VkDeviceSize offset,

+    VmaAllocation hAllocation) const

+{

+    json.BeginObject(true);

+        

+    json.WriteString("Offset");

+    json.WriteNumber(offset);

+

+    hAllocation->PrintParameters(json);

+

+    json.EndObject();

+}

+

+void VmaBlockMetadata::PrintDetailedMap_UnusedRange(class VmaJsonWriter& json,

+    VkDeviceSize offset,

+    VkDeviceSize size) const

+{

+    json.BeginObject(true);

+        

+    json.WriteString("Offset");

+    json.WriteNumber(offset);

+

+    json.WriteString("Type");

+    json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[VMA_SUBALLOCATION_TYPE_FREE]);

+

+    json.WriteString("Size");

+    json.WriteNumber(size);

+

+    json.EndObject();

+}

+

+void VmaBlockMetadata::PrintDetailedMap_End(class VmaJsonWriter& json) const

+{

+    json.EndArray();

+    json.EndObject();

+}

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+////////////////////////////////////////////////////////////////////////////////

+// class VmaBlockMetadata_Generic

+

+VmaBlockMetadata_Generic::VmaBlockMetadata_Generic(VmaAllocator hAllocator) :

+    VmaBlockMetadata(hAllocator),

+    m_FreeCount(0),

+    m_SumFreeSize(0),

+    m_Suballocations(VmaStlAllocator<VmaSuballocation>(hAllocator->GetAllocationCallbacks())),

+    m_FreeSuballocationsBySize(VmaStlAllocator<VmaSuballocationList::iterator>(hAllocator->GetAllocationCallbacks()))

+{

+}

+

+VmaBlockMetadata_Generic::~VmaBlockMetadata_Generic()

+{

+}

+

+void VmaBlockMetadata_Generic::Init(VkDeviceSize size)

+{

+    VmaBlockMetadata::Init(size);

+

+    m_FreeCount = 1;

+    m_SumFreeSize = size;

+

+    VmaSuballocation suballoc = {};

+    suballoc.offset = 0;

+    suballoc.size = size;

+    suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;

+    suballoc.hAllocation = VK_NULL_HANDLE;

+

+    VMA_ASSERT(size > VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER);

+    m_Suballocations.push_back(suballoc);

+    VmaSuballocationList::iterator suballocItem = m_Suballocations.end();

+    --suballocItem;

+    m_FreeSuballocationsBySize.push_back(suballocItem);

+}

+

+bool VmaBlockMetadata_Generic::Validate() const

+{

+    VMA_VALIDATE(!m_Suballocations.empty());

+    

+    // Expected offset of new suballocation as calculated from previous ones.

+    VkDeviceSize calculatedOffset = 0;

+    // Expected number of free suballocations as calculated from traversing their list.

+    uint32_t calculatedFreeCount = 0;

+    // Expected sum size of free suballocations as calculated from traversing their list.

+    VkDeviceSize calculatedSumFreeSize = 0;

+    // Expected number of free suballocations that should be registered in

+    // m_FreeSuballocationsBySize calculated from traversing their list.

+    size_t freeSuballocationsToRegister = 0;

+    // True if previous visited suballocation was free.

+    bool prevFree = false;

+

+    for(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();

+        suballocItem != m_Suballocations.cend();

+        ++suballocItem)

+    {

+        const VmaSuballocation& subAlloc = *suballocItem;

+        

+        // Actual offset of this suballocation doesn't match expected one.

+        VMA_VALIDATE(subAlloc.offset == calculatedOffset);

+

+        const bool currFree = (subAlloc.type == VMA_SUBALLOCATION_TYPE_FREE);

+        // Two adjacent free suballocations are invalid. They should be merged.

+        VMA_VALIDATE(!prevFree || !currFree);

+

+        VMA_VALIDATE(currFree == (subAlloc.hAllocation == VK_NULL_HANDLE));

+

+        if(currFree)

+        {

+            calculatedSumFreeSize += subAlloc.size;

+            ++calculatedFreeCount;

+            if(subAlloc.size >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)

+            {

+                ++freeSuballocationsToRegister;

+            }

+

+            // Margin required between allocations - every free space must be at least that large.

+            VMA_VALIDATE(subAlloc.size >= VMA_DEBUG_MARGIN);

+        }

+        else

+        {

+            VMA_VALIDATE(subAlloc.hAllocation->GetOffset() == subAlloc.offset);

+            VMA_VALIDATE(subAlloc.hAllocation->GetSize() == subAlloc.size);

+

+            // Margin required between allocations - previous allocation must be free.

+            VMA_VALIDATE(VMA_DEBUG_MARGIN == 0 || prevFree);

+        }

+

+        calculatedOffset += subAlloc.size;

+        prevFree = currFree;

+    }

+

+    // Number of free suballocations registered in m_FreeSuballocationsBySize doesn't

+    // match expected one.

+    VMA_VALIDATE(m_FreeSuballocationsBySize.size() == freeSuballocationsToRegister);

+

+    VkDeviceSize lastSize = 0;

+    for(size_t i = 0; i < m_FreeSuballocationsBySize.size(); ++i)

+    {

+        VmaSuballocationList::iterator suballocItem = m_FreeSuballocationsBySize[i];

+        

+        // Only free suballocations can be registered in m_FreeSuballocationsBySize.

+        VMA_VALIDATE(suballocItem->type == VMA_SUBALLOCATION_TYPE_FREE);

+        // They must be sorted by size ascending.

+        VMA_VALIDATE(suballocItem->size >= lastSize);

+

+        lastSize = suballocItem->size;

+    }

+

+    // Check if totals match calculacted values.

+    VMA_VALIDATE(ValidateFreeSuballocationList());

+    VMA_VALIDATE(calculatedOffset == GetSize());

+    VMA_VALIDATE(calculatedSumFreeSize == m_SumFreeSize);

+    VMA_VALIDATE(calculatedFreeCount == m_FreeCount);

+

+    return true;

+}

+

+VkDeviceSize VmaBlockMetadata_Generic::GetUnusedRangeSizeMax() const

+{

+    if(!m_FreeSuballocationsBySize.empty())

+    {

+        return m_FreeSuballocationsBySize.back()->size;

+    }

+    else

+    {

+        return 0;

+    }

+}

+

+bool VmaBlockMetadata_Generic::IsEmpty() const

+{

+    return (m_Suballocations.size() == 1) && (m_FreeCount == 1);

+}

+

+void VmaBlockMetadata_Generic::CalcAllocationStatInfo(VmaStatInfo& outInfo) const

+{

+    outInfo.blockCount = 1;

+

+    const uint32_t rangeCount = (uint32_t)m_Suballocations.size();

+    outInfo.allocationCount = rangeCount - m_FreeCount;

+    outInfo.unusedRangeCount = m_FreeCount;

+    

+    outInfo.unusedBytes = m_SumFreeSize;

+    outInfo.usedBytes = GetSize() - outInfo.unusedBytes;

+

+    outInfo.allocationSizeMin = UINT64_MAX;

+    outInfo.allocationSizeMax = 0;

+    outInfo.unusedRangeSizeMin = UINT64_MAX;

+    outInfo.unusedRangeSizeMax = 0;

+

+    for(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();

+        suballocItem != m_Suballocations.cend();

+        ++suballocItem)

+    {

+        const VmaSuballocation& suballoc = *suballocItem;

+        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)

+        {

+            outInfo.allocationSizeMin = VMA_MIN(outInfo.allocationSizeMin, suballoc.size);

+            outInfo.allocationSizeMax = VMA_MAX(outInfo.allocationSizeMax, suballoc.size);

+        }

+        else

+        {

+            outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, suballoc.size);

+            outInfo.unusedRangeSizeMax = VMA_MAX(outInfo.unusedRangeSizeMax, suballoc.size);

+        }

+    }

+}

+

+void VmaBlockMetadata_Generic::AddPoolStats(VmaPoolStats& inoutStats) const

+{

+    const uint32_t rangeCount = (uint32_t)m_Suballocations.size();

+

+    inoutStats.size += GetSize();

+    inoutStats.unusedSize += m_SumFreeSize;

+    inoutStats.allocationCount += rangeCount - m_FreeCount;

+    inoutStats.unusedRangeCount += m_FreeCount;

+    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, GetUnusedRangeSizeMax());

+}

+

+#if VMA_STATS_STRING_ENABLED

+

+void VmaBlockMetadata_Generic::PrintDetailedMap(class VmaJsonWriter& json) const

+{

+    PrintDetailedMap_Begin(json,

+        m_SumFreeSize, // unusedBytes

+        m_Suballocations.size() - (size_t)m_FreeCount, // allocationCount

+        m_FreeCount); // unusedRangeCount

+

+    size_t i = 0;

+    for(VmaSuballocationList::const_iterator suballocItem = m_Suballocations.cbegin();

+        suballocItem != m_Suballocations.cend();

+        ++suballocItem, ++i)

+    {

+        if(suballocItem->type == VMA_SUBALLOCATION_TYPE_FREE)

+        {

+            PrintDetailedMap_UnusedRange(json, suballocItem->offset, suballocItem->size);

+        }

+        else

+        {

+            PrintDetailedMap_Allocation(json, suballocItem->offset, suballocItem->hAllocation);

+        }

+    }

+

+    PrintDetailedMap_End(json);

+}

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+bool VmaBlockMetadata_Generic::CreateAllocationRequest(

+    uint32_t currentFrameIndex,

+    uint32_t frameInUseCount,

+    VkDeviceSize bufferImageGranularity,

+    VkDeviceSize allocSize,

+    VkDeviceSize allocAlignment,

+    bool upperAddress,

+    VmaSuballocationType allocType,

+    bool canMakeOtherLost,

+    uint32_t strategy,

+    VmaAllocationRequest* pAllocationRequest)

+{

+    VMA_ASSERT(allocSize > 0);

+    VMA_ASSERT(!upperAddress);

+    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);

+    VMA_ASSERT(pAllocationRequest != VMA_NULL);

+    VMA_HEAVY_ASSERT(Validate());

+

+    pAllocationRequest->type = VmaAllocationRequestType::Normal;

+

+    // There is not enough total free space in this block to fullfill the request: Early return.

+    if(canMakeOtherLost == false &&

+        m_SumFreeSize < allocSize + 2 * VMA_DEBUG_MARGIN)

+    {

+        return false;

+    }

+

+    // New algorithm, efficiently searching freeSuballocationsBySize.

+    const size_t freeSuballocCount = m_FreeSuballocationsBySize.size();

+    if(freeSuballocCount > 0)

+    {

+        if(strategy == VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT)

+        {

+            // Find first free suballocation with size not less than allocSize + 2 * VMA_DEBUG_MARGIN.

+            VmaSuballocationList::iterator* const it = VmaBinaryFindFirstNotLess(

+                m_FreeSuballocationsBySize.data(),

+                m_FreeSuballocationsBySize.data() + freeSuballocCount,

+                allocSize + 2 * VMA_DEBUG_MARGIN,

+                VmaSuballocationItemSizeLess());

+            size_t index = it - m_FreeSuballocationsBySize.data();

+            for(; index < freeSuballocCount; ++index)

+            {

+                if(CheckAllocation(

+                    currentFrameIndex,

+                    frameInUseCount,

+                    bufferImageGranularity,

+                    allocSize,

+                    allocAlignment,

+                    allocType,

+                    m_FreeSuballocationsBySize[index],

+                    false, // canMakeOtherLost

+                    &pAllocationRequest->offset,

+                    &pAllocationRequest->itemsToMakeLostCount,

+                    &pAllocationRequest->sumFreeSize,

+                    &pAllocationRequest->sumItemSize))

+                {

+                    pAllocationRequest->item = m_FreeSuballocationsBySize[index];

+                    return true;

+                }

+            }

+        }

+        else if(strategy == VMA_ALLOCATION_INTERNAL_STRATEGY_MIN_OFFSET)

+        {

+            for(VmaSuballocationList::iterator it = m_Suballocations.begin();

+                it != m_Suballocations.end();

+                ++it)

+            {

+                if(it->type == VMA_SUBALLOCATION_TYPE_FREE && CheckAllocation(

+                    currentFrameIndex,

+                    frameInUseCount,

+                    bufferImageGranularity,

+                    allocSize,

+                    allocAlignment,

+                    allocType,

+                    it,

+                    false, // canMakeOtherLost

+                    &pAllocationRequest->offset,

+                    &pAllocationRequest->itemsToMakeLostCount,

+                    &pAllocationRequest->sumFreeSize,

+                    &pAllocationRequest->sumItemSize))

+                {

+                    pAllocationRequest->item = it;

+                    return true;

+                }

+            }

+        }

+        else // WORST_FIT, FIRST_FIT

+        {

+            // Search staring from biggest suballocations.

+            for(size_t index = freeSuballocCount; index--; )

+            {

+                if(CheckAllocation(

+                    currentFrameIndex,

+                    frameInUseCount,

+                    bufferImageGranularity,

+                    allocSize,

+                    allocAlignment,

+                    allocType,

+                    m_FreeSuballocationsBySize[index],

+                    false, // canMakeOtherLost

+                    &pAllocationRequest->offset,

+                    &pAllocationRequest->itemsToMakeLostCount,

+                    &pAllocationRequest->sumFreeSize,

+                    &pAllocationRequest->sumItemSize))

+                {

+                    pAllocationRequest->item = m_FreeSuballocationsBySize[index];

+                    return true;

+                }

+            }

+        }

+    }

+

+    if(canMakeOtherLost)

+    {

+        // Brute-force algorithm. TODO: Come up with something better.

+

+        bool found = false;

+        VmaAllocationRequest tmpAllocRequest = {};

+        tmpAllocRequest.type = VmaAllocationRequestType::Normal;

+        for(VmaSuballocationList::iterator suballocIt = m_Suballocations.begin();

+            suballocIt != m_Suballocations.end();

+            ++suballocIt)

+        {

+            if(suballocIt->type == VMA_SUBALLOCATION_TYPE_FREE ||

+                suballocIt->hAllocation->CanBecomeLost())

+            {

+                if(CheckAllocation(

+                    currentFrameIndex,

+                    frameInUseCount,

+                    bufferImageGranularity,

+                    allocSize,

+                    allocAlignment,

+                    allocType,

+                    suballocIt,

+                    canMakeOtherLost,

+                    &tmpAllocRequest.offset,

+                    &tmpAllocRequest.itemsToMakeLostCount,

+                    &tmpAllocRequest.sumFreeSize,

+                    &tmpAllocRequest.sumItemSize))

+                {

+                    if(strategy == VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT)

+                    {

+                        *pAllocationRequest = tmpAllocRequest;

+                        pAllocationRequest->item = suballocIt;

+                        break;

+                    }

+                    if(!found || tmpAllocRequest.CalcCost() < pAllocationRequest->CalcCost())

+                    {

+                        *pAllocationRequest = tmpAllocRequest;

+                        pAllocationRequest->item = suballocIt;

+                        found = true;

+                    }

+                }

+            }

+        }

+

+        return found;

+    }

+

+    return false;

+}

+

+bool VmaBlockMetadata_Generic::MakeRequestedAllocationsLost(

+    uint32_t currentFrameIndex,

+    uint32_t frameInUseCount,

+    VmaAllocationRequest* pAllocationRequest)

+{

+    VMA_ASSERT(pAllocationRequest && pAllocationRequest->type == VmaAllocationRequestType::Normal);

+

+    while(pAllocationRequest->itemsToMakeLostCount > 0)

+    {

+        if(pAllocationRequest->item->type == VMA_SUBALLOCATION_TYPE_FREE)

+        {

+            ++pAllocationRequest->item;

+        }

+        VMA_ASSERT(pAllocationRequest->item != m_Suballocations.end());

+        VMA_ASSERT(pAllocationRequest->item->hAllocation != VK_NULL_HANDLE);

+        VMA_ASSERT(pAllocationRequest->item->hAllocation->CanBecomeLost());

+        if(pAllocationRequest->item->hAllocation->MakeLost(currentFrameIndex, frameInUseCount))

+        {

+            pAllocationRequest->item = FreeSuballocation(pAllocationRequest->item);

+            --pAllocationRequest->itemsToMakeLostCount;

+        }

+        else

+        {

+            return false;

+        }

+    }

+

+    VMA_HEAVY_ASSERT(Validate());

+    VMA_ASSERT(pAllocationRequest->item != m_Suballocations.end());

+    VMA_ASSERT(pAllocationRequest->item->type == VMA_SUBALLOCATION_TYPE_FREE);

+    

+    return true;

+}

+

+uint32_t VmaBlockMetadata_Generic::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)

+{

+    uint32_t lostAllocationCount = 0;

+    for(VmaSuballocationList::iterator it = m_Suballocations.begin();

+        it != m_Suballocations.end();

+        ++it)

+    {

+        if(it->type != VMA_SUBALLOCATION_TYPE_FREE &&

+            it->hAllocation->CanBecomeLost() &&

+            it->hAllocation->MakeLost(currentFrameIndex, frameInUseCount))

+        {

+            it = FreeSuballocation(it);

+            ++lostAllocationCount;

+        }

+    }

+    return lostAllocationCount;

+}

+

+VkResult VmaBlockMetadata_Generic::CheckCorruption(const void* pBlockData)

+{

+    for(VmaSuballocationList::iterator it = m_Suballocations.begin();

+        it != m_Suballocations.end();

+        ++it)

+    {

+        if(it->type != VMA_SUBALLOCATION_TYPE_FREE)

+        {

+            if(!VmaValidateMagicValue(pBlockData, it->offset - VMA_DEBUG_MARGIN))

+            {

+                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!");

+                return VK_ERROR_VALIDATION_FAILED_EXT;

+            }

+            if(!VmaValidateMagicValue(pBlockData, it->offset + it->size))

+            {

+                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!");

+                return VK_ERROR_VALIDATION_FAILED_EXT;

+            }

+        }

+    }

+

+    return VK_SUCCESS;

+}

+

+void VmaBlockMetadata_Generic::Alloc(

+    const VmaAllocationRequest& request,

+    VmaSuballocationType type,

+    VkDeviceSize allocSize,

+    VmaAllocation hAllocation)

+{

+    VMA_ASSERT(request.type == VmaAllocationRequestType::Normal);

+    VMA_ASSERT(request.item != m_Suballocations.end());

+    VmaSuballocation& suballoc = *request.item;

+    // Given suballocation is a free block.

+    VMA_ASSERT(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);

+    // Given offset is inside this suballocation.

+    VMA_ASSERT(request.offset >= suballoc.offset);

+    const VkDeviceSize paddingBegin = request.offset - suballoc.offset;

+    VMA_ASSERT(suballoc.size >= paddingBegin + allocSize);

+    const VkDeviceSize paddingEnd = suballoc.size - paddingBegin - allocSize;

+

+    // Unregister this free suballocation from m_FreeSuballocationsBySize and update

+    // it to become used.

+    UnregisterFreeSuballocation(request.item);

+

+    suballoc.offset = request.offset;

+    suballoc.size = allocSize;

+    suballoc.type = type;

+    suballoc.hAllocation = hAllocation;

+

+    // If there are any free bytes remaining at the end, insert new free suballocation after current one.

+    if(paddingEnd)

+    {

+        VmaSuballocation paddingSuballoc = {};

+        paddingSuballoc.offset = request.offset + allocSize;

+        paddingSuballoc.size = paddingEnd;

+        paddingSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;

+        VmaSuballocationList::iterator next = request.item;

+        ++next;

+        const VmaSuballocationList::iterator paddingEndItem =

+            m_Suballocations.insert(next, paddingSuballoc);

+        RegisterFreeSuballocation(paddingEndItem);

+    }

+

+    // If there are any free bytes remaining at the beginning, insert new free suballocation before current one.

+    if(paddingBegin)

+    {

+        VmaSuballocation paddingSuballoc = {};

+        paddingSuballoc.offset = request.offset - paddingBegin;

+        paddingSuballoc.size = paddingBegin;

+        paddingSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;

+        const VmaSuballocationList::iterator paddingBeginItem =

+            m_Suballocations.insert(request.item, paddingSuballoc);

+        RegisterFreeSuballocation(paddingBeginItem);

+    }

+

+    // Update totals.

+    m_FreeCount = m_FreeCount - 1;

+    if(paddingBegin > 0)

+    {

+        ++m_FreeCount;

+    }

+    if(paddingEnd > 0)

+    {

+        ++m_FreeCount;

+    }

+    m_SumFreeSize -= allocSize;

+}

+

+void VmaBlockMetadata_Generic::Free(const VmaAllocation allocation)

+{

+    for(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();

+        suballocItem != m_Suballocations.end();

+        ++suballocItem)

+    {

+        VmaSuballocation& suballoc = *suballocItem;

+        if(suballoc.hAllocation == allocation)

+        {

+            FreeSuballocation(suballocItem);

+            VMA_HEAVY_ASSERT(Validate());

+            return;

+        }

+    }

+    VMA_ASSERT(0 && "Not found!");

+}

+

+void VmaBlockMetadata_Generic::FreeAtOffset(VkDeviceSize offset)

+{

+    for(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();

+        suballocItem != m_Suballocations.end();

+        ++suballocItem)

+    {

+        VmaSuballocation& suballoc = *suballocItem;

+        if(suballoc.offset == offset)

+        {

+            FreeSuballocation(suballocItem);

+            return;

+        }

+    }

+    VMA_ASSERT(0 && "Not found!");

+}

+

+bool VmaBlockMetadata_Generic::ValidateFreeSuballocationList() const

+{

+    VkDeviceSize lastSize = 0;

+    for(size_t i = 0, count = m_FreeSuballocationsBySize.size(); i < count; ++i)

+    {

+        const VmaSuballocationList::iterator it = m_FreeSuballocationsBySize[i];

+

+        VMA_VALIDATE(it->type == VMA_SUBALLOCATION_TYPE_FREE);

+        VMA_VALIDATE(it->size >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER);

+        VMA_VALIDATE(it->size >= lastSize);

+        lastSize = it->size;

+    }

+    return true;

+}

+

+bool VmaBlockMetadata_Generic::CheckAllocation(

+    uint32_t currentFrameIndex,

+    uint32_t frameInUseCount,

+    VkDeviceSize bufferImageGranularity,

+    VkDeviceSize allocSize,

+    VkDeviceSize allocAlignment,

+    VmaSuballocationType allocType,

+    VmaSuballocationList::const_iterator suballocItem,

+    bool canMakeOtherLost,

+    VkDeviceSize* pOffset,

+    size_t* itemsToMakeLostCount,

+    VkDeviceSize* pSumFreeSize,

+    VkDeviceSize* pSumItemSize) const

+{

+    VMA_ASSERT(allocSize > 0);

+    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);

+    VMA_ASSERT(suballocItem != m_Suballocations.cend());

+    VMA_ASSERT(pOffset != VMA_NULL);

+    

+    *itemsToMakeLostCount = 0;

+    *pSumFreeSize = 0;

+    *pSumItemSize = 0;

+

+    if(canMakeOtherLost)

+    {

+        if(suballocItem->type == VMA_SUBALLOCATION_TYPE_FREE)

+        {

+            *pSumFreeSize = suballocItem->size;

+        }

+        else

+        {

+            if(suballocItem->hAllocation->CanBecomeLost() &&

+                suballocItem->hAllocation->GetLastUseFrameIndex() + frameInUseCount < currentFrameIndex)

+            {

+                ++*itemsToMakeLostCount;

+                *pSumItemSize = suballocItem->size;

+            }

+            else

+            {

+                return false;

+            }

+        }

+

+        // Remaining size is too small for this request: Early return.

+        if(GetSize() - suballocItem->offset < allocSize)

+        {

+            return false;

+        }

+

+        // Start from offset equal to beginning of this suballocation.

+        *pOffset = suballocItem->offset;

+    

+        // Apply VMA_DEBUG_MARGIN at the beginning.

+        if(VMA_DEBUG_MARGIN > 0)

+        {

+            *pOffset += VMA_DEBUG_MARGIN;

+        }

+    

+        // Apply alignment.

+        *pOffset = VmaAlignUp(*pOffset, allocAlignment);

+

+        // Check previous suballocations for BufferImageGranularity conflicts.

+        // Make bigger alignment if necessary.

+        if(bufferImageGranularity > 1)

+        {

+            bool bufferImageGranularityConflict = false;

+            VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;

+            while(prevSuballocItem != m_Suballocations.cbegin())

+            {

+                --prevSuballocItem;

+                const VmaSuballocation& prevSuballoc = *prevSuballocItem;

+                if(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, *pOffset, bufferImageGranularity))

+                {

+                    if(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))

+                    {

+                        bufferImageGranularityConflict = true;

+                        break;

+                    }

+                }

+                else

+                    // Already on previous page.

+                    break;

+            }

+            if(bufferImageGranularityConflict)

+            {

+                *pOffset = VmaAlignUp(*pOffset, bufferImageGranularity);

+            }

+        }

+    

+        // Now that we have final *pOffset, check if we are past suballocItem.

+        // If yes, return false - this function should be called for another suballocItem as starting point.

+        if(*pOffset >= suballocItem->offset + suballocItem->size)

+        {

+            return false;

+        }

+    

+        // Calculate padding at the beginning based on current offset.

+        const VkDeviceSize paddingBegin = *pOffset - suballocItem->offset;

+

+        // Calculate required margin at the end.

+        const VkDeviceSize requiredEndMargin = VMA_DEBUG_MARGIN;

+

+        const VkDeviceSize totalSize = paddingBegin + allocSize + requiredEndMargin;

+        // Another early return check.

+        if(suballocItem->offset + totalSize > GetSize())

+        {

+            return false;

+        }

+

+        // Advance lastSuballocItem until desired size is reached.

+        // Update itemsToMakeLostCount.

+        VmaSuballocationList::const_iterator lastSuballocItem = suballocItem;

+        if(totalSize > suballocItem->size)

+        {

+            VkDeviceSize remainingSize = totalSize - suballocItem->size;

+            while(remainingSize > 0)

+            {

+                ++lastSuballocItem;

+                if(lastSuballocItem == m_Suballocations.cend())

+                {

+                    return false;

+                }

+                if(lastSuballocItem->type == VMA_SUBALLOCATION_TYPE_FREE)

+                {

+                    *pSumFreeSize += lastSuballocItem->size;

+                }

+                else

+                {

+                    VMA_ASSERT(lastSuballocItem->hAllocation != VK_NULL_HANDLE);

+                    if(lastSuballocItem->hAllocation->CanBecomeLost() &&

+                        lastSuballocItem->hAllocation->GetLastUseFrameIndex() + frameInUseCount < currentFrameIndex)

+                    {

+                        ++*itemsToMakeLostCount;

+                        *pSumItemSize += lastSuballocItem->size;

+                    }

+                    else

+                    {

+                        return false;

+                    }

+                }

+                remainingSize = (lastSuballocItem->size < remainingSize) ?

+                    remainingSize - lastSuballocItem->size : 0;

+            }

+        }

+

+        // Check next suballocations for BufferImageGranularity conflicts.

+        // If conflict exists, we must mark more allocations lost or fail.

+        if(bufferImageGranularity > 1)

+        {

+            VmaSuballocationList::const_iterator nextSuballocItem = lastSuballocItem;

+            ++nextSuballocItem;

+            while(nextSuballocItem != m_Suballocations.cend())

+            {

+                const VmaSuballocation& nextSuballoc = *nextSuballocItem;

+                if(VmaBlocksOnSamePage(*pOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))

+                {

+                    if(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))

+                    {

+                        VMA_ASSERT(nextSuballoc.hAllocation != VK_NULL_HANDLE);

+                        if(nextSuballoc.hAllocation->CanBecomeLost() &&

+                            nextSuballoc.hAllocation->GetLastUseFrameIndex() + frameInUseCount < currentFrameIndex)

+                        {

+                            ++*itemsToMakeLostCount;

+                        }

+                        else

+                        {

+                            return false;

+                        }

+                    }

+                }

+                else

+                {

+                    // Already on next page.

+                    break;

+                }

+                ++nextSuballocItem;

+            }

+        }

+    }

+    else

+    {

+        const VmaSuballocation& suballoc = *suballocItem;

+        VMA_ASSERT(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);

+

+        *pSumFreeSize = suballoc.size;

+

+        // Size of this suballocation is too small for this request: Early return.

+        if(suballoc.size < allocSize)

+        {

+            return false;

+        }

+

+        // Start from offset equal to beginning of this suballocation.

+        *pOffset = suballoc.offset;

+    

+        // Apply VMA_DEBUG_MARGIN at the beginning.

+        if(VMA_DEBUG_MARGIN > 0)

+        {

+            *pOffset += VMA_DEBUG_MARGIN;

+        }

+    

+        // Apply alignment.

+        *pOffset = VmaAlignUp(*pOffset, allocAlignment);

+    

+        // Check previous suballocations for BufferImageGranularity conflicts.

+        // Make bigger alignment if necessary.

+        if(bufferImageGranularity > 1)

+        {

+            bool bufferImageGranularityConflict = false;

+            VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;

+            while(prevSuballocItem != m_Suballocations.cbegin())

+            {

+                --prevSuballocItem;

+                const VmaSuballocation& prevSuballoc = *prevSuballocItem;

+                if(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, *pOffset, bufferImageGranularity))

+                {

+                    if(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))

+                    {

+                        bufferImageGranularityConflict = true;

+                        break;

+                    }

+                }

+                else

+                    // Already on previous page.

+                    break;

+            }

+            if(bufferImageGranularityConflict)

+            {

+                *pOffset = VmaAlignUp(*pOffset, bufferImageGranularity);

+            }

+        }

+    

+        // Calculate padding at the beginning based on current offset.

+        const VkDeviceSize paddingBegin = *pOffset - suballoc.offset;

+

+        // Calculate required margin at the end.

+        const VkDeviceSize requiredEndMargin = VMA_DEBUG_MARGIN;

+

+        // Fail if requested size plus margin before and after is bigger than size of this suballocation.

+        if(paddingBegin + allocSize + requiredEndMargin > suballoc.size)

+        {

+            return false;

+        }

+

+        // Check next suballocations for BufferImageGranularity conflicts.

+        // If conflict exists, allocation cannot be made here.

+        if(bufferImageGranularity > 1)

+        {

+            VmaSuballocationList::const_iterator nextSuballocItem = suballocItem;

+            ++nextSuballocItem;

+            while(nextSuballocItem != m_Suballocations.cend())

+            {

+                const VmaSuballocation& nextSuballoc = *nextSuballocItem;

+                if(VmaBlocksOnSamePage(*pOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))

+                {

+                    if(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))

+                    {

+                        return false;

+                    }

+                }

+                else

+                {

+                    // Already on next page.

+                    break;

+                }

+                ++nextSuballocItem;

+            }

+        }

+    }

+

+    // All tests passed: Success. pOffset is already filled.

+    return true;

+}

+

+void VmaBlockMetadata_Generic::MergeFreeWithNext(VmaSuballocationList::iterator item)

+{

+    VMA_ASSERT(item != m_Suballocations.end());

+    VMA_ASSERT(item->type == VMA_SUBALLOCATION_TYPE_FREE);

+    

+    VmaSuballocationList::iterator nextItem = item;

+    ++nextItem;

+    VMA_ASSERT(nextItem != m_Suballocations.end());

+    VMA_ASSERT(nextItem->type == VMA_SUBALLOCATION_TYPE_FREE);

+

+    item->size += nextItem->size;

+    --m_FreeCount;

+    m_Suballocations.erase(nextItem);

+}

+

+VmaSuballocationList::iterator VmaBlockMetadata_Generic::FreeSuballocation(VmaSuballocationList::iterator suballocItem)

+{

+    // Change this suballocation to be marked as free.

+    VmaSuballocation& suballoc = *suballocItem;

+    suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;

+    suballoc.hAllocation = VK_NULL_HANDLE;

+    

+    // Update totals.

+    ++m_FreeCount;

+    m_SumFreeSize += suballoc.size;

+

+    // Merge with previous and/or next suballocation if it's also free.

+    bool mergeWithNext = false;

+    bool mergeWithPrev = false;

+    

+    VmaSuballocationList::iterator nextItem = suballocItem;

+    ++nextItem;

+    if((nextItem != m_Suballocations.end()) && (nextItem->type == VMA_SUBALLOCATION_TYPE_FREE))

+    {

+        mergeWithNext = true;

+    }

+

+    VmaSuballocationList::iterator prevItem = suballocItem;

+    if(suballocItem != m_Suballocations.begin())

+    {

+        --prevItem;

+        if(prevItem->type == VMA_SUBALLOCATION_TYPE_FREE)

+        {

+            mergeWithPrev = true;

+        }

+    }

+

+    if(mergeWithNext)

+    {

+        UnregisterFreeSuballocation(nextItem);

+        MergeFreeWithNext(suballocItem);

+    }

+

+    if(mergeWithPrev)

+    {

+        UnregisterFreeSuballocation(prevItem);

+        MergeFreeWithNext(prevItem);

+        RegisterFreeSuballocation(prevItem);

+        return prevItem;

+    }

+    else

+    {

+        RegisterFreeSuballocation(suballocItem);

+        return suballocItem;

+    }

+}

+

+void VmaBlockMetadata_Generic::RegisterFreeSuballocation(VmaSuballocationList::iterator item)

+{

+    VMA_ASSERT(item->type == VMA_SUBALLOCATION_TYPE_FREE);

+    VMA_ASSERT(item->size > 0);

+

+    // You may want to enable this validation at the beginning or at the end of

+    // this function, depending on what do you want to check.

+    VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());

+

+    if(item->size >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)

+    {

+        if(m_FreeSuballocationsBySize.empty())

+        {

+            m_FreeSuballocationsBySize.push_back(item);

+        }

+        else

+        {

+            VmaVectorInsertSorted<VmaSuballocationItemSizeLess>(m_FreeSuballocationsBySize, item);

+        }

+    }

+

+    //VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());

+}

+

+

+void VmaBlockMetadata_Generic::UnregisterFreeSuballocation(VmaSuballocationList::iterator item)

+{

+    VMA_ASSERT(item->type == VMA_SUBALLOCATION_TYPE_FREE);

+    VMA_ASSERT(item->size > 0);

+

+    // You may want to enable this validation at the beginning or at the end of

+    // this function, depending on what do you want to check.

+    VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());

+

+    if(item->size >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)

+    {

+        VmaSuballocationList::iterator* const it = VmaBinaryFindFirstNotLess(

+            m_FreeSuballocationsBySize.data(),

+            m_FreeSuballocationsBySize.data() + m_FreeSuballocationsBySize.size(),

+            item,

+            VmaSuballocationItemSizeLess());

+        for(size_t index = it - m_FreeSuballocationsBySize.data();

+            index < m_FreeSuballocationsBySize.size();

+            ++index)

+        {

+            if(m_FreeSuballocationsBySize[index] == item)

+            {

+                VmaVectorRemove(m_FreeSuballocationsBySize, index);

+                return;

+            }

+            VMA_ASSERT((m_FreeSuballocationsBySize[index]->size == item->size) && "Not found.");

+        }

+        VMA_ASSERT(0 && "Not found.");

+    }

+

+    //VMA_HEAVY_ASSERT(ValidateFreeSuballocationList());

+}

+

+bool VmaBlockMetadata_Generic::IsBufferImageGranularityConflictPossible(

+    VkDeviceSize bufferImageGranularity,

+    VmaSuballocationType& inOutPrevSuballocType) const

+{

+    if(bufferImageGranularity == 1 || IsEmpty())

+    {

+        return false;

+    }

+

+    VkDeviceSize minAlignment = VK_WHOLE_SIZE;

+    bool typeConflictFound = false;

+    for(VmaSuballocationList::const_iterator it = m_Suballocations.cbegin();

+        it != m_Suballocations.cend();

+        ++it)

+    {

+        const VmaSuballocationType suballocType = it->type;

+        if(suballocType != VMA_SUBALLOCATION_TYPE_FREE)

+        {

+            minAlignment = VMA_MIN(minAlignment, it->hAllocation->GetAlignment());

+            if(VmaIsBufferImageGranularityConflict(inOutPrevSuballocType, suballocType))

+            {

+                typeConflictFound = true;

+            }

+            inOutPrevSuballocType = suballocType;

+        }

+    }

+

+    return typeConflictFound || minAlignment >= bufferImageGranularity;

+}

+

+////////////////////////////////////////////////////////////////////////////////

+// class VmaBlockMetadata_Linear

+

+VmaBlockMetadata_Linear::VmaBlockMetadata_Linear(VmaAllocator hAllocator) :

+    VmaBlockMetadata(hAllocator),

+    m_SumFreeSize(0),

+    m_Suballocations0(VmaStlAllocator<VmaSuballocation>(hAllocator->GetAllocationCallbacks())),

+    m_Suballocations1(VmaStlAllocator<VmaSuballocation>(hAllocator->GetAllocationCallbacks())),

+    m_1stVectorIndex(0),

+    m_2ndVectorMode(SECOND_VECTOR_EMPTY),

+    m_1stNullItemsBeginCount(0),

+    m_1stNullItemsMiddleCount(0),

+    m_2ndNullItemsCount(0)

+{

+}

+

+VmaBlockMetadata_Linear::~VmaBlockMetadata_Linear()

+{

+}

+

+void VmaBlockMetadata_Linear::Init(VkDeviceSize size)

+{

+    VmaBlockMetadata::Init(size);

+    m_SumFreeSize = size;

+}

+

+bool VmaBlockMetadata_Linear::Validate() const

+{

+    const SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+    const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+

+    VMA_VALIDATE(suballocations2nd.empty() == (m_2ndVectorMode == SECOND_VECTOR_EMPTY));

+    VMA_VALIDATE(!suballocations1st.empty() ||

+        suballocations2nd.empty() ||

+        m_2ndVectorMode != SECOND_VECTOR_RING_BUFFER);

+

+    if(!suballocations1st.empty())

+    {

+        // Null item at the beginning should be accounted into m_1stNullItemsBeginCount.

+        VMA_VALIDATE(suballocations1st[m_1stNullItemsBeginCount].hAllocation != VK_NULL_HANDLE);

+        // Null item at the end should be just pop_back().

+        VMA_VALIDATE(suballocations1st.back().hAllocation != VK_NULL_HANDLE);

+    }

+    if(!suballocations2nd.empty())

+    {

+        // Null item at the end should be just pop_back().

+        VMA_VALIDATE(suballocations2nd.back().hAllocation != VK_NULL_HANDLE);

+    }

+

+    VMA_VALIDATE(m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount <= suballocations1st.size());

+    VMA_VALIDATE(m_2ndNullItemsCount <= suballocations2nd.size());

+

+    VkDeviceSize sumUsedSize = 0;

+    const size_t suballoc1stCount = suballocations1st.size();

+    VkDeviceSize offset = VMA_DEBUG_MARGIN;

+

+    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)

+    {

+        const size_t suballoc2ndCount = suballocations2nd.size();

+        size_t nullItem2ndCount = 0;

+        for(size_t i = 0; i < suballoc2ndCount; ++i)

+        {

+            const VmaSuballocation& suballoc = suballocations2nd[i];

+            const bool currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);

+

+            VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));

+            VMA_VALIDATE(suballoc.offset >= offset);

+

+            if(!currFree)

+            {

+                VMA_VALIDATE(suballoc.hAllocation->GetOffset() == suballoc.offset);

+                VMA_VALIDATE(suballoc.hAllocation->GetSize() == suballoc.size);

+                sumUsedSize += suballoc.size;

+            }

+            else

+            {

+                ++nullItem2ndCount;

+            }

+

+            offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;

+        }

+

+        VMA_VALIDATE(nullItem2ndCount == m_2ndNullItemsCount);

+    }

+

+    for(size_t i = 0; i < m_1stNullItemsBeginCount; ++i)

+    {

+        const VmaSuballocation& suballoc = suballocations1st[i];

+        VMA_VALIDATE(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE &&

+            suballoc.hAllocation == VK_NULL_HANDLE);

+    }

+

+    size_t nullItem1stCount = m_1stNullItemsBeginCount;

+

+    for(size_t i = m_1stNullItemsBeginCount; i < suballoc1stCount; ++i)

+    {

+        const VmaSuballocation& suballoc = suballocations1st[i];

+        const bool currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);

+

+        VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));

+        VMA_VALIDATE(suballoc.offset >= offset);

+        VMA_VALIDATE(i >= m_1stNullItemsBeginCount || currFree);

+

+        if(!currFree)

+        {

+            VMA_VALIDATE(suballoc.hAllocation->GetOffset() == suballoc.offset);

+            VMA_VALIDATE(suballoc.hAllocation->GetSize() == suballoc.size);

+            sumUsedSize += suballoc.size;

+        }

+        else

+        {

+            ++nullItem1stCount;

+        }

+

+        offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;

+    }

+    VMA_VALIDATE(nullItem1stCount == m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount);

+

+    if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)

+    {

+        const size_t suballoc2ndCount = suballocations2nd.size();

+        size_t nullItem2ndCount = 0;

+        for(size_t i = suballoc2ndCount; i--; )

+        {

+            const VmaSuballocation& suballoc = suballocations2nd[i];

+            const bool currFree = (suballoc.type == VMA_SUBALLOCATION_TYPE_FREE);

+

+            VMA_VALIDATE(currFree == (suballoc.hAllocation == VK_NULL_HANDLE));

+            VMA_VALIDATE(suballoc.offset >= offset);

+

+            if(!currFree)

+            {

+                VMA_VALIDATE(suballoc.hAllocation->GetOffset() == suballoc.offset);

+                VMA_VALIDATE(suballoc.hAllocation->GetSize() == suballoc.size);

+                sumUsedSize += suballoc.size;

+            }

+            else

+            {

+                ++nullItem2ndCount;

+            }

+

+            offset = suballoc.offset + suballoc.size + VMA_DEBUG_MARGIN;

+        }

+

+        VMA_VALIDATE(nullItem2ndCount == m_2ndNullItemsCount);

+    }

+

+    VMA_VALIDATE(offset <= GetSize());

+    VMA_VALIDATE(m_SumFreeSize == GetSize() - sumUsedSize);

+

+    return true;

+}

+

+size_t VmaBlockMetadata_Linear::GetAllocationCount() const

+{

+    return AccessSuballocations1st().size() - (m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount) +

+        AccessSuballocations2nd().size() - m_2ndNullItemsCount;

+}

+

+VkDeviceSize VmaBlockMetadata_Linear::GetUnusedRangeSizeMax() const

+{

+    const VkDeviceSize size = GetSize();

+

+    /*

+    We don't consider gaps inside allocation vectors with freed allocations because

+    they are not suitable for reuse in linear allocator. We consider only space that

+    is available for new allocations.

+    */

+    if(IsEmpty())

+    {

+        return size;

+    }

+    

+    const SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+

+    switch(m_2ndVectorMode)

+    {

+    case SECOND_VECTOR_EMPTY:

+        /*

+        Available space is after end of 1st, as well as before beginning of 1st (which

+        whould make it a ring buffer).

+        */

+        {

+            const size_t suballocations1stCount = suballocations1st.size();

+            VMA_ASSERT(suballocations1stCount > m_1stNullItemsBeginCount);

+            const VmaSuballocation& firstSuballoc = suballocations1st[m_1stNullItemsBeginCount];

+            const VmaSuballocation& lastSuballoc  = suballocations1st[suballocations1stCount - 1];

+            return VMA_MAX(

+                firstSuballoc.offset,

+                size - (lastSuballoc.offset + lastSuballoc.size));

+        }

+        break;

+

+    case SECOND_VECTOR_RING_BUFFER:

+        /*

+        Available space is only between end of 2nd and beginning of 1st.

+        */

+        {

+            const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+            const VmaSuballocation& lastSuballoc2nd = suballocations2nd.back();

+            const VmaSuballocation& firstSuballoc1st = suballocations1st[m_1stNullItemsBeginCount];

+            return firstSuballoc1st.offset - (lastSuballoc2nd.offset + lastSuballoc2nd.size);

+        }

+        break;

+

+    case SECOND_VECTOR_DOUBLE_STACK:

+        /*

+        Available space is only between end of 1st and top of 2nd.

+        */

+        {

+            const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+            const VmaSuballocation& topSuballoc2nd = suballocations2nd.back();

+            const VmaSuballocation& lastSuballoc1st = suballocations1st.back();

+            return topSuballoc2nd.offset - (lastSuballoc1st.offset + lastSuballoc1st.size);

+        }

+        break;

+

+    default:

+        VMA_ASSERT(0);

+        return 0;

+    }

+}

+

+void VmaBlockMetadata_Linear::CalcAllocationStatInfo(VmaStatInfo& outInfo) const

+{

+    const VkDeviceSize size = GetSize();

+    const SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+    const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+    const size_t suballoc1stCount = suballocations1st.size();

+    const size_t suballoc2ndCount = suballocations2nd.size();

+

+    outInfo.blockCount = 1;

+    outInfo.allocationCount = (uint32_t)GetAllocationCount();

+    outInfo.unusedRangeCount = 0;

+    outInfo.usedBytes = 0;

+    outInfo.allocationSizeMin = UINT64_MAX;

+    outInfo.allocationSizeMax = 0;

+    outInfo.unusedRangeSizeMin = UINT64_MAX;

+    outInfo.unusedRangeSizeMax = 0;

+

+    VkDeviceSize lastOffset = 0;

+

+    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)

+    {

+        const VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;

+        size_t nextAlloc2ndIndex = 0;

+        while(lastOffset < freeSpace2ndTo1stEnd)

+        {

+            // Find next non-null allocation or move nextAllocIndex to the end.

+            while(nextAlloc2ndIndex < suballoc2ndCount &&

+                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)

+            {

+                ++nextAlloc2ndIndex;

+            }

+

+            // Found non-null allocation.

+            if(nextAlloc2ndIndex < suballoc2ndCount)

+            {

+                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];

+            

+                // 1. Process free space before this allocation.

+                if(lastOffset < suballoc.offset)

+                {

+                    // There is free space from lastOffset to suballoc.offset.

+                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;

+                    ++outInfo.unusedRangeCount;

+                    outInfo.unusedBytes += unusedRangeSize;

+                    outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);

+                    outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);

+                }

+            

+                // 2. Process this allocation.

+                // There is allocation with suballoc.offset, suballoc.size.

+                outInfo.usedBytes += suballoc.size;

+                outInfo.allocationSizeMin = VMA_MIN(outInfo.allocationSizeMin, suballoc.size);

+                outInfo.allocationSizeMax = VMA_MIN(outInfo.allocationSizeMax, suballoc.size);

+            

+                // 3. Prepare for next iteration.

+                lastOffset = suballoc.offset + suballoc.size;

+                ++nextAlloc2ndIndex;

+            }

+            // We are at the end.

+            else

+            {

+                // There is free space from lastOffset to freeSpace2ndTo1stEnd.

+                if(lastOffset < freeSpace2ndTo1stEnd)

+                {

+                    const VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;

+                    ++outInfo.unusedRangeCount;

+                    outInfo.unusedBytes += unusedRangeSize;

+                    outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);

+                    outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);

+               }

+

+                // End of loop.

+                lastOffset = freeSpace2ndTo1stEnd;

+            }

+        }

+    }

+

+    size_t nextAlloc1stIndex = m_1stNullItemsBeginCount;

+    const VkDeviceSize freeSpace1stTo2ndEnd =

+        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;

+    while(lastOffset < freeSpace1stTo2ndEnd)

+    {

+        // Find next non-null allocation or move nextAllocIndex to the end.

+        while(nextAlloc1stIndex < suballoc1stCount &&

+            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)

+        {

+            ++nextAlloc1stIndex;

+        }

+

+        // Found non-null allocation.

+        if(nextAlloc1stIndex < suballoc1stCount)

+        {

+            const VmaSuballocation& suballoc = suballocations1st[nextAlloc1stIndex];

+            

+            // 1. Process free space before this allocation.

+            if(lastOffset < suballoc.offset)

+            {

+                // There is free space from lastOffset to suballoc.offset.

+                const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;

+                ++outInfo.unusedRangeCount;

+                outInfo.unusedBytes += unusedRangeSize;

+                outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);

+                outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);

+            }

+            

+            // 2. Process this allocation.

+            // There is allocation with suballoc.offset, suballoc.size.

+            outInfo.usedBytes += suballoc.size;

+            outInfo.allocationSizeMin = VMA_MIN(outInfo.allocationSizeMin, suballoc.size);

+            outInfo.allocationSizeMax = VMA_MIN(outInfo.allocationSizeMax, suballoc.size);

+            

+            // 3. Prepare for next iteration.

+            lastOffset = suballoc.offset + suballoc.size;

+            ++nextAlloc1stIndex;

+        }

+        // We are at the end.

+        else

+        {

+            // There is free space from lastOffset to freeSpace1stTo2ndEnd.

+            if(lastOffset < freeSpace1stTo2ndEnd)

+            {

+                const VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;

+                ++outInfo.unusedRangeCount;

+                outInfo.unusedBytes += unusedRangeSize;

+                outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);

+                outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);

+           }

+

+            // End of loop.

+            lastOffset = freeSpace1stTo2ndEnd;

+        }

+    }

+

+    if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)

+    {

+        size_t nextAlloc2ndIndex = suballocations2nd.size() - 1;

+        while(lastOffset < size)

+        {

+            // Find next non-null allocation or move nextAllocIndex to the end.

+            while(nextAlloc2ndIndex != SIZE_MAX &&

+                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)

+            {

+                --nextAlloc2ndIndex;

+            }

+

+            // Found non-null allocation.

+            if(nextAlloc2ndIndex != SIZE_MAX)

+            {

+                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];

+            

+                // 1. Process free space before this allocation.

+                if(lastOffset < suballoc.offset)

+                {

+                    // There is free space from lastOffset to suballoc.offset.

+                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;

+                    ++outInfo.unusedRangeCount;

+                    outInfo.unusedBytes += unusedRangeSize;

+                    outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);

+                    outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);

+                }

+            

+                // 2. Process this allocation.

+                // There is allocation with suballoc.offset, suballoc.size.

+                outInfo.usedBytes += suballoc.size;

+                outInfo.allocationSizeMin = VMA_MIN(outInfo.allocationSizeMin, suballoc.size);

+                outInfo.allocationSizeMax = VMA_MIN(outInfo.allocationSizeMax, suballoc.size);

+            

+                // 3. Prepare for next iteration.

+                lastOffset = suballoc.offset + suballoc.size;

+                --nextAlloc2ndIndex;

+            }

+            // We are at the end.

+            else

+            {

+                // There is free space from lastOffset to size.

+                if(lastOffset < size)

+                {

+                    const VkDeviceSize unusedRangeSize = size - lastOffset;

+                    ++outInfo.unusedRangeCount;

+                    outInfo.unusedBytes += unusedRangeSize;

+                    outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusedRangeSize);

+                    outInfo.unusedRangeSizeMax = VMA_MIN(outInfo.unusedRangeSizeMax, unusedRangeSize);

+               }

+

+                // End of loop.

+                lastOffset = size;

+            }

+        }

+    }

+

+    outInfo.unusedBytes = size - outInfo.usedBytes;

+}

+

+void VmaBlockMetadata_Linear::AddPoolStats(VmaPoolStats& inoutStats) const

+{

+    const SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+    const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+    const VkDeviceSize size = GetSize();

+    const size_t suballoc1stCount = suballocations1st.size();

+    const size_t suballoc2ndCount = suballocations2nd.size();

+

+    inoutStats.size += size;

+

+    VkDeviceSize lastOffset = 0;

+

+    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)

+    {

+        const VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;

+        size_t nextAlloc2ndIndex = m_1stNullItemsBeginCount;

+        while(lastOffset < freeSpace2ndTo1stEnd)

+        {

+            // Find next non-null allocation or move nextAlloc2ndIndex to the end.

+            while(nextAlloc2ndIndex < suballoc2ndCount &&

+                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)

+            {

+                ++nextAlloc2ndIndex;

+            }

+

+            // Found non-null allocation.

+            if(nextAlloc2ndIndex < suballoc2ndCount)

+            {

+                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];

+            

+                // 1. Process free space before this allocation.

+                if(lastOffset < suballoc.offset)

+                {

+                    // There is free space from lastOffset to suballoc.offset.

+                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;

+                    inoutStats.unusedSize += unusedRangeSize;

+                    ++inoutStats.unusedRangeCount;

+                    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);

+                }

+            

+                // 2. Process this allocation.

+                // There is allocation with suballoc.offset, suballoc.size.

+                ++inoutStats.allocationCount;

+            

+                // 3. Prepare for next iteration.

+                lastOffset = suballoc.offset + suballoc.size;

+                ++nextAlloc2ndIndex;

+            }

+            // We are at the end.

+            else

+            {

+                if(lastOffset < freeSpace2ndTo1stEnd)

+                {

+                    // There is free space from lastOffset to freeSpace2ndTo1stEnd.

+                    const VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;

+                    inoutStats.unusedSize += unusedRangeSize;

+                    ++inoutStats.unusedRangeCount;

+                    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);

+                }

+

+                // End of loop.

+                lastOffset = freeSpace2ndTo1stEnd;

+            }

+        }

+    }

+

+    size_t nextAlloc1stIndex = m_1stNullItemsBeginCount;

+    const VkDeviceSize freeSpace1stTo2ndEnd =

+        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;

+    while(lastOffset < freeSpace1stTo2ndEnd)

+    {

+        // Find next non-null allocation or move nextAllocIndex to the end.

+        while(nextAlloc1stIndex < suballoc1stCount &&

+            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)

+        {

+            ++nextAlloc1stIndex;

+        }

+

+        // Found non-null allocation.

+        if(nextAlloc1stIndex < suballoc1stCount)

+        {

+            const VmaSuballocation& suballoc = suballocations1st[nextAlloc1stIndex];

+            

+            // 1. Process free space before this allocation.

+            if(lastOffset < suballoc.offset)

+            {

+                // There is free space from lastOffset to suballoc.offset.

+                const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;

+                inoutStats.unusedSize += unusedRangeSize;

+                ++inoutStats.unusedRangeCount;

+                inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);

+            }

+            

+            // 2. Process this allocation.

+            // There is allocation with suballoc.offset, suballoc.size.

+            ++inoutStats.allocationCount;

+            

+            // 3. Prepare for next iteration.

+            lastOffset = suballoc.offset + suballoc.size;

+            ++nextAlloc1stIndex;

+        }

+        // We are at the end.

+        else

+        {

+            if(lastOffset < freeSpace1stTo2ndEnd)

+            {

+                // There is free space from lastOffset to freeSpace1stTo2ndEnd.

+                const VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;

+                inoutStats.unusedSize += unusedRangeSize;

+                ++inoutStats.unusedRangeCount;

+                inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);

+            }

+

+            // End of loop.

+            lastOffset = freeSpace1stTo2ndEnd;

+        }

+    }

+

+    if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)

+    {

+        size_t nextAlloc2ndIndex = suballocations2nd.size() - 1;

+        while(lastOffset < size)

+        {

+            // Find next non-null allocation or move nextAlloc2ndIndex to the end.

+            while(nextAlloc2ndIndex != SIZE_MAX &&

+                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)

+            {

+                --nextAlloc2ndIndex;

+            }

+

+            // Found non-null allocation.

+            if(nextAlloc2ndIndex != SIZE_MAX)

+            {

+                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];

+            

+                // 1. Process free space before this allocation.

+                if(lastOffset < suballoc.offset)

+                {

+                    // There is free space from lastOffset to suballoc.offset.

+                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;

+                    inoutStats.unusedSize += unusedRangeSize;

+                    ++inoutStats.unusedRangeCount;

+                    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);

+                }

+            

+                // 2. Process this allocation.

+                // There is allocation with suballoc.offset, suballoc.size.

+                ++inoutStats.allocationCount;

+            

+                // 3. Prepare for next iteration.

+                lastOffset = suballoc.offset + suballoc.size;

+                --nextAlloc2ndIndex;

+            }

+            // We are at the end.

+            else

+            {

+                if(lastOffset < size)

+                {

+                    // There is free space from lastOffset to size.

+                    const VkDeviceSize unusedRangeSize = size - lastOffset;

+                    inoutStats.unusedSize += unusedRangeSize;

+                    ++inoutStats.unusedRangeCount;

+                    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, unusedRangeSize);

+                }

+

+                // End of loop.

+                lastOffset = size;

+            }

+        }

+    }

+}

+

+#if VMA_STATS_STRING_ENABLED

+void VmaBlockMetadata_Linear::PrintDetailedMap(class VmaJsonWriter& json) const

+{

+    const VkDeviceSize size = GetSize();

+    const SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+    const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+    const size_t suballoc1stCount = suballocations1st.size();

+    const size_t suballoc2ndCount = suballocations2nd.size();

+

+    // FIRST PASS

+

+    size_t unusedRangeCount = 0;

+    VkDeviceSize usedBytes = 0;

+

+    VkDeviceSize lastOffset = 0;

+

+    size_t alloc2ndCount = 0;

+    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)

+    {

+        const VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;

+        size_t nextAlloc2ndIndex = 0;

+        while(lastOffset < freeSpace2ndTo1stEnd)

+        {

+            // Find next non-null allocation or move nextAlloc2ndIndex to the end.

+            while(nextAlloc2ndIndex < suballoc2ndCount &&

+                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)

+            {

+                ++nextAlloc2ndIndex;

+            }

+

+            // Found non-null allocation.

+            if(nextAlloc2ndIndex < suballoc2ndCount)

+            {

+                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];

+            

+                // 1. Process free space before this allocation.

+                if(lastOffset < suballoc.offset)

+                {

+                    // There is free space from lastOffset to suballoc.offset.

+                    ++unusedRangeCount;

+                }

+            

+                // 2. Process this allocation.

+                // There is allocation with suballoc.offset, suballoc.size.

+                ++alloc2ndCount;

+                usedBytes += suballoc.size;

+            

+                // 3. Prepare for next iteration.

+                lastOffset = suballoc.offset + suballoc.size;

+                ++nextAlloc2ndIndex;

+            }

+            // We are at the end.

+            else

+            {

+                if(lastOffset < freeSpace2ndTo1stEnd)

+                {

+                    // There is free space from lastOffset to freeSpace2ndTo1stEnd.

+                    ++unusedRangeCount;

+                }

+

+                // End of loop.

+                lastOffset = freeSpace2ndTo1stEnd;

+            }

+        }

+    }

+

+    size_t nextAlloc1stIndex = m_1stNullItemsBeginCount;

+    size_t alloc1stCount = 0;

+    const VkDeviceSize freeSpace1stTo2ndEnd =

+        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ? suballocations2nd.back().offset : size;

+    while(lastOffset < freeSpace1stTo2ndEnd)

+    {

+        // Find next non-null allocation or move nextAllocIndex to the end.

+        while(nextAlloc1stIndex < suballoc1stCount &&

+            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)

+        {

+            ++nextAlloc1stIndex;

+        }

+

+        // Found non-null allocation.

+        if(nextAlloc1stIndex < suballoc1stCount)

+        {

+            const VmaSuballocation& suballoc = suballocations1st[nextAlloc1stIndex];

+            

+            // 1. Process free space before this allocation.

+            if(lastOffset < suballoc.offset)

+            {

+                // There is free space from lastOffset to suballoc.offset.

+                ++unusedRangeCount;

+            }

+            

+            // 2. Process this allocation.

+            // There is allocation with suballoc.offset, suballoc.size.

+            ++alloc1stCount;

+            usedBytes += suballoc.size;

+            

+            // 3. Prepare for next iteration.

+            lastOffset = suballoc.offset + suballoc.size;

+            ++nextAlloc1stIndex;

+        }

+        // We are at the end.

+        else

+        {

+            if(lastOffset < size)

+            {

+                // There is free space from lastOffset to freeSpace1stTo2ndEnd.

+                ++unusedRangeCount;

+            }

+

+            // End of loop.

+            lastOffset = freeSpace1stTo2ndEnd;

+        }

+    }

+

+    if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)

+    {

+        size_t nextAlloc2ndIndex = suballocations2nd.size() - 1;

+        while(lastOffset < size)

+        {

+            // Find next non-null allocation or move nextAlloc2ndIndex to the end.

+            while(nextAlloc2ndIndex != SIZE_MAX &&

+                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)

+            {

+                --nextAlloc2ndIndex;

+            }

+

+            // Found non-null allocation.

+            if(nextAlloc2ndIndex != SIZE_MAX)

+            {

+                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];

+            

+                // 1. Process free space before this allocation.

+                if(lastOffset < suballoc.offset)

+                {

+                    // There is free space from lastOffset to suballoc.offset.

+                    ++unusedRangeCount;

+                }

+            

+                // 2. Process this allocation.

+                // There is allocation with suballoc.offset, suballoc.size.

+                ++alloc2ndCount;

+                usedBytes += suballoc.size;

+            

+                // 3. Prepare for next iteration.

+                lastOffset = suballoc.offset + suballoc.size;

+                --nextAlloc2ndIndex;

+            }

+            // We are at the end.

+            else

+            {

+                if(lastOffset < size)

+                {

+                    // There is free space from lastOffset to size.

+                    ++unusedRangeCount;

+                }

+

+                // End of loop.

+                lastOffset = size;

+            }

+        }

+    }

+

+    const VkDeviceSize unusedBytes = size - usedBytes;

+    PrintDetailedMap_Begin(json, unusedBytes, alloc1stCount + alloc2ndCount, unusedRangeCount);

+

+    // SECOND PASS

+    lastOffset = 0;

+

+    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)

+    {

+        const VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;

+        size_t nextAlloc2ndIndex = 0;

+        while(lastOffset < freeSpace2ndTo1stEnd)

+        {

+            // Find next non-null allocation or move nextAlloc2ndIndex to the end.

+            while(nextAlloc2ndIndex < suballoc2ndCount &&

+                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)

+            {

+                ++nextAlloc2ndIndex;

+            }

+

+            // Found non-null allocation.

+            if(nextAlloc2ndIndex < suballoc2ndCount)

+            {

+                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];

+            

+                // 1. Process free space before this allocation.

+                if(lastOffset < suballoc.offset)

+                {

+                    // There is free space from lastOffset to suballoc.offset.

+                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;

+                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);

+                }

+            

+                // 2. Process this allocation.

+                // There is allocation with suballoc.offset, suballoc.size.

+                PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);

+            

+                // 3. Prepare for next iteration.

+                lastOffset = suballoc.offset + suballoc.size;

+                ++nextAlloc2ndIndex;

+            }

+            // We are at the end.

+            else

+            {

+                if(lastOffset < freeSpace2ndTo1stEnd)

+                {

+                    // There is free space from lastOffset to freeSpace2ndTo1stEnd.

+                    const VkDeviceSize unusedRangeSize = freeSpace2ndTo1stEnd - lastOffset;

+                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);

+                }

+

+                // End of loop.

+                lastOffset = freeSpace2ndTo1stEnd;

+            }

+        }

+    }

+

+    nextAlloc1stIndex = m_1stNullItemsBeginCount;

+    while(lastOffset < freeSpace1stTo2ndEnd)

+    {

+        // Find next non-null allocation or move nextAllocIndex to the end.

+        while(nextAlloc1stIndex < suballoc1stCount &&

+            suballocations1st[nextAlloc1stIndex].hAllocation == VK_NULL_HANDLE)

+        {

+            ++nextAlloc1stIndex;

+        }

+

+        // Found non-null allocation.

+        if(nextAlloc1stIndex < suballoc1stCount)

+        {

+            const VmaSuballocation& suballoc = suballocations1st[nextAlloc1stIndex];

+            

+            // 1. Process free space before this allocation.

+            if(lastOffset < suballoc.offset)

+            {

+                // There is free space from lastOffset to suballoc.offset.

+                const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;

+                PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);

+            }

+            

+            // 2. Process this allocation.

+            // There is allocation with suballoc.offset, suballoc.size.

+            PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);

+            

+            // 3. Prepare for next iteration.

+            lastOffset = suballoc.offset + suballoc.size;

+            ++nextAlloc1stIndex;

+        }

+        // We are at the end.

+        else

+        {

+            if(lastOffset < freeSpace1stTo2ndEnd)

+            {

+                // There is free space from lastOffset to freeSpace1stTo2ndEnd.

+                const VkDeviceSize unusedRangeSize = freeSpace1stTo2ndEnd - lastOffset;

+                PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);

+            }

+

+            // End of loop.

+            lastOffset = freeSpace1stTo2ndEnd;

+        }

+    }

+

+    if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)

+    {

+        size_t nextAlloc2ndIndex = suballocations2nd.size() - 1;

+        while(lastOffset < size)

+        {

+            // Find next non-null allocation or move nextAlloc2ndIndex to the end.

+            while(nextAlloc2ndIndex != SIZE_MAX &&

+                suballocations2nd[nextAlloc2ndIndex].hAllocation == VK_NULL_HANDLE)

+            {

+                --nextAlloc2ndIndex;

+            }

+

+            // Found non-null allocation.

+            if(nextAlloc2ndIndex != SIZE_MAX)

+            {

+                const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];

+            

+                // 1. Process free space before this allocation.

+                if(lastOffset < suballoc.offset)

+                {

+                    // There is free space from lastOffset to suballoc.offset.

+                    const VkDeviceSize unusedRangeSize = suballoc.offset - lastOffset;

+                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);

+                }

+            

+                // 2. Process this allocation.

+                // There is allocation with suballoc.offset, suballoc.size.

+                PrintDetailedMap_Allocation(json, suballoc.offset, suballoc.hAllocation);

+            

+                // 3. Prepare for next iteration.

+                lastOffset = suballoc.offset + suballoc.size;

+                --nextAlloc2ndIndex;

+            }

+            // We are at the end.

+            else

+            {

+                if(lastOffset < size)

+                {

+                    // There is free space from lastOffset to size.

+                    const VkDeviceSize unusedRangeSize = size - lastOffset;

+                    PrintDetailedMap_UnusedRange(json, lastOffset, unusedRangeSize);

+                }

+

+                // End of loop.

+                lastOffset = size;

+            }

+        }

+    }

+

+    PrintDetailedMap_End(json);

+}

+#endif // #if VMA_STATS_STRING_ENABLED

+

+bool VmaBlockMetadata_Linear::CreateAllocationRequest(

+    uint32_t currentFrameIndex,

+    uint32_t frameInUseCount,

+    VkDeviceSize bufferImageGranularity,

+    VkDeviceSize allocSize,

+    VkDeviceSize allocAlignment,

+    bool upperAddress,

+    VmaSuballocationType allocType,

+    bool canMakeOtherLost,

+    uint32_t strategy,

+    VmaAllocationRequest* pAllocationRequest)

+{

+    VMA_ASSERT(allocSize > 0);

+    VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);

+    VMA_ASSERT(pAllocationRequest != VMA_NULL);

+    VMA_HEAVY_ASSERT(Validate());

+    return upperAddress ?

+        CreateAllocationRequest_UpperAddress(

+            currentFrameIndex, frameInUseCount, bufferImageGranularity,

+            allocSize, allocAlignment, allocType, canMakeOtherLost, strategy, pAllocationRequest) :

+        CreateAllocationRequest_LowerAddress(

+            currentFrameIndex, frameInUseCount, bufferImageGranularity,

+            allocSize, allocAlignment, allocType, canMakeOtherLost, strategy, pAllocationRequest);

+}

+

+bool VmaBlockMetadata_Linear::CreateAllocationRequest_UpperAddress(

+    uint32_t currentFrameIndex,

+    uint32_t frameInUseCount,

+    VkDeviceSize bufferImageGranularity,

+    VkDeviceSize allocSize,

+    VkDeviceSize allocAlignment,

+    VmaSuballocationType allocType,

+    bool canMakeOtherLost,

+    uint32_t strategy,

+    VmaAllocationRequest* pAllocationRequest)

+{

+    const VkDeviceSize size = GetSize();

+    SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+

+    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)

+    {

+        VMA_ASSERT(0 && "Trying to use pool with linear algorithm as double stack, while it is already being used as ring buffer.");

+        return false;

+    }

+

+    // Try to allocate before 2nd.back(), or end of block if 2nd.empty().

+    if(allocSize > size)

+    {

+        return false;

+    }

+    VkDeviceSize resultBaseOffset = size - allocSize;

+    if(!suballocations2nd.empty())

+    {

+        const VmaSuballocation& lastSuballoc = suballocations2nd.back();

+        resultBaseOffset = lastSuballoc.offset - allocSize;

+        if(allocSize > lastSuballoc.offset)

+        {

+            return false;

+        }

+    }

+

+    // Start from offset equal to end of free space.

+    VkDeviceSize resultOffset = resultBaseOffset;

+

+    // Apply VMA_DEBUG_MARGIN at the end.

+    if(VMA_DEBUG_MARGIN > 0)

+    {

+        if(resultOffset < VMA_DEBUG_MARGIN)

+        {

+            return false;

+        }

+        resultOffset -= VMA_DEBUG_MARGIN;

+    }

+

+    // Apply alignment.

+    resultOffset = VmaAlignDown(resultOffset, allocAlignment);

+

+    // Check next suballocations from 2nd for BufferImageGranularity conflicts.

+    // Make bigger alignment if necessary.

+    if(bufferImageGranularity > 1 && !suballocations2nd.empty())

+    {

+        bool bufferImageGranularityConflict = false;

+        for(size_t nextSuballocIndex = suballocations2nd.size(); nextSuballocIndex--; )

+        {

+            const VmaSuballocation& nextSuballoc = suballocations2nd[nextSuballocIndex];

+            if(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))

+            {

+                if(VmaIsBufferImageGranularityConflict(nextSuballoc.type, allocType))

+                {

+                    bufferImageGranularityConflict = true;

+                    break;

+                }

+            }

+            else

+                // Already on previous page.

+                break;

+        }

+        if(bufferImageGranularityConflict)

+        {

+            resultOffset = VmaAlignDown(resultOffset, bufferImageGranularity);

+        }

+    }

+

+    // There is enough free space.

+    const VkDeviceSize endOf1st = !suballocations1st.empty() ?

+        suballocations1st.back().offset + suballocations1st.back().size :

+        0;

+    if(endOf1st + VMA_DEBUG_MARGIN <= resultOffset)

+    {

+        // Check previous suballocations for BufferImageGranularity conflicts.

+        // If conflict exists, allocation cannot be made here.

+        if(bufferImageGranularity > 1)

+        {

+            for(size_t prevSuballocIndex = suballocations1st.size(); prevSuballocIndex--; )

+            {

+                const VmaSuballocation& prevSuballoc = suballocations1st[prevSuballocIndex];

+                if(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))

+                {

+                    if(VmaIsBufferImageGranularityConflict(allocType, prevSuballoc.type))

+                    {

+                        return false;

+                    }

+                }

+                else

+                {

+                    // Already on next page.

+                    break;

+                }

+            }

+        }

+

+        // All tests passed: Success.

+        pAllocationRequest->offset = resultOffset;

+        pAllocationRequest->sumFreeSize = resultBaseOffset + allocSize - endOf1st;

+        pAllocationRequest->sumItemSize = 0;

+        // pAllocationRequest->item unused.

+        pAllocationRequest->itemsToMakeLostCount = 0;

+        pAllocationRequest->type = VmaAllocationRequestType::UpperAddress;

+        return true;

+    }

+

+    return false;

+}

+

+bool VmaBlockMetadata_Linear::CreateAllocationRequest_LowerAddress(

+    uint32_t currentFrameIndex,

+    uint32_t frameInUseCount,

+    VkDeviceSize bufferImageGranularity,

+    VkDeviceSize allocSize,

+    VkDeviceSize allocAlignment,

+    VmaSuballocationType allocType,

+    bool canMakeOtherLost,

+    uint32_t strategy,

+    VmaAllocationRequest* pAllocationRequest)

+{

+    const VkDeviceSize size = GetSize();

+    SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+

+    if(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)

+    {

+        // Try to allocate at the end of 1st vector.

+

+        VkDeviceSize resultBaseOffset = 0;

+        if(!suballocations1st.empty())

+        {

+            const VmaSuballocation& lastSuballoc = suballocations1st.back();

+            resultBaseOffset = lastSuballoc.offset + lastSuballoc.size;

+        }

+

+        // Start from offset equal to beginning of free space.

+        VkDeviceSize resultOffset = resultBaseOffset;

+

+        // Apply VMA_DEBUG_MARGIN at the beginning.

+        if(VMA_DEBUG_MARGIN > 0)

+        {

+            resultOffset += VMA_DEBUG_MARGIN;

+        }

+

+        // Apply alignment.

+        resultOffset = VmaAlignUp(resultOffset, allocAlignment);

+

+        // Check previous suballocations for BufferImageGranularity conflicts.

+        // Make bigger alignment if necessary.

+        if(bufferImageGranularity > 1 && !suballocations1st.empty())

+        {

+            bool bufferImageGranularityConflict = false;

+            for(size_t prevSuballocIndex = suballocations1st.size(); prevSuballocIndex--; )

+            {

+                const VmaSuballocation& prevSuballoc = suballocations1st[prevSuballocIndex];

+                if(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))

+                {

+                    if(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))

+                    {

+                        bufferImageGranularityConflict = true;

+                        break;

+                    }

+                }

+                else

+                    // Already on previous page.

+                    break;

+            }

+            if(bufferImageGranularityConflict)

+            {

+                resultOffset = VmaAlignUp(resultOffset, bufferImageGranularity);

+            }

+        }

+

+        const VkDeviceSize freeSpaceEnd = m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK ?

+            suballocations2nd.back().offset : size;

+

+        // There is enough free space at the end after alignment.

+        if(resultOffset + allocSize + VMA_DEBUG_MARGIN <= freeSpaceEnd)

+        {

+            // Check next suballocations for BufferImageGranularity conflicts.

+            // If conflict exists, allocation cannot be made here.

+            if(bufferImageGranularity > 1 && m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)

+            {

+                for(size_t nextSuballocIndex = suballocations2nd.size(); nextSuballocIndex--; )

+                {

+                    const VmaSuballocation& nextSuballoc = suballocations2nd[nextSuballocIndex];

+                    if(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))

+                    {

+                        if(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))

+                        {

+                            return false;

+                        }

+                    }

+                    else

+                    {

+                        // Already on previous page.

+                        break;

+                    }

+                }

+            }

+

+            // All tests passed: Success.

+            pAllocationRequest->offset = resultOffset;

+            pAllocationRequest->sumFreeSize = freeSpaceEnd - resultBaseOffset;

+            pAllocationRequest->sumItemSize = 0;

+            // pAllocationRequest->item, customData unused.

+            pAllocationRequest->type = VmaAllocationRequestType::EndOf1st;

+            pAllocationRequest->itemsToMakeLostCount = 0;

+            return true;

+        }

+    }

+

+    // Wrap-around to end of 2nd vector. Try to allocate there, watching for the

+    // beginning of 1st vector as the end of free space.

+    if(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)

+    {

+        VMA_ASSERT(!suballocations1st.empty());

+

+        VkDeviceSize resultBaseOffset = 0;

+        if(!suballocations2nd.empty())

+        {

+            const VmaSuballocation& lastSuballoc = suballocations2nd.back();

+            resultBaseOffset = lastSuballoc.offset + lastSuballoc.size;

+        }

+

+        // Start from offset equal to beginning of free space.

+        VkDeviceSize resultOffset = resultBaseOffset;

+

+        // Apply VMA_DEBUG_MARGIN at the beginning.

+        if(VMA_DEBUG_MARGIN > 0)

+        {

+            resultOffset += VMA_DEBUG_MARGIN;

+        }

+

+        // Apply alignment.

+        resultOffset = VmaAlignUp(resultOffset, allocAlignment);

+

+        // Check previous suballocations for BufferImageGranularity conflicts.

+        // Make bigger alignment if necessary.

+        if(bufferImageGranularity > 1 && !suballocations2nd.empty())

+        {

+            bool bufferImageGranularityConflict = false;

+            for(size_t prevSuballocIndex = suballocations2nd.size(); prevSuballocIndex--; )

+            {

+                const VmaSuballocation& prevSuballoc = suballocations2nd[prevSuballocIndex];

+                if(VmaBlocksOnSamePage(prevSuballoc.offset, prevSuballoc.size, resultOffset, bufferImageGranularity))

+                {

+                    if(VmaIsBufferImageGranularityConflict(prevSuballoc.type, allocType))

+                    {

+                        bufferImageGranularityConflict = true;

+                        break;

+                    }

+                }

+                else

+                    // Already on previous page.

+                    break;

+            }

+            if(bufferImageGranularityConflict)

+            {

+                resultOffset = VmaAlignUp(resultOffset, bufferImageGranularity);

+            }

+        }

+

+        pAllocationRequest->itemsToMakeLostCount = 0;

+        pAllocationRequest->sumItemSize = 0;

+        size_t index1st = m_1stNullItemsBeginCount;

+

+        if(canMakeOtherLost)

+        {

+            while(index1st < suballocations1st.size() &&

+                resultOffset + allocSize + VMA_DEBUG_MARGIN > suballocations1st[index1st].offset)

+            {

+                // Next colliding allocation at the beginning of 1st vector found. Try to make it lost.

+                const VmaSuballocation& suballoc = suballocations1st[index1st];

+                if(suballoc.type == VMA_SUBALLOCATION_TYPE_FREE)

+                {

+                    // No problem.

+                }

+                else

+                {

+                    VMA_ASSERT(suballoc.hAllocation != VK_NULL_HANDLE);

+                    if(suballoc.hAllocation->CanBecomeLost() &&

+                        suballoc.hAllocation->GetLastUseFrameIndex() + frameInUseCount < currentFrameIndex)

+                    {

+                        ++pAllocationRequest->itemsToMakeLostCount;

+                        pAllocationRequest->sumItemSize += suballoc.size;

+                    }

+                    else

+                    {

+                        return false;

+                    }

+                }

+                ++index1st;

+            }

+

+            // Check next suballocations for BufferImageGranularity conflicts.

+            // If conflict exists, we must mark more allocations lost or fail.

+            if(bufferImageGranularity > 1)

+            {

+                while(index1st < suballocations1st.size())

+                {

+                    const VmaSuballocation& suballoc = suballocations1st[index1st];

+                    if(VmaBlocksOnSamePage(resultOffset, allocSize, suballoc.offset, bufferImageGranularity))

+                    {

+                        if(suballoc.hAllocation != VK_NULL_HANDLE)

+                        {

+                            // Not checking actual VmaIsBufferImageGranularityConflict(allocType, suballoc.type).

+                            if(suballoc.hAllocation->CanBecomeLost() &&

+                                suballoc.hAllocation->GetLastUseFrameIndex() + frameInUseCount < currentFrameIndex)

+                            {

+                                ++pAllocationRequest->itemsToMakeLostCount;

+                                pAllocationRequest->sumItemSize += suballoc.size;

+                            }

+                            else

+                            {

+                                return false;

+                            }

+                        }

+                    }

+                    else

+                    {

+                        // Already on next page.

+                        break;

+                    }

+                    ++index1st;

+                }

+            }

+

+            // Special case: There is not enough room at the end for this allocation, even after making all from the 1st lost.

+            if(index1st == suballocations1st.size() &&

+                resultOffset + allocSize + VMA_DEBUG_MARGIN > size)

+            {

+                // TODO: This is a known bug that it's not yet implemented and the allocation is failing.

+                VMA_DEBUG_LOG("Unsupported special case in custom pool with linear allocation algorithm used as ring buffer with allocations that can be lost.");

+            }

+        }

+

+        // There is enough free space at the end after alignment.

+        if((index1st == suballocations1st.size() && resultOffset + allocSize + VMA_DEBUG_MARGIN <= size) ||

+            (index1st < suballocations1st.size() && resultOffset + allocSize + VMA_DEBUG_MARGIN <= suballocations1st[index1st].offset))

+        {

+            // Check next suballocations for BufferImageGranularity conflicts.

+            // If conflict exists, allocation cannot be made here.

+            if(bufferImageGranularity > 1)

+            {

+                for(size_t nextSuballocIndex = index1st;

+                    nextSuballocIndex < suballocations1st.size();

+                    nextSuballocIndex++)

+                {

+                    const VmaSuballocation& nextSuballoc = suballocations1st[nextSuballocIndex];

+                    if(VmaBlocksOnSamePage(resultOffset, allocSize, nextSuballoc.offset, bufferImageGranularity))

+                    {

+                        if(VmaIsBufferImageGranularityConflict(allocType, nextSuballoc.type))

+                        {

+                            return false;

+                        }

+                    }

+                    else

+                    {

+                        // Already on next page.

+                        break;

+                    }

+                }

+            }

+

+            // All tests passed: Success.

+            pAllocationRequest->offset = resultOffset;

+            pAllocationRequest->sumFreeSize =

+                (index1st < suballocations1st.size() ? suballocations1st[index1st].offset : size)

+                - resultBaseOffset

+                - pAllocationRequest->sumItemSize;

+            pAllocationRequest->type = VmaAllocationRequestType::EndOf2nd;

+            // pAllocationRequest->item, customData unused.

+            return true;

+        }

+    }

+

+    return false;

+}

+

+bool VmaBlockMetadata_Linear::MakeRequestedAllocationsLost(

+    uint32_t currentFrameIndex,

+    uint32_t frameInUseCount,

+    VmaAllocationRequest* pAllocationRequest)

+{

+    if(pAllocationRequest->itemsToMakeLostCount == 0)

+    {

+        return true;

+    }

+

+    VMA_ASSERT(m_2ndVectorMode == SECOND_VECTOR_EMPTY || m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER);

+    

+    // We always start from 1st.

+    SuballocationVectorType* suballocations = &AccessSuballocations1st();

+    size_t index = m_1stNullItemsBeginCount;

+    size_t madeLostCount = 0;

+    while(madeLostCount < pAllocationRequest->itemsToMakeLostCount)

+    {

+        if(index == suballocations->size())

+        {

+            index = 0;

+            // If we get to the end of 1st, we wrap around to beginning of 2nd of 1st.

+            if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)

+            {

+                suballocations = &AccessSuballocations2nd();

+            }

+            // else: m_2ndVectorMode == SECOND_VECTOR_EMPTY:

+            // suballocations continues pointing at AccessSuballocations1st().

+            VMA_ASSERT(!suballocations->empty());

+        }

+        VmaSuballocation& suballoc = (*suballocations)[index];

+        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)

+        {

+            VMA_ASSERT(suballoc.hAllocation != VK_NULL_HANDLE);

+            VMA_ASSERT(suballoc.hAllocation->CanBecomeLost());

+            if(suballoc.hAllocation->MakeLost(currentFrameIndex, frameInUseCount))

+            {

+                suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;

+                suballoc.hAllocation = VK_NULL_HANDLE;

+                m_SumFreeSize += suballoc.size;

+                if(suballocations == &AccessSuballocations1st())

+                {

+                    ++m_1stNullItemsMiddleCount;

+                }

+                else

+                {

+                    ++m_2ndNullItemsCount;

+                }

+                ++madeLostCount;

+            }

+            else

+            {

+                return false;

+            }

+        }

+        ++index;

+    }

+

+    CleanupAfterFree();

+    //VMA_HEAVY_ASSERT(Validate()); // Already called by ClanupAfterFree().

+    

+    return true;

+}

+

+uint32_t VmaBlockMetadata_Linear::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)

+{

+    uint32_t lostAllocationCount = 0;

+    

+    SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+    for(size_t i = m_1stNullItemsBeginCount, count = suballocations1st.size(); i < count; ++i)

+    {

+        VmaSuballocation& suballoc = suballocations1st[i];

+        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE &&

+            suballoc.hAllocation->CanBecomeLost() &&

+            suballoc.hAllocation->MakeLost(currentFrameIndex, frameInUseCount))

+        {

+            suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;

+            suballoc.hAllocation = VK_NULL_HANDLE;

+            ++m_1stNullItemsMiddleCount;

+            m_SumFreeSize += suballoc.size;

+            ++lostAllocationCount;

+        }

+    }

+

+    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+    for(size_t i = 0, count = suballocations2nd.size(); i < count; ++i)

+    {

+        VmaSuballocation& suballoc = suballocations2nd[i];

+        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE &&

+            suballoc.hAllocation->CanBecomeLost() &&

+            suballoc.hAllocation->MakeLost(currentFrameIndex, frameInUseCount))

+        {

+            suballoc.type = VMA_SUBALLOCATION_TYPE_FREE;

+            suballoc.hAllocation = VK_NULL_HANDLE;

+            ++m_2ndNullItemsCount;

+            m_SumFreeSize += suballoc.size;

+            ++lostAllocationCount;

+        }

+    }

+

+    if(lostAllocationCount)

+    {

+        CleanupAfterFree();

+    }

+

+    return lostAllocationCount;

+}

+

+VkResult VmaBlockMetadata_Linear::CheckCorruption(const void* pBlockData)

+{

+    SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+    for(size_t i = m_1stNullItemsBeginCount, count = suballocations1st.size(); i < count; ++i)

+    {

+        const VmaSuballocation& suballoc = suballocations1st[i];

+        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)

+        {

+            if(!VmaValidateMagicValue(pBlockData, suballoc.offset - VMA_DEBUG_MARGIN))

+            {

+                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!");

+                return VK_ERROR_VALIDATION_FAILED_EXT;

+            }

+            if(!VmaValidateMagicValue(pBlockData, suballoc.offset + suballoc.size))

+            {

+                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!");

+                return VK_ERROR_VALIDATION_FAILED_EXT;

+            }

+        }

+    }

+

+    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+    for(size_t i = 0, count = suballocations2nd.size(); i < count; ++i)

+    {

+        const VmaSuballocation& suballoc = suballocations2nd[i];

+        if(suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)

+        {

+            if(!VmaValidateMagicValue(pBlockData, suballoc.offset - VMA_DEBUG_MARGIN))

+            {

+                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED BEFORE VALIDATED ALLOCATION!");

+                return VK_ERROR_VALIDATION_FAILED_EXT;

+            }

+            if(!VmaValidateMagicValue(pBlockData, suballoc.offset + suballoc.size))

+            {

+                VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!");

+                return VK_ERROR_VALIDATION_FAILED_EXT;

+            }

+        }

+    }

+

+    return VK_SUCCESS;

+}

+

+void VmaBlockMetadata_Linear::Alloc(

+    const VmaAllocationRequest& request,

+    VmaSuballocationType type,

+    VkDeviceSize allocSize,

+    VmaAllocation hAllocation)

+{

+    const VmaSuballocation newSuballoc = { request.offset, allocSize, hAllocation, type };

+

+    switch(request.type)

+    {

+    case VmaAllocationRequestType::UpperAddress:

+        {

+            VMA_ASSERT(m_2ndVectorMode != SECOND_VECTOR_RING_BUFFER &&

+                "CRITICAL ERROR: Trying to use linear allocator as double stack while it was already used as ring buffer.");

+            SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+            suballocations2nd.push_back(newSuballoc);

+            m_2ndVectorMode = SECOND_VECTOR_DOUBLE_STACK;

+        }

+        break;

+    case VmaAllocationRequestType::EndOf1st:

+        {

+            SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+

+            VMA_ASSERT(suballocations1st.empty() ||

+                request.offset >= suballocations1st.back().offset + suballocations1st.back().size);

+            // Check if it fits before the end of the block.

+            VMA_ASSERT(request.offset + allocSize <= GetSize());

+

+            suballocations1st.push_back(newSuballoc);

+        }

+        break;

+    case VmaAllocationRequestType::EndOf2nd:

+        {

+            SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+            // New allocation at the end of 2-part ring buffer, so before first allocation from 1st vector.

+            VMA_ASSERT(!suballocations1st.empty() &&

+                request.offset + allocSize <= suballocations1st[m_1stNullItemsBeginCount].offset);

+            SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+

+            switch(m_2ndVectorMode)

+            {

+            case SECOND_VECTOR_EMPTY:

+                // First allocation from second part ring buffer.

+                VMA_ASSERT(suballocations2nd.empty());

+                m_2ndVectorMode = SECOND_VECTOR_RING_BUFFER;

+                break;

+            case SECOND_VECTOR_RING_BUFFER:

+                // 2-part ring buffer is already started.

+                VMA_ASSERT(!suballocations2nd.empty());

+                break;

+            case SECOND_VECTOR_DOUBLE_STACK:

+                VMA_ASSERT(0 && "CRITICAL ERROR: Trying to use linear allocator as ring buffer while it was already used as double stack.");

+                break;

+            default:

+                VMA_ASSERT(0);

+            }

+

+            suballocations2nd.push_back(newSuballoc);

+        }

+        break;

+    default:

+        VMA_ASSERT(0 && "CRITICAL INTERNAL ERROR.");

+    }

+

+    m_SumFreeSize -= newSuballoc.size;

+}

+

+void VmaBlockMetadata_Linear::Free(const VmaAllocation allocation)

+{

+    FreeAtOffset(allocation->GetOffset());

+}

+

+void VmaBlockMetadata_Linear::FreeAtOffset(VkDeviceSize offset)

+{

+    SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+

+    if(!suballocations1st.empty())

+    {

+        // First allocation: Mark it as next empty at the beginning.

+        VmaSuballocation& firstSuballoc = suballocations1st[m_1stNullItemsBeginCount];

+        if(firstSuballoc.offset == offset)

+        {

+            firstSuballoc.type = VMA_SUBALLOCATION_TYPE_FREE;

+            firstSuballoc.hAllocation = VK_NULL_HANDLE;

+            m_SumFreeSize += firstSuballoc.size;

+            ++m_1stNullItemsBeginCount;

+            CleanupAfterFree();

+            return;

+        }

+    }

+

+    // Last allocation in 2-part ring buffer or top of upper stack (same logic).

+    if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER ||

+        m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK)

+    {

+        VmaSuballocation& lastSuballoc = suballocations2nd.back();

+        if(lastSuballoc.offset == offset)

+        {

+            m_SumFreeSize += lastSuballoc.size;

+            suballocations2nd.pop_back();

+            CleanupAfterFree();

+            return;

+        }

+    }

+    // Last allocation in 1st vector.

+    else if(m_2ndVectorMode == SECOND_VECTOR_EMPTY)

+    {

+        VmaSuballocation& lastSuballoc = suballocations1st.back();

+        if(lastSuballoc.offset == offset)

+        {

+            m_SumFreeSize += lastSuballoc.size;

+            suballocations1st.pop_back();

+            CleanupAfterFree();

+            return;

+        }

+    }

+

+    // Item from the middle of 1st vector.

+    {

+        VmaSuballocation refSuballoc;

+        refSuballoc.offset = offset;

+        // Rest of members stays uninitialized intentionally for better performance.

+        SuballocationVectorType::iterator it = VmaBinaryFindSorted(

+            suballocations1st.begin() + m_1stNullItemsBeginCount,

+            suballocations1st.end(),

+            refSuballoc,

+            VmaSuballocationOffsetLess());

+        if(it != suballocations1st.end())

+        {

+            it->type = VMA_SUBALLOCATION_TYPE_FREE;

+            it->hAllocation = VK_NULL_HANDLE;

+            ++m_1stNullItemsMiddleCount;

+            m_SumFreeSize += it->size;

+            CleanupAfterFree();

+            return;

+        }

+    }

+

+    if(m_2ndVectorMode != SECOND_VECTOR_EMPTY)

+    {

+        // Item from the middle of 2nd vector.

+        VmaSuballocation refSuballoc;

+        refSuballoc.offset = offset;

+        // Rest of members stays uninitialized intentionally for better performance.

+        SuballocationVectorType::iterator it = m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER ?

+            VmaBinaryFindSorted(suballocations2nd.begin(), suballocations2nd.end(), refSuballoc, VmaSuballocationOffsetLess()) :

+            VmaBinaryFindSorted(suballocations2nd.begin(), suballocations2nd.end(), refSuballoc, VmaSuballocationOffsetGreater());

+        if(it != suballocations2nd.end())

+        {

+            it->type = VMA_SUBALLOCATION_TYPE_FREE;

+            it->hAllocation = VK_NULL_HANDLE;

+            ++m_2ndNullItemsCount;

+            m_SumFreeSize += it->size;

+            CleanupAfterFree();

+            return;

+        }

+    }

+

+    VMA_ASSERT(0 && "Allocation to free not found in linear allocator!");

+}

+

+bool VmaBlockMetadata_Linear::ShouldCompact1st() const

+{

+    const size_t nullItemCount = m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount;

+    const size_t suballocCount = AccessSuballocations1st().size();

+    return suballocCount > 32 && nullItemCount * 2 >= (suballocCount - nullItemCount) * 3;

+}

+

+void VmaBlockMetadata_Linear::CleanupAfterFree()

+{

+    SuballocationVectorType& suballocations1st = AccessSuballocations1st();

+    SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();

+

+    if(IsEmpty())

+    {

+        suballocations1st.clear();

+        suballocations2nd.clear();

+        m_1stNullItemsBeginCount = 0;

+        m_1stNullItemsMiddleCount = 0;

+        m_2ndNullItemsCount = 0;

+        m_2ndVectorMode = SECOND_VECTOR_EMPTY;

+    }

+    else

+    {

+        const size_t suballoc1stCount = suballocations1st.size();

+        const size_t nullItem1stCount = m_1stNullItemsBeginCount + m_1stNullItemsMiddleCount;

+        VMA_ASSERT(nullItem1stCount <= suballoc1stCount);

+

+        // Find more null items at the beginning of 1st vector.

+        while(m_1stNullItemsBeginCount < suballoc1stCount &&

+            suballocations1st[m_1stNullItemsBeginCount].hAllocation == VK_NULL_HANDLE)

+        {

+            ++m_1stNullItemsBeginCount;

+            --m_1stNullItemsMiddleCount;

+        }

+

+        // Find more null items at the end of 1st vector.

+        while(m_1stNullItemsMiddleCount > 0 &&

+            suballocations1st.back().hAllocation == VK_NULL_HANDLE)

+        {

+            --m_1stNullItemsMiddleCount;

+            suballocations1st.pop_back();

+        }

+

+        // Find more null items at the end of 2nd vector.

+        while(m_2ndNullItemsCount > 0 &&

+            suballocations2nd.back().hAllocation == VK_NULL_HANDLE)

+        {

+            --m_2ndNullItemsCount;

+            suballocations2nd.pop_back();

+        }

+

+        // Find more null items at the beginning of 2nd vector.

+        while(m_2ndNullItemsCount > 0 &&

+            suballocations2nd[0].hAllocation == VK_NULL_HANDLE)

+        {

+            --m_2ndNullItemsCount;

+            VmaVectorRemove(suballocations2nd, 0);

+        }

+

+        if(ShouldCompact1st())

+        {

+            const size_t nonNullItemCount = suballoc1stCount - nullItem1stCount;

+            size_t srcIndex = m_1stNullItemsBeginCount;

+            for(size_t dstIndex = 0; dstIndex < nonNullItemCount; ++dstIndex)

+            {

+                while(suballocations1st[srcIndex].hAllocation == VK_NULL_HANDLE)

+                {

+                    ++srcIndex;

+                }

+                if(dstIndex != srcIndex)

+                {

+                    suballocations1st[dstIndex] = suballocations1st[srcIndex];

+                }

+                ++srcIndex;

+            }

+            suballocations1st.resize(nonNullItemCount);

+            m_1stNullItemsBeginCount = 0;

+            m_1stNullItemsMiddleCount = 0;

+        }

+

+        // 2nd vector became empty.

+        if(suballocations2nd.empty())

+        {

+            m_2ndVectorMode = SECOND_VECTOR_EMPTY;

+        }

+

+        // 1st vector became empty.

+        if(suballocations1st.size() - m_1stNullItemsBeginCount == 0)

+        {

+            suballocations1st.clear();

+            m_1stNullItemsBeginCount = 0;

+

+            if(!suballocations2nd.empty() && m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)

+            {

+                // Swap 1st with 2nd. Now 2nd is empty.

+                m_2ndVectorMode = SECOND_VECTOR_EMPTY;

+                m_1stNullItemsMiddleCount = m_2ndNullItemsCount;

+                while(m_1stNullItemsBeginCount < suballocations2nd.size() &&

+                    suballocations2nd[m_1stNullItemsBeginCount].hAllocation == VK_NULL_HANDLE)

+                {

+                    ++m_1stNullItemsBeginCount;

+                    --m_1stNullItemsMiddleCount;

+                }

+                m_2ndNullItemsCount = 0;

+                m_1stVectorIndex ^= 1;

+            }

+        }

+    }

+

+    VMA_HEAVY_ASSERT(Validate());

+}

+

+

+////////////////////////////////////////////////////////////////////////////////

+// class VmaBlockMetadata_Buddy

+

+VmaBlockMetadata_Buddy::VmaBlockMetadata_Buddy(VmaAllocator hAllocator) :

+    VmaBlockMetadata(hAllocator),

+    m_Root(VMA_NULL),

+    m_AllocationCount(0),

+    m_FreeCount(1),

+    m_SumFreeSize(0)

+{

+    memset(m_FreeList, 0, sizeof(m_FreeList));

+}

+

+VmaBlockMetadata_Buddy::~VmaBlockMetadata_Buddy()

+{

+    DeleteNode(m_Root);

+}

+

+void VmaBlockMetadata_Buddy::Init(VkDeviceSize size)

+{

+    VmaBlockMetadata::Init(size);

+

+    m_UsableSize = VmaPrevPow2(size);

+    m_SumFreeSize = m_UsableSize;

+

+    // Calculate m_LevelCount.

+    m_LevelCount = 1;

+    while(m_LevelCount < MAX_LEVELS &&

+        LevelToNodeSize(m_LevelCount) >= MIN_NODE_SIZE)

+    {

+        ++m_LevelCount;

+    }

+

+    Node* rootNode = vma_new(GetAllocationCallbacks(), Node)();

+    rootNode->offset = 0;

+    rootNode->type = Node::TYPE_FREE;

+    rootNode->parent = VMA_NULL;

+    rootNode->buddy = VMA_NULL;

+

+    m_Root = rootNode;

+    AddToFreeListFront(0, rootNode);

+}

+

+bool VmaBlockMetadata_Buddy::Validate() const

+{

+    // Validate tree.

+    ValidationContext ctx;

+    if(!ValidateNode(ctx, VMA_NULL, m_Root, 0, LevelToNodeSize(0)))

+    {

+        VMA_VALIDATE(false && "ValidateNode failed.");

+    }

+    VMA_VALIDATE(m_AllocationCount == ctx.calculatedAllocationCount);

+    VMA_VALIDATE(m_SumFreeSize == ctx.calculatedSumFreeSize);

+

+    // Validate free node lists.

+    for(uint32_t level = 0; level < m_LevelCount; ++level)

+    {

+        VMA_VALIDATE(m_FreeList[level].front == VMA_NULL ||

+            m_FreeList[level].front->free.prev == VMA_NULL);

+

+        for(Node* node = m_FreeList[level].front;

+            node != VMA_NULL;

+            node = node->free.next)

+        {

+            VMA_VALIDATE(node->type == Node::TYPE_FREE);

+            

+            if(node->free.next == VMA_NULL)

+            {

+                VMA_VALIDATE(m_FreeList[level].back == node);

+            }

+            else

+            {

+                VMA_VALIDATE(node->free.next->free.prev == node);

+            }

+        }

+    }

+

+    // Validate that free lists ar higher levels are empty.

+    for(uint32_t level = m_LevelCount; level < MAX_LEVELS; ++level)

+    {

+        VMA_VALIDATE(m_FreeList[level].front == VMA_NULL && m_FreeList[level].back == VMA_NULL);

+    }

+

+    return true;

+}

+

+VkDeviceSize VmaBlockMetadata_Buddy::GetUnusedRangeSizeMax() const

+{

+    for(uint32_t level = 0; level < m_LevelCount; ++level)

+    {

+        if(m_FreeList[level].front != VMA_NULL)

+        {

+            return LevelToNodeSize(level);

+        }

+    }

+    return 0;

+}

+

+void VmaBlockMetadata_Buddy::CalcAllocationStatInfo(VmaStatInfo& outInfo) const

+{

+    const VkDeviceSize unusableSize = GetUnusableSize();

+

+    outInfo.blockCount = 1;

+

+    outInfo.allocationCount = outInfo.unusedRangeCount = 0;

+    outInfo.usedBytes = outInfo.unusedBytes = 0;

+

+    outInfo.allocationSizeMax = outInfo.unusedRangeSizeMax = 0;

+    outInfo.allocationSizeMin = outInfo.unusedRangeSizeMin = UINT64_MAX;

+    outInfo.allocationSizeAvg = outInfo.unusedRangeSizeAvg = 0; // Unused.

+

+    CalcAllocationStatInfoNode(outInfo, m_Root, LevelToNodeSize(0));

+

+    if(unusableSize > 0)

+    {

+        ++outInfo.unusedRangeCount;

+        outInfo.unusedBytes += unusableSize;

+        outInfo.unusedRangeSizeMax = VMA_MAX(outInfo.unusedRangeSizeMax, unusableSize);

+        outInfo.unusedRangeSizeMin = VMA_MIN(outInfo.unusedRangeSizeMin, unusableSize);

+    }

+}

+

+void VmaBlockMetadata_Buddy::AddPoolStats(VmaPoolStats& inoutStats) const

+{

+    const VkDeviceSize unusableSize = GetUnusableSize();

+

+    inoutStats.size += GetSize();

+    inoutStats.unusedSize += m_SumFreeSize + unusableSize;

+    inoutStats.allocationCount += m_AllocationCount;

+    inoutStats.unusedRangeCount += m_FreeCount;

+    inoutStats.unusedRangeSizeMax = VMA_MAX(inoutStats.unusedRangeSizeMax, GetUnusedRangeSizeMax());

+

+    if(unusableSize > 0)

+    {

+        ++inoutStats.unusedRangeCount;

+        // Not updating inoutStats.unusedRangeSizeMax with unusableSize because this space is not available for allocations.

+    }

+}

+

+#if VMA_STATS_STRING_ENABLED

+

+void VmaBlockMetadata_Buddy::PrintDetailedMap(class VmaJsonWriter& json) const

+{

+    // TODO optimize

+    VmaStatInfo stat;

+    CalcAllocationStatInfo(stat);

+

+    PrintDetailedMap_Begin(

+        json,

+        stat.unusedBytes,

+        stat.allocationCount,

+        stat.unusedRangeCount);

+

+    PrintDetailedMapNode(json, m_Root, LevelToNodeSize(0));

+

+    const VkDeviceSize unusableSize = GetUnusableSize();

+    if(unusableSize > 0)

+    {

+        PrintDetailedMap_UnusedRange(json,

+            m_UsableSize, // offset

+            unusableSize); // size

+    }

+

+    PrintDetailedMap_End(json);

+}

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+bool VmaBlockMetadata_Buddy::CreateAllocationRequest(

+    uint32_t currentFrameIndex,

+    uint32_t frameInUseCount,

+    VkDeviceSize bufferImageGranularity,

+    VkDeviceSize allocSize,

+    VkDeviceSize allocAlignment,

+    bool upperAddress,

+    VmaSuballocationType allocType,

+    bool canMakeOtherLost,

+    uint32_t strategy,

+    VmaAllocationRequest* pAllocationRequest)

+{

+    VMA_ASSERT(!upperAddress && "VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT can be used only with linear algorithm.");

+

+    // Simple way to respect bufferImageGranularity. May be optimized some day.

+    // Whenever it might be an OPTIMAL image...

+    if(allocType == VMA_SUBALLOCATION_TYPE_UNKNOWN ||

+        allocType == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||

+        allocType == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL)

+    {

+        allocAlignment = VMA_MAX(allocAlignment, bufferImageGranularity);

+        allocSize = VMA_MAX(allocSize, bufferImageGranularity);

+    }

+

+    if(allocSize > m_UsableSize)

+    {

+        return false;

+    }

+

+    const uint32_t targetLevel = AllocSizeToLevel(allocSize);

+    for(uint32_t level = targetLevel + 1; level--; )

+    {

+        for(Node* freeNode = m_FreeList[level].front;

+            freeNode != VMA_NULL;

+            freeNode = freeNode->free.next)

+        {

+            if(freeNode->offset % allocAlignment == 0)

+            {

+                pAllocationRequest->type = VmaAllocationRequestType::Normal;

+                pAllocationRequest->offset = freeNode->offset;

+                pAllocationRequest->sumFreeSize = LevelToNodeSize(level);

+                pAllocationRequest->sumItemSize = 0;

+                pAllocationRequest->itemsToMakeLostCount = 0;

+                pAllocationRequest->customData = (void*)(uintptr_t)level;

+                return true;

+            }

+        }

+    }

+

+    return false;

+}

+

+bool VmaBlockMetadata_Buddy::MakeRequestedAllocationsLost(

+    uint32_t currentFrameIndex,

+    uint32_t frameInUseCount,

+    VmaAllocationRequest* pAllocationRequest)

+{

+    /*

+    Lost allocations are not supported in buddy allocator at the moment.

+    Support might be added in the future.

+    */

+    return pAllocationRequest->itemsToMakeLostCount == 0;

+}

+

+uint32_t VmaBlockMetadata_Buddy::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)

+{

+    /*

+    Lost allocations are not supported in buddy allocator at the moment.

+    Support might be added in the future.

+    */

+    return 0;

+}

+

+void VmaBlockMetadata_Buddy::Alloc(

+    const VmaAllocationRequest& request,

+    VmaSuballocationType type,

+    VkDeviceSize allocSize,

+    VmaAllocation hAllocation)

+{

+    VMA_ASSERT(request.type == VmaAllocationRequestType::Normal);

+

+    const uint32_t targetLevel = AllocSizeToLevel(allocSize);

+    uint32_t currLevel = (uint32_t)(uintptr_t)request.customData;

+    

+    Node* currNode = m_FreeList[currLevel].front;

+    VMA_ASSERT(currNode != VMA_NULL && currNode->type == Node::TYPE_FREE);

+    while(currNode->offset != request.offset)

+    {

+        currNode = currNode->free.next;

+        VMA_ASSERT(currNode != VMA_NULL && currNode->type == Node::TYPE_FREE);

+    }

+    

+    // Go down, splitting free nodes.

+    while(currLevel < targetLevel)

+    {

+        // currNode is already first free node at currLevel.

+        // Remove it from list of free nodes at this currLevel.

+        RemoveFromFreeList(currLevel, currNode);

+         

+        const uint32_t childrenLevel = currLevel + 1;

+

+        // Create two free sub-nodes.

+        Node* leftChild = vma_new(GetAllocationCallbacks(), Node)();

+        Node* rightChild = vma_new(GetAllocationCallbacks(), Node)();

+

+        leftChild->offset = currNode->offset;

+        leftChild->type = Node::TYPE_FREE;

+        leftChild->parent = currNode;

+        leftChild->buddy = rightChild;

+

+        rightChild->offset = currNode->offset + LevelToNodeSize(childrenLevel);

+        rightChild->type = Node::TYPE_FREE;

+        rightChild->parent = currNode;

+        rightChild->buddy = leftChild;

+

+        // Convert current currNode to split type.

+        currNode->type = Node::TYPE_SPLIT;

+        currNode->split.leftChild = leftChild;

+

+        // Add child nodes to free list. Order is important!

+        AddToFreeListFront(childrenLevel, rightChild);

+        AddToFreeListFront(childrenLevel, leftChild);

+

+        ++m_FreeCount;

+        //m_SumFreeSize -= LevelToNodeSize(currLevel) % 2; // Useful only when level node sizes can be non power of 2.

+        ++currLevel;

+        currNode = m_FreeList[currLevel].front;

+

+        /*

+        We can be sure that currNode, as left child of node previously split,

+        also fullfills the alignment requirement.

+        */

+    }

+

+    // Remove from free list.

+    VMA_ASSERT(currLevel == targetLevel &&

+        currNode != VMA_NULL &&

+        currNode->type == Node::TYPE_FREE);

+    RemoveFromFreeList(currLevel, currNode);

+

+    // Convert to allocation node.

+    currNode->type = Node::TYPE_ALLOCATION;

+    currNode->allocation.alloc = hAllocation;

+

+    ++m_AllocationCount;

+    --m_FreeCount;

+    m_SumFreeSize -= allocSize;

+}

+

+void VmaBlockMetadata_Buddy::DeleteNode(Node* node)

+{

+    if(node->type == Node::TYPE_SPLIT)

+    {

+        DeleteNode(node->split.leftChild->buddy);

+        DeleteNode(node->split.leftChild);

+    }

+

+    vma_delete(GetAllocationCallbacks(), node);

+}

+

+bool VmaBlockMetadata_Buddy::ValidateNode(ValidationContext& ctx, const Node* parent, const Node* curr, uint32_t level, VkDeviceSize levelNodeSize) const

+{

+    VMA_VALIDATE(level < m_LevelCount);

+    VMA_VALIDATE(curr->parent == parent);

+    VMA_VALIDATE((curr->buddy == VMA_NULL) == (parent == VMA_NULL));

+    VMA_VALIDATE(curr->buddy == VMA_NULL || curr->buddy->buddy == curr);

+    switch(curr->type)

+    {

+    case Node::TYPE_FREE:

+        // curr->free.prev, next are validated separately.

+        ctx.calculatedSumFreeSize += levelNodeSize;

+        ++ctx.calculatedFreeCount;

+        break;

+    case Node::TYPE_ALLOCATION:

+        ++ctx.calculatedAllocationCount;

+        ctx.calculatedSumFreeSize += levelNodeSize - curr->allocation.alloc->GetSize();

+        VMA_VALIDATE(curr->allocation.alloc != VK_NULL_HANDLE);

+        break;

+    case Node::TYPE_SPLIT:

+        {

+            const uint32_t childrenLevel = level + 1;

+            const VkDeviceSize childrenLevelNodeSize = levelNodeSize / 2;

+            const Node* const leftChild = curr->split.leftChild;

+            VMA_VALIDATE(leftChild != VMA_NULL);

+            VMA_VALIDATE(leftChild->offset == curr->offset);

+            if(!ValidateNode(ctx, curr, leftChild, childrenLevel, childrenLevelNodeSize))

+            {

+                VMA_VALIDATE(false && "ValidateNode for left child failed.");

+            }

+            const Node* const rightChild = leftChild->buddy;

+            VMA_VALIDATE(rightChild->offset == curr->offset + childrenLevelNodeSize);

+            if(!ValidateNode(ctx, curr, rightChild, childrenLevel, childrenLevelNodeSize))

+            {

+                VMA_VALIDATE(false && "ValidateNode for right child failed.");

+            }

+        }

+        break;

+    default:

+        return false;

+    }

+

+    return true;

+}

+

+uint32_t VmaBlockMetadata_Buddy::AllocSizeToLevel(VkDeviceSize allocSize) const

+{

+    // I know this could be optimized somehow e.g. by using std::log2p1 from C++20.

+    uint32_t level = 0;

+    VkDeviceSize currLevelNodeSize = m_UsableSize;

+    VkDeviceSize nextLevelNodeSize = currLevelNodeSize >> 1;

+    while(allocSize <= nextLevelNodeSize && level + 1 < m_LevelCount)

+    {

+        ++level;

+        currLevelNodeSize = nextLevelNodeSize;

+        nextLevelNodeSize = currLevelNodeSize >> 1;

+    }

+    return level;

+}

+

+void VmaBlockMetadata_Buddy::FreeAtOffset(VmaAllocation alloc, VkDeviceSize offset)

+{

+    // Find node and level.

+    Node* node = m_Root;

+    VkDeviceSize nodeOffset = 0;

+    uint32_t level = 0;

+    VkDeviceSize levelNodeSize = LevelToNodeSize(0);

+    while(node->type == Node::TYPE_SPLIT)

+    {

+        const VkDeviceSize nextLevelSize = levelNodeSize >> 1;

+        if(offset < nodeOffset + nextLevelSize)

+        {

+            node = node->split.leftChild;

+        }

+        else

+        {

+            node = node->split.leftChild->buddy;

+            nodeOffset += nextLevelSize;

+        }

+        ++level;

+        levelNodeSize = nextLevelSize;

+    }

+

+    VMA_ASSERT(node != VMA_NULL && node->type == Node::TYPE_ALLOCATION);

+    VMA_ASSERT(alloc == VK_NULL_HANDLE || node->allocation.alloc == alloc);

+

+    ++m_FreeCount;

+    --m_AllocationCount;

+    m_SumFreeSize += alloc->GetSize();

+

+    node->type = Node::TYPE_FREE;

+

+    // Join free nodes if possible.

+    while(level > 0 && node->buddy->type == Node::TYPE_FREE)

+    {

+        RemoveFromFreeList(level, node->buddy);

+        Node* const parent = node->parent;

+

+        vma_delete(GetAllocationCallbacks(), node->buddy);

+        vma_delete(GetAllocationCallbacks(), node);

+        parent->type = Node::TYPE_FREE;

+        

+        node = parent;

+        --level;

+        //m_SumFreeSize += LevelToNodeSize(level) % 2; // Useful only when level node sizes can be non power of 2.

+        --m_FreeCount;

+    }

+

+    AddToFreeListFront(level, node);

+}

+

+void VmaBlockMetadata_Buddy::CalcAllocationStatInfoNode(VmaStatInfo& outInfo, const Node* node, VkDeviceSize levelNodeSize) const

+{

+    switch(node->type)

+    {

+    case Node::TYPE_FREE:

+        ++outInfo.unusedRangeCount;

+        outInfo.unusedBytes += levelNodeSize;

+        outInfo.unusedRangeSizeMax = VMA_MAX(outInfo.unusedRangeSizeMax, levelNodeSize);

+        outInfo.unusedRangeSizeMin = VMA_MAX(outInfo.unusedRangeSizeMin, levelNodeSize);

+        break;

+    case Node::TYPE_ALLOCATION:

+        {

+            const VkDeviceSize allocSize = node->allocation.alloc->GetSize();

+            ++outInfo.allocationCount;

+            outInfo.usedBytes += allocSize;

+            outInfo.allocationSizeMax = VMA_MAX(outInfo.allocationSizeMax, allocSize);

+            outInfo.allocationSizeMin = VMA_MAX(outInfo.allocationSizeMin, allocSize);

+

+            const VkDeviceSize unusedRangeSize = levelNodeSize - allocSize;

+            if(unusedRangeSize > 0)

+            {

+                ++outInfo.unusedRangeCount;

+                outInfo.unusedBytes += unusedRangeSize;

+                outInfo.unusedRangeSizeMax = VMA_MAX(outInfo.unusedRangeSizeMax, unusedRangeSize);

+                outInfo.unusedRangeSizeMin = VMA_MAX(outInfo.unusedRangeSizeMin, unusedRangeSize);

+            }

+        }

+        break;

+    case Node::TYPE_SPLIT:

+        {

+            const VkDeviceSize childrenNodeSize = levelNodeSize / 2;

+            const Node* const leftChild = node->split.leftChild;

+            CalcAllocationStatInfoNode(outInfo, leftChild, childrenNodeSize);

+            const Node* const rightChild = leftChild->buddy;

+            CalcAllocationStatInfoNode(outInfo, rightChild, childrenNodeSize);

+        }

+        break;

+    default:

+        VMA_ASSERT(0);

+    }

+}

+

+void VmaBlockMetadata_Buddy::AddToFreeListFront(uint32_t level, Node* node)

+{

+    VMA_ASSERT(node->type == Node::TYPE_FREE);

+

+    // List is empty.

+    Node* const frontNode = m_FreeList[level].front;

+    if(frontNode == VMA_NULL)

+    {

+        VMA_ASSERT(m_FreeList[level].back == VMA_NULL);

+        node->free.prev = node->free.next = VMA_NULL;

+        m_FreeList[level].front = m_FreeList[level].back = node;

+    }

+    else

+    {

+        VMA_ASSERT(frontNode->free.prev == VMA_NULL);

+        node->free.prev = VMA_NULL;

+        node->free.next = frontNode;

+        frontNode->free.prev = node;

+        m_FreeList[level].front = node;

+    }

+}

+

+void VmaBlockMetadata_Buddy::RemoveFromFreeList(uint32_t level, Node* node)

+{

+    VMA_ASSERT(m_FreeList[level].front != VMA_NULL);

+

+    // It is at the front.

+    if(node->free.prev == VMA_NULL)

+    {

+        VMA_ASSERT(m_FreeList[level].front == node);

+        m_FreeList[level].front = node->free.next;

+    }

+    else

+    {

+        Node* const prevFreeNode = node->free.prev;

+        VMA_ASSERT(prevFreeNode->free.next == node);

+        prevFreeNode->free.next = node->free.next;

+    }

+

+    // It is at the back.

+    if(node->free.next == VMA_NULL)

+    {

+        VMA_ASSERT(m_FreeList[level].back == node);

+        m_FreeList[level].back = node->free.prev;

+    }

+    else

+    {

+        Node* const nextFreeNode = node->free.next;

+        VMA_ASSERT(nextFreeNode->free.prev == node);

+        nextFreeNode->free.prev = node->free.prev;

+    }

+}

+

+#if VMA_STATS_STRING_ENABLED

+void VmaBlockMetadata_Buddy::PrintDetailedMapNode(class VmaJsonWriter& json, const Node* node, VkDeviceSize levelNodeSize) const

+{

+    switch(node->type)

+    {

+    case Node::TYPE_FREE:

+        PrintDetailedMap_UnusedRange(json, node->offset, levelNodeSize);

+        break;

+    case Node::TYPE_ALLOCATION:

+        {   

+            PrintDetailedMap_Allocation(json, node->offset, node->allocation.alloc);

+            const VkDeviceSize allocSize = node->allocation.alloc->GetSize();

+            if(allocSize < levelNodeSize)

+            {

+                PrintDetailedMap_UnusedRange(json, node->offset + allocSize, levelNodeSize - allocSize);

+            }

+        }

+        break;

+    case Node::TYPE_SPLIT:

+        {

+            const VkDeviceSize childrenNodeSize = levelNodeSize / 2;

+            const Node* const leftChild = node->split.leftChild;

+            PrintDetailedMapNode(json, leftChild, childrenNodeSize);

+            const Node* const rightChild = leftChild->buddy;

+            PrintDetailedMapNode(json, rightChild, childrenNodeSize);

+        }

+        break;

+    default:

+        VMA_ASSERT(0);

+    }

+}

+#endif // #if VMA_STATS_STRING_ENABLED

+

+

+////////////////////////////////////////////////////////////////////////////////

+// class VmaDeviceMemoryBlock

+

+VmaDeviceMemoryBlock::VmaDeviceMemoryBlock(VmaAllocator hAllocator) :

+    m_pMetadata(VMA_NULL),

+    m_MemoryTypeIndex(UINT32_MAX),

+    m_Id(0),

+    m_hMemory(VK_NULL_HANDLE),

+    m_MapCount(0),

+    m_pMappedData(VMA_NULL)

+{

+}

+

+void VmaDeviceMemoryBlock::Init(

+    VmaAllocator hAllocator,

+    VmaPool hParentPool,

+    uint32_t newMemoryTypeIndex,

+    VkDeviceMemory newMemory,

+    VkDeviceSize newSize,

+    uint32_t id,

+    uint32_t algorithm)

+{

+    VMA_ASSERT(m_hMemory == VK_NULL_HANDLE);

+

+    m_hParentPool = hParentPool;

+    m_MemoryTypeIndex = newMemoryTypeIndex;

+    m_Id = id;

+    m_hMemory = newMemory;

+

+    switch(algorithm)

+    {

+    case VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT:

+        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Linear)(hAllocator);

+        break;

+    case VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT:

+        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Buddy)(hAllocator);

+        break;

+    default:

+        VMA_ASSERT(0);

+        // Fall-through.

+    case 0:

+        m_pMetadata = vma_new(hAllocator, VmaBlockMetadata_Generic)(hAllocator);

+    }

+    m_pMetadata->Init(newSize);

+}

+

+void VmaDeviceMemoryBlock::Destroy(VmaAllocator allocator)

+{

+    // This is the most important assert in the entire library.

+    // Hitting it means you have some memory leak - unreleased VmaAllocation objects.

+    VMA_ASSERT(m_pMetadata->IsEmpty() && "Some allocations were not freed before destruction of this memory block!");

+

+    VMA_ASSERT(m_hMemory != VK_NULL_HANDLE);

+    allocator->FreeVulkanMemory(m_MemoryTypeIndex, m_pMetadata->GetSize(), m_hMemory);

+    m_hMemory = VK_NULL_HANDLE;

+

+    vma_delete(allocator, m_pMetadata);

+    m_pMetadata = VMA_NULL;

+}

+

+bool VmaDeviceMemoryBlock::Validate() const

+{

+    VMA_VALIDATE((m_hMemory != VK_NULL_HANDLE) &&

+        (m_pMetadata->GetSize() != 0));

+    

+    return m_pMetadata->Validate();

+}

+

+VkResult VmaDeviceMemoryBlock::CheckCorruption(VmaAllocator hAllocator)

+{

+    void* pData = nullptr;

+    VkResult res = Map(hAllocator, 1, &pData);

+    if(res != VK_SUCCESS)

+    {

+        return res;

+    }

+

+    res = m_pMetadata->CheckCorruption(pData);

+

+    Unmap(hAllocator, 1);

+

+    return res;

+}

+

+VkResult VmaDeviceMemoryBlock::Map(VmaAllocator hAllocator, uint32_t count, void** ppData)

+{

+    if(count == 0)

+    {

+        return VK_SUCCESS;

+    }

+

+    VmaMutexLock lock(m_Mutex, hAllocator->m_UseMutex);

+    if(m_MapCount != 0)

+    {

+        m_MapCount += count;

+        VMA_ASSERT(m_pMappedData != VMA_NULL);

+        if(ppData != VMA_NULL)

+        {

+            *ppData = m_pMappedData;

+        }

+        return VK_SUCCESS;

+    }

+    else

+    {

+        VkResult result = (*hAllocator->GetVulkanFunctions().vkMapMemory)(

+            hAllocator->m_hDevice,

+            m_hMemory,

+            0, // offset

+            VK_WHOLE_SIZE,

+            0, // flags

+            &m_pMappedData);

+        if(result == VK_SUCCESS)

+        {

+            if(ppData != VMA_NULL)

+            {

+                *ppData = m_pMappedData;

+            }

+            m_MapCount = count;

+        }

+        return result;

+    }

+}

+

+void VmaDeviceMemoryBlock::Unmap(VmaAllocator hAllocator, uint32_t count)

+{

+    if(count == 0)

+    {

+        return;

+    }

+

+    VmaMutexLock lock(m_Mutex, hAllocator->m_UseMutex);

+    if(m_MapCount >= count)

+    {

+        m_MapCount -= count;

+        if(m_MapCount == 0)

+        {

+            m_pMappedData = VMA_NULL;

+            (*hAllocator->GetVulkanFunctions().vkUnmapMemory)(hAllocator->m_hDevice, m_hMemory);

+        }

+    }

+    else

+    {

+        VMA_ASSERT(0 && "VkDeviceMemory block is being unmapped while it was not previously mapped.");

+    }

+}

+

+VkResult VmaDeviceMemoryBlock::WriteMagicValueAroundAllocation(VmaAllocator hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize)

+{

+    VMA_ASSERT(VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_MARGIN % 4 == 0 && VMA_DEBUG_DETECT_CORRUPTION);

+    VMA_ASSERT(allocOffset >= VMA_DEBUG_MARGIN);

+

+    void* pData;

+    VkResult res = Map(hAllocator, 1, &pData);

+    if(res != VK_SUCCESS)

+    {

+        return res;

+    }

+

+    VmaWriteMagicValue(pData, allocOffset - VMA_DEBUG_MARGIN);

+    VmaWriteMagicValue(pData, allocOffset + allocSize);

+

+    Unmap(hAllocator, 1);

+

+    return VK_SUCCESS;

+}

+

+VkResult VmaDeviceMemoryBlock::ValidateMagicValueAroundAllocation(VmaAllocator hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize)

+{

+    VMA_ASSERT(VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_MARGIN % 4 == 0 && VMA_DEBUG_DETECT_CORRUPTION);

+    VMA_ASSERT(allocOffset >= VMA_DEBUG_MARGIN);

+

+    void* pData;

+    VkResult res = Map(hAllocator, 1, &pData);

+    if(res != VK_SUCCESS)

+    {

+        return res;

+    }

+

+    if(!VmaValidateMagicValue(pData, allocOffset - VMA_DEBUG_MARGIN))

+    {

+        VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED BEFORE FREED ALLOCATION!");

+    }

+    else if(!VmaValidateMagicValue(pData, allocOffset + allocSize))

+    {

+        VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED AFTER FREED ALLOCATION!");

+    }

+

+    Unmap(hAllocator, 1);

+

+    return VK_SUCCESS;

+}

+

+VkResult VmaDeviceMemoryBlock::BindBufferMemory(

+    const VmaAllocator hAllocator,

+    const VmaAllocation hAllocation,

+    VkDeviceSize allocationLocalOffset,

+    VkBuffer hBuffer,

+    const void* pNext)

+{

+    VMA_ASSERT(hAllocation->GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK &&

+        hAllocation->GetBlock() == this);

+    VMA_ASSERT(allocationLocalOffset < hAllocation->GetSize() &&

+        "Invalid allocationLocalOffset. Did you forget that this offset is relative to the beginning of the allocation, not the whole memory block?");

+    const VkDeviceSize memoryOffset = hAllocation->GetOffset() + allocationLocalOffset;

+    // This lock is important so that we don't call vkBind... and/or vkMap... simultaneously on the same VkDeviceMemory from multiple threads.

+    VmaMutexLock lock(m_Mutex, hAllocator->m_UseMutex);

+    return hAllocator->BindVulkanBuffer(m_hMemory, memoryOffset, hBuffer, pNext);

+}

+

+VkResult VmaDeviceMemoryBlock::BindImageMemory(

+    const VmaAllocator hAllocator,

+    const VmaAllocation hAllocation,

+    VkDeviceSize allocationLocalOffset,

+    VkImage hImage,

+    const void* pNext)

+{

+    VMA_ASSERT(hAllocation->GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK &&

+        hAllocation->GetBlock() == this);

+    VMA_ASSERT(allocationLocalOffset < hAllocation->GetSize() &&

+        "Invalid allocationLocalOffset. Did you forget that this offset is relative to the beginning of the allocation, not the whole memory block?");

+    const VkDeviceSize memoryOffset = hAllocation->GetOffset() + allocationLocalOffset;

+    // This lock is important so that we don't call vkBind... and/or vkMap... simultaneously on the same VkDeviceMemory from multiple threads.

+    VmaMutexLock lock(m_Mutex, hAllocator->m_UseMutex);

+    return hAllocator->BindVulkanImage(m_hMemory, memoryOffset, hImage, pNext);

+}

+

+static void InitStatInfo(VmaStatInfo& outInfo)

+{

+    memset(&outInfo, 0, sizeof(outInfo));

+    outInfo.allocationSizeMin = UINT64_MAX;

+    outInfo.unusedRangeSizeMin = UINT64_MAX;

+}

+

+// Adds statistics srcInfo into inoutInfo, like: inoutInfo += srcInfo.

+static void VmaAddStatInfo(VmaStatInfo& inoutInfo, const VmaStatInfo& srcInfo)

+{

+    inoutInfo.blockCount += srcInfo.blockCount;

+    inoutInfo.allocationCount += srcInfo.allocationCount;

+    inoutInfo.unusedRangeCount += srcInfo.unusedRangeCount;

+    inoutInfo.usedBytes += srcInfo.usedBytes;

+    inoutInfo.unusedBytes += srcInfo.unusedBytes;

+    inoutInfo.allocationSizeMin = VMA_MIN(inoutInfo.allocationSizeMin, srcInfo.allocationSizeMin);

+    inoutInfo.allocationSizeMax = VMA_MAX(inoutInfo.allocationSizeMax, srcInfo.allocationSizeMax);

+    inoutInfo.unusedRangeSizeMin = VMA_MIN(inoutInfo.unusedRangeSizeMin, srcInfo.unusedRangeSizeMin);

+    inoutInfo.unusedRangeSizeMax = VMA_MAX(inoutInfo.unusedRangeSizeMax, srcInfo.unusedRangeSizeMax);

+}

+

+static void VmaPostprocessCalcStatInfo(VmaStatInfo& inoutInfo)

+{

+    inoutInfo.allocationSizeAvg = (inoutInfo.allocationCount > 0) ?

+        VmaRoundDiv<VkDeviceSize>(inoutInfo.usedBytes, inoutInfo.allocationCount) : 0;

+    inoutInfo.unusedRangeSizeAvg = (inoutInfo.unusedRangeCount > 0) ?

+        VmaRoundDiv<VkDeviceSize>(inoutInfo.unusedBytes, inoutInfo.unusedRangeCount) : 0;

+}

+

+VmaPool_T::VmaPool_T(

+    VmaAllocator hAllocator,

+    const VmaPoolCreateInfo& createInfo,

+    VkDeviceSize preferredBlockSize) :

+    m_BlockVector(

+        hAllocator,

+        this, // hParentPool

+        createInfo.memoryTypeIndex,

+        createInfo.blockSize != 0 ? createInfo.blockSize : preferredBlockSize,

+        createInfo.minBlockCount,

+        createInfo.maxBlockCount,

+        (createInfo.flags & VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT) != 0 ? 1 : hAllocator->GetBufferImageGranularity(),

+        createInfo.frameInUseCount,

+        createInfo.blockSize != 0, // explicitBlockSize

+        createInfo.flags & VMA_POOL_CREATE_ALGORITHM_MASK), // algorithm

+    m_Id(0),

+    m_Name(VMA_NULL)

+{

+}

+

+VmaPool_T::~VmaPool_T()

+{

+}

+

+void VmaPool_T::SetName(const char* pName)

+{

+    const VkAllocationCallbacks* allocs = m_BlockVector.GetAllocator()->GetAllocationCallbacks();

+    VmaFreeString(allocs, m_Name);

+    

+    if(pName != VMA_NULL)

+    {

+        m_Name = VmaCreateStringCopy(allocs, pName);

+    }

+    else

+    {

+        m_Name = VMA_NULL;

+    }

+}

+

+#if VMA_STATS_STRING_ENABLED

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+VmaBlockVector::VmaBlockVector(

+    VmaAllocator hAllocator,

+    VmaPool hParentPool,

+    uint32_t memoryTypeIndex,

+    VkDeviceSize preferredBlockSize,

+    size_t minBlockCount,

+    size_t maxBlockCount,

+    VkDeviceSize bufferImageGranularity,

+    uint32_t frameInUseCount,

+    bool explicitBlockSize,

+    uint32_t algorithm) :

+    m_hAllocator(hAllocator),

+    m_hParentPool(hParentPool),

+    m_MemoryTypeIndex(memoryTypeIndex),

+    m_PreferredBlockSize(preferredBlockSize),

+    m_MinBlockCount(minBlockCount),

+    m_MaxBlockCount(maxBlockCount),

+    m_BufferImageGranularity(bufferImageGranularity),

+    m_FrameInUseCount(frameInUseCount),

+    m_ExplicitBlockSize(explicitBlockSize),

+    m_Algorithm(algorithm),

+    m_HasEmptyBlock(false),

+    m_Blocks(VmaStlAllocator<VmaDeviceMemoryBlock*>(hAllocator->GetAllocationCallbacks())),

+    m_NextBlockId(0)

+{

+}

+

+VmaBlockVector::~VmaBlockVector()

+{

+    for(size_t i = m_Blocks.size(); i--; )

+    {

+        m_Blocks[i]->Destroy(m_hAllocator);

+        vma_delete(m_hAllocator, m_Blocks[i]);

+    }

+}

+

+VkResult VmaBlockVector::CreateMinBlocks()

+{

+    for(size_t i = 0; i < m_MinBlockCount; ++i)

+    {

+        VkResult res = CreateBlock(m_PreferredBlockSize, VMA_NULL);

+        if(res != VK_SUCCESS)

+        {

+            return res;

+        }

+    }

+    return VK_SUCCESS;

+}

+

+void VmaBlockVector::GetPoolStats(VmaPoolStats* pStats)

+{

+    VmaMutexLockRead lock(m_Mutex, m_hAllocator->m_UseMutex);

+

+    const size_t blockCount = m_Blocks.size();

+

+    pStats->size = 0;

+    pStats->unusedSize = 0;

+    pStats->allocationCount = 0;

+    pStats->unusedRangeCount = 0;

+    pStats->unusedRangeSizeMax = 0;

+    pStats->blockCount = blockCount;

+

+    for(uint32_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)

+    {

+        const VmaDeviceMemoryBlock* const pBlock = m_Blocks[blockIndex];

+        VMA_ASSERT(pBlock);

+        VMA_HEAVY_ASSERT(pBlock->Validate());

+        pBlock->m_pMetadata->AddPoolStats(*pStats);

+    }

+}

+

+bool VmaBlockVector::IsEmpty()

+{

+    VmaMutexLockRead lock(m_Mutex, m_hAllocator->m_UseMutex);

+    return m_Blocks.empty();

+}

+

+bool VmaBlockVector::IsCorruptionDetectionEnabled() const

+{

+    const uint32_t requiredMemFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;

+    return (VMA_DEBUG_DETECT_CORRUPTION != 0) &&

+        (VMA_DEBUG_MARGIN > 0) &&

+        (m_Algorithm == 0 || m_Algorithm == VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT) &&

+        (m_hAllocator->m_MemProps.memoryTypes[m_MemoryTypeIndex].propertyFlags & requiredMemFlags) == requiredMemFlags;

+}

+

+static const uint32_t VMA_ALLOCATION_TRY_COUNT = 32;

+

+VkResult VmaBlockVector::Allocate(

+    uint32_t currentFrameIndex,

+    VkDeviceSize size,

+    VkDeviceSize alignment,

+    const VmaAllocationCreateInfo& createInfo,

+    VmaSuballocationType suballocType,

+    size_t allocationCount,

+    VmaAllocation* pAllocations)

+{

+    size_t allocIndex;

+    VkResult res = VK_SUCCESS;

+

+    if(IsCorruptionDetectionEnabled())

+    {

+        size = VmaAlignUp<VkDeviceSize>(size, sizeof(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));

+        alignment = VmaAlignUp<VkDeviceSize>(alignment, sizeof(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));

+    }

+

+    {

+        VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);

+        for(allocIndex = 0; allocIndex < allocationCount; ++allocIndex)

+        {

+            res = AllocatePage(

+                currentFrameIndex,

+                size,

+                alignment,

+                createInfo,

+                suballocType,

+                pAllocations + allocIndex);

+            if(res != VK_SUCCESS)

+            {

+                break;

+            }

+        }

+    }

+

+    if(res != VK_SUCCESS)

+    {

+        // Free all already created allocations.

+        while(allocIndex--)

+        {

+            Free(pAllocations[allocIndex]);

+        }

+        memset(pAllocations, 0, sizeof(VmaAllocation) * allocationCount);

+    }

+

+    return res;

+}

+

+VkResult VmaBlockVector::AllocatePage(

+    uint32_t currentFrameIndex,

+    VkDeviceSize size,

+    VkDeviceSize alignment,

+    const VmaAllocationCreateInfo& createInfo,

+    VmaSuballocationType suballocType,

+    VmaAllocation* pAllocation)

+{

+    const bool isUpperAddress = (createInfo.flags & VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT) != 0;

+    bool canMakeOtherLost = (createInfo.flags & VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT) != 0;

+    const bool mapped = (createInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0;

+    const bool isUserDataString = (createInfo.flags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0;

+    

+    VkDeviceSize freeMemory;

+    {

+        const uint32_t heapIndex = m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex);

+        VmaBudget heapBudget = {};

+        m_hAllocator->GetBudget(&heapBudget, heapIndex, 1);

+        freeMemory = (heapBudget.usage < heapBudget.budget) ? (heapBudget.budget - heapBudget.usage) : 0;

+    }

+    

+    const bool canFallbackToDedicated = !IsCustomPool();

+    const bool canCreateNewBlock =

+        ((createInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) == 0) &&

+        (m_Blocks.size() < m_MaxBlockCount) &&

+        (freeMemory >= size || !canFallbackToDedicated);

+    uint32_t strategy = createInfo.flags & VMA_ALLOCATION_CREATE_STRATEGY_MASK;

+

+    // If linearAlgorithm is used, canMakeOtherLost is available only when used as ring buffer.

+    // Which in turn is available only when maxBlockCount = 1.

+    if(m_Algorithm == VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT && m_MaxBlockCount > 1)

+    {

+        canMakeOtherLost = false;

+    }

+

+    // Upper address can only be used with linear allocator and within single memory block.

+    if(isUpperAddress &&

+        (m_Algorithm != VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT || m_MaxBlockCount > 1))

+    {

+        return VK_ERROR_FEATURE_NOT_PRESENT;

+    }

+

+    // Validate strategy.

+    switch(strategy)

+    {

+    case 0:

+        strategy = VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT;

+        break;

+    case VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT:

+    case VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT:

+    case VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT:

+        break;

+    default:

+        return VK_ERROR_FEATURE_NOT_PRESENT;

+    }

+

+    // Early reject: requested allocation size is larger that maximum block size for this block vector.

+    if(size + 2 * VMA_DEBUG_MARGIN > m_PreferredBlockSize)

+    {

+        return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+    }

+

+    /*

+    Under certain condition, this whole section can be skipped for optimization, so

+    we move on directly to trying to allocate with canMakeOtherLost. That's the case

+    e.g. for custom pools with linear algorithm.

+    */

+    if(!canMakeOtherLost || canCreateNewBlock)

+    {

+        // 1. Search existing allocations. Try to allocate without making other allocations lost.

+        VmaAllocationCreateFlags allocFlagsCopy = createInfo.flags;

+        allocFlagsCopy &= ~VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT;

+

+        if(m_Algorithm == VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT)

+        {

+            // Use only last block.

+            if(!m_Blocks.empty())

+            {

+                VmaDeviceMemoryBlock* const pCurrBlock = m_Blocks.back();

+                VMA_ASSERT(pCurrBlock);

+                VkResult res = AllocateFromBlock(

+                    pCurrBlock,

+                    currentFrameIndex,

+                    size,

+                    alignment,

+                    allocFlagsCopy,

+                    createInfo.pUserData,

+                    suballocType,

+                    strategy,

+                    pAllocation);

+                if(res == VK_SUCCESS)

+                {

+                    VMA_DEBUG_LOG("    Returned from last block #%u", pCurrBlock->GetId());

+                    return VK_SUCCESS;

+                }

+            }

+        }

+        else

+        {

+            if(strategy == VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT)

+            {

+                // Forward order in m_Blocks - prefer blocks with smallest amount of free space.

+                for(size_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex )

+                {

+                    VmaDeviceMemoryBlock* const pCurrBlock = m_Blocks[blockIndex];

+                    VMA_ASSERT(pCurrBlock);

+                    VkResult res = AllocateFromBlock(

+                        pCurrBlock,

+                        currentFrameIndex,

+                        size,

+                        alignment,

+                        allocFlagsCopy,

+                        createInfo.pUserData,

+                        suballocType,

+                        strategy,

+                        pAllocation);

+                    if(res == VK_SUCCESS)

+                    {

+                        VMA_DEBUG_LOG("    Returned from existing block #%u", pCurrBlock->GetId());

+                        return VK_SUCCESS;

+                    }

+                }

+            }

+            else // WORST_FIT, FIRST_FIT

+            {

+                // Backward order in m_Blocks - prefer blocks with largest amount of free space.

+                for(size_t blockIndex = m_Blocks.size(); blockIndex--; )

+                {

+                    VmaDeviceMemoryBlock* const pCurrBlock = m_Blocks[blockIndex];

+                    VMA_ASSERT(pCurrBlock);

+                    VkResult res = AllocateFromBlock(

+                        pCurrBlock,

+                        currentFrameIndex,

+                        size,

+                        alignment,

+                        allocFlagsCopy,

+                        createInfo.pUserData,

+                        suballocType,

+                        strategy,

+                        pAllocation);

+                    if(res == VK_SUCCESS)

+                    {

+                        VMA_DEBUG_LOG("    Returned from existing block #%u", pCurrBlock->GetId());

+                        return VK_SUCCESS;

+                    }

+                }

+            }

+        }

+

+        // 2. Try to create new block.

+        if(canCreateNewBlock)

+        {

+            // Calculate optimal size for new block.

+            VkDeviceSize newBlockSize = m_PreferredBlockSize;

+            uint32_t newBlockSizeShift = 0;

+            const uint32_t NEW_BLOCK_SIZE_SHIFT_MAX = 3;

+

+            if(!m_ExplicitBlockSize)

+            {

+                // Allocate 1/8, 1/4, 1/2 as first blocks.

+                const VkDeviceSize maxExistingBlockSize = CalcMaxBlockSize();

+                for(uint32_t i = 0; i < NEW_BLOCK_SIZE_SHIFT_MAX; ++i)

+                {

+                    const VkDeviceSize smallerNewBlockSize = newBlockSize / 2;

+                    if(smallerNewBlockSize > maxExistingBlockSize && smallerNewBlockSize >= size * 2)

+                    {

+                        newBlockSize = smallerNewBlockSize;

+                        ++newBlockSizeShift;

+                    }

+                    else

+                    {

+                        break;

+                    }

+                }

+            }

+

+            size_t newBlockIndex = 0;

+            VkResult res = (newBlockSize <= freeMemory || !canFallbackToDedicated) ?

+                CreateBlock(newBlockSize, &newBlockIndex) : VK_ERROR_OUT_OF_DEVICE_MEMORY;

+            // Allocation of this size failed? Try 1/2, 1/4, 1/8 of m_PreferredBlockSize.

+            if(!m_ExplicitBlockSize)

+            {

+                while(res < 0 && newBlockSizeShift < NEW_BLOCK_SIZE_SHIFT_MAX)

+                {

+                    const VkDeviceSize smallerNewBlockSize = newBlockSize / 2;

+                    if(smallerNewBlockSize >= size)

+                    {

+                        newBlockSize = smallerNewBlockSize;

+                        ++newBlockSizeShift;

+                        res = (newBlockSize <= freeMemory || !canFallbackToDedicated) ?

+                            CreateBlock(newBlockSize, &newBlockIndex) : VK_ERROR_OUT_OF_DEVICE_MEMORY;

+                    }

+                    else

+                    {

+                        break;

+                    }

+                }

+            }

+

+            if(res == VK_SUCCESS)

+            {

+                VmaDeviceMemoryBlock* const pBlock = m_Blocks[newBlockIndex];

+                VMA_ASSERT(pBlock->m_pMetadata->GetSize() >= size);

+

+                res = AllocateFromBlock(

+                    pBlock,

+                    currentFrameIndex,

+                    size,

+                    alignment,

+                    allocFlagsCopy,

+                    createInfo.pUserData,

+                    suballocType,

+                    strategy,

+                    pAllocation);

+                if(res == VK_SUCCESS)

+                {

+                    VMA_DEBUG_LOG("    Created new block #%u Size=%llu", pBlock->GetId(), newBlockSize);

+                    return VK_SUCCESS;

+                }

+                else

+                {

+                    // Allocation from new block failed, possibly due to VMA_DEBUG_MARGIN or alignment.

+                    return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+                }

+            }

+        }

+    }

+

+    // 3. Try to allocate from existing blocks with making other allocations lost.

+    if(canMakeOtherLost)

+    {

+        uint32_t tryIndex = 0;

+        for(; tryIndex < VMA_ALLOCATION_TRY_COUNT; ++tryIndex)

+        {

+            VmaDeviceMemoryBlock* pBestRequestBlock = VMA_NULL;

+            VmaAllocationRequest bestRequest = {};

+            VkDeviceSize bestRequestCost = VK_WHOLE_SIZE;

+

+            // 1. Search existing allocations.

+            if(strategy == VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT)

+            {

+                // Forward order in m_Blocks - prefer blocks with smallest amount of free space.

+                for(size_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex )

+                {

+                    VmaDeviceMemoryBlock* const pCurrBlock = m_Blocks[blockIndex];

+                    VMA_ASSERT(pCurrBlock);

+                    VmaAllocationRequest currRequest = {};

+                    if(pCurrBlock->m_pMetadata->CreateAllocationRequest(

+                        currentFrameIndex,

+                        m_FrameInUseCount,

+                        m_BufferImageGranularity,

+                        size,

+                        alignment,

+                        (createInfo.flags & VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT) != 0,

+                        suballocType,

+                        canMakeOtherLost,

+                        strategy,

+                        &currRequest))

+                    {

+                        const VkDeviceSize currRequestCost = currRequest.CalcCost();

+                        if(pBestRequestBlock == VMA_NULL ||

+                            currRequestCost < bestRequestCost)

+                        {

+                            pBestRequestBlock = pCurrBlock;

+                            bestRequest = currRequest;

+                            bestRequestCost = currRequestCost;

+

+                            if(bestRequestCost == 0)

+                            {

+                                break;

+                            }

+                        }

+                    }

+                }

+            }

+            else // WORST_FIT, FIRST_FIT

+            {

+                // Backward order in m_Blocks - prefer blocks with largest amount of free space.

+                for(size_t blockIndex = m_Blocks.size(); blockIndex--; )

+                {

+                    VmaDeviceMemoryBlock* const pCurrBlock = m_Blocks[blockIndex];

+                    VMA_ASSERT(pCurrBlock);

+                    VmaAllocationRequest currRequest = {};

+                    if(pCurrBlock->m_pMetadata->CreateAllocationRequest(

+                        currentFrameIndex,

+                        m_FrameInUseCount,

+                        m_BufferImageGranularity,

+                        size,

+                        alignment,

+                        (createInfo.flags & VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT) != 0,

+                        suballocType,

+                        canMakeOtherLost,

+                        strategy,

+                        &currRequest))

+                    {

+                        const VkDeviceSize currRequestCost = currRequest.CalcCost();

+                        if(pBestRequestBlock == VMA_NULL ||

+                            currRequestCost < bestRequestCost ||

+                            strategy == VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT)

+                        {

+                            pBestRequestBlock = pCurrBlock;

+                            bestRequest = currRequest;

+                            bestRequestCost = currRequestCost;

+

+                            if(bestRequestCost == 0 ||

+                                strategy == VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT)

+                            {

+                                break;

+                            }

+                        }

+                    }

+                }

+            }

+

+            if(pBestRequestBlock != VMA_NULL)

+            {

+                if(mapped)

+                {

+                    VkResult res = pBestRequestBlock->Map(m_hAllocator, 1, VMA_NULL);

+                    if(res != VK_SUCCESS)

+                    {

+                        return res;

+                    }

+                }

+

+                if(pBestRequestBlock->m_pMetadata->MakeRequestedAllocationsLost(

+                    currentFrameIndex,

+                    m_FrameInUseCount,

+                    &bestRequest))

+                {

+                    // Allocate from this pBlock.

+                    *pAllocation = m_hAllocator->m_AllocationObjectAllocator.Allocate(currentFrameIndex, isUserDataString);

+                    pBestRequestBlock->m_pMetadata->Alloc(bestRequest, suballocType, size, *pAllocation);

+                    UpdateHasEmptyBlock();

+                    (*pAllocation)->InitBlockAllocation(

+                        pBestRequestBlock,

+                        bestRequest.offset,

+                        alignment,

+                        size,

+                        m_MemoryTypeIndex,

+                        suballocType,

+                        mapped,

+                        (createInfo.flags & VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT) != 0);

+                    VMA_HEAVY_ASSERT(pBestRequestBlock->Validate());

+                    VMA_DEBUG_LOG("    Returned from existing block");

+                    (*pAllocation)->SetUserData(m_hAllocator, createInfo.pUserData);

+                    m_hAllocator->m_Budget.AddAllocation(m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex), size);

+                    if(VMA_DEBUG_INITIALIZE_ALLOCATIONS)

+                    {

+                        m_hAllocator->FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);

+                    }

+                    if(IsCorruptionDetectionEnabled())

+                    {

+                        VkResult res = pBestRequestBlock->WriteMagicValueAroundAllocation(m_hAllocator, bestRequest.offset, size);

+                        VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to write magic value.");

+                    }

+                    return VK_SUCCESS;

+                }

+                // else: Some allocations must have been touched while we are here. Next try.

+            }

+            else

+            {

+                // Could not find place in any of the blocks - break outer loop.

+                break;

+            }

+        }

+        /* Maximum number of tries exceeded - a very unlike event when many other

+        threads are simultaneously touching allocations making it impossible to make

+        lost at the same time as we try to allocate. */

+        if(tryIndex == VMA_ALLOCATION_TRY_COUNT)

+        {

+            return VK_ERROR_TOO_MANY_OBJECTS;

+        }

+    }

+

+    return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+}

+

+void VmaBlockVector::Free(

+    const VmaAllocation hAllocation)

+{

+    VmaDeviceMemoryBlock* pBlockToDelete = VMA_NULL;

+

+    bool budgetExceeded = false;

+    {

+        const uint32_t heapIndex = m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex);

+        VmaBudget heapBudget = {};

+        m_hAllocator->GetBudget(&heapBudget, heapIndex, 1);

+        budgetExceeded = heapBudget.usage >= heapBudget.budget;

+    }

+

+    // Scope for lock.

+    {

+        VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);

+

+        VmaDeviceMemoryBlock* pBlock = hAllocation->GetBlock();

+

+        if(IsCorruptionDetectionEnabled())

+        {

+            VkResult res = pBlock->ValidateMagicValueAroundAllocation(m_hAllocator, hAllocation->GetOffset(), hAllocation->GetSize());

+            VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to validate magic value.");

+        }

+

+        if(hAllocation->IsPersistentMap())

+        {

+            pBlock->Unmap(m_hAllocator, 1);

+        }

+

+        pBlock->m_pMetadata->Free(hAllocation);

+        VMA_HEAVY_ASSERT(pBlock->Validate());

+

+        VMA_DEBUG_LOG("  Freed from MemoryTypeIndex=%u", m_MemoryTypeIndex);

+

+        const bool canDeleteBlock = m_Blocks.size() > m_MinBlockCount;

+        // pBlock became empty after this deallocation.

+        if(pBlock->m_pMetadata->IsEmpty())

+        {

+            // Already has empty block. We don't want to have two, so delete this one.

+            if((m_HasEmptyBlock || budgetExceeded) && canDeleteBlock)

+            {

+                pBlockToDelete = pBlock;

+                Remove(pBlock);

+            }

+            // else: We now have an empty block - leave it.

+        }

+        // pBlock didn't become empty, but we have another empty block - find and free that one.

+        // (This is optional, heuristics.)

+        else if(m_HasEmptyBlock && canDeleteBlock)

+        {

+            VmaDeviceMemoryBlock* pLastBlock = m_Blocks.back();

+            if(pLastBlock->m_pMetadata->IsEmpty())

+            {

+                pBlockToDelete = pLastBlock;

+                m_Blocks.pop_back();

+            }

+        }

+

+        UpdateHasEmptyBlock();

+        IncrementallySortBlocks();

+    }

+

+    // Destruction of a free block. Deferred until this point, outside of mutex

+    // lock, for performance reason.

+    if(pBlockToDelete != VMA_NULL)

+    {

+        VMA_DEBUG_LOG("    Deleted empty block");

+        pBlockToDelete->Destroy(m_hAllocator);

+        vma_delete(m_hAllocator, pBlockToDelete);

+    }

+}

+

+VkDeviceSize VmaBlockVector::CalcMaxBlockSize() const

+{

+    VkDeviceSize result = 0;

+    for(size_t i = m_Blocks.size(); i--; )

+    {

+        result = VMA_MAX(result, m_Blocks[i]->m_pMetadata->GetSize());

+        if(result >= m_PreferredBlockSize)

+        {

+            break;

+        }

+    }

+    return result;

+}

+

+void VmaBlockVector::Remove(VmaDeviceMemoryBlock* pBlock)

+{

+    for(uint32_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex)

+    {

+        if(m_Blocks[blockIndex] == pBlock)

+        {

+            VmaVectorRemove(m_Blocks, blockIndex);

+            return;

+        }

+    }

+    VMA_ASSERT(0);

+}

+

+void VmaBlockVector::IncrementallySortBlocks()

+{

+    if(m_Algorithm != VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT)

+    {

+        // Bubble sort only until first swap.

+        for(size_t i = 1; i < m_Blocks.size(); ++i)

+        {

+            if(m_Blocks[i - 1]->m_pMetadata->GetSumFreeSize() > m_Blocks[i]->m_pMetadata->GetSumFreeSize())

+            {

+                VMA_SWAP(m_Blocks[i - 1], m_Blocks[i]);

+                return;

+            }

+        }

+    }

+}

+

+VkResult VmaBlockVector::AllocateFromBlock(

+    VmaDeviceMemoryBlock* pBlock,

+    uint32_t currentFrameIndex,

+    VkDeviceSize size,

+    VkDeviceSize alignment,

+    VmaAllocationCreateFlags allocFlags,

+    void* pUserData,

+    VmaSuballocationType suballocType,

+    uint32_t strategy,

+    VmaAllocation* pAllocation)

+{

+    VMA_ASSERT((allocFlags & VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT) == 0);

+    const bool isUpperAddress = (allocFlags & VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT) != 0;

+    const bool mapped = (allocFlags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0;

+    const bool isUserDataString = (allocFlags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0;

+

+    VmaAllocationRequest currRequest = {};

+    if(pBlock->m_pMetadata->CreateAllocationRequest(

+        currentFrameIndex,

+        m_FrameInUseCount,

+        m_BufferImageGranularity,

+        size,

+        alignment,

+        isUpperAddress,

+        suballocType,

+        false, // canMakeOtherLost

+        strategy,

+        &currRequest))

+    {

+        // Allocate from pCurrBlock.

+        VMA_ASSERT(currRequest.itemsToMakeLostCount == 0);

+

+        if(mapped)

+        {

+            VkResult res = pBlock->Map(m_hAllocator, 1, VMA_NULL);

+            if(res != VK_SUCCESS)

+            {

+                return res;

+            }

+        }

+            

+        *pAllocation = m_hAllocator->m_AllocationObjectAllocator.Allocate(currentFrameIndex, isUserDataString);

+        pBlock->m_pMetadata->Alloc(currRequest, suballocType, size, *pAllocation);

+        UpdateHasEmptyBlock();

+        (*pAllocation)->InitBlockAllocation(

+            pBlock,

+            currRequest.offset,

+            alignment,

+            size,

+            m_MemoryTypeIndex,

+            suballocType,

+            mapped,

+            (allocFlags & VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT) != 0);

+        VMA_HEAVY_ASSERT(pBlock->Validate());

+        (*pAllocation)->SetUserData(m_hAllocator, pUserData);

+        m_hAllocator->m_Budget.AddAllocation(m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex), size);

+        if(VMA_DEBUG_INITIALIZE_ALLOCATIONS)

+        {

+            m_hAllocator->FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);

+        }

+        if(IsCorruptionDetectionEnabled())

+        {

+            VkResult res = pBlock->WriteMagicValueAroundAllocation(m_hAllocator, currRequest.offset, size);

+            VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to write magic value.");

+        }

+        return VK_SUCCESS;

+    }

+    return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+}

+

+VkResult VmaBlockVector::CreateBlock(VkDeviceSize blockSize, size_t* pNewBlockIndex)

+{

+    VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };

+    allocInfo.memoryTypeIndex = m_MemoryTypeIndex;

+    allocInfo.allocationSize = blockSize;

+

+#if VMA_BUFFER_DEVICE_ADDRESS

+    // Every standalone block can potentially contain a buffer with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT - always enable the feature.

+    VkMemoryAllocateFlagsInfoKHR allocFlagsInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR };

+    if(m_hAllocator->m_UseKhrBufferDeviceAddress)

+    {

+        allocFlagsInfo.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;

+        VmaPnextChainPushFront(&allocInfo, &allocFlagsInfo);

+    }

+#endif // #if VMA_BUFFER_DEVICE_ADDRESS

+

+    VkDeviceMemory mem = VK_NULL_HANDLE;

+    VkResult res = m_hAllocator->AllocateVulkanMemory(&allocInfo, &mem);

+    if(res < 0)

+    {

+        return res;

+    }

+

+    // New VkDeviceMemory successfully created.

+

+    // Create new Allocation for it.

+    VmaDeviceMemoryBlock* const pBlock = vma_new(m_hAllocator, VmaDeviceMemoryBlock)(m_hAllocator);

+    pBlock->Init(

+        m_hAllocator,

+        m_hParentPool,

+        m_MemoryTypeIndex,

+        mem,

+        allocInfo.allocationSize,

+        m_NextBlockId++,

+        m_Algorithm);

+

+    m_Blocks.push_back(pBlock);

+    if(pNewBlockIndex != VMA_NULL)

+    {

+        *pNewBlockIndex = m_Blocks.size() - 1;

+    }

+

+    return VK_SUCCESS;

+}

+

+void VmaBlockVector::ApplyDefragmentationMovesCpu(

+    class VmaBlockVectorDefragmentationContext* pDefragCtx,

+    const VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves)

+{

+    const size_t blockCount = m_Blocks.size();

+    const bool isNonCoherent = m_hAllocator->IsMemoryTypeNonCoherent(m_MemoryTypeIndex);

+

+    enum BLOCK_FLAG

+    {

+        BLOCK_FLAG_USED = 0x00000001,

+        BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION = 0x00000002,

+    };

+

+    struct BlockInfo

+    {

+        uint32_t flags;

+        void* pMappedData;

+    };

+    VmaVector< BlockInfo, VmaStlAllocator<BlockInfo> >

+        blockInfo(blockCount, BlockInfo(), VmaStlAllocator<BlockInfo>(m_hAllocator->GetAllocationCallbacks()));

+    memset(blockInfo.data(), 0, blockCount * sizeof(BlockInfo));

+

+    // Go over all moves. Mark blocks that are used with BLOCK_FLAG_USED.

+    const size_t moveCount = moves.size();

+    for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)

+    {

+        const VmaDefragmentationMove& move = moves[moveIndex];

+        blockInfo[move.srcBlockIndex].flags |= BLOCK_FLAG_USED;

+        blockInfo[move.dstBlockIndex].flags |= BLOCK_FLAG_USED;

+    }

+

+    VMA_ASSERT(pDefragCtx->res == VK_SUCCESS);

+

+    // Go over all blocks. Get mapped pointer or map if necessary.

+    for(size_t blockIndex = 0; pDefragCtx->res == VK_SUCCESS && blockIndex < blockCount; ++blockIndex)

+    {

+        BlockInfo& currBlockInfo = blockInfo[blockIndex];

+        VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];

+        if((currBlockInfo.flags & BLOCK_FLAG_USED) != 0)

+        {

+            currBlockInfo.pMappedData = pBlock->GetMappedData();

+            // It is not originally mapped - map it.

+            if(currBlockInfo.pMappedData == VMA_NULL)

+            {

+                pDefragCtx->res = pBlock->Map(m_hAllocator, 1, &currBlockInfo.pMappedData);

+                if(pDefragCtx->res == VK_SUCCESS)

+                {

+                    currBlockInfo.flags |= BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION;

+                }

+            }

+        }

+    }

+

+    // Go over all moves. Do actual data transfer.

+    if(pDefragCtx->res == VK_SUCCESS)

+    {

+        const VkDeviceSize nonCoherentAtomSize = m_hAllocator->m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;

+        VkMappedMemoryRange memRange = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE };

+

+        for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)

+        {

+            const VmaDefragmentationMove& move = moves[moveIndex];

+

+            const BlockInfo& srcBlockInfo = blockInfo[move.srcBlockIndex];

+            const BlockInfo& dstBlockInfo = blockInfo[move.dstBlockIndex];

+

+            VMA_ASSERT(srcBlockInfo.pMappedData && dstBlockInfo.pMappedData);

+

+            // Invalidate source.

+            if(isNonCoherent)

+            {

+                VmaDeviceMemoryBlock* const pSrcBlock = m_Blocks[move.srcBlockIndex];

+                memRange.memory = pSrcBlock->GetDeviceMemory();

+                memRange.offset = VmaAlignDown(move.srcOffset, nonCoherentAtomSize);

+                memRange.size = VMA_MIN(

+                    VmaAlignUp(move.size + (move.srcOffset - memRange.offset), nonCoherentAtomSize),

+                    pSrcBlock->m_pMetadata->GetSize() - memRange.offset);

+                (*m_hAllocator->GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hAllocator->m_hDevice, 1, &memRange);

+            }

+

+            // THE PLACE WHERE ACTUAL DATA COPY HAPPENS.

+            memmove(

+                reinterpret_cast<char*>(dstBlockInfo.pMappedData) + move.dstOffset,

+                reinterpret_cast<char*>(srcBlockInfo.pMappedData) + move.srcOffset,

+                static_cast<size_t>(move.size));

+

+            if(IsCorruptionDetectionEnabled())

+            {

+                VmaWriteMagicValue(dstBlockInfo.pMappedData, move.dstOffset - VMA_DEBUG_MARGIN);

+                VmaWriteMagicValue(dstBlockInfo.pMappedData, move.dstOffset + move.size);

+            }

+

+            // Flush destination.

+            if(isNonCoherent)

+            {

+                VmaDeviceMemoryBlock* const pDstBlock = m_Blocks[move.dstBlockIndex];

+                memRange.memory = pDstBlock->GetDeviceMemory();

+                memRange.offset = VmaAlignDown(move.dstOffset, nonCoherentAtomSize);

+                memRange.size = VMA_MIN(

+                    VmaAlignUp(move.size + (move.dstOffset - memRange.offset), nonCoherentAtomSize),

+                    pDstBlock->m_pMetadata->GetSize() - memRange.offset);

+                (*m_hAllocator->GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hAllocator->m_hDevice, 1, &memRange);

+            }

+        }

+    }

+

+    // Go over all blocks in reverse order. Unmap those that were mapped just for defragmentation.

+    // Regardless of pCtx->res == VK_SUCCESS.

+    for(size_t blockIndex = blockCount; blockIndex--; )

+    {

+        const BlockInfo& currBlockInfo = blockInfo[blockIndex];

+        if((currBlockInfo.flags & BLOCK_FLAG_MAPPED_FOR_DEFRAGMENTATION) != 0)

+        {

+            VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];

+            pBlock->Unmap(m_hAllocator, 1);

+        }

+    }

+}

+

+void VmaBlockVector::ApplyDefragmentationMovesGpu(

+    class VmaBlockVectorDefragmentationContext* pDefragCtx,

+    VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,

+    VkCommandBuffer commandBuffer)

+{

+    const size_t blockCount = m_Blocks.size();

+

+    pDefragCtx->blockContexts.resize(blockCount);

+    memset(pDefragCtx->blockContexts.data(), 0, blockCount * sizeof(VmaBlockDefragmentationContext));

+

+    // Go over all moves. Mark blocks that are used with BLOCK_FLAG_USED.

+    const size_t moveCount = moves.size();

+    for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)

+    {

+        const VmaDefragmentationMove& move = moves[moveIndex];

+

+        //if(move.type == VMA_ALLOCATION_TYPE_UNKNOWN)

+        {

+            // Old school move still require us to map the whole block

+            pDefragCtx->blockContexts[move.srcBlockIndex].flags |= VmaBlockDefragmentationContext::BLOCK_FLAG_USED;

+            pDefragCtx->blockContexts[move.dstBlockIndex].flags |= VmaBlockDefragmentationContext::BLOCK_FLAG_USED;

+        }

+    }

+

+    VMA_ASSERT(pDefragCtx->res == VK_SUCCESS);

+

+    // Go over all blocks. Create and bind buffer for whole block if necessary.

+    {

+        VkBufferCreateInfo bufCreateInfo;

+        VmaFillGpuDefragmentationBufferCreateInfo(bufCreateInfo);

+

+        for(size_t blockIndex = 0; pDefragCtx->res == VK_SUCCESS && blockIndex < blockCount; ++blockIndex)

+        {

+            VmaBlockDefragmentationContext& currBlockCtx = pDefragCtx->blockContexts[blockIndex];

+            VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];

+            if((currBlockCtx.flags & VmaBlockDefragmentationContext::BLOCK_FLAG_USED) != 0)

+            {

+                bufCreateInfo.size = pBlock->m_pMetadata->GetSize();

+                pDefragCtx->res = (*m_hAllocator->GetVulkanFunctions().vkCreateBuffer)(

+                    m_hAllocator->m_hDevice, &bufCreateInfo, m_hAllocator->GetAllocationCallbacks(), &currBlockCtx.hBuffer);

+                if(pDefragCtx->res == VK_SUCCESS)

+                {

+                    pDefragCtx->res = (*m_hAllocator->GetVulkanFunctions().vkBindBufferMemory)(

+                        m_hAllocator->m_hDevice, currBlockCtx.hBuffer, pBlock->GetDeviceMemory(), 0);

+                }

+            }

+        }

+    }

+

+    // Go over all moves. Post data transfer commands to command buffer.

+    if(pDefragCtx->res == VK_SUCCESS)

+    {

+        for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)

+        {

+            const VmaDefragmentationMove& move = moves[moveIndex];

+

+            const VmaBlockDefragmentationContext& srcBlockCtx = pDefragCtx->blockContexts[move.srcBlockIndex];

+            const VmaBlockDefragmentationContext& dstBlockCtx = pDefragCtx->blockContexts[move.dstBlockIndex];

+

+            VMA_ASSERT(srcBlockCtx.hBuffer && dstBlockCtx.hBuffer);

+

+            VkBufferCopy region = {

+                move.srcOffset,

+                move.dstOffset,

+                move.size };

+            (*m_hAllocator->GetVulkanFunctions().vkCmdCopyBuffer)(

+                commandBuffer, srcBlockCtx.hBuffer, dstBlockCtx.hBuffer, 1, &region);

+        }

+    }

+

+    // Save buffers to defrag context for later destruction.

+    if(pDefragCtx->res == VK_SUCCESS && moveCount > 0)

+    {

+        pDefragCtx->res = VK_NOT_READY;

+    }

+}

+

+void VmaBlockVector::FreeEmptyBlocks(VmaDefragmentationStats* pDefragmentationStats)

+{

+    for(size_t blockIndex = m_Blocks.size(); blockIndex--; )

+    {

+        VmaDeviceMemoryBlock* pBlock = m_Blocks[blockIndex];

+        if(pBlock->m_pMetadata->IsEmpty())

+        {

+            if(m_Blocks.size() > m_MinBlockCount)

+            {

+                if(pDefragmentationStats != VMA_NULL)

+                {

+                    ++pDefragmentationStats->deviceMemoryBlocksFreed;

+                    pDefragmentationStats->bytesFreed += pBlock->m_pMetadata->GetSize();

+                }

+

+                VmaVectorRemove(m_Blocks, blockIndex);

+                pBlock->Destroy(m_hAllocator);

+                vma_delete(m_hAllocator, pBlock);

+            }

+            else

+            {

+                break;

+            }

+        }

+    }

+    UpdateHasEmptyBlock();

+}

+

+void VmaBlockVector::UpdateHasEmptyBlock()

+{

+    m_HasEmptyBlock = false;

+    for(size_t index = 0, count = m_Blocks.size(); index < count; ++index)

+    {

+        VmaDeviceMemoryBlock* const pBlock = m_Blocks[index];

+        if(pBlock->m_pMetadata->IsEmpty())

+        {

+            m_HasEmptyBlock = true;

+            break;

+        }

+    }

+}

+

+#if VMA_STATS_STRING_ENABLED

+

+void VmaBlockVector::PrintDetailedMap(class VmaJsonWriter& json)

+{

+    VmaMutexLockRead lock(m_Mutex, m_hAllocator->m_UseMutex);

+

+    json.BeginObject();

+

+    if(IsCustomPool())

+    {

+        const char* poolName = m_hParentPool->GetName();

+        if(poolName != VMA_NULL && poolName[0] != '\0')

+        {

+            json.WriteString("Name");

+            json.WriteString(poolName);

+        }

+

+        json.WriteString("MemoryTypeIndex");

+        json.WriteNumber(m_MemoryTypeIndex);

+

+        json.WriteString("BlockSize");

+        json.WriteNumber(m_PreferredBlockSize);

+

+        json.WriteString("BlockCount");

+        json.BeginObject(true);

+        if(m_MinBlockCount > 0)

+        {

+            json.WriteString("Min");

+            json.WriteNumber((uint64_t)m_MinBlockCount);

+        }

+        if(m_MaxBlockCount < SIZE_MAX)

+        {

+            json.WriteString("Max");

+            json.WriteNumber((uint64_t)m_MaxBlockCount);

+        }

+        json.WriteString("Cur");

+        json.WriteNumber((uint64_t)m_Blocks.size());

+        json.EndObject();

+

+        if(m_FrameInUseCount > 0)

+        {

+            json.WriteString("FrameInUseCount");

+            json.WriteNumber(m_FrameInUseCount);

+        }

+

+        if(m_Algorithm != 0)

+        {

+            json.WriteString("Algorithm");

+            json.WriteString(VmaAlgorithmToStr(m_Algorithm));

+        }

+    }

+    else

+    {

+        json.WriteString("PreferredBlockSize");

+        json.WriteNumber(m_PreferredBlockSize);

+    }

+

+    json.WriteString("Blocks");

+    json.BeginObject();

+    for(size_t i = 0; i < m_Blocks.size(); ++i)

+    {

+        json.BeginString();

+        json.ContinueString(m_Blocks[i]->GetId());

+        json.EndString();

+

+        m_Blocks[i]->m_pMetadata->PrintDetailedMap(json);

+    }

+    json.EndObject();

+

+    json.EndObject();

+}

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+void VmaBlockVector::Defragment(

+    class VmaBlockVectorDefragmentationContext* pCtx,

+    VmaDefragmentationStats* pStats, VmaDefragmentationFlags flags,

+    VkDeviceSize& maxCpuBytesToMove, uint32_t& maxCpuAllocationsToMove,

+    VkDeviceSize& maxGpuBytesToMove, uint32_t& maxGpuAllocationsToMove,

+    VkCommandBuffer commandBuffer)

+{

+    pCtx->res = VK_SUCCESS;

+    

+    const VkMemoryPropertyFlags memPropFlags =

+        m_hAllocator->m_MemProps.memoryTypes[m_MemoryTypeIndex].propertyFlags;

+    const bool isHostVisible = (memPropFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0;

+

+    const bool canDefragmentOnCpu = maxCpuBytesToMove > 0 && maxCpuAllocationsToMove > 0 &&

+        isHostVisible;

+    const bool canDefragmentOnGpu = maxGpuBytesToMove > 0 && maxGpuAllocationsToMove > 0 &&

+        !IsCorruptionDetectionEnabled() &&

+        ((1u << m_MemoryTypeIndex) & m_hAllocator->GetGpuDefragmentationMemoryTypeBits()) != 0;

+

+    // There are options to defragment this memory type.

+    if(canDefragmentOnCpu || canDefragmentOnGpu)

+    {

+        bool defragmentOnGpu;

+        // There is only one option to defragment this memory type.

+        if(canDefragmentOnGpu != canDefragmentOnCpu)

+        {

+            defragmentOnGpu = canDefragmentOnGpu;

+        }

+        // Both options are available: Heuristics to choose the best one.

+        else

+        {

+            defragmentOnGpu = (memPropFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0 ||

+                m_hAllocator->IsIntegratedGpu();

+        }

+

+        bool overlappingMoveSupported = !defragmentOnGpu;

+

+        if(m_hAllocator->m_UseMutex)

+        {

+            if(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL)

+            {

+                if(!m_Mutex.TryLockWrite())

+                {

+                    pCtx->res = VK_ERROR_INITIALIZATION_FAILED;

+                    return;

+                }

+            }

+            else

+            {

+                m_Mutex.LockWrite();

+                pCtx->mutexLocked = true;

+            }

+        }

+

+        pCtx->Begin(overlappingMoveSupported, flags);

+

+        // Defragment.

+

+        const VkDeviceSize maxBytesToMove = defragmentOnGpu ? maxGpuBytesToMove : maxCpuBytesToMove;

+        const uint32_t maxAllocationsToMove = defragmentOnGpu ? maxGpuAllocationsToMove : maxCpuAllocationsToMove;

+        pCtx->res = pCtx->GetAlgorithm()->Defragment(pCtx->defragmentationMoves, maxBytesToMove, maxAllocationsToMove, flags);

+

+        // Accumulate statistics.

+        if(pStats != VMA_NULL)

+        {

+            const VkDeviceSize bytesMoved = pCtx->GetAlgorithm()->GetBytesMoved();

+            const uint32_t allocationsMoved = pCtx->GetAlgorithm()->GetAllocationsMoved();

+            pStats->bytesMoved += bytesMoved;

+            pStats->allocationsMoved += allocationsMoved;

+            VMA_ASSERT(bytesMoved <= maxBytesToMove);

+            VMA_ASSERT(allocationsMoved <= maxAllocationsToMove);

+            if(defragmentOnGpu)

+            {

+                maxGpuBytesToMove -= bytesMoved;

+                maxGpuAllocationsToMove -= allocationsMoved;

+            }

+            else

+            {

+                maxCpuBytesToMove -= bytesMoved;

+                maxCpuAllocationsToMove -= allocationsMoved;

+            }

+        }

+

+        if(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL)

+        {

+            if(m_hAllocator->m_UseMutex)

+                m_Mutex.UnlockWrite();

+            

+            if(pCtx->res >= VK_SUCCESS && !pCtx->defragmentationMoves.empty())

+                pCtx->res = VK_NOT_READY;

+

+            return;

+        }

+    

+        if(pCtx->res >= VK_SUCCESS)

+        {

+            if(defragmentOnGpu)

+            {

+                ApplyDefragmentationMovesGpu(pCtx, pCtx->defragmentationMoves, commandBuffer);

+            }

+            else

+            {

+                ApplyDefragmentationMovesCpu(pCtx, pCtx->defragmentationMoves);

+            }

+        }

+    }

+}

+

+void VmaBlockVector::DefragmentationEnd(

+    class VmaBlockVectorDefragmentationContext* pCtx,

+    uint32_t flags,

+    VmaDefragmentationStats* pStats)

+{

+    if(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL && m_hAllocator->m_UseMutex)

+    {

+        VMA_ASSERT(pCtx->mutexLocked == false);

+

+        // Incremental defragmentation doesn't hold the lock, so when we enter here we don't actually have any

+        // lock protecting us. Since we mutate state here, we have to take the lock out now

+        m_Mutex.LockWrite();

+        pCtx->mutexLocked = true;

+    }

+

+    // If the mutex isn't locked we didn't do any work and there is nothing to delete.

+    if(pCtx->mutexLocked || !m_hAllocator->m_UseMutex)

+    {

+        // Destroy buffers.

+        for(size_t blockIndex = pCtx->blockContexts.size(); blockIndex--;)

+        {

+            VmaBlockDefragmentationContext &blockCtx = pCtx->blockContexts[blockIndex];

+            if(blockCtx.hBuffer)

+            {

+                (*m_hAllocator->GetVulkanFunctions().vkDestroyBuffer)(m_hAllocator->m_hDevice, blockCtx.hBuffer, m_hAllocator->GetAllocationCallbacks());

+            }

+        }

+

+        if(pCtx->res >= VK_SUCCESS)

+        {

+            FreeEmptyBlocks(pStats);

+        }

+    }

+

+    if(pCtx->mutexLocked)

+    {

+        VMA_ASSERT(m_hAllocator->m_UseMutex);

+        m_Mutex.UnlockWrite();

+    }

+}

+

+uint32_t VmaBlockVector::ProcessDefragmentations(

+    class VmaBlockVectorDefragmentationContext *pCtx,

+    VmaDefragmentationPassMoveInfo* pMove, uint32_t maxMoves)

+{

+    VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);

+    

+    const uint32_t moveCount = std::min(uint32_t(pCtx->defragmentationMoves.size()) - pCtx->defragmentationMovesProcessed, maxMoves);

+

+    for(uint32_t i = 0; i < moveCount; ++ i)

+    {

+        VmaDefragmentationMove& move = pCtx->defragmentationMoves[pCtx->defragmentationMovesProcessed + i];

+

+        pMove->allocation = move.hAllocation;

+        pMove->memory = move.pDstBlock->GetDeviceMemory();

+        pMove->offset = move.dstOffset;

+

+        ++ pMove;

+    }

+

+    pCtx->defragmentationMovesProcessed += moveCount;

+

+    return moveCount;

+}

+

+void VmaBlockVector::CommitDefragmentations(

+    class VmaBlockVectorDefragmentationContext *pCtx,

+    VmaDefragmentationStats* pStats)

+{

+    VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);

+    

+    for(uint32_t i = pCtx->defragmentationMovesCommitted; i < pCtx->defragmentationMovesProcessed; ++ i)

+    {

+        const VmaDefragmentationMove &move = pCtx->defragmentationMoves[i];

+

+        move.pSrcBlock->m_pMetadata->FreeAtOffset(move.srcOffset);

+        move.hAllocation->ChangeBlockAllocation(m_hAllocator, move.pDstBlock, move.dstOffset);

+    }

+

+    pCtx->defragmentationMovesCommitted = pCtx->defragmentationMovesProcessed;

+    FreeEmptyBlocks(pStats);

+}

+

+size_t VmaBlockVector::CalcAllocationCount() const

+{

+    size_t result = 0;

+    for(size_t i = 0; i < m_Blocks.size(); ++i)

+    {

+        result += m_Blocks[i]->m_pMetadata->GetAllocationCount();

+    }

+    return result;

+}

+

+bool VmaBlockVector::IsBufferImageGranularityConflictPossible() const

+{

+    if(m_BufferImageGranularity == 1)

+    {

+        return false;

+    }

+    VmaSuballocationType lastSuballocType = VMA_SUBALLOCATION_TYPE_FREE;

+    for(size_t i = 0, count = m_Blocks.size(); i < count; ++i)

+    {

+        VmaDeviceMemoryBlock* const pBlock = m_Blocks[i];

+        VMA_ASSERT(m_Algorithm == 0);

+        VmaBlockMetadata_Generic* const pMetadata = (VmaBlockMetadata_Generic*)pBlock->m_pMetadata;

+        if(pMetadata->IsBufferImageGranularityConflictPossible(m_BufferImageGranularity, lastSuballocType))

+        {

+            return true;

+        }

+    }

+    return false;

+}

+

+void VmaBlockVector::MakePoolAllocationsLost(

+    uint32_t currentFrameIndex,

+    size_t* pLostAllocationCount)

+{

+    VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);

+    size_t lostAllocationCount = 0;

+    for(uint32_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex)

+    {

+        VmaDeviceMemoryBlock* const pBlock = m_Blocks[blockIndex];

+        VMA_ASSERT(pBlock);

+        lostAllocationCount += pBlock->m_pMetadata->MakeAllocationsLost(currentFrameIndex, m_FrameInUseCount);

+    }

+    if(pLostAllocationCount != VMA_NULL)

+    {

+        *pLostAllocationCount = lostAllocationCount;

+    }

+}

+

+VkResult VmaBlockVector::CheckCorruption()

+{

+    if(!IsCorruptionDetectionEnabled())

+    {

+        return VK_ERROR_FEATURE_NOT_PRESENT;

+    }

+

+    VmaMutexLockRead lock(m_Mutex, m_hAllocator->m_UseMutex);

+    for(uint32_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex)

+    {

+        VmaDeviceMemoryBlock* const pBlock = m_Blocks[blockIndex];

+        VMA_ASSERT(pBlock);

+        VkResult res = pBlock->CheckCorruption(m_hAllocator);

+        if(res != VK_SUCCESS)

+        {

+            return res;

+        }

+    }

+    return VK_SUCCESS;

+}

+

+void VmaBlockVector::AddStats(VmaStats* pStats)

+{

+    const uint32_t memTypeIndex = m_MemoryTypeIndex;

+    const uint32_t memHeapIndex = m_hAllocator->MemoryTypeIndexToHeapIndex(memTypeIndex);

+

+    VmaMutexLockRead lock(m_Mutex, m_hAllocator->m_UseMutex);

+

+    for(uint32_t blockIndex = 0; blockIndex < m_Blocks.size(); ++blockIndex)

+    {

+        const VmaDeviceMemoryBlock* const pBlock = m_Blocks[blockIndex];

+        VMA_ASSERT(pBlock);

+        VMA_HEAVY_ASSERT(pBlock->Validate());

+        VmaStatInfo allocationStatInfo;

+        pBlock->m_pMetadata->CalcAllocationStatInfo(allocationStatInfo);

+        VmaAddStatInfo(pStats->total, allocationStatInfo);

+        VmaAddStatInfo(pStats->memoryType[memTypeIndex], allocationStatInfo);

+        VmaAddStatInfo(pStats->memoryHeap[memHeapIndex], allocationStatInfo);

+    }

+}

+

+////////////////////////////////////////////////////////////////////////////////

+// VmaDefragmentationAlgorithm_Generic members definition

+

+VmaDefragmentationAlgorithm_Generic::VmaDefragmentationAlgorithm_Generic(

+    VmaAllocator hAllocator,

+    VmaBlockVector* pBlockVector,

+    uint32_t currentFrameIndex,

+    bool overlappingMoveSupported) :

+    VmaDefragmentationAlgorithm(hAllocator, pBlockVector, currentFrameIndex),

+    m_AllocationCount(0),

+    m_AllAllocations(false),

+    m_BytesMoved(0),

+    m_AllocationsMoved(0),

+    m_Blocks(VmaStlAllocator<BlockInfo*>(hAllocator->GetAllocationCallbacks()))

+{

+    // Create block info for each block.

+    const size_t blockCount = m_pBlockVector->m_Blocks.size();

+    for(size_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)

+    {

+        BlockInfo* pBlockInfo = vma_new(m_hAllocator, BlockInfo)(m_hAllocator->GetAllocationCallbacks());

+        pBlockInfo->m_OriginalBlockIndex = blockIndex;

+        pBlockInfo->m_pBlock = m_pBlockVector->m_Blocks[blockIndex];

+        m_Blocks.push_back(pBlockInfo);

+    }

+

+    // Sort them by m_pBlock pointer value.

+    VMA_SORT(m_Blocks.begin(), m_Blocks.end(), BlockPointerLess());

+}

+

+VmaDefragmentationAlgorithm_Generic::~VmaDefragmentationAlgorithm_Generic()

+{

+    for(size_t i = m_Blocks.size(); i--; )

+    {

+        vma_delete(m_hAllocator, m_Blocks[i]);

+    }

+}

+

+void VmaDefragmentationAlgorithm_Generic::AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged)

+{

+    // Now as we are inside VmaBlockVector::m_Mutex, we can make final check if this allocation was not lost.

+    if(hAlloc->GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST)

+    {

+        VmaDeviceMemoryBlock* pBlock = hAlloc->GetBlock();

+        BlockInfoVector::iterator it = VmaBinaryFindFirstNotLess(m_Blocks.begin(), m_Blocks.end(), pBlock, BlockPointerLess());

+        if(it != m_Blocks.end() && (*it)->m_pBlock == pBlock)

+        {

+            AllocationInfo allocInfo = AllocationInfo(hAlloc, pChanged);

+            (*it)->m_Allocations.push_back(allocInfo);

+        }

+        else

+        {

+            VMA_ASSERT(0);

+        }

+

+        ++m_AllocationCount;

+    }

+}

+

+VkResult VmaDefragmentationAlgorithm_Generic::DefragmentRound(

+    VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,

+    VkDeviceSize maxBytesToMove,

+    uint32_t maxAllocationsToMove,

+    bool freeOldAllocations)

+{

+    if(m_Blocks.empty())

+    {

+        return VK_SUCCESS;

+    }

+

+    // This is a choice based on research.

+    // Option 1:

+    uint32_t strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT;

+    // Option 2:

+    //uint32_t strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT;

+    // Option 3:

+    //uint32_t strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT;

+

+    size_t srcBlockMinIndex = 0;

+    // When FAST_ALGORITHM, move allocations from only last out of blocks that contain non-movable allocations.

+    /*

+    if(m_AlgorithmFlags & VMA_DEFRAGMENTATION_FAST_ALGORITHM_BIT)

+    {

+        const size_t blocksWithNonMovableCount = CalcBlocksWithNonMovableCount();

+        if(blocksWithNonMovableCount > 0)

+        {

+            srcBlockMinIndex = blocksWithNonMovableCount - 1;

+        }

+    }

+    */

+

+    size_t srcBlockIndex = m_Blocks.size() - 1;

+    size_t srcAllocIndex = SIZE_MAX;

+    for(;;)

+    {

+        // 1. Find next allocation to move.

+        // 1.1. Start from last to first m_Blocks - they are sorted from most "destination" to most "source".

+        // 1.2. Then start from last to first m_Allocations.

+        while(srcAllocIndex >= m_Blocks[srcBlockIndex]->m_Allocations.size())

+        {

+            if(m_Blocks[srcBlockIndex]->m_Allocations.empty())

+            {

+                // Finished: no more allocations to process.

+                if(srcBlockIndex == srcBlockMinIndex)

+                {

+                    return VK_SUCCESS;

+                }

+                else

+                {

+                    --srcBlockIndex;

+                    srcAllocIndex = SIZE_MAX;

+                }

+            }

+            else

+            {

+                srcAllocIndex = m_Blocks[srcBlockIndex]->m_Allocations.size() - 1;

+            }

+        }

+        

+        BlockInfo* pSrcBlockInfo = m_Blocks[srcBlockIndex];

+        AllocationInfo& allocInfo = pSrcBlockInfo->m_Allocations[srcAllocIndex];

+

+        const VkDeviceSize size = allocInfo.m_hAllocation->GetSize();

+        const VkDeviceSize srcOffset = allocInfo.m_hAllocation->GetOffset();

+        const VkDeviceSize alignment = allocInfo.m_hAllocation->GetAlignment();

+        const VmaSuballocationType suballocType = allocInfo.m_hAllocation->GetSuballocationType();

+

+        // 2. Try to find new place for this allocation in preceding or current block.

+        for(size_t dstBlockIndex = 0; dstBlockIndex <= srcBlockIndex; ++dstBlockIndex)

+        {

+            BlockInfo* pDstBlockInfo = m_Blocks[dstBlockIndex];

+            VmaAllocationRequest dstAllocRequest;

+            if(pDstBlockInfo->m_pBlock->m_pMetadata->CreateAllocationRequest(

+                m_CurrentFrameIndex,

+                m_pBlockVector->GetFrameInUseCount(),

+                m_pBlockVector->GetBufferImageGranularity(),

+                size,

+                alignment,

+                false, // upperAddress

+                suballocType,

+                false, // canMakeOtherLost

+                strategy,

+                &dstAllocRequest) &&

+            MoveMakesSense(

+                dstBlockIndex, dstAllocRequest.offset, srcBlockIndex, srcOffset))

+            {

+                VMA_ASSERT(dstAllocRequest.itemsToMakeLostCount == 0);

+

+                // Reached limit on number of allocations or bytes to move.

+                if((m_AllocationsMoved + 1 > maxAllocationsToMove) ||

+                    (m_BytesMoved + size > maxBytesToMove))

+                {

+                    return VK_SUCCESS;

+                }

+

+                VmaDefragmentationMove move = {};

+                move.srcBlockIndex = pSrcBlockInfo->m_OriginalBlockIndex;

+                move.dstBlockIndex = pDstBlockInfo->m_OriginalBlockIndex;

+                move.srcOffset = srcOffset;

+                move.dstOffset = dstAllocRequest.offset;

+                move.size = size;

+                move.hAllocation = allocInfo.m_hAllocation;

+                move.pSrcBlock = pSrcBlockInfo->m_pBlock;

+                move.pDstBlock = pDstBlockInfo->m_pBlock;

+

+                moves.push_back(move);

+

+                pDstBlockInfo->m_pBlock->m_pMetadata->Alloc(

+                    dstAllocRequest,

+                    suballocType,

+                    size,

+                    allocInfo.m_hAllocation);

+

+                if(freeOldAllocations)

+                {

+                    pSrcBlockInfo->m_pBlock->m_pMetadata->FreeAtOffset(srcOffset);

+                    allocInfo.m_hAllocation->ChangeBlockAllocation(m_hAllocator, pDstBlockInfo->m_pBlock, dstAllocRequest.offset);

+                }

+                

+                if(allocInfo.m_pChanged != VMA_NULL)

+                {

+                    *allocInfo.m_pChanged = VK_TRUE;

+                }

+

+                ++m_AllocationsMoved;

+                m_BytesMoved += size;

+

+                VmaVectorRemove(pSrcBlockInfo->m_Allocations, srcAllocIndex);

+

+                break;

+            }

+        }

+

+        // If not processed, this allocInfo remains in pBlockInfo->m_Allocations for next round.

+

+        if(srcAllocIndex > 0)

+        {

+            --srcAllocIndex;

+        }

+        else

+        {

+            if(srcBlockIndex > 0)

+            {

+                --srcBlockIndex;

+                srcAllocIndex = SIZE_MAX;

+            }

+            else

+            {

+                return VK_SUCCESS;

+            }

+        }

+    }

+}

+

+size_t VmaDefragmentationAlgorithm_Generic::CalcBlocksWithNonMovableCount() const

+{

+    size_t result = 0;

+    for(size_t i = 0; i < m_Blocks.size(); ++i)

+    {

+        if(m_Blocks[i]->m_HasNonMovableAllocations)

+        {

+            ++result;

+        }

+    }

+    return result;

+}

+

+VkResult VmaDefragmentationAlgorithm_Generic::Defragment(

+    VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,

+    VkDeviceSize maxBytesToMove,

+    uint32_t maxAllocationsToMove,

+    VmaDefragmentationFlags flags)

+{

+    if(!m_AllAllocations && m_AllocationCount == 0)

+    {

+        return VK_SUCCESS;

+    }

+

+    const size_t blockCount = m_Blocks.size();

+    for(size_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)

+    {

+        BlockInfo* pBlockInfo = m_Blocks[blockIndex];

+

+        if(m_AllAllocations)

+        {

+            VmaBlockMetadata_Generic* pMetadata = (VmaBlockMetadata_Generic*)pBlockInfo->m_pBlock->m_pMetadata;

+            for(VmaSuballocationList::const_iterator it = pMetadata->m_Suballocations.begin();

+                it != pMetadata->m_Suballocations.end();

+                ++it)

+            {

+                if(it->type != VMA_SUBALLOCATION_TYPE_FREE)

+                {

+                    AllocationInfo allocInfo = AllocationInfo(it->hAllocation, VMA_NULL);

+                    pBlockInfo->m_Allocations.push_back(allocInfo);

+                }

+            }

+        }

+

+        pBlockInfo->CalcHasNonMovableAllocations();

+        

+        // This is a choice based on research.

+        // Option 1:

+        pBlockInfo->SortAllocationsByOffsetDescending();

+        // Option 2:

+        //pBlockInfo->SortAllocationsBySizeDescending();

+    }

+

+    // Sort m_Blocks this time by the main criterium, from most "destination" to most "source" blocks.

+    VMA_SORT(m_Blocks.begin(), m_Blocks.end(), BlockInfoCompareMoveDestination());

+

+    // This is a choice based on research.

+    const uint32_t roundCount = 2;

+

+    // Execute defragmentation rounds (the main part).

+    VkResult result = VK_SUCCESS;

+    for(uint32_t round = 0; (round < roundCount) && (result == VK_SUCCESS); ++round)

+    {

+        result = DefragmentRound(moves, maxBytesToMove, maxAllocationsToMove, !(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL));

+    }

+

+    return result;

+}

+

+bool VmaDefragmentationAlgorithm_Generic::MoveMakesSense(

+        size_t dstBlockIndex, VkDeviceSize dstOffset,

+        size_t srcBlockIndex, VkDeviceSize srcOffset)

+{

+    if(dstBlockIndex < srcBlockIndex)

+    {

+        return true;

+    }

+    if(dstBlockIndex > srcBlockIndex)

+    {

+        return false;

+    }

+    if(dstOffset < srcOffset)

+    {

+        return true;

+    }

+    return false;

+}

+

+////////////////////////////////////////////////////////////////////////////////

+// VmaDefragmentationAlgorithm_Fast

+

+VmaDefragmentationAlgorithm_Fast::VmaDefragmentationAlgorithm_Fast(

+    VmaAllocator hAllocator,

+    VmaBlockVector* pBlockVector,

+    uint32_t currentFrameIndex,

+    bool overlappingMoveSupported) :

+    VmaDefragmentationAlgorithm(hAllocator, pBlockVector, currentFrameIndex),

+    m_OverlappingMoveSupported(overlappingMoveSupported),

+    m_AllocationCount(0),

+    m_AllAllocations(false),

+    m_BytesMoved(0),

+    m_AllocationsMoved(0),

+    m_BlockInfos(VmaStlAllocator<BlockInfo>(hAllocator->GetAllocationCallbacks()))

+{

+    VMA_ASSERT(VMA_DEBUG_MARGIN == 0);

+

+}

+

+VmaDefragmentationAlgorithm_Fast::~VmaDefragmentationAlgorithm_Fast()

+{

+}

+

+VkResult VmaDefragmentationAlgorithm_Fast::Defragment(

+    VmaVector< VmaDefragmentationMove, VmaStlAllocator<VmaDefragmentationMove> >& moves,

+    VkDeviceSize maxBytesToMove,

+    uint32_t maxAllocationsToMove,

+    VmaDefragmentationFlags flags)

+{

+    VMA_ASSERT(m_AllAllocations || m_pBlockVector->CalcAllocationCount() == m_AllocationCount);

+

+    const size_t blockCount = m_pBlockVector->GetBlockCount();

+    if(blockCount == 0 || maxBytesToMove == 0 || maxAllocationsToMove == 0)

+    {

+        return VK_SUCCESS;

+    }

+

+    PreprocessMetadata();

+

+    // Sort blocks in order from most destination.

+

+    m_BlockInfos.resize(blockCount);

+    for(size_t i = 0; i < blockCount; ++i)

+    {

+        m_BlockInfos[i].origBlockIndex = i;

+    }

+

+    VMA_SORT(m_BlockInfos.begin(), m_BlockInfos.end(), [this](const BlockInfo& lhs, const BlockInfo& rhs) -> bool {

+        return m_pBlockVector->GetBlock(lhs.origBlockIndex)->m_pMetadata->GetSumFreeSize() <

+            m_pBlockVector->GetBlock(rhs.origBlockIndex)->m_pMetadata->GetSumFreeSize();

+    });

+

+    // THE MAIN ALGORITHM

+

+    FreeSpaceDatabase freeSpaceDb;

+

+    size_t dstBlockInfoIndex = 0;

+    size_t dstOrigBlockIndex = m_BlockInfos[dstBlockInfoIndex].origBlockIndex;

+    VmaDeviceMemoryBlock* pDstBlock = m_pBlockVector->GetBlock(dstOrigBlockIndex);

+    VmaBlockMetadata_Generic* pDstMetadata = (VmaBlockMetadata_Generic*)pDstBlock->m_pMetadata;

+    VkDeviceSize dstBlockSize = pDstMetadata->GetSize();

+    VkDeviceSize dstOffset = 0;

+

+    bool end = false;

+    for(size_t srcBlockInfoIndex = 0; !end && srcBlockInfoIndex < blockCount; ++srcBlockInfoIndex)

+    {

+        const size_t srcOrigBlockIndex = m_BlockInfos[srcBlockInfoIndex].origBlockIndex;

+        VmaDeviceMemoryBlock* const pSrcBlock = m_pBlockVector->GetBlock(srcOrigBlockIndex);

+        VmaBlockMetadata_Generic* const pSrcMetadata = (VmaBlockMetadata_Generic*)pSrcBlock->m_pMetadata;

+        for(VmaSuballocationList::iterator srcSuballocIt = pSrcMetadata->m_Suballocations.begin();

+            !end && srcSuballocIt != pSrcMetadata->m_Suballocations.end(); )

+        {

+            VmaAllocation_T* const pAlloc = srcSuballocIt->hAllocation;

+            const VkDeviceSize srcAllocAlignment = pAlloc->GetAlignment();

+            const VkDeviceSize srcAllocSize = srcSuballocIt->size;

+            if(m_AllocationsMoved == maxAllocationsToMove ||

+                m_BytesMoved + srcAllocSize > maxBytesToMove)

+            {

+                end = true;

+                break;

+            }

+            const VkDeviceSize srcAllocOffset = srcSuballocIt->offset;

+

+            VmaDefragmentationMove move = {};

+            // Try to place it in one of free spaces from the database.

+            size_t freeSpaceInfoIndex;

+            VkDeviceSize dstAllocOffset;

+            if(freeSpaceDb.Fetch(srcAllocAlignment, srcAllocSize,

+                freeSpaceInfoIndex, dstAllocOffset))

+            {

+                size_t freeSpaceOrigBlockIndex = m_BlockInfos[freeSpaceInfoIndex].origBlockIndex;

+                VmaDeviceMemoryBlock* pFreeSpaceBlock = m_pBlockVector->GetBlock(freeSpaceOrigBlockIndex);

+                VmaBlockMetadata_Generic* pFreeSpaceMetadata = (VmaBlockMetadata_Generic*)pFreeSpaceBlock->m_pMetadata;

+

+                // Same block

+                if(freeSpaceInfoIndex == srcBlockInfoIndex)

+                {

+                    VMA_ASSERT(dstAllocOffset <= srcAllocOffset);

+

+                    // MOVE OPTION 1: Move the allocation inside the same block by decreasing offset.

+

+                    VmaSuballocation suballoc = *srcSuballocIt;

+                    suballoc.offset = dstAllocOffset;

+                    suballoc.hAllocation->ChangeOffset(dstAllocOffset);

+                    m_BytesMoved += srcAllocSize;

+                    ++m_AllocationsMoved;

+                    

+                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;

+                    ++nextSuballocIt;

+                    pSrcMetadata->m_Suballocations.erase(srcSuballocIt);

+                    srcSuballocIt = nextSuballocIt;

+

+                    InsertSuballoc(pFreeSpaceMetadata, suballoc);

+

+                    move.srcBlockIndex = srcOrigBlockIndex;

+                    move.dstBlockIndex = freeSpaceOrigBlockIndex;

+                    move.srcOffset = srcAllocOffset;

+                    move.dstOffset = dstAllocOffset;

+                    move.size = srcAllocSize;

+                    

+                    moves.push_back(move);

+                }

+                // Different block

+                else

+                {

+                    // MOVE OPTION 2: Move the allocation to a different block.

+

+                    VMA_ASSERT(freeSpaceInfoIndex < srcBlockInfoIndex);

+

+                    VmaSuballocation suballoc = *srcSuballocIt;

+                    suballoc.offset = dstAllocOffset;

+                    suballoc.hAllocation->ChangeBlockAllocation(m_hAllocator, pFreeSpaceBlock, dstAllocOffset);

+                    m_BytesMoved += srcAllocSize;

+                    ++m_AllocationsMoved;

+

+                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;

+                    ++nextSuballocIt;

+                    pSrcMetadata->m_Suballocations.erase(srcSuballocIt);

+                    srcSuballocIt = nextSuballocIt;

+

+                    InsertSuballoc(pFreeSpaceMetadata, suballoc);

+

+                    move.srcBlockIndex = srcOrigBlockIndex;

+                    move.dstBlockIndex = freeSpaceOrigBlockIndex;

+                    move.srcOffset = srcAllocOffset;

+                    move.dstOffset = dstAllocOffset;

+                    move.size = srcAllocSize;

+                    

+                    moves.push_back(move);

+                }

+            }

+            else

+            {

+                dstAllocOffset = VmaAlignUp(dstOffset, srcAllocAlignment);

+

+                // If the allocation doesn't fit before the end of dstBlock, forward to next block.

+                while(dstBlockInfoIndex < srcBlockInfoIndex &&

+                    dstAllocOffset + srcAllocSize > dstBlockSize)

+                {

+                    // But before that, register remaining free space at the end of dst block.

+                    freeSpaceDb.Register(dstBlockInfoIndex, dstOffset, dstBlockSize - dstOffset);

+

+                    ++dstBlockInfoIndex;

+                    dstOrigBlockIndex = m_BlockInfos[dstBlockInfoIndex].origBlockIndex;

+                    pDstBlock = m_pBlockVector->GetBlock(dstOrigBlockIndex);

+                    pDstMetadata = (VmaBlockMetadata_Generic*)pDstBlock->m_pMetadata;

+                    dstBlockSize = pDstMetadata->GetSize();

+                    dstOffset = 0;

+                    dstAllocOffset = 0;

+                }

+

+                // Same block

+                if(dstBlockInfoIndex == srcBlockInfoIndex)

+                {

+                    VMA_ASSERT(dstAllocOffset <= srcAllocOffset);

+

+                    const bool overlap = dstAllocOffset + srcAllocSize > srcAllocOffset;

+

+                    bool skipOver = overlap;

+                    if(overlap && m_OverlappingMoveSupported && dstAllocOffset < srcAllocOffset)

+                    {

+                        // If destination and source place overlap, skip if it would move it

+                        // by only < 1/64 of its size.

+                        skipOver = (srcAllocOffset - dstAllocOffset) * 64 < srcAllocSize;

+                    }

+

+                    if(skipOver)

+                    {

+                        freeSpaceDb.Register(dstBlockInfoIndex, dstOffset, srcAllocOffset - dstOffset);

+

+                        dstOffset = srcAllocOffset + srcAllocSize;

+                        ++srcSuballocIt;

+                    }

+                    // MOVE OPTION 1: Move the allocation inside the same block by decreasing offset.

+                    else

+                    {

+                        srcSuballocIt->offset = dstAllocOffset;

+                        srcSuballocIt->hAllocation->ChangeOffset(dstAllocOffset);

+                        dstOffset = dstAllocOffset + srcAllocSize;

+                        m_BytesMoved += srcAllocSize;

+                        ++m_AllocationsMoved;

+                        ++srcSuballocIt;

+                        

+                        move.srcBlockIndex = srcOrigBlockIndex;

+                        move.dstBlockIndex = dstOrigBlockIndex;

+                        move.srcOffset = srcAllocOffset;

+                        move.dstOffset = dstAllocOffset;

+                        move.size = srcAllocSize;

+                        

+                        moves.push_back(move);

+                    }

+                }

+                // Different block

+                else

+                {

+                    // MOVE OPTION 2: Move the allocation to a different block.

+

+                    VMA_ASSERT(dstBlockInfoIndex < srcBlockInfoIndex);

+                    VMA_ASSERT(dstAllocOffset + srcAllocSize <= dstBlockSize);

+

+                    VmaSuballocation suballoc = *srcSuballocIt;

+                    suballoc.offset = dstAllocOffset;

+                    suballoc.hAllocation->ChangeBlockAllocation(m_hAllocator, pDstBlock, dstAllocOffset);

+                    dstOffset = dstAllocOffset + srcAllocSize;

+                    m_BytesMoved += srcAllocSize;

+                    ++m_AllocationsMoved;

+

+                    VmaSuballocationList::iterator nextSuballocIt = srcSuballocIt;

+                    ++nextSuballocIt;

+                    pSrcMetadata->m_Suballocations.erase(srcSuballocIt);

+                    srcSuballocIt = nextSuballocIt;

+

+                    pDstMetadata->m_Suballocations.push_back(suballoc);

+

+                    move.srcBlockIndex = srcOrigBlockIndex;

+                    move.dstBlockIndex = dstOrigBlockIndex;

+                    move.srcOffset = srcAllocOffset;

+                    move.dstOffset = dstAllocOffset;

+                    move.size = srcAllocSize;

+                    

+                    moves.push_back(move);

+                }

+            }

+        }

+    }

+

+    m_BlockInfos.clear();

+    

+    PostprocessMetadata();

+

+    return VK_SUCCESS;

+}

+

+void VmaDefragmentationAlgorithm_Fast::PreprocessMetadata()

+{

+    const size_t blockCount = m_pBlockVector->GetBlockCount();

+    for(size_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)

+    {

+        VmaBlockMetadata_Generic* const pMetadata =

+            (VmaBlockMetadata_Generic*)m_pBlockVector->GetBlock(blockIndex)->m_pMetadata;

+        pMetadata->m_FreeCount = 0;

+        pMetadata->m_SumFreeSize = pMetadata->GetSize();

+        pMetadata->m_FreeSuballocationsBySize.clear();

+        for(VmaSuballocationList::iterator it = pMetadata->m_Suballocations.begin();

+            it != pMetadata->m_Suballocations.end(); )

+        {

+            if(it->type == VMA_SUBALLOCATION_TYPE_FREE)

+            {

+                VmaSuballocationList::iterator nextIt = it;

+                ++nextIt;

+                pMetadata->m_Suballocations.erase(it);

+                it = nextIt;

+            }

+            else

+            {

+                ++it;

+            }

+        }

+    }

+}

+

+void VmaDefragmentationAlgorithm_Fast::PostprocessMetadata()

+{

+    const size_t blockCount = m_pBlockVector->GetBlockCount();

+    for(size_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)

+    {

+        VmaBlockMetadata_Generic* const pMetadata =

+            (VmaBlockMetadata_Generic*)m_pBlockVector->GetBlock(blockIndex)->m_pMetadata;

+        const VkDeviceSize blockSize = pMetadata->GetSize();

+        

+        // No allocations in this block - entire area is free.

+        if(pMetadata->m_Suballocations.empty())

+        {

+            pMetadata->m_FreeCount = 1;

+            //pMetadata->m_SumFreeSize is already set to blockSize.

+            VmaSuballocation suballoc = {

+                0, // offset

+                blockSize, // size

+                VMA_NULL, // hAllocation

+                VMA_SUBALLOCATION_TYPE_FREE };

+            pMetadata->m_Suballocations.push_back(suballoc);

+            pMetadata->RegisterFreeSuballocation(pMetadata->m_Suballocations.begin());

+        }

+        // There are some allocations in this block.

+        else

+        {

+            VkDeviceSize offset = 0;

+            VmaSuballocationList::iterator it;

+            for(it = pMetadata->m_Suballocations.begin();

+                it != pMetadata->m_Suballocations.end();

+                ++it)

+            {

+                VMA_ASSERT(it->type != VMA_SUBALLOCATION_TYPE_FREE);

+                VMA_ASSERT(it->offset >= offset);

+

+                // Need to insert preceding free space.

+                if(it->offset > offset)

+                {

+                    ++pMetadata->m_FreeCount;

+                    const VkDeviceSize freeSize = it->offset - offset;

+                    VmaSuballocation suballoc = {

+                        offset, // offset

+                        freeSize, // size

+                        VMA_NULL, // hAllocation

+                        VMA_SUBALLOCATION_TYPE_FREE };

+                    VmaSuballocationList::iterator precedingFreeIt = pMetadata->m_Suballocations.insert(it, suballoc);

+                    if(freeSize >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)

+                    {

+                        pMetadata->m_FreeSuballocationsBySize.push_back(precedingFreeIt);

+                    }

+                }

+

+                pMetadata->m_SumFreeSize -= it->size;

+                offset = it->offset + it->size;

+            }

+

+            // Need to insert trailing free space.

+            if(offset < blockSize)

+            {

+                ++pMetadata->m_FreeCount;

+                const VkDeviceSize freeSize = blockSize - offset;

+                VmaSuballocation suballoc = {

+                    offset, // offset

+                    freeSize, // size

+                    VMA_NULL, // hAllocation

+                    VMA_SUBALLOCATION_TYPE_FREE };

+                VMA_ASSERT(it == pMetadata->m_Suballocations.end());

+                VmaSuballocationList::iterator trailingFreeIt = pMetadata->m_Suballocations.insert(it, suballoc);

+                if(freeSize > VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)

+                {

+                    pMetadata->m_FreeSuballocationsBySize.push_back(trailingFreeIt);

+                }

+            }

+

+            VMA_SORT(

+                pMetadata->m_FreeSuballocationsBySize.begin(),

+                pMetadata->m_FreeSuballocationsBySize.end(),

+                VmaSuballocationItemSizeLess());

+        }

+

+        VMA_HEAVY_ASSERT(pMetadata->Validate());

+    }

+}

+

+void VmaDefragmentationAlgorithm_Fast::InsertSuballoc(VmaBlockMetadata_Generic* pMetadata, const VmaSuballocation& suballoc)

+{

+    // TODO: Optimize somehow. Remember iterator instead of searching for it linearly.

+    VmaSuballocationList::iterator it = pMetadata->m_Suballocations.begin();

+    while(it != pMetadata->m_Suballocations.end())

+    {

+        if(it->offset < suballoc.offset)

+        {

+            ++it;

+        }

+    }

+    pMetadata->m_Suballocations.insert(it, suballoc);

+}

+

+////////////////////////////////////////////////////////////////////////////////

+// VmaBlockVectorDefragmentationContext

+

+VmaBlockVectorDefragmentationContext::VmaBlockVectorDefragmentationContext(

+    VmaAllocator hAllocator,

+    VmaPool hCustomPool,

+    VmaBlockVector* pBlockVector,

+    uint32_t currFrameIndex) :

+    res(VK_SUCCESS),

+    mutexLocked(false),

+    blockContexts(VmaStlAllocator<VmaBlockDefragmentationContext>(hAllocator->GetAllocationCallbacks())),

+    defragmentationMoves(VmaStlAllocator<VmaDefragmentationMove>(hAllocator->GetAllocationCallbacks())),

+    defragmentationMovesProcessed(0),

+    defragmentationMovesCommitted(0),

+    hasDefragmentationPlan(0),

+    m_hAllocator(hAllocator),

+    m_hCustomPool(hCustomPool),

+    m_pBlockVector(pBlockVector),

+    m_CurrFrameIndex(currFrameIndex),

+    m_pAlgorithm(VMA_NULL),

+    m_Allocations(VmaStlAllocator<AllocInfo>(hAllocator->GetAllocationCallbacks())),

+    m_AllAllocations(false)

+{

+}

+

+VmaBlockVectorDefragmentationContext::~VmaBlockVectorDefragmentationContext()

+{

+    vma_delete(m_hAllocator, m_pAlgorithm);

+}

+

+void VmaBlockVectorDefragmentationContext::AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged)

+{

+    AllocInfo info = { hAlloc, pChanged };

+    m_Allocations.push_back(info);

+}

+

+void VmaBlockVectorDefragmentationContext::Begin(bool overlappingMoveSupported, VmaDefragmentationFlags flags)

+{

+    const bool allAllocations = m_AllAllocations ||

+        m_Allocations.size() == m_pBlockVector->CalcAllocationCount();

+

+    /********************************

+    HERE IS THE CHOICE OF DEFRAGMENTATION ALGORITHM.

+    ********************************/

+

+    /*

+    Fast algorithm is supported only when certain criteria are met:

+    - VMA_DEBUG_MARGIN is 0.

+    - All allocations in this block vector are moveable.

+    - There is no possibility of image/buffer granularity conflict.

+    - The defragmentation is not incremental

+    */

+    if(VMA_DEBUG_MARGIN == 0 &&

+        allAllocations &&

+        !m_pBlockVector->IsBufferImageGranularityConflictPossible() &&

+        !(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL))

+    {

+        m_pAlgorithm = vma_new(m_hAllocator, VmaDefragmentationAlgorithm_Fast)(

+            m_hAllocator, m_pBlockVector, m_CurrFrameIndex, overlappingMoveSupported);

+    }

+    else

+    {

+        m_pAlgorithm = vma_new(m_hAllocator, VmaDefragmentationAlgorithm_Generic)(

+            m_hAllocator, m_pBlockVector, m_CurrFrameIndex, overlappingMoveSupported);

+    }

+

+    if(allAllocations)

+    {

+        m_pAlgorithm->AddAll();

+    }

+    else

+    {

+        for(size_t i = 0, count = m_Allocations.size(); i < count; ++i)

+        {

+            m_pAlgorithm->AddAllocation(m_Allocations[i].hAlloc, m_Allocations[i].pChanged);

+        }

+    }

+}

+

+////////////////////////////////////////////////////////////////////////////////

+// VmaDefragmentationContext

+

+VmaDefragmentationContext_T::VmaDefragmentationContext_T(

+    VmaAllocator hAllocator,

+    uint32_t currFrameIndex,

+    uint32_t flags,

+    VmaDefragmentationStats* pStats) :

+    m_hAllocator(hAllocator),

+    m_CurrFrameIndex(currFrameIndex),

+    m_Flags(flags),

+    m_pStats(pStats),

+    m_CustomPoolContexts(VmaStlAllocator<VmaBlockVectorDefragmentationContext*>(hAllocator->GetAllocationCallbacks()))

+{

+    memset(m_DefaultPoolContexts, 0, sizeof(m_DefaultPoolContexts));

+}

+

+VmaDefragmentationContext_T::~VmaDefragmentationContext_T()

+{

+    for(size_t i = m_CustomPoolContexts.size(); i--; )

+    {

+        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_CustomPoolContexts[i];

+        pBlockVectorCtx->GetBlockVector()->DefragmentationEnd(pBlockVectorCtx, m_Flags, m_pStats);

+        vma_delete(m_hAllocator, pBlockVectorCtx);

+    }

+    for(size_t i = m_hAllocator->m_MemProps.memoryTypeCount; i--; )

+    {

+        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_DefaultPoolContexts[i];

+        if(pBlockVectorCtx)

+        {

+            pBlockVectorCtx->GetBlockVector()->DefragmentationEnd(pBlockVectorCtx, m_Flags, m_pStats);

+            vma_delete(m_hAllocator, pBlockVectorCtx);

+        }

+    }

+}

+

+void VmaDefragmentationContext_T::AddPools(uint32_t poolCount, const VmaPool* pPools)

+{

+    for(uint32_t poolIndex = 0; poolIndex < poolCount; ++poolIndex)

+    {

+        VmaPool pool = pPools[poolIndex];

+        VMA_ASSERT(pool);

+        // Pools with algorithm other than default are not defragmented.

+        if(pool->m_BlockVector.GetAlgorithm() == 0)

+        {

+            VmaBlockVectorDefragmentationContext* pBlockVectorDefragCtx = VMA_NULL;

+            

+            for(size_t i = m_CustomPoolContexts.size(); i--; )

+            {

+                if(m_CustomPoolContexts[i]->GetCustomPool() == pool)

+                {

+                    pBlockVectorDefragCtx = m_CustomPoolContexts[i];

+                    break;

+                }

+            }

+            

+            if(!pBlockVectorDefragCtx)

+            {

+                pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(

+                    m_hAllocator,

+                    pool,

+                    &pool->m_BlockVector,

+                    m_CurrFrameIndex);

+                m_CustomPoolContexts.push_back(pBlockVectorDefragCtx);

+            }

+

+            pBlockVectorDefragCtx->AddAll();

+        }

+    }

+}

+

+void VmaDefragmentationContext_T::AddAllocations(

+    uint32_t allocationCount,

+    const VmaAllocation* pAllocations,

+    VkBool32* pAllocationsChanged)

+{

+    // Dispatch pAllocations among defragmentators. Create them when necessary.

+    for(uint32_t allocIndex = 0; allocIndex < allocationCount; ++allocIndex)

+    {

+        const VmaAllocation hAlloc = pAllocations[allocIndex];

+        VMA_ASSERT(hAlloc);

+        // DedicatedAlloc cannot be defragmented.

+        if((hAlloc->GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK) &&

+            // Lost allocation cannot be defragmented.

+            (hAlloc->GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST))

+        {

+            VmaBlockVectorDefragmentationContext* pBlockVectorDefragCtx = VMA_NULL;

+

+            const VmaPool hAllocPool = hAlloc->GetBlock()->GetParentPool();

+            // This allocation belongs to custom pool.

+            if(hAllocPool != VK_NULL_HANDLE)

+            {

+                // Pools with algorithm other than default are not defragmented.

+                if(hAllocPool->m_BlockVector.GetAlgorithm() == 0)

+                {

+                    for(size_t i = m_CustomPoolContexts.size(); i--; )

+                    {

+                        if(m_CustomPoolContexts[i]->GetCustomPool() == hAllocPool)

+                        {

+                            pBlockVectorDefragCtx = m_CustomPoolContexts[i];

+                            break;

+                        }

+                    }

+                    if(!pBlockVectorDefragCtx)

+                    {

+                        pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(

+                            m_hAllocator,

+                            hAllocPool,

+                            &hAllocPool->m_BlockVector,

+                            m_CurrFrameIndex);

+                        m_CustomPoolContexts.push_back(pBlockVectorDefragCtx);

+                    }

+                }

+            }

+            // This allocation belongs to default pool.

+            else

+            {

+                const uint32_t memTypeIndex = hAlloc->GetMemoryTypeIndex();

+                pBlockVectorDefragCtx = m_DefaultPoolContexts[memTypeIndex];

+                if(!pBlockVectorDefragCtx)

+                {

+                    pBlockVectorDefragCtx = vma_new(m_hAllocator, VmaBlockVectorDefragmentationContext)(

+                        m_hAllocator,

+                        VMA_NULL, // hCustomPool

+                        m_hAllocator->m_pBlockVectors[memTypeIndex],

+                        m_CurrFrameIndex);

+                    m_DefaultPoolContexts[memTypeIndex] = pBlockVectorDefragCtx;

+                }

+            }

+

+            if(pBlockVectorDefragCtx)

+            {

+                VkBool32* const pChanged = (pAllocationsChanged != VMA_NULL) ?

+                    &pAllocationsChanged[allocIndex] : VMA_NULL;

+                pBlockVectorDefragCtx->AddAllocation(hAlloc, pChanged);

+            }

+        }

+    }

+}

+

+VkResult VmaDefragmentationContext_T::Defragment(

+    VkDeviceSize maxCpuBytesToMove, uint32_t maxCpuAllocationsToMove,

+    VkDeviceSize maxGpuBytesToMove, uint32_t maxGpuAllocationsToMove,

+    VkCommandBuffer commandBuffer, VmaDefragmentationStats* pStats, VmaDefragmentationFlags flags)

+{

+    if(pStats)

+    {

+        memset(pStats, 0, sizeof(VmaDefragmentationStats));

+    }

+

+    if(flags & VMA_DEFRAGMENTATION_FLAG_INCREMENTAL)

+    {

+        // For incremental defragmetnations, we just earmark how much we can move

+        // The real meat is in the defragmentation steps

+        m_MaxCpuBytesToMove = maxCpuBytesToMove;

+        m_MaxCpuAllocationsToMove = maxCpuAllocationsToMove;

+

+        m_MaxGpuBytesToMove = maxGpuBytesToMove;

+        m_MaxGpuAllocationsToMove = maxGpuAllocationsToMove;

+

+        if(m_MaxCpuBytesToMove == 0 && m_MaxCpuAllocationsToMove == 0 &&

+            m_MaxGpuBytesToMove == 0 && m_MaxGpuAllocationsToMove == 0)

+            return VK_SUCCESS;

+

+        return VK_NOT_READY;

+    }

+

+    if(commandBuffer == VK_NULL_HANDLE)

+    {

+        maxGpuBytesToMove = 0;

+        maxGpuAllocationsToMove = 0;

+    }

+

+    VkResult res = VK_SUCCESS;

+

+    // Process default pools.

+    for(uint32_t memTypeIndex = 0;

+        memTypeIndex < m_hAllocator->GetMemoryTypeCount() && res >= VK_SUCCESS;

+        ++memTypeIndex)

+    {

+        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];

+        if(pBlockVectorCtx)

+        {

+            VMA_ASSERT(pBlockVectorCtx->GetBlockVector());

+            pBlockVectorCtx->GetBlockVector()->Defragment(

+                pBlockVectorCtx,

+                pStats, flags,

+                maxCpuBytesToMove, maxCpuAllocationsToMove,

+                maxGpuBytesToMove, maxGpuAllocationsToMove,

+                commandBuffer);

+            if(pBlockVectorCtx->res != VK_SUCCESS)

+            {

+                res = pBlockVectorCtx->res;

+            }

+        }

+    }

+

+    // Process custom pools.

+    for(size_t customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();

+        customCtxIndex < customCtxCount && res >= VK_SUCCESS;

+        ++customCtxIndex)

+    {

+        VmaBlockVectorDefragmentationContext* pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];

+        VMA_ASSERT(pBlockVectorCtx && pBlockVectorCtx->GetBlockVector());

+        pBlockVectorCtx->GetBlockVector()->Defragment(

+            pBlockVectorCtx,

+            pStats, flags,

+            maxCpuBytesToMove, maxCpuAllocationsToMove,

+            maxGpuBytesToMove, maxGpuAllocationsToMove,

+            commandBuffer);

+        if(pBlockVectorCtx->res != VK_SUCCESS)

+        {

+            res = pBlockVectorCtx->res;

+        }

+    }

+

+    return res;

+}

+

+VkResult VmaDefragmentationContext_T::DefragmentPassBegin(VmaDefragmentationPassInfo* pInfo)

+{

+    VmaDefragmentationPassMoveInfo* pCurrentMove = pInfo->pMoves;

+    uint32_t movesLeft = pInfo->moveCount;

+

+    // Process default pools.

+    for(uint32_t memTypeIndex = 0;

+        memTypeIndex < m_hAllocator->GetMemoryTypeCount();

+        ++memTypeIndex)

+    {

+        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];

+        if(pBlockVectorCtx)

+        {

+            VMA_ASSERT(pBlockVectorCtx->GetBlockVector());

+

+            if(!pBlockVectorCtx->hasDefragmentationPlan)

+            {

+                pBlockVectorCtx->GetBlockVector()->Defragment(

+                    pBlockVectorCtx,

+                    m_pStats, m_Flags,

+                    m_MaxCpuBytesToMove, m_MaxCpuAllocationsToMove,

+                    m_MaxGpuBytesToMove, m_MaxGpuAllocationsToMove,

+                    VK_NULL_HANDLE);

+

+                if(pBlockVectorCtx->res < VK_SUCCESS)

+                    continue;

+

+                pBlockVectorCtx->hasDefragmentationPlan = true;

+            }

+

+            const uint32_t processed = pBlockVectorCtx->GetBlockVector()->ProcessDefragmentations(

+                pBlockVectorCtx,

+                pCurrentMove, movesLeft);

+

+            movesLeft -= processed;

+            pCurrentMove += processed;

+        }

+    }

+

+    // Process custom pools.

+    for(size_t customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();

+        customCtxIndex < customCtxCount;

+        ++customCtxIndex)

+    {

+        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];

+        VMA_ASSERT(pBlockVectorCtx && pBlockVectorCtx->GetBlockVector());

+

+        if(!pBlockVectorCtx->hasDefragmentationPlan)

+        {

+            pBlockVectorCtx->GetBlockVector()->Defragment(

+                pBlockVectorCtx,

+                m_pStats, m_Flags,

+                m_MaxCpuBytesToMove, m_MaxCpuAllocationsToMove,

+                m_MaxGpuBytesToMove, m_MaxGpuAllocationsToMove,

+                VK_NULL_HANDLE);

+

+            if(pBlockVectorCtx->res < VK_SUCCESS)

+                continue;

+

+            pBlockVectorCtx->hasDefragmentationPlan = true;

+        }

+

+        const uint32_t processed = pBlockVectorCtx->GetBlockVector()->ProcessDefragmentations(

+            pBlockVectorCtx,

+            pCurrentMove, movesLeft);

+

+        movesLeft -= processed;

+        pCurrentMove += processed;

+    }

+

+    pInfo->moveCount = pInfo->moveCount - movesLeft;

+

+    return VK_SUCCESS;

+}

+VkResult VmaDefragmentationContext_T::DefragmentPassEnd()

+{

+    VkResult res = VK_SUCCESS;

+

+    // Process default pools.

+    for(uint32_t memTypeIndex = 0;

+        memTypeIndex < m_hAllocator->GetMemoryTypeCount();

+        ++memTypeIndex)

+    {

+        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_DefaultPoolContexts[memTypeIndex];

+        if(pBlockVectorCtx)

+        {

+            VMA_ASSERT(pBlockVectorCtx->GetBlockVector());

+

+            if(!pBlockVectorCtx->hasDefragmentationPlan)

+            {

+                res = VK_NOT_READY;

+                continue;

+            }

+

+            pBlockVectorCtx->GetBlockVector()->CommitDefragmentations(

+                pBlockVectorCtx, m_pStats);

+

+            if(pBlockVectorCtx->defragmentationMoves.size() != pBlockVectorCtx->defragmentationMovesCommitted)

+                res = VK_NOT_READY;

+        }

+    }

+

+    // Process custom pools.

+    for(size_t customCtxIndex = 0, customCtxCount = m_CustomPoolContexts.size();

+        customCtxIndex < customCtxCount;

+        ++customCtxIndex)

+    {

+        VmaBlockVectorDefragmentationContext *pBlockVectorCtx = m_CustomPoolContexts[customCtxIndex];

+        VMA_ASSERT(pBlockVectorCtx && pBlockVectorCtx->GetBlockVector());

+

+        if(!pBlockVectorCtx->hasDefragmentationPlan)

+        {

+            res = VK_NOT_READY;

+            continue;

+        }

+

+        pBlockVectorCtx->GetBlockVector()->CommitDefragmentations(

+            pBlockVectorCtx, m_pStats);

+

+        if(pBlockVectorCtx->defragmentationMoves.size() != pBlockVectorCtx->defragmentationMovesCommitted)

+            res = VK_NOT_READY;

+    }

+

+    return res;

+}

+

+////////////////////////////////////////////////////////////////////////////////

+// VmaRecorder

+

+#if VMA_RECORDING_ENABLED

+

+VmaRecorder::VmaRecorder() :

+    m_UseMutex(true),

+    m_Flags(0),

+    m_File(VMA_NULL),

+    m_Freq(INT64_MAX),

+    m_StartCounter(INT64_MAX)

+{

+}

+

+VkResult VmaRecorder::Init(const VmaRecordSettings& settings, bool useMutex)

+{

+    m_UseMutex = useMutex;

+    m_Flags = settings.flags;

+

+    QueryPerformanceFrequency((LARGE_INTEGER*)&m_Freq);

+    QueryPerformanceCounter((LARGE_INTEGER*)&m_StartCounter);

+

+    // Open file for writing.

+    errno_t err = fopen_s(&m_File, settings.pFilePath, "wb");

+    if(err != 0)

+    {

+        return VK_ERROR_INITIALIZATION_FAILED;

+    }

+

+    // Write header.

+    fprintf(m_File, "%s\n", "Vulkan Memory Allocator,Calls recording");

+    fprintf(m_File, "%s\n", "1,8");

+

+    return VK_SUCCESS;

+}

+

+VmaRecorder::~VmaRecorder()

+{

+    if(m_File != VMA_NULL)

+    {

+        fclose(m_File);

+    }

+}

+

+void VmaRecorder::RecordCreateAllocator(uint32_t frameIndex)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaCreateAllocator\n", callParams.threadId, callParams.time, frameIndex);

+    Flush();

+}

+

+void VmaRecorder::RecordDestroyAllocator(uint32_t frameIndex)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaDestroyAllocator\n", callParams.threadId, callParams.time, frameIndex);

+    Flush();

+}

+

+void VmaRecorder::RecordCreatePool(uint32_t frameIndex, const VmaPoolCreateInfo& createInfo, VmaPool pool)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaCreatePool,%u,%u,%llu,%llu,%llu,%u,%p\n", callParams.threadId, callParams.time, frameIndex,

+        createInfo.memoryTypeIndex,

+        createInfo.flags,

+        createInfo.blockSize,

+        (uint64_t)createInfo.minBlockCount,

+        (uint64_t)createInfo.maxBlockCount,

+        createInfo.frameInUseCount,

+        pool);

+    Flush();

+}

+

+void VmaRecorder::RecordDestroyPool(uint32_t frameIndex, VmaPool pool)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaDestroyPool,%p\n", callParams.threadId, callParams.time, frameIndex,

+        pool);

+    Flush();

+}

+

+void VmaRecorder::RecordAllocateMemory(uint32_t frameIndex,

+        const VkMemoryRequirements& vkMemReq,

+        const VmaAllocationCreateInfo& createInfo,

+        VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    UserDataString userDataStr(createInfo.flags, createInfo.pUserData);

+    fprintf(m_File, "%u,%.3f,%u,vmaAllocateMemory,%llu,%llu,%u,%u,%u,%u,%u,%u,%p,%p,%s\n", callParams.threadId, callParams.time, frameIndex,

+        vkMemReq.size,

+        vkMemReq.alignment,

+        vkMemReq.memoryTypeBits,

+        createInfo.flags,

+        createInfo.usage,

+        createInfo.requiredFlags,

+        createInfo.preferredFlags,

+        createInfo.memoryTypeBits,

+        createInfo.pool,

+        allocation,

+        userDataStr.GetString());

+    Flush();

+}

+

+void VmaRecorder::RecordAllocateMemoryPages(uint32_t frameIndex,

+    const VkMemoryRequirements& vkMemReq,

+    const VmaAllocationCreateInfo& createInfo,

+    uint64_t allocationCount,

+    const VmaAllocation* pAllocations)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    UserDataString userDataStr(createInfo.flags, createInfo.pUserData);

+    fprintf(m_File, "%u,%.3f,%u,vmaAllocateMemoryPages,%llu,%llu,%u,%u,%u,%u,%u,%u,%p,", callParams.threadId, callParams.time, frameIndex,

+        vkMemReq.size,

+        vkMemReq.alignment,

+        vkMemReq.memoryTypeBits,

+        createInfo.flags,

+        createInfo.usage,

+        createInfo.requiredFlags,

+        createInfo.preferredFlags,

+        createInfo.memoryTypeBits,

+        createInfo.pool);

+    PrintPointerList(allocationCount, pAllocations);

+    fprintf(m_File, ",%s\n", userDataStr.GetString());

+    Flush();

+}

+

+void VmaRecorder::RecordAllocateMemoryForBuffer(uint32_t frameIndex,

+    const VkMemoryRequirements& vkMemReq,

+    bool requiresDedicatedAllocation,

+    bool prefersDedicatedAllocation,

+    const VmaAllocationCreateInfo& createInfo,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    UserDataString userDataStr(createInfo.flags, createInfo.pUserData);

+    fprintf(m_File, "%u,%.3f,%u,vmaAllocateMemoryForBuffer,%llu,%llu,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n", callParams.threadId, callParams.time, frameIndex,

+        vkMemReq.size,

+        vkMemReq.alignment,

+        vkMemReq.memoryTypeBits,

+        requiresDedicatedAllocation ? 1 : 0,

+        prefersDedicatedAllocation ? 1 : 0,

+        createInfo.flags,

+        createInfo.usage,

+        createInfo.requiredFlags,

+        createInfo.preferredFlags,

+        createInfo.memoryTypeBits,

+        createInfo.pool,

+        allocation,

+        userDataStr.GetString());

+    Flush();

+}

+

+void VmaRecorder::RecordAllocateMemoryForImage(uint32_t frameIndex,

+    const VkMemoryRequirements& vkMemReq,

+    bool requiresDedicatedAllocation,

+    bool prefersDedicatedAllocation,

+    const VmaAllocationCreateInfo& createInfo,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    UserDataString userDataStr(createInfo.flags, createInfo.pUserData);

+    fprintf(m_File, "%u,%.3f,%u,vmaAllocateMemoryForImage,%llu,%llu,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n", callParams.threadId, callParams.time, frameIndex,

+        vkMemReq.size,

+        vkMemReq.alignment,

+        vkMemReq.memoryTypeBits,

+        requiresDedicatedAllocation ? 1 : 0,

+        prefersDedicatedAllocation ? 1 : 0,

+        createInfo.flags,

+        createInfo.usage,

+        createInfo.requiredFlags,

+        createInfo.preferredFlags,

+        createInfo.memoryTypeBits,

+        createInfo.pool,

+        allocation,

+        userDataStr.GetString());

+    Flush();

+}

+

+void VmaRecorder::RecordFreeMemory(uint32_t frameIndex,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaFreeMemory,%p\n", callParams.threadId, callParams.time, frameIndex,

+        allocation);

+    Flush();

+}

+

+void VmaRecorder::RecordFreeMemoryPages(uint32_t frameIndex,

+    uint64_t allocationCount,

+    const VmaAllocation* pAllocations)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaFreeMemoryPages,", callParams.threadId, callParams.time, frameIndex);

+    PrintPointerList(allocationCount, pAllocations);

+    fprintf(m_File, "\n");

+    Flush();

+}

+

+void VmaRecorder::RecordSetAllocationUserData(uint32_t frameIndex,

+    VmaAllocation allocation,

+    const void* pUserData)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    UserDataString userDataStr(

+        allocation->IsUserDataString() ? VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT : 0,

+        pUserData);

+    fprintf(m_File, "%u,%.3f,%u,vmaSetAllocationUserData,%p,%s\n", callParams.threadId, callParams.time, frameIndex,

+        allocation,

+        userDataStr.GetString());

+    Flush();

+}

+

+void VmaRecorder::RecordCreateLostAllocation(uint32_t frameIndex,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaCreateLostAllocation,%p\n", callParams.threadId, callParams.time, frameIndex,

+        allocation);

+    Flush();

+}

+

+void VmaRecorder::RecordMapMemory(uint32_t frameIndex,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaMapMemory,%p\n", callParams.threadId, callParams.time, frameIndex,

+        allocation);

+    Flush();

+}

+

+void VmaRecorder::RecordUnmapMemory(uint32_t frameIndex,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaUnmapMemory,%p\n", callParams.threadId, callParams.time, frameIndex,

+        allocation);

+    Flush();

+}

+

+void VmaRecorder::RecordFlushAllocation(uint32_t frameIndex,

+    VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaFlushAllocation,%p,%llu,%llu\n", callParams.threadId, callParams.time, frameIndex,

+        allocation,

+        offset,

+        size);

+    Flush();

+}

+

+void VmaRecorder::RecordInvalidateAllocation(uint32_t frameIndex,

+    VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaInvalidateAllocation,%p,%llu,%llu\n", callParams.threadId, callParams.time, frameIndex,

+        allocation,

+        offset,

+        size);

+    Flush();

+}

+

+void VmaRecorder::RecordCreateBuffer(uint32_t frameIndex,

+    const VkBufferCreateInfo& bufCreateInfo,

+    const VmaAllocationCreateInfo& allocCreateInfo,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    UserDataString userDataStr(allocCreateInfo.flags, allocCreateInfo.pUserData);

+    fprintf(m_File, "%u,%.3f,%u,vmaCreateBuffer,%u,%llu,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n", callParams.threadId, callParams.time, frameIndex,

+        bufCreateInfo.flags,

+        bufCreateInfo.size,

+        bufCreateInfo.usage,

+        bufCreateInfo.sharingMode,

+        allocCreateInfo.flags,

+        allocCreateInfo.usage,

+        allocCreateInfo.requiredFlags,

+        allocCreateInfo.preferredFlags,

+        allocCreateInfo.memoryTypeBits,

+        allocCreateInfo.pool,

+        allocation,

+        userDataStr.GetString());

+    Flush();

+}

+

+void VmaRecorder::RecordCreateImage(uint32_t frameIndex,

+    const VkImageCreateInfo& imageCreateInfo,

+    const VmaAllocationCreateInfo& allocCreateInfo,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    UserDataString userDataStr(allocCreateInfo.flags, allocCreateInfo.pUserData);

+    fprintf(m_File, "%u,%.3f,%u,vmaCreateImage,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%p,%p,%s\n", callParams.threadId, callParams.time, frameIndex,

+        imageCreateInfo.flags,

+        imageCreateInfo.imageType,

+        imageCreateInfo.format,

+        imageCreateInfo.extent.width,

+        imageCreateInfo.extent.height,

+        imageCreateInfo.extent.depth,

+        imageCreateInfo.mipLevels,

+        imageCreateInfo.arrayLayers,

+        imageCreateInfo.samples,

+        imageCreateInfo.tiling,

+        imageCreateInfo.usage,

+        imageCreateInfo.sharingMode,

+        imageCreateInfo.initialLayout,

+        allocCreateInfo.flags,

+        allocCreateInfo.usage,

+        allocCreateInfo.requiredFlags,

+        allocCreateInfo.preferredFlags,

+        allocCreateInfo.memoryTypeBits,

+        allocCreateInfo.pool,

+        allocation,

+        userDataStr.GetString());

+    Flush();

+}

+

+void VmaRecorder::RecordDestroyBuffer(uint32_t frameIndex,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaDestroyBuffer,%p\n", callParams.threadId, callParams.time, frameIndex,

+        allocation);

+    Flush();

+}

+

+void VmaRecorder::RecordDestroyImage(uint32_t frameIndex,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaDestroyImage,%p\n", callParams.threadId, callParams.time, frameIndex,

+        allocation);

+    Flush();

+}

+

+void VmaRecorder::RecordTouchAllocation(uint32_t frameIndex,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaTouchAllocation,%p\n", callParams.threadId, callParams.time, frameIndex,

+        allocation);

+    Flush();

+}

+

+void VmaRecorder::RecordGetAllocationInfo(uint32_t frameIndex,

+    VmaAllocation allocation)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaGetAllocationInfo,%p\n", callParams.threadId, callParams.time, frameIndex,

+        allocation);

+    Flush();

+}

+

+void VmaRecorder::RecordMakePoolAllocationsLost(uint32_t frameIndex,

+    VmaPool pool)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaMakePoolAllocationsLost,%p\n", callParams.threadId, callParams.time, frameIndex,

+        pool);

+    Flush();

+}

+

+void VmaRecorder::RecordDefragmentationBegin(uint32_t frameIndex,

+    const VmaDefragmentationInfo2& info,

+    VmaDefragmentationContext ctx)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaDefragmentationBegin,%u,", callParams.threadId, callParams.time, frameIndex,

+        info.flags);

+    PrintPointerList(info.allocationCount, info.pAllocations);

+    fprintf(m_File, ",");

+    PrintPointerList(info.poolCount, info.pPools);

+    fprintf(m_File, ",%llu,%u,%llu,%u,%p,%p\n",

+        info.maxCpuBytesToMove,

+        info.maxCpuAllocationsToMove,

+        info.maxGpuBytesToMove,

+        info.maxGpuAllocationsToMove,

+        info.commandBuffer,

+        ctx);

+    Flush();

+}

+

+void VmaRecorder::RecordDefragmentationEnd(uint32_t frameIndex,

+    VmaDefragmentationContext ctx)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaDefragmentationEnd,%p\n", callParams.threadId, callParams.time, frameIndex,

+        ctx);

+    Flush();

+}

+

+void VmaRecorder::RecordSetPoolName(uint32_t frameIndex,

+    VmaPool pool,

+    const char* name)

+{

+    CallParams callParams;

+    GetBasicParams(callParams);

+

+    VmaMutexLock lock(m_FileMutex, m_UseMutex);

+    fprintf(m_File, "%u,%.3f,%u,vmaSetPoolName,%p,%s\n", callParams.threadId, callParams.time, frameIndex,

+        pool, name != VMA_NULL ? name : "");

+    Flush();

+}

+

+VmaRecorder::UserDataString::UserDataString(VmaAllocationCreateFlags allocFlags, const void* pUserData)

+{

+    if(pUserData != VMA_NULL)

+    {

+        if((allocFlags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0)

+        {

+            m_Str = (const char*)pUserData;

+        }

+        else

+        {

+            sprintf_s(m_PtrStr, "%p", pUserData);

+            m_Str = m_PtrStr;

+        }

+    }

+    else

+    {

+        m_Str = "";

+    }

+}

+

+void VmaRecorder::WriteConfiguration(

+    const VkPhysicalDeviceProperties& devProps,

+    const VkPhysicalDeviceMemoryProperties& memProps,

+    uint32_t vulkanApiVersion,

+    bool dedicatedAllocationExtensionEnabled,

+    bool bindMemory2ExtensionEnabled,

+    bool memoryBudgetExtensionEnabled,

+    bool deviceCoherentMemoryExtensionEnabled)

+{

+    fprintf(m_File, "Config,Begin\n");

+

+    fprintf(m_File, "VulkanApiVersion,%u,%u\n", VK_VERSION_MAJOR(vulkanApiVersion), VK_VERSION_MINOR(vulkanApiVersion));

+

+    fprintf(m_File, "PhysicalDevice,apiVersion,%u\n", devProps.apiVersion);

+    fprintf(m_File, "PhysicalDevice,driverVersion,%u\n", devProps.driverVersion);

+    fprintf(m_File, "PhysicalDevice,vendorID,%u\n", devProps.vendorID);

+    fprintf(m_File, "PhysicalDevice,deviceID,%u\n", devProps.deviceID);

+    fprintf(m_File, "PhysicalDevice,deviceType,%u\n", devProps.deviceType);

+    fprintf(m_File, "PhysicalDevice,deviceName,%s\n", devProps.deviceName);

+

+    fprintf(m_File, "PhysicalDeviceLimits,maxMemoryAllocationCount,%u\n", devProps.limits.maxMemoryAllocationCount);

+    fprintf(m_File, "PhysicalDeviceLimits,bufferImageGranularity,%llu\n", devProps.limits.bufferImageGranularity);

+    fprintf(m_File, "PhysicalDeviceLimits,nonCoherentAtomSize,%llu\n", devProps.limits.nonCoherentAtomSize);

+

+    fprintf(m_File, "PhysicalDeviceMemory,HeapCount,%u\n", memProps.memoryHeapCount);

+    for(uint32_t i = 0; i < memProps.memoryHeapCount; ++i)

+    {

+        fprintf(m_File, "PhysicalDeviceMemory,Heap,%u,size,%llu\n", i, memProps.memoryHeaps[i].size);

+        fprintf(m_File, "PhysicalDeviceMemory,Heap,%u,flags,%u\n", i, memProps.memoryHeaps[i].flags);

+    }

+    fprintf(m_File, "PhysicalDeviceMemory,TypeCount,%u\n", memProps.memoryTypeCount);

+    for(uint32_t i = 0; i < memProps.memoryTypeCount; ++i)

+    {

+        fprintf(m_File, "PhysicalDeviceMemory,Type,%u,heapIndex,%u\n", i, memProps.memoryTypes[i].heapIndex);

+        fprintf(m_File, "PhysicalDeviceMemory,Type,%u,propertyFlags,%u\n", i, memProps.memoryTypes[i].propertyFlags);

+    }

+

+    fprintf(m_File, "Extension,VK_KHR_dedicated_allocation,%u\n", dedicatedAllocationExtensionEnabled ? 1 : 0);

+    fprintf(m_File, "Extension,VK_KHR_bind_memory2,%u\n", bindMemory2ExtensionEnabled ? 1 : 0);

+    fprintf(m_File, "Extension,VK_EXT_memory_budget,%u\n", memoryBudgetExtensionEnabled ? 1 : 0);

+    fprintf(m_File, "Extension,VK_AMD_device_coherent_memory,%u\n", deviceCoherentMemoryExtensionEnabled ? 1 : 0);

+

+    fprintf(m_File, "Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,%u\n", VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ? 1 : 0);

+    fprintf(m_File, "Macro,VMA_DEBUG_ALIGNMENT,%llu\n", (VkDeviceSize)VMA_DEBUG_ALIGNMENT);

+    fprintf(m_File, "Macro,VMA_DEBUG_MARGIN,%llu\n", (VkDeviceSize)VMA_DEBUG_MARGIN);

+    fprintf(m_File, "Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,%u\n", VMA_DEBUG_INITIALIZE_ALLOCATIONS ? 1 : 0);

+    fprintf(m_File, "Macro,VMA_DEBUG_DETECT_CORRUPTION,%u\n", VMA_DEBUG_DETECT_CORRUPTION ? 1 : 0);

+    fprintf(m_File, "Macro,VMA_DEBUG_GLOBAL_MUTEX,%u\n", VMA_DEBUG_GLOBAL_MUTEX ? 1 : 0);

+    fprintf(m_File, "Macro,VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY,%llu\n", (VkDeviceSize)VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY);

+    fprintf(m_File, "Macro,VMA_SMALL_HEAP_MAX_SIZE,%llu\n", (VkDeviceSize)VMA_SMALL_HEAP_MAX_SIZE);

+    fprintf(m_File, "Macro,VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE,%llu\n", (VkDeviceSize)VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE);

+

+    fprintf(m_File, "Config,End\n");

+}

+

+void VmaRecorder::GetBasicParams(CallParams& outParams)

+{

+    outParams.threadId = GetCurrentThreadId();

+

+    LARGE_INTEGER counter;

+    QueryPerformanceCounter(&counter);

+    outParams.time = (double)(counter.QuadPart - m_StartCounter) / (double)m_Freq;

+}

+

+void VmaRecorder::PrintPointerList(uint64_t count, const VmaAllocation* pItems)

+{

+    if(count)

+    {

+        fprintf(m_File, "%p", pItems[0]);

+        for(uint64_t i = 1; i < count; ++i)

+        {

+            fprintf(m_File, " %p", pItems[i]);

+        }

+    }

+}

+

+void VmaRecorder::Flush()

+{

+    if((m_Flags & VMA_RECORD_FLUSH_AFTER_CALL_BIT) != 0)

+    {

+        fflush(m_File);

+    }

+}

+

+#endif // #if VMA_RECORDING_ENABLED

+

+////////////////////////////////////////////////////////////////////////////////

+// VmaAllocationObjectAllocator

+

+VmaAllocationObjectAllocator::VmaAllocationObjectAllocator(const VkAllocationCallbacks* pAllocationCallbacks) :

+    m_Allocator(pAllocationCallbacks, 1024)

+{

+}

+

+template<typename... Types> VmaAllocation VmaAllocationObjectAllocator::Allocate(Types... args)

+{

+    VmaMutexLock mutexLock(m_Mutex);

+    return m_Allocator.Alloc<Types...>(std::forward<Types>(args)...);

+}

+

+void VmaAllocationObjectAllocator::Free(VmaAllocation hAlloc)

+{

+    VmaMutexLock mutexLock(m_Mutex);

+    m_Allocator.Free(hAlloc);

+}

+

+////////////////////////////////////////////////////////////////////////////////

+// VmaAllocator_T

+

+VmaAllocator_T::VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo) :

+    m_UseMutex((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT) == 0),

+    m_VulkanApiVersion(pCreateInfo->vulkanApiVersion != 0 ? pCreateInfo->vulkanApiVersion : VK_API_VERSION_1_0),

+    m_UseKhrDedicatedAllocation((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT) != 0),

+    m_UseKhrBindMemory2((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT) != 0),

+    m_UseExtMemoryBudget((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT) != 0),

+    m_UseAmdDeviceCoherentMemory((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT) != 0),

+    m_UseKhrBufferDeviceAddress((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT) != 0),

+    m_hDevice(pCreateInfo->device),

+    m_hInstance(pCreateInfo->instance),

+    m_AllocationCallbacksSpecified(pCreateInfo->pAllocationCallbacks != VMA_NULL),

+    m_AllocationCallbacks(pCreateInfo->pAllocationCallbacks ?

+        *pCreateInfo->pAllocationCallbacks : VmaEmptyAllocationCallbacks),

+    m_AllocationObjectAllocator(&m_AllocationCallbacks),

+    m_HeapSizeLimitMask(0),

+    m_PreferredLargeHeapBlockSize(0),

+    m_PhysicalDevice(pCreateInfo->physicalDevice),

+    m_CurrentFrameIndex(0),

+    m_GpuDefragmentationMemoryTypeBits(UINT32_MAX),

+    m_Pools(VmaStlAllocator<VmaPool>(GetAllocationCallbacks())),

+    m_NextPoolId(0),

+    m_GlobalMemoryTypeBits(UINT32_MAX)

+#if VMA_RECORDING_ENABLED

+    ,m_pRecorder(VMA_NULL)

+#endif

+{

+    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))

+    {

+        m_UseKhrDedicatedAllocation = false;

+        m_UseKhrBindMemory2 = false;

+    }

+

+    if(VMA_DEBUG_DETECT_CORRUPTION)

+    {

+        // Needs to be multiply of uint32_t size because we are going to write VMA_CORRUPTION_DETECTION_MAGIC_VALUE to it.

+        VMA_ASSERT(VMA_DEBUG_MARGIN % sizeof(uint32_t) == 0);

+    }

+

+    VMA_ASSERT(pCreateInfo->physicalDevice && pCreateInfo->device && pCreateInfo->instance);

+

+    if(m_VulkanApiVersion < VK_MAKE_VERSION(1, 1, 0))

+    {

+#if !(VMA_DEDICATED_ALLOCATION)

+        if((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT) != 0)

+        {

+            VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT set but required extensions are disabled by preprocessor macros.");

+        }

+#endif

+#if !(VMA_BIND_MEMORY2)

+        if((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT) != 0)

+        {

+            VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT set but required extension is disabled by preprocessor macros.");

+        }

+#endif

+    }

+#if !(VMA_MEMORY_BUDGET)

+    if((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT) != 0)

+    {

+        VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT set but required extension is disabled by preprocessor macros.");

+    }

+#endif

+#if !(VMA_BUFFER_DEVICE_ADDRESS)

+    if(m_UseKhrBufferDeviceAddress)

+    {

+        VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT is set but required extension or Vulkan 1.2 is not available in your Vulkan header or its support in VMA has been disabled by a preprocessor macro.");

+    }

+#endif

+#if VMA_VULKAN_VERSION < 1002000

+    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 2, 0))

+    {

+        VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros.");

+    }

+#endif

+#if VMA_VULKAN_VERSION < 1001000

+    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))

+    {

+        VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_1 but required Vulkan version is disabled by preprocessor macros.");

+    }

+#endif

+

+    memset(&m_DeviceMemoryCallbacks, 0 ,sizeof(m_DeviceMemoryCallbacks));

+    memset(&m_PhysicalDeviceProperties, 0, sizeof(m_PhysicalDeviceProperties));

+    memset(&m_MemProps, 0, sizeof(m_MemProps));

+        

+    memset(&m_pBlockVectors, 0, sizeof(m_pBlockVectors));

+    memset(&m_pDedicatedAllocations, 0, sizeof(m_pDedicatedAllocations));

+    memset(&m_VulkanFunctions, 0, sizeof(m_VulkanFunctions));

+

+    if(pCreateInfo->pDeviceMemoryCallbacks != VMA_NULL)

+    {

+        m_DeviceMemoryCallbacks.pUserData = pCreateInfo->pDeviceMemoryCallbacks->pUserData;

+        m_DeviceMemoryCallbacks.pfnAllocate = pCreateInfo->pDeviceMemoryCallbacks->pfnAllocate;

+        m_DeviceMemoryCallbacks.pfnFree = pCreateInfo->pDeviceMemoryCallbacks->pfnFree;

+    }

+

+    ImportVulkanFunctions(pCreateInfo->pVulkanFunctions);

+

+    (*m_VulkanFunctions.vkGetPhysicalDeviceProperties)(m_PhysicalDevice, &m_PhysicalDeviceProperties);

+    (*m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties)(m_PhysicalDevice, &m_MemProps);

+

+    VMA_ASSERT(VmaIsPow2(VMA_DEBUG_ALIGNMENT));

+    VMA_ASSERT(VmaIsPow2(VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY));

+    VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.bufferImageGranularity));

+    VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.nonCoherentAtomSize));

+

+    m_PreferredLargeHeapBlockSize = (pCreateInfo->preferredLargeHeapBlockSize != 0) ?

+        pCreateInfo->preferredLargeHeapBlockSize : static_cast<VkDeviceSize>(VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE);

+

+    m_GlobalMemoryTypeBits = CalculateGlobalMemoryTypeBits();

+

+    if(pCreateInfo->pHeapSizeLimit != VMA_NULL)

+    {

+        for(uint32_t heapIndex = 0; heapIndex < GetMemoryHeapCount(); ++heapIndex)

+        {

+            const VkDeviceSize limit = pCreateInfo->pHeapSizeLimit[heapIndex];

+            if(limit != VK_WHOLE_SIZE)

+            {

+                m_HeapSizeLimitMask |= 1u << heapIndex;

+                if(limit < m_MemProps.memoryHeaps[heapIndex].size)

+                {

+                    m_MemProps.memoryHeaps[heapIndex].size = limit;

+                }

+            }

+        }

+    }

+

+    for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)

+    {

+        const VkDeviceSize preferredBlockSize = CalcPreferredBlockSize(memTypeIndex);

+

+        m_pBlockVectors[memTypeIndex] = vma_new(this, VmaBlockVector)(

+            this,

+            VK_NULL_HANDLE, // hParentPool

+            memTypeIndex,

+            preferredBlockSize,

+            0,

+            SIZE_MAX,

+            GetBufferImageGranularity(),

+            pCreateInfo->frameInUseCount,

+            false, // explicitBlockSize

+            false); // linearAlgorithm

+        // No need to call m_pBlockVectors[memTypeIndex][blockVectorTypeIndex]->CreateMinBlocks here,

+        // becase minBlockCount is 0.

+        m_pDedicatedAllocations[memTypeIndex] = vma_new(this, AllocationVectorType)(VmaStlAllocator<VmaAllocation>(GetAllocationCallbacks()));

+

+    }

+}

+

+VkResult VmaAllocator_T::Init(const VmaAllocatorCreateInfo* pCreateInfo)

+{

+    VkResult res = VK_SUCCESS;

+

+    if(pCreateInfo->pRecordSettings != VMA_NULL &&

+        !VmaStrIsEmpty(pCreateInfo->pRecordSettings->pFilePath))

+    {

+#if VMA_RECORDING_ENABLED

+        m_pRecorder = vma_new(this, VmaRecorder)();

+        res = m_pRecorder->Init(*pCreateInfo->pRecordSettings, m_UseMutex);

+        if(res != VK_SUCCESS)

+        {

+            return res;

+        }

+        m_pRecorder->WriteConfiguration(

+            m_PhysicalDeviceProperties,

+            m_MemProps,

+            m_VulkanApiVersion,

+            m_UseKhrDedicatedAllocation,

+            m_UseKhrBindMemory2,

+            m_UseExtMemoryBudget,

+            m_UseAmdDeviceCoherentMemory);

+        m_pRecorder->RecordCreateAllocator(GetCurrentFrameIndex());

+#else

+        VMA_ASSERT(0 && "VmaAllocatorCreateInfo::pRecordSettings used, but not supported due to VMA_RECORDING_ENABLED not defined to 1.");

+        return VK_ERROR_FEATURE_NOT_PRESENT;

+#endif

+    }

+

+#if VMA_MEMORY_BUDGET

+    if(m_UseExtMemoryBudget)

+    {

+        UpdateVulkanBudget();

+    }

+#endif // #if VMA_MEMORY_BUDGET

+

+    return res;

+}

+

+VmaAllocator_T::~VmaAllocator_T()

+{

+#if VMA_RECORDING_ENABLED

+    if(m_pRecorder != VMA_NULL)

+    {

+        m_pRecorder->RecordDestroyAllocator(GetCurrentFrameIndex());

+        vma_delete(this, m_pRecorder);

+    }

+#endif

+    

+    VMA_ASSERT(m_Pools.empty());

+

+    for(size_t i = GetMemoryTypeCount(); i--; )

+    {

+        if(m_pDedicatedAllocations[i] != VMA_NULL && !m_pDedicatedAllocations[i]->empty())

+        {

+            VMA_ASSERT(0 && "Unfreed dedicated allocations found.");

+        }

+

+        vma_delete(this, m_pDedicatedAllocations[i]);

+        vma_delete(this, m_pBlockVectors[i]);

+    }

+}

+

+void VmaAllocator_T::ImportVulkanFunctions(const VmaVulkanFunctions* pVulkanFunctions)

+{

+#if VMA_STATIC_VULKAN_FUNCTIONS == 1

+    ImportVulkanFunctions_Static();

+#endif

+

+    if(pVulkanFunctions != VMA_NULL)

+    {

+        ImportVulkanFunctions_Custom(pVulkanFunctions);

+    }

+

+#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1

+    ImportVulkanFunctions_Dynamic();

+#endif

+

+    ValidateVulkanFunctions();

+}

+

+#if VMA_STATIC_VULKAN_FUNCTIONS == 1

+

+void VmaAllocator_T::ImportVulkanFunctions_Static()

+{

+    // Vulkan 1.0

+    m_VulkanFunctions.vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties)vkGetPhysicalDeviceProperties;

+    m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties)vkGetPhysicalDeviceMemoryProperties;

+    m_VulkanFunctions.vkAllocateMemory = (PFN_vkAllocateMemory)vkAllocateMemory;

+    m_VulkanFunctions.vkFreeMemory = (PFN_vkFreeMemory)vkFreeMemory;

+    m_VulkanFunctions.vkMapMemory = (PFN_vkMapMemory)vkMapMemory;

+    m_VulkanFunctions.vkUnmapMemory = (PFN_vkUnmapMemory)vkUnmapMemory;

+    m_VulkanFunctions.vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges)vkFlushMappedMemoryRanges;

+    m_VulkanFunctions.vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges)vkInvalidateMappedMemoryRanges;

+    m_VulkanFunctions.vkBindBufferMemory = (PFN_vkBindBufferMemory)vkBindBufferMemory;

+    m_VulkanFunctions.vkBindImageMemory = (PFN_vkBindImageMemory)vkBindImageMemory;

+    m_VulkanFunctions.vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements)vkGetBufferMemoryRequirements;

+    m_VulkanFunctions.vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements)vkGetImageMemoryRequirements;

+    m_VulkanFunctions.vkCreateBuffer = (PFN_vkCreateBuffer)vkCreateBuffer;

+    m_VulkanFunctions.vkDestroyBuffer = (PFN_vkDestroyBuffer)vkDestroyBuffer;

+    m_VulkanFunctions.vkCreateImage = (PFN_vkCreateImage)vkCreateImage;

+    m_VulkanFunctions.vkDestroyImage = (PFN_vkDestroyImage)vkDestroyImage;

+    m_VulkanFunctions.vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer)vkCmdCopyBuffer;

+

+    // Vulkan 1.1

+#if VMA_VULKAN_VERSION >= 1001000

+    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))

+    {

+        m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR = (PFN_vkGetBufferMemoryRequirements2)vkGetBufferMemoryRequirements2;

+        m_VulkanFunctions.vkGetImageMemoryRequirements2KHR = (PFN_vkGetImageMemoryRequirements2)vkGetImageMemoryRequirements2;

+        m_VulkanFunctions.vkBindBufferMemory2KHR = (PFN_vkBindBufferMemory2)vkBindBufferMemory2;

+        m_VulkanFunctions.vkBindImageMemory2KHR = (PFN_vkBindImageMemory2)vkBindImageMemory2;

+        m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties2KHR = (PFN_vkGetPhysicalDeviceMemoryProperties2)vkGetPhysicalDeviceMemoryProperties2;

+    }

+#endif

+}

+

+#endif // #if VMA_STATIC_VULKAN_FUNCTIONS == 1

+

+void VmaAllocator_T::ImportVulkanFunctions_Custom(const VmaVulkanFunctions* pVulkanFunctions)

+{

+    VMA_ASSERT(pVulkanFunctions != VMA_NULL);

+

+#define VMA_COPY_IF_NOT_NULL(funcName) \

+    if(pVulkanFunctions->funcName != VMA_NULL) m_VulkanFunctions.funcName = pVulkanFunctions->funcName;

+

+    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceProperties);

+    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceMemoryProperties);

+    VMA_COPY_IF_NOT_NULL(vkAllocateMemory);

+    VMA_COPY_IF_NOT_NULL(vkFreeMemory);

+    VMA_COPY_IF_NOT_NULL(vkMapMemory);

+    VMA_COPY_IF_NOT_NULL(vkUnmapMemory);

+    VMA_COPY_IF_NOT_NULL(vkFlushMappedMemoryRanges);

+    VMA_COPY_IF_NOT_NULL(vkInvalidateMappedMemoryRanges);

+    VMA_COPY_IF_NOT_NULL(vkBindBufferMemory);

+    VMA_COPY_IF_NOT_NULL(vkBindImageMemory);

+    VMA_COPY_IF_NOT_NULL(vkGetBufferMemoryRequirements);

+    VMA_COPY_IF_NOT_NULL(vkGetImageMemoryRequirements);

+    VMA_COPY_IF_NOT_NULL(vkCreateBuffer);

+    VMA_COPY_IF_NOT_NULL(vkDestroyBuffer);

+    VMA_COPY_IF_NOT_NULL(vkCreateImage);

+    VMA_COPY_IF_NOT_NULL(vkDestroyImage);

+    VMA_COPY_IF_NOT_NULL(vkCmdCopyBuffer);

+

+#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000

+    VMA_COPY_IF_NOT_NULL(vkGetBufferMemoryRequirements2KHR);

+    VMA_COPY_IF_NOT_NULL(vkGetImageMemoryRequirements2KHR);

+#endif

+

+#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION >= 1001000

+    VMA_COPY_IF_NOT_NULL(vkBindBufferMemory2KHR);

+    VMA_COPY_IF_NOT_NULL(vkBindImageMemory2KHR);

+#endif

+

+#if VMA_MEMORY_BUDGET

+    VMA_COPY_IF_NOT_NULL(vkGetPhysicalDeviceMemoryProperties2KHR);

+#endif

+

+#undef VMA_COPY_IF_NOT_NULL

+}

+

+#if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1

+

+void VmaAllocator_T::ImportVulkanFunctions_Dynamic()

+{

+#define VMA_FETCH_INSTANCE_FUNC(memberName, functionPointerType, functionNameString) \

+    if(m_VulkanFunctions.memberName == VMA_NULL) \

+        m_VulkanFunctions.memberName = \

+            (functionPointerType)vkGetInstanceProcAddr(m_hInstance, functionNameString);

+#define VMA_FETCH_DEVICE_FUNC(memberName, functionPointerType, functionNameString) \

+    if(m_VulkanFunctions.memberName == VMA_NULL) \

+        m_VulkanFunctions.memberName = \

+            (functionPointerType)vkGetDeviceProcAddr(m_hDevice, functionNameString);

+

+    VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceProperties, PFN_vkGetPhysicalDeviceProperties, "vkGetPhysicalDeviceProperties");

+    VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceMemoryProperties, PFN_vkGetPhysicalDeviceMemoryProperties, "vkGetPhysicalDeviceMemoryProperties");

+    VMA_FETCH_DEVICE_FUNC(vkAllocateMemory, PFN_vkAllocateMemory, "vkAllocateMemory");

+    VMA_FETCH_DEVICE_FUNC(vkFreeMemory, PFN_vkFreeMemory, "vkFreeMemory");

+    VMA_FETCH_DEVICE_FUNC(vkMapMemory, PFN_vkMapMemory, "vkMapMemory");

+    VMA_FETCH_DEVICE_FUNC(vkUnmapMemory, PFN_vkUnmapMemory, "vkUnmapMemory");

+    VMA_FETCH_DEVICE_FUNC(vkFlushMappedMemoryRanges, PFN_vkFlushMappedMemoryRanges, "vkFlushMappedMemoryRanges");

+    VMA_FETCH_DEVICE_FUNC(vkInvalidateMappedMemoryRanges, PFN_vkInvalidateMappedMemoryRanges, "vkInvalidateMappedMemoryRanges");

+    VMA_FETCH_DEVICE_FUNC(vkBindBufferMemory, PFN_vkBindBufferMemory, "vkBindBufferMemory");

+    VMA_FETCH_DEVICE_FUNC(vkBindImageMemory, PFN_vkBindImageMemory, "vkBindImageMemory");

+    VMA_FETCH_DEVICE_FUNC(vkGetBufferMemoryRequirements, PFN_vkGetBufferMemoryRequirements, "vkGetBufferMemoryRequirements");

+    VMA_FETCH_DEVICE_FUNC(vkGetImageMemoryRequirements, PFN_vkGetImageMemoryRequirements, "vkGetImageMemoryRequirements");

+    VMA_FETCH_DEVICE_FUNC(vkCreateBuffer, PFN_vkCreateBuffer, "vkCreateBuffer");

+    VMA_FETCH_DEVICE_FUNC(vkDestroyBuffer, PFN_vkDestroyBuffer, "vkDestroyBuffer");

+    VMA_FETCH_DEVICE_FUNC(vkCreateImage, PFN_vkCreateImage, "vkCreateImage");

+    VMA_FETCH_DEVICE_FUNC(vkDestroyImage, PFN_vkDestroyImage, "vkDestroyImage");

+    VMA_FETCH_DEVICE_FUNC(vkCmdCopyBuffer, PFN_vkCmdCopyBuffer, "vkCmdCopyBuffer");

+

+#if VMA_DEDICATED_ALLOCATION

+    if(m_UseKhrDedicatedAllocation)

+    {

+        VMA_FETCH_DEVICE_FUNC(vkGetBufferMemoryRequirements2KHR, PFN_vkGetBufferMemoryRequirements2KHR, "vkGetBufferMemoryRequirements2KHR");

+        VMA_FETCH_DEVICE_FUNC(vkGetImageMemoryRequirements2KHR, PFN_vkGetImageMemoryRequirements2KHR, "vkGetImageMemoryRequirements2KHR");

+    }

+#endif

+

+#if VMA_BIND_MEMORY2

+    if(m_UseKhrBindMemory2)

+    {

+        VMA_FETCH_DEVICE_FUNC(vkBindBufferMemory2KHR, PFN_vkBindBufferMemory2KHR, "vkBindBufferMemory2KHR");

+        VMA_FETCH_DEVICE_FUNC(vkBindImageMemory2KHR, PFN_vkBindImageMemory2KHR, "vkBindImageMemory2KHR");

+    }

+#endif // #if VMA_BIND_MEMORY2

+

+#if VMA_MEMORY_BUDGET

+    if(m_UseExtMemoryBudget && m_VulkanApiVersion < VK_MAKE_VERSION(1, 1, 0))

+    {

+        VMA_FETCH_INSTANCE_FUNC(vkGetPhysicalDeviceMemoryProperties2KHR, PFN_vkGetPhysicalDeviceMemoryProperties2KHR, "vkGetPhysicalDeviceMemoryProperties2KHR");

+    }

+#endif // #if VMA_MEMORY_BUDGET

+

+#undef VMA_FETCH_DEVICE_FUNC

+#undef VMA_FETCH_INSTANCE_FUNC

+}

+

+#endif // #if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1

+

+void VmaAllocator_T::ValidateVulkanFunctions()

+{

+    VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceProperties != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkAllocateMemory != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkFreeMemory != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkMapMemory != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkUnmapMemory != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkFlushMappedMemoryRanges != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkInvalidateMappedMemoryRanges != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkBindBufferMemory != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkBindImageMemory != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkGetBufferMemoryRequirements != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkGetImageMemoryRequirements != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkCreateBuffer != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkDestroyBuffer != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkCreateImage != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkDestroyImage != VMA_NULL);

+    VMA_ASSERT(m_VulkanFunctions.vkCmdCopyBuffer != VMA_NULL);

+

+#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000

+    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0) || m_UseKhrDedicatedAllocation)

+    {

+        VMA_ASSERT(m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR != VMA_NULL);

+        VMA_ASSERT(m_VulkanFunctions.vkGetImageMemoryRequirements2KHR != VMA_NULL);

+    }

+#endif

+

+#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION >= 1001000

+    if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0) || m_UseKhrBindMemory2)

+    {

+        VMA_ASSERT(m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL);

+        VMA_ASSERT(m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL);

+    }

+#endif

+

+#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION >= 1001000

+    if(m_UseExtMemoryBudget || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))

+    {

+        VMA_ASSERT(m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties2KHR != VMA_NULL);

+    }

+#endif

+}

+

+VkDeviceSize VmaAllocator_T::CalcPreferredBlockSize(uint32_t memTypeIndex)

+{

+    const uint32_t heapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);

+    const VkDeviceSize heapSize = m_MemProps.memoryHeaps[heapIndex].size;

+    const bool isSmallHeap = heapSize <= VMA_SMALL_HEAP_MAX_SIZE;

+    return VmaAlignUp(isSmallHeap ? (heapSize / 8) : m_PreferredLargeHeapBlockSize, (VkDeviceSize)32);

+}

+

+VkResult VmaAllocator_T::AllocateMemoryOfType(

+    VkDeviceSize size,

+    VkDeviceSize alignment,

+    bool dedicatedAllocation,

+    VkBuffer dedicatedBuffer,

+    VkBufferUsageFlags dedicatedBufferUsage,

+    VkImage dedicatedImage,

+    const VmaAllocationCreateInfo& createInfo,

+    uint32_t memTypeIndex,

+    VmaSuballocationType suballocType,

+    size_t allocationCount,

+    VmaAllocation* pAllocations)

+{

+    VMA_ASSERT(pAllocations != VMA_NULL);

+    VMA_DEBUG_LOG("  AllocateMemory: MemoryTypeIndex=%u, AllocationCount=%zu, Size=%llu", memTypeIndex, allocationCount, size);

+

+    VmaAllocationCreateInfo finalCreateInfo = createInfo;

+

+    // If memory type is not HOST_VISIBLE, disable MAPPED.

+    if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0 &&

+        (m_MemProps.memoryTypes[memTypeIndex].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)

+    {

+        finalCreateInfo.flags &= ~VMA_ALLOCATION_CREATE_MAPPED_BIT;

+    }

+    // If memory is lazily allocated, it should be always dedicated.

+    if(finalCreateInfo.usage == VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED)

+    {

+        finalCreateInfo.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;

+    }

+

+    VmaBlockVector* const blockVector = m_pBlockVectors[memTypeIndex];

+    VMA_ASSERT(blockVector);

+

+    const VkDeviceSize preferredBlockSize = blockVector->GetPreferredBlockSize();

+    bool preferDedicatedMemory =

+        VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ||

+        dedicatedAllocation ||

+        // Heuristics: Allocate dedicated memory if requested size if greater than half of preferred block size.

+        size > preferredBlockSize / 2;

+

+    if(preferDedicatedMemory &&

+        (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) == 0 &&

+        finalCreateInfo.pool == VK_NULL_HANDLE)

+    {

+        finalCreateInfo.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;

+    }

+

+    if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT) != 0)

+    {

+        if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) != 0)

+        {

+            return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+        }

+        else

+        {

+            return AllocateDedicatedMemory(

+                size,

+                suballocType,

+                memTypeIndex,

+                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT) != 0,

+                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0,

+                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0,

+                finalCreateInfo.pUserData,

+                dedicatedBuffer,

+                dedicatedBufferUsage,

+                dedicatedImage,

+                allocationCount,

+                pAllocations);

+        }

+    }

+    else

+    {

+        VkResult res = blockVector->Allocate(

+            m_CurrentFrameIndex.load(),

+            size,

+            alignment,

+            finalCreateInfo,

+            suballocType,

+            allocationCount,

+            pAllocations);

+        if(res == VK_SUCCESS)

+        {

+            return res;

+        }

+

+        // 5. Try dedicated memory.

+        if((finalCreateInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) != 0)

+        {

+            return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+        }

+        else

+        {

+            res = AllocateDedicatedMemory(

+                size,

+                suballocType,

+                memTypeIndex,

+                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT) != 0,

+                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0,

+                (finalCreateInfo.flags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0,

+                finalCreateInfo.pUserData,

+                dedicatedBuffer,

+                dedicatedBufferUsage,

+                dedicatedImage,

+                allocationCount,

+                pAllocations);

+            if(res == VK_SUCCESS)

+            {

+                // Succeeded: AllocateDedicatedMemory function already filld pMemory, nothing more to do here.

+                VMA_DEBUG_LOG("    Allocated as DedicatedMemory");

+                return VK_SUCCESS;

+            }

+            else

+            {

+                // Everything failed: Return error code.

+                VMA_DEBUG_LOG("    vkAllocateMemory FAILED");

+                return res;

+            }

+        }

+    }

+}

+

+VkResult VmaAllocator_T::AllocateDedicatedMemory(

+    VkDeviceSize size,

+    VmaSuballocationType suballocType,

+    uint32_t memTypeIndex,

+    bool withinBudget,

+    bool map,

+    bool isUserDataString,

+    void* pUserData,

+    VkBuffer dedicatedBuffer,

+    VkBufferUsageFlags dedicatedBufferUsage,

+    VkImage dedicatedImage,

+    size_t allocationCount,

+    VmaAllocation* pAllocations)

+{

+    VMA_ASSERT(allocationCount > 0 && pAllocations);

+

+    if(withinBudget)

+    {

+        const uint32_t heapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);

+        VmaBudget heapBudget = {};

+        GetBudget(&heapBudget, heapIndex, 1);

+        if(heapBudget.usage + size * allocationCount > heapBudget.budget)

+        {

+            return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+        }

+    }

+

+    VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };

+    allocInfo.memoryTypeIndex = memTypeIndex;

+    allocInfo.allocationSize = size;

+

+#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000

+    VkMemoryDedicatedAllocateInfoKHR dedicatedAllocInfo = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR };

+    if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))

+    {

+        if(dedicatedBuffer != VK_NULL_HANDLE)

+        {

+            VMA_ASSERT(dedicatedImage == VK_NULL_HANDLE);

+            dedicatedAllocInfo.buffer = dedicatedBuffer;

+            VmaPnextChainPushFront(&allocInfo, &dedicatedAllocInfo);

+        }

+        else if(dedicatedImage != VK_NULL_HANDLE)

+        {

+            dedicatedAllocInfo.image = dedicatedImage;

+            VmaPnextChainPushFront(&allocInfo, &dedicatedAllocInfo);

+        }

+    }

+#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000

+

+#if VMA_BUFFER_DEVICE_ADDRESS

+    VkMemoryAllocateFlagsInfoKHR allocFlagsInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR };

+    if(m_UseKhrBufferDeviceAddress)

+    {

+        bool canContainBufferWithDeviceAddress = true;

+        if(dedicatedBuffer != VK_NULL_HANDLE)

+        {

+            canContainBufferWithDeviceAddress = dedicatedBufferUsage == UINT32_MAX || // Usage flags unknown

+                (dedicatedBufferUsage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT) != 0;

+        }

+        else if(dedicatedImage != VK_NULL_HANDLE)

+        {

+            canContainBufferWithDeviceAddress = false;

+        }

+        if(canContainBufferWithDeviceAddress)

+        {

+            allocFlagsInfo.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;

+            VmaPnextChainPushFront(&allocInfo, &allocFlagsInfo);

+        }

+    }

+#endif // #if VMA_BUFFER_DEVICE_ADDRESS

+

+    size_t allocIndex;

+    VkResult res = VK_SUCCESS;

+    for(allocIndex = 0; allocIndex < allocationCount; ++allocIndex)

+    {

+        res = AllocateDedicatedMemoryPage(

+            size,

+            suballocType,

+            memTypeIndex,

+            allocInfo,

+            map,

+            isUserDataString,

+            pUserData,

+            pAllocations + allocIndex);

+        if(res != VK_SUCCESS)

+        {

+            break;

+        }

+    }

+

+    if(res == VK_SUCCESS)

+    {

+        // Register them in m_pDedicatedAllocations.

+        {

+            VmaMutexLockWrite lock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);

+            AllocationVectorType* pDedicatedAllocations = m_pDedicatedAllocations[memTypeIndex];

+            VMA_ASSERT(pDedicatedAllocations);

+            for(allocIndex = 0; allocIndex < allocationCount; ++allocIndex)

+            {

+                VmaVectorInsertSorted<VmaPointerLess>(*pDedicatedAllocations, pAllocations[allocIndex]);

+            }

+        }

+

+        VMA_DEBUG_LOG("    Allocated DedicatedMemory Count=%zu, MemoryTypeIndex=#%u", allocationCount, memTypeIndex);

+    }

+    else

+    {

+        // Free all already created allocations.

+        while(allocIndex--)

+        {

+            VmaAllocation currAlloc = pAllocations[allocIndex];

+            VkDeviceMemory hMemory = currAlloc->GetMemory();

+    

+            /*

+            There is no need to call this, because Vulkan spec allows to skip vkUnmapMemory

+            before vkFreeMemory.

+

+            if(currAlloc->GetMappedData() != VMA_NULL)

+            {

+                (*m_VulkanFunctions.vkUnmapMemory)(m_hDevice, hMemory);

+            }

+            */

+    

+            FreeVulkanMemory(memTypeIndex, currAlloc->GetSize(), hMemory);

+            m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(memTypeIndex), currAlloc->GetSize());

+            currAlloc->SetUserData(this, VMA_NULL);

+            m_AllocationObjectAllocator.Free(currAlloc);

+        }

+

+        memset(pAllocations, 0, sizeof(VmaAllocation) * allocationCount);

+    }

+

+    return res;

+}

+

+VkResult VmaAllocator_T::AllocateDedicatedMemoryPage(

+    VkDeviceSize size,

+    VmaSuballocationType suballocType,

+    uint32_t memTypeIndex,

+    const VkMemoryAllocateInfo& allocInfo,

+    bool map,

+    bool isUserDataString,

+    void* pUserData,

+    VmaAllocation* pAllocation)

+{

+    VkDeviceMemory hMemory = VK_NULL_HANDLE;

+    VkResult res = AllocateVulkanMemory(&allocInfo, &hMemory);

+    if(res < 0)

+    {

+        VMA_DEBUG_LOG("    vkAllocateMemory FAILED");

+        return res;

+    }

+

+    void* pMappedData = VMA_NULL;

+    if(map)

+    {

+        res = (*m_VulkanFunctions.vkMapMemory)(

+            m_hDevice,

+            hMemory,

+            0,

+            VK_WHOLE_SIZE,

+            0,

+            &pMappedData);

+        if(res < 0)

+        {

+            VMA_DEBUG_LOG("    vkMapMemory FAILED");

+            FreeVulkanMemory(memTypeIndex, size, hMemory);

+            return res;

+        }

+    }

+

+    *pAllocation = m_AllocationObjectAllocator.Allocate(m_CurrentFrameIndex.load(), isUserDataString);

+    (*pAllocation)->InitDedicatedAllocation(memTypeIndex, hMemory, suballocType, pMappedData, size);

+    (*pAllocation)->SetUserData(this, pUserData);

+    m_Budget.AddAllocation(MemoryTypeIndexToHeapIndex(memTypeIndex), size);

+    if(VMA_DEBUG_INITIALIZE_ALLOCATIONS)

+    {

+        FillAllocation(*pAllocation, VMA_ALLOCATION_FILL_PATTERN_CREATED);

+    }

+

+    return VK_SUCCESS;

+}

+

+void VmaAllocator_T::GetBufferMemoryRequirements(

+    VkBuffer hBuffer,

+    VkMemoryRequirements& memReq,

+    bool& requiresDedicatedAllocation,

+    bool& prefersDedicatedAllocation) const

+{

+#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000

+    if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))

+    {

+        VkBufferMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR };

+        memReqInfo.buffer = hBuffer;

+

+        VkMemoryDedicatedRequirementsKHR memDedicatedReq = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR };

+

+        VkMemoryRequirements2KHR memReq2 = { VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR };

+        VmaPnextChainPushFront(&memReq2, &memDedicatedReq);

+

+        (*m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR)(m_hDevice, &memReqInfo, &memReq2);

+

+        memReq = memReq2.memoryRequirements;

+        requiresDedicatedAllocation = (memDedicatedReq.requiresDedicatedAllocation != VK_FALSE);

+        prefersDedicatedAllocation  = (memDedicatedReq.prefersDedicatedAllocation  != VK_FALSE);

+    }

+    else

+#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000

+    {

+        (*m_VulkanFunctions.vkGetBufferMemoryRequirements)(m_hDevice, hBuffer, &memReq);

+        requiresDedicatedAllocation = false;

+        prefersDedicatedAllocation  = false;

+    }

+}

+

+void VmaAllocator_T::GetImageMemoryRequirements(

+    VkImage hImage,

+    VkMemoryRequirements& memReq,

+    bool& requiresDedicatedAllocation,

+    bool& prefersDedicatedAllocation) const

+{

+#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000

+    if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))

+    {

+        VkImageMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR };

+        memReqInfo.image = hImage;

+

+        VkMemoryDedicatedRequirementsKHR memDedicatedReq = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR };

+

+        VkMemoryRequirements2KHR memReq2 = { VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR };

+        VmaPnextChainPushFront(&memReq2, &memDedicatedReq);

+

+        (*m_VulkanFunctions.vkGetImageMemoryRequirements2KHR)(m_hDevice, &memReqInfo, &memReq2);

+

+        memReq = memReq2.memoryRequirements;

+        requiresDedicatedAllocation = (memDedicatedReq.requiresDedicatedAllocation != VK_FALSE);

+        prefersDedicatedAllocation  = (memDedicatedReq.prefersDedicatedAllocation  != VK_FALSE);

+    }

+    else

+#endif // #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000

+    {

+        (*m_VulkanFunctions.vkGetImageMemoryRequirements)(m_hDevice, hImage, &memReq);

+        requiresDedicatedAllocation = false;

+        prefersDedicatedAllocation  = false;

+    }

+}

+

+VkResult VmaAllocator_T::AllocateMemory(

+    const VkMemoryRequirements& vkMemReq,

+    bool requiresDedicatedAllocation,

+    bool prefersDedicatedAllocation,

+    VkBuffer dedicatedBuffer,

+    VkBufferUsageFlags dedicatedBufferUsage,

+    VkImage dedicatedImage,

+    const VmaAllocationCreateInfo& createInfo,

+    VmaSuballocationType suballocType,

+    size_t allocationCount,

+    VmaAllocation* pAllocations)

+{

+    memset(pAllocations, 0, sizeof(VmaAllocation) * allocationCount);

+

+    VMA_ASSERT(VmaIsPow2(vkMemReq.alignment));

+

+    if(vkMemReq.size == 0)

+    {

+        return VK_ERROR_VALIDATION_FAILED_EXT;

+    }

+    if((createInfo.flags & VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT) != 0 &&

+        (createInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) != 0)

+    {

+        VMA_ASSERT(0 && "Specifying VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT together with VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT makes no sense.");

+        return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+    }

+    if((createInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0 &&

+        (createInfo.flags & VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT) != 0)

+    {

+        VMA_ASSERT(0 && "Specifying VMA_ALLOCATION_CREATE_MAPPED_BIT together with VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT is invalid.");

+        return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+    }

+    if(requiresDedicatedAllocation)

+    {

+        if((createInfo.flags & VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT) != 0)

+        {

+            VMA_ASSERT(0 && "VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT specified while dedicated allocation is required.");

+            return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+        }

+        if(createInfo.pool != VK_NULL_HANDLE)

+        {

+            VMA_ASSERT(0 && "Pool specified while dedicated allocation is required.");

+            return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+        }

+    }

+    if((createInfo.pool != VK_NULL_HANDLE) &&

+        ((createInfo.flags & (VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT)) != 0))

+    {

+        VMA_ASSERT(0 && "Specifying VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT when pool != null is invalid.");

+        return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+    }

+

+    if(createInfo.pool != VK_NULL_HANDLE)

+    {

+        const VkDeviceSize alignmentForPool = VMA_MAX(

+            vkMemReq.alignment,

+            GetMemoryTypeMinAlignment(createInfo.pool->m_BlockVector.GetMemoryTypeIndex()));

+

+        VmaAllocationCreateInfo createInfoForPool = createInfo;

+        // If memory type is not HOST_VISIBLE, disable MAPPED.

+        if((createInfoForPool.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0 &&

+            (m_MemProps.memoryTypes[createInfo.pool->m_BlockVector.GetMemoryTypeIndex()].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)

+        {

+            createInfoForPool.flags &= ~VMA_ALLOCATION_CREATE_MAPPED_BIT;

+        }

+

+        return createInfo.pool->m_BlockVector.Allocate(

+            m_CurrentFrameIndex.load(),

+            vkMemReq.size,

+            alignmentForPool,

+            createInfoForPool,

+            suballocType,

+            allocationCount,

+            pAllocations);

+    }

+    else

+    {

+        // Bit mask of memory Vulkan types acceptable for this allocation.

+        uint32_t memoryTypeBits = vkMemReq.memoryTypeBits;

+        uint32_t memTypeIndex = UINT32_MAX;

+        VkResult res = vmaFindMemoryTypeIndex(this, memoryTypeBits, &createInfo, &memTypeIndex);

+        if(res == VK_SUCCESS)

+        {

+            VkDeviceSize alignmentForMemType = VMA_MAX(

+                vkMemReq.alignment,

+                GetMemoryTypeMinAlignment(memTypeIndex));

+

+            res = AllocateMemoryOfType(

+                vkMemReq.size,

+                alignmentForMemType,

+                requiresDedicatedAllocation || prefersDedicatedAllocation,

+                dedicatedBuffer,

+                dedicatedBufferUsage,

+                dedicatedImage,

+                createInfo,

+                memTypeIndex,

+                suballocType,

+                allocationCount,

+                pAllocations);

+            // Succeeded on first try.

+            if(res == VK_SUCCESS)

+            {

+                return res;

+            }

+            // Allocation from this memory type failed. Try other compatible memory types.

+            else

+            {

+                for(;;)

+                {

+                    // Remove old memTypeIndex from list of possibilities.

+                    memoryTypeBits &= ~(1u << memTypeIndex);

+                    // Find alternative memTypeIndex.

+                    res = vmaFindMemoryTypeIndex(this, memoryTypeBits, &createInfo, &memTypeIndex);

+                    if(res == VK_SUCCESS)

+                    {

+                        alignmentForMemType = VMA_MAX(

+                            vkMemReq.alignment,

+                            GetMemoryTypeMinAlignment(memTypeIndex));

+                        

+                        res = AllocateMemoryOfType(

+                            vkMemReq.size,

+                            alignmentForMemType,

+                            requiresDedicatedAllocation || prefersDedicatedAllocation,

+                            dedicatedBuffer,

+                            dedicatedBufferUsage,

+                            dedicatedImage,

+                            createInfo,

+                            memTypeIndex,

+                            suballocType,

+                            allocationCount,

+                            pAllocations);

+                        // Allocation from this alternative memory type succeeded.

+                        if(res == VK_SUCCESS)

+                        {

+                            return res;

+                        }

+                        // else: Allocation from this memory type failed. Try next one - next loop iteration.

+                    }

+                    // No other matching memory type index could be found.

+                    else

+                    {

+                        // Not returning res, which is VK_ERROR_FEATURE_NOT_PRESENT, because we already failed to allocate once.

+                        return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+                    }

+                }

+            }

+        }

+        // Can't find any single memory type maching requirements. res is VK_ERROR_FEATURE_NOT_PRESENT.

+        else

+            return res;

+    }

+}

+

+void VmaAllocator_T::FreeMemory(

+    size_t allocationCount,

+    const VmaAllocation* pAllocations)

+{

+    VMA_ASSERT(pAllocations);

+

+    for(size_t allocIndex = allocationCount; allocIndex--; )

+    {

+        VmaAllocation allocation = pAllocations[allocIndex];

+

+        if(allocation != VK_NULL_HANDLE)

+        {

+            if(TouchAllocation(allocation))

+            {

+                if(VMA_DEBUG_INITIALIZE_ALLOCATIONS)

+                {

+                    FillAllocation(allocation, VMA_ALLOCATION_FILL_PATTERN_DESTROYED);

+                }

+

+                switch(allocation->GetType())

+                {

+                case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:

+                    {

+                        VmaBlockVector* pBlockVector = VMA_NULL;

+                        VmaPool hPool = allocation->GetBlock()->GetParentPool();

+                        if(hPool != VK_NULL_HANDLE)

+                        {

+                            pBlockVector = &hPool->m_BlockVector;

+                        }

+                        else

+                        {

+                            const uint32_t memTypeIndex = allocation->GetMemoryTypeIndex();

+                            pBlockVector = m_pBlockVectors[memTypeIndex];

+                        }

+                        pBlockVector->Free(allocation);

+                    }

+                    break;

+                case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:

+                    FreeDedicatedMemory(allocation);

+                    break;

+                default:

+                    VMA_ASSERT(0);

+                }

+            }

+

+            // Do this regardless of whether the allocation is lost. Lost allocations still account to Budget.AllocationBytes.

+            m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(allocation->GetMemoryTypeIndex()), allocation->GetSize());

+            allocation->SetUserData(this, VMA_NULL);

+            m_AllocationObjectAllocator.Free(allocation);

+        }

+    }

+}

+

+VkResult VmaAllocator_T::ResizeAllocation(

+    const VmaAllocation alloc,

+    VkDeviceSize newSize)

+{

+    // This function is deprecated and so it does nothing. It's left for backward compatibility.

+    if(newSize == 0 || alloc->GetLastUseFrameIndex() == VMA_FRAME_INDEX_LOST)

+    {

+        return VK_ERROR_VALIDATION_FAILED_EXT;

+    }

+    if(newSize == alloc->GetSize())

+    {

+        return VK_SUCCESS;

+    }

+    return VK_ERROR_OUT_OF_POOL_MEMORY;

+}

+

+void VmaAllocator_T::CalculateStats(VmaStats* pStats)

+{

+    // Initialize.

+    InitStatInfo(pStats->total);

+    for(size_t i = 0; i < VK_MAX_MEMORY_TYPES; ++i)

+        InitStatInfo(pStats->memoryType[i]);

+    for(size_t i = 0; i < VK_MAX_MEMORY_HEAPS; ++i)

+        InitStatInfo(pStats->memoryHeap[i]);

+    

+    // Process default pools.

+    for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)

+    {

+        VmaBlockVector* const pBlockVector = m_pBlockVectors[memTypeIndex];

+        VMA_ASSERT(pBlockVector);

+        pBlockVector->AddStats(pStats);

+    }

+

+    // Process custom pools.

+    {

+        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);

+        for(size_t poolIndex = 0, poolCount = m_Pools.size(); poolIndex < poolCount; ++poolIndex)

+        {

+            m_Pools[poolIndex]->m_BlockVector.AddStats(pStats);

+        }

+    }

+

+    // Process dedicated allocations.

+    for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)

+    {

+        const uint32_t memHeapIndex = MemoryTypeIndexToHeapIndex(memTypeIndex);

+        VmaMutexLockRead dedicatedAllocationsLock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);

+        AllocationVectorType* const pDedicatedAllocVector = m_pDedicatedAllocations[memTypeIndex];

+        VMA_ASSERT(pDedicatedAllocVector);

+        for(size_t allocIndex = 0, allocCount = pDedicatedAllocVector->size(); allocIndex < allocCount; ++allocIndex)

+        {

+            VmaStatInfo allocationStatInfo;

+            (*pDedicatedAllocVector)[allocIndex]->DedicatedAllocCalcStatsInfo(allocationStatInfo);

+            VmaAddStatInfo(pStats->total, allocationStatInfo);

+            VmaAddStatInfo(pStats->memoryType[memTypeIndex], allocationStatInfo);

+            VmaAddStatInfo(pStats->memoryHeap[memHeapIndex], allocationStatInfo);

+        }

+    }

+

+    // Postprocess.

+    VmaPostprocessCalcStatInfo(pStats->total);

+    for(size_t i = 0; i < GetMemoryTypeCount(); ++i)

+        VmaPostprocessCalcStatInfo(pStats->memoryType[i]);

+    for(size_t i = 0; i < GetMemoryHeapCount(); ++i)

+        VmaPostprocessCalcStatInfo(pStats->memoryHeap[i]);

+}

+

+void VmaAllocator_T::GetBudget(VmaBudget* outBudget, uint32_t firstHeap, uint32_t heapCount)

+{

+#if VMA_MEMORY_BUDGET

+    if(m_UseExtMemoryBudget)

+    {

+        if(m_Budget.m_OperationsSinceBudgetFetch < 30)

+        {

+            VmaMutexLockRead lockRead(m_Budget.m_BudgetMutex, m_UseMutex);

+            for(uint32_t i = 0; i < heapCount; ++i, ++outBudget)

+            {

+                const uint32_t heapIndex = firstHeap + i;

+

+                outBudget->blockBytes = m_Budget.m_BlockBytes[heapIndex];

+                outBudget->allocationBytes = m_Budget.m_AllocationBytes[heapIndex];

+

+                if(m_Budget.m_VulkanUsage[heapIndex] + outBudget->blockBytes > m_Budget.m_BlockBytesAtBudgetFetch[heapIndex])

+                {

+                    outBudget->usage = m_Budget.m_VulkanUsage[heapIndex] +

+                        outBudget->blockBytes - m_Budget.m_BlockBytesAtBudgetFetch[heapIndex];

+                }

+                else

+                {

+                    outBudget->usage = 0;

+                }

+

+                // Have to take MIN with heap size because explicit HeapSizeLimit is included in it.

+                outBudget->budget = VMA_MIN(

+                    m_Budget.m_VulkanBudget[heapIndex], m_MemProps.memoryHeaps[heapIndex].size);

+            }

+        }

+        else

+        {

+            UpdateVulkanBudget(); // Outside of mutex lock

+            GetBudget(outBudget, firstHeap, heapCount); // Recursion

+        }

+    }

+    else

+#endif

+    {

+        for(uint32_t i = 0; i < heapCount; ++i, ++outBudget)

+        {

+            const uint32_t heapIndex = firstHeap + i;

+

+            outBudget->blockBytes = m_Budget.m_BlockBytes[heapIndex];

+            outBudget->allocationBytes = m_Budget.m_AllocationBytes[heapIndex];

+

+            outBudget->usage = outBudget->blockBytes;

+            outBudget->budget = m_MemProps.memoryHeaps[heapIndex].size * 8 / 10; // 80% heuristics.

+        }

+    }

+}

+

+static const uint32_t VMA_VENDOR_ID_AMD = 4098;

+

+VkResult VmaAllocator_T::DefragmentationBegin(

+    const VmaDefragmentationInfo2& info,

+    VmaDefragmentationStats* pStats,

+    VmaDefragmentationContext* pContext)

+{

+    if(info.pAllocationsChanged != VMA_NULL)

+    {

+        memset(info.pAllocationsChanged, 0, info.allocationCount * sizeof(VkBool32));

+    }

+

+    *pContext = vma_new(this, VmaDefragmentationContext_T)(

+        this, m_CurrentFrameIndex.load(), info.flags, pStats);

+

+    (*pContext)->AddPools(info.poolCount, info.pPools);

+    (*pContext)->AddAllocations(

+        info.allocationCount, info.pAllocations, info.pAllocationsChanged);

+

+    VkResult res = (*pContext)->Defragment(

+        info.maxCpuBytesToMove, info.maxCpuAllocationsToMove,

+        info.maxGpuBytesToMove, info.maxGpuAllocationsToMove,

+        info.commandBuffer, pStats, info.flags);

+

+    if(res != VK_NOT_READY)

+    {

+        vma_delete(this, *pContext);

+        *pContext = VMA_NULL;

+    }

+

+    return res;

+}

+

+VkResult VmaAllocator_T::DefragmentationEnd(

+    VmaDefragmentationContext context)

+{

+    vma_delete(this, context);

+    return VK_SUCCESS;

+}

+

+VkResult VmaAllocator_T::DefragmentationPassBegin(

+    VmaDefragmentationPassInfo* pInfo,

+    VmaDefragmentationContext context)

+{

+    return context->DefragmentPassBegin(pInfo);

+}

+VkResult VmaAllocator_T::DefragmentationPassEnd(

+    VmaDefragmentationContext context)

+{

+    return context->DefragmentPassEnd();

+    

+}

+

+void VmaAllocator_T::GetAllocationInfo(VmaAllocation hAllocation, VmaAllocationInfo* pAllocationInfo)

+{

+    if(hAllocation->CanBecomeLost())

+    {

+        /*

+        Warning: This is a carefully designed algorithm.

+        Do not modify unless you really know what you're doing :)

+        */

+        const uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();

+        uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();

+        for(;;)

+        {

+            if(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)

+            {

+                pAllocationInfo->memoryType = UINT32_MAX;

+                pAllocationInfo->deviceMemory = VK_NULL_HANDLE;

+                pAllocationInfo->offset = 0;

+                pAllocationInfo->size = hAllocation->GetSize();

+                pAllocationInfo->pMappedData = VMA_NULL;

+                pAllocationInfo->pUserData = hAllocation->GetUserData();

+                return;

+            }

+            else if(localLastUseFrameIndex == localCurrFrameIndex)

+            {

+                pAllocationInfo->memoryType = hAllocation->GetMemoryTypeIndex();

+                pAllocationInfo->deviceMemory = hAllocation->GetMemory();

+                pAllocationInfo->offset = hAllocation->GetOffset();

+                pAllocationInfo->size = hAllocation->GetSize();

+                pAllocationInfo->pMappedData = VMA_NULL;

+                pAllocationInfo->pUserData = hAllocation->GetUserData();

+                return;

+            }

+            else // Last use time earlier than current time.

+            {

+                if(hAllocation->CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))

+                {

+                    localLastUseFrameIndex = localCurrFrameIndex;

+                }

+            }

+        }

+    }

+    else

+    {

+#if VMA_STATS_STRING_ENABLED

+        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();

+        uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();

+        for(;;)

+        {

+            VMA_ASSERT(localLastUseFrameIndex != VMA_FRAME_INDEX_LOST);

+            if(localLastUseFrameIndex == localCurrFrameIndex)

+            {

+                break;

+            }

+            else // Last use time earlier than current time.

+            {

+                if(hAllocation->CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))

+                {

+                    localLastUseFrameIndex = localCurrFrameIndex;

+                }

+            }

+        }

+#endif

+

+        pAllocationInfo->memoryType = hAllocation->GetMemoryTypeIndex();

+        pAllocationInfo->deviceMemory = hAllocation->GetMemory();

+        pAllocationInfo->offset = hAllocation->GetOffset();

+        pAllocationInfo->size = hAllocation->GetSize();

+        pAllocationInfo->pMappedData = hAllocation->GetMappedData();

+        pAllocationInfo->pUserData = hAllocation->GetUserData();

+    }

+}

+

+bool VmaAllocator_T::TouchAllocation(VmaAllocation hAllocation)

+{

+    // This is a stripped-down version of VmaAllocator_T::GetAllocationInfo.

+    if(hAllocation->CanBecomeLost())

+    {

+        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();

+        uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();

+        for(;;)

+        {

+            if(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)

+            {

+                return false;

+            }

+            else if(localLastUseFrameIndex == localCurrFrameIndex)

+            {

+                return true;

+            }

+            else // Last use time earlier than current time.

+            {

+                if(hAllocation->CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))

+                {

+                    localLastUseFrameIndex = localCurrFrameIndex;

+                }

+            }

+        }

+    }

+    else

+    {

+#if VMA_STATS_STRING_ENABLED

+        uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();

+        uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();

+        for(;;)

+        {

+            VMA_ASSERT(localLastUseFrameIndex != VMA_FRAME_INDEX_LOST);

+            if(localLastUseFrameIndex == localCurrFrameIndex)

+            {

+                break;

+            }

+            else // Last use time earlier than current time.

+            {

+                if(hAllocation->CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))

+                {

+                    localLastUseFrameIndex = localCurrFrameIndex;

+                }

+            }

+        }

+#endif

+

+        return true;

+    }

+}

+

+VkResult VmaAllocator_T::CreatePool(const VmaPoolCreateInfo* pCreateInfo, VmaPool* pPool)

+{

+    VMA_DEBUG_LOG("  CreatePool: MemoryTypeIndex=%u, flags=%u", pCreateInfo->memoryTypeIndex, pCreateInfo->flags);

+

+    VmaPoolCreateInfo newCreateInfo = *pCreateInfo;

+

+    if(newCreateInfo.maxBlockCount == 0)

+    {

+        newCreateInfo.maxBlockCount = SIZE_MAX;

+    }

+    if(newCreateInfo.minBlockCount > newCreateInfo.maxBlockCount)

+    {

+        return VK_ERROR_INITIALIZATION_FAILED;

+    }

+    // Memory type index out of range or forbidden.

+    if(pCreateInfo->memoryTypeIndex >= GetMemoryTypeCount() ||

+        ((1u << pCreateInfo->memoryTypeIndex) & m_GlobalMemoryTypeBits) == 0)

+    {

+        return VK_ERROR_FEATURE_NOT_PRESENT;

+    }

+

+    const VkDeviceSize preferredBlockSize = CalcPreferredBlockSize(newCreateInfo.memoryTypeIndex);

+

+    *pPool = vma_new(this, VmaPool_T)(this, newCreateInfo, preferredBlockSize);

+

+    VkResult res = (*pPool)->m_BlockVector.CreateMinBlocks();

+    if(res != VK_SUCCESS)

+    {

+        vma_delete(this, *pPool);

+        *pPool = VMA_NULL;

+        return res;

+    }

+

+    // Add to m_Pools.

+    {

+        VmaMutexLockWrite lock(m_PoolsMutex, m_UseMutex);

+        (*pPool)->SetId(m_NextPoolId++);

+        VmaVectorInsertSorted<VmaPointerLess>(m_Pools, *pPool);

+    }

+

+    return VK_SUCCESS;

+}

+

+void VmaAllocator_T::DestroyPool(VmaPool pool)

+{

+    // Remove from m_Pools.

+    {

+        VmaMutexLockWrite lock(m_PoolsMutex, m_UseMutex);

+        bool success = VmaVectorRemoveSorted<VmaPointerLess>(m_Pools, pool);

+        VMA_ASSERT(success && "Pool not found in Allocator.");

+    }

+

+    vma_delete(this, pool);

+}

+

+void VmaAllocator_T::GetPoolStats(VmaPool pool, VmaPoolStats* pPoolStats)

+{

+    pool->m_BlockVector.GetPoolStats(pPoolStats);

+}

+

+void VmaAllocator_T::SetCurrentFrameIndex(uint32_t frameIndex)

+{

+    m_CurrentFrameIndex.store(frameIndex);

+

+#if VMA_MEMORY_BUDGET

+    if(m_UseExtMemoryBudget)

+    {

+        UpdateVulkanBudget();

+    }

+#endif // #if VMA_MEMORY_BUDGET

+}

+

+void VmaAllocator_T::MakePoolAllocationsLost(

+    VmaPool hPool,

+    size_t* pLostAllocationCount)

+{

+    hPool->m_BlockVector.MakePoolAllocationsLost(

+        m_CurrentFrameIndex.load(),

+        pLostAllocationCount);

+}

+

+VkResult VmaAllocator_T::CheckPoolCorruption(VmaPool hPool)

+{

+    return hPool->m_BlockVector.CheckCorruption();

+}

+

+VkResult VmaAllocator_T::CheckCorruption(uint32_t memoryTypeBits)

+{

+    VkResult finalRes = VK_ERROR_FEATURE_NOT_PRESENT;

+

+    // Process default pools.

+    for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)

+    {

+        if(((1u << memTypeIndex) & memoryTypeBits) != 0)

+        {

+            VmaBlockVector* const pBlockVector = m_pBlockVectors[memTypeIndex];

+            VMA_ASSERT(pBlockVector);

+            VkResult localRes = pBlockVector->CheckCorruption();

+            switch(localRes)

+            {

+            case VK_ERROR_FEATURE_NOT_PRESENT:

+                break;

+            case VK_SUCCESS:

+                finalRes = VK_SUCCESS;

+                break;

+            default:

+                return localRes;

+            }

+        }

+    }

+

+    // Process custom pools.

+    {

+        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);

+        for(size_t poolIndex = 0, poolCount = m_Pools.size(); poolIndex < poolCount; ++poolIndex)

+        {

+            if(((1u << m_Pools[poolIndex]->m_BlockVector.GetMemoryTypeIndex()) & memoryTypeBits) != 0)

+            {

+                VkResult localRes = m_Pools[poolIndex]->m_BlockVector.CheckCorruption();

+                switch(localRes)

+                {

+                case VK_ERROR_FEATURE_NOT_PRESENT:

+                    break;

+                case VK_SUCCESS:

+                    finalRes = VK_SUCCESS;

+                    break;

+                default:

+                    return localRes;

+                }

+            }

+        }

+    }

+

+    return finalRes;

+}

+

+void VmaAllocator_T::CreateLostAllocation(VmaAllocation* pAllocation)

+{

+    *pAllocation = m_AllocationObjectAllocator.Allocate(VMA_FRAME_INDEX_LOST, false);

+    (*pAllocation)->InitLost();

+}

+

+VkResult VmaAllocator_T::AllocateVulkanMemory(const VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory)

+{

+    const uint32_t heapIndex = MemoryTypeIndexToHeapIndex(pAllocateInfo->memoryTypeIndex);

+

+    // HeapSizeLimit is in effect for this heap.

+    if((m_HeapSizeLimitMask & (1u << heapIndex)) != 0)

+    {

+        const VkDeviceSize heapSize = m_MemProps.memoryHeaps[heapIndex].size;

+        VkDeviceSize blockBytes = m_Budget.m_BlockBytes[heapIndex];

+        for(;;)

+        {

+            const VkDeviceSize blockBytesAfterAllocation = blockBytes + pAllocateInfo->allocationSize;

+            if(blockBytesAfterAllocation > heapSize)

+            {

+                return VK_ERROR_OUT_OF_DEVICE_MEMORY;

+            }

+            if(m_Budget.m_BlockBytes[heapIndex].compare_exchange_strong(blockBytes, blockBytesAfterAllocation))

+            {

+                break;

+            }

+        }

+    }

+    else

+    {

+        m_Budget.m_BlockBytes[heapIndex] += pAllocateInfo->allocationSize;

+    }

+

+    // VULKAN CALL vkAllocateMemory.

+    VkResult res = (*m_VulkanFunctions.vkAllocateMemory)(m_hDevice, pAllocateInfo, GetAllocationCallbacks(), pMemory);

+

+    if(res == VK_SUCCESS)

+    {

+#if VMA_MEMORY_BUDGET

+        ++m_Budget.m_OperationsSinceBudgetFetch;

+#endif

+

+        // Informative callback.

+        if(m_DeviceMemoryCallbacks.pfnAllocate != VMA_NULL)

+        {

+            (*m_DeviceMemoryCallbacks.pfnAllocate)(this, pAllocateInfo->memoryTypeIndex, *pMemory, pAllocateInfo->allocationSize, m_DeviceMemoryCallbacks.pUserData);

+        }

+    }

+    else

+    {

+        m_Budget.m_BlockBytes[heapIndex] -= pAllocateInfo->allocationSize;

+    }

+

+    return res;

+}

+

+void VmaAllocator_T::FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, VkDeviceMemory hMemory)

+{

+    // Informative callback.

+    if(m_DeviceMemoryCallbacks.pfnFree != VMA_NULL)

+    {

+        (*m_DeviceMemoryCallbacks.pfnFree)(this, memoryType, hMemory, size, m_DeviceMemoryCallbacks.pUserData);

+    }

+

+    // VULKAN CALL vkFreeMemory.

+    (*m_VulkanFunctions.vkFreeMemory)(m_hDevice, hMemory, GetAllocationCallbacks());

+

+    m_Budget.m_BlockBytes[MemoryTypeIndexToHeapIndex(memoryType)] -= size;

+}

+

+VkResult VmaAllocator_T::BindVulkanBuffer(

+    VkDeviceMemory memory,

+    VkDeviceSize memoryOffset,

+    VkBuffer buffer,

+    const void* pNext)

+{

+    if(pNext != VMA_NULL)

+    {

+#if VMA_VULKAN_VERSION >= 1001000 || VMA_BIND_MEMORY2

+        if((m_UseKhrBindMemory2 || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0)) &&

+            m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL)

+        {

+            VkBindBufferMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR };

+            bindBufferMemoryInfo.pNext = pNext;

+            bindBufferMemoryInfo.buffer = buffer;

+            bindBufferMemoryInfo.memory = memory;

+            bindBufferMemoryInfo.memoryOffset = memoryOffset;

+            return (*m_VulkanFunctions.vkBindBufferMemory2KHR)(m_hDevice, 1, &bindBufferMemoryInfo);

+        }

+        else

+#endif // #if VMA_VULKAN_VERSION >= 1001000 || VMA_BIND_MEMORY2

+        {

+            return VK_ERROR_EXTENSION_NOT_PRESENT;

+        }

+    }

+    else

+    {

+        return (*m_VulkanFunctions.vkBindBufferMemory)(m_hDevice, buffer, memory, memoryOffset);

+    }

+}

+

+VkResult VmaAllocator_T::BindVulkanImage(

+    VkDeviceMemory memory,

+    VkDeviceSize memoryOffset,

+    VkImage image,

+    const void* pNext)

+{

+    if(pNext != VMA_NULL)

+    {

+#if VMA_VULKAN_VERSION >= 1001000 || VMA_BIND_MEMORY2

+        if((m_UseKhrBindMemory2 || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0)) &&

+            m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL)

+        {

+            VkBindImageMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR };

+            bindBufferMemoryInfo.pNext = pNext;

+            bindBufferMemoryInfo.image = image;

+            bindBufferMemoryInfo.memory = memory;

+            bindBufferMemoryInfo.memoryOffset = memoryOffset;

+            return (*m_VulkanFunctions.vkBindImageMemory2KHR)(m_hDevice, 1, &bindBufferMemoryInfo);

+        }

+        else

+#endif // #if VMA_BIND_MEMORY2

+        {

+            return VK_ERROR_EXTENSION_NOT_PRESENT;

+        }

+    }

+    else

+    {

+        return (*m_VulkanFunctions.vkBindImageMemory)(m_hDevice, image, memory, memoryOffset);

+    }

+}

+

+VkResult VmaAllocator_T::Map(VmaAllocation hAllocation, void** ppData)

+{

+    if(hAllocation->CanBecomeLost())

+    {

+        return VK_ERROR_MEMORY_MAP_FAILED;

+    }

+

+    switch(hAllocation->GetType())

+    {

+    case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:

+        {

+            VmaDeviceMemoryBlock* const pBlock = hAllocation->GetBlock();

+            char *pBytes = VMA_NULL;

+            VkResult res = pBlock->Map(this, 1, (void**)&pBytes);

+            if(res == VK_SUCCESS)

+            {

+                *ppData = pBytes + (ptrdiff_t)hAllocation->GetOffset();

+                hAllocation->BlockAllocMap();

+            }

+            return res;

+        }

+    case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:

+        return hAllocation->DedicatedAllocMap(this, ppData);

+    default:

+        VMA_ASSERT(0);

+        return VK_ERROR_MEMORY_MAP_FAILED;

+    }

+}

+

+void VmaAllocator_T::Unmap(VmaAllocation hAllocation)

+{

+    switch(hAllocation->GetType())

+    {

+    case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:

+        {

+            VmaDeviceMemoryBlock* const pBlock = hAllocation->GetBlock();

+            hAllocation->BlockAllocUnmap();

+            pBlock->Unmap(this, 1);

+        }

+        break;

+    case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:

+        hAllocation->DedicatedAllocUnmap(this);

+        break;

+    default:

+        VMA_ASSERT(0);

+    }

+}

+

+VkResult VmaAllocator_T::BindBufferMemory(

+    VmaAllocation hAllocation,

+    VkDeviceSize allocationLocalOffset,

+    VkBuffer hBuffer,

+    const void* pNext)

+{

+    VkResult res = VK_SUCCESS;

+    switch(hAllocation->GetType())

+    {

+    case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:

+        res = BindVulkanBuffer(hAllocation->GetMemory(), allocationLocalOffset, hBuffer, pNext);

+        break;

+    case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:

+    {

+        VmaDeviceMemoryBlock* const pBlock = hAllocation->GetBlock();

+        VMA_ASSERT(pBlock && "Binding buffer to allocation that doesn't belong to any block. Is the allocation lost?");

+        res = pBlock->BindBufferMemory(this, hAllocation, allocationLocalOffset, hBuffer, pNext);

+        break;

+    }

+    default:

+        VMA_ASSERT(0);

+    }

+    return res;

+}

+

+VkResult VmaAllocator_T::BindImageMemory(

+    VmaAllocation hAllocation,

+    VkDeviceSize allocationLocalOffset,

+    VkImage hImage,

+    const void* pNext)

+{

+    VkResult res = VK_SUCCESS;

+    switch(hAllocation->GetType())

+    {

+    case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:

+        res = BindVulkanImage(hAllocation->GetMemory(), allocationLocalOffset, hImage, pNext);

+        break;

+    case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:

+    {

+        VmaDeviceMemoryBlock* pBlock = hAllocation->GetBlock();

+        VMA_ASSERT(pBlock && "Binding image to allocation that doesn't belong to any block. Is the allocation lost?");

+        res = pBlock->BindImageMemory(this, hAllocation, allocationLocalOffset, hImage, pNext);

+        break;

+    }

+    default:

+        VMA_ASSERT(0);

+    }

+    return res;

+}

+

+VkResult VmaAllocator_T::FlushOrInvalidateAllocation(

+    VmaAllocation hAllocation,

+    VkDeviceSize offset, VkDeviceSize size,

+    VMA_CACHE_OPERATION op)

+{

+    VkResult res = VK_SUCCESS;

+

+    VkMappedMemoryRange memRange = {};

+    if(GetFlushOrInvalidateRange(hAllocation, offset, size, memRange))

+    {

+        switch(op)

+        {

+        case VMA_CACHE_FLUSH:

+            res = (*GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hDevice, 1, &memRange);

+            break;

+        case VMA_CACHE_INVALIDATE:

+            res = (*GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hDevice, 1, &memRange);

+            break;

+        default:

+            VMA_ASSERT(0);

+        }

+    }

+    // else: Just ignore this call.

+    return res;

+}

+

+VkResult VmaAllocator_T::FlushOrInvalidateAllocations(

+    uint32_t allocationCount,

+    const VmaAllocation* allocations,

+    const VkDeviceSize* offsets, const VkDeviceSize* sizes,

+    VMA_CACHE_OPERATION op)

+{

+    typedef VmaStlAllocator<VkMappedMemoryRange> RangeAllocator;

+    typedef VmaSmallVector<VkMappedMemoryRange, RangeAllocator, 16> RangeVector;

+    RangeVector ranges = RangeVector(RangeAllocator(GetAllocationCallbacks()));

+    

+    for(uint32_t allocIndex = 0; allocIndex < allocationCount; ++allocIndex)

+    {

+        const VmaAllocation alloc = allocations[allocIndex];

+        const VkDeviceSize offset = offsets != VMA_NULL ? offsets[allocIndex] : 0;

+        const VkDeviceSize size = sizes != VMA_NULL ? sizes[allocIndex] : VK_WHOLE_SIZE;

+        VkMappedMemoryRange newRange;

+        if(GetFlushOrInvalidateRange(alloc, offset, size, newRange))

+        {

+            ranges.push_back(newRange);

+        }

+    }

+

+    VkResult res = VK_SUCCESS;

+    if(!ranges.empty())

+    {

+        switch(op)

+        {

+        case VMA_CACHE_FLUSH:

+            res = (*GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hDevice, (uint32_t)ranges.size(), ranges.data());

+            break;

+        case VMA_CACHE_INVALIDATE:

+            res = (*GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hDevice, (uint32_t)ranges.size(), ranges.data());

+            break;

+        default:

+            VMA_ASSERT(0);

+        }

+    }

+    // else: Just ignore this call.

+    return res;

+}

+

+void VmaAllocator_T::FreeDedicatedMemory(const VmaAllocation allocation)

+{

+    VMA_ASSERT(allocation && allocation->GetType() == VmaAllocation_T::ALLOCATION_TYPE_DEDICATED);

+

+    const uint32_t memTypeIndex = allocation->GetMemoryTypeIndex();

+    {

+        VmaMutexLockWrite lock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);

+        AllocationVectorType* const pDedicatedAllocations = m_pDedicatedAllocations[memTypeIndex];

+        VMA_ASSERT(pDedicatedAllocations);

+        bool success = VmaVectorRemoveSorted<VmaPointerLess>(*pDedicatedAllocations, allocation);

+        VMA_ASSERT(success);

+    }

+

+    VkDeviceMemory hMemory = allocation->GetMemory();

+    

+    /*

+    There is no need to call this, because Vulkan spec allows to skip vkUnmapMemory

+    before vkFreeMemory.

+

+    if(allocation->GetMappedData() != VMA_NULL)

+    {

+        (*m_VulkanFunctions.vkUnmapMemory)(m_hDevice, hMemory);

+    }

+    */

+    

+    FreeVulkanMemory(memTypeIndex, allocation->GetSize(), hMemory);

+

+    VMA_DEBUG_LOG("    Freed DedicatedMemory MemoryTypeIndex=%u", memTypeIndex);

+}

+

+uint32_t VmaAllocator_T::CalculateGpuDefragmentationMemoryTypeBits() const

+{

+    VkBufferCreateInfo dummyBufCreateInfo;

+    VmaFillGpuDefragmentationBufferCreateInfo(dummyBufCreateInfo);

+

+    uint32_t memoryTypeBits = 0;

+

+    // Create buffer.

+    VkBuffer buf = VK_NULL_HANDLE;

+    VkResult res = (*GetVulkanFunctions().vkCreateBuffer)(

+        m_hDevice, &dummyBufCreateInfo, GetAllocationCallbacks(), &buf);

+    if(res == VK_SUCCESS)

+    {

+        // Query for supported memory types.

+        VkMemoryRequirements memReq;

+        (*GetVulkanFunctions().vkGetBufferMemoryRequirements)(m_hDevice, buf, &memReq);

+        memoryTypeBits = memReq.memoryTypeBits;

+

+        // Destroy buffer.

+        (*GetVulkanFunctions().vkDestroyBuffer)(m_hDevice, buf, GetAllocationCallbacks());

+    }

+

+    return memoryTypeBits;

+}

+

+uint32_t VmaAllocator_T::CalculateGlobalMemoryTypeBits() const

+{

+    // Make sure memory information is already fetched.

+    VMA_ASSERT(GetMemoryTypeCount() > 0);

+

+    uint32_t memoryTypeBits = UINT32_MAX;

+

+    if(!m_UseAmdDeviceCoherentMemory)

+    {

+        // Exclude memory types that have VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD.

+        for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)

+        {

+            if((m_MemProps.memoryTypes[memTypeIndex].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY) != 0)

+            {

+                memoryTypeBits &= ~(1u << memTypeIndex);

+            }

+        }

+    }

+

+    return memoryTypeBits;

+}

+

+bool VmaAllocator_T::GetFlushOrInvalidateRange(

+    VmaAllocation allocation,

+    VkDeviceSize offset, VkDeviceSize size,

+    VkMappedMemoryRange& outRange) const

+{

+    const uint32_t memTypeIndex = allocation->GetMemoryTypeIndex();

+    if(size > 0 && IsMemoryTypeNonCoherent(memTypeIndex))

+    {

+        const VkDeviceSize nonCoherentAtomSize = m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;

+        const VkDeviceSize allocationSize = allocation->GetSize();

+        VMA_ASSERT(offset <= allocationSize);

+

+        outRange.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;

+        outRange.pNext = VMA_NULL;

+        outRange.memory = allocation->GetMemory();

+

+        switch(allocation->GetType())

+        {

+        case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:

+            outRange.offset = VmaAlignDown(offset, nonCoherentAtomSize);

+            if(size == VK_WHOLE_SIZE)

+            {

+                outRange.size = allocationSize - outRange.offset;

+            }

+            else

+            {

+                VMA_ASSERT(offset + size <= allocationSize);

+                outRange.size = VMA_MIN(

+                    VmaAlignUp(size + (offset - outRange.offset), nonCoherentAtomSize),

+                    allocationSize - outRange.offset);

+            }

+            break;

+        case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:

+        {

+            // 1. Still within this allocation.

+            outRange.offset = VmaAlignDown(offset, nonCoherentAtomSize);

+            if(size == VK_WHOLE_SIZE)

+            {

+                size = allocationSize - offset;

+            }

+            else

+            {

+                VMA_ASSERT(offset + size <= allocationSize);

+            }

+            outRange.size = VmaAlignUp(size + (offset - outRange.offset), nonCoherentAtomSize);

+

+            // 2. Adjust to whole block.

+            const VkDeviceSize allocationOffset = allocation->GetOffset();

+            VMA_ASSERT(allocationOffset % nonCoherentAtomSize == 0);

+            const VkDeviceSize blockSize = allocation->GetBlock()->m_pMetadata->GetSize();

+            outRange.offset += allocationOffset;

+            outRange.size = VMA_MIN(outRange.size, blockSize - outRange.offset);

+

+            break;

+        }

+        default:

+            VMA_ASSERT(0);

+        }

+        return true;

+    }

+    return false;

+}

+

+#if VMA_MEMORY_BUDGET

+

+void VmaAllocator_T::UpdateVulkanBudget()

+{

+    VMA_ASSERT(m_UseExtMemoryBudget);

+

+    VkPhysicalDeviceMemoryProperties2KHR memProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR };

+

+    VkPhysicalDeviceMemoryBudgetPropertiesEXT budgetProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT };

+    VmaPnextChainPushFront(&memProps, &budgetProps);

+

+    GetVulkanFunctions().vkGetPhysicalDeviceMemoryProperties2KHR(m_PhysicalDevice, &memProps);

+

+    {

+        VmaMutexLockWrite lockWrite(m_Budget.m_BudgetMutex, m_UseMutex);

+

+        for(uint32_t heapIndex = 0; heapIndex < GetMemoryHeapCount(); ++heapIndex)

+        {

+            m_Budget.m_VulkanUsage[heapIndex] = budgetProps.heapUsage[heapIndex];

+            m_Budget.m_VulkanBudget[heapIndex] = budgetProps.heapBudget[heapIndex];

+            m_Budget.m_BlockBytesAtBudgetFetch[heapIndex] = m_Budget.m_BlockBytes[heapIndex].load();

+

+            // Some bugged drivers return the budget incorrectly, e.g. 0 or much bigger than heap size.

+            if(m_Budget.m_VulkanBudget[heapIndex] == 0)

+            {

+                m_Budget.m_VulkanBudget[heapIndex] = m_MemProps.memoryHeaps[heapIndex].size * 8 / 10; // 80% heuristics.

+            }

+            else if(m_Budget.m_VulkanBudget[heapIndex] > m_MemProps.memoryHeaps[heapIndex].size)

+            {

+                m_Budget.m_VulkanBudget[heapIndex] = m_MemProps.memoryHeaps[heapIndex].size;

+            }

+            if(m_Budget.m_VulkanUsage[heapIndex] == 0 && m_Budget.m_BlockBytesAtBudgetFetch[heapIndex] > 0)

+            {

+                m_Budget.m_VulkanUsage[heapIndex] = m_Budget.m_BlockBytesAtBudgetFetch[heapIndex];

+            }

+        }

+        m_Budget.m_OperationsSinceBudgetFetch = 0;

+    }

+}

+

+#endif // #if VMA_MEMORY_BUDGET

+

+void VmaAllocator_T::FillAllocation(const VmaAllocation hAllocation, uint8_t pattern)

+{

+    if(VMA_DEBUG_INITIALIZE_ALLOCATIONS &&

+        !hAllocation->CanBecomeLost() &&

+        (m_MemProps.memoryTypes[hAllocation->GetMemoryTypeIndex()].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)

+    {

+        void* pData = VMA_NULL;

+        VkResult res = Map(hAllocation, &pData);

+        if(res == VK_SUCCESS)

+        {

+            memset(pData, (int)pattern, (size_t)hAllocation->GetSize());

+            FlushOrInvalidateAllocation(hAllocation, 0, VK_WHOLE_SIZE, VMA_CACHE_FLUSH);

+            Unmap(hAllocation);

+        }

+        else

+        {

+            VMA_ASSERT(0 && "VMA_DEBUG_INITIALIZE_ALLOCATIONS is enabled, but couldn't map memory to fill allocation.");

+        }

+    }

+}

+

+uint32_t VmaAllocator_T::GetGpuDefragmentationMemoryTypeBits()

+{

+    uint32_t memoryTypeBits = m_GpuDefragmentationMemoryTypeBits.load();

+    if(memoryTypeBits == UINT32_MAX)

+    {

+        memoryTypeBits = CalculateGpuDefragmentationMemoryTypeBits();

+        m_GpuDefragmentationMemoryTypeBits.store(memoryTypeBits);

+    }

+    return memoryTypeBits;

+}

+

+#if VMA_STATS_STRING_ENABLED

+

+void VmaAllocator_T::PrintDetailedMap(VmaJsonWriter& json)

+{

+    bool dedicatedAllocationsStarted = false;

+    for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)

+    {

+        VmaMutexLockRead dedicatedAllocationsLock(m_DedicatedAllocationsMutex[memTypeIndex], m_UseMutex);

+        AllocationVectorType* const pDedicatedAllocVector = m_pDedicatedAllocations[memTypeIndex];

+        VMA_ASSERT(pDedicatedAllocVector);

+        if(pDedicatedAllocVector->empty() == false)

+        {

+            if(dedicatedAllocationsStarted == false)

+            {

+                dedicatedAllocationsStarted = true;

+                json.WriteString("DedicatedAllocations");

+                json.BeginObject();

+            }

+

+            json.BeginString("Type ");

+            json.ContinueString(memTypeIndex);

+            json.EndString();

+                

+            json.BeginArray();

+

+            for(size_t i = 0; i < pDedicatedAllocVector->size(); ++i)

+            {

+                json.BeginObject(true);

+                const VmaAllocation hAlloc = (*pDedicatedAllocVector)[i];

+                hAlloc->PrintParameters(json);

+                json.EndObject();

+            }

+

+            json.EndArray();

+        }

+    }

+    if(dedicatedAllocationsStarted)

+    {

+        json.EndObject();

+    }

+

+    {

+        bool allocationsStarted = false;

+        for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex)

+        {

+            if(m_pBlockVectors[memTypeIndex]->IsEmpty() == false)

+            {

+                if(allocationsStarted == false)

+                {

+                    allocationsStarted = true;

+                    json.WriteString("DefaultPools");

+                    json.BeginObject();

+                }

+

+                json.BeginString("Type ");

+                json.ContinueString(memTypeIndex);

+                json.EndString();

+

+                m_pBlockVectors[memTypeIndex]->PrintDetailedMap(json);

+            }

+        }

+        if(allocationsStarted)

+        {

+            json.EndObject();

+        }

+    }

+

+    // Custom pools

+    {

+        VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex);

+        const size_t poolCount = m_Pools.size();

+        if(poolCount > 0)

+        {

+            json.WriteString("Pools");

+            json.BeginObject();

+            for(size_t poolIndex = 0; poolIndex < poolCount; ++poolIndex)

+            {

+                json.BeginString();

+                json.ContinueString(m_Pools[poolIndex]->GetId());

+                json.EndString();

+

+                m_Pools[poolIndex]->m_BlockVector.PrintDetailedMap(json);

+            }

+            json.EndObject();

+        }

+    }

+}

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+////////////////////////////////////////////////////////////////////////////////

+// Public interface

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAllocator(

+    const VmaAllocatorCreateInfo* pCreateInfo,

+    VmaAllocator* pAllocator)

+{

+    VMA_ASSERT(pCreateInfo && pAllocator);

+    VMA_ASSERT(pCreateInfo->vulkanApiVersion == 0 ||

+        (VK_VERSION_MAJOR(pCreateInfo->vulkanApiVersion) == 1 && VK_VERSION_MINOR(pCreateInfo->vulkanApiVersion) <= 2));

+    VMA_DEBUG_LOG("vmaCreateAllocator");

+    *pAllocator = vma_new(pCreateInfo->pAllocationCallbacks, VmaAllocator_T)(pCreateInfo);

+    return (*pAllocator)->Init(pCreateInfo);

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaDestroyAllocator(

+    VmaAllocator allocator)

+{

+    if(allocator != VK_NULL_HANDLE)

+    {

+        VMA_DEBUG_LOG("vmaDestroyAllocator");

+        VkAllocationCallbacks allocationCallbacks = allocator->m_AllocationCallbacks;

+        vma_delete(&allocationCallbacks, allocator);

+    }

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocatorInfo(VmaAllocator allocator, VmaAllocatorInfo* pAllocatorInfo)

+{

+    VMA_ASSERT(allocator && pAllocatorInfo);

+    pAllocatorInfo->instance = allocator->m_hInstance;

+    pAllocatorInfo->physicalDevice = allocator->GetPhysicalDevice();

+    pAllocatorInfo->device = allocator->m_hDevice;

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaGetPhysicalDeviceProperties(

+    VmaAllocator allocator,

+    const VkPhysicalDeviceProperties **ppPhysicalDeviceProperties)

+{

+    VMA_ASSERT(allocator && ppPhysicalDeviceProperties);

+    *ppPhysicalDeviceProperties = &allocator->m_PhysicalDeviceProperties;

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryProperties(

+    VmaAllocator allocator,

+    const VkPhysicalDeviceMemoryProperties** ppPhysicalDeviceMemoryProperties)

+{

+    VMA_ASSERT(allocator && ppPhysicalDeviceMemoryProperties);

+    *ppPhysicalDeviceMemoryProperties = &allocator->m_MemProps;

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryTypeProperties(

+    VmaAllocator allocator,

+    uint32_t memoryTypeIndex,

+    VkMemoryPropertyFlags* pFlags)

+{

+    VMA_ASSERT(allocator && pFlags);

+    VMA_ASSERT(memoryTypeIndex < allocator->GetMemoryTypeCount());

+    *pFlags = allocator->m_MemProps.memoryTypes[memoryTypeIndex].propertyFlags;

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaSetCurrentFrameIndex(

+    VmaAllocator allocator,

+    uint32_t frameIndex)

+{

+    VMA_ASSERT(allocator);

+    VMA_ASSERT(frameIndex != VMA_FRAME_INDEX_LOST);

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    allocator->SetCurrentFrameIndex(frameIndex);

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaCalculateStats(

+    VmaAllocator allocator,

+    VmaStats* pStats)

+{

+    VMA_ASSERT(allocator && pStats);

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+    allocator->CalculateStats(pStats);

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaGetBudget(

+    VmaAllocator allocator,

+    VmaBudget* pBudget)

+{

+    VMA_ASSERT(allocator && pBudget);

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+    allocator->GetBudget(pBudget, 0, allocator->GetMemoryHeapCount());

+}

+

+#if VMA_STATS_STRING_ENABLED

+

+VMA_CALL_PRE void VMA_CALL_POST vmaBuildStatsString(

+    VmaAllocator allocator,

+    char** ppStatsString,

+    VkBool32 detailedMap)

+{

+    VMA_ASSERT(allocator && ppStatsString);

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    VmaStringBuilder sb(allocator);

+    {

+        VmaJsonWriter json(allocator->GetAllocationCallbacks(), sb);

+        json.BeginObject();

+

+        VmaBudget budget[VK_MAX_MEMORY_HEAPS];

+        allocator->GetBudget(budget, 0, allocator->GetMemoryHeapCount());

+

+        VmaStats stats;

+        allocator->CalculateStats(&stats);

+

+        json.WriteString("Total");

+        VmaPrintStatInfo(json, stats.total);

+    

+        for(uint32_t heapIndex = 0; heapIndex < allocator->GetMemoryHeapCount(); ++heapIndex)

+        {

+            json.BeginString("Heap ");

+            json.ContinueString(heapIndex);

+            json.EndString();

+            json.BeginObject();

+

+            json.WriteString("Size");

+            json.WriteNumber(allocator->m_MemProps.memoryHeaps[heapIndex].size);

+

+            json.WriteString("Flags");

+            json.BeginArray(true);

+            if((allocator->m_MemProps.memoryHeaps[heapIndex].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) != 0)

+            {

+                json.WriteString("DEVICE_LOCAL");

+            }

+            json.EndArray();

+

+            json.WriteString("Budget");

+            json.BeginObject();

+            {

+                json.WriteString("BlockBytes");

+                json.WriteNumber(budget[heapIndex].blockBytes);

+                json.WriteString("AllocationBytes");

+                json.WriteNumber(budget[heapIndex].allocationBytes);

+                json.WriteString("Usage");

+                json.WriteNumber(budget[heapIndex].usage);

+                json.WriteString("Budget");

+                json.WriteNumber(budget[heapIndex].budget);

+            }

+            json.EndObject();

+

+            if(stats.memoryHeap[heapIndex].blockCount > 0)

+            {

+                json.WriteString("Stats");

+                VmaPrintStatInfo(json, stats.memoryHeap[heapIndex]);

+            }

+

+            for(uint32_t typeIndex = 0; typeIndex < allocator->GetMemoryTypeCount(); ++typeIndex)

+            {

+                if(allocator->MemoryTypeIndexToHeapIndex(typeIndex) == heapIndex)

+                {

+                    json.BeginString("Type ");

+                    json.ContinueString(typeIndex);

+                    json.EndString();

+

+                    json.BeginObject();

+

+                    json.WriteString("Flags");

+                    json.BeginArray(true);

+                    VkMemoryPropertyFlags flags = allocator->m_MemProps.memoryTypes[typeIndex].propertyFlags;

+                    if((flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0)

+                    {

+                        json.WriteString("DEVICE_LOCAL");

+                    }

+                    if((flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)

+                    {

+                        json.WriteString("HOST_VISIBLE");

+                    }

+                    if((flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) != 0)

+                    {

+                        json.WriteString("HOST_COHERENT");

+                    }

+                    if((flags & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) != 0)

+                    {

+                        json.WriteString("HOST_CACHED");

+                    }

+                    if((flags & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) != 0)

+                    {

+                        json.WriteString("LAZILY_ALLOCATED");

+                    }

+                    if((flags & VK_MEMORY_PROPERTY_PROTECTED_BIT) != 0)

+                    {

+                        json.WriteString(" PROTECTED");

+                    }

+                    if((flags & VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY) != 0)

+                    {

+                        json.WriteString(" DEVICE_COHERENT");

+                    }

+                    if((flags & VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY) != 0)

+                    {

+                        json.WriteString(" DEVICE_UNCACHED");

+                    }

+                    json.EndArray();

+

+                    if(stats.memoryType[typeIndex].blockCount > 0)

+                    {

+                        json.WriteString("Stats");

+                        VmaPrintStatInfo(json, stats.memoryType[typeIndex]);

+                    }

+

+                    json.EndObject();

+                }

+            }

+

+            json.EndObject();

+        }

+        if(detailedMap == VK_TRUE)

+        {

+            allocator->PrintDetailedMap(json);

+        }

+

+        json.EndObject();

+    }

+

+    const size_t len = sb.GetLength();

+    char* const pChars = vma_new_array(allocator, char, len + 1);

+    if(len > 0)

+    {

+        memcpy(pChars, sb.GetData(), len);

+    }

+    pChars[len] = '\0';

+    *ppStatsString = pChars;

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(

+    VmaAllocator allocator,

+    char* pStatsString)

+{

+    if(pStatsString != VMA_NULL)

+    {

+        VMA_ASSERT(allocator);

+        size_t len = strlen(pStatsString);

+        vma_delete_array(allocator, pStatsString, len + 1);

+    }

+}

+

+#endif // #if VMA_STATS_STRING_ENABLED

+

+/*

+This function is not protected by any mutex because it just reads immutable data.

+*/

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndex(

+    VmaAllocator allocator,

+    uint32_t memoryTypeBits,

+    const VmaAllocationCreateInfo* pAllocationCreateInfo,

+    uint32_t* pMemoryTypeIndex)

+{

+    VMA_ASSERT(allocator != VK_NULL_HANDLE);

+    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);

+    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);

+

+    memoryTypeBits &= allocator->GetGlobalMemoryTypeBits();

+

+    if(pAllocationCreateInfo->memoryTypeBits != 0)

+    {

+        memoryTypeBits &= pAllocationCreateInfo->memoryTypeBits;

+    }

+    

+    uint32_t requiredFlags = pAllocationCreateInfo->requiredFlags;

+    uint32_t preferredFlags = pAllocationCreateInfo->preferredFlags;

+    uint32_t notPreferredFlags = 0;

+

+    // Convert usage to requiredFlags and preferredFlags.

+    switch(pAllocationCreateInfo->usage)

+    {

+    case VMA_MEMORY_USAGE_UNKNOWN:

+        break;

+    case VMA_MEMORY_USAGE_GPU_ONLY:

+        if(!allocator->IsIntegratedGpu() || (preferredFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)

+        {

+            preferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;

+        }

+        break;

+    case VMA_MEMORY_USAGE_CPU_ONLY:

+        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;

+        break;

+    case VMA_MEMORY_USAGE_CPU_TO_GPU:

+        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;

+        if(!allocator->IsIntegratedGpu() || (preferredFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)

+        {

+            preferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;

+        }

+        break;

+    case VMA_MEMORY_USAGE_GPU_TO_CPU:

+        requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;

+        preferredFlags |= VK_MEMORY_PROPERTY_HOST_CACHED_BIT;

+        break;

+    case VMA_MEMORY_USAGE_CPU_COPY:

+        notPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;

+        break;

+    case VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED:

+        requiredFlags |= VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT;

+        break;

+    default:

+        VMA_ASSERT(0);

+        break;

+    }

+

+    // Avoid DEVICE_COHERENT unless explicitly requested.

+    if(((pAllocationCreateInfo->requiredFlags | pAllocationCreateInfo->preferredFlags) &

+        (VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY | VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD_COPY)) == 0)

+    {

+        notPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD_COPY;

+    }

+

+    *pMemoryTypeIndex = UINT32_MAX;

+    uint32_t minCost = UINT32_MAX;

+    for(uint32_t memTypeIndex = 0, memTypeBit = 1;

+        memTypeIndex < allocator->GetMemoryTypeCount();

+        ++memTypeIndex, memTypeBit <<= 1)

+    {

+        // This memory type is acceptable according to memoryTypeBits bitmask.

+        if((memTypeBit & memoryTypeBits) != 0)

+        {

+            const VkMemoryPropertyFlags currFlags =

+                allocator->m_MemProps.memoryTypes[memTypeIndex].propertyFlags;

+            // This memory type contains requiredFlags.

+            if((requiredFlags & ~currFlags) == 0)

+            {

+                // Calculate cost as number of bits from preferredFlags not present in this memory type.

+                uint32_t currCost = VmaCountBitsSet(preferredFlags & ~currFlags) +

+                    VmaCountBitsSet(currFlags & notPreferredFlags);

+                // Remember memory type with lowest cost.

+                if(currCost < minCost)

+                {

+                    *pMemoryTypeIndex = memTypeIndex;

+                    if(currCost == 0)

+                    {

+                        return VK_SUCCESS;

+                    }

+                    minCost = currCost;

+                }

+            }

+        }

+    }

+    return (*pMemoryTypeIndex != UINT32_MAX) ? VK_SUCCESS : VK_ERROR_FEATURE_NOT_PRESENT;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForBufferInfo(

+    VmaAllocator allocator,

+    const VkBufferCreateInfo* pBufferCreateInfo,

+    const VmaAllocationCreateInfo* pAllocationCreateInfo,

+    uint32_t* pMemoryTypeIndex)

+{

+    VMA_ASSERT(allocator != VK_NULL_HANDLE);

+    VMA_ASSERT(pBufferCreateInfo != VMA_NULL);

+    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);

+    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);

+

+    const VkDevice hDev = allocator->m_hDevice;

+    VkBuffer hBuffer = VK_NULL_HANDLE;

+    VkResult res = allocator->GetVulkanFunctions().vkCreateBuffer(

+        hDev, pBufferCreateInfo, allocator->GetAllocationCallbacks(), &hBuffer);

+    if(res == VK_SUCCESS)

+    {

+        VkMemoryRequirements memReq = {};

+        allocator->GetVulkanFunctions().vkGetBufferMemoryRequirements(

+            hDev, hBuffer, &memReq);

+

+        res = vmaFindMemoryTypeIndex(

+            allocator,

+            memReq.memoryTypeBits,

+            pAllocationCreateInfo,

+            pMemoryTypeIndex);

+

+        allocator->GetVulkanFunctions().vkDestroyBuffer(

+            hDev, hBuffer, allocator->GetAllocationCallbacks());

+    }

+    return res;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForImageInfo(

+    VmaAllocator allocator,

+    const VkImageCreateInfo* pImageCreateInfo,

+    const VmaAllocationCreateInfo* pAllocationCreateInfo,

+    uint32_t* pMemoryTypeIndex)

+{

+    VMA_ASSERT(allocator != VK_NULL_HANDLE);

+    VMA_ASSERT(pImageCreateInfo != VMA_NULL);

+    VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);

+    VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);

+

+    const VkDevice hDev = allocator->m_hDevice;

+    VkImage hImage = VK_NULL_HANDLE;

+    VkResult res = allocator->GetVulkanFunctions().vkCreateImage(

+        hDev, pImageCreateInfo, allocator->GetAllocationCallbacks(), &hImage);

+    if(res == VK_SUCCESS)

+    {

+        VkMemoryRequirements memReq = {};

+        allocator->GetVulkanFunctions().vkGetImageMemoryRequirements(

+            hDev, hImage, &memReq);

+

+        res = vmaFindMemoryTypeIndex(

+            allocator,

+            memReq.memoryTypeBits,

+            pAllocationCreateInfo,

+            pMemoryTypeIndex);

+

+        allocator->GetVulkanFunctions().vkDestroyImage(

+            hDev, hImage, allocator->GetAllocationCallbacks());

+    }

+    return res;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreatePool(

+	VmaAllocator allocator,

+	const VmaPoolCreateInfo* pCreateInfo,

+	VmaPool* pPool)

+{

+    VMA_ASSERT(allocator && pCreateInfo && pPool);

+    

+    VMA_DEBUG_LOG("vmaCreatePool");

+    

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+    

+    VkResult res = allocator->CreatePool(pCreateInfo, pPool);

+    

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordCreatePool(allocator->GetCurrentFrameIndex(), *pCreateInfo, *pPool);

+    }

+#endif

+    

+    return res;

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaDestroyPool(

+    VmaAllocator allocator,

+    VmaPool pool)

+{

+    VMA_ASSERT(allocator);

+    

+    if(pool == VK_NULL_HANDLE)

+    {

+        return;

+    }

+    

+    VMA_DEBUG_LOG("vmaDestroyPool");

+    

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+    

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordDestroyPool(allocator->GetCurrentFrameIndex(), pool);

+    }

+#endif

+

+    allocator->DestroyPool(pool);

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolStats(

+    VmaAllocator allocator,

+    VmaPool pool,

+    VmaPoolStats* pPoolStats)

+{

+    VMA_ASSERT(allocator && pool && pPoolStats);

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    allocator->GetPoolStats(pool, pPoolStats);

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaMakePoolAllocationsLost(

+    VmaAllocator allocator,

+    VmaPool pool,

+    size_t* pLostAllocationCount)

+{

+    VMA_ASSERT(allocator && pool);

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordMakePoolAllocationsLost(allocator->GetCurrentFrameIndex(), pool);

+    }

+#endif

+

+    allocator->MakePoolAllocationsLost(pool, pLostAllocationCount);

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckPoolCorruption(VmaAllocator allocator, VmaPool pool)

+{

+    VMA_ASSERT(allocator && pool);

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    VMA_DEBUG_LOG("vmaCheckPoolCorruption");

+

+    return allocator->CheckPoolCorruption(pool);

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolName(

+    VmaAllocator allocator,

+    VmaPool pool,

+    const char** ppName)

+{

+    VMA_ASSERT(allocator && pool && ppName);

+    

+    VMA_DEBUG_LOG("vmaGetPoolName");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    *ppName = pool->GetName();

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaSetPoolName(

+    VmaAllocator allocator,

+    VmaPool pool,

+    const char* pName)

+{

+    VMA_ASSERT(allocator && pool);

+

+    VMA_DEBUG_LOG("vmaSetPoolName");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    pool->SetName(pName);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordSetPoolName(allocator->GetCurrentFrameIndex(), pool, pName);

+    }

+#endif

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemory(

+    VmaAllocator allocator,

+    const VkMemoryRequirements* pVkMemoryRequirements,

+    const VmaAllocationCreateInfo* pCreateInfo,

+    VmaAllocation* pAllocation,

+    VmaAllocationInfo* pAllocationInfo)

+{

+    VMA_ASSERT(allocator && pVkMemoryRequirements && pCreateInfo && pAllocation);

+

+    VMA_DEBUG_LOG("vmaAllocateMemory");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+	VkResult result = allocator->AllocateMemory(

+        *pVkMemoryRequirements,

+        false, // requiresDedicatedAllocation

+        false, // prefersDedicatedAllocation

+        VK_NULL_HANDLE, // dedicatedBuffer

+        UINT32_MAX, // dedicatedBufferUsage

+        VK_NULL_HANDLE, // dedicatedImage

+        *pCreateInfo,

+        VMA_SUBALLOCATION_TYPE_UNKNOWN,

+        1, // allocationCount

+        pAllocation);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordAllocateMemory(

+            allocator->GetCurrentFrameIndex(),

+            *pVkMemoryRequirements,

+            *pCreateInfo,

+            *pAllocation);

+    }

+#endif

+        

+    if(pAllocationInfo != VMA_NULL && result == VK_SUCCESS)

+    {

+        allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);

+    }

+

+	return result;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryPages(

+    VmaAllocator allocator,

+    const VkMemoryRequirements* pVkMemoryRequirements,

+    const VmaAllocationCreateInfo* pCreateInfo,

+    size_t allocationCount,

+    VmaAllocation* pAllocations,

+    VmaAllocationInfo* pAllocationInfo)

+{

+    if(allocationCount == 0)

+    {

+        return VK_SUCCESS;

+    }

+

+    VMA_ASSERT(allocator && pVkMemoryRequirements && pCreateInfo && pAllocations);

+

+    VMA_DEBUG_LOG("vmaAllocateMemoryPages");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+	VkResult result = allocator->AllocateMemory(

+        *pVkMemoryRequirements,

+        false, // requiresDedicatedAllocation

+        false, // prefersDedicatedAllocation

+        VK_NULL_HANDLE, // dedicatedBuffer

+        UINT32_MAX, // dedicatedBufferUsage

+        VK_NULL_HANDLE, // dedicatedImage

+        *pCreateInfo,

+        VMA_SUBALLOCATION_TYPE_UNKNOWN,

+        allocationCount,

+        pAllocations);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordAllocateMemoryPages(

+            allocator->GetCurrentFrameIndex(),

+            *pVkMemoryRequirements,

+            *pCreateInfo,

+            (uint64_t)allocationCount,

+            pAllocations);

+    }

+#endif

+        

+    if(pAllocationInfo != VMA_NULL && result == VK_SUCCESS)

+    {

+        for(size_t i = 0; i < allocationCount; ++i)

+        {

+            allocator->GetAllocationInfo(pAllocations[i], pAllocationInfo + i);

+        }

+    }

+

+	return result;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForBuffer(

+    VmaAllocator allocator,

+    VkBuffer buffer,

+    const VmaAllocationCreateInfo* pCreateInfo,

+    VmaAllocation* pAllocation,

+    VmaAllocationInfo* pAllocationInfo)

+{

+    VMA_ASSERT(allocator && buffer != VK_NULL_HANDLE && pCreateInfo && pAllocation);

+

+    VMA_DEBUG_LOG("vmaAllocateMemoryForBuffer");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    VkMemoryRequirements vkMemReq = {};

+    bool requiresDedicatedAllocation = false;

+    bool prefersDedicatedAllocation = false;

+    allocator->GetBufferMemoryRequirements(buffer, vkMemReq,

+        requiresDedicatedAllocation,

+        prefersDedicatedAllocation);

+

+    VkResult result = allocator->AllocateMemory(

+        vkMemReq,

+        requiresDedicatedAllocation,

+        prefersDedicatedAllocation,

+        buffer, // dedicatedBuffer

+        UINT32_MAX, // dedicatedBufferUsage

+        VK_NULL_HANDLE, // dedicatedImage

+        *pCreateInfo,

+        VMA_SUBALLOCATION_TYPE_BUFFER,

+        1, // allocationCount

+        pAllocation);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordAllocateMemoryForBuffer(

+            allocator->GetCurrentFrameIndex(),

+            vkMemReq,

+            requiresDedicatedAllocation,

+            prefersDedicatedAllocation,

+            *pCreateInfo,

+            *pAllocation);

+    }

+#endif

+

+    if(pAllocationInfo && result == VK_SUCCESS)

+    {

+        allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);

+    }

+

+	return result;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForImage(

+    VmaAllocator allocator,

+    VkImage image,

+    const VmaAllocationCreateInfo* pCreateInfo,

+    VmaAllocation* pAllocation,

+    VmaAllocationInfo* pAllocationInfo)

+{

+    VMA_ASSERT(allocator && image != VK_NULL_HANDLE && pCreateInfo && pAllocation);

+

+    VMA_DEBUG_LOG("vmaAllocateMemoryForImage");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    VkMemoryRequirements vkMemReq = {};

+    bool requiresDedicatedAllocation = false;

+    bool prefersDedicatedAllocation  = false;

+    allocator->GetImageMemoryRequirements(image, vkMemReq,

+        requiresDedicatedAllocation, prefersDedicatedAllocation);

+

+    VkResult result = allocator->AllocateMemory(

+        vkMemReq,

+        requiresDedicatedAllocation,

+        prefersDedicatedAllocation,

+        VK_NULL_HANDLE, // dedicatedBuffer

+        UINT32_MAX, // dedicatedBufferUsage

+        image, // dedicatedImage

+        *pCreateInfo,

+        VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN,

+        1, // allocationCount

+        pAllocation);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordAllocateMemoryForImage(

+            allocator->GetCurrentFrameIndex(),

+            vkMemReq,

+            requiresDedicatedAllocation,

+            prefersDedicatedAllocation,

+            *pCreateInfo,

+            *pAllocation);

+    }

+#endif

+

+    if(pAllocationInfo && result == VK_SUCCESS)

+    {

+        allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);

+    }

+

+	return result;

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemory(

+    VmaAllocator allocator,

+    VmaAllocation allocation)

+{

+    VMA_ASSERT(allocator);

+    

+    if(allocation == VK_NULL_HANDLE)

+    {

+        return;

+    }

+    

+    VMA_DEBUG_LOG("vmaFreeMemory");

+    

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordFreeMemory(

+            allocator->GetCurrentFrameIndex(),

+            allocation);

+    }

+#endif

+    

+    allocator->FreeMemory(

+        1, // allocationCount

+        &allocation);

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemoryPages(

+    VmaAllocator allocator,

+    size_t allocationCount,

+    const VmaAllocation* pAllocations)

+{

+    if(allocationCount == 0)

+    {

+        return;

+    }

+

+    VMA_ASSERT(allocator);

+    

+    VMA_DEBUG_LOG("vmaFreeMemoryPages");

+    

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordFreeMemoryPages(

+            allocator->GetCurrentFrameIndex(),

+            (uint64_t)allocationCount,

+            pAllocations);

+    }

+#endif

+    

+    allocator->FreeMemory(allocationCount, pAllocations);

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaResizeAllocation(

+    VmaAllocator allocator,

+    VmaAllocation allocation,

+    VkDeviceSize newSize)

+{

+    VMA_ASSERT(allocator && allocation);

+    

+    VMA_DEBUG_LOG("vmaResizeAllocation");

+    

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    return allocator->ResizeAllocation(allocation, newSize);

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocationInfo(

+    VmaAllocator allocator,

+    VmaAllocation allocation,

+    VmaAllocationInfo* pAllocationInfo)

+{

+    VMA_ASSERT(allocator && allocation && pAllocationInfo);

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordGetAllocationInfo(

+            allocator->GetCurrentFrameIndex(),

+            allocation);

+    }

+#endif

+

+    allocator->GetAllocationInfo(allocation, pAllocationInfo);

+}

+

+VMA_CALL_PRE VkBool32 VMA_CALL_POST vmaTouchAllocation(

+    VmaAllocator allocator,

+    VmaAllocation allocation)

+{

+    VMA_ASSERT(allocator && allocation);

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordTouchAllocation(

+            allocator->GetCurrentFrameIndex(),

+            allocation);

+    }

+#endif

+

+    return allocator->TouchAllocation(allocation);

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaSetAllocationUserData(

+    VmaAllocator allocator,

+    VmaAllocation allocation,

+    void* pUserData)

+{

+    VMA_ASSERT(allocator && allocation);

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    allocation->SetUserData(allocator, pUserData);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordSetAllocationUserData(

+            allocator->GetCurrentFrameIndex(),

+            allocation,

+            pUserData);

+    }

+#endif

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaCreateLostAllocation(

+    VmaAllocator allocator,

+    VmaAllocation* pAllocation)

+{

+    VMA_ASSERT(allocator && pAllocation);

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK;

+

+    allocator->CreateLostAllocation(pAllocation);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordCreateLostAllocation(

+            allocator->GetCurrentFrameIndex(),

+            *pAllocation);

+    }

+#endif

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaMapMemory(

+    VmaAllocator allocator,

+    VmaAllocation allocation,

+    void** ppData)

+{

+    VMA_ASSERT(allocator && allocation && ppData);

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    VkResult res = allocator->Map(allocation, ppData);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordMapMemory(

+            allocator->GetCurrentFrameIndex(),

+            allocation);

+    }

+#endif

+

+    return res;

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaUnmapMemory(

+    VmaAllocator allocator,

+    VmaAllocation allocation)

+{

+    VMA_ASSERT(allocator && allocation);

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordUnmapMemory(

+            allocator->GetCurrentFrameIndex(),

+            allocation);

+    }

+#endif

+

+    allocator->Unmap(allocation);

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaFlushAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)

+{

+    VMA_ASSERT(allocator && allocation);

+

+    VMA_DEBUG_LOG("vmaFlushAllocation");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    const VkResult res = allocator->FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_FLUSH);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordFlushAllocation(

+            allocator->GetCurrentFrameIndex(),

+            allocation, offset, size);

+    }

+#endif

+

+    return res;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaInvalidateAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)

+{

+    VMA_ASSERT(allocator && allocation);

+

+    VMA_DEBUG_LOG("vmaInvalidateAllocation");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    const VkResult res = allocator->FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_INVALIDATE);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordInvalidateAllocation(

+            allocator->GetCurrentFrameIndex(),

+            allocation, offset, size);

+    }

+#endif

+

+    return res;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaFlushAllocations(

+    VmaAllocator allocator,

+    uint32_t allocationCount,

+    const VmaAllocation* allocations,

+    const VkDeviceSize* offsets,

+    const VkDeviceSize* sizes)

+{

+    VMA_ASSERT(allocator);

+

+    if(allocationCount == 0)

+    {

+        return VK_SUCCESS;

+    }

+

+    VMA_ASSERT(allocations);

+

+    VMA_DEBUG_LOG("vmaFlushAllocations");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    const VkResult res = allocator->FlushOrInvalidateAllocations(allocationCount, allocations, offsets, sizes, VMA_CACHE_FLUSH);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        //TODO

+    }

+#endif

+

+    return res;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaInvalidateAllocations(

+    VmaAllocator allocator,

+    uint32_t allocationCount,

+    const VmaAllocation* allocations,

+    const VkDeviceSize* offsets,

+    const VkDeviceSize* sizes)

+{

+    VMA_ASSERT(allocator);

+

+    if(allocationCount == 0)

+    {

+        return VK_SUCCESS;

+    }

+

+    VMA_ASSERT(allocations);

+

+    VMA_DEBUG_LOG("vmaInvalidateAllocations");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    const VkResult res = allocator->FlushOrInvalidateAllocations(allocationCount, allocations, offsets, sizes, VMA_CACHE_INVALIDATE);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        //TODO

+    }

+#endif

+

+    return res;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckCorruption(VmaAllocator allocator, uint32_t memoryTypeBits)

+{

+    VMA_ASSERT(allocator);

+

+    VMA_DEBUG_LOG("vmaCheckCorruption");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    return allocator->CheckCorruption(memoryTypeBits);

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragment(

+    VmaAllocator allocator,

+    const VmaAllocation* pAllocations,

+    size_t allocationCount,

+    VkBool32* pAllocationsChanged,

+    const VmaDefragmentationInfo *pDefragmentationInfo,

+    VmaDefragmentationStats* pDefragmentationStats)

+{

+    // Deprecated interface, reimplemented using new one.

+

+    VmaDefragmentationInfo2 info2 = {};

+    info2.allocationCount = (uint32_t)allocationCount;

+    info2.pAllocations = pAllocations;

+    info2.pAllocationsChanged = pAllocationsChanged;

+    if(pDefragmentationInfo != VMA_NULL)

+    {

+        info2.maxCpuAllocationsToMove = pDefragmentationInfo->maxAllocationsToMove;

+        info2.maxCpuBytesToMove = pDefragmentationInfo->maxBytesToMove;

+    }

+    else

+    {

+        info2.maxCpuAllocationsToMove = UINT32_MAX;

+        info2.maxCpuBytesToMove = VK_WHOLE_SIZE;

+    }

+    // info2.flags, maxGpuAllocationsToMove, maxGpuBytesToMove, commandBuffer deliberately left zero.

+

+    VmaDefragmentationContext ctx;

+    VkResult res = vmaDefragmentationBegin(allocator, &info2, pDefragmentationStats, &ctx);

+    if(res == VK_NOT_READY)

+    {

+        res = vmaDefragmentationEnd( allocator, ctx);

+    }

+    return res;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragmentationBegin(

+    VmaAllocator allocator,

+    const VmaDefragmentationInfo2* pInfo,

+    VmaDefragmentationStats* pStats,

+    VmaDefragmentationContext *pContext)

+{

+    VMA_ASSERT(allocator && pInfo && pContext);

+

+    // Degenerate case: Nothing to defragment.

+    if(pInfo->allocationCount == 0 && pInfo->poolCount == 0)

+    {

+        return VK_SUCCESS;

+    }

+

+    VMA_ASSERT(pInfo->allocationCount == 0 || pInfo->pAllocations != VMA_NULL);

+    VMA_ASSERT(pInfo->poolCount == 0 || pInfo->pPools != VMA_NULL);

+    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo->allocationCount, pInfo->pAllocations));

+    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo->poolCount, pInfo->pPools));

+

+    VMA_DEBUG_LOG("vmaDefragmentationBegin");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    VkResult res = allocator->DefragmentationBegin(*pInfo, pStats, pContext);

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordDefragmentationBegin(

+            allocator->GetCurrentFrameIndex(), *pInfo, *pContext);

+    }

+#endif

+

+    return res;

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragmentationEnd(

+    VmaAllocator allocator,

+    VmaDefragmentationContext context)

+{

+    VMA_ASSERT(allocator);

+

+    VMA_DEBUG_LOG("vmaDefragmentationEnd");

+

+    if(context != VK_NULL_HANDLE)

+    {

+        VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+#if VMA_RECORDING_ENABLED

+        if(allocator->GetRecorder() != VMA_NULL)

+        {

+            allocator->GetRecorder()->RecordDefragmentationEnd(

+                allocator->GetCurrentFrameIndex(), context);

+        }

+#endif

+

+        return allocator->DefragmentationEnd(context);

+    }

+    else

+    {

+        return VK_SUCCESS;

+    }

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentationPass(

+    VmaAllocator allocator,

+    VmaDefragmentationContext context,

+    VmaDefragmentationPassInfo* pInfo

+    )

+{

+    VMA_ASSERT(allocator);

+    VMA_ASSERT(pInfo);

+    VMA_HEAVY_ASSERT(VmaValidatePointerArray(pInfo->moveCount, pInfo->pMoves));

+

+    VMA_DEBUG_LOG("vmaBeginDefragmentationPass");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    if(context == VK_NULL_HANDLE)

+    {

+        pInfo->moveCount = 0;

+        return VK_SUCCESS;

+    }

+

+    return allocator->DefragmentationPassBegin(pInfo, context);

+}

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentationPass(

+    VmaAllocator allocator,

+    VmaDefragmentationContext context)

+{

+    VMA_ASSERT(allocator);

+

+    VMA_DEBUG_LOG("vmaEndDefragmentationPass");

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    if(context == VK_NULL_HANDLE)

+        return VK_SUCCESS;

+

+    return allocator->DefragmentationPassEnd(context);

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory(

+    VmaAllocator allocator,

+    VmaAllocation allocation,

+    VkBuffer buffer)

+{

+    VMA_ASSERT(allocator && allocation && buffer);

+

+    VMA_DEBUG_LOG("vmaBindBufferMemory");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    return allocator->BindBufferMemory(allocation, 0, buffer, VMA_NULL);

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory2(

+    VmaAllocator allocator,

+    VmaAllocation allocation,

+    VkDeviceSize allocationLocalOffset,

+    VkBuffer buffer,

+    const void* pNext)

+{

+    VMA_ASSERT(allocator && allocation && buffer);

+

+    VMA_DEBUG_LOG("vmaBindBufferMemory2");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    return allocator->BindBufferMemory(allocation, allocationLocalOffset, buffer, pNext);

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory(

+    VmaAllocator allocator,

+    VmaAllocation allocation,

+    VkImage image)

+{

+    VMA_ASSERT(allocator && allocation && image);

+

+    VMA_DEBUG_LOG("vmaBindImageMemory");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    return allocator->BindImageMemory(allocation, 0, image, VMA_NULL);

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory2(

+    VmaAllocator allocator,

+    VmaAllocation allocation,

+    VkDeviceSize allocationLocalOffset,

+    VkImage image,

+    const void* pNext)

+{

+    VMA_ASSERT(allocator && allocation && image);

+

+    VMA_DEBUG_LOG("vmaBindImageMemory2");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+        return allocator->BindImageMemory(allocation, allocationLocalOffset, image, pNext);

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateBuffer(

+    VmaAllocator allocator,

+    const VkBufferCreateInfo* pBufferCreateInfo,

+    const VmaAllocationCreateInfo* pAllocationCreateInfo,

+    VkBuffer* pBuffer,

+    VmaAllocation* pAllocation,

+    VmaAllocationInfo* pAllocationInfo)

+{

+    VMA_ASSERT(allocator && pBufferCreateInfo && pAllocationCreateInfo && pBuffer && pAllocation);

+

+    if(pBufferCreateInfo->size == 0)

+    {

+        return VK_ERROR_VALIDATION_FAILED_EXT;

+    }

+    if((pBufferCreateInfo->usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_COPY) != 0 &&

+        !allocator->m_UseKhrBufferDeviceAddress)

+    {

+        VMA_ASSERT(0 && "Creating a buffer with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT is not valid if VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT was not used.");

+        return VK_ERROR_VALIDATION_FAILED_EXT;

+    }

+    

+    VMA_DEBUG_LOG("vmaCreateBuffer");

+    

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    *pBuffer = VK_NULL_HANDLE;

+    *pAllocation = VK_NULL_HANDLE;

+

+    // 1. Create VkBuffer.

+    VkResult res = (*allocator->GetVulkanFunctions().vkCreateBuffer)(

+        allocator->m_hDevice,

+        pBufferCreateInfo,

+        allocator->GetAllocationCallbacks(),

+        pBuffer);

+    if(res >= 0)

+    {

+        // 2. vkGetBufferMemoryRequirements.

+        VkMemoryRequirements vkMemReq = {};

+        bool requiresDedicatedAllocation = false;

+        bool prefersDedicatedAllocation  = false;

+        allocator->GetBufferMemoryRequirements(*pBuffer, vkMemReq,

+            requiresDedicatedAllocation, prefersDedicatedAllocation);

+

+        // 3. Allocate memory using allocator.

+        res = allocator->AllocateMemory(

+            vkMemReq,

+            requiresDedicatedAllocation,

+            prefersDedicatedAllocation,

+            *pBuffer, // dedicatedBuffer

+            pBufferCreateInfo->usage, // dedicatedBufferUsage

+            VK_NULL_HANDLE, // dedicatedImage

+            *pAllocationCreateInfo,

+            VMA_SUBALLOCATION_TYPE_BUFFER,

+            1, // allocationCount

+            pAllocation);

+

+#if VMA_RECORDING_ENABLED

+        if(allocator->GetRecorder() != VMA_NULL)

+        {

+            allocator->GetRecorder()->RecordCreateBuffer(

+                allocator->GetCurrentFrameIndex(),

+                *pBufferCreateInfo,

+                *pAllocationCreateInfo,

+                *pAllocation);

+        }

+#endif

+

+        if(res >= 0)

+        {

+            // 3. Bind buffer with memory.

+            if((pAllocationCreateInfo->flags & VMA_ALLOCATION_CREATE_DONT_BIND_BIT) == 0)

+            {

+                res = allocator->BindBufferMemory(*pAllocation, 0, *pBuffer, VMA_NULL);

+            }

+            if(res >= 0)

+            {

+                // All steps succeeded.

+                #if VMA_STATS_STRING_ENABLED

+                    (*pAllocation)->InitBufferImageUsage(pBufferCreateInfo->usage);

+                #endif

+                if(pAllocationInfo != VMA_NULL)

+                {

+                    allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);

+                }

+

+                return VK_SUCCESS;

+            }

+            allocator->FreeMemory(

+                1, // allocationCount

+                pAllocation);

+            *pAllocation = VK_NULL_HANDLE;

+            (*allocator->GetVulkanFunctions().vkDestroyBuffer)(allocator->m_hDevice, *pBuffer, allocator->GetAllocationCallbacks());

+            *pBuffer = VK_NULL_HANDLE;

+            return res;

+        }

+        (*allocator->GetVulkanFunctions().vkDestroyBuffer)(allocator->m_hDevice, *pBuffer, allocator->GetAllocationCallbacks());

+        *pBuffer = VK_NULL_HANDLE;

+        return res;

+    }

+    return res;

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaDestroyBuffer(

+    VmaAllocator allocator,

+    VkBuffer buffer,

+    VmaAllocation allocation)

+{

+    VMA_ASSERT(allocator);

+

+    if(buffer == VK_NULL_HANDLE && allocation == VK_NULL_HANDLE)

+    {

+        return;

+    }

+

+    VMA_DEBUG_LOG("vmaDestroyBuffer");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordDestroyBuffer(

+            allocator->GetCurrentFrameIndex(),

+            allocation);

+    }

+#endif

+

+    if(buffer != VK_NULL_HANDLE)

+    {

+        (*allocator->GetVulkanFunctions().vkDestroyBuffer)(allocator->m_hDevice, buffer, allocator->GetAllocationCallbacks());

+    }

+

+    if(allocation != VK_NULL_HANDLE)

+    {

+        allocator->FreeMemory(

+            1, // allocationCount

+            &allocation);

+    }

+}

+

+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateImage(

+    VmaAllocator allocator,

+    const VkImageCreateInfo* pImageCreateInfo,

+    const VmaAllocationCreateInfo* pAllocationCreateInfo,

+    VkImage* pImage,

+    VmaAllocation* pAllocation,

+    VmaAllocationInfo* pAllocationInfo)

+{

+    VMA_ASSERT(allocator && pImageCreateInfo && pAllocationCreateInfo && pImage && pAllocation);

+

+    if(pImageCreateInfo->extent.width == 0 ||

+        pImageCreateInfo->extent.height == 0 ||

+        pImageCreateInfo->extent.depth == 0 ||

+        pImageCreateInfo->mipLevels == 0 ||

+        pImageCreateInfo->arrayLayers == 0)

+    {

+        return VK_ERROR_VALIDATION_FAILED_EXT;

+    }

+

+    VMA_DEBUG_LOG("vmaCreateImage");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+    *pImage = VK_NULL_HANDLE;

+    *pAllocation = VK_NULL_HANDLE;

+

+    // 1. Create VkImage.

+    VkResult res = (*allocator->GetVulkanFunctions().vkCreateImage)(

+        allocator->m_hDevice,

+        pImageCreateInfo,

+        allocator->GetAllocationCallbacks(),

+        pImage);

+    if(res >= 0)

+    {

+        VmaSuballocationType suballocType = pImageCreateInfo->tiling == VK_IMAGE_TILING_OPTIMAL ?

+            VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL :

+            VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR;

+        

+        // 2. Allocate memory using allocator.

+        VkMemoryRequirements vkMemReq = {};

+        bool requiresDedicatedAllocation = false;

+        bool prefersDedicatedAllocation  = false;

+        allocator->GetImageMemoryRequirements(*pImage, vkMemReq,

+            requiresDedicatedAllocation, prefersDedicatedAllocation);

+

+        res = allocator->AllocateMemory(

+            vkMemReq,

+            requiresDedicatedAllocation,

+            prefersDedicatedAllocation,

+            VK_NULL_HANDLE, // dedicatedBuffer

+            UINT32_MAX, // dedicatedBufferUsage

+            *pImage, // dedicatedImage

+            *pAllocationCreateInfo,

+            suballocType,

+            1, // allocationCount

+            pAllocation);

+

+#if VMA_RECORDING_ENABLED

+        if(allocator->GetRecorder() != VMA_NULL)

+        {

+            allocator->GetRecorder()->RecordCreateImage(

+                allocator->GetCurrentFrameIndex(),

+                *pImageCreateInfo,

+                *pAllocationCreateInfo,

+                *pAllocation);

+        }

+#endif

+

+        if(res >= 0)

+        {

+            // 3. Bind image with memory.

+            if((pAllocationCreateInfo->flags & VMA_ALLOCATION_CREATE_DONT_BIND_BIT) == 0)

+            {

+                res = allocator->BindImageMemory(*pAllocation, 0, *pImage, VMA_NULL);

+            }

+            if(res >= 0)

+            {

+                // All steps succeeded.

+                #if VMA_STATS_STRING_ENABLED

+                    (*pAllocation)->InitBufferImageUsage(pImageCreateInfo->usage);

+                #endif

+                if(pAllocationInfo != VMA_NULL)

+                {

+                    allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);

+                }

+

+                return VK_SUCCESS;

+            }

+            allocator->FreeMemory(

+                1, // allocationCount

+                pAllocation);

+            *pAllocation = VK_NULL_HANDLE;

+            (*allocator->GetVulkanFunctions().vkDestroyImage)(allocator->m_hDevice, *pImage, allocator->GetAllocationCallbacks());

+            *pImage = VK_NULL_HANDLE;

+            return res;

+        }

+        (*allocator->GetVulkanFunctions().vkDestroyImage)(allocator->m_hDevice, *pImage, allocator->GetAllocationCallbacks());

+        *pImage = VK_NULL_HANDLE;

+        return res;

+    }

+    return res;

+}

+

+VMA_CALL_PRE void VMA_CALL_POST vmaDestroyImage(

+    VmaAllocator allocator,

+    VkImage image,

+    VmaAllocation allocation)

+{

+    VMA_ASSERT(allocator);

+

+    if(image == VK_NULL_HANDLE && allocation == VK_NULL_HANDLE)

+    {

+        return;

+    }

+

+    VMA_DEBUG_LOG("vmaDestroyImage");

+

+    VMA_DEBUG_GLOBAL_MUTEX_LOCK

+

+#if VMA_RECORDING_ENABLED

+    if(allocator->GetRecorder() != VMA_NULL)

+    {

+        allocator->GetRecorder()->RecordDestroyImage(

+            allocator->GetCurrentFrameIndex(),

+            allocation);

+    }

+#endif

+

+    if(image != VK_NULL_HANDLE)

+    {

+        (*allocator->GetVulkanFunctions().vkDestroyImage)(allocator->m_hDevice, image, allocator->GetAllocationCallbacks());

+    }

+    if(allocation != VK_NULL_HANDLE)

+    {

+        allocator->FreeMemory(

+            1, // allocationCount

+            &allocation);

+    }

+}

+

+#endif // #ifdef VMA_IMPLEMENTATION