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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-08 17:23:17 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-08 17:23:17 +0400
commita07dcd67ebf63fad08536b1e78bbb61e18fa51e6 (patch)
tree7c96f23349f005187e87d19d23248bb40d4d2e91 /source/blender/blenkernel/intern/scene.c
parent3e763d7e4dbbc4acb3deb7afb95e936ce950ebb5 (diff)
Fix #35240: command line -t number of threads option did not work for cycles.
Now it works for blender internal, cycles and other multithreading code in Blender in both background and UI mode.
Diffstat (limited to 'source/blender/blenkernel/intern/scene.c')
-rw-r--r--source/blender/blenkernel/intern/scene.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index c7a8c96a232..e93c32ddf64 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -56,6 +56,7 @@
#include "BLI_utildefines.h"
#include "BLI_callbacks.h"
#include "BLI_string.h"
+#include "BLI_threads.h"
#include "BLF_translation.h"
@@ -1469,3 +1470,28 @@ int BKE_scene_check_rigidbody_active(const Scene *scene)
{
return scene && scene->rigidbody_world && scene->rigidbody_world->group && !(scene->rigidbody_world->flag & RBW_FLAG_MUTED);
}
+
+int BKE_render_num_threads(const RenderData *rd)
+{
+ int threads;
+
+ /* override set from command line? */
+ threads = BLI_system_num_threads_override_get();
+
+ if (threads > 0)
+ return threads;
+
+ /* fixed number of threads specified in scene? */
+ if (rd->mode & R_FIXED_THREADS)
+ threads = rd->threads;
+ else
+ threads = BLI_system_thread_count();
+
+ return max_ii(threads, 1);
+}
+
+int BKE_scene_num_threads(const Scene *scene)
+{
+ return BKE_render_num_threads(&scene->r);
+}
+