mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-22 15:04:34 +00:00
Improvements in documentation, especially regarding defragmentation
This commit is contained in:
parent
f828262f43
commit
80a07979f5
@ -71,7 +71,7 @@ $(function() {
|
||||
<div class="contents">
|
||||
<div class="textblock"><h1><a class="anchor" id="allocation_user_data"></a>
|
||||
Allocation user data</h1>
|
||||
<p >You can annotate allocations with your own information, e.g. for debugging purposes. To do that, fill <a class="el" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19" title="Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...">VmaAllocationCreateInfo::pUserData</a> field when creating an allocation. It is an opaque <code>void*</code> 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.</p>
|
||||
<p >You can annotate allocations with your own information, e.g. for debugging purposes. To do that, fill <a class="el" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19" title="Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...">VmaAllocationCreateInfo::pUserData</a> field when creating an allocation. It is an opaque <code>void*</code> pointer. You can use it e.g. as a pointer, some handle, index, key, ordinal number or any other value that would associate the allocation with your custom metadata. It it useful to identify appropriate data structures in your engine given <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a>, e.g. when doing <a class="el" href="defragmentation.html">Defragmentation</a>.</p>
|
||||
<div class="fragment"><div class="line">VkBufferCreateInfo bufCreateInfo = ...</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">MyBufferMetadata* pMetadata = CreateBufferMetadata();</div>
|
||||
@ -100,30 +100,13 @@ Allocation user data</h1>
|
||||
<p >Values of (non-zero) allocations' <code>pUserData</code> are printed in JSON report created by <a class="el" href="group__group__stats.html#gaa4fee7eb5253377599ef4fd38c93c2a0" title="Builds and returns statistics as a null-terminated string in JSON format.">vmaBuildStatsString()</a> in hexadecimal form.</p>
|
||||
<h1><a class="anchor" id="allocation_names"></a>
|
||||
Allocation names</h1>
|
||||
<p >There is alternative mode available where <code>pUserData</code> pointer is used to point to a null-terminated string, giving a name to the allocation. To use this mode, set <a class="el" href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a> flag in <a class="el" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b" title="Use VmaAllocationCreateFlagBits enum.">VmaAllocationCreateInfo::flags</a>. Then <code>pUserData</code> passed as <a class="el" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19" title="Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...">VmaAllocationCreateInfo::pUserData</a> or argument to <a class="el" href="group__group__alloc.html#gaf9147d31ffc11d62fc187bde283ed14f" title="Sets pUserData in given allocation to new value.">vmaSetAllocationUserData()</a> must be either null or a 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.</p>
|
||||
<div class="fragment"><div class="line">VkImageCreateInfo imageInfo = ...</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">std::string imageName = <span class="stringliteral">"Texture: "</span>;</div>
|
||||
<p >An allocation can also carry a null-terminated string, giving a name to the allocation. To set it, call <a class="el" href="group__group__alloc.html#gabe02cbb0cd913b3f125958179f2020fc" title="Sets pName in given allocation to new value.">vmaSetAllocationName()</a>. 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.</p>
|
||||
<div class="fragment"><div class="line">std::string imageName = <span class="stringliteral">"Texture: "</span>;</div>
|
||||
<div class="line">imageName += fileName;</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><a class="code hl_struct" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> allocCreateInfo = {};</div>
|
||||
<div class="line">allocCreateInfo.<a class="code hl_variable" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a> = <a class="code hl_enumvalue" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca27cde9026a84d34d525777baa41fce6e">VMA_MEMORY_USAGE_AUTO</a>;</div>
|
||||
<div class="line">allocCreateInfo.<a class="code hl_variable" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> = <a class="code hl_enumvalue" href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a>;</div>
|
||||
<div class="line">allocCreateInfo.<a class="code hl_variable" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a> = imageName.c_str();</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">VkImage image;</div>
|
||||
<div class="line"><a class="code hl_struct" href="struct_vma_allocation.html">VmaAllocation</a> allocation;</div>
|
||||
<div class="line"><a class="code hl_function" href="group__group__alloc.html#ga02a94f25679275851a53e82eacbcfc73">vmaCreateImage</a>(allocator, &imageInfo, &allocCreateInfo, &image, &allocation, <span class="keyword">nullptr</span>);</div>
|
||||
<div class="ttc" id="agroup__group__alloc_html_ga02a94f25679275851a53e82eacbcfc73"><div class="ttname"><a href="group__group__alloc.html#ga02a94f25679275851a53e82eacbcfc73">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="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">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:562</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:1225</div></div>
|
||||
</div><!-- fragment --><p >The value of <code>pUserData</code> 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.</p>
|
||||
<div class="fragment"><div class="line"><a class="code hl_struct" href="struct_vma_allocation_info.html">VmaAllocationInfo</a> allocInfo;</div>
|
||||
<div class="line"><a class="code hl_function" href="group__group__alloc.html#ga86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a>(allocator, allocation, &allocInfo);</div>
|
||||
<div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span>* imageName = (<span class="keyword">const</span> <span class="keywordtype">char</span>*)allocInfo.<a class="code hl_variable" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a>;</div>
|
||||
<div class="line">printf(<span class="stringliteral">"Image name: %s\n"</span>, imageName);</div>
|
||||
</div><!-- fragment --><p >That string is also printed in JSON report created by <a class="el" href="group__group__stats.html#gaa4fee7eb5253377599ef4fd38c93c2a0" title="Builds and returns statistics as a null-terminated string in JSON format.">vmaBuildStatsString()</a>.</p>
|
||||
<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 class="line"><a class="code hl_function" href="group__group__alloc.html#gabe02cbb0cd913b3f125958179f2020fc">vmaSetAllocationName</a>(allocator, allocation, imageName.c_str());</div>
|
||||
<div class="ttc" id="agroup__group__alloc_html_gabe02cbb0cd913b3f125958179f2020fc"><div class="ttname"><a href="group__group__alloc.html#gabe02cbb0cd913b3f125958179f2020fc">vmaSetAllocationName</a></div><div class="ttdeci">void vmaSetAllocationName(VmaAllocator allocator, VmaAllocation allocation, const char *pName)</div><div class="ttdoc">Sets pName in given allocation to new value.</div></div>
|
||||
</div><!-- fragment --><p >The string can be later retrieved by inspecting <a class="el" href="struct_vma_allocation_info.html#a28612f3e897e5b268254a3c63413d759" title="Custom allocation name that was set with vmaSetAllocationName().">VmaAllocationInfo::pName</a>. It is also printed in JSON report created by <a class="el" href="group__group__stats.html#gaa4fee7eb5253377599ef4fd38c93c2a0" title="Builds and returns statistics as a null-terminated string in JSON format.">vmaBuildStatsString()</a>.</p>
|
||||
<dl class="section note"><dt>Note</dt><dd>Setting 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 -->
|
||||
<!-- start footer part -->
|
||||
|
@ -78,7 +78,7 @@ $(function() {
|
||||
<tr id="row_8_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_vma_defragmentation_info.html" target="_self">VmaDefragmentationInfo</a></td><td class="desc">Parameters for defragmentation </td></tr>
|
||||
<tr id="row_9_"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_vma_defragmentation_move.html" target="_self">VmaDefragmentationMove</a></td><td class="desc">Single move of an allocation to be done for defragmentation </td></tr>
|
||||
<tr id="row_10_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_vma_defragmentation_pass_move_info.html" target="_self">VmaDefragmentationPassMoveInfo</a></td><td class="desc">Parameters for incremental defragmentation steps </td></tr>
|
||||
<tr id="row_11_"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_vma_defragmentation_stats.html" target="_self">VmaDefragmentationStats</a></td><td class="desc">Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174" title="Ends defragmentation process.">vmaEndDefragmentation()</a> </td></tr>
|
||||
<tr id="row_11_"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_vma_defragmentation_stats.html" target="_self">VmaDefragmentationStats</a></td><td class="desc">Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87" title="Ends defragmentation process.">vmaEndDefragmentation()</a> </td></tr>
|
||||
<tr id="row_12_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_vma_detailed_statistics.html" target="_self">VmaDetailedStatistics</a></td><td class="desc">More detailed statistics than <a class="el" href="struct_vma_statistics.html" title="Calculated statistics of memory usage e.g. in a specific memory type, heap, custom pool,...">VmaStatistics</a> </td></tr>
|
||||
<tr id="row_13_"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_vma_device_memory_callbacks.html" target="_self">VmaDeviceMemoryCallbacks</a></td><td class="desc">Set of callbacks that the library will call for <code>vkAllocateMemory</code> and <code>vkFreeMemory</code> </td></tr>
|
||||
<tr id="row_14_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_vma_pool.html" target="_self">VmaPool</a></td><td class="desc">Represents custom memory pool </td></tr>
|
||||
|
@ -86,41 +86,106 @@ $(function() {
|
||||
<div class="line"> res = <a class="code hl_function" href="group__group__alloc.html#ga980d7da2ce3b1fd5c8b8476bc362cc00">vmaBeginDefragmentationPass</a>(allocator, defragCtx, &pass);</div>
|
||||
<div class="line"> <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
|
||||
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span>(res == VK_INCOMPLETE)</div>
|
||||
<div class="line"> {</div>
|
||||
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span>(res != VK_INCOMPLETE)</div>
|
||||
<div class="line"> <span class="comment">// Handle error...</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="keywordflow">for</span>(uint32_t i = 0; i < pass.<a class="code hl_variable" href="struct_vma_defragmentation_pass_move_info.html#a1b3e18c23f9691f35baf183e615c4408">moveCount</a>; ++i)</div>
|
||||
<div class="line"> {</div>
|
||||
<div class="line"> <span class="comment">//- Inspect pass.pMoves[i].srcAllocation, identify what buffer or image it represents.</span></div>
|
||||
<div class="line"> <span class="comment">//- Recreate and bind this buffer or image at pass.pMoves[i].dstMemory, pass.pMoves[i].dstOffset.</span></div>
|
||||
<div class="line"> <span class="comment">//- Issue a vkCmdCopyBuffer/vkCmdCopyImage to copy its content to the new place.</span></div>
|
||||
<div class="line"> <span class="comment">// Inspect pass.pMoves[i].srcAllocation, identify what buffer/image it represents.</span></div>
|
||||
<div class="line"> <a class="code hl_struct" href="struct_vma_allocation_info.html">VmaAllocationInfo</a> allocInfo;</div>
|
||||
<div class="line"> <a class="code hl_function" href="group__group__alloc.html#ga86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a>(allocator, pMoves[i].srcAllocation, &allocInfo);</div>
|
||||
<div class="line"> MyEngineResourceData* resData = (MyEngineResourceData*)allocInfo.<a class="code hl_variable" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a>;</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// Recreate and bind this buffer/image at: pass.pMoves[i].dstMemory, pass.pMoves[i].dstOffset.</span></div>
|
||||
<div class="line"> VkImageCreateInfo imgCreateInfo = ...</div>
|
||||
<div class="line"> VkImage newImg;</div>
|
||||
<div class="line"> res = vkCreateImage(device, &imgCreateInfo, <span class="keyword">nullptr</span>, &newImg);</div>
|
||||
<div class="line"> <span class="comment">// Check res...</span></div>
|
||||
<div class="line"> res = vKBindImageMemory(device, newImg, pass.<a class="code hl_variable" href="struct_vma_defragmentation_pass_move_info.html#adfa7a4994afd9b940e7f1dfaf436a725">pMoves</a>[i].<a class="code hl_variable" href="struct_vma_defragmentation_move.html#a382fbec8dac2747abdc1883b69ef9458">dstMemory</a>, pass.<a class="code hl_variable" href="struct_vma_defragmentation_pass_move_info.html#adfa7a4994afd9b940e7f1dfaf436a725">pMoves</a>[i].<a class="code hl_variable" href="struct_vma_defragmentation_move.html#a80c466b445bc272f82c7dbf1a971ba18">dstOffset</a>);</div>
|
||||
<div class="line"> <span class="comment">// Check res...</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// Issue a vkCmdCopyBuffer/vkCmdCopyImage to copy its content to the new place.</span></div>
|
||||
<div class="line"> vkCmdCopyImage(cmdBuf, resData->img, ..., newImg, ...);</div>
|
||||
<div class="line"> }</div>
|
||||
<div class="line"> <span class="comment">//- Make sure the copy commands finished executing.</span></div>
|
||||
<div class="line"> <span class="comment">//- Update appropriate descriptors to point to the new places.</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// Make sure the copy commands finished executing.</span></div>
|
||||
<div class="line"> vkWaitForFences(...);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// Destroy old buffers/images bound with pass.pMoves[i].srcAllocation.</span></div>
|
||||
<div class="line"> <span class="keywordflow">for</span>(uint32_t i = 0; i < pass.<a class="code hl_variable" href="struct_vma_defragmentation_pass_move_info.html#a1b3e18c23f9691f35baf183e615c4408">moveCount</a>; ++i)</div>
|
||||
<div class="line"> {</div>
|
||||
<div class="line"> <span class="comment">// ...</span></div>
|
||||
<div class="line"> vkDestroyImage(device, resData->img, <span class="keyword">nullptr</span>);</div>
|
||||
<div class="line"> }</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// Update appropriate descriptors to point to the new places...</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> res = <a class="code hl_function" href="group__group__alloc.html#gaded05a445742a00718ee766144c5c226">vmaEndDefragmentationPass</a>(allocator, defragCtx, &pass);</div>
|
||||
<div class="line"> <span class="keywordflow">if</span>(res == VK_SUCCESS)</div>
|
||||
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span>(res != VK_INCOMPLETE)</div>
|
||||
<div class="line"> <span class="comment">// Handle error...</span></div>
|
||||
<div class="line"> }</div>
|
||||
<div class="line"> <span class="keywordflow">else</span></div>
|
||||
<div class="line"> <span class="comment">// Handle error...</span></div>
|
||||
<div class="line">}</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><a class="code hl_function" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174">vmaEndDefragmentation</a>(allocator, defragCtx, <span class="keyword">nullptr</span>);</div>
|
||||
<div class="ttc" id="agroup__group__alloc_html_ga729a594b45ae1681096940a44f3eb174"><div class="ttname"><a href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174">vmaEndDefragmentation</a></div><div class="ttdeci">VkResult vmaEndDefragmentation(VmaAllocator allocator, VmaDefragmentationContext context, VmaDefragmentationStats *pStats)</div><div class="ttdoc">Ends defragmentation process.</div></div>
|
||||
<div class="line"><a class="code hl_function" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87">vmaEndDefragmentation</a>(allocator, defragCtx, <span class="keyword">nullptr</span>);</div>
|
||||
<div class="ttc" id="agroup__group__alloc_html_ga59f01ca3d53d50b7cca9b442b77a3e87"><div class="ttname"><a href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87">vmaEndDefragmentation</a></div><div class="ttdeci">void vmaEndDefragmentation(VmaAllocator allocator, VmaDefragmentationContext context, VmaDefragmentationStats *pStats)</div><div class="ttdoc">Ends defragmentation process.</div></div>
|
||||
<div class="ttc" id="agroup__group__alloc_html_ga86dd08aba8633bfa4ad0df2e76481d8b"><div class="ttname"><a href="group__group__alloc.html#ga86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a></div><div class="ttdeci">void vmaGetAllocationInfo(VmaAllocator allocator, VmaAllocation allocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">Returns current information about specified allocation.</div></div>
|
||||
<div class="ttc" id="agroup__group__alloc_html_ga980d7da2ce3b1fd5c8b8476bc362cc00"><div class="ttname"><a href="group__group__alloc.html#ga980d7da2ce3b1fd5c8b8476bc362cc00">vmaBeginDefragmentationPass</a></div><div class="ttdeci">VkResult vmaBeginDefragmentationPass(VmaAllocator allocator, VmaDefragmentationContext context, VmaDefragmentationPassMoveInfo *pPassInfo)</div><div class="ttdoc">Starts single defragmentation pass.</div></div>
|
||||
<div class="ttc" id="agroup__group__alloc_html_gac3335566858b45541fa9c0d7a6bbb57e"><div class="ttname"><a href="group__group__alloc.html#gac3335566858b45541fa9c0d7a6bbb57e">vmaBeginDefragmentation</a></div><div class="ttdeci">VkResult vmaBeginDefragmentation(VmaAllocator allocator, const VmaDefragmentationInfo *pInfo, VmaDefragmentationContext *pContext)</div><div class="ttdoc">Begins defragmentation process.</div></div>
|
||||
<div class="ttc" id="agroup__group__alloc_html_gaded05a445742a00718ee766144c5c226"><div class="ttname"><a href="group__group__alloc.html#gaded05a445742a00718ee766144c5c226">vmaEndDefragmentationPass</a></div><div class="ttdeci">VkResult vmaEndDefragmentationPass(VmaAllocator allocator, VmaDefragmentationContext context, VmaDefragmentationPassMoveInfo *pPassInfo)</div><div class="ttdoc">Ends single defragmentation pass.</div></div>
|
||||
<div class="ttc" id="agroup__group__alloc_html_gga6552a65b71d16f378c6994b3ceaef50ca2e6469bcf5a094776ceb5d118263f04b"><div class="ttname"><a href="group__group__alloc.html#gga6552a65b71d16f378c6994b3ceaef50ca2e6469bcf5a094776ceb5d118263f04b">VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FAST_BIT</a></div><div class="ttdeci">@ VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FAST_BIT</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:707</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:1338</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:1385</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">An opaque object that represents started defragmentation process.</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">Parameters for defragmentation.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:1401</div></div>
|
||||
<div class="ttc" id="astruct_vma_defragmentation_info_html_a18dd2097d8ab2976cdc7dd3e7b978bd4"><div class="ttname"><a href="struct_vma_defragmentation_info.html#a18dd2097d8ab2976cdc7dd3e7b978bd4">VmaDefragmentationInfo::pool</a></div><div class="ttdeci">VmaPool pool</div><div class="ttdoc">Custom pool to be defragmented.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:1408</div></div>
|
||||
<div class="ttc" id="astruct_vma_defragmentation_info_html_a3e23080c978ecf3abb3180f5b2069da7"><div class="ttname"><a href="struct_vma_defragmentation_info.html#a3e23080c978ecf3abb3180f5b2069da7">VmaDefragmentationInfo::flags</a></div><div class="ttdeci">VmaDefragmentationFlags flags</div><div class="ttdoc">Use combination of VmaDefragmentationFlagBits.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:1403</div></div>
|
||||
<div class="ttc" id="astruct_vma_defragmentation_move_html_a382fbec8dac2747abdc1883b69ef9458"><div class="ttname"><a href="struct_vma_defragmentation_move.html#a382fbec8dac2747abdc1883b69ef9458">VmaDefragmentationMove::dstMemory</a></div><div class="ttdeci">VkDeviceMemory dstMemory</div><div class="ttdoc">Destination memory block where the allocation should be moved.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:1429</div></div>
|
||||
<div class="ttc" id="astruct_vma_defragmentation_move_html_a80c466b445bc272f82c7dbf1a971ba18"><div class="ttname"><a href="struct_vma_defragmentation_move.html#a80c466b445bc272f82c7dbf1a971ba18">VmaDefragmentationMove::dstOffset</a></div><div class="ttdeci">VkDeviceSize dstOffset</div><div class="ttdoc">Destination offset where the allocation should be moved.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:1431</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="ttdoc">Parameters for incremental defragmentation steps.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:1441</div></div>
|
||||
<div class="ttc" id="astruct_vma_defragmentation_pass_move_info_html_a1b3e18c23f9691f35baf183e615c4408"><div class="ttname"><a href="struct_vma_defragmentation_pass_move_info.html#a1b3e18c23f9691f35baf183e615c4408">VmaDefragmentationPassMoveInfo::moveCount</a></div><div class="ttdeci">uint32_t moveCount</div><div class="ttdoc">Number of elements in the pMoves array.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:1443</div></div>
|
||||
</div><!-- fragment --><p >You can defragment a specific custom pool by setting <a class="el" href="struct_vma_defragmentation_info.html#a18dd2097d8ab2976cdc7dd3e7b978bd4" title="Custom pool to be defragmented.">VmaDefragmentationInfo::pool</a> (like in the example above) or all the default pools by setting this member to null.</p>
|
||||
<div class="ttc" id="astruct_vma_defragmentation_pass_move_info_html_adfa7a4994afd9b940e7f1dfaf436a725"><div class="ttname"><a href="struct_vma_defragmentation_pass_move_info.html#adfa7a4994afd9b940e7f1dfaf436a725">VmaDefragmentationPassMoveInfo::pMoves</a></div><div class="ttdeci">VmaDefragmentationMove * pMoves</div><div class="ttdoc">Array of moves to be performed by the user in the current defragmentation pass.</div><div class="ttdef"><b>Definition:</b> vk_mem_alloc.h:1467</div></div>
|
||||
</div><!-- fragment --><p >Although functions like <a class="el" href="group__group__alloc.html#gac72ee55598617e8eecca384e746bab51" title="Creates a new VkBuffer, allocates and binds memory for it.">vmaCreateBuffer()</a>, <a class="el" href="group__group__alloc.html#ga02a94f25679275851a53e82eacbcfc73" title="Function similar to vmaCreateBuffer().">vmaCreateImage()</a>, <a class="el" href="group__group__alloc.html#ga0d9f4e4ba5bf9aab1f1c746387753d77" title="Destroys Vulkan buffer and frees allocated memory.">vmaDestroyBuffer()</a>, <a class="el" href="group__group__alloc.html#gae50d2cb3b4a3bfd4dd40987234e50e7e" title="Destroys Vulkan image and frees allocated memory.">vmaDestroyImage()</a> create/destroy an allocation and a buffer/image at once, these are just a shortcut for creating the resource, allocating memory, and binding them together. Defragmentation works on memory allocations only. You must handle the rest manually. Defragmentation is an iterative process that should repreat "passes" as long as related functions return <code>VK_INCOMPLETE</code> not <code>VK_SUCCESS</code>. In each pass:</p>
|
||||
<ol type="1">
|
||||
<li><a class="el" href="group__group__alloc.html#ga980d7da2ce3b1fd5c8b8476bc362cc00" title="Starts single defragmentation pass.">vmaBeginDefragmentationPass()</a> function call:<ul>
|
||||
<li>Calculates and returns the list of allocations to be moved in this pass. Note this can be a time-consuming process.</li>
|
||||
<li>Reserves destination memory for them by creating internal allocations. Returns their <code>VkDeviceMemory</code> + offset.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Inside the pass, <b>you should</b>:<ul>
|
||||
<li>Inspect the returned list of allocations to be moved.</li>
|
||||
<li>Create new buffers/images and bind them at the returned destination <code>VkDeviceMemory</code> + offset.</li>
|
||||
<li>Copy data from source to destination resources if necessary.</li>
|
||||
<li>Destroy the source buffers/images, but NOT their allocations.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="el" href="group__group__alloc.html#gaded05a445742a00718ee766144c5c226" title="Ends single defragmentation pass.">vmaEndDefragmentationPass()</a> function call:<ul>
|
||||
<li>Frees the source memory reserved for the allocations that are moved.</li>
|
||||
<li>Modifies <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a> objects that are moved to point to the destination reserved memory.</li>
|
||||
<li>Frees <code>VkDeviceMemory</code> blocks that became empty.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
<p >Unlike in previous iterations of the defragmentation API, there is no list of "movable" allocations passed as a parameter. Defragmentation algorithm tries to move all suitable allocations. You can, however, refuse to move some of them inside a defragmentation pass, by setting <code>pass.pMoves[i].operation</code> to <a class="el" href="group__group__alloc.html#ggada9e3861caf96f08894b0bcc160ec257ad25bc6f816b226b4fd5170e845f218d2" title="Set this value if you cannot move the allocation. New place reserved dstMemory + dstOffset will be fr...">VMA_DEFRAGMENTATION_MOVE_OPERATION_IGNORE</a>. This is not recommended and may result in suboptimal packing of the allocations after defragmentation. If you cannot ensure any allocation can be moved, it is better to keep movable allocations separate in a custom pool.</p>
|
||||
<p >You can also decide to destroy an allocation instead of moving it. You should then set <code>pass.pMoves[i].operation</code> to <a class="el" href="group__group__alloc.html#ggada9e3861caf96f08894b0bcc160ec257a9786f8492a9be2c03bd26395e352ab85" title="Set this value if you decide to abandon the allocation and you destroyed the buffer/image....">VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY</a>.</p>
|
||||
<p >Inside a pass, for each allocation that should be moved:</p>
|
||||
<ul>
|
||||
<li>You should copy its data from the source to the destination place by calling e.g. <code>vkCmdCopyBuffer()</code>, <code>vkCmdCopyImage()</code>.<ul>
|
||||
<li>You need to make sure these commands finished executing before destroying the source buffers/images and before calling <a class="el" href="group__group__alloc.html#gaded05a445742a00718ee766144c5c226" title="Ends single defragmentation pass.">vmaEndDefragmentationPass()</a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>If a resource doesn't contain any meaningful data, e.g. it is a transient color attachment image to be cleared, filled, and used temporarily in each rendering frame, you can just recreate this image without copying its data.</li>
|
||||
<li>If the resource is in <code>HOST_VISIBLE</code> and <code>HOST_COHERENT</code> memory, you can copy its data on the CPU using <code>memcpy()</code>.</li>
|
||||
<li>If you cannot move the allocation, you can set <code>pass.pMoves[i].operation</code> to <a class="el" href="group__group__alloc.html#ggada9e3861caf96f08894b0bcc160ec257ad25bc6f816b226b4fd5170e845f218d2" title="Set this value if you cannot move the allocation. New place reserved dstMemory + dstOffset will be fr...">VMA_DEFRAGMENTATION_MOVE_OPERATION_IGNORE</a>. This will cancel the move.<ul>
|
||||
<li><a class="el" href="group__group__alloc.html#gaded05a445742a00718ee766144c5c226" title="Ends single defragmentation pass.">vmaEndDefragmentationPass()</a> will then free the destination memory not the source memory of the allocation, leaving it unchanged.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>If you decide the allocation is unimportant and can be destroyed instead of moved (e.g. it wasn't used for long time), you can set <code>pass.pMoves[i].operation</code> to <a class="el" href="group__group__alloc.html#ggada9e3861caf96f08894b0bcc160ec257a9786f8492a9be2c03bd26395e352ab85" title="Set this value if you decide to abandon the allocation and you destroyed the buffer/image....">VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY</a>.<ul>
|
||||
<li><a class="el" href="group__group__alloc.html#gaded05a445742a00718ee766144c5c226" title="Ends single defragmentation pass.">vmaEndDefragmentationPass()</a> will then free both source and destination memory, and will destroy the <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a> object.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p >You can defragment a specific custom pool by setting <a class="el" href="struct_vma_defragmentation_info.html#a18dd2097d8ab2976cdc7dd3e7b978bd4" title="Custom pool to be defragmented.">VmaDefragmentationInfo::pool</a> (like in the example above) or all the default pools by setting this member to null.</p>
|
||||
<p >Defragmentation is always performed in each pool separately. Allocations are never moved between different Vulkan memory types. The size of the destination memory reserved for a moved allocation is the same as the original one. Alignment of an allocation as it was determined using <code>vkGetBufferMemoryRequirements()</code> etc. is also respected after defragmentation. Buffers/images should be recreated with the same <code>VkBufferCreateInfo</code> / <code>VkImageCreateInfo</code> parameters as the original ones.</p>
|
||||
<p >You can perform the defragmentation incrementally to limit the number of allocations and bytes to be moved in each pass, e.g. to call it in sync with render frames and not to experience too big hitches. See members: <a class="el" href="struct_vma_defragmentation_info.html#a637ada77b02179a27fa92290000afac4" title="Maximum numbers of bytes that can be copied during single pass, while moving allocations to different...">VmaDefragmentationInfo::maxBytesPerPass</a>, <a class="el" href="struct_vma_defragmentation_info.html#ac2db29d309bebc4f7d55041416e9694b" title="Maximum number of allocations that can be moved during single pass to a different place.">VmaDefragmentationInfo::maxAllocationsPerPass</a>.</p>
|
||||
<p >It is also safe to perform the defragmentation asynchronously to render frames and other Vulkan and VMA usage, possibly from multiple threads, with the exception that allocations returned in <a class="el" href="struct_vma_defragmentation_pass_move_info.html#adfa7a4994afd9b940e7f1dfaf436a725" title="Array of moves to be performed by the user in the current defragmentation pass.">VmaDefragmentationPassMoveInfo::pMoves</a> shouldn't be destroyed until the defragmentation pass is ended.</p>
|
||||
<dl class="section note"><dt>Note</dt><dd>Defragmentation is not supported in custom pools created with <a class="el" href="group__group__alloc.html#gga9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726" title="Enables alternative, linear allocation algorithm in this pool.">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>. </dd></dl>
|
||||
|
@ -185,7 +185,7 @@ $(function() {
|
||||
<li>vmaDestroyVirtualBlock() : <a class="el" href="group__group__virtual.html#ga3795f7783ae2c182cede067d656f66a5">vk_mem_alloc.h</a></li>
|
||||
<li>VmaDetailedStatistics : <a class="el" href="group__group__stats.html#ga9ab0c535a6ca655dc63b8609ab4b8394">vk_mem_alloc.h</a></li>
|
||||
<li>VmaDeviceMemoryCallbacks : <a class="el" href="group__group__init.html#ga77692d3c8770ea8882d573206bd27b2b">vk_mem_alloc.h</a></li>
|
||||
<li>vmaEndDefragmentation() : <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174">vk_mem_alloc.h</a></li>
|
||||
<li>vmaEndDefragmentation() : <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87">vk_mem_alloc.h</a></li>
|
||||
<li>vmaEndDefragmentationPass() : <a class="el" href="group__group__alloc.html#gaded05a445742a00718ee766144c5c226">vk_mem_alloc.h</a></li>
|
||||
<li>vmaFindMemoryTypeIndex() : <a class="el" href="group__group__alloc.html#gaef15a94b58fbcb0fe706d5720e84a74a">vk_mem_alloc.h</a></li>
|
||||
<li>vmaFindMemoryTypeIndexForBufferInfo() : <a class="el" href="group__group__alloc.html#gae790ab9ffaf7667fb8f62523e6897888">vk_mem_alloc.h</a></li>
|
||||
|
@ -95,7 +95,7 @@ $(function() {
|
||||
<li>vmaDestroyImage() : <a class="el" href="group__group__alloc.html#gae50d2cb3b4a3bfd4dd40987234e50e7e">vk_mem_alloc.h</a></li>
|
||||
<li>vmaDestroyPool() : <a class="el" href="group__group__alloc.html#ga5485779c8f1948238fc4e92232fa65e1">vk_mem_alloc.h</a></li>
|
||||
<li>vmaDestroyVirtualBlock() : <a class="el" href="group__group__virtual.html#ga3795f7783ae2c182cede067d656f66a5">vk_mem_alloc.h</a></li>
|
||||
<li>vmaEndDefragmentation() : <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174">vk_mem_alloc.h</a></li>
|
||||
<li>vmaEndDefragmentation() : <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87">vk_mem_alloc.h</a></li>
|
||||
<li>vmaEndDefragmentationPass() : <a class="el" href="group__group__alloc.html#gaded05a445742a00718ee766144c5c226">vk_mem_alloc.h</a></li>
|
||||
<li>vmaFindMemoryTypeIndex() : <a class="el" href="group__group__alloc.html#gaef15a94b58fbcb0fe706d5720e84a74a">vk_mem_alloc.h</a></li>
|
||||
<li>vmaFindMemoryTypeIndexForBufferInfo() : <a class="el" href="group__group__alloc.html#gae790ab9ffaf7667fb8f62523e6897888">vk_mem_alloc.h</a></li>
|
||||
|
@ -95,7 +95,7 @@ Classes</h2></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Parameters for incremental defragmentation steps. <a href="struct_vma_defragmentation_pass_move_info.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. <a href="struct_vma_defragmentation_stats.html#details">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. <a href="struct_vma_defragmentation_stats.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_pool.html">VmaPool</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Represents custom memory pool. <a href="struct_vma_pool.html#details">More...</a><br /></td></tr>
|
||||
@ -152,7 +152,7 @@ Typedefs</h2></td></tr>
|
||||
<tr class="memdesc:gad6799e8e2b1527abfc84d33bc44aeaf5"><td class="mdescLeft"> </td><td class="mdescRight">Parameters for incremental defragmentation steps. <a href="group__group__alloc.html#gad6799e8e2b1527abfc84d33bc44aeaf5">More...</a><br /></td></tr>
|
||||
<tr class="separator:gad6799e8e2b1527abfc84d33bc44aeaf5"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gad94034192259c2e34a4d1c5e27810403"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__alloc.html#gad94034192259c2e34a4d1c5e27810403">VmaDefragmentationStats</a></td></tr>
|
||||
<tr class="memdesc:gad94034192259c2e34a4d1c5e27810403"><td class="mdescLeft"> </td><td class="mdescRight">Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. <a href="group__group__alloc.html#gad94034192259c2e34a4d1c5e27810403">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gad94034192259c2e34a4d1c5e27810403"><td class="mdescLeft"> </td><td class="mdescRight">Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. <a href="group__group__alloc.html#gad94034192259c2e34a4d1c5e27810403">More...</a><br /></td></tr>
|
||||
<tr class="separator:gad94034192259c2e34a4d1c5e27810403"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
|
||||
@ -310,9 +310,9 @@ Functions</h2></td></tr>
|
||||
<tr class="memitem:gac3335566858b45541fa9c0d7a6bbb57e"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__alloc.html#gac3335566858b45541fa9c0d7a6bbb57e">vmaBeginDefragmentation</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, const <a class="el" href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a> *pInfo, <a class="el" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> *pContext)</td></tr>
|
||||
<tr class="memdesc:gac3335566858b45541fa9c0d7a6bbb57e"><td class="mdescLeft"> </td><td class="mdescRight">Begins defragmentation process. <a href="group__group__alloc.html#gac3335566858b45541fa9c0d7a6bbb57e">More...</a><br /></td></tr>
|
||||
<tr class="separator:gac3335566858b45541fa9c0d7a6bbb57e"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga729a594b45ae1681096940a44f3eb174"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174">vmaEndDefragmentation</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context, <a class="el" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a> *pStats)</td></tr>
|
||||
<tr class="memdesc:ga729a594b45ae1681096940a44f3eb174"><td class="mdescLeft"> </td><td class="mdescRight">Ends defragmentation process. <a href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga729a594b45ae1681096940a44f3eb174"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga59f01ca3d53d50b7cca9b442b77a3e87"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87">vmaEndDefragmentation</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context, <a class="el" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a> *pStats)</td></tr>
|
||||
<tr class="memdesc:ga59f01ca3d53d50b7cca9b442b77a3e87"><td class="mdescLeft"> </td><td class="mdescRight">Ends defragmentation process. <a href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga59f01ca3d53d50b7cca9b442b77a3e87"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga980d7da2ce3b1fd5c8b8476bc362cc00"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__alloc.html#ga980d7da2ce3b1fd5c8b8476bc362cc00">vmaBeginDefragmentationPass</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context, <a class="el" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a> *pPassInfo)</td></tr>
|
||||
<tr class="memdesc:ga980d7da2ce3b1fd5c8b8476bc362cc00"><td class="mdescLeft"> </td><td class="mdescRight">Starts single defragmentation pass. <a href="group__group__alloc.html#ga980d7da2ce3b1fd5c8b8476bc362cc00">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga980d7da2ce3b1fd5c8b8476bc362cc00"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@ -525,7 +525,7 @@ Functions</h2></td></tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. </p>
|
||||
<p>Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -1087,7 +1087,7 @@ Functions</h2></td></tr>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir"></td><td class="paramname">allocator</td><td>Allocator object. </td></tr>
|
||||
<tr><td class="paramdir"></td><td class="paramname">pInfo</td><td>Structure filled with parameters of defragmentation. </td></tr>
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">pContext</td><td>Context object that must be passed to <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174" title="Ends defragmentation process.">vmaEndDefragmentation()</a> to finish defragmentation. </td></tr>
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">pContext</td><td>Context object that must be passed to <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87" title="Ends defragmentation process.">vmaEndDefragmentation()</a> to finish defragmentation. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
@ -1773,14 +1773,14 @@ Functions</h2></td></tr>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ga729a594b45ae1681096940a44f3eb174" name="ga729a594b45ae1681096940a44f3eb174"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga729a594b45ae1681096940a44f3eb174">◆ </a></span>vmaEndDefragmentation()</h2>
|
||||
<a id="ga59f01ca3d53d50b7cca9b442b77a3e87" name="ga59f01ca3d53d50b7cca9b442b77a3e87"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ga59f01ca3d53d50b7cca9b442b77a3e87">◆ </a></span>vmaEndDefragmentation()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">VkResult vmaEndDefragmentation </td>
|
||||
<td class="memname">void vmaEndDefragmentation </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_vma_allocator.html">VmaAllocator</a> </td>
|
||||
<td class="paramname"><em>allocator</em>, </td>
|
||||
|
@ -98,7 +98,7 @@ Typedefs</h2></td></tr>
|
||||
<tr class="memdesc:gafd73b95e737ee7e76f827cb5472f559f"><td class="mdescLeft"> </td><td class="mdescRight">Flags for created <a class="el" href="struct_vma_allocator.html" title="Represents main object of this library initialized.">VmaAllocator</a>. <a href="group__group__init.html#gafd73b95e737ee7e76f827cb5472f559f">More...</a><br /></td></tr>
|
||||
<tr class="separator:gafd73b95e737ee7e76f827cb5472f559f"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gacfe6863e160722c2c1bbcf7573fddc4d"><td class="memItemLeft" align="right" valign="top">typedef VkFlags </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__init.html#gacfe6863e160722c2c1bbcf7573fddc4d">VmaAllocatorCreateFlags</a></td></tr>
|
||||
<tr class="memdesc:gacfe6863e160722c2c1bbcf7573fddc4d"><td class="mdescLeft"> </td><td class="mdescRight">See #VmaAllocatorCreateFlagBigs. <a href="group__group__init.html#gacfe6863e160722c2c1bbcf7573fddc4d">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gacfe6863e160722c2c1bbcf7573fddc4d"><td class="mdescLeft"> </td><td class="mdescRight">See <a class="el" href="group__group__init.html#ga4f87c9100d154a65a4ad495f7763cf7c" title="Flags for created VmaAllocator.">VmaAllocatorCreateFlagBits</a>. <a href="group__group__init.html#gacfe6863e160722c2c1bbcf7573fddc4d">More...</a><br /></td></tr>
|
||||
<tr class="separator:gacfe6863e160722c2c1bbcf7573fddc4d"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga7e1ed85f7799600b03ad51a77acc21f3"><td class="memItemLeft" align="right" valign="top">typedef void(VKAPI_PTR * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__init.html#ga7e1ed85f7799600b03ad51a77acc21f3">PFN_vmaAllocateDeviceMemoryFunction</a>) (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, uint32_t memoryType, VkDeviceMemory memory, VkDeviceSize size, void *pUserData)</td></tr>
|
||||
<tr class="memdesc:ga7e1ed85f7799600b03ad51a77acc21f3"><td class="mdescLeft"> </td><td class="mdescRight">Callback function called after successful vkAllocateMemory. <a href="group__group__init.html#ga7e1ed85f7799600b03ad51a77acc21f3">More...</a><br /></td></tr>
|
||||
@ -221,7 +221,7 @@ Functions</h2></td></tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>See #VmaAllocatorCreateFlagBigs. </p>
|
||||
<p>See <a class="el" href="group__group__init.html#ga4f87c9100d154a65a4ad495f7763cf7c" title="Flags for created VmaAllocator.">VmaAllocatorCreateFlagBits</a>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -148,7 +148,7 @@ var searchData=
|
||||
['vmadestroyvirtualblock_145',['vmaDestroyVirtualBlock',['../group__group__virtual.html#ga3795f7783ae2c182cede067d656f66a5',1,'vk_mem_alloc.h']]],
|
||||
['vmadetailedstatistics_146',['VmaDetailedStatistics',['../struct_vma_detailed_statistics.html',1,'VmaDetailedStatistics'],['../group__group__stats.html#ga9ab0c535a6ca655dc63b8609ab4b8394',1,'VmaDetailedStatistics(): vk_mem_alloc.h']]],
|
||||
['vmadevicememorycallbacks_147',['VmaDeviceMemoryCallbacks',['../struct_vma_device_memory_callbacks.html',1,'VmaDeviceMemoryCallbacks'],['../group__group__init.html#ga77692d3c8770ea8882d573206bd27b2b',1,'VmaDeviceMemoryCallbacks(): vk_mem_alloc.h']]],
|
||||
['vmaenddefragmentation_148',['vmaEndDefragmentation',['../group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174',1,'vk_mem_alloc.h']]],
|
||||
['vmaenddefragmentation_148',['vmaEndDefragmentation',['../group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87',1,'vk_mem_alloc.h']]],
|
||||
['vmaenddefragmentationpass_149',['vmaEndDefragmentationPass',['../group__group__alloc.html#gaded05a445742a00718ee766144c5c226',1,'vk_mem_alloc.h']]],
|
||||
['vmafindmemorytypeindex_150',['vmaFindMemoryTypeIndex',['../group__group__alloc.html#gaef15a94b58fbcb0fe706d5720e84a74a',1,'vk_mem_alloc.h']]],
|
||||
['vmafindmemorytypeindexforbufferinfo_151',['vmaFindMemoryTypeIndexForBufferInfo',['../group__group__alloc.html#gae790ab9ffaf7667fb8f62523e6897888',1,'vk_mem_alloc.h']]],
|
||||
|
@ -30,7 +30,7 @@ var searchData=
|
||||
['vmadestroyimage_27',['vmaDestroyImage',['../group__group__alloc.html#gae50d2cb3b4a3bfd4dd40987234e50e7e',1,'vk_mem_alloc.h']]],
|
||||
['vmadestroypool_28',['vmaDestroyPool',['../group__group__alloc.html#ga5485779c8f1948238fc4e92232fa65e1',1,'vk_mem_alloc.h']]],
|
||||
['vmadestroyvirtualblock_29',['vmaDestroyVirtualBlock',['../group__group__virtual.html#ga3795f7783ae2c182cede067d656f66a5',1,'vk_mem_alloc.h']]],
|
||||
['vmaenddefragmentation_30',['vmaEndDefragmentation',['../group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174',1,'vk_mem_alloc.h']]],
|
||||
['vmaenddefragmentation_30',['vmaEndDefragmentation',['../group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87',1,'vk_mem_alloc.h']]],
|
||||
['vmaenddefragmentationpass_31',['vmaEndDefragmentationPass',['../group__group__alloc.html#gaded05a445742a00718ee766144c5c226',1,'vk_mem_alloc.h']]],
|
||||
['vmafindmemorytypeindex_32',['vmaFindMemoryTypeIndex',['../group__group__alloc.html#gaef15a94b58fbcb0fe706d5720e84a74a',1,'vk_mem_alloc.h']]],
|
||||
['vmafindmemorytypeindexforbufferinfo_33',['vmaFindMemoryTypeIndexForBufferInfo',['../group__group__alloc.html#gae790ab9ffaf7667fb8f62523e6897888',1,'vk_mem_alloc.h']]],
|
||||
|
@ -184,7 +184,7 @@ Public Attributes</h2></td></tr>
|
||||
|
||||
<p>Custom allocation name that was set with <a class="el" href="group__group__alloc.html#gabe02cbb0cd913b3f125958179f2020fc" title="Sets pName in given allocation to new value.">vmaSetAllocationName()</a>. </p>
|
||||
<p >It can change after call to <a class="el" href="group__group__alloc.html#gabe02cbb0cd913b3f125958179f2020fc" title="Sets pName in given allocation to new value.">vmaSetAllocationName()</a> for this allocation.</p>
|
||||
<p >Another way to set custom name is to pass it in <a class="el" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19" title="Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...">VmaAllocationCreateInfo::pUserData</a> with additional flag VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT set [DEPRECATED]. </p>
|
||||
<p >Another way to set custom name is to pass it in <a class="el" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19" title="Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...">VmaAllocationCreateInfo::pUserData</a> with additional flag <a class="el" href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a> set [DEPRECATED]. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -70,7 +70,7 @@ $(function() {
|
||||
<a href="struct_vma_defragmentation_context.html#details">More...</a></p>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p >An opaque object that represents started defragmentation process. </p>
|
||||
<p >Fill structure <a class="el" href="struct_vma_defragmentation_info.html" title="Parameters for defragmentation.">VmaDefragmentationInfo</a> and call function <a class="el" href="group__group__alloc.html#gac3335566858b45541fa9c0d7a6bbb57e" title="Begins defragmentation process.">vmaBeginDefragmentation()</a> to create it. Call function <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174" title="Ends defragmentation process.">vmaEndDefragmentation()</a> to destroy it. </p>
|
||||
<p >Fill structure <a class="el" href="struct_vma_defragmentation_info.html" title="Parameters for defragmentation.">VmaDefragmentationInfo</a> and call function <a class="el" href="group__group__alloc.html#gac3335566858b45541fa9c0d7a6bbb57e" title="Begins defragmentation process.">vmaBeginDefragmentation()</a> to create it. Call function <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87" title="Ends defragmentation process.">vmaEndDefragmentation()</a> to destroy it. </p>
|
||||
</div><hr/>The documentation for this struct was generated from the following file:<ul>
|
||||
<li>D:/PROJECTS/Vulkan Memory Allocator/REPO/include/<a class="el" href="vk__mem__alloc_8h.html">vk_mem_alloc.h</a></li>
|
||||
</ul>
|
||||
|
@ -69,7 +69,7 @@ $(function() {
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174" title="Ends defragmentation process.">vmaEndDefragmentation()</a>.
|
||||
<p>Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87" title="Ends defragmentation process.">vmaEndDefragmentation()</a>.
|
||||
<a href="struct_vma_defragmentation_stats.html#details">More...</a></p>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-attribs" name="pub-attribs"></a>
|
||||
@ -88,7 +88,7 @@ Public Attributes</h2></td></tr>
|
||||
<tr class="separator:a0113f1877904a5d1ee8f409216ff276b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p >Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. </p>
|
||||
<div class="textblock"><p >Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. </p>
|
||||
</div><h2 class="groupheader">Member Data Documentation</h2>
|
||||
<a id="aefeabf130022008eadd75999478af3f9" name="aefeabf130022008eadd75999478af3f9"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aefeabf130022008eadd75999478af3f9">◆ </a></span>allocationsMoved</h2>
|
||||
|
@ -122,7 +122,7 @@ Classes</h2></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Parameters for incremental defragmentation steps. <a href="struct_vma_defragmentation_pass_move_info.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. <a href="struct_vma_defragmentation_stats.html#details">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. <a href="struct_vma_defragmentation_stats.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_virtual_block_create_info.html">VmaVirtualBlockCreateInfo</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Parameters of created <a class="el" href="struct_vma_virtual_block.html" title="Handle to a virtual block object that allows to use core allocation algorithm without allocating any ...">VmaVirtualBlock</a> object to be passed to <a class="el" href="group__group__virtual.html#gab585754076877265fdae33e5c40ef13b" title="Creates new VmaVirtualBlock object.">vmaCreateVirtualBlock()</a>. <a href="struct_vma_virtual_block_create_info.html#details">More...</a><br /></td></tr>
|
||||
@ -153,7 +153,7 @@ Typedefs</h2></td></tr>
|
||||
<tr class="memdesc:gafd73b95e737ee7e76f827cb5472f559f"><td class="mdescLeft"> </td><td class="mdescRight">Flags for created <a class="el" href="struct_vma_allocator.html" title="Represents main object of this library initialized.">VmaAllocator</a>. <a href="group__group__init.html#gafd73b95e737ee7e76f827cb5472f559f">More...</a><br /></td></tr>
|
||||
<tr class="separator:gafd73b95e737ee7e76f827cb5472f559f"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gacfe6863e160722c2c1bbcf7573fddc4d"><td class="memItemLeft" align="right" valign="top">typedef VkFlags </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__init.html#gacfe6863e160722c2c1bbcf7573fddc4d">VmaAllocatorCreateFlags</a></td></tr>
|
||||
<tr class="memdesc:gacfe6863e160722c2c1bbcf7573fddc4d"><td class="mdescLeft"> </td><td class="mdescRight">See #VmaAllocatorCreateFlagBigs. <a href="group__group__init.html#gacfe6863e160722c2c1bbcf7573fddc4d">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gacfe6863e160722c2c1bbcf7573fddc4d"><td class="mdescLeft"> </td><td class="mdescRight">See <a class="el" href="group__group__init.html#ga4f87c9100d154a65a4ad495f7763cf7c" title="Flags for created VmaAllocator.">VmaAllocatorCreateFlagBits</a>. <a href="group__group__init.html#gacfe6863e160722c2c1bbcf7573fddc4d">More...</a><br /></td></tr>
|
||||
<tr class="separator:gacfe6863e160722c2c1bbcf7573fddc4d"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga806e8499dde802e59eb72a1dc811c35f"><td class="memItemLeft" align="right" valign="top">typedef enum <a class="el" href="group__group__alloc.html#gaa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__alloc.html#ga806e8499dde802e59eb72a1dc811c35f">VmaMemoryUsage</a></td></tr>
|
||||
<tr class="memdesc:ga806e8499dde802e59eb72a1dc811c35f"><td class="mdescLeft"> </td><td class="mdescRight">Intended usage of the allocated memory. <a href="group__group__alloc.html#ga806e8499dde802e59eb72a1dc811c35f">More...</a><br /></td></tr>
|
||||
@ -240,7 +240,7 @@ Typedefs</h2></td></tr>
|
||||
<tr class="memdesc:gad6799e8e2b1527abfc84d33bc44aeaf5"><td class="mdescLeft"> </td><td class="mdescRight">Parameters for incremental defragmentation steps. <a href="group__group__alloc.html#gad6799e8e2b1527abfc84d33bc44aeaf5">More...</a><br /></td></tr>
|
||||
<tr class="separator:gad6799e8e2b1527abfc84d33bc44aeaf5"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gad94034192259c2e34a4d1c5e27810403"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__alloc.html#gad94034192259c2e34a4d1c5e27810403">VmaDefragmentationStats</a></td></tr>
|
||||
<tr class="memdesc:gad94034192259c2e34a4d1c5e27810403"><td class="mdescLeft"> </td><td class="mdescRight">Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. <a href="group__group__alloc.html#gad94034192259c2e34a4d1c5e27810403">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:gad94034192259c2e34a4d1c5e27810403"><td class="mdescLeft"> </td><td class="mdescRight">Statistics returned for defragmentation process in function <a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87" title="Ends defragmentation process.">vmaEndDefragmentation()</a>. <a href="group__group__alloc.html#gad94034192259c2e34a4d1c5e27810403">More...</a><br /></td></tr>
|
||||
<tr class="separator:gad94034192259c2e34a4d1c5e27810403"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga4753d42d40217a3a652a3cdf253ad773"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="struct_vma_virtual_block_create_info.html">VmaVirtualBlockCreateInfo</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__virtual.html#ga4753d42d40217a3a652a3cdf253ad773">VmaVirtualBlockCreateInfo</a></td></tr>
|
||||
<tr class="memdesc:ga4753d42d40217a3a652a3cdf253ad773"><td class="mdescLeft"> </td><td class="mdescRight">Parameters of created <a class="el" href="struct_vma_virtual_block.html" title="Handle to a virtual block object that allows to use core allocation algorithm without allocating any ...">VmaVirtualBlock</a> object to be passed to <a class="el" href="group__group__virtual.html#gab585754076877265fdae33e5c40ef13b" title="Creates new VmaVirtualBlock object.">vmaCreateVirtualBlock()</a>. <a href="group__group__virtual.html#ga4753d42d40217a3a652a3cdf253ad773">More...</a><br /></td></tr>
|
||||
@ -472,9 +472,9 @@ Functions</h2></td></tr>
|
||||
<tr class="memitem:gac3335566858b45541fa9c0d7a6bbb57e"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__alloc.html#gac3335566858b45541fa9c0d7a6bbb57e">vmaBeginDefragmentation</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, const <a class="el" href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a> *pInfo, <a class="el" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> *pContext)</td></tr>
|
||||
<tr class="memdesc:gac3335566858b45541fa9c0d7a6bbb57e"><td class="mdescLeft"> </td><td class="mdescRight">Begins defragmentation process. <a href="group__group__alloc.html#gac3335566858b45541fa9c0d7a6bbb57e">More...</a><br /></td></tr>
|
||||
<tr class="separator:gac3335566858b45541fa9c0d7a6bbb57e"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga729a594b45ae1681096940a44f3eb174"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174">vmaEndDefragmentation</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context, <a class="el" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a> *pStats)</td></tr>
|
||||
<tr class="memdesc:ga729a594b45ae1681096940a44f3eb174"><td class="mdescLeft"> </td><td class="mdescRight">Ends defragmentation process. <a href="group__group__alloc.html#ga729a594b45ae1681096940a44f3eb174">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga729a594b45ae1681096940a44f3eb174"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga59f01ca3d53d50b7cca9b442b77a3e87"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87">vmaEndDefragmentation</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context, <a class="el" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a> *pStats)</td></tr>
|
||||
<tr class="memdesc:ga59f01ca3d53d50b7cca9b442b77a3e87"><td class="mdescLeft"> </td><td class="mdescRight">Ends defragmentation process. <a href="group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga59f01ca3d53d50b7cca9b442b77a3e87"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ga980d7da2ce3b1fd5c8b8476bc362cc00"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__alloc.html#ga980d7da2ce3b1fd5c8b8476bc362cc00">vmaBeginDefragmentationPass</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context, <a class="el" href="struct_vma_defragmentation_pass_move_info.html">VmaDefragmentationPassMoveInfo</a> *pPassInfo)</td></tr>
|
||||
<tr class="memdesc:ga980d7da2ce3b1fd5c8b8476bc362cc00"><td class="mdescLeft"> </td><td class="mdescRight">Starts single defragmentation pass. <a href="group__group__alloc.html#ga980d7da2ce3b1fd5c8b8476bc362cc00">More...</a><br /></td></tr>
|
||||
<tr class="separator:ga980d7da2ce3b1fd5c8b8476bc362cc00"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
|
@ -426,7 +426,7 @@ typedef enum VmaAllocatorCreateFlagBits
|
||||
|
||||
VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
||||
} VmaAllocatorCreateFlagBits;
|
||||
/// See #VmaAllocatorCreateFlagBigs.
|
||||
/// See #VmaAllocatorCreateFlagBits.
|
||||
typedef VkFlags VmaAllocatorCreateFlags;
|
||||
|
||||
/** @} */
|
||||
@ -1388,7 +1388,7 @@ typedef struct VmaAllocationInfo
|
||||
It can change after call to vmaSetAllocationName() for this allocation.
|
||||
|
||||
Another way to set custom name is to pass it in VmaAllocationCreateInfo::pUserData with
|
||||
additional flag VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT set [DEPRECATED].
|
||||
additional flag #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT set [DEPRECATED].
|
||||
*/
|
||||
const char* VMA_NULLABLE pName;
|
||||
} VmaAllocationInfo;
|
||||
@ -18267,31 +18267,72 @@ for(;;)
|
||||
res = vmaBeginDefragmentationPass(allocator, defragCtx, &pass);
|
||||
if(res == VK_SUCCESS)
|
||||
break;
|
||||
else if(res == VK_INCOMPLETE)
|
||||
{
|
||||
else if(res != VK_INCOMPLETE)
|
||||
// Handle error...
|
||||
|
||||
for(uint32_t i = 0; i < pass.moveCount; ++i)
|
||||
{
|
||||
//- Inspect pass.pMoves[i].srcAllocation, identify what buffer or image it represents.
|
||||
//- Recreate and bind this buffer or image at pass.pMoves[i].dstMemory, pass.pMoves[i].dstOffset.
|
||||
//- Issue a vkCmdCopyBuffer/vkCmdCopyImage to copy its content to the new place.
|
||||
// Inspect pass.pMoves[i].srcAllocation, identify what buffer/image it represents.
|
||||
VmaAllocationInfo allocInfo;
|
||||
vmaGetAllocationInfo(allocator, pMoves[i].srcAllocation, &allocInfo);
|
||||
MyEngineResourceData* resData = (MyEngineResourceData*)allocInfo.pUserData;
|
||||
|
||||
// Recreate and bind this buffer/image at: pass.pMoves[i].dstMemory, pass.pMoves[i].dstOffset.
|
||||
VkImageCreateInfo imgCreateInfo = ...
|
||||
VkImage newImg;
|
||||
res = vkCreateImage(device, &imgCreateInfo, nullptr, &newImg);
|
||||
// Check res...
|
||||
res = vKBindImageMemory(device, newImg, pass.pMoves[i].dstMemory, pass.pMoves[i].dstOffset);
|
||||
// Check res...
|
||||
|
||||
// Issue a vkCmdCopyBuffer/vkCmdCopyImage to copy its content to the new place.
|
||||
vkCmdCopyImage(cmdBuf, resData->img, ..., newImg, ...);
|
||||
}
|
||||
//- Make sure the copy commands finished executing.
|
||||
//- Update appropriate descriptors to point to the new places.
|
||||
|
||||
// Make sure the copy commands finished executing.
|
||||
vkWaitForFences(...);
|
||||
|
||||
// Destroy old buffers/images bound with pass.pMoves[i].srcAllocation.
|
||||
for(uint32_t i = 0; i < pass.moveCount; ++i)
|
||||
{
|
||||
// ...
|
||||
vkDestroyImage(device, resData->img, nullptr);
|
||||
}
|
||||
|
||||
// Update appropriate descriptors to point to the new places...
|
||||
|
||||
res = vmaEndDefragmentationPass(allocator, defragCtx, &pass);
|
||||
if(res == VK_SUCCESS)
|
||||
break;
|
||||
else if(res != VK_INCOMPLETE)
|
||||
// Handle error...
|
||||
}
|
||||
else
|
||||
// Handle error...
|
||||
}
|
||||
|
||||
vmaEndDefragmentation(allocator, defragCtx, nullptr);
|
||||
\endcode
|
||||
|
||||
You can defragment a specific custom pool by setting VmaDefragmentationInfo::pool
|
||||
(like in the example above) or all the default pools by setting this member to null.
|
||||
Although functions like vmaCreateBuffer(), vmaCreateImage(), vmaDestroyBuffer(), vmaDestroyImage()
|
||||
create/destroy an allocation and a buffer/image at once, these are just a shortcut for
|
||||
creating the resource, allocating memory, and binding them together.
|
||||
Defragmentation works on memory allocations only. You must handle the rest manually.
|
||||
Defragmentation is an iterative process that should repreat "passes" as long as related functions
|
||||
return `VK_INCOMPLETE` not `VK_SUCCESS`.
|
||||
In each pass:
|
||||
|
||||
1. vmaBeginDefragmentationPass() function call:
|
||||
- Calculates and returns the list of allocations to be moved in this pass.
|
||||
Note this can be a time-consuming process.
|
||||
- Reserves destination memory for them by creating internal allocations.
|
||||
Returns their `VkDeviceMemory` + offset.
|
||||
2. Inside the pass, **you should**:
|
||||
- Inspect the returned list of allocations to be moved.
|
||||
- Create new buffers/images and bind them at the returned destination `VkDeviceMemory` + offset.
|
||||
- Copy data from source to destination resources if necessary.
|
||||
- Destroy the source buffers/images, but NOT their allocations.
|
||||
3. vmaEndDefragmentationPass() function call:
|
||||
- Frees the source memory reserved for the allocations that are moved.
|
||||
- Modifies #VmaAllocation objects that are moved to point to the destination reserved memory.
|
||||
- Frees `VkDeviceMemory` blocks that became empty.
|
||||
|
||||
Unlike in previous iterations of the defragmentation API, there is no list of "movable" allocations passed as a parameter.
|
||||
Defragmentation algorithm tries to move all suitable allocations.
|
||||
@ -18300,8 +18341,31 @@ You can, however, refuse to move some of them inside a defragmentation pass, by
|
||||
This is not recommended and may result in suboptimal packing of the allocations after defragmentation.
|
||||
If you cannot ensure any allocation can be moved, it is better to keep movable allocations separate in a custom pool.
|
||||
|
||||
You can also decide to destroy an allocation instead of moving it.
|
||||
You should then set `pass.pMoves[i].operation` to #VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY.
|
||||
Inside a pass, for each allocation that should be moved:
|
||||
|
||||
- You should copy its data from the source to the destination place by calling e.g. `vkCmdCopyBuffer()`, `vkCmdCopyImage()`.
|
||||
- You need to make sure these commands finished executing before destroying the source buffers/images and before calling vmaEndDefragmentationPass().
|
||||
- If a resource doesn't contain any meaningful data, e.g. it is a transient color attachment image to be cleared,
|
||||
filled, and used temporarily in each rendering frame, you can just recreate this image
|
||||
without copying its data.
|
||||
- If the resource is in `HOST_VISIBLE` and `HOST_COHERENT` memory, you can copy its data on the CPU
|
||||
using `memcpy()`.
|
||||
- If you cannot move the allocation, you can set `pass.pMoves[i].operation` to #VMA_DEFRAGMENTATION_MOVE_OPERATION_IGNORE.
|
||||
This will cancel the move.
|
||||
- vmaEndDefragmentationPass() will then free the destination memory
|
||||
not the source memory of the allocation, leaving it unchanged.
|
||||
- If you decide the allocation is unimportant and can be destroyed instead of moved (e.g. it wasn't used for long time),
|
||||
you can set `pass.pMoves[i].operation` to #VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY.
|
||||
- vmaEndDefragmentationPass() will then free both source and destination memory, and will destroy the #VmaAllocation object.
|
||||
|
||||
You can defragment a specific custom pool by setting VmaDefragmentationInfo::pool
|
||||
(like in the example above) or all the default pools by setting this member to null.
|
||||
|
||||
Defragmentation is always performed in each pool separately.
|
||||
Allocations are never moved between different Vulkan memory types.
|
||||
The size of the destination memory reserved for a moved allocation is the same as the original one.
|
||||
Alignment of an allocation as it was determined using `vkGetBufferMemoryRequirements()` etc. is also respected after defragmentation.
|
||||
Buffers/images should be recreated with the same `VkBufferCreateInfo` / `VkImageCreateInfo` parameters as the original ones.
|
||||
|
||||
You can perform the defragmentation incrementally to limit the number of allocations and bytes to be moved
|
||||
in each pass, e.g. to call it in sync with render frames and not to experience too big hitches.
|
||||
@ -18385,6 +18449,8 @@ To do that, fill VmaAllocationCreateInfo::pUserData field when creating
|
||||
an allocation. It is 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.
|
||||
It it useful to identify appropriate data structures in your engine given #VmaAllocation,
|
||||
e.g. when doing \ref defragmentation.
|
||||
|
||||
\code
|
||||
VkBufferCreateInfo bufCreateInfo = ...
|
||||
@ -18415,44 +18481,21 @@ 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 a pointer to a null-terminated string.
|
||||
An allocation can also carry a null-terminated string, giving a name to the allocation.
|
||||
To set it, call vmaSetAllocationName().
|
||||
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 = ...
|
||||
|
||||
std::string imageName = "Texture: ";
|
||||
imageName += fileName;
|
||||
|
||||
VmaAllocationCreateInfo allocCreateInfo = {};
|
||||
allocCreateInfo.usage = VMA_MEMORY_USAGE_AUTO;
|
||||
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);
|
||||
vmaSetAllocationName(allocator, allocation, imageName.c_str());
|
||||
\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.
|
||||
The string can be later retrieved by inspecting VmaAllocationInfo::pName.
|
||||
It is also printed in JSON report created by vmaBuildStatsString().
|
||||
|
||||
\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.
|
||||
\note Setting 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.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user