fixes to make the OpenCL cloth demo run on Apple/GPU

This commit is contained in:
erwin.coumans
2011-03-15 22:24:27 +00:00
parent 3615f6d415
commit 21162f77e3
5 changed files with 31 additions and 15 deletions

View File

@@ -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