[Bf-blender-cvs] [ed2180832ec] functions: use debug name checking again

Jacques Lucke noreply at git.blender.org
Mon Jul 29 17:57:11 CEST 2019


Commit: ed2180832eca1b1a0db47392a5a335ba03217714
Author: Jacques Lucke
Date:   Mon Jul 29 11:20:42 2019 +0200
Branches: functions
https://developer.blender.org/rBed2180832eca1b1a0db47392a5a335ba03217714

use debug name checking again

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

M	source/blender/simulations/bparticles/particle_function.cpp
M	source/blender/simulations/bparticles/particle_function.hpp

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

diff --git a/source/blender/simulations/bparticles/particle_function.cpp b/source/blender/simulations/bparticles/particle_function.cpp
index b002d36217f..da316f7f4e3 100644
--- a/source/blender/simulations/bparticles/particle_function.cpp
+++ b/source/blender/simulations/bparticles/particle_function.cpp
@@ -48,6 +48,9 @@ std::unique_ptr<ParticleFunctionResult> ParticleFunction::compute(ArrayAllocator
   result->m_buffers.append_n_times(nullptr, parameter_amount);
   result->m_only_first.append_n_times(false, parameter_amount);
   result->m_strides.append_n_times(0, parameter_amount);
+  result->m_fn_no_deps = m_fn_no_deps.ptr();
+  result->m_fn_with_deps = m_fn_with_deps.ptr();
+  result->m_output_indices = m_output_indices;
 
   if (m_fn_no_deps->output_amount() > 0) {
     TupleCallBody &body = m_fn_no_deps->body<TupleCallBody>();
diff --git a/source/blender/simulations/bparticles/particle_function.hpp b/source/blender/simulations/bparticles/particle_function.hpp
index 4eb2c867cc3..464976edff9 100644
--- a/source/blender/simulations/bparticles/particle_function.hpp
+++ b/source/blender/simulations/bparticles/particle_function.hpp
@@ -24,6 +24,9 @@ class ParticleFunctionResult {
   Vector<uint> m_strides;
   Vector<bool> m_only_first;
   ArrayAllocator *m_array_allocator;
+  FN::Function *m_fn_no_deps;
+  FN::Function *m_fn_with_deps;
+  ArrayRef<uint> m_output_indices;
 
   friend ParticleFunction;
 
@@ -41,11 +44,18 @@ class ParticleFunctionResult {
 
   template<typename T> T get(StringRef expected_name, uint parameter_index, uint pindex)
   {
-    // #ifdef DEBUG
-    //     BLI_assert(sizeof(T) == m_strides[parameter_index]);
-    //     StringRefNull real_name = m_fn->output_name(parameter_index);
-    //     BLI_assert(real_name == expected_name);
-    // #endif
+#ifdef DEBUG
+    BLI_assert(sizeof(T) == m_strides[parameter_index]);
+    uint output_index = m_output_indices[parameter_index];
+    if (m_only_first[parameter_index]) {
+      StringRefNull real_name = m_fn_no_deps->output_name(output_index);
+      BLI_assert(real_name == expected_name);
+    }
+    else {
+      StringRefNull real_name = m_fn_with_deps->output_name(output_index);
+      BLI_assert(real_name == expected_name);
+    }
+#endif
     UNUSED_VARS_NDEBUG(expected_name);
 
     T *buffer = (T *)m_buffers[parameter_index];



More information about the Bf-blender-cvs mailing list