added a variation of the constraint solver, that works on CPU OpenCL (oneBigBatch), one stage (batching) happens on CPU for this mode

This commit is contained in:
erwin coumans
2013-11-20 22:54:04 -08:00
committed by erwincoumans
parent 1d5c651753
commit 8a7ad65177
9 changed files with 352 additions and 141 deletions

View File

@@ -476,3 +476,22 @@ void BatchSolveKernelContact(__global Body* gBodies,
}
__kernel void solveSingleContactKernel(__global Body* gBodies,
__global Shape* gShapes,
__global Constraint4* gConstraints,
int cellIdx,
int batchOffset,
int numConstraintsInBatch
)
{
int index = get_global_id(0);
if (index < numConstraintsInBatch)
{
int idx=batchOffset+index;
solveContactConstraint( gBodies, gShapes, &gConstraints[idx] );
}
}

View File

@@ -371,4 +371,19 @@ static const char* solveContactCL= \
" \n"
" \n"
"}\n"
"__kernel void solveSingleContactKernel(__global Body* gBodies,\n"
" __global Shape* gShapes,\n"
" __global Constraint4* gConstraints,\n"
" int cellIdx,\n"
" int batchOffset,\n"
" int numConstraintsInBatch\n"
" )\n"
"{\n"
" int index = get_global_id(0);\n"
" if (index < numConstraintsInBatch)\n"
" {\n"
" int idx=batchOffset+index;\n"
" solveContactConstraint( gBodies, gShapes, &gConstraints[idx] );\n"
" } \n"
"}\n"
;

View File

@@ -498,3 +498,27 @@ void BatchSolveKernelFriction(__global Body* gBodies,
}
__kernel void solveSingleFrictionKernel(__global Body* gBodies,
__global Shape* gShapes,
__global Constraint4* gConstraints,
int cellIdx,
int batchOffset,
int numConstraintsInBatch
)
{
int index = get_global_id(0);
if (index < numConstraintsInBatch)
{
int idx=batchOffset+index;
solveFrictionConstraint( gBodies, gShapes, &gConstraints[idx] );
}
}

View File

@@ -399,4 +399,21 @@ static const char* solveFrictionCL= \
" \n"
" \n"
"}\n"
"__kernel void solveSingleFrictionKernel(__global Body* gBodies,\n"
" __global Shape* gShapes,\n"
" __global Constraint4* gConstraints,\n"
" int cellIdx,\n"
" int batchOffset,\n"
" int numConstraintsInBatch\n"
" )\n"
"{\n"
" int index = get_global_id(0);\n"
" if (index < numConstraintsInBatch)\n"
" {\n"
" \n"
" int idx=batchOffset+index;\n"
" \n"
" solveFrictionConstraint( gBodies, gShapes, &gConstraints[idx] );\n"
" } \n"
"}\n"
;