[Bf-blender-cvs] [6ac3a106190] master: Compositor: Fix constant folded operations not being rendered

Manuel Castilla noreply at git.blender.org
Wed Jul 7 01:22:58 CEST 2021


Commit: 6ac3a106190c1ebcf943e341d7078333f18bf8cb
Author: Manuel Castilla
Date:   Wed Jul 7 00:14:11 2021 +0200
Branches: master
https://developer.blender.org/rB6ac3a106190c1ebcf943e341d7078333f18bf8cb

Compositor: Fix constant folded operations not being rendered

Many operations do not expect single element buffers as output.
Use full buffers with a single pixel instead.

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

M	source/blender/compositor/intern/COM_ConstantFolder.cc

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

diff --git a/source/blender/compositor/intern/COM_ConstantFolder.cc b/source/blender/compositor/intern/COM_ConstantFolder.cc
index 8e25ef03aba..a9427013f87 100644
--- a/source/blender/compositor/intern/COM_ConstantFolder.cc
+++ b/source/blender/compositor/intern/COM_ConstantFolder.cc
@@ -92,13 +92,15 @@ static ConstantOperation *create_constant_operation(DataType data_type, const fl
 ConstantOperation *ConstantFolder::fold_operation(NodeOperation *operation)
 {
   const DataType data_type = operation->getOutputSocket()->getDataType();
-  MemoryBuffer *fold_buf = create_constant_buffer(data_type);
+  MemoryBuffer fold_buf(data_type, first_elem_area_);
   Vector<MemoryBuffer *> input_bufs = get_constant_input_buffers(operation);
-  operation->render(fold_buf, {first_elem_area_}, input_bufs);
+  operation->render(&fold_buf, {first_elem_area_}, input_bufs);
 
-  ConstantOperation *constant_op = create_constant_operation(data_type, fold_buf->getBuffer());
+  MemoryBuffer *constant_buf = create_constant_buffer(data_type);
+  constant_buf->copy_from(&fold_buf, first_elem_area_);
+  ConstantOperation *constant_op = create_constant_operation(data_type, constant_buf->getBuffer());
   operations_builder_.replace_operation_with_constant(operation, constant_op);
-  constant_buffers_.add_new(constant_op, fold_buf);
+  constant_buffers_.add_new(constant_op, constant_buf);
   return constant_op;
 }



More information about the Bf-blender-cvs mailing list