[Bf-blender-cvs] [03f33a6f237] master: Realtime Compositor: Allow inputs to skip realization

Omar Emara noreply at git.blender.org
Fri Sep 9 14:23:05 CEST 2022


Commit: 03f33a6f237fba668d5caf900d9bdec73e366fef
Author: Omar Emara
Date:   Fri Sep 9 14:22:03 2022 +0200
Branches: master
https://developer.blender.org/rB03f33a6f237fba668d5caf900d9bdec73e366fef

Realtime Compositor: Allow inputs to skip realization

This patch adds support for the skip realization option of the input
descriptor. Inputs that request skip realization will not be realized on
the operation domain of the operation and will not contribute to its
computation, and consequently, they can't be a domain input.

An example is the bokeh input of the Bokeh Blur node, which is actually
a resource that is decoupled from the rest of the inputs and should not
affect or be affected by their domain.

Differential Revision: https://developer.blender.org/D15767

Reviewed By: Clement Foucault

===================================================================

M	source/blender/compositor/realtime_compositor/intern/compile_state.cc
M	source/blender/compositor/realtime_compositor/intern/operation.cc
M	source/blender/compositor/realtime_compositor/intern/utilities.cc
M	source/blender/nodes/NOD_node_declaration.hh

===================================================================

diff --git a/source/blender/compositor/realtime_compositor/intern/compile_state.cc b/source/blender/compositor/realtime_compositor/intern/compile_state.cc
index 97c1e47e86e..5fa2fc9d544 100644
--- a/source/blender/compositor/realtime_compositor/intern/compile_state.cc
+++ b/source/blender/compositor/realtime_compositor/intern/compile_state.cc
@@ -149,6 +149,11 @@ Domain CompileState::compute_shader_node_domain(DNode node)
       continue;
     }
 
+    /* An input that skips realization can't be a domain input. */
+    if (input_descriptor.skip_realization) {
+      continue;
+    }
+
     /* Notice that the lower the domain priority value is, the higher the priority is, hence the
      * less than comparison. */
     if (input_descriptor.domain_priority < current_domain_priority) {
diff --git a/source/blender/compositor/realtime_compositor/intern/operation.cc b/source/blender/compositor/realtime_compositor/intern/operation.cc
index fb02807d729..832196cc5ef 100644
--- a/source/blender/compositor/realtime_compositor/intern/operation.cc
+++ b/source/blender/compositor/realtime_compositor/intern/operation.cc
@@ -66,6 +66,11 @@ Domain Operation::compute_domain()
       continue;
     }
 
+    /* An input that skips realization can't be a domain input. */
+    if (descriptor.skip_realization) {
+      continue;
+    }
+
     /* Notice that the lower the domain priority value is, the higher the priority is, hence the
      * less than comparison. */
     if (descriptor.domain_priority < current_domain_priority) {
diff --git a/source/blender/compositor/realtime_compositor/intern/utilities.cc b/source/blender/compositor/realtime_compositor/intern/utilities.cc
index 2e1baec98a8..1a5823b8441 100644
--- a/source/blender/compositor/realtime_compositor/intern/utilities.cc
+++ b/source/blender/compositor/realtime_compositor/intern/utilities.cc
@@ -116,6 +116,7 @@ InputDescriptor input_descriptor_from_input_socket(const bNodeSocket *socket)
   }
   const SocketDeclarationPtr &socket_declaration = node_declaration->inputs()[socket->index()];
   input_descriptor.domain_priority = socket_declaration->compositor_domain_priority();
+  input_descriptor.skip_realization = socket_declaration->compositor_skip_realization();
   input_descriptor.expects_single_value = socket_declaration->compositor_expects_single_value();
   return input_descriptor;
 }
diff --git a/source/blender/nodes/NOD_node_declaration.hh b/source/blender/nodes/NOD_node_declaration.hh
index d8b8c354230..42755b2e8dd 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -92,6 +92,10 @@ class SocketDeclaration {
    * realtime_compositor::InputDescriptor for more information. */
   int compositor_domain_priority_ = 0;
 
+  /** This input shouldn't be realized on the operation domain of the node. See
+   * realtime_compositor::InputDescriptor for more information. */
+  bool compositor_skip_realization_ = false;
+
   /** This input expects a single value and can't operate on non-single values. See
    * realtime_compositor::InputDescriptor for more information. */
   bool compositor_expects_single_value_ = false;
@@ -133,6 +137,7 @@ class SocketDeclaration {
   const OutputFieldDependency &output_field_dependency() const;
 
   int compositor_domain_priority() const;
+  bool compositor_skip_realization() const;
   bool compositor_expects_single_value() const;
 
  protected:
@@ -257,6 +262,14 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
     return *(Self *)this;
   }
 
+  /** This input shouldn't be realized on the operation domain of the node. See
+   * realtime_compositor::InputDescriptor for more information. */
+  Self &compositor_skip_realization(bool value = true)
+  {
+    decl_->compositor_skip_realization_ = value;
+    return *(Self *)this;
+  }
+
   /** This input expects a single value and can't operate on non-single values. See
    * realtime_compositor::InputDescriptor for more information. */
   Self &compositor_expects_single_value(bool value = true)
@@ -460,6 +473,11 @@ inline int SocketDeclaration::compositor_domain_priority() const
   return compositor_domain_priority_;
 }
 
+inline bool SocketDeclaration::compositor_skip_realization() const
+{
+  return compositor_skip_realization_;
+}
+
 inline bool SocketDeclaration::compositor_expects_single_value() const
 {
   return compositor_expects_single_value_;



More information about the Bf-blender-cvs mailing list