[Bf-blender-cvs] [506b6d7df98] functions: temporarily unrolled event loop

Jacques Lucke noreply at git.blender.org
Sat Jun 29 16:25:41 CEST 2019


Commit: 506b6d7df98a1d2d6bb11fcacaf1efe3c5e83824
Author: Jacques Lucke
Date:   Sat Jun 29 12:53:19 2019 +0200
Branches: functions
https://developer.blender.org/rB506b6d7df98a1d2d6bb11fcacaf1efe3c5e83824

temporarily unrolled event loop

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

M	source/blender/simulations/bparticles/core.hpp
M	source/blender/simulations/bparticles/simulate.cpp

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

diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index e739a97827d..814bd75b77b 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -217,7 +217,7 @@ class EmitterInterface {
 
 struct ParticleSet {
  private:
-  ParticlesBlock &m_block;
+  ParticlesBlock *m_block;
 
   /* Indices into the attribute arrays.
    * Invariants:
@@ -227,18 +227,18 @@ struct ParticleSet {
 
  public:
   ParticleSet(ParticlesBlock &block, ArrayRef<uint> particle_indices)
-      : m_block(block), m_particle_indices(particle_indices)
+      : m_block(&block), m_particle_indices(particle_indices)
   {
   }
 
   ParticlesBlock &block()
   {
-    return m_block;
+    return *m_block;
   }
 
   AttributeArrays attributes()
   {
-    return m_block.slice_all();
+    return m_block->slice_all();
   }
 
   ArrayRef<uint> indices()
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index e6f599ea9ed..e2471f8047c 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -287,10 +287,11 @@ BLI_NOINLINE static void simulate_with_max_n_events(
     ParticleType &particle_type,
     SmallVector<uint> &r_unfinished_particle_indices)
 {
-  ParticleSet particles(block, static_number_range_ref(0, block.active_amount()));
-
   SmallVector<float> last_event_times;
-  SmallVector<float> remaining_durations;
+
+  ParticleSet particles(block, static_number_range_ref(0, block.active_amount()));
+  SmallVector<uint> unfinished_particle_indices_after_1;
+  SmallVector<float> remaining_durations_after_1;
 
   simulate_to_next_event(block_allocator,
                          particles,
@@ -299,8 +300,38 @@ BLI_NOINLINE static void simulate_with_max_n_events(
                          end_time,
                          particle_type,
                          last_event_times,
-                         r_unfinished_particle_indices,
-                         remaining_durations);
+                         unfinished_particle_indices_after_1,
+                         remaining_durations_after_1);
+
+  particles = ParticleSet(block, unfinished_particle_indices_after_1);
+  SmallVector<uint> unfinished_particle_indices_after_2;
+  SmallVector<float> remaining_durations_after_2;
+
+  simulate_to_next_event(block_allocator,
+                         particles,
+                         ideal_offsets,
+                         remaining_durations_after_1,
+                         end_time,
+                         particle_type,
+                         last_event_times,
+                         unfinished_particle_indices_after_2,
+                         remaining_durations_after_2);
+
+  particles = ParticleSet(block, unfinished_particle_indices_after_2);
+  SmallVector<uint> unfinished_particle_indices_after_3;
+  SmallVector<float> remaining_durations_after_3;
+
+  simulate_to_next_event(block_allocator,
+                         particles,
+                         ideal_offsets,
+                         remaining_durations_after_2,
+                         end_time,
+                         particle_type,
+                         last_event_times,
+                         unfinished_particle_indices_after_3,
+                         remaining_durations_after_3);
+
+  r_unfinished_particle_indices = unfinished_particle_indices_after_3;
 }
 
 BLI_NOINLINE static void apply_remaining_offsets(ParticleSet particles, IdealOffsets ideal_offsets)



More information about the Bf-blender-cvs mailing list