[Bf-blender-cvs] [4b685e1] master: Fix T44268: Particles: too many virtual parents + non-100 display% = crash
Sergey Sharybin
noreply at git.blender.org
Tue Apr 7 10:52:53 CEST 2015
Commit: 4b685e1b90c555a222d524b16a482913865683aa
Author: Sergey Sharybin
Date: Tue Apr 7 13:50:11 2015 +0500
Branches: master
https://developer.blender.org/rB4b685e1b90c555a222d524b16a482913865683aa
Fix T44268: Particles: too many virtual parents + non-100 display% = crash
Issue was caused by mismatched logic in counting child/parent particles in
job initialization and actual job execution. Confusion here came from mixed
usage of psys->renderdata and G.is_rendering.
We need to get rid of G.is_rendering and use eval_ctx if it's really needed,
but we also might just use psys->renderdata check since it's expected psys
to have this structure anyway.
===================================================================
M source/blender/blenkernel/intern/particle.c
===================================================================
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 8d3f921..fbd5592 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -286,7 +286,7 @@ bool psys_check_enabled(Object *ob, ParticleSystem *psys)
return 0;
psmd = psys_get_modifier(ob, psys);
- if (psys->renderdata || G.is_rendering) {
+ if (psys->renderdata) {
if (!(psmd->modifier.mode & eModifierMode_Render))
return 0;
}
@@ -1955,7 +1955,7 @@ void psys_find_parents(ParticleSimulationData *sim)
int from = PART_FROM_FACE;
totparent = (int)(totchild * part->parents * 0.3f);
- if ((sim->psys->renderdata || G.is_rendering) && part->child_nbr && part->ren_child_nbr)
+ if (sim->psys->renderdata && part->child_nbr && part->ren_child_nbr)
totparent *= (float)part->child_nbr / (float)part->ren_child_nbr;
/* hard limit, workaround for it being ignored above */
@@ -2009,7 +2009,7 @@ static bool psys_thread_context_init_path(ParticleThreadContext *ctx, ParticleSi
if (totchild && part->childtype == PART_CHILD_FACES) {
totparent = (int)(totchild * part->parents * 0.3f);
- if ((psys->renderdata || G.is_rendering) && part->child_nbr && part->ren_child_nbr)
+ if (psys->renderdata && part->child_nbr && part->ren_child_nbr)
totparent *= (float)part->child_nbr / (float)part->ren_child_nbr;
/* part->parents could still be 0 so we can't test with totparent */
@@ -2288,6 +2288,7 @@ static void psys_thread_create_path(ParticleTask *task, struct ChildParticle *cp
if (i >= ctx->totparent) {
pa = &psys->particles[cpa->parent];
/* this is now threadsafe, virtual parents are calculated before rest of children */
+ BLI_assert(cpa->parent < psys->totchildcache);
par = cache[cpa->parent];
}
}
@@ -2335,6 +2336,7 @@ static void exec_child_path_cache(TaskPool *UNUSED(pool), void *taskdata, int UN
cpa = psys->child + task->begin;
for (i = task->begin; i < task->end; ++i, ++cpa) {
+ BLI_assert(i < psys->totchildcache);
psys_thread_create_path(task, cpa, cache[i], i);
}
}
More information about the Bf-blender-cvs
mailing list