@@ -2074,6 +2074,21 @@ VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocationMemoryProperties(
2074
2074
VmaAllocation VMA_NOT_NULL allocation,
2075
2075
VkMemoryPropertyFlags* VMA_NOT_NULL pFlags);
2076
2076
2077
+
2078
+ #if VMA_EXTERNAL_MEMORY_WIN32
2079
+ /**
2080
+ \brief Given an allocation, returns Win32 Handle, that may be imported by other processes or APIs.
2081
+
2082
+ `hTargetProcess` must be a valid handle to target process or NULL. If it's `NULL`, the function returns
2083
+ handle for the current process.
2084
+
2085
+ If the allocation was created with `VMA_ALLOCATION_CREATE_EXPORT_WIN32_HANDLE_BIT` flag,
2086
+ the function fills `pHandle` with handle that can be used in target process.
2087
+ */
2088
+ VMA_CALL_PRE VkResult VMA_CALL_POST vmaGetMemoryWin32HandleKHR(VmaAllocator VMA_NOT_NULL allocator,
2089
+ VmaAllocation VMA_NOT_NULL allocation, HANDLE hTargetProcess, HANDLE* VMA_NOT_NULL pHandle);
2090
+ #endif // VMA_EXTERNAL_MEMORY_WIN32
2091
+
2077
2092
/** \brief Maps memory represented by given allocation and returns pointer to it.
2078
2093
2079
2094
Maps memory represented by given allocation to make it accessible to CPU code.
@@ -6345,7 +6360,7 @@ struct VmaAllocation_T
6345
6360
#endif
6346
6361
6347
6362
#if VMA_EXTERNAL_MEMORY_WIN32
6348
- VkResult GetWin32Handle(VmaAllocator hAllocator, HANDLE hTargetProcess, HANDLE* hHandle) const noexcept;
6363
+ VkResult GetWin32Handle(VmaAllocator hAllocator, HANDLE hTargetProcess, HANDLE* hHandle) noexcept;
6349
6364
#endif // VMA_EXTERNAL_MEMORY_WIN32
6350
6365
6351
6366
private:
@@ -6363,7 +6378,7 @@ struct VmaAllocation_T
6363
6378
void* m_pMappedData; // Not null means memory is mapped.
6364
6379
VmaAllocation_T* m_Prev;
6365
6380
VmaAllocation_T* m_Next;
6366
- mutable VmaWin32Handle m_Handle; // Win32 handle
6381
+ VmaWin32Handle m_Handle; // Win32 handle
6367
6382
};
6368
6383
union
6369
6384
{
@@ -11101,7 +11116,7 @@ void VmaAllocation_T::PrintParameters(class VmaJsonWriter& json) const
11101
11116
}
11102
11117
}
11103
11118
#if VMA_EXTERNAL_MEMORY_WIN32
11104
- VkResult VmaAllocation_T::GetWin32Handle(VmaAllocator hAllocator, HANDLE hTargetProcess, HANDLE* pHandle) const noexcept
11119
+ VkResult VmaAllocation_T::GetWin32Handle(VmaAllocator hAllocator, HANDLE hTargetProcess, HANDLE* pHandle) noexcept
11105
11120
{
11106
11121
// Where do we get this function from?
11107
11122
auto pvkGetMemoryWin32HandleKHR = hAllocator->GetVulkanFunctions().vkGetMemoryWin32HandleKHR;
@@ -13127,12 +13142,6 @@ void VmaAllocator_T::ImportVulkanFunctions_Static()
13127
13142
m_VulkanFunctions.vkGetDeviceImageMemoryRequirements = (PFN_vkGetDeviceImageMemoryRequirements)vkGetDeviceImageMemoryRequirements;
13128
13143
}
13129
13144
#endif
13130
- #if VMA_EXTERNAL_MEMORY_WIN32
13131
- // Can only be fetched dynamically
13132
- m_VulkanFunctions.vkGetMemoryWin32HandleKHR = (PFN_vkGetMemoryWin32HandleKHR)m_VulkanFunctions.vkGetDeviceProcAddr(m_hDevice, "vkGetMemoryWin32HandleKHR");
13133
- #else
13134
- m_VulkanFunctions.vkGetMemoryWin32HandleKHR = VMA_NULL;
13135
- #endif
13136
13145
}
13137
13146
13138
13147
#endif // VMA_STATIC_VULKAN_FUNCTIONS == 1
@@ -16604,7 +16613,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeVirtualBlockStatsString(VmaVirtualBlock V
16604
16613
}
16605
16614
#if VMA_EXTERNAL_MEMORY_WIN32
16606
16615
VMA_CALL_PRE VkResult VMA_CALL_POST vmaGetMemoryWin32HandleKHR(VmaAllocator VMA_NOT_NULL allocator,
16607
- VmaAllocation VMA_NOT_NULL allocation, HANDLE hTargetProcess, HANDLE* pHandle)
16616
+ VmaAllocation VMA_NOT_NULL allocation, HANDLE hTargetProcess, HANDLE* VMA_NOT_NULL pHandle)
16608
16617
{
16609
16618
VMA_ASSERT(allocator && allocation);
16610
16619
VMA_DEBUG_GLOBAL_MUTEX_LOCK;
0 commit comments