Fix for aligned_alloc for Apple MolenVK. Thanks @rextimmy !

This commit is contained in:
Adam Sawicki 2018-02-28 11:24:46 +01:00
parent 94fa0a8e4d
commit f44305429c

View File

@ -1747,9 +1747,16 @@ remove them if not needed.
#include <cstdlib> #include <cstdlib>
void *aligned_alloc(size_t alignment, size_t size) void *aligned_alloc(size_t alignment, size_t size)
{ {
// alignment must be >= sizeof(void*)
if(alignment < sizeof(void*))
{
alignment = sizeof(void*);
}
void *pointer; void *pointer;
posix_memalign(&pointer, alignment, size); if(posix_memalign(&pointer, alignment, size) == 0)
return pointer; return pointer;
return VMA_NULL;
} }
#endif #endif