vulkan/util: Add a vk_zalloc helper
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
parent
caa71343c6
commit
ae8365a9eb
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue