fixes to make the OpenCL cloth demo run on Apple/GPU
This commit is contained in:
@@ -16,7 +16,6 @@ subject to the following restrictions:
|
||||
#ifdef _WIN32
|
||||
#include <GL/glew.h>
|
||||
#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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -32,23 +32,37 @@ 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);
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -20,7 +20,7 @@ subject to the following restrictions:
|
||||
#ifdef USE_MINICL
|
||||
#include <MiniCL/cl.h>
|
||||
#else
|
||||
#include <MiniCL/cl.h>
|
||||
#include <OpenCL/cl.h>
|
||||
#endif
|
||||
#else
|
||||
#ifdef USE_MINICL
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user