Bullet Collision Detection & Physics Library
Main Page
Namespaces
Classes
Files
File List
File Members
src
MiniCL
cl_platform.h
Go to the documentation of this file.
1
/**********************************************************************************
2
* Copyright (c) 2008-2009 The Khronos Group Inc.
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and/or associated documentation files (the
6
* "Materials"), to deal in the Materials without restriction, including
7
* without limitation the rights to use, copy, modify, merge, publish,
8
* distribute, sublicense, and/or sell copies of the Materials, and to
9
* permit persons to whom the Materials are furnished to do so, subject to
10
* the following conditions:
11
*
12
* The above copyright notice and this permission notice shall be included
13
* in all copies or substantial portions of the Materials.
14
*
15
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
22
**********************************************************************************/
23
24
#ifndef __CL_PLATFORM_H
25
#define __CL_PLATFORM_H
26
27
#define CL_PLATFORM_MINI_CL 0x12345
28
29
struct
MiniCLKernelDesc
30
{
31
MiniCLKernelDesc
(
void
* pCode,
const
char
* pName);
32
};
33
34
#define MINICL_REGISTER(__kernel_func) static MiniCLKernelDesc __kernel_func##Desc((void*)__kernel_func, #__kernel_func);
35
36
37
#ifdef __APPLE__
38
/* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
39
#include <AvailabilityMacros.h>
40
#endif
41
42
#ifdef __cplusplus
43
extern
"C"
{
44
#endif
45
46
#define CL_API_ENTRY
47
#define CL_API_CALL
48
#ifdef __APPLE__
49
#define CL_API_SUFFIX__VERSION_1_0 // AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
50
#define CL_EXTENSION_WEAK_LINK __attribute__((weak_import))
51
#else
52
#define CL_API_SUFFIX__VERSION_1_0
53
#define CL_EXTENSION_WEAK_LINK
54
#endif
55
56
#if defined (_WIN32) && ! defined (__MINGW32__)
57
typedef
signed
__int8
int8_t
;
58
typedef
unsigned
__int8
uint8_t
;
59
typedef
signed
__int16
int16_t
;
60
typedef
unsigned
__int16
uint16_t
;
61
typedef
signed
__int32
int32_t
;
62
typedef
unsigned
__int32
uint32_t
;
63
typedef
signed
__int64
int64_t
;
64
typedef
unsigned
__int64
uint64_t
;
65
66
typedef
int8_t
cl_char
;
67
typedef
uint8_t
cl_uchar
;
68
typedef
int16_t
cl_short
;
69
typedef
uint16_t
cl_ushort
;
70
typedef
int32_t
cl_int
;
71
typedef
uint32_t
cl_uint
;
72
typedef
int64_t
cl_long
;
73
typedef
uint64_t
cl_ulong
;
74
75
typedef
uint16_t
cl_half
;
76
typedef
float
cl_float
;
77
typedef
double
cl_double
;
78
79
80
typedef
int8_t
cl_char2
[2] ;
81
typedef
int8_t
cl_char4
[4] ;
82
typedef
int8_t
cl_char8
[8] ;
83
typedef
int8_t
cl_char16
[16] ;
84
typedef
uint8_t
cl_uchar2
[2] ;
85
typedef
uint8_t
cl_uchar4
[4] ;
86
typedef
uint8_t
cl_uchar8
[8] ;
87
typedef
uint8_t
cl_uchar16
[16] ;
88
89
typedef
int16_t
cl_short2
[2] ;
90
typedef
int16_t
cl_short4
[4] ;
91
typedef
int16_t
cl_short8
[8] ;
92
typedef
int16_t
cl_short16
[16] ;
93
typedef
uint16_t
cl_ushort2
[2] ;
94
typedef
uint16_t
cl_ushort4
[4] ;
95
typedef
uint16_t
cl_ushort8
[8] ;
96
typedef
uint16_t
cl_ushort16
[16] ;
97
98
typedef
int32_t
cl_int2
[2] ;
99
typedef
int32_t
cl_int4
[4] ;
100
typedef
int32_t
cl_int8
[8] ;
101
typedef
int32_t
cl_int16
[16] ;
102
typedef
uint32_t
cl_uint2
[2] ;
103
typedef
uint32_t
cl_uint4
[4] ;
104
typedef
uint32_t
cl_uint8
[8] ;
105
typedef
uint32_t
cl_uint16
[16] ;
106
107
typedef
int64_t
cl_long2
[2] ;
108
typedef
int64_t
cl_long4
[4] ;
109
typedef
int64_t
cl_long8
[8] ;
110
typedef
int64_t
cl_long16
[16] ;
111
typedef
uint64_t
cl_ulong2
[2] ;
112
typedef
uint64_t
cl_ulong4
[4] ;
113
typedef
uint64_t
cl_ulong8
[8] ;
114
typedef
uint64_t
cl_ulong16
[16] ;
115
116
typedef
float
cl_float2
[2] ;
117
typedef
float
cl_float4
[4] ;
118
typedef
float
cl_float8
[8] ;
119
typedef
float
cl_float16
[16] ;
120
121
typedef
double
cl_double2
[2] ;
122
typedef
double
cl_double4
[4] ;
123
typedef
double
cl_double8
[8] ;
124
typedef
double
cl_double16
[16] ;
125
126
127
#else
128
#include <stdint.h>
129
130
/* scalar types */
131
typedef
int8_t
cl_char
;
132
typedef
uint8_t
cl_uchar
;
133
typedef
int16_t cl_short
__attribute__
((aligned(2)));
134
typedef
uint16_t cl_ushort
__attribute__
((aligned(2)));
135
typedef
int32_t cl_int
__attribute__
((aligned(4)));
136
typedef
uint32_t cl_uint
__attribute__
((aligned(4)));
137
typedef
int64_t cl_long
__attribute__
((aligned(8)));
138
typedef
uint64_t cl_ulong
__attribute__
((aligned(8)));
139
140
typedef
uint16_t cl_half
__attribute__
((aligned(2)));
141
typedef
float
cl_float
__attribute__
((aligned(4)));
142
typedef
double
cl_double
__attribute__
((aligned(8)));
143
144
145
/*
146
* Vector types
147
*
148
* Note: OpenCL requires that all types be naturally aligned.
149
* This means that vector types must be naturally aligned.
150
* For example, a vector of four floats must be aligned to
151
* a 16 byte boundary (calculated as 4 * the natural 4-byte
152
* alignment of the float). The alignment qualifiers here
153
* will only function properly if your compiler supports them
154
* and if you don't actively work to defeat them. For example,
155
* in order for a cl_float4 to be 16 byte aligned in a struct,
156
* the start of the struct must itself be 16-byte aligned.
157
*
158
* Maintaining proper alignment is the user's responsibility.
159
*/
160
typedef
int8_t cl_char2[2]
__attribute__
((aligned(2)));
161
typedef
int8_t cl_char4[4]
__attribute__
((aligned(4)));
162
typedef
int8_t cl_char8[8]
__attribute__
((aligned(8)));
163
typedef
int8_t cl_char16[16]
__attribute__
((aligned(16)));
164
typedef
uint8_t cl_uchar2[2]
__attribute__
((aligned(2)));
165
typedef
uint8_t cl_uchar4[4]
__attribute__
((aligned(4)));
166
typedef
uint8_t cl_uchar8[8]
__attribute__
((aligned(8)));
167
typedef
uint8_t cl_uchar16[16]
__attribute__
((aligned(16)));
168
169
typedef
int16_t cl_short2[2]
__attribute__
((aligned(4)));
170
typedef
int16_t cl_short4[4]
__attribute__
((aligned(8)));
171
typedef
int16_t cl_short8[8]
__attribute__
((aligned(16)));
172
typedef
int16_t cl_short16[16]
__attribute__
((aligned(32)));
173
typedef
uint16_t cl_ushort2[2]
__attribute__
((aligned(4)));
174
typedef
uint16_t cl_ushort4[4]
__attribute__
((aligned(8)));
175
typedef
uint16_t cl_ushort8[8]
__attribute__
((aligned(16)));
176
typedef
uint16_t cl_ushort16[16]
__attribute__
((aligned(32)));
177
178
typedef
int32_t cl_int2[2]
__attribute__
((aligned(8)));
179
typedef
int32_t cl_int4[4]
__attribute__
((aligned(16)));
180
typedef
int32_t cl_int8[8]
__attribute__
((aligned(32)));
181
typedef
int32_t cl_int16[16]
__attribute__
((aligned(64)));
182
typedef
uint32_t cl_uint2[2]
__attribute__
((aligned(8)));
183
typedef
uint32_t cl_uint4[4]
__attribute__
((aligned(16)));
184
typedef
uint32_t cl_uint8[8]
__attribute__
((aligned(32)));
185
typedef
uint32_t cl_uint16[16]
__attribute__
((aligned(64)));
186
187
typedef
int64_t cl_long2[2]
__attribute__
((aligned(16)));
188
typedef
int64_t cl_long4[4]
__attribute__
((aligned(32)));
189
typedef
int64_t cl_long8[8]
__attribute__
((aligned(64)));
190
typedef
int64_t cl_long16[16]
__attribute__
((aligned(128)));
191
typedef
uint64_t cl_ulong2[2]
__attribute__
((aligned(16)));
192
typedef
uint64_t cl_ulong4[4]
__attribute__
((aligned(32)));
193
typedef
uint64_t cl_ulong8[8]
__attribute__
((aligned(64)));
194
typedef
uint64_t cl_ulong16[16]
__attribute__
((aligned(128)));
195
196
typedef
float
cl_float2[2]
__attribute__
((aligned(8)));
197
typedef
float
cl_float4[4]
__attribute__
((aligned(16)));
198
typedef
float
cl_float8[8]
__attribute__
((aligned(32)));
199
typedef
float
cl_float16[16]
__attribute__
((aligned(64)));
200
201
typedef
double
cl_double2[2]
__attribute__
((aligned(16)));
202
typedef
double
cl_double4[4]
__attribute__
((aligned(32)));
203
typedef
double
cl_double8[8]
__attribute__
((aligned(64)));
204
typedef
double
cl_double16[16]
__attribute__
((aligned(128)));
205
#endif
206
207
#include <stddef.h>
208
209
/* and a few goodies to go with them */
210
#define CL_CHAR_BIT 8
211
#define CL_SCHAR_MAX 127
212
#define CL_SCHAR_MIN (-127-1)
213
#define CL_CHAR_MAX CL_SCHAR_MAX
214
#define CL_CHAR_MIN CL_SCHAR_MIN
215
#define CL_UCHAR_MAX 255
216
#define CL_SHRT_MAX 32767
217
#define CL_SHRT_MIN (-32767-1)
218
#define CL_USHRT_MAX 65535
219
#define CL_INT_MAX 2147483647
220
#define CL_INT_MIN (-2147483647-1)
221
#define CL_UINT_MAX 0xffffffffU
222
#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
223
#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
224
#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
225
226
#define CL_FLT_DIG 6
227
#define CL_FLT_MANT_DIG 24
228
#define CL_FLT_MAX_10_EXP +38
229
#define CL_FLT_MAX_EXP +128
230
#define CL_FLT_MIN_10_EXP -37
231
#define CL_FLT_MIN_EXP -125
232
#define CL_FLT_RADIX 2
233
#define CL_FLT_MAX 0x1.fffffep127f
234
#define CL_FLT_MIN 0x1.0p-126f
235
#define CL_FLT_EPSILON 0x1.0p-23f
236
237
#define CL_DBL_DIG 15
238
#define CL_DBL_MANT_DIG 53
239
#define CL_DBL_MAX_10_EXP +308
240
#define CL_DBL_MAX_EXP +1024
241
#define CL_DBL_MIN_10_EXP -307
242
#define CL_DBL_MIN_EXP -1021
243
#define CL_DBL_RADIX 2
244
#define CL_DBL_MAX 0x1.fffffffffffffp1023
245
#define CL_DBL_MIN 0x1.0p-1022
246
#define CL_DBL_EPSILON 0x1.0p-52
247
248
/* There are no vector types for half */
249
250
#ifdef __cplusplus
251
}
252
#endif
253
254
#endif // __CL_PLATFORM_H
Generated on Thu Oct 3 2013 18:25:07 for Bullet Collision Detection & Physics Library by
1.8.4