PVD & Aggregate crash
Opened this issue · 1 comments
zemlifr commented
Hello, when I create aggregate and insert it to scene and then connect PVD, my application crashes once I want remove actor in aggregate with following callstack:
PhysXFoundation_64.dll!`anonymous namespace'::DefaultAssertHandler::operator()(const char * expr, const char * file, int line, bool & ignore) Line 65 C++
PhysX_64.dll!physx::Vd::ChangeOjectRefCmd::canRun(physx::pvdsdk::PvdInstanceDataStream & inStream) Line 1456 C++
PhysX_64.dll!physx::Vd::changeAggregateSubActors(physx::pvdsdk::PvdDataStream & inStream, const physx::PxAggregate & inObj, const physx::PxActor & inActor, bool pushBack) Line 1497 C++
PhysX_64.dll!physx::Vd::PvdMetaDataBinding::detachAggregateActor(physx::pvdsdk::PvdDataStream & inStream, const physx::PxAggregate & inObj, const physx::PxActor & inActor) Line 1505 C++
PhysX_64.dll!physx::Vd::ScbScenePvdClient::detachAggregateActor(const physx::Scb::Aggregate * aggregate, physx::Scb::Actor * actor) Line 785 C++
PhysX_64.dll!physx::Scb::`anonymous namespace'::PvdDetachActorFromAggregate(physx::Scb::Aggregate * pAggregate, physx::Scb::Actor * pScbActor) Line 156 C++
> PhysX_64.dll!physx::Scb::Aggregate::removeActor(physx::Scb::Actor & actor, bool reinsert) Line 137 C++
PhysX_64.dll!physx::NpAggregate::removeAndReinsert(physx::PxActor & actor, bool reinsert) Line 78 C++
PhysX_64.dll!physx::NpAggregate::removeActorAndReinsert(physx::PxActor & actor, bool reinsert) Line 201 C++
PhysX_64.dll!physx::NpActor::release(physx::PxActor & owner) Line 181 C++
PhysX_64.dll!physx::NpActorTemplate<physx::PxRigidDynamic>::release() Line 80 C++
PhysX_64.dll!physx::NpRigidActorTemplate<physx::PxRigidDynamic>::release() Line 207 C++
PhysX_64.dll!physx::releaseActorT<physx::PxRigidDynamic,physx::Scb::Body>(physx::NpRigidActorTemplate<physx::PxRigidDynamic> * actor, physx::Scb::Body & scbActor) Line 58 C++
PhysX_64.dll!physx::NpRigidDynamic::release() Line 75 C++
In PVD I can also see, that Aggregate section is empty.
This does not happen, when I create aggregate after PVD connection init.
I have noticed that there is commented out following check about instance validity, which would probably solve my crash
PX_FORCE_INLINE void PvdDetachActorFromAggregate(Scb::Aggregate* pAggregate, Scb::Actor* pScbActor)
{
Scb::Scene* scbScene = pAggregate->getScbSceneForAPI();
if(scbScene/*&& scbScene->getScenePvdClient().isInstanceValid(pAggregate)*/)
scbScene->getScenePvdClient().detachAggregateActor( pAggregate, pScbActor );
}
But I am afraid there is some bigger issue which causes Aggregate not being inserted. Any hints how to solve it?
zemlifr commented
I have found that ScbScenePvdClient::sendEntireScene
is missing section that sends aggregates
Adding following code there seems to resolved my problem:
// aggregates
{
Ps::Array<PxAggregate*> aggregates;
const PxU32 numAggregates = npScene->getNbAggregates();
aggregates.resize(numAggregates);
npScene->getAggregates(aggregates.begin(), aggregates.size());
for (PxU32 i = 0; i < numAggregates; i++)
{
PxAggregate* aggregate = aggregates[i];
mMetaDataBinding.createInstance(*mPvdDataStream, *aggregate, *npScene);
Ps::Array<PxActor*> aggregateActors;
const PxU32 numAggActors = aggregate->getNbActors();
aggregateActors.resize(numAggActors);
aggregate->getActors(aggregateActors.begin(), aggregateActors.size());
for (PxU32 j = 0; j < numAggActors; j++)
{
mMetaDataBinding.attachAggregateActor(*mPvdDataStream, *aggregate, *aggregateActors[j]);
}
}
}