diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-02-21 11:43:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-02-21 11:43:13 +0300 |
commit | 7c7a931fed41dcf51e2d537a9157c357f0285955 (patch) | |
tree | 956105c8e2ab7f8553bccb963a1630d54dc3d2b0 | |
parent | 91d44a91249355827b6f135ab6e4fc52bfe926e4 (diff) |
made auto threads default (noob's get faster renders in their dual core CPU's)
changed env variable check order $TMP, $TMPDIR - aparently $TMP is more common.
-rw-r--r-- | source/blender/blenlib/intern/threads.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/util.c | 21 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/sceneRender.c | 11 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 2 | ||||
-rw-r--r-- | source/blender/src/buttons_scene.c | 4 |
6 files changed, 26 insertions, 22 deletions
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index f1b0dff491b..f4a44b3a0db 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -32,20 +32,20 @@ #include <stdlib.h> #include <string.h> #include <pthread.h> -#include <unistd.h> /* for checking system threads */ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" #include "BLI_threads.h" +/* for checking system threads - BLI_system_thread_count */ #ifdef WIN32 #include "Windows.h" -#endif - -#ifdef __APPLE__ +#elif defined(__APPLE__) #include <sys/types.h> #include <sys/sysctl.h> +#else +#include <unistd.h> #endif /* ********** basic thread control API ************ diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index c3917178347..8480a9d6e06 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -1615,25 +1615,30 @@ void BLI_where_is_temp(char *fullname, int usertemp) strcpy(fullname, U.tempdir); } - if (fullname[0] == '\0') { + #ifdef WIN32 + if (fullname[0] == '\0') { char *tmp = getenv("TEMP"); /* Windows */ if (tmp && BLI_exists(tmp)) { strcpy(fullname, tmp); } + } #else - char *tmp = getenv("TMPDIR"); /* Other OS's - Try TMP and TMPDIR */ + /* Other OS's - Try TMP and TMPDIR */ + if (fullname[0] == '\0') { + char *tmp = getenv("TMP"); if (tmp && BLI_exists(tmp)) { strcpy(fullname, tmp); } - if (fullname[0] == '\0') { - tmp = getenv("TMP"); - if (tmp && BLI_exists(tmp)) { - strcpy(fullname, tmp); - } + } + + if (fullname[0] == '\0') { + char *tmp = getenv("TMPDIR"); + if (tmp && BLI_exists(tmp)) { + strcpy(fullname, tmp); } -#endif } +#endif if (fullname[0] == '\0') { strcpy(fullname, "/tmp/"); diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 01b04435c58..9b24d8214b0 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -577,7 +577,7 @@ typedef struct Scene { /* threads obsolete... is there for old files, now use for autodetect threads */ #define R_THREADS 0x80000 /* Use the same flag for autothreads */ -#define R_AUTO_THREADS 0x80000 +#define R_FIXED_THREADS 0x80000 #define R_SPEED 0x100000 #define R_SSS 0x200000 diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c index 29fc018e16d..428a4e82548 100644 --- a/source/blender/python/api2_2x/sceneRender.c +++ b/source/blender/python/api2_2x/sceneRender.c @@ -2089,7 +2089,7 @@ static int RenderData_setModeBit( BPy_RenderData* self, PyObject *value, #define MODE_MASK ( R_OSA | R_SHADOW | R_GAMMA | R_ENVMAP | R_EDGE | \ R_FIELDS | R_FIELDSTILL | R_RADIO | R_BORDER | R_PANORAMA | R_CROP | \ - R_ODDFIELD | R_MBLUR | R_RAYTRACE | R_AUTO_THREADS ) + R_ODDFIELD | R_MBLUR | R_RAYTRACE | R_FIXED_THREADS ) static PyObject *RenderData_getMode( BPy_RenderData *self ) { @@ -2593,13 +2593,12 @@ static PyGetSetDef BPy_RenderData_getseters[] = { (getter)RenderData_getModeBit, (setter)RenderData_setModeBit, "Skip rendering existing image files", (void *)R_NO_OVERWRITE}, - {"autoThreads", + {"fixedThreads", (getter)RenderData_getModeBit, (setter)RenderData_setModeBit, - "Use system number of processors", - (void *)R_AUTO_THREADS}, + "Use the number of threads defined by the blend file", + (void *)R_FIXED_THREADS}, /* R_GAUSS unused */ /* R_FBUF unused */ -/* R_AUTO_THREADS unused */ {"threads", (getter)RenderData_getThreads, (setter)RenderData_setThreads, "Number of threads used to render", @@ -3721,7 +3720,7 @@ static PyObject *M_Render_ModesDict( void ) PyConstant_Insert( d, "ODDFIELD", PyInt_FromLong( R_ODDFIELD ) ); PyConstant_Insert( d, "MBLUR", PyInt_FromLong( R_MBLUR ) ); PyConstant_Insert( d, "RAYTRACING", PyInt_FromLong( R_RAYTRACE ) ); - PyConstant_Insert( d, "AUTOTHREADS", PyInt_FromLong( R_AUTO_THREADS ) ); + PyConstant_Insert( d, "FIXEDTHREADS", PyInt_FromLong( R_FIXED_THREADS ) ); } return M; } diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index f537cbff259..318b35e8be3 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1108,7 +1108,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, int winx, int winy /* we clip faces with a minimum of 2 pixel boundary outside of image border. see zbuf.c */ re->clipcrop= 1.0f + 2.0f/(float)(re->winx>re->winy?re->winy:re->winx); - if (rd->mode & R_AUTO_THREADS || commandline_threads == 0) { /* Automatic threads */ + if (rd->mode & R_FIXED_THREADS || commandline_threads == 0) { /* Automatic threads */ re->r.threads = BLI_system_thread_count(); } else if(commandline_threads >= 1 && commandline_threads<=BLENDER_MAX_THREADS) { re->r.threads= commandline_threads; diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index da5f2817e4e..5cff2ee1608 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -2023,8 +2023,8 @@ static void render_panel_output(void) uiBlockEndAlign(block); uiBlockBeginAlign(block); - uiDefIconButBitI(block, TOG, R_AUTO_THREADS, B_REDR, ICON_AUTO, 10, 63, 20, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Automatically set the threads to the number of processors on the system"); - if (G.scene->r.mode & R_AUTO_THREADS) { + uiDefIconButBitI(block, TOGN, R_FIXED_THREADS, B_REDR, ICON_AUTO, 10, 63, 20, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Automatically set the threads to the number of processors on the system"); + if ((G.scene->r.mode & R_FIXED_THREADS)==0) { char thread_str[16]; sprintf(thread_str, " Threads: %d", BLI_system_thread_count()); uiDefBut(block, LABEL, 0, thread_str, 30, 63,80,20, 0, 0, 0, 0, 0, ""); |