Move btOclUtils.cpp/h and btOclCommon.cpp/h to btOpenCLUtils.cpp/h

Rename member numerator to m_numerator in btConvexHullComputer.cpp to avoid confusion (Thanks to Ian for the feedback)
Add btSoftBody::addAeroForceToNode and btSoftBody::addAeroForceToFace, thanks to Dongsoo Han/Saggita
This commit is contained in:
erwin.coumans
2011-11-14 22:22:49 +00:00
parent a374f8c0d4
commit 0d1fcf7c48
27 changed files with 877 additions and 723 deletions

View File

@@ -27,8 +27,7 @@ subject to the following restrictions:
#endif //__APPLE__
#include "btOclCommon.h"
#include "btOclUtils.h"
#include "btOpenCLUtils.h"
#include "btBulletDynamicsCommon.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
@@ -337,18 +336,23 @@ void btParticlesDynamicsWorld::initCLKernels(int argc, char** argv)
if (!m_cxMainContext)
{
// m_cxMainContext = clCreateContextFromType(0, CL_DEVICE_TYPE_ALL, NULL, NULL, &ciErrNum);
#ifdef USE_INTEL_OPENCL
m_cxMainContext = btOclCommon::createContextFromType(CL_DEVICE_TYPE_ALL, &ciErrNum);
#else
m_cxMainContext = btOclCommon::createContextFromType(CL_DEVICE_TYPE_GPU, &ciErrNum);
#endif
oclCHECKERROR(ciErrNum, CL_SUCCESS);
m_cdDevice = btOclGetDev(m_cxMainContext,0);
btOclPrintDevInfo(m_cdDevice);
cl_device_type deviceType = CL_DEVICE_TYPE_ALL;
m_cxMainContext = btOpenCLUtils::createContextFromType(deviceType, &ciErrNum, 0, 0);
int numDev = btOpenCLUtils::getNumDevices(m_cxMainContext);
if (!numDev)
{
btAssert(0);
exit(0);//this is just a demo, exit now
}
m_cdDevice = btOpenCLUtils::getDevice(m_cxMainContext,0);
oclCHECKERROR(ciErrNum, CL_SUCCESS);
btOpenCLDeviceInfo clInfo;
btOpenCLUtils::getDeviceInfo(m_cdDevice,clInfo);
btOpenCLUtils::printDeviceInfo(m_cdDevice);
// create a command-queue
m_cqCommandQue = clCreateCommandQueue(m_cxMainContext, m_cdDevice, 0, &ciErrNum);
@@ -440,7 +444,7 @@ void btParticlesDynamicsWorld::initCLKernels(int argc, char** argv)
char cBuildLog[10240];
// char* cPtx;
// size_t szPtxLength;
clGetProgramBuildInfo(m_cpProgram, btOclGetFirstDev(m_cxMainContext), CL_PROGRAM_BUILD_LOG,
clGetProgramBuildInfo(m_cpProgram, m_cdDevice, CL_PROGRAM_BUILD_LOG,
sizeof(cBuildLog), cBuildLog, NULL );
// oclGetProgBinary(m_cpProgram, oclGetFirstDev(m_cxMainContext), &cPtx, &szPtxLength);
// oclLog(LOGBOTH | CLOSELOG, 0.0, "\n\nLog:\n%s\n\n\n\n\nPtx:\n%s\n\n\n", cBuildLog, cPtx);