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:
Diffstat (limited to 'source/blender/compositor/realtime_compositor/COM_reduce_to_single_value_operation.hh')
-rw-r--r--source/blender/compositor/realtime_compositor/COM_reduce_to_single_value_operation.hh31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/compositor/realtime_compositor/COM_reduce_to_single_value_operation.hh b/source/blender/compositor/realtime_compositor/COM_reduce_to_single_value_operation.hh
new file mode 100644
index 00000000000..2f5a82c79b7
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/COM_reduce_to_single_value_operation.hh
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#pragma once
+
+#include "COM_context.hh"
+#include "COM_result.hh"
+#include "COM_simple_operation.hh"
+
+namespace blender::realtime_compositor {
+
+/* ------------------------------------------------------------------------------------------------
+ * Reduce To Single Value Operation
+ *
+ * A simple operation that reduces its input result into a single value output result. The input is
+ * assumed to be a texture result of size 1x1, that is, a texture composed of a single pixel, the
+ * value of which shall serve as the single value of the output result. */
+class ReduceToSingleValueOperation : public SimpleOperation {
+ public:
+ ReduceToSingleValueOperation(Context &context, ResultType type);
+
+ /* Download the input pixel from the GPU texture and set its value to the value of the allocated
+ * single value output result. */
+ void execute() override;
+
+ /* Determine if a reduce to single value operation is needed for the input with the
+ * given result. If it is not needed, return a null pointer. If it is needed, return an instance
+ * of the operation. */
+ static SimpleOperation *construct_if_needed(Context &context, const Result &input_result);
+};
+
+} // namespace blender::realtime_compositor