CompoundShape problem with ThreadSupport enabled

sandeep_slash
Posts: 48
Joined: Thu Jul 10, 2008 6:36 pm

CompoundShape problem with ThreadSupport enabled

Post by sandeep_slash »

Hello,

I've a CompositeObject and a TriMesh in MultiThreadedDemo.cpp. And I found a problem when MultiThread Support is enabled. (this happens only with CompositeObject)

Code: Select all

in SpuGatheringCollisionTask.cpp

void processCollisionTask(void* userPtr, void* lsMemPtr)
{
             SpuGatherAndProcessPairsTaskDesc* taskDescPtr = (SpuGatherAndProcessPairsTaskDesc*)userPtr;
	SpuGatherAndProcessPairsTaskDesc& taskDesc = *taskDescPtr;
	CollisionTask_LocalStoreMemory*	colMemPtr = (CollisionTask_LocalStoreMemory*)lsMemPtr;
	CollisionTask_LocalStoreMemory& lsMem = *(colMemPtr);
.....
.....
}
After debugging I found that, only the first childShape is valid in "lsMem.compoundShapeData[0].gSubShapes".... rest of them are junk.
And because of this, I'm hitting an assert //unsupported shapetype// in SpuCollisionShapes::getShapeTypeSize(..)

I'm pretty sure that my Composite Object is correct coz it works fine, when MultiThreadSupport is disabled.

What might be the cause?

Thanks,
Sandeep.
sandeep_slash
Posts: 48
Joined: Thu Jul 10, 2008 6:36 pm

Re: CompoundShape problem with ThreadSupport enabled

Post by sandeep_slash »

Anyone?? plzz
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: CompoundShape problem with ThreadSupport enabled

Post by Erwin Coumans »

Thanks for the report, but can you please be more clear in the naming?

Bullet doesn't have a 'composite object'. Did you mean btCompoundShape?

Bullet doesn't have 'trimesh', did you mean btBvhTriangleMeshShape?

Did you make sure to enable quantization for btBvhTriangleMeshShape? It is required for BulletMultiThreaded.
Hope this helps,
Erwin
sandeep_slash
Posts: 48
Joined: Thu Jul 10, 2008 6:36 pm

Re: CompoundShape problem with ThreadSupport enabled

Post by sandeep_slash »

Sorry about the naming...

Yes, I meant btCompoundShape and btBvtTriangleMeshShape.

And I've enabled quantization for btBvtTriangleMeshShape.

This time, I even tried with the ConcacePhysicsDemo's btBvhTriangleMeshShape. I copied that mesh and a simple btCompoundShape into MultiThreadedDemo and tried running it. But it's the same result.

Just for your info... I've pasted my CompoundShape code.

Code: Select all

	btTransform parentTransform;
	parentTransform.setIdentity();
	parentTransform.setOrigin(btVector3(0, 5, 0));

             btTransform childTransform;
             childTransform.setIdentity();

	//Part1
	childTransform.setOrigin(btVector3(0, 1, 0));
	m_pParentShape->addChildShape(childTransform, new btBoxShape(btVector3(1, 1, 1)););

             //Part2
	childTransform.setOrigin(btVector3(0, 2, 0));
	m_pParentShape->addChildShape(childTransform, new btBoxShape(btVector3(1, 1, 1)));

	DemoApplication::localCreateRigidBody(1.0f, parentTransform, m_pParentShape);
I don't see anything wrong with this code. If I don't create the 2nd child, it works fine..
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: CompoundShape problem with ThreadSupport enabled

Post by Erwin Coumans »

Just tried to reproduce your issue with the Demos/ConcaveDemo/ConcavePhysicsDemo, with following modifications:
  • enable define #USE_PARALLEL_DISPATCHER
  • add btCompoundShape
  • add libbulletmultithreaded as link dependency
and all works fine, using SpuGatheringCollisionDispatcher and Win32ThreadSupport.

Can you try out that demo and see if there are issues on your side?
Thanks,
Erwin