mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 12:20:07 +00:00
Disable broken aligned_alloc on new versions of macOS and revert to old behaviour.
This commit is contained in:
parent
55868965ae
commit
0495495a42
@ -4182,18 +4182,21 @@ static void* vma_aligned_alloc(size_t alignment, size_t size)
|
|||||||
|
|
||||||
static void* vma_aligned_alloc(size_t alignment, size_t size)
|
static void* vma_aligned_alloc(size_t alignment, size_t size)
|
||||||
{
|
{
|
||||||
#if defined(__APPLE__) && (defined(MAC_OS_X_VERSION_10_16) || defined(__IPHONE_14_0))
|
// Unfortunately, aligned_alloc causes VMA to crash due to it returning null pointers. (At least under 11.4)
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_16 || __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
|
// Therefore, for now disable this specific exception until a proper solution is found.
|
||||||
// For C++14, usr/include/malloc/_malloc.h declares aligned_alloc()) only
|
//#if defined(__APPLE__) && (defined(MAC_OS_X_VERSION_10_16) || defined(__IPHONE_14_0))
|
||||||
// with the MacOSX11.0 SDK in Xcode 12 (which is what adds
|
//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_16 || __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
|
||||||
// MAC_OS_X_VERSION_10_16), even though the function is marked
|
// // For C++14, usr/include/malloc/_malloc.h declares aligned_alloc()) only
|
||||||
// availabe for 10.15. That's why the preprocessor checks for 10.16 but
|
// // with the MacOSX11.0 SDK in Xcode 12 (which is what adds
|
||||||
// the __builtin_available checks for 10.15.
|
// // MAC_OS_X_VERSION_10_16), even though the function is marked
|
||||||
// People who use C++17 could call aligned_alloc with the 10.15 SDK already.
|
// // availabe for 10.15. That's why the preprocessor checks for 10.16 but
|
||||||
if (__builtin_available(macOS 10.15, iOS 13, *))
|
// // the __builtin_available checks for 10.15.
|
||||||
return aligned_alloc(alignment, size);
|
// // People who use C++17 could call aligned_alloc with the 10.15 SDK already.
|
||||||
#endif
|
// if (__builtin_available(macOS 10.15, iOS 13, *))
|
||||||
#endif
|
// return aligned_alloc(alignment, size);
|
||||||
|
//#endif
|
||||||
|
//#endif
|
||||||
|
|
||||||
// alignment must be >= sizeof(void*)
|
// alignment must be >= sizeof(void*)
|
||||||
if(alignment < sizeof(void*))
|
if(alignment < sizeof(void*))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user