diff options
author | Stan Seibert <stan@mtrr.org> | 2012-02-17 18:34:02 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2021-05-09 08:42:38 -0700 |
commit | 6f1b889d03f011c3be7fa107f4364df6756f1029 (patch) | |
tree | 0c4716004695ff52bde0aa9e0d420ee8e0245933 | |
parent | cc386a0dbad610f4c2ed6a79ed1cfc2af57aade3 (diff) | |
download | chroma-6f1b889d03f011c3be7fa107f4364df6756f1029.tar.gz chroma-6f1b889d03f011c3be7fa107f4364df6756f1029.tar.bz2 chroma-6f1b889d03f011c3be7fa107f4364df6756f1029.zip |
Remove unneeded Node.kind member from struct. Speeds up benchmark further, but no improvement to actual simulation.
-rw-r--r-- | chroma/cuda/geometry.h | 6 | ||||
-rw-r--r-- | chroma/cuda/geometry_types.h | 1 | ||||
-rw-r--r-- | chroma/cuda/mesh.h | 5 | ||||
-rw-r--r-- | chroma/cuda/render.cu | 5 |
4 files changed, 2 insertions, 15 deletions
diff --git a/chroma/cuda/geometry.h b/chroma/cuda/geometry.h index 3db6dad..b718655 100644 --- a/chroma/cuda/geometry.h +++ b/chroma/cuda/geometry.h @@ -25,11 +25,6 @@ get_node(Geometry *geometry, const unsigned int &i) uint4 node = geometry->nodes[i]; Node node_struct; - if (node.x == 0) { - node_struct.kind = PADDING_NODE; - return node_struct; - } - uint3 lower_int = make_uint3(node.x & 0xFFFF, node.y & 0xFFFF, node.z & 0xFFFF); uint3 upper_int = make_uint3(node.x >> 16, node.y >> 16, node.z >> 16); @@ -38,7 +33,6 @@ get_node(Geometry *geometry, const unsigned int &i) node_struct.upper = geometry->world_origin + to_float3(upper_int) * geometry->world_scale; node_struct.child = node.w & ~NCHILD_MASK; node_struct.nchild = node.w >> CHILD_BITS; - node_struct.kind = node_struct.nchild == 0 ? LEAF_NODE : INTERNAL_NODE; return node_struct; } diff --git a/chroma/cuda/geometry_types.h b/chroma/cuda/geometry_types.h index 59d6706..8836d91 100644 --- a/chroma/cuda/geometry_types.h +++ b/chroma/cuda/geometry_types.h @@ -37,7 +37,6 @@ struct Node float3 upper; unsigned int child; unsigned int nchild; - unsigned int kind; }; struct Geometry diff --git a/chroma/cuda/mesh.h b/chroma/cuda/mesh.h index d1381c3..6395b52 100644 --- a/chroma/cuda/mesh.h +++ b/chroma/cuda/mesh.h @@ -74,12 +74,9 @@ intersect_mesh(const float3 &origin, const float3& direction, Geometry *g, Node node = get_node(g, i); count++; - if (node.kind == PADDING_NODE) - break; // this node and rest of children are padding - if (intersect_node(neg_origin_inv_dir, inv_dir, g, node, min_distance)) { - if (node.kind == LEAF_NODE) { + if (node.nchild == 0) { /* leaf node */ // This node wraps a triangle if (node.child != last_hit_triangle) { diff --git a/chroma/cuda/render.cu b/chroma/cuda/render.cu index 6c282d6..07abf0f 100644 --- a/chroma/cuda/render.cu +++ b/chroma/cuda/render.cu @@ -91,12 +91,9 @@ render(int nthreads, float3 *_origin, float3 *_direction, Geometry *g, Node node = get_node(g, i); count++; - if (node.kind == PADDING_NODE) - break; // this node and rest of children are padding - if (intersect_node(neg_origin_inv_dir, inv_dir, g, node)) { - if (node.kind == LEAF_NODE) { + if (node.nchild == 0) { /* leaf node */ // This node wraps a triangle tri_count++; |