Skip to content

Commit c1e6a31

Browse files
committed
Updated documentation of vmaGetMemoryWin32Handle2 and related places
Based on discussion in #503 - thanks @Agrael1
1 parent 62ce8ac commit c1e6a31

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

docs/html/group__group__alloc.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2405,7 +2405,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#ga1a8d7aba3bf5a4de66c801b
24052405
</dd>
24062406
</dl>
24072407
<p>The function fills <span class="tt">pHandle</span> with handle that can be used in target process. The handle is fetched using function <span class="tt">vkGetMemoryWin32HandleKHR</span>.</p>
2408-
<p>if <span class="tt">handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR</span>, each call to this function creates a new handle that must be closed using:</p>
2408+
<p>If <span class="tt">handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR</span>, or other NT handle types, each call to this function creates a new handle that must be closed using:</p>
24092409
<div class="fragment"><div class="line">CloseHandle(handle);</div>
24102410
</div><!-- fragment --><p>You can close it any time, before or after destroying the allocation object. It is reference-counted internally by Windows.</p>
24112411
<p>Note the handle is returned for the entire <span class="tt">VkDeviceMemory</span> block that the allocation belongs to. If the allocation is sub-allocated from a larger block, you may need to consider the offset of the allocation (<a class="el" href="struct_vma_allocation_info.html#a4a3c732388dbdc7a23f9365b00825268" title="Offset in VkDeviceMemory object to the beginning of this allocation, in bytes. (deviceMemory,...">VmaAllocationInfo::offset</a>).</p>

docs/html/other_api_interop.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ <h2 class="doxsection"><a class="anchor" id="other_api_interop_exporting_exporti
192192
<blockquote class="doxtable">
193193
<p>If handleType is defined as an NT handle, vkGetMemoryWin32HandleKHR must be called no more than once for each valid unique combination of memory and handleType. </p>
194194
</blockquote>
195-
<p>This is ensured automatically inside VMA. If <span class="tt">VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT</span> is used as the handle type, the library fetches the handle on first use, remembers it internally, and closes it when the memory block or dedicated allocation is destroyed. Every time you call <a class="el" href="group__group__alloc.html#ga1a8d7aba3bf5a4de66c801b9988afa58" title="Given an allocation, returns Win32 handle that may be imported by other processes or APIs.">vmaGetMemoryWin32Handle2()</a>, VMA calls <span class="tt">DuplicateHandle</span> and returns a new handle that you need to close. For further information, please check the documentation of this function.</p>
195+
<p>This is ensured automatically inside VMA. If <span class="tt">VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT</span> is used as the handle type, or other NT handle types, the library fetches the handle on first use, remembers it internally, and closes it when the memory block or dedicated allocation is destroyed. Every time you call <a class="el" href="group__group__alloc.html#ga1a8d7aba3bf5a4de66c801b9988afa58" title="Given an allocation, returns Win32 handle that may be imported by other processes or APIs.">vmaGetMemoryWin32Handle2()</a>, VMA calls <span class="tt">DuplicateHandle</span> and returns a new handle that you need to close. For further information, please check the documentation of this function.</p>
196196
<h2 class="doxsection"><a class="anchor" id="other_api_interop_exporting_custom_alignment"></a>
197197
Custom alignment</h2>
198198
<p>Buffers or images exported to a different API like OpenGL may require a different alignment, higher than the one used by the library automatically, queried from functions like <span class="tt">vkGetBufferMemoryRequirements</span>. To impose such alignment:</p>

include/vk_mem_alloc.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2210,7 +2210,8 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaGetMemoryWin32Handle(
22102210
The function fills `pHandle` with handle that can be used in target process.
22112211
The handle is fetched using function `vkGetMemoryWin32HandleKHR`.
22122212

2213-
if `handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR`,
2213+
If `handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR`,
2214+
or other NT handle types,
22142215
each call to this function creates a new handle that must be closed using:
22152216

22162217
\code
@@ -18888,6 +18889,7 @@ Documentation of the VK_KHR_external_memory_win32 extension states that:
1888818889

1888918890
This is ensured automatically inside VMA.
1889018891
If `VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT` is used as the handle type,
18892+
or other NT handle types,
1889118893
the library fetches the handle on first use, remembers it internally, and closes it when the memory block or dedicated allocation is destroyed.
1889218894
Every time you call vmaGetMemoryWin32Handle2(), VMA calls `DuplicateHandle` and returns a new handle that you need to close.
1889318895
For further information, please check the documentation of this function.

0 commit comments

Comments
 (0)