mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2025-05-15 01:08:31 +00:00
Only use system aligned_alloc on mac/ios if the SDK has them.
Bug: chromium:1098741 Change-Id: I4df73f581c2a6895c7f136ff974db0371c48cc5e
This commit is contained in:
parent
5ef3d923d5
commit
c331971b30
1 changed files with 8 additions and 1 deletions
|
@ -3955,11 +3955,18 @@ void *vma_aligned_alloc(size_t alignment, size_t size)
|
||||||
}
|
}
|
||||||
#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
|
#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void *vma_aligned_alloc(size_t alignment, size_t size)
|
void *vma_aligned_alloc(size_t alignment, size_t size)
|
||||||
{
|
{
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__) && (defined(MAC_OS_X_VERSION_10_15) || defined(__IPHONE_13_0))
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_15 || __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
|
||||||
if (__builtin_available(macOS 10.15, iOS 13, *))
|
if (__builtin_available(macOS 10.15, iOS 13, *))
|
||||||
return aligned_alloc(alignment, size);
|
return aligned_alloc(alignment, size);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
// alignment must be >= sizeof(void*)
|
// alignment must be >= sizeof(void*)
|
||||||
if(alignment < sizeof(void*))
|
if(alignment < sizeof(void*))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue