mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-22 23:04:35 +00:00
Added a member void* pUserData to VmaDeviceMemoryCallbacks
Updated PFN_vmaAllocateDeviceMemoryFunction to use new pUserData member Updated PFN_vmaFreeDeviceMemoryFunction to use new pUserData member Signed-off-by: Nils Petter Skålerud <np_skalerud@hotmail.com>
This commit is contained in:
parent
39aeff7a43
commit
eebf47cd1c
@ -1904,13 +1904,15 @@ typedef void (VKAPI_PTR *PFN_vmaAllocateDeviceMemoryFunction)(
|
||||
VmaAllocator allocator,
|
||||
uint32_t memoryType,
|
||||
VkDeviceMemory memory,
|
||||
VkDeviceSize size);
|
||||
VkDeviceSize size,
|
||||
void* pUserData);
|
||||
/// Callback function called before vkFreeMemory.
|
||||
typedef void (VKAPI_PTR *PFN_vmaFreeDeviceMemoryFunction)(
|
||||
VmaAllocator allocator,
|
||||
uint32_t memoryType,
|
||||
VkDeviceMemory memory,
|
||||
VkDeviceSize size);
|
||||
VkDeviceSize size,
|
||||
void* pUserData);
|
||||
|
||||
/** \brief Set of callbacks that the library will call for `vkAllocateMemory` and `vkFreeMemory`.
|
||||
|
||||
@ -1924,6 +1926,8 @@ typedef struct VmaDeviceMemoryCallbacks {
|
||||
PFN_vmaAllocateDeviceMemoryFunction pfnAllocate;
|
||||
/// Optional, can be null.
|
||||
PFN_vmaFreeDeviceMemoryFunction pfnFree;
|
||||
/// Optional, can be null.
|
||||
void* pUserData;
|
||||
} VmaDeviceMemoryCallbacks;
|
||||
|
||||
/// Flags for created #VmaAllocator.
|
||||
@ -16363,7 +16367,7 @@ VkResult VmaAllocator_T::AllocateVulkanMemory(const VkMemoryAllocateInfo* pAlloc
|
||||
// Informative callback.
|
||||
if(m_DeviceMemoryCallbacks.pfnAllocate != VMA_NULL)
|
||||
{
|
||||
(*m_DeviceMemoryCallbacks.pfnAllocate)(this, pAllocateInfo->memoryTypeIndex, *pMemory, pAllocateInfo->allocationSize);
|
||||
(*m_DeviceMemoryCallbacks.pfnAllocate)(this, pAllocateInfo->memoryTypeIndex, *pMemory, pAllocateInfo->allocationSize, m_DeviceMemoryCallbacks.pUserData);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -16379,7 +16383,7 @@ void VmaAllocator_T::FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, Vk
|
||||
// Informative callback.
|
||||
if(m_DeviceMemoryCallbacks.pfnFree != VMA_NULL)
|
||||
{
|
||||
(*m_DeviceMemoryCallbacks.pfnFree)(this, memoryType, hMemory, size);
|
||||
(*m_DeviceMemoryCallbacks.pfnFree)(this, memoryType, hMemory, size, m_DeviceMemoryCallbacks.pUserData);
|
||||
}
|
||||
|
||||
// VULKAN CALL vkFreeMemory.
|
||||
|
Loading…
Reference in New Issue
Block a user