Mesa (main): tu: 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: 3ba3681b58f91a51c628edfa85be9f41cb1c6539
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ba3681b58f91a51c628edfa85be9f41cb1c6539
Author: Chia-I Wu <olvaffe at gmail.com>
Date: Tue Jun 1 09:36:02 2021 -0700
tu: use vk_default_allocator
Signed-off-by: Chia-I Wu <olvaffe at gmail.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Acked-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11117>
---
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);
More information about the mesa-commit
mailing list