Fix ternary selection operator on float scalars in OpenCL kernels.
According to Section 6.3(i) of the OpenCL 1.1 specification, the first expression of the operator cannot be a float.
This commit is contained in:
@@ -410,8 +410,8 @@ __kernel void initBatchConstraintsKernel(__global unsigned int* numConstraintRow
|
|||||||
int rbA = constraints[i].m_rbA;
|
int rbA = constraints[i].m_rbA;
|
||||||
int rbB = constraints[i].m_rbB;
|
int rbB = constraints[i].m_rbB;
|
||||||
|
|
||||||
batchConstraints[i].m_bodyAPtrAndSignBit = bodies[rbA].m_invMass? rbA : -rbA;
|
batchConstraints[i].m_bodyAPtrAndSignBit = bodies[rbA].m_invMass != 0.f ? rbA : -rbA;
|
||||||
batchConstraints[i].m_bodyBPtrAndSignBit = bodies[rbB].m_invMass? rbB : -rbB;
|
batchConstraints[i].m_bodyBPtrAndSignBit = bodies[rbB].m_invMass != 0.f ? rbB : -rbB;
|
||||||
batchConstraints[i].m_batchId = -1;
|
batchConstraints[i].m_batchId = -1;
|
||||||
batchConstraints[i].m_originalConstraintIndex = i;
|
batchConstraints[i].m_originalConstraintIndex = i;
|
||||||
|
|
||||||
|
|||||||
@@ -325,8 +325,8 @@ static const char* solveConstraintRowsCL= \
|
|||||||
" return;\n"
|
" return;\n"
|
||||||
" int rbA = constraints[i].m_rbA;\n"
|
" int rbA = constraints[i].m_rbA;\n"
|
||||||
" int rbB = constraints[i].m_rbB;\n"
|
" int rbB = constraints[i].m_rbB;\n"
|
||||||
" batchConstraints[i].m_bodyAPtrAndSignBit = bodies[rbA].m_invMass? rbA : -rbA;\n"
|
" batchConstraints[i].m_bodyAPtrAndSignBit = bodies[rbA].m_invMass != 0.f ? rbA : -rbA;\n"
|
||||||
" batchConstraints[i].m_bodyBPtrAndSignBit = bodies[rbB].m_invMass? rbB : -rbB;\n"
|
" batchConstraints[i].m_bodyBPtrAndSignBit = bodies[rbB].m_invMass != 0.f ? rbB : -rbB;\n"
|
||||||
" batchConstraints[i].m_batchId = -1;\n"
|
" batchConstraints[i].m_batchId = -1;\n"
|
||||||
" batchConstraints[i].m_originalConstraintIndex = i;\n"
|
" batchConstraints[i].m_originalConstraintIndex = i;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
|||||||
@@ -954,8 +954,8 @@ float positionConstraintCoeff
|
|||||||
|
|
||||||
Constraint4 cs;
|
Constraint4 cs;
|
||||||
|
|
||||||
float countA = invMassA ? (float)bodyCount[aIdx] : 1;
|
float countA = invMassA != 0.f ? (float)bodyCount[aIdx] : 1;
|
||||||
float countB = invMassB ? (float)bodyCount[bIdx] : 1;
|
float countB = invMassB != 0.f ? (float)bodyCount[bIdx] : 1;
|
||||||
|
|
||||||
setConstraint4( posA, linVelA, angVelA, invMassA, invInertiaA, posB, linVelB, angVelB, invMassB, invInertiaB,
|
setConstraint4( posA, linVelA, angVelA, invMassA, invInertiaA, posB, linVelB, angVelB, invMassB, invInertiaB,
|
||||||
&gContact[gIdx], dt, positionDrift, positionConstraintCoeff,countA,countB,
|
&gContact[gIdx], dt, positionDrift, positionConstraintCoeff,countA,countB,
|
||||||
|
|||||||
@@ -896,8 +896,8 @@ static const char* solverUtilsCL= \
|
|||||||
" float invMassB = gBodies[bIdx].m_invMass;\n"
|
" float invMassB = gBodies[bIdx].m_invMass;\n"
|
||||||
" Matrix3x3 invInertiaB = gShapes[bIdx].m_invInertia;\n"
|
" Matrix3x3 invInertiaB = gShapes[bIdx].m_invInertia;\n"
|
||||||
" Constraint4 cs;\n"
|
" Constraint4 cs;\n"
|
||||||
" float countA = invMassA ? (float)bodyCount[aIdx] : 1;\n"
|
" float countA = invMassA != 0.f ? (float)bodyCount[aIdx] : 1;\n"
|
||||||
" float countB = invMassB ? (float)bodyCount[bIdx] : 1;\n"
|
" float countB = invMassB != 0.f ? (float)bodyCount[bIdx] : 1;\n"
|
||||||
" setConstraint4( posA, linVelA, angVelA, invMassA, invInertiaA, posB, linVelB, angVelB, invMassB, invInertiaB,\n"
|
" setConstraint4( posA, linVelA, angVelA, invMassA, invInertiaA, posB, linVelB, angVelB, invMassB, invInertiaB,\n"
|
||||||
" &gContact[gIdx], dt, positionDrift, positionConstraintCoeff,countA,countB,\n"
|
" &gContact[gIdx], dt, positionDrift, positionConstraintCoeff,countA,countB,\n"
|
||||||
" &cs );\n"
|
" &cs );\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user