[Bf-blender-cvs] [300fe84bf0a] master: Compositor: Full frame Viewer node

Manuel Castilla noreply at git.blender.org
Mon Jul 19 22:06:46 CEST 2021


Commit: 300fe84bf0ad28b08ec3b5615d15d6b7352e3f7a
Author: Manuel Castilla
Date:   Mon Jul 19 18:36:18 2021 +0200
Branches: master
https://developer.blender.org/rB300fe84bf0ad28b08ec3b5615d15d6b7352e3f7a

Compositor: Full frame Viewer node

Adds full frame implementation to this node operation.
No functional changes.
No performance changes.

Reviewed By: jbakker

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

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

M	source/blender/compositor/operations/COM_ViewerOperation.cc
M	source/blender/compositor/operations/COM_ViewerOperation.h

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

diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc
index 860f56e23fa..e47396e14a1 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cc
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cc
@@ -191,10 +191,11 @@ void ViewerOperation::initImage()
   BLI_thread_unlock(LOCK_DRAW_IMAGE);
 }
 
-void ViewerOperation::updateImage(rcti *rect)
+void ViewerOperation::updateImage(const rcti *rect)
 {
+  float *buffer = m_outputBuffer;
   IMB_partial_display_buffer_update(this->m_ibuf,
-                                    this->m_outputBuffer,
+                                    buffer,
                                     nullptr,
                                     getWidth(),
                                     0,
@@ -218,4 +219,31 @@ eCompositorPriority ViewerOperation::getRenderPriority() const
   return eCompositorPriority::Low;
 }
 
+void ViewerOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(output),
+                                                   const rcti &area,
+                                                   Span<MemoryBuffer *> inputs)
+{
+  if (!m_outputBuffer) {
+    return;
+  }
+
+  MemoryBuffer output_buffer(
+      m_outputBuffer, COM_DATA_TYPE_COLOR_CHANNELS, getWidth(), getHeight());
+  const MemoryBuffer *input_image = inputs[0];
+  output_buffer.copy_from(input_image, area);
+  if (this->m_useAlphaInput) {
+    const MemoryBuffer *input_alpha = inputs[1];
+    output_buffer.copy_from(input_alpha, area, 0, COM_DATA_TYPE_VALUE_CHANNELS, 3);
+  }
+
+  if (m_depthBuffer) {
+    MemoryBuffer depth_buffer(
+        m_depthBuffer, COM_DATA_TYPE_VALUE_CHANNELS, getWidth(), getHeight());
+    const MemoryBuffer *input_depth = inputs[2];
+    depth_buffer.copy_from(input_depth, area);
+  }
+
+  updateImage(&area);
+}
+
 }  // namespace blender::compositor
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h
index c0f13ff79fc..ed05a7a282d 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerOperation.h
@@ -20,15 +20,17 @@
 
 #include "BKE_global.h"
 #include "BLI_rect.h"
-#include "COM_NodeOperation.h"
+#include "COM_MultiThreadedOperation.h"
 #include "DNA_image_types.h"
 
 namespace blender::compositor {
 
-class ViewerOperation : public NodeOperation {
+class ViewerOperation : public MultiThreadedOperation {
  private:
+  /* TODO(manzanilla): To be removed together with tiled implementation. */
   float *m_outputBuffer;
   float *m_depthBuffer;
+
   Image *m_image;
   ImageUser *m_imageUser;
   bool m_active;
@@ -125,8 +127,12 @@ class ViewerOperation : public NodeOperation {
     this->m_displaySettings = displaySettings;
   }
 
+  void update_memory_buffer_partial(MemoryBuffer *output,
+                                    const rcti &area,
+                                    Span<MemoryBuffer *> inputs) override;
+
  private:
-  void updateImage(rcti *rect);
+  void updateImage(const rcti *rect);
   void initImage();
 };



More information about the Bf-blender-cvs mailing list