Skip to content

Commit

Permalink
vk_mem_alloc.h: Patch for C++14 compilation on Linux, BSDs
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Oct 15, 2023
1 parent baedca4 commit 971c73e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/ivis_opengl/3rdparty/vk_mem_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2765,7 +2765,11 @@ static void* vma_aligned_alloc(size_t alignment, size_t size)

return memalign(alignment, size);
}
#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
#elif defined(__APPLE__) || defined(__ANDROID__) || \
((defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__)) \
&& ((__cplusplus >= 201402L && __cplusplus < 201703L) || (defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))))
// WZ Patch: Add C++14, BSDs to the linux check above (until we can require C++17)
// Reference: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/issues/332
#include <cstdlib>

#if defined(__APPLE__)
Expand Down Expand Up @@ -2813,6 +2817,7 @@ static void* vma_aligned_alloc(size_t alignment, size_t size)
#else
static void* vma_aligned_alloc(size_t alignment, size_t size)
{
#error No available implementation for vma_aligned_alloc
VMA_ASSERT(0 && "Could not implement aligned_alloc automatically. Please enable C++17 or later in your compiler or provide custom implementation of macro VMA_SYSTEM_ALIGNED_MALLOC (and VMA_SYSTEM_ALIGNED_FREE if needed) using the API of your system.");
return VMA_NULL;
}
Expand Down

0 comments on commit 971c73e

Please sign in to comment.