diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-23 21:06:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-23 21:07:45 +0400 |
commit | 1e6fa59e4f4447bfeecd5abb868361ae1b7ab9ab (patch) | |
tree | 966c2df6f241b2b8ebd118913fc98da5a22d1958 /source/blender/render/intern/raytrace | |
parent | d4261d02bd5cee3fbc8b70a9d2ed9699e1cf4625 (diff) |
Fix T39852: Crash (Blender internal) large objects
Add check when bounds reached inf
Diffstat (limited to 'source/blender/render/intern/raytrace')
-rw-r--r-- | source/blender/render/intern/raytrace/reorganize.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/render/intern/raytrace/reorganize.h b/source/blender/render/intern/raytrace/reorganize.h index 33b5258dd94..e25538cd584 100644 --- a/source/blender/render/intern/raytrace/reorganize.h +++ b/source/blender/render/intern/raytrace/reorganize.h @@ -288,6 +288,7 @@ static float bvh_refit(Node *node) #define MAX_OPTIMIZE_CHILDS MAX_CUT_SIZE #define CUT_SIZE_IS_VALID(cut_size) ((cut_size) < MAX_CUT_SIZE && (cut_size) >= 0) +#define CUT_SIZE_INVALID -1 struct OVBVHNode { @@ -348,9 +349,9 @@ struct OVBVHNode { { if (RE_rayobject_isAligned(this->child)) { //Calc new childs - { + if (this->best_cutsize != CUT_SIZE_INVALID) { OVBVHNode **cut = &(this->child); - set_cut(best_cutsize, &cut); + set_cut(this->best_cutsize, &cut); *cut = NULL; } @@ -473,12 +474,17 @@ struct VBVH_optimalPackSIMD { } } } - assert(node->cut_cost[0] != INFINITY); + + if (node->cut_cost[0] == INFINITY) { + node->best_cutsize = CUT_SIZE_INVALID; + } } else { node->cut_cost[0] = 1.0f; for (int i = 1; i < MAX_CUT_SIZE; i++) node->cut_cost[i] = INFINITY; + + /* node->best_cutsize can remain unset here */ } } |