Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Extras / CUDA / btCudaBroadphase.cu
1 /*
2 Bullet Continuous Collision Detection and Physics Library, http://bulletphysics.org
3 Copyright (C) 2006, 2007 Sony Computer Entertainment Inc. 
4
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose, 
8 including commercial applications, and to alter it and redistribute it freely, 
9 subject to the following restrictions:
10
11 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15
16 #include <cstdlib>
17 #include <cstdio>
18 #include <string.h>
19
20 #include "cutil_math.h"
21 #include "math_constants.h"
22
23
24 #include <vector_types.h>
25
26
27
28 #include "btCudaDefines.h"
29
30
31
32 #include "../../src/BulletMultiThreaded/btGpuUtilsSharedDefs.h"
33 #include "../../src/BulletMultiThreaded/btGpu3DGridBroadphaseSharedDefs.h"
34
35
36
37 __device__ inline bt3DGrid3F1U tex_fetch3F1U(float4 a) { return *((bt3DGrid3F1U*)(&a)); }
38
39
40
41 void btCuda_exit(int val);
42
43
44
45 texture<uint2, 1, cudaReadModeElementType> particleHashTex;
46 texture<uint, 1, cudaReadModeElementType> cellStartTex;
47 texture<float4, 1, cudaReadModeElementType> pAABBTex;
48
49
50
51 __constant__ bt3DGridBroadphaseParams params;
52
53
54
55 extern "C"
56 {
57
58
59
60 void btCuda_setParameters(bt3DGridBroadphaseParams* hostParams)
61 {
62     // copy parameters to constant memory
63     BT_GPU_SAFE_CALL(cudaMemcpyToSymbol(params, hostParams, sizeof(bt3DGridBroadphaseParams)));
64 }
65
66
67
68 } // extern "C"
69
70
71
72 #include "../../src/BulletMultiThreaded/btGpu3DGridBroadphaseSharedCode.h"
73
74