aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/SimulationController/src
diff options
context:
space:
mode:
authorsschirm <[email protected]>2016-12-23 14:20:36 +0100
committersschirm <[email protected]>2016-12-23 14:56:17 +0100
commitef6937e69e8ee3f409cf9d460d5ad300a65d5924 (patch)
tree710426e8daa605551ce3f34b581897011101c30f /PhysX_3.4/Source/SimulationController/src
parentInitial commit: (diff)
downloadphysx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.tar.xz
physx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.zip
PhysX 3.4 / APEX 1.4 release candidate @21506124
Diffstat (limited to 'PhysX_3.4/Source/SimulationController/src')
-rw-r--r--PhysX_3.4/Source/SimulationController/src/ScContactStream.h15
-rw-r--r--PhysX_3.4/Source/SimulationController/src/ScScene.cpp173
-rw-r--r--PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp3
-rw-r--r--PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp2
-rw-r--r--PhysX_3.4/Source/SimulationController/src/ScShapeSim.h2
-rw-r--r--PhysX_3.4/Source/SimulationController/src/ScSqBoundsManager.cpp49
-rw-r--r--PhysX_3.4/Source/SimulationController/src/ScSqBoundsManager.h26
7 files changed, 52 insertions, 218 deletions
diff --git a/PhysX_3.4/Source/SimulationController/src/ScContactStream.h b/PhysX_3.4/Source/SimulationController/src/ScContactStream.h
index 163f119c..db6cf648 100644
--- a/PhysX_3.4/Source/SimulationController/src/ScContactStream.h
+++ b/PhysX_3.4/Source/SimulationController/src/ScContactStream.h
@@ -317,21 +317,12 @@ PX_FORCE_INLINE void Sc::ContactStreamManager::fillInContactReportExtraData(PxCo
PX_FORCE_INLINE void Sc::ContactStreamManager::fillInContactReportExtraData(PxContactPairPose* cpPose, PxU32 index, const RigidSim& rs, bool isCCDPass, const bool useCurrentTransform)
{
- if (rs.getActorType() != PxActorType::eRIGID_STATIC)
+ if(rs.getActorType() != PxActorType::eRIGID_STATIC)
{
const BodySim& bs = static_cast<const BodySim&>(rs);
const BodyCore& bc = bs.getBodyCore();
-
- if (!isCCDPass)
- {
- if (useCurrentTransform)
- cpPose->globalPose[index] = bc.getBody2World() * bc.getBody2Actor().getInverse();
- else
- cpPose->globalPose[index] = bs.getLowLevelBody().getLastCCDTransform() * bc.getBody2Actor().getInverse();
- }
- else
- cpPose->globalPose[index] = bs.getLowLevelBody().getLastCCDTransform() * bc.getBody2Actor().getInverse();
-
+ const PxTransform& src = (!isCCDPass && useCurrentTransform) ? bc.getBody2World() : bs.getLowLevelBody().getLastCCDTransform();
+ cpPose->globalPose[index] = src * bc.getBody2Actor().getInverse();
}
else
{
diff --git a/PhysX_3.4/Source/SimulationController/src/ScScene.cpp b/PhysX_3.4/Source/SimulationController/src/ScScene.cpp
index afa02401..28945a12 100644
--- a/PhysX_3.4/Source/SimulationController/src/ScScene.cpp
+++ b/PhysX_3.4/Source/SimulationController/src/ScScene.cpp
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#define NOMINMAX
#include "foundation/PxProfiler.h"
@@ -120,8 +119,7 @@ PX_PHYSX_GPU_API Bp::BPMemoryAllocator* createGpuMemoryAllocator();
#endif
extern bool gUnifiedHeightfieldCollision;
-
-
+
namespace Sc {
class LLArticulationPool: public Ps::Pool<Articulation, Ps::AlignedAllocator<DY_ARTICULATION_MAX_SIZE> >
@@ -130,7 +128,6 @@ public:
LLArticulationPool() {}
};
-
static const char* sFilterShaderDataMemAllocId = "SceneDesc filterShaderData";
}}
@@ -287,10 +284,8 @@ private:
ScAfterIntegrationTask& operator = (const ScAfterIntegrationTask&);
};
-
class ScSimulationControllerCallback : public PxsSimulationControllerCallback
{
-
Sc::Scene* mScene;
public:
@@ -359,7 +354,6 @@ public:
task->setContinuation(continuation);
task->removeReference();
}
-
}
}
@@ -367,7 +361,6 @@ public:
{
return mScene->getCcdBodies().size();
}
-
};
class PxgUpdateBodyAndShapeStatusTask : public Cm::Task
@@ -383,7 +376,6 @@ private:
PxU32* mDeactivatedBodies;
PxI32& mCCDBodyWriteIndex;
-
public:
PxgUpdateBodyAndShapeStatusTask(const IG::NodeIndex* const indices, PxU32 numBodies, PxsBodySim* bodySimsLL, PxU32* activatedBodies, PxU32* deactivatedBodies,
@@ -469,7 +461,6 @@ public:
virtual void updateScBodyAndShapeSim(PxBaseTask* continuation)
{
-
IG::SimpleIslandManager* islandManager = mScene->getSimpleIslandManager();
PxsSimulationController* simulationController = mScene->getSimulationController();
PxsContext* contextLL = mScene->getLowLevelContext();
@@ -499,8 +490,6 @@ public:
task->removeReference();
}
-
-
PxU32* unfrozenShapeIndices = simulationController->getUnfrozenShapes();
PxU32* frozenShapeIndices = simulationController->getFrozenShapes();
const PxU32 nbFrozenShapes = simulationController->getNbFrozenShapes();
@@ -525,18 +514,14 @@ public:
Sc::ShapeSim* shape = reinterpret_cast<Sc::ShapeSim*>(reinterpret_cast<PxU8*>(shapeLL) - shapeOffset);
shape->createSqBounds();
}
-
-
}
virtual PxU32 getNbCcdBodies()
{
return PxU32(mCcdBodyWriteIndex);
}
-
};
-
Sc::Scene::Scene(const PxSceneDesc& desc, PxU64 contextID) :
mContextId (contextID),
mActiveBodies (PX_DEBUG_EXP("sceneActiveBodies")),
@@ -577,7 +562,6 @@ Sc::Scene::Scene(const PxSceneDesc& desc, PxU64 contextID) :
mBatchRemoveState (NULL),
mLostTouchPairs (PX_DEBUG_EXP("sceneLostTouchPairs")),
mOutOfBoundsIDs (PX_DEBUG_EXP("sceneOutOfBoundsIds")),
- mErrorState (0),
mVisualizationScale (0.0f),
mVisualizationParameterChanged (false),
mNbRigidStatics (0),
@@ -909,11 +893,6 @@ Sc::Scene::Scene(const PxSceneDesc& desc, PxU64 contextID) :
mFilterShader = desc.filterShader;
mFilterCallback = desc.filterCallback;
-#if EXTRA_PROFILING
- mExtraProfileFile = fopen("extraProfile.txt", "w");
- mLineNum = 0;
-#endif
-
#if PX_USE_CLOTH_API
createClothSolver();
#endif // PX_USE_CLOTH_API
@@ -927,7 +906,6 @@ Sc::Scene::Scene(const PxSceneDesc& desc, PxU64 contextID) :
void Sc::Scene::release()
{
-
#if PX_USE_PARTICLE_SYSTEM_API
if (mParticleContext)
{
@@ -965,10 +943,6 @@ void Sc::Scene::release()
delete &core;
}
-#if EXTRA_PROFILING
- fclose(mExtraProfileFile);
-#endif
-
// Free object IDs and the deleted object id map
postReportsCleanup();
@@ -992,7 +966,6 @@ void Sc::Scene::release()
PX_DELETE_AND_RESET(mSqBoundsManager);
PX_DELETE_AND_RESET(mBoundsArray);
-
for(PxU32 i=0;i<mClients.size(); i++)
PX_DELETE_AND_RESET(mClients[i]);
@@ -1035,17 +1008,12 @@ void Sc::Scene::release()
mDynamicsContext->destroy();
-
mCCDContext->destroy();
-
-
mSimpleIslandManager->~SimpleIslandManager();
PX_FREE(mSimpleIslandManager);
#if PX_SUPPORT_GPU_PHYSX
-
-
if (mGpuWranglerManagers)
{
mGpuWranglerManagers->~PxsKernelWranglerManager();
@@ -1080,7 +1048,6 @@ void Sc::Scene::release()
PX_FREE(mMemoryManager);
mMemoryManager = NULL;
}
-
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1460,7 +1427,6 @@ void Sc::Scene::prepareCollide()
PxcClearContactCacheStats();
}
-
void Sc::Scene::simulate(PxReal timeStep, PxBaseTask* continuation)
{
@@ -1554,7 +1520,6 @@ void Sc::Scene::endSimulation()
PxcDisplayContactCacheStats();
}
-
void Sc::Scene::flush(bool sendPendingReports)
{
if (sendPendingReports)
@@ -1606,7 +1571,6 @@ void Sc::Scene::flush(bool sendPendingReports)
mLLContext->getNpMemBlockPool().releaseUnusedBlocks();
}
-
// User callbacks
void Sc::Scene::setSimulationEventCallback(PxSimulationEventCallback* callback, PxClientID client)
@@ -1660,7 +1624,6 @@ PxU32 Sc::Scene::getCCDMaxPasses() const
return mCCDContext->getCCDMaxPasses();
}
-
void Sc::Scene::setBroadPhaseCallback(PxBroadPhaseCallback* callback, PxClientID client)
{
PX_ASSERT(client < mClients.size());
@@ -1701,7 +1664,6 @@ void Sc::Scene::removeBody(BodySim& body) //this also notifies any connected joi
markReleasedBodyIDForLostTouch(body.getID());
}
-
void Sc::Scene::addConstraint(ConstraintCore& constraint, RigidCore* body0, RigidCore* body1)
{
ConstraintSim* sim = mConstraintSimPool->construct(constraint, body0, body1, *this);
@@ -1710,7 +1672,6 @@ void Sc::Scene::addConstraint(ConstraintCore& constraint, RigidCore* body0, Rigi
mConstraints.insert(&constraint);
}
-
void Sc::Scene::removeConstraint(ConstraintCore& constraint)
{
ConstraintSim* cSim = constraint.getSim();
@@ -1728,7 +1689,6 @@ void Sc::Scene::removeConstraint(ConstraintCore& constraint)
mConstraints.erase(&constraint);
}
-
void Sc::Scene::addArticulation(ArticulationCore& articulation, BodyCore& root)
{
ArticulationSim* sim = PX_NEW(ArticulationSim)(articulation, *this, root);
@@ -1741,7 +1701,6 @@ void Sc::Scene::addArticulation(ArticulationCore& articulation, BodyCore& root)
mArticulations.insert(&articulation);
}
-
void Sc::Scene::removeArticulation(ArticulationCore& articulation)
{
ArticulationSim* a = articulation.getSim();
@@ -1750,21 +1709,18 @@ void Sc::Scene::removeArticulation(ArticulationCore& articulation)
mArticulations.erase(&articulation);
}
-
void Sc::Scene::addArticulationJoint(ArticulationJointCore& joint, BodyCore& parent, BodyCore& child)
{
ArticulationJointSim* sim = PX_NEW(ArticulationJointSim)(joint, *parent.getSim(), *child.getSim());
PX_UNUSED(sim);
}
-
void Sc::Scene::removeArticulationJoint(ArticulationJointCore& joint)
{
if (joint.getSim())
PX_DELETE(joint.getSim());
}
-
void Sc::Scene::addBrokenConstraint(Sc::ConstraintCore* c)
{
PX_ASSERT(mBrokenConstraints.find(c) == mBrokenConstraints.end());
@@ -2038,7 +1994,6 @@ void Sc::Scene::advanceStep(PxBaseTask* continuation)
}
}
-
//void Sc::Scene::advanceStep(PxBaseTask* continuation)
//{
// PX_PROFILE_ZONE("Sim.solveQueueTasks", getContextId());
@@ -2119,7 +2074,6 @@ void Sc::Scene::collideStep(PxBaseTask* continuation)
mPreRigidBodyNarrowPhase.removeReference();
}
-
void Sc::Scene::clothPreprocessing(PxBaseTask* /*continuation*/)
{
#if PX_USE_CLOTH_API
@@ -2226,7 +2180,6 @@ public:
virtual const char* getName() const { return "DirtyShapeUpdatesTask"; }
-
private:
PX_NOCOPY(DirtyShapeUpdatesTask)
};
@@ -2356,11 +2309,13 @@ void Sc::Scene::preRigidBodyNarrowPhase(PxBaseTask* continuation)
DirtyShapeUpdatesTask* task = PX_PLACEMENT_NEW(pool.allocate(sizeof(DirtyShapeUpdatesTask)), DirtyShapeUpdatesTask)(cache, boundsArray);
+ bool hasDirtyShapes = false;
while ((index = dirtyShapeIter.getNext()) != Cm::BitMap::Iterator::DONE)
{
Sc::ShapeSim* shapeSim = reinterpret_cast<Sc::ShapeSim*>(mAABBManager->getUserData(index));
if (shapeSim)
{
+ hasDirtyShapes = true;
changedMap.growAndSet(index);
task->mShapes[task->mNbShapes++] = shapeSim;
if (task->mNbShapes == DirtyShapeUpdatesTask::MaxShapes)
@@ -2372,6 +2327,14 @@ void Sc::Scene::preRigidBodyNarrowPhase(PxBaseTask* continuation)
}
}
+ if (hasDirtyShapes)
+ {
+ //Setting the boundsArray and transform cache as dirty so that they get DMAd to GPU if GPU dynamics and BP are being used respectively.
+ //These bits are no longer set when we update the cached state for actors due to an optimization avoiding setting these dirty bits multiple times.
+ getBoundsArray().setChangedState();
+ getLowLevelContext()->getTransformCache().setChangedState();
+ }
+
if (task->mNbShapes != 0)
{
task->setContinuation(continuation);
@@ -2517,9 +2480,8 @@ void Sc::Scene::processNarrowPhaseTouchEvents()
}
}
-
- getLowLevelContext()->getSimStats().mNbNewTouches = newTouchCount;
- getLowLevelContext()->getSimStats().mNbLostTouches = lostTouchCount;
+ context->getSimStats().mNbNewTouches = newTouchCount;
+ context->getSimStats().mNbLostTouches = lostTouchCount;
}
}
@@ -2673,8 +2635,6 @@ void Sc::Scene::processNarrowPhaseLostTouchEvents(PxBaseTask*)
addToLostTouchList(si->getShape0().getBodySim(), si->getShape1().getBodySim());
}
}
-
-
}
void Sc::Scene::processLostSolverPatches(PxBaseTask* /*continuation*/)
@@ -2683,7 +2643,6 @@ void Sc::Scene::processLostSolverPatches(PxBaseTask* /*continuation*/)
mDynamicsContext->processLostPatches(*mSimpleIslandManager, mLostPatchManagers.begin(), mLostPatchManagers.size(), outputs);
}
-
void Sc::Scene::islandGen(PxBaseTask* continuation)
{
PX_PROFILE_START_CROSSTHREAD("Basic.rigidBodySolver", getContextId());
@@ -2704,7 +2663,6 @@ void Sc::Scene::islandGen(PxBaseTask* continuation)
PX_FORCE_INLINE void Sc::Scene::putObjectsToSleep(PxU32 infoFlag)
{
-
const IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim();
//Set to sleep all bodies that were in awake islands that have just been put to sleep.
@@ -2730,9 +2688,6 @@ PX_FORCE_INLINE void Sc::Scene::putObjectsToSleep(PxU32 infoFlag)
if (articSim && !islandSim.getNode(articIndices[i]).isActive())
articSim->setActive(false, infoFlag);
}
-
-
-
}
PX_FORCE_INLINE void Sc::Scene::putInteractionsToSleep(PxU32 infoFlag)
@@ -2945,7 +2900,6 @@ void Sc::Scene::unregisterInteractions(PxBaseTask*)
void Sc::Scene::destroyManagers(PxBaseTask*)
{
{
-
PX_PROFILE_ZONE("Sim.destroyManagers", getContextId());
mPostThirdPassIslandGenTask.setContinuation(mProcessLostContactsTask3.getContinuation());
@@ -2982,8 +2936,6 @@ void Sc::Scene::processLostContacts2(PxBaseTask* continuation)
mUnregisterInteractionsTask.setContinuation(continuation);
mUnregisterInteractionsTask.removeReference();
-
-
{
PX_PROFILE_ZONE("Sim.clearIslandData", getContextId());
// PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs();
@@ -3053,8 +3005,6 @@ void Sc::Scene::processLostContacts3(PxBaseTask* /*continuation*/)
mPostThirdPassIslandGenTask.removeReference();
}
-
-
//This is called after solver finish
void Sc::Scene::updateSimulationController(PxBaseTask* continuation)
{
@@ -3073,7 +3023,6 @@ void Sc::Scene::updateSimulationController(PxBaseTask* continuation)
}
void Sc::Scene::updateDynamics(PxBaseTask* continuation)
-
{
mProcessLostContactsTask3.setContinuation(continuation);
mProcessLostContactsTask2.setContinuation(&mProcessLostContactsTask3);
@@ -3103,10 +3052,8 @@ void Sc::Scene::updateDynamics(PxBaseTask* continuation)
mProcessLostContactsTask3.removeReference();
mProcessLostContactsTask2.removeReference();
mProcessLostContactsTask.removeReference();
-
}
-
void Sc::Scene::updateCCDMultiPass(PxBaseTask* parentContinuation)
{
getCcdBodies().forceSize_Unsafe(mSimulationControllerCallback->getNbCcdBodies());
@@ -3155,18 +3102,15 @@ void Sc::Scene::updateCCDMultiPass(PxBaseTask* parentContinuation)
}
}
-
//reset thread context in a place we know all tasks possibly accessing it, are in sync with. (see US6664)
mLLContext->resetThreadContexts();
mCCDContext->updateCCDBegin();
-
mCCDBroadPhase[0].setContinuation(parentContinuation);
mCCDBroadPhaseAABB[0].setContinuation(&mCCDBroadPhase[0]);
mCCDBroadPhase[0].removeReference();
mCCDBroadPhaseAABB[0].removeReference();
-
}
}
@@ -3213,7 +3157,6 @@ public:
Ps::atomicAdd(mNumFastMovingShapes, PxI32(activeShapes));
}
-
};
void Sc::Scene::ccdBroadPhaseAABB(PxBaseTask* continuation)
@@ -3239,10 +3182,8 @@ void Sc::Scene::ccdBroadPhaseAABB(PxBaseTask* continuation)
task->removeReference();
}
}
-
}
-
void Sc::Scene::ccdBroadPhase(PxBaseTask* continuation)
{
PX_PROFILE_ZONE("Sim.ccdBroadPhase", getContextId());
@@ -3267,7 +3208,6 @@ void Sc::Scene::ccdBroadPhase(PxBaseTask* continuation)
mUpdateCCDSinglePass2[currIndex].setContinuation(&mUpdateCCDSinglePass3[currIndex]);
mUpdateCCDSinglePass[currIndex].setContinuation(&mUpdateCCDSinglePass2[currIndex]);
-
//Do the actual broad phase
PxBaseTask* continuationTask = &mUpdateCCDSinglePass[currIndex];
const PxU32 numCpuTasks = continuationTask->getTaskManager()->getCpuDispatcher()->getWorkerCount();
@@ -3292,7 +3232,6 @@ void Sc::Scene::ccdBroadPhase(PxBaseTask* continuation)
}
}
-
void Sc::Scene::updateCCDSinglePass(PxBaseTask* continuation)
{
PX_PROFILE_ZONE("Sim.updateCCDSinglePass", getContextId());
@@ -3301,7 +3240,6 @@ void Sc::Scene::updateCCDSinglePass(PxBaseTask* continuation)
const PxU32 currentPass = mCCDContext->getCurrentCCDPass() + 1; // 0 is reserved for discrete collision phase
finishBroadPhase(currentPass, continuation);
-
if (currentPass == 1) // reset the handle map so we only update CCD objects from here on
{
Cm::BitMapPinned& changedAABBMgrActorHandles = mAABBManager->getChangedAABBMgActorHandleMap();
@@ -3339,7 +3277,6 @@ void Sc::Scene::updateCCDSinglePassStage3(PxBaseTask* continuation)
mCCDContext->updateCCD(mDt, continuation, (mPublicFlags & PxSceneFlag::eDISABLE_CCD_RESWEEP), mNumFastMovingShapes);
}
-
void Sc::Scene::integrateKinematicPose()
{
PX_PROFILE_ZONE("Sim.integrateKinematicPose", getContextId());
@@ -3394,7 +3331,6 @@ void Sc::Scene::updateKinematicCached()
}
}
-
class ConstraintProjectionTask : public Cm::Task
{
private:
@@ -3438,7 +3374,6 @@ public:
return "ScScene.constraintProjectionWork";
}
-
public:
static const PxU32 sProjectingConstraintsPerTask = 256; // just a guideline, will not match exactly most of the time
@@ -3554,7 +3489,6 @@ void Sc::Scene::postSolver(PxBaseTask* continuation)
}
//afterIntegration(continuation);
-
}
void Sc::Scene::postCCDPass(PxBaseTask* /*continuation*/)
@@ -3688,10 +3622,8 @@ void Sc::Scene::postReportsCleanup()
mRigidIDTracker->processPendingReleases();
mRigidIDTracker->clearDeletedIDMap();
-
mConstraintIDTracker->processPendingReleases();
mConstraintIDTracker->clearDeletedIDMap();
-
}
void Sc::Scene::syncSceneQueryBounds(SqBoundsSync& sync, SqRefFinder& finder)
@@ -3771,8 +3703,6 @@ void Sc::Scene::stepSetupCollide()
mInternalFlags &= ~(SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_DOMINANCE | SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_VISUALIZATION);
}
-
-
void Sc::Scene::processLostTouchPairs()
{
PX_PROFILE_ZONE("Sc::Scene::processLostTouchPairs", getContextId());
@@ -3807,7 +3737,6 @@ void Sc::Scene::processLostTouchPairs()
}
}
-
mLostTouchPairs.clear();
mLostTouchPairsDeletedBodyIDs.clear();
}
@@ -3872,7 +3801,6 @@ private:
ScBeforeSolverTask& operator = (const ScBeforeSolverTask&);
};
-
void Sc::Scene::beforeSolver(PxBaseTask* continuation)
{
PX_PROFILE_ZONE("Sim.updateForces", getContextId());
@@ -3934,7 +3862,6 @@ void Sc::Scene::beforeSolver(PxBaseTask* continuation)
mBodyGravityDirty = false;
}
-
#if PX_DEBUG
bool DEBUG_solverlock = false;
#endif
@@ -3965,7 +3892,6 @@ public:
}
};
-
void Sc::Scene::afterIntegration(PxBaseTask* continuation)
{
mLLContext->getTransformCache().resetChangedState(); //Reset the changed state. If anything outside of the GPU kernels updates any shape's transforms, this will be raised again
@@ -3976,8 +3902,6 @@ void Sc::Scene::afterIntegration(PxBaseTask* continuation)
mSimulationController->udpateScBodyAndShapeSim(cache, boundArray, continuation);
-
-
{
PX_PROFILE_ZONE("AfterIntegration::lockStage", getContextId());
mLLContext->getLock().lock();
@@ -4144,7 +4068,6 @@ void Sc::Scene::checkForceThresholdContactEvents(const PxU32 ccdPass)
const PxU32 nbThresholdElements = thresholdStream.size();
-
for (PxU32 i = 0; i< nbThresholdElements; ++i)
{
ThresholdStreamElement& elem = thresholdStream[i];
@@ -4268,7 +4191,6 @@ void Sc::Scene::visualizeEndStep()
#endif
}
-
void Sc::Scene::collectPostSolverVelocitiesBeforeCCD()
{
if (mContactReportsNeedPostSolverVelocity)
@@ -4301,7 +4223,6 @@ void Sc::Scene::collectPostSolverVelocitiesBeforeCCD()
}
}
-
void Sc::Scene::finalizeContactStreamAndCreateHeader(PxContactPairHeader& header, const ActorPairReport& aPair, ContactStreamManager& cs, PxU32 removedShapeTestMask)
{
PxU8* stream = mNPhaseCore->getContactReportPairData(cs.bufferIndex);
@@ -4347,10 +4268,8 @@ void Sc::Scene::finalizeContactStreamAndCreateHeader(PxContactPairHeader& header
}
}
header.extraDataStreamSize = extraDataSize;
-
}
-
const Ps::Array<PxContactPairHeader>& Sc::Scene::getQueuedContactPairHeaders()
{
// if buffered shape removals occured, then the criteria for testing the contact stream for events with removed shape pointers needs to be more strict.
@@ -4448,7 +4367,6 @@ void Sc::Scene::fireQueuedContactCallbacks(bool asPartOfFlush)
}
}
-
PX_FORCE_INLINE void markDeletedShapes(Sc::ObjectIDTracker& idTracker, Sc::TriggerPairExtraData& tped, PxTriggerPair& pair)
{
PxTriggerPairFlags::InternalType flags = 0;
@@ -4460,7 +4378,6 @@ PX_FORCE_INLINE void markDeletedShapes(Sc::ObjectIDTracker& idTracker, Sc::Trigg
pair.flags = PxTriggerPairFlags(flags);
}
-
void Sc::Scene::fireTriggerCallbacks()
{
// triggers
@@ -4576,7 +4493,6 @@ void Sc::Scene::fireTriggerCallbacks()
mTriggerBufferExtraData->clear();
}
-
namespace
{
struct BrokenConstraintReportData
@@ -4600,7 +4516,6 @@ void Sc::Scene::fireBrokenConstraintCallbacks()
PxU32 activeClients[(PX_MAX_CLIENTS+7)/8];
PxMemSet(activeClients, 0, (PX_MAX_CLIENTS+7)/8);
-
PxU16 activeClientLimit = 0;
for(PxU32 i=0;i<count;i++)
@@ -4665,7 +4580,6 @@ void Sc::Scene::fireBrokenConstraintCallbacks()
}
}
-
/*
Threading: called in the context of the user thread, but only after the physics thread has finished its run
*/
@@ -4789,7 +4703,6 @@ void Sc::Scene::prepareOutOfBoundsCallbacks()
}
}
-
bool Sc::Scene::fireOutOfBoundsCallbacks()
{
bool outputWarning = false;
@@ -4937,23 +4850,6 @@ void Sc::Scene::postCallbacksPreSync()
releaseConstraints(true); //release constraint blocks at the end of the frame, so user can retrieve the blocks
}
-PxU32 Sc::Scene::getErrorState()
-{
- return mErrorState; // we only signal critical errors from the HW core
-}
-
-
-void Sc::Scene::setLimits(const PxSceneLimits & limits)
-{
- mLimits = limits;
-}
-
-
-const PxSceneLimits& Sc::Scene::getLimits() const
-{
- return mLimits;
-}
-
void Sc::Scene::setNbContactDataBlocks(PxU32 numBlocks)
{
mLLContext->getNpMemBlockPool().setBlockCount(numBlocks);
@@ -5042,7 +4938,6 @@ void Sc::Scene::removeShapes(Sc::RigidSim& sim, Ps::InlineArray<Sc::ShapeSim*, 6
removeShape(*shapesBuffer[i], wakeOnLostTouch);
}
-
void Sc::Scene::addStatic(StaticCore& ro, void*const *shapes, PxU32 nbShapes, size_t shapePtrOffset, PxBounds3* uninflatedBounds)
{
PX_ASSERT(ro.getActorCoreType() == PxActorType::eRIGID_STATIC);
@@ -5097,7 +4992,6 @@ void Sc::Scene::removeStatic(StaticCore& ro, Ps::InlineArray<const Sc::ShapeCore
}
}
-
void Sc::Scene::addBody(BodyCore& body, void*const *shapes, PxU32 nbShapes, size_t shapePtrOffset, PxBounds3* outBounds)
{
// sim objects do all the necessary work of adding themselves to broad phase,
@@ -5142,7 +5036,6 @@ void Sc::Scene::removeBody(BodyCore& body, Ps::InlineArray<const Sc::ShapeCore*,
}
}
-
void Sc::Scene::addShape(RigidSim& owner, ShapeCore& shapeCore, PxBounds3* uninflatedBounds)
{
ShapeSim* sim = mShapeSimPool->construct(owner, shapeCore);
@@ -5192,7 +5085,6 @@ void Sc::Scene::startBatchInsertion(BatchInsertionState&state)
state.bodySim = mBodySimPool->allocateAndPrefetch();
}
-
void Sc::Scene::addShapes(void *const* shapes, PxU32 nbShapes, size_t ptrOffset, RigidSim& rigidSim, ShapeSim*& prefetchedShapeSim, PxBounds3* outBounds)
{
for(PxU32 i=0;i<nbShapes;i++)
@@ -5293,7 +5185,6 @@ void Sc::Scene::setDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup
mInternalFlags |= SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_DOMINANCE; //force an update on all interactions on matrix change -- very expensive but we have no choice!!
}
-
PxDominanceGroupPair Sc::Scene::getDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2) const
{
PxU8 dom0 = PxU8((mDominanceBitMatrix[group1]>>group2) & 0x1 ? 1u : 0u);
@@ -5312,13 +5203,11 @@ void Sc::Scene::setSolverBatchSize(PxU32 solverBatchSize)
mDynamicsContext->setSolverBatchSize(solverBatchSize);
}
-
PxU32 Sc::Scene::getSolverBatchSize() const
{
return mDynamicsContext->getSolverBatchSize();
}
-
void Sc::Scene::setVisualizationParameter(PxVisualizationParameter::Enum param, PxReal value)
{
mVisualizationParameterChanged = true;
@@ -5331,7 +5220,6 @@ void Sc::Scene::setVisualizationParameter(PxVisualizationParameter::Enum param,
mVisualizationScale = value;
}
-
PxReal Sc::Scene::getVisualizationParameter(PxVisualizationParameter::Enum param) const
{
PX_ASSERT(mLLContext->getVisualizationParameter(PxVisualizationParameter::eSCALE) == mVisualizationScale); // Safety check because the scale is duplicated for performance reasons
@@ -5339,7 +5227,6 @@ PxReal Sc::Scene::getVisualizationParameter(PxVisualizationParameter::Enum param
return mLLContext->getVisualizationParameter(param);
}
-
void Sc::Scene::setVisualizationCullingBox(const PxBounds3& box)
{
mLLContext->setVisualizationCullingBox(box);
@@ -5618,7 +5505,6 @@ void Sc::Scene::clearSleepWakeBodies(void)
mSleepBodyListValid = true;
}
-
void Sc::Scene::onBodySleep(BodySim* body)
{
//temp: TODO: Add support for other clients
@@ -5657,7 +5543,6 @@ void Sc::Scene::onBodySleep(BodySim* body)
}
}
-
void Sc::Scene::onBodyWakeUp(BodySim* body)
{
//temp: TODO: Add support for other clients
@@ -5687,7 +5572,6 @@ void Sc::Scene::onBodyWakeUp(BodySim* body)
}
}
-
PX_INLINE void Sc::Scene::cleanUpSleepBodies()
{
BodyCore* const* bodyArray = mSleepBodies.getEntries();
@@ -5714,16 +5598,13 @@ PX_INLINE void Sc::Scene::cleanUpSleepBodies()
}
mSleepBodyListValid = true;
-
}
-
PX_INLINE void Sc::Scene::cleanUpWokenBodies()
{
cleanUpSleepOrWokenBodies(mWokeBodies, BodySim::BF_SLEEP_NOTIFY, mWokeBodyListValid);
}
-
PX_INLINE void Sc::Scene::cleanUpSleepOrWokenBodies(Ps::CoalescedHashSet<BodyCore*>& bodyList, PxU32 removeFlag, bool& validMarker)
{
// With our current logic it can happen that a body is added to the sleep as well as the woken body list in the
@@ -5749,7 +5630,6 @@ PX_INLINE void Sc::Scene::cleanUpSleepOrWokenBodies(Ps::CoalescedHashSet<BodyCor
validMarker = true;
}
-
void Sc::Scene::releaseConstraints(bool endOfScene)
{
PX_ASSERT(mLLContext);
@@ -5775,13 +5655,11 @@ void Sc::Scene::releaseConstraints(bool endOfScene)
}
}
-
PX_INLINE void Sc::Scene::clearBrokenConstraintBuffer()
{
mBrokenConstraints.clear();
}
-
void Sc::Scene::updateFromVisualizationParameters()
{
if (!mVisualizationParameterChanged) // All up to date
@@ -5795,13 +5673,6 @@ void Sc::Scene::updateFromVisualizationParameters()
mVisualizationParameterChanged = false;
}
-
-bool Sc::Scene::isValid() const
-{
- return (mLLContext != NULL);
-}
-
-
void Sc::Scene::addToLostTouchList(BodySim* body1, BodySim* body2)
{
PX_ASSERT(body1 != 0);
@@ -5810,7 +5681,6 @@ void Sc::Scene::addToLostTouchList(BodySim* body1, BodySim* body2)
mLostTouchPairs.pushBack(p);
}
-
void Sc::Scene::initDominanceMatrix()
{
//init all dominance pairs such that:
@@ -5828,13 +5698,11 @@ Articulation* Sc::Scene::createLLArticulation(Sc::ArticulationSim* sim)
return mLLArticulationPool->construct(sim);
}
-
void Sc::Scene::destroyLLArticulation(Articulation& articulation)
{
mLLArticulationPool->destroy(&articulation);
}
-
#if PX_USE_PARTICLE_SYSTEM_API
void Sc::Scene::addParticleSystem(ParticleSystemCore& ps)
@@ -5855,7 +5723,6 @@ void Sc::Scene::addParticleSystem(ParticleSystemCore& ps)
mParticleSystems.insert(&ps);
}
-
void Sc::Scene::removeParticleSystem(ParticleSystemCore& ps, bool isRelease)
{
const bool exists = mParticleSystems.erase(&ps);
@@ -5864,13 +5731,11 @@ void Sc::Scene::removeParticleSystem(ParticleSystemCore& ps, bool isRelease)
ps.getSim()->release(isRelease);
}
-
PxU32 Sc::Scene::getNbParticleSystems() const
{
return mParticleSystems.size();
}
-
Sc::ParticleSystemCore* const* Sc::Scene::getParticleSystems()
{
return mParticleSystems.getEntries();
@@ -6019,9 +5884,6 @@ Sc::ConstraintCore*const * Sc::Scene::getConstraints()
return mConstraints.getEntries();
}
-
-
-
// PX_AGGREGATE
PxU32 Sc::Scene::createAggregate(void* userData, bool selfCollisions)
{
@@ -6328,7 +6190,6 @@ public:
virtual const char* getName() const { return "OverlapFilterTask"; }
};
-
class OnOverlapCreatedTask : public Cm::Task
{
public:
@@ -6393,11 +6254,8 @@ public:
}
virtual const char* getName() const { return "OnOverlapCreatedTask"; }
-
};
-#include <stdio.h>
-
void Sc::Scene::preallocateContactManagers(PxBaseTask* continuation)
{
//Iterate over all filter tasks and work out how many pairs we need...
@@ -6416,7 +6274,6 @@ void Sc::Scene::preallocateContactManagers(PxBaseTask* continuation)
{
OverlapFilterTask* task = mOverlapFilterTasks[a];
-
if (task->mNbToCallback)
{
//Iterate and process callbacks. Refilter then increment the results, setting the appropriate settings
@@ -6470,12 +6327,8 @@ void Sc::Scene::preallocateContactManagers(PxBaseTask* continuation)
Bp::BroadPhasePair* bpPairs = mAABBManager->getBroadPhase()->getBroadPhasePairs();
-
-
Cm::FlushPool& flushPool = mLLContext->getTaskPool();
-
-
OnOverlapCreatedTask* createTask = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(OnOverlapCreatedTask)), OnOverlapCreatedTask)(mNPhaseCore, p,
fInfo, cms, shapeInter, markerIter, bpPairs, 0);
diff --git a/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp b/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp
index 2235eb9d..1e1c48de 100644
--- a/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp
+++ b/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp
@@ -868,6 +868,9 @@ void Sc::ShapeInteraction::updateState(const PxU8 externalDirtyFlags)
// B) The contact notification or processing state has changed.
// All existing managers need to be deleted and recreated with the correct flag set
// These flags can only be set at creation in LL
+ //KS - added this code here because it is no longer done in destroyManager() - a side-effect of the parallelization of the interaction management code
+ if (mEdgeIndex != IG_INVALID_EDGE)
+ scene.getSimpleIslandManager()->clearEdgeRigidCM(mEdgeIndex);
destroyManager();
createManager(NULL);
}
diff --git a/PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp b/PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp
index 46a20a62..d30064c9 100644
--- a/PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp
+++ b/PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp
@@ -426,7 +426,7 @@ Ps::IntBool Sc::ShapeSim::updateSweptBounds()
Cm::getDynamicGlobalPoseAligned(rigidBody.mLastTransform, shapeCore.getShape2Actor(), bodyCore.getBody2Actor(), shape2World);
PxBounds3 startBounds = computeBounds(shapeCore.getGeometry(), shape2World, !physx::gUnifiedHeightfieldCollision);
- Ps::IntBool isFastMoving = (startBounds.getCenter() - endOrigin).magnitudeSquared() >= ccdThreshold * ccdThreshold ? 1 : 0;;
+ const Ps::IntBool isFastMoving = (startBounds.getCenter() - endOrigin).magnitudeSquared() >= ccdThreshold * ccdThreshold ? 1 : 0;
if (isFastMoving)
bounds.include(startBounds);
diff --git a/PhysX_3.4/Source/SimulationController/src/ScShapeSim.h b/PhysX_3.4/Source/SimulationController/src/ScShapeSim.h
index f59e4823..785de4ce 100644
--- a/PhysX_3.4/Source/SimulationController/src/ScShapeSim.h
+++ b/PhysX_3.4/Source/SimulationController/src/ScShapeSim.h
@@ -133,7 +133,7 @@ namespace Sc
PxsShapeSim mLLShape;
const ShapeCore& mCore;
PxU32 mId;
- PxU32 mSqBoundsId;
+ PxU32 mSqBoundsId;
PX_FORCE_INLINE void internalAddToBroadPhase();
PX_FORCE_INLINE void internalRemoveFromBroadPhase();
diff --git a/PhysX_3.4/Source/SimulationController/src/ScSqBoundsManager.cpp b/PhysX_3.4/Source/SimulationController/src/ScSqBoundsManager.cpp
index 5ea2ebde..02648829 100644
--- a/PhysX_3.4/Source/SimulationController/src/ScSqBoundsManager.cpp
+++ b/PhysX_3.4/Source/SimulationController/src/ScSqBoundsManager.cpp
@@ -27,26 +27,18 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-#include "CmPhysXCommon.h"
#include "ScSqBoundsManager.h"
#include "ScBodySim.h"
#include "ScShapeSim.h"
-#include "ScShapeIterator.h"
-#include "CmTransformUtils.h"
-#include "PxsTransformCache.h"
-#include <stdio.h>
-namespace physx
-{
-namespace Sc
-{
-
- SqBoundsManager::SqBoundsManager() :
- mShapes(PX_DEBUG_EXP("SqBoundsManager::mRefs")),
- mRefs(PX_DEBUG_EXP("SqBoundsManager::mRefs")),
- mBoundsIndices(PX_DEBUG_EXP("SqBoundsManager::mRefs")),
- mRefless(PX_DEBUG_EXP("SqBoundsManager::mRefs"))
+using namespace physx;
+using namespace Sc;
+SqBoundsManager::SqBoundsManager() :
+ mShapes (PX_DEBUG_EXP("SqBoundsManager::mShapes")),
+ mRefs (PX_DEBUG_EXP("SqBoundsManager::mRefs")),
+ mBoundsIndices (PX_DEBUG_EXP("SqBoundsManager::mBoundsIndices")),
+ mRefless (PX_DEBUG_EXP("SqBoundsManager::mRefless"))
{
}
@@ -56,19 +48,24 @@ void SqBoundsManager::addShape(ShapeSim& shape)
PX_ASSERT(!shape.getBodySim()->usingSqKinematicTarget());
PX_ASSERT(!shape.getBodySim()->isFrozen());
- PxU32 id = mShapes.size();
+ const PxU32 id = mShapes.size();
+ PX_ASSERT(id == mRefs.size());
+ PX_ASSERT(id == mBoundsIndices.size());
+
+ shape.setSqBoundsId(id);
+
mShapes.pushBack(&shape);
- mRefs.pushBack(PX_INVALID_U32);
+ mRefs.pushBack(PX_INVALID_U32); // PT: TODO: should be INVALID_PRUNERHANDLE but cannot include SqPruner.h
mBoundsIndices.pushBack(shape.getElementID());
mRefless.insert(&shape);
-
- shape.setSqBoundsId(id);
}
void SqBoundsManager::removeShape(ShapeSim& shape)
{
- PxU32 id = shape.getSqBoundsId();
- if(mRefs[id] == PX_INVALID_U32)
+ const PxU32 id = shape.getSqBoundsId();
+ PX_ASSERT(id!=PX_INVALID_U32);
+
+ if(mRefs[id] == PX_INVALID_U32) // PT: TODO: should be INVALID_PRUNERHANDLE but cannot include SqPruner.h
{
PX_ASSERT(mRefless.contains(&shape));
mRefless.erase(&shape);
@@ -87,7 +84,6 @@ void SqBoundsManager::removeShape(ShapeSim& shape)
mBoundsIndices.popBack();
}
-
void SqBoundsManager::syncBounds(SqBoundsSync& sync, SqRefFinder& finder, const PxBounds3* bounds, PxU64 contextID)
{
PX_PROFILE_ZONE("Sim.sceneQuerySyncBounds", contextID);
@@ -107,16 +103,11 @@ void SqBoundsManager::syncBounds(SqBoundsSync& sync, SqRefFinder& finder, const
ShapeSim*const * shapes = mRefless.getEntries();
for(PxU32 i=0, size = mRefless.size();i<size;i++)
{
- PxU32 id = shapes[i]->getSqBoundsId();
- PX_ASSERT(mRefs[id] == PX_INVALID_U32);
+ const PxU32 id = shapes[i]->getSqBoundsId();
+ PX_ASSERT(mRefs[id] == PX_INVALID_U32); // PT: TODO: should be INVALID_PRUNERHANDLE but cannot include SqPruner.h
mRefs[id] = finder.find(static_cast<PxRigidBody*>(shapes[i]->getBodySim()->getPxActor()), shapes[i]->getPxShape());
}
mRefless.clear();
sync.sync(mRefs.begin(), mBoundsIndices.begin(), bounds, mShapes.size());
}
-
-
-}
-
-}
diff --git a/PhysX_3.4/Source/SimulationController/src/ScSqBoundsManager.h b/PhysX_3.4/Source/SimulationController/src/ScSqBoundsManager.h
index 46006622..9d13b3df 100644
--- a/PhysX_3.4/Source/SimulationController/src/ScSqBoundsManager.h
+++ b/PhysX_3.4/Source/SimulationController/src/ScSqBoundsManager.h
@@ -34,43 +34,39 @@
#include "foundation/PxBounds3.h"
#include "PsArray.h"
#include "PsUserAllocated.h"
-#include "CmTask.h"
#include "PsHashSet.h"
+//#include "SqPruner.h"
namespace physx
{
-
-namespace Cm
+namespace Sq
{
- class FlushPool;
- class EventProfiler;
+typedef PxU32 PrunerHandle; // PT: we should get this from SqPruner.h but it cannot be included from here
}
namespace Sc
{
-
struct SqBoundsSync;
struct SqRefFinder;
-class Scene;
class ShapeSim;
class SqBoundsManager : public Ps::UserAllocated
{
PX_NOCOPY(SqBoundsManager)
public:
- SqBoundsManager();
+ SqBoundsManager();
- void addShape(ShapeSim& shape);
- void removeShape(ShapeSim& shape);
- void syncBounds(SqBoundsSync& sync, SqRefFinder& finder, const PxBounds3* bounds, PxU64 contextID);
+ void addShape(ShapeSim& shape);
+ void removeShape(ShapeSim& shape);
+ void syncBounds(SqBoundsSync& sync, SqRefFinder& finder, const PxBounds3* bounds, PxU64 contextID);
private:
- Ps::Array<ShapeSim*> mShapes; //
- Ps::Array<PxU32> mRefs; // SQ pruner references
- Ps::Array<PxU32> mBoundsIndices; // indices into the Sc bounds array
- Ps::CoalescedHashSet<ShapeSim*> mRefless; // shapesims without references
+ Ps::Array<ShapeSim*> mShapes; //
+ Ps::Array<Sq::PrunerHandle> mRefs; // SQ pruner references
+ Ps::Array<PxU32> mBoundsIndices; // indices into the Sc bounds array
+ Ps::CoalescedHashSet<ShapeSim*> mRefless; // shapesims without references
};
}
}