[Bf-blender-cvs] [46fe816fc65] temp-varray-get-set-multiple: use threads

Jacques Lucke noreply at git.blender.org
Sun Sep 26 15:09:35 CEST 2021


Commit: 46fe816fc6517989f41871710be4a4551020d007
Author: Jacques Lucke
Date:   Sun Sep 26 15:07:27 2021 +0200
Branches: temp-varray-get-set-multiple
https://developer.blender.org/rB46fe816fc6517989f41871710be4a4551020d007

use threads

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

M	source/blender/functions/intern/field.cc

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

diff --git a/source/blender/functions/intern/field.cc b/source/blender/functions/intern/field.cc
index c34182924cb..5f4b395e36a 100644
--- a/source/blender/functions/intern/field.cc
+++ b/source/blender/functions/intern/field.cc
@@ -18,6 +18,7 @@
 #include "BLI_multi_value_map.hh"
 #include "BLI_set.hh"
 #include "BLI_stack.hh"
+#include "BLI_task.hh"
 #include "BLI_vector_set.hh"
 
 #include "FN_field.hh"
@@ -468,7 +469,10 @@ Vector<const GVArray *> evaluate_fields(ResourceScope &scope,
         /* The result has been written into the destination provided by the caller already. */
         continue;
       }
-      output_varray->set_multiple_by_copy(*computed_varray, mask);
+      threading::parallel_for(mask.index_range(), 1024, [&](IndexRange range) {
+        const IndexMask sub_mask = mask.slice(range);
+        output_varray->set_multiple_by_copy(*computed_varray, sub_mask);
+      });
       r_varrays[out_index] = output_varray;
     }
   }



More information about the Bf-blender-cvs mailing list