fixes to make the OpenCL cloth demo run on Apple/GPU
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user