diff options
| author | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-04-25 16:02:08 -0500 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-04-25 16:02:08 -0500 |
| commit | d11708e398c2f6377d9eac2b1f7248c62faab569 (patch) | |
| tree | 5778e794690c046ab4b0205d8f764960a5af168b /PhysX_3.4/Source/LowLevel/software/src | |
| parent | PhysX 3.4, APEX 1.4 patch release @21821222 (diff) | |
| download | physx-3.4-d11708e398c2f6377d9eac2b1f7248c62faab569.tar.xz physx-3.4-d11708e398c2f6377d9eac2b1f7248c62faab569.zip | |
PhysX 3.4, APEX 1.4 patch release @22017166
Diffstat (limited to 'PhysX_3.4/Source/LowLevel/software/src')
4 files changed, 71 insertions, 30 deletions
diff --git a/PhysX_3.4/Source/LowLevel/software/src/PxsCCD.cpp b/PhysX_3.4/Source/LowLevel/software/src/PxsCCD.cpp index 70d24cc0..1668a494 100644 --- a/PhysX_3.4/Source/LowLevel/software/src/PxsCCD.cpp +++ b/PhysX_3.4/Source/LowLevel/software/src/PxsCCD.cpp @@ -194,9 +194,9 @@ namespace physx { PxsCCDContext::PxsCCDContext(PxsContext* context, Dy::ThresholdStream& thresholdStream, PxvNphaseImplementationContext& nPhaseContext) : - mPostCCDSweepTask (this, "PxsContext.postCCDSweep"), - mPostCCDAdvanceTask (this, "PxsContext.postCCDAdvance"), - mPostCCDDepenetrateTask (this, "PxsContext.postCCDDepenetrate"), + mPostCCDSweepTask (context->getContextId(), this, "PxsContext.postCCDSweep"), + mPostCCDAdvanceTask (context->getContextId(), this, "PxsContext.postCCDAdvance"), + mPostCCDDepenetrateTask (context->getContextId(), this, "PxsContext.postCCDDepenetrate"), mDisableCCDResweep (false), miCCDPass (0), mSweepTotalHits (0), @@ -857,8 +857,8 @@ class PxsCCDSweepTask : public Cm::Task PxsCCDPair** mPairs; PxU32 mNumPairs; public: - PxsCCDSweepTask(PxsCCDPair** pairs, PxU32 nPairs) - : mPairs(pairs), mNumPairs(nPairs) + PxsCCDSweepTask(PxU64 contextID, PxsCCDPair** pairs, PxU32 nPairs) + : Cm::Task(contextID), mPairs(pairs), mNumPairs(nPairs) { } @@ -914,7 +914,7 @@ public: PxU32 firstIslandPair, PxU32 firstThreadIsland, PxU32 islandsPerThread, PxU32 totalIslands, PxsCCDBody** islandBodies, PxU16* numIslandBodies, bool clipTrajectory, bool disableResweep, PxI32* sweepTotalHits) - : mCCDPairs(pairs), mNumPairs(nPairs), mContext(context), mCCDContext(ccdContext), mDt(dt), + : Cm::Task(context->getContextId()), mCCDPairs(pairs), mNumPairs(nPairs), mContext(context), mCCDContext(ccdContext), mDt(dt), mCCDPass(ccdPass), mCCDBodies(ccdBodies), mFirstThreadIsland(firstThreadIsland), mIslandsPerThread(islandsPerThread), mTotalIslandCount(totalIslands), mFirstIslandPair(firstIslandPair), mIslandBodies(islandBodies), mNumIslandBodies(numIslandBodies), mSweepTotalHits(sweepTotalHits), @@ -1697,8 +1697,7 @@ void PxsCCDContext::updateCCD(PxReal dt, PxBaseTask* continuation, bool disableR PX_ASSERT_WITH_MESSAGE(ptr, "Failed to allocate PxsCCDSweepTask"); const PxU32 batchEnd = PxMin(nPairs, batchBegin + mCCDPairsPerBatch); PX_ASSERT(batchEnd >= batchBegin); - PxsCCDSweepTask* task = PX_PLACEMENT_NEW(ptr, PxsCCDSweepTask)( - mCCDPtrPairs.begin() + batchBegin, batchEnd - batchBegin); + PxsCCDSweepTask* task = PX_PLACEMENT_NEW(ptr, PxsCCDSweepTask)(mContext->getContextId(), mCCDPtrPairs.begin() + batchBegin, batchEnd - batchBegin); task->setContinuation(*mContext->mTaskManager, &mPostCCDSweepTask); task->removeReference(); } diff --git a/PhysX_3.4/Source/LowLevel/software/src/PxsContext.cpp b/PhysX_3.4/Source/LowLevel/software/src/PxsContext.cpp index d9bcc3d1..6735b3aa 100644 --- a/PhysX_3.4/Source/LowLevel/software/src/PxsContext.cpp +++ b/PhysX_3.4/Source/LowLevel/software/src/PxsContext.cpp @@ -63,24 +63,6 @@ using namespace physx::shdfnd; #define PXS_BODYSHAPE_SLABSIZE 1024 #define PXS_MAX_BODYSHAPE_SLABS 16 - -void PxsCMUpdateTask::release() -{ - // We used to do Task::release(); here before fixing DE1106 (xbox pure virtual crash) - // Release in turn causes the dependent tasks to start running - // The problem was that between the time release was called and by the time we got to the destructor - // The task chain would get all the way to scene finalization code which would reset the allocation pool - // And a new task would get allocated at the same address, then we would invoke the destructor on that freshly created task - // This could potentially cause any number of other problems, it is suprising that it only manifested itself - // as a pure virtual crash - PxBaseTask* saveContinuation = mCont; - this->~PxsCMUpdateTask(); - if (saveContinuation) - saveContinuation->removeReference(); -} - - - PxsContext::PxsContext(const PxSceneDesc& desc, PxTaskManager* taskManager, Cm::FlushPool& taskPool, PxU64 contextID) : mNpThreadContextPool (this), mContactManagerPool ("mContactManagerPool", this, 256, 8192), diff --git a/PhysX_3.4/Source/LowLevel/software/src/PxsNphaseImplementationContext.cpp b/PhysX_3.4/Source/LowLevel/software/src/PxsNphaseImplementationContext.cpp index fa39ba6f..5a2823a5 100644 --- a/PhysX_3.4/Source/LowLevel/software/src/PxsNphaseImplementationContext.cpp +++ b/PhysX_3.4/Source/LowLevel/software/src/PxsNphaseImplementationContext.cpp @@ -54,6 +54,58 @@ using namespace physx; using namespace physx::shdfnd; +class PxsCMUpdateTask : public Cm::Task +{ +public: + + static const PxU32 BATCH_SIZE = 128; + + PxsCMUpdateTask(PxsContext* context, PxReal dt, PxsContactManager** cmArray, PxsContactManagerOutput* cmOutputs, Gu::Cache* caches, PxU32 cmCount, PxContactModifyCallback* callback) : + Cm::Task (context->getContextId()), + mCmArray (cmArray), + mCmOutputs (cmOutputs), + mCaches (caches), + mCmCount (cmCount), + mDt (dt), + mContext (context), + mCallback (callback) + { + } + + virtual void release(); + + /*PX_FORCE_INLINE void insert(PxsContactManager* cm) + { + PX_ASSERT(mCmCount < BATCH_SIZE); + mCmArray[mCmCount++]=cm; + }*/ + +protected: + //PxsContactManager* mCmArray[BATCH_SIZE]; + PxsContactManager** mCmArray; + PxsContactManagerOutput* mCmOutputs; + Gu::Cache* mCaches; + PxU32 mCmCount; + PxReal mDt; //we could probably retrieve from context to save space? + PxsContext* mContext; + PxContactModifyCallback* mCallback; +}; + +void PxsCMUpdateTask::release() +{ + // We used to do Task::release(); here before fixing DE1106 (xbox pure virtual crash) + // Release in turn causes the dependent tasks to start running + // The problem was that between the time release was called and by the time we got to the destructor + // The task chain would get all the way to scene finalization code which would reset the allocation pool + // And a new task would get allocated at the same address, then we would invoke the destructor on that freshly created task + // This could potentially cause any number of other problems, it is suprising that it only manifested itself + // as a pure virtual crash + PxBaseTask* saveContinuation = mCont; + this->~PxsCMUpdateTask(); + if (saveContinuation) + saveContinuation->removeReference(); +} + class PxsCMDiscreteUpdateTask : public PxsCMUpdateTask { public: diff --git a/PhysX_3.4/Source/LowLevel/software/src/PxsSimpleIslandManager.cpp b/PhysX_3.4/Source/LowLevel/software/src/PxsSimpleIslandManager.cpp index aeb83270..9f0fa050 100644 --- a/PhysX_3.4/Source/LowLevel/software/src/PxsSimpleIslandManager.cpp +++ b/PhysX_3.4/Source/LowLevel/software/src/PxsSimpleIslandManager.cpp @@ -40,6 +40,14 @@ namespace physx namespace IG { + ThirdPassTask::ThirdPassTask(PxU64 contextID, SimpleIslandManager& islandManager, IslandSim& islandSim) : Cm::Task(contextID), mIslandManager(islandManager), mIslandSim(islandSim) + { + } + + PostThirdPassTask::PostThirdPassTask(PxU64 contextID, SimpleIslandManager& islandManager) : Cm::Task(contextID), mIslandManager(islandManager) + { + } + SimpleIslandManager::SimpleIslandManager(bool useEnhancedDeterminism, PxU64 contextID) : mDestroyedNodes(PX_DEBUG_EXP("mDestroyedNodes")), mInteractions(PX_DEBUG_EXP("mInteractions")), @@ -50,9 +58,9 @@ namespace IG mConstraintOrCm(PX_DEBUG_EXP("mConstraintOrCm")), mIslandManager(&mFirstPartitionEdges, mEdgeNodeIndices, &mDestroyedPartitionEdges, contextID), mSpeculativeIslandManager(NULL, mEdgeNodeIndices, NULL, contextID), - mSpeculativeThirdPassTask(*this, mSpeculativeIslandManager), - mAccurateThirdPassTask(*this, mIslandManager), - mPostThirdPassTask(*this), + mSpeculativeThirdPassTask(contextID, *this, mSpeculativeIslandManager), + mAccurateThirdPassTask(contextID, *this, mIslandManager), + mPostThirdPassTask(contextID, *this), mContextID(contextID) { mFirstPartitionEdges.resize(1024); @@ -219,7 +227,7 @@ void SimpleIslandManager::secondPassIslandGen() mNodeHandles.freeHandle(mDestroyedNodes[a].index()); } mDestroyedNodes.clear(); - mDestroyedEdges.clear(); + //mDestroyedEdges.clear(); } bool SimpleIslandManager::validateDeactivations() const |