added win32 check for number of processors, but cant test.
could somebody running win32 see if headers need to be added to threads.c?
This commit is contained in:
@@ -228,7 +228,15 @@ void BLI_unlock_thread(int type)
|
|||||||
/* how many threads are native on this system? */
|
/* how many threads are native on this system? */
|
||||||
int BLI_system_thread_count( void )
|
int BLI_system_thread_count( void )
|
||||||
{
|
{
|
||||||
int t = (int)sysconf(_SC_NPROCESSORS_ONLN);
|
int t;
|
||||||
|
#ifdef WIN32
|
||||||
|
SYSTEM_INFO info;
|
||||||
|
GetSystemInfo(&info);
|
||||||
|
t = (int) info.dwNumberOfProcessors;
|
||||||
|
#else
|
||||||
|
t = (int)sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (t>RE_MAX_THREAD)
|
if (t>RE_MAX_THREAD)
|
||||||
return RE_MAX_THREAD;
|
return RE_MAX_THREAD;
|
||||||
if (t<1)
|
if (t<1)
|
||||||
|
|||||||
@@ -2025,11 +2025,11 @@ static void render_panel_output(void)
|
|||||||
uiBlockBeginAlign(block);
|
uiBlockBeginAlign(block);
|
||||||
uiDefIconButBitI(block, TOG, R_THREADS, B_REDR, ICON_AUTO, 10, 63, 20, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Automatic threads from system");
|
uiDefIconButBitI(block, TOG, R_THREADS, B_REDR, ICON_AUTO, 10, 63, 20, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Automatic threads from system");
|
||||||
if (G.scene->r.mode & R_THREADS) {
|
if (G.scene->r.mode & R_THREADS) {
|
||||||
char thread_str[32];
|
char thread_str[16];
|
||||||
sprintf(thread_str, "Threads: %d", BLI_system_thread_count());
|
sprintf(thread_str, " Threads: %d", BLI_system_thread_count());
|
||||||
uiDefBut(block, LABEL, 0, thread_str, 30, 63,80,20, 0, 0, 0, 0, 0, "");
|
uiDefBut(block, LABEL, 0, thread_str, 30, 63,80,20, 0, 0, 0, 0, 0, "");
|
||||||
} else {
|
} else {
|
||||||
uiDefButS(block, NUM, B_NOP, "Threads:", 35, 63, 80, 20, &G.scene->r.threads, 1, BLENDER_MAX_THREADS, 0, 0, "Amount of threads for render (takes advantage of multi-core and multi-processor computers)");
|
uiDefButS(block, NUM, B_NOP, "Threads:", 30, 63, 80, 20, &G.scene->r.threads, 1, BLENDER_MAX_THREADS, 0, 0, "Amount of threads for render (takes advantage of multi-core and multi-processor computers)");
|
||||||
}
|
}
|
||||||
uiBlockEndAlign(block);
|
uiBlockEndAlign(block);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user