Skip to content

Commit

Permalink
Update PhysX to 82786122
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoub-belarbi committed Jul 23, 2024
1 parent f07ba77 commit 44667a2
Show file tree
Hide file tree
Showing 29 changed files with 328 additions and 54 deletions.
1 change: 0 additions & 1 deletion physx/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
bin/
compiler/linux-*
compiler/vc*
include/PxConfig.h
38 changes: 37 additions & 1 deletion physx/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,47 @@
# v5.4.1-106.0

## General

### Added

* Debug visualization of contact friction was added, controlled by the following visualization parameter flags: PxVisualizationParameter::eFRICTION_POINT, PxVisualizationParameter::eFRICTION_NORMAL, and PxVisualizationParameter::eFRICTION_IMPULSE.
* PxVisualizationParameter::eCONTACT_IMPULSE flag was added to replace PxVisualizationParameter::eCONTACT_FORCE.

### Deprecated

* PxVisualizationParameter::eCONTACT_FORCE was deprecated. Use PxVisualizationParameter::eCONTACT_IMPULSE instead.

### Fixed

* A bug in Debug Visualization where collision contact points are misaligned with collision geometry.
* A bug in the GPU broadphase that resulted in a crash when overflowing the preallocated number of lost and found pairs.

## Articulations

### Added

* Possibility to apply a force or a torque to an articulation link through articulation cache with the flags PxArticulationCacheFlag::eLINK_FORCE and PxArticulationCacheFlag::eLINK_TORQUE.

### Fixed

* Runtime changes to PxArticulationJointReducedCoordinate::setMaxJointVelocity() were not working for the GPU pipeline.
* Runtime changes to PxArticulationJointReducedCoordinate::setFrictionCoefficient() were not working for the GPU pipeline.
* A bug when adding articulations to a scene that already contained other articulations.
* Corrected the calculation of the first tangent vector used in the friction patch model of articulations. This may have increased the probability of artifacts in the friction calculation.

## PVD

### Fixed

* Missing OVD object creation calls in deserializations of PxCollection and PxAggregate with regards to articulations.

# v5.4.0-106.0

## Supported Platforms

### Runtime

* Linux (tested on Ubuntu 20.04 and 22.04)
* Linux glibc version 2.31 or higher
* Microsoft Windows 10 or later (64 bit)
* GPU acceleration: display driver supporting CUDA toolkit 11.8 and Pascal GPU or above

Expand Down
6 changes: 3 additions & 3 deletions physx/dependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
</dependency>

<dependency name="PhysXGpu">
<package name="PhysXGpu" version="912d9405-windows-public" platforms="vc15win64 vc16win64 vc17win64"/>
<package name="PhysXGpu" version="912d9405-linux-x86_64-public" platforms="linux"/>
<package name="PhysXGpu" version="912d9405-linux-aarch64-public" platforms="linux-aarch64"/>
<package name="PhysXGpu" version="5.4.1.86cd1749-release-106.0-windows-public" platforms="vc15win64 vc16win64 vc17win64"/>
<package name="PhysXGpu" version="5.4.1.86cd1749-release-106.0-linux-x86_64-public" platforms="linux"/>
<package name="PhysXGpu" version="5.4.1.86cd1749-release-106.0-linux-aarch64-public" platforms="linux-aarch64"/>
</dependency>

<dependency name="opengllinux" tags="requiredForDistro">
Expand Down
2 changes: 1 addition & 1 deletion physx/documentation/platformreadme/linux/README_LINUX.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Compilers and C++ Standard:
* Ubuntu 22.04 LTS with gcc 11 or clang 14
* Note: PhysX may fail to compile with clang versions higher than 14 as they have not been tested
* For linux aarch64 builds we support gcc version 9
* C++17 compatible
* Tested with C++11 standard


## Generating Makefiles:
Expand Down
4 changes: 2 additions & 2 deletions physx/documentation/platformreadme/windows/README_WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

