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:
authorTon Roosendaal <ton@blender.org>2005-06-03 22:44:01 +0400
committerTon Roosendaal <ton@blender.org>2005-06-03 22:44:01 +0400
commit0f82931e5fe89ed245a03a4608e524c2423c0d64 (patch)
treec14e4b2d0e38e6670522749fb556092db81d827b
parent3d6a159b0b615c589daa5ac682165542bb732e7b (diff)
Added threadsafe patch from Martin.
Now envmaps of type "Load" should not give errors. I assume Martin tested!
-rw-r--r--source/blender/render/intern/source/envmap.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index 37af5f77c82..168fe271f13 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -64,6 +64,10 @@
#include "MTC_matrixops.h"
+#include "SDL_thread.h"
+#undef main
+#define main main /* stupid SDL_main redefines main as SDL_main */
+
/* this module */
#include "RE_callbacks.h"
#include "render.h"
@@ -634,6 +638,7 @@ static void set_dxtdyt(float *dxts, float *dyts, float *dxt, float *dyt, int fac
int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
{
+ extern SDL_mutex *load_ibuf_lock; // initrender.c
/* texvec should be the already reflected normal */
EnvMap *env;
Image *ima;
@@ -648,8 +653,10 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
if(env->stype==ENV_LOAD) {
env->ima= tex->ima;
if(env->ima && env->ima->ok) {
- // not threadsafe yet!
+ // Now thread safe
+ if(load_ibuf_lock) SDL_mutexP(load_ibuf_lock);
if(env->ima->ibuf==NULL) ima_ibuf_is_nul(tex, tex->ima);
+ if(load_ibuf_lock) SDL_mutexV(load_ibuf_lock);
if(env->ima->ok && env->ok==0) envmap_split_ima(env);
}
}