Blender V4.3
COM_utilities.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include "BLI_function_ref.hh"
9
11
12#include "GPU_shader.hh"
13
15#include "COM_result.hh"
16
18
19using namespace nodes::derived_node_tree_types;
20
27DSocket get_input_origin_socket(DInputSocket input);
28
33DOutputSocket get_output_linked_to_input(DInputSocket input);
34
37
42bool is_output_linked_to_node_conditioned(DOutputSocket output,
43 FunctionRef<bool(DNode)> condition);
44
47 FunctionRef<bool(DInputSocket)> condition);
48
50bool is_pixel_node(DNode node);
51
53InputDescriptor input_descriptor_from_input_socket(const bNodeSocket *socket);
54
64 int2 threads_range,
65 int2 local_size = int2(16));
66
67/* Returns true if a node preview needs to be computed for the give node. */
68bool is_node_preview_needed(const DNode &node);
69
70/* Returns the node output that will be used to generate previews. */
71DOutputSocket find_preview_output_socket(const DNode &node);
72
73/* Computes a lower resolution version of the given result and sets it as a preview for the given
74 * node after applying the appropriate color management specified in the given context. */
75void compute_preview_from_result(Context &context, const DNode &node, Result &input_result);
76
77/* Executes the given function in parallel over the given 2D range. The given function gets the
78 * texel coordinates of the element of the range as an argument. */
79void parallel_for(const int2 range, FunctionRef<void(int2)> function);
80
81} // namespace blender::realtime_compositor
struct GPUShader GPUShader
bool is_pixel_node(DNode node)
Definition utilities.cc:104
bool is_node_preview_needed(const DNode &node)
Definition utilities.cc:141
bool is_output_linked_to_node_conditioned(DOutputSocket output, FunctionRef< bool(DNode)> condition)
Definition utilities.cc:78
void compute_preview_from_result(Context &context, const DNode &node, Result &input_result)
Definition utilities.cc:190
DOutputSocket get_output_linked_to_input(DInputSocket input)
Definition utilities.cc:47
int number_of_inputs_linked_to_output_conditioned(DOutputSocket output, FunctionRef< bool(DInputSocket)> condition)
Definition utilities.cc:91
void parallel_for(const int2 range, FunctionRef< void(int2)> function)
Definition utilities.cc:252
DOutputSocket find_preview_output_socket(const DNode &node)
Definition utilities.cc:161
ResultType get_node_socket_result_type(const bNodeSocket *socket)
Definition utilities.cc:63
InputDescriptor input_descriptor_from_input_socket(const bNodeSocket *socket)
Definition utilities.cc:109
void compute_dispatch_threads_at_least(GPUShader *shader, int2 threads_range, int2 local_size=int2(16))
Definition utilities.cc:131
DSocket get_input_origin_socket(DInputSocket input)
Definition utilities.cc:34
VecBase< int32_t, 2 > int2