Blender V5.0
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
8
9#include "FN_lazy_function.hh"
10
12
13std::string LazyFunction::name() const
14{
15 return debug_name_;
16}
17
18std::string LazyFunction::input_name(int index) const
19{
20 return inputs_[index].debug_name;
21}
22
23std::string LazyFunction::output_name(int index) const
24{
25 return outputs_[index].debug_name;
26}
27
29{
30 return nullptr;
31}
32
33void LazyFunction::destruct_storage(void *storage) const
34{
35 BLI_assert(storage == nullptr);
36 UNUSED_VARS_NDEBUG(storage);
37}
38
39void LazyFunction::possible_output_dependencies(const int /*output_index*/,
40 const FunctionRef<void(Span<int>)> fn) const
41{
42 /* The output depends on all inputs by default. */
44 for (const int i : inputs_.index_range()) {
45 indices[i] = i;
46 }
47 fn(indices);
48}
49
51{
53 return true;
54 }
55 for (const int i : inputs_.index_range()) {
56 const Input &fn_input = inputs_[i];
57 if (fn_input.usage == ValueUsage::Used) {
58 if (params.try_get_input_data_ptr(i) == nullptr) {
59 return false;
60 }
61 }
62 }
63 return true;
64}
65
66bool Params::try_enable_multi_threading_impl()
67{
68 return false;
69}
70
71} // namespace blender::fn::lazy_function
#define BLI_assert(a)
Definition BLI_assert.h:46
#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
static ushort indices[]
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
i
Definition text_draw.cc:230