OSX/CLEW: silence hundreds of warnings: 'weak_import' attribute only applies to varia...
[blender.git] / extern / clew / include / clew.h
1 #ifndef CLEW_HPP_INCLUDED
2 #define CLEW_HPP_INCLUDED
3
4 //////////////////////////////////////////////////////////////////////////
5 //  Copyright (c) 2009-2011 Organic Vectory B.V., KindDragon
6 //  Written by George van Venrooij
7 //
8 //  Distributed under the MIT License.
9 //////////////////////////////////////////////////////////////////////////
10
11 //! \file clew.h
12 //! \brief OpenCL run-time loader header
13 //!
14 //! This file contains a copy of the contents of CL.H and CL_PLATFORM.H from the 
15 //! official OpenCL spec. The purpose of this code is to load the OpenCL dynamic
16 //! library at run-time and thus allow the executable to function on many
17 //! platforms regardless of the vendor of the OpenCL driver actually installed.
18 //! Some of the techniques used here were inspired by work done in the GLEW
19 //! library (http://glew.sourceforge.net/)
20
21 //  Run-time dynamic linking functionality based on concepts used in GLEW
22 #ifdef  __OPENCL_CL_H
23 #error cl.h included before clew.h
24 #endif
25
26 #ifdef  __OPENCL_CL_PLATFORM_H
27 #error cl_platform.h included before clew.h
28 #endif
29
30 //  Prevent cl.h inclusion
31 #define __OPENCL_CL_H
32 //  Prevent cl_platform.h inclusion
33 #define __CL_PLATFORM_H
34
35 /*******************************************************************************
36 * Copyright (c) 2008-2010 The Khronos Group Inc.
37 *
38 * Permission is hereby granted, free of charge, to any person obtaining a
39 * copy of this software and/or associated documentation files (the
40 * "Materials"), to deal in the Materials without restriction, including
41 * without limitation the rights to use, copy, modify, merge, publish,
42 * distribute, sublicense, and/or sell copies of the Materials, and to
43 * permit persons to whom the Materials are furnished to do so, subject to
44 * the following conditions:
45 *
46 * The above copyright notice and this permission notice shall be included
47 * in all copies or substantial portions of the Materials.
48 *
49 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
50 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
51 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
52 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
53 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
54 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
55 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
56 ******************************************************************************/
57 #ifdef __APPLE__
58     /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
59     #include <AvailabilityMacros.h>
60 #endif
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65
66 #if defined(_WIN32)
67     #define CL_API_ENTRY
68     #define CL_API_CALL     __stdcall
69     #define CL_CALLBACK     __stdcall
70 #else
71     #define CL_API_ENTRY
72     #define CL_API_CALL
73     #define CL_CALLBACK
74 #endif
75
76 #ifdef __APPLE__
77     #define CL_EXTENSION_WEAK_LINK                  __attribute__((weak_import))       
78     #define CL_API_SUFFIX__VERSION_1_0              AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
79     #define CL_EXT_SUFFIX__VERSION_1_0              CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
80     #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED   CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
81         #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED   CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
82         #define CL_API_SUFFIX__VERSION_1_1              CL_EXTENSION_WEAK_LINK
83         #define CL_EXT_SUFFIX__VERSION_1_1              CL_EXTENSION_WEAK_LINK
84         #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED   CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
85         #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED   CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
86         #define CL_API_SUFFIX__VERSION_1_2              CL_EXTENSION_WEAK_LINK
87         #define CL_EXT_SUFFIX__VERSION_1_2              CL_EXTENSION_WEAK_LINK
88 #else
89     #define CL_EXTENSION_WEAK_LINK
90     #define CL_API_SUFFIX__VERSION_1_0
91     #define CL_EXT_SUFFIX__VERSION_1_0
92     #define CL_API_SUFFIX__VERSION_1_1
93     #define CL_EXT_SUFFIX__VERSION_1_1
94     #define CL_API_SUFFIX__VERSION_1_2
95     #define CL_EXT_SUFFIX__VERSION_1_2
96
97     #if defined(__GNUC__)
98         #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
99             #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
100             #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
101         #else
102             #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED __attribute__((deprecated))
103             #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
104         #endif
105
106         #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
107             #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
108             #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
109         #else
110             #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED __attribute__((deprecated))
111             #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
112         #endif
113     #elif defined(_WIN32)
114         #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
115             #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
116             #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
117         #else
118             #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
119             #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED __declspec(deprecated)
120         #endif
121
122         #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
123             #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
124             #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
125         #else
126             #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
127             #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED __declspec(deprecated)
128         #endif
129     #else
130         #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
131         #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
132
133         #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
134         #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
135     #endif
136 #endif
137
138 #if (defined (_WIN32) && defined(_MSC_VER))
139
140 /* scalar types  */
141 typedef signed   __int8         cl_char;
142 typedef unsigned __int8         cl_uchar;
143 typedef signed   __int16        cl_short;
144 typedef unsigned __int16        cl_ushort;
145 typedef signed   __int32        cl_int;
146 typedef unsigned __int32        cl_uint;
147 typedef signed   __int64        cl_long;
148 typedef unsigned __int64        cl_ulong;
149
150 typedef unsigned __int16        cl_half;
151 typedef float                   cl_float;
152 typedef double                  cl_double;
153
154 /* Macro names and corresponding values defined by OpenCL */
155 #define CL_CHAR_BIT         8
156 #define CL_SCHAR_MAX        127
157 #define CL_SCHAR_MIN        (-127-1)
158 #define CL_CHAR_MAX         CL_SCHAR_MAX
159 #define CL_CHAR_MIN         CL_SCHAR_MIN
160 #define CL_UCHAR_MAX        255
161 #define CL_SHRT_MAX         32767
162 #define CL_SHRT_MIN         (-32767-1)
163 #define CL_USHRT_MAX        65535
164 #define CL_INT_MAX          2147483647
165 #define CL_INT_MIN          (-2147483647-1)
166 #define CL_UINT_MAX         0xffffffffU
167 #define CL_LONG_MAX         ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
168 #define CL_LONG_MIN         ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
169 #define CL_ULONG_MAX        ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
170
171 #define CL_FLT_DIG          6
172 #define CL_FLT_MANT_DIG     24
173 #define CL_FLT_MAX_10_EXP   +38
174 #define CL_FLT_MAX_EXP      +128
175 #define CL_FLT_MIN_10_EXP   -37
176 #define CL_FLT_MIN_EXP      -125
177 #define CL_FLT_RADIX        2
178 #define CL_FLT_MAX          340282346638528859811704183484516925440.0f
179 #define CL_FLT_MIN          1.175494350822287507969e-38f
180 #define CL_FLT_EPSILON      0x1.0p-23f
181
182 #define CL_DBL_DIG          15
183 #define CL_DBL_MANT_DIG     53
184 #define CL_DBL_MAX_10_EXP   +308
185 #define CL_DBL_MAX_EXP      +1024
186 #define CL_DBL_MIN_10_EXP   -307
187 #define CL_DBL_MIN_EXP      -1021
188 #define CL_DBL_RADIX        2
189 #define CL_DBL_MAX          179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
190 #define CL_DBL_MIN          2.225073858507201383090e-308
191 #define CL_DBL_EPSILON      2.220446049250313080847e-16
192
193 #define  CL_M_E             2.718281828459045090796
194 #define  CL_M_LOG2E         1.442695040888963387005
195 #define  CL_M_LOG10E        0.434294481903251816668
196 #define  CL_M_LN2           0.693147180559945286227
197 #define  CL_M_LN10          2.302585092994045901094
198 #define  CL_M_PI            3.141592653589793115998
199 #define  CL_M_PI_2          1.570796326794896557999
200 #define  CL_M_PI_4          0.785398163397448278999
201 #define  CL_M_1_PI          0.318309886183790691216
202 #define  CL_M_2_PI          0.636619772367581382433
203 #define  CL_M_2_SQRTPI      1.128379167095512558561
204 #define  CL_M_SQRT2         1.414213562373095145475
205 #define  CL_M_SQRT1_2       0.707106781186547572737
206
207 #define  CL_M_E_F           2.71828174591064f
208 #define  CL_M_LOG2E_F       1.44269502162933f
209 #define  CL_M_LOG10E_F      0.43429449200630f
210 #define  CL_M_LN2_F         0.69314718246460f
211 #define  CL_M_LN10_F        2.30258512496948f
212 #define  CL_M_PI_F          3.14159274101257f
213 #define  CL_M_PI_2_F        1.57079637050629f
214 #define  CL_M_PI_4_F        0.78539818525314f
215 #define  CL_M_1_PI_F        0.31830987334251f
216 #define  CL_M_2_PI_F        0.63661974668503f
217 #define  CL_M_2_SQRTPI_F    1.12837922573090f
218 #define  CL_M_SQRT2_F       1.41421353816986f
219 #define  CL_M_SQRT1_2_F     0.70710676908493f
220
221 #define CL_NAN              (CL_INFINITY - CL_INFINITY)
222 #define CL_HUGE_VALF        ((cl_float) 1e50)
223 #define CL_HUGE_VAL         ((cl_double) 1e500)
224 #define CL_MAXFLOAT         CL_FLT_MAX
225 #define CL_INFINITY         CL_HUGE_VALF
226
227 #else
228
229 #include <stdint.h>
230
231 /* scalar types  */
232 typedef int8_t          cl_char;
233 typedef uint8_t         cl_uchar;
234 typedef int16_t         cl_short    __attribute__((aligned(2)));
235 typedef uint16_t        cl_ushort   __attribute__((aligned(2)));
236 typedef int32_t         cl_int      __attribute__((aligned(4)));
237 typedef uint32_t        cl_uint     __attribute__((aligned(4)));
238 typedef int64_t         cl_long     __attribute__((aligned(8)));
239 typedef uint64_t        cl_ulong    __attribute__((aligned(8)));
240
241 typedef uint16_t        cl_half     __attribute__((aligned(2)));
242 typedef float           cl_float    __attribute__((aligned(4)));
243 typedef double          cl_double   __attribute__((aligned(8)));
244
245 /* Macro names and corresponding values defined by OpenCL */
246 #define CL_CHAR_BIT         8
247 #define CL_SCHAR_MAX        127
248 #define CL_SCHAR_MIN        (-127-1)
249 #define CL_CHAR_MAX         CL_SCHAR_MAX
250 #define CL_CHAR_MIN         CL_SCHAR_MIN
251 #define CL_UCHAR_MAX        255
252 #define CL_SHRT_MAX         32767
253 #define CL_SHRT_MIN         (-32767-1)
254 #define CL_USHRT_MAX        65535
255 #define CL_INT_MAX          2147483647
256 #define CL_INT_MIN          (-2147483647-1)
257 #define CL_UINT_MAX         0xffffffffU
258 #define CL_LONG_MAX         ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
259 #define CL_LONG_MIN         ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
260 #define CL_ULONG_MAX        ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
261
262 #define CL_FLT_DIG          6
263 #define CL_FLT_MANT_DIG     24
264 #define CL_FLT_MAX_10_EXP   +38
265 #define CL_FLT_MAX_EXP      +128
266 #define CL_FLT_MIN_10_EXP   -37
267 #define CL_FLT_MIN_EXP      -125
268 #define CL_FLT_RADIX        2
269 #define CL_FLT_MAX          0x1.fffffep127f
270 #define CL_FLT_MIN          0x1.0p-126f
271 #define CL_FLT_EPSILON      0x1.0p-23f
272
273 #define CL_DBL_DIG          15
274 #define CL_DBL_MANT_DIG     53
275 #define CL_DBL_MAX_10_EXP   +308
276 #define CL_DBL_MAX_EXP      +1024
277 #define CL_DBL_MIN_10_EXP   -307
278 #define CL_DBL_MIN_EXP      -1021
279 #define CL_DBL_RADIX        2
280 #define CL_DBL_MAX          0x1.fffffffffffffp1023
281 #define CL_DBL_MIN          0x1.0p-1022
282 #define CL_DBL_EPSILON      0x1.0p-52
283
284 #define  CL_M_E             2.718281828459045090796
285 #define  CL_M_LOG2E         1.442695040888963387005
286 #define  CL_M_LOG10E        0.434294481903251816668
287 #define  CL_M_LN2           0.693147180559945286227
288 #define  CL_M_LN10          2.302585092994045901094
289 #define  CL_M_PI            3.141592653589793115998
290 #define  CL_M_PI_2          1.570796326794896557999
291 #define  CL_M_PI_4          0.785398163397448278999
292 #define  CL_M_1_PI          0.318309886183790691216
293 #define  CL_M_2_PI          0.636619772367581382433
294 #define  CL_M_2_SQRTPI      1.128379167095512558561
295 #define  CL_M_SQRT2         1.414213562373095145475
296 #define  CL_M_SQRT1_2       0.707106781186547572737
297
298 #define  CL_M_E_F           2.71828174591064f
299 #define  CL_M_LOG2E_F       1.44269502162933f
300 #define  CL_M_LOG10E_F      0.43429449200630f
301 #define  CL_M_LN2_F         0.69314718246460f
302 #define  CL_M_LN10_F        2.30258512496948f
303 #define  CL_M_PI_F          3.14159274101257f
304 #define  CL_M_PI_2_F        1.57079637050629f
305 #define  CL_M_PI_4_F        0.78539818525314f
306 #define  CL_M_1_PI_F        0.31830987334251f
307 #define  CL_M_2_PI_F        0.63661974668503f
308 #define  CL_M_2_SQRTPI_F    1.12837922573090f
309 #define  CL_M_SQRT2_F       1.41421353816986f
310 #define  CL_M_SQRT1_2_F     0.70710676908493f
311
312 #if defined( __GNUC__ )
313    #define CL_HUGE_VALF     __builtin_huge_valf()
314    #define CL_HUGE_VAL      __builtin_huge_val()
315    #define CL_NAN           __builtin_nanf( "" )
316 #else
317    #define CL_HUGE_VALF     ((cl_float) 1e50)
318    #define CL_HUGE_VAL      ((cl_double) 1e500)
319    float nanf( const char * );
320    #define CL_NAN           nanf( "" )  
321 #endif
322 #define CL_MAXFLOAT         CL_FLT_MAX
323 #define CL_INFINITY         CL_HUGE_VALF
324
325 #endif
326
327 #include <stddef.h>
328
329 /* Mirror types to GL types. Mirror types allow us to avoid deciding which headers to load based on whether we are using GL or GLES here. */
330 typedef unsigned int cl_GLuint;
331 typedef int          cl_GLint;
332 typedef unsigned int cl_GLenum;
333
334 /*
335  * Vector types 
336  *
337  *  Note:   OpenCL requires that all types be naturally aligned. 
338  *          This means that vector types must be naturally aligned.
339  *          For example, a vector of four floats must be aligned to
340  *          a 16 byte boundary (calculated as 4 * the natural 4-byte 
341  *          alignment of the float).  The alignment qualifiers here
342  *          will only function properly if your compiler supports them
343  *          and if you don't actively work to defeat them.  For example,
344  *          in order for a cl_float4 to be 16 byte aligned in a struct,
345  *          the start of the struct must itself be 16-byte aligned. 
346  *
347  *          Maintaining proper alignment is the user's responsibility.
348  */
349
350
351 #ifdef _MSC_VER
352 #if defined(_M_IX86)
353 #if _M_IX86_FP >= 0
354 #define __SSE__
355 #endif
356 #if _M_IX86_FP >= 1
357 #  ifndef __SSE2__
358 #    define __SSE2__
359 #  endif
360 #endif
361 #elif defined(_M_X64)
362 #  ifndef __SSE__
363 #    define __SSE__
364 #  endif
365 #  ifndef __SSE2__
366 #    define __SSE2__
367 #  endif
368 #endif
369 #endif
370
371 /* Define basic vector types */
372 #if defined( __VEC__ )
373    #include <altivec.h>   /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
374    typedef vector unsigned char     __cl_uchar16;
375    typedef vector signed char       __cl_char16;
376    typedef vector unsigned short    __cl_ushort8;
377    typedef vector signed short      __cl_short8;
378    typedef vector unsigned int      __cl_uint4;
379    typedef vector signed int        __cl_int4;
380    typedef vector float             __cl_float4;
381    #define  __CL_UCHAR16__  1
382    #define  __CL_CHAR16__   1
383    #define  __CL_USHORT8__  1
384    #define  __CL_SHORT8__   1
385    #define  __CL_UINT4__    1
386    #define  __CL_INT4__     1
387    #define  __CL_FLOAT4__   1
388 #endif
389
390 #if defined( __SSE__ )
391     #if defined( __MINGW64__ )
392         #include <intrin.h>
393     #else
394         #include <xmmintrin.h>
395     #endif
396     #if defined( __GNUC__ ) && !defined( __ICC )
397         typedef float __cl_float4   __attribute__((vector_size(16)));
398     #else
399         typedef __m128 __cl_float4;
400     #endif
401     #define __CL_FLOAT4__   1
402 #endif
403
404 #if defined( __SSE2__ )
405     #if defined( __MINGW64__ )
406         #include <intrin.h>
407     #else
408         #include <emmintrin.h>
409     #endif
410     #if defined( __GNUC__ ) && !defined( __ICC )
411         typedef cl_uchar    __cl_uchar16    __attribute__((vector_size(16)));
412         typedef cl_char     __cl_char16     __attribute__((vector_size(16)));
413         typedef cl_ushort   __cl_ushort8    __attribute__((vector_size(16)));
414         typedef cl_short    __cl_short8     __attribute__((vector_size(16)));
415         typedef cl_uint     __cl_uint4      __attribute__((vector_size(16)));
416         typedef cl_int      __cl_int4       __attribute__((vector_size(16)));
417         typedef cl_ulong    __cl_ulong2     __attribute__((vector_size(16)));
418         typedef cl_long     __cl_long2      __attribute__((vector_size(16)));
419         typedef cl_double   __cl_double2    __attribute__((vector_size(16)));
420     #else
421         typedef __m128i __cl_uchar16;
422         typedef __m128i __cl_char16;
423         typedef __m128i __cl_ushort8;
424         typedef __m128i __cl_short8;
425         typedef __m128i __cl_uint4;
426         typedef __m128i __cl_int4;
427         typedef __m128i __cl_ulong2;
428         typedef __m128i __cl_long2;
429         typedef __m128d __cl_double2;
430     #endif
431     #define __CL_UCHAR16__  1
432     #define __CL_CHAR16__   1
433     #define __CL_USHORT8__  1
434     #define __CL_SHORT8__   1
435     #define __CL_INT4__     1
436     #define __CL_UINT4__    1
437     #define __CL_ULONG2__   1
438     #define __CL_LONG2__    1
439     #define __CL_DOUBLE2__  1
440 #endif
441
442 #if defined( __MMX__ )
443     #include <mmintrin.h>
444     #if defined( __GNUC__ ) && !defined( __ICC )
445         typedef cl_uchar    __cl_uchar8     __attribute__((vector_size(8)));
446         typedef cl_char     __cl_char8      __attribute__((vector_size(8)));
447         typedef cl_ushort   __cl_ushort4    __attribute__((vector_size(8)));
448         typedef cl_short    __cl_short4     __attribute__((vector_size(8)));
449         typedef cl_uint     __cl_uint2      __attribute__((vector_size(8)));
450         typedef cl_int      __cl_int2       __attribute__((vector_size(8)));
451         typedef cl_ulong    __cl_ulong1     __attribute__((vector_size(8)));
452         typedef cl_long     __cl_long1      __attribute__((vector_size(8)));
453         typedef cl_float    __cl_float2     __attribute__((vector_size(8)));
454     #else
455         typedef __m64       __cl_uchar8;
456         typedef __m64       __cl_char8;
457         typedef __m64       __cl_ushort4;
458         typedef __m64       __cl_short4;
459         typedef __m64       __cl_uint2;
460         typedef __m64       __cl_int2;
461         typedef __m64       __cl_ulong1;
462         typedef __m64       __cl_long1;
463         typedef __m64       __cl_float2;
464     #endif
465     #define __CL_UCHAR8__   1
466     #define __CL_CHAR8__    1
467     #define __CL_USHORT4__  1
468     #define __CL_SHORT4__   1
469     #define __CL_INT2__     1
470     #define __CL_UINT2__    1
471     #define __CL_ULONG1__   1
472     #define __CL_LONG1__    1
473     #define __CL_FLOAT2__   1
474 #endif
475
476 #if defined( __AVX__ )
477     #if defined( __MINGW64__ )
478         #include <intrin.h>
479     #else
480         #include <immintrin.h> 
481     #endif
482     #if defined( __GNUC__ ) && !defined( __ICC )
483         typedef cl_float    __cl_float8     __attribute__((vector_size(32)));
484         typedef cl_double   __cl_double4    __attribute__((vector_size(32)));
485     #else
486         typedef __m256      __cl_float8;
487         typedef __m256d     __cl_double4;
488     #endif
489     #define __CL_FLOAT8__   1
490     #define __CL_DOUBLE4__  1
491 #endif
492
493 /* Define alignment keys */
494 #if defined( __GNUC__ )
495     #define CL_ALIGNED(_x)          __attribute__ ((aligned(_x)))
496 #elif defined( _WIN32) && (_MSC_VER)
497     /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements     */
498     /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx                                                 */
499     /* #include <crtdefs.h>                                                                                             */
500     /* #define CL_ALIGNED(_x)          _CRT_ALIGN(_x)                                                                   */
501     #define CL_ALIGNED(_x)
502 #else
503    #warning  Need to implement some method to align data here
504    #define  CL_ALIGNED(_x)
505 #endif
506
507 /* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
508 #if (defined( __GNUC__) && ! defined( __STRICT_ANSI__ )) || (defined( _MSC_VER ) && ! defined( __STDC__ ))
509     /* .xyzw and .s0123...{f|F} are supported */
510     #define CL_HAS_NAMED_VECTOR_FIELDS 1
511     /* .hi and .lo are supported */
512     #define CL_HAS_HI_LO_VECTOR_FIELDS 1
513
514     #define CL_NAMED_STRUCT_SUPPORTED
515 #endif
516
517 #if defined( CL_NAMED_STRUCT_SUPPORTED) && defined( _MSC_VER )
518 #define __extension__ __pragma(warning(suppress:4201))
519 #endif
520
521 /* Define cl_vector types */
522
523 /* ---- cl_charn ---- */
524 typedef union
525 {
526     cl_char  CL_ALIGNED(2) s[2];
527 #if defined( CL_NAMED_STRUCT_SUPPORTED )
528    __extension__ struct{ cl_char  x, y; };
529    __extension__ struct{ cl_char  s0, s1; };
530    __extension__ struct{ cl_char  lo, hi; };
531 #endif
532 #if defined( __CL_CHAR2__) 
533     __cl_char2     v2;
534 #endif
535 }cl_char2;
536
537 typedef union
538 {
539     cl_char  CL_ALIGNED(4) s[4];
540 #if defined( CL_NAMED_STRUCT_SUPPORTED )
541    __extension__ struct{ cl_char  x, y, z, w; };
542    __extension__ struct{ cl_char  s0, s1, s2, s3; };
543    __extension__ struct{ cl_char2 lo, hi; };
544 #endif
545 #if defined( __CL_CHAR2__) 
546     __cl_char2     v2[2];
547 #endif
548 #if defined( __CL_CHAR4__) 
549     __cl_char4     v4;
550 #endif
551 }cl_char4;
552
553 /* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
554 typedef  cl_char4  cl_char3;
555
556 typedef union
557 {
558     cl_char   CL_ALIGNED(8) s[8];
559 #if defined( CL_NAMED_STRUCT_SUPPORTED )
560    __extension__ struct{ cl_char  x, y, z, w; };
561    __extension__ struct{ cl_char  s0, s1, s2, s3, s4, s5, s6, s7; };
562    __extension__ struct{ cl_char4 lo, hi; };
563 #endif
564 #if defined( __CL_CHAR2__) 
565     __cl_char2     v2[4];
566 #endif
567 #if defined( __CL_CHAR4__) 
568     __cl_char4     v4[2];
569 #endif
570 #if defined( __CL_CHAR8__ )
571     __cl_char8     v8;
572 #endif
573 }cl_char8;
574
575 typedef union
576 {
577     cl_char  CL_ALIGNED(16) s[16];
578 #if defined( CL_NAMED_STRUCT_SUPPORTED )
579    __extension__ struct{ cl_char  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
580    __extension__ struct{ cl_char  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
581    __extension__ struct{ cl_char8 lo, hi; };
582 #endif
583 #if defined( __CL_CHAR2__) 
584     __cl_char2     v2[8];
585 #endif
586 #if defined( __CL_CHAR4__) 
587     __cl_char4     v4[4];
588 #endif
589 #if defined( __CL_CHAR8__ )
590     __cl_char8     v8[2];
591 #endif
592 #if defined( __CL_CHAR16__ )
593     __cl_char16    v16;
594 #endif
595 }cl_char16;
596
597
598 /* ---- cl_ucharn ---- */
599 typedef union
600 {
601     cl_uchar  CL_ALIGNED(2) s[2];
602 #if defined( CL_NAMED_STRUCT_SUPPORTED )
603    __extension__ struct{ cl_uchar  x, y; };
604    __extension__ struct{ cl_uchar  s0, s1; };
605    __extension__ struct{ cl_uchar  lo, hi; };
606 #endif
607 #if defined( __cl_uchar2__) 
608     __cl_uchar2     v2;
609 #endif
610 }cl_uchar2;
611
612 typedef union
613 {
614     cl_uchar  CL_ALIGNED(4) s[4];
615 #if defined( CL_NAMED_STRUCT_SUPPORTED )
616    __extension__ struct{ cl_uchar  x, y, z, w; };
617    __extension__ struct{ cl_uchar  s0, s1, s2, s3; };
618    __extension__ struct{ cl_uchar2 lo, hi; };
619 #endif
620 #if defined( __CL_UCHAR2__) 
621     __cl_uchar2     v2[2];
622 #endif
623 #if defined( __CL_UCHAR4__) 
624     __cl_uchar4     v4;
625 #endif
626 }cl_uchar4;
627
628 /* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
629 typedef  cl_uchar4  cl_uchar3;
630
631 typedef union
632 {
633     cl_uchar   CL_ALIGNED(8) s[8];
634 #if defined( CL_NAMED_STRUCT_SUPPORTED )
635    __extension__ struct{ cl_uchar  x, y, z, w; };
636    __extension__ struct{ cl_uchar  s0, s1, s2, s3, s4, s5, s6, s7; };
637    __extension__ struct{ cl_uchar4 lo, hi; };
638 #endif
639 #if defined( __CL_UCHAR2__) 
640     __cl_uchar2     v2[4];
641 #endif
642 #if defined( __CL_UCHAR4__) 
643     __cl_uchar4     v4[2];
644 #endif
645 #if defined( __CL_UCHAR8__ )
646     __cl_uchar8     v8;
647 #endif
648 }cl_uchar8;
649
650 typedef union
651 {
652     cl_uchar  CL_ALIGNED(16) s[16];
653 #if defined( CL_NAMED_STRUCT_SUPPORTED )
654    __extension__ struct{ cl_uchar  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
655    __extension__ struct{ cl_uchar  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
656    __extension__ struct{ cl_uchar8 lo, hi; };
657 #endif
658 #if defined( __CL_UCHAR2__) 
659     __cl_uchar2     v2[8];
660 #endif
661 #if defined( __CL_UCHAR4__) 
662     __cl_uchar4     v4[4];
663 #endif
664 #if defined( __CL_UCHAR8__ )
665     __cl_uchar8     v8[2];
666 #endif
667 #if defined( __CL_UCHAR16__ )
668     __cl_uchar16    v16;
669 #endif
670 }cl_uchar16;
671
672
673 /* ---- cl_shortn ---- */
674 typedef union
675 {
676     cl_short  CL_ALIGNED(4) s[2];
677 #if defined( CL_NAMED_STRUCT_SUPPORTED )
678    __extension__ struct{ cl_short  x, y; };
679    __extension__ struct{ cl_short  s0, s1; };
680    __extension__ struct{ cl_short  lo, hi; };
681 #endif
682 #if defined( __CL_SHORT2__) 
683     __cl_short2     v2;
684 #endif
685 }cl_short2;
686
687 typedef union
688 {
689     cl_short  CL_ALIGNED(8) s[4];
690 #if defined( CL_NAMED_STRUCT_SUPPORTED )
691    __extension__ struct{ cl_short  x, y, z, w; };
692    __extension__ struct{ cl_short  s0, s1, s2, s3; };
693    __extension__ struct{ cl_short2 lo, hi; };
694 #endif
695 #if defined( __CL_SHORT2__) 
696     __cl_short2     v2[2];
697 #endif
698 #if defined( __CL_SHORT4__) 
699     __cl_short4     v4;
700 #endif
701 }cl_short4;
702
703 /* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
704 typedef  cl_short4  cl_short3;
705
706 typedef union
707 {
708     cl_short   CL_ALIGNED(16) s[8];
709 #if defined( CL_NAMED_STRUCT_SUPPORTED )
710    __extension__ struct{ cl_short  x, y, z, w; };
711    __extension__ struct{ cl_short  s0, s1, s2, s3, s4, s5, s6, s7; };
712    __extension__ struct{ cl_short4 lo, hi; };
713 #endif
714 #if defined( __CL_SHORT2__) 
715     __cl_short2     v2[4];
716 #endif
717 #if defined( __CL_SHORT4__) 
718     __cl_short4     v4[2];
719 #endif
720 #if defined( __CL_SHORT8__ )
721     __cl_short8     v8;
722 #endif
723 }cl_short8;
724
725 typedef union
726 {
727     cl_short  CL_ALIGNED(32) s[16];
728 #if defined( CL_NAMED_STRUCT_SUPPORTED )
729    __extension__ struct{ cl_short  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
730    __extension__ struct{ cl_short  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
731    __extension__ struct{ cl_short8 lo, hi; };
732 #endif
733 #if defined( __CL_SHORT2__) 
734     __cl_short2     v2[8];
735 #endif
736 #if defined( __CL_SHORT4__) 
737     __cl_short4     v4[4];
738 #endif
739 #if defined( __CL_SHORT8__ )
740     __cl_short8     v8[2];
741 #endif
742 #if defined( __CL_SHORT16__ )
743     __cl_short16    v16;
744 #endif
745 }cl_short16;
746
747
748 /* ---- cl_ushortn ---- */
749 typedef union
750 {
751     cl_ushort  CL_ALIGNED(4) s[2];
752 #if defined( CL_NAMED_STRUCT_SUPPORTED )
753    __extension__ struct{ cl_ushort  x, y; };
754    __extension__ struct{ cl_ushort  s0, s1; };
755    __extension__ struct{ cl_ushort  lo, hi; };
756 #endif
757 #if defined( __CL_USHORT2__) 
758     __cl_ushort2     v2;
759 #endif
760 }cl_ushort2;
761
762 typedef union
763 {
764     cl_ushort  CL_ALIGNED(8) s[4];
765 #if defined( CL_NAMED_STRUCT_SUPPORTED )
766    __extension__ struct{ cl_ushort  x, y, z, w; };
767    __extension__ struct{ cl_ushort  s0, s1, s2, s3; };
768    __extension__ struct{ cl_ushort2 lo, hi; };
769 #endif
770 #if defined( __CL_USHORT2__) 
771     __cl_ushort2     v2[2];
772 #endif
773 #if defined( __CL_USHORT4__) 
774     __cl_ushort4     v4;
775 #endif
776 }cl_ushort4;
777
778 /* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
779 typedef  cl_ushort4  cl_ushort3;
780
781 typedef union
782 {
783     cl_ushort   CL_ALIGNED(16) s[8];
784 #if defined( CL_NAMED_STRUCT_SUPPORTED )
785    __extension__ struct{ cl_ushort  x, y, z, w; };
786    __extension__ struct{ cl_ushort  s0, s1, s2, s3, s4, s5, s6, s7; };
787    __extension__ struct{ cl_ushort4 lo, hi; };
788 #endif
789 #if defined( __CL_USHORT2__) 
790     __cl_ushort2     v2[4];
791 #endif
792 #if defined( __CL_USHORT4__) 
793     __cl_ushort4     v4[2];
794 #endif
795 #if defined( __CL_USHORT8__ )
796     __cl_ushort8     v8;
797 #endif
798 }cl_ushort8;
799
800 typedef union
801 {
802     cl_ushort  CL_ALIGNED(32) s[16];
803 #if defined( CL_NAMED_STRUCT_SUPPORTED )
804    __extension__ struct{ cl_ushort  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
805    __extension__ struct{ cl_ushort  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
806    __extension__ struct{ cl_ushort8 lo, hi; };
807 #endif
808 #if defined( __CL_USHORT2__) 
809     __cl_ushort2     v2[8];
810 #endif
811 #if defined( __CL_USHORT4__) 
812     __cl_ushort4     v4[4];
813 #endif
814 #if defined( __CL_USHORT8__ )
815     __cl_ushort8     v8[2];
816 #endif
817 #if defined( __CL_USHORT16__ )
818     __cl_ushort16    v16;
819 #endif
820 }cl_ushort16;
821
822 /* ---- cl_intn ---- */
823 typedef union
824 {
825     cl_int  CL_ALIGNED(8) s[2];
826 #if defined( CL_NAMED_STRUCT_SUPPORTED )
827    __extension__ struct{ cl_int  x, y; };
828    __extension__ struct{ cl_int  s0, s1; };
829    __extension__ struct{ cl_int  lo, hi; };
830 #endif
831 #if defined( __CL_INT2__) 
832     __cl_int2     v2;
833 #endif
834 }cl_int2;
835
836 typedef union
837 {
838     cl_int  CL_ALIGNED(16) s[4];
839 #if defined( CL_NAMED_STRUCT_SUPPORTED )
840    __extension__ struct{ cl_int  x, y, z, w; };
841    __extension__ struct{ cl_int  s0, s1, s2, s3; };
842    __extension__ struct{ cl_int2 lo, hi; };
843 #endif
844 #if defined( __CL_INT2__) 
845     __cl_int2     v2[2];
846 #endif
847 #if defined( __CL_INT4__) 
848     __cl_int4     v4;
849 #endif
850 }cl_int4;
851
852 /* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
853 typedef  cl_int4  cl_int3;
854
855 typedef union
856 {
857     cl_int   CL_ALIGNED(32) s[8];
858 #if defined( CL_NAMED_STRUCT_SUPPORTED )
859    __extension__ struct{ cl_int  x, y, z, w; };
860    __extension__ struct{ cl_int  s0, s1, s2, s3, s4, s5, s6, s7; };
861    __extension__ struct{ cl_int4 lo, hi; };
862 #endif
863 #if defined( __CL_INT2__) 
864     __cl_int2     v2[4];
865 #endif
866 #if defined( __CL_INT4__) 
867     __cl_int4     v4[2];
868 #endif
869 #if defined( __CL_INT8__ )
870     __cl_int8     v8;
871 #endif
872 }cl_int8;
873
874 typedef union
875 {
876     cl_int  CL_ALIGNED(64) s[16];
877 #if defined( CL_NAMED_STRUCT_SUPPORTED )
878    __extension__ struct{ cl_int  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
879    __extension__ struct{ cl_int  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
880    __extension__ struct{ cl_int8 lo, hi; };
881 #endif
882 #if defined( __CL_INT2__) 
883     __cl_int2     v2[8];
884 #endif
885 #if defined( __CL_INT4__) 
886     __cl_int4     v4[4];
887 #endif
888 #if defined( __CL_INT8__ )
889     __cl_int8     v8[2];
890 #endif
891 #if defined( __CL_INT16__ )
892     __cl_int16    v16;
893 #endif
894 }cl_int16;
895
896
897 /* ---- cl_uintn ---- */
898 typedef union
899 {
900     cl_uint  CL_ALIGNED(8) s[2];
901 #if defined( CL_NAMED_STRUCT_SUPPORTED )
902    __extension__ struct{ cl_uint  x, y; };
903    __extension__ struct{ cl_uint  s0, s1; };
904    __extension__ struct{ cl_uint  lo, hi; };
905 #endif
906 #if defined( __CL_UINT2__) 
907     __cl_uint2     v2;
908 #endif
909 }cl_uint2;
910
911 typedef union
912 {
913     cl_uint  CL_ALIGNED(16) s[4];
914 #if defined( CL_NAMED_STRUCT_SUPPORTED )
915    __extension__ struct{ cl_uint  x, y, z, w; };
916    __extension__ struct{ cl_uint  s0, s1, s2, s3; };
917    __extension__ struct{ cl_uint2 lo, hi; };
918 #endif
919 #if defined( __CL_UINT2__) 
920     __cl_uint2     v2[2];
921 #endif
922 #if defined( __CL_UINT4__) 
923     __cl_uint4     v4;
924 #endif
925 }cl_uint4;
926
927 /* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
928 typedef  cl_uint4  cl_uint3;
929
930 typedef union
931 {
932     cl_uint   CL_ALIGNED(32) s[8];
933 #if defined( CL_NAMED_STRUCT_SUPPORTED )
934    __extension__ struct{ cl_uint  x, y, z, w; };
935    __extension__ struct{ cl_uint  s0, s1, s2, s3, s4, s5, s6, s7; };
936    __extension__ struct{ cl_uint4 lo, hi; };
937 #endif
938 #if defined( __CL_UINT2__) 
939     __cl_uint2     v2[4];
940 #endif
941 #if defined( __CL_UINT4__) 
942     __cl_uint4     v4[2];
943 #endif
944 #if defined( __CL_UINT8__ )
945     __cl_uint8     v8;
946 #endif
947 }cl_uint8;
948
949 typedef union
950 {
951     cl_uint  CL_ALIGNED(64) s[16];
952 #if defined( CL_NAMED_STRUCT_SUPPORTED )
953    __extension__ struct{ cl_uint  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
954    __extension__ struct{ cl_uint  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
955    __extension__ struct{ cl_uint8 lo, hi; };
956 #endif
957 #if defined( __CL_UINT2__) 
958     __cl_uint2     v2[8];
959 #endif
960 #if defined( __CL_UINT4__) 
961     __cl_uint4     v4[4];
962 #endif
963 #if defined( __CL_UINT8__ )
964     __cl_uint8     v8[2];
965 #endif
966 #if defined( __CL_UINT16__ )
967     __cl_uint16    v16;
968 #endif
969 }cl_uint16;
970
971 /* ---- cl_longn ---- */
972 typedef union
973 {
974     cl_long  CL_ALIGNED(16) s[2];
975 #if defined( CL_NAMED_STRUCT_SUPPORTED )
976    __extension__ struct{ cl_long  x, y; };
977    __extension__ struct{ cl_long  s0, s1; };
978    __extension__ struct{ cl_long  lo, hi; };
979 #endif
980 #if defined( __CL_LONG2__) 
981     __cl_long2     v2;
982 #endif
983 }cl_long2;
984
985 typedef union
986 {
987     cl_long  CL_ALIGNED(32) s[4];
988 #if defined( CL_NAMED_STRUCT_SUPPORTED )
989    __extension__ struct{ cl_long  x, y, z, w; };
990    __extension__ struct{ cl_long  s0, s1, s2, s3; };
991    __extension__ struct{ cl_long2 lo, hi; };
992 #endif
993 #if defined( __CL_LONG2__) 
994     __cl_long2     v2[2];
995 #endif
996 #if defined( __CL_LONG4__) 
997     __cl_long4     v4;
998 #endif
999 }cl_long4;
1000
1001 /* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
1002 typedef  cl_long4  cl_long3;
1003
1004 typedef union
1005 {
1006     cl_long   CL_ALIGNED(64) s[8];
1007 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1008    __extension__ struct{ cl_long  x, y, z, w; };
1009    __extension__ struct{ cl_long  s0, s1, s2, s3, s4, s5, s6, s7; };
1010    __extension__ struct{ cl_long4 lo, hi; };
1011 #endif
1012 #if defined( __CL_LONG2__) 
1013     __cl_long2     v2[4];
1014 #endif
1015 #if defined( __CL_LONG4__) 
1016     __cl_long4     v4[2];
1017 #endif
1018 #if defined( __CL_LONG8__ )
1019     __cl_long8     v8;
1020 #endif
1021 }cl_long8;
1022
1023 typedef union
1024 {
1025     cl_long  CL_ALIGNED(128) s[16];
1026 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1027    __extension__ struct{ cl_long  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1028    __extension__ struct{ cl_long  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1029    __extension__ struct{ cl_long8 lo, hi; };
1030 #endif
1031 #if defined( __CL_LONG2__) 
1032     __cl_long2     v2[8];
1033 #endif
1034 #if defined( __CL_LONG4__) 
1035     __cl_long4     v4[4];
1036 #endif
1037 #if defined( __CL_LONG8__ )
1038     __cl_long8     v8[2];
1039 #endif
1040 #if defined( __CL_LONG16__ )
1041     __cl_long16    v16;
1042 #endif
1043 }cl_long16;
1044
1045
1046 /* ---- cl_ulongn ---- */
1047 typedef union
1048 {
1049     cl_ulong  CL_ALIGNED(16) s[2];
1050 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1051    __extension__ struct{ cl_ulong  x, y; };
1052    __extension__ struct{ cl_ulong  s0, s1; };
1053    __extension__ struct{ cl_ulong  lo, hi; };
1054 #endif
1055 #if defined( __CL_ULONG2__) 
1056     __cl_ulong2     v2;
1057 #endif
1058 }cl_ulong2;
1059
1060 typedef union
1061 {
1062     cl_ulong  CL_ALIGNED(32) s[4];
1063 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1064    __extension__ struct{ cl_ulong  x, y, z, w; };
1065    __extension__ struct{ cl_ulong  s0, s1, s2, s3; };
1066    __extension__ struct{ cl_ulong2 lo, hi; };
1067 #endif
1068 #if defined( __CL_ULONG2__) 
1069     __cl_ulong2     v2[2];
1070 #endif
1071 #if defined( __CL_ULONG4__) 
1072     __cl_ulong4     v4;
1073 #endif
1074 }cl_ulong4;
1075
1076 /* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
1077 typedef  cl_ulong4  cl_ulong3;
1078
1079 typedef union
1080 {
1081     cl_ulong   CL_ALIGNED(64) s[8];
1082 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1083    __extension__ struct{ cl_ulong  x, y, z, w; };
1084    __extension__ struct{ cl_ulong  s0, s1, s2, s3, s4, s5, s6, s7; };
1085    __extension__ struct{ cl_ulong4 lo, hi; };
1086 #endif
1087 #if defined( __CL_ULONG2__) 
1088     __cl_ulong2     v2[4];
1089 #endif
1090 #if defined( __CL_ULONG4__) 
1091     __cl_ulong4     v4[2];
1092 #endif
1093 #if defined( __CL_ULONG8__ )
1094     __cl_ulong8     v8;
1095 #endif
1096 }cl_ulong8;
1097
1098 typedef union
1099 {
1100     cl_ulong  CL_ALIGNED(128) s[16];
1101 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1102    __extension__ struct{ cl_ulong  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1103    __extension__ struct{ cl_ulong  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1104    __extension__ struct{ cl_ulong8 lo, hi; };
1105 #endif
1106 #if defined( __CL_ULONG2__) 
1107     __cl_ulong2     v2[8];
1108 #endif
1109 #if defined( __CL_ULONG4__) 
1110     __cl_ulong4     v4[4];
1111 #endif
1112 #if defined( __CL_ULONG8__ )
1113     __cl_ulong8     v8[2];
1114 #endif
1115 #if defined( __CL_ULONG16__ )
1116     __cl_ulong16    v16;
1117 #endif
1118 }cl_ulong16;
1119
1120
1121 /* --- cl_floatn ---- */
1122
1123 typedef union
1124 {
1125     cl_float  CL_ALIGNED(8) s[2];
1126 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1127    __extension__ struct{ cl_float  x, y; };
1128    __extension__ struct{ cl_float  s0, s1; };
1129    __extension__ struct{ cl_float  lo, hi; };
1130 #endif
1131 #if defined( __CL_FLOAT2__) 
1132     __cl_float2     v2;
1133 #endif
1134 }cl_float2;
1135
1136 typedef union
1137 {
1138     cl_float  CL_ALIGNED(16) s[4];
1139 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1140    __extension__ struct{ cl_float   x, y, z, w; };
1141    __extension__ struct{ cl_float   s0, s1, s2, s3; };
1142    __extension__ struct{ cl_float2  lo, hi; };
1143 #endif
1144 #if defined( __CL_FLOAT2__) 
1145     __cl_float2     v2[2];
1146 #endif
1147 #if defined( __CL_FLOAT4__) 
1148     __cl_float4     v4;
1149 #endif
1150 }cl_float4;
1151
1152 /* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
1153 typedef  cl_float4  cl_float3;
1154
1155 typedef union
1156 {
1157     cl_float   CL_ALIGNED(32) s[8];
1158 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1159    __extension__ struct{ cl_float   x, y, z, w; };
1160    __extension__ struct{ cl_float   s0, s1, s2, s3, s4, s5, s6, s7; };
1161    __extension__ struct{ cl_float4  lo, hi; };
1162 #endif
1163 #if defined( __CL_FLOAT2__) 
1164     __cl_float2     v2[4];
1165 #endif
1166 #if defined( __CL_FLOAT4__) 
1167     __cl_float4     v4[2];
1168 #endif
1169 #if defined( __CL_FLOAT8__ )
1170     __cl_float8     v8;
1171 #endif
1172 }cl_float8;
1173
1174 typedef union
1175 {
1176     cl_float  CL_ALIGNED(64) s[16];
1177 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1178    __extension__ struct{ cl_float  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1179    __extension__ struct{ cl_float  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1180    __extension__ struct{ cl_float8 lo, hi; };
1181 #endif
1182 #if defined( __CL_FLOAT2__) 
1183     __cl_float2     v2[8];
1184 #endif
1185 #if defined( __CL_FLOAT4__) 
1186     __cl_float4     v4[4];
1187 #endif
1188 #if defined( __CL_FLOAT8__ )
1189     __cl_float8     v8[2];
1190 #endif
1191 #if defined( __CL_FLOAT16__ )
1192     __cl_float16    v16;
1193 #endif
1194 }cl_float16;
1195
1196 /* --- cl_doublen ---- */
1197
1198 typedef union
1199 {
1200     cl_double  CL_ALIGNED(16) s[2];
1201 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1202    __extension__ struct{ cl_double  x, y; };
1203    __extension__ struct{ cl_double s0, s1; };
1204    __extension__ struct{ cl_double lo, hi; };
1205 #endif
1206 #if defined( __CL_DOUBLE2__) 
1207     __cl_double2     v2;
1208 #endif
1209 }cl_double2;
1210
1211 typedef union
1212 {
1213     cl_double  CL_ALIGNED(32) s[4];
1214 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1215    __extension__ struct{ cl_double  x, y, z, w; };
1216    __extension__ struct{ cl_double  s0, s1, s2, s3; };
1217    __extension__ struct{ cl_double2 lo, hi; };
1218 #endif
1219 #if defined( __CL_DOUBLE2__) 
1220     __cl_double2     v2[2];
1221 #endif
1222 #if defined( __CL_DOUBLE4__) 
1223     __cl_double4     v4;
1224 #endif
1225 }cl_double4;
1226
1227 /* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
1228 typedef  cl_double4  cl_double3;
1229
1230 typedef union
1231 {
1232     cl_double   CL_ALIGNED(64) s[8];
1233 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1234    __extension__ struct{ cl_double  x, y, z, w; };
1235    __extension__ struct{ cl_double  s0, s1, s2, s3, s4, s5, s6, s7; };
1236    __extension__ struct{ cl_double4 lo, hi; };
1237 #endif
1238 #if defined( __CL_DOUBLE2__) 
1239     __cl_double2     v2[4];
1240 #endif
1241 #if defined( __CL_DOUBLE4__) 
1242     __cl_double4     v4[2];
1243 #endif
1244 #if defined( __CL_DOUBLE8__ )
1245     __cl_double8     v8;
1246 #endif
1247 }cl_double8;
1248
1249 typedef union
1250 {
1251     cl_double  CL_ALIGNED(128) s[16];
1252 #if defined( CL_NAMED_STRUCT_SUPPORTED )
1253    __extension__ struct{ cl_double  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1254    __extension__ struct{ cl_double  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1255    __extension__ struct{ cl_double8 lo, hi; };
1256 #endif
1257 #if defined( __CL_DOUBLE2__) 
1258     __cl_double2     v2[8];
1259 #endif
1260 #if defined( __CL_DOUBLE4__) 
1261     __cl_double4     v4[4];
1262 #endif
1263 #if defined( __CL_DOUBLE8__ )
1264     __cl_double8     v8[2];
1265 #endif
1266 #if defined( __CL_DOUBLE16__ )
1267     __cl_double16    v16;
1268 #endif
1269 }cl_double16;
1270
1271 /* Macro to facilitate debugging 
1272  * Usage:
1273  *   Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source. 
1274  *   The first line ends with:   CL_PROGRAM_STRING_BEGIN \"
1275  *   Each line thereafter of OpenCL C source must end with: \n\
1276  *   The last line ends in ";
1277  *
1278  *   Example:
1279  *
1280  *   const char *my_program = CL_PROGRAM_STRING_BEGIN "\
1281  *   kernel void foo( int a, float * b )             \n\
1282  *   {                                               \n\
1283  *      // my comment                                \n\
1284  *      *b[ get_global_id(0)] = a;                   \n\
1285  *   }                                               \n\
1286  *   ";
1287  *
1288  * This should correctly set up the line, (column) and file information for your source 
1289  * string so you can do source level debugging.
1290  */
1291 #define  __CL_STRINGIFY( _x )               # _x
1292 #define  _CL_STRINGIFY( _x )                __CL_STRINGIFY( _x )
1293 #define  CL_PROGRAM_STRING_DEBUG_INFO       "#line "  _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n" 
1294
1295 //  CL.h contents
1296 /******************************************************************************/
1297
1298 typedef struct _cl_platform_id *    cl_platform_id;
1299 typedef struct _cl_device_id *      cl_device_id;
1300 typedef struct _cl_context *        cl_context;
1301 typedef struct _cl_command_queue *  cl_command_queue;
1302 typedef struct _cl_mem *            cl_mem;
1303 typedef struct _cl_program *        cl_program;
1304 typedef struct _cl_kernel *         cl_kernel;
1305 typedef struct _cl_event *          cl_event;
1306 typedef struct _cl_sampler *        cl_sampler;
1307
1308 typedef cl_uint             cl_bool;                     /* WARNING!  Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */ 
1309 typedef cl_ulong            cl_bitfield;
1310 typedef cl_bitfield         cl_device_type;
1311 typedef cl_uint             cl_platform_info;
1312 typedef cl_uint             cl_device_info;
1313 typedef cl_bitfield         cl_device_fp_config;
1314 typedef cl_uint             cl_device_mem_cache_type;
1315 typedef cl_uint             cl_device_local_mem_type;
1316 typedef cl_bitfield         cl_device_exec_capabilities;
1317 typedef cl_bitfield         cl_command_queue_properties;
1318 typedef intptr_t            cl_device_partition_property;
1319 typedef cl_bitfield         cl_device_affinity_domain;
1320
1321 typedef intptr_t                        cl_context_properties;
1322 typedef cl_uint             cl_context_info;
1323 typedef cl_uint             cl_command_queue_info;
1324 typedef cl_uint             cl_channel_order;
1325 typedef cl_uint             cl_channel_type;
1326 typedef cl_bitfield         cl_mem_flags;
1327 typedef cl_uint             cl_mem_object_type;
1328 typedef cl_uint             cl_mem_info;
1329 typedef cl_uint             cl_image_info;
1330 typedef cl_uint             cl_buffer_create_type;
1331 typedef cl_uint             cl_addressing_mode;
1332 typedef cl_uint             cl_filter_mode;
1333 typedef cl_uint             cl_sampler_info;
1334 typedef cl_bitfield         cl_map_flags;
1335 typedef cl_uint             cl_program_info;
1336 typedef cl_uint             cl_program_build_info;
1337 typedef cl_int              cl_build_status;
1338 typedef cl_uint             cl_kernel_info;
1339 typedef cl_uint             cl_kernel_work_group_info;
1340 typedef cl_uint             cl_event_info;
1341 typedef cl_uint             cl_command_type;
1342 typedef cl_uint             cl_profiling_info;
1343
1344 typedef struct _cl_image_format {
1345     cl_channel_order        image_channel_order;
1346     cl_channel_type         image_channel_data_type;
1347 } cl_image_format;
1348
1349 typedef struct _cl_image_desc {
1350        cl_mem_object_type      image_type;
1351        size_t                  image_width;
1352        size_t                  image_height;
1353        size_t                  image_depth;
1354        size_t                  image_array_size;
1355        size_t                  image_row_pitch;
1356        size_t                  image_slice_pitch;
1357        cl_uint                 num_mip_levels;
1358        cl_uint                 num_samples;
1359        cl_mem                  buffer;
1360    } cl_image_desc;
1361
1362 typedef struct _cl_buffer_region {
1363     size_t                  origin;
1364     size_t                  size;
1365 } cl_buffer_region;
1366
1367 /******************************************************************************/
1368
1369 /* Error Codes */
1370 #define CL_SUCCESS                                  0
1371 #define CL_DEVICE_NOT_FOUND                         -1
1372 #define CL_DEVICE_NOT_AVAILABLE                     -2
1373 #define CL_COMPILER_NOT_AVAILABLE                   -3
1374 #define CL_MEM_OBJECT_ALLOCATION_FAILURE            -4
1375 #define CL_OUT_OF_RESOURCES                         -5
1376 #define CL_OUT_OF_HOST_MEMORY                       -6
1377 #define CL_PROFILING_INFO_NOT_AVAILABLE             -7
1378 #define CL_MEM_COPY_OVERLAP                         -8
1379 #define CL_IMAGE_FORMAT_MISMATCH                    -9
1380 #define CL_IMAGE_FORMAT_NOT_SUPPORTED               -10
1381 #define CL_BUILD_PROGRAM_FAILURE                    -11
1382 #define CL_MAP_FAILURE                              -12
1383 #define CL_MISALIGNED_SUB_BUFFER_OFFSET             -13
1384 #define CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST -14
1385 #define CL_COMPILE_PROGRAM_FAILURE                  -15
1386 #define CL_LINKER_NOT_AVAILABLE                     -16
1387 #define CL_LINK_PROGRAM_FAILURE                     -17
1388 #define CL_DEVICE_PARTITION_FAILED                  -18
1389 #define CL_KERNEL_ARG_INFO_NOT_AVAILABLE            -19
1390
1391 #define CL_INVALID_VALUE                            -30
1392 #define CL_INVALID_DEVICE_TYPE                      -31
1393 #define CL_INVALID_PLATFORM                         -32
1394 #define CL_INVALID_DEVICE                           -33
1395 #define CL_INVALID_CONTEXT                          -34
1396 #define CL_INVALID_QUEUE_PROPERTIES                 -35
1397 #define CL_INVALID_COMMAND_QUEUE                    -36
1398 #define CL_INVALID_HOST_PTR                         -37
1399 #define CL_INVALID_MEM_OBJECT                       -38
1400 #define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR          -39
1401 #define CL_INVALID_IMAGE_SIZE                       -40
1402 #define CL_INVALID_SAMPLER                          -41
1403 #define CL_INVALID_BINARY                           -42
1404 #define CL_INVALID_BUILD_OPTIONS                    -43
1405 #define CL_INVALID_PROGRAM                          -44
1406 #define CL_INVALID_PROGRAM_EXECUTABLE               -45
1407 #define CL_INVALID_KERNEL_NAME                      -46
1408 #define CL_INVALID_KERNEL_DEFINITION                -47
1409 #define CL_INVALID_KERNEL                           -48
1410 #define CL_INVALID_ARG_INDEX                        -49
1411 #define CL_INVALID_ARG_VALUE                        -50
1412 #define CL_INVALID_ARG_SIZE                         -51
1413 #define CL_INVALID_KERNEL_ARGS                      -52
1414 #define CL_INVALID_WORK_DIMENSION                   -53
1415 #define CL_INVALID_WORK_GROUP_SIZE                  -54
1416 #define CL_INVALID_WORK_ITEM_SIZE                   -55
1417 #define CL_INVALID_GLOBAL_OFFSET                    -56
1418 #define CL_INVALID_EVENT_WAIT_LIST                  -57
1419 #define CL_INVALID_EVENT                            -58
1420 #define CL_INVALID_OPERATION                        -59
1421 #define CL_INVALID_GL_OBJECT                        -60
1422 #define CL_INVALID_BUFFER_SIZE                      -61
1423 #define CL_INVALID_MIP_LEVEL                        -62
1424 #define CL_INVALID_GLOBAL_WORK_SIZE                 -63
1425 #define CL_INVALID_PROPERTY                         -64
1426 #define CL_INVALID_IMAGE_DESCRIPTOR                 -65
1427 #define CL_INVALID_COMPILER_OPTIONS                 -66
1428 #define CL_INVALID_LINKER_OPTIONS                   -67
1429 #define CL_INVALID_DEVICE_PARTITION_COUNT           -68
1430
1431 /* OpenCL Version */
1432 #define CL_VERSION_1_0                              1
1433 #define CL_VERSION_1_1                              1
1434 #define CL_VERSION_1_2                              1
1435
1436 /* cl_bool */
1437 #define CL_FALSE                                    0
1438 #define CL_TRUE                                     1
1439 #define CL_BLOCKING                                 CL_TRUE
1440 #define CL_NON_BLOCKING                             CL_FALSE
1441
1442 /* cl_platform_info */
1443 #define CL_PLATFORM_PROFILE                         0x0900
1444 #define CL_PLATFORM_VERSION                         0x0901
1445 #define CL_PLATFORM_NAME                            0x0902
1446 #define CL_PLATFORM_VENDOR                          0x0903
1447 #define CL_PLATFORM_EXTENSIONS                      0x0904
1448
1449 /* cl_device_type - bitfield */
1450 #define CL_DEVICE_TYPE_DEFAULT                      (1 << 0)
1451 #define CL_DEVICE_TYPE_CPU                          (1 << 1)
1452 #define CL_DEVICE_TYPE_GPU                          (1 << 2)
1453 #define CL_DEVICE_TYPE_ACCELERATOR                  (1 << 3)
1454 #define CL_DEVICE_TYPE_CUSTOM                       (1 << 4)
1455 #define CL_DEVICE_TYPE_ALL                          0xFFFFFFFF
1456
1457 /* cl_device_info */
1458 #define CL_DEVICE_TYPE                              0x1000
1459 #define CL_DEVICE_VENDOR_ID                         0x1001
1460 #define CL_DEVICE_MAX_COMPUTE_UNITS                 0x1002
1461 #define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS          0x1003
1462 #define CL_DEVICE_MAX_WORK_GROUP_SIZE               0x1004
1463 #define CL_DEVICE_MAX_WORK_ITEM_SIZES               0x1005
1464 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR       0x1006
1465 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT      0x1007
1466 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT        0x1008
1467 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG       0x1009
1468 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT      0x100A
1469 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE     0x100B
1470 #define CL_DEVICE_MAX_CLOCK_FREQUENCY               0x100C
1471 #define CL_DEVICE_ADDRESS_BITS                      0x100D
1472 #define CL_DEVICE_MAX_READ_IMAGE_ARGS               0x100E
1473 #define CL_DEVICE_MAX_WRITE_IMAGE_ARGS              0x100F
1474 #define CL_DEVICE_MAX_MEM_ALLOC_SIZE                0x1010
1475 #define CL_DEVICE_IMAGE2D_MAX_WIDTH                 0x1011
1476 #define CL_DEVICE_IMAGE2D_MAX_HEIGHT                0x1012
1477 #define CL_DEVICE_IMAGE3D_MAX_WIDTH                 0x1013
1478 #define CL_DEVICE_IMAGE3D_MAX_HEIGHT                0x1014
1479 #define CL_DEVICE_IMAGE3D_MAX_DEPTH                 0x1015
1480 #define CL_DEVICE_IMAGE_SUPPORT                     0x1016
1481 #define CL_DEVICE_MAX_PARAMETER_SIZE                0x1017
1482 #define CL_DEVICE_MAX_SAMPLERS                      0x1018
1483 #define CL_DEVICE_MEM_BASE_ADDR_ALIGN               0x1019
1484 #define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE          0x101A
1485 #define CL_DEVICE_SINGLE_FP_CONFIG                  0x101B
1486 #define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE             0x101C
1487 #define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE         0x101D
1488 #define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE             0x101E
1489 #define CL_DEVICE_GLOBAL_MEM_SIZE                   0x101F
1490 #define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE          0x1020
1491 #define CL_DEVICE_MAX_CONSTANT_ARGS                 0x1021
1492 #define CL_DEVICE_LOCAL_MEM_TYPE                    0x1022
1493 #define CL_DEVICE_LOCAL_MEM_SIZE                    0x1023
1494 #define CL_DEVICE_ERROR_CORRECTION_SUPPORT          0x1024
1495 #define CL_DEVICE_PROFILING_TIMER_RESOLUTION        0x1025
1496 #define CL_DEVICE_ENDIAN_LITTLE                     0x1026
1497 #define CL_DEVICE_AVAILABLE                         0x1027
1498 #define CL_DEVICE_COMPILER_AVAILABLE                0x1028
1499 #define CL_DEVICE_EXECUTION_CAPABILITIES            0x1029
1500 #define CL_DEVICE_QUEUE_PROPERTIES                  0x102A
1501 #define CL_DEVICE_NAME                              0x102B
1502 #define CL_DEVICE_VENDOR                            0x102C
1503 #define CL_DRIVER_VERSION                           0x102D
1504 #define CL_DEVICE_PROFILE                           0x102E
1505 #define CL_DEVICE_VERSION                           0x102F
1506 #define CL_DEVICE_EXTENSIONS                        0x1030
1507 #define CL_DEVICE_PLATFORM                          0x1031
1508 #define CL_DEVICE_DOUBLE_FP_CONFIG                  0x1032
1509 /* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG */
1510 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF       0x1034
1511 #define CL_DEVICE_HOST_UNIFIED_MEMORY               0x1035
1512 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR          0x1036
1513 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT         0x1037
1514 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_INT           0x1038
1515 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG          0x1039
1516 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT         0x103A
1517 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE        0x103B
1518 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF          0x103C
1519 #define CL_DEVICE_OPENCL_C_VERSION                  0x103D
1520 #define CL_DEVICE_LINKER_AVAILABLE                  0x103E
1521 #define CL_DEVICE_BUILT_IN_KERNELS                  0x103F
1522 #define CL_DEVICE_IMAGE_MAX_BUFFER_SIZE             0x1040
1523 #define CL_DEVICE_IMAGE_MAX_ARRAY_SIZE              0x1041
1524 #define CL_DEVICE_PARENT_DEVICE                     0x1042
1525 #define CL_DEVICE_PARTITION_MAX_SUB_DEVICES         0x1043
1526 #define CL_DEVICE_PARTITION_PROPERTIES              0x1044
1527 #define CL_DEVICE_PARTITION_AFFINITY_DOMAIN         0x1045
1528 #define CL_DEVICE_PARTITION_TYPE                    0x1046
1529 #define CL_DEVICE_REFERENCE_COUNT                   0x1047
1530 #define CL_DEVICE_PREFERRED_INTEROP_USER_SYNC       0x1048
1531 #define CL_DEVICE_PRINTF_BUFFER_SIZE                0x1049
1532 #define CL_DEVICE_IMAGE_PITCH_ALIGNMENT             0x104A
1533 #define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT      0x104B
1534
1535 /* cl_device_fp_config - bitfield */
1536 #define CL_FP_DENORM                                (1 << 0)
1537 #define CL_FP_INF_NAN                               (1 << 1)
1538 #define CL_FP_ROUND_TO_NEAREST                      (1 << 2)
1539 #define CL_FP_ROUND_TO_ZERO                         (1 << 3)
1540 #define CL_FP_ROUND_TO_INF                          (1 << 4)
1541 #define CL_FP_FMA                                   (1 << 5)
1542 #define CL_FP_SOFT_FLOAT                            (1 << 6)
1543 #define CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT         (1 << 7)
1544
1545 /* cl_device_mem_cache_type */
1546 #define CL_NONE                                     0x0
1547 #define CL_READ_ONLY_CACHE                          0x1
1548 #define CL_READ_WRITE_CACHE                         0x2
1549
1550 /* cl_device_local_mem_type */
1551 #define CL_LOCAL                                    0x1
1552 #define CL_GLOBAL                                   0x2
1553
1554 /* cl_device_exec_capabilities - bitfield */
1555 #define CL_EXEC_KERNEL                              (1 << 0)
1556 #define CL_EXEC_NATIVE_KERNEL                       (1 << 1)
1557
1558 /* cl_command_queue_properties - bitfield */
1559 #define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE      (1 << 0)
1560 #define CL_QUEUE_PROFILING_ENABLE                   (1 << 1)
1561
1562 /* cl_context_info  */
1563 #define CL_CONTEXT_REFERENCE_COUNT                  0x1080
1564 #define CL_CONTEXT_DEVICES                          0x1081
1565 #define CL_CONTEXT_PROPERTIES                       0x1082
1566 #define CL_CONTEXT_NUM_DEVICES                      0x1083
1567
1568 /* cl_context_info + cl_context_properties */
1569 #define CL_CONTEXT_PLATFORM                         0x1084
1570 #define CL_CONTEXT_INTEROP_USER_SYNC                0x1085
1571
1572 /* cl_device_partition_property */
1573 #define CL_DEVICE_PARTITION_EQUALLY                 0x1086
1574 #define CL_DEVICE_PARTITION_BY_COUNTS               0x1087
1575 #define CL_DEVICE_PARTITION_BY_COUNTS_LIST_END      0x0
1576 #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN      0x1088
1577
1578 /* cl_device_affinity_domain */
1579 #define CL_DEVICE_AFFINITY_DOMAIN_NUMA                     (1 << 0)
1580 #define CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE                 (1 << 1)
1581 #define CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE                 (1 << 2)
1582 #define CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE                 (1 << 3)
1583 #define CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE                 (1 << 4)
1584 #define CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE       (1 << 5)
1585
1586 /* cl_command_queue_info */
1587 #define CL_QUEUE_CONTEXT                            0x1090
1588 #define CL_QUEUE_DEVICE                             0x1091
1589 #define CL_QUEUE_REFERENCE_COUNT                    0x1092
1590 #define CL_QUEUE_PROPERTIES                         0x1093
1591
1592 /* cl_mem_flags - bitfield */
1593 #define CL_MEM_READ_WRITE                           (1 << 0)
1594 #define CL_MEM_WRITE_ONLY                           (1 << 1)
1595 #define CL_MEM_READ_ONLY                            (1 << 2)
1596 #define CL_MEM_USE_HOST_PTR                         (1 << 3)
1597 #define CL_MEM_ALLOC_HOST_PTR                       (1 << 4)
1598 #define CL_MEM_COPY_HOST_PTR                        (1 << 5)
1599 // reserved                                         (1 << 6)
1600 #define CL_MEM_HOST_WRITE_ONLY                      (1 << 7)
1601 #define CL_MEM_HOST_READ_ONLY                       (1 << 8)
1602 #define CL_MEM_HOST_NO_ACCESS                       (1 << 9)
1603
1604 /* cl_mem_migration_flags - bitfield */
1605 #define CL_MIGRATE_MEM_OBJECT_HOST                  (1 << 0)
1606 #define CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED     (1 << 1)
1607
1608 /* cl_channel_order */
1609 #define CL_R                                        0x10B0
1610 #define CL_A                                        0x10B1
1611 #define CL_RG                                       0x10B2
1612 #define CL_RA                                       0x10B3
1613 #define CL_RGB                                      0x10B4
1614 #define CL_RGBA                                     0x10B5
1615 #define CL_BGRA                                     0x10B6
1616 #define CL_ARGB                                     0x10B7
1617 #define CL_INTENSITY                                0x10B8
1618 #define CL_LUMINANCE                                0x10B9
1619 #define CL_Rx                                       0x10BA
1620 #define CL_RGx                                      0x10BB
1621 #define CL_RGBx                                     0x10BC
1622 #define CL_DEPTH                                    0x10BD
1623 #define CL_DEPTH_STENCIL                            0x10BE
1624
1625 /* cl_channel_type */
1626 #define CL_SNORM_INT8                               0x10D0
1627 #define CL_SNORM_INT16                              0x10D1
1628 #define CL_UNORM_INT8                               0x10D2
1629 #define CL_UNORM_INT16                              0x10D3
1630 #define CL_UNORM_SHORT_565                          0x10D4
1631 #define CL_UNORM_SHORT_555                          0x10D5
1632 #define CL_UNORM_INT_101010                         0x10D6
1633 #define CL_SIGNED_INT8                              0x10D7
1634 #define CL_SIGNED_INT16                             0x10D8
1635 #define CL_SIGNED_INT32                             0x10D9
1636 #define CL_UNSIGNED_INT8                            0x10DA
1637 #define CL_UNSIGNED_INT16                           0x10DB
1638 #define CL_UNSIGNED_INT32                           0x10DC
1639 #define CL_HALF_FLOAT                               0x10DD
1640 #define CL_FLOAT                                    0x10DE
1641 #define CL_UNORM_INT24                              0x10DF
1642
1643 /* cl_mem_object_type */
1644 #define CL_MEM_OBJECT_BUFFER                        0x10F0
1645 #define CL_MEM_OBJECT_IMAGE2D                       0x10F1
1646 #define CL_MEM_OBJECT_IMAGE3D                       0x10F2
1647 #define CL_MEM_OBJECT_IMAGE2D_ARRAY                 0x10F3
1648 #define CL_MEM_OBJECT_IMAGE1D                       0x10F4
1649 #define CL_MEM_OBJECT_IMAGE1D_ARRAY                 0x10F5
1650 #define CL_MEM_OBJECT_IMAGE1D_BUFFER                0x10F6
1651
1652 /* cl_mem_info */
1653 #define CL_MEM_TYPE                                 0x1100
1654 #define CL_MEM_FLAGS                                0x1101
1655 #define CL_MEM_SIZE                                 0x1102
1656 #define CL_MEM_HOST_PTR                             0x1103
1657 #define CL_MEM_MAP_COUNT                            0x1104
1658 #define CL_MEM_REFERENCE_COUNT                      0x1105
1659 #define CL_MEM_CONTEXT                              0x1106
1660 #define CL_MEM_ASSOCIATED_MEMOBJECT                 0x1107
1661 #define CL_MEM_OFFSET                               0x1108
1662
1663 /* cl_image_info */
1664 #define CL_IMAGE_FORMAT                             0x1110
1665 #define CL_IMAGE_ELEMENT_SIZE                       0x1111
1666 #define CL_IMAGE_ROW_PITCH                          0x1112
1667 #define CL_IMAGE_SLICE_PITCH                        0x1113
1668 #define CL_IMAGE_WIDTH                              0x1114
1669 #define CL_IMAGE_HEIGHT                             0x1115
1670 #define CL_IMAGE_DEPTH                              0x1116
1671 #define CL_IMAGE_ARRAY_SIZE                         0x1117
1672 #define CL_IMAGE_BUFFER                             0x1118
1673 #define CL_IMAGE_NUM_MIP_LEVELS                     0x1119
1674 #define CL_IMAGE_NUM_SAMPLES                        0x111A
1675
1676 /* cl_addressing_mode */
1677 #define CL_ADDRESS_NONE                             0x1130
1678 #define CL_ADDRESS_CLAMP_TO_EDGE                    0x1131
1679 #define CL_ADDRESS_CLAMP                            0x1132
1680 #define CL_ADDRESS_REPEAT                           0x1133
1681 #define CL_ADDRESS_MIRRORED_REPEAT                  0x1134
1682
1683 /* cl_filter_mode */
1684 #define CL_FILTER_NEAREST                           0x1140
1685 #define CL_FILTER_LINEAR                            0x1141
1686
1687 /* cl_sampler_info */
1688 #define CL_SAMPLER_REFERENCE_COUNT                  0x1150
1689 #define CL_SAMPLER_CONTEXT                          0x1151
1690 #define CL_SAMPLER_NORMALIZED_COORDS                0x1152
1691 #define CL_SAMPLER_ADDRESSING_MODE                  0x1153
1692 #define CL_SAMPLER_FILTER_MODE                      0x1154
1693
1694 /* cl_map_flags - bitfield */
1695 #define CL_MAP_READ                                 (1 << 0)
1696 #define CL_MAP_WRITE                                (1 << 1)
1697 #define CL_MAP_WRITE_INVALIDATE_REGION              (1 << 2)
1698
1699 /* cl_program_info */
1700 #define CL_PROGRAM_REFERENCE_COUNT                  0x1160
1701 #define CL_PROGRAM_CONTEXT                          0x1161
1702 #define CL_PROGRAM_NUM_DEVICES                      0x1162
1703 #define CL_PROGRAM_DEVICES                          0x1163
1704 #define CL_PROGRAM_SOURCE                           0x1164
1705 #define CL_PROGRAM_BINARY_SIZES                     0x1165
1706 #define CL_PROGRAM_BINARIES                         0x1166
1707 #define CL_PROGRAM_NUM_KERNELS                      0x1167
1708 #define CL_PROGRAM_KERNEL_NAMES                     0x1168
1709
1710 /* cl_program_build_info */
1711 #define CL_PROGRAM_BUILD_STATUS                     0x1181
1712 #define CL_PROGRAM_BUILD_OPTIONS                    0x1182
1713 #define CL_PROGRAM_BUILD_LOG                        0x1183
1714 #define CL_PROGRAM_BINARY_TYPE                      0x1184
1715
1716 /* cl_build_status */
1717 #define CL_BUILD_SUCCESS                            0
1718 #define CL_BUILD_NONE                               -1
1719 #define CL_BUILD_ERROR                              -2
1720 #define CL_BUILD_IN_PROGRESS                        -3
1721
1722 /* cl_kernel_info */
1723 #define CL_KERNEL_FUNCTION_NAME                     0x1190
1724 #define CL_KERNEL_NUM_ARGS                          0x1191
1725 #define CL_KERNEL_REFERENCE_COUNT                   0x1192
1726 #define CL_KERNEL_CONTEXT                           0x1193
1727 #define CL_KERNEL_PROGRAM                           0x1194
1728 #define CL_KERNEL_ATTRIBUTES                        0x1195
1729
1730 /* cl_kernel_arg_info */
1731 #define CL_KERNEL_ARG_ADDRESS_QUALIFIER             0x1196
1732 #define CL_KERNEL_ARG_ACCESS_QUALIFIER              0x1197
1733 #define CL_KERNEL_ARG_TYPE_NAME                     0x1198
1734 #define CL_KERNEL_ARG_TYPE_QUALIFIER                0x1199
1735 #define CL_KERNEL_ARG_NAME                          0x119A
1736
1737 /* cl_kernel_arg_address_qualifier */
1738 #define CL_KERNEL_ARG_ADDRESS_GLOBAL                0x119B
1739 #define CL_KERNEL_ARG_ADDRESS_LOCAL                 0x119C
1740 #define CL_KERNEL_ARG_ADDRESS_CONSTANT              0x119D
1741 #define CL_KERNEL_ARG_ADDRESS_PRIVATE               0x119E
1742
1743 /* cl_kernel_arg_access_qualifier */
1744 #define CL_KERNEL_ARG_ACCESS_READ_ONLY              0x11A0
1745 #define CL_KERNEL_ARG_ACCESS_WRITE_ONLY             0x11A1
1746 #define CL_KERNEL_ARG_ACCESS_READ_WRITE             0x11A2
1747 #define CL_KERNEL_ARG_ACCESS_NONE                   0x11A3
1748
1749 /* cl_kernel_arg_type_qualifer */
1750 #define CL_KERNEL_ARG_TYPE_NONE                     0
1751 #define CL_KERNEL_ARG_TYPE_CONST                    (1 << 0)
1752 #define CL_KERNEL_ARG_TYPE_RESTRICT                 (1 << 1)
1753 #define CL_KERNEL_ARG_TYPE_VOLATILE                 (1 << 2)
1754
1755 /* cl_kernel_work_group_info */
1756 #define CL_KERNEL_WORK_GROUP_SIZE                   0x11B0
1757 #define CL_KERNEL_COMPILE_WORK_GROUP_SIZE           0x11B1
1758 #define CL_KERNEL_LOCAL_MEM_SIZE                    0x11B2
1759 #define CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x11B3
1760 #define CL_KERNEL_PRIVATE_MEM_SIZE                  0x11B4
1761 #define CL_KERNEL_GLOBAL_WORK_SIZE                  0x11B5
1762
1763 /* cl_event_info  */
1764 #define CL_EVENT_COMMAND_QUEUE                      0x11D0
1765 #define CL_EVENT_COMMAND_TYPE                       0x11D1
1766 #define CL_EVENT_REFERENCE_COUNT                    0x11D2
1767 #define CL_EVENT_COMMAND_EXECUTION_STATUS           0x11D3
1768 #define CL_EVENT_CONTEXT                            0x11D4
1769
1770 /* cl_command_type */
1771 #define CL_COMMAND_NDRANGE_KERNEL                   0x11F0
1772 #define CL_COMMAND_TASK                             0x11F1
1773 #define CL_COMMAND_NATIVE_KERNEL                    0x11F2
1774 #define CL_COMMAND_READ_BUFFER                      0x11F3
1775 #define CL_COMMAND_WRITE_BUFFER                     0x11F4
1776 #define CL_COMMAND_COPY_BUFFER                      0x11F5
1777 #define CL_COMMAND_READ_IMAGE                       0x11F6
1778 #define CL_COMMAND_WRITE_IMAGE                      0x11F7
1779 #define CL_COMMAND_COPY_IMAGE                       0x11F8
1780 #define CL_COMMAND_COPY_IMAGE_TO_BUFFER             0x11F9
1781 #define CL_COMMAND_COPY_BUFFER_TO_IMAGE             0x11FA
1782 #define CL_COMMAND_MAP_BUFFER                       0x11FB
1783 #define CL_COMMAND_MAP_IMAGE                        0x11FC
1784 #define CL_COMMAND_UNMAP_MEM_OBJECT                 0x11FD
1785 #define CL_COMMAND_MARKER                           0x11FE
1786 #define CL_COMMAND_ACQUIRE_GL_OBJECTS               0x11FF
1787 #define CL_COMMAND_RELEASE_GL_OBJECTS               0x1200
1788 #define CL_COMMAND_READ_BUFFER_RECT                 0x1201
1789 #define CL_COMMAND_WRITE_BUFFER_RECT                0x1202
1790 #define CL_COMMAND_COPY_BUFFER_RECT                 0x1203
1791 #define CL_COMMAND_USER                             0x1204
1792 #define CL_COMMAND_BARRIER                          0x1205
1793 #define CL_COMMAND_MIGRATE_MEM_OBJECTS              0x1206
1794 #define CL_COMMAND_FILL_BUFFER                      0x1207
1795 #define CL_COMMAND_FILL_IMAGE                       0x1208
1796
1797 /* command execution status */
1798 #define CL_COMPLETE                                 0x0
1799 #define CL_RUNNING                                  0x1
1800 #define CL_SUBMITTED                                0x2
1801 #define CL_QUEUED                                   0x3
1802   
1803 /* cl_buffer_create_type  */
1804 #define CL_BUFFER_CREATE_TYPE_REGION                0x1220
1805
1806 /* cl_profiling_info  */
1807 #define CL_PROFILING_COMMAND_QUEUED                 0x1280
1808 #define CL_PROFILING_COMMAND_SUBMIT                 0x1281
1809 #define CL_PROFILING_COMMAND_START                  0x1282
1810 #define CL_PROFILING_COMMAND_END                    0x1283
1811
1812 /********************************************************************************************************/
1813
1814 /********************************************************************************************************/
1815
1816 /*  Function signature typedef's */
1817
1818 #ifdef __APPLE__
1819 #  pragma GCC diagnostic push
1820 #  pragma GCC diagnostic ignored "-Wignored-attributes"
1821 #endif
1822
1823 /* Platform API */
1824 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1825 PFNCLGETPLATFORMIDS)(cl_uint          /* num_entries */,
1826                  cl_platform_id * /* platforms */,
1827                  cl_uint *        /* num_platforms */) CL_API_SUFFIX__VERSION_1_0;
1828
1829 typedef CL_API_ENTRY cl_int (CL_API_CALL * 
1830 PFNCLGETPLATFORMINFO)(cl_platform_id   /* platform */, 
1831                   cl_platform_info /* param_name */,
1832                   size_t           /* param_value_size */, 
1833                   void *           /* param_value */,
1834                   size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
1835
1836 /* Device APIs */
1837 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1838 PFNCLGETDEVICEIDS)(cl_platform_id   /* platform */,
1839                cl_device_type   /* device_type */, 
1840                cl_uint          /* num_entries */, 
1841                cl_device_id *   /* devices */, 
1842                cl_uint *        /* num_devices */) CL_API_SUFFIX__VERSION_1_0;
1843
1844 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1845 PFNCLGETDEVICEINFO)(cl_device_id    /* device */,
1846                 cl_device_info  /* param_name */, 
1847                 size_t          /* param_value_size */, 
1848                 void *          /* param_value */,
1849                 size_t *        /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
1850
1851 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1852 PFNCLCREATESUBDEVICES)(cl_device_id                         /* in_device */,
1853                   const cl_device_partition_property * /* properties */,
1854                   cl_uint                              /* num_devices */,
1855                   cl_device_id *                       /* out_devices */,
1856                   cl_uint *                            /* num_devices_ret */) CL_API_SUFFIX__VERSION_1_2;
1857
1858 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1859 PFNCLRETAINDEVICE)(cl_device_id /* device */) CL_API_SUFFIX__VERSION_1_2;
1860
1861 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1862 PFNCLRELEASEDEVICE)(cl_device_id /* device */) CL_API_SUFFIX__VERSION_1_2;
1863
1864 // Context APIs  
1865 typedef CL_API_ENTRY cl_context (CL_API_CALL *
1866 PFNCLCREATECONTEXT)(const cl_context_properties * /* properties */,
1867                 cl_uint                       /* num_devices */,
1868                 const cl_device_id *          /* devices */,
1869                 void (CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t, void *),
1870                 void *                        /* user_data */,
1871                 cl_int *                      /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
1872
1873 typedef CL_API_ENTRY cl_context (CL_API_CALL *
1874 PFNCLCREATECONTEXTFROMTYPE)(const cl_context_properties * /* properties */,
1875                         cl_device_type                /* device_type */,
1876                         void (CL_CALLBACK *     /* pfn_notify*/ )(const char *, const void *, size_t, void *),
1877                         void *                        /* user_data */,
1878                         cl_int *                      /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
1879
1880 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1881 PFNCLRETAINCONTEXT)(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
1882
1883 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1884 PFNCLRELEASECONTEXT)(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
1885
1886 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1887 PFNCLGETCONTEXTINFO)(cl_context         /* context */, 
1888                  cl_context_info    /* param_name */, 
1889                  size_t             /* param_value_size */, 
1890                  void *             /* param_value */, 
1891                  size_t *           /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
1892
1893 /* Command Queue APIs */
1894 typedef CL_API_ENTRY cl_command_queue (CL_API_CALL *
1895 PFNCLCREATECOMMANDQUEUE)(cl_context                     /* context */, 
1896                      cl_device_id                   /* device */, 
1897                      cl_command_queue_properties    /* properties */,
1898                      cl_int *                       /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
1899
1900 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1901 PFNCLRETAINCOMMANDQUEUE)(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
1902
1903 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1904 PFNCLRELEASECOMMANDQUEUE)(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
1905
1906 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1907 PFNCLGETCOMMANDQUEUEINFO)(cl_command_queue      /* command_queue */,
1908                       cl_command_queue_info /* param_name */,
1909                       size_t                /* param_value_size */,
1910                       void *                /* param_value */,
1911                       size_t *              /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
1912
1913 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1914 PFNCLSETCOMMANDQUEUEPROPERTY)(cl_command_queue              /* command_queue */,
1915                           cl_command_queue_properties   /* properties */, 
1916                           cl_bool                        /* enable */,
1917                           cl_command_queue_properties * /* old_properties */) CL_API_SUFFIX__VERSION_1_0;
1918
1919 /* Memory Object APIs */
1920 typedef CL_API_ENTRY cl_mem (CL_API_CALL *
1921 PFNCLCREATEBUFFER)(cl_context   /* context */,
1922                cl_mem_flags /* flags */,
1923                size_t       /* size */,
1924                void *       /* host_ptr */,
1925                cl_int *     /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
1926
1927 typedef CL_API_ENTRY cl_mem (CL_API_CALL *
1928 PFNCLCREATESUBBUFFER)(cl_mem                    /* buffer */,
1929                cl_mem_flags                     /* flags */,
1930                cl_buffer_create_type    /* buffer_create_type */,
1931                const void *                     /* buffer_create_info */,
1932                cl_int *                         /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
1933
1934 typedef CL_API_ENTRY cl_mem (CL_API_CALL *
1935 PFNCLCREATEIMAGE)(cl_context              /* context */,
1936              cl_mem_flags            /* flags */,
1937              const cl_image_format * /* image_format */,
1938              const cl_image_desc *   /* image_desc */,
1939              void *                  /* host_ptr */,
1940              cl_int *                /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
1941
1942 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1943 PFNCLRETAINMEMOBJECT)(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
1944
1945 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1946 PFNCLRELEASEMEMOBJECT)(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
1947
1948 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1949 PFNCLGETSUPPORTEDIMAGEFORMATS)(cl_context           /* context */,
1950                            cl_mem_flags         /* flags */,
1951                            cl_mem_object_type   /* image_type */,
1952                            cl_uint              /* num_entries */,
1953                            cl_image_format *    /* image_formats */,
1954                            cl_uint *            /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0;
1955
1956 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1957 PFNCLGETMEMOBJECTINFO)(cl_mem           /* memobj */,
1958                    cl_mem_info      /* param_name */, 
1959                    size_t           /* param_value_size */,
1960                    void *           /* param_value */,
1961                    size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
1962
1963 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1964 PFNCLGETIMAGEINFO)(cl_mem           /* image */,
1965                cl_image_info    /* param_name */, 
1966                size_t           /* param_value_size */,
1967                void *           /* param_value */,
1968                size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
1969
1970 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1971 PFNCLSETMEMOBJECTDESTRUCTORCALLBACK)(  cl_mem /* memobj */, 
1972                                     void (CL_CALLBACK * /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), 
1973                                     void * /*user_data */ )             CL_API_SUFFIX__VERSION_1_1;  
1974
1975 /* Sampler APIs  */
1976 typedef CL_API_ENTRY cl_sampler (CL_API_CALL *
1977 PFNCLCREATESAMPLER)(cl_context          /* context */,
1978                 cl_bool             /* normalized_coords */, 
1979                 cl_addressing_mode  /* addressing_mode */, 
1980                 cl_filter_mode      /* filter_mode */,
1981                 cl_int *            /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
1982
1983 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1984 PFNCLRETAINSAMPLER)(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
1985
1986 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1987 PFNCLRELEASESAMPLER)(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
1988
1989 typedef CL_API_ENTRY cl_int (CL_API_CALL *
1990 PFNCLGETSAMPLERINFO)(cl_sampler         /* sampler */,
1991                  cl_sampler_info    /* param_name */,
1992                  size_t             /* param_value_size */,
1993                  void *             /* param_value */,
1994                  size_t *           /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
1995  
1996 /* Program Object APIs  */
1997 typedef CL_API_ENTRY cl_program (CL_API_CALL *
1998 PFNCLCREATEPROGRAMWITHSOURCE)(cl_context        /* context */,
1999                           cl_uint           /* count */,
2000                           const char **     /* strings */,
2001                           const size_t *    /* lengths */,
2002                           cl_int *          /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
2003
2004 typedef CL_API_ENTRY cl_program (CL_API_CALL *
2005 PFNCLCREATEPROGRAMWITHBINARY)(cl_context                     /* context */,
2006                           cl_uint                        /* num_devices */,
2007                           const cl_device_id *           /* device_list */,
2008                           const size_t *                 /* lengths */,
2009                           const unsigned char **         /* binaries */,
2010                           cl_int *                       /* binary_status */,
2011                           cl_int *                       /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
2012
2013 typedef CL_API_ENTRY cl_program (CL_API_CALL *
2014 PFNCLCREATEPROGRAMWITHBUILTINKERNELS)(cl_context            /* context */,
2015                                  cl_uint               /* num_devices */,
2016                                  const cl_device_id *  /* device_list */,
2017                                  const char *          /* kernel_names */,
2018                                  cl_int *              /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
2019
2020 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2021 PFNCLRETAINPROGRAM)(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
2022
2023 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2024 PFNCLRELEASEPROGRAM)(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
2025
2026 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2027 PFNCLBUILDPROGRAM)(cl_program           /* program */,
2028                cl_uint              /* num_devices */,
2029                const cl_device_id * /* device_list */,
2030                const char *         /* options */, 
2031                void (CL_CALLBACK *  /* pfn_notify */)(cl_program /* program */, void * /* user_data */),
2032                void *               /* user_data */) CL_API_SUFFIX__VERSION_1_0;
2033
2034 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2035 PFNCLGETPROGRAMINFO)(cl_program         /* program */,
2036                  cl_program_info    /* param_name */,
2037                  size_t             /* param_value_size */,
2038                  void *             /* param_value */,
2039                  size_t *           /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
2040
2041 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2042 PFNCLGETPROGRAMBUILDINFO)(cl_program            /* program */,
2043                       cl_device_id          /* device */,
2044                       cl_program_build_info /* param_name */,
2045                       size_t                /* param_value_size */,
2046                       void *                /* param_value */,
2047                       size_t *              /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
2048
2049 /* Kernel Object APIs */
2050 typedef CL_API_ENTRY cl_kernel (CL_API_CALL *
2051 PFNCLCREATEKERNEL)(cl_program      /* program */,
2052                const char *    /* kernel_name */,
2053                cl_int *        /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
2054
2055 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2056 PFNCLCREATEKERNELSINPROGRAM)(cl_program     /* program */,
2057                          cl_uint        /* num_kernels */,
2058                          cl_kernel *    /* kernels */,
2059                          cl_uint *      /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0;
2060
2061 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2062 PFNCLRETAINKERNEL)(cl_kernel    /* kernel */) CL_API_SUFFIX__VERSION_1_0;
2063
2064 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2065 PFNCLRELEASEKERNEL)(cl_kernel   /* kernel */) CL_API_SUFFIX__VERSION_1_0;
2066
2067 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2068 PFNCLSETKERNELARG)(cl_kernel    /* kernel */,
2069                cl_uint      /* arg_index */,
2070                size_t       /* arg_size */,
2071                const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0;
2072
2073 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2074 PFNCLGETKERNELINFO)(cl_kernel       /* kernel */,
2075                 cl_kernel_info  /* param_name */,
2076                 size_t          /* param_value_size */,
2077                 void *          /* param_value */,
2078                 size_t *        /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
2079
2080 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2081 PFNCLGETKERNELWORKGROUPINFO)(cl_kernel                  /* kernel */,
2082                          cl_device_id               /* device */,
2083                          cl_kernel_work_group_info  /* param_name */,
2084                          size_t                     /* param_value_size */,
2085                          void *                     /* param_value */,
2086                          size_t *                   /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
2087
2088 // Event Object APIs
2089 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2090 PFNCLWAITFOREVENTS)(cl_uint             /* num_events */,
2091                 const cl_event *    /* event_list */) CL_API_SUFFIX__VERSION_1_0;
2092
2093 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2094 PFNCLGETEVENTINFO)(cl_event         /* event */,
2095                cl_event_info    /* param_name */,
2096                size_t           /* param_value_size */,
2097                void *           /* param_value */,
2098                size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
2099
2100 typedef CL_API_ENTRY cl_event (CL_API_CALL *
2101 PFNCLCREATEUSEREVENT)(cl_context    /* context */,
2102                           cl_int *      /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;               
2103
2104 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2105 PFNCLRETAINEVENT)(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
2106
2107 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2108 PFNCLRELEASEEVENT)(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
2109
2110 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2111 PFNCLSETUSEREVENTSTATUS)(cl_event   /* event */,
2112                      cl_int     /* execution_status */) CL_API_SUFFIX__VERSION_1_1;
2113                      
2114 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2115 PFNCLSETEVENTCALLBACK)( cl_event    /* event */,
2116                     cl_int      /* command_exec_callback_type */,
2117                     void (CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *),
2118                     void *      /* user_data */) CL_API_SUFFIX__VERSION_1_1;
2119
2120 /* Profiling APIs  */
2121 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2122 PFNCLGETEVENTPROFILINGINFO)(cl_event            /* event */,
2123                         cl_profiling_info   /* param_name */,
2124                         size_t              /* param_value_size */,
2125                         void *              /* param_value */,
2126                         size_t *            /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
2127
2128 // Flush and Finish APIs
2129 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2130 PFNCLFLUSH)(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
2131
2132 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2133 PFNCLFINISH)(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
2134
2135 /* Enqueued Commands APIs */
2136 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2137 PFNCLENQUEUEREADBUFFER)(cl_command_queue    /* command_queue */,
2138                     cl_mem              /* buffer */,
2139                     cl_bool             /* blocking_read */,
2140                     size_t              /* offset */,
2141                     size_t              /* cb */, 
2142                     void *              /* ptr */,
2143                     cl_uint             /* num_events_in_wait_list */,
2144                     const cl_event *    /* event_wait_list */,
2145                     cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
2146                             
2147 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2148 PFNCLENQUEUEREADBUFFERRECT)(cl_command_queue    /* command_queue */,
2149                         cl_mem              /* buffer */,
2150                         cl_bool             /* blocking_read */,
2151                         const size_t *      /* buffer_origin */,
2152                         const size_t *      /* host_origin */, 
2153                         const size_t *      /* region */,
2154                         size_t              /* buffer_row_pitch */,
2155                         size_t              /* buffer_slice_pitch */,
2156                         size_t              /* host_row_pitch */,
2157                         size_t              /* host_slice_pitch */,                        
2158                         void *              /* ptr */,
2159                         cl_uint             /* num_events_in_wait_list */,
2160                         const cl_event *    /* event_wait_list */,
2161                         cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_1;
2162                             
2163 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2164 PFNCLENQUEUEWRITEBUFFER)(cl_command_queue   /* command_queue */, 
2165                      cl_mem             /* buffer */, 
2166                      cl_bool            /* blocking_write */, 
2167                      size_t             /* offset */, 
2168                      size_t             /* cb */, 
2169                      const void *       /* ptr */, 
2170                      cl_uint            /* num_events_in_wait_list */, 
2171                      const cl_event *   /* event_wait_list */, 
2172                      cl_event *         /* event */) CL_API_SUFFIX__VERSION_1_0;
2173                             
2174 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2175 PFNCLENQUEUEWRITEBUFFERRECT)(cl_command_queue    /* command_queue */,
2176                          cl_mem              /* buffer */,
2177                          cl_bool             /* blocking_write */,
2178                          const size_t *      /* buffer_origin */,
2179                          const size_t *      /* host_origin */, 
2180                          const size_t *      /* region */,
2181                          size_t              /* buffer_row_pitch */,
2182                          size_t              /* buffer_slice_pitch */,
2183                          size_t              /* host_row_pitch */,
2184                          size_t              /* host_slice_pitch */,                        
2185                          const void *        /* ptr */,
2186                          cl_uint             /* num_events_in_wait_list */,
2187                          const cl_event *    /* event_wait_list */,
2188                          cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_1;
2189                             
2190 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2191 PFNCLENQUEUECOPYBUFFER)(cl_command_queue    /* command_queue */, 
2192                     cl_mem              /* src_buffer */,
2193                     cl_mem              /* dst_buffer */, 
2194                     size_t              /* src_offset */,
2195                     size_t              /* dst_offset */,
2196                     size_t              /* cb */, 
2197                     cl_uint             /* num_events_in_wait_list */,
2198                     const cl_event *    /* event_wait_list */,
2199                     cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
2200                             
2201 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2202 PFNCLENQUEUECOPYBUFFERRECT)(cl_command_queue    /* command_queue */, 
2203                         cl_mem              /* src_buffer */,
2204                         cl_mem              /* dst_buffer */, 
2205                         const size_t *      /* src_origin */,
2206                         const size_t *      /* dst_origin */,
2207                         const size_t *      /* region */, 
2208                         size_t              /* src_row_pitch */,
2209                         size_t              /* src_slice_pitch */,
2210                         size_t              /* dst_row_pitch */,
2211                         size_t              /* dst_slice_pitch */,
2212                         cl_uint             /* num_events_in_wait_list */,
2213                         const cl_event *    /* event_wait_list */,
2214                         cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_1;
2215                             
2216 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2217 PFNCLENQUEUEREADIMAGE)(cl_command_queue     /* command_queue */,
2218                    cl_mem               /* image */,
2219                    cl_bool              /* blocking_read */, 
2220                    const size_t *       /* origin[3] */,
2221                    const size_t *       /* region[3] */,
2222                    size_t               /* row_pitch */,
2223                    size_t               /* slice_pitch */, 
2224                    void *               /* ptr */,
2225                    cl_uint              /* num_events_in_wait_list */,
2226                    const cl_event *     /* event_wait_list */,
2227                    cl_event *           /* event */) CL_API_SUFFIX__VERSION_1_0;
2228
2229 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2230 PFNCLENQUEUEWRITEIMAGE)(cl_command_queue    /* command_queue */,
2231                     cl_mem              /* image */,
2232                     cl_bool             /* blocking_write */, 
2233                     const size_t *      /* origin[3] */,
2234                     const size_t *      /* region[3] */,
2235                     size_t              /* input_row_pitch */,
2236                     size_t              /* input_slice_pitch */, 
2237                     const void *        /* ptr */,
2238                     cl_uint             /* num_events_in_wait_list */,
2239                     const cl_event *    /* event_wait_list */,
2240                     cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
2241
2242 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2243 PFNCLENQUEUECOPYIMAGE)(cl_command_queue     /* command_queue */,
2244                    cl_mem               /* src_image */,
2245                    cl_mem               /* dst_image */, 
2246                    const size_t *       /* src_origin[3] */,
2247                    const size_t *       /* dst_origin[3] */,
2248                    const size_t *       /* region[3] */, 
2249                    cl_uint              /* num_events_in_wait_list */,
2250                    const cl_event *     /* event_wait_list */,
2251                    cl_event *           /* event */) CL_API_SUFFIX__VERSION_1_0;
2252
2253 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2254 PFNCLENQUEUECOPYIMAGETOBUFFER)(cl_command_queue /* command_queue */,
2255                            cl_mem           /* src_image */,
2256                            cl_mem           /* dst_buffer */, 
2257                            const size_t *   /* src_origin[3] */,
2258                            const size_t *   /* region[3] */, 
2259                            size_t           /* dst_offset */,
2260                            cl_uint          /* num_events_in_wait_list */,
2261                            const cl_event * /* event_wait_list */,
2262                            cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
2263
2264 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2265 PFNCLENQUEUECOPYBUFFERTOIMAGE)(cl_command_queue /* command_queue */,
2266                            cl_mem           /* src_buffer */,
2267                            cl_mem           /* dst_image */, 
2268                            size_t           /* src_offset */,
2269                            const size_t *   /* dst_origin[3] */,
2270                            const size_t *   /* region[3] */, 
2271                            cl_uint          /* num_events_in_wait_list */,
2272                            const cl_event * /* event_wait_list */,
2273                            cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
2274
2275 typedef CL_API_ENTRY void * (CL_API_CALL *
2276 PFNCLENQUEUEMAPBUFFER)(cl_command_queue /* command_queue */,
2277                    cl_mem           /* buffer */,
2278                    cl_bool          /* blocking_map */, 
2279                    cl_map_flags     /* map_flags */,
2280                    size_t           /* offset */,
2281                    size_t           /* cb */,
2282                    cl_uint          /* num_events_in_wait_list */,
2283                    const cl_event * /* event_wait_list */,
2284                    cl_event *       /* event */,
2285                    cl_int *         /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
2286
2287 typedef CL_API_ENTRY void * (CL_API_CALL *
2288 PFNCLENQUEUEMAPIMAGE)(cl_command_queue  /* command_queue */,
2289                   cl_mem            /* image */, 
2290                   cl_bool           /* blocking_map */, 
2291                   cl_map_flags      /* map_flags */, 
2292                   const size_t *    /* origin[3] */,
2293                   const size_t *    /* region[3] */,
2294                   size_t *          /* image_row_pitch */,
2295                   size_t *          /* image_slice_pitch */,
2296                   cl_uint           /* num_events_in_wait_list */,
2297                   const cl_event *  /* event_wait_list */,
2298                   cl_event *        /* event */,
2299                   cl_int *          /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
2300
2301 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2302 PFNCLENQUEUEUNMAPMEMOBJECT)(cl_command_queue /* command_queue */,
2303                         cl_mem           /* memobj */,
2304                         void *           /* mapped_ptr */,
2305                         cl_uint          /* num_events_in_wait_list */,
2306                         const cl_event *  /* event_wait_list */,
2307                         cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_0;
2308
2309 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2310 PFNCLENQUEUENDRANGEKERNEL)(cl_command_queue /* command_queue */,
2311                        cl_kernel        /* kernel */,
2312                        cl_uint          /* work_dim */,
2313                        const size_t *   /* global_work_offset */,
2314                        const size_t *   /* global_work_size */,
2315                        const size_t *   /* local_work_size */,
2316                        cl_uint          /* num_events_in_wait_list */,
2317                        const cl_event * /* event_wait_list */,
2318                        cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
2319
2320 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2321 PFNCLENQUEUETASK)(cl_command_queue  /* command_queue */,
2322               cl_kernel         /* kernel */,
2323               cl_uint           /* num_events_in_wait_list */,
2324               const cl_event *  /* event_wait_list */,
2325               cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_0;
2326
2327 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2328 PFNCLENQUEUENATIVEKERNEL)(cl_command_queue  /* command_queue */,
2329                       void (*user_func)(void *), 
2330                       void *            /* args */,
2331                       size_t            /* cb_args */, 
2332                       cl_uint           /* num_mem_objects */,
2333                       const cl_mem *    /* mem_list */,
2334                       const void **     /* args_mem_loc */,
2335                       cl_uint           /* num_events_in_wait_list */,
2336                       const cl_event *  /* event_wait_list */,
2337                       cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_0;
2338
2339 /* Extension function access
2340 *
2341 * Returns the extension function address for the given function name,
2342 * or NULL if a valid function can not be found.  The client must
2343 * check to make sure the address is not NULL, before using or
2344 * calling the returned function address.
2345 */
2346 typedef CL_API_ENTRY void * (CL_API_CALL *
2347 PFNCLGETEXTENSIONFUNCTIONADDRESSFORPLATFORM)(cl_platform_id /* platform */,
2348                                          const char *   /* func_name */) CL_API_SUFFIX__VERSION_1_2;
2349 #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
2350 // Deprecated OpenCL 1.1 APIs
2351 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (CL_API_CALL *
2352 PFNCLCREATEIMAGE2D)(cl_context              /* context */,
2353                cl_mem_flags            /* flags */,
2354                const cl_image_format * /* image_format */,
2355                size_t                  /* image_width */,
2356                size_t                  /* image_height */,
2357                size_t                  /* image_row_pitch */,
2358                void *                  /* host_ptr */,
2359                cl_int *                /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
2360
2361 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (CL_API_CALL *
2362 PFNCLCREATEIMAGE3D)(cl_context              /* context */,
2363                cl_mem_flags            /* flags */,
2364                const cl_image_format * /* image_format */,
2365                size_t                  /* image_width */,
2366                size_t                  /* image_height */,
2367                size_t                  /* image_depth */,
2368                size_t                  /* image_row_pitch */,
2369                size_t                  /* image_slice_pitch */,
2370                void *                  /* host_ptr */,
2371                cl_int *                /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
2372
2373 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (CL_API_CALL *
2374 PFNCLENQUEUEMARKER)(cl_command_queue    /* command_queue */,
2375                cl_event *          /* event */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
2376
2377 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (CL_API_CALL *
2378 PFNCLENQUEUEWAITFOREVENTS)(cl_command_queue /* command_queue */,
2379                       cl_uint          /* num_events */,
2380                       const cl_event * /* event_list */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
2381
2382 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (CL_API_CALL *
2383 PFNCLENQUEUEBARRIER)(cl_command_queue /* command_queue */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
2384
2385 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (CL_API_CALL *
2386 PFNCLUNLOADCOMPILER)(void) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
2387
2388 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED void * (CL_API_CALL *
2389 PFNCLGETEXTENSIONFUNCTIONADDRESS)(const char * /* func_name */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
2390 #endif
2391
2392
2393 /* cl_gl */
2394
2395 typedef cl_uint     cl_gl_object_type;
2396 typedef cl_uint     cl_gl_texture_info;
2397 typedef cl_uint     cl_gl_platform_info;
2398 typedef struct __GLsync *cl_GLsync;
2399
2400 /* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken           */
2401 #define CL_GL_OBJECT_BUFFER                     0x2000
2402 #define CL_GL_OBJECT_TEXTURE2D                  0x2001
2403 #define CL_GL_OBJECT_TEXTURE3D                  0x2002
2404 #define CL_GL_OBJECT_RENDERBUFFER               0x2003
2405 #define CL_GL_OBJECT_TEXTURE2D_ARRAY            0x200E
2406 #define CL_GL_OBJECT_TEXTURE1D                  0x200F
2407 #define CL_GL_OBJECT_TEXTURE1D_ARRAY            0x2010
2408 #define CL_GL_OBJECT_TEXTURE_BUFFER             0x2011
2409
2410 /* cl_gl_texture_info           */
2411 #define CL_GL_TEXTURE_TARGET                    0x2004
2412 #define CL_GL_MIPMAP_LEVEL                      0x2005
2413 #define CL_GL_NUM_SAMPLES                       0x2012
2414
2415
2416 typedef CL_API_ENTRY cl_mem (CL_API_CALL *
2417 PFNCLCREATEFROMGLBUFFER)(cl_context     /* context */,
2418                    cl_mem_flags   /* flags */,
2419                    cl_GLuint      /* bufobj */,
2420                    int *          /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
2421
2422 typedef CL_API_ENTRY cl_mem (CL_API_CALL *
2423 PFNCLCREATEFROMGLTEXTURE)(cl_context      /* context */,
2424                     cl_mem_flags    /* flags */,
2425                     cl_GLenum       /* target */,
2426                     cl_GLint        /* miplevel */,
2427                     cl_GLuint       /* texture */,
2428                     cl_int *        /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
2429
2430 typedef CL_API_ENTRY cl_mem (CL_API_CALL *
2431 PFNCLCREATEFROMGLRENDERBUFFER)(cl_context   /* context */,
2432                          cl_mem_flags /* flags */,
2433                          cl_GLuint    /* renderbuffer */,
2434                          cl_int *     /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
2435
2436 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2437 PFNCLGETGLOBJECTINFO)(cl_mem                /* memobj */,
2438                 cl_gl_object_type *   /* gl_object_type */,
2439                 cl_GLuint *           /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
2440
2441 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2442 PFNCLGETGLTEXTUREINFO)(cl_mem               /* memobj */,
2443                  cl_gl_texture_info   /* param_name */,
2444                  size_t               /* param_value_size */,
2445                  void *               /* param_value */,
2446                  size_t *             /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
2447
2448 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2449 PFNCLENQUEUEACQUIREGLOBJECTS)(cl_command_queue      /* command_queue */,
2450                         cl_uint               /* num_objects */,
2451                         const cl_mem *        /* mem_objects */,
2452                         cl_uint               /* num_events_in_wait_list */,
2453                         const cl_event *      /* event_wait_list */,
2454                         cl_event *            /* event */) CL_API_SUFFIX__VERSION_1_0;
2455
2456 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2457 PFNCLENQUEUERELEASEGLOBJECTS)(cl_command_queue      /* command_queue */,
2458                         cl_uint               /* num_objects */,
2459                         const cl_mem *        /* mem_objects */,
2460                         cl_uint               /* num_events_in_wait_list */,
2461                         const cl_event *      /* event_wait_list */,
2462                         cl_event *            /* event */) CL_API_SUFFIX__VERSION_1_0;
2463
2464
2465 // Deprecated OpenCL 1.1 APIs
2466 #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
2467 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (CL_API_CALL *
2468 PFNCLCREATEFROMGLTEXTURE2D)(cl_context      /* context */,
2469                       cl_mem_flags    /* flags */,
2470                       cl_GLenum       /* target */,
2471                       cl_GLint        /* miplevel */,
2472                       cl_GLuint       /* texture */,
2473                       cl_int *        /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
2474
2475 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (CL_API_CALL *
2476 PFNCLCREATEFROMGLTEXTURE3D)(cl_context      /* context */,
2477                       cl_mem_flags    /* flags */,
2478                       cl_GLenum       /* target */,
2479                       cl_GLint        /* miplevel */,
2480                       cl_GLuint       /* texture */,
2481                       cl_int *        /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
2482 #endif
2483
2484 #ifdef __APPLE__
2485 #  pragma GCC diagnostic pop // ignored "-Wignored-attributes"
2486 #endif
2487         
2488 /* cl_khr_gl_sharing extension  */
2489
2490 #define cl_khr_gl_sharing 1
2491
2492 typedef cl_uint     cl_gl_context_info;
2493
2494 /* Additional Error Codes  */
2495 #define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR  -1000
2496
2497 /* cl_gl_context_info  */
2498 #define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR    0x2006
2499 #define CL_DEVICES_FOR_GL_CONTEXT_KHR           0x2007
2500
2501 /* Additional cl_context_properties  */
2502 #define CL_GL_CONTEXT_KHR                       0x2008
2503 #define CL_EGL_DISPLAY_KHR                      0x2009
2504 #define CL_GLX_DISPLAY_KHR                      0x200A
2505 #define CL_WGL_HDC_KHR                          0x200B
2506 #define CL_CGL_SHAREGROUP_KHR                   0x200C
2507
2508 typedef CL_API_ENTRY cl_int (CL_API_CALL *
2509 PFNCLGETGLCONTEXTINFOKHR)(const cl_context_properties * /* properties */,
2510                     cl_gl_context_info            /* param_name */,
2511                     size_t                        /* param_value_size */,
2512                     void *                        /* param_value */,
2513                     size_t *                      /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
2514
2515 typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
2516   const cl_context_properties * properties,
2517   cl_gl_context_info            param_name,
2518   size_t                        param_value_size,
2519   void *                        param_value,
2520   size_t *                      param_value_size_ret);
2521
2522 #define CLEW_STATIC
2523
2524 #ifdef CLEW_STATIC
2525 #  define CLEWAPI extern
2526 #else
2527 #  ifdef CLEW_BUILD
2528 #    define CLEWAPI extern __declspec(dllexport)
2529 #  else
2530 #    define CLEWAPI extern __declspec(dllimport)
2531 #  endif
2532 #endif
2533
2534 #if defined(_WIN32)
2535 #define CLEW_FUN_EXPORT extern
2536 #else
2537 #define CLEW_FUN_EXPORT CLEWAPI
2538 #endif
2539
2540 #define CLEW_GET_FUN(x) x
2541
2542
2543 //  Variables holding function entry points
2544 CLEW_FUN_EXPORT     PFNCLGETPLATFORMIDS                 __clewGetPlatformIDs                ;
2545 CLEW_FUN_EXPORT     PFNCLGETPLATFORMINFO                __clewGetPlatformInfo               ;
2546 CLEW_FUN_EXPORT     PFNCLGETDEVICEIDS                   __clewGetDeviceIDs                  ;
2547 CLEW_FUN_EXPORT     PFNCLGETDEVICEINFO                  __clewGetDeviceInfo                 ;
2548 CLEW_FUN_EXPORT     PFNCLCREATESUBDEVICES               __clewCreateSubDevices              ;
2549 CLEW_FUN_EXPORT     PFNCLRETAINDEVICE                   __clewRetainDevice                  ;
2550 CLEW_FUN_EXPORT     PFNCLRELEASEDEVICE                  __clewReleaseDevice                 ;
2551 CLEW_FUN_EXPORT     PFNCLCREATECONTEXT                  __clewCreateContext                 ;
2552 CLEW_FUN_EXPORT     PFNCLCREATECONTEXTFROMTYPE          __clewCreateContextFromType         ;
2553 CLEW_FUN_EXPORT     PFNCLRETAINCONTEXT                  __clewRetainContext                 ;
2554 CLEW_FUN_EXPORT     PFNCLRELEASECONTEXT                 __clewReleaseContext                ;
2555 CLEW_FUN_EXPORT     PFNCLGETCONTEXTINFO                 __clewGetContextInfo                ;
2556 CLEW_FUN_EXPORT     PFNCLCREATECOMMANDQUEUE             __clewCreateCommandQueue            ;
2557 CLEW_FUN_EXPORT     PFNCLRETAINCOMMANDQUEUE             __clewRetainCommandQueue            ;
2558 CLEW_FUN_EXPORT     PFNCLRELEASECOMMANDQUEUE            __clewReleaseCommandQueue           ;
2559 CLEW_FUN_EXPORT     PFNCLGETCOMMANDQUEUEINFO            __clewGetCommandQueueInfo           ;
2560 CLEW_FUN_EXPORT     PFNCLCREATEBUFFER                   __clewCreateBuffer                  ;
2561 CLEW_FUN_EXPORT     PFNCLCREATESUBBUFFER                __clewCreateSubBuffer               ;
2562 CLEW_FUN_EXPORT     PFNCLCREATEIMAGE                    __clewCreateImage                   ;
2563 CLEW_FUN_EXPORT     PFNCLRETAINMEMOBJECT                __clewRetainMemObject               ;
2564 CLEW_FUN_EXPORT     PFNCLRELEASEMEMOBJECT               __clewReleaseMemObject              ;
2565 CLEW_FUN_EXPORT     PFNCLGETSUPPORTEDIMAGEFORMATS       __clewGetSupportedImageFormats      ;
2566 CLEW_FUN_EXPORT     PFNCLGETMEMOBJECTINFO               __clewGetMemObjectInfo              ;
2567 CLEW_FUN_EXPORT     PFNCLGETIMAGEINFO                   __clewGetImageInfo                  ;
2568 CLEW_FUN_EXPORT     PFNCLSETMEMOBJECTDESTRUCTORCALLBACK __clewSetMemObjectDestructorCallback;
2569 CLEW_FUN_EXPORT     PFNCLCREATESAMPLER                  __clewCreateSampler                 ;
2570 CLEW_FUN_EXPORT     PFNCLRETAINSAMPLER                  __clewRetainSampler                 ;
2571 CLEW_FUN_EXPORT     PFNCLRELEASESAMPLER                 __clewReleaseSampler                ;
2572 CLEW_FUN_EXPORT     PFNCLGETSAMPLERINFO                 __clewGetSamplerInfo                ;
2573 CLEW_FUN_EXPORT     PFNCLCREATEPROGRAMWITHSOURCE        __clewCreateProgramWithSource       ;
2574 CLEW_FUN_EXPORT     PFNCLCREATEPROGRAMWITHBINARY        __clewCreateProgramWithBinary       ;
2575 CLEW_FUN_EXPORT     PFNCLCREATEPROGRAMWITHBUILTINKERNELS __clewCreateProgramWithBuiltInKernels;
2576 CLEW_FUN_EXPORT     PFNCLRETAINPROGRAM                  __clewRetainProgram                 ;
2577 CLEW_FUN_EXPORT     PFNCLRELEASEPROGRAM                 __clewReleaseProgram                ;
2578 CLEW_FUN_EXPORT     PFNCLBUILDPROGRAM                   __clewBuildProgram                  ;
2579 CLEW_FUN_EXPORT     PFNCLGETPROGRAMINFO                 __clewGetProgramInfo                ;
2580 CLEW_FUN_EXPORT     PFNCLGETPROGRAMBUILDINFO            __clewGetProgramBuildInfo           ;
2581 CLEW_FUN_EXPORT     PFNCLCREATEKERNEL                   __clewCreateKernel                  ;
2582 CLEW_FUN_EXPORT     PFNCLCREATEKERNELSINPROGRAM         __clewCreateKernelsInProgram        ;
2583 CLEW_FUN_EXPORT     PFNCLRETAINKERNEL                   __clewRetainKernel                  ;
2584 CLEW_FUN_EXPORT     PFNCLRELEASEKERNEL                  __clewReleaseKernel                 ;
2585 CLEW_FUN_EXPORT     PFNCLSETKERNELARG                   __clewSetKernelArg                  ;
2586 CLEW_FUN_EXPORT     PFNCLGETKERNELINFO                  __clewGetKernelInfo                 ;
2587 CLEW_FUN_EXPORT     PFNCLGETKERNELWORKGROUPINFO         __clewGetKernelWorkGroupInfo        ;
2588 CLEW_FUN_EXPORT     PFNCLWAITFOREVENTS                  __clewWaitForEvents                 ;
2589 CLEW_FUN_EXPORT     PFNCLGETEVENTINFO                   __clewGetEventInfo                  ;
2590 CLEW_FUN_EXPORT     PFNCLCREATEUSEREVENT                __clewCreateUserEvent               ;
2591 CLEW_FUN_EXPORT     PFNCLRETAINEVENT                    __clewRetainEvent                   ;
2592 CLEW_FUN_EXPORT     PFNCLRELEASEEVENT                   __clewReleaseEvent                  ;
2593 CLEW_FUN_EXPORT     PFNCLSETUSEREVENTSTATUS             __clewSetUserEventStatus            ;
2594 CLEW_FUN_EXPORT     PFNCLSETEVENTCALLBACK               __clewSetEventCallback              ;
2595 CLEW_FUN_EXPORT     PFNCLGETEVENTPROFILINGINFO          __clewGetEventProfilingInfo         ;
2596 CLEW_FUN_EXPORT     PFNCLFLUSH                          __clewFlush                         ;
2597 CLEW_FUN_EXPORT     PFNCLFINISH                         __clewFinish                        ;
2598 CLEW_FUN_EXPORT     PFNCLENQUEUEREADBUFFER              __clewEnqueueReadBuffer             ;
2599 CLEW_FUN_EXPORT     PFNCLENQUEUEREADBUFFERRECT          __clewEnqueueReadBufferRect         ;
2600 CLEW_FUN_EXPORT     PFNCLENQUEUEWRITEBUFFER             __clewEnqueueWriteBuffer            ;
2601 CLEW_FUN_EXPORT     PFNCLENQUEUEWRITEBUFFERRECT         __clewEnqueueWriteBufferRect        ;
2602 CLEW_FUN_EXPORT     PFNCLENQUEUECOPYBUFFER              __clewEnqueueCopyBuffer             ;
2603 CLEW_FUN_EXPORT     PFNCLENQUEUECOPYBUFFERRECT          __clewEnqueueCopyBufferRect         ;
2604 CLEW_FUN_EXPORT     PFNCLENQUEUEREADIMAGE               __clewEnqueueReadImage              ;
2605 CLEW_FUN_EXPORT     PFNCLENQUEUEWRITEIMAGE              __clewEnqueueWriteImage             ;
2606 CLEW_FUN_EXPORT     PFNCLENQUEUECOPYIMAGE               __clewEnqueueCopyImage              ;
2607 CLEW_FUN_EXPORT     PFNCLENQUEUECOPYIMAGETOBUFFER       __clewEnqueueCopyImageToBuffer      ;
2608 CLEW_FUN_EXPORT     PFNCLENQUEUECOPYBUFFERTOIMAGE       __clewEnqueueCopyBufferToImage      ;
2609 CLEW_FUN_EXPORT     PFNCLENQUEUEMAPBUFFER               __clewEnqueueMapBuffer              ;
2610 CLEW_FUN_EXPORT     PFNCLENQUEUEMAPIMAGE                __clewEnqueueMapImage               ;
2611 CLEW_FUN_EXPORT     PFNCLENQUEUEUNMAPMEMOBJECT          __clewEnqueueUnmapMemObject         ;
2612 CLEW_FUN_EXPORT     PFNCLENQUEUENDRANGEKERNEL           __clewEnqueueNDRangeKernel          ;
2613 CLEW_FUN_EXPORT     PFNCLENQUEUETASK                    __clewEnqueueTask                   ;
2614 CLEW_FUN_EXPORT     PFNCLENQUEUENATIVEKERNEL            __clewEnqueueNativeKernel           ;
2615 CLEW_FUN_EXPORT     PFNCLGETEXTENSIONFUNCTIONADDRESSFORPLATFORM __clewGetExtensionFunctionAddressForPlatform;
2616
2617 #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
2618 CLEW_FUN_EXPORT     PFNCLSETCOMMANDQUEUEPROPERTY        __clewSetCommandQueueProperty       ;
2619 #endif
2620
2621 #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
2622 CLEW_FUN_EXPORT     PFNCLCREATEIMAGE2D                  __clewCreateImage2D                 ;
2623 CLEW_FUN_EXPORT     PFNCLCREATEIMAGE3D                  __clewCreateImage3D                 ;
2624 CLEW_FUN_EXPORT     PFNCLGETEXTENSIONFUNCTIONADDRESS    __clewGetExtensionFunctionAddress   ;
2625 CLEW_FUN_EXPORT     PFNCLUNLOADCOMPILER                 __clewUnloadCompiler                ;
2626 CLEW_FUN_EXPORT     PFNCLENQUEUEMARKER                  __clewEnqueueMarker                 ;
2627 CLEW_FUN_EXPORT     PFNCLENQUEUEWAITFOREVENTS           __clewEnqueueWaitForEvents          ;
2628 CLEW_FUN_EXPORT     PFNCLENQUEUEBARRIER                 __clewEnqueueBarrier                ;
2629 #endif
2630
2631 /* cl_gl */
2632 CLEW_FUN_EXPORT     PFNCLCREATEFROMGLBUFFER             __clewCreateFromGLBuffer            ;
2633 CLEW_FUN_EXPORT     PFNCLCREATEFROMGLTEXTURE            __clewCreateFromGLTexture           ;
2634 CLEW_FUN_EXPORT     PFNCLCREATEFROMGLRENDERBUFFER       __clewCreateFromGLRenderbuffer      ;
2635 CLEW_FUN_EXPORT     PFNCLGETGLOBJECTINFO                __clewGetGLObjectInfo               ;
2636 CLEW_FUN_EXPORT     PFNCLGETGLTEXTUREINFO               __clewGetGLTextureInfo              ;
2637 CLEW_FUN_EXPORT     PFNCLENQUEUEACQUIREGLOBJECTS        __clewEnqueueAcquireGLObjects       ;
2638 CLEW_FUN_EXPORT     PFNCLENQUEUERELEASEGLOBJECTS        __clewEnqueueReleaseGLObjects       ;
2639 #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
2640 CLEW_FUN_EXPORT     PFNCLCREATEFROMGLTEXTURE2D          __clewCreateFromGLTexture2D         ;
2641 CLEW_FUN_EXPORT     PFNCLCREATEFROMGLTEXTURE3D          __clewCreateFromGLTexture3D         ;
2642 #endif
2643 CLEW_FUN_EXPORT     PFNCLGETGLCONTEXTINFOKHR            __clewGetGLContextInfoKHR           ;
2644
2645 #define clGetPlatformIDs                CLEW_GET_FUN(__clewGetPlatformIDs                )
2646 #define clGetPlatformInfo               CLEW_GET_FUN(__clewGetPlatformInfo               )
2647 #define clGetDeviceIDs                  CLEW_GET_FUN(__clewGetDeviceIDs                  )
2648 #define clGetDeviceInfo                 CLEW_GET_FUN(__clewGetDeviceInfo                 )
2649 #define clCreateContext                 CLEW_GET_FUN(__clewCreateContext                 )
2650 #define clCreateContextFromType         CLEW_GET_FUN(__clewCreateContextFromType         )
2651 #define clRetainContext                 CLEW_GET_FUN(__clewRetainContext                 )
2652 #define clReleaseContext                CLEW_GET_FUN(__clewReleaseContext                )
2653 #define clGetContextInfo                CLEW_GET_FUN(__clewGetContextInfo                )
2654 #define clCreateCommandQueue            CLEW_GET_FUN(__clewCreateCommandQueue            )
2655 #define clRetainCommandQueue            CLEW_GET_FUN(__clewRetainCommandQueue            )
2656 #define clReleaseCommandQueue           CLEW_GET_FUN(__clewReleaseCommandQueue           )
2657 #define clGetCommandQueueInfo           CLEW_GET_FUN(__clewGetCommandQueueInfo           )
2658 #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
2659 #warning CL_USE_DEPRECATED_OPENCL_1_0_APIS is defined. These APIs are unsupported and untested in OpenCL 1.1!
2660 /* 
2661  *  WARNING:
2662  *     This API introduces mutable state into the OpenCL implementation. It has been REMOVED
2663  *  to better facilitate thread safety.  The 1.0 API is not thread safe. It is not tested by the
2664  *  OpenCL 1.1 conformance test, and consequently may not work or may not work dependably.
2665  *  It is likely to be non-performant. Use of this API is not advised. Use at your own risk.
2666  *
2667  *  Software developers previously relying on this API are instructed to set the command queue 
2668  *  properties when creating the queue, instead. 
2669  */
2670 #define clSetCommandQueueProperty       CLEW_GET_FUN(__clewSetCommandQueueProperty       )
2671 #endif /* CL_USE_DEPRECATED_OPENCL_1_0_APIS */
2672 #define clCreateBuffer                  CLEW_GET_FUN(__clewCreateBuffer                  )
2673 #define clCreateSubBuffer               CLEW_GET_FUN(__clewCreateSubBuffer               )
2674 #define clCreateImage                   CLEW_GET_FUN(__clewCreateImage                   )
2675 #define clRetainMemObject               CLEW_GET_FUN(__clewRetainMemObject               )
2676 #define clReleaseMemObject              CLEW_GET_FUN(__clewReleaseMemObject              )
2677 #define clGetSupportedImageFormats      CLEW_GET_FUN(__clewGetSupportedImageFormats      )
2678 #define clGetMemObjectInfo              CLEW_GET_FUN(__clewGetMemObjectInfo              )
2679 #define clGetImageInfo                  CLEW_GET_FUN(__clewGetImageInfo                  )
2680 #define clSetMemObjectDestructorCallback CLEW_GET_FUN(__clewSetMemObjectDestructorCallback)
2681 #define clCreateSampler                 CLEW_GET_FUN(__clewCreateSampler                 )
2682 #define clRetainSampler                 CLEW_GET_FUN(__clewRetainSampler                 )
2683 #define clReleaseSampler                CLEW_GET_FUN(__clewReleaseSampler                )
2684 #define clGetSamplerInfo                CLEW_GET_FUN(__clewGetSamplerInfo                )
2685 #define clCreateProgramWithSource       CLEW_GET_FUN(__clewCreateProgramWithSource       )
2686 #define clCreateProgramWithBinary       CLEW_GET_FUN(__clewCreateProgramWithBinary       )
2687 #define clCreateProgramWithBuiltInKernels CLEW_GET_FUN(__clewCreateProgramWithBuiltInKernels)
2688 #define clRetainProgram                 CLEW_GET_FUN(__clewRetainProgram                 )
2689 #define clReleaseProgram                CLEW_GET_FUN(__clewReleaseProgram                )
2690 #define clBuildProgram                  CLEW_GET_FUN(__clewBuildProgram                  )
2691 #define clGetProgramInfo                CLEW_GET_FUN(__clewGetProgramInfo                )
2692 #define clGetProgramBuildInfo           CLEW_GET_FUN(__clewGetProgramBuildInfo           )
2693 #define clCreateKernel                  CLEW_GET_FUN(__clewCreateKernel                  )
2694 #define clCreateKernelsInProgram        CLEW_GET_FUN(__clewCreateKernelsInProgram        )
2695 #define clRetainKernel                  CLEW_GET_FUN(__clewRetainKernel                  )
2696 #define clReleaseKernel                 CLEW_GET_FUN(__clewReleaseKernel                 )
2697 #define clSetKernelArg                  CLEW_GET_FUN(__clewSetKernelArg                  )
2698 #define clGetKernelInfo                 CLEW_GET_FUN(__clewGetKernelInfo                 )
2699 #define clGetKernelWorkGroupInfo        CLEW_GET_FUN(__clewGetKernelWorkGroupInfo        )
2700 #define clWaitForEvents                 CLEW_GET_FUN(__clewWaitForEvents                 )
2701 #define clGetEventInfo                  CLEW_GET_FUN(__clewGetEventInfo                  )
2702 #define clCreateUserEvent               CLEW_GET_FUN(__clewCreateUserEvent               )
2703 #define clRetainEvent                   CLEW_GET_FUN(__clewRetainEvent                   )
2704 #define clReleaseEvent                  CLEW_GET_FUN(__clewReleaseEvent                  )
2705 #define clSetUserEventStatus            CLEW_GET_FUN(__clewSetUserEventStatus            )
2706 #define clSetEventCallback              CLEW_GET_FUN(__clewSetEventCallback              )
2707 #define clGetEventProfilingInfo         CLEW_GET_FUN(__clewGetEventProfilingInfo         )
2708 #define clFlush                         CLEW_GET_FUN(__clewFlush                         )
2709 #define clFinish                        CLEW_GET_FUN(__clewFinish                        )
2710 #define clEnqueueReadBuffer             CLEW_GET_FUN(__clewEnqueueReadBuffer             )
2711 #define clEnqueueReadBufferRect         CLEW_GET_FUN(__clewEnqueueReadBufferRect         )
2712 #define clEnqueueWriteBuffer            CLEW_GET_FUN(__clewEnqueueWriteBuffer            )
2713 #define clEnqueueWriteBufferRect        CLEW_GET_FUN(__clewEnqueueWriteBufferRect        )
2714 #define clEnqueueCopyBuffer             CLEW_GET_FUN(__clewEnqueueCopyBuffer             )
2715 #define clEnqueueCopyBufferRect         CLEW_GET_FUN(__clewEnqueueCopyBufferRect         )
2716 #define clEnqueueReadImage              CLEW_GET_FUN(__clewEnqueueReadImage              )
2717 #define clEnqueueWriteImage             CLEW_GET_FUN(__clewEnqueueWriteImage             )
2718 #define clEnqueueCopyImage              CLEW_GET_FUN(__clewEnqueueCopyImage              )
2719 #define clEnqueueCopyImageToBuffer      CLEW_GET_FUN(__clewEnqueueCopyImageToBuffer      )
2720 #define clEnqueueCopyBufferToImage      CLEW_GET_FUN(__clewEnqueueCopyBufferToImage      )
2721 #define clEnqueueMapBuffer              CLEW_GET_FUN(__clewEnqueueMapBuffer              )
2722 #define clEnqueueMapImage               CLEW_GET_FUN(__clewEnqueueMapImage               )
2723 #define clEnqueueUnmapMemObject         CLEW_GET_FUN(__clewEnqueueUnmapMemObject         )
2724 #define clEnqueueNDRangeKernel          CLEW_GET_FUN(__clewEnqueueNDRangeKernel          )
2725 #define clEnqueueTask                   CLEW_GET_FUN(__clewEnqueueTask                   )
2726 #define clEnqueueNativeKernel           CLEW_GET_FUN(__clewEnqueueNativeKernel           )
2727
2728 #define clGetExtensionFunctionAddressForPlatform CLEW_GET_FUN(__clewGetExtensionFunctionAddressForPlatform)
2729
2730 #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
2731 #define clCreateImage2D                 CLEW_GET_FUN(__clewCreateImage2D                 )
2732 #define clCreateImage3D                 CLEW_GET_FUN(__clewCreateImage3D                 )
2733 #define clGetExtensionFunctionAddress   CLEW_GET_FUN(__clewGetExtensionFunctionAddress   )
2734 #define clEnqueueMarker                 CLEW_GET_FUN(__clewEnqueueMarker                 )
2735 #define clEnqueueWaitForEvents          CLEW_GET_FUN(__clewEnqueueWaitForEvents          )
2736 #define clEnqueueBarrier                CLEW_GET_FUN(__clewEnqueueBarrier                )
2737 #define clUnloadCompiler                CLEW_GET_FUN(__clewUnloadCompiler                )
2738 #endif
2739
2740 /* cl_gl */
2741 #define clCreateFromGLBuffer            CLEW_GET_FUN(__clewCreateFromGLBuffer            )
2742 #define clCreateFromGLTexture           CLEW_GET_FUN(__clewCreateFromGLTexture           )
2743 #define clCreateFromGLRenderbuffer      CLEW_GET_FUN(__clewCreateFromGLRenderbuffer      )
2744 #define clGetGLObjectInfo               CLEW_GET_FUN(__clewGetGLObjectInfo               )
2745 #define clGetGLTextureInfo              CLEW_GET_FUN(__clGetGLTextureInfo                )
2746 #define clEnqueueAcquireGLObjects       CLEW_GET_FUN(__clewEnqueueAcquireGLObjects       )
2747 #define clEnqueueReleaseGLObjects       CLEW_GET_FUN(__clewEnqueueReleaseGLObjects       )
2748 #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
2749 #define clCreateFromGLTexture2D         CLEW_GET_FUN(__clewCreateFromGLTexture2D         )
2750 #define clCreateFromGLTexture3D         CLEW_GET_FUN(__clewCreateFromGLTexture3D         )
2751 #endif
2752 #define clGetGLContextInfoKHR           CLEW_GET_FUN(__clewGetGLContextInfoKHR           )
2753
2754
2755 #define CLEW_SUCCESS                0       //!<    Success error code
2756 #define CLEW_ERROR_OPEN_FAILED      -1      //!<    Error code for failing to open the dynamic library
2757 #define CLEW_ERROR_ATEXIT_FAILED    -2      //!<    Error code for failing to queue the closing of the dynamic library to atexit()
2758
2759 //! \brief Load OpenCL dynamic library and set function entry points
2760 int         clewInit        ();
2761 //! \brief Convert an OpenCL error code to its string equivalent
2762 const char* clewErrorString (cl_int error);
2763
2764 #ifdef __cplusplus
2765 }
2766 #endif
2767
2768 #endif  //  CLEW_HPP_INCLUDED