projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
caa7134
)
vulkan/util: Add a vk_zalloc helper
author
Jason Ekstrand
<jason.ekstrand@intel.com>
Tue, 8 Aug 2017 19:25:26 +0000
(12:25 -0700)
committer
Jason Ekstrand
<jason.ekstrand@intel.com>
Tue, 29 Aug 2017 01:35:33 +0000
(18:35 -0700)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/vulkan/util/vk_alloc.h
patch
|
blob
|
history
diff --git
a/src/vulkan/util/vk_alloc.h
b/src/vulkan/util/vk_alloc.h
index 2915021826903391b777f9f061893f0840b3e64d..f58a80625a8f4c84fe8d18ac4008989c40f02a96 100644
(file)
--- a/
src/vulkan/util/vk_alloc.h
+++ b/
src/vulkan/util/vk_alloc.h
@@
-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,