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
path: root/source
diff options
context:
space:
mode:
authorDamien Plisson <damien.plisson@yahoo.fr>2010-02-22 13:29:49 +0300
committerDamien Plisson <damien.plisson@yahoo.fr>2010-02-22 13:29:49 +0300
commitdd03793f4edd455c09a1a2273e5e991dd3bd702b (patch)
treedd46108cef522d0b6faa93de6490af111af3d073 /source
parentb65a983d391edf4c2ee2fcf9c80f4ff074bc6b59 (diff)
OSX : Bugfix [#21293] add OpenMP apple gcc bug workaround for render preview
All openMP calls from a background thread need to have this thread var init workaround
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/render/Makefile6
-rw-r--r--source/blender/editors/render/SConscript4
-rw-r--r--source/blender/editors/render/render_preview.c24
3 files changed, 33 insertions, 1 deletions
diff --git a/source/blender/editors/render/Makefile b/source/blender/editors/render/Makefile
index ed25f0be02a..85b70172e0a 100644
--- a/source/blender/editors/render/Makefile
+++ b/source/blender/editors/render/Makefile
@@ -54,3 +54,9 @@ CPPFLAGS += -I../../render/extern/include
# own include
CPPFLAGS += -I../include
+
+ifeq ($(OS), darwin)
+ ifeq ($(WITH_BF_OPENMP), true)
+ CPPFLAGS += -DPARALLEL=1
+ endif
+endif
diff --git a/source/blender/editors/render/SConscript b/source/blender/editors/render/SConscript
index 575f988544c..2b9737557cd 100644
--- a/source/blender/editors/render/SConscript
+++ b/source/blender/editors/render/SConscript
@@ -24,4 +24,8 @@ if env['WITH_BF_QUICKTIME']:
if env['USE_QTKIT']:
env.Append(CFLAGS=['-DUSE_QTKIT'])
+if env['OURPLATFORM'] == 'darwin':
+ if env['WITH_BF_OPENMP']:
+ env.Append(CFLAGS=['-DPARALLEL=1'])
+
env.BlenderLib ( 'bf_editors_render', sources, Split(incs), [], libtype=['core'], priority=[45])
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 1563c5a8e1d..aca13fbd66d 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -100,6 +100,13 @@
#define PR_XMAX 200
#define PR_YMAX 195
+#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
+/* ************** libgomp (Apple gcc 4.2.1) TLS bug workaround *************** */
+#include <pthread.h>
+extern pthread_key_t gomp_tls_key;
+static void *thread_tls_data;
+#endif
+
/* XXX */
static int qtest() {return 0;}
/* XXX */
@@ -1098,6 +1105,11 @@ static void common_preview_startjob(void *customdata, short *stop, short *do_upd
{
ShaderPreview *sp= customdata;
+#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
+ // Workaround for Apple gcc 4.2.1 omp vs background thread bug
+ pthread_setspecific (gomp_tls_key, thread_tls_data);
+#endif
+
if(sp->pr_method == PR_ICON_RENDER)
icon_preview_startjob(customdata, stop, do_update);
else
@@ -1127,7 +1139,12 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
WM_jobs_customdata(steve, sp, shader_preview_free);
WM_jobs_timer(steve, 0.1, NC_MATERIAL, NC_MATERIAL);
WM_jobs_callbacks(steve, common_preview_startjob, NULL, NULL);
-
+
+#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
+ // Workaround for Apple gcc 4.2.1 omp vs background thread bug
+ thread_tls_data = pthread_getspecific(gomp_tls_key);
+#endif
+
WM_jobs_start(CTX_wm_manager(C), steve);
}
@@ -1154,6 +1171,11 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
WM_jobs_timer(steve, 0.1, NC_MATERIAL, NC_MATERIAL);
WM_jobs_callbacks(steve, common_preview_startjob, NULL, shader_preview_updatejob);
+#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
+ // Workaround for Apple gcc 4.2.1 omp vs background thread bug
+ thread_tls_data = pthread_getspecific(gomp_tls_key);
+#endif
+
WM_jobs_start(CTX_wm_manager(C), steve);
}