From: Jason Ekstrand Date: Fri, 31 Jul 2015 17:18:00 +0000 (-0700) Subject: vk/instance: valgrind-guard client-provided allocations X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=930598ad567155a7c35e7c5758844253232015a1;p=mesa.git vk/instance: valgrind-guard client-provided allocations --- diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index 9f2fcf37344..f633108895e 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -142,6 +142,8 @@ VkResult anv_CreateInstance( instance->apiVersion = pCreateInfo->pAppInfo->apiVersion; instance->physicalDeviceCount = 0; + VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false)); + *pInstance = anv_instance_to_handle(instance); return VK_SUCCESS; @@ -156,6 +158,8 @@ VkResult anv_DestroyInstance( anv_physical_device_finish(&instance->physicalDevice); } + VG(VALGRIND_DESTROY_MEMPOOL(instance)); + instance->pfnFree(instance->pAllocUserData, instance); return VK_SUCCESS; @@ -167,7 +171,10 @@ anv_instance_alloc(struct anv_instance *instance, size_t size, { void *mem = instance->pfnAlloc(instance->pAllocUserData, size, alignment, allocType); - VG(VALGRIND_MAKE_MEM_UNDEFINED(mem, size)); + if (mem) { + VALGRIND_MEMPOOL_ALLOC(instance, mem, size); + VALGRIND_MAKE_MEM_UNDEFINED(mem, size); + } return mem; } @@ -177,6 +184,8 @@ anv_instance_free(struct anv_instance *instance, void *mem) if (mem == NULL) return; + VALGRIND_MEMPOOL_FREE(instance, mem); + instance->pfnFree(instance->pAllocUserData, mem); }