[Bf-blender-cvs] [60b2bb3a1cc] master: Fix T79626: 2.91 Mantaflow crash when adaptive domain + noise are enabled

Sebastián Barschkis noreply at git.blender.org
Thu Sep 10 11:10:07 CEST 2020


Commit: 60b2bb3a1cc24f25f27c5be0f000344703071694
Author: Sebastián Barschkis
Date:   Thu Sep 10 11:09:49 2020 +0200
Branches: master
https://developer.blender.org/rB60b2bb3a1cc24f25f27c5be0f000344703071694

Fix T79626: 2.91 Mantaflow crash when adaptive domain + noise are enabled

Crash was caused by an incorect domain size of the noise solver and an index out of bounds.

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

M	source/blender/blenkernel/intern/fluid.c

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

diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index e3063d1de75..df7d308a87c 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -181,7 +181,6 @@ void BKE_fluid_reallocate_copy_fluid(FluidDomainSettings *fds,
     float *n_b = manta_smoke_get_color_b(fds->fluid);
 
     /* Noise smoke fields. */
-    int wt_res_old[3];
     float *o_wt_dens = manta_noise_get_density(fluid_old);
     float *o_wt_react = manta_noise_get_react(fluid_old);
     float *o_wt_flame = manta_noise_get_flame(fluid_old);
@@ -210,6 +209,7 @@ void BKE_fluid_reallocate_copy_fluid(FluidDomainSettings *fds,
     float *n_wt_tcv2 = manta_noise_get_texture_v2(fds->fluid);
     float *n_wt_tcw2 = manta_noise_get_texture_w2(fds->fluid);
 
+    int wt_res_old[3];
     manta_noise_get_res(fluid_old, wt_res_old);
 
     for (int z = o_min[2]; z < o_max[2]; z++) {
@@ -3815,6 +3815,13 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *fmd,
     }
   }
 
+  /* Adaptive domain needs to know about current state, so save it here. */
+  int o_res[3], o_min[3], o_max[3], o_shift[3];
+  copy_v3_v3_int(o_res, fds->res);
+  copy_v3_v3_int(o_min, fds->res_min);
+  copy_v3_v3_int(o_max, fds->res_max);
+  copy_v3_v3_int(o_shift, fds->shift);
+
   /* Ensure that time parameters are initialized correctly before every step. */
   float fps = scene->r.frs_sec / scene->r.frs_sec_base;
   fds->frame_length = DT_DEFAULT * (25.0f / fps) * fds->time_scale;
@@ -3903,8 +3910,6 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *fmd,
   bool with_gdomain;
   with_gdomain = (fds->guide_source == FLUID_DOMAIN_GUIDE_SRC_DOMAIN);
 
-  int o_res[3], o_min[3], o_max[3], o_shift[3];
-
   /* Cache mode specific settings. */
   switch (mode) {
     case FLUID_DOMAIN_CACHE_ALL:
@@ -3968,12 +3973,6 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *fmd,
       break;
   }
 
-  /* Adaptive domain needs to know about current state, so save it here. */
-  copy_v3_v3_int(o_res, fds->res);
-  copy_v3_v3_int(o_min, fds->res_min);
-  copy_v3_v3_int(o_max, fds->res_max);
-  copy_v3_v3_int(o_shift, fds->shift);
-
   bool read_partial = false, read_all = false;
   bool grid_display = fds->use_coba;



More information about the Bf-blender-cvs mailing list