mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 17:10:11 +01:00
venus: use vk_default_allocator
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4870 Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Acked-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11117>
This commit is contained in:
parent
567a18dade
commit
736e24bdce
3 changed files with 1 additions and 48 deletions
|
|
@ -17,12 +17,6 @@
|
|||
#include "util/os_misc.h"
|
||||
#include "vk_enum_to_str.h"
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
#define VN_MAX_ALIGN _Alignof(max_align_t)
|
||||
#else
|
||||
#define VN_MAX_ALIGN VN_DEFAULT_ALIGN
|
||||
#endif
|
||||
|
||||
static const struct debug_control vn_debug_options[] = {
|
||||
{ "init", VN_DEBUG_INIT },
|
||||
{ "result", VN_DEBUG_RESULT },
|
||||
|
|
@ -67,44 +61,6 @@ vn_log_result(struct vn_instance *instance,
|
|||
return result;
|
||||
}
|
||||
|
||||
static void *
|
||||
vn_default_alloc(void *pUserData,
|
||||
size_t size,
|
||||
size_t alignment,
|
||||
VkSystemAllocationScope allocationScope)
|
||||
{
|
||||
assert(VN_MAX_ALIGN % alignment == 0);
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
static void *
|
||||
vn_default_realloc(void *pUserData,
|
||||
void *pOriginal,
|
||||
size_t size,
|
||||
size_t alignment,
|
||||
VkSystemAllocationScope allocationScope)
|
||||
{
|
||||
assert(VN_MAX_ALIGN % alignment == 0);
|
||||
return realloc(pOriginal, size);
|
||||
}
|
||||
|
||||
static void
|
||||
vn_default_free(void *pUserData, void *pMemory)
|
||||
{
|
||||
free(pMemory);
|
||||
}
|
||||
|
||||
const VkAllocationCallbacks *
|
||||
vn_default_allocator(void)
|
||||
{
|
||||
static const VkAllocationCallbacks allocator = {
|
||||
.pfnAllocation = vn_default_alloc,
|
||||
.pfnReallocation = vn_default_realloc,
|
||||
.pfnFree = vn_default_free,
|
||||
};
|
||||
return &allocator;
|
||||
}
|
||||
|
||||
void
|
||||
vn_relax(uint32_t *iter)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -132,9 +132,6 @@ vn_log_result(struct vn_instance *instance,
|
|||
VkResult result,
|
||||
const char *where);
|
||||
|
||||
const VkAllocationCallbacks *
|
||||
vn_default_allocator(void);
|
||||
|
||||
void
|
||||
vn_relax(uint32_t *iter);
|
||||
|
||||
|
|
|
|||
|
|
@ -1853,7 +1853,7 @@ vn_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||
VkInstance *pInstance)
|
||||
{
|
||||
const VkAllocationCallbacks *alloc =
|
||||
pAllocator ? pAllocator : vn_default_allocator();
|
||||
pAllocator ? pAllocator : vk_default_allocator();
|
||||
struct vn_instance *instance;
|
||||
VkResult result;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue