[Bf-blender-cvs] [de214ddecb3] temp-viewport-compositor-compiler: Viewport Compositor: Correct domain for viewer node

Omar Emara noreply at git.blender.org
Thu Mar 31 11:09:45 CEST 2022


Commit: de214ddecb388586bcfc1d15e2c5bff6b17b1a01
Author: Omar Emara
Date:   Thu Mar 31 11:08:50 2022 +0200
Branches: temp-viewport-compositor-compiler
https://developer.blender.org/rBde214ddecb388586bcfc1d15e2c5bff6b17b1a01

Viewport Compositor: Correct domain for viewer node

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

M	source/blender/nodes/composite/nodes/node_composite_viewer.cc

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

diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.cc b/source/blender/nodes/composite/nodes/node_composite_viewer.cc
index 2fdf8c4e044..fa36987309a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_viewer.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.cc
@@ -85,15 +85,27 @@ class ViewerOperation : public NodeOperation {
   {
     const Result &input_image = get_input("Image");
     GPUTexture *viewport_texture = context().get_viewport_texture();
+
+    /* If the input image is a texture, copy the input texture to the viewport texture. */
     if (get_input("Image").is_texture()) {
-      /* If the input image is a texture, copy the input texture to the viewport texture. */
+      /* Make sure any prior writes to the texture are reflected before copying it. */
+      GPU_memory_barrier(GPU_BARRIER_TEXTURE_UPDATE);
+
       GPU_texture_copy(viewport_texture, input_image.texture());
     }
     else {
-      /* If the input image is a single color value, clear the viewport texture to that color. */
+      /* Otherwise, if the input image is a single color value, clear the viewport texture to that
+       * color. */
       GPU_texture_clear(viewport_texture, GPU_DATA_FLOAT, input_image.get_color_value());
     }
   }
+
+  /* The operation domain have the same dimensions of the viewport without any transformations. */
+  Domain compute_domain() override
+  {
+    GPUTexture *viewport_texture = context().get_viewport_texture();
+    return Domain(int2(GPU_texture_width(viewport_texture), GPU_texture_height(viewport_texture)));
+  }
 };
 
 static NodeOperation *get_compositor_operation(Context &context, DNode node)



More information about the Bf-blender-cvs mailing list