From 00bf7a304e5a55255fbc53175496891e7ad6217f Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Wed, 28 Aug 2024 20:57:18 +0200 Subject: [PATCH] Improved documentation about vk_khr_external_memory_win32 --- docs/html/vk_khr_external_memory_win32.html | 3 ++- include/vk_mem_alloc.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/html/vk_khr_external_memory_win32.html b/docs/html/vk_khr_external_memory_win32.html index 5d1a806..63f252e 100644 --- a/docs/html/vk_khr_external_memory_win32.html +++ b/docs/html/vk_khr_external_memory_win32.html @@ -181,7 +181,8 @@ Memory allocation
VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
Creates a new VkBuffer, allocates and binds memory for it.
VmaPool pool
Pool that this allocation should be created in.
Definition vk_mem_alloc.h:1321
Represents single memory allocation.
-

+

If you need each allocation to have its own device memory block and start at offset 0, you can still do by using VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT flag. It works also with custom pools.

+

Exporting Win32 handle

After the allocation is created, you can acquire a Win32 HANDLE to the VkDeviceMemory block it belongs to. VMA function vmaGetMemoryWin32Handle() is a replacement of the Vulkan function vkGetMemoryWin32HandleKHR.

HANDLE handle;
diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index 5a2ae79..cb58a9e 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -18929,6 +18929,9 @@ res = vmaCreateBuffer(g_Allocator, &bufCreateInfo, &allocCreateInfo, &buf, &allo vmaDestroyBuffer(g_Allocator, buf, alloc); \endcode +If you need each allocation to have its own device memory block and start at offset 0, you can still do +by using #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT flag. It works also with custom pools. + \section vk_khr_external_memory_win32_exporting_win32_handle Exporting Win32 handle After the allocation is created, you can acquire a Win32 `HANDLE` to the `VkDeviceMemory` block it belongs to.