diff options
Diffstat (limited to 'source/blender/functions/intern')
6 files changed, 37 insertions, 36 deletions
diff --git a/source/blender/functions/intern/cpp_types.cc b/source/blender/functions/intern/cpp_types.cc index 9c2c1621e23..7be34d2a1bf 100644 --- a/source/blender/functions/intern/cpp_types.cc +++ b/source/blender/functions/intern/cpp_types.cc @@ -23,20 +23,20 @@ namespace blender::fn { -MAKE_CPP_TYPE(bool, bool) +MAKE_CPP_TYPE(bool, bool, CPPTypeFlags::BasicType) -MAKE_CPP_TYPE(float, float) -MAKE_CPP_TYPE(float2, blender::float2) -MAKE_CPP_TYPE(float3, blender::float3) -MAKE_CPP_TYPE(float4x4, blender::float4x4) +MAKE_CPP_TYPE(float, float, CPPTypeFlags::BasicType) +MAKE_CPP_TYPE(float2, blender::float2, CPPTypeFlags::BasicType) +MAKE_CPP_TYPE(float3, blender::float3, CPPTypeFlags::BasicType) +MAKE_CPP_TYPE(float4x4, blender::float4x4, CPPTypeFlags::BasicType) -MAKE_CPP_TYPE(int32, int32_t) -MAKE_CPP_TYPE(uint32, uint32_t) -MAKE_CPP_TYPE(uint8, uint8_t) +MAKE_CPP_TYPE(int32, int32_t, CPPTypeFlags::BasicType) +MAKE_CPP_TYPE(uint32, uint32_t, CPPTypeFlags::BasicType) +MAKE_CPP_TYPE(uint8, uint8_t, CPPTypeFlags::BasicType) -MAKE_CPP_TYPE(ColorGeometry4f, blender::ColorGeometry4f) -MAKE_CPP_TYPE(ColorGeometry4b, blender::ColorGeometry4b) +MAKE_CPP_TYPE(ColorGeometry4f, blender::ColorGeometry4f, CPPTypeFlags::BasicType) +MAKE_CPP_TYPE(ColorGeometry4b, blender::ColorGeometry4b, CPPTypeFlags::BasicType) -MAKE_CPP_TYPE(string, std::string) +MAKE_CPP_TYPE(string, std::string, CPPTypeFlags::BasicType) } // namespace blender::fn diff --git a/source/blender/functions/intern/generic_vector_array.cc b/source/blender/functions/intern/generic_vector_array.cc index 3335b07e559..9556d24218e 100644 --- a/source/blender/functions/intern/generic_vector_array.cc +++ b/source/blender/functions/intern/generic_vector_array.cc @@ -43,7 +43,7 @@ void GVectorArray::append(const int64_t index, const void *value) } void *dst = POINTER_OFFSET(item.start, element_size_ * item.length); - type_.copy_to_uninitialized(value, dst); + type_.copy_construct(value, dst); item.length++; } @@ -95,7 +95,7 @@ void GVectorArray::realloc_to_at_least(Item &item, int64_t min_capacity) const int64_t new_capacity = std::max(min_capacity, item.length * 2); void *new_buffer = allocator_.allocate(element_size_ * new_capacity, type_.alignment()); - type_.relocate_to_initialized_n(item.start, new_buffer, item.length); + type_.relocate_assign_n(item.start, new_buffer, item.length); item.start = new_buffer; item.capacity = new_capacity; diff --git a/source/blender/functions/intern/generic_virtual_array.cc b/source/blender/functions/intern/generic_virtual_array.cc index 87dae06ccdc..bd033a429de 100644 --- a/source/blender/functions/intern/generic_virtual_array.cc +++ b/source/blender/functions/intern/generic_virtual_array.cc @@ -149,7 +149,7 @@ GVArrayPtr GVArray::shallow_copy() const void GVMutableArray::set_by_copy_impl(const int64_t index, const void *value) { BUFFER_FOR_CPP_TYPE_VALUE(*type_, buffer); - type_->copy_to_uninitialized(value, buffer); + type_->copy_construct(value, buffer); this->set_by_move_impl(index, buffer); type_->destruct(buffer); } @@ -164,7 +164,7 @@ void GVMutableArray::set_all_impl(const void *src) { if (this->is_span()) { const GMutableSpan span = this->get_internal_span(); - type_->copy_to_initialized_n(src, span.data(), size_); + type_->copy_assign_n(src, span.data(), size_); } else { for (int64_t i : IndexRange(size_)) { @@ -182,7 +182,7 @@ void GVMutableArray::fill(const void *value) { if (this->is_span()) { const GMutableSpan span = this->get_internal_span(); - type_->fill_initialized(value, span.data(), size_); + type_->fill_assign_n(value, span.data(), size_); } else { for (int64_t i : IndexRange(size_)) { @@ -197,12 +197,12 @@ void GVMutableArray::fill(const void *value) void GVArray_For_GSpan::get_impl(const int64_t index, void *r_value) const { - type_->copy_to_initialized(POINTER_OFFSET(data_, element_size_ * index), r_value); + type_->copy_assign(POINTER_OFFSET(data_, element_size_ * index), r_value); } void GVArray_For_GSpan::get_to_uninitialized_impl(const int64_t index, void *r_value) const { - type_->copy_to_uninitialized(POINTER_OFFSET(data_, element_size_ * index), r_value); + type_->copy_construct(POINTER_OFFSET(data_, element_size_ * index), r_value); } bool GVArray_For_GSpan::is_span_impl() const @@ -221,28 +221,28 @@ GSpan GVArray_For_GSpan::get_internal_span_impl() const void GVMutableArray_For_GMutableSpan::get_impl(const int64_t index, void *r_value) const { - type_->copy_to_initialized(POINTER_OFFSET(data_, element_size_ * index), r_value); + type_->copy_assign(POINTER_OFFSET(data_, element_size_ * index), r_value); } void GVMutableArray_For_GMutableSpan::get_to_uninitialized_impl(const int64_t index, void *r_value) const { - type_->copy_to_uninitialized(POINTER_OFFSET(data_, element_size_ * index), r_value); + type_->copy_construct(POINTER_OFFSET(data_, element_size_ * index), r_value); } void GVMutableArray_For_GMutableSpan::set_by_copy_impl(const int64_t index, const void *value) { - type_->copy_to_initialized(value, POINTER_OFFSET(data_, element_size_ * index)); + type_->copy_assign(value, POINTER_OFFSET(data_, element_size_ * index)); } void GVMutableArray_For_GMutableSpan::set_by_move_impl(const int64_t index, void *value) { - type_->move_to_initialized(value, POINTER_OFFSET(data_, element_size_ * index)); + type_->move_construct(value, POINTER_OFFSET(data_, element_size_ * index)); } void GVMutableArray_For_GMutableSpan::set_by_relocate_impl(const int64_t index, void *value) { - type_->relocate_to_initialized(value, POINTER_OFFSET(data_, element_size_ * index)); + type_->relocate_assign(value, POINTER_OFFSET(data_, element_size_ * index)); } bool GVMutableArray_For_GMutableSpan::is_span_impl() const @@ -261,13 +261,13 @@ GSpan GVMutableArray_For_GMutableSpan::get_internal_span_impl() const void GVArray_For_SingleValueRef::get_impl(const int64_t UNUSED(index), void *r_value) const { - type_->copy_to_initialized(value_, r_value); + type_->copy_assign(value_, r_value); } void GVArray_For_SingleValueRef::get_to_uninitialized_impl(const int64_t UNUSED(index), void *r_value) const { - type_->copy_to_uninitialized(value_, r_value); + type_->copy_construct(value_, r_value); } bool GVArray_For_SingleValueRef::is_span_impl() const @@ -287,7 +287,7 @@ bool GVArray_For_SingleValueRef::is_single_impl() const void GVArray_For_SingleValueRef::get_internal_single_impl(void *r_value) const { - type_->copy_to_initialized(value_, r_value); + type_->copy_assign(value_, r_value); } /* -------------------------------------------------------------------- @@ -300,7 +300,7 @@ GVArray_For_SingleValue::GVArray_For_SingleValue(const CPPType &type, : GVArray_For_SingleValueRef(type, size) { value_ = MEM_mallocN_aligned(type.size(), type.alignment(), __func__); - type.copy_to_uninitialized(value, (void *)value_); + type.copy_construct(value, (void *)value_); } GVArray_For_SingleValue::~GVArray_For_SingleValue() @@ -351,7 +351,7 @@ GVMutableArray_GSpan::GVMutableArray_GSpan(GVMutableArray &varray, const bool co varray_.materialize_to_uninitialized(IndexRange(size_), owned_data_); } else { - type_->construct_default_n(owned_data_, size_); + type_->default_construct_n(owned_data_, size_); } data_ = owned_data_; } diff --git a/source/blender/functions/intern/generic_virtual_vector_array.cc b/source/blender/functions/intern/generic_virtual_vector_array.cc index aa3d90883c6..6b90ce993ae 100644 --- a/source/blender/functions/intern/generic_virtual_vector_array.cc +++ b/source/blender/functions/intern/generic_virtual_vector_array.cc @@ -26,7 +26,7 @@ void GVArray_For_GVVectorArrayIndex::get_impl(const int64_t index_in_vector, voi void GVArray_For_GVVectorArrayIndex::get_to_uninitialized_impl(const int64_t index_in_vector, void *r_value) const { - type_->construct_default(r_value); + type_->default_construct(r_value); vector_array_.get_vector_element(index_, index_in_vector, r_value); } @@ -56,7 +56,7 @@ void GVVectorArray_For_SingleGSpan::get_vector_element_impl(const int64_t UNUSED const int64_t index_in_vector, void *r_value) const { - type_->copy_to_initialized(span_[index_in_vector], r_value); + type_->copy_assign(span_[index_in_vector], r_value); } bool GVVectorArray_For_SingleGSpan::is_single_vector_impl() const diff --git a/source/blender/functions/intern/multi_function_builder.cc b/source/blender/functions/intern/multi_function_builder.cc index 3567f4f9167..c6b3b808130 100644 --- a/source/blender/functions/intern/multi_function_builder.cc +++ b/source/blender/functions/intern/multi_function_builder.cc @@ -25,7 +25,7 @@ CustomMF_GenericConstant::CustomMF_GenericConstant(const CPPType &type, const vo { MFSignatureBuilder signature{"Constant " + type.name()}; std::stringstream ss; - type.debug_print(value, ss); + type.print_or_default(value, ss, type.name()); signature.single_output(ss.str(), type); signature_ = signature.build(); this->set_signature(&signature_); @@ -36,12 +36,12 @@ void CustomMF_GenericConstant::call(IndexMask mask, MFContext UNUSED(context)) const { GMutableSpan output = params.uninitialized_single_output(0); - type_.fill_uninitialized_indices(value_, output.data(), mask); + type_.fill_construct_indices(value_, output.data(), mask); } uint64_t CustomMF_GenericConstant::hash() const { - return type_.hash(value_); + return type_.hash_or_fallback(value_, (uintptr_t)this); } bool CustomMF_GenericConstant::equals(const MultiFunction &other) const @@ -58,11 +58,12 @@ bool CustomMF_GenericConstant::equals(const MultiFunction &other) const static std::string gspan_to_string(GSpan array) { + const CPPType &type = array.type(); std::stringstream ss; ss << "["; const int64_t max_amount = 5; for (int64_t i : IndexRange(std::min(max_amount, array.size()))) { - array.type().debug_print(array[i], ss); + type.print_or_default(array[i], ss, type.name()); ss << ", "; } if (max_amount < array.size()) { @@ -117,7 +118,7 @@ void CustomMF_DefaultOutput::call(IndexMask mask, MFParams params, MFContext UNU if (param_type.data_type().is_single()) { GMutableSpan span = params.uninitialized_single_output(param_index); const CPPType &type = span.type(); - type.fill_uninitialized_indices(type.default_value(), span.data(), mask); + type.fill_construct_indices(type.default_value(), span.data(), mask); } } } diff --git a/source/blender/functions/intern/multi_function_network_optimization.cc b/source/blender/functions/intern/multi_function_network_optimization.cc index 4b6b3e81393..0f65d320f62 100644 --- a/source/blender/functions/intern/multi_function_network_optimization.cc +++ b/source/blender/functions/intern/multi_function_network_optimization.cc @@ -263,7 +263,7 @@ static Array<MFOutputSocket *> add_constant_folded_sockets(const MultiFunction & const CPPType &cpp_type = data_type.single_type(); GMutableSpan array = params.computed_array(param_index); void *buffer = array.data(); - scope.add(buffer, array.type().destruct_cb(), AT); + scope.add(buffer, array.type().members().destruct, AT); constant_fn = &scope.construct<CustomMF_GenericConstant>(AT, cpp_type, buffer); break; |