[Bf-blender-cvs] [1a0a22f95a2] blender-v3.1-release: Fix T95413: Blur node size input crash

Habib Gahbiche noreply at git.blender.org
Sun Feb 20 23:03:26 CET 2022


Commit: 1a0a22f95a22496dec2791441249265d553dc2d7
Author: Habib Gahbiche
Date:   Wed Feb 9 20:17:48 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB1a0a22f95a22496dec2791441249265d553dc2d7

Fix T95413: Blur node size input crash

Bug was introduced in D12167.

Reading input size from an input socket is not possible in tiled compositor before execution is initialized. A similar change was done for the base class, see BlurBaseOperation::init_data().

Reviewed by: Jeroen Bakker

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

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

M	source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc

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

diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc
index db5f9c7c35d..49e761d6221 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc
@@ -44,8 +44,10 @@ void GaussianBokehBlurOperation::init_data()
   const float width = this->get_width();
   const float height = this->get_height();
 
-  if (!sizeavailable_) {
-    update_size();
+  if(execution_model_ == eExecutionModel::FullFrame) {
+    if (!sizeavailable_) {
+      update_size();
+    }
   }
 
   radxf_ = size_ * (float)data_.sizex;
@@ -111,6 +113,22 @@ void GaussianBokehBlurOperation::update_gauss()
 
 void GaussianBokehBlurOperation::execute_pixel(float output[4], int x, int y, void *data)
 {
+  float result[4];
+  input_size_->read_sampled(result, 0, 0, PixelSampler::Nearest);
+  size_ = result[0];
+
+  const float width = this->get_width();
+  const float height = this->get_height();
+
+  radxf_ = size_ * (float)data_.sizex;
+  CLAMP(radxf_, 0.0f, width / 2.0f);
+
+  radyf_ = size_ * (float)data_.sizey;
+  CLAMP(radyf_, 0.0f, height / 2.0f);
+
+  radx_ = ceil(radxf_);
+  rady_ = ceil(radyf_);
+
   float temp_color[4];
   temp_color[0] = 0;
   temp_color[1] = 0;



More information about the Bf-blender-cvs mailing list