Revision: 56715
          http://sourceforge.net/p/brlcad/code/56715
Author:   ejno
Date:     2013-08-09 16:02:39 +0000 (Fri, 09 Aug 2013)
Log Message:
-----------
fixed all the bugs

Modified Paths:
--------------
    brlcad/branches/opencl/src/librt/primitives/sph/sph.c

Modified: brlcad/branches/opencl/src/librt/primitives/sph/sph.c
===================================================================
--- brlcad/branches/opencl/src/librt/primitives/sph/sph.c       2013-08-09 
15:23:40 UTC (rev 56714)
+++ brlcad/branches/opencl/src/librt/primitives/sph/sph.c       2013-08-09 
16:02:39 UTC (rev 56715)
@@ -104,18 +104,12 @@
     float C = dot(o-c, o-c) - r*r;\n\
     float disc = B*B - 4*A*C;\n\
 \n\
-    if (disc <= 0) {\n\
-       output[0] = 0;\n\
-       output[1] = 0;\n\
-       output[2] = 0;\n\
-       return;\n\
-    }\n\
+    if (disc <= 0) return;\n\
 \n\
     float q = B < 0 ? (-B + sqrt(disc))/2 : (-B - sqrt(disc))/2;\n\
     \n\
-    output[0] = 1;\n\
-    output[1] = q/A;\n\
-    output[2] = C/q;\n\
+    output[0] = q/A;\n\
+    output[1] = C/q;\n\
 }\n\
 \n\
 ";
@@ -202,6 +196,7 @@
     cl_float3 result;
     const size_t global_size = 1;
 
+    VSET(result.s, 0, 0, 0);
     output = clCreateBuffer(clt_context, CL_MEM_USE_HOST_PTR | 
CL_MEM_HOST_READ_ONLY | CL_MEM_WRITE_ONLY,
            sizeof(cl_float3), &result, &error);
     if (error != CL_SUCCESS) bu_bomb("failed to create OpenCL output buffer");
@@ -395,8 +390,8 @@
     RT_GET_SEG(segp, ap->a_resource);
     segp->seg_stp = stp;
 
-    segp->seg_in.hit_dist = result.s[2];
-    segp->seg_out.hit_dist = result.s[1];
+    segp->seg_in.hit_dist = result.s[1];
+    segp->seg_out.hit_dist = result.s[0];
     segp->seg_in.hit_surfno = 0;
     segp->seg_out.hit_surfno = 0;
     BU_LIST_INSERT(&(seghead->l), &(segp->l));

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to