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:
authorJeroen Bakker <j.bakker@atmind.nl>2012-05-21 23:31:29 +0400
committerJeroen Bakker <j.bakker@atmind.nl>2012-05-21 23:31:29 +0400
commit564711418d17bbd750a496d119cf0cfaefba2107 (patch)
tree0bb199466efe6dac22a213c086110c06731fc60d /source/blender/compositor
parentff87bdecfeedcb16155448a9cb6fe793f2c452e2 (diff)
Fix for [#31418] Code review: OpenCL initialization
* Moved OpenCL initialization to first use * cleaned up build files * display some debug lines only when debugging is enabled.
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.cpp15
-rw-r--r--source/blender/compositor/intern/COM_compositor.cpp2
2 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index c82a01a1e0a..406f0acf724 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -29,6 +29,7 @@
#include "OCL_opencl.h"
#include "stdio.h"
#include "COM_OpenCLKernels.cl.cpp"
+#include "BKE_global.h"
#if COM_CURRENT_THREADING_MODEL == COM_TM_NOTHREAD
#warning COM_CURRENT_THREADING_MODEL COM_TM_NOTHREAD is activated. Use only for debugging.
@@ -235,7 +236,7 @@ void WorkScheduler::initialize()
cl_int error;
error = clGetPlatformIDs(0, 0, &numberOfPlatforms);
if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
- printf("%d number of platforms\n", numberOfPlatforms);
+ 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);
unsigned int indexPlatform;
@@ -280,11 +281,13 @@ void WorkScheduler::initialize()
OpenCLDevice *clDevice = new OpenCLDevice(context, device, program);
clDevice->initialize(),
gpudevices.push_back(clDevice);
- 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);
+ 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);
+ }
}
delete cldevices;
delete platforms;
diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp
index bd967190987..e27bff4401e 100644
--- a/source/blender/compositor/intern/COM_compositor.cpp
+++ b/source/blender/compositor/intern/COM_compositor.cpp
@@ -29,6 +29,7 @@ extern "C" {
#include "COM_compositor.h"
#include "COM_ExecutionSystem.h"
#include "COM_WorkScheduler.h"
+#include "OCL_opencl.h"
static ThreadMutex *compositorMutex;
void COM_execute(bNodeTree *editingtree, int rendering)
@@ -36,6 +37,7 @@ void COM_execute(bNodeTree *editingtree, int rendering)
if (compositorMutex == NULL) { /// TODO: move to blender startup phase
compositorMutex = new ThreadMutex();
BLI_mutex_init(compositorMutex);
+ OCL_init();
WorkScheduler::initialize(); ///TODO: call workscheduler.deinitialize somewhere
}
BLI_mutex_lock(compositorMutex);