From d5dcb341888a1d406cfe138a5b09ddf181084d7b Mon Sep 17 00:00:00 2001 From: Michael Mc Donnell Date: Thu, 25 Aug 2016 21:40:55 -0700 Subject: [PATCH 1/2] [Bullet3OpenCL] Fix wrong parantheses around b3Fabs The absolute value of m_appliedImpulse was supposed to be compared to the breakingThreshold. Instead a boolean was created from the comparison, and the absolute value of that was taken (which makes no sense). --- src/Bullet3OpenCL/RigidBody/b3GpuPgsConstraintSolver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bullet3OpenCL/RigidBody/b3GpuPgsConstraintSolver.cpp b/src/Bullet3OpenCL/RigidBody/b3GpuPgsConstraintSolver.cpp index 4d14bc428..ad477e25d 100644 --- a/src/Bullet3OpenCL/RigidBody/b3GpuPgsConstraintSolver.cpp +++ b/src/Bullet3OpenCL/RigidBody/b3GpuPgsConstraintSolver.cpp @@ -1071,7 +1071,7 @@ b3Scalar b3GpuPgsConstraintSolver::solveGroupCacheFriendlyFinish(b3OpenCLArraym_cpuConstraintRows[rowIndex].m_originalConstraintIndex; float breakingThreshold = m_gpuData->m_cpuConstraints[orgConstraintIndex].m_breakingImpulseThreshold; // printf("rows[%d].m_appliedImpulse=%f\n",rowIndex,rows[rowIndex].m_appliedImpulse); - if (b3Fabs((m_gpuData->m_cpuConstraintRows[rowIndex].m_appliedImpulse) >= breakingThreshold)) + if (b3Fabs(m_gpuData->m_cpuConstraintRows[rowIndex].m_appliedImpulse) >= breakingThreshold) { m_gpuData->m_cpuConstraints[orgConstraintIndex].m_flags =0;//&= ~B3_CONSTRAINT_FLAG_ENABLED; From 4636efae2bc8ae80cb20b88b0f6bc76d2fed1f6f Mon Sep 17 00:00:00 2001 From: Michael Mc Donnell Date: Thu, 25 Aug 2016 21:50:45 -0700 Subject: [PATCH 2/2] [Bullet3OpenCL] Fix check for null-terminated string The code essentially dead because it was checking the pointer to an array for null. The check will alway return true. Instead the code was meant to check if the string had anything in it after the call to clGetDeviceInfo. --- src/Bullet3OpenCL/Initialize/b3OpenCLUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bullet3OpenCL/Initialize/b3OpenCLUtils.cpp b/src/Bullet3OpenCL/Initialize/b3OpenCLUtils.cpp index 369f1d750..0287e0e5d 100644 --- a/src/Bullet3OpenCL/Initialize/b3OpenCLUtils.cpp +++ b/src/Bullet3OpenCL/Initialize/b3OpenCLUtils.cpp @@ -560,7 +560,7 @@ void b3OpenCLUtils_printDeviceInfo(cl_device_id device) b3Printf("\t\t\t\t\t3D_MAX_WIDTH\t %u\n", info.m_image3dMaxWidth); b3Printf("\t\t\t\t\t3D_MAX_HEIGHT\t %u\n", info.m_image3dMaxHeight); b3Printf("\t\t\t\t\t3D_MAX_DEPTH\t %u\n", info.m_image3dMaxDepth); - if (info.m_deviceExtensions != 0) + if (*info.m_deviceExtensions != 0) { b3Printf("\n CL_DEVICE_EXTENSIONS:%s\n",info.m_deviceExtensions); }