Thirdparty: Harmonize patches to document downstream changes

This commit is contained in:
Rémi Verschelde
2025-01-31 10:58:38 +01:00
parent 0d14ae58b0
commit 91907a89f7
141 changed files with 1274 additions and 3849 deletions

View File

@ -22,9 +22,7 @@ subject to the following restrictions:
#include "btScalar.h"
// -- GODOT start --
namespace VHACD {
// -- GODOT end --
//#define BT_DEBUG_MEMORY_ALLOCATIONS 1
#ifdef BT_DEBUG_MEMORY_ALLOCATIONS
@ -106,8 +104,6 @@ public:
friend bool operator==(const self_type&, const self_type&) { return true; }
};
// -- GODOT start --
}; // namespace VHACD
// -- GODOT end --
#endif //BT_ALIGNED_ALLOCATOR

View File

@ -38,9 +38,7 @@ subject to the following restrictions:
#include <new> //for placement new
#endif //BT_USE_PLACEMENT_NEW
// -- GODOT start --
namespace VHACD {
// -- GODOT end --
///The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods
///It is developed to replace stl::vector to avoid portability issues, including STL alignment issues to add SIMD/SSE data
@ -449,8 +447,6 @@ public:
}
};
// -- GODOT start --
}; // namespace VHACD
// -- GODOT end --
#endif //BT_OBJECT_ARRAY__

View File

@ -18,9 +18,7 @@ subject to the following restrictions:
#include "btAlignedObjectArray.h"
#include "btVector3.h"
// -- GODOT start --
namespace VHACD {
// -- GODOT end --
/// Convex hull implementation based on Preparata and Hong
/// See http://code.google.com/p/bullet/issues/detail?id=275
@ -98,8 +96,6 @@ public:
}
};
// -- GODOT start --
}; // namespace VHACD
// -- GODOT end --
#endif //BT_CONVEX_HULL_COMPUTER_H

View File

@ -17,9 +17,7 @@ subject to the following restrictions:
#include "btScalar.h"
// -- GODOT start --
namespace VHACD {
// -- GODOT end --
template <class T>
SIMD_FORCE_INLINE const T& btMin(const T& a, const T& b)
@ -66,8 +64,6 @@ SIMD_FORCE_INLINE void btClamp(T& a, const T& lb, const T& ub)
}
}
// -- GODOT start --
}; // namespace VHACD
// -- GODOT end --
#endif //BT_GEN_MINMAX_H

View File

@ -28,18 +28,14 @@ subject to the following restrictions:
/* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/
#define BT_BULLET_VERSION 279
// -- GODOT start --
namespace VHACD {
// -- GODOT end --
inline int32_t btGetVersion()
{
return BT_BULLET_VERSION;
}
// -- GODOT start --
}; // namespace VHACD
// -- GODOT end --
#if defined(DEBUG) || defined(_DEBUG)
#define BT_DEBUG
@ -72,10 +68,8 @@ inline int32_t btGetVersion()
#define btFsel(a, b, c) __fsel((a), (b), (c))
#else
// -- GODOT start --
//#if (defined(_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined(BT_USE_DOUBLE_PRECISION))
#if (defined(_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined(BT_USE_DOUBLE_PRECISION)) && (!defined(_M_ARM)) && (!defined(_M_ARM64))
// -- GODOT end --
#define BT_USE_SSE
#include <emmintrin.h>
#endif
@ -210,9 +204,7 @@ inline int32_t btGetVersion()
#endif //__CELLOS_LV2__
#endif
// -- GODOT start --
namespace VHACD {
// -- GODOT end --
///The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision.
#if defined(BT_USE_DOUBLE_PRECISION)
@ -546,7 +538,6 @@ struct btTypedObject {
}
};
// -- GODOT start --
// Cherry-picked from Bullet 2.88 to fix GH-27926
///align a pointer to the provided alignment, upwards
template <typename T>
@ -567,10 +558,7 @@ T *btAlignPointer(T *unalignedPtr, size_t alignment)
converter.integer &= bit_mask;
return converter.ptr;
}
// -- GODOT end --
// -- GODOT start --
}; // namespace VHACD
// -- GODOT end --
#endif //BT_SCALAR_H

View File

@ -26,9 +26,7 @@ subject to the following restrictions:
#define btVector3DataName "btVector3FloatData"
#endif //BT_USE_DOUBLE_PRECISION
// -- GODOT start --
namespace VHACD {
// -- GODOT end --
/**@brief btVector3 can be used to represent 3D points and vectors.
* It has an un-used w component to suit 16-byte alignment when btVector3 is stored in containers. This extra component can be used by derived classes (Quaternion?) or by user
@ -716,8 +714,6 @@ SIMD_FORCE_INLINE void btVector3::deSerialize(const struct btVector3Data& dataIn
m_floats[i] = dataIn.m_floats[i];
}
// -- GODOT start --
}; // namespace VHACD
// -- GODOT end --
#endif //BT_VECTOR3_H

View File

@ -18,9 +18,7 @@
#include "vhacdManifoldMesh.h"
#include "vhacdVector.h"
// -- GODOT start --
#include <cstdint>
// -- GODOT end --
namespace VHACD {
//! Incremental Convex Hull algorithm (cf. http://cs.smith.edu/~orourke/books/ftp.html ).

View File

@ -19,9 +19,7 @@ All rights reserved.
#include "vhacdSArray.h"
#include "vhacdVector.h"
// -- GODOT start --
#include <cstdint>
// -- GODOT end --
namespace VHACD {
class TMMTriangle;

View File

@ -71,9 +71,7 @@
#include <pthread.h>
#endif
// -- GODOT start --
#if defined(__APPLE__) || !defined(__GLIBC__)
// -- GODOT end --
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#endif

View File

@ -1,213 +1,177 @@
diff --git a/thirdparty/vhacd/inc/btAlignedAllocator.h b/thirdparty/vhacd/inc/btAlignedAllocator.h
index 11f6e12dc..94e71d512 100644
index 11f6e12dca..8011595d89 100644
--- a/thirdparty/vhacd/inc/btAlignedAllocator.h
+++ b/thirdparty/vhacd/inc/btAlignedAllocator.h
@@ -21,6 +21,11 @@ subject to the following restrictions:
@@ -21,6 +21,9 @@ subject to the following restrictions:
///that is better portable and more predictable
#include "btScalar.h"
+
+// -- GODOT start --
+namespace VHACD {
+// -- GODOT end --
+
//#define BT_DEBUG_MEMORY_ALLOCATIONS 1
#ifdef BT_DEBUG_MEMORY_ALLOCATIONS
@@ -101,4 +106,8 @@ public:
@@ -101,4 +104,6 @@ public:
friend bool operator==(const self_type&, const self_type&) { return true; }
};
+// -- GODOT start --
+}; // namespace VHACD
+// -- GODOT end --
+
#endif //BT_ALIGNED_ALLOCATOR
diff --git a/thirdparty/vhacd/inc/btAlignedObjectArray.h b/thirdparty/vhacd/inc/btAlignedObjectArray.h
index e6620adf6..1ce03d21b 100644
index e6620adf6f..7446a8bfd9 100644
--- a/thirdparty/vhacd/inc/btAlignedObjectArray.h
+++ b/thirdparty/vhacd/inc/btAlignedObjectArray.h
@@ -38,6 +38,10 @@ subject to the following restrictions:
@@ -38,6 +38,8 @@ subject to the following restrictions:
#include <new> //for placement new
#endif //BT_USE_PLACEMENT_NEW
+// -- GODOT start --
+namespace VHACD {
+// -- GODOT end --
+
///The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods
///It is developed to replace stl::vector to avoid portability issues, including STL alignment issues to add SIMD/SSE data
template <typename T>
@@ -445,4 +449,8 @@ public:
@@ -445,4 +447,6 @@ public:
}
};
+// -- GODOT start --
+}; // namespace VHACD
+// -- GODOT end --
+
#endif //BT_OBJECT_ARRAY__
diff --git a/thirdparty/vhacd/inc/btConvexHullComputer.h b/thirdparty/vhacd/inc/btConvexHullComputer.h
index 3c5075c2c..04bb96f64 100644
index 3c5075c2cb..194917cdec 100644
--- a/thirdparty/vhacd/inc/btConvexHullComputer.h
+++ b/thirdparty/vhacd/inc/btConvexHullComputer.h
@@ -18,6 +18,10 @@ subject to the following restrictions:
@@ -18,6 +18,8 @@ subject to the following restrictions:
#include "btAlignedObjectArray.h"
#include "btVector3.h"
+// -- GODOT start --
+namespace VHACD {
+// -- GODOT end --
+
/// Convex hull implementation based on Preparata and Hong
/// See http://code.google.com/p/bullet/issues/detail?id=275
/// Ole Kniemeyer, MAXON Computer GmbH
@@ -94,4 +98,8 @@ public:
@@ -94,4 +96,6 @@ public:
}
};
+// -- GODOT start --
+}; // namespace VHACD
+// -- GODOT end --
+
#endif //BT_CONVEX_HULL_COMPUTER_H
diff --git a/thirdparty/vhacd/inc/btMinMax.h b/thirdparty/vhacd/inc/btMinMax.h
index 40b0ceb6e..9bc1e1c77 100644
index 40b0ceb6ed..12aaeda9c4 100644
--- a/thirdparty/vhacd/inc/btMinMax.h
+++ b/thirdparty/vhacd/inc/btMinMax.h
@@ -17,6 +17,10 @@ subject to the following restrictions:
@@ -17,6 +17,8 @@ subject to the following restrictions:
#include "btScalar.h"
+// -- GODOT start --
+namespace VHACD {
+// -- GODOT end --
+
template <class T>
SIMD_FORCE_INLINE const T& btMin(const T& a, const T& b)
{
@@ -62,4 +66,8 @@ SIMD_FORCE_INLINE void btClamp(T& a, const T& lb, const T& ub)
@@ -62,4 +64,6 @@ SIMD_FORCE_INLINE void btClamp(T& a, const T& lb, const T& ub)
}
}
+// -- GODOT start --
+}; // namespace VHACD
+// -- GODOT end --
+
#endif //BT_GEN_MINMAX_H
diff --git a/thirdparty/vhacd/inc/btScalar.h b/thirdparty/vhacd/inc/btScalar.h
index b814474bd..617fd7c44 100644
index b814474bdf..404bcbcfe1 100644
--- a/thirdparty/vhacd/inc/btScalar.h
+++ b/thirdparty/vhacd/inc/btScalar.h
@@ -28,11 +28,19 @@ subject to the following restrictions:
@@ -28,11 +28,15 @@ subject to the following restrictions:
/* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/
#define BT_BULLET_VERSION 279
+// -- GODOT start --
+namespace VHACD {
+// -- GODOT end --
+
inline int32_t btGetVersion()
{
return BT_BULLET_VERSION;
}
+// -- GODOT start --
+}; // namespace VHACD
+// -- GODOT end --
+
#if defined(DEBUG) || defined(_DEBUG)
#define BT_DEBUG
#endif
@@ -199,6 +207,10 @@ inline int32_t btGetVersion()
@@ -199,6 +203,8 @@ inline int32_t btGetVersion()
#endif //__CELLOS_LV2__
#endif
+// -- GODOT start --
+namespace VHACD {
+// -- GODOT end --
+
///The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision.
#if defined(BT_USE_DOUBLE_PRECISION)
typedef double btScalar;
@@ -530,4 +542,9 @@ struct btTypedObject {
@@ -530,4 +536,7 @@ struct btTypedObject {
return m_objectType;
}
};
+
+// -- GODOT start --
+}; // namespace VHACD
+// -- GODOT end --
+
#endif //BT_SCALAR_H
diff --git a/thirdparty/vhacd/inc/btVector3.h b/thirdparty/vhacd/inc/btVector3.h
index 0f2fefbbd..4ed971673 100644
index 0f2fefbbd5..356a6a9cfc 100644
--- a/thirdparty/vhacd/inc/btVector3.h
+++ b/thirdparty/vhacd/inc/btVector3.h
@@ -26,6 +26,10 @@ subject to the following restrictions:
@@ -26,6 +26,8 @@ subject to the following restrictions:
#define btVector3DataName "btVector3FloatData"
#endif //BT_USE_DOUBLE_PRECISION
+// -- GODOT start --
+namespace VHACD {
+// -- GODOT end --
+
/**@brief btVector3 can be used to represent 3D points and vectors.
* It has an un-used w component to suit 16-byte alignment when btVector3 is stored in containers. This extra component can be used by derived classes (Quaternion?) or by user
* Ideally, this class should be replaced by a platform optimized SIMD version that keeps the data in registers
@@ -712,4 +716,8 @@ SIMD_FORCE_INLINE void btVector3::deSerialize(const struct btVector3Data& dataIn
@@ -712,4 +714,6 @@ SIMD_FORCE_INLINE void btVector3::deSerialize(const struct btVector3Data& dataIn
m_floats[i] = dataIn.m_floats[i];
}
+// -- GODOT start --
+}; // namespace VHACD
+// -- GODOT end --
+
#endif //BT_VECTOR3_H
diff --git a/thirdparty/vhacd/src/btAlignedAllocator.cpp b/thirdparty/vhacd/src/btAlignedAllocator.cpp
index 11d594f6c..ce0e7f26f 100644
index 11d594f6c9..bbb8baa107 100644
--- a/thirdparty/vhacd/src/btAlignedAllocator.cpp
+++ b/thirdparty/vhacd/src/btAlignedAllocator.cpp
@@ -15,6 +15,10 @@ subject to the following restrictions:
@@ -15,6 +15,8 @@ subject to the following restrictions:
#include "btAlignedAllocator.h"
+// -- GODOT start --
+namespace VHACD {
+// -- GODOT end --
+
#ifdef _MSC_VER
#pragma warning(disable:4311 4302)
#endif
@@ -177,4 +181,8 @@ void btAlignedFreeInternal(void* ptr)
@@ -177,4 +179,6 @@ void btAlignedFreeInternal(void* ptr)
sAlignedFreeFunc(ptr);
}
+// -- GODOT start --
+}; // namespace VHACD
+// -- GODOT end --
+
#endif //BT_DEBUG_MEMORY_ALLOCATIONS
diff --git a/thirdparty/vhacd/src/btConvexHullComputer.cpp b/thirdparty/vhacd/src/btConvexHullComputer.cpp
index d3d749adb..8ab34af2a 100644
index d3d749adbe..4f224c8360 100644
--- a/thirdparty/vhacd/src/btConvexHullComputer.cpp
+++ b/thirdparty/vhacd/src/btConvexHullComputer.cpp
@@ -49,6 +49,10 @@ typedef unsigned long long int32_t uint64_t;
@@ -49,6 +49,8 @@ typedef unsigned long long int32_t uint64_t;
#include <stdio.h>
#endif
+// -- GODOT start --
+namespace VHACD {
+// -- GODOT end --
+
// Convex hull implementation based on Preparata and Hong
// Ole Kniemeyer, MAXON Computer GmbH
class btConvexHullInternal {
@@ -2477,3 +2481,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
@@ -2477,3 +2479,5 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
return shift;
}
+
+// -- GODOT start --
+}; // namespace VHACD
+// -- GODOT end --

View File

@ -1,12 +1,11 @@
diff --git a/thirdparty/vhacd/inc/btScalar.h b/thirdparty/vhacd/inc/btScalar.h
index 487205062..52297cd78 100644
index 404bcbcfe1..db00a3c428 100644
--- a/thirdparty/vhacd/inc/btScalar.h
+++ b/thirdparty/vhacd/inc/btScalar.h
@@ -535,6 +535,29 @@ struct btTypedObject {
@@ -537,6 +537,27 @@ struct btTypedObject {
}
};
+// -- GODOT start --
+// Cherry-picked from Bullet 2.88 to fix GH-27926
+///align a pointer to the provided alignment, upwards
+template <typename T>
@ -27,27 +26,24 @@ index 487205062..52297cd78 100644
+ converter.integer &= bit_mask;
+ return converter.ptr;
+}
+// -- GODOT end --
+
// -- GODOT start --
}; // namespace VHACD
// -- GODOT end --
#endif //BT_SCALAR_H
diff --git a/thirdparty/vhacd/src/btAlignedAllocator.cpp b/thirdparty/vhacd/src/btAlignedAllocator.cpp
index ce0e7f26f..8dee31e7e 100644
index bbb8baa107..4d7f4b1b2f 100644
--- a/thirdparty/vhacd/src/btAlignedAllocator.cpp
+++ b/thirdparty/vhacd/src/btAlignedAllocator.cpp
@@ -72,8 +72,12 @@ static inline void* btAlignedAllocDefault(size_t size, int32_t alignment)
@@ -70,8 +70,10 @@ static inline void* btAlignedAllocDefault(size_t size, int32_t alignment)
real = (char*)sAllocFunc(size + sizeof(void*) + (alignment - 1));
if (real) {
- offset = (alignment - (unsigned long)(real + sizeof(void*))) & (alignment - 1);
- ret = (void*)((real + sizeof(void*)) + offset);
+ // -- GODOT start --
+ // Synced with Bullet 2.88 to fix GH-27926
+ //offset = (alignment - (unsigned long)(real + sizeof(void*))) & (alignment - 1);
+ //ret = (void*)((real + sizeof(void*)) + offset);
+ ret = btAlignPointer(real + sizeof(void *), alignment);
+ // -- GODOT end --
*((void**)(ret)-1) = (void*)(real);
}
else {

View File

@ -1,15 +1,13 @@
diff --git a/thirdparty/vhacd/inc/vhacdMutex.h b/thirdparty/vhacd/inc/vhacdMutex.h
index 6b09259200..d587dd6387 100644
index 6b09259200..22acc2135a 100644
--- a/thirdparty/vhacd/inc/vhacdMutex.h
+++ b/thirdparty/vhacd/inc/vhacdMutex.h
@@ -71,7 +71,9 @@
@@ -71,7 +71,7 @@
#include <pthread.h>
#endif
-#if defined(__APPLE__)
+// -- GODOT start --
+#if defined(__APPLE__) || !defined(__GLIBC__)
+// -- GODOT end --
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#endif

View File

@ -1,16 +1,14 @@
diff --git a/thirdparty/vhacd/inc/btScalar.h b/thirdparty/vhacd/inc/btScalar.h
index 3999a71521..4c9e0cf7ab 100644
index db00a3c428..ef8546a4b5 100644
--- a/thirdparty/vhacd/inc/btScalar.h
+++ b/thirdparty/vhacd/inc/btScalar.h
@@ -72,7 +72,10 @@ inline int32_t btGetVersion()
@@ -68,7 +68,8 @@ inline int32_t btGetVersion()
#define btFsel(a, b, c) __fsel((a), (b), (c))
#else
-#if (defined(_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined(BT_USE_DOUBLE_PRECISION))
+// -- GODOT start --
+//#if (defined(_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined(BT_USE_DOUBLE_PRECISION))
+#if (defined(_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined(BT_USE_DOUBLE_PRECISION)) && (!defined(_M_ARM)) && (!defined(_M_ARM64))
+// -- GODOT end --
#define BT_USE_SSE
#include <emmintrin.h>
#endif

View File

@ -1,38 +1,27 @@
diff --git a/thirdparty/vhacd/inc/vhacdICHull.h b/thirdparty/vhacd/inc/vhacdICHull.h
index 132bdcfb3e..925584cf52 100644
index 132bdcfb3e..4075a9e054 100644
--- a/thirdparty/vhacd/inc/vhacdICHull.h
+++ b/thirdparty/vhacd/inc/vhacdICHull.h
@@ -18,6 +18,10 @@
@@ -18,6 +18,8 @@
#include "vhacdManifoldMesh.h"
#include "vhacdVector.h"
+// -- GODOT start --
+#include <cstdint>
+// -- GODOT end --
+
namespace VHACD {
//! Incremental Convex Hull algorithm (cf. http://cs.smith.edu/~orourke/books/ftp.html ).
enum ICHullError {
diff --git a/thirdparty/vhacd/inc/vhacdManifoldMesh.h b/thirdparty/vhacd/inc/vhacdManifoldMesh.h
index a48f53c5c5..5eed4e13aa 100644
index a48f53c5c5..3f9d039470 100644
--- a/thirdparty/vhacd/inc/vhacdManifoldMesh.h
+++ b/thirdparty/vhacd/inc/vhacdManifoldMesh.h
@@ -18,6 +18,11 @@ All rights reserved.
@@ -18,6 +18,9 @@ All rights reserved.
#include "vhacdCircularList.h"
#include "vhacdSArray.h"
#include "vhacdVector.h"
+
+// -- GODOT start --
+#include <cstdint>
+// -- GODOT end --
+
namespace VHACD {
class TMMTriangle;
class TMMEdge;
@@ -139,4 +144,4 @@ private:
friend class ICHull;
};
}
-#endif // VHACD_MANIFOLD_MESH_H
\ No newline at end of file
+#endif // VHACD_MANIFOLD_MESH_H

View File

@ -15,9 +15,7 @@ subject to the following restrictions:
#include "btAlignedAllocator.h"
// -- GODOT start --
namespace VHACD {
// -- GODOT end --
#ifdef _MSC_VER
#pragma warning(disable:4311 4302)
@ -72,12 +70,10 @@ static inline void* btAlignedAllocDefault(size_t size, int32_t alignment)
real = (char*)sAllocFunc(size + sizeof(void*) + (alignment - 1));
if (real) {
// -- GODOT start --
// Synced with Bullet 2.88 to fix GH-27926
//offset = (alignment - (unsigned long)(real + sizeof(void*))) & (alignment - 1);
//ret = (void*)((real + sizeof(void*)) + offset);
ret = btAlignPointer(real + sizeof(void *), alignment);
// -- GODOT end --
*((void**)(ret)-1) = (void*)(real);
}
else {
@ -185,8 +181,6 @@ void btAlignedFreeInternal(void* ptr)
sAlignedFreeFunc(ptr);
}
// -- GODOT start --
}; // namespace VHACD
// -- GODOT end --
#endif //BT_DEBUG_MEMORY_ALLOCATIONS

View File

@ -49,9 +49,7 @@ typedef unsigned long long int32_t uint64_t;
#include <stdio.h>
#endif
// -- GODOT start --
namespace VHACD {
// -- GODOT end --
// Convex hull implementation based on Preparata and Hong
// Ole Kniemeyer, MAXON Computer GmbH
@ -2482,6 +2480,4 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
return shift;
}
// -- GODOT start --
}; // namespace VHACD
// -- GODOT end --