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:
committed by
erwincoumans
parent
1d5c651753
commit
8a7ad65177
@@ -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] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
;
|
||||
|
||||
@@ -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] );
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user