Clarified documentation of vmaUnmapPersistentlyMappedMemory function (thanks @bobvodka)

This commit is contained in:
Adam Sawicki 2017-07-18 16:24:24 +02:00
parent caea62140c
commit 73fb4aa325
4 changed files with 28 additions and 19 deletions

View File

@ -195,7 +195,7 @@ Functions</h2></td></tr>
<p>It makes no sense to set VMA_MEMORY_REQUIREMENT_OWN_MEMORY_BIT and VMA_MEMORY_REQUIREMENT_NEVER_ALLOCATE_BIT at the same time. </p> <p>It makes no sense to set VMA_MEMORY_REQUIREMENT_OWN_MEMORY_BIT and VMA_MEMORY_REQUIREMENT_NEVER_ALLOCATE_BIT at the same time. </p>
</td></tr> </td></tr>
<tr><td class="fieldname"><a id="ggadec54ccdb0fd3901e89ac6d38c2619edae75c9dde227c9d4f64693b1e004106dc"></a>VMA_MEMORY_REQUIREMENT_PERSISTENT_MAP_BIT&#160;</td><td class="fielddoc"><p>Set to use a memory that will be persistently mapped and retrieve pointer to it. </p> <tr><td class="fieldname"><a id="ggadec54ccdb0fd3901e89ac6d38c2619edae75c9dde227c9d4f64693b1e004106dc"></a>VMA_MEMORY_REQUIREMENT_PERSISTENT_MAP_BIT&#160;</td><td class="fielddoc"><p>Set to use a memory that will be persistently mapped and retrieve pointer to it. </p>
<p>Pointer to mapped memory will be returned through ppMappedData. You cannot map the memory on your own as multiple maps of a single VkDeviceMemory are illegal. </p> <p>Pointer to mapped memory will be returned through <a class="el" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2" title="Pointer to the beginning of this allocation as mapped data. Null if this alloaction is not persistent...">VmaAllocationInfo::pMappedData</a>. You cannot map the memory on your own as multiple maps of a single VkDeviceMemory are illegal. </p>
</td></tr> </td></tr>
<tr><td class="fieldname"><a id="ggadec54ccdb0fd3901e89ac6d38c2619eda11f849416519c61bebd90e2e7ecbab21"></a>VMA_MEMORY_REQUIREMENT_FLAG_BITS_MAX_ENUM&#160;</td><td class="fielddoc"></td></tr> <tr><td class="fieldname"><a id="ggadec54ccdb0fd3901e89ac6d38c2619eda11f849416519c61bebd90e2e7ecbab21"></a>VMA_MEMORY_REQUIREMENT_FLAG_BITS_MAX_ENUM&#160;</td><td class="fielddoc"></td></tr>
</table> </table>

View File

