fix cpu version of findCompoundPairs, in order to fix Mac OSX OpenCL compound issues
This commit is contained in:
@@ -3340,7 +3340,6 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
|
|||||||
b3AlignedObjectArray<b3RigidBodyCL> hostBodyBuf;
|
b3AlignedObjectArray<b3RigidBodyCL> hostBodyBuf;
|
||||||
bodyBuf->copyToHost(hostBodyBuf);
|
bodyBuf->copyToHost(hostBodyBuf);
|
||||||
|
|
||||||
int numCompoundPairsOut=0;
|
|
||||||
|
|
||||||
b3AlignedObjectArray<b3Int4> cpuCompoundPairsOut;
|
b3AlignedObjectArray<b3Int4> cpuCompoundPairsOut;
|
||||||
cpuCompoundPairsOut.resize(compoundPairCapacity);
|
cpuCompoundPairsOut.resize(compoundPairCapacity);
|
||||||
@@ -3366,7 +3365,8 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
|
|||||||
int bodyIndexB = hostPairs[pairIndex].y;
|
int bodyIndexB = hostPairs[pairIndex].y;
|
||||||
int collidableIndexA = hostBodyBuf[bodyIndexA].m_collidableIdx;
|
int collidableIndexA = hostBodyBuf[bodyIndexA].m_collidableIdx;
|
||||||
int collidableIndexB = hostBodyBuf[bodyIndexB].m_collidableIdx;
|
int collidableIndexB = hostBodyBuf[bodyIndexB].m_collidableIdx;
|
||||||
|
if (cpuChildShapes.size())
|
||||||
|
{
|
||||||
findCompoundPairsKernel(
|
findCompoundPairsKernel(
|
||||||
pairIndex,
|
pairIndex,
|
||||||
bodyIndexA,
|
bodyIndexA,
|
||||||
@@ -3381,19 +3381,30 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
|
|||||||
hostAabbsLocalSpace,
|
hostAabbsLocalSpace,
|
||||||
&cpuChildShapes[0],
|
&cpuChildShapes[0],
|
||||||
&cpuCompoundPairsOut[0],
|
&cpuCompoundPairsOut[0],
|
||||||
&numCompoundPairsOut,
|
&numCompoundPairs,
|
||||||
compoundPairCapacity,
|
compoundPairCapacity,
|
||||||
treeNodesCPU,
|
treeNodesCPU,
|
||||||
subTreesCPU,
|
subTreesCPU,
|
||||||
bvhInfoCPU
|
bvhInfoCPU
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (numCompoundPairsOut)
|
|
||||||
{
|
|
||||||
// printf("numCompoundPairsOut=%d\n",numCompoundPairsOut);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
m_numCompoundPairsOut.copyFromHostPointer(&numCompoundPairs,1,0,true);
|
||||||
|
if (numCompoundPairs)
|
||||||
|
{
|
||||||
|
b3CompoundOverlappingPair* ptr = (b3CompoundOverlappingPair*)&cpuCompoundPairsOut[0];
|
||||||
|
m_gpuCompoundPairs.copyFromHostPointer(ptr,numCompoundPairs,0,true);
|
||||||
|
}
|
||||||
|
//cpuCompoundPairsOut
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (numCompoundPairs)
|
||||||
|
{
|
||||||
|
printf("numCompoundPairs=%d\n",numCompoundPairs);
|
||||||
|
}
|
||||||
|
|
||||||
if (numCompoundPairs > compoundPairCapacity)
|
if (numCompoundPairs > compoundPairCapacity)
|
||||||
{
|
{
|
||||||
b3Error("Exceeded compound pair capacity (%d/%d)\n", numCompoundPairs, compoundPairCapacity);
|
b3Error("Exceeded compound pair capacity (%d/%d)\n", numCompoundPairs, compoundPairCapacity);
|
||||||
|
|||||||
Reference in New Issue
Block a user