forked from bartvdbraak/blender
Add asserts to raytrace get/set_cut functions
This commit is contained in:
parent
210dc12b53
commit
7cdf5992dd
@ -287,6 +287,9 @@ static float bvh_refit(Node *node)
|
|||||||
#define MAX_CUT_SIZE 4 /* svbvh assumes max 4 children! */
|
#define MAX_CUT_SIZE 4 /* svbvh assumes max 4 children! */
|
||||||
#define MAX_OPTIMIZE_CHILDS MAX_CUT_SIZE
|
#define MAX_OPTIMIZE_CHILDS MAX_CUT_SIZE
|
||||||
|
|
||||||
|
#define CUT_SIZE_IS_VALID(cut_size) ((cut_size) < MAX_CUT_SIZE && (cut_size) >= 0)
|
||||||
|
|
||||||
|
|
||||||
struct OVBVHNode {
|
struct OVBVHNode {
|
||||||
float bb[6];
|
float bb[6];
|
||||||
|
|
||||||
@ -300,6 +303,7 @@ struct OVBVHNode {
|
|||||||
float cut_cost[MAX_CUT_SIZE];
|
float cut_cost[MAX_CUT_SIZE];
|
||||||
float get_cost(int cutsize)
|
float get_cost(int cutsize)
|
||||||
{
|
{
|
||||||
|
assert(CUT_SIZE_IS_VALID(cutsize - 1));
|
||||||
return cut_cost[cutsize - 1];
|
return cut_cost[cutsize - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,6 +314,7 @@ struct OVBVHNode {
|
|||||||
int cut_size[MAX_CUT_SIZE];
|
int cut_size[MAX_CUT_SIZE];
|
||||||
int get_cut_size(int parent_cut_size)
|
int get_cut_size(int parent_cut_size)
|
||||||
{
|
{
|
||||||
|
assert(CUT_SIZE_IS_VALID(parent_cut_size - 1));
|
||||||
return cut_size[parent_cut_size - 1];
|
return cut_size[parent_cut_size - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user