~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC/PrepareLinks.cl

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
MSTRINGIFY(
 
2
 
 
3
__kernel void 
 
4
PrepareLinksKernel( 
 
5
        const int numLinks,
 
6
        __global int2 * g_linksVertexIndices,
 
7
        __global float * g_linksMassLSC,
 
8
        __global float4 * g_nodesPreviousPosition,
 
9
        __global float * g_linksLengthRatio,
 
10
        __global float4 * g_linksCurrentLength)
 
11
{
 
12
        int linkID = get_global_id(0);
 
13
        if( linkID < numLinks )
 
14
        {       
 
15
                int2 nodeIndices = g_linksVertexIndices[linkID];
 
16
                int node0 = nodeIndices.x;
 
17
                int node1 = nodeIndices.y;
 
18
                
 
19
                float4 nodePreviousPosition0 = g_nodesPreviousPosition[node0];
 
20
                float4 nodePreviousPosition1 = g_nodesPreviousPosition[node1];
 
21
 
 
22
                float massLSC = g_linksMassLSC[linkID];
 
23
                
 
24
                float4 linkCurrentLength = nodePreviousPosition1 - nodePreviousPosition0;
 
25
                
 
26
                float linkLengthRatio = dot(linkCurrentLength, linkCurrentLength)*massLSC;
 
27
                linkLengthRatio = 1.0f/linkLengthRatio;
 
28
                
 
29
                g_linksCurrentLength[linkID] = linkCurrentLength;
 
30
                g_linksLengthRatio[linkID]   = linkLengthRatio;         
 
31
        }
 
32
}
 
33
 
 
34
);
 
 
b'\\ No newline at end of file'