Fixed crash on Linux caused by VMA vs MOC aligned_alloc conflict. closes #935

This commit is contained in:
Robert Beckebans 2024-10-24 13:05:53 +02:00
parent 9521760c18
commit 6a1b2cff18
2 changed files with 6 additions and 5 deletions

View file

@ -36,12 +36,12 @@ FORCE_INLINE unsigned long find_clear_lsb( unsigned int* mask )
return idx;
}
FORCE_INLINE void* aligned_alloc( size_t alignment, size_t size )
FORCE_INLINE void* moc_aligned_alloc( size_t alignment, size_t size )
{
return _aligned_malloc( size, alignment );
}
FORCE_INLINE void aligned_free( void* ptr )
FORCE_INLINE void moc_aligned_free( void* ptr )
{
_aligned_free( ptr );
}
@ -77,14 +77,15 @@ FORCE_INLINE unsigned long find_clear_lsb( unsigned int* mask )
return idx;
}
FORCE_INLINE void* aligned_alloc( size_t alignment, size_t size )
// RB: renamed to avoid conflict with C++17 aligned_alloc used by VMA
FORCE_INLINE void* moc_aligned_alloc( size_t alignment, size_t size )
{
void* ret;
posix_memalign( &ret, alignment, size );
return ret;
}
FORCE_INLINE void aligned_free( void* ptr )
FORCE_INLINE void moc_aligned_free( void* ptr )
{
free( ptr );
}

View file

@ -486,7 +486,7 @@ extern MaskedOcclusionCulling* CreateMaskedOcclusionCulling( pfnAlignedAlloc ali
MaskedOcclusionCulling* MaskedOcclusionCulling::Create( Implementation RequestedSIMD )
{
return Create( RequestedSIMD, aligned_alloc, aligned_free );
return Create( RequestedSIMD, moc_aligned_alloc, moc_aligned_free );
}
MaskedOcclusionCulling* MaskedOcclusionCulling::Create( Implementation RequestedSIMD, pfnAlignedAlloc alignedAlloc, pfnAlignedFree alignedFree )