diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-07-24 17:27:07 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-07-24 17:27:07 +0300 |
commit | b60b1933845b814ad9b5364e8aff05e5ed90f642 (patch) | |
tree | 073c89a69425190798d93db21f907dc67f9b38c8 /source/blender/simulations/bparticles | |
parent | 299ba77cc9bcec91bbd4d0801741624c25131d32 (diff) |
do more checks when debugging
Diffstat (limited to 'source/blender/simulations/bparticles')
4 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/simulations/bparticles/actions.cpp b/source/blender/simulations/bparticles/actions.cpp index db210dd48b8..abdfdcc77af 100644 --- a/source/blender/simulations/bparticles/actions.cpp +++ b/source/blender/simulations/bparticles/actions.cpp @@ -16,7 +16,7 @@ void ChangeDirectionAction::execute(ActionInterface &interface) auto velocity_offsets = interface.attribute_offsets().try_get_float3("Velocity"); auto caller = m_compute_inputs.get_caller(interface); - auto new_directions = caller.add_output<float3>(); + auto new_directions = caller.add_output<float3>("Direction"); caller.call(particles.pindices()); for (uint pindex : particles.pindices()) { @@ -63,8 +63,8 @@ void ExplodeAction::execute(ActionInterface &interface) Vector<float> new_birth_times; auto caller = m_compute_inputs.get_caller(interface); - auto parts_amounts = caller.add_output<int>(); - auto speeds = caller.add_output<float>(); + auto parts_amounts = caller.add_output<int>("Amount"); + auto speeds = caller.add_output<float>("Speed"); caller.call(particles.pindices()); for (uint pindex : particles.pindices()) { @@ -94,7 +94,7 @@ void ConditionAction::execute(ActionInterface &interface) ParticleSet particles = interface.particles(); auto caller = m_compute_inputs.get_caller(interface); - auto conditions = caller.add_output<bool>(); + auto conditions = caller.add_output<bool>("Condition"); caller.call(particles.pindices()); Vector<uint> true_pindices, false_pindices; diff --git a/source/blender/simulations/bparticles/forces.cpp b/source/blender/simulations/bparticles/forces.cpp index 9cc62159138..f18c15cfc8a 100644 --- a/source/blender/simulations/bparticles/forces.cpp +++ b/source/blender/simulations/bparticles/forces.cpp @@ -35,7 +35,7 @@ void TurbulenceForce::add_force(ForceInterface &interface) auto positions = block.attributes().get_float3("Position"); auto caller = m_compute_inputs.get_caller(interface); - auto strengths = caller.add_output<float3>(); + auto strengths = caller.add_output<float3>("Strength"); caller.call(block.active_range().as_array_ref()); for (uint pindex = 0; pindex < block.active_amount(); pindex++) { diff --git a/source/blender/simulations/bparticles/offset_handlers.cpp b/source/blender/simulations/bparticles/offset_handlers.cpp index bceb8b88b41..b185cc2a714 100644 --- a/source/blender/simulations/bparticles/offset_handlers.cpp +++ b/source/blender/simulations/bparticles/offset_handlers.cpp @@ -9,7 +9,7 @@ void CreateTrailHandler::execute(OffsetHandlerInterface &interface) auto position_offsets = interface.offsets().get_float3("Position"); auto caller = m_compute_inputs.get_caller(interface); - auto rates = caller.add_output<float>(); + auto rates = caller.add_output<float>("Rate"); caller.call(particles.pindices()); Vector<float3> new_positions; diff --git a/source/blender/simulations/bparticles/particle_function.hpp b/source/blender/simulations/bparticles/particle_function.hpp index c40b148887b..bb5dce8faa7 100644 --- a/source/blender/simulations/bparticles/particle_function.hpp +++ b/source/blender/simulations/bparticles/particle_function.hpp @@ -31,7 +31,7 @@ class ParticleFunctionCaller { friend ParticleFunction; public: - template<typename T> void add_output(ArrayRef<T> array) + template<typename T> void add_output(ArrayRef<T> array, StringRef expected_name) { #ifdef DEBUG uint index = m_output_buffers.size(); @@ -40,16 +40,18 @@ class ParticleFunctionCaller { uint given_stride = sizeof(T); BLI_assert(expected_stride == given_stride); BLI_assert(m_min_buffer_length <= array.size()); + StringRef real_name = m_body->owner()->output_name(index); + BLI_assert(expected_name == real_name); #endif m_output_buffers.append((void *)array.begin()); m_output_strides.append(sizeof(T)); } - template<typename T> ArrayAllocator::Array<T> add_output() + template<typename T> ArrayAllocator::Array<T> add_output(StringRef expected_name) { ArrayAllocator::Array<T> array(*m_array_allocator); - this->add_output(array.as_array_ref()); + this->add_output(array.as_array_ref(), expected_name); return array; } |