diff options
author | Monique Dewanchand <m.dewanchand@atmind.nl> | 2012-05-31 01:09:50 +0400 |
---|---|---|
committer | Monique Dewanchand <m.dewanchand@atmind.nl> | 2012-05-31 01:09:50 +0400 |
commit | 722ce85ff6876ab85b7e934724e89fe24241f670 (patch) | |
tree | f9c4e9b267454523b5ff4ddddbf0d7f5d9123e78 /source/blender/compositor | |
parent | b3bc5edffc052e707604eb07efd2f8260c9bd63c (diff) |
Fix for
[#31562] New compositor crashes due to incorrect opencl initialization
Diffstat (limited to 'source/blender/compositor')
-rw-r--r-- | source/blender/compositor/intern/COM_WorkScheduler.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index 925ff904cc0..7d709dd919c 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -232,11 +232,10 @@ void WorkScheduler::initialize() 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 @@ void WorkScheduler::initialize() 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 @@ void WorkScheduler::initialize() 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); + } } } } |