Refactored virtual allocator. (COMPATIBILITY BREAKING!) Added TLSF algoritym.

Refactored virtual allocator: Added type VmaVirtualAllocation, member VmaVirtualAllocationInfo::offset, changed parameters of vmaVirtualAllocate, vmaVirtualFree, vmaSetVirtualAllocationUserData, vmaGetVirtualAllocationInfo.

Added TLSF algorithm: Added VMA_POOL_CREATE_TLSF_ALGORITHM_BIT, VMA_VIRTUAL_BLOCK_CREATE_TLSF_ALGORITHM_BIT.

Some internal refactoring.

Improved documentation: Grouped API elements into Doxygen modules.

Code mostly by @medranSolus.
This commit is contained in:
Adam Sawicki 2022-01-20 17:00:33 +01:00
parent c5870ad3c2
commit d3a85f0dc3
89 changed files with 7653 additions and 5225 deletions

View file

@ -65,7 +65,7 @@ $(function() {
<div class="summary">
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="struct_vma_allocation_create_info-members.html">List of all members</a> </div>
<div class="headertitle"><div class="title">VmaAllocationCreateInfo Struct Reference</div></div>
<div class="headertitle"><div class="title">VmaAllocationCreateInfo Struct Reference<div class="ingroups"><a class="el" href="group__group__alloc.html">Memory allocation</a></div></div></div>
</div><!--header-->
<div class="contents">
@ -73,10 +73,10 @@ $(function() {
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-attribs" name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:add09658ac14fe290ace25470ddd6d41b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a></td></tr>
<tr class="memdesc:add09658ac14fe290ace25470ddd6d41b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Use <a class="el" href="vk__mem__alloc_8h.html#a4fceecc301f4064dc808d3cd6c038941" title="Flags to be passed as VmaAllocationCreateInfo::flags.">VmaAllocationCreateFlagBits</a> enum. <a href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">More...</a><br /></td></tr>
<tr class="memitem:add09658ac14fe290ace25470ddd6d41b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__alloc.html#ga5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a></td></tr>
<tr class="memdesc:add09658ac14fe290ace25470ddd6d41b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Use <a class="el" href="group__group__alloc.html#ga4fceecc301f4064dc808d3cd6c038941" title="Flags to be passed as VmaAllocationCreateInfo::flags.">VmaAllocationCreateFlagBits</a> enum. <a href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">More...</a><br /></td></tr>
<tr class="separator:add09658ac14fe290ace25470ddd6d41b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:accb8b06b1f677d858cb9af20705fa910"><td class="memItemLeft" align="right" valign="top"><a class="el" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a></td></tr>
<tr class="memitem:accb8b06b1f677d858cb9af20705fa910"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__alloc.html#gaa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a></td></tr>
<tr class="memdesc:accb8b06b1f677d858cb9af20705fa910"><td class="mdescLeft">&#160;</td><td class="mdescRight">Intended usage of memory. <a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">More...</a><br /></td></tr>
<tr class="separator:accb8b06b1f677d858cb9af20705fa910"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9166390303ff42d783305bc31c2b6b90"><td class="memItemLeft" align="right" valign="top">VkMemoryPropertyFlags&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a></td></tr>
@ -92,7 +92,7 @@ Public Attributes</h2></td></tr>
<tr class="memdesc:a6272c0555cfd1fe28bff1afeb6190150"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pool that this allocation should be created in. <a href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">More...</a><br /></td></tr>
<tr class="separator:a6272c0555cfd1fe28bff1afeb6190150"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8259e85c272683434f4abb4ddddffe19"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a></td></tr>
<tr class="memdesc:a8259e85c272683434f4abb4ddddffe19"><td class="mdescLeft">&#160;</td><td class="mdescRight">Custom general-purpose pointer that will be stored in <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a>, can be read as <a class="el" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13" title="Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...">VmaAllocationInfo::pUserData</a> and changed using <a class="el" href="vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f" title="Sets pUserData in given allocation to new value.">vmaSetAllocationUserData()</a>. <a href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">More...</a><br /></td></tr>
<tr class="memdesc:a8259e85c272683434f4abb4ddddffe19"><td class="mdescLeft">&#160;</td><td class="mdescRight">Custom general-purpose pointer that will be stored in <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a>, can be read as <a class="el" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13" title="Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...">VmaAllocationInfo::pUserData</a> and changed using <a class="el" href="group__group__alloc.html#gaf9147d31ffc11d62fc187bde283ed14f" title="Sets pUserData in given allocation to new value.">vmaSetAllocationUserData()</a>. <a href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">More...</a><br /></td></tr>
<tr class="separator:a8259e85c272683434f4abb4ddddffe19"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a983d39e1a2e63649d78a960aa2fdd0f7"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_allocation_create_info.html#a983d39e1a2e63649d78a960aa2fdd0f7">priority</a></td></tr>
<tr class="memdesc:a983d39e1a2e63649d78a960aa2fdd0f7"><td class="mdescLeft">&#160;</td><td class="mdescRight">A floating-point value between 0 and 1, indicating the priority of the allocation relative to other memory allocations. <a href="struct_vma_allocation_create_info.html#a983d39e1a2e63649d78a960aa2fdd0f7">More...</a><br /></td></tr>
@ -106,12 +106,12 @@ Public Attributes</h2></td></tr>
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> VmaAllocationCreateInfo::flags</td>
<td class="memname"><a class="el" href="group__group__alloc.html#ga5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> VmaAllocationCreateInfo::flags</td>
</tr>
</table>
</div><div class="memdoc">
<p>Use <a class="el" href="vk__mem__alloc_8h.html#a4fceecc301f4064dc808d3cd6c038941" title="Flags to be passed as VmaAllocationCreateInfo::flags.">VmaAllocationCreateFlagBits</a> enum. </p>
<p>Use <a class="el" href="group__group__alloc.html#ga4fceecc301f4064dc808d3cd6c038941" title="Flags to be passed as VmaAllocationCreateInfo::flags.">VmaAllocationCreateFlagBits</a> enum. </p>
</div>
</div>
@ -181,7 +181,7 @@ If <code>pool</code> is not null, this member is ignored. </p>
</div><div class="memdoc">
<p>A floating-point value between 0 and 1, indicating the priority of the allocation relative to other memory allocations. </p>
<p >It is used only when <a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7caffdd7a5169be3dbd7cbf6b3619e4f78a">VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT</a> flag was used during creation of the <a class="el" href="struct_vma_allocator.html" title="Represents main object of this library initialized.">VmaAllocator</a> object and this allocation ends up as dedicated or is explicitly forced as dedicated using <a class="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>. Otherwise, it has the priority of a memory block where it is placed and this variable is ignored. </p>
<p >It is used only when <a class="el" href="group__group__init.html#gga4f87c9100d154a65a4ad495f7763cf7caffdd7a5169be3dbd7cbf6b3619e4f78a">VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT</a> flag was used during creation of the <a class="el" href="struct_vma_allocator.html" title="Represents main object of this library initialized.">VmaAllocator</a> object and this allocation ends up as dedicated or is explicitly forced as dedicated using <a class="el" href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f" title="Set this flag if the allocation should have its own memory block.">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>. Otherwise, it has the priority of a memory block where it is placed and this variable is ignored. </p>
</div>
</div>
@ -197,8 +197,8 @@ If <code>pool</code> is not null, this member is ignored. </p>
</table>
</div><div class="memdoc">
<p>Custom general-purpose pointer that will be stored in <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a>, can be read as <a class="el" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13" title="Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...">VmaAllocationInfo::pUserData</a> and changed using <a class="el" href="vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f" title="Sets pUserData in given allocation to new value.">vmaSetAllocationUserData()</a>. </p>
<p >If <a class="el" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a> 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. </p>
<p>Custom general-purpose pointer that will be stored in <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a>, can be read as <a class="el" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13" title="Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...">VmaAllocationInfo::pUserData</a> and changed using <a class="el" href="group__group__alloc.html#gaf9147d31ffc11d62fc187bde283ed14f" title="Sets pUserData in given allocation to new value.">vmaSetAllocationUserData()</a>. </p>
<p >If <a class="el" href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a> 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. </p>
</div>
</div>
@ -227,13 +227,13 @@ If <code>pool</code> is not null, this member is ignored. </p>
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a> VmaAllocationCreateInfo::usage</td>
<td class="memname"><a class="el" href="group__group__alloc.html#gaa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a> VmaAllocationCreateInfo::usage</td>
</tr>
</table>
</div><div class="memdoc">
<p>Intended usage of memory. </p>
<p >You can leave <a class="el" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd">VMA_MEMORY_USAGE_UNKNOWN</a> if you specify memory requirements in other way. <br />
<p >You can leave <a class="el" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd">VMA_MEMORY_USAGE_UNKNOWN</a> if you specify memory requirements in other way. <br />
If <code>pool</code> is not null, this member is ignored. </p>
</div>