diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-01-13 01:40:05 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-01-13 12:40:41 +0300 |
commit | a3deef6fff7c395512cf56a64d6e026f84d95db2 (patch) | |
tree | c2cca7e8582c80b6f349391f6f847529d0744468 /intern/cycles/util | |
parent | eaa4cdaa4230d69b470d229017bad27c03c9ef14 (diff) |
Fix Cycles CPU + GPU render not using CPU after recent changes
In some places the task scheduler was not initialized in time.
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/task.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/util/task.h | 7 |
2 files changed, 6 insertions, 6 deletions
diff --git a/intern/cycles/util/task.cpp b/intern/cycles/util/task.cpp index eeccbaf1c44..174befce571 100644 --- a/intern/cycles/util/task.cpp +++ b/intern/cycles/util/task.cpp @@ -109,9 +109,10 @@ void TaskScheduler::free_memory() assert(users == 0); } -int TaskScheduler::num_threads() +int TaskScheduler::max_concurrency() { - return active_num_threads; + thread_scoped_lock lock(mutex); + return (users > 0) ? active_num_threads : tbb::this_task_arena::max_concurrency(); } /* Dedicated Task Pool */ diff --git a/intern/cycles/util/task.h b/intern/cycles/util/task.h index 1a8f512b83a..0117c51d05c 100644 --- a/intern/cycles/util/task.h +++ b/intern/cycles/util/task.h @@ -86,10 +86,9 @@ class TaskScheduler { static void exit(); static void free_memory(); - /* Approximate number of threads that will work on task, which may be lower - * or higher than the actual number of threads. Use as little as possible and - * leave splitting up tasks to the scheduler. */ - static int num_threads(); + /* Maximum number of threads that will work on task. Use as little as + * possible and leave scheduling and splitting up tasks to the scheduler. */ + static int max_concurrency(); protected: static thread_mutex mutex; |