blob: ec5240e63e5bed06f53e0c776e74453b64290354 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Vulkan Memory Allocator: vk_mem_alloc.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Vulkan Memory Allocator
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.16 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">vk_mem_alloc.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="vk__mem__alloc_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">// Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved.</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">// Permission is hereby granted, free of charge, to any person obtaining a copy</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment">// of this software and associated documentation files (the &quot;Software&quot;), to deal</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment">// in the Software without restriction, including without limitation the rights</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment">// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment">// copies of the Software, and to permit persons to whom the Software is</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment">// furnished to do so, subject to the following conditions:</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment">// The above copyright notice and this permission notice shall be included in</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment">// all copies or substantial portions of the Software.</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment">// THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment">// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment">// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment">// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="comment">// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="comment">// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="comment">// THE SOFTWARE.</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; </div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor">#ifndef AMD_VULKAN_MEMORY_ALLOCATOR_H</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#define AMD_VULKAN_MEMORY_ALLOCATOR_H</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; </div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; </div>
<div class="line"><a name="l01761"></a><span class="lineno"> 1761</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01762"></a><span class="lineno"> 1762</span>&#160;<span class="comment">Define this macro to 0/1 to disable/enable support for recording functionality,</span></div>
<div class="line"><a name="l01763"></a><span class="lineno"> 1763</span>&#160;<span class="comment">available through VmaAllocatorCreateInfo::pRecordSettings.</span></div>
<div class="line"><a name="l01764"></a><span class="lineno"> 1764</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01765"></a><span class="lineno"> 1765</span>&#160;<span class="preprocessor">#ifndef VMA_RECORDING_ENABLED</span></div>
<div class="line"><a name="l01766"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a1f0c126759fc96ccb6e2d23c101d770c"> 1766</a></span>&#160;<span class="preprocessor"> #define VMA_RECORDING_ENABLED 0</span></div>
<div class="line"><a name="l01767"></a><span class="lineno"> 1767</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01768"></a><span class="lineno"> 1768</span>&#160; </div>
<div class="line"><a name="l01769"></a><span class="lineno"> 1769</span>&#160;<span class="preprocessor">#ifndef NOMINMAX</span></div>
<div class="line"><a name="l01770"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9f918755b601cf4bffca775992e6fb90"> 1770</a></span>&#160;<span class="preprocessor"> #define NOMINMAX // For windows.h</span></div>
<div class="line"><a name="l01771"></a><span class="lineno"> 1771</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01772"></a><span class="lineno"> 1772</span>&#160; </div>
<div class="line"><a name="l01773"></a><span class="lineno"> 1773</span>&#160;<span class="preprocessor">#ifndef VULKAN_H_</span></div>
<div class="line"><a name="l01774"></a><span class="lineno"> 1774</span>&#160;<span class="preprocessor"> #include &lt;vulkan/vulkan.h&gt;</span></div>
<div class="line"><a name="l01775"></a><span class="lineno"> 1775</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01776"></a><span class="lineno"> 1776</span>&#160; </div>
<div class="line"><a name="l01777"></a><span class="lineno"> 1777</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
<div class="line"><a name="l01778"></a><span class="lineno"> 1778</span>&#160;<span class="preprocessor"> #include &lt;windows.h&gt;</span></div>
<div class="line"><a name="l01779"></a><span class="lineno"> 1779</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01780"></a><span class="lineno"> 1780</span>&#160; </div>
<div class="line"><a name="l01781"></a><span class="lineno"> 1781</span>&#160;<span class="comment">// Define this macro to declare maximum supported Vulkan version in format AAABBBCCC,</span></div>
<div class="line"><a name="l01782"></a><span class="lineno"> 1782</span>&#160;<span class="comment">// where AAA = major, BBB = minor, CCC = patch.</span></div>
<div class="line"><a name="l01783"></a><span class="lineno"> 1783</span>&#160;<span class="comment">// If you want to use version &gt; 1.0, it still needs to be enabled via VmaAllocatorCreateInfo::vulkanApiVersion.</span></div>
<div class="line"><a name="l01784"></a><span class="lineno"> 1784</span>&#160;<span class="preprocessor">#if !defined(VMA_VULKAN_VERSION)</span></div>
<div class="line"><a name="l01785"></a><span class="lineno"> 1785</span>&#160;<span class="preprocessor"> #if defined(VK_VERSION_1_1)</span></div>
<div class="line"><a name="l01786"></a><span class="lineno"> 1786</span>&#160;<span class="preprocessor"> #define VMA_VULKAN_VERSION 1001000</span></div>
<div class="line"><a name="l01787"></a><span class="lineno"> 1787</span>&#160;<span class="preprocessor"> #else</span></div>
<div class="line"><a name="l01788"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a1a2407c283893638cc039bb31fcd74b6"> 1788</a></span>&#160;<span class="preprocessor"> #define VMA_VULKAN_VERSION 1000000</span></div>
<div class="line"><a name="l01789"></a><span class="lineno"> 1789</span>&#160;<span class="preprocessor"> #endif</span></div>
<div class="line"><a name="l01790"></a><span class="lineno"> 1790</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01791"></a><span class="lineno"> 1791</span>&#160; </div>
<div class="line"><a name="l01792"></a><span class="lineno"> 1792</span>&#160;<span class="preprocessor">#if !defined(VMA_DEDICATED_ALLOCATION)</span></div>
<div class="line"><a name="l01793"></a><span class="lineno"> 1793</span>&#160;<span class="preprocessor"> #if VK_KHR_get_memory_requirements2 &amp;&amp; VK_KHR_dedicated_allocation</span></div>
<div class="line"><a name="l01794"></a><span class="lineno"> 1794</span>&#160;<span class="preprocessor"> #define VMA_DEDICATED_ALLOCATION 1</span></div>
<div class="line"><a name="l01795"></a><span class="lineno"> 1795</span>&#160;<span class="preprocessor"> #else</span></div>
<div class="line"><a name="l01796"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#af7b860e63b96d11e44ae8587ba06bbf4"> 1796</a></span>&#160;<span class="preprocessor"> #define VMA_DEDICATED_ALLOCATION 0</span></div>
<div class="line"><a name="l01797"></a><span class="lineno"> 1797</span>&#160;<span class="preprocessor"> #endif</span></div>
<div class="line"><a name="l01798"></a><span class="lineno"> 1798</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01799"></a><span class="lineno"> 1799</span>&#160; </div>
<div class="line"><a name="l01800"></a><span class="lineno"> 1800</span>&#160;<span class="preprocessor">#if !defined(VMA_BIND_MEMORY2)</span></div>
<div class="line"><a name="l01801"></a><span class="lineno"> 1801</span>&#160;<span class="preprocessor"> #if VK_KHR_bind_memory2</span></div>
<div class="line"><a name="l01802"></a><span class="lineno"> 1802</span>&#160;<span class="preprocessor"> #define VMA_BIND_MEMORY2 1</span></div>
<div class="line"><a name="l01803"></a><span class="lineno"> 1803</span>&#160;<span class="preprocessor"> #else</span></div>
<div class="line"><a name="l01804"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a88bef97f86d70a34a4c0746e09a2680d"> 1804</a></span>&#160;<span class="preprocessor"> #define VMA_BIND_MEMORY2 0</span></div>
<div class="line"><a name="l01805"></a><span class="lineno"> 1805</span>&#160;<span class="preprocessor"> #endif</span></div>
<div class="line"><a name="l01806"></a><span class="lineno"> 1806</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01807"></a><span class="lineno"> 1807</span>&#160; </div>
<div class="line"><a name="l01808"></a><span class="lineno"> 1808</span>&#160;<span class="preprocessor">#if !defined(VMA_MEMORY_BUDGET)</span></div>
<div class="line"><a name="l01809"></a><span class="lineno"> 1809</span>&#160;<span class="preprocessor"> #if VK_EXT_memory_budget &amp;&amp; (VK_KHR_get_physical_device_properties2 || VMA_VULKAN_VERSION &gt;= 1001000)</span></div>
<div class="line"><a name="l01810"></a><span class="lineno"> 1810</span>&#160;<span class="preprocessor"> #define VMA_MEMORY_BUDGET 1</span></div>
<div class="line"><a name="l01811"></a><span class="lineno"> 1811</span>&#160;<span class="preprocessor"> #else</span></div>
<div class="line"><a name="l01812"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a05decf1cf4ebf767beba7acca6c1ec3a"> 1812</a></span>&#160;<span class="preprocessor"> #define VMA_MEMORY_BUDGET 0</span></div>
<div class="line"><a name="l01813"></a><span class="lineno"> 1813</span>&#160;<span class="preprocessor"> #endif</span></div>
<div class="line"><a name="l01814"></a><span class="lineno"> 1814</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01815"></a><span class="lineno"> 1815</span>&#160; </div>
<div class="line"><a name="l01816"></a><span class="lineno"> 1816</span>&#160;<span class="comment">// Define these macros to decorate all public functions with additional code,</span></div>
<div class="line"><a name="l01817"></a><span class="lineno"> 1817</span>&#160;<span class="comment">// before and after returned type, appropriately. This may be useful for</span></div>
<div class="line"><a name="l01818"></a><span class="lineno"> 1818</span>&#160;<span class="comment">// exporing the functions when compiling VMA as a separate library. Example:</span></div>
<div class="line"><a name="l01819"></a><span class="lineno"> 1819</span>&#160;<span class="comment">// #define VMA_CALL_PRE __declspec(dllexport)</span></div>
<div class="line"><a name="l01820"></a><span class="lineno"> 1820</span>&#160;<span class="comment">// #define VMA_CALL_POST __cdecl</span></div>
<div class="line"><a name="l01821"></a><span class="lineno"> 1821</span>&#160;<span class="preprocessor">#ifndef VMA_CALL_PRE</span></div>
<div class="line"><a name="l01822"></a><span class="lineno"> 1822</span>&#160;<span class="preprocessor"> #define VMA_CALL_PRE</span></div>
<div class="line"><a name="l01823"></a><span class="lineno"> 1823</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01824"></a><span class="lineno"> 1824</span>&#160;<span class="preprocessor">#ifndef VMA_CALL_POST</span></div>
<div class="line"><a name="l01825"></a><span class="lineno"> 1825</span>&#160;<span class="preprocessor"> #define VMA_CALL_POST</span></div>
<div class="line"><a name="l01826"></a><span class="lineno"> 1826</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01827"></a><span class="lineno"> 1827</span>&#160; </div>
<div class="line"><a name="l01837"></a><span class="lineno"> 1837</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a>)</div>
<div class="line"><a name="l01838"></a><span class="lineno"> 1838</span>&#160; </div>
<div class="line"><a name="l01839"></a><span class="lineno"> 1839</span>&#160;<span class="keyword">typedef</span> void (VKAPI_PTR *<a class="code" href="vk__mem__alloc_8h.html#ab6a6477cda1ce775b30bde96d766203b">PFN_vmaAllocateDeviceMemoryFunction</a>)(</div>
<div class="line"><a name="l01841"></a><span class="lineno"> 1841</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l01842"></a><span class="lineno"> 1842</span>&#160; uint32_t memoryType,</div>
<div class="line"><a name="l01843"></a><span class="lineno"> 1843</span>&#160; VkDeviceMemory memory,</div>
<div class="line"><a name="l01844"></a><span class="lineno"> 1844</span>&#160; VkDeviceSize size);</div>
<div class="line"><a name="l01846"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aef2545dc2e9dd4f29ab9ba6ac6fe2f49"> 1846</a></span>&#160;<span class="keyword">typedef</span> void (VKAPI_PTR *<a class="code" href="vk__mem__alloc_8h.html#aef2545dc2e9dd4f29ab9ba6ac6fe2f49">PFN_vmaFreeDeviceMemoryFunction</a>)(</div>
<div class="line"><a name="l01847"></a><span class="lineno"> 1847</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l01848"></a><span class="lineno"> 1848</span>&#160; uint32_t memoryType,</div>
<div class="line"><a name="l01849"></a><span class="lineno"> 1849</span>&#160; VkDeviceMemory memory,</div>
<div class="line"><a name="l01850"></a><span class="lineno"> 1850</span>&#160; VkDeviceSize size);</div>
<div class="line"><a name="l01851"></a><span class="lineno"> 1851</span>&#160; </div>
<div class="line"><a name="l01859"></a><span class="lineno"><a class="line" href="struct_vma_device_memory_callbacks.html"> 1859</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks</a> {</div>
<div class="line"><a name="l01861"></a><span class="lineno"><a class="line" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb"> 1861</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ab6a6477cda1ce775b30bde96d766203b">PFN_vmaAllocateDeviceMemoryFunction</a> <a class="code" href="struct_vma_device_memory_callbacks.html#a4f17f7b255101e733b44d5633aceabfb">pfnAllocate</a>;</div>
<div class="line"><a name="l01863"></a><span class="lineno"><a class="line" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c"> 1863</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#aef2545dc2e9dd4f29ab9ba6ac6fe2f49">PFN_vmaFreeDeviceMemoryFunction</a> <a class="code" href="struct_vma_device_memory_callbacks.html#abe8a3328bbc916f6f712fdb6b299444c">pfnFree</a>;</div>
<div class="line"><a name="l01864"></a><span class="lineno"> 1864</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a5e2eb68d727cfd4df25702b027b7aa31">VmaDeviceMemoryCallbacks</a>;</div>
<div class="line"><a name="l01865"></a><span class="lineno"> 1865</span>&#160; </div>
<div class="line"><a name="l01867"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c"> 1867</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c">VmaAllocatorCreateFlagBits</a> {</div>
<div class="line"><a name="l01872"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d"> 1872</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d">VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT</a> = 0x00000001,</div>
<div class="line"><a name="l01897"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878"> 1897</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a> = 0x00000002,</div>
<div class="line"><a name="l01912"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee"> 1912</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a> = 0x00000004,</div>
<div class="line"><a name="l01924"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0"> 1924</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0">VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT</a> = 0x00000008,</div>
<div class="line"><a name="l01925"></a><span class="lineno"> 1925</span>&#160; </div>
<div class="line"><a name="l01926"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c"> 1926</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c">VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
<div class="line"><a name="l01927"></a><span class="lineno"> 1927</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c">VmaAllocatorCreateFlagBits</a>;</div>
<div class="line"><a name="l01928"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d"> 1928</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d">VmaAllocatorCreateFlags</a>;</div>
<div class="line"><a name="l01929"></a><span class="lineno"> 1929</span>&#160; </div>
<div class="line"><a name="l01934"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html"> 1934</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a> {</div>
<div class="line"><a name="l01935"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a77b7a74082823e865dd6546623468f96"> 1935</a></span>&#160; PFN_vkGetPhysicalDeviceProperties <a class="code" href="struct_vma_vulkan_functions.html#a77b7a74082823e865dd6546623468f96">vkGetPhysicalDeviceProperties</a>;</div>
<div class="line"><a name="l01936"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a60d25c33bba06bb8592e6875cbaa9830"> 1936</a></span>&#160; PFN_vkGetPhysicalDeviceMemoryProperties <a class="code" href="struct_vma_vulkan_functions.html#a60d25c33bba06bb8592e6875cbaa9830">vkGetPhysicalDeviceMemoryProperties</a>;</div>
<div class="line"><a name="l01937"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c"> 1937</a></span>&#160; PFN_vkAllocateMemory <a class="code" href="struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c">vkAllocateMemory</a>;</div>
<div class="line"><a name="l01938"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a4c658701778564d62034255b5dda91b4"> 1938</a></span>&#160; PFN_vkFreeMemory <a class="code" href="struct_vma_vulkan_functions.html#a4c658701778564d62034255b5dda91b4">vkFreeMemory</a>;</div>
<div class="line"><a name="l01939"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#ab5c1f38dea3a2cf00dc9eb4f57218c49"> 1939</a></span>&#160; PFN_vkMapMemory <a class="code" href="struct_vma_vulkan_functions.html#ab5c1f38dea3a2cf00dc9eb4f57218c49">vkMapMemory</a>;</div>
<div class="line"><a name="l01940"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#acc798589736f0becb317fc2196c1d8b9"> 1940</a></span>&#160; PFN_vkUnmapMemory <a class="code" href="struct_vma_vulkan_functions.html#acc798589736f0becb317fc2196c1d8b9">vkUnmapMemory</a>;</div>
<div class="line"><a name="l01941"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a33c322f4c4ad2810f8a9c97a277572f9"> 1941</a></span>&#160; PFN_vkFlushMappedMemoryRanges <a class="code" href="struct_vma_vulkan_functions.html#a33c322f4c4ad2810f8a9c97a277572f9">vkFlushMappedMemoryRanges</a>;</div>
<div class="line"><a name="l01942"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a5c1093bc32386a8060c37c9f282078a1"> 1942</a></span>&#160; PFN_vkInvalidateMappedMemoryRanges <a class="code" href="struct_vma_vulkan_functions.html#a5c1093bc32386a8060c37c9f282078a1">vkInvalidateMappedMemoryRanges</a>;</div>
<div class="line"><a name="l01943"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2"> 1943</a></span>&#160; PFN_vkBindBufferMemory <a class="code" href="struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2">vkBindBufferMemory</a>;</div>
<div class="line"><a name="l01944"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a1338d96a128a5ade648b8d934907c637"> 1944</a></span>&#160; PFN_vkBindImageMemory <a class="code" href="struct_vma_vulkan_functions.html#a1338d96a128a5ade648b8d934907c637">vkBindImageMemory</a>;</div>
<div class="line"><a name="l01945"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a5b92901df89a4194b0d12f6071d4d143"> 1945</a></span>&#160; PFN_vkGetBufferMemoryRequirements <a class="code" href="struct_vma_vulkan_functions.html#a5b92901df89a4194b0d12f6071d4d143">vkGetBufferMemoryRequirements</a>;</div>
<div class="line"><a name="l01946"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a475f6f49f8debe4d10800592606d53f4"> 1946</a></span>&#160; PFN_vkGetImageMemoryRequirements <a class="code" href="struct_vma_vulkan_functions.html#a475f6f49f8debe4d10800592606d53f4">vkGetImageMemoryRequirements</a>;</div>
<div class="line"><a name="l01947"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#ae8084315a25006271a2edfc3a447519f"> 1947</a></span>&#160; PFN_vkCreateBuffer <a class="code" href="struct_vma_vulkan_functions.html#ae8084315a25006271a2edfc3a447519f">vkCreateBuffer</a>;</div>
<div class="line"><a name="l01948"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a7e054606faddb07f0e8556f3ed317d45"> 1948</a></span>&#160; PFN_vkDestroyBuffer <a class="code" href="struct_vma_vulkan_functions.html#a7e054606faddb07f0e8556f3ed317d45">vkDestroyBuffer</a>;</div>
<div class="line"><a name="l01949"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a23ebe70be515b9b5010a1d691200e325"> 1949</a></span>&#160; PFN_vkCreateImage <a class="code" href="struct_vma_vulkan_functions.html#a23ebe70be515b9b5010a1d691200e325">vkCreateImage</a>;</div>
<div class="line"><a name="l01950"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#a90b898227039b1dcb3520f6e91f09ffa"> 1950</a></span>&#160; PFN_vkDestroyImage <a class="code" href="struct_vma_vulkan_functions.html#a90b898227039b1dcb3520f6e91f09ffa">vkDestroyImage</a>;</div>
<div class="line"><a name="l01951"></a><span class="lineno"><a class="line" href="struct_vma_vulkan_functions.html#ae5c0db8c89a3b82593dc16aa6a49fa3a"> 1951</a></span>&#160; PFN_vkCmdCopyBuffer <a class="code" href="struct_vma_vulkan_functions.html#ae5c0db8c89a3b82593dc16aa6a49fa3a">vkCmdCopyBuffer</a>;</div>
<div class="line"><a name="l01952"></a><span class="lineno"> 1952</span>&#160;<span class="preprocessor">#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
<div class="line"><a name="l01953"></a><span class="lineno"> 1953</span>&#160; PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR;</div>
<div class="line"><a name="l01954"></a><span class="lineno"> 1954</span>&#160; PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2KHR;</div>
<div class="line"><a name="l01955"></a><span class="lineno"> 1955</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01956"></a><span class="lineno"> 1956</span>&#160;<span class="preprocessor">#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
<div class="line"><a name="l01957"></a><span class="lineno"> 1957</span>&#160; PFN_vkBindBufferMemory2KHR vkBindBufferMemory2KHR;</div>
<div class="line"><a name="l01958"></a><span class="lineno"> 1958</span>&#160; PFN_vkBindImageMemory2KHR vkBindImageMemory2KHR;</div>
<div class="line"><a name="l01959"></a><span class="lineno"> 1959</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01960"></a><span class="lineno"> 1960</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION &gt;= 1001000</span></div>
<div class="line"><a name="l01961"></a><span class="lineno"> 1961</span>&#160; PFN_vkGetPhysicalDeviceMemoryProperties2KHR vkGetPhysicalDeviceMemoryProperties2KHR;</div>
<div class="line"><a name="l01962"></a><span class="lineno"> 1962</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01963"></a><span class="lineno"> 1963</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a97064a1a271b0061ebfc3a079862d0c5">VmaVulkanFunctions</a>;</div>
<div class="line"><a name="l01964"></a><span class="lineno"> 1964</span>&#160; </div>
<div class="line"><a name="l01966"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2"> 1966</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2">VmaRecordFlagBits</a> {</div>
<div class="line"><a name="l01972"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7"> 1972</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a8e7ab322e8732654be627c4ea8f36cc7">VMA_RECORD_FLUSH_AFTER_CALL_BIT</a> = 0x00000001,</div>
<div class="line"><a name="l01973"></a><span class="lineno"> 1973</span>&#160; </div>
<div class="line"><a name="l01974"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e"> 1974</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2a20dd17d69966dbffa054739d6090b85e">VMA_RECORD_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
<div class="line"><a name="l01975"></a><span class="lineno"> 1975</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2">VmaRecordFlagBits</a>;</div>
<div class="line"><a name="l01976"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828"> 1976</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828">VmaRecordFlags</a>;</div>
<div class="line"><a name="l01977"></a><span class="lineno"> 1977</span>&#160; </div>
<div class="line"><a name="l01979"></a><span class="lineno"><a class="line" href="struct_vma_record_settings.html"> 1979</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_record_settings.html">VmaRecordSettings</a></div>
<div class="line"><a name="l01980"></a><span class="lineno"> 1980</span>&#160;{</div>
<div class="line"><a name="l01982"></a><span class="lineno"><a class="line" href="struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a"> 1982</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828">VmaRecordFlags</a> <a class="code" href="struct_vma_record_settings.html#ad8fdcc92119ae7a8c08c1a564c01d63a">flags</a>;</div>
<div class="line"><a name="l01990"></a><span class="lineno"><a class="line" href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d"> 1990</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="struct_vma_record_settings.html#a6cb1fdbf6bcb610b68f2010dd629e89d">pFilePath</a>;</div>
<div class="line"><a name="l01991"></a><span class="lineno"> 1991</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a0ab61e87ff6365f1d59915eadc37a9f0">VmaRecordSettings</a>;</div>
<div class="line"><a name="l01992"></a><span class="lineno"> 1992</span>&#160; </div>
<div class="line"><a name="l01994"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html"> 1994</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a></div>
<div class="line"><a name="l01995"></a><span class="lineno"> 1995</span>&#160;{</div>
<div class="line"><a name="l01997"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346"> 1997</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d">VmaAllocatorCreateFlags</a> <a class="code" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346">flags</a>;</div>
<div class="line"><a name="l01999"></a><span class="lineno"> 1999</span>&#160; </div>
<div class="line"><a name="l02000"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156"> 2000</a></span>&#160; VkPhysicalDevice <a class="code" href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156">physicalDevice</a>;</div>
<div class="line"><a name="l02002"></a><span class="lineno"> 2002</span>&#160; </div>
<div class="line"><a name="l02003"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500"> 2003</a></span>&#160; VkDevice <a class="code" href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500">device</a>;</div>
<div class="line"><a name="l02005"></a><span class="lineno"> 2005</span>&#160; </div>
<div class="line"><a name="l02006"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a"> 2006</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_allocator_create_info.html#a8e4714298e3121cdd8b214a1ae7a637a">preferredLargeHeapBlockSize</a>;</div>
<div class="line"><a name="l02008"></a><span class="lineno"> 2008</span>&#160; </div>
<div class="line"><a name="l02009"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d"> 2009</a></span>&#160; <span class="keyword">const</span> VkAllocationCallbacks* <a class="code" href="struct_vma_allocator_create_info.html#a6e409087e3be55400d0e4ccbe43c608d">pAllocationCallbacks</a>;</div>
<div class="line"><a name="l02011"></a><span class="lineno"> 2011</span>&#160; </div>
<div class="line"><a name="l02012"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e"> 2012</a></span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks</a>* <a class="code" href="struct_vma_allocator_create_info.html#af1380969b5e1ea4c3184a877892d260e">pDeviceMemoryCallbacks</a>;</div>
<div class="line"><a name="l02026"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7"> 2026</a></span>&#160; uint32_t <a class="code" href="struct_vma_allocator_create_info.html#a21ea188dd212b8171cb9ecbed4a2a3a7">frameInUseCount</a>;</div>
<div class="line"><a name="l02051"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b"> 2051</a></span>&#160; <span class="keyword">const</span> VkDeviceSize* <a class="code" href="struct_vma_allocator_create_info.html#a31c192aa6cbffa33279f6d9f0c47c44b">pHeapSizeLimit</a>;</div>
<div class="line"><a name="l02063"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd"> 2063</a></span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* <a class="code" href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd">pVulkanFunctions</a>;</div>
<div class="line"><a name="l02070"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee"> 2070</a></span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_record_settings.html">VmaRecordSettings</a>* <a class="code" href="struct_vma_allocator_create_info.html#ace2aa4877b16a42b0b7673d4e26000ee">pRecordSettings</a>;</div>
<div class="line"><a name="l02076"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b"> 2076</a></span>&#160; VkInstance <a class="code" href="struct_vma_allocator_create_info.html#a70dd42e29b1df1d1b9b61532ae0b370b">instance</a>;</div>
<div class="line"><a name="l02085"></a><span class="lineno"><a class="line" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285"> 2085</a></span>&#160; uint32_t <a class="code" href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">vulkanApiVersion</a>;</div>
<div class="line"><a name="l02086"></a><span class="lineno"> 2086</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ae0f6d1d733dded220d28134da46b4283">VmaAllocatorCreateInfo</a>;</div>
<div class="line"><a name="l02087"></a><span class="lineno"> 2087</span>&#160; </div>
<div class="line"><a name="l02089"></a><span class="lineno"> 2089</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb">vmaCreateAllocator</a>(</div>
<div class="line"><a name="l02090"></a><span class="lineno"> 2090</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo,</div>
<div class="line"><a name="l02091"></a><span class="lineno"> 2091</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a>* pAllocator);</div>
<div class="line"><a name="l02092"></a><span class="lineno"> 2092</span>&#160; </div>
<div class="line"><a name="l02094"></a><span class="lineno"> 2094</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa8d164061c88f22fb1fd3c8f3534bc1d">vmaDestroyAllocator</a>(</div>
<div class="line"><a name="l02095"></a><span class="lineno"> 2095</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator);</div>
<div class="line"><a name="l02096"></a><span class="lineno"> 2096</span>&#160; </div>
<div class="line"><a name="l02101"></a><span class="lineno"> 2101</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0">vmaGetPhysicalDeviceProperties</a>(</div>
<div class="line"><a name="l02102"></a><span class="lineno"> 2102</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02103"></a><span class="lineno"> 2103</span>&#160; <span class="keyword">const</span> VkPhysicalDeviceProperties** ppPhysicalDeviceProperties);</div>
<div class="line"><a name="l02104"></a><span class="lineno"> 2104</span>&#160; </div>
<div class="line"><a name="l02109"></a><span class="lineno"> 2109</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19">vmaGetMemoryProperties</a>(</div>
<div class="line"><a name="l02110"></a><span class="lineno"> 2110</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02111"></a><span class="lineno"> 2111</span>&#160; <span class="keyword">const</span> VkPhysicalDeviceMemoryProperties** ppPhysicalDeviceMemoryProperties);</div>
<div class="line"><a name="l02112"></a><span class="lineno"> 2112</span>&#160; </div>
<div class="line"><a name="l02119"></a><span class="lineno"> 2119</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca">vmaGetMemoryTypeProperties</a>(</div>
<div class="line"><a name="l02120"></a><span class="lineno"> 2120</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02121"></a><span class="lineno"> 2121</span>&#160; uint32_t memoryTypeIndex,</div>
<div class="line"><a name="l02122"></a><span class="lineno"> 2122</span>&#160; VkMemoryPropertyFlags* pFlags);</div>
<div class="line"><a name="l02123"></a><span class="lineno"> 2123</span>&#160; </div>
<div class="line"><a name="l02132"></a><span class="lineno"> 2132</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236">vmaSetCurrentFrameIndex</a>(</div>
<div class="line"><a name="l02133"></a><span class="lineno"> 2133</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02134"></a><span class="lineno"> 2134</span>&#160; uint32_t frameIndex);</div>
<div class="line"><a name="l02135"></a><span class="lineno"> 2135</span>&#160; </div>
<div class="line"><a name="l02138"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html"> 2138</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a></div>
<div class="line"><a name="l02139"></a><span class="lineno"> 2139</span>&#160;{</div>
<div class="line"><a name="l02141"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4"> 2141</a></span>&#160; uint32_t <a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a>;</div>
<div class="line"><a name="l02143"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff"> 2143</a></span>&#160; uint32_t <a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a>;</div>
<div class="line"><a name="l02145"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9"> 2145</a></span>&#160; uint32_t <a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a>;</div>
<div class="line"><a name="l02147"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a"> 2147</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a>;</div>
<div class="line"><a name="l02149"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669"> 2149</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a>;</div>
<div class="line"><a name="l02150"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea"> 2150</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a>, <a class="code" href="struct_vma_stat_info.html#a1081a039964e566c672e7a2347f9e599">allocationSizeAvg</a>, <a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a>;</div>
<div class="line"><a name="l02151"></a><span class="lineno"><a class="line" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4"> 2151</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a>, <a class="code" href="struct_vma_stat_info.html#a2f9b3452af90c9768a30b7fb6ae194fc">unusedRangeSizeAvg</a>, <a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a>;</div>
<div class="line"><a name="l02152"></a><span class="lineno"> 2152</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a810b009a788ee8aac72a25b42ffbe31c">VmaStatInfo</a>;</div>
<div class="line"><a name="l02153"></a><span class="lineno"> 2153</span>&#160; </div>
<div class="line"><a name="l02155"></a><span class="lineno"><a class="line" href="struct_vma_stats.html"> 2155</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_stats.html">VmaStats</a></div>
<div class="line"><a name="l02156"></a><span class="lineno"> 2156</span>&#160;{</div>
<div class="line"><a name="l02157"></a><span class="lineno"><a class="line" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331"> 2157</a></span>&#160; <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> <a class="code" href="struct_vma_stats.html#a13e3caf754be79352c42408756309331">memoryType</a>[VK_MAX_MEMORY_TYPES];</div>
<div class="line"><a name="l02158"></a><span class="lineno"><a class="line" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0"> 2158</a></span>&#160; <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> <a class="code" href="struct_vma_stats.html#a0e6611508c29a187f0fd14ff1a0329c0">memoryHeap</a>[VK_MAX_MEMORY_HEAPS];</div>
<div class="line"><a name="l02159"></a><span class="lineno"><a class="line" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9"> 2159</a></span>&#160; <a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a> <a class="code" href="struct_vma_stats.html#a2e8f5b3353f2fefef3c27f29e245a1f9">total</a>;</div>
<div class="line"><a name="l02160"></a><span class="lineno"> 2160</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a732be855fb4a7c248e6853d928a729af">VmaStats</a>;</div>
<div class="line"><a name="l02161"></a><span class="lineno"> 2161</span>&#160; </div>
<div class="line"><a name="l02171"></a><span class="lineno"> 2171</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3">vmaCalculateStats</a>(</div>
<div class="line"><a name="l02172"></a><span class="lineno"> 2172</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02173"></a><span class="lineno"> 2173</span>&#160; <a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats);</div>
<div class="line"><a name="l02174"></a><span class="lineno"> 2174</span>&#160; </div>
<div class="line"><a name="l02177"></a><span class="lineno"><a class="line" href="struct_vma_budget.html"> 2177</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_budget.html">VmaBudget</a></div>
<div class="line"><a name="l02178"></a><span class="lineno"> 2178</span>&#160;{</div>
<div class="line"><a name="l02181"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0"> 2181</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_budget.html#a58b492901baab685f466199124e514a0">blockBytes</a>;</div>
<div class="line"><a name="l02182"></a><span class="lineno"> 2182</span>&#160; </div>
<div class="line"><a name="l02192"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8"> 2192</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_budget.html#a7e2a6583ebd63e194951c542563804d8">allocationBytes</a>;</div>
<div class="line"><a name="l02193"></a><span class="lineno"> 2193</span>&#160; </div>
<div class="line"><a name="l02202"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6"> 2202</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_budget.html#a84dd1ecca8b0110259eb206dbadb11f6">usage</a>;</div>
<div class="line"><a name="l02203"></a><span class="lineno"> 2203</span>&#160; </div>
<div class="line"><a name="l02213"></a><span class="lineno"><a class="line" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd"> 2213</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_budget.html#ab82e1d1754c2d210d0bdf90220bc6cdd">budget</a>;</div>
<div class="line"><a name="l02214"></a><span class="lineno"> 2214</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ab79b48b6d25aada0de91a913896e1c38">VmaBudget</a>;</div>
<div class="line"><a name="l02215"></a><span class="lineno"> 2215</span>&#160; </div>
<div class="line"><a name="l02226"></a><span class="lineno"> 2226</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba">vmaGetBudget</a>(</div>
<div class="line"><a name="l02227"></a><span class="lineno"> 2227</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02228"></a><span class="lineno"> 2228</span>&#160; <a class="code" href="struct_vma_budget.html">VmaBudget</a>* pBudget);</div>
<div class="line"><a name="l02229"></a><span class="lineno"> 2229</span>&#160; </div>
<div class="line"><a name="l02230"></a><span class="lineno"> 2230</span>&#160;<span class="preprocessor">#ifndef VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l02231"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ae25f0d55fd91cb166f002b63244800e1"> 2231</a></span>&#160;<span class="preprocessor">#define VMA_STATS_STRING_ENABLED 1</span></div>
<div class="line"><a name="l02232"></a><span class="lineno"> 2232</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l02233"></a><span class="lineno"> 2233</span>&#160; </div>
<div class="line"><a name="l02234"></a><span class="lineno"> 2234</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l02235"></a><span class="lineno"> 2235</span>&#160; </div>
<div class="line"><a name="l02237"></a><span class="lineno"> 2237</span>&#160; </div>
<div class="line"><a name="l02239"></a><span class="lineno"> 2239</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0">vmaBuildStatsString</a>(</div>
<div class="line"><a name="l02240"></a><span class="lineno"> 2240</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02241"></a><span class="lineno"> 2241</span>&#160; <span class="keywordtype">char</span>** ppStatsString,</div>
<div class="line"><a name="l02242"></a><span class="lineno"> 2242</span>&#160; VkBool32 detailedMap);</div>
<div class="line"><a name="l02243"></a><span class="lineno"> 2243</span>&#160; </div>
<div class="line"><a name="l02244"></a><span class="lineno"> 2244</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288">vmaFreeStatsString</a>(</div>
<div class="line"><a name="l02245"></a><span class="lineno"> 2245</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02246"></a><span class="lineno"> 2246</span>&#160; <span class="keywordtype">char</span>* pStatsString);</div>
<div class="line"><a name="l02247"></a><span class="lineno"> 2247</span>&#160; </div>
<div class="line"><a name="l02248"></a><span class="lineno"> 2248</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l02249"></a><span class="lineno"> 2249</span>&#160; </div>
<div class="line"><a name="l02258"></a><span class="lineno"> 2258</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_pool.html">VmaPool</a>)</div>
<div class="line"><a name="l02259"></a><span class="lineno"> 2259</span>&#160; </div>
<div class="line"><a name="l02260"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc"> 2260</a></span>&#160;typedef enum <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a></div>
<div class="line"><a name="l02261"></a><span class="lineno"> 2261</span>&#160;{</div>
<div class="line"><a name="l02265"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd"> 2265</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd">VMA_MEMORY_USAGE_UNKNOWN</a> = 0,</div>
<div class="line"><a name="l02282"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"> 2282</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a> = 1,</div>
<div class="line"><a name="l02292"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5"> 2292</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a> = 2,</div>
<div class="line"><a name="l02299"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67"> 2299</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67">VMA_MEMORY_USAGE_CPU_TO_GPU</a> = 3,</div>
<div class="line"><a name="l02308"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27"> 2308</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27">VMA_MEMORY_USAGE_GPU_TO_CPU</a> = 4,</div>
<div class="line"><a name="l02314"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500"> 2314</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500">VMA_MEMORY_USAGE_CPU_COPY</a> = 5,</div>
<div class="line"><a name="l02322"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d"> 2322</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d">VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED</a> = 6,</div>
<div class="line"><a name="l02323"></a><span class="lineno"> 2323</span>&#160; </div>
<div class="line"><a name="l02324"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e"> 2324</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e">VMA_MEMORY_USAGE_MAX_ENUM</a> = 0x7FFFFFFF</div>
<div class="line"><a name="l02325"></a><span class="lineno"> 2325</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a>;</div>
<div class="line"><a name="l02326"></a><span class="lineno"> 2326</span>&#160; </div>
<div class="line"><a name="l02328"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597"> 2328</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597">VmaAllocationCreateFlagBits</a> {</div>
<div class="line"><a name="l02335"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f"> 2335</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a> = 0x00000001,</div>
<div class="line"><a name="l02336"></a><span class="lineno"> 2336</span>&#160; </div>
<div class="line"><a name="l02346"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff"> 2346</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a> = 0x00000002,</div>
<div class="line"><a name="l02359"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f"> 2359</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f">VMA_ALLOCATION_CREATE_MAPPED_BIT</a> = 0x00000004,</div>
<div class="line"><a name="l02372"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2"> 2372</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a> = 0x00000008,</div>
<div class="line"><a name="l02379"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e"> 2379</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a> = 0x00000010,</div>
<div class="line"><a name="l02385"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520"> 2385</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520">VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT</a> = 0x00000020,</div>
<div class="line"><a name="l02390"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df"> 2390</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a> = 0x00000040,</div>
<div class="line"><a name="l02396"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea"> 2396</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea">VMA_ALLOCATION_CREATE_DONT_BIND_BIT</a> = 0x00000080,</div>
<div class="line"><a name="l02400"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d"> 2400</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d">VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT</a> = 0x00000100,</div>
<div class="line"><a name="l02401"></a><span class="lineno"> 2401</span>&#160; </div>
<div class="line"><a name="l02405"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d"> 2405</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a> = 0x00010000,</div>
<div class="line"><a name="l02409"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62"> 2409</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a> = 0x00020000,</div>
<div class="line"><a name="l02416"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777"> 2416</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a> = 0x00040000,</div>
<div class="line"><a name="l02417"></a><span class="lineno"> 2417</span>&#160; </div>
<div class="line"><a name="l02420"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d"> 2420</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT</a> = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a>,</div>
<div class="line"><a name="l02423"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d"> 2423</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d">VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT</a> = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>,</div>
<div class="line"><a name="l02426"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706"> 2426</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a621b704103eb3360230c860acf36e706">VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT</a> = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a>,</div>
<div class="line"><a name="l02427"></a><span class="lineno"> 2427</span>&#160; </div>
<div class="line"><a name="l02430"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e"> 2430</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e">VMA_ALLOCATION_CREATE_STRATEGY_MASK</a> =</div>
<div class="line"><a name="l02431"></a><span class="lineno"> 2431</span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d">VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT</a> |</div>
<div class="line"><a name="l02432"></a><span class="lineno"> 2432</span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ad242a04f802e25fef0b880afe8bb0a62">VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT</a> |</div>
<div class="line"><a name="l02433"></a><span class="lineno"> 2433</span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777">VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT</a>,</div>
<div class="line"><a name="l02434"></a><span class="lineno"> 2434</span>&#160; </div>
<div class="line"><a name="l02435"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882"> 2435</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882">VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
<div class="line"><a name="l02436"></a><span class="lineno"> 2436</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597">VmaAllocationCreateFlagBits</a>;</div>
<div class="line"><a name="l02437"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817"> 2437</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a>;</div>
<div class="line"><a name="l02438"></a><span class="lineno"> 2438</span>&#160; </div>
<div class="line"><a name="l02439"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html"> 2439</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div>
<div class="line"><a name="l02440"></a><span class="lineno"> 2440</span>&#160;{</div>
<div class="line"><a name="l02442"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b"> 2442</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> <a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a>;</div>
<div class="line"><a name="l02448"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910"> 2448</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">VmaMemoryUsage</a> <a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a>;</div>
<div class="line"><a name="l02453"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90"> 2453</a></span>&#160; VkMemoryPropertyFlags <a class="code" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90">requiredFlags</a>;</div>
<div class="line"><a name="l02458"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d"> 2458</a></span>&#160; VkMemoryPropertyFlags <a class="code" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d">preferredFlags</a>;</div>
<div class="line"><a name="l02466"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055"> 2466</a></span>&#160; uint32_t <a class="code" href="struct_vma_allocation_create_info.html#a3bf940c0271d85d6ba32a4d820075055">memoryTypeBits</a>;</div>
<div class="line"><a name="l02472"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150"> 2472</a></span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> <a class="code" href="struct_vma_allocation_create_info.html#a6272c0555cfd1fe28bff1afeb6190150">pool</a>;</div>
<div class="line"><a name="l02479"></a><span class="lineno"><a class="line" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19"> 2479</a></span>&#160; <span class="keywordtype">void</span>* <a class="code" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">pUserData</a>;</div>
<div class="line"><a name="l02480"></a><span class="lineno"> 2480</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a86c44f9950b40d50088ed93a17870a7a">VmaAllocationCreateInfo</a>;</div>
<div class="line"><a name="l02481"></a><span class="lineno"> 2481</span>&#160; </div>
<div class="line"><a name="l02498"></a><span class="lineno"> 2498</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a>(</div>
<div class="line"><a name="l02499"></a><span class="lineno"> 2499</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02500"></a><span class="lineno"> 2500</span>&#160; uint32_t memoryTypeBits,</div>
<div class="line"><a name="l02501"></a><span class="lineno"> 2501</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
<div class="line"><a name="l02502"></a><span class="lineno"> 2502</span>&#160; uint32_t* pMemoryTypeIndex);</div>
<div class="line"><a name="l02503"></a><span class="lineno"> 2503</span>&#160; </div>
<div class="line"><a name="l02516"></a><span class="lineno"> 2516</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888">vmaFindMemoryTypeIndexForBufferInfo</a>(</div>
<div class="line"><a name="l02517"></a><span class="lineno"> 2517</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02518"></a><span class="lineno"> 2518</span>&#160; <span class="keyword">const</span> VkBufferCreateInfo* pBufferCreateInfo,</div>
<div class="line"><a name="l02519"></a><span class="lineno"> 2519</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
<div class="line"><a name="l02520"></a><span class="lineno"> 2520</span>&#160; uint32_t* pMemoryTypeIndex);</div>
<div class="line"><a name="l02521"></a><span class="lineno"> 2521</span>&#160; </div>
<div class="line"><a name="l02534"></a><span class="lineno"> 2534</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472">vmaFindMemoryTypeIndexForImageInfo</a>(</div>
<div class="line"><a name="l02535"></a><span class="lineno"> 2535</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02536"></a><span class="lineno"> 2536</span>&#160; <span class="keyword">const</span> VkImageCreateInfo* pImageCreateInfo,</div>
<div class="line"><a name="l02537"></a><span class="lineno"> 2537</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
<div class="line"><a name="l02538"></a><span class="lineno"> 2538</span>&#160; uint32_t* pMemoryTypeIndex);</div>
<div class="line"><a name="l02539"></a><span class="lineno"> 2539</span>&#160; </div>
<div class="line"><a name="l02541"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7"> 2541</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7">VmaPoolCreateFlagBits</a> {</div>
<div class="line"><a name="l02559"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2"> 2559</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2">VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT</a> = 0x00000002,</div>
<div class="line"><a name="l02560"></a><span class="lineno"> 2560</span>&#160; </div>
<div class="line"><a name="l02576"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726"> 2576</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a> = 0x00000004,</div>
<div class="line"><a name="l02577"></a><span class="lineno"> 2577</span>&#160; </div>
<div class="line"><a name="l02587"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e"> 2587</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a> = 0x00000008,</div>
<div class="line"><a name="l02588"></a><span class="lineno"> 2588</span>&#160; </div>
<div class="line"><a name="l02591"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c"> 2591</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c">VMA_POOL_CREATE_ALGORITHM_MASK</a> =</div>
<div class="line"><a name="l02592"></a><span class="lineno"> 2592</span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a> |</div>
<div class="line"><a name="l02593"></a><span class="lineno"> 2593</span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a>,</div>
<div class="line"><a name="l02594"></a><span class="lineno"> 2594</span>&#160; </div>
<div class="line"><a name="l02595"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec"> 2595</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec">VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
<div class="line"><a name="l02596"></a><span class="lineno"> 2596</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7">VmaPoolCreateFlagBits</a>;</div>
<div class="line"><a name="l02597"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a"> 2597</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a">VmaPoolCreateFlags</a>;</div>
<div class="line"><a name="l02598"></a><span class="lineno"> 2598</span>&#160; </div>
<div class="line"><a name="l02601"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html"> 2601</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a> {</div>
<div class="line"><a name="l02604"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319"> 2604</a></span>&#160; uint32_t <a class="code" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319">memoryTypeIndex</a>;</div>
<div class="line"><a name="l02607"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446"> 2607</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a">VmaPoolCreateFlags</a> <a class="code" href="struct_vma_pool_create_info.html#a8405139f63d078340ae74513a59f5446">flags</a>;</div>
<div class="line"><a name="l02616"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676"> 2616</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676">blockSize</a>;</div>
<div class="line"><a name="l02621"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae"> 2621</a></span>&#160; <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae">minBlockCount</a>;</div>
<div class="line"><a name="l02629"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c"> 2629</a></span>&#160; <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c">maxBlockCount</a>;</div>
<div class="line"><a name="l02643"></a><span class="lineno"><a class="line" href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa"> 2643</a></span>&#160; uint32_t <a class="code" href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa">frameInUseCount</a>;</div>
<div class="line"><a name="l02644"></a><span class="lineno"> 2644</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a211706e9348dcee25a843ed4ea69bce7">VmaPoolCreateInfo</a>;</div>
<div class="line"><a name="l02645"></a><span class="lineno"> 2645</span>&#160; </div>
<div class="line"><a name="l02648"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html"> 2648</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a> {</div>
<div class="line"><a name="l02651"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c"> 2651</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a>;</div>
<div class="line"><a name="l02654"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8"> 2654</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a>;</div>
<div class="line"><a name="l02657"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb"> 2657</a></span>&#160; <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a>;</div>
<div class="line"><a name="l02660"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4"> 2660</a></span>&#160; <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a>;</div>
<div class="line"><a name="l02667"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b"> 2667</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a>;</div>
<div class="line"><a name="l02670"></a><span class="lineno"><a class="line" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7"> 2670</a></span>&#160; <span class="keywordtype">size_t</span> <a class="code" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7">blockCount</a>;</div>
<div class="line"><a name="l02671"></a><span class="lineno"> 2671</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a2e5612d871d64c5624087b837a338c34">VmaPoolStats</a>;</div>
<div class="line"><a name="l02672"></a><span class="lineno"> 2672</span>&#160; </div>
<div class="line"><a name="l02679"></a><span class="lineno"> 2679</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5c8770ded7c59c8caac6de0c2cb00b50">vmaCreatePool</a>(</div>
<div class="line"><a name="l02680"></a><span class="lineno"> 2680</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02681"></a><span class="lineno"> 2681</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>* pCreateInfo,</div>
<div class="line"><a name="l02682"></a><span class="lineno"> 2682</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPool);</div>
<div class="line"><a name="l02683"></a><span class="lineno"> 2683</span>&#160; </div>
<div class="line"><a name="l02686"></a><span class="lineno"> 2686</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a5485779c8f1948238fc4e92232fa65e1">vmaDestroyPool</a>(</div>
<div class="line"><a name="l02687"></a><span class="lineno"> 2687</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02688"></a><span class="lineno"> 2688</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
<div class="line"><a name="l02689"></a><span class="lineno"> 2689</span>&#160; </div>
<div class="line"><a name="l02696"></a><span class="lineno"> 2696</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153">vmaGetPoolStats</a>(</div>
<div class="line"><a name="l02697"></a><span class="lineno"> 2697</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02698"></a><span class="lineno"> 2698</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
<div class="line"><a name="l02699"></a><span class="lineno"> 2699</span>&#160; <a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pPoolStats);</div>
<div class="line"><a name="l02700"></a><span class="lineno"> 2700</span>&#160; </div>
<div class="line"><a name="l02707"></a><span class="lineno"> 2707</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024">vmaMakePoolAllocationsLost</a>(</div>
<div class="line"><a name="l02708"></a><span class="lineno"> 2708</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02709"></a><span class="lineno"> 2709</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
<div class="line"><a name="l02710"></a><span class="lineno"> 2710</span>&#160; <span class="keywordtype">size_t</span>* pLostAllocationCount);</div>
<div class="line"><a name="l02711"></a><span class="lineno"> 2711</span>&#160; </div>
<div class="line"><a name="l02726"></a><span class="lineno"> 2726</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad535935619c7a549bf837e1bb0068f89">vmaCheckPoolCorruption</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
<div class="line"><a name="l02727"></a><span class="lineno"> 2727</span>&#160; </div>
<div class="line"><a name="l02734"></a><span class="lineno"> 2734</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030">vmaGetPoolName</a>(</div>
<div class="line"><a name="l02735"></a><span class="lineno"> 2735</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02736"></a><span class="lineno"> 2736</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
<div class="line"><a name="l02737"></a><span class="lineno"> 2737</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>** ppName);</div>
<div class="line"><a name="l02738"></a><span class="lineno"> 2738</span>&#160; </div>
<div class="line"><a name="l02744"></a><span class="lineno"> 2744</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58">vmaSetPoolName</a>(</div>
<div class="line"><a name="l02745"></a><span class="lineno"> 2745</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02746"></a><span class="lineno"> 2746</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
<div class="line"><a name="l02747"></a><span class="lineno"> 2747</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* pName);</div>
<div class="line"><a name="l02748"></a><span class="lineno"> 2748</span>&#160; </div>
<div class="line"><a name="l02773"></a><span class="lineno"> 2773</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>)</div>
<div class="line"><a name="l02774"></a><span class="lineno"> 2774</span>&#160; </div>
<div class="line"><a name="l02775"></a><span class="lineno"> 2775</span>&#160; </div>
<div class="line"><a name="l02777"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html"> 2777</a></span>&#160;typedef struct <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a> {</div>
<div class="line"><a name="l02782"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5"> 2782</a></span>&#160; uint32_t <a class="code" href="struct_vma_allocation_info.html#a7f6b0aa58c135e488e6b40a388dad9d5">memoryType</a>;</div>
<div class="line"><a name="l02791"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67"> 2791</a></span>&#160; VkDeviceMemory <a class="code" href="struct_vma_allocation_info.html#ae0bfb7dfdf79a76ffefc9a94677a2f67">deviceMemory</a>;</div>
<div class="line"><a name="l02796"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268"> 2796</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268">offset</a>;</div>
<div class="line"><a name="l02801"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f"> 2801</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f">size</a>;</div>
<div class="line"><a name="l02810"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2"> 2810</a></span>&#160; <span class="keywordtype">void</span>* <a class="code" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2">pMappedData</a>;</div>
<div class="line"><a name="l02815"></a><span class="lineno"><a class="line" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13"> 2815</a></span>&#160; <span class="keywordtype">void</span>* <a class="code" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a>;</div>
<div class="line"><a name="l02816"></a><span class="lineno"> 2816</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a795e6ff02a21d5486c0565f403dd9255">VmaAllocationInfo</a>;</div>
<div class="line"><a name="l02817"></a><span class="lineno"> 2817</span>&#160; </div>
<div class="line"><a name="l02828"></a><span class="lineno"> 2828</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8">vmaAllocateMemory</a>(</div>
<div class="line"><a name="l02829"></a><span class="lineno"> 2829</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02830"></a><span class="lineno"> 2830</span>&#160; <span class="keyword">const</span> VkMemoryRequirements* pVkMemoryRequirements,</div>
<div class="line"><a name="l02831"></a><span class="lineno"> 2831</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
<div class="line"><a name="l02832"></a><span class="lineno"> 2832</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
<div class="line"><a name="l02833"></a><span class="lineno"> 2833</span>&#160; <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo);</div>
<div class="line"><a name="l02834"></a><span class="lineno"> 2834</span>&#160; </div>
<div class="line"><a name="l02854"></a><span class="lineno"> 2854</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad37e82e492b3de38fc3f4cffd9ad0ae1">vmaAllocateMemoryPages</a>(</div>
<div class="line"><a name="l02855"></a><span class="lineno"> 2855</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02856"></a><span class="lineno"> 2856</span>&#160; <span class="keyword">const</span> VkMemoryRequirements* pVkMemoryRequirements,</div>
<div class="line"><a name="l02857"></a><span class="lineno"> 2857</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
<div class="line"><a name="l02858"></a><span class="lineno"> 2858</span>&#160; <span class="keywordtype">size_t</span> allocationCount,</div>
<div class="line"><a name="l02859"></a><span class="lineno"> 2859</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations,</div>
<div class="line"><a name="l02860"></a><span class="lineno"> 2860</span>&#160; <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo);</div>
<div class="line"><a name="l02861"></a><span class="lineno"> 2861</span>&#160; </div>
<div class="line"><a name="l02868"></a><span class="lineno"> 2868</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer</a>(</div>
<div class="line"><a name="l02869"></a><span class="lineno"> 2869</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02870"></a><span class="lineno"> 2870</span>&#160; VkBuffer buffer,</div>
<div class="line"><a name="l02871"></a><span class="lineno"> 2871</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
<div class="line"><a name="l02872"></a><span class="lineno"> 2872</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
<div class="line"><a name="l02873"></a><span class="lineno"> 2873</span>&#160; <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo);</div>
<div class="line"><a name="l02874"></a><span class="lineno"> 2874</span>&#160; </div>
<div class="line"><a name="l02876"></a><span class="lineno"> 2876</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb">vmaAllocateMemoryForImage</a>(</div>
<div class="line"><a name="l02877"></a><span class="lineno"> 2877</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02878"></a><span class="lineno"> 2878</span>&#160; VkImage image,</div>
<div class="line"><a name="l02879"></a><span class="lineno"> 2879</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pCreateInfo,</div>
<div class="line"><a name="l02880"></a><span class="lineno"> 2880</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
<div class="line"><a name="l02881"></a><span class="lineno"> 2881</span>&#160; <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo);</div>
<div class="line"><a name="l02882"></a><span class="lineno"> 2882</span>&#160; </div>
<div class="line"><a name="l02887"></a><span class="lineno"> 2887</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568">vmaFreeMemory</a>(</div>
<div class="line"><a name="l02888"></a><span class="lineno"> 2888</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02889"></a><span class="lineno"> 2889</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l02890"></a><span class="lineno"> 2890</span>&#160; </div>
<div class="line"><a name="l02901"></a><span class="lineno"> 2901</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ab9e709de044c5d8476bea77a4e755840">vmaFreeMemoryPages</a>(</div>
<div class="line"><a name="l02902"></a><span class="lineno"> 2902</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02903"></a><span class="lineno"> 2903</span>&#160; <span class="keywordtype">size_t</span> allocationCount,</div>
<div class="line"><a name="l02904"></a><span class="lineno"> 2904</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
<div class="line"><a name="l02905"></a><span class="lineno"> 2905</span>&#160; </div>
<div class="line"><a name="l02912"></a><span class="lineno"> 2912</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0ff488958ca72b28e545880463cb8696">vmaResizeAllocation</a>(</div>
<div class="line"><a name="l02913"></a><span class="lineno"> 2913</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02914"></a><span class="lineno"> 2914</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
<div class="line"><a name="l02915"></a><span class="lineno"> 2915</span>&#160; VkDeviceSize newSize);</div>
<div class="line"><a name="l02916"></a><span class="lineno"> 2916</span>&#160; </div>
<div class="line"><a name="l02933"></a><span class="lineno"> 2933</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a>(</div>
<div class="line"><a name="l02934"></a><span class="lineno"> 2934</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02935"></a><span class="lineno"> 2935</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
<div class="line"><a name="l02936"></a><span class="lineno"> 2936</span>&#160; <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo);</div>
<div class="line"><a name="l02937"></a><span class="lineno"> 2937</span>&#160; </div>
<div class="line"><a name="l02952"></a><span class="lineno"> 2952</span>&#160;VMA_CALL_PRE VkBool32 VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a">vmaTouchAllocation</a>(</div>
<div class="line"><a name="l02953"></a><span class="lineno"> 2953</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02954"></a><span class="lineno"> 2954</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l02955"></a><span class="lineno"> 2955</span>&#160; </div>
<div class="line"><a name="l02969"></a><span class="lineno"> 2969</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f">vmaSetAllocationUserData</a>(</div>
<div class="line"><a name="l02970"></a><span class="lineno"> 2970</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02971"></a><span class="lineno"> 2971</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
<div class="line"><a name="l02972"></a><span class="lineno"> 2972</span>&#160; <span class="keywordtype">void</span>* pUserData);</div>
<div class="line"><a name="l02973"></a><span class="lineno"> 2973</span>&#160; </div>
<div class="line"><a name="l02984"></a><span class="lineno"> 2984</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae5c9657d9e94756269145b01c05d16f1">vmaCreateLostAllocation</a>(</div>
<div class="line"><a name="l02985"></a><span class="lineno"> 2985</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l02986"></a><span class="lineno"> 2986</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
<div class="line"><a name="l02987"></a><span class="lineno"> 2987</span>&#160; </div>
<div class="line"><a name="l03026"></a><span class="lineno"> 3026</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069">vmaMapMemory</a>(</div>
<div class="line"><a name="l03027"></a><span class="lineno"> 3027</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03028"></a><span class="lineno"> 3028</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
<div class="line"><a name="l03029"></a><span class="lineno"> 3029</span>&#160; <span class="keywordtype">void</span>** ppData);</div>
<div class="line"><a name="l03030"></a><span class="lineno"> 3030</span>&#160; </div>
<div class="line"><a name="l03039"></a><span class="lineno"> 3039</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45">vmaUnmapMemory</a>(</div>
<div class="line"><a name="l03040"></a><span class="lineno"> 3040</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03041"></a><span class="lineno"> 3041</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l03042"></a><span class="lineno"> 3042</span>&#160; </div>
<div class="line"><a name="l03061"></a><span class="lineno"> 3061</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#abc34ee6f021f459aff885f3758c435de">vmaFlushAllocation</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size);</div>
<div class="line"><a name="l03062"></a><span class="lineno"> 3062</span>&#160; </div>
<div class="line"><a name="l03081"></a><span class="lineno"> 3081</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0d0eb0c1102268fa9a476d12ecbe4006">vmaInvalidateAllocation</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size);</div>
<div class="line"><a name="l03082"></a><span class="lineno"> 3082</span>&#160; </div>
<div class="line"><a name="l03099"></a><span class="lineno"> 3099</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98">vmaCheckCorruption</a>(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator, uint32_t memoryTypeBits);</div>
<div class="line"><a name="l03100"></a><span class="lineno"> 3100</span>&#160; </div>
<div class="line"><a name="l03107"></a><span class="lineno"> 3107</span>&#160;VK_DEFINE_HANDLE(<a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a>)</div>
<div class="line"><a name="l03108"></a><span class="lineno"> 3108</span>&#160; </div>
<div class="line"><a name="l03109"></a><span class="lineno"> 3109</span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50c">VmaDefragmentationFlagBits</a> {</div>
<div class="line"><a name="l03111"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97"> 3111</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97">VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF</div>
<div class="line"><a name="l03112"></a><span class="lineno"> 3112</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50c">VmaDefragmentationFlagBits</a>;</div>
<div class="line"><a name="l03113"></a><span class="lineno"><a class="line" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d"> 3113</a></span>&#160;<span class="keyword">typedef</span> VkFlags <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a>;</div>
<div class="line"><a name="l03114"></a><span class="lineno"> 3114</span>&#160; </div>
<div class="line"><a name="l03119"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html"> 3119</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a> {</div>
<div class="line"><a name="l03122"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9"> 3122</a></span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d">VmaDefragmentationFlags</a> <a class="code" href="struct_vma_defragmentation_info2.html#a53e844ee5633e229cf6daf14b2d9fff9">flags</a>;</div>
<div class="line"><a name="l03125"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba"> 3125</a></span>&#160; uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a3cf86ab32c1da779b4923d301a3056ba">allocationCount</a>;</div>
<div class="line"><a name="l03134"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a8943f8d65969ce8e2189a1cdf3205e96"> 3134</a></span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* <a class="code" href="struct_vma_defragmentation_info2.html#a8943f8d65969ce8e2189a1cdf3205e96">pAllocations</a>;</div>
<div class="line"><a name="l03140"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc"> 3140</a></span>&#160; VkBool32* <a class="code" href="struct_vma_defragmentation_info2.html#a76d51a644dc7f5405d0cdd0025ecd0cc">pAllocationsChanged</a>;</div>
<div class="line"><a name="l03143"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d"> 3143</a></span>&#160; uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a7e70aa2a1081d849dcc7829b19d3ec9d">poolCount</a>;</div>
<div class="line"><a name="l03159"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a0b3effd57f3fcdeb2ed62210b4ef20e1"> 3159</a></span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a>* <a class="code" href="struct_vma_defragmentation_info2.html#a0b3effd57f3fcdeb2ed62210b4ef20e1">pPools</a>;</div>
<div class="line"><a name="l03164"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a"> 3164</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_defragmentation_info2.html#af78e1ea40c22d85137b65f6b384a4d0a">maxCpuBytesToMove</a>;</div>
<div class="line"><a name="l03169"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671"> 3169</a></span>&#160; uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a94c2c7223d52878445a8cccce396b671">maxCpuAllocationsToMove</a>;</div>
<div class="line"><a name="l03174"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08"> 3174</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_defragmentation_info2.html#a4ddbc898d0afe1518f863a3763628f08">maxGpuBytesToMove</a>;</div>
<div class="line"><a name="l03179"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6"> 3179</a></span>&#160; uint32_t <a class="code" href="struct_vma_defragmentation_info2.html#a40d53d33e71ba0b66f844ed63c05a3f6">maxGpuAllocationsToMove</a>;</div>
<div class="line"><a name="l03188"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd"> 3188</a></span>&#160; VkCommandBuffer <a class="code" href="struct_vma_defragmentation_info2.html#a7f71f39590c5316771493d2333f9c1bd">commandBuffer</a>;</div>
<div class="line"><a name="l03189"></a><span class="lineno"> 3189</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#abac0e85abaa6ea1ffd63bde29c5c3a29">VmaDefragmentationInfo2</a>;</div>
<div class="line"><a name="l03190"></a><span class="lineno"> 3190</span>&#160; </div>
<div class="line"><a name="l03195"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info.html"> 3195</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a> {</div>
<div class="line"><a name="l03200"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d"> 3200</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_defragmentation_info.html#acb311c940a777270e67e1b81c5ab6a1d">maxBytesToMove</a>;</div>
<div class="line"><a name="l03205"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc"> 3205</a></span>&#160; uint32_t <a class="code" href="struct_vma_defragmentation_info.html#aa7c7304e13c71f604c907196c4e28fbc">maxAllocationsToMove</a>;</div>
<div class="line"><a name="l03206"></a><span class="lineno"> 3206</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ae67f8573a0cf20f16f0a1eecbca566a0">VmaDefragmentationInfo</a>;</div>
<div class="line"><a name="l03207"></a><span class="lineno"> 3207</span>&#160; </div>
<div class="line"><a name="l03209"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html"> 3209</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a> {</div>
<div class="line"><a name="l03211"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d"> 3211</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d">bytesMoved</a>;</div>
<div class="line"><a name="l03213"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28"> 3213</a></span>&#160; VkDeviceSize <a class="code" href="struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28">bytesFreed</a>;</div>
<div class="line"><a name="l03215"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9"> 3215</a></span>&#160; uint32_t <a class="code" href="struct_vma_defragmentation_stats.html#aefeabf130022008eadd75999478af3f9">allocationsMoved</a>;</div>
<div class="line"><a name="l03217"></a><span class="lineno"><a class="line" href="struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b"> 3217</a></span>&#160; uint32_t <a class="code" href="struct_vma_defragmentation_stats.html#a0113f1877904a5d1ee8f409216ff276b">deviceMemoryBlocksFreed</a>;</div>
<div class="line"><a name="l03218"></a><span class="lineno"> 3218</span>&#160;} <a class="code" href="vk__mem__alloc_8h.html#ab0f9b06441c840fee560de4a2967f8c9">VmaDefragmentationStats</a>;</div>
<div class="line"><a name="l03219"></a><span class="lineno"> 3219</span>&#160; </div>
<div class="line"><a name="l03249"></a><span class="lineno"> 3249</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a36ba776fd7fd5cb1e9359fdc0d8e6e8a">vmaDefragmentationBegin</a>(</div>
<div class="line"><a name="l03250"></a><span class="lineno"> 3250</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03251"></a><span class="lineno"> 3251</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>* pInfo,</div>
<div class="line"><a name="l03252"></a><span class="lineno"> 3252</span>&#160; <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats,</div>
<div class="line"><a name="l03253"></a><span class="lineno"> 3253</span>&#160; <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> *pContext);</div>
<div class="line"><a name="l03254"></a><span class="lineno"> 3254</span>&#160; </div>
<div class="line"><a name="l03260"></a><span class="lineno"> 3260</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a8774e20e91e245aae959ba63efa15dd2">vmaDefragmentationEnd</a>(</div>
<div class="line"><a name="l03261"></a><span class="lineno"> 3261</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03262"></a><span class="lineno"> 3262</span>&#160; <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context);</div>
<div class="line"><a name="l03263"></a><span class="lineno"> 3263</span>&#160; </div>
<div class="line"><a name="l03304"></a><span class="lineno"> 3304</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a6aced90fcc7b39882b6654a740a0b9bb">vmaDefragment</a>(</div>
<div class="line"><a name="l03305"></a><span class="lineno"> 3305</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03306"></a><span class="lineno"> 3306</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations,</div>
<div class="line"><a name="l03307"></a><span class="lineno"> 3307</span>&#160; <span class="keywordtype">size_t</span> allocationCount,</div>
<div class="line"><a name="l03308"></a><span class="lineno"> 3308</span>&#160; VkBool32* pAllocationsChanged,</div>
<div class="line"><a name="l03309"></a><span class="lineno"> 3309</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info.html">VmaDefragmentationInfo</a> *pDefragmentationInfo,</div>
<div class="line"><a name="l03310"></a><span class="lineno"> 3310</span>&#160; <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pDefragmentationStats);</div>
<div class="line"><a name="l03311"></a><span class="lineno"> 3311</span>&#160; </div>
<div class="line"><a name="l03324"></a><span class="lineno"> 3324</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470">vmaBindBufferMemory</a>(</div>
<div class="line"><a name="l03325"></a><span class="lineno"> 3325</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03326"></a><span class="lineno"> 3326</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
<div class="line"><a name="l03327"></a><span class="lineno"> 3327</span>&#160; VkBuffer buffer);</div>
<div class="line"><a name="l03328"></a><span class="lineno"> 3328</span>&#160; </div>
<div class="line"><a name="l03339"></a><span class="lineno"> 3339</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a">vmaBindBufferMemory2</a>(</div>
<div class="line"><a name="l03340"></a><span class="lineno"> 3340</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03341"></a><span class="lineno"> 3341</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
<div class="line"><a name="l03342"></a><span class="lineno"> 3342</span>&#160; VkDeviceSize allocationLocalOffset,</div>
<div class="line"><a name="l03343"></a><span class="lineno"> 3343</span>&#160; VkBuffer buffer,</div>
<div class="line"><a name="l03344"></a><span class="lineno"> 3344</span>&#160; <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
<div class="line"><a name="l03345"></a><span class="lineno"> 3345</span>&#160; </div>
<div class="line"><a name="l03358"></a><span class="lineno"> 3358</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5">vmaBindImageMemory</a>(</div>
<div class="line"><a name="l03359"></a><span class="lineno"> 3359</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03360"></a><span class="lineno"> 3360</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
<div class="line"><a name="l03361"></a><span class="lineno"> 3361</span>&#160; VkImage image);</div>
<div class="line"><a name="l03362"></a><span class="lineno"> 3362</span>&#160; </div>
<div class="line"><a name="l03373"></a><span class="lineno"> 3373</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc">vmaBindImageMemory2</a>(</div>
<div class="line"><a name="l03374"></a><span class="lineno"> 3374</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03375"></a><span class="lineno"> 3375</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
<div class="line"><a name="l03376"></a><span class="lineno"> 3376</span>&#160; VkDeviceSize allocationLocalOffset,</div>
<div class="line"><a name="l03377"></a><span class="lineno"> 3377</span>&#160; VkImage image,</div>
<div class="line"><a name="l03378"></a><span class="lineno"> 3378</span>&#160; <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
<div class="line"><a name="l03379"></a><span class="lineno"> 3379</span>&#160; </div>
<div class="line"><a name="l03406"></a><span class="lineno"> 3406</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(</div>
<div class="line"><a name="l03407"></a><span class="lineno"> 3407</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03408"></a><span class="lineno"> 3408</span>&#160; <span class="keyword">const</span> VkBufferCreateInfo* pBufferCreateInfo,</div>
<div class="line"><a name="l03409"></a><span class="lineno"> 3409</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
<div class="line"><a name="l03410"></a><span class="lineno"> 3410</span>&#160; VkBuffer* pBuffer,</div>
<div class="line"><a name="l03411"></a><span class="lineno"> 3411</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
<div class="line"><a name="l03412"></a><span class="lineno"> 3412</span>&#160; <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo);</div>
<div class="line"><a name="l03413"></a><span class="lineno"> 3413</span>&#160; </div>
<div class="line"><a name="l03425"></a><span class="lineno"> 3425</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a>(</div>
<div class="line"><a name="l03426"></a><span class="lineno"> 3426</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03427"></a><span class="lineno"> 3427</span>&#160; VkBuffer buffer,</div>
<div class="line"><a name="l03428"></a><span class="lineno"> 3428</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l03429"></a><span class="lineno"> 3429</span>&#160; </div>
<div class="line"><a name="l03431"></a><span class="lineno"> 3431</span>&#160;VMA_CALL_PRE VkResult VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73">vmaCreateImage</a>(</div>
<div class="line"><a name="l03432"></a><span class="lineno"> 3432</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03433"></a><span class="lineno"> 3433</span>&#160; <span class="keyword">const</span> VkImageCreateInfo* pImageCreateInfo,</div>
<div class="line"><a name="l03434"></a><span class="lineno"> 3434</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>* pAllocationCreateInfo,</div>
<div class="line"><a name="l03435"></a><span class="lineno"> 3435</span>&#160; VkImage* pImage,</div>
<div class="line"><a name="l03436"></a><span class="lineno"> 3436</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation,</div>
<div class="line"><a name="l03437"></a><span class="lineno"> 3437</span>&#160; <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo);</div>
<div class="line"><a name="l03438"></a><span class="lineno"> 3438</span>&#160; </div>
<div class="line"><a name="l03450"></a><span class="lineno"> 3450</span>&#160;VMA_CALL_PRE <span class="keywordtype">void</span> VMA_CALL_POST <a class="code" href="vk__mem__alloc_8h.html#ae50d2cb3b4a3bfd4dd40987234e50e7e">vmaDestroyImage</a>(</div>
<div class="line"><a name="l03451"></a><span class="lineno"> 3451</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator,</div>
<div class="line"><a name="l03452"></a><span class="lineno"> 3452</span>&#160; VkImage image,</div>
<div class="line"><a name="l03453"></a><span class="lineno"> 3453</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l03454"></a><span class="lineno"> 3454</span>&#160; </div>
<div class="line"><a name="l03455"></a><span class="lineno"> 3455</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a name="l03456"></a><span class="lineno"> 3456</span>&#160;}</div>
<div class="line"><a name="l03457"></a><span class="lineno"> 3457</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03458"></a><span class="lineno"> 3458</span>&#160; </div>
<div class="line"><a name="l03459"></a><span class="lineno"> 3459</span>&#160;<span class="preprocessor">#endif // AMD_VULKAN_MEMORY_ALLOCATOR_H</span></div>
<div class="line"><a name="l03460"></a><span class="lineno"> 3460</span>&#160; </div>
<div class="line"><a name="l03461"></a><span class="lineno"> 3461</span>&#160;<span class="comment">// For Visual Studio IntelliSense.</span></div>
<div class="line"><a name="l03462"></a><span class="lineno"> 3462</span>&#160;<span class="preprocessor">#if defined(__cplusplus) &amp;&amp; defined(__INTELLISENSE__)</span></div>
<div class="line"><a name="l03463"></a><span class="lineno"> 3463</span>&#160;<span class="preprocessor">#define VMA_IMPLEMENTATION</span></div>
<div class="line"><a name="l03464"></a><span class="lineno"> 3464</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03465"></a><span class="lineno"> 3465</span>&#160; </div>
<div class="line"><a name="l03466"></a><span class="lineno"> 3466</span>&#160;<span class="preprocessor">#ifdef VMA_IMPLEMENTATION</span></div>
<div class="line"><a name="l03467"></a><span class="lineno"> 3467</span>&#160;<span class="preprocessor">#undef VMA_IMPLEMENTATION</span></div>
<div class="line"><a name="l03468"></a><span class="lineno"> 3468</span>&#160; </div>
<div class="line"><a name="l03469"></a><span class="lineno"> 3469</span>&#160;<span class="preprocessor">#include &lt;cstdint&gt;</span></div>
<div class="line"><a name="l03470"></a><span class="lineno"> 3470</span>&#160;<span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
<div class="line"><a name="l03471"></a><span class="lineno"> 3471</span>&#160;<span class="preprocessor">#include &lt;cstring&gt;</span></div>
<div class="line"><a name="l03472"></a><span class="lineno"> 3472</span>&#160; </div>
<div class="line"><a name="l03473"></a><span class="lineno"> 3473</span>&#160;<span class="comment">/*******************************************************************************</span></div>
<div class="line"><a name="l03474"></a><span class="lineno"> 3474</span>&#160;<span class="comment">CONFIGURATION SECTION</span></div>
<div class="line"><a name="l03475"></a><span class="lineno"> 3475</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l03476"></a><span class="lineno"> 3476</span>&#160;<span class="comment">Define some of these macros before each #include of this header or change them</span></div>
<div class="line"><a name="l03477"></a><span class="lineno"> 3477</span>&#160;<span class="comment">here if you need other then default behavior depending on your environment.</span></div>
<div class="line"><a name="l03478"></a><span class="lineno"> 3478</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l03479"></a><span class="lineno"> 3479</span>&#160; </div>
<div class="line"><a name="l03480"></a><span class="lineno"> 3480</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l03481"></a><span class="lineno"> 3481</span>&#160;<span class="comment">Define this macro to 1 to make the library fetch pointers to Vulkan functions</span></div>
<div class="line"><a name="l03482"></a><span class="lineno"> 3482</span>&#160;<span class="comment">internally, like:</span></div>
<div class="line"><a name="l03483"></a><span class="lineno"> 3483</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l03484"></a><span class="lineno"> 3484</span>&#160;<span class="comment"> vulkanFunctions.vkAllocateMemory = &amp;vkAllocateMemory;</span></div>
<div class="line"><a name="l03485"></a><span class="lineno"> 3485</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l03486"></a><span class="lineno"> 3486</span>&#160;<span class="comment">Define to 0 if you are going to provide you own pointers to Vulkan functions via</span></div>
<div class="line"><a name="l03487"></a><span class="lineno"> 3487</span>&#160;<span class="comment">VmaAllocatorCreateInfo::pVulkanFunctions.</span></div>
<div class="line"><a name="l03488"></a><span class="lineno"> 3488</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l03489"></a><span class="lineno"> 3489</span>&#160;<span class="preprocessor">#if !defined(VMA_STATIC_VULKAN_FUNCTIONS) &amp;&amp; !defined(VK_NO_PROTOTYPES)</span></div>
<div class="line"><a name="l03490"></a><span class="lineno"> 3490</span>&#160;<span class="preprocessor">#define VMA_STATIC_VULKAN_FUNCTIONS 1</span></div>
<div class="line"><a name="l03491"></a><span class="lineno"> 3491</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03492"></a><span class="lineno"> 3492</span>&#160; </div>
<div class="line"><a name="l03493"></a><span class="lineno"> 3493</span>&#160;<span class="comment">// Define this macro to 1 to make the library use STL containers instead of its own implementation.</span></div>
<div class="line"><a name="l03494"></a><span class="lineno"> 3494</span>&#160;<span class="comment">//#define VMA_USE_STL_CONTAINERS 1</span></div>
<div class="line"><a name="l03495"></a><span class="lineno"> 3495</span>&#160; </div>
<div class="line"><a name="l03496"></a><span class="lineno"> 3496</span>&#160;<span class="comment">/* Set this macro to 1 to make the library including and using STL containers:</span></div>
<div class="line"><a name="l03497"></a><span class="lineno"> 3497</span>&#160;<span class="comment">std::pair, std::vector, std::list, std::unordered_map.</span></div>
<div class="line"><a name="l03498"></a><span class="lineno"> 3498</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l03499"></a><span class="lineno"> 3499</span>&#160;<span class="comment">Set it to 0 or undefined to make the library using its own implementation of</span></div>
<div class="line"><a name="l03500"></a><span class="lineno"> 3500</span>&#160;<span class="comment">the containers.</span></div>
<div class="line"><a name="l03501"></a><span class="lineno"> 3501</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l03502"></a><span class="lineno"> 3502</span>&#160;<span class="preprocessor">#if VMA_USE_STL_CONTAINERS</span></div>
<div class="line"><a name="l03503"></a><span class="lineno"> 3503</span>&#160;<span class="preprocessor"> #define VMA_USE_STL_VECTOR 1</span></div>
<div class="line"><a name="l03504"></a><span class="lineno"> 3504</span>&#160;<span class="preprocessor"> #define VMA_USE_STL_UNORDERED_MAP 1</span></div>
<div class="line"><a name="l03505"></a><span class="lineno"> 3505</span>&#160;<span class="preprocessor"> #define VMA_USE_STL_LIST 1</span></div>
<div class="line"><a name="l03506"></a><span class="lineno"> 3506</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03507"></a><span class="lineno"> 3507</span>&#160; </div>
<div class="line"><a name="l03508"></a><span class="lineno"> 3508</span>&#160;<span class="preprocessor">#ifndef VMA_USE_STL_SHARED_MUTEX</span></div>
<div class="line"><a name="l03509"></a><span class="lineno"> 3509</span>&#160; <span class="comment">// Compiler conforms to C++17.</span></div>
<div class="line"><a name="l03510"></a><span class="lineno"> 3510</span>&#160;<span class="preprocessor"> #if __cplusplus &gt;= 201703L</span></div>
<div class="line"><a name="l03511"></a><span class="lineno"> 3511</span>&#160;<span class="preprocessor"> #define VMA_USE_STL_SHARED_MUTEX 1</span></div>
<div class="line"><a name="l03512"></a><span class="lineno"> 3512</span>&#160; <span class="comment">// Visual studio defines __cplusplus properly only when passed additional parameter: /Zc:__cplusplus</span></div>
<div class="line"><a name="l03513"></a><span class="lineno"> 3513</span>&#160; <span class="comment">// Otherwise it&#39;s always 199711L, despite shared_mutex works since Visual Studio 2015 Update 2.</span></div>
<div class="line"><a name="l03514"></a><span class="lineno"> 3514</span>&#160; <span class="comment">// See: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/</span></div>
<div class="line"><a name="l03515"></a><span class="lineno"> 3515</span>&#160;<span class="preprocessor"> #elif defined(_MSC_FULL_VER) &amp;&amp; _MSC_FULL_VER &gt;= 190023918 &amp;&amp; __cplusplus == 199711L &amp;&amp; _MSVC_LANG &gt;= 201703L</span></div>
<div class="line"><a name="l03516"></a><span class="lineno"> 3516</span>&#160;<span class="preprocessor"> #define VMA_USE_STL_SHARED_MUTEX 1</span></div>
<div class="line"><a name="l03517"></a><span class="lineno"> 3517</span>&#160;<span class="preprocessor"> #else</span></div>
<div class="line"><a name="l03518"></a><span class="lineno"> 3518</span>&#160;<span class="preprocessor"> #define VMA_USE_STL_SHARED_MUTEX 0</span></div>
<div class="line"><a name="l03519"></a><span class="lineno"> 3519</span>&#160;<span class="preprocessor"> #endif</span></div>
<div class="line"><a name="l03520"></a><span class="lineno"> 3520</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03521"></a><span class="lineno"> 3521</span>&#160; </div>
<div class="line"><a name="l03522"></a><span class="lineno"> 3522</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l03523"></a><span class="lineno"> 3523</span>&#160;<span class="comment">THESE INCLUDES ARE NOT ENABLED BY DEFAULT.</span></div>
<div class="line"><a name="l03524"></a><span class="lineno"> 3524</span>&#160;<span class="comment">Library has its own container implementation.</span></div>
<div class="line"><a name="l03525"></a><span class="lineno"> 3525</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l03526"></a><span class="lineno"> 3526</span>&#160;<span class="preprocessor">#if VMA_USE_STL_VECTOR</span></div>
<div class="line"><a name="l03527"></a><span class="lineno"> 3527</span>&#160;<span class="preprocessor"> #include &lt;vector&gt;</span></div>
<div class="line"><a name="l03528"></a><span class="lineno"> 3528</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03529"></a><span class="lineno"> 3529</span>&#160; </div>
<div class="line"><a name="l03530"></a><span class="lineno"> 3530</span>&#160;<span class="preprocessor">#if VMA_USE_STL_UNORDERED_MAP</span></div>
<div class="line"><a name="l03531"></a><span class="lineno"> 3531</span>&#160;<span class="preprocessor"> #include &lt;unordered_map&gt;</span></div>
<div class="line"><a name="l03532"></a><span class="lineno"> 3532</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03533"></a><span class="lineno"> 3533</span>&#160; </div>
<div class="line"><a name="l03534"></a><span class="lineno"> 3534</span>&#160;<span class="preprocessor">#if VMA_USE_STL_LIST</span></div>
<div class="line"><a name="l03535"></a><span class="lineno"> 3535</span>&#160;<span class="preprocessor"> #include &lt;list&gt;</span></div>
<div class="line"><a name="l03536"></a><span class="lineno"> 3536</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03537"></a><span class="lineno"> 3537</span>&#160; </div>
<div class="line"><a name="l03538"></a><span class="lineno"> 3538</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l03539"></a><span class="lineno"> 3539</span>&#160;<span class="comment">Following headers are used in this CONFIGURATION section only, so feel free to</span></div>
<div class="line"><a name="l03540"></a><span class="lineno"> 3540</span>&#160;<span class="comment">remove them if not needed.</span></div>
<div class="line"><a name="l03541"></a><span class="lineno"> 3541</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l03542"></a><span class="lineno"> 3542</span>&#160;<span class="preprocessor">#include &lt;cassert&gt;</span> <span class="comment">// for assert</span></div>
<div class="line"><a name="l03543"></a><span class="lineno"> 3543</span>&#160;<span class="preprocessor">#include &lt;algorithm&gt;</span> <span class="comment">// for min, max</span></div>
<div class="line"><a name="l03544"></a><span class="lineno"> 3544</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div>
<div class="line"><a name="l03545"></a><span class="lineno"> 3545</span>&#160; </div>
<div class="line"><a name="l03546"></a><span class="lineno"> 3546</span>&#160;<span class="preprocessor">#ifndef VMA_NULL</span></div>
<div class="line"><a name="l03547"></a><span class="lineno"> 3547</span>&#160; <span class="comment">// Value used as null pointer. Define it to e.g.: nullptr, NULL, 0, (void*)0.</span></div>
<div class="line"><a name="l03548"></a><span class="lineno"> 3548</span>&#160;<span class="preprocessor"> #define VMA_NULL nullptr</span></div>
<div class="line"><a name="l03549"></a><span class="lineno"> 3549</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03550"></a><span class="lineno"> 3550</span>&#160; </div>
<div class="line"><a name="l03551"></a><span class="lineno"> 3551</span>&#160;<span class="preprocessor">#if defined(__ANDROID_API__) &amp;&amp; (__ANDROID_API__ &lt; 16)</span></div>
<div class="line"><a name="l03552"></a><span class="lineno"> 3552</span>&#160;<span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
<div class="line"><a name="l03553"></a><span class="lineno"> 3553</span>&#160;<span class="keywordtype">void</span> *aligned_alloc(<span class="keywordtype">size_t</span> alignment, <span class="keywordtype">size_t</span> size)</div>
<div class="line"><a name="l03554"></a><span class="lineno"> 3554</span>&#160;{</div>
<div class="line"><a name="l03555"></a><span class="lineno"> 3555</span>&#160; <span class="comment">// alignment must be &gt;= sizeof(void*)</span></div>
<div class="line"><a name="l03556"></a><span class="lineno"> 3556</span>&#160; <span class="keywordflow">if</span>(alignment &lt; <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*))</div>
<div class="line"><a name="l03557"></a><span class="lineno"> 3557</span>&#160; {</div>
<div class="line"><a name="l03558"></a><span class="lineno"> 3558</span>&#160; alignment = <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*);</div>
<div class="line"><a name="l03559"></a><span class="lineno"> 3559</span>&#160; }</div>
<div class="line"><a name="l03560"></a><span class="lineno"> 3560</span>&#160; </div>
<div class="line"><a name="l03561"></a><span class="lineno"> 3561</span>&#160; <span class="keywordflow">return</span> memalign(alignment, size);</div>
<div class="line"><a name="l03562"></a><span class="lineno"> 3562</span>&#160;}</div>
<div class="line"><a name="l03563"></a><span class="lineno"> 3563</span>&#160;<span class="preprocessor">#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) &amp;&amp; defined(__GLIBCXX__) &amp;&amp; !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))</span></div>
<div class="line"><a name="l03564"></a><span class="lineno"> 3564</span>&#160;<span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
<div class="line"><a name="l03565"></a><span class="lineno"> 3565</span>&#160;<span class="keywordtype">void</span> *aligned_alloc(<span class="keywordtype">size_t</span> alignment, <span class="keywordtype">size_t</span> size)</div>
<div class="line"><a name="l03566"></a><span class="lineno"> 3566</span>&#160;{</div>
<div class="line"><a name="l03567"></a><span class="lineno"> 3567</span>&#160; <span class="comment">// alignment must be &gt;= sizeof(void*)</span></div>
<div class="line"><a name="l03568"></a><span class="lineno"> 3568</span>&#160; <span class="keywordflow">if</span>(alignment &lt; <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*))</div>
<div class="line"><a name="l03569"></a><span class="lineno"> 3569</span>&#160; {</div>
<div class="line"><a name="l03570"></a><span class="lineno"> 3570</span>&#160; alignment = <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*);</div>
<div class="line"><a name="l03571"></a><span class="lineno"> 3571</span>&#160; }</div>
<div class="line"><a name="l03572"></a><span class="lineno"> 3572</span>&#160; </div>
<div class="line"><a name="l03573"></a><span class="lineno"> 3573</span>&#160; <span class="keywordtype">void</span> *pointer;</div>
<div class="line"><a name="l03574"></a><span class="lineno"> 3574</span>&#160; <span class="keywordflow">if</span>(posix_memalign(&amp;pointer, alignment, size) == 0)</div>
<div class="line"><a name="l03575"></a><span class="lineno"> 3575</span>&#160; <span class="keywordflow">return</span> pointer;</div>
<div class="line"><a name="l03576"></a><span class="lineno"> 3576</span>&#160; <span class="keywordflow">return</span> VMA_NULL;</div>
<div class="line"><a name="l03577"></a><span class="lineno"> 3577</span>&#160;}</div>
<div class="line"><a name="l03578"></a><span class="lineno"> 3578</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03579"></a><span class="lineno"> 3579</span>&#160; </div>
<div class="line"><a name="l03580"></a><span class="lineno"> 3580</span>&#160;<span class="comment">// If your compiler is not compatible with C++11 and definition of</span></div>
<div class="line"><a name="l03581"></a><span class="lineno"> 3581</span>&#160;<span class="comment">// aligned_alloc() function is missing, uncommeting following line may help:</span></div>
<div class="line"><a name="l03582"></a><span class="lineno"> 3582</span>&#160; </div>
<div class="line"><a name="l03583"></a><span class="lineno"> 3583</span>&#160;<span class="comment">//#include &lt;malloc.h&gt;</span></div>
<div class="line"><a name="l03584"></a><span class="lineno"> 3584</span>&#160; </div>
<div class="line"><a name="l03585"></a><span class="lineno"> 3585</span>&#160;<span class="comment">// Normal assert to check for programmer&#39;s errors, especially in Debug configuration.</span></div>
<div class="line"><a name="l03586"></a><span class="lineno"> 3586</span>&#160;<span class="preprocessor">#ifndef VMA_ASSERT</span></div>
<div class="line"><a name="l03587"></a><span class="lineno"> 3587</span>&#160;<span class="preprocessor"> #ifdef _DEBUG</span></div>
<div class="line"><a name="l03588"></a><span class="lineno"> 3588</span>&#160;<span class="preprocessor"> #define VMA_ASSERT(expr) assert(expr)</span></div>
<div class="line"><a name="l03589"></a><span class="lineno"> 3589</span>&#160;<span class="preprocessor"> #else</span></div>
<div class="line"><a name="l03590"></a><span class="lineno"> 3590</span>&#160;<span class="preprocessor"> #define VMA_ASSERT(expr)</span></div>
<div class="line"><a name="l03591"></a><span class="lineno"> 3591</span>&#160;<span class="preprocessor"> #endif</span></div>
<div class="line"><a name="l03592"></a><span class="lineno"> 3592</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03593"></a><span class="lineno"> 3593</span>&#160; </div>
<div class="line"><a name="l03594"></a><span class="lineno"> 3594</span>&#160;<span class="comment">// Assert that will be called very often, like inside data structures e.g. operator[].</span></div>
<div class="line"><a name="l03595"></a><span class="lineno"> 3595</span>&#160;<span class="comment">// Making it non-empty can make program slow.</span></div>
<div class="line"><a name="l03596"></a><span class="lineno"> 3596</span>&#160;<span class="preprocessor">#ifndef VMA_HEAVY_ASSERT</span></div>
<div class="line"><a name="l03597"></a><span class="lineno"> 3597</span>&#160;<span class="preprocessor"> #ifdef _DEBUG</span></div>
<div class="line"><a name="l03598"></a><span class="lineno"> 3598</span>&#160;<span class="preprocessor"> #define VMA_HEAVY_ASSERT(expr) //VMA_ASSERT(expr)</span></div>
<div class="line"><a name="l03599"></a><span class="lineno"> 3599</span>&#160;<span class="preprocessor"> #else</span></div>
<div class="line"><a name="l03600"></a><span class="lineno"> 3600</span>&#160;<span class="preprocessor"> #define VMA_HEAVY_ASSERT(expr)</span></div>
<div class="line"><a name="l03601"></a><span class="lineno"> 3601</span>&#160;<span class="preprocessor"> #endif</span></div>
<div class="line"><a name="l03602"></a><span class="lineno"> 3602</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03603"></a><span class="lineno"> 3603</span>&#160; </div>
<div class="line"><a name="l03604"></a><span class="lineno"> 3604</span>&#160;<span class="preprocessor">#ifndef VMA_ALIGN_OF</span></div>
<div class="line"><a name="l03605"></a><span class="lineno"> 3605</span>&#160;<span class="preprocessor"> #define VMA_ALIGN_OF(type) (__alignof(type))</span></div>
<div class="line"><a name="l03606"></a><span class="lineno"> 3606</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03607"></a><span class="lineno"> 3607</span>&#160; </div>
<div class="line"><a name="l03608"></a><span class="lineno"> 3608</span>&#160;<span class="preprocessor">#ifndef VMA_SYSTEM_ALIGNED_MALLOC</span></div>
<div class="line"><a name="l03609"></a><span class="lineno"> 3609</span>&#160;<span class="preprocessor"> #if defined(_WIN32)</span></div>
<div class="line"><a name="l03610"></a><span class="lineno"> 3610</span>&#160;<span class="preprocessor"> #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (_aligned_malloc((size), (alignment)))</span></div>
<div class="line"><a name="l03611"></a><span class="lineno"> 3611</span>&#160;<span class="preprocessor"> #else</span></div>
<div class="line"><a name="l03612"></a><span class="lineno"> 3612</span>&#160;<span class="preprocessor"> #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (aligned_alloc((alignment), (size) ))</span></div>
<div class="line"><a name="l03613"></a><span class="lineno"> 3613</span>&#160;<span class="preprocessor"> #endif</span></div>
<div class="line"><a name="l03614"></a><span class="lineno"> 3614</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03615"></a><span class="lineno"> 3615</span>&#160; </div>
<div class="line"><a name="l03616"></a><span class="lineno"> 3616</span>&#160;<span class="preprocessor">#ifndef VMA_SYSTEM_FREE</span></div>
<div class="line"><a name="l03617"></a><span class="lineno"> 3617</span>&#160;<span class="preprocessor"> #if defined(_WIN32)</span></div>
<div class="line"><a name="l03618"></a><span class="lineno"> 3618</span>&#160;<span class="preprocessor"> #define VMA_SYSTEM_FREE(ptr) _aligned_free(ptr)</span></div>
<div class="line"><a name="l03619"></a><span class="lineno"> 3619</span>&#160;<span class="preprocessor"> #else</span></div>
<div class="line"><a name="l03620"></a><span class="lineno"> 3620</span>&#160;<span class="preprocessor"> #define VMA_SYSTEM_FREE(ptr) free(ptr)</span></div>
<div class="line"><a name="l03621"></a><span class="lineno"> 3621</span>&#160;<span class="preprocessor"> #endif</span></div>
<div class="line"><a name="l03622"></a><span class="lineno"> 3622</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03623"></a><span class="lineno"> 3623</span>&#160; </div>
<div class="line"><a name="l03624"></a><span class="lineno"> 3624</span>&#160;<span class="preprocessor">#ifndef VMA_MIN</span></div>
<div class="line"><a name="l03625"></a><span class="lineno"> 3625</span>&#160;<span class="preprocessor"> #define VMA_MIN(v1, v2) (std::min((v1), (v2)))</span></div>
<div class="line"><a name="l03626"></a><span class="lineno"> 3626</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03627"></a><span class="lineno"> 3627</span>&#160; </div>
<div class="line"><a name="l03628"></a><span class="lineno"> 3628</span>&#160;<span class="preprocessor">#ifndef VMA_MAX</span></div>
<div class="line"><a name="l03629"></a><span class="lineno"> 3629</span>&#160;<span class="preprocessor"> #define VMA_MAX(v1, v2) (std::max((v1), (v2)))</span></div>
<div class="line"><a name="l03630"></a><span class="lineno"> 3630</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03631"></a><span class="lineno"> 3631</span>&#160; </div>
<div class="line"><a name="l03632"></a><span class="lineno"> 3632</span>&#160;<span class="preprocessor">#ifndef VMA_SWAP</span></div>
<div class="line"><a name="l03633"></a><span class="lineno"> 3633</span>&#160;<span class="preprocessor"> #define VMA_SWAP(v1, v2) std::swap((v1), (v2))</span></div>
<div class="line"><a name="l03634"></a><span class="lineno"> 3634</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03635"></a><span class="lineno"> 3635</span>&#160; </div>
<div class="line"><a name="l03636"></a><span class="lineno"> 3636</span>&#160;<span class="preprocessor">#ifndef VMA_SORT</span></div>
<div class="line"><a name="l03637"></a><span class="lineno"> 3637</span>&#160;<span class="preprocessor"> #define VMA_SORT(beg, end, cmp) std::sort(beg, end, cmp)</span></div>
<div class="line"><a name="l03638"></a><span class="lineno"> 3638</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03639"></a><span class="lineno"> 3639</span>&#160; </div>
<div class="line"><a name="l03640"></a><span class="lineno"> 3640</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_LOG</span></div>
<div class="line"><a name="l03641"></a><span class="lineno"> 3641</span>&#160;<span class="preprocessor"> #define VMA_DEBUG_LOG(format, ...)</span></div>
<div class="line"><a name="l03642"></a><span class="lineno"> 3642</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l03643"></a><span class="lineno"> 3643</span>&#160;<span class="comment"> #define VMA_DEBUG_LOG(format, ...) do { \</span></div>
<div class="line"><a name="l03644"></a><span class="lineno"> 3644</span>&#160;<span class="comment"> printf(format, __VA_ARGS__); \</span></div>
<div class="line"><a name="l03645"></a><span class="lineno"> 3645</span>&#160;<span class="comment"> printf(&quot;\n&quot;); \</span></div>
<div class="line"><a name="l03646"></a><span class="lineno"> 3646</span>&#160;<span class="comment"> } while(false)</span></div>
<div class="line"><a name="l03647"></a><span class="lineno"> 3647</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l03648"></a><span class="lineno"> 3648</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03649"></a><span class="lineno"> 3649</span>&#160; </div>
<div class="line"><a name="l03650"></a><span class="lineno"> 3650</span>&#160;<span class="comment">// Define this macro to 1 to enable functions: vmaBuildStatsString, vmaFreeStatsString.</span></div>
<div class="line"><a name="l03651"></a><span class="lineno"> 3651</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l03652"></a><span class="lineno"> 3652</span>&#160; <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> VmaUint32ToStr(<span class="keywordtype">char</span>* outStr, <span class="keywordtype">size_t</span> strLen, uint32_t num)</div>
<div class="line"><a name="l03653"></a><span class="lineno"> 3653</span>&#160; {</div>
<div class="line"><a name="l03654"></a><span class="lineno"> 3654</span>&#160; snprintf(outStr, strLen, <span class="stringliteral">&quot;%u&quot;</span>, static_cast&lt;unsigned int&gt;(num));</div>
<div class="line"><a name="l03655"></a><span class="lineno"> 3655</span>&#160; }</div>
<div class="line"><a name="l03656"></a><span class="lineno"> 3656</span>&#160; <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> VmaUint64ToStr(<span class="keywordtype">char</span>* outStr, <span class="keywordtype">size_t</span> strLen, uint64_t num)</div>
<div class="line"><a name="l03657"></a><span class="lineno"> 3657</span>&#160; {</div>
<div class="line"><a name="l03658"></a><span class="lineno"> 3658</span>&#160; snprintf(outStr, strLen, <span class="stringliteral">&quot;%llu&quot;</span>, static_cast&lt;unsigned long long&gt;(num));</div>
<div class="line"><a name="l03659"></a><span class="lineno"> 3659</span>&#160; }</div>
<div class="line"><a name="l03660"></a><span class="lineno"> 3660</span>&#160; <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> VmaPtrToStr(<span class="keywordtype">char</span>* outStr, <span class="keywordtype">size_t</span> strLen, <span class="keyword">const</span> <span class="keywordtype">void</span>* ptr)</div>
<div class="line"><a name="l03661"></a><span class="lineno"> 3661</span>&#160; {</div>
<div class="line"><a name="l03662"></a><span class="lineno"> 3662</span>&#160; snprintf(outStr, strLen, <span class="stringliteral">&quot;%p&quot;</span>, ptr);</div>
<div class="line"><a name="l03663"></a><span class="lineno"> 3663</span>&#160; }</div>
<div class="line"><a name="l03664"></a><span class="lineno"> 3664</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03665"></a><span class="lineno"> 3665</span>&#160; </div>
<div class="line"><a name="l03666"></a><span class="lineno"> 3666</span>&#160;<span class="preprocessor">#ifndef VMA_MUTEX</span></div>
<div class="line"><a name="l03667"></a><span class="lineno"> 3667</span>&#160; <span class="keyword">class </span>VmaMutex</div>
<div class="line"><a name="l03668"></a><span class="lineno"> 3668</span>&#160; {</div>
<div class="line"><a name="l03669"></a><span class="lineno"> 3669</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l03670"></a><span class="lineno"> 3670</span>&#160; <span class="keywordtype">void</span> Lock() { m_Mutex.lock(); }</div>
<div class="line"><a name="l03671"></a><span class="lineno"> 3671</span>&#160; <span class="keywordtype">void</span> Unlock() { m_Mutex.unlock(); }</div>
<div class="line"><a name="l03672"></a><span class="lineno"> 3672</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l03673"></a><span class="lineno"> 3673</span>&#160; std::mutex m_Mutex;</div>
<div class="line"><a name="l03674"></a><span class="lineno"> 3674</span>&#160; };</div>
<div class="line"><a name="l03675"></a><span class="lineno"> 3675</span>&#160;<span class="preprocessor"> #define VMA_MUTEX VmaMutex</span></div>
<div class="line"><a name="l03676"></a><span class="lineno"> 3676</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03677"></a><span class="lineno"> 3677</span>&#160; </div>
<div class="line"><a name="l03678"></a><span class="lineno"> 3678</span>&#160;<span class="comment">// Read-write mutex, where &quot;read&quot; is shared access, &quot;write&quot; is exclusive access.</span></div>
<div class="line"><a name="l03679"></a><span class="lineno"> 3679</span>&#160;<span class="preprocessor">#ifndef VMA_RW_MUTEX</span></div>
<div class="line"><a name="l03680"></a><span class="lineno"> 3680</span>&#160;<span class="preprocessor"> #if VMA_USE_STL_SHARED_MUTEX</span></div>
<div class="line"><a name="l03681"></a><span class="lineno"> 3681</span>&#160; <span class="comment">// Use std::shared_mutex from C++17.</span></div>
<div class="line"><a name="l03682"></a><span class="lineno"> 3682</span>&#160;<span class="preprocessor"> #include &lt;shared_mutex&gt;</span></div>
<div class="line"><a name="l03683"></a><span class="lineno"> 3683</span>&#160; <span class="keyword">class </span>VmaRWMutex</div>
<div class="line"><a name="l03684"></a><span class="lineno"> 3684</span>&#160; {</div>
<div class="line"><a name="l03685"></a><span class="lineno"> 3685</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l03686"></a><span class="lineno"> 3686</span>&#160; <span class="keywordtype">void</span> LockRead() { m_Mutex.lock_shared(); }</div>
<div class="line"><a name="l03687"></a><span class="lineno"> 3687</span>&#160; <span class="keywordtype">void</span> UnlockRead() { m_Mutex.unlock_shared(); }</div>
<div class="line"><a name="l03688"></a><span class="lineno"> 3688</span>&#160; <span class="keywordtype">void</span> LockWrite() { m_Mutex.lock(); }</div>
<div class="line"><a name="l03689"></a><span class="lineno"> 3689</span>&#160; <span class="keywordtype">void</span> UnlockWrite() { m_Mutex.unlock(); }</div>
<div class="line"><a name="l03690"></a><span class="lineno"> 3690</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l03691"></a><span class="lineno"> 3691</span>&#160; std::shared_mutex m_Mutex;</div>
<div class="line"><a name="l03692"></a><span class="lineno"> 3692</span>&#160; };</div>
<div class="line"><a name="l03693"></a><span class="lineno"> 3693</span>&#160;<span class="preprocessor"> #define VMA_RW_MUTEX VmaRWMutex</span></div>
<div class="line"><a name="l03694"></a><span class="lineno"> 3694</span>&#160;<span class="preprocessor"> #elif defined(_WIN32) &amp;&amp; defined(WINVER) &amp;&amp; WINVER &gt;= 0x0600</span></div>
<div class="line"><a name="l03695"></a><span class="lineno"> 3695</span>&#160; <span class="comment">// Use SRWLOCK from WinAPI.</span></div>
<div class="line"><a name="l03696"></a><span class="lineno"> 3696</span>&#160; <span class="comment">// Minimum supported client = Windows Vista, server = Windows Server 2008.</span></div>
<div class="line"><a name="l03697"></a><span class="lineno"> 3697</span>&#160; <span class="keyword">class </span>VmaRWMutex</div>
<div class="line"><a name="l03698"></a><span class="lineno"> 3698</span>&#160; {</div>
<div class="line"><a name="l03699"></a><span class="lineno"> 3699</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l03700"></a><span class="lineno"> 3700</span>&#160; VmaRWMutex() { InitializeSRWLock(&amp;m_Lock); }</div>
<div class="line"><a name="l03701"></a><span class="lineno"> 3701</span>&#160; <span class="keywordtype">void</span> LockRead() { AcquireSRWLockShared(&amp;m_Lock); }</div>
<div class="line"><a name="l03702"></a><span class="lineno"> 3702</span>&#160; <span class="keywordtype">void</span> UnlockRead() { ReleaseSRWLockShared(&amp;m_Lock); }</div>
<div class="line"><a name="l03703"></a><span class="lineno"> 3703</span>&#160; <span class="keywordtype">void</span> LockWrite() { AcquireSRWLockExclusive(&amp;m_Lock); }</div>
<div class="line"><a name="l03704"></a><span class="lineno"> 3704</span>&#160; <span class="keywordtype">void</span> UnlockWrite() { ReleaseSRWLockExclusive(&amp;m_Lock); }</div>
<div class="line"><a name="l03705"></a><span class="lineno"> 3705</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l03706"></a><span class="lineno"> 3706</span>&#160; SRWLOCK m_Lock;</div>
<div class="line"><a name="l03707"></a><span class="lineno"> 3707</span>&#160; };</div>
<div class="line"><a name="l03708"></a><span class="lineno"> 3708</span>&#160;<span class="preprocessor"> #define VMA_RW_MUTEX VmaRWMutex</span></div>
<div class="line"><a name="l03709"></a><span class="lineno"> 3709</span>&#160;<span class="preprocessor"> #else</span></div>
<div class="line"><a name="l03710"></a><span class="lineno"> 3710</span>&#160; <span class="comment">// Less efficient fallback: Use normal mutex.</span></div>
<div class="line"><a name="l03711"></a><span class="lineno"> 3711</span>&#160; <span class="keyword">class </span>VmaRWMutex</div>
<div class="line"><a name="l03712"></a><span class="lineno"> 3712</span>&#160; {</div>
<div class="line"><a name="l03713"></a><span class="lineno"> 3713</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l03714"></a><span class="lineno"> 3714</span>&#160; <span class="keywordtype">void</span> LockRead() { m_Mutex.Lock(); }</div>
<div class="line"><a name="l03715"></a><span class="lineno"> 3715</span>&#160; <span class="keywordtype">void</span> UnlockRead() { m_Mutex.Unlock(); }</div>
<div class="line"><a name="l03716"></a><span class="lineno"> 3716</span>&#160; <span class="keywordtype">void</span> LockWrite() { m_Mutex.Lock(); }</div>
<div class="line"><a name="l03717"></a><span class="lineno"> 3717</span>&#160; <span class="keywordtype">void</span> UnlockWrite() { m_Mutex.Unlock(); }</div>
<div class="line"><a name="l03718"></a><span class="lineno"> 3718</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l03719"></a><span class="lineno"> 3719</span>&#160; VMA_MUTEX m_Mutex;</div>
<div class="line"><a name="l03720"></a><span class="lineno"> 3720</span>&#160; };</div>
<div class="line"><a name="l03721"></a><span class="lineno"> 3721</span>&#160;<span class="preprocessor"> #define VMA_RW_MUTEX VmaRWMutex</span></div>
<div class="line"><a name="l03722"></a><span class="lineno"> 3722</span>&#160;<span class="preprocessor"> #endif // #if VMA_USE_STL_SHARED_MUTEX</span></div>
<div class="line"><a name="l03723"></a><span class="lineno"> 3723</span>&#160;<span class="preprocessor">#endif // #ifndef VMA_RW_MUTEX</span></div>
<div class="line"><a name="l03724"></a><span class="lineno"> 3724</span>&#160; </div>
<div class="line"><a name="l03725"></a><span class="lineno"> 3725</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l03726"></a><span class="lineno"> 3726</span>&#160;<span class="comment">If providing your own implementation, you need to implement a subset of std::atomic.</span></div>
<div class="line"><a name="l03727"></a><span class="lineno"> 3727</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l03728"></a><span class="lineno"> 3728</span>&#160;<span class="preprocessor">#ifndef VMA_ATOMIC_UINT32</span></div>
<div class="line"><a name="l03729"></a><span class="lineno"> 3729</span>&#160;<span class="preprocessor"> #include &lt;atomic&gt;</span></div>
<div class="line"><a name="l03730"></a><span class="lineno"> 3730</span>&#160;<span class="preprocessor"> #define VMA_ATOMIC_UINT32 std::atomic&lt;uint32_t&gt;</span></div>
<div class="line"><a name="l03731"></a><span class="lineno"> 3731</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03732"></a><span class="lineno"> 3732</span>&#160; </div>
<div class="line"><a name="l03733"></a><span class="lineno"> 3733</span>&#160;<span class="preprocessor">#ifndef VMA_ATOMIC_UINT64</span></div>
<div class="line"><a name="l03734"></a><span class="lineno"> 3734</span>&#160;<span class="preprocessor"> #include &lt;atomic&gt;</span></div>
<div class="line"><a name="l03735"></a><span class="lineno"> 3735</span>&#160;<span class="preprocessor"> #define VMA_ATOMIC_UINT64 std::atomic&lt;uint64_t&gt;</span></div>
<div class="line"><a name="l03736"></a><span class="lineno"> 3736</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03737"></a><span class="lineno"> 3737</span>&#160; </div>
<div class="line"><a name="l03738"></a><span class="lineno"> 3738</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_ALWAYS_DEDICATED_MEMORY</span></div>
<div class="line"><a name="l03739"></a><span class="lineno"> 3739</span>&#160; </div>
<div class="line"><a name="l03743"></a><span class="lineno"> 3743</span>&#160;<span class="preprocessor"> #define VMA_DEBUG_ALWAYS_DEDICATED_MEMORY (0)</span></div>
<div class="line"><a name="l03744"></a><span class="lineno"> 3744</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03745"></a><span class="lineno"> 3745</span>&#160; </div>
<div class="line"><a name="l03746"></a><span class="lineno"> 3746</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_ALIGNMENT</span></div>
<div class="line"><a name="l03747"></a><span class="lineno"> 3747</span>&#160; </div>
<div class="line"><a name="l03751"></a><span class="lineno"> 3751</span>&#160;<span class="preprocessor"> #define VMA_DEBUG_ALIGNMENT (1)</span></div>
<div class="line"><a name="l03752"></a><span class="lineno"> 3752</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03753"></a><span class="lineno"> 3753</span>&#160; </div>
<div class="line"><a name="l03754"></a><span class="lineno"> 3754</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_MARGIN</span></div>
<div class="line"><a name="l03755"></a><span class="lineno"> 3755</span>&#160; </div>
<div class="line"><a name="l03759"></a><span class="lineno"> 3759</span>&#160;<span class="preprocessor"> #define VMA_DEBUG_MARGIN (0)</span></div>
<div class="line"><a name="l03760"></a><span class="lineno"> 3760</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03761"></a><span class="lineno"> 3761</span>&#160; </div>
<div class="line"><a name="l03762"></a><span class="lineno"> 3762</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_INITIALIZE_ALLOCATIONS</span></div>
<div class="line"><a name="l03763"></a><span class="lineno"> 3763</span>&#160; </div>
<div class="line"><a name="l03767"></a><span class="lineno"> 3767</span>&#160;<span class="preprocessor"> #define VMA_DEBUG_INITIALIZE_ALLOCATIONS (0)</span></div>
<div class="line"><a name="l03768"></a><span class="lineno"> 3768</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03769"></a><span class="lineno"> 3769</span>&#160; </div>
<div class="line"><a name="l03770"></a><span class="lineno"> 3770</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_DETECT_CORRUPTION</span></div>
<div class="line"><a name="l03771"></a><span class="lineno"> 3771</span>&#160; </div>
<div class="line"><a name="l03776"></a><span class="lineno"> 3776</span>&#160;<span class="preprocessor"> #define VMA_DEBUG_DETECT_CORRUPTION (0)</span></div>
<div class="line"><a name="l03777"></a><span class="lineno"> 3777</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03778"></a><span class="lineno"> 3778</span>&#160; </div>
<div class="line"><a name="l03779"></a><span class="lineno"> 3779</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_GLOBAL_MUTEX</span></div>
<div class="line"><a name="l03780"></a><span class="lineno"> 3780</span>&#160; </div>
<div class="line"><a name="l03784"></a><span class="lineno"> 3784</span>&#160;<span class="preprocessor"> #define VMA_DEBUG_GLOBAL_MUTEX (0)</span></div>
<div class="line"><a name="l03785"></a><span class="lineno"> 3785</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03786"></a><span class="lineno"> 3786</span>&#160; </div>
<div class="line"><a name="l03787"></a><span class="lineno"> 3787</span>&#160;<span class="preprocessor">#ifndef VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY</span></div>
<div class="line"><a name="l03788"></a><span class="lineno"> 3788</span>&#160; </div>
<div class="line"><a name="l03792"></a><span class="lineno"> 3792</span>&#160;<span class="preprocessor"> #define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY (1)</span></div>
<div class="line"><a name="l03793"></a><span class="lineno"> 3793</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03794"></a><span class="lineno"> 3794</span>&#160; </div>
<div class="line"><a name="l03795"></a><span class="lineno"> 3795</span>&#160;<span class="preprocessor">#ifndef VMA_SMALL_HEAP_MAX_SIZE</span></div>
<div class="line"><a name="l03796"></a><span class="lineno"> 3796</span>&#160;<span class="preprocessor"> #define VMA_SMALL_HEAP_MAX_SIZE (1024ull * 1024 * 1024)</span></div>
<div class="line"><a name="l03798"></a><span class="lineno"> 3798</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03799"></a><span class="lineno"> 3799</span>&#160; </div>
<div class="line"><a name="l03800"></a><span class="lineno"> 3800</span>&#160;<span class="preprocessor">#ifndef VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE</span></div>
<div class="line"><a name="l03801"></a><span class="lineno"> 3801</span>&#160;<span class="preprocessor"> #define VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE (256ull * 1024 * 1024)</span></div>
<div class="line"><a name="l03803"></a><span class="lineno"> 3803</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03804"></a><span class="lineno"> 3804</span>&#160; </div>
<div class="line"><a name="l03805"></a><span class="lineno"> 3805</span>&#160;<span class="preprocessor">#ifndef VMA_CLASS_NO_COPY</span></div>
<div class="line"><a name="l03806"></a><span class="lineno"> 3806</span>&#160;<span class="preprocessor"> #define VMA_CLASS_NO_COPY(className) \</span></div>
<div class="line"><a name="l03807"></a><span class="lineno"> 3807</span>&#160;<span class="preprocessor"> private: \</span></div>
<div class="line"><a name="l03808"></a><span class="lineno"> 3808</span>&#160;<span class="preprocessor"> className(const className&amp;) = delete; \</span></div>
<div class="line"><a name="l03809"></a><span class="lineno"> 3809</span>&#160;<span class="preprocessor"> className&amp; operator=(const className&amp;) = delete;</span></div>
<div class="line"><a name="l03810"></a><span class="lineno"> 3810</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l03811"></a><span class="lineno"> 3811</span>&#160; </div>
<div class="line"><a name="l03812"></a><span class="lineno"> 3812</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_FRAME_INDEX_LOST = UINT32_MAX;</div>
<div class="line"><a name="l03813"></a><span class="lineno"> 3813</span>&#160; </div>
<div class="line"><a name="l03814"></a><span class="lineno"> 3814</span>&#160;<span class="comment">// Decimal 2139416166, float NaN, little-endian binary 66 E6 84 7F.</span></div>
<div class="line"><a name="l03815"></a><span class="lineno"> 3815</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_CORRUPTION_DETECTION_MAGIC_VALUE = 0x7F84E666;</div>
<div class="line"><a name="l03816"></a><span class="lineno"> 3816</span>&#160; </div>
<div class="line"><a name="l03817"></a><span class="lineno"> 3817</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint8_t VMA_ALLOCATION_FILL_PATTERN_CREATED = 0xDC;</div>
<div class="line"><a name="l03818"></a><span class="lineno"> 3818</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint8_t VMA_ALLOCATION_FILL_PATTERN_DESTROYED = 0xEF;</div>
<div class="line"><a name="l03819"></a><span class="lineno"> 3819</span>&#160; </div>
<div class="line"><a name="l03820"></a><span class="lineno"> 3820</span>&#160;<span class="comment">/*******************************************************************************</span></div>
<div class="line"><a name="l03821"></a><span class="lineno"> 3821</span>&#160;<span class="comment">END OF CONFIGURATION</span></div>
<div class="line"><a name="l03822"></a><span class="lineno"> 3822</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l03823"></a><span class="lineno"> 3823</span>&#160; </div>
<div class="line"><a name="l03824"></a><span class="lineno"> 3824</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> uint32_t VMA_ALLOCATION_INTERNAL_STRATEGY_MIN_OFFSET = 0x10000000u;</div>
<div class="line"><a name="l03825"></a><span class="lineno"> 3825</span>&#160; </div>
<div class="line"><a name="l03826"></a><span class="lineno"> 3826</span>&#160;<span class="keyword">static</span> VkAllocationCallbacks VmaEmptyAllocationCallbacks = {</div>
<div class="line"><a name="l03827"></a><span class="lineno"> 3827</span>&#160; VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL, VMA_NULL };</div>
<div class="line"><a name="l03828"></a><span class="lineno"> 3828</span>&#160; </div>
<div class="line"><a name="l03829"></a><span class="lineno"> 3829</span>&#160;<span class="comment">// Returns number of bits set to 1 in (v).</span></div>
<div class="line"><a name="l03830"></a><span class="lineno"> 3830</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint32_t VmaCountBitsSet(uint32_t v)</div>
<div class="line"><a name="l03831"></a><span class="lineno"> 3831</span>&#160;{</div>
<div class="line"><a name="l03832"></a><span class="lineno"> 3832</span>&#160; uint32_t c = v - ((v &gt;&gt; 1) &amp; 0x55555555);</div>
<div class="line"><a name="l03833"></a><span class="lineno"> 3833</span>&#160; c = ((c &gt;&gt; 2) &amp; 0x33333333) + (c &amp; 0x33333333);</div>
<div class="line"><a name="l03834"></a><span class="lineno"> 3834</span>&#160; c = ((c &gt;&gt; 4) + c) &amp; 0x0F0F0F0F;</div>
<div class="line"><a name="l03835"></a><span class="lineno"> 3835</span>&#160; c = ((c &gt;&gt; 8) + c) &amp; 0x00FF00FF;</div>
<div class="line"><a name="l03836"></a><span class="lineno"> 3836</span>&#160; c = ((c &gt;&gt; 16) + c) &amp; 0x0000FFFF;</div>
<div class="line"><a name="l03837"></a><span class="lineno"> 3837</span>&#160; <span class="keywordflow">return</span> c;</div>
<div class="line"><a name="l03838"></a><span class="lineno"> 3838</span>&#160;}</div>
<div class="line"><a name="l03839"></a><span class="lineno"> 3839</span>&#160; </div>
<div class="line"><a name="l03840"></a><span class="lineno"> 3840</span>&#160;<span class="comment">// Aligns given value up to nearest multiply of align value. For example: VmaAlignUp(11, 8) = 16.</span></div>
<div class="line"><a name="l03841"></a><span class="lineno"> 3841</span>&#160;<span class="comment">// Use types like uint32_t, uint64_t as T.</span></div>
<div class="line"><a name="l03842"></a><span class="lineno"> 3842</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l03843"></a><span class="lineno"> 3843</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> T VmaAlignUp(T val, T align)</div>
<div class="line"><a name="l03844"></a><span class="lineno"> 3844</span>&#160;{</div>
<div class="line"><a name="l03845"></a><span class="lineno"> 3845</span>&#160; <span class="keywordflow">return</span> (val + align - 1) / align * align;</div>
<div class="line"><a name="l03846"></a><span class="lineno"> 3846</span>&#160;}</div>
<div class="line"><a name="l03847"></a><span class="lineno"> 3847</span>&#160;<span class="comment">// Aligns given value down to nearest multiply of align value. For example: VmaAlignUp(11, 8) = 8.</span></div>
<div class="line"><a name="l03848"></a><span class="lineno"> 3848</span>&#160;<span class="comment">// Use types like uint32_t, uint64_t as T.</span></div>
<div class="line"><a name="l03849"></a><span class="lineno"> 3849</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l03850"></a><span class="lineno"> 3850</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> T VmaAlignDown(T val, T align)</div>
<div class="line"><a name="l03851"></a><span class="lineno"> 3851</span>&#160;{</div>
<div class="line"><a name="l03852"></a><span class="lineno"> 3852</span>&#160; <span class="keywordflow">return</span> val / align * align;</div>
<div class="line"><a name="l03853"></a><span class="lineno"> 3853</span>&#160;}</div>
<div class="line"><a name="l03854"></a><span class="lineno"> 3854</span>&#160; </div>
<div class="line"><a name="l03855"></a><span class="lineno"> 3855</span>&#160;<span class="comment">// Division with mathematical rounding to nearest number.</span></div>
<div class="line"><a name="l03856"></a><span class="lineno"> 3856</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l03857"></a><span class="lineno"> 3857</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> T VmaRoundDiv(T x, T y)</div>
<div class="line"><a name="l03858"></a><span class="lineno"> 3858</span>&#160;{</div>
<div class="line"><a name="l03859"></a><span class="lineno"> 3859</span>&#160; <span class="keywordflow">return</span> (x + (y / (T)2)) / y;</div>
<div class="line"><a name="l03860"></a><span class="lineno"> 3860</span>&#160;}</div>
<div class="line"><a name="l03861"></a><span class="lineno"> 3861</span>&#160; </div>
<div class="line"><a name="l03862"></a><span class="lineno"> 3862</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l03863"></a><span class="lineno"> 3863</span>&#160;<span class="comment">Returns true if given number is a power of two.</span></div>
<div class="line"><a name="l03864"></a><span class="lineno"> 3864</span>&#160;<span class="comment">T must be unsigned integer number or signed integer but always nonnegative.</span></div>
<div class="line"><a name="l03865"></a><span class="lineno"> 3865</span>&#160;<span class="comment">For 0 returns true.</span></div>
<div class="line"><a name="l03866"></a><span class="lineno"> 3866</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l03867"></a><span class="lineno"> 3867</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l03868"></a><span class="lineno"> 3868</span>&#160;<span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaIsPow2(T x)</div>
<div class="line"><a name="l03869"></a><span class="lineno"> 3869</span>&#160;{</div>
<div class="line"><a name="l03870"></a><span class="lineno"> 3870</span>&#160; <span class="keywordflow">return</span> (x &amp; (x-1)) == 0;</div>
<div class="line"><a name="l03871"></a><span class="lineno"> 3871</span>&#160;}</div>
<div class="line"><a name="l03872"></a><span class="lineno"> 3872</span>&#160; </div>
<div class="line"><a name="l03873"></a><span class="lineno"> 3873</span>&#160;<span class="comment">// Returns smallest power of 2 greater or equal to v.</span></div>
<div class="line"><a name="l03874"></a><span class="lineno"> 3874</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint32_t VmaNextPow2(uint32_t v)</div>
<div class="line"><a name="l03875"></a><span class="lineno"> 3875</span>&#160;{</div>
<div class="line"><a name="l03876"></a><span class="lineno"> 3876</span>&#160; v--;</div>
<div class="line"><a name="l03877"></a><span class="lineno"> 3877</span>&#160; v |= v &gt;&gt; 1;</div>
<div class="line"><a name="l03878"></a><span class="lineno"> 3878</span>&#160; v |= v &gt;&gt; 2;</div>
<div class="line"><a name="l03879"></a><span class="lineno"> 3879</span>&#160; v |= v &gt;&gt; 4;</div>
<div class="line"><a name="l03880"></a><span class="lineno"> 3880</span>&#160; v |= v &gt;&gt; 8;</div>
<div class="line"><a name="l03881"></a><span class="lineno"> 3881</span>&#160; v |= v &gt;&gt; 16;</div>
<div class="line"><a name="l03882"></a><span class="lineno"> 3882</span>&#160; v++;</div>
<div class="line"><a name="l03883"></a><span class="lineno"> 3883</span>&#160; <span class="keywordflow">return</span> v;</div>
<div class="line"><a name="l03884"></a><span class="lineno"> 3884</span>&#160;}</div>
<div class="line"><a name="l03885"></a><span class="lineno"> 3885</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint64_t VmaNextPow2(uint64_t v)</div>
<div class="line"><a name="l03886"></a><span class="lineno"> 3886</span>&#160;{</div>
<div class="line"><a name="l03887"></a><span class="lineno"> 3887</span>&#160; v--;</div>
<div class="line"><a name="l03888"></a><span class="lineno"> 3888</span>&#160; v |= v &gt;&gt; 1;</div>
<div class="line"><a name="l03889"></a><span class="lineno"> 3889</span>&#160; v |= v &gt;&gt; 2;</div>
<div class="line"><a name="l03890"></a><span class="lineno"> 3890</span>&#160; v |= v &gt;&gt; 4;</div>
<div class="line"><a name="l03891"></a><span class="lineno"> 3891</span>&#160; v |= v &gt;&gt; 8;</div>
<div class="line"><a name="l03892"></a><span class="lineno"> 3892</span>&#160; v |= v &gt;&gt; 16;</div>
<div class="line"><a name="l03893"></a><span class="lineno"> 3893</span>&#160; v |= v &gt;&gt; 32;</div>
<div class="line"><a name="l03894"></a><span class="lineno"> 3894</span>&#160; v++;</div>
<div class="line"><a name="l03895"></a><span class="lineno"> 3895</span>&#160; <span class="keywordflow">return</span> v;</div>
<div class="line"><a name="l03896"></a><span class="lineno"> 3896</span>&#160;}</div>
<div class="line"><a name="l03897"></a><span class="lineno"> 3897</span>&#160; </div>
<div class="line"><a name="l03898"></a><span class="lineno"> 3898</span>&#160;<span class="comment">// Returns largest power of 2 less or equal to v.</span></div>
<div class="line"><a name="l03899"></a><span class="lineno"> 3899</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint32_t VmaPrevPow2(uint32_t v)</div>
<div class="line"><a name="l03900"></a><span class="lineno"> 3900</span>&#160;{</div>
<div class="line"><a name="l03901"></a><span class="lineno"> 3901</span>&#160; v |= v &gt;&gt; 1;</div>
<div class="line"><a name="l03902"></a><span class="lineno"> 3902</span>&#160; v |= v &gt;&gt; 2;</div>
<div class="line"><a name="l03903"></a><span class="lineno"> 3903</span>&#160; v |= v &gt;&gt; 4;</div>
<div class="line"><a name="l03904"></a><span class="lineno"> 3904</span>&#160; v |= v &gt;&gt; 8;</div>
<div class="line"><a name="l03905"></a><span class="lineno"> 3905</span>&#160; v |= v &gt;&gt; 16;</div>
<div class="line"><a name="l03906"></a><span class="lineno"> 3906</span>&#160; v = v ^ (v &gt;&gt; 1);</div>
<div class="line"><a name="l03907"></a><span class="lineno"> 3907</span>&#160; <span class="keywordflow">return</span> v;</div>
<div class="line"><a name="l03908"></a><span class="lineno"> 3908</span>&#160;}</div>
<div class="line"><a name="l03909"></a><span class="lineno"> 3909</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint64_t VmaPrevPow2(uint64_t v)</div>
<div class="line"><a name="l03910"></a><span class="lineno"> 3910</span>&#160;{</div>
<div class="line"><a name="l03911"></a><span class="lineno"> 3911</span>&#160; v |= v &gt;&gt; 1;</div>
<div class="line"><a name="l03912"></a><span class="lineno"> 3912</span>&#160; v |= v &gt;&gt; 2;</div>
<div class="line"><a name="l03913"></a><span class="lineno"> 3913</span>&#160; v |= v &gt;&gt; 4;</div>
<div class="line"><a name="l03914"></a><span class="lineno"> 3914</span>&#160; v |= v &gt;&gt; 8;</div>
<div class="line"><a name="l03915"></a><span class="lineno"> 3915</span>&#160; v |= v &gt;&gt; 16;</div>
<div class="line"><a name="l03916"></a><span class="lineno"> 3916</span>&#160; v |= v &gt;&gt; 32;</div>
<div class="line"><a name="l03917"></a><span class="lineno"> 3917</span>&#160; v = v ^ (v &gt;&gt; 1);</div>
<div class="line"><a name="l03918"></a><span class="lineno"> 3918</span>&#160; <span class="keywordflow">return</span> v;</div>
<div class="line"><a name="l03919"></a><span class="lineno"> 3919</span>&#160;}</div>
<div class="line"><a name="l03920"></a><span class="lineno"> 3920</span>&#160; </div>
<div class="line"><a name="l03921"></a><span class="lineno"> 3921</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaStrIsEmpty(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
<div class="line"><a name="l03922"></a><span class="lineno"> 3922</span>&#160;{</div>
<div class="line"><a name="l03923"></a><span class="lineno"> 3923</span>&#160; <span class="keywordflow">return</span> pStr == VMA_NULL || *pStr == <span class="charliteral">&#39;\0&#39;</span>;</div>
<div class="line"><a name="l03924"></a><span class="lineno"> 3924</span>&#160;}</div>
<div class="line"><a name="l03925"></a><span class="lineno"> 3925</span>&#160; </div>
<div class="line"><a name="l03926"></a><span class="lineno"> 3926</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l03927"></a><span class="lineno"> 3927</span>&#160; </div>
<div class="line"><a name="l03928"></a><span class="lineno"> 3928</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* VmaAlgorithmToStr(uint32_t algorithm)</div>
<div class="line"><a name="l03929"></a><span class="lineno"> 3929</span>&#160;{</div>
<div class="line"><a name="l03930"></a><span class="lineno"> 3930</span>&#160; <span class="keywordflow">switch</span>(algorithm)</div>
<div class="line"><a name="l03931"></a><span class="lineno"> 3931</span>&#160; {</div>
<div class="line"><a name="l03932"></a><span class="lineno"> 3932</span>&#160; <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a>:</div>
<div class="line"><a name="l03933"></a><span class="lineno"> 3933</span>&#160; <span class="keywordflow">return</span> <span class="stringliteral">&quot;Linear&quot;</span>;</div>
<div class="line"><a name="l03934"></a><span class="lineno"> 3934</span>&#160; <span class="keywordflow">case</span> <a class="code" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a97a0dc38e5161b780594d998d313d35e">VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT</a>:</div>
<div class="line"><a name="l03935"></a><span class="lineno"> 3935</span>&#160; <span class="keywordflow">return</span> <span class="stringliteral">&quot;Buddy&quot;</span>;</div>
<div class="line"><a name="l03936"></a><span class="lineno"> 3936</span>&#160; <span class="keywordflow">case</span> 0:</div>
<div class="line"><a name="l03937"></a><span class="lineno"> 3937</span>&#160; <span class="keywordflow">return</span> <span class="stringliteral">&quot;Default&quot;</span>;</div>
<div class="line"><a name="l03938"></a><span class="lineno"> 3938</span>&#160; <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l03939"></a><span class="lineno"> 3939</span>&#160; VMA_ASSERT(0);</div>
<div class="line"><a name="l03940"></a><span class="lineno"> 3940</span>&#160; <span class="keywordflow">return</span> <span class="stringliteral">&quot;&quot;</span>;</div>
<div class="line"><a name="l03941"></a><span class="lineno"> 3941</span>&#160; }</div>
<div class="line"><a name="l03942"></a><span class="lineno"> 3942</span>&#160;}</div>
<div class="line"><a name="l03943"></a><span class="lineno"> 3943</span>&#160; </div>
<div class="line"><a name="l03944"></a><span class="lineno"> 3944</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l03945"></a><span class="lineno"> 3945</span>&#160; </div>
<div class="line"><a name="l03946"></a><span class="lineno"> 3946</span>&#160;<span class="preprocessor">#ifndef VMA_SORT</span></div>
<div class="line"><a name="l03947"></a><span class="lineno"> 3947</span>&#160; </div>
<div class="line"><a name="l03948"></a><span class="lineno"> 3948</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> Iterator, <span class="keyword">typename</span> Compare&gt;</div>
<div class="line"><a name="l03949"></a><span class="lineno"> 3949</span>&#160;Iterator VmaQuickSortPartition(Iterator beg, Iterator end, Compare cmp)</div>
<div class="line"><a name="l03950"></a><span class="lineno"> 3950</span>&#160;{</div>
<div class="line"><a name="l03951"></a><span class="lineno"> 3951</span>&#160; Iterator centerValue = end; --centerValue;</div>
<div class="line"><a name="l03952"></a><span class="lineno"> 3952</span>&#160; Iterator insertIndex = beg;</div>
<div class="line"><a name="l03953"></a><span class="lineno"> 3953</span>&#160; <span class="keywordflow">for</span>(Iterator memTypeIndex = beg; memTypeIndex &lt; centerValue; ++memTypeIndex)</div>
<div class="line"><a name="l03954"></a><span class="lineno"> 3954</span>&#160; {</div>
<div class="line"><a name="l03955"></a><span class="lineno"> 3955</span>&#160; <span class="keywordflow">if</span>(cmp(*memTypeIndex, *centerValue))</div>
<div class="line"><a name="l03956"></a><span class="lineno"> 3956</span>&#160; {</div>
<div class="line"><a name="l03957"></a><span class="lineno"> 3957</span>&#160; <span class="keywordflow">if</span>(insertIndex != memTypeIndex)</div>
<div class="line"><a name="l03958"></a><span class="lineno"> 3958</span>&#160; {</div>
<div class="line"><a name="l03959"></a><span class="lineno"> 3959</span>&#160; VMA_SWAP(*memTypeIndex, *insertIndex);</div>
<div class="line"><a name="l03960"></a><span class="lineno"> 3960</span>&#160; }</div>
<div class="line"><a name="l03961"></a><span class="lineno"> 3961</span>&#160; ++insertIndex;</div>
<div class="line"><a name="l03962"></a><span class="lineno"> 3962</span>&#160; }</div>
<div class="line"><a name="l03963"></a><span class="lineno"> 3963</span>&#160; }</div>
<div class="line"><a name="l03964"></a><span class="lineno"> 3964</span>&#160; <span class="keywordflow">if</span>(insertIndex != centerValue)</div>
<div class="line"><a name="l03965"></a><span class="lineno"> 3965</span>&#160; {</div>
<div class="line"><a name="l03966"></a><span class="lineno"> 3966</span>&#160; VMA_SWAP(*insertIndex, *centerValue);</div>
<div class="line"><a name="l03967"></a><span class="lineno"> 3967</span>&#160; }</div>
<div class="line"><a name="l03968"></a><span class="lineno"> 3968</span>&#160; <span class="keywordflow">return</span> insertIndex;</div>
<div class="line"><a name="l03969"></a><span class="lineno"> 3969</span>&#160;}</div>
<div class="line"><a name="l03970"></a><span class="lineno"> 3970</span>&#160; </div>
<div class="line"><a name="l03971"></a><span class="lineno"> 3971</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> Iterator, <span class="keyword">typename</span> Compare&gt;</div>
<div class="line"><a name="l03972"></a><span class="lineno"> 3972</span>&#160;<span class="keywordtype">void</span> VmaQuickSort(Iterator beg, Iterator end, Compare cmp)</div>
<div class="line"><a name="l03973"></a><span class="lineno"> 3973</span>&#160;{</div>
<div class="line"><a name="l03974"></a><span class="lineno"> 3974</span>&#160; <span class="keywordflow">if</span>(beg &lt; end)</div>
<div class="line"><a name="l03975"></a><span class="lineno"> 3975</span>&#160; {</div>
<div class="line"><a name="l03976"></a><span class="lineno"> 3976</span>&#160; Iterator it = VmaQuickSortPartition&lt;Iterator, Compare&gt;(beg, end, cmp);</div>
<div class="line"><a name="l03977"></a><span class="lineno"> 3977</span>&#160; VmaQuickSort&lt;Iterator, Compare&gt;(beg, it, cmp);</div>
<div class="line"><a name="l03978"></a><span class="lineno"> 3978</span>&#160; VmaQuickSort&lt;Iterator, Compare&gt;(it + 1, end, cmp);</div>
<div class="line"><a name="l03979"></a><span class="lineno"> 3979</span>&#160; }</div>
<div class="line"><a name="l03980"></a><span class="lineno"> 3980</span>&#160;}</div>
<div class="line"><a name="l03981"></a><span class="lineno"> 3981</span>&#160; </div>
<div class="line"><a name="l03982"></a><span class="lineno"> 3982</span>&#160;<span class="preprocessor">#define VMA_SORT(beg, end, cmp) VmaQuickSort(beg, end, cmp)</span></div>
<div class="line"><a name="l03983"></a><span class="lineno"> 3983</span>&#160; </div>
<div class="line"><a name="l03984"></a><span class="lineno"> 3984</span>&#160;<span class="preprocessor">#endif // #ifndef VMA_SORT</span></div>
<div class="line"><a name="l03985"></a><span class="lineno"> 3985</span>&#160; </div>
<div class="line"><a name="l03986"></a><span class="lineno"> 3986</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l03987"></a><span class="lineno"> 3987</span>&#160;<span class="comment">Returns true if two memory blocks occupy overlapping pages.</span></div>
<div class="line"><a name="l03988"></a><span class="lineno"> 3988</span>&#160;<span class="comment">ResourceA must be in less memory offset than ResourceB.</span></div>
<div class="line"><a name="l03989"></a><span class="lineno"> 3989</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l03990"></a><span class="lineno"> 3990</span>&#160;<span class="comment">Algorithm is based on &quot;Vulkan 1.0.39 - A Specification (with all registered Vulkan extensions)&quot;</span></div>
<div class="line"><a name="l03991"></a><span class="lineno"> 3991</span>&#160;<span class="comment">chapter 11.6 &quot;Resource Memory Association&quot;, paragraph &quot;Buffer-Image Granularity&quot;.</span></div>
<div class="line"><a name="l03992"></a><span class="lineno"> 3992</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l03993"></a><span class="lineno"> 3993</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaBlocksOnSamePage(</div>
<div class="line"><a name="l03994"></a><span class="lineno"> 3994</span>&#160; VkDeviceSize resourceAOffset,</div>
<div class="line"><a name="l03995"></a><span class="lineno"> 3995</span>&#160; VkDeviceSize resourceASize,</div>
<div class="line"><a name="l03996"></a><span class="lineno"> 3996</span>&#160; VkDeviceSize resourceBOffset,</div>
<div class="line"><a name="l03997"></a><span class="lineno"> 3997</span>&#160; VkDeviceSize pageSize)</div>
<div class="line"><a name="l03998"></a><span class="lineno"> 3998</span>&#160;{</div>
<div class="line"><a name="l03999"></a><span class="lineno"> 3999</span>&#160; VMA_ASSERT(resourceAOffset + resourceASize &lt;= resourceBOffset &amp;&amp; resourceASize &gt; 0 &amp;&amp; pageSize &gt; 0);</div>
<div class="line"><a name="l04000"></a><span class="lineno"> 4000</span>&#160; VkDeviceSize resourceAEnd = resourceAOffset + resourceASize - 1;</div>
<div class="line"><a name="l04001"></a><span class="lineno"> 4001</span>&#160; VkDeviceSize resourceAEndPage = resourceAEnd &amp; ~(pageSize - 1);</div>
<div class="line"><a name="l04002"></a><span class="lineno"> 4002</span>&#160; VkDeviceSize resourceBStart = resourceBOffset;</div>
<div class="line"><a name="l04003"></a><span class="lineno"> 4003</span>&#160; VkDeviceSize resourceBStartPage = resourceBStart &amp; ~(pageSize - 1);</div>
<div class="line"><a name="l04004"></a><span class="lineno"> 4004</span>&#160; <span class="keywordflow">return</span> resourceAEndPage == resourceBStartPage;</div>
<div class="line"><a name="l04005"></a><span class="lineno"> 4005</span>&#160;}</div>
<div class="line"><a name="l04006"></a><span class="lineno"> 4006</span>&#160; </div>
<div class="line"><a name="l04007"></a><span class="lineno"> 4007</span>&#160;<span class="keyword">enum</span> VmaSuballocationType</div>
<div class="line"><a name="l04008"></a><span class="lineno"> 4008</span>&#160;{</div>
<div class="line"><a name="l04009"></a><span class="lineno"> 4009</span>&#160; VMA_SUBALLOCATION_TYPE_FREE = 0,</div>
<div class="line"><a name="l04010"></a><span class="lineno"> 4010</span>&#160; VMA_SUBALLOCATION_TYPE_UNKNOWN = 1,</div>
<div class="line"><a name="l04011"></a><span class="lineno"> 4011</span>&#160; VMA_SUBALLOCATION_TYPE_BUFFER = 2,</div>
<div class="line"><a name="l04012"></a><span class="lineno"> 4012</span>&#160; VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN = 3,</div>
<div class="line"><a name="l04013"></a><span class="lineno"> 4013</span>&#160; VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR = 4,</div>
<div class="line"><a name="l04014"></a><span class="lineno"> 4014</span>&#160; VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL = 5,</div>
<div class="line"><a name="l04015"></a><span class="lineno"> 4015</span>&#160; VMA_SUBALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF</div>
<div class="line"><a name="l04016"></a><span class="lineno"> 4016</span>&#160;};</div>
<div class="line"><a name="l04017"></a><span class="lineno"> 4017</span>&#160; </div>
<div class="line"><a name="l04018"></a><span class="lineno"> 4018</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l04019"></a><span class="lineno"> 4019</span>&#160;<span class="comment">Returns true if given suballocation types could conflict and must respect</span></div>
<div class="line"><a name="l04020"></a><span class="lineno"> 4020</span>&#160;<span class="comment">VkPhysicalDeviceLimits::bufferImageGranularity. They conflict if one is buffer</span></div>
<div class="line"><a name="l04021"></a><span class="lineno"> 4021</span>&#160;<span class="comment">or linear image and another one is optimal image. If type is unknown, behave</span></div>
<div class="line"><a name="l04022"></a><span class="lineno"> 4022</span>&#160;<span class="comment">conservatively.</span></div>
<div class="line"><a name="l04023"></a><span class="lineno"> 4023</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l04024"></a><span class="lineno"> 4024</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> VmaIsBufferImageGranularityConflict(</div>
<div class="line"><a name="l04025"></a><span class="lineno"> 4025</span>&#160; VmaSuballocationType suballocType1,</div>
<div class="line"><a name="l04026"></a><span class="lineno"> 4026</span>&#160; VmaSuballocationType suballocType2)</div>
<div class="line"><a name="l04027"></a><span class="lineno"> 4027</span>&#160;{</div>
<div class="line"><a name="l04028"></a><span class="lineno"> 4028</span>&#160; <span class="keywordflow">if</span>(suballocType1 &gt; suballocType2)</div>
<div class="line"><a name="l04029"></a><span class="lineno"> 4029</span>&#160; {</div>
<div class="line"><a name="l04030"></a><span class="lineno"> 4030</span>&#160; VMA_SWAP(suballocType1, suballocType2);</div>
<div class="line"><a name="l04031"></a><span class="lineno"> 4031</span>&#160; }</div>
<div class="line"><a name="l04032"></a><span class="lineno"> 4032</span>&#160; </div>
<div class="line"><a name="l04033"></a><span class="lineno"> 4033</span>&#160; <span class="keywordflow">switch</span>(suballocType1)</div>
<div class="line"><a name="l04034"></a><span class="lineno"> 4034</span>&#160; {</div>
<div class="line"><a name="l04035"></a><span class="lineno"> 4035</span>&#160; <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_FREE:</div>
<div class="line"><a name="l04036"></a><span class="lineno"> 4036</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l04037"></a><span class="lineno"> 4037</span>&#160; <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_UNKNOWN:</div>
<div class="line"><a name="l04038"></a><span class="lineno"> 4038</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l04039"></a><span class="lineno"> 4039</span>&#160; <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_BUFFER:</div>
<div class="line"><a name="l04040"></a><span class="lineno"> 4040</span>&#160; <span class="keywordflow">return</span></div>
<div class="line"><a name="l04041"></a><span class="lineno"> 4041</span>&#160; suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||</div>
<div class="line"><a name="l04042"></a><span class="lineno"> 4042</span>&#160; suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;</div>
<div class="line"><a name="l04043"></a><span class="lineno"> 4043</span>&#160; <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN:</div>
<div class="line"><a name="l04044"></a><span class="lineno"> 4044</span>&#160; <span class="keywordflow">return</span></div>
<div class="line"><a name="l04045"></a><span class="lineno"> 4045</span>&#160; suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||</div>
<div class="line"><a name="l04046"></a><span class="lineno"> 4046</span>&#160; suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR ||</div>
<div class="line"><a name="l04047"></a><span class="lineno"> 4047</span>&#160; suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;</div>
<div class="line"><a name="l04048"></a><span class="lineno"> 4048</span>&#160; <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_IMAGE_LINEAR:</div>
<div class="line"><a name="l04049"></a><span class="lineno"> 4049</span>&#160; <span class="keywordflow">return</span></div>
<div class="line"><a name="l04050"></a><span class="lineno"> 4050</span>&#160; suballocType2 == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL;</div>
<div class="line"><a name="l04051"></a><span class="lineno"> 4051</span>&#160; <span class="keywordflow">case</span> VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL:</div>
<div class="line"><a name="l04052"></a><span class="lineno"> 4052</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l04053"></a><span class="lineno"> 4053</span>&#160; <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l04054"></a><span class="lineno"> 4054</span>&#160; VMA_ASSERT(0);</div>
<div class="line"><a name="l04055"></a><span class="lineno"> 4055</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l04056"></a><span class="lineno"> 4056</span>&#160; }</div>
<div class="line"><a name="l04057"></a><span class="lineno"> 4057</span>&#160;}</div>
<div class="line"><a name="l04058"></a><span class="lineno"> 4058</span>&#160; </div>
<div class="line"><a name="l04059"></a><span class="lineno"> 4059</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaWriteMagicValue(<span class="keywordtype">void</span>* pData, VkDeviceSize offset)</div>
<div class="line"><a name="l04060"></a><span class="lineno"> 4060</span>&#160;{</div>
<div class="line"><a name="l04061"></a><span class="lineno"> 4061</span>&#160;<span class="preprocessor">#if VMA_DEBUG_MARGIN &gt; 0 &amp;&amp; VMA_DEBUG_DETECT_CORRUPTION</span></div>
<div class="line"><a name="l04062"></a><span class="lineno"> 4062</span>&#160; uint32_t* pDst = (uint32_t*)((<span class="keywordtype">char</span>*)pData + offset);</div>
<div class="line"><a name="l04063"></a><span class="lineno"> 4063</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> numberCount = VMA_DEBUG_MARGIN / <span class="keyword">sizeof</span>(uint32_t);</div>
<div class="line"><a name="l04064"></a><span class="lineno"> 4064</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; numberCount; ++i, ++pDst)</div>
<div class="line"><a name="l04065"></a><span class="lineno"> 4065</span>&#160; {</div>
<div class="line"><a name="l04066"></a><span class="lineno"> 4066</span>&#160; *pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;</div>
<div class="line"><a name="l04067"></a><span class="lineno"> 4067</span>&#160; }</div>
<div class="line"><a name="l04068"></a><span class="lineno"> 4068</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l04069"></a><span class="lineno"> 4069</span>&#160; <span class="comment">// no-op</span></div>
<div class="line"><a name="l04070"></a><span class="lineno"> 4070</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l04071"></a><span class="lineno"> 4071</span>&#160;}</div>
<div class="line"><a name="l04072"></a><span class="lineno"> 4072</span>&#160; </div>
<div class="line"><a name="l04073"></a><span class="lineno"> 4073</span>&#160;<span class="keyword">static</span> <span class="keywordtype">bool</span> VmaValidateMagicValue(<span class="keyword">const</span> <span class="keywordtype">void</span>* pData, VkDeviceSize offset)</div>
<div class="line"><a name="l04074"></a><span class="lineno"> 4074</span>&#160;{</div>
<div class="line"><a name="l04075"></a><span class="lineno"> 4075</span>&#160;<span class="preprocessor">#if VMA_DEBUG_MARGIN &gt; 0 &amp;&amp; VMA_DEBUG_DETECT_CORRUPTION</span></div>
<div class="line"><a name="l04076"></a><span class="lineno"> 4076</span>&#160; <span class="keyword">const</span> uint32_t* pSrc = (<span class="keyword">const</span> uint32_t*)((<span class="keyword">const</span> <span class="keywordtype">char</span>*)pData + offset);</div>
<div class="line"><a name="l04077"></a><span class="lineno"> 4077</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> numberCount = VMA_DEBUG_MARGIN / <span class="keyword">sizeof</span>(uint32_t);</div>
<div class="line"><a name="l04078"></a><span class="lineno"> 4078</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; numberCount; ++i, ++pSrc)</div>
<div class="line"><a name="l04079"></a><span class="lineno"> 4079</span>&#160; {</div>
<div class="line"><a name="l04080"></a><span class="lineno"> 4080</span>&#160; <span class="keywordflow">if</span>(*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE)</div>
<div class="line"><a name="l04081"></a><span class="lineno"> 4081</span>&#160; {</div>
<div class="line"><a name="l04082"></a><span class="lineno"> 4082</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l04083"></a><span class="lineno"> 4083</span>&#160; }</div>
<div class="line"><a name="l04084"></a><span class="lineno"> 4084</span>&#160; }</div>
<div class="line"><a name="l04085"></a><span class="lineno"> 4085</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l04086"></a><span class="lineno"> 4086</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l04087"></a><span class="lineno"> 4087</span>&#160;}</div>
<div class="line"><a name="l04088"></a><span class="lineno"> 4088</span>&#160; </div>
<div class="line"><a name="l04089"></a><span class="lineno"> 4089</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l04090"></a><span class="lineno"> 4090</span>&#160;<span class="comment">Fills structure with parameters of an example buffer to be used for transfers</span></div>
<div class="line"><a name="l04091"></a><span class="lineno"> 4091</span>&#160;<span class="comment">during GPU memory defragmentation.</span></div>
<div class="line"><a name="l04092"></a><span class="lineno"> 4092</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l04093"></a><span class="lineno"> 4093</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFillGpuDefragmentationBufferCreateInfo(VkBufferCreateInfo&amp; outBufCreateInfo)</div>
<div class="line"><a name="l04094"></a><span class="lineno"> 4094</span>&#160;{</div>
<div class="line"><a name="l04095"></a><span class="lineno"> 4095</span>&#160; memset(&amp;outBufCreateInfo, 0, <span class="keyword">sizeof</span>(outBufCreateInfo));</div>
<div class="line"><a name="l04096"></a><span class="lineno"> 4096</span>&#160; outBufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;</div>
<div class="line"><a name="l04097"></a><span class="lineno"> 4097</span>&#160; outBufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;</div>
<div class="line"><a name="l04098"></a><span class="lineno"> 4098</span>&#160; outBufCreateInfo.size = (VkDeviceSize)VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE; <span class="comment">// Example size.</span></div>
<div class="line"><a name="l04099"></a><span class="lineno"> 4099</span>&#160;}</div>
<div class="line"><a name="l04100"></a><span class="lineno"> 4100</span>&#160; </div>
<div class="line"><a name="l04101"></a><span class="lineno"> 4101</span>&#160;<span class="comment">// Helper RAII class to lock a mutex in constructor and unlock it in destructor (at the end of scope).</span></div>
<div class="line"><a name="l04102"></a><span class="lineno"> 4102</span>&#160;<span class="keyword">struct </span>VmaMutexLock</div>
<div class="line"><a name="l04103"></a><span class="lineno"> 4103</span>&#160;{</div>
<div class="line"><a name="l04104"></a><span class="lineno"> 4104</span>&#160; VMA_CLASS_NO_COPY(VmaMutexLock)</div>
<div class="line"><a name="l04105"></a><span class="lineno"> 4105</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l04106"></a><span class="lineno"> 4106</span>&#160; VmaMutexLock(VMA_MUTEX&amp; mutex, <span class="keywordtype">bool</span> useMutex = <span class="keyword">true</span>) :</div>
<div class="line"><a name="l04107"></a><span class="lineno"> 4107</span>&#160; m_pMutex(useMutex ? &amp;mutex : VMA_NULL)</div>
<div class="line"><a name="l04108"></a><span class="lineno"> 4108</span>&#160; { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;Lock(); } }</div>
<div class="line"><a name="l04109"></a><span class="lineno"> 4109</span>&#160; ~VmaMutexLock()</div>
<div class="line"><a name="l04110"></a><span class="lineno"> 4110</span>&#160; { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;Unlock(); } }</div>
<div class="line"><a name="l04111"></a><span class="lineno"> 4111</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l04112"></a><span class="lineno"> 4112</span>&#160; VMA_MUTEX* m_pMutex;</div>
<div class="line"><a name="l04113"></a><span class="lineno"> 4113</span>&#160;};</div>
<div class="line"><a name="l04114"></a><span class="lineno"> 4114</span>&#160; </div>
<div class="line"><a name="l04115"></a><span class="lineno"> 4115</span>&#160;<span class="comment">// Helper RAII class to lock a RW mutex in constructor and unlock it in destructor (at the end of scope), for reading.</span></div>
<div class="line"><a name="l04116"></a><span class="lineno"> 4116</span>&#160;<span class="keyword">struct </span>VmaMutexLockRead</div>
<div class="line"><a name="l04117"></a><span class="lineno"> 4117</span>&#160;{</div>
<div class="line"><a name="l04118"></a><span class="lineno"> 4118</span>&#160; VMA_CLASS_NO_COPY(VmaMutexLockRead)</div>
<div class="line"><a name="l04119"></a><span class="lineno"> 4119</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l04120"></a><span class="lineno"> 4120</span>&#160; VmaMutexLockRead(VMA_RW_MUTEX&amp; mutex, <span class="keywordtype">bool</span> useMutex) :</div>
<div class="line"><a name="l04121"></a><span class="lineno"> 4121</span>&#160; m_pMutex(useMutex ? &amp;mutex : VMA_NULL)</div>
<div class="line"><a name="l04122"></a><span class="lineno"> 4122</span>&#160; { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;LockRead(); } }</div>
<div class="line"><a name="l04123"></a><span class="lineno"> 4123</span>&#160; ~VmaMutexLockRead() { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;UnlockRead(); } }</div>
<div class="line"><a name="l04124"></a><span class="lineno"> 4124</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l04125"></a><span class="lineno"> 4125</span>&#160; VMA_RW_MUTEX* m_pMutex;</div>
<div class="line"><a name="l04126"></a><span class="lineno"> 4126</span>&#160;};</div>
<div class="line"><a name="l04127"></a><span class="lineno"> 4127</span>&#160; </div>
<div class="line"><a name="l04128"></a><span class="lineno"> 4128</span>&#160;<span class="comment">// Helper RAII class to lock a RW mutex in constructor and unlock it in destructor (at the end of scope), for writing.</span></div>
<div class="line"><a name="l04129"></a><span class="lineno"> 4129</span>&#160;<span class="keyword">struct </span>VmaMutexLockWrite</div>
<div class="line"><a name="l04130"></a><span class="lineno"> 4130</span>&#160;{</div>
<div class="line"><a name="l04131"></a><span class="lineno"> 4131</span>&#160; VMA_CLASS_NO_COPY(VmaMutexLockWrite)</div>
<div class="line"><a name="l04132"></a><span class="lineno"> 4132</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l04133"></a><span class="lineno"> 4133</span>&#160; VmaMutexLockWrite(VMA_RW_MUTEX&amp; mutex, <span class="keywordtype">bool</span> useMutex) :</div>
<div class="line"><a name="l04134"></a><span class="lineno"> 4134</span>&#160; m_pMutex(useMutex ? &amp;mutex : VMA_NULL)</div>
<div class="line"><a name="l04135"></a><span class="lineno"> 4135</span>&#160; { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;LockWrite(); } }</div>
<div class="line"><a name="l04136"></a><span class="lineno"> 4136</span>&#160; ~VmaMutexLockWrite() { <span class="keywordflow">if</span>(m_pMutex) { m_pMutex-&gt;UnlockWrite(); } }</div>
<div class="line"><a name="l04137"></a><span class="lineno"> 4137</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l04138"></a><span class="lineno"> 4138</span>&#160; VMA_RW_MUTEX* m_pMutex;</div>
<div class="line"><a name="l04139"></a><span class="lineno"> 4139</span>&#160;};</div>
<div class="line"><a name="l04140"></a><span class="lineno"> 4140</span>&#160; </div>
<div class="line"><a name="l04141"></a><span class="lineno"> 4141</span>&#160;<span class="preprocessor">#if VMA_DEBUG_GLOBAL_MUTEX</span></div>
<div class="line"><a name="l04142"></a><span class="lineno"> 4142</span>&#160; <span class="keyword">static</span> VMA_MUTEX gDebugGlobalMutex;</div>
<div class="line"><a name="l04143"></a><span class="lineno"> 4143</span>&#160;<span class="preprocessor"> #define VMA_DEBUG_GLOBAL_MUTEX_LOCK VmaMutexLock debugGlobalMutexLock(gDebugGlobalMutex, true);</span></div>
<div class="line"><a name="l04144"></a><span class="lineno"> 4144</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l04145"></a><span class="lineno"> 4145</span>&#160;<span class="preprocessor"> #define VMA_DEBUG_GLOBAL_MUTEX_LOCK</span></div>
<div class="line"><a name="l04146"></a><span class="lineno"> 4146</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l04147"></a><span class="lineno"> 4147</span>&#160; </div>
<div class="line"><a name="l04148"></a><span class="lineno"> 4148</span>&#160;<span class="comment">// Minimum size of a free suballocation to register it in the free suballocation collection.</span></div>
<div class="line"><a name="l04149"></a><span class="lineno"> 4149</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> VkDeviceSize VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER = 16;</div>
<div class="line"><a name="l04150"></a><span class="lineno"> 4150</span>&#160; </div>
<div class="line"><a name="l04151"></a><span class="lineno"> 4151</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l04152"></a><span class="lineno"> 4152</span>&#160;<span class="comment">Performs binary search and returns iterator to first element that is greater or</span></div>
<div class="line"><a name="l04153"></a><span class="lineno"> 4153</span>&#160;<span class="comment">equal to (key), according to comparison (cmp).</span></div>
<div class="line"><a name="l04154"></a><span class="lineno"> 4154</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l04155"></a><span class="lineno"> 4155</span>&#160;<span class="comment">Cmp should return true if first argument is less than second argument.</span></div>
<div class="line"><a name="l04156"></a><span class="lineno"> 4156</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l04157"></a><span class="lineno"> 4157</span>&#160;<span class="comment">Returned value is the found element, if present in the collection or place where</span></div>
<div class="line"><a name="l04158"></a><span class="lineno"> 4158</span>&#160;<span class="comment">new element with value (key) should be inserted.</span></div>
<div class="line"><a name="l04159"></a><span class="lineno"> 4159</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l04160"></a><span class="lineno"> 4160</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> IterT, <span class="keyword">typename</span> KeyT&gt;</div>
<div class="line"><a name="l04161"></a><span class="lineno"> 4161</span>&#160;<span class="keyword">static</span> IterT VmaBinaryFindFirstNotLess(IterT beg, IterT end, <span class="keyword">const</span> KeyT &amp;key, <span class="keyword">const</span> CmpLess&amp; cmp)</div>
<div class="line"><a name="l04162"></a><span class="lineno"> 4162</span>&#160;{</div>
<div class="line"><a name="l04163"></a><span class="lineno"> 4163</span>&#160; <span class="keywordtype">size_t</span> down = 0, up = (end - beg);</div>
<div class="line"><a name="l04164"></a><span class="lineno"> 4164</span>&#160; <span class="keywordflow">while</span>(down &lt; up)</div>
<div class="line"><a name="l04165"></a><span class="lineno"> 4165</span>&#160; {</div>
<div class="line"><a name="l04166"></a><span class="lineno"> 4166</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> mid = (down + up) / 2;</div>
<div class="line"><a name="l04167"></a><span class="lineno"> 4167</span>&#160; <span class="keywordflow">if</span>(cmp(*(beg+mid), key))</div>
<div class="line"><a name="l04168"></a><span class="lineno"> 4168</span>&#160; {</div>
<div class="line"><a name="l04169"></a><span class="lineno"> 4169</span>&#160; down = mid + 1;</div>
<div class="line"><a name="l04170"></a><span class="lineno"> 4170</span>&#160; }</div>
<div class="line"><a name="l04171"></a><span class="lineno"> 4171</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l04172"></a><span class="lineno"> 4172</span>&#160; {</div>
<div class="line"><a name="l04173"></a><span class="lineno"> 4173</span>&#160; up = mid;</div>
<div class="line"><a name="l04174"></a><span class="lineno"> 4174</span>&#160; }</div>
<div class="line"><a name="l04175"></a><span class="lineno"> 4175</span>&#160; }</div>
<div class="line"><a name="l04176"></a><span class="lineno"> 4176</span>&#160; <span class="keywordflow">return</span> beg + down;</div>
<div class="line"><a name="l04177"></a><span class="lineno"> 4177</span>&#160;}</div>
<div class="line"><a name="l04178"></a><span class="lineno"> 4178</span>&#160; </div>
<div class="line"><a name="l04179"></a><span class="lineno"> 4179</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> IterT, <span class="keyword">typename</span> KeyT&gt;</div>
<div class="line"><a name="l04180"></a><span class="lineno"> 4180</span>&#160;IterT VmaBinaryFindSorted(<span class="keyword">const</span> IterT&amp; beg, <span class="keyword">const</span> IterT&amp; end, <span class="keyword">const</span> KeyT&amp; value, <span class="keyword">const</span> CmpLess&amp; cmp)</div>
<div class="line"><a name="l04181"></a><span class="lineno"> 4181</span>&#160;{</div>
<div class="line"><a name="l04182"></a><span class="lineno"> 4182</span>&#160; IterT it = VmaBinaryFindFirstNotLess&lt;CmpLess, IterT, KeyT&gt;(</div>
<div class="line"><a name="l04183"></a><span class="lineno"> 4183</span>&#160; beg, end, value, cmp);</div>
<div class="line"><a name="l04184"></a><span class="lineno"> 4184</span>&#160; <span class="keywordflow">if</span>(it == end ||</div>
<div class="line"><a name="l04185"></a><span class="lineno"> 4185</span>&#160; (!cmp(*it, value) &amp;&amp; !cmp(value, *it)))</div>
<div class="line"><a name="l04186"></a><span class="lineno"> 4186</span>&#160; {</div>
<div class="line"><a name="l04187"></a><span class="lineno"> 4187</span>&#160; <span class="keywordflow">return</span> it;</div>
<div class="line"><a name="l04188"></a><span class="lineno"> 4188</span>&#160; }</div>
<div class="line"><a name="l04189"></a><span class="lineno"> 4189</span>&#160; <span class="keywordflow">return</span> end;</div>
<div class="line"><a name="l04190"></a><span class="lineno"> 4190</span>&#160;}</div>
<div class="line"><a name="l04191"></a><span class="lineno"> 4191</span>&#160; </div>
<div class="line"><a name="l04192"></a><span class="lineno"> 4192</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l04193"></a><span class="lineno"> 4193</span>&#160;<span class="comment">Returns true if all pointers in the array are not-null and unique.</span></div>
<div class="line"><a name="l04194"></a><span class="lineno"> 4194</span>&#160;<span class="comment">Warning! O(n^2) complexity. Use only inside VMA_HEAVY_ASSERT.</span></div>
<div class="line"><a name="l04195"></a><span class="lineno"> 4195</span>&#160;<span class="comment">T must be pointer type, e.g. VmaAllocation, VmaPool.</span></div>
<div class="line"><a name="l04196"></a><span class="lineno"> 4196</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l04197"></a><span class="lineno"> 4197</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04198"></a><span class="lineno"> 4198</span>&#160;<span class="keyword">static</span> <span class="keywordtype">bool</span> VmaValidatePointerArray(uint32_t count, <span class="keyword">const</span> T* arr)</div>
<div class="line"><a name="l04199"></a><span class="lineno"> 4199</span>&#160;{</div>
<div class="line"><a name="l04200"></a><span class="lineno"> 4200</span>&#160; <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; count; ++i)</div>
<div class="line"><a name="l04201"></a><span class="lineno"> 4201</span>&#160; {</div>
<div class="line"><a name="l04202"></a><span class="lineno"> 4202</span>&#160; <span class="keyword">const</span> T iPtr = arr[i];</div>
<div class="line"><a name="l04203"></a><span class="lineno"> 4203</span>&#160; <span class="keywordflow">if</span>(iPtr == VMA_NULL)</div>
<div class="line"><a name="l04204"></a><span class="lineno"> 4204</span>&#160; {</div>
<div class="line"><a name="l04205"></a><span class="lineno"> 4205</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l04206"></a><span class="lineno"> 4206</span>&#160; }</div>
<div class="line"><a name="l04207"></a><span class="lineno"> 4207</span>&#160; <span class="keywordflow">for</span>(uint32_t j = i + 1; j &lt; count; ++j)</div>
<div class="line"><a name="l04208"></a><span class="lineno"> 4208</span>&#160; {</div>
<div class="line"><a name="l04209"></a><span class="lineno"> 4209</span>&#160; <span class="keywordflow">if</span>(iPtr == arr[j])</div>
<div class="line"><a name="l04210"></a><span class="lineno"> 4210</span>&#160; {</div>
<div class="line"><a name="l04211"></a><span class="lineno"> 4211</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l04212"></a><span class="lineno"> 4212</span>&#160; }</div>
<div class="line"><a name="l04213"></a><span class="lineno"> 4213</span>&#160; }</div>
<div class="line"><a name="l04214"></a><span class="lineno"> 4214</span>&#160; }</div>
<div class="line"><a name="l04215"></a><span class="lineno"> 4215</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l04216"></a><span class="lineno"> 4216</span>&#160;}</div>
<div class="line"><a name="l04217"></a><span class="lineno"> 4217</span>&#160; </div>
<div class="line"><a name="l04219"></a><span class="lineno"> 4219</span>&#160;<span class="comment">// Memory allocation</span></div>
<div class="line"><a name="l04220"></a><span class="lineno"> 4220</span>&#160; </div>
<div class="line"><a name="l04221"></a><span class="lineno"> 4221</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span>* VmaMalloc(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, <span class="keywordtype">size_t</span> size, <span class="keywordtype">size_t</span> alignment)</div>
<div class="line"><a name="l04222"></a><span class="lineno"> 4222</span>&#160;{</div>
<div class="line"><a name="l04223"></a><span class="lineno"> 4223</span>&#160; <span class="keywordflow">if</span>((pAllocationCallbacks != VMA_NULL) &amp;&amp;</div>
<div class="line"><a name="l04224"></a><span class="lineno"> 4224</span>&#160; (pAllocationCallbacks-&gt;pfnAllocation != VMA_NULL))</div>
<div class="line"><a name="l04225"></a><span class="lineno"> 4225</span>&#160; {</div>
<div class="line"><a name="l04226"></a><span class="lineno"> 4226</span>&#160; <span class="keywordflow">return</span> (*pAllocationCallbacks-&gt;pfnAllocation)(</div>
<div class="line"><a name="l04227"></a><span class="lineno"> 4227</span>&#160; pAllocationCallbacks-&gt;pUserData,</div>
<div class="line"><a name="l04228"></a><span class="lineno"> 4228</span>&#160; size,</div>
<div class="line"><a name="l04229"></a><span class="lineno"> 4229</span>&#160; alignment,</div>
<div class="line"><a name="l04230"></a><span class="lineno"> 4230</span>&#160; VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);</div>
<div class="line"><a name="l04231"></a><span class="lineno"> 4231</span>&#160; }</div>
<div class="line"><a name="l04232"></a><span class="lineno"> 4232</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l04233"></a><span class="lineno"> 4233</span>&#160; {</div>
<div class="line"><a name="l04234"></a><span class="lineno"> 4234</span>&#160; <span class="keywordflow">return</span> VMA_SYSTEM_ALIGNED_MALLOC(size, alignment);</div>
<div class="line"><a name="l04235"></a><span class="lineno"> 4235</span>&#160; }</div>
<div class="line"><a name="l04236"></a><span class="lineno"> 4236</span>&#160;}</div>
<div class="line"><a name="l04237"></a><span class="lineno"> 4237</span>&#160; </div>
<div class="line"><a name="l04238"></a><span class="lineno"> 4238</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFree(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, <span class="keywordtype">void</span>* ptr)</div>
<div class="line"><a name="l04239"></a><span class="lineno"> 4239</span>&#160;{</div>
<div class="line"><a name="l04240"></a><span class="lineno"> 4240</span>&#160; <span class="keywordflow">if</span>((pAllocationCallbacks != VMA_NULL) &amp;&amp;</div>
<div class="line"><a name="l04241"></a><span class="lineno"> 4241</span>&#160; (pAllocationCallbacks-&gt;pfnFree != VMA_NULL))</div>
<div class="line"><a name="l04242"></a><span class="lineno"> 4242</span>&#160; {</div>
<div class="line"><a name="l04243"></a><span class="lineno"> 4243</span>&#160; (*pAllocationCallbacks-&gt;pfnFree)(pAllocationCallbacks-&gt;pUserData, ptr);</div>
<div class="line"><a name="l04244"></a><span class="lineno"> 4244</span>&#160; }</div>
<div class="line"><a name="l04245"></a><span class="lineno"> 4245</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l04246"></a><span class="lineno"> 4246</span>&#160; {</div>
<div class="line"><a name="l04247"></a><span class="lineno"> 4247</span>&#160; VMA_SYSTEM_FREE(ptr);</div>
<div class="line"><a name="l04248"></a><span class="lineno"> 4248</span>&#160; }</div>
<div class="line"><a name="l04249"></a><span class="lineno"> 4249</span>&#160;}</div>
<div class="line"><a name="l04250"></a><span class="lineno"> 4250</span>&#160; </div>
<div class="line"><a name="l04251"></a><span class="lineno"> 4251</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04252"></a><span class="lineno"> 4252</span>&#160;<span class="keyword">static</span> T* VmaAllocate(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks)</div>
<div class="line"><a name="l04253"></a><span class="lineno"> 4253</span>&#160;{</div>
<div class="line"><a name="l04254"></a><span class="lineno"> 4254</span>&#160; <span class="keywordflow">return</span> (T*)VmaMalloc(pAllocationCallbacks, <span class="keyword">sizeof</span>(T), VMA_ALIGN_OF(T));</div>
<div class="line"><a name="l04255"></a><span class="lineno"> 4255</span>&#160;}</div>
<div class="line"><a name="l04256"></a><span class="lineno"> 4256</span>&#160; </div>
<div class="line"><a name="l04257"></a><span class="lineno"> 4257</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04258"></a><span class="lineno"> 4258</span>&#160;<span class="keyword">static</span> T* VmaAllocateArray(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, <span class="keywordtype">size_t</span> count)</div>
<div class="line"><a name="l04259"></a><span class="lineno"> 4259</span>&#160;{</div>
<div class="line"><a name="l04260"></a><span class="lineno"> 4260</span>&#160; <span class="keywordflow">return</span> (T*)VmaMalloc(pAllocationCallbacks, <span class="keyword">sizeof</span>(T) * count, VMA_ALIGN_OF(T));</div>
<div class="line"><a name="l04261"></a><span class="lineno"> 4261</span>&#160;}</div>
<div class="line"><a name="l04262"></a><span class="lineno"> 4262</span>&#160; </div>
<div class="line"><a name="l04263"></a><span class="lineno"> 4263</span>&#160;<span class="preprocessor">#define vma_new(allocator, type) new(VmaAllocate&lt;type&gt;(allocator))(type)</span></div>
<div class="line"><a name="l04264"></a><span class="lineno"> 4264</span>&#160; </div>
<div class="line"><a name="l04265"></a><span class="lineno"> 4265</span>&#160;<span class="preprocessor">#define vma_new_array(allocator, type, count) new(VmaAllocateArray&lt;type&gt;((allocator), (count)))(type)</span></div>
<div class="line"><a name="l04266"></a><span class="lineno"> 4266</span>&#160; </div>
<div class="line"><a name="l04267"></a><span class="lineno"> 4267</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04268"></a><span class="lineno"> 4268</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, T* ptr)</div>
<div class="line"><a name="l04269"></a><span class="lineno"> 4269</span>&#160;{</div>
<div class="line"><a name="l04270"></a><span class="lineno"> 4270</span>&#160; ptr-&gt;~T();</div>
<div class="line"><a name="l04271"></a><span class="lineno"> 4271</span>&#160; VmaFree(pAllocationCallbacks, ptr);</div>
<div class="line"><a name="l04272"></a><span class="lineno"> 4272</span>&#160;}</div>
<div class="line"><a name="l04273"></a><span class="lineno"> 4273</span>&#160; </div>
<div class="line"><a name="l04274"></a><span class="lineno"> 4274</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04275"></a><span class="lineno"> 4275</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete_array(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, T* ptr, <span class="keywordtype">size_t</span> count)</div>
<div class="line"><a name="l04276"></a><span class="lineno"> 4276</span>&#160;{</div>
<div class="line"><a name="l04277"></a><span class="lineno"> 4277</span>&#160; <span class="keywordflow">if</span>(ptr != VMA_NULL)</div>
<div class="line"><a name="l04278"></a><span class="lineno"> 4278</span>&#160; {</div>
<div class="line"><a name="l04279"></a><span class="lineno"> 4279</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = count; i--; )</div>
<div class="line"><a name="l04280"></a><span class="lineno"> 4280</span>&#160; {</div>
<div class="line"><a name="l04281"></a><span class="lineno"> 4281</span>&#160; ptr[i].~T();</div>
<div class="line"><a name="l04282"></a><span class="lineno"> 4282</span>&#160; }</div>
<div class="line"><a name="l04283"></a><span class="lineno"> 4283</span>&#160; VmaFree(pAllocationCallbacks, ptr);</div>
<div class="line"><a name="l04284"></a><span class="lineno"> 4284</span>&#160; }</div>
<div class="line"><a name="l04285"></a><span class="lineno"> 4285</span>&#160;}</div>
<div class="line"><a name="l04286"></a><span class="lineno"> 4286</span>&#160; </div>
<div class="line"><a name="l04287"></a><span class="lineno"> 4287</span>&#160;<span class="keyword">static</span> <span class="keywordtype">char</span>* VmaCreateStringCopy(<span class="keyword">const</span> VkAllocationCallbacks* allocs, <span class="keyword">const</span> <span class="keywordtype">char</span>* srcStr)</div>
<div class="line"><a name="l04288"></a><span class="lineno"> 4288</span>&#160;{</div>
<div class="line"><a name="l04289"></a><span class="lineno"> 4289</span>&#160; <span class="keywordflow">if</span>(srcStr != VMA_NULL)</div>
<div class="line"><a name="l04290"></a><span class="lineno"> 4290</span>&#160; {</div>
<div class="line"><a name="l04291"></a><span class="lineno"> 4291</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> len = strlen(srcStr);</div>
<div class="line"><a name="l04292"></a><span class="lineno"> 4292</span>&#160; <span class="keywordtype">char</span>* <span class="keyword">const</span> result = vma_new_array(allocs, <span class="keywordtype">char</span>, len + 1);</div>
<div class="line"><a name="l04293"></a><span class="lineno"> 4293</span>&#160; memcpy(result, srcStr, len + 1);</div>
<div class="line"><a name="l04294"></a><span class="lineno"> 4294</span>&#160; <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l04295"></a><span class="lineno"> 4295</span>&#160; }</div>
<div class="line"><a name="l04296"></a><span class="lineno"> 4296</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l04297"></a><span class="lineno"> 4297</span>&#160; {</div>
<div class="line"><a name="l04298"></a><span class="lineno"> 4298</span>&#160; <span class="keywordflow">return</span> VMA_NULL;</div>
<div class="line"><a name="l04299"></a><span class="lineno"> 4299</span>&#160; }</div>
<div class="line"><a name="l04300"></a><span class="lineno"> 4300</span>&#160;}</div>
<div class="line"><a name="l04301"></a><span class="lineno"> 4301</span>&#160; </div>
<div class="line"><a name="l04302"></a><span class="lineno"> 4302</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFreeString(<span class="keyword">const</span> VkAllocationCallbacks* allocs, <span class="keywordtype">char</span>* str)</div>
<div class="line"><a name="l04303"></a><span class="lineno"> 4303</span>&#160;{</div>
<div class="line"><a name="l04304"></a><span class="lineno"> 4304</span>&#160; <span class="keywordflow">if</span>(str != VMA_NULL)</div>
<div class="line"><a name="l04305"></a><span class="lineno"> 4305</span>&#160; {</div>
<div class="line"><a name="l04306"></a><span class="lineno"> 4306</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> len = strlen(str);</div>
<div class="line"><a name="l04307"></a><span class="lineno"> 4307</span>&#160; vma_delete_array(allocs, str, len + 1);</div>
<div class="line"><a name="l04308"></a><span class="lineno"> 4308</span>&#160; }</div>
<div class="line"><a name="l04309"></a><span class="lineno"> 4309</span>&#160;}</div>
<div class="line"><a name="l04310"></a><span class="lineno"> 4310</span>&#160; </div>
<div class="line"><a name="l04311"></a><span class="lineno"> 4311</span>&#160;<span class="comment">// STL-compatible allocator.</span></div>
<div class="line"><a name="l04312"></a><span class="lineno"> 4312</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04313"></a><span class="lineno"> 4313</span>&#160;<span class="keyword">class </span>VmaStlAllocator</div>
<div class="line"><a name="l04314"></a><span class="lineno"> 4314</span>&#160;{</div>
<div class="line"><a name="l04315"></a><span class="lineno"> 4315</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l04316"></a><span class="lineno"> 4316</span>&#160; <span class="keyword">const</span> VkAllocationCallbacks* <span class="keyword">const</span> m_pCallbacks;</div>
<div class="line"><a name="l04317"></a><span class="lineno"> 4317</span>&#160; <span class="keyword">typedef</span> T value_type;</div>
<div class="line"><a name="l04318"></a><span class="lineno"> 4318</span>&#160; </div>
<div class="line"><a name="l04319"></a><span class="lineno"> 4319</span>&#160; VmaStlAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pCallbacks) : m_pCallbacks(pCallbacks) { }</div>
<div class="line"><a name="l04320"></a><span class="lineno"> 4320</span>&#160; <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt; VmaStlAllocator(<span class="keyword">const</span> VmaStlAllocator&lt;U&gt;&amp; src) : m_pCallbacks(src.m_pCallbacks) { }</div>
<div class="line"><a name="l04321"></a><span class="lineno"> 4321</span>&#160; </div>
<div class="line"><a name="l04322"></a><span class="lineno"> 4322</span>&#160; T* allocate(<span class="keywordtype">size_t</span> n) { <span class="keywordflow">return</span> VmaAllocateArray&lt;T&gt;(m_pCallbacks, n); }</div>
<div class="line"><a name="l04323"></a><span class="lineno"> 4323</span>&#160; <span class="keywordtype">void</span> deallocate(T* p, <span class="keywordtype">size_t</span> n) { VmaFree(m_pCallbacks, p); }</div>
<div class="line"><a name="l04324"></a><span class="lineno"> 4324</span>&#160; </div>
<div class="line"><a name="l04325"></a><span class="lineno"> 4325</span>&#160; <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt;</div>
<div class="line"><a name="l04326"></a><span class="lineno"> 4326</span>&#160; <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> VmaStlAllocator&lt;U&gt;&amp; rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l04327"></a><span class="lineno"> 4327</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l04328"></a><span class="lineno"> 4328</span>&#160; <span class="keywordflow">return</span> m_pCallbacks == rhs.m_pCallbacks;</div>
<div class="line"><a name="l04329"></a><span class="lineno"> 4329</span>&#160; }</div>
<div class="line"><a name="l04330"></a><span class="lineno"> 4330</span>&#160; <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt;</div>
<div class="line"><a name="l04331"></a><span class="lineno"> 4331</span>&#160; <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> VmaStlAllocator&lt;U&gt;&amp; rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l04332"></a><span class="lineno"> 4332</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l04333"></a><span class="lineno"> 4333</span>&#160; <span class="keywordflow">return</span> m_pCallbacks != rhs.m_pCallbacks;</div>
<div class="line"><a name="l04334"></a><span class="lineno"> 4334</span>&#160; }</div>
<div class="line"><a name="l04335"></a><span class="lineno"> 4335</span>&#160; </div>
<div class="line"><a name="l04336"></a><span class="lineno"> 4336</span>&#160; VmaStlAllocator&amp; operator=(<span class="keyword">const</span> VmaStlAllocator&amp; x) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l04337"></a><span class="lineno"> 4337</span>&#160;};</div>
<div class="line"><a name="l04338"></a><span class="lineno"> 4338</span>&#160; </div>
<div class="line"><a name="l04339"></a><span class="lineno"> 4339</span>&#160;<span class="preprocessor">#if VMA_USE_STL_VECTOR</span></div>
<div class="line"><a name="l04340"></a><span class="lineno"> 4340</span>&#160; </div>
<div class="line"><a name="l04341"></a><span class="lineno"> 4341</span>&#160;<span class="preprocessor">#define VmaVector std::vector</span></div>
<div class="line"><a name="l04342"></a><span class="lineno"> 4342</span>&#160; </div>
<div class="line"><a name="l04343"></a><span class="lineno"> 4343</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
<div class="line"><a name="l04344"></a><span class="lineno"> 4344</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorInsert(std::vector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index, <span class="keyword">const</span> T&amp; item)</div>
<div class="line"><a name="l04345"></a><span class="lineno"> 4345</span>&#160;{</div>
<div class="line"><a name="l04346"></a><span class="lineno"> 4346</span>&#160; vec.insert(vec.begin() + index, item);</div>
<div class="line"><a name="l04347"></a><span class="lineno"> 4347</span>&#160;}</div>
<div class="line"><a name="l04348"></a><span class="lineno"> 4348</span>&#160; </div>
<div class="line"><a name="l04349"></a><span class="lineno"> 4349</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
<div class="line"><a name="l04350"></a><span class="lineno"> 4350</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorRemove(std::vector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index)</div>
<div class="line"><a name="l04351"></a><span class="lineno"> 4351</span>&#160;{</div>
<div class="line"><a name="l04352"></a><span class="lineno"> 4352</span>&#160; vec.erase(vec.begin() + index);</div>
<div class="line"><a name="l04353"></a><span class="lineno"> 4353</span>&#160;}</div>
<div class="line"><a name="l04354"></a><span class="lineno"> 4354</span>&#160; </div>
<div class="line"><a name="l04355"></a><span class="lineno"> 4355</span>&#160;<span class="preprocessor">#else // #if VMA_USE_STL_VECTOR</span></div>
<div class="line"><a name="l04356"></a><span class="lineno"> 4356</span>&#160; </div>
<div class="line"><a name="l04357"></a><span class="lineno"> 4357</span>&#160;<span class="comment">/* Class with interface compatible with subset of std::vector.</span></div>
<div class="line"><a name="l04358"></a><span class="lineno"> 4358</span>&#160;<span class="comment">T must be POD because constructors and destructors are not called and memcpy is</span></div>
<div class="line"><a name="l04359"></a><span class="lineno"> 4359</span>&#160;<span class="comment">used for these objects. */</span></div>
<div class="line"><a name="l04360"></a><span class="lineno"> 4360</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> AllocatorT&gt;</div>
<div class="line"><a name="l04361"></a><span class="lineno"> 4361</span>&#160;<span class="keyword">class </span>VmaVector</div>
<div class="line"><a name="l04362"></a><span class="lineno"> 4362</span>&#160;{</div>
<div class="line"><a name="l04363"></a><span class="lineno"> 4363</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l04364"></a><span class="lineno"> 4364</span>&#160; <span class="keyword">typedef</span> T value_type;</div>
<div class="line"><a name="l04365"></a><span class="lineno"> 4365</span>&#160; </div>
<div class="line"><a name="l04366"></a><span class="lineno"> 4366</span>&#160; VmaVector(<span class="keyword">const</span> AllocatorT&amp; allocator) :</div>
<div class="line"><a name="l04367"></a><span class="lineno"> 4367</span>&#160; m_Allocator(allocator),</div>
<div class="line"><a name="l04368"></a><span class="lineno"> 4368</span>&#160; m_pArray(VMA_NULL),</div>
<div class="line"><a name="l04369"></a><span class="lineno"> 4369</span>&#160; m_Count(0),</div>
<div class="line"><a name="l04370"></a><span class="lineno"> 4370</span>&#160; m_Capacity(0)</div>
<div class="line"><a name="l04371"></a><span class="lineno"> 4371</span>&#160; {</div>
<div class="line"><a name="l04372"></a><span class="lineno"> 4372</span>&#160; }</div>
<div class="line"><a name="l04373"></a><span class="lineno"> 4373</span>&#160; </div>
<div class="line"><a name="l04374"></a><span class="lineno"> 4374</span>&#160; VmaVector(<span class="keywordtype">size_t</span> count, <span class="keyword">const</span> AllocatorT&amp; allocator) :</div>
<div class="line"><a name="l04375"></a><span class="lineno"> 4375</span>&#160; m_Allocator(allocator),</div>
<div class="line"><a name="l04376"></a><span class="lineno"> 4376</span>&#160; m_pArray(count ? (T*)VmaAllocateArray&lt;T&gt;(allocator.m_pCallbacks, count) : VMA_NULL),</div>
<div class="line"><a name="l04377"></a><span class="lineno"> 4377</span>&#160; m_Count(count),</div>
<div class="line"><a name="l04378"></a><span class="lineno"> 4378</span>&#160; m_Capacity(count)</div>
<div class="line"><a name="l04379"></a><span class="lineno"> 4379</span>&#160; {</div>
<div class="line"><a name="l04380"></a><span class="lineno"> 4380</span>&#160; }</div>
<div class="line"><a name="l04381"></a><span class="lineno"> 4381</span>&#160; </div>
<div class="line"><a name="l04382"></a><span class="lineno"> 4382</span>&#160; <span class="comment">// This version of the constructor is here for compatibility with pre-C++14 std::vector.</span></div>
<div class="line"><a name="l04383"></a><span class="lineno"> 4383</span>&#160; <span class="comment">// value is unused.</span></div>
<div class="line"><a name="l04384"></a><span class="lineno"> 4384</span>&#160; VmaVector(<span class="keywordtype">size_t</span> count, <span class="keyword">const</span> T&amp; value, <span class="keyword">const</span> AllocatorT&amp; allocator)</div>
<div class="line"><a name="l04385"></a><span class="lineno"> 4385</span>&#160; : VmaVector(count, allocator) {}</div>
<div class="line"><a name="l04386"></a><span class="lineno"> 4386</span>&#160; </div>
<div class="line"><a name="l04387"></a><span class="lineno"> 4387</span>&#160; VmaVector(<span class="keyword">const</span> VmaVector&lt;T, AllocatorT&gt;&amp; src) :</div>
<div class="line"><a name="l04388"></a><span class="lineno"> 4388</span>&#160; m_Allocator(src.m_Allocator),</div>
<div class="line"><a name="l04389"></a><span class="lineno"> 4389</span>&#160; m_pArray(src.m_Count ? (T*)VmaAllocateArray&lt;T&gt;(src.m_Allocator.m_pCallbacks, src.m_Count) : VMA_NULL),</div>
<div class="line"><a name="l04390"></a><span class="lineno"> 4390</span>&#160; m_Count(src.m_Count),</div>
<div class="line"><a name="l04391"></a><span class="lineno"> 4391</span>&#160; m_Capacity(src.m_Count)</div>
<div class="line"><a name="l04392"></a><span class="lineno"> 4392</span>&#160; {</div>
<div class="line"><a name="l04393"></a><span class="lineno"> 4393</span>&#160; <span class="keywordflow">if</span>(m_Count != 0)</div>
<div class="line"><a name="l04394"></a><span class="lineno"> 4394</span>&#160; {</div>
<div class="line"><a name="l04395"></a><span class="lineno"> 4395</span>&#160; memcpy(m_pArray, src.m_pArray, m_Count * <span class="keyword">sizeof</span>(T));</div>
<div class="line"><a name="l04396"></a><span class="lineno"> 4396</span>&#160; }</div>
<div class="line"><a name="l04397"></a><span class="lineno"> 4397</span>&#160; }</div>
<div class="line"><a name="l04398"></a><span class="lineno"> 4398</span>&#160; </div>
<div class="line"><a name="l04399"></a><span class="lineno"> 4399</span>&#160; ~VmaVector()</div>
<div class="line"><a name="l04400"></a><span class="lineno"> 4400</span>&#160; {</div>
<div class="line"><a name="l04401"></a><span class="lineno"> 4401</span>&#160; VmaFree(m_Allocator.m_pCallbacks, m_pArray);</div>
<div class="line"><a name="l04402"></a><span class="lineno"> 4402</span>&#160; }</div>
<div class="line"><a name="l04403"></a><span class="lineno"> 4403</span>&#160; </div>
<div class="line"><a name="l04404"></a><span class="lineno"> 4404</span>&#160; VmaVector&amp; operator=(<span class="keyword">const</span> VmaVector&lt;T, AllocatorT&gt;&amp; rhs)</div>
<div class="line"><a name="l04405"></a><span class="lineno"> 4405</span>&#160; {</div>
<div class="line"><a name="l04406"></a><span class="lineno"> 4406</span>&#160; <span class="keywordflow">if</span>(&amp;rhs != <span class="keyword">this</span>)</div>
<div class="line"><a name="l04407"></a><span class="lineno"> 4407</span>&#160; {</div>
<div class="line"><a name="l04408"></a><span class="lineno"> 4408</span>&#160; resize(rhs.m_Count);</div>
<div class="line"><a name="l04409"></a><span class="lineno"> 4409</span>&#160; <span class="keywordflow">if</span>(m_Count != 0)</div>
<div class="line"><a name="l04410"></a><span class="lineno"> 4410</span>&#160; {</div>
<div class="line"><a name="l04411"></a><span class="lineno"> 4411</span>&#160; memcpy(m_pArray, rhs.m_pArray, m_Count * <span class="keyword">sizeof</span>(T));</div>
<div class="line"><a name="l04412"></a><span class="lineno"> 4412</span>&#160; }</div>
<div class="line"><a name="l04413"></a><span class="lineno"> 4413</span>&#160; }</div>
<div class="line"><a name="l04414"></a><span class="lineno"> 4414</span>&#160; <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l04415"></a><span class="lineno"> 4415</span>&#160; }</div>
<div class="line"><a name="l04416"></a><span class="lineno"> 4416</span>&#160; </div>
<div class="line"><a name="l04417"></a><span class="lineno"> 4417</span>&#160; <span class="keywordtype">bool</span> empty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count == 0; }</div>
<div class="line"><a name="l04418"></a><span class="lineno"> 4418</span>&#160; <span class="keywordtype">size_t</span> size()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count; }</div>
<div class="line"><a name="l04419"></a><span class="lineno"> 4419</span>&#160; T* data() { <span class="keywordflow">return</span> m_pArray; }</div>
<div class="line"><a name="l04420"></a><span class="lineno"> 4420</span>&#160; <span class="keyword">const</span> T* data()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pArray; }</div>
<div class="line"><a name="l04421"></a><span class="lineno"> 4421</span>&#160; </div>
<div class="line"><a name="l04422"></a><span class="lineno"> 4422</span>&#160; T&amp; operator[](<span class="keywordtype">size_t</span> index)</div>
<div class="line"><a name="l04423"></a><span class="lineno"> 4423</span>&#160; {</div>
<div class="line"><a name="l04424"></a><span class="lineno"> 4424</span>&#160; VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
<div class="line"><a name="l04425"></a><span class="lineno"> 4425</span>&#160; <span class="keywordflow">return</span> m_pArray[index];</div>
<div class="line"><a name="l04426"></a><span class="lineno"> 4426</span>&#160; }</div>
<div class="line"><a name="l04427"></a><span class="lineno"> 4427</span>&#160; <span class="keyword">const</span> T&amp; operator[](<span class="keywordtype">size_t</span> index)<span class="keyword"> const</span></div>
<div class="line"><a name="l04428"></a><span class="lineno"> 4428</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l04429"></a><span class="lineno"> 4429</span>&#160; VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
<div class="line"><a name="l04430"></a><span class="lineno"> 4430</span>&#160; <span class="keywordflow">return</span> m_pArray[index];</div>
<div class="line"><a name="l04431"></a><span class="lineno"> 4431</span>&#160; }</div>
<div class="line"><a name="l04432"></a><span class="lineno"> 4432</span>&#160; </div>
<div class="line"><a name="l04433"></a><span class="lineno"> 4433</span>&#160; T&amp; front()</div>
<div class="line"><a name="l04434"></a><span class="lineno"> 4434</span>&#160; {</div>
<div class="line"><a name="l04435"></a><span class="lineno"> 4435</span>&#160; VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
<div class="line"><a name="l04436"></a><span class="lineno"> 4436</span>&#160; <span class="keywordflow">return</span> m_pArray[0];</div>
<div class="line"><a name="l04437"></a><span class="lineno"> 4437</span>&#160; }</div>
<div class="line"><a name="l04438"></a><span class="lineno"> 4438</span>&#160; <span class="keyword">const</span> T&amp; front()<span class="keyword"> const</span></div>
<div class="line"><a name="l04439"></a><span class="lineno"> 4439</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l04440"></a><span class="lineno"> 4440</span>&#160; VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
<div class="line"><a name="l04441"></a><span class="lineno"> 4441</span>&#160; <span class="keywordflow">return</span> m_pArray[0];</div>
<div class="line"><a name="l04442"></a><span class="lineno"> 4442</span>&#160; }</div>
<div class="line"><a name="l04443"></a><span class="lineno"> 4443</span>&#160; T&amp; back()</div>
<div class="line"><a name="l04444"></a><span class="lineno"> 4444</span>&#160; {</div>
<div class="line"><a name="l04445"></a><span class="lineno"> 4445</span>&#160; VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
<div class="line"><a name="l04446"></a><span class="lineno"> 4446</span>&#160; <span class="keywordflow">return</span> m_pArray[m_Count - 1];</div>
<div class="line"><a name="l04447"></a><span class="lineno"> 4447</span>&#160; }</div>
<div class="line"><a name="l04448"></a><span class="lineno"> 4448</span>&#160; <span class="keyword">const</span> T&amp; back()<span class="keyword"> const</span></div>
<div class="line"><a name="l04449"></a><span class="lineno"> 4449</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l04450"></a><span class="lineno"> 4450</span>&#160; VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
<div class="line"><a name="l04451"></a><span class="lineno"> 4451</span>&#160; <span class="keywordflow">return</span> m_pArray[m_Count - 1];</div>
<div class="line"><a name="l04452"></a><span class="lineno"> 4452</span>&#160; }</div>
<div class="line"><a name="l04453"></a><span class="lineno"> 4453</span>&#160; </div>
<div class="line"><a name="l04454"></a><span class="lineno"> 4454</span>&#160; <span class="keywordtype">void</span> reserve(<span class="keywordtype">size_t</span> newCapacity, <span class="keywordtype">bool</span> freeMemory = <span class="keyword">false</span>)</div>
<div class="line"><a name="l04455"></a><span class="lineno"> 4455</span>&#160; {</div>
<div class="line"><a name="l04456"></a><span class="lineno"> 4456</span>&#160; newCapacity = VMA_MAX(newCapacity, m_Count);</div>
<div class="line"><a name="l04457"></a><span class="lineno"> 4457</span>&#160; </div>
<div class="line"><a name="l04458"></a><span class="lineno"> 4458</span>&#160; <span class="keywordflow">if</span>((newCapacity &lt; m_Capacity) &amp;&amp; !freeMemory)</div>
<div class="line"><a name="l04459"></a><span class="lineno"> 4459</span>&#160; {</div>
<div class="line"><a name="l04460"></a><span class="lineno"> 4460</span>&#160; newCapacity = m_Capacity;</div>
<div class="line"><a name="l04461"></a><span class="lineno"> 4461</span>&#160; }</div>
<div class="line"><a name="l04462"></a><span class="lineno"> 4462</span>&#160; </div>
<div class="line"><a name="l04463"></a><span class="lineno"> 4463</span>&#160; <span class="keywordflow">if</span>(newCapacity != m_Capacity)</div>
<div class="line"><a name="l04464"></a><span class="lineno"> 4464</span>&#160; {</div>
<div class="line"><a name="l04465"></a><span class="lineno"> 4465</span>&#160; T* <span class="keyword">const</span> newArray = newCapacity ? VmaAllocateArray&lt;T&gt;(m_Allocator, newCapacity) : VMA_NULL;</div>
<div class="line"><a name="l04466"></a><span class="lineno"> 4466</span>&#160; <span class="keywordflow">if</span>(m_Count != 0)</div>
<div class="line"><a name="l04467"></a><span class="lineno"> 4467</span>&#160; {</div>
<div class="line"><a name="l04468"></a><span class="lineno"> 4468</span>&#160; memcpy(newArray, m_pArray, m_Count * <span class="keyword">sizeof</span>(T));</div>
<div class="line"><a name="l04469"></a><span class="lineno"> 4469</span>&#160; }</div>
<div class="line"><a name="l04470"></a><span class="lineno"> 4470</span>&#160; VmaFree(m_Allocator.m_pCallbacks, m_pArray);</div>
<div class="line"><a name="l04471"></a><span class="lineno"> 4471</span>&#160; m_Capacity = newCapacity;</div>
<div class="line"><a name="l04472"></a><span class="lineno"> 4472</span>&#160; m_pArray = newArray;</div>
<div class="line"><a name="l04473"></a><span class="lineno"> 4473</span>&#160; }</div>
<div class="line"><a name="l04474"></a><span class="lineno"> 4474</span>&#160; }</div>
<div class="line"><a name="l04475"></a><span class="lineno"> 4475</span>&#160; </div>
<div class="line"><a name="l04476"></a><span class="lineno"> 4476</span>&#160; <span class="keywordtype">void</span> resize(<span class="keywordtype">size_t</span> newCount, <span class="keywordtype">bool</span> freeMemory = <span class="keyword">false</span>)</div>
<div class="line"><a name="l04477"></a><span class="lineno"> 4477</span>&#160; {</div>
<div class="line"><a name="l04478"></a><span class="lineno"> 4478</span>&#160; <span class="keywordtype">size_t</span> newCapacity = m_Capacity;</div>
<div class="line"><a name="l04479"></a><span class="lineno"> 4479</span>&#160; <span class="keywordflow">if</span>(newCount &gt; m_Capacity)</div>
<div class="line"><a name="l04480"></a><span class="lineno"> 4480</span>&#160; {</div>
<div class="line"><a name="l04481"></a><span class="lineno"> 4481</span>&#160; newCapacity = VMA_MAX(newCount, VMA_MAX(m_Capacity * 3 / 2, (<span class="keywordtype">size_t</span>)8));</div>
<div class="line"><a name="l04482"></a><span class="lineno"> 4482</span>&#160; }</div>
<div class="line"><a name="l04483"></a><span class="lineno"> 4483</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span>(freeMemory)</div>
<div class="line"><a name="l04484"></a><span class="lineno"> 4484</span>&#160; {</div>
<div class="line"><a name="l04485"></a><span class="lineno"> 4485</span>&#160; newCapacity = newCount;</div>
<div class="line"><a name="l04486"></a><span class="lineno"> 4486</span>&#160; }</div>
<div class="line"><a name="l04487"></a><span class="lineno"> 4487</span>&#160; </div>
<div class="line"><a name="l04488"></a><span class="lineno"> 4488</span>&#160; <span class="keywordflow">if</span>(newCapacity != m_Capacity)</div>
<div class="line"><a name="l04489"></a><span class="lineno"> 4489</span>&#160; {</div>
<div class="line"><a name="l04490"></a><span class="lineno"> 4490</span>&#160; T* <span class="keyword">const</span> newArray = newCapacity ? VmaAllocateArray&lt;T&gt;(m_Allocator.m_pCallbacks, newCapacity) : VMA_NULL;</div>
<div class="line"><a name="l04491"></a><span class="lineno"> 4491</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> elementsToCopy = VMA_MIN(m_Count, newCount);</div>
<div class="line"><a name="l04492"></a><span class="lineno"> 4492</span>&#160; <span class="keywordflow">if</span>(elementsToCopy != 0)</div>
<div class="line"><a name="l04493"></a><span class="lineno"> 4493</span>&#160; {</div>
<div class="line"><a name="l04494"></a><span class="lineno"> 4494</span>&#160; memcpy(newArray, m_pArray, elementsToCopy * <span class="keyword">sizeof</span>(T));</div>
<div class="line"><a name="l04495"></a><span class="lineno"> 4495</span>&#160; }</div>
<div class="line"><a name="l04496"></a><span class="lineno"> 4496</span>&#160; VmaFree(m_Allocator.m_pCallbacks, m_pArray);</div>
<div class="line"><a name="l04497"></a><span class="lineno"> 4497</span>&#160; m_Capacity = newCapacity;</div>
<div class="line"><a name="l04498"></a><span class="lineno"> 4498</span>&#160; m_pArray = newArray;</div>
<div class="line"><a name="l04499"></a><span class="lineno"> 4499</span>&#160; }</div>
<div class="line"><a name="l04500"></a><span class="lineno"> 4500</span>&#160; </div>
<div class="line"><a name="l04501"></a><span class="lineno"> 4501</span>&#160; m_Count = newCount;</div>
<div class="line"><a name="l04502"></a><span class="lineno"> 4502</span>&#160; }</div>
<div class="line"><a name="l04503"></a><span class="lineno"> 4503</span>&#160; </div>
<div class="line"><a name="l04504"></a><span class="lineno"> 4504</span>&#160; <span class="keywordtype">void</span> clear(<span class="keywordtype">bool</span> freeMemory = <span class="keyword">false</span>)</div>
<div class="line"><a name="l04505"></a><span class="lineno"> 4505</span>&#160; {</div>
<div class="line"><a name="l04506"></a><span class="lineno"> 4506</span>&#160; resize(0, freeMemory);</div>
<div class="line"><a name="l04507"></a><span class="lineno"> 4507</span>&#160; }</div>
<div class="line"><a name="l04508"></a><span class="lineno"> 4508</span>&#160; </div>
<div class="line"><a name="l04509"></a><span class="lineno"> 4509</span>&#160; <span class="keywordtype">void</span> insert(<span class="keywordtype">size_t</span> index, <span class="keyword">const</span> T&amp; src)</div>
<div class="line"><a name="l04510"></a><span class="lineno"> 4510</span>&#160; {</div>
<div class="line"><a name="l04511"></a><span class="lineno"> 4511</span>&#160; VMA_HEAVY_ASSERT(index &lt;= m_Count);</div>
<div class="line"><a name="l04512"></a><span class="lineno"> 4512</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> oldCount = size();</div>
<div class="line"><a name="l04513"></a><span class="lineno"> 4513</span>&#160; resize(oldCount + 1);</div>
<div class="line"><a name="l04514"></a><span class="lineno"> 4514</span>&#160; <span class="keywordflow">if</span>(index &lt; oldCount)</div>
<div class="line"><a name="l04515"></a><span class="lineno"> 4515</span>&#160; {</div>
<div class="line"><a name="l04516"></a><span class="lineno"> 4516</span>&#160; memmove(m_pArray + (index + 1), m_pArray + index, (oldCount - index) * <span class="keyword">sizeof</span>(T));</div>
<div class="line"><a name="l04517"></a><span class="lineno"> 4517</span>&#160; }</div>
<div class="line"><a name="l04518"></a><span class="lineno"> 4518</span>&#160; m_pArray[index] = src;</div>
<div class="line"><a name="l04519"></a><span class="lineno"> 4519</span>&#160; }</div>
<div class="line"><a name="l04520"></a><span class="lineno"> 4520</span>&#160; </div>
<div class="line"><a name="l04521"></a><span class="lineno"> 4521</span>&#160; <span class="keywordtype">void</span> remove(<span class="keywordtype">size_t</span> index)</div>
<div class="line"><a name="l04522"></a><span class="lineno"> 4522</span>&#160; {</div>
<div class="line"><a name="l04523"></a><span class="lineno"> 4523</span>&#160; VMA_HEAVY_ASSERT(index &lt; m_Count);</div>
<div class="line"><a name="l04524"></a><span class="lineno"> 4524</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> oldCount = size();</div>
<div class="line"><a name="l04525"></a><span class="lineno"> 4525</span>&#160; <span class="keywordflow">if</span>(index &lt; oldCount - 1)</div>
<div class="line"><a name="l04526"></a><span class="lineno"> 4526</span>&#160; {</div>
<div class="line"><a name="l04527"></a><span class="lineno"> 4527</span>&#160; memmove(m_pArray + index, m_pArray + (index + 1), (oldCount - index - 1) * <span class="keyword">sizeof</span>(T));</div>
<div class="line"><a name="l04528"></a><span class="lineno"> 4528</span>&#160; }</div>
<div class="line"><a name="l04529"></a><span class="lineno"> 4529</span>&#160; resize(oldCount - 1);</div>
<div class="line"><a name="l04530"></a><span class="lineno"> 4530</span>&#160; }</div>
<div class="line"><a name="l04531"></a><span class="lineno"> 4531</span>&#160; </div>
<div class="line"><a name="l04532"></a><span class="lineno"> 4532</span>&#160; <span class="keywordtype">void</span> push_back(<span class="keyword">const</span> T&amp; src)</div>
<div class="line"><a name="l04533"></a><span class="lineno"> 4533</span>&#160; {</div>
<div class="line"><a name="l04534"></a><span class="lineno"> 4534</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> newIndex = size();</div>
<div class="line"><a name="l04535"></a><span class="lineno"> 4535</span>&#160; resize(newIndex + 1);</div>
<div class="line"><a name="l04536"></a><span class="lineno"> 4536</span>&#160; m_pArray[newIndex] = src;</div>
<div class="line"><a name="l04537"></a><span class="lineno"> 4537</span>&#160; }</div>
<div class="line"><a name="l04538"></a><span class="lineno"> 4538</span>&#160; </div>
<div class="line"><a name="l04539"></a><span class="lineno"> 4539</span>&#160; <span class="keywordtype">void</span> pop_back()</div>
<div class="line"><a name="l04540"></a><span class="lineno"> 4540</span>&#160; {</div>
<div class="line"><a name="l04541"></a><span class="lineno"> 4541</span>&#160; VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
<div class="line"><a name="l04542"></a><span class="lineno"> 4542</span>&#160; resize(size() - 1);</div>
<div class="line"><a name="l04543"></a><span class="lineno"> 4543</span>&#160; }</div>
<div class="line"><a name="l04544"></a><span class="lineno"> 4544</span>&#160; </div>
<div class="line"><a name="l04545"></a><span class="lineno"> 4545</span>&#160; <span class="keywordtype">void</span> push_front(<span class="keyword">const</span> T&amp; src)</div>
<div class="line"><a name="l04546"></a><span class="lineno"> 4546</span>&#160; {</div>
<div class="line"><a name="l04547"></a><span class="lineno"> 4547</span>&#160; insert(0, src);</div>
<div class="line"><a name="l04548"></a><span class="lineno"> 4548</span>&#160; }</div>
<div class="line"><a name="l04549"></a><span class="lineno"> 4549</span>&#160; </div>
<div class="line"><a name="l04550"></a><span class="lineno"> 4550</span>&#160; <span class="keywordtype">void</span> pop_front()</div>
<div class="line"><a name="l04551"></a><span class="lineno"> 4551</span>&#160; {</div>
<div class="line"><a name="l04552"></a><span class="lineno"> 4552</span>&#160; VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
<div class="line"><a name="l04553"></a><span class="lineno"> 4553</span>&#160; remove(0);</div>
<div class="line"><a name="l04554"></a><span class="lineno"> 4554</span>&#160; }</div>
<div class="line"><a name="l04555"></a><span class="lineno"> 4555</span>&#160; </div>
<div class="line"><a name="l04556"></a><span class="lineno"> 4556</span>&#160; <span class="keyword">typedef</span> T* iterator;</div>
<div class="line"><a name="l04557"></a><span class="lineno"> 4557</span>&#160; </div>
<div class="line"><a name="l04558"></a><span class="lineno"> 4558</span>&#160; iterator begin() { <span class="keywordflow">return</span> m_pArray; }</div>
<div class="line"><a name="l04559"></a><span class="lineno"> 4559</span>&#160; iterator end() { <span class="keywordflow">return</span> m_pArray + m_Count; }</div>
<div class="line"><a name="l04560"></a><span class="lineno"> 4560</span>&#160; </div>
<div class="line"><a name="l04561"></a><span class="lineno"> 4561</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l04562"></a><span class="lineno"> 4562</span>&#160; AllocatorT m_Allocator;</div>
<div class="line"><a name="l04563"></a><span class="lineno"> 4563</span>&#160; T* m_pArray;</div>
<div class="line"><a name="l04564"></a><span class="lineno"> 4564</span>&#160; <span class="keywordtype">size_t</span> m_Count;</div>
<div class="line"><a name="l04565"></a><span class="lineno"> 4565</span>&#160; <span class="keywordtype">size_t</span> m_Capacity;</div>
<div class="line"><a name="l04566"></a><span class="lineno"> 4566</span>&#160;};</div>
<div class="line"><a name="l04567"></a><span class="lineno"> 4567</span>&#160; </div>
<div class="line"><a name="l04568"></a><span class="lineno"> 4568</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
<div class="line"><a name="l04569"></a><span class="lineno"> 4569</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorInsert(VmaVector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index, <span class="keyword">const</span> T&amp; item)</div>
<div class="line"><a name="l04570"></a><span class="lineno"> 4570</span>&#160;{</div>
<div class="line"><a name="l04571"></a><span class="lineno"> 4571</span>&#160; vec.insert(index, item);</div>
<div class="line"><a name="l04572"></a><span class="lineno"> 4572</span>&#160;}</div>
<div class="line"><a name="l04573"></a><span class="lineno"> 4573</span>&#160; </div>
<div class="line"><a name="l04574"></a><span class="lineno"> 4574</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> allocatorT&gt;</div>
<div class="line"><a name="l04575"></a><span class="lineno"> 4575</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaVectorRemove(VmaVector&lt;T, allocatorT&gt;&amp; vec, <span class="keywordtype">size_t</span> index)</div>
<div class="line"><a name="l04576"></a><span class="lineno"> 4576</span>&#160;{</div>
<div class="line"><a name="l04577"></a><span class="lineno"> 4577</span>&#160; vec.remove(index);</div>
<div class="line"><a name="l04578"></a><span class="lineno"> 4578</span>&#160;}</div>
<div class="line"><a name="l04579"></a><span class="lineno"> 4579</span>&#160; </div>
<div class="line"><a name="l04580"></a><span class="lineno"> 4580</span>&#160;<span class="preprocessor">#endif // #if VMA_USE_STL_VECTOR</span></div>
<div class="line"><a name="l04581"></a><span class="lineno"> 4581</span>&#160; </div>
<div class="line"><a name="l04582"></a><span class="lineno"> 4582</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> VectorT&gt;</div>
<div class="line"><a name="l04583"></a><span class="lineno"> 4583</span>&#160;<span class="keywordtype">size_t</span> VmaVectorInsertSorted(VectorT&amp; vector, <span class="keyword">const</span> <span class="keyword">typename</span> VectorT::value_type&amp; value)</div>
<div class="line"><a name="l04584"></a><span class="lineno"> 4584</span>&#160;{</div>
<div class="line"><a name="l04585"></a><span class="lineno"> 4585</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> indexToInsert = VmaBinaryFindFirstNotLess(</div>
<div class="line"><a name="l04586"></a><span class="lineno"> 4586</span>&#160; vector.data(),</div>
<div class="line"><a name="l04587"></a><span class="lineno"> 4587</span>&#160; vector.data() + vector.size(),</div>
<div class="line"><a name="l04588"></a><span class="lineno"> 4588</span>&#160; value,</div>
<div class="line"><a name="l04589"></a><span class="lineno"> 4589</span>&#160; CmpLess()) - vector.data();</div>
<div class="line"><a name="l04590"></a><span class="lineno"> 4590</span>&#160; VmaVectorInsert(vector, indexToInsert, value);</div>
<div class="line"><a name="l04591"></a><span class="lineno"> 4591</span>&#160; <span class="keywordflow">return</span> indexToInsert;</div>
<div class="line"><a name="l04592"></a><span class="lineno"> 4592</span>&#160;}</div>
<div class="line"><a name="l04593"></a><span class="lineno"> 4593</span>&#160; </div>
<div class="line"><a name="l04594"></a><span class="lineno"> 4594</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> CmpLess, <span class="keyword">typename</span> VectorT&gt;</div>
<div class="line"><a name="l04595"></a><span class="lineno"> 4595</span>&#160;<span class="keywordtype">bool</span> VmaVectorRemoveSorted(VectorT&amp; vector, <span class="keyword">const</span> <span class="keyword">typename</span> VectorT::value_type&amp; value)</div>
<div class="line"><a name="l04596"></a><span class="lineno"> 4596</span>&#160;{</div>
<div class="line"><a name="l04597"></a><span class="lineno"> 4597</span>&#160; CmpLess comparator;</div>
<div class="line"><a name="l04598"></a><span class="lineno"> 4598</span>&#160; <span class="keyword">typename</span> VectorT::iterator it = VmaBinaryFindFirstNotLess(</div>
<div class="line"><a name="l04599"></a><span class="lineno"> 4599</span>&#160; vector.begin(),</div>
<div class="line"><a name="l04600"></a><span class="lineno"> 4600</span>&#160; vector.end(),</div>
<div class="line"><a name="l04601"></a><span class="lineno"> 4601</span>&#160; value,</div>
<div class="line"><a name="l04602"></a><span class="lineno"> 4602</span>&#160; comparator);</div>
<div class="line"><a name="l04603"></a><span class="lineno"> 4603</span>&#160; <span class="keywordflow">if</span>((it != vector.end()) &amp;&amp; !comparator(*it, value) &amp;&amp; !comparator(value, *it))</div>
<div class="line"><a name="l04604"></a><span class="lineno"> 4604</span>&#160; {</div>
<div class="line"><a name="l04605"></a><span class="lineno"> 4605</span>&#160; <span class="keywordtype">size_t</span> indexToRemove = it - vector.begin();</div>
<div class="line"><a name="l04606"></a><span class="lineno"> 4606</span>&#160; VmaVectorRemove(vector, indexToRemove);</div>
<div class="line"><a name="l04607"></a><span class="lineno"> 4607</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l04608"></a><span class="lineno"> 4608</span>&#160; }</div>
<div class="line"><a name="l04609"></a><span class="lineno"> 4609</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l04610"></a><span class="lineno"> 4610</span>&#160;}</div>
<div class="line"><a name="l04611"></a><span class="lineno"> 4611</span>&#160; </div>
<div class="line"><a name="l04613"></a><span class="lineno"> 4613</span>&#160;<span class="comment">// class VmaPoolAllocator</span></div>
<div class="line"><a name="l04614"></a><span class="lineno"> 4614</span>&#160; </div>
<div class="line"><a name="l04615"></a><span class="lineno"> 4615</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l04616"></a><span class="lineno"> 4616</span>&#160;<span class="comment">Allocator for objects of type T using a list of arrays (pools) to speed up</span></div>
<div class="line"><a name="l04617"></a><span class="lineno"> 4617</span>&#160;<span class="comment">allocation. Number of elements that can be allocated is not bounded because</span></div>
<div class="line"><a name="l04618"></a><span class="lineno"> 4618</span>&#160;<span class="comment">allocator can create multiple blocks.</span></div>
<div class="line"><a name="l04619"></a><span class="lineno"> 4619</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l04620"></a><span class="lineno"> 4620</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04621"></a><span class="lineno"> 4621</span>&#160;<span class="keyword">class </span>VmaPoolAllocator</div>
<div class="line"><a name="l04622"></a><span class="lineno"> 4622</span>&#160;{</div>
<div class="line"><a name="l04623"></a><span class="lineno"> 4623</span>&#160; VMA_CLASS_NO_COPY(VmaPoolAllocator)</div>
<div class="line"><a name="l04624"></a><span class="lineno"> 4624</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l04625"></a><span class="lineno"> 4625</span>&#160; VmaPoolAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, uint32_t firstBlockCapacity);</div>
<div class="line"><a name="l04626"></a><span class="lineno"> 4626</span>&#160; ~VmaPoolAllocator();</div>
<div class="line"><a name="l04627"></a><span class="lineno"> 4627</span>&#160; T* Alloc();</div>
<div class="line"><a name="l04628"></a><span class="lineno"> 4628</span>&#160; <span class="keywordtype">void</span> Free(T* ptr);</div>
<div class="line"><a name="l04629"></a><span class="lineno"> 4629</span>&#160; </div>
<div class="line"><a name="l04630"></a><span class="lineno"> 4630</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l04631"></a><span class="lineno"> 4631</span>&#160; <span class="keyword">union </span>Item</div>
<div class="line"><a name="l04632"></a><span class="lineno"> 4632</span>&#160; {</div>
<div class="line"><a name="l04633"></a><span class="lineno"> 4633</span>&#160; uint32_t NextFreeIndex;</div>
<div class="line"><a name="l04634"></a><span class="lineno"> 4634</span>&#160; <span class="keyword">alignas</span>(T) <span class="keywordtype">char</span> Value[<span class="keyword">sizeof</span>(T)];</div>
<div class="line"><a name="l04635"></a><span class="lineno"> 4635</span>&#160; };</div>
<div class="line"><a name="l04636"></a><span class="lineno"> 4636</span>&#160; </div>
<div class="line"><a name="l04637"></a><span class="lineno"> 4637</span>&#160; <span class="keyword">struct </span>ItemBlock</div>
<div class="line"><a name="l04638"></a><span class="lineno"> 4638</span>&#160; {</div>
<div class="line"><a name="l04639"></a><span class="lineno"> 4639</span>&#160; Item* pItems;</div>
<div class="line"><a name="l04640"></a><span class="lineno"> 4640</span>&#160; uint32_t Capacity;</div>
<div class="line"><a name="l04641"></a><span class="lineno"> 4641</span>&#160; uint32_t FirstFreeIndex;</div>
<div class="line"><a name="l04642"></a><span class="lineno"> 4642</span>&#160; };</div>
<div class="line"><a name="l04643"></a><span class="lineno"> 4643</span>&#160; </div>
<div class="line"><a name="l04644"></a><span class="lineno"> 4644</span>&#160; <span class="keyword">const</span> VkAllocationCallbacks* m_pAllocationCallbacks;</div>
<div class="line"><a name="l04645"></a><span class="lineno"> 4645</span>&#160; <span class="keyword">const</span> uint32_t m_FirstBlockCapacity;</div>
<div class="line"><a name="l04646"></a><span class="lineno"> 4646</span>&#160; VmaVector&lt; ItemBlock, VmaStlAllocator&lt;ItemBlock&gt; &gt; m_ItemBlocks;</div>
<div class="line"><a name="l04647"></a><span class="lineno"> 4647</span>&#160; </div>
<div class="line"><a name="l04648"></a><span class="lineno"> 4648</span>&#160; ItemBlock&amp; CreateNewBlock();</div>
<div class="line"><a name="l04649"></a><span class="lineno"> 4649</span>&#160;};</div>
<div class="line"><a name="l04650"></a><span class="lineno"> 4650</span>&#160; </div>
<div class="line"><a name="l04651"></a><span class="lineno"> 4651</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04652"></a><span class="lineno"> 4652</span>&#160;VmaPoolAllocator&lt;T&gt;::VmaPoolAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, uint32_t firstBlockCapacity) :</div>
<div class="line"><a name="l04653"></a><span class="lineno"> 4653</span>&#160; m_pAllocationCallbacks(pAllocationCallbacks),</div>
<div class="line"><a name="l04654"></a><span class="lineno"> 4654</span>&#160; m_FirstBlockCapacity(firstBlockCapacity),</div>
<div class="line"><a name="l04655"></a><span class="lineno"> 4655</span>&#160; m_ItemBlocks(VmaStlAllocator&lt;ItemBlock&gt;(pAllocationCallbacks))</div>
<div class="line"><a name="l04656"></a><span class="lineno"> 4656</span>&#160;{</div>
<div class="line"><a name="l04657"></a><span class="lineno"> 4657</span>&#160; VMA_ASSERT(m_FirstBlockCapacity &gt; 1);</div>
<div class="line"><a name="l04658"></a><span class="lineno"> 4658</span>&#160;}</div>
<div class="line"><a name="l04659"></a><span class="lineno"> 4659</span>&#160; </div>
<div class="line"><a name="l04660"></a><span class="lineno"> 4660</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04661"></a><span class="lineno"> 4661</span>&#160;VmaPoolAllocator&lt;T&gt;::~VmaPoolAllocator()</div>
<div class="line"><a name="l04662"></a><span class="lineno"> 4662</span>&#160;{</div>
<div class="line"><a name="l04663"></a><span class="lineno"> 4663</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_ItemBlocks.size(); i--; )</div>
<div class="line"><a name="l04664"></a><span class="lineno"> 4664</span>&#160; vma_delete_array(m_pAllocationCallbacks, m_ItemBlocks[i].pItems, m_ItemBlocks[i].Capacity);</div>
<div class="line"><a name="l04665"></a><span class="lineno"> 4665</span>&#160; m_ItemBlocks.clear();</div>
<div class="line"><a name="l04666"></a><span class="lineno"> 4666</span>&#160;}</div>
<div class="line"><a name="l04667"></a><span class="lineno"> 4667</span>&#160; </div>
<div class="line"><a name="l04668"></a><span class="lineno"> 4668</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04669"></a><span class="lineno"> 4669</span>&#160;T* VmaPoolAllocator&lt;T&gt;::Alloc()</div>
<div class="line"><a name="l04670"></a><span class="lineno"> 4670</span>&#160;{</div>
<div class="line"><a name="l04671"></a><span class="lineno"> 4671</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_ItemBlocks.size(); i--; )</div>
<div class="line"><a name="l04672"></a><span class="lineno"> 4672</span>&#160; {</div>
<div class="line"><a name="l04673"></a><span class="lineno"> 4673</span>&#160; ItemBlock&amp; block = m_ItemBlocks[i];</div>
<div class="line"><a name="l04674"></a><span class="lineno"> 4674</span>&#160; <span class="comment">// This block has some free items: Use first one.</span></div>
<div class="line"><a name="l04675"></a><span class="lineno"> 4675</span>&#160; <span class="keywordflow">if</span>(block.FirstFreeIndex != UINT32_MAX)</div>
<div class="line"><a name="l04676"></a><span class="lineno"> 4676</span>&#160; {</div>
<div class="line"><a name="l04677"></a><span class="lineno"> 4677</span>&#160; Item* <span class="keyword">const</span> pItem = &amp;block.pItems[block.FirstFreeIndex];</div>
<div class="line"><a name="l04678"></a><span class="lineno"> 4678</span>&#160; block.FirstFreeIndex = pItem-&gt;NextFreeIndex;</div>
<div class="line"><a name="l04679"></a><span class="lineno"> 4679</span>&#160; T* result = (T*)&amp;pItem-&gt;Value;</div>
<div class="line"><a name="l04680"></a><span class="lineno"> 4680</span>&#160; <span class="keyword">new</span>(result)T(); <span class="comment">// Explicit constructor call.</span></div>
<div class="line"><a name="l04681"></a><span class="lineno"> 4681</span>&#160; <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l04682"></a><span class="lineno"> 4682</span>&#160; }</div>
<div class="line"><a name="l04683"></a><span class="lineno"> 4683</span>&#160; }</div>
<div class="line"><a name="l04684"></a><span class="lineno"> 4684</span>&#160; </div>
<div class="line"><a name="l04685"></a><span class="lineno"> 4685</span>&#160; <span class="comment">// No block has free item: Create new one and use it.</span></div>
<div class="line"><a name="l04686"></a><span class="lineno"> 4686</span>&#160; ItemBlock&amp; newBlock = CreateNewBlock();</div>
<div class="line"><a name="l04687"></a><span class="lineno"> 4687</span>&#160; Item* <span class="keyword">const</span> pItem = &amp;newBlock.pItems[0];</div>
<div class="line"><a name="l04688"></a><span class="lineno"> 4688</span>&#160; newBlock.FirstFreeIndex = pItem-&gt;NextFreeIndex;</div>
<div class="line"><a name="l04689"></a><span class="lineno"> 4689</span>&#160; T* result = (T*)&amp;pItem-&gt;Value;</div>
<div class="line"><a name="l04690"></a><span class="lineno"> 4690</span>&#160; <span class="keyword">new</span>(result)T(); <span class="comment">// Explicit constructor call.</span></div>
<div class="line"><a name="l04691"></a><span class="lineno"> 4691</span>&#160; <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l04692"></a><span class="lineno"> 4692</span>&#160;}</div>
<div class="line"><a name="l04693"></a><span class="lineno"> 4693</span>&#160; </div>
<div class="line"><a name="l04694"></a><span class="lineno"> 4694</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04695"></a><span class="lineno"> 4695</span>&#160;<span class="keywordtype">void</span> VmaPoolAllocator&lt;T&gt;::Free(T* ptr)</div>
<div class="line"><a name="l04696"></a><span class="lineno"> 4696</span>&#160;{</div>
<div class="line"><a name="l04697"></a><span class="lineno"> 4697</span>&#160; <span class="comment">// Search all memory blocks to find ptr.</span></div>
<div class="line"><a name="l04698"></a><span class="lineno"> 4698</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = m_ItemBlocks.size(); i--; )</div>
<div class="line"><a name="l04699"></a><span class="lineno"> 4699</span>&#160; {</div>
<div class="line"><a name="l04700"></a><span class="lineno"> 4700</span>&#160; ItemBlock&amp; block = m_ItemBlocks[i];</div>
<div class="line"><a name="l04701"></a><span class="lineno"> 4701</span>&#160; </div>
<div class="line"><a name="l04702"></a><span class="lineno"> 4702</span>&#160; <span class="comment">// Casting to union.</span></div>
<div class="line"><a name="l04703"></a><span class="lineno"> 4703</span>&#160; Item* pItemPtr;</div>
<div class="line"><a name="l04704"></a><span class="lineno"> 4704</span>&#160; memcpy(&amp;pItemPtr, &amp;ptr, <span class="keyword">sizeof</span>(pItemPtr));</div>
<div class="line"><a name="l04705"></a><span class="lineno"> 4705</span>&#160; </div>
<div class="line"><a name="l04706"></a><span class="lineno"> 4706</span>&#160; <span class="comment">// Check if pItemPtr is in address range of this block.</span></div>
<div class="line"><a name="l04707"></a><span class="lineno"> 4707</span>&#160; <span class="keywordflow">if</span>((pItemPtr &gt;= block.pItems) &amp;&amp; (pItemPtr &lt; block.pItems + block.Capacity))</div>
<div class="line"><a name="l04708"></a><span class="lineno"> 4708</span>&#160; {</div>
<div class="line"><a name="l04709"></a><span class="lineno"> 4709</span>&#160; ptr-&gt;~T(); <span class="comment">// Explicit destructor call.</span></div>
<div class="line"><a name="l04710"></a><span class="lineno"> 4710</span>&#160; <span class="keyword">const</span> uint32_t index = static_cast&lt;uint32_t&gt;(pItemPtr - block.pItems);</div>
<div class="line"><a name="l04711"></a><span class="lineno"> 4711</span>&#160; pItemPtr-&gt;NextFreeIndex = block.FirstFreeIndex;</div>
<div class="line"><a name="l04712"></a><span class="lineno"> 4712</span>&#160; block.FirstFreeIndex = index;</div>
<div class="line"><a name="l04713"></a><span class="lineno"> 4713</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l04714"></a><span class="lineno"> 4714</span>&#160; }</div>
<div class="line"><a name="l04715"></a><span class="lineno"> 4715</span>&#160; }</div>
<div class="line"><a name="l04716"></a><span class="lineno"> 4716</span>&#160; VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Pointer doesn&#39;t belong to this memory pool.&quot;</span>);</div>
<div class="line"><a name="l04717"></a><span class="lineno"> 4717</span>&#160;}</div>
<div class="line"><a name="l04718"></a><span class="lineno"> 4718</span>&#160; </div>
<div class="line"><a name="l04719"></a><span class="lineno"> 4719</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04720"></a><span class="lineno"> 4720</span>&#160;<span class="keyword">typename</span> VmaPoolAllocator&lt;T&gt;::ItemBlock&amp; VmaPoolAllocator&lt;T&gt;::CreateNewBlock()</div>
<div class="line"><a name="l04721"></a><span class="lineno"> 4721</span>&#160;{</div>
<div class="line"><a name="l04722"></a><span class="lineno"> 4722</span>&#160; <span class="keyword">const</span> uint32_t newBlockCapacity = m_ItemBlocks.empty() ?</div>
<div class="line"><a name="l04723"></a><span class="lineno"> 4723</span>&#160; m_FirstBlockCapacity : m_ItemBlocks.back().Capacity * 3 / 2;</div>
<div class="line"><a name="l04724"></a><span class="lineno"> 4724</span>&#160; </div>
<div class="line"><a name="l04725"></a><span class="lineno"> 4725</span>&#160; <span class="keyword">const</span> ItemBlock newBlock = {</div>
<div class="line"><a name="l04726"></a><span class="lineno"> 4726</span>&#160; vma_new_array(m_pAllocationCallbacks, Item, newBlockCapacity),</div>
<div class="line"><a name="l04727"></a><span class="lineno"> 4727</span>&#160; newBlockCapacity,</div>
<div class="line"><a name="l04728"></a><span class="lineno"> 4728</span>&#160; 0 };</div>
<div class="line"><a name="l04729"></a><span class="lineno"> 4729</span>&#160; </div>
<div class="line"><a name="l04730"></a><span class="lineno"> 4730</span>&#160; m_ItemBlocks.push_back(newBlock);</div>
<div class="line"><a name="l04731"></a><span class="lineno"> 4731</span>&#160; </div>
<div class="line"><a name="l04732"></a><span class="lineno"> 4732</span>&#160; <span class="comment">// Setup singly-linked list of all free items in this block.</span></div>
<div class="line"><a name="l04733"></a><span class="lineno"> 4733</span>&#160; <span class="keywordflow">for</span>(uint32_t i = 0; i &lt; newBlockCapacity - 1; ++i)</div>
<div class="line"><a name="l04734"></a><span class="lineno"> 4734</span>&#160; newBlock.pItems[i].NextFreeIndex = i + 1;</div>
<div class="line"><a name="l04735"></a><span class="lineno"> 4735</span>&#160; newBlock.pItems[newBlockCapacity - 1].NextFreeIndex = UINT32_MAX;</div>
<div class="line"><a name="l04736"></a><span class="lineno"> 4736</span>&#160; <span class="keywordflow">return</span> m_ItemBlocks.back();</div>
<div class="line"><a name="l04737"></a><span class="lineno"> 4737</span>&#160;}</div>
<div class="line"><a name="l04738"></a><span class="lineno"> 4738</span>&#160; </div>
<div class="line"><a name="l04740"></a><span class="lineno"> 4740</span>&#160;<span class="comment">// class VmaRawList, VmaList</span></div>
<div class="line"><a name="l04741"></a><span class="lineno"> 4741</span>&#160; </div>
<div class="line"><a name="l04742"></a><span class="lineno"> 4742</span>&#160;<span class="preprocessor">#if VMA_USE_STL_LIST</span></div>
<div class="line"><a name="l04743"></a><span class="lineno"> 4743</span>&#160; </div>
<div class="line"><a name="l04744"></a><span class="lineno"> 4744</span>&#160;<span class="preprocessor">#define VmaList std::list</span></div>
<div class="line"><a name="l04745"></a><span class="lineno"> 4745</span>&#160; </div>
<div class="line"><a name="l04746"></a><span class="lineno"> 4746</span>&#160;<span class="preprocessor">#else // #if VMA_USE_STL_LIST</span></div>
<div class="line"><a name="l04747"></a><span class="lineno"> 4747</span>&#160; </div>
<div class="line"><a name="l04748"></a><span class="lineno"> 4748</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04749"></a><span class="lineno"> 4749</span>&#160;<span class="keyword">struct </span>VmaListItem</div>
<div class="line"><a name="l04750"></a><span class="lineno"> 4750</span>&#160;{</div>
<div class="line"><a name="l04751"></a><span class="lineno"> 4751</span>&#160; VmaListItem* pPrev;</div>
<div class="line"><a name="l04752"></a><span class="lineno"> 4752</span>&#160; VmaListItem* pNext;</div>
<div class="line"><a name="l04753"></a><span class="lineno"> 4753</span>&#160; T Value;</div>
<div class="line"><a name="l04754"></a><span class="lineno"> 4754</span>&#160;};</div>
<div class="line"><a name="l04755"></a><span class="lineno"> 4755</span>&#160; </div>
<div class="line"><a name="l04756"></a><span class="lineno"> 4756</span>&#160;<span class="comment">// Doubly linked list.</span></div>
<div class="line"><a name="l04757"></a><span class="lineno"> 4757</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04758"></a><span class="lineno"> 4758</span>&#160;<span class="keyword">class </span>VmaRawList</div>
<div class="line"><a name="l04759"></a><span class="lineno"> 4759</span>&#160;{</div>
<div class="line"><a name="l04760"></a><span class="lineno"> 4760</span>&#160; VMA_CLASS_NO_COPY(VmaRawList)</div>
<div class="line"><a name="l04761"></a><span class="lineno"> 4761</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l04762"></a><span class="lineno"> 4762</span>&#160; <span class="keyword">typedef</span> VmaListItem&lt;T&gt; ItemType;</div>
<div class="line"><a name="l04763"></a><span class="lineno"> 4763</span>&#160; </div>
<div class="line"><a name="l04764"></a><span class="lineno"> 4764</span>&#160; VmaRawList(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks);</div>
<div class="line"><a name="l04765"></a><span class="lineno"> 4765</span>&#160; ~VmaRawList();</div>
<div class="line"><a name="l04766"></a><span class="lineno"> 4766</span>&#160; <span class="keywordtype">void</span> Clear();</div>
<div class="line"><a name="l04767"></a><span class="lineno"> 4767</span>&#160; </div>
<div class="line"><a name="l04768"></a><span class="lineno"> 4768</span>&#160; <span class="keywordtype">size_t</span> GetCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count; }</div>
<div class="line"><a name="l04769"></a><span class="lineno"> 4769</span>&#160; <span class="keywordtype">bool</span> IsEmpty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Count == 0; }</div>
<div class="line"><a name="l04770"></a><span class="lineno"> 4770</span>&#160; </div>
<div class="line"><a name="l04771"></a><span class="lineno"> 4771</span>&#160; ItemType* Front() { <span class="keywordflow">return</span> m_pFront; }</div>
<div class="line"><a name="l04772"></a><span class="lineno"> 4772</span>&#160; <span class="keyword">const</span> ItemType* Front()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pFront; }</div>
<div class="line"><a name="l04773"></a><span class="lineno"> 4773</span>&#160; ItemType* Back() { <span class="keywordflow">return</span> m_pBack; }</div>
<div class="line"><a name="l04774"></a><span class="lineno"> 4774</span>&#160; <span class="keyword">const</span> ItemType* Back()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pBack; }</div>
<div class="line"><a name="l04775"></a><span class="lineno"> 4775</span>&#160; </div>
<div class="line"><a name="l04776"></a><span class="lineno"> 4776</span>&#160; ItemType* PushBack();</div>
<div class="line"><a name="l04777"></a><span class="lineno"> 4777</span>&#160; ItemType* PushFront();</div>
<div class="line"><a name="l04778"></a><span class="lineno"> 4778</span>&#160; ItemType* PushBack(<span class="keyword">const</span> T&amp; value);</div>
<div class="line"><a name="l04779"></a><span class="lineno"> 4779</span>&#160; ItemType* PushFront(<span class="keyword">const</span> T&amp; value);</div>
<div class="line"><a name="l04780"></a><span class="lineno"> 4780</span>&#160; <span class="keywordtype">void</span> PopBack();</div>
<div class="line"><a name="l04781"></a><span class="lineno"> 4781</span>&#160; <span class="keywordtype">void</span> PopFront();</div>
<div class="line"><a name="l04782"></a><span class="lineno"> 4782</span>&#160; </div>
<div class="line"><a name="l04783"></a><span class="lineno"> 4783</span>&#160; <span class="comment">// Item can be null - it means PushBack.</span></div>
<div class="line"><a name="l04784"></a><span class="lineno"> 4784</span>&#160; ItemType* InsertBefore(ItemType* pItem);</div>
<div class="line"><a name="l04785"></a><span class="lineno"> 4785</span>&#160; <span class="comment">// Item can be null - it means PushFront.</span></div>
<div class="line"><a name="l04786"></a><span class="lineno"> 4786</span>&#160; ItemType* InsertAfter(ItemType* pItem);</div>
<div class="line"><a name="l04787"></a><span class="lineno"> 4787</span>&#160; </div>
<div class="line"><a name="l04788"></a><span class="lineno"> 4788</span>&#160; ItemType* InsertBefore(ItemType* pItem, <span class="keyword">const</span> T&amp; value);</div>
<div class="line"><a name="l04789"></a><span class="lineno"> 4789</span>&#160; ItemType* InsertAfter(ItemType* pItem, <span class="keyword">const</span> T&amp; value);</div>
<div class="line"><a name="l04790"></a><span class="lineno"> 4790</span>&#160; </div>
<div class="line"><a name="l04791"></a><span class="lineno"> 4791</span>&#160; <span class="keywordtype">void</span> Remove(ItemType* pItem);</div>
<div class="line"><a name="l04792"></a><span class="lineno"> 4792</span>&#160; </div>
<div class="line"><a name="l04793"></a><span class="lineno"> 4793</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l04794"></a><span class="lineno"> 4794</span>&#160; <span class="keyword">const</span> VkAllocationCallbacks* <span class="keyword">const</span> m_pAllocationCallbacks;</div>
<div class="line"><a name="l04795"></a><span class="lineno"> 4795</span>&#160; VmaPoolAllocator&lt;ItemType&gt; m_ItemAllocator;</div>
<div class="line"><a name="l04796"></a><span class="lineno"> 4796</span>&#160; ItemType* m_pFront;</div>
<div class="line"><a name="l04797"></a><span class="lineno"> 4797</span>&#160; ItemType* m_pBack;</div>
<div class="line"><a name="l04798"></a><span class="lineno"> 4798</span>&#160; <span class="keywordtype">size_t</span> m_Count;</div>
<div class="line"><a name="l04799"></a><span class="lineno"> 4799</span>&#160;};</div>
<div class="line"><a name="l04800"></a><span class="lineno"> 4800</span>&#160; </div>
<div class="line"><a name="l04801"></a><span class="lineno"> 4801</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04802"></a><span class="lineno"> 4802</span>&#160;VmaRawList&lt;T&gt;::VmaRawList(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks) :</div>
<div class="line"><a name="l04803"></a><span class="lineno"> 4803</span>&#160; m_pAllocationCallbacks(pAllocationCallbacks),</div>
<div class="line"><a name="l04804"></a><span class="lineno"> 4804</span>&#160; m_ItemAllocator(pAllocationCallbacks, 128),</div>
<div class="line"><a name="l04805"></a><span class="lineno"> 4805</span>&#160; m_pFront(VMA_NULL),</div>
<div class="line"><a name="l04806"></a><span class="lineno"> 4806</span>&#160; m_pBack(VMA_NULL),</div>
<div class="line"><a name="l04807"></a><span class="lineno"> 4807</span>&#160; m_Count(0)</div>
<div class="line"><a name="l04808"></a><span class="lineno"> 4808</span>&#160;{</div>
<div class="line"><a name="l04809"></a><span class="lineno"> 4809</span>&#160;}</div>
<div class="line"><a name="l04810"></a><span class="lineno"> 4810</span>&#160; </div>
<div class="line"><a name="l04811"></a><span class="lineno"> 4811</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04812"></a><span class="lineno"> 4812</span>&#160;VmaRawList&lt;T&gt;::~VmaRawList()</div>
<div class="line"><a name="l04813"></a><span class="lineno"> 4813</span>&#160;{</div>
<div class="line"><a name="l04814"></a><span class="lineno"> 4814</span>&#160; <span class="comment">// Intentionally not calling Clear, because that would be unnecessary</span></div>
<div class="line"><a name="l04815"></a><span class="lineno"> 4815</span>&#160; <span class="comment">// computations to return all items to m_ItemAllocator as free.</span></div>
<div class="line"><a name="l04816"></a><span class="lineno"> 4816</span>&#160;}</div>
<div class="line"><a name="l04817"></a><span class="lineno"> 4817</span>&#160; </div>
<div class="line"><a name="l04818"></a><span class="lineno"> 4818</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04819"></a><span class="lineno"> 4819</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::Clear()</div>
<div class="line"><a name="l04820"></a><span class="lineno"> 4820</span>&#160;{</div>
<div class="line"><a name="l04821"></a><span class="lineno"> 4821</span>&#160; <span class="keywordflow">if</span>(IsEmpty() == <span class="keyword">false</span>)</div>
<div class="line"><a name="l04822"></a><span class="lineno"> 4822</span>&#160; {</div>
<div class="line"><a name="l04823"></a><span class="lineno"> 4823</span>&#160; ItemType* pItem = m_pBack;</div>
<div class="line"><a name="l04824"></a><span class="lineno"> 4824</span>&#160; <span class="keywordflow">while</span>(pItem != VMA_NULL)</div>
<div class="line"><a name="l04825"></a><span class="lineno"> 4825</span>&#160; {</div>
<div class="line"><a name="l04826"></a><span class="lineno"> 4826</span>&#160; ItemType* <span class="keyword">const</span> pPrevItem = pItem-&gt;pPrev;</div>
<div class="line"><a name="l04827"></a><span class="lineno"> 4827</span>&#160; m_ItemAllocator.Free(pItem);</div>
<div class="line"><a name="l04828"></a><span class="lineno"> 4828</span>&#160; pItem = pPrevItem;</div>
<div class="line"><a name="l04829"></a><span class="lineno"> 4829</span>&#160; }</div>
<div class="line"><a name="l04830"></a><span class="lineno"> 4830</span>&#160; m_pFront = VMA_NULL;</div>
<div class="line"><a name="l04831"></a><span class="lineno"> 4831</span>&#160; m_pBack = VMA_NULL;</div>
<div class="line"><a name="l04832"></a><span class="lineno"> 4832</span>&#160; m_Count = 0;</div>
<div class="line"><a name="l04833"></a><span class="lineno"> 4833</span>&#160; }</div>
<div class="line"><a name="l04834"></a><span class="lineno"> 4834</span>&#160;}</div>
<div class="line"><a name="l04835"></a><span class="lineno"> 4835</span>&#160; </div>
<div class="line"><a name="l04836"></a><span class="lineno"> 4836</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04837"></a><span class="lineno"> 4837</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushBack()</div>
<div class="line"><a name="l04838"></a><span class="lineno"> 4838</span>&#160;{</div>
<div class="line"><a name="l04839"></a><span class="lineno"> 4839</span>&#160; ItemType* <span class="keyword">const</span> pNewItem = m_ItemAllocator.Alloc();</div>
<div class="line"><a name="l04840"></a><span class="lineno"> 4840</span>&#160; pNewItem-&gt;pNext = VMA_NULL;</div>
<div class="line"><a name="l04841"></a><span class="lineno"> 4841</span>&#160; <span class="keywordflow">if</span>(IsEmpty())</div>
<div class="line"><a name="l04842"></a><span class="lineno"> 4842</span>&#160; {</div>
<div class="line"><a name="l04843"></a><span class="lineno"> 4843</span>&#160; pNewItem-&gt;pPrev = VMA_NULL;</div>
<div class="line"><a name="l04844"></a><span class="lineno"> 4844</span>&#160; m_pFront = pNewItem;</div>
<div class="line"><a name="l04845"></a><span class="lineno"> 4845</span>&#160; m_pBack = pNewItem;</div>
<div class="line"><a name="l04846"></a><span class="lineno"> 4846</span>&#160; m_Count = 1;</div>
<div class="line"><a name="l04847"></a><span class="lineno"> 4847</span>&#160; }</div>
<div class="line"><a name="l04848"></a><span class="lineno"> 4848</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l04849"></a><span class="lineno"> 4849</span>&#160; {</div>
<div class="line"><a name="l04850"></a><span class="lineno"> 4850</span>&#160; pNewItem-&gt;pPrev = m_pBack;</div>
<div class="line"><a name="l04851"></a><span class="lineno"> 4851</span>&#160; m_pBack-&gt;pNext = pNewItem;</div>
<div class="line"><a name="l04852"></a><span class="lineno"> 4852</span>&#160; m_pBack = pNewItem;</div>
<div class="line"><a name="l04853"></a><span class="lineno"> 4853</span>&#160; ++m_Count;</div>
<div class="line"><a name="l04854"></a><span class="lineno"> 4854</span>&#160; }</div>
<div class="line"><a name="l04855"></a><span class="lineno"> 4855</span>&#160; <span class="keywordflow">return</span> pNewItem;</div>
<div class="line"><a name="l04856"></a><span class="lineno"> 4856</span>&#160;}</div>
<div class="line"><a name="l04857"></a><span class="lineno"> 4857</span>&#160; </div>
<div class="line"><a name="l04858"></a><span class="lineno"> 4858</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04859"></a><span class="lineno"> 4859</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushFront()</div>
<div class="line"><a name="l04860"></a><span class="lineno"> 4860</span>&#160;{</div>
<div class="line"><a name="l04861"></a><span class="lineno"> 4861</span>&#160; ItemType* <span class="keyword">const</span> pNewItem = m_ItemAllocator.Alloc();</div>
<div class="line"><a name="l04862"></a><span class="lineno"> 4862</span>&#160; pNewItem-&gt;pPrev = VMA_NULL;</div>
<div class="line"><a name="l04863"></a><span class="lineno"> 4863</span>&#160; <span class="keywordflow">if</span>(IsEmpty())</div>
<div class="line"><a name="l04864"></a><span class="lineno"> 4864</span>&#160; {</div>
<div class="line"><a name="l04865"></a><span class="lineno"> 4865</span>&#160; pNewItem-&gt;pNext = VMA_NULL;</div>
<div class="line"><a name="l04866"></a><span class="lineno"> 4866</span>&#160; m_pFront = pNewItem;</div>
<div class="line"><a name="l04867"></a><span class="lineno"> 4867</span>&#160; m_pBack = pNewItem;</div>
<div class="line"><a name="l04868"></a><span class="lineno"> 4868</span>&#160; m_Count = 1;</div>
<div class="line"><a name="l04869"></a><span class="lineno"> 4869</span>&#160; }</div>
<div class="line"><a name="l04870"></a><span class="lineno"> 4870</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l04871"></a><span class="lineno"> 4871</span>&#160; {</div>
<div class="line"><a name="l04872"></a><span class="lineno"> 4872</span>&#160; pNewItem-&gt;pNext = m_pFront;</div>
<div class="line"><a name="l04873"></a><span class="lineno"> 4873</span>&#160; m_pFront-&gt;pPrev = pNewItem;</div>
<div class="line"><a name="l04874"></a><span class="lineno"> 4874</span>&#160; m_pFront = pNewItem;</div>
<div class="line"><a name="l04875"></a><span class="lineno"> 4875</span>&#160; ++m_Count;</div>
<div class="line"><a name="l04876"></a><span class="lineno"> 4876</span>&#160; }</div>
<div class="line"><a name="l04877"></a><span class="lineno"> 4877</span>&#160; <span class="keywordflow">return</span> pNewItem;</div>
<div class="line"><a name="l04878"></a><span class="lineno"> 4878</span>&#160;}</div>
<div class="line"><a name="l04879"></a><span class="lineno"> 4879</span>&#160; </div>
<div class="line"><a name="l04880"></a><span class="lineno"> 4880</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04881"></a><span class="lineno"> 4881</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushBack(<span class="keyword">const</span> T&amp; value)</div>
<div class="line"><a name="l04882"></a><span class="lineno"> 4882</span>&#160;{</div>
<div class="line"><a name="l04883"></a><span class="lineno"> 4883</span>&#160; ItemType* <span class="keyword">const</span> pNewItem = PushBack();</div>
<div class="line"><a name="l04884"></a><span class="lineno"> 4884</span>&#160; pNewItem-&gt;Value = value;</div>
<div class="line"><a name="l04885"></a><span class="lineno"> 4885</span>&#160; <span class="keywordflow">return</span> pNewItem;</div>
<div class="line"><a name="l04886"></a><span class="lineno"> 4886</span>&#160;}</div>
<div class="line"><a name="l04887"></a><span class="lineno"> 4887</span>&#160; </div>
<div class="line"><a name="l04888"></a><span class="lineno"> 4888</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04889"></a><span class="lineno"> 4889</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::PushFront(<span class="keyword">const</span> T&amp; value)</div>
<div class="line"><a name="l04890"></a><span class="lineno"> 4890</span>&#160;{</div>
<div class="line"><a name="l04891"></a><span class="lineno"> 4891</span>&#160; ItemType* <span class="keyword">const</span> pNewItem = PushFront();</div>
<div class="line"><a name="l04892"></a><span class="lineno"> 4892</span>&#160; pNewItem-&gt;Value = value;</div>
<div class="line"><a name="l04893"></a><span class="lineno"> 4893</span>&#160; <span class="keywordflow">return</span> pNewItem;</div>
<div class="line"><a name="l04894"></a><span class="lineno"> 4894</span>&#160;}</div>
<div class="line"><a name="l04895"></a><span class="lineno"> 4895</span>&#160; </div>
<div class="line"><a name="l04896"></a><span class="lineno"> 4896</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04897"></a><span class="lineno"> 4897</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::PopBack()</div>
<div class="line"><a name="l04898"></a><span class="lineno"> 4898</span>&#160;{</div>
<div class="line"><a name="l04899"></a><span class="lineno"> 4899</span>&#160; VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
<div class="line"><a name="l04900"></a><span class="lineno"> 4900</span>&#160; ItemType* <span class="keyword">const</span> pBackItem = m_pBack;</div>
<div class="line"><a name="l04901"></a><span class="lineno"> 4901</span>&#160; ItemType* <span class="keyword">const</span> pPrevItem = pBackItem-&gt;pPrev;</div>
<div class="line"><a name="l04902"></a><span class="lineno"> 4902</span>&#160; <span class="keywordflow">if</span>(pPrevItem != VMA_NULL)</div>
<div class="line"><a name="l04903"></a><span class="lineno"> 4903</span>&#160; {</div>
<div class="line"><a name="l04904"></a><span class="lineno"> 4904</span>&#160; pPrevItem-&gt;pNext = VMA_NULL;</div>
<div class="line"><a name="l04905"></a><span class="lineno"> 4905</span>&#160; }</div>
<div class="line"><a name="l04906"></a><span class="lineno"> 4906</span>&#160; m_pBack = pPrevItem;</div>
<div class="line"><a name="l04907"></a><span class="lineno"> 4907</span>&#160; m_ItemAllocator.Free(pBackItem);</div>
<div class="line"><a name="l04908"></a><span class="lineno"> 4908</span>&#160; --m_Count;</div>
<div class="line"><a name="l04909"></a><span class="lineno"> 4909</span>&#160;}</div>
<div class="line"><a name="l04910"></a><span class="lineno"> 4910</span>&#160; </div>
<div class="line"><a name="l04911"></a><span class="lineno"> 4911</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04912"></a><span class="lineno"> 4912</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::PopFront()</div>
<div class="line"><a name="l04913"></a><span class="lineno"> 4913</span>&#160;{</div>
<div class="line"><a name="l04914"></a><span class="lineno"> 4914</span>&#160; VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
<div class="line"><a name="l04915"></a><span class="lineno"> 4915</span>&#160; ItemType* <span class="keyword">const</span> pFrontItem = m_pFront;</div>
<div class="line"><a name="l04916"></a><span class="lineno"> 4916</span>&#160; ItemType* <span class="keyword">const</span> pNextItem = pFrontItem-&gt;pNext;</div>
<div class="line"><a name="l04917"></a><span class="lineno"> 4917</span>&#160; <span class="keywordflow">if</span>(pNextItem != VMA_NULL)</div>
<div class="line"><a name="l04918"></a><span class="lineno"> 4918</span>&#160; {</div>
<div class="line"><a name="l04919"></a><span class="lineno"> 4919</span>&#160; pNextItem-&gt;pPrev = VMA_NULL;</div>
<div class="line"><a name="l04920"></a><span class="lineno"> 4920</span>&#160; }</div>
<div class="line"><a name="l04921"></a><span class="lineno"> 4921</span>&#160; m_pFront = pNextItem;</div>
<div class="line"><a name="l04922"></a><span class="lineno"> 4922</span>&#160; m_ItemAllocator.Free(pFrontItem);</div>
<div class="line"><a name="l04923"></a><span class="lineno"> 4923</span>&#160; --m_Count;</div>
<div class="line"><a name="l04924"></a><span class="lineno"> 4924</span>&#160;}</div>
<div class="line"><a name="l04925"></a><span class="lineno"> 4925</span>&#160; </div>
<div class="line"><a name="l04926"></a><span class="lineno"> 4926</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04927"></a><span class="lineno"> 4927</span>&#160;<span class="keywordtype">void</span> VmaRawList&lt;T&gt;::Remove(ItemType* pItem)</div>
<div class="line"><a name="l04928"></a><span class="lineno"> 4928</span>&#160;{</div>
<div class="line"><a name="l04929"></a><span class="lineno"> 4929</span>&#160; VMA_HEAVY_ASSERT(pItem != VMA_NULL);</div>
<div class="line"><a name="l04930"></a><span class="lineno"> 4930</span>&#160; VMA_HEAVY_ASSERT(m_Count &gt; 0);</div>
<div class="line"><a name="l04931"></a><span class="lineno"> 4931</span>&#160; </div>
<div class="line"><a name="l04932"></a><span class="lineno"> 4932</span>&#160; <span class="keywordflow">if</span>(pItem-&gt;pPrev != VMA_NULL)</div>
<div class="line"><a name="l04933"></a><span class="lineno"> 4933</span>&#160; {</div>
<div class="line"><a name="l04934"></a><span class="lineno"> 4934</span>&#160; pItem-&gt;pPrev-&gt;pNext = pItem-&gt;pNext;</div>
<div class="line"><a name="l04935"></a><span class="lineno"> 4935</span>&#160; }</div>
<div class="line"><a name="l04936"></a><span class="lineno"> 4936</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l04937"></a><span class="lineno"> 4937</span>&#160; {</div>
<div class="line"><a name="l04938"></a><span class="lineno"> 4938</span>&#160; VMA_HEAVY_ASSERT(m_pFront == pItem);</div>
<div class="line"><a name="l04939"></a><span class="lineno"> 4939</span>&#160; m_pFront = pItem-&gt;pNext;</div>
<div class="line"><a name="l04940"></a><span class="lineno"> 4940</span>&#160; }</div>
<div class="line"><a name="l04941"></a><span class="lineno"> 4941</span>&#160; </div>
<div class="line"><a name="l04942"></a><span class="lineno"> 4942</span>&#160; <span class="keywordflow">if</span>(pItem-&gt;pNext != VMA_NULL)</div>
<div class="line"><a name="l04943"></a><span class="lineno"> 4943</span>&#160; {</div>
<div class="line"><a name="l04944"></a><span class="lineno"> 4944</span>&#160; pItem-&gt;pNext-&gt;pPrev = pItem-&gt;pPrev;</div>
<div class="line"><a name="l04945"></a><span class="lineno"> 4945</span>&#160; }</div>
<div class="line"><a name="l04946"></a><span class="lineno"> 4946</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l04947"></a><span class="lineno"> 4947</span>&#160; {</div>
<div class="line"><a name="l04948"></a><span class="lineno"> 4948</span>&#160; VMA_HEAVY_ASSERT(m_pBack == pItem);</div>
<div class="line"><a name="l04949"></a><span class="lineno"> 4949</span>&#160; m_pBack = pItem-&gt;pPrev;</div>
<div class="line"><a name="l04950"></a><span class="lineno"> 4950</span>&#160; }</div>
<div class="line"><a name="l04951"></a><span class="lineno"> 4951</span>&#160; </div>
<div class="line"><a name="l04952"></a><span class="lineno"> 4952</span>&#160; m_ItemAllocator.Free(pItem);</div>
<div class="line"><a name="l04953"></a><span class="lineno"> 4953</span>&#160; --m_Count;</div>
<div class="line"><a name="l04954"></a><span class="lineno"> 4954</span>&#160;}</div>
<div class="line"><a name="l04955"></a><span class="lineno"> 4955</span>&#160; </div>
<div class="line"><a name="l04956"></a><span class="lineno"> 4956</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04957"></a><span class="lineno"> 4957</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertBefore(ItemType* pItem)</div>
<div class="line"><a name="l04958"></a><span class="lineno"> 4958</span>&#160;{</div>
<div class="line"><a name="l04959"></a><span class="lineno"> 4959</span>&#160; <span class="keywordflow">if</span>(pItem != VMA_NULL)</div>
<div class="line"><a name="l04960"></a><span class="lineno"> 4960</span>&#160; {</div>
<div class="line"><a name="l04961"></a><span class="lineno"> 4961</span>&#160; ItemType* <span class="keyword">const</span> prevItem = pItem-&gt;pPrev;</div>
<div class="line"><a name="l04962"></a><span class="lineno"> 4962</span>&#160; ItemType* <span class="keyword">const</span> newItem = m_ItemAllocator.Alloc();</div>
<div class="line"><a name="l04963"></a><span class="lineno"> 4963</span>&#160; newItem-&gt;pPrev = prevItem;</div>
<div class="line"><a name="l04964"></a><span class="lineno"> 4964</span>&#160; newItem-&gt;pNext = pItem;</div>
<div class="line"><a name="l04965"></a><span class="lineno"> 4965</span>&#160; pItem-&gt;pPrev = newItem;</div>
<div class="line"><a name="l04966"></a><span class="lineno"> 4966</span>&#160; <span class="keywordflow">if</span>(prevItem != VMA_NULL)</div>
<div class="line"><a name="l04967"></a><span class="lineno"> 4967</span>&#160; {</div>
<div class="line"><a name="l04968"></a><span class="lineno"> 4968</span>&#160; prevItem-&gt;pNext = newItem;</div>
<div class="line"><a name="l04969"></a><span class="lineno"> 4969</span>&#160; }</div>
<div class="line"><a name="l04970"></a><span class="lineno"> 4970</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l04971"></a><span class="lineno"> 4971</span>&#160; {</div>
<div class="line"><a name="l04972"></a><span class="lineno"> 4972</span>&#160; VMA_HEAVY_ASSERT(m_pFront == pItem);</div>
<div class="line"><a name="l04973"></a><span class="lineno"> 4973</span>&#160; m_pFront = newItem;</div>
<div class="line"><a name="l04974"></a><span class="lineno"> 4974</span>&#160; }</div>
<div class="line"><a name="l04975"></a><span class="lineno"> 4975</span>&#160; ++m_Count;</div>
<div class="line"><a name="l04976"></a><span class="lineno"> 4976</span>&#160; <span class="keywordflow">return</span> newItem;</div>
<div class="line"><a name="l04977"></a><span class="lineno"> 4977</span>&#160; }</div>
<div class="line"><a name="l04978"></a><span class="lineno"> 4978</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l04979"></a><span class="lineno"> 4979</span>&#160; <span class="keywordflow">return</span> PushBack();</div>
<div class="line"><a name="l04980"></a><span class="lineno"> 4980</span>&#160;}</div>
<div class="line"><a name="l04981"></a><span class="lineno"> 4981</span>&#160; </div>
<div class="line"><a name="l04982"></a><span class="lineno"> 4982</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l04983"></a><span class="lineno"> 4983</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertAfter(ItemType* pItem)</div>
<div class="line"><a name="l04984"></a><span class="lineno"> 4984</span>&#160;{</div>
<div class="line"><a name="l04985"></a><span class="lineno"> 4985</span>&#160; <span class="keywordflow">if</span>(pItem != VMA_NULL)</div>
<div class="line"><a name="l04986"></a><span class="lineno"> 4986</span>&#160; {</div>
<div class="line"><a name="l04987"></a><span class="lineno"> 4987</span>&#160; ItemType* <span class="keyword">const</span> nextItem = pItem-&gt;pNext;</div>
<div class="line"><a name="l04988"></a><span class="lineno"> 4988</span>&#160; ItemType* <span class="keyword">const</span> newItem = m_ItemAllocator.Alloc();</div>
<div class="line"><a name="l04989"></a><span class="lineno"> 4989</span>&#160; newItem-&gt;pNext = nextItem;</div>
<div class="line"><a name="l04990"></a><span class="lineno"> 4990</span>&#160; newItem-&gt;pPrev = pItem;</div>
<div class="line"><a name="l04991"></a><span class="lineno"> 4991</span>&#160; pItem-&gt;pNext = newItem;</div>
<div class="line"><a name="l04992"></a><span class="lineno"> 4992</span>&#160; <span class="keywordflow">if</span>(nextItem != VMA_NULL)</div>
<div class="line"><a name="l04993"></a><span class="lineno"> 4993</span>&#160; {</div>
<div class="line"><a name="l04994"></a><span class="lineno"> 4994</span>&#160; nextItem-&gt;pPrev = newItem;</div>
<div class="line"><a name="l04995"></a><span class="lineno"> 4995</span>&#160; }</div>
<div class="line"><a name="l04996"></a><span class="lineno"> 4996</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l04997"></a><span class="lineno"> 4997</span>&#160; {</div>
<div class="line"><a name="l04998"></a><span class="lineno"> 4998</span>&#160; VMA_HEAVY_ASSERT(m_pBack == pItem);</div>
<div class="line"><a name="l04999"></a><span class="lineno"> 4999</span>&#160; m_pBack = newItem;</div>
<div class="line"><a name="l05000"></a><span class="lineno"> 5000</span>&#160; }</div>
<div class="line"><a name="l05001"></a><span class="lineno"> 5001</span>&#160; ++m_Count;</div>
<div class="line"><a name="l05002"></a><span class="lineno"> 5002</span>&#160; <span class="keywordflow">return</span> newItem;</div>
<div class="line"><a name="l05003"></a><span class="lineno"> 5003</span>&#160; }</div>
<div class="line"><a name="l05004"></a><span class="lineno"> 5004</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l05005"></a><span class="lineno"> 5005</span>&#160; <span class="keywordflow">return</span> PushFront();</div>
<div class="line"><a name="l05006"></a><span class="lineno"> 5006</span>&#160;}</div>
<div class="line"><a name="l05007"></a><span class="lineno"> 5007</span>&#160; </div>
<div class="line"><a name="l05008"></a><span class="lineno"> 5008</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l05009"></a><span class="lineno"> 5009</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertBefore(ItemType* pItem, <span class="keyword">const</span> T&amp; value)</div>
<div class="line"><a name="l05010"></a><span class="lineno"> 5010</span>&#160;{</div>
<div class="line"><a name="l05011"></a><span class="lineno"> 5011</span>&#160; ItemType* <span class="keyword">const</span> newItem = InsertBefore(pItem);</div>
<div class="line"><a name="l05012"></a><span class="lineno"> 5012</span>&#160; newItem-&gt;Value = value;</div>
<div class="line"><a name="l05013"></a><span class="lineno"> 5013</span>&#160; <span class="keywordflow">return</span> newItem;</div>
<div class="line"><a name="l05014"></a><span class="lineno"> 5014</span>&#160;}</div>
<div class="line"><a name="l05015"></a><span class="lineno"> 5015</span>&#160; </div>
<div class="line"><a name="l05016"></a><span class="lineno"> 5016</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l05017"></a><span class="lineno"> 5017</span>&#160;VmaListItem&lt;T&gt;* VmaRawList&lt;T&gt;::InsertAfter(ItemType* pItem, <span class="keyword">const</span> T&amp; value)</div>
<div class="line"><a name="l05018"></a><span class="lineno"> 5018</span>&#160;{</div>
<div class="line"><a name="l05019"></a><span class="lineno"> 5019</span>&#160; ItemType* <span class="keyword">const</span> newItem = InsertAfter(pItem);</div>
<div class="line"><a name="l05020"></a><span class="lineno"> 5020</span>&#160; newItem-&gt;Value = value;</div>
<div class="line"><a name="l05021"></a><span class="lineno"> 5021</span>&#160; <span class="keywordflow">return</span> newItem;</div>
<div class="line"><a name="l05022"></a><span class="lineno"> 5022</span>&#160;}</div>
<div class="line"><a name="l05023"></a><span class="lineno"> 5023</span>&#160; </div>
<div class="line"><a name="l05024"></a><span class="lineno"> 5024</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> AllocatorT&gt;</div>
<div class="line"><a name="l05025"></a><span class="lineno"> 5025</span>&#160;<span class="keyword">class </span>VmaList</div>
<div class="line"><a name="l05026"></a><span class="lineno"> 5026</span>&#160;{</div>
<div class="line"><a name="l05027"></a><span class="lineno"> 5027</span>&#160; VMA_CLASS_NO_COPY(VmaList)</div>
<div class="line"><a name="l05028"></a><span class="lineno"> 5028</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l05029"></a><span class="lineno"> 5029</span>&#160; <span class="keyword">class </span>iterator</div>
<div class="line"><a name="l05030"></a><span class="lineno"> 5030</span>&#160; {</div>
<div class="line"><a name="l05031"></a><span class="lineno"> 5031</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l05032"></a><span class="lineno"> 5032</span>&#160; iterator() :</div>
<div class="line"><a name="l05033"></a><span class="lineno"> 5033</span>&#160; m_pList(VMA_NULL),</div>
<div class="line"><a name="l05034"></a><span class="lineno"> 5034</span>&#160; m_pItem(VMA_NULL)</div>
<div class="line"><a name="l05035"></a><span class="lineno"> 5035</span>&#160; {</div>
<div class="line"><a name="l05036"></a><span class="lineno"> 5036</span>&#160; }</div>
<div class="line"><a name="l05037"></a><span class="lineno"> 5037</span>&#160; </div>
<div class="line"><a name="l05038"></a><span class="lineno"> 5038</span>&#160; T&amp; operator*()<span class="keyword"> const</span></div>
<div class="line"><a name="l05039"></a><span class="lineno"> 5039</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05040"></a><span class="lineno"> 5040</span>&#160; VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
<div class="line"><a name="l05041"></a><span class="lineno"> 5041</span>&#160; <span class="keywordflow">return</span> m_pItem-&gt;Value;</div>
<div class="line"><a name="l05042"></a><span class="lineno"> 5042</span>&#160; }</div>
<div class="line"><a name="l05043"></a><span class="lineno"> 5043</span>&#160; T* operator-&gt;()<span class="keyword"> const</span></div>
<div class="line"><a name="l05044"></a><span class="lineno"> 5044</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05045"></a><span class="lineno"> 5045</span>&#160; VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
<div class="line"><a name="l05046"></a><span class="lineno"> 5046</span>&#160; <span class="keywordflow">return</span> &amp;m_pItem-&gt;Value;</div>
<div class="line"><a name="l05047"></a><span class="lineno"> 5047</span>&#160; }</div>
<div class="line"><a name="l05048"></a><span class="lineno"> 5048</span>&#160; </div>
<div class="line"><a name="l05049"></a><span class="lineno"> 5049</span>&#160; iterator&amp; operator++()</div>
<div class="line"><a name="l05050"></a><span class="lineno"> 5050</span>&#160; {</div>
<div class="line"><a name="l05051"></a><span class="lineno"> 5051</span>&#160; VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
<div class="line"><a name="l05052"></a><span class="lineno"> 5052</span>&#160; m_pItem = m_pItem-&gt;pNext;</div>
<div class="line"><a name="l05053"></a><span class="lineno"> 5053</span>&#160; <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l05054"></a><span class="lineno"> 5054</span>&#160; }</div>
<div class="line"><a name="l05055"></a><span class="lineno"> 5055</span>&#160; iterator&amp; operator--()</div>
<div class="line"><a name="l05056"></a><span class="lineno"> 5056</span>&#160; {</div>
<div class="line"><a name="l05057"></a><span class="lineno"> 5057</span>&#160; <span class="keywordflow">if</span>(m_pItem != VMA_NULL)</div>
<div class="line"><a name="l05058"></a><span class="lineno"> 5058</span>&#160; {</div>
<div class="line"><a name="l05059"></a><span class="lineno"> 5059</span>&#160; m_pItem = m_pItem-&gt;pPrev;</div>
<div class="line"><a name="l05060"></a><span class="lineno"> 5060</span>&#160; }</div>
<div class="line"><a name="l05061"></a><span class="lineno"> 5061</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l05062"></a><span class="lineno"> 5062</span>&#160; {</div>
<div class="line"><a name="l05063"></a><span class="lineno"> 5063</span>&#160; VMA_HEAVY_ASSERT(!m_pList-&gt;IsEmpty());</div>
<div class="line"><a name="l05064"></a><span class="lineno"> 5064</span>&#160; m_pItem = m_pList-&gt;Back();</div>
<div class="line"><a name="l05065"></a><span class="lineno"> 5065</span>&#160; }</div>
<div class="line"><a name="l05066"></a><span class="lineno"> 5066</span>&#160; <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l05067"></a><span class="lineno"> 5067</span>&#160; }</div>
<div class="line"><a name="l05068"></a><span class="lineno"> 5068</span>&#160; </div>
<div class="line"><a name="l05069"></a><span class="lineno"> 5069</span>&#160; iterator operator++(<span class="keywordtype">int</span>)</div>
<div class="line"><a name="l05070"></a><span class="lineno"> 5070</span>&#160; {</div>
<div class="line"><a name="l05071"></a><span class="lineno"> 5071</span>&#160; iterator result = *<span class="keyword">this</span>;</div>
<div class="line"><a name="l05072"></a><span class="lineno"> 5072</span>&#160; ++*<span class="keyword">this</span>;</div>
<div class="line"><a name="l05073"></a><span class="lineno"> 5073</span>&#160; <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l05074"></a><span class="lineno"> 5074</span>&#160; }</div>
<div class="line"><a name="l05075"></a><span class="lineno"> 5075</span>&#160; iterator operator--(<span class="keywordtype">int</span>)</div>
<div class="line"><a name="l05076"></a><span class="lineno"> 5076</span>&#160; {</div>
<div class="line"><a name="l05077"></a><span class="lineno"> 5077</span>&#160; iterator result = *<span class="keyword">this</span>;</div>
<div class="line"><a name="l05078"></a><span class="lineno"> 5078</span>&#160; --*<span class="keyword">this</span>;</div>
<div class="line"><a name="l05079"></a><span class="lineno"> 5079</span>&#160; <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l05080"></a><span class="lineno"> 5080</span>&#160; }</div>
<div class="line"><a name="l05081"></a><span class="lineno"> 5081</span>&#160; </div>
<div class="line"><a name="l05082"></a><span class="lineno"> 5082</span>&#160; <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> iterator&amp; rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l05083"></a><span class="lineno"> 5083</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05084"></a><span class="lineno"> 5084</span>&#160; VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
<div class="line"><a name="l05085"></a><span class="lineno"> 5085</span>&#160; <span class="keywordflow">return</span> m_pItem == rhs.m_pItem;</div>
<div class="line"><a name="l05086"></a><span class="lineno"> 5086</span>&#160; }</div>
<div class="line"><a name="l05087"></a><span class="lineno"> 5087</span>&#160; <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> iterator&amp; rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l05088"></a><span class="lineno"> 5088</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05089"></a><span class="lineno"> 5089</span>&#160; VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
<div class="line"><a name="l05090"></a><span class="lineno"> 5090</span>&#160; <span class="keywordflow">return</span> m_pItem != rhs.m_pItem;</div>
<div class="line"><a name="l05091"></a><span class="lineno"> 5091</span>&#160; }</div>
<div class="line"><a name="l05092"></a><span class="lineno"> 5092</span>&#160; </div>
<div class="line"><a name="l05093"></a><span class="lineno"> 5093</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l05094"></a><span class="lineno"> 5094</span>&#160; VmaRawList&lt;T&gt;* m_pList;</div>
<div class="line"><a name="l05095"></a><span class="lineno"> 5095</span>&#160; VmaListItem&lt;T&gt;* m_pItem;</div>
<div class="line"><a name="l05096"></a><span class="lineno"> 5096</span>&#160; </div>
<div class="line"><a name="l05097"></a><span class="lineno"> 5097</span>&#160; iterator(VmaRawList&lt;T&gt;* pList, VmaListItem&lt;T&gt;* pItem) :</div>
<div class="line"><a name="l05098"></a><span class="lineno"> 5098</span>&#160; m_pList(pList),</div>
<div class="line"><a name="l05099"></a><span class="lineno"> 5099</span>&#160; m_pItem(pItem)</div>
<div class="line"><a name="l05100"></a><span class="lineno"> 5100</span>&#160; {</div>
<div class="line"><a name="l05101"></a><span class="lineno"> 5101</span>&#160; }</div>
<div class="line"><a name="l05102"></a><span class="lineno"> 5102</span>&#160; </div>
<div class="line"><a name="l05103"></a><span class="lineno"> 5103</span>&#160; <span class="keyword">friend</span> <span class="keyword">class </span>VmaList&lt;T, AllocatorT&gt;;</div>
<div class="line"><a name="l05104"></a><span class="lineno"> 5104</span>&#160; };</div>
<div class="line"><a name="l05105"></a><span class="lineno"> 5105</span>&#160; </div>
<div class="line"><a name="l05106"></a><span class="lineno"> 5106</span>&#160; <span class="keyword">class </span>const_iterator</div>
<div class="line"><a name="l05107"></a><span class="lineno"> 5107</span>&#160; {</div>
<div class="line"><a name="l05108"></a><span class="lineno"> 5108</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l05109"></a><span class="lineno"> 5109</span>&#160; const_iterator() :</div>
<div class="line"><a name="l05110"></a><span class="lineno"> 5110</span>&#160; m_pList(VMA_NULL),</div>
<div class="line"><a name="l05111"></a><span class="lineno"> 5111</span>&#160; m_pItem(VMA_NULL)</div>
<div class="line"><a name="l05112"></a><span class="lineno"> 5112</span>&#160; {</div>
<div class="line"><a name="l05113"></a><span class="lineno"> 5113</span>&#160; }</div>
<div class="line"><a name="l05114"></a><span class="lineno"> 5114</span>&#160; </div>
<div class="line"><a name="l05115"></a><span class="lineno"> 5115</span>&#160; const_iterator(<span class="keyword">const</span> iterator&amp; src) :</div>
<div class="line"><a name="l05116"></a><span class="lineno"> 5116</span>&#160; m_pList(src.m_pList),</div>
<div class="line"><a name="l05117"></a><span class="lineno"> 5117</span>&#160; m_pItem(src.m_pItem)</div>
<div class="line"><a name="l05118"></a><span class="lineno"> 5118</span>&#160; {</div>
<div class="line"><a name="l05119"></a><span class="lineno"> 5119</span>&#160; }</div>
<div class="line"><a name="l05120"></a><span class="lineno"> 5120</span>&#160; </div>
<div class="line"><a name="l05121"></a><span class="lineno"> 5121</span>&#160; <span class="keyword">const</span> T&amp; operator*()<span class="keyword"> const</span></div>
<div class="line"><a name="l05122"></a><span class="lineno"> 5122</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05123"></a><span class="lineno"> 5123</span>&#160; VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
<div class="line"><a name="l05124"></a><span class="lineno"> 5124</span>&#160; <span class="keywordflow">return</span> m_pItem-&gt;Value;</div>
<div class="line"><a name="l05125"></a><span class="lineno"> 5125</span>&#160; }</div>
<div class="line"><a name="l05126"></a><span class="lineno"> 5126</span>&#160; <span class="keyword">const</span> T* operator-&gt;()<span class="keyword"> const</span></div>
<div class="line"><a name="l05127"></a><span class="lineno"> 5127</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05128"></a><span class="lineno"> 5128</span>&#160; VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
<div class="line"><a name="l05129"></a><span class="lineno"> 5129</span>&#160; <span class="keywordflow">return</span> &amp;m_pItem-&gt;Value;</div>
<div class="line"><a name="l05130"></a><span class="lineno"> 5130</span>&#160; }</div>
<div class="line"><a name="l05131"></a><span class="lineno"> 5131</span>&#160; </div>
<div class="line"><a name="l05132"></a><span class="lineno"> 5132</span>&#160; const_iterator&amp; operator++()</div>
<div class="line"><a name="l05133"></a><span class="lineno"> 5133</span>&#160; {</div>
<div class="line"><a name="l05134"></a><span class="lineno"> 5134</span>&#160; VMA_HEAVY_ASSERT(m_pItem != VMA_NULL);</div>
<div class="line"><a name="l05135"></a><span class="lineno"> 5135</span>&#160; m_pItem = m_pItem-&gt;pNext;</div>
<div class="line"><a name="l05136"></a><span class="lineno"> 5136</span>&#160; <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l05137"></a><span class="lineno"> 5137</span>&#160; }</div>
<div class="line"><a name="l05138"></a><span class="lineno"> 5138</span>&#160; const_iterator&amp; operator--()</div>
<div class="line"><a name="l05139"></a><span class="lineno"> 5139</span>&#160; {</div>
<div class="line"><a name="l05140"></a><span class="lineno"> 5140</span>&#160; <span class="keywordflow">if</span>(m_pItem != VMA_NULL)</div>
<div class="line"><a name="l05141"></a><span class="lineno"> 5141</span>&#160; {</div>
<div class="line"><a name="l05142"></a><span class="lineno"> 5142</span>&#160; m_pItem = m_pItem-&gt;pPrev;</div>
<div class="line"><a name="l05143"></a><span class="lineno"> 5143</span>&#160; }</div>
<div class="line"><a name="l05144"></a><span class="lineno"> 5144</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l05145"></a><span class="lineno"> 5145</span>&#160; {</div>
<div class="line"><a name="l05146"></a><span class="lineno"> 5146</span>&#160; VMA_HEAVY_ASSERT(!m_pList-&gt;IsEmpty());</div>
<div class="line"><a name="l05147"></a><span class="lineno"> 5147</span>&#160; m_pItem = m_pList-&gt;Back();</div>
<div class="line"><a name="l05148"></a><span class="lineno"> 5148</span>&#160; }</div>
<div class="line"><a name="l05149"></a><span class="lineno"> 5149</span>&#160; <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l05150"></a><span class="lineno"> 5150</span>&#160; }</div>
<div class="line"><a name="l05151"></a><span class="lineno"> 5151</span>&#160; </div>
<div class="line"><a name="l05152"></a><span class="lineno"> 5152</span>&#160; const_iterator operator++(<span class="keywordtype">int</span>)</div>
<div class="line"><a name="l05153"></a><span class="lineno"> 5153</span>&#160; {</div>
<div class="line"><a name="l05154"></a><span class="lineno"> 5154</span>&#160; const_iterator result = *<span class="keyword">this</span>;</div>
<div class="line"><a name="l05155"></a><span class="lineno"> 5155</span>&#160; ++*<span class="keyword">this</span>;</div>
<div class="line"><a name="l05156"></a><span class="lineno"> 5156</span>&#160; <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l05157"></a><span class="lineno"> 5157</span>&#160; }</div>
<div class="line"><a name="l05158"></a><span class="lineno"> 5158</span>&#160; const_iterator operator--(<span class="keywordtype">int</span>)</div>
<div class="line"><a name="l05159"></a><span class="lineno"> 5159</span>&#160; {</div>
<div class="line"><a name="l05160"></a><span class="lineno"> 5160</span>&#160; const_iterator result = *<span class="keyword">this</span>;</div>
<div class="line"><a name="l05161"></a><span class="lineno"> 5161</span>&#160; --*<span class="keyword">this</span>;</div>
<div class="line"><a name="l05162"></a><span class="lineno"> 5162</span>&#160; <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l05163"></a><span class="lineno"> 5163</span>&#160; }</div>
<div class="line"><a name="l05164"></a><span class="lineno"> 5164</span>&#160; </div>
<div class="line"><a name="l05165"></a><span class="lineno"> 5165</span>&#160; <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> const_iterator&amp; rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l05166"></a><span class="lineno"> 5166</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05167"></a><span class="lineno"> 5167</span>&#160; VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
<div class="line"><a name="l05168"></a><span class="lineno"> 5168</span>&#160; <span class="keywordflow">return</span> m_pItem == rhs.m_pItem;</div>
<div class="line"><a name="l05169"></a><span class="lineno"> 5169</span>&#160; }</div>
<div class="line"><a name="l05170"></a><span class="lineno"> 5170</span>&#160; <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> const_iterator&amp; rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l05171"></a><span class="lineno"> 5171</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05172"></a><span class="lineno"> 5172</span>&#160; VMA_HEAVY_ASSERT(m_pList == rhs.m_pList);</div>
<div class="line"><a name="l05173"></a><span class="lineno"> 5173</span>&#160; <span class="keywordflow">return</span> m_pItem != rhs.m_pItem;</div>
<div class="line"><a name="l05174"></a><span class="lineno"> 5174</span>&#160; }</div>
<div class="line"><a name="l05175"></a><span class="lineno"> 5175</span>&#160; </div>
<div class="line"><a name="l05176"></a><span class="lineno"> 5176</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l05177"></a><span class="lineno"> 5177</span>&#160; const_iterator(<span class="keyword">const</span> VmaRawList&lt;T&gt;* pList, <span class="keyword">const</span> VmaListItem&lt;T&gt;* pItem) :</div>
<div class="line"><a name="l05178"></a><span class="lineno"> 5178</span>&#160; m_pList(pList),</div>
<div class="line"><a name="l05179"></a><span class="lineno"> 5179</span>&#160; m_pItem(pItem)</div>
<div class="line"><a name="l05180"></a><span class="lineno"> 5180</span>&#160; {</div>
<div class="line"><a name="l05181"></a><span class="lineno"> 5181</span>&#160; }</div>
<div class="line"><a name="l05182"></a><span class="lineno"> 5182</span>&#160; </div>
<div class="line"><a name="l05183"></a><span class="lineno"> 5183</span>&#160; <span class="keyword">const</span> VmaRawList&lt;T&gt;* m_pList;</div>
<div class="line"><a name="l05184"></a><span class="lineno"> 5184</span>&#160; <span class="keyword">const</span> VmaListItem&lt;T&gt;* m_pItem;</div>
<div class="line"><a name="l05185"></a><span class="lineno"> 5185</span>&#160; </div>
<div class="line"><a name="l05186"></a><span class="lineno"> 5186</span>&#160; <span class="keyword">friend</span> <span class="keyword">class </span>VmaList&lt;T, AllocatorT&gt;;</div>
<div class="line"><a name="l05187"></a><span class="lineno"> 5187</span>&#160; };</div>
<div class="line"><a name="l05188"></a><span class="lineno"> 5188</span>&#160; </div>
<div class="line"><a name="l05189"></a><span class="lineno"> 5189</span>&#160; VmaList(<span class="keyword">const</span> AllocatorT&amp; allocator) : m_RawList(allocator.m_pCallbacks) { }</div>
<div class="line"><a name="l05190"></a><span class="lineno"> 5190</span>&#160; </div>
<div class="line"><a name="l05191"></a><span class="lineno"> 5191</span>&#160; <span class="keywordtype">bool</span> empty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_RawList.IsEmpty(); }</div>
<div class="line"><a name="l05192"></a><span class="lineno"> 5192</span>&#160; <span class="keywordtype">size_t</span> size()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_RawList.GetCount(); }</div>
<div class="line"><a name="l05193"></a><span class="lineno"> 5193</span>&#160; </div>
<div class="line"><a name="l05194"></a><span class="lineno"> 5194</span>&#160; iterator begin() { <span class="keywordflow">return</span> iterator(&amp;m_RawList, m_RawList.Front()); }</div>
<div class="line"><a name="l05195"></a><span class="lineno"> 5195</span>&#160; iterator end() { <span class="keywordflow">return</span> iterator(&amp;m_RawList, VMA_NULL); }</div>
<div class="line"><a name="l05196"></a><span class="lineno"> 5196</span>&#160; </div>
<div class="line"><a name="l05197"></a><span class="lineno"> 5197</span>&#160; const_iterator cbegin()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> const_iterator(&amp;m_RawList, m_RawList.Front()); }</div>
<div class="line"><a name="l05198"></a><span class="lineno"> 5198</span>&#160; const_iterator cend()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> const_iterator(&amp;m_RawList, VMA_NULL); }</div>
<div class="line"><a name="l05199"></a><span class="lineno"> 5199</span>&#160; </div>
<div class="line"><a name="l05200"></a><span class="lineno"> 5200</span>&#160; <span class="keywordtype">void</span> clear() { m_RawList.Clear(); }</div>
<div class="line"><a name="l05201"></a><span class="lineno"> 5201</span>&#160; <span class="keywordtype">void</span> push_back(<span class="keyword">const</span> T&amp; value) { m_RawList.PushBack(value); }</div>
<div class="line"><a name="l05202"></a><span class="lineno"> 5202</span>&#160; <span class="keywordtype">void</span> erase(iterator it) { m_RawList.Remove(it.m_pItem); }</div>
<div class="line"><a name="l05203"></a><span class="lineno"> 5203</span>&#160; iterator insert(iterator it, <span class="keyword">const</span> T&amp; value) { <span class="keywordflow">return</span> iterator(&amp;m_RawList, m_RawList.InsertBefore(it.m_pItem, value)); }</div>
<div class="line"><a name="l05204"></a><span class="lineno"> 5204</span>&#160; </div>
<div class="line"><a name="l05205"></a><span class="lineno"> 5205</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l05206"></a><span class="lineno"> 5206</span>&#160; VmaRawList&lt;T&gt; m_RawList;</div>
<div class="line"><a name="l05207"></a><span class="lineno"> 5207</span>&#160;};</div>
<div class="line"><a name="l05208"></a><span class="lineno"> 5208</span>&#160; </div>
<div class="line"><a name="l05209"></a><span class="lineno"> 5209</span>&#160;<span class="preprocessor">#endif // #if VMA_USE_STL_LIST</span></div>
<div class="line"><a name="l05210"></a><span class="lineno"> 5210</span>&#160; </div>
<div class="line"><a name="l05212"></a><span class="lineno"> 5212</span>&#160;<span class="comment">// class VmaMap</span></div>
<div class="line"><a name="l05213"></a><span class="lineno"> 5213</span>&#160; </div>
<div class="line"><a name="l05214"></a><span class="lineno"> 5214</span>&#160;<span class="comment">// Unused in this version.</span></div>
<div class="line"><a name="l05215"></a><span class="lineno"> 5215</span>&#160;<span class="preprocessor">#if 0</span></div>
<div class="line"><a name="l05216"></a><span class="lineno"> 5216</span>&#160; </div>
<div class="line"><a name="l05217"></a><span class="lineno"> 5217</span>&#160;<span class="preprocessor">#if VMA_USE_STL_UNORDERED_MAP</span></div>
<div class="line"><a name="l05218"></a><span class="lineno"> 5218</span>&#160; </div>
<div class="line"><a name="l05219"></a><span class="lineno"> 5219</span>&#160;<span class="preprocessor">#define VmaPair std::pair</span></div>
<div class="line"><a name="l05220"></a><span class="lineno"> 5220</span>&#160; </div>
<div class="line"><a name="l05221"></a><span class="lineno"> 5221</span>&#160;<span class="preprocessor">#define VMA_MAP_TYPE(KeyT, ValueT) \</span></div>
<div class="line"><a name="l05222"></a><span class="lineno"> 5222</span>&#160;<span class="preprocessor"> std::unordered_map&lt; KeyT, ValueT, std::hash&lt;KeyT&gt;, std::equal_to&lt;KeyT&gt;, VmaStlAllocator&lt; std::pair&lt;KeyT, ValueT&gt; &gt; &gt;</span></div>
<div class="line"><a name="l05223"></a><span class="lineno"> 5223</span>&#160; </div>
<div class="line"><a name="l05224"></a><span class="lineno"> 5224</span>&#160;<span class="preprocessor">#else // #if VMA_USE_STL_UNORDERED_MAP</span></div>
<div class="line"><a name="l05225"></a><span class="lineno"> 5225</span>&#160; </div>
<div class="line"><a name="l05226"></a><span class="lineno"> 5226</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T1, <span class="keyword">typename</span> T2&gt;</div>
<div class="line"><a name="l05227"></a><span class="lineno"> 5227</span>&#160;<span class="keyword">struct </span>VmaPair</div>
<div class="line"><a name="l05228"></a><span class="lineno"> 5228</span>&#160;{</div>
<div class="line"><a name="l05229"></a><span class="lineno"> 5229</span>&#160; T1 first;</div>
<div class="line"><a name="l05230"></a><span class="lineno"> 5230</span>&#160; T2 second;</div>
<div class="line"><a name="l05231"></a><span class="lineno"> 5231</span>&#160; </div>
<div class="line"><a name="l05232"></a><span class="lineno"> 5232</span>&#160; VmaPair() : first(), second() { }</div>
<div class="line"><a name="l05233"></a><span class="lineno"> 5233</span>&#160; VmaPair(<span class="keyword">const</span> T1&amp; firstSrc, <span class="keyword">const</span> T2&amp; secondSrc) : first(firstSrc), second(secondSrc) { }</div>
<div class="line"><a name="l05234"></a><span class="lineno"> 5234</span>&#160;};</div>
<div class="line"><a name="l05235"></a><span class="lineno"> 5235</span>&#160; </div>
<div class="line"><a name="l05236"></a><span class="lineno"> 5236</span>&#160;<span class="comment">/* Class compatible with subset of interface of std::unordered_map.</span></div>
<div class="line"><a name="l05237"></a><span class="lineno"> 5237</span>&#160;<span class="comment">KeyT, ValueT must be POD because they will be stored in VmaVector.</span></div>
<div class="line"><a name="l05238"></a><span class="lineno"> 5238</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l05239"></a><span class="lineno"> 5239</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
<div class="line"><a name="l05240"></a><span class="lineno"> 5240</span>&#160;<span class="keyword">class </span>VmaMap</div>
<div class="line"><a name="l05241"></a><span class="lineno"> 5241</span>&#160;{</div>
<div class="line"><a name="l05242"></a><span class="lineno"> 5242</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l05243"></a><span class="lineno"> 5243</span>&#160; <span class="keyword">typedef</span> VmaPair&lt;KeyT, ValueT&gt; PairType;</div>
<div class="line"><a name="l05244"></a><span class="lineno"> 5244</span>&#160; <span class="keyword">typedef</span> PairType* iterator;</div>
<div class="line"><a name="l05245"></a><span class="lineno"> 5245</span>&#160; </div>
<div class="line"><a name="l05246"></a><span class="lineno"> 5246</span>&#160; VmaMap(<span class="keyword">const</span> VmaStlAllocator&lt;PairType&gt;&amp; allocator) : m_Vector(allocator) { }</div>
<div class="line"><a name="l05247"></a><span class="lineno"> 5247</span>&#160; </div>
<div class="line"><a name="l05248"></a><span class="lineno"> 5248</span>&#160; iterator begin() { <span class="keywordflow">return</span> m_Vector.begin(); }</div>
<div class="line"><a name="l05249"></a><span class="lineno"> 5249</span>&#160; iterator end() { <span class="keywordflow">return</span> m_Vector.end(); }</div>
<div class="line"><a name="l05250"></a><span class="lineno"> 5250</span>&#160; </div>
<div class="line"><a name="l05251"></a><span class="lineno"> 5251</span>&#160; <span class="keywordtype">void</span> insert(<span class="keyword">const</span> PairType&amp; pair);</div>
<div class="line"><a name="l05252"></a><span class="lineno"> 5252</span>&#160; iterator find(<span class="keyword">const</span> KeyT&amp; key);</div>
<div class="line"><a name="l05253"></a><span class="lineno"> 5253</span>&#160; <span class="keywordtype">void</span> erase(iterator it);</div>
<div class="line"><a name="l05254"></a><span class="lineno"> 5254</span>&#160; </div>
<div class="line"><a name="l05255"></a><span class="lineno"> 5255</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l05256"></a><span class="lineno"> 5256</span>&#160; VmaVector&lt; PairType, VmaStlAllocator&lt;PairType&gt; &gt; m_Vector;</div>
<div class="line"><a name="l05257"></a><span class="lineno"> 5257</span>&#160;};</div>
<div class="line"><a name="l05258"></a><span class="lineno"> 5258</span>&#160; </div>
<div class="line"><a name="l05259"></a><span class="lineno"> 5259</span>&#160;<span class="preprocessor">#define VMA_MAP_TYPE(KeyT, ValueT) VmaMap&lt;KeyT, ValueT&gt;</span></div>
<div class="line"><a name="l05260"></a><span class="lineno"> 5260</span>&#160; </div>
<div class="line"><a name="l05261"></a><span class="lineno"> 5261</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> FirstT, <span class="keyword">typename</span> SecondT&gt;</div>
<div class="line"><a name="l05262"></a><span class="lineno"> 5262</span>&#160;<span class="keyword">struct </span>VmaPairFirstLess</div>
<div class="line"><a name="l05263"></a><span class="lineno"> 5263</span>&#160;{</div>
<div class="line"><a name="l05264"></a><span class="lineno"> 5264</span>&#160; <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaPair&lt;FirstT, SecondT&gt;&amp; lhs, <span class="keyword">const</span> VmaPair&lt;FirstT, SecondT&gt;&amp; rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l05265"></a><span class="lineno"> 5265</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05266"></a><span class="lineno"> 5266</span>&#160; <span class="keywordflow">return</span> lhs.first &lt; rhs.first;</div>
<div class="line"><a name="l05267"></a><span class="lineno"> 5267</span>&#160; }</div>
<div class="line"><a name="l05268"></a><span class="lineno"> 5268</span>&#160; <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaPair&lt;FirstT, SecondT&gt;&amp; lhs, <span class="keyword">const</span> FirstT&amp; rhsFirst)<span class="keyword"> const</span></div>
<div class="line"><a name="l05269"></a><span class="lineno"> 5269</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05270"></a><span class="lineno"> 5270</span>&#160; <span class="keywordflow">return</span> lhs.first &lt; rhsFirst;</div>
<div class="line"><a name="l05271"></a><span class="lineno"> 5271</span>&#160; }</div>
<div class="line"><a name="l05272"></a><span class="lineno"> 5272</span>&#160;};</div>
<div class="line"><a name="l05273"></a><span class="lineno"> 5273</span>&#160; </div>
<div class="line"><a name="l05274"></a><span class="lineno"> 5274</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
<div class="line"><a name="l05275"></a><span class="lineno"> 5275</span>&#160;<span class="keywordtype">void</span> VmaMap&lt;KeyT, ValueT&gt;::insert(<span class="keyword">const</span> PairType&amp; pair)</div>
<div class="line"><a name="l05276"></a><span class="lineno"> 5276</span>&#160;{</div>
<div class="line"><a name="l05277"></a><span class="lineno"> 5277</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> indexToInsert = VmaBinaryFindFirstNotLess(</div>
<div class="line"><a name="l05278"></a><span class="lineno"> 5278</span>&#160; m_Vector.data(),</div>
<div class="line"><a name="l05279"></a><span class="lineno"> 5279</span>&#160; m_Vector.data() + m_Vector.size(),</div>
<div class="line"><a name="l05280"></a><span class="lineno"> 5280</span>&#160; pair,</div>
<div class="line"><a name="l05281"></a><span class="lineno"> 5281</span>&#160; VmaPairFirstLess&lt;KeyT, ValueT&gt;()) - m_Vector.data();</div>
<div class="line"><a name="l05282"></a><span class="lineno"> 5282</span>&#160; VmaVectorInsert(m_Vector, indexToInsert, pair);</div>
<div class="line"><a name="l05283"></a><span class="lineno"> 5283</span>&#160;}</div>
<div class="line"><a name="l05284"></a><span class="lineno"> 5284</span>&#160; </div>
<div class="line"><a name="l05285"></a><span class="lineno"> 5285</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
<div class="line"><a name="l05286"></a><span class="lineno"> 5286</span>&#160;VmaPair&lt;KeyT, ValueT&gt;* VmaMap&lt;KeyT, ValueT&gt;::find(<span class="keyword">const</span> KeyT&amp; key)</div>
<div class="line"><a name="l05287"></a><span class="lineno"> 5287</span>&#160;{</div>
<div class="line"><a name="l05288"></a><span class="lineno"> 5288</span>&#160; PairType* it = VmaBinaryFindFirstNotLess(</div>
<div class="line"><a name="l05289"></a><span class="lineno"> 5289</span>&#160; m_Vector.data(),</div>
<div class="line"><a name="l05290"></a><span class="lineno"> 5290</span>&#160; m_Vector.data() + m_Vector.size(),</div>
<div class="line"><a name="l05291"></a><span class="lineno"> 5291</span>&#160; key,</div>
<div class="line"><a name="l05292"></a><span class="lineno"> 5292</span>&#160; VmaPairFirstLess&lt;KeyT, ValueT&gt;());</div>
<div class="line"><a name="l05293"></a><span class="lineno"> 5293</span>&#160; <span class="keywordflow">if</span>((it != m_Vector.end()) &amp;&amp; (it-&gt;first == key))</div>
<div class="line"><a name="l05294"></a><span class="lineno"> 5294</span>&#160; {</div>
<div class="line"><a name="l05295"></a><span class="lineno"> 5295</span>&#160; <span class="keywordflow">return</span> it;</div>
<div class="line"><a name="l05296"></a><span class="lineno"> 5296</span>&#160; }</div>
<div class="line"><a name="l05297"></a><span class="lineno"> 5297</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l05298"></a><span class="lineno"> 5298</span>&#160; {</div>
<div class="line"><a name="l05299"></a><span class="lineno"> 5299</span>&#160; <span class="keywordflow">return</span> m_Vector.end();</div>
<div class="line"><a name="l05300"></a><span class="lineno"> 5300</span>&#160; }</div>
<div class="line"><a name="l05301"></a><span class="lineno"> 5301</span>&#160;}</div>
<div class="line"><a name="l05302"></a><span class="lineno"> 5302</span>&#160; </div>
<div class="line"><a name="l05303"></a><span class="lineno"> 5303</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> KeyT, <span class="keyword">typename</span> ValueT&gt;</div>
<div class="line"><a name="l05304"></a><span class="lineno"> 5304</span>&#160;<span class="keywordtype">void</span> VmaMap&lt;KeyT, ValueT&gt;::erase(iterator it)</div>
<div class="line"><a name="l05305"></a><span class="lineno"> 5305</span>&#160;{</div>
<div class="line"><a name="l05306"></a><span class="lineno"> 5306</span>&#160; VmaVectorRemove(m_Vector, it - m_Vector.begin());</div>
<div class="line"><a name="l05307"></a><span class="lineno"> 5307</span>&#160;}</div>
<div class="line"><a name="l05308"></a><span class="lineno"> 5308</span>&#160; </div>
<div class="line"><a name="l05309"></a><span class="lineno"> 5309</span>&#160;<span class="preprocessor">#endif // #if VMA_USE_STL_UNORDERED_MAP</span></div>
<div class="line"><a name="l05310"></a><span class="lineno"> 5310</span>&#160; </div>
<div class="line"><a name="l05311"></a><span class="lineno"> 5311</span>&#160;<span class="preprocessor">#endif // #if 0</span></div>
<div class="line"><a name="l05312"></a><span class="lineno"> 5312</span>&#160; </div>
<div class="line"><a name="l05314"></a><span class="lineno"> 5314</span>&#160; </div>
<div class="line"><a name="l05315"></a><span class="lineno"> 5315</span>&#160;<span class="keyword">class </span>VmaDeviceMemoryBlock;</div>
<div class="line"><a name="l05316"></a><span class="lineno"> 5316</span>&#160; </div>
<div class="line"><a name="l05317"></a><span class="lineno"> 5317</span>&#160;<span class="keyword">enum</span> VMA_CACHE_OPERATION { VMA_CACHE_FLUSH, VMA_CACHE_INVALIDATE };</div>
<div class="line"><a name="l05318"></a><span class="lineno"> 5318</span>&#160; </div>
<div class="line"><a name="l05319"></a><span class="lineno"> 5319</span>&#160;<span class="keyword">struct </span>VmaAllocation_T</div>
<div class="line"><a name="l05320"></a><span class="lineno"> 5320</span>&#160;{</div>
<div class="line"><a name="l05321"></a><span class="lineno"> 5321</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l05322"></a><span class="lineno"> 5322</span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> uint8_t MAP_COUNT_FLAG_PERSISTENT_MAP = 0x80;</div>
<div class="line"><a name="l05323"></a><span class="lineno"> 5323</span>&#160; </div>
<div class="line"><a name="l05324"></a><span class="lineno"> 5324</span>&#160; <span class="keyword">enum</span> FLAGS</div>
<div class="line"><a name="l05325"></a><span class="lineno"> 5325</span>&#160; {</div>
<div class="line"><a name="l05326"></a><span class="lineno"> 5326</span>&#160; FLAG_USER_DATA_STRING = 0x01,</div>
<div class="line"><a name="l05327"></a><span class="lineno"> 5327</span>&#160; };</div>
<div class="line"><a name="l05328"></a><span class="lineno"> 5328</span>&#160; </div>
<div class="line"><a name="l05329"></a><span class="lineno"> 5329</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l05330"></a><span class="lineno"> 5330</span>&#160; <span class="keyword">enum</span> ALLOCATION_TYPE</div>
<div class="line"><a name="l05331"></a><span class="lineno"> 5331</span>&#160; {</div>
<div class="line"><a name="l05332"></a><span class="lineno"> 5332</span>&#160; ALLOCATION_TYPE_NONE,</div>
<div class="line"><a name="l05333"></a><span class="lineno"> 5333</span>&#160; ALLOCATION_TYPE_BLOCK,</div>
<div class="line"><a name="l05334"></a><span class="lineno"> 5334</span>&#160; ALLOCATION_TYPE_DEDICATED,</div>
<div class="line"><a name="l05335"></a><span class="lineno"> 5335</span>&#160; };</div>
<div class="line"><a name="l05336"></a><span class="lineno"> 5336</span>&#160; </div>
<div class="line"><a name="l05337"></a><span class="lineno"> 5337</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l05338"></a><span class="lineno"> 5338</span>&#160;<span class="comment"> This struct is allocated using VmaPoolAllocator.</span></div>
<div class="line"><a name="l05339"></a><span class="lineno"> 5339</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l05340"></a><span class="lineno"> 5340</span>&#160; </div>
<div class="line"><a name="l05341"></a><span class="lineno"> 5341</span>&#160; <span class="keywordtype">void</span> Ctor(uint32_t currentFrameIndex, <span class="keywordtype">bool</span> userDataString)</div>
<div class="line"><a name="l05342"></a><span class="lineno"> 5342</span>&#160; {</div>
<div class="line"><a name="l05343"></a><span class="lineno"> 5343</span>&#160; m_Alignment = 1;</div>
<div class="line"><a name="l05344"></a><span class="lineno"> 5344</span>&#160; m_Size = 0;</div>
<div class="line"><a name="l05345"></a><span class="lineno"> 5345</span>&#160; m_MemoryTypeIndex = 0;</div>
<div class="line"><a name="l05346"></a><span class="lineno"> 5346</span>&#160; m_pUserData = VMA_NULL;</div>
<div class="line"><a name="l05347"></a><span class="lineno"> 5347</span>&#160; m_LastUseFrameIndex = currentFrameIndex;</div>
<div class="line"><a name="l05348"></a><span class="lineno"> 5348</span>&#160; m_Type = (uint8_t)ALLOCATION_TYPE_NONE;</div>
<div class="line"><a name="l05349"></a><span class="lineno"> 5349</span>&#160; m_SuballocationType = (uint8_t)VMA_SUBALLOCATION_TYPE_UNKNOWN;</div>
<div class="line"><a name="l05350"></a><span class="lineno"> 5350</span>&#160; m_MapCount = 0;</div>
<div class="line"><a name="l05351"></a><span class="lineno"> 5351</span>&#160; m_Flags = userDataString ? (uint8_t)FLAG_USER_DATA_STRING : 0;</div>
<div class="line"><a name="l05352"></a><span class="lineno"> 5352</span>&#160; </div>
<div class="line"><a name="l05353"></a><span class="lineno"> 5353</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l05354"></a><span class="lineno"> 5354</span>&#160; m_CreationFrameIndex = currentFrameIndex;</div>
<div class="line"><a name="l05355"></a><span class="lineno"> 5355</span>&#160; m_BufferImageUsage = 0;</div>
<div class="line"><a name="l05356"></a><span class="lineno"> 5356</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l05357"></a><span class="lineno"> 5357</span>&#160; }</div>
<div class="line"><a name="l05358"></a><span class="lineno"> 5358</span>&#160; </div>
<div class="line"><a name="l05359"></a><span class="lineno"> 5359</span>&#160; <span class="keywordtype">void</span> Dtor()</div>
<div class="line"><a name="l05360"></a><span class="lineno"> 5360</span>&#160; {</div>
<div class="line"><a name="l05361"></a><span class="lineno"> 5361</span>&#160; VMA_ASSERT((m_MapCount &amp; ~MAP_COUNT_FLAG_PERSISTENT_MAP) == 0 &amp;&amp; <span class="stringliteral">&quot;Allocation was not unmapped before destruction.&quot;</span>);</div>
<div class="line"><a name="l05362"></a><span class="lineno"> 5362</span>&#160; </div>
<div class="line"><a name="l05363"></a><span class="lineno"> 5363</span>&#160; <span class="comment">// Check if owned string was freed.</span></div>
<div class="line"><a name="l05364"></a><span class="lineno"> 5364</span>&#160; VMA_ASSERT(m_pUserData == VMA_NULL);</div>
<div class="line"><a name="l05365"></a><span class="lineno"> 5365</span>&#160; }</div>
<div class="line"><a name="l05366"></a><span class="lineno"> 5366</span>&#160; </div>
<div class="line"><a name="l05367"></a><span class="lineno"> 5367</span>&#160; <span class="keywordtype">void</span> InitBlockAllocation(</div>
<div class="line"><a name="l05368"></a><span class="lineno"> 5368</span>&#160; VmaDeviceMemoryBlock* block,</div>
<div class="line"><a name="l05369"></a><span class="lineno"> 5369</span>&#160; VkDeviceSize offset,</div>
<div class="line"><a name="l05370"></a><span class="lineno"> 5370</span>&#160; VkDeviceSize alignment,</div>
<div class="line"><a name="l05371"></a><span class="lineno"> 5371</span>&#160; VkDeviceSize size,</div>
<div class="line"><a name="l05372"></a><span class="lineno"> 5372</span>&#160; uint32_t memoryTypeIndex,</div>
<div class="line"><a name="l05373"></a><span class="lineno"> 5373</span>&#160; VmaSuballocationType suballocationType,</div>
<div class="line"><a name="l05374"></a><span class="lineno"> 5374</span>&#160; <span class="keywordtype">bool</span> mapped,</div>
<div class="line"><a name="l05375"></a><span class="lineno"> 5375</span>&#160; <span class="keywordtype">bool</span> canBecomeLost)</div>
<div class="line"><a name="l05376"></a><span class="lineno"> 5376</span>&#160; {</div>
<div class="line"><a name="l05377"></a><span class="lineno"> 5377</span>&#160; VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);</div>
<div class="line"><a name="l05378"></a><span class="lineno"> 5378</span>&#160; VMA_ASSERT(block != VMA_NULL);</div>
<div class="line"><a name="l05379"></a><span class="lineno"> 5379</span>&#160; m_Type = (uint8_t)ALLOCATION_TYPE_BLOCK;</div>
<div class="line"><a name="l05380"></a><span class="lineno"> 5380</span>&#160; m_Alignment = alignment;</div>
<div class="line"><a name="l05381"></a><span class="lineno"> 5381</span>&#160; m_Size = size;</div>
<div class="line"><a name="l05382"></a><span class="lineno"> 5382</span>&#160; m_MemoryTypeIndex = memoryTypeIndex;</div>
<div class="line"><a name="l05383"></a><span class="lineno"> 5383</span>&#160; m_MapCount = mapped ? MAP_COUNT_FLAG_PERSISTENT_MAP : 0;</div>
<div class="line"><a name="l05384"></a><span class="lineno"> 5384</span>&#160; m_SuballocationType = (uint8_t)suballocationType;</div>
<div class="line"><a name="l05385"></a><span class="lineno"> 5385</span>&#160; m_BlockAllocation.m_Block = block;</div>
<div class="line"><a name="l05386"></a><span class="lineno"> 5386</span>&#160; m_BlockAllocation.m_Offset = offset;</div>
<div class="line"><a name="l05387"></a><span class="lineno"> 5387</span>&#160; m_BlockAllocation.m_CanBecomeLost = canBecomeLost;</div>
<div class="line"><a name="l05388"></a><span class="lineno"> 5388</span>&#160; }</div>
<div class="line"><a name="l05389"></a><span class="lineno"> 5389</span>&#160; </div>
<div class="line"><a name="l05390"></a><span class="lineno"> 5390</span>&#160; <span class="keywordtype">void</span> InitLost()</div>
<div class="line"><a name="l05391"></a><span class="lineno"> 5391</span>&#160; {</div>
<div class="line"><a name="l05392"></a><span class="lineno"> 5392</span>&#160; VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);</div>
<div class="line"><a name="l05393"></a><span class="lineno"> 5393</span>&#160; VMA_ASSERT(m_LastUseFrameIndex.load() == VMA_FRAME_INDEX_LOST);</div>
<div class="line"><a name="l05394"></a><span class="lineno"> 5394</span>&#160; m_Type = (uint8_t)ALLOCATION_TYPE_BLOCK;</div>
<div class="line"><a name="l05395"></a><span class="lineno"> 5395</span>&#160; m_MemoryTypeIndex = 0;</div>
<div class="line"><a name="l05396"></a><span class="lineno"> 5396</span>&#160; m_BlockAllocation.m_Block = VMA_NULL;</div>
<div class="line"><a name="l05397"></a><span class="lineno"> 5397</span>&#160; m_BlockAllocation.m_Offset = 0;</div>
<div class="line"><a name="l05398"></a><span class="lineno"> 5398</span>&#160; m_BlockAllocation.m_CanBecomeLost = <span class="keyword">true</span>;</div>
<div class="line"><a name="l05399"></a><span class="lineno"> 5399</span>&#160; }</div>
<div class="line"><a name="l05400"></a><span class="lineno"> 5400</span>&#160; </div>
<div class="line"><a name="l05401"></a><span class="lineno"> 5401</span>&#160; <span class="keywordtype">void</span> ChangeBlockAllocation(</div>
<div class="line"><a name="l05402"></a><span class="lineno"> 5402</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
<div class="line"><a name="l05403"></a><span class="lineno"> 5403</span>&#160; VmaDeviceMemoryBlock* block,</div>
<div class="line"><a name="l05404"></a><span class="lineno"> 5404</span>&#160; VkDeviceSize offset); </div>
<div class="line"><a name="l05405"></a><span class="lineno"> 5405</span>&#160; </div>
<div class="line"><a name="l05406"></a><span class="lineno"> 5406</span>&#160; <span class="keywordtype">void</span> ChangeOffset(VkDeviceSize newOffset);</div>
<div class="line"><a name="l05407"></a><span class="lineno"> 5407</span>&#160; </div>
<div class="line"><a name="l05408"></a><span class="lineno"> 5408</span>&#160; <span class="comment">// pMappedData not null means allocation is created with MAPPED flag.</span></div>
<div class="line"><a name="l05409"></a><span class="lineno"> 5409</span>&#160; <span class="keywordtype">void</span> InitDedicatedAllocation(</div>
<div class="line"><a name="l05410"></a><span class="lineno"> 5410</span>&#160; uint32_t memoryTypeIndex,</div>
<div class="line"><a name="l05411"></a><span class="lineno"> 5411</span>&#160; VkDeviceMemory hMemory,</div>
<div class="line"><a name="l05412"></a><span class="lineno"> 5412</span>&#160; VmaSuballocationType suballocationType,</div>
<div class="line"><a name="l05413"></a><span class="lineno"> 5413</span>&#160; <span class="keywordtype">void</span>* pMappedData,</div>
<div class="line"><a name="l05414"></a><span class="lineno"> 5414</span>&#160; VkDeviceSize size)</div>
<div class="line"><a name="l05415"></a><span class="lineno"> 5415</span>&#160; {</div>
<div class="line"><a name="l05416"></a><span class="lineno"> 5416</span>&#160; VMA_ASSERT(m_Type == ALLOCATION_TYPE_NONE);</div>
<div class="line"><a name="l05417"></a><span class="lineno"> 5417</span>&#160; VMA_ASSERT(hMemory != VK_NULL_HANDLE);</div>
<div class="line"><a name="l05418"></a><span class="lineno"> 5418</span>&#160; m_Type = (uint8_t)ALLOCATION_TYPE_DEDICATED;</div>
<div class="line"><a name="l05419"></a><span class="lineno"> 5419</span>&#160; m_Alignment = 0;</div>
<div class="line"><a name="l05420"></a><span class="lineno"> 5420</span>&#160; m_Size = size;</div>
<div class="line"><a name="l05421"></a><span class="lineno"> 5421</span>&#160; m_MemoryTypeIndex = memoryTypeIndex;</div>
<div class="line"><a name="l05422"></a><span class="lineno"> 5422</span>&#160; m_SuballocationType = (uint8_t)suballocationType;</div>
<div class="line"><a name="l05423"></a><span class="lineno"> 5423</span>&#160; m_MapCount = (pMappedData != VMA_NULL) ? MAP_COUNT_FLAG_PERSISTENT_MAP : 0;</div>
<div class="line"><a name="l05424"></a><span class="lineno"> 5424</span>&#160; m_DedicatedAllocation.m_hMemory = hMemory;</div>
<div class="line"><a name="l05425"></a><span class="lineno"> 5425</span>&#160; m_DedicatedAllocation.m_pMappedData = pMappedData;</div>
<div class="line"><a name="l05426"></a><span class="lineno"> 5426</span>&#160; }</div>
<div class="line"><a name="l05427"></a><span class="lineno"> 5427</span>&#160; </div>
<div class="line"><a name="l05428"></a><span class="lineno"> 5428</span>&#160; ALLOCATION_TYPE GetType()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (ALLOCATION_TYPE)m_Type; }</div>
<div class="line"><a name="l05429"></a><span class="lineno"> 5429</span>&#160; VkDeviceSize GetAlignment()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Alignment; }</div>
<div class="line"><a name="l05430"></a><span class="lineno"> 5430</span>&#160; VkDeviceSize GetSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Size; }</div>
<div class="line"><a name="l05431"></a><span class="lineno"> 5431</span>&#160; <span class="keywordtype">bool</span> IsUserDataString()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (m_Flags &amp; FLAG_USER_DATA_STRING) != 0; }</div>
<div class="line"><a name="l05432"></a><span class="lineno"> 5432</span>&#160; <span class="keywordtype">void</span>* GetUserData()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pUserData; }</div>
<div class="line"><a name="l05433"></a><span class="lineno"> 5433</span>&#160; <span class="keywordtype">void</span> SetUserData(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>* pUserData);</div>
<div class="line"><a name="l05434"></a><span class="lineno"> 5434</span>&#160; VmaSuballocationType GetSuballocationType()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (VmaSuballocationType)m_SuballocationType; }</div>
<div class="line"><a name="l05435"></a><span class="lineno"> 5435</span>&#160; </div>
<div class="line"><a name="l05436"></a><span class="lineno"> 5436</span>&#160; VmaDeviceMemoryBlock* GetBlock()<span class="keyword"> const</span></div>
<div class="line"><a name="l05437"></a><span class="lineno"> 5437</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05438"></a><span class="lineno"> 5438</span>&#160; VMA_ASSERT(m_Type == ALLOCATION_TYPE_BLOCK);</div>
<div class="line"><a name="l05439"></a><span class="lineno"> 5439</span>&#160; <span class="keywordflow">return</span> m_BlockAllocation.m_Block;</div>
<div class="line"><a name="l05440"></a><span class="lineno"> 5440</span>&#160; }</div>
<div class="line"><a name="l05441"></a><span class="lineno"> 5441</span>&#160; VkDeviceSize GetOffset() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05442"></a><span class="lineno"> 5442</span>&#160; VkDeviceMemory GetMemory() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05443"></a><span class="lineno"> 5443</span>&#160; uint32_t GetMemoryTypeIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemoryTypeIndex; }</div>
<div class="line"><a name="l05444"></a><span class="lineno"> 5444</span>&#160; <span class="keywordtype">bool</span> IsPersistentMap()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (m_MapCount &amp; MAP_COUNT_FLAG_PERSISTENT_MAP) != 0; }</div>
<div class="line"><a name="l05445"></a><span class="lineno"> 5445</span>&#160; <span class="keywordtype">void</span>* GetMappedData() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05446"></a><span class="lineno"> 5446</span>&#160; <span class="keywordtype">bool</span> CanBecomeLost() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05447"></a><span class="lineno"> 5447</span>&#160; </div>
<div class="line"><a name="l05448"></a><span class="lineno"> 5448</span>&#160; uint32_t GetLastUseFrameIndex()<span class="keyword"> const</span></div>
<div class="line"><a name="l05449"></a><span class="lineno"> 5449</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05450"></a><span class="lineno"> 5450</span>&#160; <span class="keywordflow">return</span> m_LastUseFrameIndex.load();</div>
<div class="line"><a name="l05451"></a><span class="lineno"> 5451</span>&#160; }</div>
<div class="line"><a name="l05452"></a><span class="lineno"> 5452</span>&#160; <span class="keywordtype">bool</span> CompareExchangeLastUseFrameIndex(uint32_t&amp; expected, uint32_t desired)</div>
<div class="line"><a name="l05453"></a><span class="lineno"> 5453</span>&#160; {</div>
<div class="line"><a name="l05454"></a><span class="lineno"> 5454</span>&#160; <span class="keywordflow">return</span> m_LastUseFrameIndex.compare_exchange_weak(expected, desired);</div>
<div class="line"><a name="l05455"></a><span class="lineno"> 5455</span>&#160; }</div>
<div class="line"><a name="l05456"></a><span class="lineno"> 5456</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l05457"></a><span class="lineno"> 5457</span>&#160;<span class="comment"> - If hAllocation.LastUseFrameIndex + frameInUseCount &lt; allocator.CurrentFrameIndex,</span></div>
<div class="line"><a name="l05458"></a><span class="lineno"> 5458</span>&#160;<span class="comment"> makes it lost by setting LastUseFrameIndex = VMA_FRAME_INDEX_LOST and returns true.</span></div>
<div class="line"><a name="l05459"></a><span class="lineno"> 5459</span>&#160;<span class="comment"> - Else, returns false.</span></div>
<div class="line"><a name="l05460"></a><span class="lineno"> 5460</span>&#160;<span class="comment"> </span></div>
<div class="line"><a name="l05461"></a><span class="lineno"> 5461</span>&#160;<span class="comment"> If hAllocation is already lost, assert - you should not call it then.</span></div>
<div class="line"><a name="l05462"></a><span class="lineno"> 5462</span>&#160;<span class="comment"> If hAllocation was not created with CAN_BECOME_LOST_BIT, assert.</span></div>
<div class="line"><a name="l05463"></a><span class="lineno"> 5463</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l05464"></a><span class="lineno"> 5464</span>&#160; <span class="keywordtype">bool</span> MakeLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
<div class="line"><a name="l05465"></a><span class="lineno"> 5465</span>&#160; </div>
<div class="line"><a name="l05466"></a><span class="lineno"> 5466</span>&#160; <span class="keywordtype">void</span> DedicatedAllocCalcStatsInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo)</div>
<div class="line"><a name="l05467"></a><span class="lineno"> 5467</span>&#160; {</div>
<div class="line"><a name="l05468"></a><span class="lineno"> 5468</span>&#160; VMA_ASSERT(m_Type == ALLOCATION_TYPE_DEDICATED);</div>
<div class="line"><a name="l05469"></a><span class="lineno"> 5469</span>&#160; outInfo.<a class="code" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">blockCount</a> = 1;</div>
<div class="line"><a name="l05470"></a><span class="lineno"> 5470</span>&#160; outInfo.<a class="code" href="struct_vma_stat_info.html#a537741e4d5cdddc1c0ab95ec650afaff">allocationCount</a> = 1;</div>
<div class="line"><a name="l05471"></a><span class="lineno"> 5471</span>&#160; outInfo.<a class="code" href="struct_vma_stat_info.html#ae06129c771bfebfd6468a7f4276502a9">unusedRangeCount</a> = 0;</div>
<div class="line"><a name="l05472"></a><span class="lineno"> 5472</span>&#160; outInfo.<a class="code" href="struct_vma_stat_info.html#ab0c6c73837e5a70c749fbd4f6064895a">usedBytes</a> = m_Size;</div>
<div class="line"><a name="l05473"></a><span class="lineno"> 5473</span>&#160; outInfo.<a class="code" href="struct_vma_stat_info.html#a1859d290aca2cd582d8dc25922092669">unusedBytes</a> = 0;</div>
<div class="line"><a name="l05474"></a><span class="lineno"> 5474</span>&#160; outInfo.<a class="code" href="struct_vma_stat_info.html#ade8b40bd3139c04aabd2fc538a356fea">allocationSizeMin</a> = outInfo.<a class="code" href="struct_vma_stat_info.html#a17e9733a5ecd76287d4db6e66f71f50c">allocationSizeMax</a> = m_Size;</div>
<div class="line"><a name="l05475"></a><span class="lineno"> 5475</span>&#160; outInfo.<a class="code" href="struct_vma_stat_info.html#aedeba931324f16589cd2416c0d2dd0d4">unusedRangeSizeMin</a> = UINT64_MAX;</div>
<div class="line"><a name="l05476"></a><span class="lineno"> 5476</span>&#160; outInfo.<a class="code" href="struct_vma_stat_info.html#a5ba1a2476c4d39b10f7e2f7ebbb72ac4">unusedRangeSizeMax</a> = 0;</div>
<div class="line"><a name="l05477"></a><span class="lineno"> 5477</span>&#160; }</div>
<div class="line"><a name="l05478"></a><span class="lineno"> 5478</span>&#160; </div>
<div class="line"><a name="l05479"></a><span class="lineno"> 5479</span>&#160; <span class="keywordtype">void</span> BlockAllocMap();</div>
<div class="line"><a name="l05480"></a><span class="lineno"> 5480</span>&#160; <span class="keywordtype">void</span> BlockAllocUnmap();</div>
<div class="line"><a name="l05481"></a><span class="lineno"> 5481</span>&#160; VkResult DedicatedAllocMap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>** ppData);</div>
<div class="line"><a name="l05482"></a><span class="lineno"> 5482</span>&#160; <span class="keywordtype">void</span> DedicatedAllocUnmap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
<div class="line"><a name="l05483"></a><span class="lineno"> 5483</span>&#160; </div>
<div class="line"><a name="l05484"></a><span class="lineno"> 5484</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l05485"></a><span class="lineno"> 5485</span>&#160; uint32_t GetCreationFrameIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_CreationFrameIndex; }</div>
<div class="line"><a name="l05486"></a><span class="lineno"> 5486</span>&#160; uint32_t GetBufferImageUsage()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BufferImageUsage; }</div>
<div class="line"><a name="l05487"></a><span class="lineno"> 5487</span>&#160; </div>
<div class="line"><a name="l05488"></a><span class="lineno"> 5488</span>&#160; <span class="keywordtype">void</span> InitBufferImageUsage(uint32_t bufferImageUsage)</div>
<div class="line"><a name="l05489"></a><span class="lineno"> 5489</span>&#160; {</div>
<div class="line"><a name="l05490"></a><span class="lineno"> 5490</span>&#160; VMA_ASSERT(m_BufferImageUsage == 0);</div>
<div class="line"><a name="l05491"></a><span class="lineno"> 5491</span>&#160; m_BufferImageUsage = bufferImageUsage;</div>
<div class="line"><a name="l05492"></a><span class="lineno"> 5492</span>&#160; }</div>
<div class="line"><a name="l05493"></a><span class="lineno"> 5493</span>&#160; </div>
<div class="line"><a name="l05494"></a><span class="lineno"> 5494</span>&#160; <span class="keywordtype">void</span> PrintParameters(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05495"></a><span class="lineno"> 5495</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l05496"></a><span class="lineno"> 5496</span>&#160; </div>
<div class="line"><a name="l05497"></a><span class="lineno"> 5497</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l05498"></a><span class="lineno"> 5498</span>&#160; VkDeviceSize m_Alignment;</div>
<div class="line"><a name="l05499"></a><span class="lineno"> 5499</span>&#160; VkDeviceSize m_Size;</div>
<div class="line"><a name="l05500"></a><span class="lineno"> 5500</span>&#160; <span class="keywordtype">void</span>* m_pUserData;</div>
<div class="line"><a name="l05501"></a><span class="lineno"> 5501</span>&#160; VMA_ATOMIC_UINT32 m_LastUseFrameIndex;</div>
<div class="line"><a name="l05502"></a><span class="lineno"> 5502</span>&#160; uint32_t m_MemoryTypeIndex;</div>
<div class="line"><a name="l05503"></a><span class="lineno"> 5503</span>&#160; uint8_t m_Type; <span class="comment">// ALLOCATION_TYPE</span></div>
<div class="line"><a name="l05504"></a><span class="lineno"> 5504</span>&#160; uint8_t m_SuballocationType; <span class="comment">// VmaSuballocationType</span></div>
<div class="line"><a name="l05505"></a><span class="lineno"> 5505</span>&#160; <span class="comment">// Bit 0x80 is set when allocation was created with VMA_ALLOCATION_CREATE_MAPPED_BIT.</span></div>
<div class="line"><a name="l05506"></a><span class="lineno"> 5506</span>&#160; <span class="comment">// Bits with mask 0x7F are reference counter for vmaMapMemory()/vmaUnmapMemory().</span></div>
<div class="line"><a name="l05507"></a><span class="lineno"> 5507</span>&#160; uint8_t m_MapCount;</div>
<div class="line"><a name="l05508"></a><span class="lineno"> 5508</span>&#160; uint8_t m_Flags; <span class="comment">// enum FLAGS</span></div>
<div class="line"><a name="l05509"></a><span class="lineno"> 5509</span>&#160; </div>
<div class="line"><a name="l05510"></a><span class="lineno"> 5510</span>&#160; <span class="comment">// Allocation out of VmaDeviceMemoryBlock.</span></div>
<div class="line"><a name="l05511"></a><span class="lineno"> 5511</span>&#160; <span class="keyword">struct </span>BlockAllocation</div>
<div class="line"><a name="l05512"></a><span class="lineno"> 5512</span>&#160; {</div>
<div class="line"><a name="l05513"></a><span class="lineno"> 5513</span>&#160; VmaDeviceMemoryBlock* m_Block;</div>
<div class="line"><a name="l05514"></a><span class="lineno"> 5514</span>&#160; VkDeviceSize m_Offset;</div>
<div class="line"><a name="l05515"></a><span class="lineno"> 5515</span>&#160; <span class="keywordtype">bool</span> m_CanBecomeLost;</div>
<div class="line"><a name="l05516"></a><span class="lineno"> 5516</span>&#160; };</div>
<div class="line"><a name="l05517"></a><span class="lineno"> 5517</span>&#160; </div>
<div class="line"><a name="l05518"></a><span class="lineno"> 5518</span>&#160; <span class="comment">// Allocation for an object that has its own private VkDeviceMemory.</span></div>
<div class="line"><a name="l05519"></a><span class="lineno"> 5519</span>&#160; <span class="keyword">struct </span>DedicatedAllocation</div>
<div class="line"><a name="l05520"></a><span class="lineno"> 5520</span>&#160; {</div>
<div class="line"><a name="l05521"></a><span class="lineno"> 5521</span>&#160; VkDeviceMemory m_hMemory;</div>
<div class="line"><a name="l05522"></a><span class="lineno"> 5522</span>&#160; <span class="keywordtype">void</span>* m_pMappedData; <span class="comment">// Not null means memory is mapped.</span></div>
<div class="line"><a name="l05523"></a><span class="lineno"> 5523</span>&#160; };</div>
<div class="line"><a name="l05524"></a><span class="lineno"> 5524</span>&#160; </div>
<div class="line"><a name="l05525"></a><span class="lineno"> 5525</span>&#160; <span class="keyword">union</span></div>
<div class="line"><a name="l05526"></a><span class="lineno"> 5526</span>&#160; {</div>
<div class="line"><a name="l05527"></a><span class="lineno"> 5527</span>&#160; <span class="comment">// Allocation out of VmaDeviceMemoryBlock.</span></div>
<div class="line"><a name="l05528"></a><span class="lineno"> 5528</span>&#160; BlockAllocation m_BlockAllocation;</div>
<div class="line"><a name="l05529"></a><span class="lineno"> 5529</span>&#160; <span class="comment">// Allocation for an object that has its own private VkDeviceMemory.</span></div>
<div class="line"><a name="l05530"></a><span class="lineno"> 5530</span>&#160; DedicatedAllocation m_DedicatedAllocation;</div>
<div class="line"><a name="l05531"></a><span class="lineno"> 5531</span>&#160; };</div>
<div class="line"><a name="l05532"></a><span class="lineno"> 5532</span>&#160; </div>
<div class="line"><a name="l05533"></a><span class="lineno"> 5533</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l05534"></a><span class="lineno"> 5534</span>&#160; uint32_t m_CreationFrameIndex;</div>
<div class="line"><a name="l05535"></a><span class="lineno"> 5535</span>&#160; uint32_t m_BufferImageUsage; <span class="comment">// 0 if unknown.</span></div>
<div class="line"><a name="l05536"></a><span class="lineno"> 5536</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l05537"></a><span class="lineno"> 5537</span>&#160; </div>
<div class="line"><a name="l05538"></a><span class="lineno"> 5538</span>&#160; <span class="keywordtype">void</span> FreeUserDataString(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
<div class="line"><a name="l05539"></a><span class="lineno"> 5539</span>&#160;};</div>
<div class="line"><a name="l05540"></a><span class="lineno"> 5540</span>&#160; </div>
<div class="line"><a name="l05541"></a><span class="lineno"> 5541</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l05542"></a><span class="lineno"> 5542</span>&#160;<span class="comment">Represents a region of VmaDeviceMemoryBlock that is either assigned and returned as</span></div>
<div class="line"><a name="l05543"></a><span class="lineno"> 5543</span>&#160;<span class="comment">allocated memory block or free.</span></div>
<div class="line"><a name="l05544"></a><span class="lineno"> 5544</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l05545"></a><span class="lineno"> 5545</span>&#160;<span class="keyword">struct </span>VmaSuballocation</div>
<div class="line"><a name="l05546"></a><span class="lineno"> 5546</span>&#160;{</div>
<div class="line"><a name="l05547"></a><span class="lineno"> 5547</span>&#160; VkDeviceSize offset;</div>
<div class="line"><a name="l05548"></a><span class="lineno"> 5548</span>&#160; VkDeviceSize size;</div>
<div class="line"><a name="l05549"></a><span class="lineno"> 5549</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation;</div>
<div class="line"><a name="l05550"></a><span class="lineno"> 5550</span>&#160; VmaSuballocationType type;</div>
<div class="line"><a name="l05551"></a><span class="lineno"> 5551</span>&#160;};</div>
<div class="line"><a name="l05552"></a><span class="lineno"> 5552</span>&#160; </div>
<div class="line"><a name="l05553"></a><span class="lineno"> 5553</span>&#160;<span class="comment">// Comparator for offsets.</span></div>
<div class="line"><a name="l05554"></a><span class="lineno"> 5554</span>&#160;<span class="keyword">struct </span>VmaSuballocationOffsetLess</div>
<div class="line"><a name="l05555"></a><span class="lineno"> 5555</span>&#160;{</div>
<div class="line"><a name="l05556"></a><span class="lineno"> 5556</span>&#160; <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaSuballocation&amp; lhs, <span class="keyword">const</span> VmaSuballocation&amp; rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l05557"></a><span class="lineno"> 5557</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05558"></a><span class="lineno"> 5558</span>&#160; <span class="keywordflow">return</span> lhs.offset &lt; rhs.offset;</div>
<div class="line"><a name="l05559"></a><span class="lineno"> 5559</span>&#160; }</div>
<div class="line"><a name="l05560"></a><span class="lineno"> 5560</span>&#160;};</div>
<div class="line"><a name="l05561"></a><span class="lineno"> 5561</span>&#160;<span class="keyword">struct </span>VmaSuballocationOffsetGreater</div>
<div class="line"><a name="l05562"></a><span class="lineno"> 5562</span>&#160;{</div>
<div class="line"><a name="l05563"></a><span class="lineno"> 5563</span>&#160; <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> VmaSuballocation&amp; lhs, <span class="keyword">const</span> VmaSuballocation&amp; rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l05564"></a><span class="lineno"> 5564</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05565"></a><span class="lineno"> 5565</span>&#160; <span class="keywordflow">return</span> lhs.offset &gt; rhs.offset;</div>
<div class="line"><a name="l05566"></a><span class="lineno"> 5566</span>&#160; }</div>
<div class="line"><a name="l05567"></a><span class="lineno"> 5567</span>&#160;};</div>
<div class="line"><a name="l05568"></a><span class="lineno"> 5568</span>&#160; </div>
<div class="line"><a name="l05569"></a><span class="lineno"> 5569</span>&#160;<span class="keyword">typedef</span> VmaList&lt; VmaSuballocation, VmaStlAllocator&lt;VmaSuballocation&gt; &gt; VmaSuballocationList;</div>
<div class="line"><a name="l05570"></a><span class="lineno"> 5570</span>&#160; </div>
<div class="line"><a name="l05571"></a><span class="lineno"> 5571</span>&#160;<span class="comment">// Cost of one additional allocation lost, as equivalent in bytes.</span></div>
<div class="line"><a name="l05572"></a><span class="lineno"> 5572</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> VkDeviceSize VMA_LOST_ALLOCATION_COST = 1048576;</div>
<div class="line"><a name="l05573"></a><span class="lineno"> 5573</span>&#160; </div>
<div class="line"><a name="l05574"></a><span class="lineno"> 5574</span>&#160;<span class="keyword">enum class</span> VmaAllocationRequestType</div>
<div class="line"><a name="l05575"></a><span class="lineno"> 5575</span>&#160;{</div>
<div class="line"><a name="l05576"></a><span class="lineno"> 5576</span>&#160; Normal,</div>
<div class="line"><a name="l05577"></a><span class="lineno"> 5577</span>&#160; <span class="comment">// Used by &quot;Linear&quot; algorithm.</span></div>
<div class="line"><a name="l05578"></a><span class="lineno"> 5578</span>&#160; UpperAddress,</div>
<div class="line"><a name="l05579"></a><span class="lineno"> 5579</span>&#160; EndOf1st,</div>
<div class="line"><a name="l05580"></a><span class="lineno"> 5580</span>&#160; EndOf2nd,</div>
<div class="line"><a name="l05581"></a><span class="lineno"> 5581</span>&#160;};</div>
<div class="line"><a name="l05582"></a><span class="lineno"> 5582</span>&#160; </div>
<div class="line"><a name="l05583"></a><span class="lineno"> 5583</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l05584"></a><span class="lineno"> 5584</span>&#160;<span class="comment">Parameters of planned allocation inside a VmaDeviceMemoryBlock.</span></div>
<div class="line"><a name="l05585"></a><span class="lineno"> 5585</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l05586"></a><span class="lineno"> 5586</span>&#160;<span class="comment">If canMakeOtherLost was false:</span></div>
<div class="line"><a name="l05587"></a><span class="lineno"> 5587</span>&#160;<span class="comment">- item points to a FREE suballocation.</span></div>
<div class="line"><a name="l05588"></a><span class="lineno"> 5588</span>&#160;<span class="comment">- itemsToMakeLostCount is 0.</span></div>
<div class="line"><a name="l05589"></a><span class="lineno"> 5589</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l05590"></a><span class="lineno"> 5590</span>&#160;<span class="comment">If canMakeOtherLost was true:</span></div>
<div class="line"><a name="l05591"></a><span class="lineno"> 5591</span>&#160;<span class="comment">- item points to first of sequence of suballocations, which are either FREE,</span></div>
<div class="line"><a name="l05592"></a><span class="lineno"> 5592</span>&#160;<span class="comment"> or point to VmaAllocations that can become lost.</span></div>
<div class="line"><a name="l05593"></a><span class="lineno"> 5593</span>&#160;<span class="comment">- itemsToMakeLostCount is the number of VmaAllocations that need to be made lost for</span></div>
<div class="line"><a name="l05594"></a><span class="lineno"> 5594</span>&#160;<span class="comment"> the requested allocation to succeed.</span></div>
<div class="line"><a name="l05595"></a><span class="lineno"> 5595</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l05596"></a><span class="lineno"> 5596</span>&#160;<span class="keyword">struct </span>VmaAllocationRequest</div>
<div class="line"><a name="l05597"></a><span class="lineno"> 5597</span>&#160;{</div>
<div class="line"><a name="l05598"></a><span class="lineno"> 5598</span>&#160; VkDeviceSize offset;</div>
<div class="line"><a name="l05599"></a><span class="lineno"> 5599</span>&#160; VkDeviceSize sumFreeSize; <span class="comment">// Sum size of free items that overlap with proposed allocation.</span></div>
<div class="line"><a name="l05600"></a><span class="lineno"> 5600</span>&#160; VkDeviceSize sumItemSize; <span class="comment">// Sum size of items to make lost that overlap with proposed allocation.</span></div>
<div class="line"><a name="l05601"></a><span class="lineno"> 5601</span>&#160; VmaSuballocationList::iterator item;</div>
<div class="line"><a name="l05602"></a><span class="lineno"> 5602</span>&#160; <span class="keywordtype">size_t</span> itemsToMakeLostCount;</div>
<div class="line"><a name="l05603"></a><span class="lineno"> 5603</span>&#160; <span class="keywordtype">void</span>* customData;</div>
<div class="line"><a name="l05604"></a><span class="lineno"> 5604</span>&#160; VmaAllocationRequestType type;</div>
<div class="line"><a name="l05605"></a><span class="lineno"> 5605</span>&#160; </div>
<div class="line"><a name="l05606"></a><span class="lineno"> 5606</span>&#160; VkDeviceSize CalcCost()<span class="keyword"> const</span></div>
<div class="line"><a name="l05607"></a><span class="lineno"> 5607</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l05608"></a><span class="lineno"> 5608</span>&#160; <span class="keywordflow">return</span> sumItemSize + itemsToMakeLostCount * VMA_LOST_ALLOCATION_COST;</div>
<div class="line"><a name="l05609"></a><span class="lineno"> 5609</span>&#160; }</div>
<div class="line"><a name="l05610"></a><span class="lineno"> 5610</span>&#160;};</div>
<div class="line"><a name="l05611"></a><span class="lineno"> 5611</span>&#160; </div>
<div class="line"><a name="l05612"></a><span class="lineno"> 5612</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l05613"></a><span class="lineno"> 5613</span>&#160;<span class="comment">Data structure used for bookkeeping of allocations and unused ranges of memory</span></div>
<div class="line"><a name="l05614"></a><span class="lineno"> 5614</span>&#160;<span class="comment">in a single VkDeviceMemory block.</span></div>
<div class="line"><a name="l05615"></a><span class="lineno"> 5615</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l05616"></a><span class="lineno"> 5616</span>&#160;<span class="keyword">class </span>VmaBlockMetadata</div>
<div class="line"><a name="l05617"></a><span class="lineno"> 5617</span>&#160;{</div>
<div class="line"><a name="l05618"></a><span class="lineno"> 5618</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l05619"></a><span class="lineno"> 5619</span>&#160; VmaBlockMetadata(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
<div class="line"><a name="l05620"></a><span class="lineno"> 5620</span>&#160; <span class="keyword">virtual</span> ~VmaBlockMetadata() { }</div>
<div class="line"><a name="l05621"></a><span class="lineno"> 5621</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size) { m_Size = size; }</div>
<div class="line"><a name="l05622"></a><span class="lineno"> 5622</span>&#160; </div>
<div class="line"><a name="l05623"></a><span class="lineno"> 5623</span>&#160; <span class="comment">// Validates all data structures inside this object. If not valid, returns false.</span></div>
<div class="line"><a name="l05624"></a><span class="lineno"> 5624</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l05625"></a><span class="lineno"> 5625</span>&#160; VkDeviceSize GetSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Size; }</div>
<div class="line"><a name="l05626"></a><span class="lineno"> 5626</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l05627"></a><span class="lineno"> 5627</span>&#160; <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l05628"></a><span class="lineno"> 5628</span>&#160; <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l05629"></a><span class="lineno"> 5629</span>&#160; <span class="comment">// Returns true if this block is empty - contains only single free suballocation.</span></div>
<div class="line"><a name="l05630"></a><span class="lineno"> 5630</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l05631"></a><span class="lineno"> 5631</span>&#160; </div>
<div class="line"><a name="l05632"></a><span class="lineno"> 5632</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l05633"></a><span class="lineno"> 5633</span>&#160; <span class="comment">// Shouldn&#39;t modify blockCount.</span></div>
<div class="line"><a name="l05634"></a><span class="lineno"> 5634</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l05635"></a><span class="lineno"> 5635</span>&#160; </div>
<div class="line"><a name="l05636"></a><span class="lineno"> 5636</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l05637"></a><span class="lineno"> 5637</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l05638"></a><span class="lineno"> 5638</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l05639"></a><span class="lineno"> 5639</span>&#160; </div>
<div class="line"><a name="l05640"></a><span class="lineno"> 5640</span>&#160; <span class="comment">// Tries to find a place for suballocation with given parameters inside this block.</span></div>
<div class="line"><a name="l05641"></a><span class="lineno"> 5641</span>&#160; <span class="comment">// If succeeded, fills pAllocationRequest and returns true.</span></div>
<div class="line"><a name="l05642"></a><span class="lineno"> 5642</span>&#160; <span class="comment">// If failed, returns false.</span></div>
<div class="line"><a name="l05643"></a><span class="lineno"> 5643</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
<div class="line"><a name="l05644"></a><span class="lineno"> 5644</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l05645"></a><span class="lineno"> 5645</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l05646"></a><span class="lineno"> 5646</span>&#160; VkDeviceSize bufferImageGranularity,</div>
<div class="line"><a name="l05647"></a><span class="lineno"> 5647</span>&#160; VkDeviceSize allocSize,</div>
<div class="line"><a name="l05648"></a><span class="lineno"> 5648</span>&#160; VkDeviceSize allocAlignment,</div>
<div class="line"><a name="l05649"></a><span class="lineno"> 5649</span>&#160; <span class="keywordtype">bool</span> upperAddress,</div>
<div class="line"><a name="l05650"></a><span class="lineno"> 5650</span>&#160; VmaSuballocationType allocType,</div>
<div class="line"><a name="l05651"></a><span class="lineno"> 5651</span>&#160; <span class="keywordtype">bool</span> canMakeOtherLost,</div>
<div class="line"><a name="l05652"></a><span class="lineno"> 5652</span>&#160; <span class="comment">// Always one of VMA_ALLOCATION_CREATE_STRATEGY_* or VMA_ALLOCATION_INTERNAL_STRATEGY_* flags.</span></div>
<div class="line"><a name="l05653"></a><span class="lineno"> 5653</span>&#160; uint32_t strategy,</div>
<div class="line"><a name="l05654"></a><span class="lineno"> 5654</span>&#160; VmaAllocationRequest* pAllocationRequest) = 0;</div>
<div class="line"><a name="l05655"></a><span class="lineno"> 5655</span>&#160; </div>
<div class="line"><a name="l05656"></a><span class="lineno"> 5656</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
<div class="line"><a name="l05657"></a><span class="lineno"> 5657</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l05658"></a><span class="lineno"> 5658</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l05659"></a><span class="lineno"> 5659</span>&#160; VmaAllocationRequest* pAllocationRequest) = 0;</div>
<div class="line"><a name="l05660"></a><span class="lineno"> 5660</span>&#160; </div>
<div class="line"><a name="l05661"></a><span class="lineno"> 5661</span>&#160; <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount) = 0;</div>
<div class="line"><a name="l05662"></a><span class="lineno"> 5662</span>&#160; </div>
<div class="line"><a name="l05663"></a><span class="lineno"> 5663</span>&#160; <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData) = 0;</div>
<div class="line"><a name="l05664"></a><span class="lineno"> 5664</span>&#160; </div>
<div class="line"><a name="l05665"></a><span class="lineno"> 5665</span>&#160; <span class="comment">// Makes actual allocation based on request. Request must already be checked and valid.</span></div>
<div class="line"><a name="l05666"></a><span class="lineno"> 5666</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
<div class="line"><a name="l05667"></a><span class="lineno"> 5667</span>&#160; <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
<div class="line"><a name="l05668"></a><span class="lineno"> 5668</span>&#160; VmaSuballocationType type,</div>
<div class="line"><a name="l05669"></a><span class="lineno"> 5669</span>&#160; VkDeviceSize allocSize,</div>
<div class="line"><a name="l05670"></a><span class="lineno"> 5670</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation) = 0;</div>
<div class="line"><a name="l05671"></a><span class="lineno"> 5671</span>&#160; </div>
<div class="line"><a name="l05672"></a><span class="lineno"> 5672</span>&#160; <span class="comment">// Frees suballocation assigned to given memory region.</span></div>
<div class="line"><a name="l05673"></a><span class="lineno"> 5673</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation) = 0;</div>
<div class="line"><a name="l05674"></a><span class="lineno"> 5674</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset) = 0;</div>
<div class="line"><a name="l05675"></a><span class="lineno"> 5675</span>&#160; </div>
<div class="line"><a name="l05676"></a><span class="lineno"> 5676</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l05677"></a><span class="lineno"> 5677</span>&#160; <span class="keyword">const</span> VkAllocationCallbacks* GetAllocationCallbacks()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pAllocationCallbacks; }</div>
<div class="line"><a name="l05678"></a><span class="lineno"> 5678</span>&#160; </div>
<div class="line"><a name="l05679"></a><span class="lineno"> 5679</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l05680"></a><span class="lineno"> 5680</span>&#160; <span class="keywordtype">void</span> PrintDetailedMap_Begin(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
<div class="line"><a name="l05681"></a><span class="lineno"> 5681</span>&#160; VkDeviceSize unusedBytes,</div>
<div class="line"><a name="l05682"></a><span class="lineno"> 5682</span>&#160; <span class="keywordtype">size_t</span> allocationCount,</div>
<div class="line"><a name="l05683"></a><span class="lineno"> 5683</span>&#160; <span class="keywordtype">size_t</span> unusedRangeCount) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05684"></a><span class="lineno"> 5684</span>&#160; <span class="keywordtype">void</span> PrintDetailedMap_Allocation(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
<div class="line"><a name="l05685"></a><span class="lineno"> 5685</span>&#160; VkDeviceSize offset,</div>
<div class="line"><a name="l05686"></a><span class="lineno"> 5686</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05687"></a><span class="lineno"> 5687</span>&#160; <span class="keywordtype">void</span> PrintDetailedMap_UnusedRange(<span class="keyword">class</span> VmaJsonWriter&amp; json,</div>
<div class="line"><a name="l05688"></a><span class="lineno"> 5688</span>&#160; VkDeviceSize offset,</div>
<div class="line"><a name="l05689"></a><span class="lineno"> 5689</span>&#160; VkDeviceSize size) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05690"></a><span class="lineno"> 5690</span>&#160; <span class="keywordtype">void</span> PrintDetailedMap_End(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05691"></a><span class="lineno"> 5691</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l05692"></a><span class="lineno"> 5692</span>&#160; </div>
<div class="line"><a name="l05693"></a><span class="lineno"> 5693</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l05694"></a><span class="lineno"> 5694</span>&#160; VkDeviceSize m_Size;</div>
<div class="line"><a name="l05695"></a><span class="lineno"> 5695</span>&#160; <span class="keyword">const</span> VkAllocationCallbacks* m_pAllocationCallbacks;</div>
<div class="line"><a name="l05696"></a><span class="lineno"> 5696</span>&#160;};</div>
<div class="line"><a name="l05697"></a><span class="lineno"> 5697</span>&#160; </div>
<div class="line"><a name="l05698"></a><span class="lineno"> 5698</span>&#160;<span class="preprocessor">#define VMA_VALIDATE(cond) do { if(!(cond)) { \</span></div>
<div class="line"><a name="l05699"></a><span class="lineno"> 5699</span>&#160;<span class="preprocessor"> VMA_ASSERT(0 &amp;&amp; &quot;Validation failed: &quot; #cond); \</span></div>
<div class="line"><a name="l05700"></a><span class="lineno"> 5700</span>&#160;<span class="preprocessor"> return false; \</span></div>
<div class="line"><a name="l05701"></a><span class="lineno"> 5701</span>&#160;<span class="preprocessor"> } } while(false)</span></div>
<div class="line"><a name="l05702"></a><span class="lineno"> 5702</span>&#160; </div>
<div class="line"><a name="l05703"></a><span class="lineno"> 5703</span>&#160;<span class="keyword">class </span>VmaBlockMetadata_Generic : <span class="keyword">public</span> VmaBlockMetadata</div>
<div class="line"><a name="l05704"></a><span class="lineno"> 5704</span>&#160;{</div>
<div class="line"><a name="l05705"></a><span class="lineno"> 5705</span>&#160; VMA_CLASS_NO_COPY(VmaBlockMetadata_Generic)</div>
<div class="line"><a name="l05706"></a><span class="lineno"> 5706</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l05707"></a><span class="lineno"> 5707</span>&#160; VmaBlockMetadata_Generic(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
<div class="line"><a name="l05708"></a><span class="lineno"> 5708</span>&#160; <span class="keyword">virtual</span> ~VmaBlockMetadata_Generic();</div>
<div class="line"><a name="l05709"></a><span class="lineno"> 5709</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size);</div>
<div class="line"><a name="l05710"></a><span class="lineno"> 5710</span>&#160; </div>
<div class="line"><a name="l05711"></a><span class="lineno"> 5711</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05712"></a><span class="lineno"> 5712</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Suballocations.size() - m_FreeCount; }</div>
<div class="line"><a name="l05713"></a><span class="lineno"> 5713</span>&#160; <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_SumFreeSize; }</div>
<div class="line"><a name="l05714"></a><span class="lineno"> 5714</span>&#160; <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05715"></a><span class="lineno"> 5715</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05716"></a><span class="lineno"> 5716</span>&#160; </div>
<div class="line"><a name="l05717"></a><span class="lineno"> 5717</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05718"></a><span class="lineno"> 5718</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05719"></a><span class="lineno"> 5719</span>&#160; </div>
<div class="line"><a name="l05720"></a><span class="lineno"> 5720</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l05721"></a><span class="lineno"> 5721</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05722"></a><span class="lineno"> 5722</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l05723"></a><span class="lineno"> 5723</span>&#160; </div>
<div class="line"><a name="l05724"></a><span class="lineno"> 5724</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
<div class="line"><a name="l05725"></a><span class="lineno"> 5725</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l05726"></a><span class="lineno"> 5726</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l05727"></a><span class="lineno"> 5727</span>&#160; VkDeviceSize bufferImageGranularity,</div>
<div class="line"><a name="l05728"></a><span class="lineno"> 5728</span>&#160; VkDeviceSize allocSize,</div>
<div class="line"><a name="l05729"></a><span class="lineno"> 5729</span>&#160; VkDeviceSize allocAlignment,</div>
<div class="line"><a name="l05730"></a><span class="lineno"> 5730</span>&#160; <span class="keywordtype">bool</span> upperAddress,</div>
<div class="line"><a name="l05731"></a><span class="lineno"> 5731</span>&#160; VmaSuballocationType allocType,</div>
<div class="line"><a name="l05732"></a><span class="lineno"> 5732</span>&#160; <span class="keywordtype">bool</span> canMakeOtherLost,</div>
<div class="line"><a name="l05733"></a><span class="lineno"> 5733</span>&#160; uint32_t strategy,</div>
<div class="line"><a name="l05734"></a><span class="lineno"> 5734</span>&#160; VmaAllocationRequest* pAllocationRequest);</div>
<div class="line"><a name="l05735"></a><span class="lineno"> 5735</span>&#160; </div>
<div class="line"><a name="l05736"></a><span class="lineno"> 5736</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
<div class="line"><a name="l05737"></a><span class="lineno"> 5737</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l05738"></a><span class="lineno"> 5738</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l05739"></a><span class="lineno"> 5739</span>&#160; VmaAllocationRequest* pAllocationRequest);</div>
<div class="line"><a name="l05740"></a><span class="lineno"> 5740</span>&#160; </div>
<div class="line"><a name="l05741"></a><span class="lineno"> 5741</span>&#160; <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
<div class="line"><a name="l05742"></a><span class="lineno"> 5742</span>&#160; </div>
<div class="line"><a name="l05743"></a><span class="lineno"> 5743</span>&#160; <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData);</div>
<div class="line"><a name="l05744"></a><span class="lineno"> 5744</span>&#160; </div>
<div class="line"><a name="l05745"></a><span class="lineno"> 5745</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
<div class="line"><a name="l05746"></a><span class="lineno"> 5746</span>&#160; <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
<div class="line"><a name="l05747"></a><span class="lineno"> 5747</span>&#160; VmaSuballocationType type,</div>
<div class="line"><a name="l05748"></a><span class="lineno"> 5748</span>&#160; VkDeviceSize allocSize,</div>
<div class="line"><a name="l05749"></a><span class="lineno"> 5749</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
<div class="line"><a name="l05750"></a><span class="lineno"> 5750</span>&#160; </div>
<div class="line"><a name="l05751"></a><span class="lineno"> 5751</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l05752"></a><span class="lineno"> 5752</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset);</div>
<div class="line"><a name="l05753"></a><span class="lineno"> 5753</span>&#160; </div>
<div class="line"><a name="l05755"></a><span class="lineno"> 5755</span>&#160; <span class="comment">// For defragmentation</span></div>
<div class="line"><a name="l05756"></a><span class="lineno"> 5756</span>&#160; </div>
<div class="line"><a name="l05757"></a><span class="lineno"> 5757</span>&#160; <span class="keywordtype">bool</span> IsBufferImageGranularityConflictPossible(</div>
<div class="line"><a name="l05758"></a><span class="lineno"> 5758</span>&#160; VkDeviceSize bufferImageGranularity,</div>
<div class="line"><a name="l05759"></a><span class="lineno"> 5759</span>&#160; VmaSuballocationType&amp; inOutPrevSuballocType) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05760"></a><span class="lineno"> 5760</span>&#160; </div>
<div class="line"><a name="l05761"></a><span class="lineno"> 5761</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l05762"></a><span class="lineno"> 5762</span>&#160; <span class="keyword">friend</span> <span class="keyword">class </span>VmaDefragmentationAlgorithm_Generic;</div>
<div class="line"><a name="l05763"></a><span class="lineno"> 5763</span>&#160; <span class="keyword">friend</span> <span class="keyword">class </span>VmaDefragmentationAlgorithm_Fast;</div>
<div class="line"><a name="l05764"></a><span class="lineno"> 5764</span>&#160; </div>
<div class="line"><a name="l05765"></a><span class="lineno"> 5765</span>&#160; uint32_t m_FreeCount;</div>
<div class="line"><a name="l05766"></a><span class="lineno"> 5766</span>&#160; VkDeviceSize m_SumFreeSize;</div>
<div class="line"><a name="l05767"></a><span class="lineno"> 5767</span>&#160; VmaSuballocationList m_Suballocations;</div>
<div class="line"><a name="l05768"></a><span class="lineno"> 5768</span>&#160; <span class="comment">// Suballocations that are free and have size greater than certain threshold.</span></div>
<div class="line"><a name="l05769"></a><span class="lineno"> 5769</span>&#160; <span class="comment">// Sorted by size, ascending.</span></div>
<div class="line"><a name="l05770"></a><span class="lineno"> 5770</span>&#160; VmaVector&lt; VmaSuballocationList::iterator, VmaStlAllocator&lt; VmaSuballocationList::iterator &gt; &gt; m_FreeSuballocationsBySize;</div>
<div class="line"><a name="l05771"></a><span class="lineno"> 5771</span>&#160; </div>
<div class="line"><a name="l05772"></a><span class="lineno"> 5772</span>&#160; <span class="keywordtype">bool</span> ValidateFreeSuballocationList() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05773"></a><span class="lineno"> 5773</span>&#160; </div>
<div class="line"><a name="l05774"></a><span class="lineno"> 5774</span>&#160; <span class="comment">// Checks if requested suballocation with given parameters can be placed in given pFreeSuballocItem.</span></div>
<div class="line"><a name="l05775"></a><span class="lineno"> 5775</span>&#160; <span class="comment">// If yes, fills pOffset and returns true. If no, returns false.</span></div>
<div class="line"><a name="l05776"></a><span class="lineno"> 5776</span>&#160; <span class="keywordtype">bool</span> CheckAllocation(</div>
<div class="line"><a name="l05777"></a><span class="lineno"> 5777</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l05778"></a><span class="lineno"> 5778</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l05779"></a><span class="lineno"> 5779</span>&#160; VkDeviceSize bufferImageGranularity,</div>
<div class="line"><a name="l05780"></a><span class="lineno"> 5780</span>&#160; VkDeviceSize allocSize,</div>
<div class="line"><a name="l05781"></a><span class="lineno"> 5781</span>&#160; VkDeviceSize allocAlignment,</div>
<div class="line"><a name="l05782"></a><span class="lineno"> 5782</span>&#160; VmaSuballocationType allocType,</div>
<div class="line"><a name="l05783"></a><span class="lineno"> 5783</span>&#160; VmaSuballocationList::const_iterator suballocItem,</div>
<div class="line"><a name="l05784"></a><span class="lineno"> 5784</span>&#160; <span class="keywordtype">bool</span> canMakeOtherLost,</div>
<div class="line"><a name="l05785"></a><span class="lineno"> 5785</span>&#160; VkDeviceSize* pOffset,</div>
<div class="line"><a name="l05786"></a><span class="lineno"> 5786</span>&#160; <span class="keywordtype">size_t</span>* itemsToMakeLostCount,</div>
<div class="line"><a name="l05787"></a><span class="lineno"> 5787</span>&#160; VkDeviceSize* pSumFreeSize,</div>
<div class="line"><a name="l05788"></a><span class="lineno"> 5788</span>&#160; VkDeviceSize* pSumItemSize) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05789"></a><span class="lineno"> 5789</span>&#160; <span class="comment">// Given free suballocation, it merges it with following one, which must also be free.</span></div>
<div class="line"><a name="l05790"></a><span class="lineno"> 5790</span>&#160; <span class="keywordtype">void</span> MergeFreeWithNext(VmaSuballocationList::iterator item);</div>
<div class="line"><a name="l05791"></a><span class="lineno"> 5791</span>&#160; <span class="comment">// Releases given suballocation, making it free.</span></div>
<div class="line"><a name="l05792"></a><span class="lineno"> 5792</span>&#160; <span class="comment">// Merges it with adjacent free suballocations if applicable.</span></div>
<div class="line"><a name="l05793"></a><span class="lineno"> 5793</span>&#160; <span class="comment">// Returns iterator to new free suballocation at this place.</span></div>
<div class="line"><a name="l05794"></a><span class="lineno"> 5794</span>&#160; VmaSuballocationList::iterator FreeSuballocation(VmaSuballocationList::iterator suballocItem);</div>
<div class="line"><a name="l05795"></a><span class="lineno"> 5795</span>&#160; <span class="comment">// Given free suballocation, it inserts it into sorted list of</span></div>
<div class="line"><a name="l05796"></a><span class="lineno"> 5796</span>&#160; <span class="comment">// m_FreeSuballocationsBySize if it&#39;s suitable.</span></div>
<div class="line"><a name="l05797"></a><span class="lineno"> 5797</span>&#160; <span class="keywordtype">void</span> RegisterFreeSuballocation(VmaSuballocationList::iterator item);</div>
<div class="line"><a name="l05798"></a><span class="lineno"> 5798</span>&#160; <span class="comment">// Given free suballocation, it removes it from sorted list of</span></div>
<div class="line"><a name="l05799"></a><span class="lineno"> 5799</span>&#160; <span class="comment">// m_FreeSuballocationsBySize if it&#39;s suitable.</span></div>
<div class="line"><a name="l05800"></a><span class="lineno"> 5800</span>&#160; <span class="keywordtype">void</span> UnregisterFreeSuballocation(VmaSuballocationList::iterator item);</div>
<div class="line"><a name="l05801"></a><span class="lineno"> 5801</span>&#160;};</div>
<div class="line"><a name="l05802"></a><span class="lineno"> 5802</span>&#160; </div>
<div class="line"><a name="l05803"></a><span class="lineno"> 5803</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l05804"></a><span class="lineno"> 5804</span>&#160;<span class="comment">Allocations and their references in internal data structure look like this:</span></div>
<div class="line"><a name="l05805"></a><span class="lineno"> 5805</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l05806"></a><span class="lineno"> 5806</span>&#160;<span class="comment">if(m_2ndVectorMode == SECOND_VECTOR_EMPTY):</span></div>
<div class="line"><a name="l05807"></a><span class="lineno"> 5807</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l05808"></a><span class="lineno"> 5808</span>&#160;<span class="comment"> 0 +-------+</span></div>
<div class="line"><a name="l05809"></a><span class="lineno"> 5809</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05810"></a><span class="lineno"> 5810</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05811"></a><span class="lineno"> 5811</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05812"></a><span class="lineno"> 5812</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05813"></a><span class="lineno"> 5813</span>&#160;<span class="comment"> | Alloc | 1st[m_1stNullItemsBeginCount]</span></div>
<div class="line"><a name="l05814"></a><span class="lineno"> 5814</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05815"></a><span class="lineno"> 5815</span>&#160;<span class="comment"> | Alloc | 1st[m_1stNullItemsBeginCount + 1]</span></div>
<div class="line"><a name="l05816"></a><span class="lineno"> 5816</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05817"></a><span class="lineno"> 5817</span>&#160;<span class="comment"> | ... |</span></div>
<div class="line"><a name="l05818"></a><span class="lineno"> 5818</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05819"></a><span class="lineno"> 5819</span>&#160;<span class="comment"> | Alloc | 1st[1st.size() - 1]</span></div>
<div class="line"><a name="l05820"></a><span class="lineno"> 5820</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05821"></a><span class="lineno"> 5821</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05822"></a><span class="lineno"> 5822</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05823"></a><span class="lineno"> 5823</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05824"></a><span class="lineno"> 5824</span>&#160;<span class="comment">GetSize() +-------+</span></div>
<div class="line"><a name="l05825"></a><span class="lineno"> 5825</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l05826"></a><span class="lineno"> 5826</span>&#160;<span class="comment">if(m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER):</span></div>
<div class="line"><a name="l05827"></a><span class="lineno"> 5827</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l05828"></a><span class="lineno"> 5828</span>&#160;<span class="comment"> 0 +-------+</span></div>
<div class="line"><a name="l05829"></a><span class="lineno"> 5829</span>&#160;<span class="comment"> | Alloc | 2nd[0]</span></div>
<div class="line"><a name="l05830"></a><span class="lineno"> 5830</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05831"></a><span class="lineno"> 5831</span>&#160;<span class="comment"> | Alloc | 2nd[1]</span></div>
<div class="line"><a name="l05832"></a><span class="lineno"> 5832</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05833"></a><span class="lineno"> 5833</span>&#160;<span class="comment"> | ... |</span></div>
<div class="line"><a name="l05834"></a><span class="lineno"> 5834</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05835"></a><span class="lineno"> 5835</span>&#160;<span class="comment"> | Alloc | 2nd[2nd.size() - 1]</span></div>
<div class="line"><a name="l05836"></a><span class="lineno"> 5836</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05837"></a><span class="lineno"> 5837</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05838"></a><span class="lineno"> 5838</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05839"></a><span class="lineno"> 5839</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05840"></a><span class="lineno"> 5840</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05841"></a><span class="lineno"> 5841</span>&#160;<span class="comment"> | Alloc | 1st[m_1stNullItemsBeginCount]</span></div>
<div class="line"><a name="l05842"></a><span class="lineno"> 5842</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05843"></a><span class="lineno"> 5843</span>&#160;<span class="comment"> | Alloc | 1st[m_1stNullItemsBeginCount + 1]</span></div>
<div class="line"><a name="l05844"></a><span class="lineno"> 5844</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05845"></a><span class="lineno"> 5845</span>&#160;<span class="comment"> | ... |</span></div>
<div class="line"><a name="l05846"></a><span class="lineno"> 5846</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05847"></a><span class="lineno"> 5847</span>&#160;<span class="comment"> | Alloc | 1st[1st.size() - 1]</span></div>
<div class="line"><a name="l05848"></a><span class="lineno"> 5848</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05849"></a><span class="lineno"> 5849</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05850"></a><span class="lineno"> 5850</span>&#160;<span class="comment">GetSize() +-------+</span></div>
<div class="line"><a name="l05851"></a><span class="lineno"> 5851</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l05852"></a><span class="lineno"> 5852</span>&#160;<span class="comment">if(m_2ndVectorMode == SECOND_VECTOR_DOUBLE_STACK):</span></div>
<div class="line"><a name="l05853"></a><span class="lineno"> 5853</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l05854"></a><span class="lineno"> 5854</span>&#160;<span class="comment"> 0 +-------+</span></div>
<div class="line"><a name="l05855"></a><span class="lineno"> 5855</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05856"></a><span class="lineno"> 5856</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05857"></a><span class="lineno"> 5857</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05858"></a><span class="lineno"> 5858</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05859"></a><span class="lineno"> 5859</span>&#160;<span class="comment"> | Alloc | 1st[m_1stNullItemsBeginCount]</span></div>
<div class="line"><a name="l05860"></a><span class="lineno"> 5860</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05861"></a><span class="lineno"> 5861</span>&#160;<span class="comment"> | Alloc | 1st[m_1stNullItemsBeginCount + 1]</span></div>
<div class="line"><a name="l05862"></a><span class="lineno"> 5862</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05863"></a><span class="lineno"> 5863</span>&#160;<span class="comment"> | ... |</span></div>
<div class="line"><a name="l05864"></a><span class="lineno"> 5864</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05865"></a><span class="lineno"> 5865</span>&#160;<span class="comment"> | Alloc | 1st[1st.size() - 1]</span></div>
<div class="line"><a name="l05866"></a><span class="lineno"> 5866</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05867"></a><span class="lineno"> 5867</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05868"></a><span class="lineno"> 5868</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05869"></a><span class="lineno"> 5869</span>&#160;<span class="comment"> | |</span></div>
<div class="line"><a name="l05870"></a><span class="lineno"> 5870</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05871"></a><span class="lineno"> 5871</span>&#160;<span class="comment"> | Alloc | 2nd[2nd.size() - 1]</span></div>
<div class="line"><a name="l05872"></a><span class="lineno"> 5872</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05873"></a><span class="lineno"> 5873</span>&#160;<span class="comment"> | ... |</span></div>
<div class="line"><a name="l05874"></a><span class="lineno"> 5874</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05875"></a><span class="lineno"> 5875</span>&#160;<span class="comment"> | Alloc | 2nd[1]</span></div>
<div class="line"><a name="l05876"></a><span class="lineno"> 5876</span>&#160;<span class="comment"> +-------+</span></div>
<div class="line"><a name="l05877"></a><span class="lineno"> 5877</span>&#160;<span class="comment"> | Alloc | 2nd[0]</span></div>
<div class="line"><a name="l05878"></a><span class="lineno"> 5878</span>&#160;<span class="comment">GetSize() +-------+</span></div>
<div class="line"><a name="l05879"></a><span class="lineno"> 5879</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l05880"></a><span class="lineno"> 5880</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l05881"></a><span class="lineno"> 5881</span>&#160;<span class="keyword">class </span>VmaBlockMetadata_Linear : <span class="keyword">public</span> VmaBlockMetadata</div>
<div class="line"><a name="l05882"></a><span class="lineno"> 5882</span>&#160;{</div>
<div class="line"><a name="l05883"></a><span class="lineno"> 5883</span>&#160; VMA_CLASS_NO_COPY(VmaBlockMetadata_Linear)</div>
<div class="line"><a name="l05884"></a><span class="lineno"> 5884</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l05885"></a><span class="lineno"> 5885</span>&#160; VmaBlockMetadata_Linear(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
<div class="line"><a name="l05886"></a><span class="lineno"> 5886</span>&#160; <span class="keyword">virtual</span> ~VmaBlockMetadata_Linear();</div>
<div class="line"><a name="l05887"></a><span class="lineno"> 5887</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size);</div>
<div class="line"><a name="l05888"></a><span class="lineno"> 5888</span>&#160; </div>
<div class="line"><a name="l05889"></a><span class="lineno"> 5889</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05890"></a><span class="lineno"> 5890</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05891"></a><span class="lineno"> 5891</span>&#160; <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_SumFreeSize; }</div>
<div class="line"><a name="l05892"></a><span class="lineno"> 5892</span>&#160; <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05893"></a><span class="lineno"> 5893</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> GetAllocationCount() == 0; }</div>
<div class="line"><a name="l05894"></a><span class="lineno"> 5894</span>&#160; </div>
<div class="line"><a name="l05895"></a><span class="lineno"> 5895</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05896"></a><span class="lineno"> 5896</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05897"></a><span class="lineno"> 5897</span>&#160; </div>
<div class="line"><a name="l05898"></a><span class="lineno"> 5898</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l05899"></a><span class="lineno"> 5899</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
<div class="line"><a name="l05900"></a><span class="lineno"> 5900</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l05901"></a><span class="lineno"> 5901</span>&#160; </div>
<div class="line"><a name="l05902"></a><span class="lineno"> 5902</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
<div class="line"><a name="l05903"></a><span class="lineno"> 5903</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l05904"></a><span class="lineno"> 5904</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l05905"></a><span class="lineno"> 5905</span>&#160; VkDeviceSize bufferImageGranularity,</div>
<div class="line"><a name="l05906"></a><span class="lineno"> 5906</span>&#160; VkDeviceSize allocSize,</div>
<div class="line"><a name="l05907"></a><span class="lineno"> 5907</span>&#160; VkDeviceSize allocAlignment,</div>
<div class="line"><a name="l05908"></a><span class="lineno"> 5908</span>&#160; <span class="keywordtype">bool</span> upperAddress,</div>
<div class="line"><a name="l05909"></a><span class="lineno"> 5909</span>&#160; VmaSuballocationType allocType,</div>
<div class="line"><a name="l05910"></a><span class="lineno"> 5910</span>&#160; <span class="keywordtype">bool</span> canMakeOtherLost,</div>
<div class="line"><a name="l05911"></a><span class="lineno"> 5911</span>&#160; uint32_t strategy,</div>
<div class="line"><a name="l05912"></a><span class="lineno"> 5912</span>&#160; VmaAllocationRequest* pAllocationRequest);</div>
<div class="line"><a name="l05913"></a><span class="lineno"> 5913</span>&#160; </div>
<div class="line"><a name="l05914"></a><span class="lineno"> 5914</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
<div class="line"><a name="l05915"></a><span class="lineno"> 5915</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l05916"></a><span class="lineno"> 5916</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l05917"></a><span class="lineno"> 5917</span>&#160; VmaAllocationRequest* pAllocationRequest);</div>
<div class="line"><a name="l05918"></a><span class="lineno"> 5918</span>&#160; </div>
<div class="line"><a name="l05919"></a><span class="lineno"> 5919</span>&#160; <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
<div class="line"><a name="l05920"></a><span class="lineno"> 5920</span>&#160; </div>
<div class="line"><a name="l05921"></a><span class="lineno"> 5921</span>&#160; <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData);</div>
<div class="line"><a name="l05922"></a><span class="lineno"> 5922</span>&#160; </div>
<div class="line"><a name="l05923"></a><span class="lineno"> 5923</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
<div class="line"><a name="l05924"></a><span class="lineno"> 5924</span>&#160; <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
<div class="line"><a name="l05925"></a><span class="lineno"> 5925</span>&#160; VmaSuballocationType type,</div>
<div class="line"><a name="l05926"></a><span class="lineno"> 5926</span>&#160; VkDeviceSize allocSize,</div>
<div class="line"><a name="l05927"></a><span class="lineno"> 5927</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
<div class="line"><a name="l05928"></a><span class="lineno"> 5928</span>&#160; </div>
<div class="line"><a name="l05929"></a><span class="lineno"> 5929</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l05930"></a><span class="lineno"> 5930</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset);</div>
<div class="line"><a name="l05931"></a><span class="lineno"> 5931</span>&#160; </div>
<div class="line"><a name="l05932"></a><span class="lineno"> 5932</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l05933"></a><span class="lineno"> 5933</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l05934"></a><span class="lineno"> 5934</span>&#160;<span class="comment"> There are two suballocation vectors, used in ping-pong way.</span></div>
<div class="line"><a name="l05935"></a><span class="lineno"> 5935</span>&#160;<span class="comment"> The one with index m_1stVectorIndex is called 1st.</span></div>
<div class="line"><a name="l05936"></a><span class="lineno"> 5936</span>&#160;<span class="comment"> The one with index (m_1stVectorIndex ^ 1) is called 2nd.</span></div>
<div class="line"><a name="l05937"></a><span class="lineno"> 5937</span>&#160;<span class="comment"> 2nd can be non-empty only when 1st is not empty.</span></div>
<div class="line"><a name="l05938"></a><span class="lineno"> 5938</span>&#160;<span class="comment"> When 2nd is not empty, m_2ndVectorMode indicates its mode of operation.</span></div>
<div class="line"><a name="l05939"></a><span class="lineno"> 5939</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l05940"></a><span class="lineno"> 5940</span>&#160; <span class="keyword">typedef</span> VmaVector&lt; VmaSuballocation, VmaStlAllocator&lt;VmaSuballocation&gt; &gt; SuballocationVectorType;</div>
<div class="line"><a name="l05941"></a><span class="lineno"> 5941</span>&#160; </div>
<div class="line"><a name="l05942"></a><span class="lineno"> 5942</span>&#160; <span class="keyword">enum</span> SECOND_VECTOR_MODE</div>
<div class="line"><a name="l05943"></a><span class="lineno"> 5943</span>&#160; {</div>
<div class="line"><a name="l05944"></a><span class="lineno"> 5944</span>&#160; SECOND_VECTOR_EMPTY,</div>
<div class="line"><a name="l05945"></a><span class="lineno"> 5945</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l05946"></a><span class="lineno"> 5946</span>&#160;<span class="comment"> Suballocations in 2nd vector are created later than the ones in 1st, but they</span></div>
<div class="line"><a name="l05947"></a><span class="lineno"> 5947</span>&#160;<span class="comment"> all have smaller offset.</span></div>
<div class="line"><a name="l05948"></a><span class="lineno"> 5948</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l05949"></a><span class="lineno"> 5949</span>&#160; SECOND_VECTOR_RING_BUFFER,</div>
<div class="line"><a name="l05950"></a><span class="lineno"> 5950</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l05951"></a><span class="lineno"> 5951</span>&#160;<span class="comment"> Suballocations in 2nd vector are upper side of double stack.</span></div>
<div class="line"><a name="l05952"></a><span class="lineno"> 5952</span>&#160;<span class="comment"> They all have offsets higher than those in 1st vector.</span></div>
<div class="line"><a name="l05953"></a><span class="lineno"> 5953</span>&#160;<span class="comment"> Top of this stack means smaller offsets, but higher indices in this vector.</span></div>
<div class="line"><a name="l05954"></a><span class="lineno"> 5954</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l05955"></a><span class="lineno"> 5955</span>&#160; SECOND_VECTOR_DOUBLE_STACK,</div>
<div class="line"><a name="l05956"></a><span class="lineno"> 5956</span>&#160; };</div>
<div class="line"><a name="l05957"></a><span class="lineno"> 5957</span>&#160; </div>
<div class="line"><a name="l05958"></a><span class="lineno"> 5958</span>&#160; VkDeviceSize m_SumFreeSize;</div>
<div class="line"><a name="l05959"></a><span class="lineno"> 5959</span>&#160; SuballocationVectorType m_Suballocations0, m_Suballocations1;</div>
<div class="line"><a name="l05960"></a><span class="lineno"> 5960</span>&#160; uint32_t m_1stVectorIndex;</div>
<div class="line"><a name="l05961"></a><span class="lineno"> 5961</span>&#160; SECOND_VECTOR_MODE m_2ndVectorMode;</div>
<div class="line"><a name="l05962"></a><span class="lineno"> 5962</span>&#160; </div>
<div class="line"><a name="l05963"></a><span class="lineno"> 5963</span>&#160; SuballocationVectorType&amp; AccessSuballocations1st() { <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations1 : m_Suballocations0; }</div>
<div class="line"><a name="l05964"></a><span class="lineno"> 5964</span>&#160; SuballocationVectorType&amp; AccessSuballocations2nd() { <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations0 : m_Suballocations1; }</div>
<div class="line"><a name="l05965"></a><span class="lineno"> 5965</span>&#160; <span class="keyword">const</span> SuballocationVectorType&amp; AccessSuballocations1st()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations1 : m_Suballocations0; }</div>
<div class="line"><a name="l05966"></a><span class="lineno"> 5966</span>&#160; <span class="keyword">const</span> SuballocationVectorType&amp; AccessSuballocations2nd()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_1stVectorIndex ? m_Suballocations0 : m_Suballocations1; }</div>
<div class="line"><a name="l05967"></a><span class="lineno"> 5967</span>&#160; </div>
<div class="line"><a name="l05968"></a><span class="lineno"> 5968</span>&#160; <span class="comment">// Number of items in 1st vector with hAllocation = null at the beginning.</span></div>
<div class="line"><a name="l05969"></a><span class="lineno"> 5969</span>&#160; <span class="keywordtype">size_t</span> m_1stNullItemsBeginCount;</div>
<div class="line"><a name="l05970"></a><span class="lineno"> 5970</span>&#160; <span class="comment">// Number of other items in 1st vector with hAllocation = null somewhere in the middle.</span></div>
<div class="line"><a name="l05971"></a><span class="lineno"> 5971</span>&#160; <span class="keywordtype">size_t</span> m_1stNullItemsMiddleCount;</div>
<div class="line"><a name="l05972"></a><span class="lineno"> 5972</span>&#160; <span class="comment">// Number of items in 2nd vector with hAllocation = null.</span></div>
<div class="line"><a name="l05973"></a><span class="lineno"> 5973</span>&#160; <span class="keywordtype">size_t</span> m_2ndNullItemsCount;</div>
<div class="line"><a name="l05974"></a><span class="lineno"> 5974</span>&#160; </div>
<div class="line"><a name="l05975"></a><span class="lineno"> 5975</span>&#160; <span class="keywordtype">bool</span> ShouldCompact1st() <span class="keyword">const</span>;</div>
<div class="line"><a name="l05976"></a><span class="lineno"> 5976</span>&#160; <span class="keywordtype">void</span> CleanupAfterFree();</div>
<div class="line"><a name="l05977"></a><span class="lineno"> 5977</span>&#160; </div>
<div class="line"><a name="l05978"></a><span class="lineno"> 5978</span>&#160; <span class="keywordtype">bool</span> CreateAllocationRequest_LowerAddress(</div>
<div class="line"><a name="l05979"></a><span class="lineno"> 5979</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l05980"></a><span class="lineno"> 5980</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l05981"></a><span class="lineno"> 5981</span>&#160; VkDeviceSize bufferImageGranularity,</div>
<div class="line"><a name="l05982"></a><span class="lineno"> 5982</span>&#160; VkDeviceSize allocSize,</div>
<div class="line"><a name="l05983"></a><span class="lineno"> 5983</span>&#160; VkDeviceSize allocAlignment,</div>
<div class="line"><a name="l05984"></a><span class="lineno"> 5984</span>&#160; VmaSuballocationType allocType,</div>
<div class="line"><a name="l05985"></a><span class="lineno"> 5985</span>&#160; <span class="keywordtype">bool</span> canMakeOtherLost,</div>
<div class="line"><a name="l05986"></a><span class="lineno"> 5986</span>&#160; uint32_t strategy,</div>
<div class="line"><a name="l05987"></a><span class="lineno"> 5987</span>&#160; VmaAllocationRequest* pAllocationRequest);</div>
<div class="line"><a name="l05988"></a><span class="lineno"> 5988</span>&#160; <span class="keywordtype">bool</span> CreateAllocationRequest_UpperAddress(</div>
<div class="line"><a name="l05989"></a><span class="lineno"> 5989</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l05990"></a><span class="lineno"> 5990</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l05991"></a><span class="lineno"> 5991</span>&#160; VkDeviceSize bufferImageGranularity,</div>
<div class="line"><a name="l05992"></a><span class="lineno"> 5992</span>&#160; VkDeviceSize allocSize,</div>
<div class="line"><a name="l05993"></a><span class="lineno"> 5993</span>&#160; VkDeviceSize allocAlignment,</div>
<div class="line"><a name="l05994"></a><span class="lineno"> 5994</span>&#160; VmaSuballocationType allocType,</div>
<div class="line"><a name="l05995"></a><span class="lineno"> 5995</span>&#160; <span class="keywordtype">bool</span> canMakeOtherLost,</div>
<div class="line"><a name="l05996"></a><span class="lineno"> 5996</span>&#160; uint32_t strategy,</div>
<div class="line"><a name="l05997"></a><span class="lineno"> 5997</span>&#160; VmaAllocationRequest* pAllocationRequest);</div>
<div class="line"><a name="l05998"></a><span class="lineno"> 5998</span>&#160;};</div>
<div class="line"><a name="l05999"></a><span class="lineno"> 5999</span>&#160; </div>
<div class="line"><a name="l06000"></a><span class="lineno"> 6000</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l06001"></a><span class="lineno"> 6001</span>&#160;<span class="comment">- GetSize() is the original size of allocated memory block.</span></div>
<div class="line"><a name="l06002"></a><span class="lineno"> 6002</span>&#160;<span class="comment">- m_UsableSize is this size aligned down to a power of two.</span></div>
<div class="line"><a name="l06003"></a><span class="lineno"> 6003</span>&#160;<span class="comment"> All allocations and calculations happen relative to m_UsableSize.</span></div>
<div class="line"><a name="l06004"></a><span class="lineno"> 6004</span>&#160;<span class="comment">- GetUnusableSize() is the difference between them.</span></div>
<div class="line"><a name="l06005"></a><span class="lineno"> 6005</span>&#160;<span class="comment"> It is repoted as separate, unused range, not available for allocations.</span></div>
<div class="line"><a name="l06006"></a><span class="lineno"> 6006</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l06007"></a><span class="lineno"> 6007</span>&#160;<span class="comment">Node at level 0 has size = m_UsableSize.</span></div>
<div class="line"><a name="l06008"></a><span class="lineno"> 6008</span>&#160;<span class="comment">Each next level contains nodes with size 2 times smaller than current level.</span></div>
<div class="line"><a name="l06009"></a><span class="lineno"> 6009</span>&#160;<span class="comment">m_LevelCount is the maximum number of levels to use in the current object.</span></div>
<div class="line"><a name="l06010"></a><span class="lineno"> 6010</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l06011"></a><span class="lineno"> 6011</span>&#160;<span class="keyword">class </span>VmaBlockMetadata_Buddy : <span class="keyword">public</span> VmaBlockMetadata</div>
<div class="line"><a name="l06012"></a><span class="lineno"> 6012</span>&#160;{</div>
<div class="line"><a name="l06013"></a><span class="lineno"> 6013</span>&#160; VMA_CLASS_NO_COPY(VmaBlockMetadata_Buddy)</div>
<div class="line"><a name="l06014"></a><span class="lineno"> 6014</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l06015"></a><span class="lineno"> 6015</span>&#160; VmaBlockMetadata_Buddy(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
<div class="line"><a name="l06016"></a><span class="lineno"> 6016</span>&#160; <span class="keyword">virtual</span> ~VmaBlockMetadata_Buddy();</div>
<div class="line"><a name="l06017"></a><span class="lineno"> 6017</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Init(VkDeviceSize size);</div>
<div class="line"><a name="l06018"></a><span class="lineno"> 6018</span>&#160; </div>
<div class="line"><a name="l06019"></a><span class="lineno"> 6019</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
<div class="line"><a name="l06020"></a><span class="lineno"> 6020</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetAllocationCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_AllocationCount; }</div>
<div class="line"><a name="l06021"></a><span class="lineno"> 6021</span>&#160; <span class="keyword">virtual</span> VkDeviceSize GetSumFreeSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_SumFreeSize + GetUnusableSize(); }</div>
<div class="line"><a name="l06022"></a><span class="lineno"> 6022</span>&#160; <span class="keyword">virtual</span> VkDeviceSize GetUnusedRangeSizeMax() <span class="keyword">const</span>;</div>
<div class="line"><a name="l06023"></a><span class="lineno"> 6023</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsEmpty()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Root-&gt;type == Node::TYPE_FREE; }</div>
<div class="line"><a name="l06024"></a><span class="lineno"> 6024</span>&#160; </div>
<div class="line"><a name="l06025"></a><span class="lineno"> 6025</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalcAllocationStatInfo(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo) <span class="keyword">const</span>;</div>
<div class="line"><a name="l06026"></a><span class="lineno"> 6026</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>&amp; inoutStats) <span class="keyword">const</span>;</div>
<div class="line"><a name="l06027"></a><span class="lineno"> 6027</span>&#160; </div>
<div class="line"><a name="l06028"></a><span class="lineno"> 6028</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l06029"></a><span class="lineno"> 6029</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json) <span class="keyword">const</span>;</div>
<div class="line"><a name="l06030"></a><span class="lineno"> 6030</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l06031"></a><span class="lineno"> 6031</span>&#160; </div>
<div class="line"><a name="l06032"></a><span class="lineno"> 6032</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CreateAllocationRequest(</div>
<div class="line"><a name="l06033"></a><span class="lineno"> 6033</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l06034"></a><span class="lineno"> 6034</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l06035"></a><span class="lineno"> 6035</span>&#160; VkDeviceSize bufferImageGranularity,</div>
<div class="line"><a name="l06036"></a><span class="lineno"> 6036</span>&#160; VkDeviceSize allocSize,</div>
<div class="line"><a name="l06037"></a><span class="lineno"> 6037</span>&#160; VkDeviceSize allocAlignment,</div>
<div class="line"><a name="l06038"></a><span class="lineno"> 6038</span>&#160; <span class="keywordtype">bool</span> upperAddress,</div>
<div class="line"><a name="l06039"></a><span class="lineno"> 6039</span>&#160; VmaSuballocationType allocType,</div>
<div class="line"><a name="l06040"></a><span class="lineno"> 6040</span>&#160; <span class="keywordtype">bool</span> canMakeOtherLost,</div>
<div class="line"><a name="l06041"></a><span class="lineno"> 6041</span>&#160; uint32_t strategy,</div>
<div class="line"><a name="l06042"></a><span class="lineno"> 6042</span>&#160; VmaAllocationRequest* pAllocationRequest);</div>
<div class="line"><a name="l06043"></a><span class="lineno"> 6043</span>&#160; </div>
<div class="line"><a name="l06044"></a><span class="lineno"> 6044</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> MakeRequestedAllocationsLost(</div>
<div class="line"><a name="l06045"></a><span class="lineno"> 6045</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l06046"></a><span class="lineno"> 6046</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l06047"></a><span class="lineno"> 6047</span>&#160; VmaAllocationRequest* pAllocationRequest);</div>
<div class="line"><a name="l06048"></a><span class="lineno"> 6048</span>&#160; </div>
<div class="line"><a name="l06049"></a><span class="lineno"> 6049</span>&#160; <span class="keyword">virtual</span> uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);</div>
<div class="line"><a name="l06050"></a><span class="lineno"> 6050</span>&#160; </div>
<div class="line"><a name="l06051"></a><span class="lineno"> 6051</span>&#160; <span class="keyword">virtual</span> VkResult CheckCorruption(<span class="keyword">const</span> <span class="keywordtype">void</span>* pBlockData) { <span class="keywordflow">return</span> VK_ERROR_FEATURE_NOT_PRESENT; }</div>
<div class="line"><a name="l06052"></a><span class="lineno"> 6052</span>&#160; </div>
<div class="line"><a name="l06053"></a><span class="lineno"> 6053</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Alloc(</div>
<div class="line"><a name="l06054"></a><span class="lineno"> 6054</span>&#160; <span class="keyword">const</span> VmaAllocationRequest&amp; request,</div>
<div class="line"><a name="l06055"></a><span class="lineno"> 6055</span>&#160; VmaSuballocationType type,</div>
<div class="line"><a name="l06056"></a><span class="lineno"> 6056</span>&#160; VkDeviceSize allocSize,</div>
<div class="line"><a name="l06057"></a><span class="lineno"> 6057</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
<div class="line"><a name="l06058"></a><span class="lineno"> 6058</span>&#160; </div>
<div class="line"><a name="l06059"></a><span class="lineno"> 6059</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation) { FreeAtOffset(allocation, allocation-&gt;GetOffset()); }</div>
<div class="line"><a name="l06060"></a><span class="lineno"> 6060</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> FreeAtOffset(VkDeviceSize offset) { FreeAtOffset(VMA_NULL, offset); }</div>
<div class="line"><a name="l06061"></a><span class="lineno"> 6061</span>&#160; </div>
<div class="line"><a name="l06062"></a><span class="lineno"> 6062</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l06063"></a><span class="lineno"> 6063</span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> VkDeviceSize MIN_NODE_SIZE = 32;</div>
<div class="line"><a name="l06064"></a><span class="lineno"> 6064</span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> MAX_LEVELS = 30;</div>
<div class="line"><a name="l06065"></a><span class="lineno"> 6065</span>&#160; </div>
<div class="line"><a name="l06066"></a><span class="lineno"> 6066</span>&#160; <span class="keyword">struct </span>ValidationContext</div>
<div class="line"><a name="l06067"></a><span class="lineno"> 6067</span>&#160; {</div>
<div class="line"><a name="l06068"></a><span class="lineno"> 6068</span>&#160; <span class="keywordtype">size_t</span> calculatedAllocationCount;</div>
<div class="line"><a name="l06069"></a><span class="lineno"> 6069</span>&#160; <span class="keywordtype">size_t</span> calculatedFreeCount;</div>
<div class="line"><a name="l06070"></a><span class="lineno"> 6070</span>&#160; VkDeviceSize calculatedSumFreeSize;</div>
<div class="line"><a name="l06071"></a><span class="lineno"> 6071</span>&#160; </div>
<div class="line"><a name="l06072"></a><span class="lineno"> 6072</span>&#160; ValidationContext() :</div>
<div class="line"><a name="l06073"></a><span class="lineno"> 6073</span>&#160; calculatedAllocationCount(0),</div>
<div class="line"><a name="l06074"></a><span class="lineno"> 6074</span>&#160; calculatedFreeCount(0),</div>
<div class="line"><a name="l06075"></a><span class="lineno"> 6075</span>&#160; calculatedSumFreeSize(0) { }</div>
<div class="line"><a name="l06076"></a><span class="lineno"> 6076</span>&#160; };</div>
<div class="line"><a name="l06077"></a><span class="lineno"> 6077</span>&#160; </div>
<div class="line"><a name="l06078"></a><span class="lineno"> 6078</span>&#160; <span class="keyword">struct </span>Node</div>
<div class="line"><a name="l06079"></a><span class="lineno"> 6079</span>&#160; {</div>
<div class="line"><a name="l06080"></a><span class="lineno"> 6080</span>&#160; VkDeviceSize offset;</div>
<div class="line"><a name="l06081"></a><span class="lineno"> 6081</span>&#160; <span class="keyword">enum</span> TYPE</div>
<div class="line"><a name="l06082"></a><span class="lineno"> 6082</span>&#160; {</div>
<div class="line"><a name="l06083"></a><span class="lineno"> 6083</span>&#160; TYPE_FREE,</div>
<div class="line"><a name="l06084"></a><span class="lineno"> 6084</span>&#160; TYPE_ALLOCATION,</div>
<div class="line"><a name="l06085"></a><span class="lineno"> 6085</span>&#160; TYPE_SPLIT,</div>
<div class="line"><a name="l06086"></a><span class="lineno"> 6086</span>&#160; TYPE_COUNT</div>
<div class="line"><a name="l06087"></a><span class="lineno"> 6087</span>&#160; } type;</div>
<div class="line"><a name="l06088"></a><span class="lineno"> 6088</span>&#160; Node* parent;</div>
<div class="line"><a name="l06089"></a><span class="lineno"> 6089</span>&#160; Node* buddy;</div>
<div class="line"><a name="l06090"></a><span class="lineno"> 6090</span>&#160; </div>
<div class="line"><a name="l06091"></a><span class="lineno"> 6091</span>&#160; <span class="keyword">union</span></div>
<div class="line"><a name="l06092"></a><span class="lineno"> 6092</span>&#160; {</div>
<div class="line"><a name="l06093"></a><span class="lineno"> 6093</span>&#160; <span class="keyword">struct</span></div>
<div class="line"><a name="l06094"></a><span class="lineno"> 6094</span>&#160; {</div>
<div class="line"><a name="l06095"></a><span class="lineno"> 6095</span>&#160; Node* prev;</div>
<div class="line"><a name="l06096"></a><span class="lineno"> 6096</span>&#160; Node* next;</div>
<div class="line"><a name="l06097"></a><span class="lineno"> 6097</span>&#160; } free;</div>
<div class="line"><a name="l06098"></a><span class="lineno"> 6098</span>&#160; <span class="keyword">struct</span></div>
<div class="line"><a name="l06099"></a><span class="lineno"> 6099</span>&#160; {</div>
<div class="line"><a name="l06100"></a><span class="lineno"> 6100</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc;</div>
<div class="line"><a name="l06101"></a><span class="lineno"> 6101</span>&#160; } allocation;</div>
<div class="line"><a name="l06102"></a><span class="lineno"> 6102</span>&#160; <span class="keyword">struct</span></div>
<div class="line"><a name="l06103"></a><span class="lineno"> 6103</span>&#160; {</div>
<div class="line"><a name="l06104"></a><span class="lineno"> 6104</span>&#160; Node* leftChild;</div>
<div class="line"><a name="l06105"></a><span class="lineno"> 6105</span>&#160; } split;</div>
<div class="line"><a name="l06106"></a><span class="lineno"> 6106</span>&#160; };</div>
<div class="line"><a name="l06107"></a><span class="lineno"> 6107</span>&#160; };</div>
<div class="line"><a name="l06108"></a><span class="lineno"> 6108</span>&#160; </div>
<div class="line"><a name="l06109"></a><span class="lineno"> 6109</span>&#160; <span class="comment">// Size of the memory block aligned down to a power of two.</span></div>
<div class="line"><a name="l06110"></a><span class="lineno"> 6110</span>&#160; VkDeviceSize m_UsableSize;</div>
<div class="line"><a name="l06111"></a><span class="lineno"> 6111</span>&#160; uint32_t m_LevelCount;</div>
<div class="line"><a name="l06112"></a><span class="lineno"> 6112</span>&#160; </div>
<div class="line"><a name="l06113"></a><span class="lineno"> 6113</span>&#160; Node* m_Root;</div>
<div class="line"><a name="l06114"></a><span class="lineno"> 6114</span>&#160; <span class="keyword">struct </span>{</div>
<div class="line"><a name="l06115"></a><span class="lineno"> 6115</span>&#160; Node* front;</div>
<div class="line"><a name="l06116"></a><span class="lineno"> 6116</span>&#160; Node* back;</div>
<div class="line"><a name="l06117"></a><span class="lineno"> 6117</span>&#160; } m_FreeList[MAX_LEVELS];</div>
<div class="line"><a name="l06118"></a><span class="lineno"> 6118</span>&#160; <span class="comment">// Number of nodes in the tree with type == TYPE_ALLOCATION.</span></div>
<div class="line"><a name="l06119"></a><span class="lineno"> 6119</span>&#160; <span class="keywordtype">size_t</span> m_AllocationCount;</div>
<div class="line"><a name="l06120"></a><span class="lineno"> 6120</span>&#160; <span class="comment">// Number of nodes in the tree with type == TYPE_FREE.</span></div>
<div class="line"><a name="l06121"></a><span class="lineno"> 6121</span>&#160; <span class="keywordtype">size_t</span> m_FreeCount;</div>
<div class="line"><a name="l06122"></a><span class="lineno"> 6122</span>&#160; <span class="comment">// This includes space wasted due to internal fragmentation. Doesn&#39;t include unusable size.</span></div>
<div class="line"><a name="l06123"></a><span class="lineno"> 6123</span>&#160; VkDeviceSize m_SumFreeSize;</div>
<div class="line"><a name="l06124"></a><span class="lineno"> 6124</span>&#160; </div>
<div class="line"><a name="l06125"></a><span class="lineno"> 6125</span>&#160; VkDeviceSize GetUnusableSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> GetSize() - m_UsableSize; }</div>
<div class="line"><a name="l06126"></a><span class="lineno"> 6126</span>&#160; <span class="keywordtype">void</span> DeleteNode(Node* node);</div>
<div class="line"><a name="l06127"></a><span class="lineno"> 6127</span>&#160; <span class="keywordtype">bool</span> ValidateNode(ValidationContext&amp; ctx, <span class="keyword">const</span> Node* parent, <span class="keyword">const</span> Node* curr, uint32_t level, VkDeviceSize levelNodeSize) <span class="keyword">const</span>;</div>
<div class="line"><a name="l06128"></a><span class="lineno"> 6128</span>&#160; uint32_t AllocSizeToLevel(VkDeviceSize allocSize) <span class="keyword">const</span>;</div>
<div class="line"><a name="l06129"></a><span class="lineno"> 6129</span>&#160; <span class="keyword">inline</span> VkDeviceSize LevelToNodeSize(uint32_t level)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_UsableSize &gt;&gt; level; }</div>
<div class="line"><a name="l06130"></a><span class="lineno"> 6130</span>&#160; <span class="comment">// Alloc passed just for validation. Can be null.</span></div>
<div class="line"><a name="l06131"></a><span class="lineno"> 6131</span>&#160; <span class="keywordtype">void</span> FreeAtOffset(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc, VkDeviceSize offset);</div>
<div class="line"><a name="l06132"></a><span class="lineno"> 6132</span>&#160; <span class="keywordtype">void</span> CalcAllocationStatInfoNode(<a class="code" href="struct_vma_stat_info.html">VmaStatInfo</a>&amp; outInfo, <span class="keyword">const</span> Node* node, VkDeviceSize levelNodeSize) <span class="keyword">const</span>;</div>
<div class="line"><a name="l06133"></a><span class="lineno"> 6133</span>&#160; <span class="comment">// Adds node to the front of FreeList at given level.</span></div>
<div class="line"><a name="l06134"></a><span class="lineno"> 6134</span>&#160; <span class="comment">// node-&gt;type must be FREE.</span></div>
<div class="line"><a name="l06135"></a><span class="lineno"> 6135</span>&#160; <span class="comment">// node-&gt;free.prev, next can be undefined.</span></div>
<div class="line"><a name="l06136"></a><span class="lineno"> 6136</span>&#160; <span class="keywordtype">void</span> AddToFreeListFront(uint32_t level, Node* node);</div>
<div class="line"><a name="l06137"></a><span class="lineno"> 6137</span>&#160; <span class="comment">// Removes node from FreeList at given level.</span></div>
<div class="line"><a name="l06138"></a><span class="lineno"> 6138</span>&#160; <span class="comment">// node-&gt;type must be FREE.</span></div>
<div class="line"><a name="l06139"></a><span class="lineno"> 6139</span>&#160; <span class="comment">// node-&gt;free.prev, next stay untouched.</span></div>
<div class="line"><a name="l06140"></a><span class="lineno"> 6140</span>&#160; <span class="keywordtype">void</span> RemoveFromFreeList(uint32_t level, Node* node);</div>
<div class="line"><a name="l06141"></a><span class="lineno"> 6141</span>&#160; </div>
<div class="line"><a name="l06142"></a><span class="lineno"> 6142</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l06143"></a><span class="lineno"> 6143</span>&#160; <span class="keywordtype">void</span> PrintDetailedMapNode(<span class="keyword">class</span> VmaJsonWriter&amp; json, <span class="keyword">const</span> Node* node, VkDeviceSize levelNodeSize) <span class="keyword">const</span>;</div>
<div class="line"><a name="l06144"></a><span class="lineno"> 6144</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l06145"></a><span class="lineno"> 6145</span>&#160;};</div>
<div class="line"><a name="l06146"></a><span class="lineno"> 6146</span>&#160; </div>
<div class="line"><a name="l06147"></a><span class="lineno"> 6147</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l06148"></a><span class="lineno"> 6148</span>&#160;<span class="comment">Represents a single block of device memory (`VkDeviceMemory`) with all the</span></div>
<div class="line"><a name="l06149"></a><span class="lineno"> 6149</span>&#160;<span class="comment">data about its regions (aka suballocations, #VmaAllocation), assigned and free.</span></div>
<div class="line"><a name="l06150"></a><span class="lineno"> 6150</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l06151"></a><span class="lineno"> 6151</span>&#160;<span class="comment">Thread-safety: This class must be externally synchronized.</span></div>
<div class="line"><a name="l06152"></a><span class="lineno"> 6152</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l06153"></a><span class="lineno"> 6153</span>&#160;<span class="keyword">class </span>VmaDeviceMemoryBlock</div>
<div class="line"><a name="l06154"></a><span class="lineno"> 6154</span>&#160;{</div>
<div class="line"><a name="l06155"></a><span class="lineno"> 6155</span>&#160; VMA_CLASS_NO_COPY(VmaDeviceMemoryBlock)</div>
<div class="line"><a name="l06156"></a><span class="lineno"> 6156</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l06157"></a><span class="lineno"> 6157</span>&#160; VmaBlockMetadata* m_pMetadata;</div>
<div class="line"><a name="l06158"></a><span class="lineno"> 6158</span>&#160; </div>
<div class="line"><a name="l06159"></a><span class="lineno"> 6159</span>&#160; VmaDeviceMemoryBlock(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
<div class="line"><a name="l06160"></a><span class="lineno"> 6160</span>&#160; </div>
<div class="line"><a name="l06161"></a><span class="lineno"> 6161</span>&#160; ~VmaDeviceMemoryBlock()</div>
<div class="line"><a name="l06162"></a><span class="lineno"> 6162</span>&#160; {</div>
<div class="line"><a name="l06163"></a><span class="lineno"> 6163</span>&#160; VMA_ASSERT(m_MapCount == 0 &amp;&amp; <span class="stringliteral">&quot;VkDeviceMemory block is being destroyed while it is still mapped.&quot;</span>);</div>
<div class="line"><a name="l06164"></a><span class="lineno"> 6164</span>&#160; VMA_ASSERT(m_hMemory == VK_NULL_HANDLE);</div>
<div class="line"><a name="l06165"></a><span class="lineno"> 6165</span>&#160; }</div>
<div class="line"><a name="l06166"></a><span class="lineno"> 6166</span>&#160; </div>
<div class="line"><a name="l06167"></a><span class="lineno"> 6167</span>&#160; <span class="comment">// Always call after construction.</span></div>
<div class="line"><a name="l06168"></a><span class="lineno"> 6168</span>&#160; <span class="keywordtype">void</span> Init(</div>
<div class="line"><a name="l06169"></a><span class="lineno"> 6169</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
<div class="line"><a name="l06170"></a><span class="lineno"> 6170</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> hParentPool,</div>
<div class="line"><a name="l06171"></a><span class="lineno"> 6171</span>&#160; uint32_t newMemoryTypeIndex,</div>
<div class="line"><a name="l06172"></a><span class="lineno"> 6172</span>&#160; VkDeviceMemory newMemory,</div>
<div class="line"><a name="l06173"></a><span class="lineno"> 6173</span>&#160; VkDeviceSize newSize,</div>
<div class="line"><a name="l06174"></a><span class="lineno"> 6174</span>&#160; uint32_t <span class="keywordtype">id</span>,</div>
<div class="line"><a name="l06175"></a><span class="lineno"> 6175</span>&#160; uint32_t algorithm);</div>
<div class="line"><a name="l06176"></a><span class="lineno"> 6176</span>&#160; <span class="comment">// Always call before destruction.</span></div>
<div class="line"><a name="l06177"></a><span class="lineno"> 6177</span>&#160; <span class="keywordtype">void</span> Destroy(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> allocator);</div>
<div class="line"><a name="l06178"></a><span class="lineno"> 6178</span>&#160; </div>
<div class="line"><a name="l06179"></a><span class="lineno"> 6179</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> GetParentPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hParentPool; }</div>
<div class="line"><a name="l06180"></a><span class="lineno"> 6180</span>&#160; VkDeviceMemory GetDeviceMemory()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hMemory; }</div>
<div class="line"><a name="l06181"></a><span class="lineno"> 6181</span>&#160; uint32_t GetMemoryTypeIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemoryTypeIndex; }</div>
<div class="line"><a name="l06182"></a><span class="lineno"> 6182</span>&#160; uint32_t GetId()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Id; }</div>
<div class="line"><a name="l06183"></a><span class="lineno"> 6183</span>&#160; <span class="keywordtype">void</span>* GetMappedData()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pMappedData; }</div>
<div class="line"><a name="l06184"></a><span class="lineno"> 6184</span>&#160; </div>
<div class="line"><a name="l06185"></a><span class="lineno"> 6185</span>&#160; <span class="comment">// Validates all data structures inside this object. If not valid, returns false.</span></div>
<div class="line"><a name="l06186"></a><span class="lineno"> 6186</span>&#160; <span class="keywordtype">bool</span> Validate() <span class="keyword">const</span>;</div>
<div class="line"><a name="l06187"></a><span class="lineno"> 6187</span>&#160; </div>
<div class="line"><a name="l06188"></a><span class="lineno"> 6188</span>&#160; VkResult CheckCorruption(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator);</div>
<div class="line"><a name="l06189"></a><span class="lineno"> 6189</span>&#160; </div>
<div class="line"><a name="l06190"></a><span class="lineno"> 6190</span>&#160; <span class="comment">// ppData can be null.</span></div>
<div class="line"><a name="l06191"></a><span class="lineno"> 6191</span>&#160; VkResult Map(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, uint32_t count, <span class="keywordtype">void</span>** ppData);</div>
<div class="line"><a name="l06192"></a><span class="lineno"> 6192</span>&#160; <span class="keywordtype">void</span> Unmap(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, uint32_t count);</div>
<div class="line"><a name="l06193"></a><span class="lineno"> 6193</span>&#160; </div>
<div class="line"><a name="l06194"></a><span class="lineno"> 6194</span>&#160; VkResult WriteMagicValueAroundAllocation(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize);</div>
<div class="line"><a name="l06195"></a><span class="lineno"> 6195</span>&#160; VkResult ValidateMagicValueAroundAllocation(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, VkDeviceSize allocOffset, VkDeviceSize allocSize);</div>
<div class="line"><a name="l06196"></a><span class="lineno"> 6196</span>&#160; </div>
<div class="line"><a name="l06197"></a><span class="lineno"> 6197</span>&#160; VkResult BindBufferMemory(</div>
<div class="line"><a name="l06198"></a><span class="lineno"> 6198</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
<div class="line"><a name="l06199"></a><span class="lineno"> 6199</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
<div class="line"><a name="l06200"></a><span class="lineno"> 6200</span>&#160; VkDeviceSize allocationLocalOffset,</div>
<div class="line"><a name="l06201"></a><span class="lineno"> 6201</span>&#160; VkBuffer hBuffer,</div>
<div class="line"><a name="l06202"></a><span class="lineno"> 6202</span>&#160; <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
<div class="line"><a name="l06203"></a><span class="lineno"> 6203</span>&#160; VkResult BindImageMemory(</div>
<div class="line"><a name="l06204"></a><span class="lineno"> 6204</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
<div class="line"><a name="l06205"></a><span class="lineno"> 6205</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
<div class="line"><a name="l06206"></a><span class="lineno"> 6206</span>&#160; VkDeviceSize allocationLocalOffset,</div>
<div class="line"><a name="l06207"></a><span class="lineno"> 6207</span>&#160; VkImage hImage,</div>
<div class="line"><a name="l06208"></a><span class="lineno"> 6208</span>&#160; <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
<div class="line"><a name="l06209"></a><span class="lineno"> 6209</span>&#160; </div>
<div class="line"><a name="l06210"></a><span class="lineno"> 6210</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l06211"></a><span class="lineno"> 6211</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> m_hParentPool; <span class="comment">// VK_NULL_HANDLE if not belongs to custom pool.</span></div>
<div class="line"><a name="l06212"></a><span class="lineno"> 6212</span>&#160; uint32_t m_MemoryTypeIndex;</div>
<div class="line"><a name="l06213"></a><span class="lineno"> 6213</span>&#160; uint32_t m_Id;</div>
<div class="line"><a name="l06214"></a><span class="lineno"> 6214</span>&#160; VkDeviceMemory m_hMemory;</div>
<div class="line"><a name="l06215"></a><span class="lineno"> 6215</span>&#160; </div>
<div class="line"><a name="l06216"></a><span class="lineno"> 6216</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l06217"></a><span class="lineno"> 6217</span>&#160;<span class="comment"> Protects access to m_hMemory so it&#39;s not used by multiple threads simultaneously, e.g. vkMapMemory, vkBindBufferMemory.</span></div>
<div class="line"><a name="l06218"></a><span class="lineno"> 6218</span>&#160;<span class="comment"> Also protects m_MapCount, m_pMappedData.</span></div>
<div class="line"><a name="l06219"></a><span class="lineno"> 6219</span>&#160;<span class="comment"> Allocations, deallocations, any change in m_pMetadata is protected by parent&#39;s VmaBlockVector::m_Mutex.</span></div>
<div class="line"><a name="l06220"></a><span class="lineno"> 6220</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l06221"></a><span class="lineno"> 6221</span>&#160; VMA_MUTEX m_Mutex;</div>
<div class="line"><a name="l06222"></a><span class="lineno"> 6222</span>&#160; uint32_t m_MapCount;</div>
<div class="line"><a name="l06223"></a><span class="lineno"> 6223</span>&#160; <span class="keywordtype">void</span>* m_pMappedData;</div>
<div class="line"><a name="l06224"></a><span class="lineno"> 6224</span>&#160;};</div>
<div class="line"><a name="l06225"></a><span class="lineno"> 6225</span>&#160; </div>
<div class="line"><a name="l06226"></a><span class="lineno"> 6226</span>&#160;<span class="keyword">struct </span>VmaPointerLess</div>
<div class="line"><a name="l06227"></a><span class="lineno"> 6227</span>&#160;{</div>
<div class="line"><a name="l06228"></a><span class="lineno"> 6228</span>&#160; <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> <span class="keywordtype">void</span>* lhs, <span class="keyword">const</span> <span class="keywordtype">void</span>* rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l06229"></a><span class="lineno"> 6229</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l06230"></a><span class="lineno"> 6230</span>&#160; <span class="keywordflow">return</span> lhs &lt; rhs;</div>
<div class="line"><a name="l06231"></a><span class="lineno"> 6231</span>&#160; }</div>
<div class="line"><a name="l06232"></a><span class="lineno"> 6232</span>&#160;};</div>
<div class="line"><a name="l06233"></a><span class="lineno"> 6233</span>&#160; </div>
<div class="line"><a name="l06234"></a><span class="lineno"> 6234</span>&#160;<span class="keyword">struct </span>VmaDefragmentationMove</div>
<div class="line"><a name="l06235"></a><span class="lineno"> 6235</span>&#160;{</div>
<div class="line"><a name="l06236"></a><span class="lineno"> 6236</span>&#160; <span class="keywordtype">size_t</span> srcBlockIndex;</div>
<div class="line"><a name="l06237"></a><span class="lineno"> 6237</span>&#160; <span class="keywordtype">size_t</span> dstBlockIndex;</div>
<div class="line"><a name="l06238"></a><span class="lineno"> 6238</span>&#160; VkDeviceSize srcOffset;</div>
<div class="line"><a name="l06239"></a><span class="lineno"> 6239</span>&#160; VkDeviceSize dstOffset;</div>
<div class="line"><a name="l06240"></a><span class="lineno"> 6240</span>&#160; VkDeviceSize size;</div>
<div class="line"><a name="l06241"></a><span class="lineno"> 6241</span>&#160;};</div>
<div class="line"><a name="l06242"></a><span class="lineno"> 6242</span>&#160; </div>
<div class="line"><a name="l06243"></a><span class="lineno"> 6243</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm;</div>
<div class="line"><a name="l06244"></a><span class="lineno"> 6244</span>&#160; </div>
<div class="line"><a name="l06245"></a><span class="lineno"> 6245</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l06246"></a><span class="lineno"> 6246</span>&#160;<span class="comment">Sequence of VmaDeviceMemoryBlock. Represents memory blocks allocated for a specific</span></div>
<div class="line"><a name="l06247"></a><span class="lineno"> 6247</span>&#160;<span class="comment">Vulkan memory type.</span></div>
<div class="line"><a name="l06248"></a><span class="lineno"> 6248</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l06249"></a><span class="lineno"> 6249</span>&#160;<span class="comment">Synchronized internally with a mutex.</span></div>
<div class="line"><a name="l06250"></a><span class="lineno"> 6250</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l06251"></a><span class="lineno"> 6251</span>&#160;<span class="keyword">struct </span>VmaBlockVector</div>
<div class="line"><a name="l06252"></a><span class="lineno"> 6252</span>&#160;{</div>
<div class="line"><a name="l06253"></a><span class="lineno"> 6253</span>&#160; VMA_CLASS_NO_COPY(VmaBlockVector)</div>
<div class="line"><a name="l06254"></a><span class="lineno"> 6254</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l06255"></a><span class="lineno"> 6255</span>&#160; VmaBlockVector(</div>
<div class="line"><a name="l06256"></a><span class="lineno"> 6256</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
<div class="line"><a name="l06257"></a><span class="lineno"> 6257</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> hParentPool,</div>
<div class="line"><a name="l06258"></a><span class="lineno"> 6258</span>&#160; uint32_t memoryTypeIndex,</div>
<div class="line"><a name="l06259"></a><span class="lineno"> 6259</span>&#160; VkDeviceSize preferredBlockSize,</div>
<div class="line"><a name="l06260"></a><span class="lineno"> 6260</span>&#160; <span class="keywordtype">size_t</span> minBlockCount,</div>
<div class="line"><a name="l06261"></a><span class="lineno"> 6261</span>&#160; <span class="keywordtype">size_t</span> maxBlockCount,</div>
<div class="line"><a name="l06262"></a><span class="lineno"> 6262</span>&#160; VkDeviceSize bufferImageGranularity,</div>
<div class="line"><a name="l06263"></a><span class="lineno"> 6263</span>&#160; uint32_t frameInUseCount,</div>
<div class="line"><a name="l06264"></a><span class="lineno"> 6264</span>&#160; <span class="keywordtype">bool</span> explicitBlockSize,</div>
<div class="line"><a name="l06265"></a><span class="lineno"> 6265</span>&#160; uint32_t algorithm);</div>
<div class="line"><a name="l06266"></a><span class="lineno"> 6266</span>&#160; ~VmaBlockVector();</div>
<div class="line"><a name="l06267"></a><span class="lineno"> 6267</span>&#160; </div>
<div class="line"><a name="l06268"></a><span class="lineno"> 6268</span>&#160; VkResult CreateMinBlocks();</div>
<div class="line"><a name="l06269"></a><span class="lineno"> 6269</span>&#160; </div>
<div class="line"><a name="l06270"></a><span class="lineno"> 6270</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> GetAllocator()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hAllocator; }</div>
<div class="line"><a name="l06271"></a><span class="lineno"> 6271</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> GetParentPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hParentPool; }</div>
<div class="line"><a name="l06272"></a><span class="lineno"> 6272</span>&#160; <span class="keywordtype">bool</span> IsCustomPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hParentPool != VMA_NULL; }</div>
<div class="line"><a name="l06273"></a><span class="lineno"> 6273</span>&#160; uint32_t GetMemoryTypeIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemoryTypeIndex; }</div>
<div class="line"><a name="l06274"></a><span class="lineno"> 6274</span>&#160; VkDeviceSize GetPreferredBlockSize()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_PreferredBlockSize; }</div>
<div class="line"><a name="l06275"></a><span class="lineno"> 6275</span>&#160; VkDeviceSize GetBufferImageGranularity()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BufferImageGranularity; }</div>
<div class="line"><a name="l06276"></a><span class="lineno"> 6276</span>&#160; uint32_t GetFrameInUseCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_FrameInUseCount; }</div>
<div class="line"><a name="l06277"></a><span class="lineno"> 6277</span>&#160; uint32_t GetAlgorithm()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Algorithm; }</div>
<div class="line"><a name="l06278"></a><span class="lineno"> 6278</span>&#160; </div>
<div class="line"><a name="l06279"></a><span class="lineno"> 6279</span>&#160; <span class="keywordtype">void</span> GetPoolStats(<a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pStats);</div>
<div class="line"><a name="l06280"></a><span class="lineno"> 6280</span>&#160; </div>
<div class="line"><a name="l06281"></a><span class="lineno"> 6281</span>&#160; <span class="keywordtype">bool</span> IsEmpty();</div>
<div class="line"><a name="l06282"></a><span class="lineno"> 6282</span>&#160; <span class="keywordtype">bool</span> IsCorruptionDetectionEnabled() <span class="keyword">const</span>;</div>
<div class="line"><a name="l06283"></a><span class="lineno"> 6283</span>&#160; </div>
<div class="line"><a name="l06284"></a><span class="lineno"> 6284</span>&#160; VkResult Allocate(</div>
<div class="line"><a name="l06285"></a><span class="lineno"> 6285</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l06286"></a><span class="lineno"> 6286</span>&#160; VkDeviceSize size,</div>
<div class="line"><a name="l06287"></a><span class="lineno"> 6287</span>&#160; VkDeviceSize alignment,</div>
<div class="line"><a name="l06288"></a><span class="lineno"> 6288</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
<div class="line"><a name="l06289"></a><span class="lineno"> 6289</span>&#160; VmaSuballocationType suballocType,</div>
<div class="line"><a name="l06290"></a><span class="lineno"> 6290</span>&#160; <span class="keywordtype">size_t</span> allocationCount,</div>
<div class="line"><a name="l06291"></a><span class="lineno"> 6291</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
<div class="line"><a name="l06292"></a><span class="lineno"> 6292</span>&#160; </div>
<div class="line"><a name="l06293"></a><span class="lineno"> 6293</span>&#160; <span class="keywordtype">void</span> Free(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
<div class="line"><a name="l06294"></a><span class="lineno"> 6294</span>&#160; </div>
<div class="line"><a name="l06295"></a><span class="lineno"> 6295</span>&#160; <span class="comment">// Adds statistics of this BlockVector to pStats.</span></div>
<div class="line"><a name="l06296"></a><span class="lineno"> 6296</span>&#160; <span class="keywordtype">void</span> AddStats(<a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats);</div>
<div class="line"><a name="l06297"></a><span class="lineno"> 6297</span>&#160; </div>
<div class="line"><a name="l06298"></a><span class="lineno"> 6298</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l06299"></a><span class="lineno"> 6299</span>&#160; <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json);</div>
<div class="line"><a name="l06300"></a><span class="lineno"> 6300</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l06301"></a><span class="lineno"> 6301</span>&#160; </div>
<div class="line"><a name="l06302"></a><span class="lineno"> 6302</span>&#160; <span class="keywordtype">void</span> MakePoolAllocationsLost(</div>
<div class="line"><a name="l06303"></a><span class="lineno"> 6303</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l06304"></a><span class="lineno"> 6304</span>&#160; <span class="keywordtype">size_t</span>* pLostAllocationCount);</div>
<div class="line"><a name="l06305"></a><span class="lineno"> 6305</span>&#160; VkResult CheckCorruption();</div>
<div class="line"><a name="l06306"></a><span class="lineno"> 6306</span>&#160; </div>
<div class="line"><a name="l06307"></a><span class="lineno"> 6307</span>&#160; <span class="comment">// Saves results in pCtx-&gt;res.</span></div>
<div class="line"><a name="l06308"></a><span class="lineno"> 6308</span>&#160; <span class="keywordtype">void</span> Defragment(</div>
<div class="line"><a name="l06309"></a><span class="lineno"> 6309</span>&#160; <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pCtx,</div>
<div class="line"><a name="l06310"></a><span class="lineno"> 6310</span>&#160; <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats,</div>
<div class="line"><a name="l06311"></a><span class="lineno"> 6311</span>&#160; VkDeviceSize&amp; maxCpuBytesToMove, uint32_t&amp; maxCpuAllocationsToMove,</div>
<div class="line"><a name="l06312"></a><span class="lineno"> 6312</span>&#160; VkDeviceSize&amp; maxGpuBytesToMove, uint32_t&amp; maxGpuAllocationsToMove,</div>
<div class="line"><a name="l06313"></a><span class="lineno"> 6313</span>&#160; VkCommandBuffer commandBuffer);</div>
<div class="line"><a name="l06314"></a><span class="lineno"> 6314</span>&#160; <span class="keywordtype">void</span> DefragmentationEnd(</div>
<div class="line"><a name="l06315"></a><span class="lineno"> 6315</span>&#160; <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pCtx,</div>
<div class="line"><a name="l06316"></a><span class="lineno"> 6316</span>&#160; <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats);</div>
<div class="line"><a name="l06317"></a><span class="lineno"> 6317</span>&#160; </div>
<div class="line"><a name="l06319"></a><span class="lineno"> 6319</span>&#160; <span class="comment">// To be used only while the m_Mutex is locked. Used during defragmentation.</span></div>
<div class="line"><a name="l06320"></a><span class="lineno"> 6320</span>&#160; </div>
<div class="line"><a name="l06321"></a><span class="lineno"> 6321</span>&#160; <span class="keywordtype">size_t</span> GetBlockCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Blocks.size(); }</div>
<div class="line"><a name="l06322"></a><span class="lineno"> 6322</span>&#160; VmaDeviceMemoryBlock* GetBlock(<span class="keywordtype">size_t</span> index)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Blocks[index]; }</div>
<div class="line"><a name="l06323"></a><span class="lineno"> 6323</span>&#160; <span class="keywordtype">size_t</span> CalcAllocationCount() <span class="keyword">const</span>;</div>
<div class="line"><a name="l06324"></a><span class="lineno"> 6324</span>&#160; <span class="keywordtype">bool</span> IsBufferImageGranularityConflictPossible() <span class="keyword">const</span>;</div>
<div class="line"><a name="l06325"></a><span class="lineno"> 6325</span>&#160; </div>
<div class="line"><a name="l06326"></a><span class="lineno"> 6326</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l06327"></a><span class="lineno"> 6327</span>&#160; <span class="keyword">friend</span> <span class="keyword">class </span>VmaDefragmentationAlgorithm_Generic;</div>
<div class="line"><a name="l06328"></a><span class="lineno"> 6328</span>&#160; </div>
<div class="line"><a name="l06329"></a><span class="lineno"> 6329</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> m_hAllocator;</div>
<div class="line"><a name="l06330"></a><span class="lineno"> 6330</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a> m_hParentPool;</div>
<div class="line"><a name="l06331"></a><span class="lineno"> 6331</span>&#160; <span class="keyword">const</span> uint32_t m_MemoryTypeIndex;</div>
<div class="line"><a name="l06332"></a><span class="lineno"> 6332</span>&#160; <span class="keyword">const</span> VkDeviceSize m_PreferredBlockSize;</div>
<div class="line"><a name="l06333"></a><span class="lineno"> 6333</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> m_MinBlockCount;</div>
<div class="line"><a name="l06334"></a><span class="lineno"> 6334</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> m_MaxBlockCount;</div>
<div class="line"><a name="l06335"></a><span class="lineno"> 6335</span>&#160; <span class="keyword">const</span> VkDeviceSize m_BufferImageGranularity;</div>
<div class="line"><a name="l06336"></a><span class="lineno"> 6336</span>&#160; <span class="keyword">const</span> uint32_t m_FrameInUseCount;</div>
<div class="line"><a name="l06337"></a><span class="lineno"> 6337</span>&#160; <span class="keyword">const</span> <span class="keywordtype">bool</span> m_ExplicitBlockSize;</div>
<div class="line"><a name="l06338"></a><span class="lineno"> 6338</span>&#160; <span class="keyword">const</span> uint32_t m_Algorithm;</div>
<div class="line"><a name="l06339"></a><span class="lineno"> 6339</span>&#160; VMA_RW_MUTEX m_Mutex;</div>
<div class="line"><a name="l06340"></a><span class="lineno"> 6340</span>&#160; </div>
<div class="line"><a name="l06341"></a><span class="lineno"> 6341</span>&#160; <span class="comment">/* There can be at most one allocation that is completely empty (except when minBlockCount &gt; 0) -</span></div>
<div class="line"><a name="l06342"></a><span class="lineno"> 6342</span>&#160;<span class="comment"> a hysteresis to avoid pessimistic case of alternating creation and destruction of a VkDeviceMemory. */</span></div>
<div class="line"><a name="l06343"></a><span class="lineno"> 6343</span>&#160; <span class="keywordtype">bool</span> m_HasEmptyBlock;</div>
<div class="line"><a name="l06344"></a><span class="lineno"> 6344</span>&#160; <span class="comment">// Incrementally sorted by sumFreeSize, ascending.</span></div>
<div class="line"><a name="l06345"></a><span class="lineno"> 6345</span>&#160; VmaVector&lt; VmaDeviceMemoryBlock*, VmaStlAllocator&lt;VmaDeviceMemoryBlock*&gt; &gt; m_Blocks;</div>
<div class="line"><a name="l06346"></a><span class="lineno"> 6346</span>&#160; uint32_t m_NextBlockId;</div>
<div class="line"><a name="l06347"></a><span class="lineno"> 6347</span>&#160; </div>
<div class="line"><a name="l06348"></a><span class="lineno"> 6348</span>&#160; VkDeviceSize CalcMaxBlockSize() <span class="keyword">const</span>;</div>
<div class="line"><a name="l06349"></a><span class="lineno"> 6349</span>&#160; </div>
<div class="line"><a name="l06350"></a><span class="lineno"> 6350</span>&#160; <span class="comment">// Finds and removes given block from vector.</span></div>
<div class="line"><a name="l06351"></a><span class="lineno"> 6351</span>&#160; <span class="keywordtype">void</span> Remove(VmaDeviceMemoryBlock* pBlock);</div>
<div class="line"><a name="l06352"></a><span class="lineno"> 6352</span>&#160; </div>
<div class="line"><a name="l06353"></a><span class="lineno"> 6353</span>&#160; <span class="comment">// Performs single step in sorting m_Blocks. They may not be fully sorted</span></div>
<div class="line"><a name="l06354"></a><span class="lineno"> 6354</span>&#160; <span class="comment">// after this call.</span></div>
<div class="line"><a name="l06355"></a><span class="lineno"> 6355</span>&#160; <span class="keywordtype">void</span> IncrementallySortBlocks();</div>
<div class="line"><a name="l06356"></a><span class="lineno"> 6356</span>&#160; </div>
<div class="line"><a name="l06357"></a><span class="lineno"> 6357</span>&#160; VkResult AllocatePage(</div>
<div class="line"><a name="l06358"></a><span class="lineno"> 6358</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l06359"></a><span class="lineno"> 6359</span>&#160; VkDeviceSize size,</div>
<div class="line"><a name="l06360"></a><span class="lineno"> 6360</span>&#160; VkDeviceSize alignment,</div>
<div class="line"><a name="l06361"></a><span class="lineno"> 6361</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
<div class="line"><a name="l06362"></a><span class="lineno"> 6362</span>&#160; VmaSuballocationType suballocType,</div>
<div class="line"><a name="l06363"></a><span class="lineno"> 6363</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
<div class="line"><a name="l06364"></a><span class="lineno"> 6364</span>&#160; </div>
<div class="line"><a name="l06365"></a><span class="lineno"> 6365</span>&#160; <span class="comment">// To be used only without CAN_MAKE_OTHER_LOST flag.</span></div>
<div class="line"><a name="l06366"></a><span class="lineno"> 6366</span>&#160; VkResult AllocateFromBlock(</div>
<div class="line"><a name="l06367"></a><span class="lineno"> 6367</span>&#160; VmaDeviceMemoryBlock* pBlock,</div>
<div class="line"><a name="l06368"></a><span class="lineno"> 6368</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l06369"></a><span class="lineno"> 6369</span>&#160; VkDeviceSize size,</div>
<div class="line"><a name="l06370"></a><span class="lineno"> 6370</span>&#160; VkDeviceSize alignment,</div>
<div class="line"><a name="l06371"></a><span class="lineno"> 6371</span>&#160; <a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlags,</div>
<div class="line"><a name="l06372"></a><span class="lineno"> 6372</span>&#160; <span class="keywordtype">void</span>* pUserData,</div>
<div class="line"><a name="l06373"></a><span class="lineno"> 6373</span>&#160; VmaSuballocationType suballocType,</div>
<div class="line"><a name="l06374"></a><span class="lineno"> 6374</span>&#160; uint32_t strategy,</div>
<div class="line"><a name="l06375"></a><span class="lineno"> 6375</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
<div class="line"><a name="l06376"></a><span class="lineno"> 6376</span>&#160; </div>
<div class="line"><a name="l06377"></a><span class="lineno"> 6377</span>&#160; VkResult CreateBlock(VkDeviceSize blockSize, <span class="keywordtype">size_t</span>* pNewBlockIndex);</div>
<div class="line"><a name="l06378"></a><span class="lineno"> 6378</span>&#160; </div>
<div class="line"><a name="l06379"></a><span class="lineno"> 6379</span>&#160; <span class="comment">// Saves result to pCtx-&gt;res.</span></div>
<div class="line"><a name="l06380"></a><span class="lineno"> 6380</span>&#160; <span class="keywordtype">void</span> ApplyDefragmentationMovesCpu(</div>
<div class="line"><a name="l06381"></a><span class="lineno"> 6381</span>&#160; <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pDefragCtx,</div>
<div class="line"><a name="l06382"></a><span class="lineno"> 6382</span>&#160; <span class="keyword">const</span> VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves);</div>
<div class="line"><a name="l06383"></a><span class="lineno"> 6383</span>&#160; <span class="comment">// Saves result to pCtx-&gt;res.</span></div>
<div class="line"><a name="l06384"></a><span class="lineno"> 6384</span>&#160; <span class="keywordtype">void</span> ApplyDefragmentationMovesGpu(</div>
<div class="line"><a name="l06385"></a><span class="lineno"> 6385</span>&#160; <span class="keyword">class</span> VmaBlockVectorDefragmentationContext* pDefragCtx,</div>
<div class="line"><a name="l06386"></a><span class="lineno"> 6386</span>&#160; <span class="keyword">const</span> VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
<div class="line"><a name="l06387"></a><span class="lineno"> 6387</span>&#160; VkCommandBuffer commandBuffer);</div>
<div class="line"><a name="l06388"></a><span class="lineno"> 6388</span>&#160; </div>
<div class="line"><a name="l06389"></a><span class="lineno"> 6389</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l06390"></a><span class="lineno"> 6390</span>&#160;<span class="comment"> Used during defragmentation. pDefragmentationStats is optional. It&#39;s in/out</span></div>
<div class="line"><a name="l06391"></a><span class="lineno"> 6391</span>&#160;<span class="comment"> - updated with new data.</span></div>
<div class="line"><a name="l06392"></a><span class="lineno"> 6392</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l06393"></a><span class="lineno"> 6393</span>&#160; <span class="keywordtype">void</span> FreeEmptyBlocks(<a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pDefragmentationStats);</div>
<div class="line"><a name="l06394"></a><span class="lineno"> 6394</span>&#160; </div>
<div class="line"><a name="l06395"></a><span class="lineno"> 6395</span>&#160; <span class="keywordtype">void</span> UpdateHasEmptyBlock();</div>
<div class="line"><a name="l06396"></a><span class="lineno"> 6396</span>&#160;};</div>
<div class="line"><a name="l06397"></a><span class="lineno"> 6397</span>&#160; </div>
<div class="line"><a name="l06398"></a><span class="lineno"> 6398</span>&#160;<span class="keyword">struct </span>VmaPool_T</div>
<div class="line"><a name="l06399"></a><span class="lineno"> 6399</span>&#160;{</div>
<div class="line"><a name="l06400"></a><span class="lineno"> 6400</span>&#160; VMA_CLASS_NO_COPY(VmaPool_T)</div>
<div class="line"><a name="l06401"></a><span class="lineno"> 6401</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l06402"></a><span class="lineno"> 6402</span>&#160; VmaBlockVector m_BlockVector;</div>
<div class="line"><a name="l06403"></a><span class="lineno"> 6403</span>&#160; </div>
<div class="line"><a name="l06404"></a><span class="lineno"> 6404</span>&#160; VmaPool_T(</div>
<div class="line"><a name="l06405"></a><span class="lineno"> 6405</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
<div class="line"><a name="l06406"></a><span class="lineno"> 6406</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>&amp; createInfo,</div>
<div class="line"><a name="l06407"></a><span class="lineno"> 6407</span>&#160; VkDeviceSize preferredBlockSize);</div>
<div class="line"><a name="l06408"></a><span class="lineno"> 6408</span>&#160; ~VmaPool_T();</div>
<div class="line"><a name="l06409"></a><span class="lineno"> 6409</span>&#160; </div>
<div class="line"><a name="l06410"></a><span class="lineno"> 6410</span>&#160; uint32_t GetId()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Id; }</div>
<div class="line"><a name="l06411"></a><span class="lineno"> 6411</span>&#160; <span class="keywordtype">void</span> SetId(uint32_t <span class="keywordtype">id</span>) { VMA_ASSERT(m_Id == 0); m_Id = id; }</div>
<div class="line"><a name="l06412"></a><span class="lineno"> 6412</span>&#160; </div>
<div class="line"><a name="l06413"></a><span class="lineno"> 6413</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* GetName()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Name; }</div>
<div class="line"><a name="l06414"></a><span class="lineno"> 6414</span>&#160; <span class="keywordtype">void</span> SetName(<span class="keyword">const</span> <span class="keywordtype">char</span>* pName);</div>
<div class="line"><a name="l06415"></a><span class="lineno"> 6415</span>&#160; </div>
<div class="line"><a name="l06416"></a><span class="lineno"> 6416</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l06417"></a><span class="lineno"> 6417</span>&#160; <span class="comment">//void PrintDetailedMap(class VmaStringBuilder&amp; sb);</span></div>
<div class="line"><a name="l06418"></a><span class="lineno"> 6418</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l06419"></a><span class="lineno"> 6419</span>&#160; </div>
<div class="line"><a name="l06420"></a><span class="lineno"> 6420</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l06421"></a><span class="lineno"> 6421</span>&#160; uint32_t m_Id;</div>
<div class="line"><a name="l06422"></a><span class="lineno"> 6422</span>&#160; <span class="keywordtype">char</span>* m_Name;</div>
<div class="line"><a name="l06423"></a><span class="lineno"> 6423</span>&#160;};</div>
<div class="line"><a name="l06424"></a><span class="lineno"> 6424</span>&#160; </div>
<div class="line"><a name="l06425"></a><span class="lineno"> 6425</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l06426"></a><span class="lineno"> 6426</span>&#160;<span class="comment">Performs defragmentation:</span></div>
<div class="line"><a name="l06427"></a><span class="lineno"> 6427</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l06428"></a><span class="lineno"> 6428</span>&#160;<span class="comment">- Updates `pBlockVector-&gt;m_pMetadata`.</span></div>
<div class="line"><a name="l06429"></a><span class="lineno"> 6429</span>&#160;<span class="comment">- Updates allocations by calling ChangeBlockAllocation() or ChangeOffset().</span></div>
<div class="line"><a name="l06430"></a><span class="lineno"> 6430</span>&#160;<span class="comment">- Does not move actual data, only returns requested moves as `moves`.</span></div>
<div class="line"><a name="l06431"></a><span class="lineno"> 6431</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l06432"></a><span class="lineno"> 6432</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm</div>
<div class="line"><a name="l06433"></a><span class="lineno"> 6433</span>&#160;{</div>
<div class="line"><a name="l06434"></a><span class="lineno"> 6434</span>&#160; VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm)</div>
<div class="line"><a name="l06435"></a><span class="lineno"> 6435</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l06436"></a><span class="lineno"> 6436</span>&#160; VmaDefragmentationAlgorithm(</div>
<div class="line"><a name="l06437"></a><span class="lineno"> 6437</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
<div class="line"><a name="l06438"></a><span class="lineno"> 6438</span>&#160; VmaBlockVector* pBlockVector,</div>
<div class="line"><a name="l06439"></a><span class="lineno"> 6439</span>&#160; uint32_t currentFrameIndex) :</div>
<div class="line"><a name="l06440"></a><span class="lineno"> 6440</span>&#160; m_hAllocator(hAllocator),</div>
<div class="line"><a name="l06441"></a><span class="lineno"> 6441</span>&#160; m_pBlockVector(pBlockVector),</div>
<div class="line"><a name="l06442"></a><span class="lineno"> 6442</span>&#160; m_CurrentFrameIndex(currentFrameIndex)</div>
<div class="line"><a name="l06443"></a><span class="lineno"> 6443</span>&#160; {</div>
<div class="line"><a name="l06444"></a><span class="lineno"> 6444</span>&#160; }</div>
<div class="line"><a name="l06445"></a><span class="lineno"> 6445</span>&#160; <span class="keyword">virtual</span> ~VmaDefragmentationAlgorithm()</div>
<div class="line"><a name="l06446"></a><span class="lineno"> 6446</span>&#160; {</div>
<div class="line"><a name="l06447"></a><span class="lineno"> 6447</span>&#160; }</div>
<div class="line"><a name="l06448"></a><span class="lineno"> 6448</span>&#160; </div>
<div class="line"><a name="l06449"></a><span class="lineno"> 6449</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged) = 0;</div>
<div class="line"><a name="l06450"></a><span class="lineno"> 6450</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAll() = 0;</div>
<div class="line"><a name="l06451"></a><span class="lineno"> 6451</span>&#160; </div>
<div class="line"><a name="l06452"></a><span class="lineno"> 6452</span>&#160; <span class="keyword">virtual</span> VkResult Defragment(</div>
<div class="line"><a name="l06453"></a><span class="lineno"> 6453</span>&#160; VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
<div class="line"><a name="l06454"></a><span class="lineno"> 6454</span>&#160; VkDeviceSize maxBytesToMove,</div>
<div class="line"><a name="l06455"></a><span class="lineno"> 6455</span>&#160; uint32_t maxAllocationsToMove) = 0;</div>
<div class="line"><a name="l06456"></a><span class="lineno"> 6456</span>&#160; </div>
<div class="line"><a name="l06457"></a><span class="lineno"> 6457</span>&#160; <span class="keyword">virtual</span> VkDeviceSize GetBytesMoved() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l06458"></a><span class="lineno"> 6458</span>&#160; <span class="keyword">virtual</span> uint32_t GetAllocationsMoved() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l06459"></a><span class="lineno"> 6459</span>&#160; </div>
<div class="line"><a name="l06460"></a><span class="lineno"> 6460</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l06461"></a><span class="lineno"> 6461</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> <span class="keyword">const</span> m_hAllocator;</div>
<div class="line"><a name="l06462"></a><span class="lineno"> 6462</span>&#160; VmaBlockVector* <span class="keyword">const</span> m_pBlockVector;</div>
<div class="line"><a name="l06463"></a><span class="lineno"> 6463</span>&#160; <span class="keyword">const</span> uint32_t m_CurrentFrameIndex;</div>
<div class="line"><a name="l06464"></a><span class="lineno"> 6464</span>&#160; </div>
<div class="line"><a name="l06465"></a><span class="lineno"> 6465</span>&#160; <span class="keyword">struct </span>AllocationInfo</div>
<div class="line"><a name="l06466"></a><span class="lineno"> 6466</span>&#160; {</div>
<div class="line"><a name="l06467"></a><span class="lineno"> 6467</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> m_hAllocation;</div>
<div class="line"><a name="l06468"></a><span class="lineno"> 6468</span>&#160; VkBool32* m_pChanged;</div>
<div class="line"><a name="l06469"></a><span class="lineno"> 6469</span>&#160; </div>
<div class="line"><a name="l06470"></a><span class="lineno"> 6470</span>&#160; AllocationInfo() :</div>
<div class="line"><a name="l06471"></a><span class="lineno"> 6471</span>&#160; m_hAllocation(VK_NULL_HANDLE),</div>
<div class="line"><a name="l06472"></a><span class="lineno"> 6472</span>&#160; m_pChanged(VMA_NULL)</div>
<div class="line"><a name="l06473"></a><span class="lineno"> 6473</span>&#160; {</div>
<div class="line"><a name="l06474"></a><span class="lineno"> 6474</span>&#160; }</div>
<div class="line"><a name="l06475"></a><span class="lineno"> 6475</span>&#160; AllocationInfo(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged) :</div>
<div class="line"><a name="l06476"></a><span class="lineno"> 6476</span>&#160; m_hAllocation(hAlloc),</div>
<div class="line"><a name="l06477"></a><span class="lineno"> 6477</span>&#160; m_pChanged(pChanged)</div>
<div class="line"><a name="l06478"></a><span class="lineno"> 6478</span>&#160; {</div>
<div class="line"><a name="l06479"></a><span class="lineno"> 6479</span>&#160; }</div>
<div class="line"><a name="l06480"></a><span class="lineno"> 6480</span>&#160; };</div>
<div class="line"><a name="l06481"></a><span class="lineno"> 6481</span>&#160;};</div>
<div class="line"><a name="l06482"></a><span class="lineno"> 6482</span>&#160; </div>
<div class="line"><a name="l06483"></a><span class="lineno"> 6483</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm_Generic : <span class="keyword">public</span> VmaDefragmentationAlgorithm</div>
<div class="line"><a name="l06484"></a><span class="lineno"> 6484</span>&#160;{</div>
<div class="line"><a name="l06485"></a><span class="lineno"> 6485</span>&#160; VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm_Generic)</div>
<div class="line"><a name="l06486"></a><span class="lineno"> 6486</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l06487"></a><span class="lineno"> 6487</span>&#160; VmaDefragmentationAlgorithm_Generic(</div>
<div class="line"><a name="l06488"></a><span class="lineno"> 6488</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
<div class="line"><a name="l06489"></a><span class="lineno"> 6489</span>&#160; VmaBlockVector* pBlockVector,</div>
<div class="line"><a name="l06490"></a><span class="lineno"> 6490</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l06491"></a><span class="lineno"> 6491</span>&#160; <span class="keywordtype">bool</span> overlappingMoveSupported);</div>
<div class="line"><a name="l06492"></a><span class="lineno"> 6492</span>&#160; <span class="keyword">virtual</span> ~VmaDefragmentationAlgorithm_Generic();</div>
<div class="line"><a name="l06493"></a><span class="lineno"> 6493</span>&#160; </div>
<div class="line"><a name="l06494"></a><span class="lineno"> 6494</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged);</div>
<div class="line"><a name="l06495"></a><span class="lineno"> 6495</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAll() { m_AllAllocations = <span class="keyword">true</span>; }</div>
<div class="line"><a name="l06496"></a><span class="lineno"> 6496</span>&#160; </div>
<div class="line"><a name="l06497"></a><span class="lineno"> 6497</span>&#160; <span class="keyword">virtual</span> VkResult Defragment(</div>
<div class="line"><a name="l06498"></a><span class="lineno"> 6498</span>&#160; VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
<div class="line"><a name="l06499"></a><span class="lineno"> 6499</span>&#160; VkDeviceSize maxBytesToMove,</div>
<div class="line"><a name="l06500"></a><span class="lineno"> 6500</span>&#160; uint32_t maxAllocationsToMove);</div>
<div class="line"><a name="l06501"></a><span class="lineno"> 6501</span>&#160; </div>
<div class="line"><a name="l06502"></a><span class="lineno"> 6502</span>&#160; <span class="keyword">virtual</span> VkDeviceSize GetBytesMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BytesMoved; }</div>
<div class="line"><a name="l06503"></a><span class="lineno"> 6503</span>&#160; <span class="keyword">virtual</span> uint32_t GetAllocationsMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_AllocationsMoved; }</div>
<div class="line"><a name="l06504"></a><span class="lineno"> 6504</span>&#160; </div>
<div class="line"><a name="l06505"></a><span class="lineno"> 6505</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l06506"></a><span class="lineno"> 6506</span>&#160; uint32_t m_AllocationCount;</div>
<div class="line"><a name="l06507"></a><span class="lineno"> 6507</span>&#160; <span class="keywordtype">bool</span> m_AllAllocations;</div>
<div class="line"><a name="l06508"></a><span class="lineno"> 6508</span>&#160; </div>
<div class="line"><a name="l06509"></a><span class="lineno"> 6509</span>&#160; VkDeviceSize m_BytesMoved;</div>
<div class="line"><a name="l06510"></a><span class="lineno"> 6510</span>&#160; uint32_t m_AllocationsMoved;</div>
<div class="line"><a name="l06511"></a><span class="lineno"> 6511</span>&#160; </div>
<div class="line"><a name="l06512"></a><span class="lineno"> 6512</span>&#160; <span class="keyword">struct </span>AllocationInfoSizeGreater</div>
<div class="line"><a name="l06513"></a><span class="lineno"> 6513</span>&#160; {</div>
<div class="line"><a name="l06514"></a><span class="lineno"> 6514</span>&#160; <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> AllocationInfo&amp; lhs, <span class="keyword">const</span> AllocationInfo&amp; rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l06515"></a><span class="lineno"> 6515</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l06516"></a><span class="lineno"> 6516</span>&#160; <span class="keywordflow">return</span> lhs.m_hAllocation-&gt;GetSize() &gt; rhs.m_hAllocation-&gt;GetSize();</div>
<div class="line"><a name="l06517"></a><span class="lineno"> 6517</span>&#160; }</div>
<div class="line"><a name="l06518"></a><span class="lineno"> 6518</span>&#160; };</div>
<div class="line"><a name="l06519"></a><span class="lineno"> 6519</span>&#160; </div>
<div class="line"><a name="l06520"></a><span class="lineno"> 6520</span>&#160; <span class="keyword">struct </span>AllocationInfoOffsetGreater</div>
<div class="line"><a name="l06521"></a><span class="lineno"> 6521</span>&#160; {</div>
<div class="line"><a name="l06522"></a><span class="lineno"> 6522</span>&#160; <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> AllocationInfo&amp; lhs, <span class="keyword">const</span> AllocationInfo&amp; rhs)<span class="keyword"> const</span></div>
<div class="line"><a name="l06523"></a><span class="lineno"> 6523</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l06524"></a><span class="lineno"> 6524</span>&#160; <span class="keywordflow">return</span> lhs.m_hAllocation-&gt;GetOffset() &gt; rhs.m_hAllocation-&gt;GetOffset();</div>
<div class="line"><a name="l06525"></a><span class="lineno"> 6525</span>&#160; }</div>
<div class="line"><a name="l06526"></a><span class="lineno"> 6526</span>&#160; };</div>
<div class="line"><a name="l06527"></a><span class="lineno"> 6527</span>&#160; </div>
<div class="line"><a name="l06528"></a><span class="lineno"> 6528</span>&#160; <span class="keyword">struct </span>BlockInfo</div>
<div class="line"><a name="l06529"></a><span class="lineno"> 6529</span>&#160; {</div>
<div class="line"><a name="l06530"></a><span class="lineno"> 6530</span>&#160; <span class="keywordtype">size_t</span> m_OriginalBlockIndex;</div>
<div class="line"><a name="l06531"></a><span class="lineno"> 6531</span>&#160; VmaDeviceMemoryBlock* m_pBlock;</div>
<div class="line"><a name="l06532"></a><span class="lineno"> 6532</span>&#160; <span class="keywordtype">bool</span> m_HasNonMovableAllocations;</div>
<div class="line"><a name="l06533"></a><span class="lineno"> 6533</span>&#160; VmaVector&lt; AllocationInfo, VmaStlAllocator&lt;AllocationInfo&gt; &gt; m_Allocations;</div>
<div class="line"><a name="l06534"></a><span class="lineno"> 6534</span>&#160; </div>
<div class="line"><a name="l06535"></a><span class="lineno"> 6535</span>&#160; BlockInfo(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks) :</div>
<div class="line"><a name="l06536"></a><span class="lineno"> 6536</span>&#160; m_OriginalBlockIndex(SIZE_MAX),</div>
<div class="line"><a name="l06537"></a><span class="lineno"> 6537</span>&#160; m_pBlock(VMA_NULL),</div>
<div class="line"><a name="l06538"></a><span class="lineno"> 6538</span>&#160; m_HasNonMovableAllocations(true),</div>
<div class="line"><a name="l06539"></a><span class="lineno"> 6539</span>&#160; m_Allocations(pAllocationCallbacks)</div>
<div class="line"><a name="l06540"></a><span class="lineno"> 6540</span>&#160; {</div>
<div class="line"><a name="l06541"></a><span class="lineno"> 6541</span>&#160; }</div>
<div class="line"><a name="l06542"></a><span class="lineno"> 6542</span>&#160; </div>
<div class="line"><a name="l06543"></a><span class="lineno"> 6543</span>&#160; <span class="keywordtype">void</span> CalcHasNonMovableAllocations()</div>
<div class="line"><a name="l06544"></a><span class="lineno"> 6544</span>&#160; {</div>
<div class="line"><a name="l06545"></a><span class="lineno"> 6545</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> blockAllocCount = m_pBlock-&gt;m_pMetadata-&gt;GetAllocationCount();</div>
<div class="line"><a name="l06546"></a><span class="lineno"> 6546</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> defragmentAllocCount = m_Allocations.size();</div>
<div class="line"><a name="l06547"></a><span class="lineno"> 6547</span>&#160; m_HasNonMovableAllocations = blockAllocCount != defragmentAllocCount;</div>
<div class="line"><a name="l06548"></a><span class="lineno"> 6548</span>&#160; }</div>
<div class="line"><a name="l06549"></a><span class="lineno"> 6549</span>&#160; </div>
<div class="line"><a name="l06550"></a><span class="lineno"> 6550</span>&#160; <span class="keywordtype">void</span> SortAllocationsBySizeDescending()</div>
<div class="line"><a name="l06551"></a><span class="lineno"> 6551</span>&#160; {</div>
<div class="line"><a name="l06552"></a><span class="lineno"> 6552</span>&#160; VMA_SORT(m_Allocations.begin(), m_Allocations.end(), AllocationInfoSizeGreater());</div>
<div class="line"><a name="l06553"></a><span class="lineno"> 6553</span>&#160; }</div>
<div class="line"><a name="l06554"></a><span class="lineno"> 6554</span>&#160; </div>
<div class="line"><a name="l06555"></a><span class="lineno"> 6555</span>&#160; <span class="keywordtype">void</span> SortAllocationsByOffsetDescending()</div>
<div class="line"><a name="l06556"></a><span class="lineno"> 6556</span>&#160; {</div>
<div class="line"><a name="l06557"></a><span class="lineno"> 6557</span>&#160; VMA_SORT(m_Allocations.begin(), m_Allocations.end(), AllocationInfoOffsetGreater());</div>
<div class="line"><a name="l06558"></a><span class="lineno"> 6558</span>&#160; }</div>
<div class="line"><a name="l06559"></a><span class="lineno"> 6559</span>&#160; };</div>
<div class="line"><a name="l06560"></a><span class="lineno"> 6560</span>&#160; </div>
<div class="line"><a name="l06561"></a><span class="lineno"> 6561</span>&#160; <span class="keyword">struct </span>BlockPointerLess</div>
<div class="line"><a name="l06562"></a><span class="lineno"> 6562</span>&#160; {</div>
<div class="line"><a name="l06563"></a><span class="lineno"> 6563</span>&#160; <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> BlockInfo* pLhsBlockInfo, <span class="keyword">const</span> VmaDeviceMemoryBlock* pRhsBlock)<span class="keyword"> const</span></div>
<div class="line"><a name="l06564"></a><span class="lineno"> 6564</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l06565"></a><span class="lineno"> 6565</span>&#160; <span class="keywordflow">return</span> pLhsBlockInfo-&gt;m_pBlock &lt; pRhsBlock;</div>
<div class="line"><a name="l06566"></a><span class="lineno"> 6566</span>&#160; }</div>
<div class="line"><a name="l06567"></a><span class="lineno"> 6567</span>&#160; <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> BlockInfo* pLhsBlockInfo, <span class="keyword">const</span> BlockInfo* pRhsBlockInfo)<span class="keyword"> const</span></div>
<div class="line"><a name="l06568"></a><span class="lineno"> 6568</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l06569"></a><span class="lineno"> 6569</span>&#160; <span class="keywordflow">return</span> pLhsBlockInfo-&gt;m_pBlock &lt; pRhsBlockInfo-&gt;m_pBlock;</div>
<div class="line"><a name="l06570"></a><span class="lineno"> 6570</span>&#160; }</div>
<div class="line"><a name="l06571"></a><span class="lineno"> 6571</span>&#160; };</div>
<div class="line"><a name="l06572"></a><span class="lineno"> 6572</span>&#160; </div>
<div class="line"><a name="l06573"></a><span class="lineno"> 6573</span>&#160; <span class="comment">// 1. Blocks with some non-movable allocations go first.</span></div>
<div class="line"><a name="l06574"></a><span class="lineno"> 6574</span>&#160; <span class="comment">// 2. Blocks with smaller sumFreeSize go first.</span></div>
<div class="line"><a name="l06575"></a><span class="lineno"> 6575</span>&#160; <span class="keyword">struct </span>BlockInfoCompareMoveDestination</div>
<div class="line"><a name="l06576"></a><span class="lineno"> 6576</span>&#160; {</div>
<div class="line"><a name="l06577"></a><span class="lineno"> 6577</span>&#160; <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> BlockInfo* pLhsBlockInfo, <span class="keyword">const</span> BlockInfo* pRhsBlockInfo)<span class="keyword"> const</span></div>
<div class="line"><a name="l06578"></a><span class="lineno"> 6578</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l06579"></a><span class="lineno"> 6579</span>&#160; <span class="keywordflow">if</span>(pLhsBlockInfo-&gt;m_HasNonMovableAllocations &amp;&amp; !pRhsBlockInfo-&gt;m_HasNonMovableAllocations)</div>
<div class="line"><a name="l06580"></a><span class="lineno"> 6580</span>&#160; {</div>
<div class="line"><a name="l06581"></a><span class="lineno"> 6581</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l06582"></a><span class="lineno"> 6582</span>&#160; }</div>
<div class="line"><a name="l06583"></a><span class="lineno"> 6583</span>&#160; <span class="keywordflow">if</span>(!pLhsBlockInfo-&gt;m_HasNonMovableAllocations &amp;&amp; pRhsBlockInfo-&gt;m_HasNonMovableAllocations)</div>
<div class="line"><a name="l06584"></a><span class="lineno"> 6584</span>&#160; {</div>
<div class="line"><a name="l06585"></a><span class="lineno"> 6585</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l06586"></a><span class="lineno"> 6586</span>&#160; }</div>
<div class="line"><a name="l06587"></a><span class="lineno"> 6587</span>&#160; <span class="keywordflow">if</span>(pLhsBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;GetSumFreeSize() &lt; pRhsBlockInfo-&gt;m_pBlock-&gt;m_pMetadata-&gt;GetSumFreeSize())</div>
<div class="line"><a name="l06588"></a><span class="lineno"> 6588</span>&#160; {</div>
<div class="line"><a name="l06589"></a><span class="lineno"> 6589</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l06590"></a><span class="lineno"> 6590</span>&#160; }</div>
<div class="line"><a name="l06591"></a><span class="lineno"> 6591</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l06592"></a><span class="lineno"> 6592</span>&#160; }</div>
<div class="line"><a name="l06593"></a><span class="lineno"> 6593</span>&#160; };</div>
<div class="line"><a name="l06594"></a><span class="lineno"> 6594</span>&#160; </div>
<div class="line"><a name="l06595"></a><span class="lineno"> 6595</span>&#160; <span class="keyword">typedef</span> VmaVector&lt; BlockInfo*, VmaStlAllocator&lt;BlockInfo*&gt; &gt; BlockInfoVector;</div>
<div class="line"><a name="l06596"></a><span class="lineno"> 6596</span>&#160; BlockInfoVector m_Blocks;</div>
<div class="line"><a name="l06597"></a><span class="lineno"> 6597</span>&#160; </div>
<div class="line"><a name="l06598"></a><span class="lineno"> 6598</span>&#160; VkResult DefragmentRound(</div>
<div class="line"><a name="l06599"></a><span class="lineno"> 6599</span>&#160; VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
<div class="line"><a name="l06600"></a><span class="lineno"> 6600</span>&#160; VkDeviceSize maxBytesToMove,</div>
<div class="line"><a name="l06601"></a><span class="lineno"> 6601</span>&#160; uint32_t maxAllocationsToMove);</div>
<div class="line"><a name="l06602"></a><span class="lineno"> 6602</span>&#160; </div>
<div class="line"><a name="l06603"></a><span class="lineno"> 6603</span>&#160; <span class="keywordtype">size_t</span> CalcBlocksWithNonMovableCount() <span class="keyword">const</span>;</div>
<div class="line"><a name="l06604"></a><span class="lineno"> 6604</span>&#160; </div>
<div class="line"><a name="l06605"></a><span class="lineno"> 6605</span>&#160; <span class="keyword">static</span> <span class="keywordtype">bool</span> MoveMakesSense(</div>
<div class="line"><a name="l06606"></a><span class="lineno"> 6606</span>&#160; <span class="keywordtype">size_t</span> dstBlockIndex, VkDeviceSize dstOffset,</div>
<div class="line"><a name="l06607"></a><span class="lineno"> 6607</span>&#160; <span class="keywordtype">size_t</span> srcBlockIndex, VkDeviceSize srcOffset);</div>
<div class="line"><a name="l06608"></a><span class="lineno"> 6608</span>&#160;};</div>
<div class="line"><a name="l06609"></a><span class="lineno"> 6609</span>&#160; </div>
<div class="line"><a name="l06610"></a><span class="lineno"> 6610</span>&#160;<span class="keyword">class </span>VmaDefragmentationAlgorithm_Fast : <span class="keyword">public</span> VmaDefragmentationAlgorithm</div>
<div class="line"><a name="l06611"></a><span class="lineno"> 6611</span>&#160;{</div>
<div class="line"><a name="l06612"></a><span class="lineno"> 6612</span>&#160; VMA_CLASS_NO_COPY(VmaDefragmentationAlgorithm_Fast)</div>
<div class="line"><a name="l06613"></a><span class="lineno"> 6613</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l06614"></a><span class="lineno"> 6614</span>&#160; VmaDefragmentationAlgorithm_Fast(</div>
<div class="line"><a name="l06615"></a><span class="lineno"> 6615</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
<div class="line"><a name="l06616"></a><span class="lineno"> 6616</span>&#160; VmaBlockVector* pBlockVector,</div>
<div class="line"><a name="l06617"></a><span class="lineno"> 6617</span>&#160; uint32_t currentFrameIndex,</div>
<div class="line"><a name="l06618"></a><span class="lineno"> 6618</span>&#160; <span class="keywordtype">bool</span> overlappingMoveSupported);</div>
<div class="line"><a name="l06619"></a><span class="lineno"> 6619</span>&#160; <span class="keyword">virtual</span> ~VmaDefragmentationAlgorithm_Fast();</div>
<div class="line"><a name="l06620"></a><span class="lineno"> 6620</span>&#160; </div>
<div class="line"><a name="l06621"></a><span class="lineno"> 6621</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged) { ++m_AllocationCount; }</div>
<div class="line"><a name="l06622"></a><span class="lineno"> 6622</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddAll() { m_AllAllocations = <span class="keyword">true</span>; }</div>
<div class="line"><a name="l06623"></a><span class="lineno"> 6623</span>&#160; </div>
<div class="line"><a name="l06624"></a><span class="lineno"> 6624</span>&#160; <span class="keyword">virtual</span> VkResult Defragment(</div>
<div class="line"><a name="l06625"></a><span class="lineno"> 6625</span>&#160; VmaVector&lt; VmaDefragmentationMove, VmaStlAllocator&lt;VmaDefragmentationMove&gt; &gt;&amp; moves,</div>
<div class="line"><a name="l06626"></a><span class="lineno"> 6626</span>&#160; VkDeviceSize maxBytesToMove,</div>
<div class="line"><a name="l06627"></a><span class="lineno"> 6627</span>&#160; uint32_t maxAllocationsToMove);</div>
<div class="line"><a name="l06628"></a><span class="lineno"> 6628</span>&#160; </div>
<div class="line"><a name="l06629"></a><span class="lineno"> 6629</span>&#160; <span class="keyword">virtual</span> VkDeviceSize GetBytesMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BytesMoved; }</div>
<div class="line"><a name="l06630"></a><span class="lineno"> 6630</span>&#160; <span class="keyword">virtual</span> uint32_t GetAllocationsMoved()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_AllocationsMoved; }</div>
<div class="line"><a name="l06631"></a><span class="lineno"> 6631</span>&#160; </div>
<div class="line"><a name="l06632"></a><span class="lineno"> 6632</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l06633"></a><span class="lineno"> 6633</span>&#160; <span class="keyword">struct </span>BlockInfo</div>
<div class="line"><a name="l06634"></a><span class="lineno"> 6634</span>&#160; {</div>
<div class="line"><a name="l06635"></a><span class="lineno"> 6635</span>&#160; <span class="keywordtype">size_t</span> origBlockIndex;</div>
<div class="line"><a name="l06636"></a><span class="lineno"> 6636</span>&#160; };</div>
<div class="line"><a name="l06637"></a><span class="lineno"> 6637</span>&#160; </div>
<div class="line"><a name="l06638"></a><span class="lineno"> 6638</span>&#160; <span class="keyword">class </span>FreeSpaceDatabase</div>
<div class="line"><a name="l06639"></a><span class="lineno"> 6639</span>&#160; {</div>
<div class="line"><a name="l06640"></a><span class="lineno"> 6640</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l06641"></a><span class="lineno"> 6641</span>&#160; FreeSpaceDatabase()</div>
<div class="line"><a name="l06642"></a><span class="lineno"> 6642</span>&#160; {</div>
<div class="line"><a name="l06643"></a><span class="lineno"> 6643</span>&#160; FreeSpace s = {};</div>
<div class="line"><a name="l06644"></a><span class="lineno"> 6644</span>&#160; s.blockInfoIndex = SIZE_MAX;</div>
<div class="line"><a name="l06645"></a><span class="lineno"> 6645</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; MAX_COUNT; ++i)</div>
<div class="line"><a name="l06646"></a><span class="lineno"> 6646</span>&#160; {</div>
<div class="line"><a name="l06647"></a><span class="lineno"> 6647</span>&#160; m_FreeSpaces[i] = s;</div>
<div class="line"><a name="l06648"></a><span class="lineno"> 6648</span>&#160; }</div>
<div class="line"><a name="l06649"></a><span class="lineno"> 6649</span>&#160; }</div>
<div class="line"><a name="l06650"></a><span class="lineno"> 6650</span>&#160; </div>
<div class="line"><a name="l06651"></a><span class="lineno"> 6651</span>&#160; <span class="keywordtype">void</span> Register(<span class="keywordtype">size_t</span> blockInfoIndex, VkDeviceSize offset, VkDeviceSize size)</div>
<div class="line"><a name="l06652"></a><span class="lineno"> 6652</span>&#160; {</div>
<div class="line"><a name="l06653"></a><span class="lineno"> 6653</span>&#160; <span class="keywordflow">if</span>(size &lt; VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
<div class="line"><a name="l06654"></a><span class="lineno"> 6654</span>&#160; {</div>
<div class="line"><a name="l06655"></a><span class="lineno"> 6655</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l06656"></a><span class="lineno"> 6656</span>&#160; }</div>
<div class="line"><a name="l06657"></a><span class="lineno"> 6657</span>&#160; </div>
<div class="line"><a name="l06658"></a><span class="lineno"> 6658</span>&#160; <span class="comment">// Find first invalid or the smallest structure.</span></div>
<div class="line"><a name="l06659"></a><span class="lineno"> 6659</span>&#160; <span class="keywordtype">size_t</span> bestIndex = SIZE_MAX;</div>
<div class="line"><a name="l06660"></a><span class="lineno"> 6660</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; MAX_COUNT; ++i)</div>
<div class="line"><a name="l06661"></a><span class="lineno"> 6661</span>&#160; {</div>
<div class="line"><a name="l06662"></a><span class="lineno"> 6662</span>&#160; <span class="comment">// Empty structure.</span></div>
<div class="line"><a name="l06663"></a><span class="lineno"> 6663</span>&#160; <span class="keywordflow">if</span>(m_FreeSpaces[i].blockInfoIndex == SIZE_MAX)</div>
<div class="line"><a name="l06664"></a><span class="lineno"> 6664</span>&#160; {</div>
<div class="line"><a name="l06665"></a><span class="lineno"> 6665</span>&#160; bestIndex = i;</div>
<div class="line"><a name="l06666"></a><span class="lineno"> 6666</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l06667"></a><span class="lineno"> 6667</span>&#160; }</div>
<div class="line"><a name="l06668"></a><span class="lineno"> 6668</span>&#160; <span class="keywordflow">if</span>(m_FreeSpaces[i].size &lt; size &amp;&amp;</div>
<div class="line"><a name="l06669"></a><span class="lineno"> 6669</span>&#160; (bestIndex == SIZE_MAX || m_FreeSpaces[bestIndex].size &gt; m_FreeSpaces[i].size))</div>
<div class="line"><a name="l06670"></a><span class="lineno"> 6670</span>&#160; {</div>
<div class="line"><a name="l06671"></a><span class="lineno"> 6671</span>&#160; bestIndex = i;</div>
<div class="line"><a name="l06672"></a><span class="lineno"> 6672</span>&#160; }</div>
<div class="line"><a name="l06673"></a><span class="lineno"> 6673</span>&#160; }</div>
<div class="line"><a name="l06674"></a><span class="lineno"> 6674</span>&#160; </div>
<div class="line"><a name="l06675"></a><span class="lineno"> 6675</span>&#160; <span class="keywordflow">if</span>(bestIndex != SIZE_MAX)</div>
<div class="line"><a name="l06676"></a><span class="lineno"> 6676</span>&#160; {</div>
<div class="line"><a name="l06677"></a><span class="lineno"> 6677</span>&#160; m_FreeSpaces[bestIndex].blockInfoIndex = blockInfoIndex;</div>
<div class="line"><a name="l06678"></a><span class="lineno"> 6678</span>&#160; m_FreeSpaces[bestIndex].offset = offset;</div>
<div class="line"><a name="l06679"></a><span class="lineno"> 6679</span>&#160; m_FreeSpaces[bestIndex].size = size;</div>
<div class="line"><a name="l06680"></a><span class="lineno"> 6680</span>&#160; }</div>
<div class="line"><a name="l06681"></a><span class="lineno"> 6681</span>&#160; }</div>
<div class="line"><a name="l06682"></a><span class="lineno"> 6682</span>&#160; </div>
<div class="line"><a name="l06683"></a><span class="lineno"> 6683</span>&#160; <span class="keywordtype">bool</span> Fetch(VkDeviceSize alignment, VkDeviceSize size,</div>
<div class="line"><a name="l06684"></a><span class="lineno"> 6684</span>&#160; <span class="keywordtype">size_t</span>&amp; outBlockInfoIndex, VkDeviceSize&amp; outDstOffset)</div>
<div class="line"><a name="l06685"></a><span class="lineno"> 6685</span>&#160; {</div>
<div class="line"><a name="l06686"></a><span class="lineno"> 6686</span>&#160; <span class="keywordtype">size_t</span> bestIndex = SIZE_MAX;</div>
<div class="line"><a name="l06687"></a><span class="lineno"> 6687</span>&#160; VkDeviceSize bestFreeSpaceAfter = 0;</div>
<div class="line"><a name="l06688"></a><span class="lineno"> 6688</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; MAX_COUNT; ++i)</div>
<div class="line"><a name="l06689"></a><span class="lineno"> 6689</span>&#160; {</div>
<div class="line"><a name="l06690"></a><span class="lineno"> 6690</span>&#160; <span class="comment">// Structure is valid.</span></div>
<div class="line"><a name="l06691"></a><span class="lineno"> 6691</span>&#160; <span class="keywordflow">if</span>(m_FreeSpaces[i].blockInfoIndex != SIZE_MAX)</div>
<div class="line"><a name="l06692"></a><span class="lineno"> 6692</span>&#160; {</div>
<div class="line"><a name="l06693"></a><span class="lineno"> 6693</span>&#160; <span class="keyword">const</span> VkDeviceSize dstOffset = VmaAlignUp(m_FreeSpaces[i].offset, alignment);</div>
<div class="line"><a name="l06694"></a><span class="lineno"> 6694</span>&#160; <span class="comment">// Allocation fits into this structure.</span></div>
<div class="line"><a name="l06695"></a><span class="lineno"> 6695</span>&#160; <span class="keywordflow">if</span>(dstOffset + size &lt;= m_FreeSpaces[i].offset + m_FreeSpaces[i].size)</div>
<div class="line"><a name="l06696"></a><span class="lineno"> 6696</span>&#160; {</div>
<div class="line"><a name="l06697"></a><span class="lineno"> 6697</span>&#160; <span class="keyword">const</span> VkDeviceSize freeSpaceAfter = (m_FreeSpaces[i].offset + m_FreeSpaces[i].size) -</div>
<div class="line"><a name="l06698"></a><span class="lineno"> 6698</span>&#160; (dstOffset + size);</div>
<div class="line"><a name="l06699"></a><span class="lineno"> 6699</span>&#160; <span class="keywordflow">if</span>(bestIndex == SIZE_MAX || freeSpaceAfter &gt; bestFreeSpaceAfter)</div>
<div class="line"><a name="l06700"></a><span class="lineno"> 6700</span>&#160; {</div>
<div class="line"><a name="l06701"></a><span class="lineno"> 6701</span>&#160; bestIndex = i;</div>
<div class="line"><a name="l06702"></a><span class="lineno"> 6702</span>&#160; bestFreeSpaceAfter = freeSpaceAfter;</div>
<div class="line"><a name="l06703"></a><span class="lineno"> 6703</span>&#160; }</div>
<div class="line"><a name="l06704"></a><span class="lineno"> 6704</span>&#160; }</div>
<div class="line"><a name="l06705"></a><span class="lineno"> 6705</span>&#160; }</div>
<div class="line"><a name="l06706"></a><span class="lineno"> 6706</span>&#160; }</div>
<div class="line"><a name="l06707"></a><span class="lineno"> 6707</span>&#160; </div>
<div class="line"><a name="l06708"></a><span class="lineno"> 6708</span>&#160; <span class="keywordflow">if</span>(bestIndex != SIZE_MAX)</div>
<div class="line"><a name="l06709"></a><span class="lineno"> 6709</span>&#160; {</div>
<div class="line"><a name="l06710"></a><span class="lineno"> 6710</span>&#160; outBlockInfoIndex = m_FreeSpaces[bestIndex].blockInfoIndex;</div>
<div class="line"><a name="l06711"></a><span class="lineno"> 6711</span>&#160; outDstOffset = VmaAlignUp(m_FreeSpaces[bestIndex].offset, alignment);</div>
<div class="line"><a name="l06712"></a><span class="lineno"> 6712</span>&#160; </div>
<div class="line"><a name="l06713"></a><span class="lineno"> 6713</span>&#160; <span class="keywordflow">if</span>(bestFreeSpaceAfter &gt;= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)</div>
<div class="line"><a name="l06714"></a><span class="lineno"> 6714</span>&#160; {</div>
<div class="line"><a name="l06715"></a><span class="lineno"> 6715</span>&#160; <span class="comment">// Leave this structure for remaining empty space.</span></div>
<div class="line"><a name="l06716"></a><span class="lineno"> 6716</span>&#160; <span class="keyword">const</span> VkDeviceSize alignmentPlusSize = (outDstOffset - m_FreeSpaces[bestIndex].offset) + size;</div>
<div class="line"><a name="l06717"></a><span class="lineno"> 6717</span>&#160; m_FreeSpaces[bestIndex].offset += alignmentPlusSize;</div>
<div class="line"><a name="l06718"></a><span class="lineno"> 6718</span>&#160; m_FreeSpaces[bestIndex].size -= alignmentPlusSize;</div>
<div class="line"><a name="l06719"></a><span class="lineno"> 6719</span>&#160; }</div>
<div class="line"><a name="l06720"></a><span class="lineno"> 6720</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l06721"></a><span class="lineno"> 6721</span>&#160; {</div>
<div class="line"><a name="l06722"></a><span class="lineno"> 6722</span>&#160; <span class="comment">// This structure becomes invalid.</span></div>
<div class="line"><a name="l06723"></a><span class="lineno"> 6723</span>&#160; m_FreeSpaces[bestIndex].blockInfoIndex = SIZE_MAX;</div>
<div class="line"><a name="l06724"></a><span class="lineno"> 6724</span>&#160; }</div>
<div class="line"><a name="l06725"></a><span class="lineno"> 6725</span>&#160; </div>
<div class="line"><a name="l06726"></a><span class="lineno"> 6726</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l06727"></a><span class="lineno"> 6727</span>&#160; }</div>
<div class="line"><a name="l06728"></a><span class="lineno"> 6728</span>&#160; </div>
<div class="line"><a name="l06729"></a><span class="lineno"> 6729</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l06730"></a><span class="lineno"> 6730</span>&#160; }</div>
<div class="line"><a name="l06731"></a><span class="lineno"> 6731</span>&#160; </div>
<div class="line"><a name="l06732"></a><span class="lineno"> 6732</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l06733"></a><span class="lineno"> 6733</span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> MAX_COUNT = 4;</div>
<div class="line"><a name="l06734"></a><span class="lineno"> 6734</span>&#160; </div>
<div class="line"><a name="l06735"></a><span class="lineno"> 6735</span>&#160; <span class="keyword">struct </span>FreeSpace</div>
<div class="line"><a name="l06736"></a><span class="lineno"> 6736</span>&#160; {</div>
<div class="line"><a name="l06737"></a><span class="lineno"> 6737</span>&#160; <span class="keywordtype">size_t</span> blockInfoIndex; <span class="comment">// SIZE_MAX means this structure is invalid.</span></div>
<div class="line"><a name="l06738"></a><span class="lineno"> 6738</span>&#160; VkDeviceSize offset;</div>
<div class="line"><a name="l06739"></a><span class="lineno"> 6739</span>&#160; VkDeviceSize size;</div>
<div class="line"><a name="l06740"></a><span class="lineno"> 6740</span>&#160; } m_FreeSpaces[MAX_COUNT];</div>
<div class="line"><a name="l06741"></a><span class="lineno"> 6741</span>&#160; };</div>
<div class="line"><a name="l06742"></a><span class="lineno"> 6742</span>&#160; </div>
<div class="line"><a name="l06743"></a><span class="lineno"> 6743</span>&#160; <span class="keyword">const</span> <span class="keywordtype">bool</span> m_OverlappingMoveSupported;</div>
<div class="line"><a name="l06744"></a><span class="lineno"> 6744</span>&#160; </div>
<div class="line"><a name="l06745"></a><span class="lineno"> 6745</span>&#160; uint32_t m_AllocationCount;</div>
<div class="line"><a name="l06746"></a><span class="lineno"> 6746</span>&#160; <span class="keywordtype">bool</span> m_AllAllocations;</div>
<div class="line"><a name="l06747"></a><span class="lineno"> 6747</span>&#160; </div>
<div class="line"><a name="l06748"></a><span class="lineno"> 6748</span>&#160; VkDeviceSize m_BytesMoved;</div>
<div class="line"><a name="l06749"></a><span class="lineno"> 6749</span>&#160; uint32_t m_AllocationsMoved;</div>
<div class="line"><a name="l06750"></a><span class="lineno"> 6750</span>&#160; </div>
<div class="line"><a name="l06751"></a><span class="lineno"> 6751</span>&#160; VmaVector&lt; BlockInfo, VmaStlAllocator&lt;BlockInfo&gt; &gt; m_BlockInfos;</div>
<div class="line"><a name="l06752"></a><span class="lineno"> 6752</span>&#160; </div>
<div class="line"><a name="l06753"></a><span class="lineno"> 6753</span>&#160; <span class="keywordtype">void</span> PreprocessMetadata();</div>
<div class="line"><a name="l06754"></a><span class="lineno"> 6754</span>&#160; <span class="keywordtype">void</span> PostprocessMetadata();</div>
<div class="line"><a name="l06755"></a><span class="lineno"> 6755</span>&#160; <span class="keywordtype">void</span> InsertSuballoc(VmaBlockMetadata_Generic* pMetadata, <span class="keyword">const</span> VmaSuballocation&amp; suballoc);</div>
<div class="line"><a name="l06756"></a><span class="lineno"> 6756</span>&#160;};</div>
<div class="line"><a name="l06757"></a><span class="lineno"> 6757</span>&#160; </div>
<div class="line"><a name="l06758"></a><span class="lineno"> 6758</span>&#160;<span class="keyword">struct </span>VmaBlockDefragmentationContext</div>
<div class="line"><a name="l06759"></a><span class="lineno"> 6759</span>&#160;{</div>
<div class="line"><a name="l06760"></a><span class="lineno"> 6760</span>&#160; <span class="keyword">enum</span> BLOCK_FLAG</div>
<div class="line"><a name="l06761"></a><span class="lineno"> 6761</span>&#160; {</div>
<div class="line"><a name="l06762"></a><span class="lineno"> 6762</span>&#160; BLOCK_FLAG_USED = 0x00000001,</div>
<div class="line"><a name="l06763"></a><span class="lineno"> 6763</span>&#160; };</div>
<div class="line"><a name="l06764"></a><span class="lineno"> 6764</span>&#160; uint32_t flags;</div>
<div class="line"><a name="l06765"></a><span class="lineno"> 6765</span>&#160; VkBuffer hBuffer;</div>
<div class="line"><a name="l06766"></a><span class="lineno"> 6766</span>&#160;};</div>
<div class="line"><a name="l06767"></a><span class="lineno"> 6767</span>&#160; </div>
<div class="line"><a name="l06768"></a><span class="lineno"> 6768</span>&#160;<span class="keyword">class </span>VmaBlockVectorDefragmentationContext</div>
<div class="line"><a name="l06769"></a><span class="lineno"> 6769</span>&#160;{</div>
<div class="line"><a name="l06770"></a><span class="lineno"> 6770</span>&#160; VMA_CLASS_NO_COPY(VmaBlockVectorDefragmentationContext)</div>
<div class="line"><a name="l06771"></a><span class="lineno"> 6771</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l06772"></a><span class="lineno"> 6772</span>&#160; VkResult res;</div>
<div class="line"><a name="l06773"></a><span class="lineno"> 6773</span>&#160; <span class="keywordtype">bool</span> mutexLocked;</div>
<div class="line"><a name="l06774"></a><span class="lineno"> 6774</span>&#160; VmaVector&lt; VmaBlockDefragmentationContext, VmaStlAllocator&lt;VmaBlockDefragmentationContext&gt; &gt; blockContexts;</div>
<div class="line"><a name="l06775"></a><span class="lineno"> 6775</span>&#160; </div>
<div class="line"><a name="l06776"></a><span class="lineno"> 6776</span>&#160; VmaBlockVectorDefragmentationContext(</div>
<div class="line"><a name="l06777"></a><span class="lineno"> 6777</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
<div class="line"><a name="l06778"></a><span class="lineno"> 6778</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> hCustomPool, <span class="comment">// Optional.</span></div>
<div class="line"><a name="l06779"></a><span class="lineno"> 6779</span>&#160; VmaBlockVector* pBlockVector,</div>
<div class="line"><a name="l06780"></a><span class="lineno"> 6780</span>&#160; uint32_t currFrameIndex);</div>
<div class="line"><a name="l06781"></a><span class="lineno"> 6781</span>&#160; ~VmaBlockVectorDefragmentationContext();</div>
<div class="line"><a name="l06782"></a><span class="lineno"> 6782</span>&#160; </div>
<div class="line"><a name="l06783"></a><span class="lineno"> 6783</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> GetCustomPool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_hCustomPool; }</div>
<div class="line"><a name="l06784"></a><span class="lineno"> 6784</span>&#160; VmaBlockVector* GetBlockVector()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pBlockVector; }</div>
<div class="line"><a name="l06785"></a><span class="lineno"> 6785</span>&#160; VmaDefragmentationAlgorithm* GetAlgorithm()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pAlgorithm; }</div>
<div class="line"><a name="l06786"></a><span class="lineno"> 6786</span>&#160; </div>
<div class="line"><a name="l06787"></a><span class="lineno"> 6787</span>&#160; <span class="keywordtype">void</span> AddAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc, VkBool32* pChanged);</div>
<div class="line"><a name="l06788"></a><span class="lineno"> 6788</span>&#160; <span class="keywordtype">void</span> AddAll() { m_AllAllocations = <span class="keyword">true</span>; }</div>
<div class="line"><a name="l06789"></a><span class="lineno"> 6789</span>&#160; </div>
<div class="line"><a name="l06790"></a><span class="lineno"> 6790</span>&#160; <span class="keywordtype">void</span> Begin(<span class="keywordtype">bool</span> overlappingMoveSupported);</div>
<div class="line"><a name="l06791"></a><span class="lineno"> 6791</span>&#160; </div>
<div class="line"><a name="l06792"></a><span class="lineno"> 6792</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l06793"></a><span class="lineno"> 6793</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> m_hAllocator;</div>
<div class="line"><a name="l06794"></a><span class="lineno"> 6794</span>&#160; <span class="comment">// Null if not from custom pool.</span></div>
<div class="line"><a name="l06795"></a><span class="lineno"> 6795</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_pool.html">VmaPool</a> m_hCustomPool;</div>
<div class="line"><a name="l06796"></a><span class="lineno"> 6796</span>&#160; <span class="comment">// Redundant, for convenience not to fetch from m_hCustomPool-&gt;m_BlockVector or m_hAllocator-&gt;m_pBlockVectors.</span></div>
<div class="line"><a name="l06797"></a><span class="lineno"> 6797</span>&#160; VmaBlockVector* <span class="keyword">const</span> m_pBlockVector;</div>
<div class="line"><a name="l06798"></a><span class="lineno"> 6798</span>&#160; <span class="keyword">const</span> uint32_t m_CurrFrameIndex;</div>
<div class="line"><a name="l06799"></a><span class="lineno"> 6799</span>&#160; <span class="comment">// Owner of this object.</span></div>
<div class="line"><a name="l06800"></a><span class="lineno"> 6800</span>&#160; VmaDefragmentationAlgorithm* m_pAlgorithm;</div>
<div class="line"><a name="l06801"></a><span class="lineno"> 6801</span>&#160; </div>
<div class="line"><a name="l06802"></a><span class="lineno"> 6802</span>&#160; <span class="keyword">struct </span>AllocInfo</div>
<div class="line"><a name="l06803"></a><span class="lineno"> 6803</span>&#160; {</div>
<div class="line"><a name="l06804"></a><span class="lineno"> 6804</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc;</div>
<div class="line"><a name="l06805"></a><span class="lineno"> 6805</span>&#160; VkBool32* pChanged;</div>
<div class="line"><a name="l06806"></a><span class="lineno"> 6806</span>&#160; };</div>
<div class="line"><a name="l06807"></a><span class="lineno"> 6807</span>&#160; <span class="comment">// Used between constructor and Begin.</span></div>
<div class="line"><a name="l06808"></a><span class="lineno"> 6808</span>&#160; VmaVector&lt; AllocInfo, VmaStlAllocator&lt;AllocInfo&gt; &gt; m_Allocations;</div>
<div class="line"><a name="l06809"></a><span class="lineno"> 6809</span>&#160; <span class="keywordtype">bool</span> m_AllAllocations;</div>
<div class="line"><a name="l06810"></a><span class="lineno"> 6810</span>&#160;};</div>
<div class="line"><a name="l06811"></a><span class="lineno"> 6811</span>&#160; </div>
<div class="line"><a name="l06812"></a><span class="lineno"> 6812</span>&#160;<span class="keyword">struct </span>VmaDefragmentationContext_T</div>
<div class="line"><a name="l06813"></a><span class="lineno"> 6813</span>&#160;{</div>
<div class="line"><a name="l06814"></a><span class="lineno"> 6814</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l06815"></a><span class="lineno"> 6815</span>&#160; VMA_CLASS_NO_COPY(VmaDefragmentationContext_T)</div>
<div class="line"><a name="l06816"></a><span class="lineno"> 6816</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l06817"></a><span class="lineno"> 6817</span>&#160; VmaDefragmentationContext_T(</div>
<div class="line"><a name="l06818"></a><span class="lineno"> 6818</span>&#160; <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator,</div>
<div class="line"><a name="l06819"></a><span class="lineno"> 6819</span>&#160; uint32_t currFrameIndex,</div>
<div class="line"><a name="l06820"></a><span class="lineno"> 6820</span>&#160; uint32_t flags,</div>
<div class="line"><a name="l06821"></a><span class="lineno"> 6821</span>&#160; <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats);</div>
<div class="line"><a name="l06822"></a><span class="lineno"> 6822</span>&#160; ~VmaDefragmentationContext_T();</div>
<div class="line"><a name="l06823"></a><span class="lineno"> 6823</span>&#160; </div>
<div class="line"><a name="l06824"></a><span class="lineno"> 6824</span>&#160; <span class="keywordtype">void</span> AddPools(uint32_t poolCount, <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPools);</div>
<div class="line"><a name="l06825"></a><span class="lineno"> 6825</span>&#160; <span class="keywordtype">void</span> AddAllocations(</div>
<div class="line"><a name="l06826"></a><span class="lineno"> 6826</span>&#160; uint32_t allocationCount,</div>
<div class="line"><a name="l06827"></a><span class="lineno"> 6827</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations,</div>
<div class="line"><a name="l06828"></a><span class="lineno"> 6828</span>&#160; VkBool32* pAllocationsChanged);</div>
<div class="line"><a name="l06829"></a><span class="lineno"> 6829</span>&#160; </div>
<div class="line"><a name="l06830"></a><span class="lineno"> 6830</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l06831"></a><span class="lineno"> 6831</span>&#160;<span class="comment"> Returns:</span></div>
<div class="line"><a name="l06832"></a><span class="lineno"> 6832</span>&#160;<span class="comment"> - `VK_SUCCESS` if succeeded and object can be destroyed immediately.</span></div>
<div class="line"><a name="l06833"></a><span class="lineno"> 6833</span>&#160;<span class="comment"> - `VK_NOT_READY` if succeeded but the object must remain alive until vmaDefragmentationEnd().</span></div>
<div class="line"><a name="l06834"></a><span class="lineno"> 6834</span>&#160;<span class="comment"> - Negative value if error occured and object can be destroyed immediately.</span></div>
<div class="line"><a name="l06835"></a><span class="lineno"> 6835</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l06836"></a><span class="lineno"> 6836</span>&#160; VkResult Defragment(</div>
<div class="line"><a name="l06837"></a><span class="lineno"> 6837</span>&#160; VkDeviceSize maxCpuBytesToMove, uint32_t maxCpuAllocationsToMove,</div>
<div class="line"><a name="l06838"></a><span class="lineno"> 6838</span>&#160; VkDeviceSize maxGpuBytesToMove, uint32_t maxGpuAllocationsToMove,</div>
<div class="line"><a name="l06839"></a><span class="lineno"> 6839</span>&#160; VkCommandBuffer commandBuffer, <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats);</div>
<div class="line"><a name="l06840"></a><span class="lineno"> 6840</span>&#160; </div>
<div class="line"><a name="l06841"></a><span class="lineno"> 6841</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l06842"></a><span class="lineno"> 6842</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocator.html">VmaAllocator</a> m_hAllocator;</div>
<div class="line"><a name="l06843"></a><span class="lineno"> 6843</span>&#160; <span class="keyword">const</span> uint32_t m_CurrFrameIndex;</div>
<div class="line"><a name="l06844"></a><span class="lineno"> 6844</span>&#160; <span class="keyword">const</span> uint32_t m_Flags;</div>
<div class="line"><a name="l06845"></a><span class="lineno"> 6845</span>&#160; <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* <span class="keyword">const</span> m_pStats;</div>
<div class="line"><a name="l06846"></a><span class="lineno"> 6846</span>&#160; <span class="comment">// Owner of these objects.</span></div>
<div class="line"><a name="l06847"></a><span class="lineno"> 6847</span>&#160; VmaBlockVectorDefragmentationContext* m_DefaultPoolContexts[VK_MAX_MEMORY_TYPES];</div>
<div class="line"><a name="l06848"></a><span class="lineno"> 6848</span>&#160; <span class="comment">// Owner of these objects.</span></div>
<div class="line"><a name="l06849"></a><span class="lineno"> 6849</span>&#160; VmaVector&lt; VmaBlockVectorDefragmentationContext*, VmaStlAllocator&lt;VmaBlockVectorDefragmentationContext*&gt; &gt; m_CustomPoolContexts;</div>
<div class="line"><a name="l06850"></a><span class="lineno"> 6850</span>&#160;};</div>
<div class="line"><a name="l06851"></a><span class="lineno"> 6851</span>&#160; </div>
<div class="line"><a name="l06852"></a><span class="lineno"> 6852</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
<div class="line"><a name="l06853"></a><span class="lineno"> 6853</span>&#160; </div>
<div class="line"><a name="l06854"></a><span class="lineno"> 6854</span>&#160;<span class="keyword">class </span>VmaRecorder</div>
<div class="line"><a name="l06855"></a><span class="lineno"> 6855</span>&#160;{</div>
<div class="line"><a name="l06856"></a><span class="lineno"> 6856</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l06857"></a><span class="lineno"> 6857</span>&#160; VmaRecorder();</div>
<div class="line"><a name="l06858"></a><span class="lineno"> 6858</span>&#160; VkResult Init(<span class="keyword">const</span> <a class="code" href="struct_vma_record_settings.html">VmaRecordSettings</a>&amp; settings, <span class="keywordtype">bool</span> useMutex);</div>
<div class="line"><a name="l06859"></a><span class="lineno"> 6859</span>&#160; <span class="keywordtype">void</span> WriteConfiguration(</div>
<div class="line"><a name="l06860"></a><span class="lineno"> 6860</span>&#160; <span class="keyword">const</span> VkPhysicalDeviceProperties&amp; devProps,</div>
<div class="line"><a name="l06861"></a><span class="lineno"> 6861</span>&#160; <span class="keyword">const</span> VkPhysicalDeviceMemoryProperties&amp; memProps,</div>
<div class="line"><a name="l06862"></a><span class="lineno"> 6862</span>&#160; uint32_t vulkanApiVersion,</div>
<div class="line"><a name="l06863"></a><span class="lineno"> 6863</span>&#160; <span class="keywordtype">bool</span> dedicatedAllocationExtensionEnabled,</div>
<div class="line"><a name="l06864"></a><span class="lineno"> 6864</span>&#160; <span class="keywordtype">bool</span> bindMemory2ExtensionEnabled,</div>
<div class="line"><a name="l06865"></a><span class="lineno"> 6865</span>&#160; <span class="keywordtype">bool</span> memoryBudgetExtensionEnabled);</div>
<div class="line"><a name="l06866"></a><span class="lineno"> 6866</span>&#160; ~VmaRecorder();</div>
<div class="line"><a name="l06867"></a><span class="lineno"> 6867</span>&#160; </div>
<div class="line"><a name="l06868"></a><span class="lineno"> 6868</span>&#160; <span class="keywordtype">void</span> RecordCreateAllocator(uint32_t frameIndex);</div>
<div class="line"><a name="l06869"></a><span class="lineno"> 6869</span>&#160; <span class="keywordtype">void</span> RecordDestroyAllocator(uint32_t frameIndex);</div>
<div class="line"><a name="l06870"></a><span class="lineno"> 6870</span>&#160; <span class="keywordtype">void</span> RecordCreatePool(uint32_t frameIndex,</div>
<div class="line"><a name="l06871"></a><span class="lineno"> 6871</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>&amp; createInfo,</div>
<div class="line"><a name="l06872"></a><span class="lineno"> 6872</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
<div class="line"><a name="l06873"></a><span class="lineno"> 6873</span>&#160; <span class="keywordtype">void</span> RecordDestroyPool(uint32_t frameIndex, <a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
<div class="line"><a name="l06874"></a><span class="lineno"> 6874</span>&#160; <span class="keywordtype">void</span> RecordAllocateMemory(uint32_t frameIndex,</div>
<div class="line"><a name="l06875"></a><span class="lineno"> 6875</span>&#160; <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
<div class="line"><a name="l06876"></a><span class="lineno"> 6876</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
<div class="line"><a name="l06877"></a><span class="lineno"> 6877</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06878"></a><span class="lineno"> 6878</span>&#160; <span class="keywordtype">void</span> RecordAllocateMemoryPages(uint32_t frameIndex,</div>
<div class="line"><a name="l06879"></a><span class="lineno"> 6879</span>&#160; <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
<div class="line"><a name="l06880"></a><span class="lineno"> 6880</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
<div class="line"><a name="l06881"></a><span class="lineno"> 6881</span>&#160; uint64_t allocationCount,</div>
<div class="line"><a name="l06882"></a><span class="lineno"> 6882</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
<div class="line"><a name="l06883"></a><span class="lineno"> 6883</span>&#160; <span class="keywordtype">void</span> RecordAllocateMemoryForBuffer(uint32_t frameIndex,</div>
<div class="line"><a name="l06884"></a><span class="lineno"> 6884</span>&#160; <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
<div class="line"><a name="l06885"></a><span class="lineno"> 6885</span>&#160; <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
<div class="line"><a name="l06886"></a><span class="lineno"> 6886</span>&#160; <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
<div class="line"><a name="l06887"></a><span class="lineno"> 6887</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
<div class="line"><a name="l06888"></a><span class="lineno"> 6888</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06889"></a><span class="lineno"> 6889</span>&#160; <span class="keywordtype">void</span> RecordAllocateMemoryForImage(uint32_t frameIndex,</div>
<div class="line"><a name="l06890"></a><span class="lineno"> 6890</span>&#160; <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
<div class="line"><a name="l06891"></a><span class="lineno"> 6891</span>&#160; <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
<div class="line"><a name="l06892"></a><span class="lineno"> 6892</span>&#160; <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
<div class="line"><a name="l06893"></a><span class="lineno"> 6893</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
<div class="line"><a name="l06894"></a><span class="lineno"> 6894</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06895"></a><span class="lineno"> 6895</span>&#160; <span class="keywordtype">void</span> RecordFreeMemory(uint32_t frameIndex,</div>
<div class="line"><a name="l06896"></a><span class="lineno"> 6896</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06897"></a><span class="lineno"> 6897</span>&#160; <span class="keywordtype">void</span> RecordFreeMemoryPages(uint32_t frameIndex,</div>
<div class="line"><a name="l06898"></a><span class="lineno"> 6898</span>&#160; uint64_t allocationCount,</div>
<div class="line"><a name="l06899"></a><span class="lineno"> 6899</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
<div class="line"><a name="l06900"></a><span class="lineno"> 6900</span>&#160; <span class="keywordtype">void</span> RecordSetAllocationUserData(uint32_t frameIndex,</div>
<div class="line"><a name="l06901"></a><span class="lineno"> 6901</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation,</div>
<div class="line"><a name="l06902"></a><span class="lineno"> 6902</span>&#160; <span class="keyword">const</span> <span class="keywordtype">void</span>* pUserData);</div>
<div class="line"><a name="l06903"></a><span class="lineno"> 6903</span>&#160; <span class="keywordtype">void</span> RecordCreateLostAllocation(uint32_t frameIndex,</div>
<div class="line"><a name="l06904"></a><span class="lineno"> 6904</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06905"></a><span class="lineno"> 6905</span>&#160; <span class="keywordtype">void</span> RecordMapMemory(uint32_t frameIndex,</div>
<div class="line"><a name="l06906"></a><span class="lineno"> 6906</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06907"></a><span class="lineno"> 6907</span>&#160; <span class="keywordtype">void</span> RecordUnmapMemory(uint32_t frameIndex,</div>
<div class="line"><a name="l06908"></a><span class="lineno"> 6908</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06909"></a><span class="lineno"> 6909</span>&#160; <span class="keywordtype">void</span> RecordFlushAllocation(uint32_t frameIndex,</div>
<div class="line"><a name="l06910"></a><span class="lineno"> 6910</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size);</div>
<div class="line"><a name="l06911"></a><span class="lineno"> 6911</span>&#160; <span class="keywordtype">void</span> RecordInvalidateAllocation(uint32_t frameIndex,</div>
<div class="line"><a name="l06912"></a><span class="lineno"> 6912</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize offset, VkDeviceSize size);</div>
<div class="line"><a name="l06913"></a><span class="lineno"> 6913</span>&#160; <span class="keywordtype">void</span> RecordCreateBuffer(uint32_t frameIndex,</div>
<div class="line"><a name="l06914"></a><span class="lineno"> 6914</span>&#160; <span class="keyword">const</span> VkBufferCreateInfo&amp; bufCreateInfo,</div>
<div class="line"><a name="l06915"></a><span class="lineno"> 6915</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; allocCreateInfo,</div>
<div class="line"><a name="l06916"></a><span class="lineno"> 6916</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06917"></a><span class="lineno"> 6917</span>&#160; <span class="keywordtype">void</span> RecordCreateImage(uint32_t frameIndex,</div>
<div class="line"><a name="l06918"></a><span class="lineno"> 6918</span>&#160; <span class="keyword">const</span> VkImageCreateInfo&amp; imageCreateInfo,</div>
<div class="line"><a name="l06919"></a><span class="lineno"> 6919</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; allocCreateInfo,</div>
<div class="line"><a name="l06920"></a><span class="lineno"> 6920</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06921"></a><span class="lineno"> 6921</span>&#160; <span class="keywordtype">void</span> RecordDestroyBuffer(uint32_t frameIndex,</div>
<div class="line"><a name="l06922"></a><span class="lineno"> 6922</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06923"></a><span class="lineno"> 6923</span>&#160; <span class="keywordtype">void</span> RecordDestroyImage(uint32_t frameIndex,</div>
<div class="line"><a name="l06924"></a><span class="lineno"> 6924</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06925"></a><span class="lineno"> 6925</span>&#160; <span class="keywordtype">void</span> RecordTouchAllocation(uint32_t frameIndex,</div>
<div class="line"><a name="l06926"></a><span class="lineno"> 6926</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06927"></a><span class="lineno"> 6927</span>&#160; <span class="keywordtype">void</span> RecordGetAllocationInfo(uint32_t frameIndex,</div>
<div class="line"><a name="l06928"></a><span class="lineno"> 6928</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l06929"></a><span class="lineno"> 6929</span>&#160; <span class="keywordtype">void</span> RecordMakePoolAllocationsLost(uint32_t frameIndex,</div>
<div class="line"><a name="l06930"></a><span class="lineno"> 6930</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
<div class="line"><a name="l06931"></a><span class="lineno"> 6931</span>&#160; <span class="keywordtype">void</span> RecordDefragmentationBegin(uint32_t frameIndex,</div>
<div class="line"><a name="l06932"></a><span class="lineno"> 6932</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>&amp; info,</div>
<div class="line"><a name="l06933"></a><span class="lineno"> 6933</span>&#160; <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx);</div>
<div class="line"><a name="l06934"></a><span class="lineno"> 6934</span>&#160; <span class="keywordtype">void</span> RecordDefragmentationEnd(uint32_t frameIndex,</div>
<div class="line"><a name="l06935"></a><span class="lineno"> 6935</span>&#160; <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> ctx);</div>
<div class="line"><a name="l06936"></a><span class="lineno"> 6936</span>&#160; <span class="keywordtype">void</span> RecordSetPoolName(uint32_t frameIndex,</div>
<div class="line"><a name="l06937"></a><span class="lineno"> 6937</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> pool,</div>
<div class="line"><a name="l06938"></a><span class="lineno"> 6938</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* name);</div>
<div class="line"><a name="l06939"></a><span class="lineno"> 6939</span>&#160; </div>
<div class="line"><a name="l06940"></a><span class="lineno"> 6940</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l06941"></a><span class="lineno"> 6941</span>&#160; <span class="keyword">struct </span>CallParams</div>
<div class="line"><a name="l06942"></a><span class="lineno"> 6942</span>&#160; {</div>
<div class="line"><a name="l06943"></a><span class="lineno"> 6943</span>&#160; uint32_t threadId;</div>
<div class="line"><a name="l06944"></a><span class="lineno"> 6944</span>&#160; <span class="keywordtype">double</span> time;</div>
<div class="line"><a name="l06945"></a><span class="lineno"> 6945</span>&#160; };</div>
<div class="line"><a name="l06946"></a><span class="lineno"> 6946</span>&#160; </div>
<div class="line"><a name="l06947"></a><span class="lineno"> 6947</span>&#160; <span class="keyword">class </span>UserDataString</div>
<div class="line"><a name="l06948"></a><span class="lineno"> 6948</span>&#160; {</div>
<div class="line"><a name="l06949"></a><span class="lineno"> 6949</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l06950"></a><span class="lineno"> 6950</span>&#160; UserDataString(<a class="code" href="vk__mem__alloc_8h.html#a5225e5e11f8376f6a31a1791f3d6e817">VmaAllocationCreateFlags</a> allocFlags, <span class="keyword">const</span> <span class="keywordtype">void</span>* pUserData);</div>
<div class="line"><a name="l06951"></a><span class="lineno"> 6951</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* GetString()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Str; }</div>
<div class="line"><a name="l06952"></a><span class="lineno"> 6952</span>&#160; </div>
<div class="line"><a name="l06953"></a><span class="lineno"> 6953</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l06954"></a><span class="lineno"> 6954</span>&#160; <span class="keywordtype">char</span> m_PtrStr[17];</div>
<div class="line"><a name="l06955"></a><span class="lineno"> 6955</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* m_Str;</div>
<div class="line"><a name="l06956"></a><span class="lineno"> 6956</span>&#160; };</div>
<div class="line"><a name="l06957"></a><span class="lineno"> 6957</span>&#160; </div>
<div class="line"><a name="l06958"></a><span class="lineno"> 6958</span>&#160; <span class="keywordtype">bool</span> m_UseMutex;</div>
<div class="line"><a name="l06959"></a><span class="lineno"> 6959</span>&#160; <a class="code" href="vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828">VmaRecordFlags</a> m_Flags;</div>
<div class="line"><a name="l06960"></a><span class="lineno"> 6960</span>&#160; FILE* m_File;</div>
<div class="line"><a name="l06961"></a><span class="lineno"> 6961</span>&#160; VMA_MUTEX m_FileMutex;</div>
<div class="line"><a name="l06962"></a><span class="lineno"> 6962</span>&#160; int64_t m_Freq;</div>
<div class="line"><a name="l06963"></a><span class="lineno"> 6963</span>&#160; int64_t m_StartCounter;</div>
<div class="line"><a name="l06964"></a><span class="lineno"> 6964</span>&#160; </div>
<div class="line"><a name="l06965"></a><span class="lineno"> 6965</span>&#160; <span class="keywordtype">void</span> GetBasicParams(CallParams&amp; outParams);</div>
<div class="line"><a name="l06966"></a><span class="lineno"> 6966</span>&#160; </div>
<div class="line"><a name="l06967"></a><span class="lineno"> 6967</span>&#160; <span class="comment">// T must be a pointer type, e.g. VmaAllocation, VmaPool.</span></div>
<div class="line"><a name="l06968"></a><span class="lineno"> 6968</span>&#160; <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l06969"></a><span class="lineno"> 6969</span>&#160; <span class="keywordtype">void</span> PrintPointerList(uint64_t count, <span class="keyword">const</span> T* pItems)</div>
<div class="line"><a name="l06970"></a><span class="lineno"> 6970</span>&#160; {</div>
<div class="line"><a name="l06971"></a><span class="lineno"> 6971</span>&#160; <span class="keywordflow">if</span>(count)</div>
<div class="line"><a name="l06972"></a><span class="lineno"> 6972</span>&#160; {</div>
<div class="line"><a name="l06973"></a><span class="lineno"> 6973</span>&#160; fprintf(m_File, <span class="stringliteral">&quot;%p&quot;</span>, pItems[0]);</div>
<div class="line"><a name="l06974"></a><span class="lineno"> 6974</span>&#160; <span class="keywordflow">for</span>(uint64_t i = 1; i &lt; count; ++i)</div>
<div class="line"><a name="l06975"></a><span class="lineno"> 6975</span>&#160; {</div>
<div class="line"><a name="l06976"></a><span class="lineno"> 6976</span>&#160; fprintf(m_File, <span class="stringliteral">&quot; %p&quot;</span>, pItems[i]);</div>
<div class="line"><a name="l06977"></a><span class="lineno"> 6977</span>&#160; }</div>
<div class="line"><a name="l06978"></a><span class="lineno"> 6978</span>&#160; }</div>
<div class="line"><a name="l06979"></a><span class="lineno"> 6979</span>&#160; }</div>
<div class="line"><a name="l06980"></a><span class="lineno"> 6980</span>&#160; </div>
<div class="line"><a name="l06981"></a><span class="lineno"> 6981</span>&#160; <span class="keywordtype">void</span> PrintPointerList(uint64_t count, <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pItems);</div>
<div class="line"><a name="l06982"></a><span class="lineno"> 6982</span>&#160; <span class="keywordtype">void</span> Flush();</div>
<div class="line"><a name="l06983"></a><span class="lineno"> 6983</span>&#160;};</div>
<div class="line"><a name="l06984"></a><span class="lineno"> 6984</span>&#160; </div>
<div class="line"><a name="l06985"></a><span class="lineno"> 6985</span>&#160;<span class="preprocessor">#endif // #if VMA_RECORDING_ENABLED</span></div>
<div class="line"><a name="l06986"></a><span class="lineno"> 6986</span>&#160; </div>
<div class="line"><a name="l06987"></a><span class="lineno"> 6987</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l06988"></a><span class="lineno"> 6988</span>&#160;<span class="comment">Thread-safe wrapper over VmaPoolAllocator free list, for allocation of VmaAllocation_T objects.</span></div>
<div class="line"><a name="l06989"></a><span class="lineno"> 6989</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l06990"></a><span class="lineno"> 6990</span>&#160;<span class="keyword">class </span>VmaAllocationObjectAllocator</div>
<div class="line"><a name="l06991"></a><span class="lineno"> 6991</span>&#160;{</div>
<div class="line"><a name="l06992"></a><span class="lineno"> 6992</span>&#160; VMA_CLASS_NO_COPY(VmaAllocationObjectAllocator)</div>
<div class="line"><a name="l06993"></a><span class="lineno"> 6993</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l06994"></a><span class="lineno"> 6994</span>&#160; VmaAllocationObjectAllocator(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks);</div>
<div class="line"><a name="l06995"></a><span class="lineno"> 6995</span>&#160; </div>
<div class="line"><a name="l06996"></a><span class="lineno"> 6996</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> Allocate();</div>
<div class="line"><a name="l06997"></a><span class="lineno"> 6997</span>&#160; <span class="keywordtype">void</span> Free(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAlloc);</div>
<div class="line"><a name="l06998"></a><span class="lineno"> 6998</span>&#160; </div>
<div class="line"><a name="l06999"></a><span class="lineno"> 6999</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l07000"></a><span class="lineno"> 7000</span>&#160; VMA_MUTEX m_Mutex;</div>
<div class="line"><a name="l07001"></a><span class="lineno"> 7001</span>&#160; VmaPoolAllocator&lt;VmaAllocation_T&gt; m_Allocator;</div>
<div class="line"><a name="l07002"></a><span class="lineno"> 7002</span>&#160;};</div>
<div class="line"><a name="l07003"></a><span class="lineno"> 7003</span>&#160; </div>
<div class="line"><a name="l07004"></a><span class="lineno"> 7004</span>&#160;<span class="keyword">struct </span>VmaCurrentBudgetData</div>
<div class="line"><a name="l07005"></a><span class="lineno"> 7005</span>&#160;{</div>
<div class="line"><a name="l07006"></a><span class="lineno"> 7006</span>&#160; VMA_ATOMIC_UINT64 m_BlockBytes[VK_MAX_MEMORY_HEAPS];</div>
<div class="line"><a name="l07007"></a><span class="lineno"> 7007</span>&#160; VMA_ATOMIC_UINT64 m_AllocationBytes[VK_MAX_MEMORY_HEAPS];</div>
<div class="line"><a name="l07008"></a><span class="lineno"> 7008</span>&#160; </div>
<div class="line"><a name="l07009"></a><span class="lineno"> 7009</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
<div class="line"><a name="l07010"></a><span class="lineno"> 7010</span>&#160; VMA_ATOMIC_UINT32 m_OperationsSinceBudgetFetch;</div>
<div class="line"><a name="l07011"></a><span class="lineno"> 7011</span>&#160; VMA_RW_MUTEX m_BudgetMutex;</div>
<div class="line"><a name="l07012"></a><span class="lineno"> 7012</span>&#160; uint64_t m_VulkanUsage[VK_MAX_MEMORY_HEAPS];</div>
<div class="line"><a name="l07013"></a><span class="lineno"> 7013</span>&#160; uint64_t m_VulkanBudget[VK_MAX_MEMORY_HEAPS];</div>
<div class="line"><a name="l07014"></a><span class="lineno"> 7014</span>&#160; uint64_t m_BlockBytesAtBudgetFetch[VK_MAX_MEMORY_HEAPS];</div>
<div class="line"><a name="l07015"></a><span class="lineno"> 7015</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
<div class="line"><a name="l07016"></a><span class="lineno"> 7016</span>&#160; </div>
<div class="line"><a name="l07017"></a><span class="lineno"> 7017</span>&#160; VmaCurrentBudgetData()</div>
<div class="line"><a name="l07018"></a><span class="lineno"> 7018</span>&#160; {</div>
<div class="line"><a name="l07019"></a><span class="lineno"> 7019</span>&#160; <span class="keywordflow">for</span>(uint32_t heapIndex = 0; heapIndex &lt; VK_MAX_MEMORY_HEAPS; ++heapIndex)</div>
<div class="line"><a name="l07020"></a><span class="lineno"> 7020</span>&#160; {</div>
<div class="line"><a name="l07021"></a><span class="lineno"> 7021</span>&#160; m_BlockBytes[heapIndex] = 0;</div>
<div class="line"><a name="l07022"></a><span class="lineno"> 7022</span>&#160; m_AllocationBytes[heapIndex] = 0;</div>
<div class="line"><a name="l07023"></a><span class="lineno"> 7023</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
<div class="line"><a name="l07024"></a><span class="lineno"> 7024</span>&#160; m_VulkanUsage[heapIndex] = 0;</div>
<div class="line"><a name="l07025"></a><span class="lineno"> 7025</span>&#160; m_VulkanBudget[heapIndex] = 0;</div>
<div class="line"><a name="l07026"></a><span class="lineno"> 7026</span>&#160; m_BlockBytesAtBudgetFetch[heapIndex] = 0;</div>
<div class="line"><a name="l07027"></a><span class="lineno"> 7027</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l07028"></a><span class="lineno"> 7028</span>&#160; }</div>
<div class="line"><a name="l07029"></a><span class="lineno"> 7029</span>&#160; </div>
<div class="line"><a name="l07030"></a><span class="lineno"> 7030</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
<div class="line"><a name="l07031"></a><span class="lineno"> 7031</span>&#160; m_OperationsSinceBudgetFetch = 0;</div>
<div class="line"><a name="l07032"></a><span class="lineno"> 7032</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l07033"></a><span class="lineno"> 7033</span>&#160; }</div>
<div class="line"><a name="l07034"></a><span class="lineno"> 7034</span>&#160; </div>
<div class="line"><a name="l07035"></a><span class="lineno"> 7035</span>&#160; <span class="keywordtype">void</span> AddAllocation(uint32_t heapIndex, VkDeviceSize allocationSize)</div>
<div class="line"><a name="l07036"></a><span class="lineno"> 7036</span>&#160; {</div>
<div class="line"><a name="l07037"></a><span class="lineno"> 7037</span>&#160; m_AllocationBytes[heapIndex] += allocationSize;</div>
<div class="line"><a name="l07038"></a><span class="lineno"> 7038</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
<div class="line"><a name="l07039"></a><span class="lineno"> 7039</span>&#160; ++m_OperationsSinceBudgetFetch;</div>
<div class="line"><a name="l07040"></a><span class="lineno"> 7040</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l07041"></a><span class="lineno"> 7041</span>&#160; }</div>
<div class="line"><a name="l07042"></a><span class="lineno"> 7042</span>&#160; </div>
<div class="line"><a name="l07043"></a><span class="lineno"> 7043</span>&#160; <span class="keywordtype">void</span> RemoveAllocation(uint32_t heapIndex, VkDeviceSize allocationSize)</div>
<div class="line"><a name="l07044"></a><span class="lineno"> 7044</span>&#160; {</div>
<div class="line"><a name="l07045"></a><span class="lineno"> 7045</span>&#160; VMA_ASSERT(m_AllocationBytes[heapIndex] &gt;= allocationSize); <span class="comment">// DELME</span></div>
<div class="line"><a name="l07046"></a><span class="lineno"> 7046</span>&#160; m_AllocationBytes[heapIndex] -= allocationSize;</div>
<div class="line"><a name="l07047"></a><span class="lineno"> 7047</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
<div class="line"><a name="l07048"></a><span class="lineno"> 7048</span>&#160; ++m_OperationsSinceBudgetFetch;</div>
<div class="line"><a name="l07049"></a><span class="lineno"> 7049</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l07050"></a><span class="lineno"> 7050</span>&#160; }</div>
<div class="line"><a name="l07051"></a><span class="lineno"> 7051</span>&#160;};</div>
<div class="line"><a name="l07052"></a><span class="lineno"> 7052</span>&#160; </div>
<div class="line"><a name="l07053"></a><span class="lineno"> 7053</span>&#160;<span class="comment">// Main allocator object.</span></div>
<div class="line"><a name="l07054"></a><span class="lineno"> 7054</span>&#160;<span class="keyword">struct </span>VmaAllocator_T</div>
<div class="line"><a name="l07055"></a><span class="lineno"> 7055</span>&#160;{</div>
<div class="line"><a name="l07056"></a><span class="lineno"> 7056</span>&#160; VMA_CLASS_NO_COPY(VmaAllocator_T)</div>
<div class="line"><a name="l07057"></a><span class="lineno"> 7057</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l07058"></a><span class="lineno"> 7058</span>&#160; <span class="keywordtype">bool</span> m_UseMutex;</div>
<div class="line"><a name="l07059"></a><span class="lineno"> 7059</span>&#160; uint32_t m_VulkanApiVersion;</div>
<div class="line"><a name="l07060"></a><span class="lineno"> 7060</span>&#160; <span class="keywordtype">bool</span> m_UseKhrDedicatedAllocation; <span class="comment">// Can be set only if m_VulkanApiVersion &lt; VK_MAKE_VERSION(1, 1, 0).</span></div>
<div class="line"><a name="l07061"></a><span class="lineno"> 7061</span>&#160; <span class="keywordtype">bool</span> m_UseKhrBindMemory2; <span class="comment">// Can be set only if m_VulkanApiVersion &lt; VK_MAKE_VERSION(1, 1, 0).</span></div>
<div class="line"><a name="l07062"></a><span class="lineno"> 7062</span>&#160; <span class="keywordtype">bool</span> m_UseExtMemoryBudget;</div>
<div class="line"><a name="l07063"></a><span class="lineno"> 7063</span>&#160; VkDevice m_hDevice;</div>
<div class="line"><a name="l07064"></a><span class="lineno"> 7064</span>&#160; VkInstance m_hInstance;</div>
<div class="line"><a name="l07065"></a><span class="lineno"> 7065</span>&#160; <span class="keywordtype">bool</span> m_AllocationCallbacksSpecified;</div>
<div class="line"><a name="l07066"></a><span class="lineno"> 7066</span>&#160; VkAllocationCallbacks m_AllocationCallbacks;</div>
<div class="line"><a name="l07067"></a><span class="lineno"> 7067</span>&#160; <a class="code" href="struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks</a> m_DeviceMemoryCallbacks;</div>
<div class="line"><a name="l07068"></a><span class="lineno"> 7068</span>&#160; VmaAllocationObjectAllocator m_AllocationObjectAllocator;</div>
<div class="line"><a name="l07069"></a><span class="lineno"> 7069</span>&#160; </div>
<div class="line"><a name="l07070"></a><span class="lineno"> 7070</span>&#160; <span class="comment">// Each bit (1 &lt;&lt; i) is set if HeapSizeLimit is enabled for that heap, so cannot allocate more than the heap size.</span></div>
<div class="line"><a name="l07071"></a><span class="lineno"> 7071</span>&#160; uint32_t m_HeapSizeLimitMask;</div>
<div class="line"><a name="l07072"></a><span class="lineno"> 7072</span>&#160; </div>
<div class="line"><a name="l07073"></a><span class="lineno"> 7073</span>&#160; VkPhysicalDeviceProperties m_PhysicalDeviceProperties;</div>
<div class="line"><a name="l07074"></a><span class="lineno"> 7074</span>&#160; VkPhysicalDeviceMemoryProperties m_MemProps;</div>
<div class="line"><a name="l07075"></a><span class="lineno"> 7075</span>&#160; </div>
<div class="line"><a name="l07076"></a><span class="lineno"> 7076</span>&#160; <span class="comment">// Default pools.</span></div>
<div class="line"><a name="l07077"></a><span class="lineno"> 7077</span>&#160; VmaBlockVector* m_pBlockVectors[VK_MAX_MEMORY_TYPES];</div>
<div class="line"><a name="l07078"></a><span class="lineno"> 7078</span>&#160; </div>
<div class="line"><a name="l07079"></a><span class="lineno"> 7079</span>&#160; <span class="comment">// Each vector is sorted by memory (handle value).</span></div>
<div class="line"><a name="l07080"></a><span class="lineno"> 7080</span>&#160; <span class="keyword">typedef</span> VmaVector&lt; VmaAllocation, VmaStlAllocator&lt;VmaAllocation&gt; &gt; AllocationVectorType;</div>
<div class="line"><a name="l07081"></a><span class="lineno"> 7081</span>&#160; AllocationVectorType* m_pDedicatedAllocations[VK_MAX_MEMORY_TYPES];</div>
<div class="line"><a name="l07082"></a><span class="lineno"> 7082</span>&#160; VMA_RW_MUTEX m_DedicatedAllocationsMutex[VK_MAX_MEMORY_TYPES];</div>
<div class="line"><a name="l07083"></a><span class="lineno"> 7083</span>&#160; </div>
<div class="line"><a name="l07084"></a><span class="lineno"> 7084</span>&#160; VmaCurrentBudgetData m_Budget;</div>
<div class="line"><a name="l07085"></a><span class="lineno"> 7085</span>&#160; </div>
<div class="line"><a name="l07086"></a><span class="lineno"> 7086</span>&#160; VmaAllocator_T(<span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo);</div>
<div class="line"><a name="l07087"></a><span class="lineno"> 7087</span>&#160; VkResult Init(<span class="keyword">const</span> <a class="code" href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a>* pCreateInfo);</div>
<div class="line"><a name="l07088"></a><span class="lineno"> 7088</span>&#160; ~VmaAllocator_T();</div>
<div class="line"><a name="l07089"></a><span class="lineno"> 7089</span>&#160; </div>
<div class="line"><a name="l07090"></a><span class="lineno"> 7090</span>&#160; <span class="keyword">const</span> VkAllocationCallbacks* GetAllocationCallbacks()<span class="keyword"> const</span></div>
<div class="line"><a name="l07091"></a><span class="lineno"> 7091</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l07092"></a><span class="lineno"> 7092</span>&#160; <span class="keywordflow">return</span> m_AllocationCallbacksSpecified ? &amp;m_AllocationCallbacks : 0;</div>
<div class="line"><a name="l07093"></a><span class="lineno"> 7093</span>&#160; }</div>
<div class="line"><a name="l07094"></a><span class="lineno"> 7094</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>&amp; GetVulkanFunctions()<span class="keyword"> const</span></div>
<div class="line"><a name="l07095"></a><span class="lineno"> 7095</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l07096"></a><span class="lineno"> 7096</span>&#160; <span class="keywordflow">return</span> m_VulkanFunctions;</div>
<div class="line"><a name="l07097"></a><span class="lineno"> 7097</span>&#160; }</div>
<div class="line"><a name="l07098"></a><span class="lineno"> 7098</span>&#160; </div>
<div class="line"><a name="l07099"></a><span class="lineno"> 7099</span>&#160; VkDeviceSize GetBufferImageGranularity()<span class="keyword"> const</span></div>
<div class="line"><a name="l07100"></a><span class="lineno"> 7100</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l07101"></a><span class="lineno"> 7101</span>&#160; <span class="keywordflow">return</span> VMA_MAX(</div>
<div class="line"><a name="l07102"></a><span class="lineno"> 7102</span>&#160; static_cast&lt;VkDeviceSize&gt;(VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY),</div>
<div class="line"><a name="l07103"></a><span class="lineno"> 7103</span>&#160; m_PhysicalDeviceProperties.limits.bufferImageGranularity);</div>
<div class="line"><a name="l07104"></a><span class="lineno"> 7104</span>&#160; }</div>
<div class="line"><a name="l07105"></a><span class="lineno"> 7105</span>&#160; </div>
<div class="line"><a name="l07106"></a><span class="lineno"> 7106</span>&#160; uint32_t GetMemoryHeapCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemProps.memoryHeapCount; }</div>
<div class="line"><a name="l07107"></a><span class="lineno"> 7107</span>&#160; uint32_t GetMemoryTypeCount()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_MemProps.memoryTypeCount; }</div>
<div class="line"><a name="l07108"></a><span class="lineno"> 7108</span>&#160; </div>
<div class="line"><a name="l07109"></a><span class="lineno"> 7109</span>&#160; uint32_t MemoryTypeIndexToHeapIndex(uint32_t memTypeIndex)<span class="keyword"> const</span></div>
<div class="line"><a name="l07110"></a><span class="lineno"> 7110</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l07111"></a><span class="lineno"> 7111</span>&#160; VMA_ASSERT(memTypeIndex &lt; m_MemProps.memoryTypeCount);</div>
<div class="line"><a name="l07112"></a><span class="lineno"> 7112</span>&#160; <span class="keywordflow">return</span> m_MemProps.memoryTypes[memTypeIndex].heapIndex;</div>
<div class="line"><a name="l07113"></a><span class="lineno"> 7113</span>&#160; }</div>
<div class="line"><a name="l07114"></a><span class="lineno"> 7114</span>&#160; <span class="comment">// True when specific memory type is HOST_VISIBLE but not HOST_COHERENT.</span></div>
<div class="line"><a name="l07115"></a><span class="lineno"> 7115</span>&#160; <span class="keywordtype">bool</span> IsMemoryTypeNonCoherent(uint32_t memTypeIndex)<span class="keyword"> const</span></div>
<div class="line"><a name="l07116"></a><span class="lineno"> 7116</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l07117"></a><span class="lineno"> 7117</span>&#160; <span class="keywordflow">return</span> (m_MemProps.memoryTypes[memTypeIndex].propertyFlags &amp; (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) ==</div>
<div class="line"><a name="l07118"></a><span class="lineno"> 7118</span>&#160; VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;</div>
<div class="line"><a name="l07119"></a><span class="lineno"> 7119</span>&#160; }</div>
<div class="line"><a name="l07120"></a><span class="lineno"> 7120</span>&#160; <span class="comment">// Minimum alignment for all allocations in specific memory type.</span></div>
<div class="line"><a name="l07121"></a><span class="lineno"> 7121</span>&#160; VkDeviceSize GetMemoryTypeMinAlignment(uint32_t memTypeIndex)<span class="keyword"> const</span></div>
<div class="line"><a name="l07122"></a><span class="lineno"> 7122</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l07123"></a><span class="lineno"> 7123</span>&#160; <span class="keywordflow">return</span> IsMemoryTypeNonCoherent(memTypeIndex) ?</div>
<div class="line"><a name="l07124"></a><span class="lineno"> 7124</span>&#160; VMA_MAX((VkDeviceSize)VMA_DEBUG_ALIGNMENT, m_PhysicalDeviceProperties.limits.nonCoherentAtomSize) :</div>
<div class="line"><a name="l07125"></a><span class="lineno"> 7125</span>&#160; (VkDeviceSize)VMA_DEBUG_ALIGNMENT;</div>
<div class="line"><a name="l07126"></a><span class="lineno"> 7126</span>&#160; }</div>
<div class="line"><a name="l07127"></a><span class="lineno"> 7127</span>&#160; </div>
<div class="line"><a name="l07128"></a><span class="lineno"> 7128</span>&#160; <span class="keywordtype">bool</span> IsIntegratedGpu()<span class="keyword"> const</span></div>
<div class="line"><a name="l07129"></a><span class="lineno"> 7129</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l07130"></a><span class="lineno"> 7130</span>&#160; <span class="keywordflow">return</span> m_PhysicalDeviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;</div>
<div class="line"><a name="l07131"></a><span class="lineno"> 7131</span>&#160; }</div>
<div class="line"><a name="l07132"></a><span class="lineno"> 7132</span>&#160; </div>
<div class="line"><a name="l07133"></a><span class="lineno"> 7133</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
<div class="line"><a name="l07134"></a><span class="lineno"> 7134</span>&#160; VmaRecorder* GetRecorder()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pRecorder; }</div>
<div class="line"><a name="l07135"></a><span class="lineno"> 7135</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l07136"></a><span class="lineno"> 7136</span>&#160; </div>
<div class="line"><a name="l07137"></a><span class="lineno"> 7137</span>&#160; <span class="keywordtype">void</span> GetBufferMemoryRequirements(</div>
<div class="line"><a name="l07138"></a><span class="lineno"> 7138</span>&#160; VkBuffer hBuffer,</div>
<div class="line"><a name="l07139"></a><span class="lineno"> 7139</span>&#160; VkMemoryRequirements&amp; memReq,</div>
<div class="line"><a name="l07140"></a><span class="lineno"> 7140</span>&#160; <span class="keywordtype">bool</span>&amp; requiresDedicatedAllocation,</div>
<div class="line"><a name="l07141"></a><span class="lineno"> 7141</span>&#160; <span class="keywordtype">bool</span>&amp; prefersDedicatedAllocation) <span class="keyword">const</span>;</div>
<div class="line"><a name="l07142"></a><span class="lineno"> 7142</span>&#160; <span class="keywordtype">void</span> GetImageMemoryRequirements(</div>
<div class="line"><a name="l07143"></a><span class="lineno"> 7143</span>&#160; VkImage hImage,</div>
<div class="line"><a name="l07144"></a><span class="lineno"> 7144</span>&#160; VkMemoryRequirements&amp; memReq,</div>
<div class="line"><a name="l07145"></a><span class="lineno"> 7145</span>&#160; <span class="keywordtype">bool</span>&amp; requiresDedicatedAllocation,</div>
<div class="line"><a name="l07146"></a><span class="lineno"> 7146</span>&#160; <span class="keywordtype">bool</span>&amp; prefersDedicatedAllocation) <span class="keyword">const</span>;</div>
<div class="line"><a name="l07147"></a><span class="lineno"> 7147</span>&#160; </div>
<div class="line"><a name="l07148"></a><span class="lineno"> 7148</span>&#160; <span class="comment">// Main allocation function.</span></div>
<div class="line"><a name="l07149"></a><span class="lineno"> 7149</span>&#160; VkResult AllocateMemory(</div>
<div class="line"><a name="l07150"></a><span class="lineno"> 7150</span>&#160; <span class="keyword">const</span> VkMemoryRequirements&amp; vkMemReq,</div>
<div class="line"><a name="l07151"></a><span class="lineno"> 7151</span>&#160; <span class="keywordtype">bool</span> requiresDedicatedAllocation,</div>
<div class="line"><a name="l07152"></a><span class="lineno"> 7152</span>&#160; <span class="keywordtype">bool</span> prefersDedicatedAllocation,</div>
<div class="line"><a name="l07153"></a><span class="lineno"> 7153</span>&#160; VkBuffer dedicatedBuffer,</div>
<div class="line"><a name="l07154"></a><span class="lineno"> 7154</span>&#160; VkImage dedicatedImage,</div>
<div class="line"><a name="l07155"></a><span class="lineno"> 7155</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
<div class="line"><a name="l07156"></a><span class="lineno"> 7156</span>&#160; VmaSuballocationType suballocType,</div>
<div class="line"><a name="l07157"></a><span class="lineno"> 7157</span>&#160; <span class="keywordtype">size_t</span> allocationCount,</div>
<div class="line"><a name="l07158"></a><span class="lineno"> 7158</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
<div class="line"><a name="l07159"></a><span class="lineno"> 7159</span>&#160; </div>
<div class="line"><a name="l07160"></a><span class="lineno"> 7160</span>&#160; <span class="comment">// Main deallocation function.</span></div>
<div class="line"><a name="l07161"></a><span class="lineno"> 7161</span>&#160; <span class="keywordtype">void</span> FreeMemory(</div>
<div class="line"><a name="l07162"></a><span class="lineno"> 7162</span>&#160; <span class="keywordtype">size_t</span> allocationCount,</div>
<div class="line"><a name="l07163"></a><span class="lineno"> 7163</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
<div class="line"><a name="l07164"></a><span class="lineno"> 7164</span>&#160; </div>
<div class="line"><a name="l07165"></a><span class="lineno"> 7165</span>&#160; VkResult ResizeAllocation(</div>
<div class="line"><a name="l07166"></a><span class="lineno"> 7166</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> alloc,</div>
<div class="line"><a name="l07167"></a><span class="lineno"> 7167</span>&#160; VkDeviceSize newSize);</div>
<div class="line"><a name="l07168"></a><span class="lineno"> 7168</span>&#160; </div>
<div class="line"><a name="l07169"></a><span class="lineno"> 7169</span>&#160; <span class="keywordtype">void</span> CalculateStats(<a class="code" href="struct_vma_stats.html">VmaStats</a>* pStats);</div>
<div class="line"><a name="l07170"></a><span class="lineno"> 7170</span>&#160; </div>
<div class="line"><a name="l07171"></a><span class="lineno"> 7171</span>&#160; <span class="keywordtype">void</span> GetBudget(</div>
<div class="line"><a name="l07172"></a><span class="lineno"> 7172</span>&#160; <a class="code" href="struct_vma_budget.html">VmaBudget</a>* outBudget, uint32_t firstHeap, uint32_t heapCount);</div>
<div class="line"><a name="l07173"></a><span class="lineno"> 7173</span>&#160; </div>
<div class="line"><a name="l07174"></a><span class="lineno"> 7174</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l07175"></a><span class="lineno"> 7175</span>&#160; <span class="keywordtype">void</span> PrintDetailedMap(<span class="keyword">class</span> VmaJsonWriter&amp; json);</div>
<div class="line"><a name="l07176"></a><span class="lineno"> 7176</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l07177"></a><span class="lineno"> 7177</span>&#160; </div>
<div class="line"><a name="l07178"></a><span class="lineno"> 7178</span>&#160; VkResult DefragmentationBegin(</div>
<div class="line"><a name="l07179"></a><span class="lineno"> 7179</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_defragmentation_info2.html">VmaDefragmentationInfo2</a>&amp; info,</div>
<div class="line"><a name="l07180"></a><span class="lineno"> 7180</span>&#160; <a class="code" href="struct_vma_defragmentation_stats.html">VmaDefragmentationStats</a>* pStats,</div>
<div class="line"><a name="l07181"></a><span class="lineno"> 7181</span>&#160; <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a>* pContext);</div>
<div class="line"><a name="l07182"></a><span class="lineno"> 7182</span>&#160; VkResult DefragmentationEnd(</div>
<div class="line"><a name="l07183"></a><span class="lineno"> 7183</span>&#160; <a class="code" href="struct_vma_defragmentation_context.html">VmaDefragmentationContext</a> context);</div>
<div class="line"><a name="l07184"></a><span class="lineno"> 7184</span>&#160; </div>
<div class="line"><a name="l07185"></a><span class="lineno"> 7185</span>&#160; <span class="keywordtype">void</span> GetAllocationInfo(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, <a class="code" href="struct_vma_allocation_info.html">VmaAllocationInfo</a>* pAllocationInfo);</div>
<div class="line"><a name="l07186"></a><span class="lineno"> 7186</span>&#160; <span class="keywordtype">bool</span> TouchAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
<div class="line"><a name="l07187"></a><span class="lineno"> 7187</span>&#160; </div>
<div class="line"><a name="l07188"></a><span class="lineno"> 7188</span>&#160; VkResult CreatePool(<span class="keyword">const</span> <a class="code" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a>* pCreateInfo, <a class="code" href="struct_vma_pool.html">VmaPool</a>* pPool);</div>
<div class="line"><a name="l07189"></a><span class="lineno"> 7189</span>&#160; <span class="keywordtype">void</span> DestroyPool(<a class="code" href="struct_vma_pool.html">VmaPool</a> pool);</div>
<div class="line"><a name="l07190"></a><span class="lineno"> 7190</span>&#160; <span class="keywordtype">void</span> GetPoolStats(<a class="code" href="struct_vma_pool.html">VmaPool</a> pool, <a class="code" href="struct_vma_pool_stats.html">VmaPoolStats</a>* pPoolStats);</div>
<div class="line"><a name="l07191"></a><span class="lineno"> 7191</span>&#160; </div>
<div class="line"><a name="l07192"></a><span class="lineno"> 7192</span>&#160; <span class="keywordtype">void</span> SetCurrentFrameIndex(uint32_t frameIndex);</div>
<div class="line"><a name="l07193"></a><span class="lineno"> 7193</span>&#160; uint32_t GetCurrentFrameIndex()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_CurrentFrameIndex.load(); }</div>
<div class="line"><a name="l07194"></a><span class="lineno"> 7194</span>&#160; </div>
<div class="line"><a name="l07195"></a><span class="lineno"> 7195</span>&#160; <span class="keywordtype">void</span> MakePoolAllocationsLost(</div>
<div class="line"><a name="l07196"></a><span class="lineno"> 7196</span>&#160; <a class="code" href="struct_vma_pool.html">VmaPool</a> hPool,</div>
<div class="line"><a name="l07197"></a><span class="lineno"> 7197</span>&#160; <span class="keywordtype">size_t</span>* pLostAllocationCount);</div>
<div class="line"><a name="l07198"></a><span class="lineno"> 7198</span>&#160; VkResult CheckPoolCorruption(<a class="code" href="struct_vma_pool.html">VmaPool</a> hPool);</div>
<div class="line"><a name="l07199"></a><span class="lineno"> 7199</span>&#160; VkResult CheckCorruption(uint32_t memoryTypeBits);</div>
<div class="line"><a name="l07200"></a><span class="lineno"> 7200</span>&#160; </div>
<div class="line"><a name="l07201"></a><span class="lineno"> 7201</span>&#160; <span class="keywordtype">void</span> CreateLostAllocation(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
<div class="line"><a name="l07202"></a><span class="lineno"> 7202</span>&#160; </div>
<div class="line"><a name="l07203"></a><span class="lineno"> 7203</span>&#160; <span class="comment">// Call to Vulkan function vkAllocateMemory with accompanying bookkeeping.</span></div>
<div class="line"><a name="l07204"></a><span class="lineno"> 7204</span>&#160; VkResult AllocateVulkanMemory(<span class="keyword">const</span> VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory);</div>
<div class="line"><a name="l07205"></a><span class="lineno"> 7205</span>&#160; <span class="comment">// Call to Vulkan function vkFreeMemory with accompanying bookkeeping.</span></div>
<div class="line"><a name="l07206"></a><span class="lineno"> 7206</span>&#160; <span class="keywordtype">void</span> FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, VkDeviceMemory hMemory);</div>
<div class="line"><a name="l07207"></a><span class="lineno"> 7207</span>&#160; <span class="comment">// Call to Vulkan function vkBindBufferMemory or vkBindBufferMemory2KHR.</span></div>
<div class="line"><a name="l07208"></a><span class="lineno"> 7208</span>&#160; VkResult BindVulkanBuffer(</div>
<div class="line"><a name="l07209"></a><span class="lineno"> 7209</span>&#160; VkDeviceMemory memory,</div>
<div class="line"><a name="l07210"></a><span class="lineno"> 7210</span>&#160; VkDeviceSize memoryOffset,</div>
<div class="line"><a name="l07211"></a><span class="lineno"> 7211</span>&#160; VkBuffer buffer,</div>
<div class="line"><a name="l07212"></a><span class="lineno"> 7212</span>&#160; <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
<div class="line"><a name="l07213"></a><span class="lineno"> 7213</span>&#160; <span class="comment">// Call to Vulkan function vkBindImageMemory or vkBindImageMemory2KHR.</span></div>
<div class="line"><a name="l07214"></a><span class="lineno"> 7214</span>&#160; VkResult BindVulkanImage(</div>
<div class="line"><a name="l07215"></a><span class="lineno"> 7215</span>&#160; VkDeviceMemory memory,</div>
<div class="line"><a name="l07216"></a><span class="lineno"> 7216</span>&#160; VkDeviceSize memoryOffset,</div>
<div class="line"><a name="l07217"></a><span class="lineno"> 7217</span>&#160; VkImage image,</div>
<div class="line"><a name="l07218"></a><span class="lineno"> 7218</span>&#160; <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
<div class="line"><a name="l07219"></a><span class="lineno"> 7219</span>&#160; </div>
<div class="line"><a name="l07220"></a><span class="lineno"> 7220</span>&#160; VkResult Map(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, <span class="keywordtype">void</span>** ppData);</div>
<div class="line"><a name="l07221"></a><span class="lineno"> 7221</span>&#160; <span class="keywordtype">void</span> Unmap(<a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation);</div>
<div class="line"><a name="l07222"></a><span class="lineno"> 7222</span>&#160; </div>
<div class="line"><a name="l07223"></a><span class="lineno"> 7223</span>&#160; VkResult BindBufferMemory(</div>
<div class="line"><a name="l07224"></a><span class="lineno"> 7224</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
<div class="line"><a name="l07225"></a><span class="lineno"> 7225</span>&#160; VkDeviceSize allocationLocalOffset,</div>
<div class="line"><a name="l07226"></a><span class="lineno"> 7226</span>&#160; VkBuffer hBuffer,</div>
<div class="line"><a name="l07227"></a><span class="lineno"> 7227</span>&#160; <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
<div class="line"><a name="l07228"></a><span class="lineno"> 7228</span>&#160; VkResult BindImageMemory(</div>
<div class="line"><a name="l07229"></a><span class="lineno"> 7229</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
<div class="line"><a name="l07230"></a><span class="lineno"> 7230</span>&#160; VkDeviceSize allocationLocalOffset,</div>
<div class="line"><a name="l07231"></a><span class="lineno"> 7231</span>&#160; VkImage hImage,</div>
<div class="line"><a name="l07232"></a><span class="lineno"> 7232</span>&#160; <span class="keyword">const</span> <span class="keywordtype">void</span>* pNext);</div>
<div class="line"><a name="l07233"></a><span class="lineno"> 7233</span>&#160; </div>
<div class="line"><a name="l07234"></a><span class="lineno"> 7234</span>&#160; <span class="keywordtype">void</span> FlushOrInvalidateAllocation(</div>
<div class="line"><a name="l07235"></a><span class="lineno"> 7235</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation,</div>
<div class="line"><a name="l07236"></a><span class="lineno"> 7236</span>&#160; VkDeviceSize offset, VkDeviceSize size,</div>
<div class="line"><a name="l07237"></a><span class="lineno"> 7237</span>&#160; VMA_CACHE_OPERATION op);</div>
<div class="line"><a name="l07238"></a><span class="lineno"> 7238</span>&#160; </div>
<div class="line"><a name="l07239"></a><span class="lineno"> 7239</span>&#160; <span class="keywordtype">void</span> FillAllocation(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> hAllocation, uint8_t pattern);</div>
<div class="line"><a name="l07240"></a><span class="lineno"> 7240</span>&#160; </div>
<div class="line"><a name="l07241"></a><span class="lineno"> 7241</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l07242"></a><span class="lineno"> 7242</span>&#160;<span class="comment"> Returns bit mask of memory types that can support defragmentation on GPU as</span></div>
<div class="line"><a name="l07243"></a><span class="lineno"> 7243</span>&#160;<span class="comment"> they support creation of required buffer for copy operations.</span></div>
<div class="line"><a name="l07244"></a><span class="lineno"> 7244</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l07245"></a><span class="lineno"> 7245</span>&#160; uint32_t GetGpuDefragmentationMemoryTypeBits();</div>
<div class="line"><a name="l07246"></a><span class="lineno"> 7246</span>&#160; </div>
<div class="line"><a name="l07247"></a><span class="lineno"> 7247</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l07248"></a><span class="lineno"> 7248</span>&#160; VkDeviceSize m_PreferredLargeHeapBlockSize;</div>
<div class="line"><a name="l07249"></a><span class="lineno"> 7249</span>&#160; </div>
<div class="line"><a name="l07250"></a><span class="lineno"> 7250</span>&#160; VkPhysicalDevice m_PhysicalDevice;</div>
<div class="line"><a name="l07251"></a><span class="lineno"> 7251</span>&#160; VMA_ATOMIC_UINT32 m_CurrentFrameIndex;</div>
<div class="line"><a name="l07252"></a><span class="lineno"> 7252</span>&#160; VMA_ATOMIC_UINT32 m_GpuDefragmentationMemoryTypeBits; <span class="comment">// UINT32_MAX means uninitialized.</span></div>
<div class="line"><a name="l07253"></a><span class="lineno"> 7253</span>&#160; </div>
<div class="line"><a name="l07254"></a><span class="lineno"> 7254</span>&#160; VMA_RW_MUTEX m_PoolsMutex;</div>
<div class="line"><a name="l07255"></a><span class="lineno"> 7255</span>&#160; <span class="comment">// Protected by m_PoolsMutex. Sorted by pointer value.</span></div>
<div class="line"><a name="l07256"></a><span class="lineno"> 7256</span>&#160; VmaVector&lt;VmaPool, VmaStlAllocator&lt;VmaPool&gt; &gt; m_Pools;</div>
<div class="line"><a name="l07257"></a><span class="lineno"> 7257</span>&#160; uint32_t m_NextPoolId;</div>
<div class="line"><a name="l07258"></a><span class="lineno"> 7258</span>&#160; </div>
<div class="line"><a name="l07259"></a><span class="lineno"> 7259</span>&#160; <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a> m_VulkanFunctions;</div>
<div class="line"><a name="l07260"></a><span class="lineno"> 7260</span>&#160; </div>
<div class="line"><a name="l07261"></a><span class="lineno"> 7261</span>&#160;<span class="preprocessor">#if VMA_RECORDING_ENABLED</span></div>
<div class="line"><a name="l07262"></a><span class="lineno"> 7262</span>&#160; VmaRecorder* m_pRecorder;</div>
<div class="line"><a name="l07263"></a><span class="lineno"> 7263</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l07264"></a><span class="lineno"> 7264</span>&#160; </div>
<div class="line"><a name="l07265"></a><span class="lineno"> 7265</span>&#160; <span class="keywordtype">void</span> ImportVulkanFunctions(<span class="keyword">const</span> <a class="code" href="struct_vma_vulkan_functions.html">VmaVulkanFunctions</a>* pVulkanFunctions);</div>
<div class="line"><a name="l07266"></a><span class="lineno"> 7266</span>&#160; </div>
<div class="line"><a name="l07267"></a><span class="lineno"> 7267</span>&#160; VkDeviceSize CalcPreferredBlockSize(uint32_t memTypeIndex);</div>
<div class="line"><a name="l07268"></a><span class="lineno"> 7268</span>&#160; </div>
<div class="line"><a name="l07269"></a><span class="lineno"> 7269</span>&#160; VkResult AllocateMemoryOfType(</div>
<div class="line"><a name="l07270"></a><span class="lineno"> 7270</span>&#160; VkDeviceSize size,</div>
<div class="line"><a name="l07271"></a><span class="lineno"> 7271</span>&#160; VkDeviceSize alignment,</div>
<div class="line"><a name="l07272"></a><span class="lineno"> 7272</span>&#160; <span class="keywordtype">bool</span> dedicatedAllocation,</div>
<div class="line"><a name="l07273"></a><span class="lineno"> 7273</span>&#160; VkBuffer dedicatedBuffer,</div>
<div class="line"><a name="l07274"></a><span class="lineno"> 7274</span>&#160; VkImage dedicatedImage,</div>
<div class="line"><a name="l07275"></a><span class="lineno"> 7275</span>&#160; <span class="keyword">const</span> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>&amp; createInfo,</div>
<div class="line"><a name="l07276"></a><span class="lineno"> 7276</span>&#160; uint32_t memTypeIndex,</div>
<div class="line"><a name="l07277"></a><span class="lineno"> 7277</span>&#160; VmaSuballocationType suballocType,</div>
<div class="line"><a name="l07278"></a><span class="lineno"> 7278</span>&#160; <span class="keywordtype">size_t</span> allocationCount,</div>
<div class="line"><a name="l07279"></a><span class="lineno"> 7279</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
<div class="line"><a name="l07280"></a><span class="lineno"> 7280</span>&#160; </div>
<div class="line"><a name="l07281"></a><span class="lineno"> 7281</span>&#160; <span class="comment">// Helper function only to be used inside AllocateDedicatedMemory.</span></div>
<div class="line"><a name="l07282"></a><span class="lineno"> 7282</span>&#160; VkResult AllocateDedicatedMemoryPage(</div>
<div class="line"><a name="l07283"></a><span class="lineno"> 7283</span>&#160; VkDeviceSize size,</div>
<div class="line"><a name="l07284"></a><span class="lineno"> 7284</span>&#160; VmaSuballocationType suballocType,</div>
<div class="line"><a name="l07285"></a><span class="lineno"> 7285</span>&#160; uint32_t memTypeIndex,</div>
<div class="line"><a name="l07286"></a><span class="lineno"> 7286</span>&#160; <span class="keyword">const</span> VkMemoryAllocateInfo&amp; allocInfo,</div>
<div class="line"><a name="l07287"></a><span class="lineno"> 7287</span>&#160; <span class="keywordtype">bool</span> map,</div>
<div class="line"><a name="l07288"></a><span class="lineno"> 7288</span>&#160; <span class="keywordtype">bool</span> isUserDataString,</div>
<div class="line"><a name="l07289"></a><span class="lineno"> 7289</span>&#160; <span class="keywordtype">void</span>* pUserData,</div>
<div class="line"><a name="l07290"></a><span class="lineno"> 7290</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocation);</div>
<div class="line"><a name="l07291"></a><span class="lineno"> 7291</span>&#160; </div>
<div class="line"><a name="l07292"></a><span class="lineno"> 7292</span>&#160; <span class="comment">// Allocates and registers new VkDeviceMemory specifically for dedicated allocations.</span></div>
<div class="line"><a name="l07293"></a><span class="lineno"> 7293</span>&#160; VkResult AllocateDedicatedMemory(</div>
<div class="line"><a name="l07294"></a><span class="lineno"> 7294</span>&#160; VkDeviceSize size,</div>
<div class="line"><a name="l07295"></a><span class="lineno"> 7295</span>&#160; VmaSuballocationType suballocType,</div>
<div class="line"><a name="l07296"></a><span class="lineno"> 7296</span>&#160; uint32_t memTypeIndex,</div>
<div class="line"><a name="l07297"></a><span class="lineno"> 7297</span>&#160; <span class="keywordtype">bool</span> withinBudget,</div>
<div class="line"><a name="l07298"></a><span class="lineno"> 7298</span>&#160; <span class="keywordtype">bool</span> map,</div>
<div class="line"><a name="l07299"></a><span class="lineno"> 7299</span>&#160; <span class="keywordtype">bool</span> isUserDataString,</div>
<div class="line"><a name="l07300"></a><span class="lineno"> 7300</span>&#160; <span class="keywordtype">void</span>* pUserData,</div>
<div class="line"><a name="l07301"></a><span class="lineno"> 7301</span>&#160; VkBuffer dedicatedBuffer,</div>
<div class="line"><a name="l07302"></a><span class="lineno"> 7302</span>&#160; VkImage dedicatedImage,</div>
<div class="line"><a name="l07303"></a><span class="lineno"> 7303</span>&#160; <span class="keywordtype">size_t</span> allocationCount,</div>
<div class="line"><a name="l07304"></a><span class="lineno"> 7304</span>&#160; <a class="code" href="struct_vma_allocation.html">VmaAllocation</a>* pAllocations);</div>
<div class="line"><a name="l07305"></a><span class="lineno"> 7305</span>&#160; </div>
<div class="line"><a name="l07306"></a><span class="lineno"> 7306</span>&#160; <span class="keywordtype">void</span> FreeDedicatedMemory(<span class="keyword">const</span> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> allocation);</div>
<div class="line"><a name="l07307"></a><span class="lineno"> 7307</span>&#160; </div>
<div class="line"><a name="l07308"></a><span class="lineno"> 7308</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l07309"></a><span class="lineno"> 7309</span>&#160;<span class="comment"> Calculates and returns bit mask of memory types that can support defragmentation</span></div>
<div class="line"><a name="l07310"></a><span class="lineno"> 7310</span>&#160;<span class="comment"> on GPU as they support creation of required buffer for copy operations.</span></div>
<div class="line"><a name="l07311"></a><span class="lineno"> 7311</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l07312"></a><span class="lineno"> 7312</span>&#160; uint32_t CalculateGpuDefragmentationMemoryTypeBits() <span class="keyword">const</span>;</div>
<div class="line"><a name="l07313"></a><span class="lineno"> 7313</span>&#160; </div>
<div class="line"><a name="l07314"></a><span class="lineno"> 7314</span>&#160;<span class="preprocessor">#if VMA_MEMORY_BUDGET</span></div>
<div class="line"><a name="l07315"></a><span class="lineno"> 7315</span>&#160; <span class="keywordtype">void</span> UpdateVulkanBudget();</div>
<div class="line"><a name="l07316"></a><span class="lineno"> 7316</span>&#160;<span class="preprocessor">#endif // #if VMA_MEMORY_BUDGET</span></div>
<div class="line"><a name="l07317"></a><span class="lineno"> 7317</span>&#160;};</div>
<div class="line"><a name="l07318"></a><span class="lineno"> 7318</span>&#160; </div>
<div class="line"><a name="l07320"></a><span class="lineno"> 7320</span>&#160;<span class="comment">// Memory allocation #2 after VmaAllocator_T definition</span></div>
<div class="line"><a name="l07321"></a><span class="lineno"> 7321</span>&#160; </div>
<div class="line"><a name="l07322"></a><span class="lineno"> 7322</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span>* VmaMalloc(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">size_t</span> size, <span class="keywordtype">size_t</span> alignment)</div>
<div class="line"><a name="l07323"></a><span class="lineno"> 7323</span>&#160;{</div>
<div class="line"><a name="l07324"></a><span class="lineno"> 7324</span>&#160; <span class="keywordflow">return</span> VmaMalloc(&amp;hAllocator-&gt;m_AllocationCallbacks, size, alignment);</div>
<div class="line"><a name="l07325"></a><span class="lineno"> 7325</span>&#160;}</div>
<div class="line"><a name="l07326"></a><span class="lineno"> 7326</span>&#160; </div>
<div class="line"><a name="l07327"></a><span class="lineno"> 7327</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> VmaFree(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">void</span>* ptr)</div>
<div class="line"><a name="l07328"></a><span class="lineno"> 7328</span>&#160;{</div>
<div class="line"><a name="l07329"></a><span class="lineno"> 7329</span>&#160; VmaFree(&amp;hAllocator-&gt;m_AllocationCallbacks, ptr);</div>
<div class="line"><a name="l07330"></a><span class="lineno"> 7330</span>&#160;}</div>
<div class="line"><a name="l07331"></a><span class="lineno"> 7331</span>&#160; </div>
<div class="line"><a name="l07332"></a><span class="lineno"> 7332</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l07333"></a><span class="lineno"> 7333</span>&#160;<span class="keyword">static</span> T* VmaAllocate(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator)</div>
<div class="line"><a name="l07334"></a><span class="lineno"> 7334</span>&#160;{</div>
<div class="line"><a name="l07335"></a><span class="lineno"> 7335</span>&#160; <span class="keywordflow">return</span> (T*)VmaMalloc(hAllocator, <span class="keyword">sizeof</span>(T), VMA_ALIGN_OF(T));</div>
<div class="line"><a name="l07336"></a><span class="lineno"> 7336</span>&#160;}</div>
<div class="line"><a name="l07337"></a><span class="lineno"> 7337</span>&#160; </div>
<div class="line"><a name="l07338"></a><span class="lineno"> 7338</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l07339"></a><span class="lineno"> 7339</span>&#160;<span class="keyword">static</span> T* VmaAllocateArray(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, <span class="keywordtype">size_t</span> count)</div>
<div class="line"><a name="l07340"></a><span class="lineno"> 7340</span>&#160;{</div>
<div class="line"><a name="l07341"></a><span class="lineno"> 7341</span>&#160; <span class="keywordflow">return</span> (T*)VmaMalloc(hAllocator, <span class="keyword">sizeof</span>(T) * count, VMA_ALIGN_OF(T));</div>
<div class="line"><a name="l07342"></a><span class="lineno"> 7342</span>&#160;}</div>
<div class="line"><a name="l07343"></a><span class="lineno"> 7343</span>&#160; </div>
<div class="line"><a name="l07344"></a><span class="lineno"> 7344</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l07345"></a><span class="lineno"> 7345</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, T* ptr)</div>
<div class="line"><a name="l07346"></a><span class="lineno"> 7346</span>&#160;{</div>
<div class="line"><a name="l07347"></a><span class="lineno"> 7347</span>&#160; <span class="keywordflow">if</span>(ptr != VMA_NULL)</div>
<div class="line"><a name="l07348"></a><span class="lineno"> 7348</span>&#160; {</div>
<div class="line"><a name="l07349"></a><span class="lineno"> 7349</span>&#160; ptr-&gt;~T();</div>
<div class="line"><a name="l07350"></a><span class="lineno"> 7350</span>&#160; VmaFree(hAllocator, ptr);</div>
<div class="line"><a name="l07351"></a><span class="lineno"> 7351</span>&#160; }</div>
<div class="line"><a name="l07352"></a><span class="lineno"> 7352</span>&#160;}</div>
<div class="line"><a name="l07353"></a><span class="lineno"> 7353</span>&#160; </div>
<div class="line"><a name="l07354"></a><span class="lineno"> 7354</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l07355"></a><span class="lineno"> 7355</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> vma_delete_array(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> hAllocator, T* ptr, <span class="keywordtype">size_t</span> count)</div>
<div class="line"><a name="l07356"></a><span class="lineno"> 7356</span>&#160;{</div>
<div class="line"><a name="l07357"></a><span class="lineno"> 7357</span>&#160; <span class="keywordflow">if</span>(ptr != VMA_NULL)</div>
<div class="line"><a name="l07358"></a><span class="lineno"> 7358</span>&#160; {</div>
<div class="line"><a name="l07359"></a><span class="lineno"> 7359</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = count; i--; )</div>
<div class="line"><a name="l07360"></a><span class="lineno"> 7360</span>&#160; ptr[i].~T();</div>
<div class="line"><a name="l07361"></a><span class="lineno"> 7361</span>&#160; VmaFree(hAllocator, ptr);</div>
<div class="line"><a name="l07362"></a><span class="lineno"> 7362</span>&#160; }</div>
<div class="line"><a name="l07363"></a><span class="lineno"> 7363</span>&#160;}</div>
<div class="line"><a name="l07364"></a><span class="lineno"> 7364</span>&#160; </div>
<div class="line"><a name="l07366"></a><span class="lineno"> 7366</span>&#160;<span class="comment">// VmaStringBuilder</span></div>
<div class="line"><a name="l07367"></a><span class="lineno"> 7367</span>&#160; </div>
<div class="line"><a name="l07368"></a><span class="lineno"> 7368</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l07369"></a><span class="lineno"> 7369</span>&#160; </div>
<div class="line"><a name="l07370"></a><span class="lineno"> 7370</span>&#160;<span class="keyword">class </span>VmaStringBuilder</div>
<div class="line"><a name="l07371"></a><span class="lineno"> 7371</span>&#160;{</div>
<div class="line"><a name="l07372"></a><span class="lineno"> 7372</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l07373"></a><span class="lineno"> 7373</span>&#160; VmaStringBuilder(<a class="code" href="struct_vma_allocator.html">VmaAllocator</a> alloc) : m_Data(VmaStlAllocator&lt;char&gt;(alloc-&gt;GetAllocationCallbacks())) { }</div>
<div class="line"><a name="l07374"></a><span class="lineno"> 7374</span>&#160; <span class="keywordtype">size_t</span> GetLength()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Data.size(); }</div>
<div class="line"><a name="l07375"></a><span class="lineno"> 7375</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* GetData()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Data.data(); }</div>
<div class="line"><a name="l07376"></a><span class="lineno"> 7376</span>&#160; </div>
<div class="line"><a name="l07377"></a><span class="lineno"> 7377</span>&#160; <span class="keywordtype">void</span> Add(<span class="keywordtype">char</span> ch) { m_Data.push_back(ch); }</div>
<div class="line"><a name="l07378"></a><span class="lineno"> 7378</span>&#160; <span class="keywordtype">void</span> Add(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr);</div>
<div class="line"><a name="l07379"></a><span class="lineno"> 7379</span>&#160; <span class="keywordtype">void</span> AddNewLine() { Add(<span class="charliteral">&#39;\n&#39;</span>); }</div>
<div class="line"><a name="l07380"></a><span class="lineno"> 7380</span>&#160; <span class="keywordtype">void</span> AddNumber(uint32_t num);</div>
<div class="line"><a name="l07381"></a><span class="lineno"> 7381</span>&#160; <span class="keywordtype">void</span> AddNumber(uint64_t num);</div>
<div class="line"><a name="l07382"></a><span class="lineno"> 7382</span>&#160; <span class="keywordtype">void</span> AddPointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr);</div>
<div class="line"><a name="l07383"></a><span class="lineno"> 7383</span>&#160; </div>
<div class="line"><a name="l07384"></a><span class="lineno"> 7384</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l07385"></a><span class="lineno"> 7385</span>&#160; VmaVector&lt; char, VmaStlAllocator&lt;char&gt; &gt; m_Data;</div>
<div class="line"><a name="l07386"></a><span class="lineno"> 7386</span>&#160;};</div>
<div class="line"><a name="l07387"></a><span class="lineno"> 7387</span>&#160; </div>
<div class="line"><a name="l07388"></a><span class="lineno"> 7388</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::Add(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
<div class="line"><a name="l07389"></a><span class="lineno"> 7389</span>&#160;{</div>
<div class="line"><a name="l07390"></a><span class="lineno"> 7390</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> strLen = strlen(pStr);</div>
<div class="line"><a name="l07391"></a><span class="lineno"> 7391</span>&#160; <span class="keywordflow">if</span>(strLen &gt; 0)</div>
<div class="line"><a name="l07392"></a><span class="lineno"> 7392</span>&#160; {</div>
<div class="line"><a name="l07393"></a><span class="lineno"> 7393</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> oldCount = m_Data.size();</div>
<div class="line"><a name="l07394"></a><span class="lineno"> 7394</span>&#160; m_Data.resize(oldCount + strLen);</div>
<div class="line"><a name="l07395"></a><span class="lineno"> 7395</span>&#160; memcpy(m_Data.data() + oldCount, pStr, strLen);</div>
<div class="line"><a name="l07396"></a><span class="lineno"> 7396</span>&#160; }</div>
<div class="line"><a name="l07397"></a><span class="lineno"> 7397</span>&#160;}</div>
<div class="line"><a name="l07398"></a><span class="lineno"> 7398</span>&#160; </div>
<div class="line"><a name="l07399"></a><span class="lineno"> 7399</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::AddNumber(uint32_t num)</div>
<div class="line"><a name="l07400"></a><span class="lineno"> 7400</span>&#160;{</div>
<div class="line"><a name="l07401"></a><span class="lineno"> 7401</span>&#160; <span class="keywordtype">char</span> buf[11];</div>
<div class="line"><a name="l07402"></a><span class="lineno"> 7402</span>&#160; buf[10] = <span class="charliteral">&#39;\0&#39;</span>;</div>
<div class="line"><a name="l07403"></a><span class="lineno"> 7403</span>&#160; <span class="keywordtype">char</span> *p = &amp;buf[10];</div>
<div class="line"><a name="l07404"></a><span class="lineno"> 7404</span>&#160; <span class="keywordflow">do</span></div>
<div class="line"><a name="l07405"></a><span class="lineno"> 7405</span>&#160; {</div>
<div class="line"><a name="l07406"></a><span class="lineno"> 7406</span>&#160; *--p = <span class="charliteral">&#39;0&#39;</span> + (num % 10);</div>
<div class="line"><a name="l07407"></a><span class="lineno"> 7407</span>&#160; num /= 10;</div>
<div class="line"><a name="l07408"></a><span class="lineno"> 7408</span>&#160; }</div>
<div class="line"><a name="l07409"></a><span class="lineno"> 7409</span>&#160; <span class="keywordflow">while</span>(num);</div>
<div class="line"><a name="l07410"></a><span class="lineno"> 7410</span>&#160; Add(p);</div>
<div class="line"><a name="l07411"></a><span class="lineno"> 7411</span>&#160;}</div>
<div class="line"><a name="l07412"></a><span class="lineno"> 7412</span>&#160; </div>
<div class="line"><a name="l07413"></a><span class="lineno"> 7413</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::AddNumber(uint64_t num)</div>
<div class="line"><a name="l07414"></a><span class="lineno"> 7414</span>&#160;{</div>
<div class="line"><a name="l07415"></a><span class="lineno"> 7415</span>&#160; <span class="keywordtype">char</span> buf[21];</div>
<div class="line"><a name="l07416"></a><span class="lineno"> 7416</span>&#160; buf[20] = <span class="charliteral">&#39;\0&#39;</span>;</div>
<div class="line"><a name="l07417"></a><span class="lineno"> 7417</span>&#160; <span class="keywordtype">char</span> *p = &amp;buf[20];</div>
<div class="line"><a name="l07418"></a><span class="lineno"> 7418</span>&#160; <span class="keywordflow">do</span></div>
<div class="line"><a name="l07419"></a><span class="lineno"> 7419</span>&#160; {</div>
<div class="line"><a name="l07420"></a><span class="lineno"> 7420</span>&#160; *--p = <span class="charliteral">&#39;0&#39;</span> + (num % 10);</div>
<div class="line"><a name="l07421"></a><span class="lineno"> 7421</span>&#160; num /= 10;</div>
<div class="line"><a name="l07422"></a><span class="lineno"> 7422</span>&#160; }</div>
<div class="line"><a name="l07423"></a><span class="lineno"> 7423</span>&#160; <span class="keywordflow">while</span>(num);</div>
<div class="line"><a name="l07424"></a><span class="lineno"> 7424</span>&#160; Add(p);</div>
<div class="line"><a name="l07425"></a><span class="lineno"> 7425</span>&#160;}</div>
<div class="line"><a name="l07426"></a><span class="lineno"> 7426</span>&#160; </div>
<div class="line"><a name="l07427"></a><span class="lineno"> 7427</span>&#160;<span class="keywordtype">void</span> VmaStringBuilder::AddPointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr)</div>
<div class="line"><a name="l07428"></a><span class="lineno"> 7428</span>&#160;{</div>
<div class="line"><a name="l07429"></a><span class="lineno"> 7429</span>&#160; <span class="keywordtype">char</span> buf[21];</div>
<div class="line"><a name="l07430"></a><span class="lineno"> 7430</span>&#160; VmaPtrToStr(buf, <span class="keyword">sizeof</span>(buf), ptr);</div>
<div class="line"><a name="l07431"></a><span class="lineno"> 7431</span>&#160; Add(buf);</div>
<div class="line"><a name="l07432"></a><span class="lineno"> 7432</span>&#160;}</div>
<div class="line"><a name="l07433"></a><span class="lineno"> 7433</span>&#160; </div>
<div class="line"><a name="l07434"></a><span class="lineno"> 7434</span>&#160;<span class="preprocessor">#endif // #if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l07435"></a><span class="lineno"> 7435</span>&#160; </div>
<div class="line"><a name="l07437"></a><span class="lineno"> 7437</span>&#160;<span class="comment">// VmaJsonWriter</span></div>
<div class="line"><a name="l07438"></a><span class="lineno"> 7438</span>&#160; </div>
<div class="line"><a name="l07439"></a><span class="lineno"> 7439</span>&#160;<span class="preprocessor">#if VMA_STATS_STRING_ENABLED</span></div>
<div class="line"><a name="l07440"></a><span class="lineno"> 7440</span>&#160; </div>
<div class="line"><a name="l07441"></a><span class="lineno"> 7441</span>&#160;<span class="keyword">class </span>VmaJsonWriter</div>
<div class="line"><a name="l07442"></a><span class="lineno"> 7442</span>&#160;{</div>
<div class="line"><a name="l07443"></a><span class="lineno"> 7443</span>&#160; VMA_CLASS_NO_COPY(VmaJsonWriter)</div>
<div class="line"><a name="l07444"></a><span class="lineno"> 7444</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l07445"></a><span class="lineno"> 7445</span>&#160; VmaJsonWriter(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder&amp; sb);</div>
<div class="line"><a name="l07446"></a><span class="lineno"> 7446</span>&#160; ~VmaJsonWriter();</div>
<div class="line"><a name="l07447"></a><span class="lineno"> 7447</span>&#160; </div>
<div class="line"><a name="l07448"></a><span class="lineno"> 7448</span>&#160; <span class="keywordtype">void</span> BeginObject(<span class="keywordtype">bool</span> singleLine = <span class="keyword">false</span>);</div>
<div class="line"><a name="l07449"></a><span class="lineno"> 7449</span>&#160; <span class="keywordtype">void</span> EndObject();</div>
<div class="line"><a name="l07450"></a><span class="lineno"> 7450</span>&#160; </div>
<div class="line"><a name="l07451"></a><span class="lineno"> 7451</span>&#160; <span class="keywordtype">void</span> BeginArray(<span class="keywordtype">bool</span> singleLine = <span class="keyword">false</span>);</div>
<div class="line"><a name="l07452"></a><span class="lineno"> 7452</span>&#160; <span class="keywordtype">void</span> EndArray();</div>
<div class="line"><a name="l07453"></a><span class="lineno"> 7453</span>&#160; </div>
<div class="line"><a name="l07454"></a><span class="lineno"> 7454</span>&#160; <span class="keywordtype">void</span> WriteString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr);</div>
<div class="line"><a name="l07455"></a><span class="lineno"> 7455</span>&#160; <span class="keywordtype">void</span> BeginString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr = VMA_NULL);</div>
<div class="line"><a name="l07456"></a><span class="lineno"> 7456</span>&#160; <span class="keywordtype">void</span> ContinueString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr);</div>
<div class="line"><a name="l07457"></a><span class="lineno"> 7457</span>&#160; <span class="keywordtype">void</span> ContinueString(uint32_t n);</div>
<div class="line"><a name="l07458"></a><span class="lineno"> 7458</span>&#160; <span class="keywordtype">void</span> ContinueString(uint64_t n);</div>
<div class="line"><a name="l07459"></a><span class="lineno"> 7459</span>&#160; <span class="keywordtype">void</span> ContinueString_Pointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr);</div>
<div class="line"><a name="l07460"></a><span class="lineno"> 7460</span>&#160; <span class="keywordtype">void</span> EndString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr = VMA_NULL);</div>
<div class="line"><a name="l07461"></a><span class="lineno"> 7461</span>&#160; </div>
<div class="line"><a name="l07462"></a><span class="lineno"> 7462</span>&#160; <span class="keywordtype">void</span> WriteNumber(uint32_t n);</div>
<div class="line"><a name="l07463"></a><span class="lineno"> 7463</span>&#160; <span class="keywordtype">void</span> WriteNumber(uint64_t n);</div>
<div class="line"><a name="l07464"></a><span class="lineno"> 7464</span>&#160; <span class="keywordtype">void</span> WriteBool(<span class="keywordtype">bool</span> b);</div>
<div class="line"><a name="l07465"></a><span class="lineno"> 7465</span>&#160; <span class="keywordtype">void</span> WriteNull();</div>
<div class="line"><a name="l07466"></a><span class="lineno"> 7466</span>&#160; </div>
<div class="line"><a name="l07467"></a><span class="lineno"> 7467</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l07468"></a><span class="lineno"> 7468</span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> INDENT;</div>
<div class="line"><a name="l07469"></a><span class="lineno"> 7469</span>&#160; </div>
<div class="line"><a name="l07470"></a><span class="lineno"> 7470</span>&#160; <span class="keyword">enum</span> COLLECTION_TYPE</div>
<div class="line"><a name="l07471"></a><span class="lineno"> 7471</span>&#160; {</div>
<div class="line"><a name="l07472"></a><span class="lineno"> 7472</span>&#160; COLLECTION_TYPE_OBJECT,</div>
<div class="line"><a name="l07473"></a><span class="lineno"> 7473</span>&#160; COLLECTION_TYPE_ARRAY,</div>
<div class="line"><a name="l07474"></a><span class="lineno"> 7474</span>&#160; };</div>
<div class="line"><a name="l07475"></a><span class="lineno"> 7475</span>&#160; <span class="keyword">struct </span>StackItem</div>
<div class="line"><a name="l07476"></a><span class="lineno"> 7476</span>&#160; {</div>
<div class="line"><a name="l07477"></a><span class="lineno"> 7477</span>&#160; COLLECTION_TYPE type;</div>
<div class="line"><a name="l07478"></a><span class="lineno"> 7478</span>&#160; uint32_t valueCount;</div>
<div class="line"><a name="l07479"></a><span class="lineno"> 7479</span>&#160; <span class="keywordtype">bool</span> singleLineMode;</div>
<div class="line"><a name="l07480"></a><span class="lineno"> 7480</span>&#160; };</div>
<div class="line"><a name="l07481"></a><span class="lineno"> 7481</span>&#160; </div>
<div class="line"><a name="l07482"></a><span class="lineno"> 7482</span>&#160; VmaStringBuilder&amp; m_SB;</div>
<div class="line"><a name="l07483"></a><span class="lineno"> 7483</span>&#160; VmaVector&lt; StackItem, VmaStlAllocator&lt;StackItem&gt; &gt; m_Stack;</div>
<div class="line"><a name="l07484"></a><span class="lineno"> 7484</span>&#160; <span class="keywordtype">bool</span> m_InsideString;</div>
<div class="line"><a name="l07485"></a><span class="lineno"> 7485</span>&#160; </div>
<div class="line"><a name="l07486"></a><span class="lineno"> 7486</span>&#160; <span class="keywordtype">void</span> BeginValue(<span class="keywordtype">bool</span> isString);</div>
<div class="line"><a name="l07487"></a><span class="lineno"> 7487</span>&#160; <span class="keywordtype">void</span> WriteIndent(<span class="keywordtype">bool</span> oneLess = <span class="keyword">false</span>);</div>
<div class="line"><a name="l07488"></a><span class="lineno"> 7488</span>&#160;};</div>
<div class="line"><a name="l07489"></a><span class="lineno"> 7489</span>&#160; </div>
<div class="line"><a name="l07490"></a><span class="lineno"> 7490</span>&#160;<span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> VmaJsonWriter::INDENT = <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><a name="l07491"></a><span class="lineno"> 7491</span>&#160; </div>
<div class="line"><a name="l07492"></a><span class="lineno"> 7492</span>&#160;VmaJsonWriter::VmaJsonWriter(<span class="keyword">const</span> VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder&amp; sb) :</div>
<div class="line"><a name="l07493"></a><span class="lineno"> 7493</span>&#160; m_SB(sb),</div>
<div class="line"><a name="l07494"></a><span class="lineno"> 7494</span>&#160; m_Stack(VmaStlAllocator&lt;StackItem&gt;(pAllocationCallbacks)),</div>
<div class="line"><a name="l07495"></a><span class="lineno"> 7495</span>&#160; m_InsideString(false)</div>
<div class="line"><a name="l07496"></a><span class="lineno"> 7496</span>&#160;{</div>
<div class="line"><a name="l07497"></a><span class="lineno"> 7497</span>&#160;}</div>
<div class="line"><a name="l07498"></a><span class="lineno"> 7498</span>&#160; </div>
<div class="line"><a name="l07499"></a><span class="lineno"> 7499</span>&#160;VmaJsonWriter::~VmaJsonWriter()</div>
<div class="line"><a name="l07500"></a><span class="lineno"> 7500</span>&#160;{</div>
<div class="line"><a name="l07501"></a><span class="lineno"> 7501</span>&#160; VMA_ASSERT(!m_InsideString);</div>
<div class="line"><a name="l07502"></a><span class="lineno"> 7502</span>&#160; VMA_ASSERT(m_Stack.empty());</div>
<div class="line"><a name="l07503"></a><span class="lineno"> 7503</span>&#160;}</div>
<div class="line"><a name="l07504"></a><span class="lineno"> 7504</span>&#160; </div>
<div class="line"><a name="l07505"></a><span class="lineno"> 7505</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::BeginObject(<span class="keywordtype">bool</span> singleLine)</div>
<div class="line"><a name="l07506"></a><span class="lineno"> 7506</span>&#160;{</div>
<div class="line"><a name="l07507"></a><span class="lineno"> 7507</span>&#160; VMA_ASSERT(!m_InsideString);</div>
<div class="line"><a name="l07508"></a><span class="lineno"> 7508</span>&#160; </div>
<div class="line"><a name="l07509"></a><span class="lineno"> 7509</span>&#160; BeginValue(<span class="keyword">false</span>);</div>
<div class="line"><a name="l07510"></a><span class="lineno"> 7510</span>&#160; m_SB.Add(<span class="charliteral">&#39;{&#39;</span>);</div>
<div class="line"><a name="l07511"></a><span class="lineno"> 7511</span>&#160; </div>
<div class="line"><a name="l07512"></a><span class="lineno"> 7512</span>&#160; StackItem item;</div>
<div class="line"><a name="l07513"></a><span class="lineno"> 7513</span>&#160; item.type = COLLECTION_TYPE_OBJECT;</div>
<div class="line"><a name="l07514"></a><span class="lineno"> 7514</span>&#160; item.valueCount = 0;</div>
<div class="line"><a name="l07515"></a><span class="lineno"> 7515</span>&#160; item.singleLineMode = singleLine;</div>
<div class="line"><a name="l07516"></a><span class="lineno"> 7516</span>&#160; m_Stack.push_back(item);</div>
<div class="line"><a name="l07517"></a><span class="lineno"> 7517</span>&#160;}</div>
<div class="line"><a name="l07518"></a><span class="lineno"> 7518</span>&#160; </div>
<div class="line"><a name="l07519"></a><span class="lineno"> 7519</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::EndObject()</div>
<div class="line"><a name="l07520"></a><span class="lineno"> 7520</span>&#160;{</div>
<div class="line"><a name="l07521"></a><span class="lineno"> 7521</span>&#160; VMA_ASSERT(!m_InsideString);</div>
<div class="line"><a name="l07522"></a><span class="lineno"> 7522</span>&#160; </div>
<div class="line"><a name="l07523"></a><span class="lineno"> 7523</span>&#160; WriteIndent(<span class="keyword">true</span>);</div>
<div class="line"><a name="l07524"></a><span class="lineno"> 7524</span>&#160; m_SB.Add(<span class="charliteral">&#39;}&#39;</span>);</div>
<div class="line"><a name="l07525"></a><span class="lineno"> 7525</span>&#160; </div>
<div class="line"><a name="l07526"></a><span class="lineno"> 7526</span>&#160; VMA_ASSERT(!m_Stack.empty() &amp;&amp; m_Stack.back().type == COLLECTION_TYPE_OBJECT);</div>
<div class="line"><a name="l07527"></a><span class="lineno"> 7527</span>&#160; m_Stack.pop_back();</div>
<div class="line"><a name="l07528"></a><span class="lineno"> 7528</span>&#160;}</div>
<div class="line"><a name="l07529"></a><span class="lineno"> 7529</span>&#160; </div>
<div class="line"><a name="l07530"></a><span class="lineno"> 7530</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::BeginArray(<span class="keywordtype">bool</span> singleLine)</div>
<div class="line"><a name="l07531"></a><span class="lineno"> 7531</span>&#160;{</div>
<div class="line"><a name="l07532"></a><span class="lineno"> 7532</span>&#160; VMA_ASSERT(!m_InsideString);</div>
<div class="line"><a name="l07533"></a><span class="lineno"> 7533</span>&#160; </div>
<div class="line"><a name="l07534"></a><span class="lineno"> 7534</span>&#160; BeginValue(<span class="keyword">false</span>);</div>
<div class="line"><a name="l07535"></a><span class="lineno"> 7535</span>&#160; m_SB.Add(<span class="charliteral">&#39;[&#39;</span>);</div>
<div class="line"><a name="l07536"></a><span class="lineno"> 7536</span>&#160; </div>
<div class="line"><a name="l07537"></a><span class="lineno"> 7537</span>&#160; StackItem item;</div>
<div class="line"><a name="l07538"></a><span class="lineno"> 7538</span>&#160; item.type = COLLECTION_TYPE_ARRAY;</div>
<div class="line"><a name="l07539"></a><span class="lineno"> 7539</span>&#160; item.valueCount = 0;</div>
<div class="line"><a name="l07540"></a><span class="lineno"> 7540</span>&#160; item.singleLineMode = singleLine;</div>
<div class="line"><a name="l07541"></a><span class="lineno"> 7541</span>&#160; m_Stack.push_back(item);</div>
<div class="line"><a name="l07542"></a><span class="lineno"> 7542</span>&#160;}</div>
<div class="line"><a name="l07543"></a><span class="lineno"> 7543</span>&#160; </div>
<div class="line"><a name="l07544"></a><span class="lineno"> 7544</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::EndArray()</div>
<div class="line"><a name="l07545"></a><span class="lineno"> 7545</span>&#160;{</div>
<div class="line"><a name="l07546"></a><span class="lineno"> 7546</span>&#160; VMA_ASSERT(!m_InsideString);</div>
<div class="line"><a name="l07547"></a><span class="lineno"> 7547</span>&#160; </div>
<div class="line"><a name="l07548"></a><span class="lineno"> 7548</span>&#160; WriteIndent(<span class="keyword">true</span>);</div>
<div class="line"><a name="l07549"></a><span class="lineno"> 7549</span>&#160; m_SB.Add(<span class="charliteral">&#39;]&#39;</span>);</div>
<div class="line"><a name="l07550"></a><span class="lineno"> 7550</span>&#160; </div>
<div class="line"><a name="l07551"></a><span class="lineno"> 7551</span>&#160; VMA_ASSERT(!m_Stack.empty() &amp;&amp; m_Stack.back().type == COLLECTION_TYPE_ARRAY);</div>
<div class="line"><a name="l07552"></a><span class="lineno"> 7552</span>&#160; m_Stack.pop_back();</div>
<div class="line"><a name="l07553"></a><span class="lineno"> 7553</span>&#160;}</div>
<div class="line"><a name="l07554"></a><span class="lineno"> 7554</span>&#160; </div>
<div class="line"><a name="l07555"></a><span class="lineno"> 7555</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
<div class="line"><a name="l07556"></a><span class="lineno"> 7556</span>&#160;{</div>
<div class="line"><a name="l07557"></a><span class="lineno"> 7557</span>&#160; BeginString(pStr);</div>
<div class="line"><a name="l07558"></a><span class="lineno"> 7558</span>&#160; EndString();</div>
<div class="line"><a name="l07559"></a><span class="lineno"> 7559</span>&#160;}</div>
<div class="line"><a name="l07560"></a><span class="lineno"> 7560</span>&#160; </div>
<div class="line"><a name="l07561"></a><span class="lineno"> 7561</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::BeginString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
<div class="line"><a name="l07562"></a><span class="lineno"> 7562</span>&#160;{</div>
<div class="line"><a name="l07563"></a><span class="lineno"> 7563</span>&#160; VMA_ASSERT(!m_InsideString);</div>
<div class="line"><a name="l07564"></a><span class="lineno"> 7564</span>&#160; </div>
<div class="line"><a name="l07565"></a><span class="lineno"> 7565</span>&#160; BeginValue(<span class="keyword">true</span>);</div>
<div class="line"><a name="l07566"></a><span class="lineno"> 7566</span>&#160; m_SB.Add(<span class="charliteral">&#39;&quot;&#39;</span>);</div>
<div class="line"><a name="l07567"></a><span class="lineno"> 7567</span>&#160; m_InsideString = <span class="keyword">true</span>;</div>
<div class="line"><a name="l07568"></a><span class="lineno"> 7568</span>&#160; <span class="keywordflow">if</span>(pStr != VMA_NULL &amp;&amp; pStr[0] != <span class="charliteral">&#39;\0&#39;</span>)</div>
<div class="line"><a name="l07569"></a><span class="lineno"> 7569</span>&#160; {</div>
<div class="line"><a name="l07570"></a><span class="lineno"> 7570</span>&#160; ContinueString(pStr);</div>
<div class="line"><a name="l07571"></a><span class="lineno"> 7571</span>&#160; }</div>
<div class="line"><a name="l07572"></a><span class="lineno"> 7572</span>&#160;}</div>
<div class="line"><a name="l07573"></a><span class="lineno"> 7573</span>&#160; </div>
<div class="line"><a name="l07574"></a><span class="lineno"> 7574</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
<div class="line"><a name="l07575"></a><span class="lineno"> 7575</span>&#160;{</div>
<div class="line"><a name="l07576"></a><span class="lineno"> 7576</span>&#160; VMA_ASSERT(m_InsideString);</div>
<div class="line"><a name="l07577"></a><span class="lineno"> 7577</span>&#160; </div>
<div class="line"><a name="l07578"></a><span class="lineno"> 7578</span>&#160; <span class="keyword">const</span> <span class="keywordtype">size_t</span> strLen = strlen(pStr);</div>
<div class="line"><a name="l07579"></a><span class="lineno"> 7579</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; strLen; ++i)</div>
<div class="line"><a name="l07580"></a><span class="lineno"> 7580</span>&#160; {</div>
<div class="line"><a name="l07581"></a><span class="lineno"> 7581</span>&#160; <span class="keywordtype">char</span> ch = pStr[i];</div>
<div class="line"><a name="l07582"></a><span class="lineno"> 7582</span>&#160; <span class="keywordflow">if</span>(ch == <span class="charliteral">&#39;\\&#39;</span>)</div>
<div class="line"><a name="l07583"></a><span class="lineno"> 7583</span>&#160; {</div>
<div class="line"><a name="l07584"></a><span class="lineno"> 7584</span>&#160; m_SB.Add(<span class="stringliteral">&quot;\\\\&quot;</span>);</div>
<div class="line"><a name="l07585"></a><span class="lineno"> 7585</span>&#160; }</div>
<div class="line"><a name="l07586"></a><span class="lineno"> 7586</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span>(ch == <span class="charliteral">&#39;&quot;&#39;</span>)</div>
<div class="line"><a name="l07587"></a><span class="lineno"> 7587</span>&#160; {</div>
<div class="line"><a name="l07588"></a><span class="lineno"> 7588</span>&#160; m_SB.Add(<span class="stringliteral">&quot;\\\&quot;&quot;</span>);</div>
<div class="line"><a name="l07589"></a><span class="lineno"> 7589</span>&#160; }</div>
<div class="line"><a name="l07590"></a><span class="lineno"> 7590</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span>(ch &gt;= 32)</div>
<div class="line"><a name="l07591"></a><span class="lineno"> 7591</span>&#160; {</div>
<div class="line"><a name="l07592"></a><span class="lineno"> 7592</span>&#160; m_SB.Add(ch);</div>
<div class="line"><a name="l07593"></a><span class="lineno"> 7593</span>&#160; }</div>
<div class="line"><a name="l07594"></a><span class="lineno"> 7594</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">switch</span>(ch)</div>
<div class="line"><a name="l07595"></a><span class="lineno"> 7595</span>&#160; {</div>
<div class="line"><a name="l07596"></a><span class="lineno"> 7596</span>&#160; <span class="keywordflow">case</span> <span class="charliteral">&#39;\b&#39;</span>:</div>
<div class="line"><a name="l07597"></a><span class="lineno"> 7597</span>&#160; m_SB.Add(<span class="stringliteral">&quot;\\b&quot;</span>);</div>
<div class="line"><a name="l07598"></a><span class="lineno"> 7598</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l07599"></a><span class="lineno"> 7599</span>&#160; <span class="keywordflow">case</span> <span class="charliteral">&#39;\f&#39;</span>:</div>
<div class="line"><a name="l07600"></a><span class="lineno"> 7600</span>&#160; m_SB.Add(<span class="stringliteral">&quot;\\f&quot;</span>);</div>
<div class="line"><a name="l07601"></a><span class="lineno"> 7601</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l07602"></a><span class="lineno"> 7602</span>&#160; <span class="keywordflow">case</span> <span class="charliteral">&#39;\n&#39;</span>:</div>
<div class="line"><a name="l07603"></a><span class="lineno"> 7603</span>&#160; m_SB.Add(<span class="stringliteral">&quot;\\n&quot;</span>);</div>
<div class="line"><a name="l07604"></a><span class="lineno"> 7604</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l07605"></a><span class="lineno"> 7605</span>&#160; <span class="keywordflow">case</span> <span class="charliteral">&#39;\r&#39;</span>:</div>
<div class="line"><a name="l07606"></a><span class="lineno"> 7606</span>&#160; m_SB.Add(<span class="stringliteral">&quot;\\r&quot;</span>);</div>
<div class="line"><a name="l07607"></a><span class="lineno"> 7607</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l07608"></a><span class="lineno"> 7608</span>&#160; <span class="keywordflow">case</span> <span class="charliteral">&#39;\t&#39;</span>:</div>
<div class="line"><a name="l07609"></a><span class="lineno"> 7609</span>&#160; m_SB.Add(<span class="stringliteral">&quot;\\t&quot;</span>);</div>
<div class="line"><a name="l07610"></a><span class="lineno"> 7610</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l07611"></a><span class="lineno"> 7611</span>&#160; <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l07612"></a><span class="lineno"> 7612</span>&#160; VMA_ASSERT(0 &amp;&amp; <span class="stringliteral">&quot;Character not currently supported.&quot;</span>);</div>
<div class="line"><a name="l07613"></a><span class="lineno"> 7613</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l07614"></a><span class="lineno"> 7614</span>&#160; }</div>
<div class="line"><a name="l07615"></a><span class="lineno"> 7615</span>&#160; }</div>
<div class="line"><a name="l07616"></a><span class="lineno"> 7616</span>&#160;}</div>
<div class="line"><a name="l07617"></a><span class="lineno"> 7617</span>&#160; </div>
<div class="line"><a name="l07618"></a><span class="lineno"> 7618</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString(uint32_t n)</div>
<div class="line"><a name="l07619"></a><span class="lineno"> 7619</span>&#160;{</div>
<div class="line"><a name="l07620"></a><span class="lineno"> 7620</span>&#160; VMA_ASSERT(m_InsideString);</div>
<div class="line"><a name="l07621"></a><span class="lineno"> 7621</span>&#160; m_SB.AddNumber(n);</div>
<div class="line"><a name="l07622"></a><span class="lineno"> 7622</span>&#160;}</div>
<div class="line"><a name="l07623"></a><span class="lineno"> 7623</span>&#160; </div>
<div class="line"><a name="l07624"></a><span class="lineno"> 7624</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString(uint64_t n)</div>
<div class="line"><a name="l07625"></a><span class="lineno"> 7625</span>&#160;{</div>
<div class="line"><a name="l07626"></a><span class="lineno"> 7626</span>&#160; VMA_ASSERT(m_InsideString);</div>
<div class="line"><a name="l07627"></a><span class="lineno"> 7627</span>&#160; m_SB.AddNumber(n);</div>
<div class="line"><a name="l07628"></a><span class="lineno"> 7628</span>&#160;}</div>
<div class="line"><a name="l07629"></a><span class="lineno"> 7629</span>&#160; </div>
<div class="line"><a name="l07630"></a><span class="lineno"> 7630</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::ContinueString_Pointer(<span class="keyword">const</span> <span class="keywordtype">void</span>* ptr)</div>
<div class="line"><a name="l07631"></a><span class="lineno"> 7631</span>&#160;{</div>
<div class="line"><a name="l07632"></a><span class="lineno"> 7632</span>&#160; VMA_ASSERT(m_InsideString);</div>
<div class="line"><a name="l07633"></a><span class="lineno"> 7633</span>&#160; m_SB.AddPointer(ptr);</div>
<div class="line"><a name="l07634"></a><span class="lineno"> 7634</span>&#160;}</div>
<div class="line"><a name="l07635"></a><span class="lineno"> 7635</span>&#160; </div>
<div class="line"><a name="l07636"></a><span class="lineno"> 7636</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::EndString(<span class="keyword">const</span> <span class="keywordtype">char</span>* pStr)</div>
<div class="line"><a name="l07637"></a><span class="lineno"> 7637</span>&#160;{</div>
<div class="line"><a name="l07638"></a><span class="lineno"> 7638</span>&#160; VMA_ASSERT(m_InsideString);</div>
<div class="line"><a name="l07639"></a><span class="lineno"> 7639</span>&#160; <span class="keywordflow">if</span>(pStr != VMA_NULL &amp;&amp; pStr[0] != <span class="charliteral">&#39;\0&#39;</span>)</div>
<div class="line"><a name="l07640"></a><span class="lineno"> 7640</span>&#160; {</div>
<div class="line"><a name="l07641"></a><span class="lineno"> 7641</span>&#160; ContinueString(pStr);</div>
<div class="line"><a name="l07642"></a><span class="lineno"> 7642</span>&#160; }</div>
<div class="line"><a name="l07643"></a><span class="lineno"> 7643</span>&#160; m_SB.Add(<span class="charliteral">&#39;&quot;&#39;</span>);</div>
<div class="line"><a name="l07644"></a><span class="lineno"> 7644</span>&#160; m_InsideString = <span class="keyword">false</span>;</div>
<div class="line"><a name="l07645"></a><span class="lineno"> 7645</span>&#160;}</div>
<div class="line"><a name="l07646"></a><span class="lineno"> 7646</span>&#160; </div>
<div class="line"><a name="l07647"></a><span class="lineno"> 7647</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteNumber(uint32_t n)</div>
<div class="line"><a name="l07648"></a><span class="lineno"> 7648</span>&#160;{</div>
<div class="line"><a name="l07649"></a><span class="lineno"> 7649</span>&#160; VMA_ASSERT(!m_InsideString);</div>
<div class="line"><a name="l07650"></a><span class="lineno"> 7650</span>&#160; BeginValue(<span class="keyword">false</span>);</div>
<div class="line"><a name="l07651"></a><span class="lineno"> 7651</span>&#160; m_SB.AddNumber(n);</div>
<div class="line"><a name="l07652"></a><span class="lineno"> 7652</span>&#160;}</div>
<div class="line"><a name="l07653"></a><span class="lineno"> 7653</span>&#160; </div>
<div class="line"><a name="l07654"></a><span class="lineno"> 7654</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteNumber(uint64_t n)</div>
<div class="line"><a name="l07655"></a><span class="lineno"> 7655</span>&#160;{</div>
<div class="line"><a name="l07656"></a><span class="lineno"> 7656</span>&#160; VMA_ASSERT(!m_InsideString);</div>
<div class="line"><a name="l07657"></a><span class="lineno"> 7657</span>&#160; BeginValue(<span class="keyword">false</span>);</div>
<div class="line"><a name="l07658"></a><span class="lineno"> 7658</span>&#160; m_SB.AddNumber(n);</div>
<div class="line"><a name="l07659"></a><span class="lineno"> 7659</span>&#160;}</div>
<div class="line"><a name="l07660"></a><span class="lineno"> 7660</span>&#160; </div>
<div class="line"><a name="l07661"></a><span class="lineno"> 7661</span>&#160;<span class="keywordtype">void</span> VmaJsonWriter::WriteBool(<span class="keywordtype">bool</span> b)</div>