I've linked my app against a debug version of Bullet and I created a test scene that generates a triangle mesh for static collision ground and a bunch of dynamic spheres and boxes.
Everyting works when running Bullet in Single threaded mode. Everything works fine when I make the dispatcher multithreaded. But I crash when I run the solver multithreaded.
I've initialized Bullet the same way its done in the Multithreaded demo, but on first body contact, Bullet crashes in CustomSetupConstraintsTask(). The pfxGetRigidbodyId*() of one of the bodies is invalid (65534).
Code :
Code: Select all
void CustomSetupContactConstraintsTask(
PfxConstraintPair *contactPairs,uint32_t numContactPairs,
btPersistentManifold* offsetContactManifolds,
TrbState *offsetRigStates,
PfxSolverBody *offsetSolverBodies,
uint32_t numRigidBodies,
float separateBias,
float timeStep)
{
for(uint32_t i=0;i<numContactPairs;i++) {
PfxConstraintPair &pair = contactPairs[i];
if(!pfxGetActive(pair) || pfxGetNumConstraints(pair) == 0 ||
((pfxGetMotionMaskA(pair)&PFX_MOTION_MASK_STATIC) && (pfxGetMotionMaskB(pair)&PFX_MOTION_MASK_STATIC)) ) {
continue;
}
uint16_t iA = pfxGetRigidBodyIdA(pair); [color=#FF0000]<< returns bad value, will over shoot offsetSolverBodies[] later on[/color]
uint16_t iB = pfxGetRigidBodyIdB(pair);
numContactPairs 1 unsigned int
- pair {i8data=0x0edadc80 "þÿ" i16data=0x0edadc80 "�ʀĐ" i32data=0x0edadc80 } PfxSortData16 &
+ i8data 0x0edadc80 "þÿ" unsigned char [16]
- i16data 0x0edadc80 "�ʀĐ" unsigned short [8]
[0] 65534 unsigned short
[1] 19 unsigned short
[2] 640 unsigned short
[3] 272 unsigned short
[4] 2 unsigned short
[5] 0 unsigned short
[6] 0 unsigned short
[7] 0 unsigned short
+ i32data 0x0edadc80 unsigned int [4]
Stack :
> app.exe!CustomSetupContactConstraintsTask(PfxSortData16 * contactPairs=0x0edadc80, unsigned int numContactPairs=1, btPersistentManifold * offsetContactManifolds=0x194a0050, TrbState * offsetRigStates=0x1bd3cc70, PfxSolverBody * offsetSolverBodies=0x1412e540, unsigned int numRigidBodies=60, float separateBias=0.10000000, float timeStep=0.016666668) Line 435 + 0x6 bytes C++
app.exe!SolverThreadFunc(void * userPtr=0x1bd10a58, void * lsMemory=0x00000000) Line 536 + 0x46 bytes C++
app.exe!Thread_no_1(void * lpParam=0x1bd10310) Line 69 + 0x15 bytes C++