Changed implementation of vma_aligned_alloc to only use aligned_alloc when C++17 is enabled, where the function is defined.

See #285

May break on some platforms! If it affects you, 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.
This commit is contained in:
Adam Sawicki 2022-09-07 16:21:34 +02:00
parent d6b705bf75
commit db0f9b481a

View File

@ -2745,11 +2745,17 @@ static void* vma_aligned_alloc(size_t alignment, size_t size)
{
return _aligned_malloc(size, alignment);
}
#else
#elif __cplusplus >= 201703L // Compiler conforms to C++17.
static void* vma_aligned_alloc(size_t alignment, size_t size)
{
return aligned_alloc(alignment, size);
}
#else
static void* vma_aligned_alloc(size_t alignment, size_t size)
{
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;
}
#endif
#if defined(_WIN32)