Fix T39852: Crash (Blender internal) large objects
Add check when bounds reached inf
This commit is contained in:
@@ -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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user