Bullet Collision Detection & Physics Library
btGpuUtilsSharedCode.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library, http://bulletphysics.org
3 Copyright (C) 2006, 2009 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 //----------------------------------------------------------------------------------------
17 
18 // Shared code for GPU-based utilities
19 
21 // Keep this file free from Bullet headers
22 // will be compiled by both CPU and CUDA compilers
23 // file with definitions of BT_GPU_xxx should be included first
25 
26 //----------------------------------------------------------------------------------------
27 
28 #include "btGpuUtilsSharedDefs.h"
29 
30 //----------------------------------------------------------------------------------------
31 
32 extern "C"
33 {
34 
35 //----------------------------------------------------------------------------------------
36 
37 //Round a / b to nearest higher integer value
38 int BT_GPU_PREF(iDivUp)(int a, int b)
39 {
40  return (a % b != 0) ? (a / b + 1) : (a / b);
41 } // iDivUp()
42 
43 //----------------------------------------------------------------------------------------
44 
45 // compute grid and thread block size for a given number of elements
46 void BT_GPU_PREF(computeGridSize)(int n, int blockSize, int &numBlocks, int &numThreads)
47 {
48  numThreads = BT_GPU_min(blockSize, n);
49  numBlocks = BT_GPU_PREF(iDivUp)(n, numThreads);
50 } // computeGridSize()
51 
52 //----------------------------------------------------------------------------------------
53 
54 } // extern "C"
55 
void BT_GPU_PREF() computeGridSize(int n, int blockSize, int &numBlocks, int &numThreads)
#define BT_GPU_min(a, b)
Definition: btGpuDefines.h:61
int BT_GPU_PREF() iDivUp(int a, int b)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#define BT_GPU_PREF(func)
Definition: btGpuDefines.h:195