Changeset View
Changeset View
Standalone View
Standalone View
source/blender/functions/intern/multi_function_network_evaluation.cc
| Show First 20 Lines • Show All 968 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| const MFOutputSocket &origin = *socket.origin(); | const MFOutputSocket &origin = *socket.origin(); | ||||
| Value *any_value = value_per_output_id_[origin.id()]; | Value *any_value = value_per_output_id_[origin.id()]; | ||||
| BLI_assert(any_value != nullptr); | BLI_assert(any_value != nullptr); | ||||
| if (any_value->type == ValueType::OwnSingle) { | if (any_value->type == ValueType::OwnSingle) { | ||||
| OwnSingleValue *value = static_cast<OwnSingleValue *>(any_value); | OwnSingleValue *value = static_cast<OwnSingleValue *>(any_value); | ||||
| if (value->is_single_allocated) { | if (value->is_single_allocated) { | ||||
| return scope.construct<GVArrayForSingleValueRef>( | return scope.construct<GVArray_For_SingleValueRef>( | ||||
| __func__, value->span.type(), min_array_size_, value->span.data()); | __func__, value->span.type(), min_array_size_, value->span.data()); | ||||
| } | } | ||||
| return scope.construct<GVArrayForGSpan>(__func__, value->span); | return scope.construct<GVArray_For_GSpan>(__func__, value->span); | ||||
| } | } | ||||
| if (any_value->type == ValueType::InputSingle) { | if (any_value->type == ValueType::InputSingle) { | ||||
| InputSingleValue *value = static_cast<InputSingleValue *>(any_value); | InputSingleValue *value = static_cast<InputSingleValue *>(any_value); | ||||
| return value->virtual_array; | return value->virtual_array; | ||||
| } | } | ||||
| if (any_value->type == ValueType::OutputSingle) { | if (any_value->type == ValueType::OutputSingle) { | ||||
| OutputSingleValue *value = static_cast<OutputSingleValue *>(any_value); | OutputSingleValue *value = static_cast<OutputSingleValue *>(any_value); | ||||
| BLI_assert(value->is_computed); | BLI_assert(value->is_computed); | ||||
| return scope.construct<GVArrayForGSpan>(__func__, value->span); | return scope.construct<GVArray_For_GSpan>(__func__, value->span); | ||||
| } | } | ||||
| BLI_assert(false); | BLI_assert(false); | ||||
| return scope.construct<GVArrayForEmpty>(__func__, CPPType::get<float>()); | return scope.construct<GVArray_For_Empty>(__func__, CPPType::get<float>()); | ||||
| } | } | ||||
| const GVArray &MFNetworkEvaluationStorage::get_single_input__single(const MFInputSocket &socket, | const GVArray &MFNetworkEvaluationStorage::get_single_input__single(const MFInputSocket &socket, | ||||
| ResourceScope &scope) | ResourceScope &scope) | ||||
| { | { | ||||
| const MFOutputSocket &origin = *socket.origin(); | const MFOutputSocket &origin = *socket.origin(); | ||||
| Value *any_value = value_per_output_id_[origin.id()]; | Value *any_value = value_per_output_id_[origin.id()]; | ||||
| BLI_assert(any_value != nullptr); | BLI_assert(any_value != nullptr); | ||||
| if (any_value->type == ValueType::OwnSingle) { | if (any_value->type == ValueType::OwnSingle) { | ||||
| OwnSingleValue *value = static_cast<OwnSingleValue *>(any_value); | OwnSingleValue *value = static_cast<OwnSingleValue *>(any_value); | ||||
| BLI_assert(value->span.size() == 1); | BLI_assert(value->span.size() == 1); | ||||
| return scope.construct<GVArrayForGSpan>(__func__, value->span); | return scope.construct<GVArray_For_GSpan>(__func__, value->span); | ||||
| } | } | ||||
| if (any_value->type == ValueType::InputSingle) { | if (any_value->type == ValueType::InputSingle) { | ||||
| InputSingleValue *value = static_cast<InputSingleValue *>(any_value); | InputSingleValue *value = static_cast<InputSingleValue *>(any_value); | ||||
| BLI_assert(value->virtual_array.is_single()); | BLI_assert(value->virtual_array.is_single()); | ||||
| return value->virtual_array; | return value->virtual_array; | ||||
| } | } | ||||
| if (any_value->type == ValueType::OutputSingle) { | if (any_value->type == ValueType::OutputSingle) { | ||||
| OutputSingleValue *value = static_cast<OutputSingleValue *>(any_value); | OutputSingleValue *value = static_cast<OutputSingleValue *>(any_value); | ||||
| BLI_assert(value->is_computed); | BLI_assert(value->is_computed); | ||||
| BLI_assert(value->span.size() == 1); | BLI_assert(value->span.size() == 1); | ||||
| return scope.construct<GVArrayForGSpan>(__func__, value->span); | return scope.construct<GVArray_For_GSpan>(__func__, value->span); | ||||
| } | } | ||||
| BLI_assert(false); | BLI_assert(false); | ||||
| return scope.construct<GVArrayForEmpty>(__func__, CPPType::get<float>()); | return scope.construct<GVArray_For_Empty>(__func__, CPPType::get<float>()); | ||||
| } | } | ||||
| const GVVectorArray &MFNetworkEvaluationStorage::get_vector_input__full( | const GVVectorArray &MFNetworkEvaluationStorage::get_vector_input__full( | ||||
| const MFInputSocket &socket, ResourceScope &scope) | const MFInputSocket &socket, ResourceScope &scope) | ||||
| { | { | ||||
| const MFOutputSocket &origin = *socket.origin(); | const MFOutputSocket &origin = *socket.origin(); | ||||
| Value *any_value = value_per_output_id_[origin.id()]; | Value *any_value = value_per_output_id_[origin.id()]; | ||||
| BLI_assert(any_value != nullptr); | BLI_assert(any_value != nullptr); | ||||
| if (any_value->type == ValueType::OwnVector) { | if (any_value->type == ValueType::OwnVector) { | ||||
| OwnVectorValue *value = static_cast<OwnVectorValue *>(any_value); | OwnVectorValue *value = static_cast<OwnVectorValue *>(any_value); | ||||
| if (value->vector_array->size() == 1) { | if (value->vector_array->size() == 1) { | ||||
| GSpan span = (*value->vector_array)[0]; | GSpan span = (*value->vector_array)[0]; | ||||
| return scope.construct<GVVectorArrayForSingleGSpan>(__func__, span, min_array_size_); | return scope.construct<GVVectorArray_For_SingleGSpan>(__func__, span, min_array_size_); | ||||
| } | } | ||||
| return scope.construct<GVVectorArrayForGVectorArray>(__func__, *value->vector_array); | return scope.construct<GVVectorArray_For_GVectorArray>(__func__, *value->vector_array); | ||||
| } | } | ||||
| if (any_value->type == ValueType::InputVector) { | if (any_value->type == ValueType::InputVector) { | ||||
| InputVectorValue *value = static_cast<InputVectorValue *>(any_value); | InputVectorValue *value = static_cast<InputVectorValue *>(any_value); | ||||
| return value->virtual_vector_array; | return value->virtual_vector_array; | ||||
| } | } | ||||
| if (any_value->type == ValueType::OutputVector) { | if (any_value->type == ValueType::OutputVector) { | ||||
| OutputVectorValue *value = static_cast<OutputVectorValue *>(any_value); | OutputVectorValue *value = static_cast<OutputVectorValue *>(any_value); | ||||
| return scope.construct<GVVectorArrayForGVectorArray>(__func__, *value->vector_array); | return scope.construct<GVVectorArray_For_GVectorArray>(__func__, *value->vector_array); | ||||
| } | } | ||||
| BLI_assert(false); | BLI_assert(false); | ||||
| return scope.construct<GVVectorArrayForSingleGSpan>(__func__, GSpan(CPPType::get<float>()), 0); | return scope.construct<GVVectorArray_For_SingleGSpan>(__func__, GSpan(CPPType::get<float>()), 0); | ||||
| } | } | ||||
| const GVVectorArray &MFNetworkEvaluationStorage::get_vector_input__single( | const GVVectorArray &MFNetworkEvaluationStorage::get_vector_input__single( | ||||
| const MFInputSocket &socket, ResourceScope &scope) | const MFInputSocket &socket, ResourceScope &scope) | ||||
| { | { | ||||
| const MFOutputSocket &origin = *socket.origin(); | const MFOutputSocket &origin = *socket.origin(); | ||||
| Value *any_value = value_per_output_id_[origin.id()]; | Value *any_value = value_per_output_id_[origin.id()]; | ||||
| BLI_assert(any_value != nullptr); | BLI_assert(any_value != nullptr); | ||||
| if (any_value->type == ValueType::OwnVector) { | if (any_value->type == ValueType::OwnVector) { | ||||
| OwnVectorValue *value = static_cast<OwnVectorValue *>(any_value); | OwnVectorValue *value = static_cast<OwnVectorValue *>(any_value); | ||||
| BLI_assert(value->vector_array->size() == 1); | BLI_assert(value->vector_array->size() == 1); | ||||
| return scope.construct<GVVectorArrayForGVectorArray>(__func__, *value->vector_array); | return scope.construct<GVVectorArray_For_GVectorArray>(__func__, *value->vector_array); | ||||
| } | } | ||||
| if (any_value->type == ValueType::InputVector) { | if (any_value->type == ValueType::InputVector) { | ||||
| InputVectorValue *value = static_cast<InputVectorValue *>(any_value); | InputVectorValue *value = static_cast<InputVectorValue *>(any_value); | ||||
| BLI_assert(value->virtual_vector_array.is_single_vector()); | BLI_assert(value->virtual_vector_array.is_single_vector()); | ||||
| return value->virtual_vector_array; | return value->virtual_vector_array; | ||||
| } | } | ||||
| if (any_value->type == ValueType::OutputVector) { | if (any_value->type == ValueType::OutputVector) { | ||||
| OutputVectorValue *value = static_cast<OutputVectorValue *>(any_value); | OutputVectorValue *value = static_cast<OutputVectorValue *>(any_value); | ||||
| BLI_assert(value->vector_array->size() == 1); | BLI_assert(value->vector_array->size() == 1); | ||||
| return scope.construct<GVVectorArrayForGVectorArray>(__func__, *value->vector_array); | return scope.construct<GVVectorArray_For_GVectorArray>(__func__, *value->vector_array); | ||||
| } | } | ||||
| BLI_assert(false); | BLI_assert(false); | ||||
| return scope.construct<GVVectorArrayForSingleGSpan>(__func__, GSpan(CPPType::get<float>()), 0); | return scope.construct<GVVectorArray_For_SingleGSpan>(__func__, GSpan(CPPType::get<float>()), 0); | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| } // namespace blender::fn | } // namespace blender::fn | ||||