Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastián Barschkis <sebbas@sebbas.org>2020-09-10 12:09:49 +0300
committerJeroen Bakker <jeroen@blender.org>2020-09-21 10:18:18 +0300
commit5d10814cccecd2a838fdaf6d991d5e9a335a35eb (patch)
tree51949c2a7e80bda9222ac777b649c6e138965f50
parent21e3b89634d3d517518dc340b8b26775aff500d2 (diff)
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.
-rw-r--r--source/blender/blenkernel/intern/fluid.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index 079b436a3ea..f0f01df723e 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++) {
@@ -3790,6 +3790,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;
@@ -3870,8 +3877,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:
@@ -3935,12 +3940,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;
/* Try to read from cache and keep track of read success. */
if (read_cache) {