Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Emara <mail@OmarEmara.dev>2022-08-10 10:14:22 +0300
committerOmar Emara <mail@OmarEmara.dev>2022-08-10 10:14:22 +0300
commit624b0ac656e4876c8518adb479be94e581c46bb8 (patch)
treecd5cd314498cab0ca367d33ce41f768de1af378e /source/blender/compositor/realtime_compositor/COM_simple_operation.hh
parent169216684a7dd9fff065bad2c0bad60578f9412f (diff)
Realtime Compositor: Add evaluator and engine
This patch adds the core realtime compositor evaluator as well as a compositor draw engine powered by the evaluator that operates in the viewport. The realtime compositor is a new GPU accelerated compositor that will be used to power the viewport compositor imminently as well as the existing compositor in the future. This patch only adds the evaluator and engine as an experimental feature, the implementation of the nodes themselves will be committed separately. See T99210. Differential Revision: https://developer.blender.org/D15206 Reviewed By: Clement Foucault
Diffstat (limited to 'source/blender/compositor/realtime_compositor/COM_simple_operation.hh')
-rw-r--r--source/blender/compositor/realtime_compositor/COM_simple_operation.hh64
1 files changed, 64 insertions, 0 deletions
diff --git a/source/blender/compositor/realtime_compositor/COM_simple_operation.hh b/source/blender/compositor/realtime_compositor/COM_simple_operation.hh
new file mode 100644
index 00000000000..2f743da50d6
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/COM_simple_operation.hh
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#pragma once
+
+#include "BLI_string_ref.hh"
+
+#include "COM_operation.hh"
+#include "COM_result.hh"
+
+namespace blender::realtime_compositor {
+
+/* ------------------------------------------------------------------------------------------------
+ * Simple Operation
+ *
+ * A simple operation is an operation that takes exactly one input and computes exactly one output.
+ * Moreover, the output is guaranteed to only have a single user, that is, its reference count will
+ * be one. Such operations can be attached to the inputs of operations to pre-process the inputs to
+ * prepare them before the operation is executed.*/
+class SimpleOperation : public Operation {
+ private:
+ /* The identifier of the output. This is constant for all operations. */
+ static const StringRef output_identifier_;
+ /* The identifier of the input. This is constant for all operations. */
+ static const StringRef input_identifier_;
+
+ public:
+ using Operation::Operation;
+
+ /* Get a reference to the output result of the operation, this essentially calls the super
+ * get_result method with the output identifier of the operation. */
+ Result &get_result();
+
+ /* Map the input of the operation to the given result, this essentially calls the super
+ * map_input_to_result method with the input identifier of the operation. */
+ void map_input_to_result(Result *result);
+
+ protected:
+ /* Simple operations don't need input processors, so override with an empty implementation. */
+ void add_and_evaluate_input_processors() override;
+
+ /* Get a reference to the input result of the operation, this essentially calls the super
+ * get_result method with the input identifier of the operation. */
+ Result &get_input();
+
+ /* Switch the result mapped to the input with the given result, this essentially calls the super
+ * switch_result_mapped_to_input method with the input identifier of the operation. */
+ void switch_result_mapped_to_input(Result *result);
+
+ /* Populate the result of the operation, this essentially calls the super populate_result method
+ * with the output identifier of the operation and sets the initial reference count of the result
+ * to 1, since the result of an operation operation is guaranteed to have a single user. */
+ void populate_result(Result result);
+
+ /* Declare the descriptor of the input of the operation to be the given descriptor, this
+ * essentially calls the super declare_input_descriptor method with the input identifier of the
+ * operation. */
+ void declare_input_descriptor(InputDescriptor descriptor);
+
+ /* Get a reference to the descriptor of the input, this essentially calls the super
+ * get_input_descriptor method with the input identifier of the operation. */
+ InputDescriptor &get_input_descriptor();
+};
+
+} // namespace blender::realtime_compositor