diff options
author | Jason Ekstrand <[email protected]> | 2017-08-08 12:25:26 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-08-28 18:35:33 -0700 |
commit | ae8365a9eb017161c294f2a9171d0cbfd7249e20 (patch) | |
tree | 93b63fa6285eaf9110803dd050ef1a843e41d504 /src/vulkan | |
parent | caa71343c684bfbe8de0e2c780c585bd808728de (diff) |
vulkan/util: Add a vk_zalloc helper
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/vulkan')
-rw-r--r-- | src/vulkan/util/vk_alloc.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vulkan/util/vk_alloc.h b/src/vulkan/util/vk_alloc.h index 29150218269..f58a80625a8 100644 --- a/src/vulkan/util/vk_alloc.h +++ b/src/vulkan/util/vk_alloc.h @@ -37,6 +37,20 @@ vk_alloc(const VkAllocationCallbacks *alloc, } 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, VkSystemAllocationScope scope) |