mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
util/vk_alloc: Add a vk_zalloc2 helper
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
parent
a512565b2b
commit
9b9fb6d212
1 changed files with 16 additions and 0 deletions
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
/* common allocation inlines for vulkan drivers */
|
||||
|
||||
#include <string.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
static inline void *
|
||||
|
|
@ -64,6 +65,21 @@ vk_alloc2(const VkAllocationCallbacks *parent_alloc,
|
|||
return vk_alloc(parent_alloc, size, align, scope);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
vk_zalloc2(const VkAllocationCallbacks *parent_alloc,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
size_t size, size_t align,
|
||||
VkSystemAllocationScope scope)
|
||||
{
|
||||
void *mem = vk_alloc2(parent_alloc, alloc, size, align, scope);
|
||||
if (mem == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(mem, 0, size);
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
static inline void
|
||||
vk_free2(const VkAllocationCallbacks *parent_alloc,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue