Skip to content

Commit 651d278

Browse files
committed
Merge pull request #110965 from mihe/jolt/v5.4.0
Jolt: Update to 5.4.0
2 parents 9efb50b + cf75064 commit 651d278

File tree

84 files changed

+1633
-227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1633
-227
lines changed

modules/jolt_physics/objects/jolt_soft_body_3d.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void JoltSoftBody3D::_space_changing() {
7878
if (jolt_body != nullptr) {
7979
jolt_settings = new JPH::SoftBodyCreationSettings(jolt_body->GetSoftBodyCreationSettings());
8080
jolt_settings->mSettings = nullptr;
81+
jolt_settings->mVertexRadius = JoltProjectSettings::soft_body_point_radius;
8182
}
8283

8384
_deref_shared_data();
@@ -146,8 +147,6 @@ bool JoltSoftBody3D::_ref_shared_data() {
146147
LocalVector<int> &mesh_to_physics = iter_shared_data->value.mesh_to_physics;
147148

148149
JPH::SoftBodySharedSettings &settings = *iter_shared_data->value.settings;
149-
settings.mVertexRadius = JoltProjectSettings::soft_body_point_radius;
150-
151150
JPH::Array<JPH::SoftBodySharedSettings::Vertex> &physics_vertices = settings.mVertices;
152151
JPH::Array<JPH::SoftBodySharedSettings::Face> &physics_faces = settings.mFaces;
153152

thirdparty/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ Files generated from upstream source:
492492
## jolt_physics
493493

494494
- Upstream: https://github.com/jrouwe/JoltPhysics
495-
- Version: 5.3.0 (0373ec0dd762e4bc2f6acdb08371ee84fa23c6db, 2025)
495+
- Version: 5.4.0 (036ea7b1d717b3e713ac9d8cbd47118fb9cd5d60, 2025)
496496
- License: MIT
497497

498498
Files extracted from upstream source:

thirdparty/jolt_physics/Jolt/ConfigurationString.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ inline const char *GetConfigurationString()
8383
#ifdef JPH_PROFILE_ENABLED
8484
"(Profile) "
8585
#endif
86+
#ifdef JPH_EXTERNAL_PROFILE
87+
"(External Profile) "
88+
#endif
8689
#if defined(JPH_OBJECT_LAYER_BITS) && JPH_OBJECT_LAYER_BITS == 32
8790
"(32-bit ObjectLayer) "
8891
#else

thirdparty/jolt_physics/Jolt/Core/Array.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ class [[nodiscard]] Array : private Allocator
6969
rev_it & operator -- () { ++mValue; return *this; }
7070
rev_it operator -- (int) { return rev_it(mValue++); }
7171

72-
rev_it operator + (int inValue) { return rev_it(mValue - inValue); }
73-
rev_it operator - (int inValue) { return rev_it(mValue + inValue); }
72+
rev_it operator + (int inValue) const { return rev_it(mValue - inValue); }
73+
rev_it operator - (int inValue) const { return rev_it(mValue + inValue); }
7474

7575
rev_it & operator += (int inValue) { mValue -= inValue; return *this; }
7676
rev_it & operator -= (int inValue) { mValue += inValue; return *this; }

thirdparty/jolt_physics/Jolt/Core/Core.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
// Jolt library version
88
#define JPH_VERSION_MAJOR 5
9-
#define JPH_VERSION_MINOR 3
9+
#define JPH_VERSION_MINOR 4
1010
#define JPH_VERSION_PATCH 0
1111

1212
// Determine which features the library was compiled with
@@ -437,6 +437,11 @@
437437
#define JPH_SUPPRESS_WARNINGS_STD_END \
438438
JPH_SUPPRESS_WARNING_POP
439439

440+
// MSVC STL requires _HAS_EXCEPTIONS=0 if exceptions are turned off
441+
#if defined(JPH_COMPILER_MSVC) && (!defined(__cpp_exceptions) || !__cpp_exceptions) && !defined(_HAS_EXCEPTIONS)
442+
#define _HAS_EXCEPTIONS 0
443+
#endif
444+
440445
// Standard C++ includes
441446
JPH_SUPPRESS_WARNINGS_STD_BEGIN
442447
#include <float.h>
@@ -448,7 +453,7 @@ JPH_SUPPRESS_WARNINGS_STD_BEGIN
448453
#include <functional>
449454
#include <algorithm>
450455
#include <cstdint>
451-
#ifdef JPH_COMPILER_MSVC
456+
#if defined(JPH_COMPILER_MSVC) || (defined(JPH_COMPILER_CLANG) && defined(_MSC_VER)) // MSVC or clang-cl
452457
#include <malloc.h> // for alloca
453458
#endif
454459
#if defined(JPH_USE_SSE)

thirdparty/jolt_physics/Jolt/Core/HashTable.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ class HashTable
364364
using Base = IteratorBase<HashTable, iterator>;
365365

366366
public:
367+
using IteratorBase<HashTable, iterator>::operator ==;
368+
367369
/// Properties
368370
using reference = typename Base::value_type &;
369371
using pointer = typename Base::value_type *;
@@ -401,6 +403,8 @@ class HashTable
401403
using Base = IteratorBase<const HashTable, const_iterator>;
402404

403405
public:
406+
using IteratorBase<const HashTable, const_iterator>::operator ==;
407+
404408
/// Properties
405409
using reference = const typename Base::value_type &;
406410
using pointer = const typename Base::value_type *;

thirdparty/jolt_physics/Jolt/Core/TickCounter.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <x86intrin.h>
1212
#elif defined(JPH_CPU_E2K)
1313
#include <x86intrin.h>
14+
#elif defined(JPH_CPU_LOONGARCH)
15+
#include <larchintrin.h>
1416
#endif
1517

1618
JPH_NAMESPACE_BEGIN
@@ -35,7 +37,16 @@ JPH_INLINE uint64 GetProcessorTickCount()
3537
uint64 val;
3638
asm volatile("mrs %0, cntvct_el0" : "=r" (val));
3739
return val;
38-
#elif defined(JPH_CPU_ARM) || defined(JPH_CPU_RISCV) || defined(JPH_CPU_WASM) || defined(JPH_CPU_PPC) || defined(JPH_CPU_LOONGARCH)
40+
#elif defined(JPH_CPU_LOONGARCH)
41+
#if JPH_CPU_ADDRESS_BITS == 64
42+
__drdtime_t t = __rdtime_d();
43+
return t.dvalue;
44+
#else
45+
__rdtime_t h = __rdtimeh_w();
46+
__rdtime_t l = __rdtimel_w();
47+
return ((uint64)h.value << 32) + l.value;
48+
#endif
49+
#elif defined(JPH_CPU_ARM) || defined(JPH_CPU_RISCV) || defined(JPH_CPU_WASM) || defined(JPH_CPU_PPC)
3950
return 0; // Not supported
4051
#else
4152
#error Undefined

thirdparty/jolt_physics/Jolt/Geometry/EPAPenetrationDepth.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ class EPAPenetrationDepth
103103
template <typename AE, typename BE>
104104
EStatus GetPenetrationDepthStepGJK(const AE &inAExcludingConvexRadius, float inConvexRadiusA, const BE &inBExcludingConvexRadius, float inConvexRadiusB, float inTolerance, Vec3 &ioV, Vec3 &outPointA, Vec3 &outPointB)
105105
{
106-
JPH_PROFILE_FUNCTION();
107-
108106
JPH_IF_ENABLE_ASSERTS(mGJKTolerance = inTolerance;)
109107

110108
// Don't supply a zero ioV, we only want to get points on the hull of the Minkowsky sum and not internal points.

thirdparty/jolt_physics/Jolt/Geometry/GJKClosestPoint.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ class GJKClosestPoint : public NonCopyable
551551
#ifdef JPH_GJK_DEBUG
552552
Trace("v . r = %g", (double)v_dot_r);
553553
#endif
554-
if (v_dot_r >= 0.0f)
554+
if (v_dot_r >= -1.0e-18f) // Instead of checking >= 0, check with epsilon as we don't want the division below to overflow to infinity as it can cause a float exception
555555
return false;
556556

557557
// Update the lower bound for lambda
@@ -744,7 +744,7 @@ class GJKClosestPoint : public NonCopyable
744744
#ifdef JPH_GJK_DEBUG
745745
Trace("v . r = %g", (double)v_dot_r);
746746
#endif
747-
if (v_dot_r >= 0.0f)
747+
if (v_dot_r >= -1.0e-18f) // Instead of checking >= 0, check with epsilon as we don't want the division below to overflow to infinity as it can cause a float exception
748748
return false;
749749

750750
// Update the lower bound for lambda

thirdparty/jolt_physics/Jolt/Geometry/Plane.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class [[nodiscard]] Plane
3232
float GetConstant() const { return mNormalAndConstant.GetW(); }
3333
void SetConstant(float inConstant) { mNormalAndConstant.SetW(inConstant); }
3434

35+
/// Store as 4 floats
36+
void StoreFloat4(Float4 *outV) const { mNormalAndConstant.StoreFloat4(outV); }
37+
3538
/// Offset the plane (positive value means move it in the direction of the plane normal)
3639
Plane Offset(float inDistance) const { return Plane(mNormalAndConstant - Vec4(Vec3::sZero(), inDistance)); }
3740

0 commit comments

Comments
 (0)