[Bf-blender-cvs] [f8cd3d9] master: Code cleanup: add some asserts and fix a typo in BVH build.
John Pavel
noreply at git.blender.org
Mon Apr 21 14:45:31 CEST 2014
Commit: f8cd3d974dafe1482c49a87a2ede68d9defe7ef9
Author: John Pavel
Date: Mon Apr 21 14:06:29 2014 +0200
https://developer.blender.org/rBf8cd3d974dafe1482c49a87a2ede68d9defe7ef9
Code cleanup: add some asserts and fix a typo in BVH build.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D467
===================================================================
M intern/cycles/bvh/bvh_build.cpp
M intern/cycles/render/nodes.cpp
===================================================================
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index 814fbf2..9367e7b 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -511,7 +511,7 @@ void BVHBuild::rotate(BVHNode *node, int max_depth)
/* find best rotation. we pick a target child of a first child, and swap
* this with an other child. we perform the best such swap. */
float best_cost = FLT_MAX;
- int best_child = -1, bets_target = -1, best_other = -1;
+ int best_child = -1, best_target = -1, best_other = -1;
for(size_t c = 0; c < 2; c++) {
/* ignore leaf nodes as we cannot descent into */
@@ -535,11 +535,11 @@ void BVHBuild::rotate(BVHNode *node, int max_depth)
if(cost0 < cost1) {
best_cost = cost0;
- bets_target = 0;
+ best_target = 0;
}
else {
best_cost = cost0;
- bets_target = 1;
+ best_target = 1;
}
}
}
@@ -548,10 +548,13 @@ void BVHBuild::rotate(BVHNode *node, int max_depth)
if(best_cost >= 0)
return;
+ assert(best_child == 0 || best_child == 1);
+ assert(best_target != -1);
+
/* perform the best found tree rotation */
InnerNode *child = (InnerNode*)parent->children[best_child];
- swap(parent->children[best_other], child->children[bets_target]);
+ swap(parent->children[best_other], child->children[best_target]);
child->m_bounds = merge(child->children[0]->m_bounds, child->children[1]->m_bounds);
}
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 576dcec..87affcb 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -629,6 +629,8 @@ void SkyTextureNode::compile(SVMCompiler& compiler)
sky_texture_precompute_old(&sunsky, sun_direction, turbidity);
else if(type_enum[type] == NODE_SKY_NEW)
sky_texture_precompute_new(&sunsky, sun_direction, turbidity, ground_albedo);
+ else
+ assert(false);
if(vector_in->link)
compiler.stack_assign(vector_in);
@@ -666,6 +668,8 @@ void SkyTextureNode::compile(OSLCompiler& compiler)
sky_texture_precompute_old(&sunsky, sun_direction, turbidity);
else if(type_enum[type] == NODE_SKY_NEW)
sky_texture_precompute_new(&sunsky, sun_direction, turbidity, ground_albedo);
+ else
+ assert(false);
compiler.parameter("sky_model", type);
compiler.parameter("theta", sunsky.theta);
More information about the Bf-blender-cvs
mailing list