summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/VulkanMemoryAllocator/patches/0002-Make-it-compile-on-macOS-10.15.patch
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/VulkanMemoryAllocator/patches/0002-Make-it-compile-on-macOS-10.15.patch')
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/patches/0002-Make-it-compile-on-macOS-10.15.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/3rdparty/VulkanMemoryAllocator/patches/0002-Make-it-compile-on-macOS-10.15.patch b/src/3rdparty/VulkanMemoryAllocator/patches/0002-Make-it-compile-on-macOS-10.15.patch
new file mode 100644
index 0000000000..9a9c5ce0c0
--- /dev/null
+++ b/src/3rdparty/VulkanMemoryAllocator/patches/0002-Make-it-compile-on-macOS-10.15.patch
@@ -0,0 +1,52 @@
+From 8dedd23c769e5b8b76bea9d322fc46a46a2bf76e Mon Sep 17 00:00:00 2001
+From: Laszlo Agocs <laszlo.agocs@qt.io>
+Date: Thu, 14 Jan 2021 11:25:27 +0100
+Subject: [PATCH 2/4] Make it compile on macOS 10.15
+
+Change-Id: I0c26c16ed65668fa90330571d3b741e730b439da
+---
+ .../VulkanMemoryAllocator/vk_mem_alloc.h | 21 ++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+index 8e579967d9..10369475c7 100644
+--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
++++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+@@ -3560,7 +3560,24 @@ void *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__)
++#include <cstdlib>
++// aligned_alloc() is marked as macOS 10.15 only in the 10.15 SDK,
++// avoid the mess by using a different name
++void *vma_aligned_alloc(size_t alignment, size_t size)
++{
++ // alignment must be >= sizeof(void*)
++ if(alignment < sizeof(void*))
++ {
++ alignment = sizeof(void*);
++ }
++
++ void *pointer;
++ if(posix_memalign(&pointer, alignment, size) == 0)
++ return pointer;
++ return VMA_NULL;
++}
++#elif defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
+ #include <cstdlib>
+ void *aligned_alloc(size_t alignment, size_t size)
+ {
+@@ -3608,6 +3625,8 @@ void *aligned_alloc(size_t alignment, size_t size)
+ #ifndef VMA_SYSTEM_ALIGNED_MALLOC
+ #if defined(_WIN32)
+ #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (_aligned_malloc((size), (alignment)))
++ #elif defined(__APPLE__)
++ #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (vma_aligned_alloc((alignment), (size) ))
+ #else
+ #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (aligned_alloc((alignment), (size) ))
+ #endif
+--
+2.23.0.windows.1
+