vk/instance: valgrind-guard client-provided allocations

This commit is contained in:
Jason Ekstrand 2015-07-31 10:18:00 -07:00
parent e40bdcef1f
commit 930598ad56

View file

@ -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);
}