## Required packages to generate projects:

* Microsoft Windows 10 (or later) + headers for at least Win7 (`_WIN32_WINNT = 0x0601`)
* Microsoft Windows 10 (or later)
* CMake, minimum version 3.21
* Python, minimum version 3.5

Compilers and C++ Standard:
* Microsoft Visual Studio 2017, 2019, 2022 (64 bit)
* C++17 compatible
* Tested with C++14 standard

## PhysX GPU Acceleration:

Expand Down
8 changes: 8 additions & 0 deletions physx/generate_projects.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@ for /f "usebackq tokens=*" %%i in (`"%PM_vswhere_PATH%\VsWhere.exe -version [15
for /f "usebackq tokens=*" %%i in (`"%PM_vswhere_PATH%\VsWhere.exe -version [16.0,17.0) -latest -property installationPath"`) do (
set Install2019Dir=%%i
set VS160PATH="%%i"
@REM Setting VS160COMNTOOLS: This is mainly needed for building for Switch
@REM Reason: When both MS build tools and Visual Studio are installed together in the same system
@REM Cmake will use msbuild to generate the project instead of Visual Studio. Which make Cmake fail
@REM When generating the project for Switch. However, if an environment variable of the form VS##0COMNTOOLS,
@REM where ## the Visual Studio major version number, is set and points to the Common7/Tools directory within
@REM one of the VS instances, that instance will be used. see: https://cmake.org/cmake/help/latest/variable/CMAKE_GENERATOR_INSTANCE.html
set "VS160COMNTOOLS=%%i\Common7\Tools\"
)

for /f "usebackq tokens=*" %%i in (`"%PM_vswhere_PATH%\VsWhere.exe -version [17.0,18.0) -latest -property installationPath"`) do (
set Install2022Dir=%%i
set VS170PATH="%%i"
set "VS170COMNTOOLS=%%i\Common7\Tools\"
)

if exist "%Install2017Dir%\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" (
Expand Down
8 changes: 5 additions & 3 deletions physx/include/PxArticulationFlag.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ namespace physx
eFORCE = (1 << 3), //!< The joint forces, see PxArticulationCache::jointForce.
eLINK_VELOCITY = (1 << 4), //!< The link velocities, see PxArticulationCache::linkVelocity. Link velocities cannot be set except for the root link velocity via PxArticulationCache::rootLinkData.
eLINK_ACCELERATION = (1 << 5), //!< The link accelerations, see PxArticulationCache::linkAcceleration.
eROOT_TRANSFORM = (1 << 6), //!< Root link transform, see PxArticulationCache::rootLinkData.
eROOT_VELOCITIES = (1 << 7), //!< Root link velocities (read/write) and accelerations (read), see PxArticulationCache::rootLinkData.
eLINK_INCOMING_JOINT_FORCE = (1 << 10), //!< Link incoming joint forces, see PxArticulationCache::linkIncomingJointForce.
eROOT_TRANSFORM = (1 << 6), //!< The root link transform, see PxArticulationCache::rootLinkData.
eROOT_VELOCITIES = (1 << 7), //!< The root link velocities (read/write) and accelerations (read), see PxArticulationCache::rootLinkData.
eLINK_INCOMING_JOINT_FORCE = (1 << 10), //!< The link incoming joint forces, see PxArticulationCache::linkIncomingJointForce.
eJOINT_TARGET_POSITIONS = (1 << 11), //!< The joint target positions, see PxArticulationCache::jointTargetPositions.
eJOINT_TARGET_VELOCITIES = (1 << 12), //!< The joint target velocities, see PxArticulationCache::jointTargetVelocities.
eLINK_FORCE = (1 << 13), //!< The link forces, see PxArticulationCache::linkForce.
eLINK_TORQUE = (1 << 14), //!< The link torques, see PxArticulationCache::linkTorque.
eALL = (eVELOCITY | eACCELERATION | ePOSITION | eLINK_VELOCITY | eLINK_ACCELERATION | eROOT_TRANSFORM | eROOT_VELOCITIES)
};
};
Expand Down
24 changes: 23 additions & 1 deletion physx/include/PxArticulationReducedCoordinate.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ namespace physx
linkVelocity (NULL),
linkAcceleration (NULL),
linkIncomingJointForce (NULL),
linkForce (NULL),
linkTorque (NULL),
rootLinkData (NULL),
coefficientMatrix (NULL),
lambda (NULL),
Expand Down Expand Up @@ -261,7 +263,27 @@ namespace physx
\note The root link reports a zero spatial force.
*/
PxSpatialForce* linkIncomingJointForce;


/**
\brief Link force, i.e. an external force applied to the link's center of mass.
- N = getNbLinks().
- Write using PxArticulationCacheFlag::eLINK_FORCE.
- The indexing follows the internal link indexing, see PxArticulationLink::getLinkIndex.
- The force is given in world space.
*/
PxVec3* linkForce;

/**
\brief Link torque, i.e. an external torque applied to the link.
- N = getNbLinks().
- Write using PxArticulationCacheFlag::eLINK_TORQUE.
- The indexing follows the internal link indexing, see PxArticulationLink::getLinkIndex.
- The torque is given in world space.
*/
PxVec3* linkTorque;

/**
\brief Root link transform, velocities, and accelerations.
Expand Down
10 changes: 10 additions & 0 deletions physx/include/PxContact.h
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,16 @@ class PxFrictionAnchorStreamIterator
return mFrictionPatches[mPatchIndex].anchorImpulses[mFrictionAnchorIndex];
}

/**
\brief Get the friction anchor's normal.
\return The friction anchor's normal.
*/
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& getNormal() const
{
PX_ASSERT(patchIsValid());
return mContactPatches[mPatchIndex].normal;
}

/**
\brief Get current patch's static friction coefficient.
\return The patch's static friction coefficient.
Expand Down
7 changes: 1 addition & 6 deletions physx/include/PxSimulationEventCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,6 @@ PX_INLINE PxU32 PxContactPair::extractFrictionAnchors(PxContactPairFrictionAncho
{
PxFrictionAnchorStreamIterator iter(contactPatches, frictionPatches, patchCount);

const PxU32 hasImpulses = (flags & PxContactPairFlag::eINTERNAL_HAS_IMPULSES);

while(iter.hasNextPatch())
{
iter.nextPatch();
Expand All @@ -719,10 +717,7 @@ PX_INLINE PxU32 PxContactPair::extractFrictionAnchors(PxContactPairFrictionAncho
PxContactPairFrictionAnchor& dst = userBuffer[nbAnchors];

dst.position = iter.getPosition();

dst.impulse = hasImpulses
? iter.getImpulse()
: PxVec3(0.0f);
dst.impulse = iter.getImpulse();

++nbAnchors;
if(nbAnchors == bufferSize)
Expand Down
23 changes: 22 additions & 1 deletion physx/include/PxVisualizationParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,31 @@ struct PxVisualizationParameter
*/
eCONTACT_ERROR,

/**
\brief Visualize Contact impulses. Will enable contact information.
*/
eCONTACT_IMPULSE,

/**
\brief Visualize Contact forces. Will enable contact information.
\deprecated Use eCONTACT_IMPULSE instead.
*/
eCONTACT_FORCE PX_DEPRECATED = eCONTACT_IMPULSE,

/**
\brief Visualize friction points. Will enable contact information.
*/
eFRICTION_POINT,

/**
\brief Visualize friction normals. Will enable contact information.
*/
eFRICTION_NORMAL,

/**
\brief Visualize friction impulses. Will enable contact information.
*/
eCONTACT_FORCE,
eFRICTION_IMPULSE,

/**
\brief Visualize actor axes.
Expand Down
2 changes: 1 addition & 1 deletion physx/include/extensions/PxSerialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
PX_BINARY_SERIAL_VERSION is used to version the PhysX binary data and meta data. The global unique identifier of the PhysX SDK needs to match
the one in the data and meta data, otherwise they are considered incompatible. A 32 character wide GUID can be generated with https://www.guidgenerator.com/ for example.
*/
#define PX_BINARY_SERIAL_VERSION "EEDFDB718C504480BB77F9B8DA353B60"
#define PX_BINARY_SERIAL_VERSION "B57177A5EF424885A73E41854E472FC4"


#if !PX_DOXYGEN
Expand Down
2 changes: 1 addition & 1 deletion physx/include/foundation/PxPhysicsVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ sometimes they are stored in a byte.

#define PX_PHYSICS_VERSION_MAJOR 5
#define PX_PHYSICS_VERSION_MINOR 4
#define PX_PHYSICS_VERSION_BUGFIX 0
#define PX_PHYSICS_VERSION_BUGFIX 1

/**
The constant PX_PHYSICS_VERSION is used when creating certain PhysX module objects.
Expand Down
2 changes: 1 addition & 1 deletion physx/include/foundation/PxVecQuat.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ PX_FORCE_INLINE bool isFiniteQuatV(const QuatV q)
return isFiniteVec4V(q);
}

#if PX_LINUX && PX_CLANG
#if (PX_LINUX || PX_SWITCH) && PX_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical" // bitwise intentionally chosen for performance
#endif
Expand Down
4 changes: 2 additions & 2 deletions physx/snippets/compiler/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ IF(NOT PUBLIC_RELEASE AND NOT PX_GENERATE_SOURCE_DISTRO)
ENDIF()

#TODO, create a propper define for whether GPU features are enabled or not!
IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (NOT CMAKE_CROSSCOMPILING))
LIST(APPEND SNIPPETS_LIST ${GPU_SNIPPET_LIST})
IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (NOT CMAKE_CROSSCOMPILING OR NOT (CMAKE_GENERATOR_PLATFORM STREQUAL "NX64")))
LIST(APPEND SNIPPETS_LIST ${GPU_SNIPPET_LIST})
ENDIF()

SET(SNIPPETS_VEHICLE2_LIST Vehicle2DirectDrive Vehicle2FourWheelDrive Vehicle2TankDrive Vehicle2CustomSuspension Vehicle2Multithreading Vehicle2Truck Vehicle2CustomTire)
Expand Down
2 changes: 1 addition & 1 deletion physx/source/compiler/cmake/PhysXExtensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ SET(PHYSX_EXTENSIONS_SOURCE
)

#TODO, create a propper define for whether GPU features are enabled or not!
IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (NOT CMAKE_CROSSCOMPILING))
IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (NOT CMAKE_CROSSCOMPILING OR NOT (CMAKE_GENERATOR_PLATFORM STREQUAL "NX64")))
LIST(APPEND PHYSX_EXTENSIONS_SOURCE "${LL_SOURCE_DIR}/ExtParticleExt.cpp")
LIST(APPEND PHYSX_EXTENSIONS_SOURCE "${LL_SOURCE_DIR}/ExtParticleClothCooker.cpp")

Expand Down
12 changes: 12 additions & 0 deletions physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,8 @@ namespace Dy
+ sizeof(PxSpatialVelocity) * linkCount * 2 // link velocity, (PxArticulationCacheFlag::eLINK_VELOCITY)
// link acceleration (PxArticulationCacheFlag::eLINK_ACCELERATION)
+ sizeof(PxSpatialForce) * linkCount // link incoming joint forces (PxArticulationCacheFlag::eLINK_INCOMING_JOINT_FORCE)
+ sizeof(PxVec3) * linkCount * 2 // link force (PxArticulationCacheFlag::eLINK_FORCE)
// link torque (PxArticulationCacheFlag::eLINK_TORQUE)
+ sizeof(PxArticulationRootLinkData); // root link data (PxArticulationCacheFlag::eROOT_TRANSFORM, PxArticulationCacheFlag::eROOT_VELOCITIES)

return totalSize;
Expand Down Expand Up @@ -665,6 +667,15 @@ namespace Dy
cache->linkIncomingJointForce = reinterpret_cast<PxSpatialForce*>(tCache + offset);
offset += sizeof(PxSpatialForce) * linkCount;

// PxArticulationCacheFlag::eLINK_FORCE
PX_ASSERT((offset & 15) == 0);
cache->linkForce = reinterpret_cast<PxVec3*>(tCache + offset);
offset += sizeof(PxVec3) * linkCount;

// PxArticulationCacheFlag::eLINK_TORQUE
cache->linkTorque = reinterpret_cast<PxVec3*>(tCache + offset);
offset += sizeof(PxVec3) * linkCount;

cache->denseJacobian = reinterpret_cast<PxReal*>(tCache + offset);
offset += sizeof(PxReal) * (6 + totalDofs) * (linkCount * 6); //size of dense jacobian assuming free floating base link.

Expand Down Expand Up @@ -705,6 +716,7 @@ namespace Dy
PxU32 scratchMemorySize =
sizeof(Cm::SpatialVectorF) * linkCount * 5 //motionVelocity, motionAccelerations, coriolisVectors, spatialZAVectors, externalAccels;
+ sizeof(Dy::SpatialMatrix) * linkCount //compositeSpatialInertias;
+ sizeof(PxVec3) * linkCount * 2 //linkForce, linkTorque
+ sizeof(PxReal) * totalDofs * 7; //jointVelocity, jointAcceleration, jointForces, jointPositions, jointFrictionForces, jointTargetPositions, jointTargetVelocities

scratchMemorySize = (scratchMemorySize+15)&~15;
Expand Down
38 changes: 38 additions & 0 deletions physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,44 @@ namespace Dy
mGPUDirtyFlags |= ArticulationDirtyFlag::eDIRTY_JOINT_TARGET_VEL;
}

if (flag & PxArticulationCacheFlag::eLINK_FORCE)
{
const PxU32 linkCount = data.getLinkCount();
for (PxU32 i = 0; i < linkCount; ++i)
{
const PxVec3 linkForce = cache.linkForce[i];
localShouldWake = localShouldWake || linkForce != PxVec3(0.0f);
ArticulationLink& link = mArticulationData.getLink(i);

PxsBodyCore& core = *link.bodyCore;
data.mExternalAcceleration[i].linear = linkForce * core.inverseMass;
}
mGPUDirtyFlags |= ArticulationDirtyFlag::eDIRTY_EXT_ACCEL;
}

if (flag & PxArticulationCacheFlag::eLINK_TORQUE)
{
const PxU32 linkCount = data.getLinkCount();
for (PxU32 i = 0; i < linkCount; ++i)
{
ArticulationLink& link = mArticulationData.getLink(i);
PxsBodyCore& core = *link.bodyCore;

const PxQuat& q = core.body2World.q;
const PxVec3& linkTorque = cache.linkTorque[i];
const PxVec3 localLinkTorque = q.rotateInv(linkTorque);
localShouldWake = localShouldWake || localLinkTorque != PxVec3(0.0f);

// turn localLinkTorque into acceleration in local frame
const PxVec3 localAccel = core.inverseInertia.multiply(localLinkTorque);
// turn localAccel into world space
const PxVec3 worldAccel = q.rotate(localAccel);

data.mExternalAcceleration[i].angular = worldAccel;
}
mGPUDirtyFlags |= ArticulationDirtyFlag::eDIRTY_EXT_ACCEL;
}

// the updateKinematic functions rely on updated joint frames.
if (mJcalcDirty)
{
Expand Down
Loading

0 comments on commit 44667a2

Please sign in to comment.