mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-12-24 01:40:05 +00:00
Version 2.0.0-alpha.8. Added functions: vmaTouchAllocation, vmaFindMemoryTypeIndexForBufferInfo, vmaFindMemoryTypeIndexForImageInfo.
This commit is contained in:
parent
aed6315b86
commit
9ecb59e847
@ -68,7 +68,7 @@ $(function() {
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>Physical devices in Vulkan support various combinations of memory heaps and types. Help with choosing correct and optimal memory type for your specific resource is one of the key features of this library. You can use it by filling appropriate members of <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> structure, as described below. You can also combine multiple methods.</p>
|
||||
<ol type="1">
|
||||
<li>If you just want to find memory type index that meets your requirements, you can use function <a class="el" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex()</a>.</li>
|
||||
<li>If you just want to find memory type index that meets your requirements, you can use function <a class="el" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a" title="Helps to find memoryTypeIndex, given memoryTypeBits and VmaAllocationCreateInfo. ">vmaFindMemoryTypeIndex()</a>.</li>
|
||||
<li>If you want to allocate a region of device memory without association with any specific image or buffer, you can use function <a class="el" href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8" title="General purpose memory allocation. ">vmaAllocateMemory()</a>. Usage of this function is not recommended and usually not needed.</li>
|
||||
<li>If you already have a buffer or an image created, you want to allocate memory for it and then you will bind it yourself, you can use function <a class="el" href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer()</a>, <a class="el" href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb" title="Function similar to vmaAllocateMemoryForBuffer(). ">vmaAllocateMemoryForImage()</a>.</li>
|
||||
<li>If you want to create a buffer or an image, allocate memory for it and bind them together, all in one call, you can use function <a class="el" href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer()</a>, <a class="el" href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73" title="Function similar to vmaCreateBuffer(). ">vmaCreateImage()</a>. This is the recommended way to use this library.</li>
|
||||
|
@ -206,6 +206,12 @@ $(function() {
|
||||
<li>vmaFindMemoryTypeIndex()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaFindMemoryTypeIndexForBufferInfo()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaFindMemoryTypeIndexForImageInfo()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaFreeMemory()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
@ -260,6 +266,9 @@ $(function() {
|
||||
<li>VmaStats
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a732be855fb4a7c248e6853d928a729af">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaTouchAllocation()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a108cb6dcb9ad32b81f0d61c08d1b4323">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaUnmapMemory()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
|
@ -58,7 +58,9 @@ $(function() {
|
||||
</div>
|
||||
|
||||
<div class="contents">
|
||||
 <ul>
|
||||
 
|
||||
|
||||
<h3><a id="index_v"></a>- v -</h3><ul>
|
||||
<li>vmaAllocateMemory()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
@ -107,6 +109,12 @@ $(function() {
|
||||
<li>vmaFindMemoryTypeIndex()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaFindMemoryTypeIndexForBufferInfo()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaFindMemoryTypeIndexForImageInfo()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaFreeMemory()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
@ -140,6 +148,9 @@ $(function() {
|
||||
<li>vmaSetCurrentFrameIndex()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaTouchAllocation()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a108cb6dcb9ad32b81f0d61c08d1b4323">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaUnmapMemory()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
|
@ -62,7 +62,7 @@ $(function() {
|
||||
<div class="title">Vulkan Memory Allocator </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p><b>Version 2.0.0-alpha.7</b> (2018-02-09)</p>
|
||||
<div class="textblock"><p><b>Version 2.0.0-alpha.8</b> (2018-03-05)</p>
|
||||
<p>Copyright (c) 2017-2018 Advanced Micro Devices, Inc. All rights reserved. <br />
|
||||
License: MIT</p>
|
||||
<p>Documentation of all members: <a class="el" href="vk__mem__alloc_8h.html">vk_mem_alloc.h</a></p>
|
||||
|
@ -37,7 +37,8 @@ var menudata={children:[
|
||||
{text:"All",url:"globals.html",children:[
|
||||
{text:"p",url:"globals.html#index_p"},
|
||||
{text:"v",url:"globals.html#index_v"}]},
|
||||
{text:"Functions",url:"globals_func.html"},
|
||||
{text:"Functions",url:"globals_func.html",children:[
|
||||
{text:"v",url:"globals_func.html#index_v"}]},
|
||||
{text:"Typedefs",url:"globals_type.html"},
|
||||
{text:"Enumerations",url:"globals_enum.html"},
|
||||
{text:"Enumerator",url:"globals_eval.html"},
|
||||
|
@ -64,6 +64,8 @@ var searchData=
|
||||
['vmadestroypool',['vmaDestroyPool',['../vk__mem__alloc_8h.html#a5485779c8f1948238fc4e92232fa65e1',1,'vk_mem_alloc.h']]],
|
||||
['vmadevicememorycallbacks',['VmaDeviceMemoryCallbacks',['../struct_vma_device_memory_callbacks.html',1,'VmaDeviceMemoryCallbacks'],['../vk__mem__alloc_8h.html#a5e2eb68d727cfd4df25702b027b7aa31',1,'VmaDeviceMemoryCallbacks(): vk_mem_alloc.h']]],
|
||||
['vmafindmemorytypeindex',['vmaFindMemoryTypeIndex',['../vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a',1,'vk_mem_alloc.h']]],
|
||||
['vmafindmemorytypeindexforbufferinfo',['vmaFindMemoryTypeIndexForBufferInfo',['../vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888',1,'vk_mem_alloc.h']]],
|
||||
['vmafindmemorytypeindexforimageinfo',['vmaFindMemoryTypeIndexForImageInfo',['../vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472',1,'vk_mem_alloc.h']]],
|
||||
['vmafreememory',['vmaFreeMemory',['../vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568',1,'vk_mem_alloc.h']]],
|
||||
['vmafreestatsstring',['vmaFreeStatsString',['../vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288',1,'vk_mem_alloc.h']]],
|
||||
['vmagetallocationinfo',['vmaGetAllocationInfo',['../vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b',1,'vk_mem_alloc.h']]],
|
||||
@ -82,6 +84,7 @@ var searchData=
|
||||
['vmasetcurrentframeindex',['vmaSetCurrentFrameIndex',['../vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236',1,'vk_mem_alloc.h']]],
|
||||
['vmastatinfo',['VmaStatInfo',['../struct_vma_stat_info.html',1,'VmaStatInfo'],['../vk__mem__alloc_8h.html#a810b009a788ee8aac72a25b42ffbe31c',1,'VmaStatInfo(): vk_mem_alloc.h']]],
|
||||
['vmastats',['VmaStats',['../struct_vma_stats.html',1,'VmaStats'],['../vk__mem__alloc_8h.html#a732be855fb4a7c248e6853d928a729af',1,'VmaStats(): vk_mem_alloc.h']]],
|
||||
['vmatouchallocation',['vmaTouchAllocation',['../vk__mem__alloc_8h.html#a108cb6dcb9ad32b81f0d61c08d1b4323',1,'vk_mem_alloc.h']]],
|
||||
['vmaunmapmemory',['vmaUnmapMemory',['../vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45',1,'vk_mem_alloc.h']]],
|
||||
['vmavulkanfunctions',['VmaVulkanFunctions',['../struct_vma_vulkan_functions.html',1,'VmaVulkanFunctions'],['../vk__mem__alloc_8h.html#a97064a1a271b0061ebfc3a079862d0c5',1,'VmaVulkanFunctions(): vk_mem_alloc.h']]]
|
||||
];
|
||||
|
@ -16,6 +16,8 @@ var searchData=
|
||||
['vmadestroyimage',['vmaDestroyImage',['../vk__mem__alloc_8h.html#ae50d2cb3b4a3bfd4dd40987234e50e7e',1,'vk_mem_alloc.h']]],
|
||||
['vmadestroypool',['vmaDestroyPool',['../vk__mem__alloc_8h.html#a5485779c8f1948238fc4e92232fa65e1',1,'vk_mem_alloc.h']]],
|
||||
['vmafindmemorytypeindex',['vmaFindMemoryTypeIndex',['../vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a',1,'vk_mem_alloc.h']]],
|
||||
['vmafindmemorytypeindexforbufferinfo',['vmaFindMemoryTypeIndexForBufferInfo',['../vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888',1,'vk_mem_alloc.h']]],
|
||||
['vmafindmemorytypeindexforimageinfo',['vmaFindMemoryTypeIndexForImageInfo',['../vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472',1,'vk_mem_alloc.h']]],
|
||||
['vmafreememory',['vmaFreeMemory',['../vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568',1,'vk_mem_alloc.h']]],
|
||||
['vmafreestatsstring',['vmaFreeStatsString',['../vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288',1,'vk_mem_alloc.h']]],
|
||||
['vmagetallocationinfo',['vmaGetAllocationInfo',['../vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b',1,'vk_mem_alloc.h']]],
|
||||
@ -27,5 +29,6 @@ var searchData=
|
||||
['vmamapmemory',['vmaMapMemory',['../vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069',1,'vk_mem_alloc.h']]],
|
||||
['vmasetallocationuserdata',['vmaSetAllocationUserData',['../vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f',1,'vk_mem_alloc.h']]],
|
||||
['vmasetcurrentframeindex',['vmaSetCurrentFrameIndex',['../vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236',1,'vk_mem_alloc.h']]],
|
||||
['vmatouchallocation',['vmaTouchAllocation',['../vk__mem__alloc_8h.html#a108cb6dcb9ad32b81f0d61c08d1b4323',1,'vk_mem_alloc.h']]],
|
||||
['vmaunmapmemory',['vmaUnmapMemory',['../vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45',1,'vk_mem_alloc.h']]]
|
||||
];
|
||||
|
@ -235,7 +235,14 @@ Functions</h2></td></tr>
|
||||
<tr class="memitem:a3104eb30d8122c84dd8541063f145288"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288">vmaFreeStatsString</a> (VmaAllocator allocator, char *pStatsString)</td></tr>
|
||||
<tr class="separator:a3104eb30d8122c84dd8541063f145288"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aef15a94b58fbcb0fe706d5720e84a74a"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a">vmaFindMemoryTypeIndex</a> (VmaAllocator allocator, uint32_t memoryTypeBits, const <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> *pAllocationCreateInfo, uint32_t *pMemoryTypeIndex)</td></tr>
|
||||
<tr class="memdesc:aef15a94b58fbcb0fe706d5720e84a74a"><td class="mdescLeft"> </td><td class="mdescRight">Helps to find memoryTypeIndex, given memoryTypeBits and <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>. <a href="#aef15a94b58fbcb0fe706d5720e84a74a">More...</a><br /></td></tr>
|
||||
<tr class="separator:aef15a94b58fbcb0fe706d5720e84a74a"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ae790ab9ffaf7667fb8f62523e6897888"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888">vmaFindMemoryTypeIndexForBufferInfo</a> (VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> *pAllocationCreateInfo, uint32_t *pMemoryTypeIndex)</td></tr>
|
||||
<tr class="memdesc:ae790ab9ffaf7667fb8f62523e6897888"><td class="mdescLeft"> </td><td class="mdescRight">Helps to find memoryTypeIndex, given VkBufferCreateInfo and <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>. <a href="#ae790ab9ffaf7667fb8f62523e6897888">More...</a><br /></td></tr>
|
||||
<tr class="separator:ae790ab9ffaf7667fb8f62523e6897888"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a088da83d8eaf3ce9056d9ea0b981d472"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472">vmaFindMemoryTypeIndexForImageInfo</a> (VmaAllocator allocator, const VkImageCreateInfo *pImageCreateInfo, const <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> *pAllocationCreateInfo, uint32_t *pMemoryTypeIndex)</td></tr>
|
||||
<tr class="memdesc:a088da83d8eaf3ce9056d9ea0b981d472"><td class="mdescLeft"> </td><td class="mdescRight">Helps to find memoryTypeIndex, given VkImageCreateInfo and <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>. <a href="#a088da83d8eaf3ce9056d9ea0b981d472">More...</a><br /></td></tr>
|
||||
<tr class="separator:a088da83d8eaf3ce9056d9ea0b981d472"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a5c8770ded7c59c8caac6de0c2cb00b50"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a5c8770ded7c59c8caac6de0c2cb00b50">vmaCreatePool</a> (VmaAllocator allocator, const <a class="el" href="struct_vma_pool_create_info.html">VmaPoolCreateInfo</a> *pCreateInfo, VmaPool *pPool)</td></tr>
|
||||
<tr class="memdesc:a5c8770ded7c59c8caac6de0c2cb00b50"><td class="mdescLeft"> </td><td class="mdescRight">Allocates Vulkan device memory and creates <code>VmaPool</code> object. <a href="#a5c8770ded7c59c8caac6de0c2cb00b50">More...</a><br /></td></tr>
|
||||
<tr class="separator:a5c8770ded7c59c8caac6de0c2cb00b50"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@ -262,6 +269,9 @@ Functions</h2></td></tr>
|
||||
<tr class="memitem:a86dd08aba8633bfa4ad0df2e76481d8b"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a> (VmaAllocator allocator, VmaAllocation allocation, <a class="el" href="struct_vma_allocation_info.html">VmaAllocationInfo</a> *pAllocationInfo)</td></tr>
|
||||
<tr class="memdesc:a86dd08aba8633bfa4ad0df2e76481d8b"><td class="mdescLeft"> </td><td class="mdescRight">Returns current information about specified allocation. <a href="#a86dd08aba8633bfa4ad0df2e76481d8b">More...</a><br /></td></tr>
|
||||
<tr class="separator:a86dd08aba8633bfa4ad0df2e76481d8b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a108cb6dcb9ad32b81f0d61c08d1b4323"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a108cb6dcb9ad32b81f0d61c08d1b4323">vmaTouchAllocation</a> (VmaAllocator allocator, VmaAllocation allocation)</td></tr>
|
||||
<tr class="memdesc:a108cb6dcb9ad32b81f0d61c08d1b4323"><td class="mdescLeft"> </td><td class="mdescRight">TODO finish documentation... <a href="#a108cb6dcb9ad32b81f0d61c08d1b4323">More...</a><br /></td></tr>
|
||||
<tr class="separator:a108cb6dcb9ad32b81f0d61c08d1b4323"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:af9147d31ffc11d62fc187bde283ed14f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f">vmaSetAllocationUserData</a> (VmaAllocator allocator, VmaAllocation allocation, void *pUserData)</td></tr>
|
||||
<tr class="memdesc:af9147d31ffc11d62fc187bde283ed14f"><td class="mdescLeft"> </td><td class="mdescRight">Sets pUserData in given allocation to new value. <a href="#af9147d31ffc11d62fc187bde283ed14f">More...</a><br /></td></tr>
|
||||
<tr class="separator:af9147d31ffc11d62fc187bde283ed14f"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@ -1464,6 +1474,8 @@ Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Helps to find memoryTypeIndex, given memoryTypeBits and <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>. </p>
|
||||
<p>This algorithm tries to find a memory type that:</p>
|
||||
<ul>
|
||||
<li>Is allowed by memoryTypeBits.</li>
|
||||
@ -1473,6 +1485,104 @@ Functions</h2></td></tr>
|
||||
</ul>
|
||||
<dl class="section return"><dt>Returns</dt><dd>Returns VK_ERROR_FEATURE_NOT_PRESENT if not found. Receiving such result from this function or any other allocating function probably means that your device doesn't support any memory type with requested features for the specific type of resource you want to use it for. Please check parameters of your resource, like image layout (OPTIMAL versus LINEAR) or mip level count. </dd></dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae790ab9ffaf7667fb8f62523e6897888"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae790ab9ffaf7667fb8f62523e6897888">◆ </a></span>vmaFindMemoryTypeIndexForBufferInfo()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">VkResult vmaFindMemoryTypeIndexForBufferInfo </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">VmaAllocator </td>
|
||||
<td class="paramname"><em>allocator</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const VkBufferCreateInfo * </td>
|
||||
<td class="paramname"><em>pBufferCreateInfo</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> * </td>
|
||||
<td class="paramname"><em>pAllocationCreateInfo</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">uint32_t * </td>
|
||||
<td class="paramname"><em>pMemoryTypeIndex</em> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>)</td>
|
||||
<td></td><td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Helps to find memoryTypeIndex, given VkBufferCreateInfo and <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>. </p>
|
||||
<p>It can be useful e.g. to determine value to be used as <a class="el" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319" title="Vulkan memory type index to allocate this pool from. ">VmaPoolCreateInfo::memoryTypeIndex</a>. It internally creates a temporary, dummy buffer that never has memory bound. It is just a convenience function, equivalent to calling:</p>
|
||||
<ul>
|
||||
<li><code>vkCreateBuffer</code></li>
|
||||
<li><code>vkGetBufferMemoryRequirements</code></li>
|
||||
<li><code>vmaFindMemoryTypeIndex</code></li>
|
||||
<li><code>vkDestroyBuffer</code> </li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a088da83d8eaf3ce9056d9ea0b981d472"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a088da83d8eaf3ce9056d9ea0b981d472">◆ </a></span>vmaFindMemoryTypeIndexForImageInfo()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">VkResult vmaFindMemoryTypeIndexForImageInfo </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">VmaAllocator </td>
|
||||
<td class="paramname"><em>allocator</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const VkImageCreateInfo * </td>
|
||||
<td class="paramname"><em>pImageCreateInfo</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> * </td>
|
||||
<td class="paramname"><em>pAllocationCreateInfo</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">uint32_t * </td>
|
||||
<td class="paramname"><em>pMemoryTypeIndex</em> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>)</td>
|
||||
<td></td><td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Helps to find memoryTypeIndex, given VkImageCreateInfo and <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a>. </p>
|
||||
<p>It can be useful e.g. to determine value to be used as <a class="el" href="struct_vma_pool_create_info.html#a596fa76b685d3f1f688f84a709a5b319" title="Vulkan memory type index to allocate this pool from. ">VmaPoolCreateInfo::memoryTypeIndex</a>. It internally creates a temporary, dummy image that never has memory bound. It is just a convenience function, equivalent to calling:</p>
|
||||
<ul>
|
||||
<li><code>vkCreateImage</code></li>
|
||||
<li><code>vkGetImageMemoryRequirements</code></li>
|
||||
<li><code>vmaFindMemoryTypeIndex</code></li>
|
||||
<li><code>vkDestroyImage</code> </li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a11f0fbc034fa81a4efedd73d61ce7568"></a>
|
||||
@ -1566,6 +1676,7 @@ Functions</h2></td></tr>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns current information about specified allocation. </p>
|
||||
<p>It also "touches" allocation... TODO finish documentation. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -1862,6 +1973,36 @@ Functions</h2></td></tr>
|
||||
<p>Sets index of the current frame. </p>
|
||||
<p>This function must be used if you make allocations with <code>VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</code> and <code>VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</code> flags to inform the allocator when a new frame begins. Allocations queried using <a class="el" href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b" title="Returns current information about specified allocation. ">vmaGetAllocationInfo()</a> cannot become lost in the current frame. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a108cb6dcb9ad32b81f0d61c08d1b4323"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a108cb6dcb9ad32b81f0d61c08d1b4323">◆ </a></span>vmaTouchAllocation()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">bool vmaTouchAllocation </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">VmaAllocator </td>
|
||||
<td class="paramname"><em>allocator</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">VmaAllocation </td>
|
||||
<td class="paramname"><em>allocation</em> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>)</td>
|
||||
<td></td><td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>TODO finish documentation... </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a9bc268595cb33f6ec4d519cfce81ff45"></a>
|
||||
|
File diff suppressed because one or more lines are too long
@ -29,7 +29,7 @@ extern "C" {
|
||||
|
||||
/** \mainpage Vulkan Memory Allocator
|
||||
|
||||
<b>Version 2.0.0-alpha.7</b> (2018-02-09)
|
||||
<b>Version 2.0.0-alpha.8</b> (2018-03-05)
|
||||
|
||||
Copyright (c) 2017-2018 Advanced Micro Devices, Inc. All rights reserved. \n
|
||||
License: MIT
|
||||
@ -1247,6 +1247,8 @@ typedef struct VmaAllocationCreateInfo
|
||||
} VmaAllocationCreateInfo;
|
||||
|
||||
/**
|
||||
\brief Helps to find memoryTypeIndex, given memoryTypeBits and VmaAllocationCreateInfo.
|
||||
|
||||
This algorithm tries to find a memory type that:
|
||||
|
||||
- Is allowed by memoryTypeBits.
|
||||
@ -1266,6 +1268,42 @@ VkResult vmaFindMemoryTypeIndex(
|
||||
const VmaAllocationCreateInfo* pAllocationCreateInfo,
|
||||
uint32_t* pMemoryTypeIndex);
|
||||
|
||||
/**
|
||||
\brief Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.
|
||||
|
||||
It can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex.
|
||||
It internally creates a temporary, dummy buffer that never has memory bound.
|
||||
It is just a convenience function, equivalent to calling:
|
||||
|
||||
- `vkCreateBuffer`
|
||||
- `vkGetBufferMemoryRequirements`
|
||||
- `vmaFindMemoryTypeIndex`
|
||||
- `vkDestroyBuffer`
|
||||
*/
|
||||
VkResult vmaFindMemoryTypeIndexForBufferInfo(
|
||||
VmaAllocator allocator,
|
||||
const VkBufferCreateInfo* pBufferCreateInfo,
|
||||
const VmaAllocationCreateInfo* pAllocationCreateInfo,
|
||||
uint32_t* pMemoryTypeIndex);
|
||||
|
||||
/**
|
||||
\brief Helps to find memoryTypeIndex, given VkImageCreateInfo and VmaAllocationCreateInfo.
|
||||
|
||||
It can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex.
|
||||
It internally creates a temporary, dummy image that never has memory bound.
|
||||
It is just a convenience function, equivalent to calling:
|
||||
|
||||
- `vkCreateImage`
|
||||
- `vkGetImageMemoryRequirements`
|
||||
- `vmaFindMemoryTypeIndex`
|
||||
- `vkDestroyImage`
|
||||
*/
|
||||
VkResult vmaFindMemoryTypeIndexForImageInfo(
|
||||
VmaAllocator allocator,
|
||||
const VkImageCreateInfo* pImageCreateInfo,
|
||||
const VmaAllocationCreateInfo* pAllocationCreateInfo,
|
||||
uint32_t* pMemoryTypeIndex);
|
||||
|
||||
/// Flags to be passed as VmaPoolCreateInfo::flags.
|
||||
typedef enum VmaPoolCreateFlagBits {
|
||||
/** \brief Use this flag if you always allocate only buffers and linear images or only optimal images out of this pool and so Buffer-Image Granularity can be ignored.
|
||||
@ -1485,12 +1523,21 @@ void vmaFreeMemory(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation);
|
||||
|
||||
/// Returns current information about specified allocation.
|
||||
/** \brief Returns current information about specified allocation.
|
||||
|
||||
It also "touches" allocation... TODO finish documentation.
|
||||
*/
|
||||
void vmaGetAllocationInfo(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
VmaAllocationInfo* pAllocationInfo);
|
||||
|
||||
/** \brief TODO finish documentation...
|
||||
*/
|
||||
bool vmaTouchAllocation(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation);
|
||||
|
||||
/** \brief Sets pUserData in given allocation to new value.
|
||||
|
||||
If the allocation was created with VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT,
|
||||
@ -4069,6 +4116,7 @@ struct VmaAllocator_T
|
||||
VmaDefragmentationStats* pDefragmentationStats);
|
||||
|
||||
void GetAllocationInfo(VmaAllocation hAllocation, VmaAllocationInfo* pAllocationInfo);
|
||||
bool TouchAllocation(VmaAllocation hAllocation);
|
||||
|
||||
VkResult CreatePool(const VmaPoolCreateInfo* pCreateInfo, VmaPool* pPool);
|
||||
void DestroyPool(VmaPool pool);
|
||||
@ -7742,6 +7790,38 @@ void VmaAllocator_T::GetAllocationInfo(VmaAllocation hAllocation, VmaAllocationI
|
||||
}
|
||||
}
|
||||
|
||||
bool VmaAllocator_T::TouchAllocation(VmaAllocation hAllocation)
|
||||
{
|
||||
// This is a stripped-down version of VmaAllocator_T::GetAllocationInfo.
|
||||
if(hAllocation->CanBecomeLost())
|
||||
{
|
||||
uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();
|
||||
uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();
|
||||
for(;;)
|
||||
{
|
||||
if(localLastUseFrameIndex == VMA_FRAME_INDEX_LOST)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(localLastUseFrameIndex == localCurrFrameIndex)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else // Last use time earlier than current time.
|
||||
{
|
||||
if(hAllocation->CompareExchangeLastUseFrameIndex(localLastUseFrameIndex, localCurrFrameIndex))
|
||||
{
|
||||
localLastUseFrameIndex = localCurrFrameIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
VkResult VmaAllocator_T::CreatePool(const VmaPoolCreateInfo* pCreateInfo, VmaPool* pPool)
|
||||
{
|
||||
VMA_DEBUG_LOG(" CreatePool: MemoryTypeIndex=%u", pCreateInfo->memoryTypeIndex);
|
||||
@ -8341,6 +8421,72 @@ VkResult vmaFindMemoryTypeIndex(
|
||||
return (*pMemoryTypeIndex != UINT32_MAX) ? VK_SUCCESS : VK_ERROR_FEATURE_NOT_PRESENT;
|
||||
}
|
||||
|
||||
VkResult vmaFindMemoryTypeIndexForBufferInfo(
|
||||
VmaAllocator allocator,
|
||||
const VkBufferCreateInfo* pBufferCreateInfo,
|
||||
const VmaAllocationCreateInfo* pAllocationCreateInfo,
|
||||
uint32_t* pMemoryTypeIndex)
|
||||
{
|
||||
VMA_ASSERT(allocator != VK_NULL_HANDLE);
|
||||
VMA_ASSERT(pBufferCreateInfo != VMA_NULL);
|
||||
VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);
|
||||
VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);
|
||||
|
||||
const VkDevice hDev = allocator->m_hDevice;
|
||||
VkBuffer hBuffer = VK_NULL_HANDLE;
|
||||
VkResult res = allocator->GetVulkanFunctions().vkCreateBuffer(
|
||||
hDev, pBufferCreateInfo, allocator->GetAllocationCallbacks(), &hBuffer);
|
||||
if(res == VK_SUCCESS)
|
||||
{
|
||||
VkMemoryRequirements memReq = {};
|
||||
allocator->GetVulkanFunctions().vkGetBufferMemoryRequirements(
|
||||
hDev, hBuffer, &memReq);
|
||||
|
||||
res = vmaFindMemoryTypeIndex(
|
||||
allocator,
|
||||
memReq.memoryTypeBits,
|
||||
pAllocationCreateInfo,
|
||||
pMemoryTypeIndex);
|
||||
|
||||
allocator->GetVulkanFunctions().vkDestroyBuffer(
|
||||
hDev, hBuffer, allocator->GetAllocationCallbacks());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
VkResult vmaFindMemoryTypeIndexForImageInfo(
|
||||
VmaAllocator allocator,
|
||||
const VkImageCreateInfo* pImageCreateInfo,
|
||||
const VmaAllocationCreateInfo* pAllocationCreateInfo,
|
||||
uint32_t* pMemoryTypeIndex)
|
||||
{
|
||||
VMA_ASSERT(allocator != VK_NULL_HANDLE);
|
||||
VMA_ASSERT(pImageCreateInfo != VMA_NULL);
|
||||
VMA_ASSERT(pAllocationCreateInfo != VMA_NULL);
|
||||
VMA_ASSERT(pMemoryTypeIndex != VMA_NULL);
|
||||
|
||||
const VkDevice hDev = allocator->m_hDevice;
|
||||
VkImage hImage = VK_NULL_HANDLE;
|
||||
VkResult res = allocator->GetVulkanFunctions().vkCreateImage(
|
||||
hDev, pImageCreateInfo, allocator->GetAllocationCallbacks(), &hImage);
|
||||
if(res == VK_SUCCESS)
|
||||
{
|
||||
VkMemoryRequirements memReq = {};
|
||||
allocator->GetVulkanFunctions().vkGetImageMemoryRequirements(
|
||||
hDev, hImage, &memReq);
|
||||
|
||||
res = vmaFindMemoryTypeIndex(
|
||||
allocator,
|
||||
memReq.memoryTypeBits,
|
||||
pAllocationCreateInfo,
|
||||
pMemoryTypeIndex);
|
||||
|
||||
allocator->GetVulkanFunctions().vkDestroyImage(
|
||||
hDev, hImage, allocator->GetAllocationCallbacks());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
VkResult vmaCreatePool(
|
||||
VmaAllocator allocator,
|
||||
const VmaPoolCreateInfo* pCreateInfo,
|
||||
@ -8519,6 +8665,17 @@ void vmaGetAllocationInfo(
|
||||
allocator->GetAllocationInfo(allocation, pAllocationInfo);
|
||||
}
|
||||
|
||||
bool vmaTouchAllocation(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation)
|
||||
{
|
||||
VMA_ASSERT(allocator && allocation);
|
||||
|
||||
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
||||
|
||||
return allocator->TouchAllocation(allocation);
|
||||
}
|
||||
|
||||
void vmaSetAllocationUserData(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
|
Loading…
Reference in New Issue
Block a user