diff options
| author | sschirm <[email protected]> | 2017-02-27 16:40:12 +0100 |
|---|---|---|
| committer | sschirm <[email protected]> | 2017-03-01 18:04:26 +0100 |
| commit | 7840347c32755e94a807f978f1cbb558717ac8cf (patch) | |
| tree | 295cd3ca93a45f8fcc43cf3cbf3887c0e0c5526b /PhysX_3.4/Source/SimulationController/src | |
| parent | Pre-release comments marking end of beta. (diff) | |
| download | physx-3.4-7840347c32755e94a807f978f1cbb558717ac8cf.tar.xz physx-3.4-7840347c32755e94a807f978f1cbb558717ac8cf.zip | |
PhysX 3.4, APEX 1.4 final release @21757769v3.4.0-rc-2
Diffstat (limited to 'PhysX_3.4/Source/SimulationController/src')
4 files changed, 30 insertions, 27 deletions
diff --git a/PhysX_3.4/Source/SimulationController/src/ScElementSimInteraction.h b/PhysX_3.4/Source/SimulationController/src/ScElementSimInteraction.h index 469a1259..daa95c0f 100644 --- a/PhysX_3.4/Source/SimulationController/src/ScElementSimInteraction.h +++ b/PhysX_3.4/Source/SimulationController/src/ScElementSimInteraction.h @@ -50,6 +50,10 @@ namespace Sc // i.e., if this interaction gets deleted, the pair is considered lost virtual bool isLastFilterInteraction() const { return true; } + PX_INLINE void setFilterPairIndex(PxU32 filterPairIndex) { mFilterPairIndex = filterPairIndex; } + + PX_INLINE PxU32 getFilterPairIndex() const { return mFilterPairIndex; } + protected: PX_INLINE ElementSimInteraction(ElementSim& element0, ElementSim& element1, InteractionType::Enum type, PxU8 flags); virtual ~ElementSimInteraction() {} @@ -58,6 +62,7 @@ namespace Sc private: ElementSim& mElement0; ElementSim& mElement1; + PxU32 mFilterPairIndex; }; } // namespace Sc @@ -67,7 +72,8 @@ namespace Sc PX_INLINE Sc::ElementSimInteraction::ElementSimInteraction(ElementSim& element0, ElementSim& element1, InteractionType::Enum type, PxU8 flags) : Interaction (element0.getActor(), element1.getActor(), type, flags), mElement0 (element0), - mElement1 (element1) + mElement1 (element1), + mFilterPairIndex(INVALID_FILTER_PAIR_INDEX) { } diff --git a/PhysX_3.4/Source/SimulationController/src/ScNPhaseCore.cpp b/PhysX_3.4/Source/SimulationController/src/ScNPhaseCore.cpp index de300003..a388dee0 100644 --- a/PhysX_3.4/Source/SimulationController/src/ScNPhaseCore.cpp +++ b/PhysX_3.4/Source/SimulationController/src/ScNPhaseCore.cpp @@ -91,7 +91,6 @@ public: FilterPairManager() : mPairs(PX_DEBUG_EXP("FilterPairManager Array")) , mFree(INVALID_FILTER_PAIR_INDEX) - , mInteractionToIndex(PX_DEBUG_EXP("FilterPairManager Hash")) {} PxU32 acquireIndex() @@ -112,18 +111,14 @@ public: } void releaseIndex(PxU32 index) - { - if(mPairs[index].getType()!=FilterPair::INVALID) - mInteractionToIndex.erase(mPairs[index].getPtr<void*>()); - + { mPairs[index].ptrAndType = mFree; mFree = index; } - void set(PxU32 index, void* ptr, FilterPair::Enum type) + void setPair(PxU32 index, Sc::ElementSimInteraction* ptr, FilterPair::Enum type) { mPairs[index] = FilterPair(ptr, type); - mInteractionToIndex[ptr] = index; } FilterPair& operator[](PxU32 index) @@ -131,10 +126,9 @@ public: return mPairs[index]; } - PxU32 findIndex(void* ptr) + PxU32 findIndex(Sc::ElementSimInteraction* ptr) { - const InteractionToIndex::Entry* pair = mInteractionToIndex.find(ptr); - return pair ? pair->second : INVALID_FILTER_PAIR_INDEX; + return ptr->getFilterPairIndex(); } private: @@ -142,7 +136,6 @@ private: Ps::Array<FilterPair> mPairs; uintptr_t mFree; - InteractionToIndex mInteractionToIndex; }; /* Sc::NPhaseCore methods */ @@ -711,7 +704,8 @@ Sc::ElementSimInteraction* Sc::NPhaseCore::createRbElementInteraction(const PxFi pair->raiseInteractionFlag(InteractionFlag::eIS_FILTER_PAIR); // Filter callback pair: Set the link to the interaction - mFilterPairManager->set(finfo.filterPairIndex, pair, FilterPair::ELEMENT_ELEMENT); + mFilterPairManager->setPair(finfo.filterPairIndex, pair, FilterPair::ELEMENT_ELEMENT); + pair->setFilterPairIndex(finfo.filterPairIndex); } return pair; @@ -790,8 +784,11 @@ Sc::ElementSimInteraction* Sc::NPhaseCore::createParticlePacketBodyInteraction(P actorElementPair->markAsFilterPair(finfo.filterPairIndex != INVALID_FILTER_PAIR_INDEX); - if(finfo.filterPairIndex != INVALID_FILTER_PAIR_INDEX) - mFilterPairManager->set(finfo.filterPairIndex, NULL, FilterPair::ELEMENT_ACTOR); + if (finfo.filterPairIndex != INVALID_FILTER_PAIR_INDEX) + { + mFilterPairManager->setPair(finfo.filterPairIndex, NULL, FilterPair::ELEMENT_ACTOR); + pbi->setFilterPairIndex(INVALID_FILTER_PAIR_INDEX); + } } ElementSimInteraction* pair = insertParticleElementRbElementPair(ps, s, actorElementPair, ccdPass); @@ -1143,7 +1140,7 @@ Sc::ElementSimInteraction* Sc::NPhaseCore::refilterInteraction(ElementSimInterac PxU32 filterPairIndex = INVALID_FILTER_PAIR_INDEX; if (pbi->readInteractionFlag(InteractionFlag::eIS_FILTER_PAIR)) { - filterPairIndex = mFilterPairManager->findIndex(aep); + filterPairIndex = mFilterPairManager->findIndex(pbi); PX_ASSERT(filterPairIndex!=INVALID_FILTER_PAIR_INDEX); callPairLost(pbi->getElement0(), pbi->getElement1(), filterPairIndex, false); @@ -1574,7 +1571,8 @@ Sc::ElementSimInteraction* Sc::NPhaseCore::convert(ElementSimInteraction* pair, // Mark the new interaction as a filter callback pair result->raiseInteractionFlag(InteractionFlag::eIS_FILTER_PAIR); - mFilterPairManager->set(filterInfo.filterPairIndex, result, FilterPair::ELEMENT_ELEMENT); + mFilterPairManager->setPair(filterInfo.filterPairIndex, result, FilterPair::ELEMENT_ELEMENT); + result->setFilterPairIndex(filterInfo.filterPairIndex); } if (pair->readInteractionFlag(InteractionFlag::eIS_FILTER_PAIR)) diff --git a/PhysX_3.4/Source/SimulationController/src/ScScene.cpp b/PhysX_3.4/Source/SimulationController/src/ScScene.cpp index 47869390..1bdeaffe 100644 --- a/PhysX_3.4/Source/SimulationController/src/ScScene.cpp +++ b/PhysX_3.4/Source/SimulationController/src/ScScene.cpp @@ -138,7 +138,7 @@ void PxcDisplayContactCacheStats(); class ScAfterIntegrationTask : public Cm::Task { public: - static const PxU32 MaxTasks = 128; + static const PxU32 MaxTasks = 256; private: const IG::NodeIndex* const mIndices; const PxU32 mNumBodies; @@ -277,7 +277,7 @@ public: virtual const char* getName() const { - return "ScScene.afterIntegration"; + return "ScScene.afterIntegrationTask"; } private: @@ -311,7 +311,7 @@ public: const IG::NodeIndex*const nodeIndices = islandSim.getActiveNodes(IG::Node::eRIGID_BODY_TYPE); - if(0) + if(1) { for(PxU32 i = 0; i < numBodies; i+=MaxBodiesPerTask) { @@ -3901,11 +3901,12 @@ void Sc::Scene::afterIntegration(PxBaseTask* continuation) PxsTransformCache& cache = getLowLevelContext()->getTransformCache(); Bp::BoundsArray& boundArray = getBoundsArray(); - mSimulationController->udpateScBodyAndShapeSim(cache, boundArray, continuation); - { PX_PROFILE_ZONE("AfterIntegration::lockStage", getContextId()); mLLContext->getLock().lock(); + + + mSimulationController->udpateScBodyAndShapeSim(cache, boundArray, continuation); const IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); @@ -6314,9 +6315,9 @@ void Sc::Scene::preallocateContactManagers(PxBaseTask* continuation) { //We allocate at least 1 element in this array to ensure that the onOverlapCreated functions don't go bang! - mPreallocatedContactManagers.reserve(totalCreatedPairs); - mPreallocatedShapeInteractions.reserve(totalCreatedPairs); - mPreallocatedInteractionMarkers.reserve(totalSuppressPairs); + mPreallocatedContactManagers.reserve(totalCreatedPairs+1); + mPreallocatedShapeInteractions.reserve(totalCreatedPairs+1); + mPreallocatedInteractionMarkers.reserve(totalSuppressPairs+1); mPreallocatedContactManagers.forceSize_Unsafe(totalCreatedPairs); mPreallocatedShapeInteractions.forceSize_Unsafe(totalCreatedPairs); diff --git a/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp b/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp index 66d0a4bf..8956983e 100644 --- a/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp +++ b/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp @@ -111,8 +111,6 @@ Sc::ShapeInteraction::ShapeInteraction(ShapeSim& s1, ShapeSim& s2, ActorPair* aP onActivate(contactManager); } - PX_ASSERT((&getShape0()) && (&getShape1())); - if(aPair) aPair->incRefCount(); } |