Updated documentation - mentioned VMA_LEAK_LOG_FORMAT

See #437
This commit is contained in:
Adam Sawicki 2024-07-18 11:00:01 +02:00
parent ceb6aeafb0
commit 871913da6a
13 changed files with 152 additions and 96 deletions

View file

@ -106,12 +106,12 @@ GPU-only resource</h1>
<div class="line"><a class="code hl_struct" href="struct_vma_allocation.html">VmaAllocation</a> alloc;</div>
<div class="line"><a class="code hl_function" href="group__group__alloc.html#ga02a94f25679275851a53e82eacbcfc73">vmaCreateImage</a>(allocator, &amp;imgCreateInfo, &amp;allocCreateInfo, &amp;img, &amp;alloc, <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_ggaa5846affa1e9da3800e3e78fae2305cca27cde9026a84d34d525777baa41fce6e"><div class="ttname"><a href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca27cde9026a84d34d525777baa41fce6e">VMA_MEMORY_USAGE_AUTO</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_AUTO</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:527</div></div>
<div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</div><div class="ttdoc">Set this flag if the allocation should have its own memory block.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:566</div></div>
<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdoc">Parameters of new VmaAllocation.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1263</div></div>
<div class="ttc" id="astruct_vma_allocation_create_info_html_a983d39e1a2e63649d78a960aa2fdd0f7"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a983d39e1a2e63649d78a960aa2fdd0f7">VmaAllocationCreateInfo::priority</a></div><div class="ttdeci">float priority</div><div class="ttdoc">A floating-point value between 0 and 1, indicating the priority of the allocation relative to other m...</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1309</div></div>
<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1271</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:1265</div></div>
<div class="ttc" id="agroup__group__alloc_html_ggaa5846affa1e9da3800e3e78fae2305cca27cde9026a84d34d525777baa41fce6e"><div class="ttname"><a href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca27cde9026a84d34d525777baa41fce6e">VMA_MEMORY_USAGE_AUTO</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_AUTO</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:529</div></div>
<div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</div><div class="ttdoc">Set this flag if the allocation should have its own memory block.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:568</div></div>
<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdoc">Parameters of new VmaAllocation.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1265</div></div>
<div class="ttc" id="astruct_vma_allocation_create_info_html_a983d39e1a2e63649d78a960aa2fdd0f7"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a983d39e1a2e63649d78a960aa2fdd0f7">VmaAllocationCreateInfo::priority</a></div><div class="ttdeci">float priority</div><div class="ttdoc">A floating-point value between 0 and 1, indicating the priority of the allocation relative to other m...</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1311</div></div>
<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1273</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:1267</div></div>
<div class="ttc" id="astruct_vma_allocation_html"><div class="ttname"><a href="struct_vma_allocation.html">VmaAllocation</a></div><div class="ttdoc">Represents single memory allocation.</div></div>
</div><!-- fragment --><p><b>Also consider:</b> Consider creating them as dedicated allocations 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>, especially if they are large or if you plan to destroy and recreate them with different sizes e.g. when display resolution changes. Prefer to create such resources first and all other GPU resources (like textures and vertex buffers) later. When VK_EXT_memory_priority extension is enabled, it is also worth setting high priority to such allocation to decrease chances to be evicted to system memory by the operating system.</p>
<h1><a class="anchor" id="usage_patterns_staging_copy_upload"></a>
@ -136,10 +136,10 @@ Staging copy for upload</h1>
<div class="line"> </div>
<div class="line">memcpy(allocInfo.<a class="code hl_variable" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a>, myData, myDataSize);</div>
<div class="ttc" id="agroup__group__alloc_html_gac72ee55598617e8eecca384e746bab51"><div class="ttname"><a href="group__group__alloc.html#gac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a></div><div class="ttdeci">VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">Creates a new VkBuffer, allocates and binds memory for it.</div></div>
<div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_MAPPED_BIT</div><div class="ttdoc">Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:587</div></div>
<div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597a9be224df3bfc1cfa06203aed689a30c5"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a9be224df3bfc1cfa06203aed689a30c5">VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:636</div></div>
<div class="ttc" id="astruct_vma_allocation_info_html"><div class="ttname"><a href="struct_vma_allocation_info.html">VmaAllocationInfo</a></div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1382</div></div>
<div class="ttc" id="astruct_vma_allocation_info_html_a5eeffbe2d2f30f53370ff14aefbadbe2"><div class="ttname"><a href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">VmaAllocationInfo::pMappedData</a></div><div class="ttdeci">void * pMappedData</div><div class="ttdoc">Pointer to the beginning of this allocation as mapped data.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1424</div></div>
<div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_MAPPED_BIT</div><div class="ttdoc">Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:589</div></div>
<div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597a9be224df3bfc1cfa06203aed689a30c5"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a9be224df3bfc1cfa06203aed689a30c5">VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:638</div></div>
<div class="ttc" id="astruct_vma_allocation_info_html"><div class="ttname"><a href="struct_vma_allocation_info.html">VmaAllocationInfo</a></div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1384</div></div>
<div class="ttc" id="astruct_vma_allocation_info_html_a5eeffbe2d2f30f53370ff14aefbadbe2"><div class="ttname"><a href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">VmaAllocationInfo::pMappedData</a></div><div class="ttdeci">void * pMappedData</div><div class="ttdoc">Pointer to the beginning of this allocation as mapped data.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1426</div></div>
</div><!-- fragment --><p><b>Also consider:</b> You can map the allocation using <a class="el" href="group__group__alloc.html#gad5bd1243512d099706de88168992f069" title="Maps memory represented by given allocation and returns pointer to it.">vmaMapMemory()</a> or you can create it as persistenly mapped using <a class="el" href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f" title="Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.">VMA_ALLOCATION_CREATE_MAPPED_BIT</a>, as in the example above.</p>
<h1><a class="anchor" id="usage_patterns_readback"></a>
Readback</h1>
@ -162,7 +162,7 @@ Readback</h1>
<div class="line">...</div>
<div class="line"> </div>
<div class="line">const <span class="keywordtype">float</span>* downloadedData = (<span class="keyword">const</span> <span class="keywordtype">float</span>*)allocInfo.<a class="code hl_variable" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a>;</div>
<div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597add61238d98e20917b9a06c617763f492"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597add61238d98e20917b9a06c617763f492">VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:648</div></div>
<div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597add61238d98e20917b9a06c617763f492"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597add61238d98e20917b9a06c617763f492">VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:650</div></div>
</div><!-- fragment --><h1><a class="anchor" id="usage_patterns_advanced_data_uploading"></a>
Advanced data uploading</h1>
<p>For resources that you frequently write on CPU via mapped pointer and frequently read on GPU e.g. as a uniform buffer (also called "dynamic"), multiple options are possible:</p>
@ -192,7 +192,8 @@ Advanced data uploading</h1>
<div class="line">VkBuffer buf;</div>
<div class="line"><a class="code hl_struct" href="struct_vma_allocation.html">VmaAllocation</a> alloc;</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#gac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(allocator, &amp;bufCreateInfo, &amp;allocCreateInfo, &amp;buf, &amp;alloc, &amp;allocInfo);</div>
<div class="line">VkResult result = <a class="code hl_function" href="group__group__alloc.html#gac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(allocator, &amp;bufCreateInfo, &amp;allocCreateInfo, &amp;buf, &amp;alloc, &amp;allocInfo);</div>
<div class="line"><span class="comment">// Check result...</span></div>
<div class="line"> </div>
<div class="line">VkMemoryPropertyFlags memPropFlags;</div>
<div class="line"><a class="code hl_function" href="group__group__alloc.html#ga571e87dd38e552249b56b1b0b982fad1">vmaGetAllocationMemoryProperties</a>(allocator, alloc, &amp;memPropFlags);</div>
@ -203,10 +204,24 @@ Advanced data uploading</h1>
<div class="line"> </div>
<div class="line"> <span class="comment">// [Executed in runtime]:</span></div>
<div class="line"> memcpy(allocInfo.<a class="code hl_variable" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a>, myData, myDataSize);</div>
<div class="line"> result = <a class="code hl_function" href="group__group__alloc.html#ga30c37c1eec6025f397be41644f48490f">vmaFlushAllocation</a>(allocator, alloc, 0, VK_WHOLE_SIZE);</div>
<div class="line"> <span class="comment">// Check result...</span></div>
<div class="line"> </div>
<div class="line"> VkBufferMemoryBarrier bufMemBarrier = { VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER };</div>
<div class="line"> bufMemBarrier.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT;</div>
<div class="line"> bufMemBarrier.dstAccessMask = VK_ACCESS_UNIFORM_READ_BIT;</div>
<div class="line"> bufMemBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;</div>
<div class="line"> bufMemBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;</div>
<div class="line"> bufMemBarrier.buffer = buf;</div>
<div class="line"> bufMemBarrier.offset = 0;</div>
<div class="line"> bufMemBarrier.size = VK_WHOLE_SIZE;</div>
<div class="line"> </div>
<div class="line"> vkCmdPipelineBarrier(cmdBuf, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT,</div>
<div class="line"> 0, 0, <span class="keyword">nullptr</span>, 1, &amp;bufMemBarrier, 0, <span class="keyword">nullptr</span>);</div>
<div class="line">}</div>
<div class="line"><span class="keywordflow">else</span></div>
<div class="line">{</div>
<div class="line"> <span class="comment">// Allocation ended up in a non-mappable memory - need to transfer.</span></div>
<div class="line"> <span class="comment">// Allocation ended up in a non-mappable memory - a transfer using a staging buffer is required.</span></div>
<div class="line"> VkBufferCreateInfo stagingBufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };</div>
<div class="line"> stagingBufCreateInfo.size = 65536;</div>
<div class="line"> stagingBufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;</div>
@ -219,22 +234,50 @@ Advanced data uploading</h1>
<div class="line"> VkBuffer stagingBuf;</div>
<div class="line"> <a class="code hl_struct" href="struct_vma_allocation.html">VmaAllocation</a> stagingAlloc;</div>
<div class="line"> <a class="code hl_struct" href="struct_vma_allocation_info.html">VmaAllocationInfo</a> stagingAllocInfo;</div>
<div class="line"> <a class="code hl_function" href="group__group__alloc.html#gac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(allocator, &amp;stagingBufCreateInfo, &amp;stagingAllocCreateInfo,</div>
<div class="line"> &amp;stagingBuf, &amp;stagingAlloc, stagingAllocInfo);</div>
<div class="line"> result = <a class="code hl_function" href="group__group__alloc.html#gac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(allocator, &amp;stagingBufCreateInfo, &amp;stagingAllocCreateInfo,</div>
<div class="line"> &amp;stagingBuf, &amp;stagingAlloc, &amp;stagingAllocInfo);</div>
<div class="line"> <span class="comment">// Check result...</span></div>
<div class="line"> </div>
<div class="line"> <span class="comment">// [Executed in runtime]:</span></div>
<div class="line"> memcpy(stagingAllocInfo.<a class="code hl_variable" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a>, myData, myDataSize);</div>
<div class="line"> <a class="code hl_function" href="group__group__alloc.html#ga30c37c1eec6025f397be41644f48490f">vmaFlushAllocation</a>(allocator, stagingAlloc, 0, VK_WHOLE_SIZE);</div>
<div class="line"> <span class="comment">//vkCmdPipelineBarrier: VK_ACCESS_HOST_WRITE_BIT --&gt; VK_ACCESS_TRANSFER_READ_BIT</span></div>
<div class="line"> result = <a class="code hl_function" href="group__group__alloc.html#ga30c37c1eec6025f397be41644f48490f">vmaFlushAllocation</a>(allocator, stagingAlloc, 0, VK_WHOLE_SIZE);</div>
<div class="line"> <span class="comment">// Check result...</span></div>
<div class="line"> </div>
<div class="line"> VkBufferMemoryBarrier bufMemBarrier = { VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER };</div>
<div class="line"> bufMemBarrier.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT;</div>
<div class="line"> bufMemBarrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;</div>
<div class="line"> bufMemBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;</div>
<div class="line"> bufMemBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;</div>
<div class="line"> bufMemBarrier.buffer = stagingBuf;</div>
<div class="line"> bufMemBarrier.offset = 0;</div>
<div class="line"> bufMemBarrier.size = VK_WHOLE_SIZE;</div>
<div class="line"> </div>
<div class="line"> vkCmdPipelineBarrier(cmdBuf, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,</div>
<div class="line"> 0, 0, <span class="keyword">nullptr</span>, 1, &amp;bufMemBarrier, 0, <span class="keyword">nullptr</span>);</div>
<div class="line"> </div>
<div class="line"> VkBufferCopy bufCopy = {</div>
<div class="line"> 0, <span class="comment">// srcOffset</span></div>
<div class="line"> 0, <span class="comment">// dstOffset,</span></div>
<div class="line"> myDataSize); <span class="comment">// size</span></div>
<div class="line"> myDataSize, <span class="comment">// size</span></div>
<div class="line"> };</div>
<div class="line"> </div>
<div class="line"> vkCmdCopyBuffer(cmdBuf, stagingBuf, buf, 1, &amp;bufCopy);</div>
<div class="line"> </div>
<div class="line"> VkBufferMemoryBarrier bufMemBarrier2 = { VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER };</div>
<div class="line"> bufMemBarrier2.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;</div>
<div class="line"> bufMemBarrier2.dstAccessMask = VK_ACCESS_UNIFORM_READ_BIT; <span class="comment">// We created a uniform buffer</span></div>
<div class="line"> bufMemBarrier2.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;</div>
<div class="line"> bufMemBarrier2.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;</div>
<div class="line"> bufMemBarrier2.buffer = buf;</div>
<div class="line"> bufMemBarrier2.offset = 0;</div>
<div class="line"> bufMemBarrier2.size = VK_WHOLE_SIZE;</div>
<div class="line"> </div>
<div class="line"> vkCmdPipelineBarrier(cmdBuf, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT,</div>
<div class="line"> 0, 0, <span class="keyword">nullptr</span>, 1, &amp;bufMemBarrier2, 0, <span class="keyword">nullptr</span>);</div>
<div class="line">}</div>
<div class="ttc" id="agroup__group__alloc_html_ga30c37c1eec6025f397be41644f48490f"><div class="ttname"><a href="group__group__alloc.html#ga30c37c1eec6025f397be41644f48490f">vmaFlushAllocation</a></div><div class="ttdeci">VkResult vmaFlushAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)</div><div class="ttdoc">Flushes memory of given allocation.</div></div>
<div class="ttc" id="agroup__group__alloc_html_ga571e87dd38e552249b56b1b0b982fad1"><div class="ttname"><a href="group__group__alloc.html#ga571e87dd38e552249b56b1b0b982fad1">vmaGetAllocationMemoryProperties</a></div><div class="ttdeci">void vmaGetAllocationMemoryProperties(VmaAllocator allocator, VmaAllocation allocation, VkMemoryPropertyFlags *pFlags)</div><div class="ttdoc">Given an allocation, returns Property Flags of its memory type.</div></div>
<div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597a11337f96eacf34c1016c339eac165cad"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a11337f96eacf34c1016c339eac165cad">VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:660</div></div>
<div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597a11337f96eacf34c1016c339eac165cad"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a11337f96eacf34c1016c339eac165cad">VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:662</div></div>
</div><!-- fragment --><h1><a class="anchor" id="usage_patterns_other_use_cases"></a>
Other use cases</h1>
<p>Here are some other, less obvious use cases and their recommended settings:</p>