Blender V5.0
COM_conversion_operation.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 "COM_context.hh"
9#include "COM_result.hh"
11
12namespace blender::compositor {
13
14/* --------------------------------------------------------------------
15 * Conversion Operation
16 *
17 * A simple operation that converts a result from a certain type to another. See the derived
18 * classes for more details. */
20 public:
22 const ResultType input_type,
23 const ResultType expected_type);
24
25 /* If the input result is a single value, execute_single is called. Otherwise, the shader
26 * provided by get_conversion_shader is dispatched for GPU contexts or execute_cpu is called for
27 * CPU contexts. */
28 void execute() override;
29
30 /* Determine if a conversion operation is needed for the input with the given result and
31 * descriptor. If it is not needed, return a null pointer. If it is needed, return an instance of
32 * the appropriate conversion operation. */
34 const Result &input_result,
35 const InputDescriptor &input_descriptor);
36
37 private:
38 /* Convert the input single value result to the output single value result. */
39 void execute_single(const Result &input, Result &output);
40
41 /* Convert the input to the appropriate type and write the result to the output on the CPU. */
42 void execute_cpu(const Result &input, Result &output);
43};
44
45} // namespace blender::compositor
static SimpleOperation * construct_if_needed(Context &context, const Result &input_result, const InputDescriptor &input_descriptor)
ConversionOperation(Context &context, const ResultType input_type, const ResultType expected_type)
#define input
#define output