[Bf-blender-cvs] [e1a662ee3a2] functions: optimize float range
Jacques Lucke
noreply at git.blender.org
Sat Dec 14 17:45:10 CET 2019
Commit: e1a662ee3a229e350491b451de17ff1aff83035c
Author: Jacques Lucke
Date: Sat Dec 14 16:53:51 2019 +0100
Branches: functions
https://developer.blender.org/rBe1a662ee3a229e350491b451de17ff1aff83035c
optimize float range
===================================================================
M source/blender/functions/FN_generic_vector_array.h
M source/blender/functions/intern/multi_functions/mixed.cc
===================================================================
diff --git a/source/blender/functions/FN_generic_vector_array.h b/source/blender/functions/FN_generic_vector_array.h
index 497ce076046..f37cd1fec08 100644
--- a/source/blender/functions/FN_generic_vector_array.h
+++ b/source/blender/functions/FN_generic_vector_array.h
@@ -192,6 +192,12 @@ class GenericVectorArray : BLI::NonCopyable, BLI::NonMovable {
m_data->type().construct_default_n(array.buffer(), amount);
return array.as_typed_ref<T>();
}
+
+ MutableArrayRef<T> allocate(uint index, uint amount)
+ {
+ GenericMutableArrayRef array = m_data->allocate_single(index, amount);
+ return array.as_typed_ref<T>();
+ }
};
template<typename T> const TypedRef<T> as_typed_ref() const
diff --git a/source/blender/functions/intern/multi_functions/mixed.cc b/source/blender/functions/intern/multi_functions/mixed.cc
index 19c6569d8c3..9faaecaae14 100644
--- a/source/blender/functions/intern/multi_functions/mixed.cc
+++ b/source/blender/functions/intern/multi_functions/mixed.cc
@@ -169,16 +169,18 @@ void MF_FloatRange::call(MFMask mask, MFParams params, MFContext UNUSED(context)
VirtualListRef<int> amounts = params.readonly_single_input<int>(0, "Amount");
VirtualListRef<float> starts = params.readonly_single_input<float>(1, "Start");
VirtualListRef<float> steps = params.readonly_single_input<float>(2, "Step");
- auto lists = params.vector_output<float>(3, "Range");
+ auto r_ranges = params.vector_output<float>(3, "Range");
for (uint i : mask.indices()) {
int amount = amounts[i];
float start = starts[i];
float step = steps[i];
+ MutableArrayRef<float> range = r_ranges.allocate(i, amount);
+
for (int j = 0; j < amount; j++) {
float value = start + j * step;
- lists.append_single(i, value);
+ range[j] = value;
}
}
}
More information about the Bf-blender-cvs
mailing list