diff --git a/Demos/OpenCLClothDemo/cl_cloth_demo.cpp b/Demos/OpenCLClothDemo/cl_cloth_demo.cpp index e5c1a825c..762f67364 100644 --- a/Demos/OpenCLClothDemo/cl_cloth_demo.cpp +++ b/Demos/OpenCLClothDemo/cl_cloth_demo.cpp @@ -16,7 +16,6 @@ subject to the following restrictions: #ifdef _WIN32 #include #endif -#ifndef __APPLE__ #ifndef USE_MINICL #define USE_SIMDAWARE_SOLVER @@ -25,7 +24,6 @@ subject to the following restrictions: #define USE_GPU_COPY //only tested on Windows, may work under Linux #endif //_WIN32 #endif //USE_MINICL -#endif diff --git a/Demos/OpenCLClothDemo/clstuff.cpp b/Demos/OpenCLClothDemo/clstuff.cpp index 856d6b801..ff84e0828 100644 --- a/Demos/OpenCLClothDemo/clstuff.cpp +++ b/Demos/OpenCLClothDemo/clstuff.cpp @@ -32,24 +32,38 @@ void initCL( void* glCtx, void* glDC ) int ciErrNum = 0; #if defined(CL_PLATFORM_MINI_CL) - cl_device_type deviceType = CL_DEVICE_TYPE_CPU; + cl_device_type deviceType = CL_DEVICE_TYPE_CPU;//or use CL_DEVICE_TYPE_DEBUG to debug MiniCL #elif defined(CL_PLATFORM_AMD) cl_device_type deviceType = CL_DEVICE_TYPE_GPU; #elif defined(CL_PLATFORM_NVIDIA) cl_device_type deviceType = CL_DEVICE_TYPE_GPU; #else - cl_device_type deviceType = CL_DEVICE_TYPE_CPU; +#ifdef __APPLE__ + cl_device_type deviceType = CL_DEVICE_TYPE_GPU; +#else + cl_device_type deviceType = CL_DEVICE_TYPE_CPU;//CL_DEVICE_TYPE_ALL +#endif//__APPLE__ #endif - - //g_cxMainContext = btOclCommon::createContextFromType(CL_DEVICE_TYPE_ALL, &ciErrNum); - //g_cxMainContext = btOclCommon::createContextFromType(CL_DEVICE_TYPE_GPU, &ciErrNum); - //g_cxMainContext = btOclCommon::createContextFromType(CL_DEVICE_TYPE_CPU, &ciErrNum); - //try CL_DEVICE_TYPE_DEBUG for sequential, non-threaded execution, when using MiniCL on CPU, it gives a full callstack at the crash in the kernel -//#ifdef USE_MINICL -// g_cxMainContext = btOclCommon::createContextFromType(CL_DEVICE_TYPE_DEBUG, &ciErrNum); -//#else + g_cxMainContext = btOclCommon::createContextFromType(deviceType, &ciErrNum, glCtx, glDC); -//#endif + + switch (deviceType) + { + case CL_DEVICE_TYPE_GPU: + printf("createContextFromType(CL_DEVICE_TYPE_GPU)\n"); + break; + case CL_DEVICE_TYPE_CPU: + printf("createContextFromType(CL_DEVICE_TYPE_CPU)\n"); + break; + case CL_DEVICE_TYPE_ALL: + printf("createContextFromType(CL_DEVICE_TYPE_ALL)\n"); + break; + + default: + printf("createContextFromType(unknown device type %d\n",deviceType); + }; + + //#endif diff --git a/Demos/SharedOpenCL/btOclCommon.cpp b/Demos/SharedOpenCL/btOclCommon.cpp index c7bbe8df3..a169c5752 100644 --- a/Demos/SharedOpenCL/btOclCommon.cpp +++ b/Demos/SharedOpenCL/btOclCommon.cpp @@ -30,7 +30,9 @@ static char* spPlatformVendor = #endif #ifndef CL_PLATFORM_MINI_CL +#ifdef _WIN32 #include "CL/cl_gl.h" +#endif //_WIN32 #endif cl_context btOclCommon::createContextFromType(cl_device_type deviceType, cl_int* pErrNum, void* pGLContext, void* pGLDC ) @@ -88,6 +90,7 @@ cl_context btOclCommon::createContextFromType(cl_device_type deviceType, cl_int* 0 }; #ifndef CL_PLATFORM_MINI_CL +#ifdef _WIN32 // If we have a gl context then enable interop if( pGLContext ) { @@ -96,6 +99,7 @@ cl_context btOclCommon::createContextFromType(cl_device_type deviceType, cl_int* cps[4] = CL_WGL_HDC_KHR; cps[5] = (cl_context_properties)pGLDC; } +#endif #endif //CL_PLATFORM_MINI_CL /* Use NULL for backward compatibility */ diff --git a/Demos/SharedOpenCL/btOclCommon.h b/Demos/SharedOpenCL/btOclCommon.h index ae3cd8344..42a222d9f 100644 --- a/Demos/SharedOpenCL/btOclCommon.h +++ b/Demos/SharedOpenCL/btOclCommon.h @@ -20,7 +20,7 @@ subject to the following restrictions: #ifdef USE_MINICL #include #else - #include + #include #endif #else #ifdef USE_MINICL diff --git a/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolver_OpenCL.cpp b/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolver_OpenCL.cpp index 357bb6c4e..3d8d9e776 100644 --- a/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolver_OpenCL.cpp +++ b/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolver_OpenCL.cpp @@ -1601,7 +1601,7 @@ void btOpenCLSoftBodySolver::processCollision( btSoftBody *softBody, btCollision m_collisionObjectDetails.push_back( newCollisionShapeDescription ); } else { - btAssert("Unsupported collision shape type\n"); + btAssert(0 && "Unsupported collision shape type\n"); } } else { btAssert("Unknown soft body");