Mesa (main): anv: use vk_default_allocator

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 3 09:11:35 UTC 2021


Module: Mesa
Branch: main
Commit: 567a18dade4482307e18d4df459b1f87dc45bc9a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=567a18dade4482307e18d4df459b1f87dc45bc9a

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Tue Jun  1 09:37:39 2021 -0700

anv: use vk_default_allocator

Signed-off-by: Chia-I Wu <olvaffe at gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Acked-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11117>

---

 src/intel/vulkan/anv_device.c | 29 +----------------------------
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 81093afe285..b4dfaa9ff75 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -949,33 +949,6 @@ anv_physical_device_destroy(struct anv_physical_device *device)
    vk_free(&device->instance->vk.alloc, device);
 }
 
-static void *
-default_alloc_func(void *pUserData, size_t size, size_t align,
-                   VkSystemAllocationScope allocationScope)
-{
-   return malloc(size);
-}
-
-static void *
-default_realloc_func(void *pUserData, void *pOriginal, size_t size,
-                     size_t align, VkSystemAllocationScope allocationScope)
-{
-   return realloc(pOriginal, size);
-}
-
-static 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,
-};
-
 VkResult anv_EnumerateInstanceExtensionProperties(
     const char*                                 pLayerName,
     uint32_t*                                   pPropertyCount,
@@ -1012,7 +985,7 @@ VkResult anv_CreateInstance(
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO);
 
    if (pAllocator == NULL)
-      pAllocator = &default_alloc;
+      pAllocator = vk_default_allocator();
 
    instance = vk_alloc(pAllocator, sizeof(*instance), 8,
                        VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);



More information about the mesa-commit mailing list