[Bf-blender-cvs] [4a3b303bb03] master: Task scheduler: Fix wrong tasks calculation when chunk size is too big

Sergey Sharybin noreply at git.blender.org
Tue Jan 9 18:18:34 CET 2018


Commit: 4a3b303bb03364523a782043e0888d608a3eb6d3
Author: Sergey Sharybin
Date:   Tue Jan 9 18:07:34 2018 +0100
Branches: master
https://developer.blender.org/rB4a3b303bb03364523a782043e0888d608a3eb6d3

Task scheduler: Fix wrong tasks calculation when chunk size is too big

===================================================================

M	source/blender/blenlib/intern/task.c

===================================================================

diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c
index 2c756aa6d65..c82d2298a36 100644
--- a/source/blender/blenlib/intern/task.c
+++ b/source/blender/blenlib/intern/task.c
@@ -1123,7 +1123,8 @@ void BLI_task_parallel_range(const int start, const int stop,
 			break;
 	}
 
-	num_tasks = min_ii(num_tasks, (stop - start) / state.chunk_size);
+	num_tasks = min_ii(num_tasks,
+	                   max_ii(1, (stop - start) / state.chunk_size));
 
 	/* TODO(sergey): If number of tasks happened to be 1, use single threaded
 	 * path.



More information about the Bf-blender-cvs mailing list