<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Set of callbacks that the library will call for <code>vkAllocateMemory</code> and <code>vkFreeMemory</code>. <ahref="struct_vma_device_memory_callbacks.html#details">More...</a><br/></td></tr>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Pointers to some Vulkan functions - a subset used by the library. <ahref="struct_vma_vulkan_functions.html#details">More...</a><br/></td></tr>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Description of a Allocator to be created. <ahref="struct_vma_allocator_create_info.html#details">More...</a><br/></td></tr>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Calculated statistics of memory usage in entire allocator. <ahref="struct_vma_stat_info.html#details">More...</a><br/></td></tr>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">General statistics from current state of Allocator. <ahref="struct_vma_stats.html#details">More...</a><br/></td></tr>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Describes parameter of created <aclass="el"href="struct_vma_pool.html"title="Represents custom memory pool. ">VmaPool</a>. <ahref="struct_vma_pool_create_info.html#details">More...</a><br/></td></tr>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Describes parameter of existing <aclass="el"href="struct_vma_pool.html"title="Represents custom memory pool. ">VmaPool</a>. <ahref="struct_vma_pool_stats.html#details">More...</a><br/></td></tr>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Parameters of <aclass="el"href="struct_vma_allocation.html"title="Represents single memory allocation. ">VmaAllocation</a> objects, that can be retrieved using function <aclass="el"href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b"title="Returns current information about specified allocation and atomically marks it as used in current fra...">vmaGetAllocationInfo()</a>. <ahref="struct_vma_allocation_info.html#details">More...</a><br/></td></tr>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Optional configuration parameters to be passed to function <aclass="el"href="vk__mem__alloc_8h.html#a6aced90fcc7b39882b6654a740a0b9bb"title="Compacts memory by moving allocations. ">vmaDefragment()</a>. <ahref="struct_vma_defragmentation_info.html#details">More...</a><br/></td></tr>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Statistics returned by function <aclass="el"href="vk__mem__alloc_8h.html#a6aced90fcc7b39882b6654a740a0b9bb"title="Compacts memory by moving allocations. ">vmaDefragment()</a>. <ahref="struct_vma_defragmentation_stats.html#details">More...</a><br/></td></tr>
<trclass="memdesc:ab6a6477cda1ce775b30bde96d766203b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Callback function called after successful vkAllocateMemory. <ahref="#ab6a6477cda1ce775b30bde96d766203b">More...</a><br/></td></tr>
<trclass="memdesc:aef2545dc2e9dd4f29ab9ba6ac6fe2f49"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Callback function called before vkFreeMemory. <ahref="#aef2545dc2e9dd4f29ab9ba6ac6fe2f49">More...</a><br/></td></tr>
<trclass="memdesc:a5e2eb68d727cfd4df25702b027b7aa31"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Set of callbacks that the library will call for <code>vkAllocateMemory</code> and <code>vkFreeMemory</code>. <ahref="#a5e2eb68d727cfd4df25702b027b7aa31">More...</a><br/></td></tr>
<trclass="memdesc:a4ddf381b6ce795bdfbc6c614640b9915"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Flags for created <aclass="el"href="struct_vma_allocator.html"title="Represents main object of this library initialized. ">VmaAllocator</a>. <ahref="#a4ddf381b6ce795bdfbc6c614640b9915">More...</a><br/></td></tr>
<trclass="memdesc:a97064a1a271b0061ebfc3a079862d0c5"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Pointers to some Vulkan functions - a subset used by the library. <ahref="#a97064a1a271b0061ebfc3a079862d0c5">More...</a><br/></td></tr>
<trclass="memdesc:ae0f6d1d733dded220d28134da46b4283"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Description of a Allocator to be created. <ahref="#ae0f6d1d733dded220d28134da46b4283">More...</a><br/></td></tr>
<trclass="memdesc:a810b009a788ee8aac72a25b42ffbe31c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Calculated statistics of memory usage in entire allocator. <ahref="#a810b009a788ee8aac72a25b42ffbe31c">More...</a><br/></td></tr>
<trclass="memdesc:a732be855fb4a7c248e6853d928a729af"><tdclass="mdescLeft"> </td><tdclass="mdescRight">General statistics from current state of Allocator. <ahref="#a732be855fb4a7c248e6853d928a729af">More...</a><br/></td></tr>
<trclass="memdesc:abf6bf6748c7a9fe7ce5b7835c0f56af4"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Flags to be passed as <aclass="el"href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b"title="Use VmaAllocationCreateFlagBits enum. ">VmaAllocationCreateInfo::flags</a>. <ahref="#abf6bf6748c7a9fe7ce5b7835c0f56af4">More...</a><br/></td></tr>
<trclass="memdesc:a8f93195158e0e2ac80ca352064e71c1f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Flags to be passed as <aclass="el"href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446"title="Use combination of VmaPoolCreateFlagBits. ">VmaPoolCreateInfo::flags</a>. <ahref="#a8f93195158e0e2ac80ca352064e71c1f">More...</a><br/></td></tr>
<trclass="memdesc:a211706e9348dcee25a843ed4ea69bce7"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Describes parameter of created <aclass="el"href="struct_vma_pool.html"title="Represents custom memory pool. ">VmaPool</a>. <ahref="#a211706e9348dcee25a843ed4ea69bce7">More...</a><br/></td></tr>
<trclass="memdesc:a2e5612d871d64c5624087b837a338c34"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Describes parameter of existing <aclass="el"href="struct_vma_pool.html"title="Represents custom memory pool. ">VmaPool</a>. <ahref="#a2e5612d871d64c5624087b837a338c34">More...</a><br/></td></tr>
<trclass="memdesc:a795e6ff02a21d5486c0565f403dd9255"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Parameters of <aclass="el"href="struct_vma_allocation.html"title="Represents single memory allocation. ">VmaAllocation</a> objects, that can be retrieved using function <aclass="el"href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b"title="Returns current information about specified allocation and atomically marks it as used in current fra...">vmaGetAllocationInfo()</a>. <ahref="#a795e6ff02a21d5486c0565f403dd9255">More...</a><br/></td></tr>
<trclass="memdesc:ae67f8573a0cf20f16f0a1eecbca566a0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Optional configuration parameters to be passed to function <aclass="el"href="vk__mem__alloc_8h.html#a6aced90fcc7b39882b6654a740a0b9bb"title="Compacts memory by moving allocations. ">vmaDefragment()</a>. <ahref="#ae67f8573a0cf20f16f0a1eecbca566a0">More...</a><br/></td></tr>
<trclass="memdesc:ab0f9b06441c840fee560de4a2967f8c9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Statistics returned by function <aclass="el"href="vk__mem__alloc_8h.html#a6aced90fcc7b39882b6654a740a0b9bb"title="Compacts memory by moving allocations. ">vmaDefragment()</a>. <ahref="#ab0f9b06441c840fee560de4a2967f8c9">More...</a><br/></td></tr>
}<trclass="memdesc:a4f87c9100d154a65a4ad495f7763cf7c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Flags for created <aclass="el"href="struct_vma_allocator.html"title="Represents main object of this library initialized. ">VmaAllocator</a>. <ahref="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c">More...</a><br/></td></tr>
}<trclass="memdesc:ad9889c10c798b040d59c92f257cae597"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Flags to be passed as <aclass="el"href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b"title="Use VmaAllocationCreateFlagBits enum. ">VmaAllocationCreateInfo::flags</a>. <ahref="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597">More...</a><br/></td></tr>
}<trclass="memdesc:a9a7c45f9c863695d98c83fa5ac940fe7"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Flags to be passed as <aclass="el"href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446"title="Use combination of VmaPoolCreateFlagBits. ">VmaPoolCreateInfo::flags</a>. <ahref="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7">More...</a><br/></td></tr>
<trclass="memdesc:a8701444752eb5de4464adb5a2b514bca"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Given Memory Type Index, returns Property Flags of this memory type. <ahref="#a8701444752eb5de4464adb5a2b514bca">More...</a><br/></td></tr>
<trclass="memdesc:ade56bf8dc9f5a5eaddf5f119ed525236"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets index of the current frame. <ahref="#ade56bf8dc9f5a5eaddf5f119ed525236">More...</a><br/></td></tr>
<trclass="memdesc:a333b61c1788cb23559177531e6a93ca3"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves statistics from current state of the Allocator. <ahref="#a333b61c1788cb23559177531e6a93ca3">More...</a><br/></td></tr>
<trclass="memdesc:aa4fee7eb5253377599ef4fd38c93c2a0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Builds and returns statistics as string in JSON format. <ahref="#aa4fee7eb5253377599ef4fd38c93c2a0">More...</a><br/></td></tr>
<trclass="memdesc:aef15a94b58fbcb0fe706d5720e84a74a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Helps to find memoryTypeIndex, given memoryTypeBits and <aclass="el"href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>. <ahref="#aef15a94b58fbcb0fe706d5720e84a74a">More...</a><br/></td></tr>
<trclass="memdesc:ae790ab9ffaf7667fb8f62523e6897888"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Helps to find memoryTypeIndex, given VkBufferCreateInfo and <aclass="el"href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>. <ahref="#ae790ab9ffaf7667fb8f62523e6897888">More...</a><br/></td></tr>
<trclass="memdesc:a088da83d8eaf3ce9056d9ea0b981d472"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Helps to find memoryTypeIndex, given VkImageCreateInfo and <aclass="el"href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>. <ahref="#a088da83d8eaf3ce9056d9ea0b981d472">More...</a><br/></td></tr>
<trclass="memdesc:a736bd6cbda886f36c891727e73bd4024"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Marks all allocations in given pool as lost if they are not used in current frame or <aclass="el"href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa"title="Maximum number of additional frames that are in use at the same time as current frame. ">VmaPoolCreateInfo::frameInUseCount</a> back from now. <ahref="#a736bd6cbda886f36c891727e73bd4024">More...</a><br/></td></tr>
<trclass="memdesc:a0faa3f9e5fb233d29d1e00390650febb"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Function similar to <aclass="el"href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer()</a>. <ahref="#a0faa3f9e5fb233d29d1e00390650febb">More...</a><br/></td></tr>
<trclass="memdesc:a11f0fbc034fa81a4efedd73d61ce7568"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Frees memory previously allocated using <aclass="el"href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8"title="General purpose memory allocation. ">vmaAllocateMemory()</a>, <aclass="el"href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer()</a>, or <aclass="el"href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb"title="Function similar to vmaAllocateMemoryForBuffer(). ">vmaAllocateMemoryForImage()</a>. <ahref="#a11f0fbc034fa81a4efedd73d61ce7568">More...</a><br/></td></tr>
<trclass="memdesc:a86dd08aba8633bfa4ad0df2e76481d8b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns current information about specified allocation and atomically marks it as used in current frame. <ahref="#a86dd08aba8633bfa4ad0df2e76481d8b">More...</a><br/></td></tr>
<trclass="memdesc:a43d8ba9673c846f049089a5029d5c73a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns <code>VK_TRUE</code> if allocation is not lost and atomically marks it as used in current frame. <ahref="#a43d8ba9673c846f049089a5029d5c73a">More...</a><br/></td></tr>
<trclass="memdesc:af9147d31ffc11d62fc187bde283ed14f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets pUserData in given allocation to new value. <ahref="#af9147d31ffc11d62fc187bde283ed14f">More...</a><br/></td></tr>
<trclass="memdesc:ae5c9657d9e94756269145b01c05d16f1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates new allocation that is in lost state from the beginning. <ahref="#ae5c9657d9e94756269145b01c05d16f1">More...</a><br/></td></tr>
<trclass="memdesc:ad5bd1243512d099706de88168992f069"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Maps memory represented by given allocation and returns pointer to it. <ahref="#ad5bd1243512d099706de88168992f069">More...</a><br/></td></tr>
<trclass="memdesc:a9bc268595cb33f6ec4d519cfce81ff45"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Unmaps memory represented by given allocation, mapped previously using <aclass="el"href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069"title="Maps memory represented by given allocation and returns pointer to it. ">vmaMapMemory()</a>. <ahref="#a9bc268595cb33f6ec4d519cfce81ff45">More...</a><br/></td></tr>
<trclass="memdesc:a6b0929b914b60cf2d45cac4bf3547470"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Binds buffer to allocation. <ahref="#a6b0929b914b60cf2d45cac4bf3547470">More...</a><br/></td></tr>
<trclass="memdesc:a3d3ca45799923aa5d138e9e5f9eb2da5"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Binds image to allocation. <ahref="#a3d3ca45799923aa5d138e9e5f9eb2da5">More...</a><br/></td></tr>
<trclass="memdesc:a02a94f25679275851a53e82eacbcfc73"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Function similar to <aclass="el"href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer()</a>. <ahref="#a02a94f25679275851a53e82eacbcfc73">More...</a><br/></td></tr>
<p>Flags to be passed as <aclass="el"href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b"title="Use VmaAllocationCreateFlagBits enum. ">VmaAllocationCreateInfo::flags</a>. </p>
<p>Parameters of <aclass="el"href="struct_vma_allocation.html"title="Represents single memory allocation. ">VmaAllocation</a> objects, that can be retrieved using function <aclass="el"href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b"title="Returns current information about specified allocation and atomically marks it as used in current fra...">vmaGetAllocationInfo()</a>. </p>
<p>Optional configuration parameters to be passed to function <aclass="el"href="vk__mem__alloc_8h.html#a6aced90fcc7b39882b6654a740a0b9bb"title="Compacts memory by moving allocations. ">vmaDefragment()</a>. </p>
<p>Statistics returned by function <aclass="el"href="vk__mem__alloc_8h.html#a6aced90fcc7b39882b6654a740a0b9bb"title="Compacts memory by moving allocations. ">vmaDefragment()</a>. </p>
<p>Used in <aclass="el"href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e"title="Informative callbacks for vkAllocateMemory, vkFreeMemory. Optional. ">VmaAllocatorCreateInfo::pDeviceMemoryCallbacks</a>. </p>
<p>Flags to be passed as <aclass="el"href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446"title="Use combination of VmaPoolCreateFlagBits. ">VmaPoolCreateInfo::flags</a>. </p>
<p>Pointers to some Vulkan functions - a subset used by the library. </p>
<p>Used in <aclass="el"href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd"title="Pointers to Vulkan functions. Can be null if you leave define VMA_STATIC_VULKAN_FUNCTIONS 1...">VmaAllocatorCreateInfo::pVulkanFunctions</a>. </p>
</div>
</div>
<h2class="groupheader">Enumeration Type Documentation</h2>
<p>Flags to be passed as <aclass="el"href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b"title="Use VmaAllocationCreateFlagBits enum. ">VmaAllocationCreateInfo::flags</a>. </p>
<tableclass="fieldtable">
<tr><thcolspan="2">Enumerator</th></tr><tr><tdclass="fieldname"><aid="ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f"></a>VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT </td><tdclass="fielddoc"><p>Set this flag if the allocation should have its own memory block. </p>
<p>Use it for special, big resources, like fullscreen images used as attachments.</p>
<p>This flag must also be used for host visible resources that you want to map simultaneously because otherwise they might end up as regions of the same <code>VkDeviceMemory</code>, while mapping same <code>VkDeviceMemory</code> multiple times simultaneously is illegal.</p>
<p>You should not use this flag if <aclass="el"href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150"title="Pool that this allocation should be created in. ">VmaAllocationCreateInfo::pool</a> is not null. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff"></a>VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT </td><tdclass="fielddoc"><p>Set this flag to only try to allocate from existing <code>VkDeviceMemory</code> blocks and never create new such block. </p>
<p>If new allocation cannot be placed in any of the existing blocks, allocation fails with <code>VK_ERROR_OUT_OF_DEVICE_MEMORY</code> error.</p>
<p>You should not use <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f"title="Set this flag if the allocation should have its own memory block. ">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a> and <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff"title="Set this flag to only try to allocate from existing VkDeviceMemory blocks and never create new such b...">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a> at the same time. It makes no sense.</p>
<p>If <aclass="el"href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150"title="Pool that this allocation should be created in. ">VmaAllocationCreateInfo::pool</a> is not null, this flag is implied and ignored. </p>
<tr><tdclass="fieldname"><aid="ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"></a>VMA_ALLOCATION_CREATE_MAPPED_BIT </td><tdclass="fielddoc"><p>Set this flag to use a memory that will be persistently mapped and retrieve pointer to it. </p>
<p>Pointer to mapped memory will be returned through <aclass="el"href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2"title="Pointer to the beginning of this allocation as mapped data. ">VmaAllocationInfo::pMappedData</a>.</p>
<p>Is it valid to use this flag for allocation made from memory type that is not <code>HOST_VISIBLE</code>. 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 (<code>DEVICE_LOCAL</code>) and still want to map it directly if possible on platforms that support it (e.g. Intel GPU).</p>
<p>You should not use this flag together with <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a>. </p>
<tr><tdclass="fieldname"><aid="ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2"></a>VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT </td><tdclass="fielddoc"><p>Allocation created with this flag can become lost as a result of another allocation with <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a> flag, so you must check it before use.</p>
<p>To check if allocation is not lost, call <aclass="el"href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b"title="Returns current information about specified allocation and atomically marks it as used in current fra...">vmaGetAllocationInfo()</a> and check if <aclass="el"href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67"title="Handle to Vulkan memory object. ">VmaAllocationInfo::deviceMemory</a> is not <code>VK_NULL_HANDLE</code>.</p>
<p>You should not use this flag together with <aclass="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>. </p>
<tr><tdclass="fieldname"><aid="ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e"></a>VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT </td><tdclass="fielddoc"><p>While creating allocation using this flag, other allocations that were created with flag <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a> can become lost.</p>
<tr><tdclass="fieldname"><aid="ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520"></a>VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT </td><tdclass="fielddoc"><p>Set this flag to treat <aclass="el"href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19"title="Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...">VmaAllocationCreateInfo::pUserData</a> 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 <code>pUserData</code>. The string is automatically freed together with the allocation. It is also used in <aclass="el"href="vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0"title="Builds and returns statistics as string in JSON format. ">vmaBuildStatsString()</a>. </p>
<tr><thcolspan="2">Enumerator</th></tr><tr><tdclass="fieldname"><aid="a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d"></a>VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT </td><tdclass="fielddoc"><p>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. </p>
<p>Using this flag may increase performance because internal mutexes are not used. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878"></a>VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT </td><tdclass="fielddoc"><p>Enables usage of VK_KHR_dedicated_allocation extension. </p>
<p>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 <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f"title="Set this flag if the allocation should have its own memory block. ">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a> flag) when it is recommended by the driver. It may improve performance on some GPUs.</p>
<p>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 <aclass="el"href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500"title="Vulkan device. ">VmaAllocatorCreateInfo::device</a>, and you want them to be used internally by this library:</p>
<ul>
<li>VK_KHR_get_memory_requirements2</li>
<li>VK_KHR_dedicated_allocation</li>
</ul>
<p>When this flag is set, you can experience following warnings reported by Vulkan validation layer. You can ignore them.</p>
<blockquoteclass="doxtable">
<p>vkBindBufferMemory(): Binding memory to buffer 0x2d but vkGetBufferMemoryRequirements() has not been called on that buffer.</p>
<tr><thcolspan="2">Enumerator</th></tr><tr><tdclass="fieldname"><aid="aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd"></a>VMA_MEMORY_USAGE_UNKNOWN </td><tdclass="fielddoc"><p>No intended memory usage specified. Use other members of <aclass="el"href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> to specify your requirements. </p>
<tr><tdclass="fieldname"><aid="aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"></a>VMA_MEMORY_USAGE_GPU_ONLY </td><tdclass="fielddoc"><p>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 <code>D3D12_HEAP_TYPE_DEFAULT</code>.</p>
<li>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.</li>
<p>Allocation may still end up in <code>HOST_VISIBLE</code> memory on some implementations. In such case, you are free to map it. You can use <aclass="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> with this usage type. </p>
<tr><tdclass="fieldname"><aid="aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5"></a>VMA_MEMORY_USAGE_CPU_ONLY </td><tdclass="fielddoc"><p>Memory will be mappable on host. It usually means CPU (system) memory. Guarantees to be <code>HOST_VISIBLE</code> and <code>HOST_COHERENT</code>. 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 <code>D3D12_HEAP_TYPE_UPLOAD</code>.</p>
<tr><tdclass="fieldname"><aid="aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67"></a>VMA_MEMORY_USAGE_CPU_TO_GPU </td><tdclass="fielddoc"><p>Memory that is both mappable on host (guarantees to be <code>HOST_VISIBLE</code>) and preferably fast to access by GPU. CPU access is typically uncached. Writes may be write-combined.</p>
<p>Usage: Resources written frequently by host (dynamic), read by device. E.g. textures, vertex buffers, uniform buffers updated every frame or every draw call. </p>
<tr><tdclass="fieldname"><aid="aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27"></a>VMA_MEMORY_USAGE_GPU_TO_CPU </td><tdclass="fielddoc"><p>Memory mappable on host (guarantees to be <code>HOST_VISIBLE</code>) and cached. It is roughly equivalent of <code>D3D12_HEAP_TYPE_READBACK</code>.</p>
<li>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. </li>
<p>Flags to be passed as <aclass="el"href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446"title="Use combination of VmaPoolCreateFlagBits. ">VmaPoolCreateInfo::flags</a>. </p>
<tr><thcolspan="2">Enumerator</th></tr><tr><tdclass="fieldname"><aid="a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2"></a>VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT </td><tdclass="fielddoc"><p>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. </p>
<p>If you always allocate using <aclass="el"href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer()</a>, <aclass="el"href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73"title="Function similar to vmaCreateBuffer(). ">vmaCreateImage()</a>, <aclass="el"href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer()</a>, 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.</p>
<p>If you also allocate using <aclass="el"href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb"title="Function similar to vmaAllocateMemoryForBuffer(). ">vmaAllocateMemoryForImage()</a> or <aclass="el"href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8"title="General purpose memory allocation. ">vmaAllocateMemory()</a>, 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 more optimal. </p>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">pAllocationInfo</td><td>Optional. Information about allocated memory. It can be later fetched using function <aclass="el"href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b"title="Returns current information about specified allocation and atomically marks it as used in current fra...">vmaGetAllocationInfo()</a>.</td></tr>
<p>You should free the memory using <aclass="el"href="vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568"title="Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(), or vmaAllocateMemoryForImage(). ">vmaFreeMemory()</a>.</p>
<p>It is recommended to use <aclass="el"href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer()</a>, <aclass="el"href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb"title="Function similar to vmaAllocateMemoryForBuffer(). ">vmaAllocateMemoryForImage()</a>, <aclass="el"href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer()</a>, <aclass="el"href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73"title="Function similar to vmaCreateBuffer(). ">vmaCreateImage()</a> instead whenever possible. </p>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">pAllocationInfo</td><td>Optional. Information about allocated memory. It can be later fetched using function <aclass="el"href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b"title="Returns current information about specified allocation and atomically marks it as used in current fra...">vmaGetAllocationInfo()</a>.</td></tr>
<p>You should free the memory using <aclass="el"href="vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568"title="Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(), or vmaAllocateMemoryForImage(). ">vmaFreeMemory()</a>. </p>
<p>Binds specified buffer to region of memory represented by specified allocation. Gets <code>VkDeviceMemory</code> 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 <code>vkBindBufferMemory()</code>, because it ensures proper synchronization so that when a <code>VkDeviceMemory</code> object is used by multiple allocations, calls to <code>vkBind*Memory()</code> or <code>vkMapMemory()</code> won't happen from multiple threads simultaneously (which is illegal in Vulkan).</p>
<p>It is recommended to use function <aclass="el"href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer()</a> instead of this one. </p>
<p>Binds specified image to region of memory represented by specified allocation. Gets <code>VkDeviceMemory</code> 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 <code>vkBindImageMemory()</code>, because it ensures proper synchronization so that when a <code>VkDeviceMemory</code> object is used by multiple allocations, calls to <code>vkBind*Memory()</code> or <code>vkMapMemory()</code> won't happen from multiple threads simultaneously (which is illegal in Vulkan).</p>
<p>It is recommended to use function <aclass="el"href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73"title="Function similar to vmaCreateBuffer(). ">vmaCreateImage()</a> instead of this one. </p>
<p>Builds and returns statistics as string in JSON format. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">ppStatsString</td><td>Must be freed using <aclass="el"href="vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288">vmaFreeStatsString()</a> function. </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">pAllocationInfo</td><td>Optional. Information about allocated memory. It can be later fetched using function <aclass="el"href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b"title="Returns current information about specified allocation and atomically marks it as used in current fra...">vmaGetAllocationInfo()</a>.</td></tr>
<p>If any of these operations fail, buffer and allocation are not created, returned value is negative error code, *pBuffer and *pAllocation are null.</p>
<p>If the function succeeded, you must destroy both buffer and allocation when you no longer need them using either convenience function <aclass="el"href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77"title="Destroys Vulkan buffer and frees allocated memory. ">vmaDestroyBuffer()</a> or separately, using <code>vkDestroyBuffer()</code> and <aclass="el"href="vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568"title="Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(), or vmaAllocateMemoryForImage(). ">vmaFreeMemory()</a>.</p>
<p>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 (<aclass="el"href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150"title="Pool that this allocation should be created in. ">VmaAllocationCreateInfo::pool</a> 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. </p>
<p>Creates new allocation that is in lost state from the beginning. </p>
<p>It can be useful if you need a dummy, non-null allocation.</p>
<p>You still need to destroy created object using <aclass="el"href="vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568"title="Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(), or vmaAllocateMemoryForImage(). ">vmaFreeMemory()</a>.</p>
<p>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. </p>
<tr><tdclass="paramdir"></td><tdclass="paramname">pAllocations</td><td>Array of allocations that can be moved during this compation. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">allocationCount</td><td>Number of elements in pAllocations and pAllocationsChanged arrays. </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">pAllocationsChanged</td><td>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. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">pDefragmentationInfo</td><td>Configuration parameters. Optional - pass null to use default values. </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">pDefragmentationStats</td><td>Statistics returned by the function. Optional - pass null if you don't need this information. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>VK_SUCCESS if completed, VK_INCOMPLETE if succeeded but didn't make all possible optimizations because limits specified in pDefragmentationInfo have been reached, negative error code in case of error.</dd></dl>
<p>This function works by moving allocations to different places (different <code>VkDeviceMemory</code> 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:</p>
<ul>
<li>Only allocations made in memory types that have <code>VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT</code> flag can be compacted. You may pass other allocations but it makes no sense - these will never be moved.</li>
<li>You may pass allocations made with <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f"title="Set this flag if the allocation should have its own memory block. ">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a> but it makes no sense - they will never be moved.</li>
<li>Both allocations made with or without <aclass="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 can be compacted. If not persistently mapped, memory will be mapped temporarily inside this function if needed.</li>
<li>You must not pass same <aclass="el"href="struct_vma_allocation.html"title="Represents single memory allocation. ">VmaAllocation</a> object multiple times in pAllocations array.</li>
<p>After allocation has been moved, its <aclass="el"href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67"title="Handle to Vulkan memory object. ">VmaAllocationInfo::deviceMemory</a> and/or <aclass="el"href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268"title="Offset into deviceMemory object to the beginning of this allocation, in bytes. (deviceMemory, offset) pair is unique to this allocation. ">VmaAllocationInfo::offset</a> changes. You must query them again using <aclass="el"href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b"title="Returns current information about specified allocation and atomically marks it as used in current fra...">vmaGetAllocationInfo()</a> if you need them.</p>
<p>If an allocation has been moved, data in memory is copied to new place automatically, but if it was bound to a buffer or an image, you must destroy that object yourself, create new one and bind it to the new memory pointed by the allocation. You must use <code>vkDestroyBuffer()</code>, <code>vkDestroyImage()</code>, <code>vkCreateBuffer()</code>, <code>vkCreateImage()</code> for that purpose and NOT <aclass="el"href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77"title="Destroys Vulkan buffer and frees allocated memory. ">vmaDestroyBuffer()</a>, <aclass="el"href="vk__mem__alloc_8h.html#ae50d2cb3b4a3bfd4dd40987234e50e7e"title="Destroys Vulkan image and frees allocated memory. ">vmaDestroyImage()</a>, <aclass="el"href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer()</a>, <aclass="el"href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73"title="Function similar to vmaCreateBuffer(). ">vmaCreateImage()</a>! Example:</p>
<divclass="fragment"><divclass="line">VkDevice device = ...;</div><divclass="line"><aclass="code"href="struct_vma_allocator.html">VmaAllocator</a> allocator = ...;</div><divclass="line">std::vector<VkBuffer> buffers = ...;</div><divclass="line">std::vector<VmaAllocation> allocations = ...;</div><divclass="line"></div><divclass="line">std::vector<VkBool32> allocationsChanged(allocations.size());</div><divclass="line"><aclass="code"href="vk__mem__alloc_8h.html#a6aced90fcc7b39882b6654a740a0b9bb">vmaDefragment</a>(allocator, allocations.data(), allocations.size(), allocationsChanged.data(), <spanclass="keyword">nullptr</span>, <spanclass="keyword">nullptr</span>);</div><divclass="line"></div><divclass="line"><spanclass="keywordflow">for</span>(<spanclass="keywordtype">size_t</span> i = 0; i < allocations.size(); ++i)</div><divclass="line">{</div><divclass="line"><spanclass="keywordflow">if</span>(allocationsChanged[i])</div><divclass="line"> {</div><divclass="line"><aclass="code"href="struct_vma_allocation_info.html">VmaAllocationInfo</a> allocInfo;</div><divclass="line"><aclass="code"href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a>(allocator, allocations[i], &allocInfo);</div><divclass="line"></div><divclass="line"> vkDestroyBuffer(device, buffers[i], <spanclass="keyword">nullptr</span>);</div><divclass="line"></div><divclass="line"> VkBufferCreateInfo bufferInfo = ...;</div><divclass="line"> vkCreateBuffer(device, &bufferInfo, <spanclass="keyword">nullptr</span>, &buffers[i]);</div><divclass="line"></div><divclass="line"><spanclass="comment">// You can make dummy call to vkGetBufferMemoryRequirements here to silence validation layer warning.</span></div><divclass="line"></div><divclass="line"> vkBindBufferMemory(device, buffers[i], allocInfo.<aclass="code"href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">deviceMemory</a>, allocInfo.<aclass="code"href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">offset</a>);</div><divclass="line"> }</div><divclass="line">}</div></div><!-- fragment --><p>Note: Please don't expect memory to be fully compacted after this call. 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 data that needs to be moved. Some fragmentation still remains after this call. This is normal.</p>
<p>Warning: This function is not 100% correct according to Vulkan specification. Use it at your own risk. That's because Vulkan doesn't guarantee that memory requirements (size and alignment) for a new buffer or image are consistent. They may be different even for subsequent calls with the same parameters. It really does happen on some platforms, especially with images.</p>
<p>Warning: This function may be time-consuming, so you shouldn't call it too often (like every frame or 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). </p>
<divclass="fragment"><divclass="line">vkDestroyBuffer(device, buffer, allocationCallbacks);</div><divclass="line"><aclass="code"href="vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568">vmaFreeMemory</a>(allocator, allocation);</div></div><!-- fragment --><p>It it safe to pass null as buffer and/or allocation. </p>
<divclass="fragment"><divclass="line">vkDestroyImage(device, image, allocationCallbacks);</div><divclass="line"><aclass="code"href="vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568">vmaFreeMemory</a>(allocator, allocation);</div></div><!-- fragment --><p>It it safe to pass null as image and/or allocation. </p>
<p>This algorithm tries to find a memory type that:</p>
<ul>
<li>Is allowed by memoryTypeBits.</li>
<li>Contains all the flags from pAllocationCreateInfo->requiredFlags.</li>
<li>Matches intended usage.</li>
<li>Has as many flags from pAllocationCreateInfo->preferredFlags as possible.</li>
</ul>
<dlclass="section return"><dt>Returns</dt><dd>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. </dd></dl>
<p>Helps to find memoryTypeIndex, given VkBufferCreateInfo and <aclass="el"href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>. </p>
<p>It can be useful e.g. to determine value to be used as <aclass="el"href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319"title="Vulkan memory type index to allocate this pool from. ">VmaPoolCreateInfo::memoryTypeIndex</a>. It internally creates a temporary, dummy buffer that never has memory bound. It is just a convenience function, equivalent to calling:</p>
<p>Helps to find memoryTypeIndex, given VkImageCreateInfo and <aclass="el"href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>. </p>
<p>It can be useful e.g. to determine value to be used as <aclass="el"href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319"title="Vulkan memory type index to allocate this pool from. ">VmaPoolCreateInfo::memoryTypeIndex</a>. It internally creates a temporary, dummy image that never has memory bound. It is just a convenience function, equivalent to calling:</p>
<p>Frees memory previously allocated using <aclass="el"href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8"title="General purpose memory allocation. ">vmaAllocateMemory()</a>, <aclass="el"href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer()</a>, or <aclass="el"href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb"title="Function similar to vmaAllocateMemoryForBuffer(). ">vmaAllocateMemoryForImage()</a>. </p>
<p>Returns current information about specified allocation and atomically marks it as used in current frame. </p>
<p>Current paramters of given allocation are returned in <code>pAllocationInfo</code>.</p>
<p>This function also atomically "touches" allocation - marks it as used in current frame, just like <aclass="el"href="vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a"title="Returns VK_TRUE if allocation is not lost and atomically marks it as used in current frame...">vmaTouchAllocation()</a>. If the allocation is in lost state, <code>pAllocationInfo->deviceMemory == VK_NULL_HANDLE</code>.</p>
<p>Although this function uses atomics and doesn't lock any mutex, so it should be quite efficient, you can avoid calling it too often.</p>
<ul>
<li>You can retrieve same <aclass="el"href="struct_vma_allocation_info.html"title="Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo(). ">VmaAllocationInfo</a> structure while creating your resource, from function <aclass="el"href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer()</a>, <aclass="el"href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73"title="Function similar to vmaCreateBuffer(). ">vmaCreateImage()</a>. You can remember it if you are sure parameters don't change (e.g. due to defragmentation or allocation becoming lost).</li>
<li>If you just want to check if allocation is not lost, <aclass="el"href="vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a"title="Returns VK_TRUE if allocation is not lost and atomically marks it as used in current frame...">vmaTouchAllocation()</a> will work faster. </li>
<p>PhysicalDeviceMemoryProperties are fetched from physicalDevice by the allocator. You can access it here, without fetching it again on your own. </p>
<p>Given Memory Type Index, returns Property Flags of this memory type. </p>
<p>This is just a convenience function. Same information can be obtained using <aclass="el"href="vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19">vmaGetMemoryProperties()</a>. </p>
<p>Marks all allocations in given pool as lost if they are not used in current frame or <aclass="el"href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa"title="Maximum number of additional frames that are in use at the same time as current frame. ">VmaPoolCreateInfo::frameInUseCount</a> back from now. </p>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">pLostAllocationCount</td><td>Number of allocations marked as lost. Optional - pass null if you don't need this information. </td></tr>
<p>Maps memory represented by given allocation and returns pointer to it. </p>
<p>Maps memory represented by given allocation to make it accessible to CPU code. When succeeded, <code>*ppData</code> contains pointer to first byte of this memory. If the allocation is part of bigger <code>VkDeviceMemory</code> block, the pointer is correctly offseted to the beginning of region assigned to this particular allocation.</p>
<p>Mapping is internally reference-counted and synchronized, so despite raw Vulkan function <code>vkMapMemory()</code> cannot be used to map same block of <code>VkDeviceMemory</code> 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.</p>
<p>If the function succeeded, you must call <aclass="el"href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45"title="Unmaps memory represented by given allocation, mapped previously using vmaMapMemory(). ">vmaUnmapMemory()</a> to unmap the allocation when mapping is no longer needed or before freeing the allocation, at the latest.</p>
<p>It also safe to call this function multiple times on the same allocation. You must call <aclass="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 <aclass="el"href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069"title="Maps memory represented by given allocation and returns pointer to it. ">vmaMapMemory()</a>.</p>
<p>It is also safe to call this function on allocation created with <aclass="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 <aclass="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 <aclass="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 <aclass="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 <aclass="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 always fails when called for allocation that was created with <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a> flag. Such allocations cannot be mapped. </p>
<p>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 <code>pUserData</code>. 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.</p>
<p>If the flag was not used, the value of pointer <code>pUserData</code> is just copied to allocation's <code>pUserData</code>. 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. </p>
<p>This function must be used if you make allocations with <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a> and <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a> flags to inform the allocator when a new frame begins. Allocations queried using <aclass="el"href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b"title="Returns current information about specified allocation and atomically marks it as used in current fra...">vmaGetAllocationInfo()</a> cannot become lost in the current frame. </p>
<p>Returns <code>VK_TRUE</code> if allocation is not lost and atomically marks it as used in current frame. </p>
<p>If the allocation has been created with <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a> flag, this function returns <code>VK_TRUE</code> 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 <code>frameInUseCount</code> frames.</p>
<p>If the allocation is in lost state, the function returns <code>VK_FALSE</code>. 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.</p>
<p>If the allocation has been created without <aclass="el"href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a> flag, this function always returns <code>VK_TRUE</code>. </p>
<p>Unmaps memory represented by given allocation, mapped previously using <aclass="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 <aclass="el"href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069"title="Maps memory represented by given allocation and returns pointer to it. ">vmaMapMemory()</a>. </p>