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,
alloc->pfnFree(alloc->pUserData, data);
}
+static inline char *
+vk_strdup(const VkAllocationCallbacks *alloc, const char *s,
+ VkSystemAllocationScope scope)
+{
+ if (s == NULL)
+ return NULL;
+
+ size_t size = strlen(s) + 1;
+ char *copy = vk_alloc(alloc, size, 1, scope);
+ if (copy == NULL)
+ return NULL;
+
+ memcpy(copy, s, size);
+
+ return copy;
+}
+
static inline void *
vk_alloc2(const VkAllocationCallbacks *parent_alloc,
const VkAllocationCallbacks *alloc,