vulkan/util: Add a vk_zalloc helper

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
Jason Ekstrand 2017-08-08 12:25:26 -07:00
parent caa71343c6
commit ae8365a9eb
1 changed files with 14 additions and 0 deletions

View File

@ -36,6 +36,20 @@ vk_alloc(const VkAllocationCallbacks *alloc,
return alloc->pfnAllocation(alloc->pUserData, size, align, scope);
}
static inline void *
vk_zalloc(const VkAllocationCallbacks *alloc,
size_t size, size_t align,
VkSystemAllocationScope scope)
{
void *mem = vk_alloc(alloc, size, align, scope);
if (mem == NULL)
return NULL;
memset(mem, 0, size);
return mem;
}
static inline void *
vk_realloc(const VkAllocationCallbacks *alloc,
void *ptr, size_t size, size_t align,