Initialize libbullet git in 2.0_beta.
[platform/upstream/libbullet.git] / Extras / RigidBodyGpuPipeline / opencl / primitives / AdlPrimitives / Copy / Copy.h
1 /*
2 Copyright (c) 2012 Advanced Micro Devices, Inc.  
3
4 This software is provided 'as-is', without any express or implied warranty.
5 In no event will the authors be held liable for any damages arising from the use of this software.
6 Permission is granted to anyone to use this software for any purpose, 
7 including commercial applications, and to alter it and redistribute it freely, 
8 subject to the following restrictions:
9
10 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
11 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
12 3. This notice may not be removed or altered from any source distribution.
13 */
14 //Originally written by Takahiro Harada
15
16
17 #pragma once
18
19 #include <Adl/Adl.h>
20 #include <AdlPrimitives/Math/Math.h>
21
22 namespace adl
23 {
24
25 class CopyBase
26 {
27         public:
28                 enum Option
29                 {
30                         PER_WI_1, 
31                         PER_WI_2, 
32                         PER_WI_4, 
33                 };
34 };
35
36 template<DeviceType TYPE>
37 class Copy : public CopyBase
38 {
39         public:
40                 typedef Launcher::BufferInfo BufferInfo;
41
42                 struct Data
43                 {
44                         const Device* m_device;
45                         Kernel* m_copy1F4Kernel;
46                         Kernel* m_copy2F4Kernel;
47                         Kernel* m_copy4F4Kernel;
48                         Kernel* m_copyF1Kernel;
49                         Kernel* m_copyF2Kernel;
50                         Buffer<int4>* m_constBuffer;
51                 };
52
53                 static
54                 Data* allocate(const Device* deviceData);
55
56                 static
57                 void deallocate(Data* data);
58
59                 static
60                 void execute( Data* data, Buffer<float4>& dst, Buffer<float4>& src, int n, Option option = PER_WI_1);
61
62                 static
63                 void execute( Data* data, Buffer<float2>& dst, Buffer<float2>& src, int n);
64
65                 static
66                 void execute( Data* data, Buffer<float>& dst, Buffer<float>& src, int n);
67 };
68
69
70 #include <AdlPrimitives/Copy/CopyHost.inl>
71 #include <AdlPrimitives/Copy/Copy.inl>
72
73 };