VulkanMemoryAllocator
VulkanMemoryAllocator copied to clipboard
Changes to PFN_vmaAllocateDeviceMemoryFunction
I modified the Allocate callback (VmaDeviceMemoryCallbacks) of our local copy to include additional information about the used VmaPool and dedicated allocations. The signature is now basically
typedef void (VKAPI_PTR* PFN_vmaAllocateDeviceMemoryFunction)(
VmaAllocator VMA_NOT_NULL allocator,
uint32_t memoryType,
VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,
VkDeviceSize size,
VmaPool VMA_NULLABLE pool,
bool isDedicated,
void* VMA_NULLABLE pUserData);
This requires some data pipelining (aka making sure the new parameters are available at the call site) but nothing all to crazy. We have done this to improve statistic tracking and simplify interop tracking.
Ideally we would like to upstream this change (so we do not have to keep a fork). Is this something you would be willing to accept? We can make the PR.
Thank you for the proposal, but I want to avoid complicating the library code by adding new features like this. Adding new parameters to PFN_vmaAllocateDeviceMemoryFunction would break backward-compatibility, so I would need to extend the structure VmaDeviceMemoryCallbacks with some new version PFN_vmaAllocateDeviceMemoryFunction2, which would add more code.