diff options
author | Jason Ekstrand <[email protected]> | 2015-07-31 10:18:00 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-07-31 10:38:23 -0700 |
commit | 930598ad567155a7c35e7c5758844253232015a1 (patch) | |
tree | 5f826dce6d207e8d3fd09310efd642c285cf20a8 /src/vulkan | |
parent | e40bdcef1fb6127545999a0b671b49fa393652b4 (diff) |
vk/instance: valgrind-guard client-provided allocations
Diffstat (limited to 'src/vulkan')
-rw-r--r-- | src/vulkan/anv_device.c | 11 |
1 files changed, 10 insertions, 1 deletions
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); } |