Tizen 2.1 base
[platform/upstream/libbullet.git] / Extras / RigidBodyGpuPipeline / opencl / primitives / AdlPrimitives / Copy / CopyKernelsDX11.h
1 static const char* copyKernelsDX11= \\r
2 "/*\n"\r
3 "               2011 Takahiro Harada\n"\r
4 "*/\n"\r
5 "\n"\r
6 "typedef uint u32;\n"\r
7 "\n"\r
8 "#define GET_GROUP_IDX groupIdx.x\n"\r
9 "#define GET_LOCAL_IDX localIdx.x\n"\r
10 "#define GET_GLOBAL_IDX globalIdx.x\n"\r
11 "#define GROUP_LDS_BARRIER GroupMemoryBarrierWithGroupSync()\n"\r
12 "#define GROUP_MEM_FENCE\n"\r
13 "#define DEFAULT_ARGS uint3 globalIdx : SV_DispatchThreadID, uint3 localIdx : SV_GroupThreadID, uint3 groupIdx : SV_GroupID\n"\r
14 "#define AtomInc(x) InterlockedAdd(x, 1)\n"\r
15 "#define AtomInc1(x, out) InterlockedAdd(x, 1, out)\n"\r
16 "\n"\r
17 "#define make_uint4 uint4\n"\r
18 "#define make_uint2 uint2\n"\r
19 "#define make_int2 int2\n"\r
20 "\n"\r
21 "#define WG_SIZE 64\n"\r
22 "\n"\r
23 "#define GET_GROUP_SIZE WG_SIZE\n"\r
24 "\n"\r
25 "\n"\r
26 "\n"\r
27 "cbuffer CB : register( b0 )\n"\r
28 "{\n"\r
29 "       int m_n;\n"\r
30 "       int m_padding[3];\n"\r
31 "};\n"\r
32 "\n"\r
33 "RWStructuredBuffer<float4> dst : register( u0 );\n"\r
34 "StructuredBuffer<float4> src : register( t0 );\n"\r
35 "\n"\r
36 "[numthreads(WG_SIZE, 1, 1)]\n"\r
37 "void Copy1F4Kernel( DEFAULT_ARGS )\n"\r
38 "{\n"\r
39 "       int gIdx = GET_GLOBAL_IDX;\n"\r
40 "\n"\r
41 "       if( gIdx < m_n )\n"\r
42 "       {\n"\r
43 "               float4 a0 = src[gIdx];\n"\r
44 "\n"\r
45 "               dst[ gIdx ] = a0;\n"\r
46 "       }\n"\r
47 "}\n"\r
48 "\n"\r
49 "[numthreads(WG_SIZE, 1, 1)]\n"\r
50 "void Copy2F4Kernel( DEFAULT_ARGS )\n"\r
51 "{\n"\r
52 "       int gIdx = GET_GLOBAL_IDX;\n"\r
53 "\n"\r
54 "       if( 2*gIdx <= m_n )\n"\r
55 "       {\n"\r
56 "               float4 a0 = src[gIdx*2+0];\n"\r
57 "               float4 a1 = src[gIdx*2+1];\n"\r
58 "\n"\r
59 "               dst[ gIdx*2+0 ] = a0;\n"\r
60 "               dst[ gIdx*2+1 ] = a1;\n"\r
61 "       }\n"\r
62 "}\n"\r
63 "\n"\r
64 "[numthreads(WG_SIZE, 1, 1)]\n"\r
65 "void Copy4F4Kernel( DEFAULT_ARGS )\n"\r
66 "{\n"\r
67 "       int gIdx = GET_GLOBAL_IDX;\n"\r
68 "\n"\r
69 "       if( 4*gIdx <= m_n )\n"\r
70 "       {\n"\r
71 "               int idx0 = gIdx*4+0;\n"\r
72 "               int idx1 = gIdx*4+1;\n"\r
73 "               int idx2 = gIdx*4+2;\n"\r
74 "               int idx3 = gIdx*4+3;\n"\r
75 "\n"\r
76 "               float4 a0 = src[idx0];\n"\r
77 "               float4 a1 = src[idx1];\n"\r
78 "               float4 a2 = src[idx2];\n"\r
79 "               float4 a3 = src[idx3];\n"\r
80 "\n"\r
81 "               dst[ idx0 ] = a0;\n"\r
82 "               dst[ idx1 ] = a1;\n"\r
83 "               dst[ idx2 ] = a2;\n"\r
84 "               dst[ idx3 ] = a3;\n"\r
85 "       }\n"\r
86 "}\n"\r
87 "\n"\r
88 "RWStructuredBuffer<float> dstF1 : register( u0 );\n"\r
89 "StructuredBuffer<float> srcF1 : register( t0 );\n"\r
90 "\n"\r
91 "[numthreads(WG_SIZE, 1, 1)]\n"\r
92 "void CopyF1Kernel( DEFAULT_ARGS )\n"\r
93 "{\n"\r
94 "       int gIdx = GET_GLOBAL_IDX;\n"\r
95 "\n"\r
96 "       if( gIdx < m_n )\n"\r
97 "       {\n"\r
98 "               float a0 = srcF1[gIdx];\n"\r
99 "\n"\r
100 "               dstF1[ gIdx ] = a0;\n"\r
101 "       }\n"\r
102 "\n"\r
103 "}\n"\r
104 "\n"\r
105 "RWStructuredBuffer<float2> dstF2 : register( u0 );\n"\r
106 "StructuredBuffer<float2> srcF2 : register( t0 );\n"\r
107 "\n"\r
108 "[numthreads(WG_SIZE, 1, 1)]\n"\r
109 "void CopyF2Kernel( DEFAULT_ARGS )\n"\r
110 "{\n"\r
111 "       int gIdx = GET_GLOBAL_IDX;\n"\r
112 "\n"\r
113 "       if( gIdx < m_n )\n"\r
114 "       {\n"\r
115 "               float2 a0 = srcF2[gIdx];\n"\r
116 "\n"\r
117 "               dstF2[ gIdx ] = a0;\n"\r
118 "       }\n"\r
119 "}\n"\r
120 ;\r