Index: source/blender/render/intern/source/envmap.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/render/intern/source/envmap.c,v retrieving revision 1.18 diff -u -r1.18 envmap.c --- source/blender/render/intern/source/envmap.c 28 Apr 2005 09:57:21 -0000 1.18 +++ source/blender/render/intern/source/envmap.c 31 May 2005 03:04:15 -0000 @@ -64,6 +64,9 @@ #include "MTC_matrixops.h" +#include "SDL_thread.h" +#define main main /* stupid SDL_main redefines main as SDL_main */ + /* this module */ #include "RE_callbacks.h" #include "render.h" @@ -634,6 +637,7 @@ 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 +652,10 @@ 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); } }