Check for weakly linked OpenCL.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5811 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-06-29 10:23:40 +00:00
parent aa43f0a575
commit 4afe48a0fb

View File

@ -44,13 +44,16 @@ bool Initialize()
#if defined(HAVE_OPENCL) && HAVE_OPENCL #if defined(HAVE_OPENCL) && HAVE_OPENCL
if(g_context) if(g_context)
return false; return false;
int err; // error code returned from api calls int err; // error code returned from api calls
#ifdef _WIN32 #ifdef _WIN32
clrInit(); clrInit();
if(!clrHasOpenCL()) if(!clrHasOpenCL())
return false; return false;
#endif #endif
// If OpenCL is weakly linked and not found, its symbols will be NULL
if (clGetPlatformIDs == NULL)
return false;
// Connect to a compute device // Connect to a compute device
cl_uint numPlatforms; cl_uint numPlatforms;
@ -173,8 +176,8 @@ cl_kernel CompileKernel(cl_program program, const char *Function)
cl_kernel kernel = clCreateKernel(program, Function, &err); cl_kernel kernel = clCreateKernel(program, Function, &err);
if (!kernel || err != CL_SUCCESS) if (!kernel || err != CL_SUCCESS)
{ {
char buffer[1024]; char buffer[1024];
sprintf(buffer, "Failed to create compute kernel '%s' !", Function); sprintf(buffer, "Failed to create compute kernel '%s' !", Function);
HandleCLError(err, buffer); HandleCLError(err, buffer);
return NULL; return NULL;
} }