summaryrefslogtreecommitdiff
path: root/src/alpha.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/alpha.h')
-rw-r--r--src/alpha.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/alpha.h b/src/alpha.h
index 5e3e803..a9963eb 100644
--- a/src/alpha.h
+++ b/src/alpha.h
@@ -17,14 +17,14 @@ __device__ void swap(T &a, T &b)
struct HitList
{
- int size;
- int indices[ALPHA_DEPTH];
+ unsigned int size;
+ unsigned int indices[ALPHA_DEPTH];
float distances[ALPHA_DEPTH];
};
__device__ void add_to_hit_list(const float &distance, const int &index, HitList &h)
{
- int i;
+ unsigned int i;
if (h.size >= ALPHA_DEPTH)
{
if (distance > h.distances[ALPHA_DEPTH-1])
@@ -50,7 +50,7 @@ __device__ void add_to_hit_list(const float &distance, const int &index, HitList
}
}
-__device__ __noinline__ int get_color_alpha(const float3 &origin, const float3& direction)
+__device__ int get_color_alpha(const float3 &origin, const float3& direction)
{
HitList h;
h.size = 0;
@@ -60,34 +60,34 @@ __device__ __noinline__ int get_color_alpha(const float3 &origin, const float3&
if (!intersect_node(origin, direction, g_start_node))
return 0;
- int stack[STACK_SIZE];
+ unsigned int stack[STACK_SIZE];
- int *head = &stack[0];
- int *node = &stack[1];
- int *tail = &stack[STACK_SIZE-1];
+ unsigned int *head = &stack[0];
+ unsigned int *node = &stack[1];
+ unsigned int *tail = &stack[STACK_SIZE-1];
*node = g_start_node;
- int i;
+ unsigned int i;
do
{
- int first_child = tex1Dfetch(node_map, *node);
- int child_count = tex1Dfetch(node_length, *node);
+ unsigned int first_child = tex1Dfetch(node_map, *node);
+ unsigned int stop = tex1Dfetch(node_map_end, *node);
- while (*node >= g_first_node && child_count == 1)
+ while (*node >= g_first_node && stop == first_child+1)
{
*node = first_child;
first_child = tex1Dfetch(node_map, *node);
- child_count = tex1Dfetch(node_length, *node);
+ stop = tex1Dfetch(node_map_end, *node);
}
if (*node >= g_first_node)
{
- for (i=0; i < child_count; i++)
+ for (i=first_child; i < stop; i++)
{
- if (intersect_node(origin, direction, first_child+i))
+ if (intersect_node(origin, direction, i))
{
- *node = first_child+i;
+ *node = i;
node++;
}
}
@@ -96,9 +96,9 @@ __device__ __noinline__ int get_color_alpha(const float3 &origin, const float3&
}
else // node is a leaf
{
- for (i=0; i < child_count; i++)
+ for (i=first_child; i < stop; i++)
{
- uint4 triangle_data = g_triangles[first_child+i];
+ uint4 triangle_data = g_triangles[i];
float3 v0 = g_vertices[triangle_data.x];
float3 v1 = g_vertices[triangle_data.y];
@@ -106,7 +106,7 @@ __device__ __noinline__ int get_color_alpha(const float3 &origin, const float3&
if (intersect_triangle(origin, direction, v0, v1, v2, distance))
{
- add_to_hit_list(distance, first_child+i, h);
+ add_to_hit_list(distance, i, h);
}
} // triangle loop