From 3ba3681b58f91a51c628edfa85be9f41cb1c6539 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 1 Jun 2021 09:36:02 -0700 Subject: [PATCH] tu: use vk_default_allocator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chia-I Wu Reviewed-by: Samuel Iglesias Gonsálvez Acked-by: Jason Ekstrand Part-of: --- src/freedreno/vulkan/tu_device.c | 34 +------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c index 677c67563ab..d6b11d1152c 100644 --- a/src/freedreno/vulkan/tu_device.c +++ b/src/freedreno/vulkan/tu_device.c @@ -272,38 +272,6 @@ tu_physical_device_finish(struct tu_physical_device *device) vk_physical_device_finish(&device->vk); } -static VKAPI_ATTR void * -default_alloc_func(void *pUserData, - size_t size, - size_t align, - VkSystemAllocationScope allocationScope) -{ - return malloc(size); -} - -static VKAPI_ATTR void * -default_realloc_func(void *pUserData, - void *pOriginal, - size_t size, - size_t align, - VkSystemAllocationScope allocationScope) -{ - return realloc(pOriginal, size); -} - -static VKAPI_ATTR void -default_free_func(void *pUserData, void *pMemory) -{ - free(pMemory); -} - -static const VkAllocationCallbacks default_alloc = { - .pUserData = NULL, - .pfnAllocation = default_alloc_func, - .pfnReallocation = default_realloc_func, - .pfnFree = default_free_func, -}; - static const struct debug_control tu_debug_options[] = { { "startup", TU_DEBUG_STARTUP }, { "nir", TU_DEBUG_NIR }, @@ -335,7 +303,7 @@ tu_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO); if (pAllocator == NULL) - pAllocator = &default_alloc; + pAllocator = vk_default_allocator(); instance = vk_zalloc(pAllocator, sizeof(*instance), 8, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);