[Bf-blender-cvs] [3e325b42bbf] functions: run emitters in parallel
Jacques Lucke
noreply at git.blender.org
Thu Jan 2 16:37:57 CET 2020
Commit: 3e325b42bbf9985ecf31af6aa5c230c806bf9ee7
Author: Jacques Lucke
Date: Thu Jan 2 14:23:12 2020 +0100
Branches: functions
https://developer.blender.org/rB3e325b42bbf9985ecf31af6aa5c230c806bf9ee7
run emitters in parallel
===================================================================
M source/blender/simulations/bparticles/simulate.cpp
===================================================================
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index f0c921df99f..732939bd3d2 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -389,10 +389,19 @@ BLI_NOINLINE static void create_particles_from_emitters(SimulationState &simulat
ArrayRef<Emitter *> emitters,
FloatInterval time_span)
{
- for (Emitter *emitter : emitters) {
+ auto func = [&](uint emitter_index) {
+ Emitter &emitter = *emitters[emitter_index];
EmitterInterface interface(simulation_state, particle_allocator, time_span);
- emitter->emit(interface);
+ emitter.emit(interface);
+ };
+
+#ifdef WITH_TBB
+ tbb::parallel_for((uint)0, emitters.size(), func);
+#else
+ for (uint i : emitters.index_iterator()) {
+ func(i);
}
+#endif
}
void simulate_particles(SimulationState &simulation_state,
More information about the Bf-blender-cvs
mailing list