diff options
author | Thomas Dinges <blender@dingto.org> | 2013-07-17 16:57:03 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2013-07-17 16:57:03 +0400 |
commit | c7e2c3f5e1e2c6e94511f89369af2fcd7e7fd8e9 (patch) | |
tree | a6e02dd917c50a950535c8960fe4e192515fcdb3 /intern/opencl | |
parent | a9eccaf85eb590d6ec8a44f687898045b3b49404 (diff) |
Possible fix for [#36086] Activating the opencl option in the compositor causes blender crash
* Now OCL_init() returns error messages if the OpenCL library cannot be loaded.
Diffstat (limited to 'intern/opencl')
-rw-r--r-- | intern/opencl/OCL_opencl.h | 2 | ||||
-rw-r--r-- | intern/opencl/intern/OCL_opencl.c | 4 | ||||
-rw-r--r-- | intern/opencl/intern/clew.c | 5 |
3 files changed, 8 insertions, 3 deletions
diff --git a/intern/opencl/OCL_opencl.h b/intern/opencl/OCL_opencl.h index 4ee167b2fb4..733e3527197 100644 --- a/intern/opencl/OCL_opencl.h +++ b/intern/opencl/OCL_opencl.h @@ -28,7 +28,7 @@ extern "C" { #endif #include "intern/clew.h" -void OCL_init(void); +int OCL_init(void); #ifdef __cplusplus } diff --git a/intern/opencl/intern/OCL_opencl.c b/intern/opencl/intern/OCL_opencl.c index e3130e16bde..33a936896fd 100644 --- a/intern/opencl/intern/OCL_opencl.c +++ b/intern/opencl/intern/OCL_opencl.c @@ -22,7 +22,7 @@ #include "OCL_opencl.h" -void OCL_init(void) +int OCL_init(void) { #ifdef _WIN32 const char *path = "OpenCL.dll"; @@ -32,6 +32,6 @@ void OCL_init(void) const char *path = "libOpenCL.so"; #endif - clewInit(path); + return (clewInit(path) == CLEW_SUCCESS); } diff --git a/intern/opencl/intern/clew.c b/intern/opencl/intern/clew.c index d68eb17288f..1e31ebced0a 100644 --- a/intern/opencl/intern/clew.c +++ b/intern/opencl/intern/clew.c @@ -227,6 +227,11 @@ int clewInit(const char* path) __oclEnqueueWaitForEvents = (PFNCLENQUEUEWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents"); __oclEnqueueBarrier = (PFNCLENQUEUEBARRIER )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier"); __oclGetExtensionFunctionAddress = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress"); + + if(__oclGetPlatformIDs == NULL) return CLEW_ERROR_OPEN_FAILED; + if(__oclGetPlatformInfo == NULL) return CLEW_ERROR_OPEN_FAILED; + if(__oclGetDeviceIDs == NULL) return CLEW_ERROR_OPEN_FAILED; + if(__oclGetDeviceInfo == NULL) return CLEW_ERROR_OPEN_FAILED; return CLEW_SUCCESS; } |