@ -223,7 +223,7 @@ Functions</h2></td></tr>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocation</td><td>Handle to allocated memory. </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">pAllocation</td><td>Handle to allocated memory. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocationInfo</td><td>Optional. Information about allocated memory. It can be later fetched using function VmaGetAllocationInfo().</td></tr> <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="group__layer2.html#ga86dd08aba8633bfa4ad0df2e76481d8b" title="Returns current information about specified allocation. ">vmaGetAllocationInfo()</a>.</td></tr>
</table> </table>
</dd> </dd>
</dl> </dl>
@ -278,7 +278,7 @@ Functions</h2></td></tr>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocation</td><td>Handle to allocated memory. </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">pAllocation</td><td>Handle to allocated memory. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocationInfo</td><td>Optional. Information about allocated memory. It can be later fetched using function VmaGetAllocationInfo().</td></tr> <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="group__layer2.html#ga86dd08aba8633bfa4ad0df2e76481d8b" title="Returns current information about specified allocation. ">vmaGetAllocationInfo()</a>.</td></tr>
</table> </table>
</dd> </dd>
</dl> </dl>
@ -640,8 +640,11 @@ for(size_t i = 0; i &lt; allocations.size(); ++i)
</div><div class="memdoc"> </div><div class="memdoc">
<p>Unmaps persistently mapped memory of types that is HOST_COHERENT and DEVICE_LOCAL. </p> <p>Unmaps persistently mapped memory of types that is HOST_COHERENT and DEVICE_LOCAL. </p>
<p>This is optional performance optimization. You should call it on Windows for time of call to vkQueueSubmit and vkQueuePresent, for performance reasons, because of the internal behavior of WDDM.</p> <p>This is optional performance optimization. On Windows you should call it before every call to vkQueueSubmit and vkQueuePresent. After which you can remap the allocations again using <a class="el" href="group__layer2.html#ga03366170bb8e186605518d2f5d65b85a" title="Maps back persistently mapped memory of types that is HOST_COHERENT and DEVICE_LOCAL. ">vmaMapPersistentlyMappedMemory()</a>. This is because of the internal behavior of WDDM. Example:</p>
<p>After this call <a class="el" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2" title="Pointer to the beginning of this allocation as mapped data. Null if this alloaction is not persistent...">VmaAllocationInfo::pMappedData</a> of some allocations may become null.</p> <pre class="fragment">vmaUnmapPersistentlyMappedMemory(allocator);
vkQueueSubmit(...)
vmaMapPersistentlyMappedMemory(allocator);
</pre><p>After this call <a class="el" href="struct_vma_allocation_info.html#a5eeffbe2d2f30f53370ff14aefbadbe2" title="Pointer to the beginning of this allocation as mapped data. Null if this alloaction is not persistent...">VmaAllocationInfo::pMappedData</a> of some allocations may become null.</p>
<p>This call is reference-counted. Memory is mapped again after you call <a class="el" href="group__layer2.html#ga03366170bb8e186605518d2f5d65b85a" title="Maps back persistently mapped memory of types that is HOST_COHERENT and DEVICE_LOCAL. ">vmaMapPersistentlyMappedMemory()</a> same number of times that you called <a class="el" href="group__layer2.html#ga26b87244491c1fe77f11fe9ab5779c27" title="Unmaps persistently mapped memory of types that is HOST_COHERENT and DEVICE_LOCAL. ">vmaUnmapPersistentlyMappedMemory()</a>. </p> <p>This call is reference-counted. Memory is mapped again after you call <a class="el" href="group__layer2.html#ga03366170bb8e186605518d2f5d65b85a" title="Maps back persistently mapped memory of types that is HOST_COHERENT and DEVICE_LOCAL. ">vmaMapPersistentlyMappedMemory()</a> same number of times that you called <a class="el" href="group__layer2.html#ga26b87244491c1fe77f11fe9ab5779c27" title="Unmaps persistently mapped memory of types that is HOST_COHERENT and DEVICE_LOCAL. ">vmaUnmapPersistentlyMappedMemory()</a>. </p>
</div> </div>

File diff suppressed because one or more lines are too long

View File

@ -455,7 +455,7 @@ typedef struct VmaAllocationInfo {
/** \brief General purpose memory allocation. /** \brief General purpose memory allocation.
@param[out] pAllocation Handle to allocated memory. @param[out] pAllocation Handle to allocated memory.
@param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function VmaGetAllocationInfo(). @param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().
You should free the memory using vmaFreeMemory(). You should free the memory using vmaFreeMemory().
@ -471,7 +471,7 @@ VkResult vmaAllocateMemory(
/** /**
@param[out] pAllocation Handle to allocated memory. @param[out] pAllocation Handle to allocated memory.
@param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function VmaGetAllocationInfo(). @param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().
You should free the memory using vmaFreeMemory(). You should free the memory using vmaFreeMemory().
*/ */
@ -526,9 +526,15 @@ void vmaUnmapMemory(
/** \brief Unmaps persistently mapped memory of types that is HOST_COHERENT and DEVICE_LOCAL. /** \brief Unmaps persistently mapped memory of types that is HOST_COHERENT and DEVICE_LOCAL.
This is optional performance optimization. You should call it on Windows for This is optional performance optimization. On Windows you should call it before
time of call to vkQueueSubmit and vkQueuePresent, for performance reasons, every call to vkQueueSubmit and vkQueuePresent. After which you can remap the
because of the internal behavior of WDDM. allocations again using vmaMapPersistentlyMappedMemory(). This is because of the
internal behavior of WDDM. Example:
vmaUnmapPersistentlyMappedMemory(allocator);
vkQueueSubmit(...)
vmaMapPersistentlyMappedMemory(allocator);
After this call VmaAllocationInfo::pMappedData of some allocations may become null. After this call VmaAllocationInfo::pMappedData of some allocations may become null.