From 6310592deb66d75f473c63fe286187ca41dae0f6 Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Thu, 11 Aug 2011 11:49:54 -0400 Subject: Switch from texture to float3 array for upper and lower bounds. 10% speed boost! --- src/mesh.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesh.h b/src/mesh.h index b4714c4..bb30bef 100644 --- a/src/mesh.h +++ b/src/mesh.h @@ -13,8 +13,8 @@ __device__ unsigned int g_start_node; __device__ unsigned int g_first_node; /* lower/upper bounds for the bounding box associated with each node/leaf */ -texture upper_bounds; -texture lower_bounds; +__device__ float3 *g_lower_bounds; +__device__ float3 *g_upper_bounds; /* map to child node/triangle indices */ texture node_map; @@ -38,8 +38,8 @@ __device__ int convert(int c) intersects the bounding box return true, else return false. */ __device__ bool intersect_node(const float3 &origin, const float3 &direction, const int &i) { - float3 lower_bound = make_float3(tex1Dfetch(lower_bounds, i)); - float3 upper_bound = make_float3(tex1Dfetch(upper_bounds, i)); + float3 lower_bound = g_lower_bounds[i]; + float3 upper_bound = g_upper_bounds[i]; return intersect_box(origin, direction, lower_bound, upper_bound); } @@ -134,13 +134,15 @@ __device__ int intersect_mesh(const float3 &origin, const float3& direction, flo extern "C" { -__global__ void set_global_mesh_variables(uint4 *triangles, float3 *vertices, unsigned int *colors, unsigned int start_node, unsigned int first_node) + __global__ void set_global_mesh_variables(uint4 *triangles, float3 *vertices, unsigned int *colors, unsigned int start_node, unsigned int first_node, float3 *lower_bounds, float3 *upper_bounds) { g_triangles = triangles; g_vertices = vertices; g_colors = colors; g_start_node = start_node; g_first_node = first_node; + g_lower_bounds = lower_bounds; + g_upper_bounds = upper_bounds; } __global__ void set_colors(unsigned int *colors) -- cgit