29 std::unique_ptr<ResourceScope> scope_;
78 void assert_current_param_name(
StringRef expected_name);
80 int current_param_index()
const;
84 void add_unused_output_for_unsupporting_function(
const CPPType &type);
141inline ParamsBuilder::ParamsBuilder(
const Signature &signature,
const IndexMask &
mask)
142 : signature_(&signature), mask_(
mask), min_array_size_(
mask.min_array_size())
144 actual_params_.reserve(signature.params.size());
151 actual_params_.append_unchecked_as(std::in_place_type<GVArray>,
162 actual_params_.append_unchecked_as(std::in_place_type<GVArray>,
173 actual_params_.append_unchecked_as(std::in_place_type<GVArray>,
varray_tag::span{}, span);
179 actual_params_.append_unchecked_as(std::in_place_type<GVArray>,
190 actual_params_.append_unchecked_as(std::in_place_type<GVArray>, std::move(varray));
197 this->resource_scope().construct<GVVectorArray_For_GVectorArray>(vector_array),
205 single_vector, min_array_size_),
214 actual_params_.append_unchecked_as(std::in_place_type<const GVVectorArray *>, &ref);
228 actual_params_.append_unchecked_as(std::in_place_type<GMutableSpan>, ref);
233 this->assert_current_param_name(expected_name);
234 const int param_index = this->current_param_index();
235 const ParamType ¶m_type = signature_->params[param_index].type;
243 actual_params_.append_unchecked_as(std::in_place_type<GMutableSpan>, dummy_span);
246 this->add_unused_output_for_unsupporting_function(type);
254 actual_params_.append_unchecked_as(std::in_place_type<GVectorArray *>, &vector_array);
261 actual_params_.append_unchecked_as(std::in_place_type<GMutableSpan>, ref);
268 actual_params_.append_unchecked_as(std::in_place_type<GVectorArray *>, &vector_array);
273 return actual_params_.size();
281 return std::get<GMutableSpan>(actual_params_[param_index]);
289 return *std::get<GVectorArray *>(actual_params_[param_index]);
292inline void ParamsBuilder::assert_current_param_type(
ParamType param_type,
StringRef expected_name)
296 int param_index = this->current_param_index();
298 if (expected_name !=
"") {
303 ParamType expected_type = signature_->
params[param_index].type;
308inline void ParamsBuilder::assert_current_param_name(
StringRef expected_name)
315 const int param_index = this->current_param_index();
321inline int ParamsBuilder::current_param_index()
const
323 return actual_params_.size();
326inline ResourceScope &ParamsBuilder::resource_scope()
329 scope_ = std::make_unique<ResourceScope>();
350 return std::get<GVArray>(builder_->actual_params_[param_index]);
356 return !std::get<GMutableSpan>(builder_->actual_params_[param_index]).is_empty();
370 GMutableSpan span = std::get<GMutableSpan>(builder_->actual_params_[param_index]);
388 return std::get<GMutableSpan>(builder_->actual_params_[param_index]);
401 return *std::get<const GVVectorArray *>(builder_->actual_params_[param_index]);
413 return *std::get<GVectorArray *>(builder_->actual_params_[param_index]);
424 return std::get<GMutableSpan>(builder_->actual_params_[param_index]);
436 return *std::get<GVectorArray *>(builder_->actual_params_[param_index]);
444 if (
name.size() > 0) {
454 BLI_assert(builder_->signature_->
params[param_index].type.category() == category);
455 if (
name.size() > 0) {
#define UNUSED_VARS_NDEBUG(...)
static const CPPType & get()
const CPPType & type() const
const CPPType * type() const
const CPPType & type() const
const CPPType & type() const
VArray< T > typed() const
const CPPType & type() const
const CPPType & type() const
constexpr bool is_empty() const
const CPPType & single_type() const
static ParamType ForVectorInput(const CPPType &base_type)
const DataType & data_type() const
static ParamType ForSingleOutput(const CPPType &type)
static ParamType ForVectorOutput(const CPPType &base_type)
static ParamType ForMutableSingle(const CPPType &type)
static ParamType ForMutableVector(const CPPType &base_type)
ParamCategory category() const
static ParamType ForSingleInput(const CPPType &type)
void add_single_mutable(GMutableSpan ref, StringRef expected_name="")
GVectorArray & computed_vector_array(int param_index)
int next_param_index() const
void add_ignored_single_output(StringRef expected_name="")
void add_uninitialized_single_output(T *value, StringRef expected_name="")
void add_vector_output(GVectorArray &vector_array, StringRef expected_name="")
GMutableSpan computed_array(int param_index)
void add_vector_mutable(GVectorArray &vector_array, StringRef expected_name="")
ParamsBuilder(const class MultiFunction &fn, const IndexMask *mask)
void add_readonly_single_input(const T *value, StringRef expected_name="")
void add_readonly_vector_input(const GVectorArray &vector_array, StringRef expected_name="")
void add_readonly_single_input_value(T value, StringRef expected_name="")
MutableSpan< T > uninitialized_single_output_if_required(int param_index, StringRef name="")
const VVectorArray< T > & readonly_vector_input(int param_index, StringRef name="")
MutableSpan< T > uninitialized_single_output(int param_index, StringRef name="")
GVectorArray_TypedMutableRef< T > vector_mutable(int param_index, StringRef name="")
GVectorArray_TypedMutableRef< T > vector_output(int param_index, StringRef name="")
MutableSpan< T > single_mutable(int param_index, StringRef name="")
Params(ParamsBuilder &builder)
VArray< T > readonly_single_input(int param_index, StringRef name="")
bool single_output_is_required(int param_index, StringRef name="")
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
Vector< ParamInfo > params