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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-09-03 16:52:21 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-09-03 16:52:21 +0400
commitd6ec4b874b99f096ce2aa1c2864609bb2e4b58ad (patch)
treeee1a946ec1c16be728dfe121d66777f53e87c0f3 /source/blender/compositor/intern/COM_compositor.cpp
parent9fbc1c31496f2ac3d8a7e71ef84cd91353c6c7fb (diff)
Compositor: initialize OpenCL only when the option is enabled. This eliminates
error prints or even crashes for poor OpenCL implementations when not using it.
Diffstat (limited to 'source/blender/compositor/intern/COM_compositor.cpp')
-rw-r--r--source/blender/compositor/intern/COM_compositor.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp
index 7dcb3572a14..daf48d65caf 100644
--- a/source/blender/compositor/intern/COM_compositor.cpp
+++ b/source/blender/compositor/intern/COM_compositor.cpp
@@ -36,24 +36,29 @@ extern "C" {
static ThreadMutex s_compositorMutex;
static char is_compositorMutex_init = FALSE;
+
void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
{
- if (is_compositorMutex_init == FALSE) { /// TODO: move to blender startup phase
- memset(&s_compositorMutex, 0, sizeof(s_compositorMutex));
+ /* initialize mutex, TODO this mutex init is actually not thread safe and
+ * should be done somewhere as part of blender startup, all the other
+ * initializations can be done lazily */
+ if (is_compositorMutex_init == FALSE) {
BLI_mutex_init(&s_compositorMutex);
- OCL_init();
- WorkScheduler::initialize(); ///TODO: call workscheduler.deinitialize somewhere
is_compositorMutex_init = TRUE;
}
+
BLI_mutex_lock(&s_compositorMutex);
+
if (editingtree->test_break(editingtree->tbh)) {
// during editing multiple calls to this method can be triggered.
// make sure one the last one will be doing the work.
BLI_mutex_unlock(&s_compositorMutex);
return;
-
}
+ /* initialize workscheduler, will check if already done. TODO deinitialize somewhere */
+ bool use_opencl = (editingtree->flag & NTREE_COM_OPENCL);
+ WorkScheduler::initialize(use_opencl);
/* set progress bar to 0% and status to init compositing */
editingtree->progress(editingtree->prh, 0.0);
@@ -83,11 +88,12 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
void COM_deinitialize()
{
- if (is_compositorMutex_init)
- {
+ if (is_compositorMutex_init) {
BLI_mutex_lock(&s_compositorMutex);
+
deintializeDistortionCache();
WorkScheduler::deinitialize();
+
is_compositorMutex_init = FALSE;
BLI_mutex_unlock(&s_compositorMutex);
BLI_mutex_end(&s_compositorMutex);