Skip to content

Commit 62ce8ac

Browse files
committed
Updated documentation of vmaAllocateMemory function
1 parent dc32c06 commit 62ce8ac

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

docs/html/group__group__alloc.html

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -826,16 +826,21 @@ <h2 class="memtitle"><span class="permalink"><a href="#gabf28077dbf82d0908b8acbe
826826
<p>General purpose memory allocation. </p>
827827
<dl class="params"><dt>Parameters</dt><dd>
828828
<table class="params">
829-
<tr><td class="paramdir"></td><td class="paramname">allocator</td><td></td></tr>
830-
<tr><td class="paramdir"></td><td class="paramname">pVkMemoryRequirements</td><td></td></tr>
831-
<tr><td class="paramdir"></td><td class="paramname">pCreateInfo</td><td></td></tr>
829+
<tr><td class="paramdir"></td><td class="paramname">allocator</td><td>The main allocator object. </td></tr>
830+
<tr><td class="paramdir"></td><td class="paramname">pVkMemoryRequirements</td><td>Requirements for the allocated memory. </td></tr>
831+
<tr><td class="paramdir"></td><td class="paramname">pCreateInfo</td><td>Allocation creation parameters. </td></tr>
832832
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocation</td><td>Handle to allocated memory. </td></tr>
833-
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocationInfo</td><td>Optional. Information about allocated memory. It can be later fetched using function <a class="el" href="#ga86dd08aba8633bfa4ad0df2e76481d8b" title="Returns current information about specified allocation.">vmaGetAllocationInfo()</a>.</td></tr>
833+
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocationInfo</td><td>Optional, can be null. Information about allocated memory. It can be also fetched later using <a class="el" href="#ga86dd08aba8633bfa4ad0df2e76481d8b" title="Returns current information about specified allocation.">vmaGetAllocationInfo()</a>.</td></tr>
834834
</table>
835835
</dd>
836836
</dl>
837-
<p>You should free the memory using <a class="el" href="#ga11f0fbc034fa81a4efedd73d61ce7568" title="Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(),...">vmaFreeMemory()</a> or <a class="el" href="#ga834b1e4aef395c0a1d56a28e69a4a17e" title="Frees memory and destroys multiple allocations.">vmaFreeMemoryPages()</a>.</p>
838-
<p>It is recommended to use <a class="el" href="#ga7fdf64415b6c3d83c454f28d2c53df7b" title="Allocates memory suitable for given VkBuffer.">vmaAllocateMemoryForBuffer()</a>, <a class="el" href="#ga0faa3f9e5fb233d29d1e00390650febb" title="Allocates memory suitable for given VkImage.">vmaAllocateMemoryForImage()</a>, <a class="el" href="#gac72ee55598617e8eecca384e746bab51" title="Creates a new VkBuffer, allocates and binds memory for it.">vmaCreateBuffer()</a>, <a class="el" href="#ga02a94f25679275851a53e82eacbcfc73" title="Function similar to vmaCreateBuffer().">vmaCreateImage()</a> instead whenever possible. </p>
837+
<p>The function creates a <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a> object without creating a buffer or an image together with it.</p>
838+
<ul>
839+
<li>It is recommended to use <a class="el" href="#ga7fdf64415b6c3d83c454f28d2c53df7b" title="Allocates memory suitable for given VkBuffer.">vmaAllocateMemoryForBuffer()</a>, <a class="el" href="#ga0faa3f9e5fb233d29d1e00390650febb" title="Allocates memory suitable for given VkImage.">vmaAllocateMemoryForImage()</a>, <a class="el" href="#gac72ee55598617e8eecca384e746bab51" title="Creates a new VkBuffer, allocates and binds memory for it.">vmaCreateBuffer()</a>, <a class="el" href="#ga02a94f25679275851a53e82eacbcfc73" title="Function similar to vmaCreateBuffer().">vmaCreateImage()</a> instead whenever possible.</li>
840+
<li>You can also create a buffer or an image later in an existing allocation using <a class="el" href="#gaf0cf014344213e117bd9f9cf5f928122" title="Creates a new VkBuffer, binds already created memory for it.">vmaCreateAliasingBuffer2()</a>, <a class="el" href="#ga69ac829f5bb0737449fa92c2d971f1bb" title="Function similar to vmaCreateAliasingBuffer2() but for images.">vmaCreateAliasingImage2()</a>.</li>
841+
<li>You can also create a buffer or an image on your own and bind it to an existing allocation using <a class="el" href="#ga861f4f27189a7d11ab9d9eedc825cb6b" title="Binds buffer to allocation with additional parameters.">vmaBindBufferMemory2()</a>, <a class="el" href="#ga5f3502dd7d38b53fb1533ea3921d038d" title="Binds image to allocation with additional parameters.">vmaBindImageMemory2()</a>.</li>
842+
</ul>
843+
<p>You must free the returned allocation object using <a class="el" href="#ga11f0fbc034fa81a4efedd73d61ce7568" title="Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(),...">vmaFreeMemory()</a> or <a class="el" href="#ga834b1e4aef395c0a1d56a28e69a4a17e" title="Frees memory and destroys multiple allocations.">vmaFreeMemoryPages()</a>. </p>
839844

840845
</div>
841846
</div>

include/vk_mem_alloc.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,16 +1962,23 @@ VMA_CALL_PRE void VMA_CALL_POST vmaSetPoolName(
19621962

19631963
/** \brief General purpose memory allocation.
19641964

1965-
\param allocator
1966-
\param pVkMemoryRequirements
1967-
\param pCreateInfo
1965+
\param allocator The main allocator object.
1966+
\param pVkMemoryRequirements Requirements for the allocated memory.
1967+
\param pCreateInfo Allocation creation parameters.
19681968
\param[out] pAllocation Handle to allocated memory.
1969-
\param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().
1969+
\param[out] pAllocationInfo Optional, can be null. Information about allocated memory. It can be also fetched later using vmaGetAllocationInfo().
19701970

1971-
You should free the memory using vmaFreeMemory() or vmaFreeMemoryPages().
1971+
The function creates a #VmaAllocation object without creating a buffer or an image together with it.
1972+
1973+
- It is recommended to use vmaAllocateMemoryForBuffer(), vmaAllocateMemoryForImage(),
1974+
vmaCreateBuffer(), vmaCreateImage() instead whenever possible.
1975+
- You can also create a buffer or an image later in an existing allocation using
1976+
vmaCreateAliasingBuffer2(), vmaCreateAliasingImage2().
1977+
- You can also create a buffer or an image on your own and bind it to an existing allocation
1978+
using vmaBindBufferMemory2(), vmaBindImageMemory2().
1979+
1980+
You must free the returned allocation object using vmaFreeMemory() or vmaFreeMemoryPages().
19721981

1973-
It is recommended to use vmaAllocateMemoryForBuffer(), vmaAllocateMemoryForImage(),
1974-
vmaCreateBuffer(), vmaCreateImage() instead whenever possible.
19751982
*/
19761983
VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemory(
19771984
VmaAllocator VMA_NOT_NULL allocator,

0 commit comments

Comments
 (0)