summaryrefslogtreecommitdiff
path: root/src/mesh.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesh.h')
-rw-r--r--src/mesh.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesh.h b/src/mesh.h
index 734ab92..73dff71 100644
--- a/src/mesh.h
+++ b/src/mesh.h
@@ -122,11 +122,20 @@ __global__ void
distance_to_mesh(int nthreads, float3 *_origin, float3 *_direction,
Geometry *g, float *_distance)
{
+ __shared__ Geometry sg;
+
+ if (threadIdx.x == 0)
+ sg = *g;
+
+ __syncthreads();
+
int id = blockIdx.x*blockDim.x + threadIdx.x;
if (id >= nthreads)
return;
+ g = &sg;
+
float3 origin = _origin[id];
float3 direction = _direction[id];
direction /= norm(direction);