Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonique Dewanchand <m.dewanchand@atmind.nl>2012-05-31 01:09:50 +0400
committerMonique Dewanchand <m.dewanchand@atmind.nl>2012-05-31 01:09:50 +0400
commit722ce85ff6876ab85b7e934724e89fe24241f670 (patch)
treef9c4e9b267454523b5ff4ddddbf0d7f5d9123e78 /source/blender/compositor
parentb3bc5edffc052e707604eb07efd2f8260c9bd63c (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.cpp32
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);
+ }
}
}
}