Skip to content

Commit dc32c06

Browse files
committed
Improved documentation of function vmaCreateBuffer
1 parent 16ad2f8 commit dc32c06

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

docs/html/group__group__alloc.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,12 +1631,12 @@ <h2 class="memtitle"><span class="permalink"><a href="#gac72ee55598617e8eecca384
16311631
<p>Creates a new <span class="tt">VkBuffer</span>, allocates and binds memory for it. </p>
16321632
<dl class="params"><dt>Parameters</dt><dd>
16331633
<table class="params">
1634-
<tr><td class="paramdir"></td><td class="paramname">allocator</td><td></td></tr>
1635-
<tr><td class="paramdir"></td><td class="paramname">pBufferCreateInfo</td><td></td></tr>
1636-
<tr><td class="paramdir"></td><td class="paramname">pAllocationCreateInfo</td><td></td></tr>
1634+
<tr><td class="paramdir"></td><td class="paramname">allocator</td><td>The main allocator object. </td></tr>
1635+
<tr><td class="paramdir"></td><td class="paramname">pBufferCreateInfo</td><td>Buffer creation parameters. </td></tr>
1636+
<tr><td class="paramdir"></td><td class="paramname">pAllocationCreateInfo</td><td>Allocation creation parameters. </td></tr>
16371637
<tr><td class="paramdir">[out]</td><td class="paramname">pBuffer</td><td>Buffer that was created. </td></tr>
16381638
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocation</td><td>Allocation that was created. </td></tr>
1639-
<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>
1639+
<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>
16401640
</table>
16411641
</dd>
16421642
</dl>
@@ -1646,10 +1646,11 @@ <h2 class="memtitle"><span class="permalink"><a href="#gac72ee55598617e8eecca384
16461646
<li>Allocates appropriate memory for it.</li>
16471647
<li>Binds the buffer with the memory.</li>
16481648
</ol>
1649-
<p>If any of these operations fail, buffer and allocation are not created, returned value is negative error code, <span class="tt">*pBuffer</span> and <span class="tt">*pAllocation</span> are null.</p>
1649+
<p>If any of these operations fail, buffer and allocation are not created, returned value is negative error code, <span class="tt">*pBuffer</span> and <span class="tt">*pAllocation</span> are returned as null.</p>
16501650
<p>If the function succeeded, you must destroy both buffer and allocation when you no longer need them using either convenience function <a class="el" href="#ga0d9f4e4ba5bf9aab1f1c746387753d77" title="Destroys Vulkan buffer and frees allocated memory.">vmaDestroyBuffer()</a> or separately, using <span class="tt">vkDestroyBuffer()</span> and <a class="el" href="#ga11f0fbc034fa81a4efedd73d61ce7568" title="Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(),...">vmaFreeMemory()</a>.</p>
1651-
<p>If <a class="el" href="group__group__init.html#gga4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878" title="Enables usage of VK_KHR_dedicated_allocation extension.">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a> flag was used, VK_KHR_dedicated_allocation extension is used internally to query driver whether it requires or prefers the new buffer to have dedicated allocation. If yes, and if dedicated allocation is possible (<a class="el" href="#ggad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff" title="Set this flag to only try to allocate from existing VkDeviceMemory blocks and never create new such b...">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a> is not used), it creates dedicated allocation for this buffer, just like when using <a class="el" href="#ggad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f" title="Set this flag if the allocation should have its own memory block.">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>.</p>
1652-
<dl class="section note"><dt>Note</dt><dd>This function creates a new <span class="tt">VkBuffer</span>. Sub-allocation of parts of one large buffer, although recommended as a good practice, is out of scope of this library and could be implemented by the user as a higher-level logic on top of VMA. </dd></dl>
1651+
<p>If VK_KHR_dedicated_allocation extenion or Vulkan version &gt;= 1.1 is used, the function queries the driver whether it requires or prefers the new buffer to have dedicated allocation. If yes, and if dedicated allocation is possible (<a class="el" href="#ggad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff" title="Set this flag to only try to allocate from existing VkDeviceMemory blocks and never create new such b...">VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT</a> is not used), it creates dedicated allocation for this buffer, just like when using <a class="el" href="#ggad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f" title="Set this flag if the allocation should have its own memory block.">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>.</p>
1652+
<dl class="section note"><dt>Note</dt><dd>This function creates a new <span class="tt">VkBuffer</span>. Sub-allocation of parts of one large buffer, although recommended as a good practice, is out of scope of this library and could be implemented by the user as a higher-level logic on top of VMA.</dd></dl>
1653+
<p>There is also an extended version of this function available with additional parameter <span class="tt">minAlignment</span> - see <a class="el" href="#gaa06a690013a0d01e60894ac378083834" title="Creates a buffer with additional minimum alignment.">vmaCreateBufferWithAlignment()</a>. </p>
16531654

16541655
</div>
16551656
</div>

include/vk_mem_alloc.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,12 +2605,13 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory2(
26052605

26062606
/** \brief Creates a new `VkBuffer`, allocates and binds memory for it.
26072607

2608-
\param allocator
2609-
\param pBufferCreateInfo
2610-
\param pAllocationCreateInfo
2608+
\param allocator The main allocator object.
2609+
\param pBufferCreateInfo Buffer creation parameters.
2610+
\param pAllocationCreateInfo Allocation creation parameters.
26112611
\param[out] pBuffer Buffer that was created.
26122612
\param[out] pAllocation Allocation that was created.
2613-
\param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().
2613+
\param[out] pAllocationInfo Optional, can be null. Information about allocated memory.
2614+
It can be also fetched later using vmaGetAllocationInfo().
26142615

26152616
This function automatically:
26162617

@@ -2619,14 +2620,14 @@ This function automatically:
26192620
-# Binds the buffer with the memory.
26202621

26212622
If any of these operations fail, buffer and allocation are not created,
2622-
returned value is negative error code, `*pBuffer` and `*pAllocation` are null.
2623+
returned value is negative error code, `*pBuffer` and `*pAllocation` are returned as null.
26232624

26242625
If the function succeeded, you must destroy both buffer and allocation when you
26252626
no longer need them using either convenience function vmaDestroyBuffer() or
26262627
separately, using `vkDestroyBuffer()` and vmaFreeMemory().
26272628

2628-
If #VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT flag was used,
2629-
VK_KHR_dedicated_allocation extension is used internally to query driver whether
2629+
If VK_KHR_dedicated_allocation extenion or Vulkan version >= 1.1 is used,
2630+
the function queries the driver whether
26302631
it requires or prefers the new buffer to have dedicated allocation. If yes,
26312632
and if dedicated allocation is possible
26322633
(#VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT is not used), it creates dedicated
@@ -2636,6 +2637,9 @@ allocation for this buffer, just like when using
26362637
\note This function creates a new `VkBuffer`. Sub-allocation of parts of one large buffer,
26372638
although recommended as a good practice, is out of scope of this library and could be implemented
26382639
by the user as a higher-level logic on top of VMA.
2640+
2641+
There is also an extended version of this function available with additional parameter `minAlignment` -
2642+
see vmaCreateBufferWithAlignment().
26392643
*/
26402644
VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateBuffer(
26412645
VmaAllocator VMA_NOT_NULL allocator,

0 commit comments

Comments
 (0)