Blender V4.3
lazy_function.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "BLI_array.hh"
10
11#include "FN_lazy_function.hh"
12
14
15std::string LazyFunction::name() const
16{
17 return debug_name_;
18}
19
20std::string LazyFunction::input_name(int index) const
21{
22 return inputs_[index].debug_name;
23}
24
25std::string LazyFunction::output_name(int index) const
26{
27 return outputs_[index].debug_name;
28}
29
31{
32 return nullptr;
33}
34
35void LazyFunction::destruct_storage(void *storage) const
36{
37 BLI_assert(storage == nullptr);
38 UNUSED_VARS_NDEBUG(storage);
39}
40
41void LazyFunction::possible_output_dependencies(const int /*output_index*/,
42 const FunctionRef<void(Span<int>)> fn) const
43{
44 /* The output depends on all inputs by default. */
46 for (const int i : inputs_.index_range()) {
47 indices[i] = i;
48 }
49 fn(indices);
50}
51
53{
55 return true;
56 }
57 for (const int i : inputs_.index_range()) {
58 const Input &fn_input = inputs_[i];
59 if (fn_input.usage == ValueUsage::Used) {
60 if (params.try_get_input_data_ptr(i) == nullptr) {
61 return false;
62 }
63 }
64 }
65 return true;
66}
67
68bool Params::try_enable_multi_threading_impl()
69{
70 return false;
71}
72
77
78} // namespace blender::fn::lazy_function
#define BLI_assert(a)
Definition BLI_assert.h:50
#define UNUSED_VARS_NDEBUG(...)
virtual void * init_storage(LinearAllocator<> &allocator) const
bool always_used_inputs_available(const Params &params) const
virtual void possible_output_dependencies(int output_index, FunctionRef< void(Span< int >)> fn) const
virtual std::string output_name(int index) const
virtual void destruct_storage(void *storage) const
virtual std::string input_name(int index) const
virtual destruct_ptr< LocalUserData > get_local(LinearAllocator<> &allocator)
static ushort indices[]
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
std::unique_ptr< T, DestructValueAtAddress< T > > destruct_ptr