[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58338] trunk/blender: Possible fix for [ #36086] Activating the opencl option in the compositor causes blender crash
Thomas Dinges
blender at dingto.org
Wed Jul 17 14:57:04 CEST 2013
Revision: 58338
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58338
Author: dingto
Date: 2013-07-17 12:57:03 +0000 (Wed, 17 Jul 2013)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/intern/opencl/OCL_opencl.h
trunk/blender/intern/opencl/intern/OCL_opencl.c
trunk/blender/intern/opencl/intern/clew.c
trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp
Modified: trunk/blender/intern/opencl/OCL_opencl.h
===================================================================
--- trunk/blender/intern/opencl/OCL_opencl.h 2013-07-17 11:44:01 UTC (rev 58337)
+++ trunk/blender/intern/opencl/OCL_opencl.h 2013-07-17 12:57:03 UTC (rev 58338)
@@ -28,7 +28,7 @@
#endif
#include "intern/clew.h"
-void OCL_init(void);
+int OCL_init(void);
#ifdef __cplusplus
}
Modified: trunk/blender/intern/opencl/intern/OCL_opencl.c
===================================================================
--- trunk/blender/intern/opencl/intern/OCL_opencl.c 2013-07-17 11:44:01 UTC (rev 58337)
+++ trunk/blender/intern/opencl/intern/OCL_opencl.c 2013-07-17 12:57:03 UTC (rev 58338)
@@ -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 @@
const char *path = "libOpenCL.so";
#endif
- clewInit(path);
+ return (clewInit(path) == CLEW_SUCCESS);
}
Modified: trunk/blender/intern/opencl/intern/clew.c
===================================================================
--- trunk/blender/intern/opencl/intern/clew.c 2013-07-17 11:44:01 UTC (rev 58337)
+++ trunk/blender/intern/opencl/intern/clew.c 2013-07-17 12:57:03 UTC (rev 58338)
@@ -227,6 +227,11 @@
__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;
}
Modified: trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp 2013-07-17 11:44:01 UTC (rev 58337)
+++ trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp 2013-07-17 12:57:03 UTC (rev 58338)
@@ -304,7 +304,8 @@
g_context = NULL;
g_program = NULL;
- OCL_init(); /* this will check and skip if already initialized */
+ if(!OCL_init()) /* this will check for errors and skip if already initialized */
+ return;
if (clCreateContextFromType) {
cl_uint numberOfPlatforms = 0;
More information about the Bf-blender-cvs
mailing list