[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47245] trunk/blender/source/blender/ compositor/intern/COM_WorkScheduler.cpp: Fix for
Monique Dewanchand
m.dewanchand at atmind.nl
Wed May 30 23:09:50 CEST 2012
Revision: 47245
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47245
Author: mdewanchand
Date: 2012-05-30 21:09:50 +0000 (Wed, 30 May 2012)
Log Message:
-----------
Fix for
[#31562] New compositor crashes due to incorrect opencl initialization
Modified Paths:
--------------
trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp
Modified: trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp 2012-05-30 19:21:22 UTC (rev 47244)
+++ trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp 2012-05-30 21:09:50 UTC (rev 47245)
@@ -232,11 +232,10 @@
context = NULL;
program = NULL;
if (clCreateContextFromType) {
- cl_uint numberOfPlatforms;
+ cl_uint numberOfPlatforms = 0;
cl_int error;
error = clGetPlatformIDs(0, 0, &numberOfPlatforms);
if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
- numberOfPlatforms = 0;
if (G.f & G_DEBUG) printf("%d number of platforms\n", numberOfPlatforms);
cl_platform_id *platforms = new cl_platform_id[numberOfPlatforms];
error = clGetPlatformIDs(numberOfPlatforms, platforms, 0);
@@ -265,7 +264,7 @@
error = clBuildProgram(program, totalNumberOfDevices, cldevices, 0, 0, 0);
if (error != CL_SUCCESS) {
cl_int error2;
- size_t ret_val_size;
+ size_t ret_val_size = 0;
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size);
if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
@@ -276,19 +275,20 @@
printf("%s", build_log);
delete build_log;
- }
- unsigned int indexDevices;
- for (indexDevices = 0 ; indexDevices < totalNumberOfDevices ; indexDevices ++) {
- cl_device_id device = cldevices[indexDevices];
- OpenCLDevice *clDevice = new OpenCLDevice(context, device, program);
- clDevice->initialize(),
- gpudevices.push_back(clDevice);
- if (G.f & G_DEBUG) {
- char resultString[32];
- error = clGetDeviceInfo(device, CL_DEVICE_NAME, 32, resultString, 0);
- printf("OPENCL_DEVICE: %s, ", resultString);
- error = clGetDeviceInfo(device, CL_DEVICE_VENDOR, 32, resultString, 0);
- printf("%s\n", resultString);
+ } else {
+ unsigned int indexDevices;
+ for (indexDevices = 0 ; indexDevices < totalNumberOfDevices ; indexDevices ++) {
+ cl_device_id device = cldevices[indexDevices];
+ OpenCLDevice *clDevice = new OpenCLDevice(context, device, program);
+ clDevice->initialize(),
+ gpudevices.push_back(clDevice);
+ if (G.f & G_DEBUG) {
+ char resultString[32];
+ error = clGetDeviceInfo(device, CL_DEVICE_NAME, 32, resultString, 0);
+ printf("OPENCL_DEVICE: %s, ", resultString);
+ error = clGetDeviceInfo(device, CL_DEVICE_VENDOR, 32, resultString, 0);
+ printf("%s\n", resultString);
+ }
}
}
}
More information about the Bf-blender-cvs
mailing list