Vulkan: Use guardedalloc for driver allocations. #104434

Merged
Jeroen Bakker merged 3 commits from Jeroen-Bakker/blender:vulkan-guardedalloc into main 2023-02-13 08:37:44 +01:00

3 Commits

Author SHA1 Message Date
Jeroen Bakker fc1c3e90ca Merge branch 'main' into vulkan-guardedalloc 2023-02-13 08:36:44 +01:00
Jeroen Bakker 4082cb6610 Merge branch 'main' into vulkan-guardedalloc 2023-02-13 08:30:54 +01:00
Jeroen Bakker afbc14f0fc Vulkan: Use guardedalloc for driver allocations.
Vulkan has a pluggable memory allocation feature, which allows internal
driver allocations to be done by the client application provided
allocator. Vulkan uses this for more client application allocations
done inside the driver, but can also do it for more internal oriented
allocations.

VK_ALLOCATION_CALLBACKS initializes allocation callbacks for host allocations.
The macro creates a local static variable with the name vk_allocation_callbacks
that can be passed to vulkan API functions that expect
const VkAllocationCallbacks *pAllocator.

When WITH_VULKAN_GUARDEDALLOC=Off the memory allocation implemented
in the vulkan device driver is used for both internal and application
oriented memory operations.

For now this would help during the development of Vulkan backend to
detect hidden memory leaks that are hidden inside the driver part
of the stack. In a later stage we need to measure the overhead and
if this should become the default behavior.
2023-02-07 20:49:19 +01:00