Skip to content
0.2.0-dev Download ZIP
32 lines ·1.9 KB Raw
1diff --git a/thirdparty/jolt_physics/Jolt/Core/Core.h b/thirdparty/jolt_physics/Jolt/Core/Core.h
2index 30377deeff..10362b3225 100644
3--- a/thirdparty/jolt_physics/Jolt/Core/Core.h
4+++ b/thirdparty/jolt_physics/Jolt/Core/Core.h
5@@ -585,7 +585,14 @@ static_assert(sizeof(uint64) == 8, "Invalid size of uint64");
6 // Default memory allocation alignment.
7 // This define can be overridden in case the user provides an Allocate function that has a different alignment than the platform default.
8 #ifndef JPH_DEFAULT_ALLOCATE_ALIGNMENT
9- #define JPH_DEFAULT_ALLOCATE_ALIGNMENT __STDCPP_DEFAULT_NEW_ALIGNMENT__
10+ #if defined(JPH_COMPILER_MINGW) && JPH_CPU_ARCH_BITS == 32
11+ // 32-bit MinGW g++ lies that __STDCPP_DEFAULT_NEW_ALIGNMENT__ is 16, but it is actually 8.
12+ // See: https://github.com/godotengine/godot/issues/121608#issuecomment-5142806330
13+ // Note: See similar fix for the definition of JPH_INTERNAL_DEFAULT_ALLOCATE.
14+ #define JPH_DEFAULT_ALLOCATE_ALIGNMENT 8
15+ #else
16+ #define JPH_DEFAULT_ALLOCATE_ALIGNMENT __STDCPP_DEFAULT_NEW_ALIGNMENT__
17+ #endif
18 #endif
19
20 // Cache line size (used for aligning to cache line)
21diff --git a/thirdparty/jolt_physics/Jolt/Core/Memory.h b/thirdparty/jolt_physics/Jolt/Core/Memory.h
22index 5df9781dd5..bf98d4fe79 100644
23--- a/thirdparty/jolt_physics/Jolt/Core/Memory.h
24+++ b/thirdparty/jolt_physics/Jolt/Core/Memory.h
25@@ -38,6 +38,7 @@ JPH_EXPORT void RegisterDefaultAllocator();
26 // It uses the non-aligned version, which on 32 bit platforms usually returns an 8 byte aligned block.
27 // We therefore default to 16 byte aligned allocations when the regular new operator is used.
28 // See: https://github.com/godotengine/godot/issues/105455#issuecomment-2824311547
29+// Note: See similar fix for the definition of JPH_DEFAULT_ALLOCATE_ALIGNMENT
30 #if defined(JPH_COMPILER_MINGW) && JPH_CPU_ARCH_BITS == 32
31 #define JPH_INTERNAL_DEFAULT_ALLOCATE(size) JPH::AlignedAllocate(size, 16)
32 #define JPH_INTERNAL_DEFAULT_FREE(pointer) JPH::AlignedFree(pointer)