1 /*******************************************************************************
2  * Copyright (c) 2008-2009 The Khronos Group Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and/or associated documentation files (the
6  * "Materials"), to deal in the Materials without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Materials, and to
9  * permit persons to whom the Materials are furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Materials.
14  *
15  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
22  ******************************************************************************/
23 
24 #ifndef __OPENCL_CL_H
25 #define __OPENCL_CL_H
26 
27 #ifdef __APPLE__
28 #include <MiniCL/cl_platform.h>
29 #else
30 #include <MiniCL/cl_platform.h>
31 #endif
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /******************************************************************************/
38 
39 typedef struct _cl_platform_id *    cl_platform_id;
40 typedef struct _cl_device_id *      cl_device_id;
41 typedef struct _cl_context *        cl_context;
42 typedef struct _cl_command_queue *  cl_command_queue;
43 typedef struct _cl_mem *            cl_mem;
44 typedef struct _cl_program *        cl_program;
45 typedef struct _cl_kernel *         cl_kernel;
46 typedef struct _cl_event *          cl_event;
47 typedef struct _cl_sampler *        cl_sampler;
48 
49 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. */
50 typedef cl_ulong            cl_bitfield;
51 typedef cl_bitfield         cl_device_type;
52 typedef cl_uint             cl_platform_info;
53 typedef cl_uint             cl_device_info;
54 typedef cl_bitfield         cl_device_address_info;
55 typedef cl_bitfield         cl_device_fp_config;
56 typedef cl_uint             cl_device_mem_cache_type;
57 typedef cl_uint             cl_device_local_mem_type;
58 typedef cl_bitfield         cl_device_exec_capabilities;
59 typedef cl_bitfield         cl_command_queue_properties;
60 
61 typedef intptr_t			cl_context_properties;
62 typedef cl_uint             cl_context_info;
63 typedef cl_uint             cl_command_queue_info;
64 typedef cl_uint             cl_channel_order;
65 typedef cl_uint             cl_channel_type;
66 typedef cl_bitfield         cl_mem_flags;
67 typedef cl_uint             cl_mem_object_type;
68 typedef cl_uint             cl_mem_info;
69 typedef cl_uint             cl_image_info;
70 typedef cl_uint             cl_addressing_mode;
71 typedef cl_uint             cl_filter_mode;
72 typedef cl_uint             cl_sampler_info;
73 typedef cl_bitfield         cl_map_flags;
74 typedef cl_uint             cl_program_info;
75 typedef cl_uint             cl_program_build_info;
76 typedef cl_int              cl_build_status;
77 typedef cl_uint             cl_kernel_info;
78 typedef cl_uint             cl_kernel_work_group_info;
79 typedef cl_uint             cl_event_info;
80 typedef cl_uint             cl_command_type;
81 typedef cl_uint             cl_profiling_info;
82 
83 typedef struct _cl_image_format {
84     cl_channel_order        image_channel_order;
85     cl_channel_type         image_channel_data_type;
86 } cl_image_format;
87 
88 /******************************************************************************/
89 
90 // Error Codes
91 #define CL_SUCCESS                                  0
92 #define CL_DEVICE_NOT_FOUND                         -1
93 #define CL_DEVICE_NOT_AVAILABLE                     -2
94 #define CL_DEVICE_COMPILER_NOT_AVAILABLE            -3
95 #define CL_MEM_OBJECT_ALLOCATION_FAILURE            -4
96 #define CL_OUT_OF_RESOURCES                         -5
97 #define CL_OUT_OF_HOST_MEMORY                       -6
98 #define CL_PROFILING_INFO_NOT_AVAILABLE             -7
99 #define CL_MEM_COPY_OVERLAP                         -8
100 #define CL_IMAGE_FORMAT_MISMATCH                    -9
101 #define CL_IMAGE_FORMAT_NOT_SUPPORTED               -10
102 #define CL_BUILD_PROGRAM_FAILURE                    -11
103 #define CL_MAP_FAILURE                              -12
104 
105 #define CL_INVALID_VALUE                            -30
106 #define CL_INVALID_DEVICE_TYPE                      -31
107 #define CL_INVALID_PLATFORM                         -32
108 #define CL_INVALID_DEVICE                           -33
109 #define CL_INVALID_CONTEXT                          -34
110 #define CL_INVALID_QUEUE_PROPERTIES                 -35
111 #define CL_INVALID_COMMAND_QUEUE                    -36
112 #define CL_INVALID_HOST_PTR                         -37
113 #define CL_INVALID_MEM_OBJECT                       -38
114 #define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR          -39
115 #define CL_INVALID_IMAGE_SIZE                       -40
116 #define CL_INVALID_SAMPLER                          -41
117 #define CL_INVALID_BINARY                           -42
118 #define CL_INVALID_BUILD_OPTIONS                    -43
119 #define CL_INVALID_PROGRAM                          -44
120 #define CL_INVALID_PROGRAM_EXECUTABLE               -45
121 #define CL_INVALID_KERNEL_NAME                      -46
122 #define CL_INVALID_KERNEL_DEFINITION                -47
123 #define CL_INVALID_KERNEL                           -48
124 #define CL_INVALID_ARG_INDEX                        -49
125 #define CL_INVALID_ARG_VALUE                        -50
126 #define CL_INVALID_ARG_SIZE                         -51
127 #define CL_INVALID_KERNEL_ARGS                      -52
128 #define CL_INVALID_WORK_DIMENSION                   -53
129 #define CL_INVALID_WORK_GROUP_SIZE                  -54
130 #define CL_INVALID_WORK_ITEM_SIZE                   -55
131 #define CL_INVALID_GLOBAL_OFFSET                    -56
132 #define CL_INVALID_EVENT_WAIT_LIST                  -57
133 #define CL_INVALID_EVENT                            -58
134 #define CL_INVALID_OPERATION                        -59
135 #define CL_INVALID_GL_OBJECT                        -60
136 #define CL_INVALID_BUFFER_SIZE                      -61
137 #define CL_INVALID_MIP_LEVEL                        -62
138 
139 // OpenCL Version
140 #define CL_VERSION_1_0                              1
141 
142 // cl_bool
143 #define CL_FALSE                                    0
144 #define CL_TRUE                                     1
145 
146 // cl_platform_info
147 #define CL_PLATFORM_PROFILE                         0x0900
148 #define CL_PLATFORM_VERSION                         0x0901
149 #define CL_PLATFORM_NAME                            0x0902
150 #define CL_PLATFORM_VENDOR                          0x0903
151 #define CL_PLATFORM_EXTENSIONS                      0x0904
152 
153 // cl_device_type - bitfield
154 #define CL_DEVICE_TYPE_DEFAULT                      (1 << 0)
155 #define CL_DEVICE_TYPE_CPU                          (1 << 1)
156 #define CL_DEVICE_TYPE_GPU                          (1 << 2)
157 #define CL_DEVICE_TYPE_ACCELERATOR                  (1 << 3)
158 #define CL_DEVICE_TYPE_DEBUG						(1 << 4)
159 #define CL_DEVICE_TYPE_ALL                          0xFFFFFFFF
160 
161 
162 // cl_device_info
163 #define CL_DEVICE_TYPE                              0x1000
164 #define CL_DEVICE_VENDOR_ID                         0x1001
165 #define CL_DEVICE_MAX_COMPUTE_UNITS                 0x1002
166 #define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS          0x1003
167 #define CL_DEVICE_MAX_WORK_GROUP_SIZE               0x1004
168 #define CL_DEVICE_MAX_WORK_ITEM_SIZES               0x1005
169 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR       0x1006
170 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT      0x1007
171 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT        0x1008
172 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG       0x1009
173 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT      0x100A
174 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE     0x100B
175 #define CL_DEVICE_MAX_CLOCK_FREQUENCY               0x100C
176 #define CL_DEVICE_ADDRESS_BITS                      0x100D
177 #define CL_DEVICE_MAX_READ_IMAGE_ARGS               0x100E
178 #define CL_DEVICE_MAX_WRITE_IMAGE_ARGS              0x100F
179 #define CL_DEVICE_MAX_MEM_ALLOC_SIZE                0x1010
180 #define CL_DEVICE_IMAGE2D_MAX_WIDTH                 0x1011
181 #define CL_DEVICE_IMAGE2D_MAX_HEIGHT                0x1012
182 #define CL_DEVICE_IMAGE3D_MAX_WIDTH                 0x1013
183 #define CL_DEVICE_IMAGE3D_MAX_HEIGHT                0x1014
184 #define CL_DEVICE_IMAGE3D_MAX_DEPTH                 0x1015
185 #define CL_DEVICE_IMAGE_SUPPORT                     0x1016
186 #define CL_DEVICE_MAX_PARAMETER_SIZE                0x1017
187 #define CL_DEVICE_MAX_SAMPLERS                      0x1018
188 #define CL_DEVICE_MEM_BASE_ADDR_ALIGN               0x1019
189 #define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE          0x101A
190 #define CL_DEVICE_SINGLE_FP_CONFIG                  0x101B
191 #define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE             0x101C
192 #define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE         0x101D
193 #define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE             0x101E
194 #define CL_DEVICE_GLOBAL_MEM_SIZE                   0x101F
195 #define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE          0x1020
196 #define CL_DEVICE_MAX_CONSTANT_ARGS                 0x1021
197 #define CL_DEVICE_LOCAL_MEM_TYPE                    0x1022
198 #define CL_DEVICE_LOCAL_MEM_SIZE                    0x1023
199 #define CL_DEVICE_ERROR_CORRECTION_SUPPORT          0x1024
200 #define CL_DEVICE_PROFILING_TIMER_RESOLUTION        0x1025
201 #define CL_DEVICE_ENDIAN_LITTLE                     0x1026
202 #define CL_DEVICE_AVAILABLE                         0x1027
203 #define CL_DEVICE_COMPILER_AVAILABLE                0x1028
204 #define CL_DEVICE_EXECUTION_CAPABILITIES            0x1029
205 #define CL_DEVICE_QUEUE_PROPERTIES                  0x102A
206 #define CL_DEVICE_NAME                              0x102B
207 #define CL_DEVICE_VENDOR                            0x102C
208 #define CL_DRIVER_VERSION                           0x102D
209 #define CL_DEVICE_PROFILE                           0x102E
210 #define CL_DEVICE_VERSION                           0x102F
211 #define CL_DEVICE_EXTENSIONS                        0x1030
212 #define CL_DEVICE_PLATFORM                          0x1031
213 
214 // cl_device_address_info - bitfield
215 #define CL_DEVICE_ADDRESS_32_BITS                   (1 << 0)
216 #define CL_DEVICE_ADDRESS_64_BITS                   (1 << 1)
217 
218 // cl_device_fp_config - bitfield
219 #define CL_FP_DENORM                                (1 << 0)
220 #define CL_FP_INF_NAN                               (1 << 1)
221 #define CL_FP_ROUND_TO_NEAREST                      (1 << 2)
222 #define CL_FP_ROUND_TO_ZERO                         (1 << 3)
223 #define CL_FP_ROUND_TO_INF                          (1 << 4)
224 #define CL_FP_FMA                                   (1 << 5)
225 
226 // cl_device_mem_cache_type
227 #define CL_NONE                                     0x0
228 #define CL_READ_ONLY_CACHE                          0x1
229 #define CL_READ_WRITE_CACHE                         0x2
230 
231 // cl_device_local_mem_type
232 #define CL_LOCAL                                    0x1
233 #define CL_GLOBAL                                   0x2
234 
235 // cl_device_exec_capabilities - bitfield
236 #define CL_EXEC_KERNEL                              (1 << 0)
237 #define CL_EXEC_NATIVE_KERNEL                       (1 << 1)
238 
239 // cl_command_queue_properties - bitfield
240 #define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE      (1 << 0)
241 #define CL_QUEUE_PROFILING_ENABLE                   (1 << 1)
242 
243 // cl_context_info
244 #define CL_CONTEXT_REFERENCE_COUNT                  0x1080
245 #define CL_CONTEXT_NUM_DEVICES                      0x1081
246 #define CL_CONTEXT_DEVICES                          0x1082
247 #define CL_CONTEXT_PROPERTIES                       0x1083
248 #define CL_CONTEXT_PLATFORM                         0x1084
249 
250 // cl_command_queue_info
251 #define CL_QUEUE_CONTEXT                            0x1090
252 #define CL_QUEUE_DEVICE                             0x1091
253 #define CL_QUEUE_REFERENCE_COUNT                    0x1092
254 #define CL_QUEUE_PROPERTIES                         0x1093
255 
256 // cl_mem_flags - bitfield
257 #define CL_MEM_READ_WRITE                           (1 << 0)
258 #define CL_MEM_WRITE_ONLY                           (1 << 1)
259 #define CL_MEM_READ_ONLY                            (1 << 2)
260 #define CL_MEM_USE_HOST_PTR                         (1 << 3)
261 #define CL_MEM_ALLOC_HOST_PTR                       (1 << 4)
262 #define CL_MEM_COPY_HOST_PTR                        (1 << 5)
263 
264 // cl_channel_order
265 #define CL_R                                        0x10B0
266 #define CL_A                                        0x10B1
267 #define CL_RG                                       0x10B2
268 #define CL_RA                                       0x10B3
269 #define CL_RGB                                      0x10B4
270 #define CL_RGBA                                     0x10B5
271 #define CL_BGRA                                     0x10B6
272 #define CL_ARGB                                     0x10B7
273 #define CL_INTENSITY                                0x10B8
274 #define CL_LUMINANCE                                0x10B9
275 
276 // cl_channel_type
277 #define CL_SNORM_INT8                               0x10D0
278 #define CL_SNORM_INT16                              0x10D1
279 #define CL_UNORM_INT8                               0x10D2
280 #define CL_UNORM_INT16                              0x10D3
281 #define CL_UNORM_SHORT_565                          0x10D4
282 #define CL_UNORM_SHORT_555                          0x10D5
283 #define CL_UNORM_INT_101010                         0x10D6
284 #define CL_SIGNED_INT8                              0x10D7
285 #define CL_SIGNED_INT16                             0x10D8
286 #define CL_SIGNED_INT32                             0x10D9
287 #define CL_UNSIGNED_INT8                            0x10DA
288 #define CL_UNSIGNED_INT16                           0x10DB
289 #define CL_UNSIGNED_INT32                           0x10DC
290 #define CL_HALF_FLOAT                               0x10DD
291 #define CL_FLOAT                                    0x10DE
292 
293 // cl_mem_object_type
294 #define CL_MEM_OBJECT_BUFFER                        0x10F0
295 #define CL_MEM_OBJECT_IMAGE2D                       0x10F1
296 #define CL_MEM_OBJECT_IMAGE3D                       0x10F2
297 
298 // cl_mem_info
299 #define CL_MEM_TYPE                                 0x1100
300 #define CL_MEM_FLAGS                                0x1101
301 #define CL_MEM_SIZE                                 0x1102
302 #define CL_MEM_HOST_PTR                             0x1103
303 #define CL_MEM_MAP_COUNT                            0x1104
304 #define CL_MEM_REFERENCE_COUNT                      0x1105
305 #define CL_MEM_CONTEXT                              0x1106
306 
307 // cl_image_info
308 #define CL_IMAGE_FORMAT                             0x1110
309 #define CL_IMAGE_ELEMENT_SIZE                       0x1111
310 #define CL_IMAGE_ROW_PITCH                          0x1112
311 #define CL_IMAGE_SLICE_PITCH                        0x1113
312 #define CL_IMAGE_WIDTH                              0x1114
313 #define CL_IMAGE_HEIGHT                             0x1115
314 #define CL_IMAGE_DEPTH                              0x1116
315 
316 // cl_addressing_mode
317 #define CL_ADDRESS_NONE                             0x1130
318 #define CL_ADDRESS_CLAMP_TO_EDGE                    0x1131
319 #define CL_ADDRESS_CLAMP                            0x1132
320 #define CL_ADDRESS_REPEAT                           0x1133
321 
322 // cl_filter_mode
323 #define CL_FILTER_NEAREST                           0x1140
324 #define CL_FILTER_LINEAR                            0x1141
325 
326 // cl_sampler_info
327 #define CL_SAMPLER_REFERENCE_COUNT                  0x1150
328 #define CL_SAMPLER_CONTEXT                          0x1151
329 #define CL_SAMPLER_NORMALIZED_COORDS                0x1152
330 #define CL_SAMPLER_ADDRESSING_MODE                  0x1153
331 #define CL_SAMPLER_FILTER_MODE                      0x1154
332 
333 // cl_map_flags - bitfield
334 #define CL_MAP_READ                                 (1 << 0)
335 #define CL_MAP_WRITE                                (1 << 1)
336 
337 // cl_program_info
338 #define CL_PROGRAM_REFERENCE_COUNT                  0x1160
339 #define CL_PROGRAM_CONTEXT                          0x1161
340 #define CL_PROGRAM_NUM_DEVICES                      0x1162
341 #define CL_PROGRAM_DEVICES                          0x1163
342 #define CL_PROGRAM_SOURCE                           0x1164
343 #define CL_PROGRAM_BINARY_SIZES                     0x1165
344 #define CL_PROGRAM_BINARIES                         0x1166
345 
346 // cl_program_build_info
347 #define CL_PROGRAM_BUILD_STATUS                     0x1181
348 #define CL_PROGRAM_BUILD_OPTIONS                    0x1182
349 #define CL_PROGRAM_BUILD_LOG                        0x1183
350 
351 // cl_build_status
352 #define CL_BUILD_SUCCESS                            0
353 #define CL_BUILD_NONE                               -1
354 #define CL_BUILD_ERROR                              -2
355 #define CL_BUILD_IN_PROGRESS                        -3
356 
357 // cl_kernel_info
358 #define CL_KERNEL_FUNCTION_NAME                     0x1190
359 #define CL_KERNEL_NUM_ARGS                          0x1191
360 #define CL_KERNEL_REFERENCE_COUNT                   0x1192
361 #define CL_KERNEL_CONTEXT                           0x1193
362 #define CL_KERNEL_PROGRAM                           0x1194
363 
364 // cl_kernel_work_group_info
365 #define CL_KERNEL_WORK_GROUP_SIZE                   0x11B0
366 #define CL_KERNEL_COMPILE_WORK_GROUP_SIZE           0x11B1
367 #define CL_KERNEL_LOCAL_MEM_SIZE                    0x11B2
368 
369 // cl_event_info
370 #define CL_EVENT_COMMAND_QUEUE                      0x11D0
371 #define CL_EVENT_COMMAND_TYPE                       0x11D1
372 #define CL_EVENT_REFERENCE_COUNT                    0x11D2
373 #define CL_EVENT_COMMAND_EXECUTION_STATUS           0x11D3
374 
375 // cl_command_type
376 #define CL_COMMAND_NDRANGE_KERNEL                   0x11F0
377 #define CL_COMMAND_TASK                             0x11F1
378 #define CL_COMMAND_NATIVE_KERNEL                    0x11F2
379 #define CL_COMMAND_READ_BUFFER                      0x11F3
380 #define CL_COMMAND_WRITE_BUFFER                     0x11F4
381 #define CL_COMMAND_COPY_BUFFER                      0x11F5
382 #define CL_COMMAND_READ_IMAGE                       0x11F6
383 #define CL_COMMAND_WRITE_IMAGE                      0x11F7
384 #define CL_COMMAND_COPY_IMAGE                       0x11F8
385 #define CL_COMMAND_COPY_IMAGE_TO_BUFFER             0x11F9
386 #define CL_COMMAND_COPY_BUFFER_TO_IMAGE             0x11FA
387 #define CL_COMMAND_MAP_BUFFER                       0x11FB
388 #define CL_COMMAND_MAP_IMAGE                        0x11FC
389 #define CL_COMMAND_UNMAP_MEM_OBJECT                 0x11FD
390 #define CL_COMMAND_MARKER                           0x11FE
391 #define CL_COMMAND_WAIT_FOR_EVENTS                  0x11FF
392 #define CL_COMMAND_BARRIER                          0x1200
393 #define CL_COMMAND_ACQUIRE_GL_OBJECTS               0x1201
394 #define CL_COMMAND_RELEASE_GL_OBJECTS               0x1202
395 
396 // command execution status
397 #define CL_COMPLETE                                 0x0
398 #define CL_RUNNING                                  0x1
399 #define CL_SUBMITTED                                0x2
400 #define CL_QUEUED                                   0x3
401 
402 // cl_profiling_info
403 #define CL_PROFILING_COMMAND_QUEUED                 0x1280
404 #define CL_PROFILING_COMMAND_SUBMIT                 0x1281
405 #define CL_PROFILING_COMMAND_START                  0x1282
406 #define CL_PROFILING_COMMAND_END                    0x1283
407 
408 /********************************************************************************************************/
409 
410 // Platform API
411 extern CL_API_ENTRY cl_int CL_API_CALL
412 clGetPlatformIDs(cl_uint          /* num_entries */,
413                  cl_platform_id * /* platforms */,
414                  cl_uint *        /* num_platforms */) CL_API_SUFFIX__VERSION_1_0;
415 
416 extern CL_API_ENTRY cl_int CL_API_CALL
417 clGetPlatformInfo(cl_platform_id   /* platform */,
418                   cl_platform_info /* param_name */,
419                   size_t           /* param_value_size */,
420                   void *           /* param_value */,
421                   size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
422 
423 // Device APIs
424 extern CL_API_ENTRY cl_int CL_API_CALL
425 clGetDeviceIDs(cl_platform_id   /* platform */,
426                cl_device_type   /* device_type */,
427                cl_uint          /* num_entries */,
428                cl_device_id *   /* devices */,
429                cl_uint *        /* num_devices */) CL_API_SUFFIX__VERSION_1_0;
430 
431 extern CL_API_ENTRY cl_int CL_API_CALL
432 clGetDeviceInfo(cl_device_id    /* device */,
433                 cl_device_info  /* param_name */,
434                 size_t          /* param_value_size */,
435                 void *          /* param_value */,
436                 size_t *        /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
437 
438 // Context APIs
439 extern CL_API_ENTRY cl_context CL_API_CALL
440 clCreateContext(cl_context_properties * /* properties */,
441                 cl_uint                 /* num_devices */,
442                 const cl_device_id *    /* devices */,
443                 void (*pfn_notify)(const char *, const void *, size_t, void *) /* pfn_notify */,
444                 void *                  /* user_data */,
445                 cl_int *                /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
446 
447 extern CL_API_ENTRY cl_context CL_API_CALL
448 clCreateContextFromType(cl_context_properties * /* properties */,
449                         cl_device_type          /* device_type */,
450                         void (*pfn_notify)(const char *, const void *, size_t, void *) /* pfn_notify */,
451                         void *                  /* user_data */,
452                         cl_int *                /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
453 
454 extern CL_API_ENTRY cl_int CL_API_CALL
455 clRetainContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
456 
457 extern CL_API_ENTRY cl_int CL_API_CALL
458 clReleaseContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
459 
460 extern CL_API_ENTRY cl_int CL_API_CALL
461 clGetContextInfo(cl_context         /* context */,
462                  cl_context_info    /* param_name */,
463                  size_t             /* param_value_size */,
464                  void *             /* param_value */,
465                  size_t *           /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
466 
467 // Command Queue APIs
468 extern CL_API_ENTRY cl_command_queue CL_API_CALL
469 clCreateCommandQueue(cl_context                     /* context */,
470                      cl_device_id                   /* device */,
471                      cl_command_queue_properties    /* properties */,
472                      cl_int *                       /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
473 
474 extern CL_API_ENTRY cl_int CL_API_CALL
475 clRetainCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
476 
477 extern CL_API_ENTRY cl_int CL_API_CALL
478 clReleaseCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
479 
480 extern CL_API_ENTRY cl_int CL_API_CALL
481 clGetCommandQueueInfo(cl_command_queue      /* command_queue */,
482                       cl_command_queue_info /* param_name */,
483                       size_t                /* param_value_size */,
484                       void *                /* param_value */,
485                       size_t *              /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
486 
487 extern CL_API_ENTRY cl_int CL_API_CALL
488 clSetCommandQueueProperty(cl_command_queue              /* command_queue */,
489                           cl_command_queue_properties   /* properties */,
490                           cl_bool                        /* enable */,
491                           cl_command_queue_properties * /* old_properties */) CL_API_SUFFIX__VERSION_1_0;
492 
493 // Memory Object APIs
494 extern CL_API_ENTRY cl_mem CL_API_CALL
495 clCreateBuffer(cl_context   /* context */,
496                cl_mem_flags /* flags */,
497                size_t       /* size */,
498                void *       /* host_ptr */,
499                cl_int *     /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
500 
501 extern CL_API_ENTRY cl_mem CL_API_CALL
502 clCreateImage2D(cl_context              /* context */,
503                 cl_mem_flags            /* flags */,
504                 const cl_image_format * /* image_format */,
505                 size_t                  /* image_width */,
506                 size_t                  /* image_height */,
507                 size_t                  /* image_row_pitch */,
508                 void *                  /* host_ptr */,
509                 cl_int *                /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
510 
511 extern CL_API_ENTRY cl_mem CL_API_CALL
512 clCreateImage3D(cl_context              /* context */,
513                 cl_mem_flags            /* flags */,
514                 const cl_image_format * /* image_format */,
515                 size_t                  /* image_width */,
516                 size_t                  /* image_height */,
517                 size_t                  /* image_depth */,
518                 size_t                  /* image_row_pitch */,
519                 size_t                  /* image_slice_pitch */,
520                 void *                  /* host_ptr */,
521                 cl_int *                /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
522 
523 extern CL_API_ENTRY cl_int CL_API_CALL
524 clRetainMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
525 
526 extern CL_API_ENTRY cl_int CL_API_CALL
527 clReleaseMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
528 
529 extern CL_API_ENTRY cl_int CL_API_CALL
530 clGetSupportedImageFormats(cl_context           /* context */,
531                            cl_mem_flags         /* flags */,
532                            cl_mem_object_type   /* image_type */,
533                            cl_uint              /* num_entries */,
534                            cl_image_format *    /* image_formats */,
535                            cl_uint *            /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0;
536 
537 extern CL_API_ENTRY cl_int CL_API_CALL
538 clGetMemObjectInfo(cl_mem           /* memobj */,
539                    cl_mem_info      /* param_name */,
540                    size_t           /* param_value_size */,
541                    void *           /* param_value */,
542                    size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
543 
544 extern CL_API_ENTRY cl_int CL_API_CALL
545 clGetImageInfo(cl_mem           /* image */,
546                cl_image_info    /* param_name */,
547                size_t           /* param_value_size */,
548                void *           /* param_value */,
549                size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
550 
551 // Sampler APIs
552 extern CL_API_ENTRY cl_sampler CL_API_CALL
553 clCreateSampler(cl_context          /* context */,
554                 cl_bool             /* normalized_coords */,
555                 cl_addressing_mode  /* addressing_mode */,
556                 cl_filter_mode      /* filter_mode */,
557                 cl_int *            /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
558 
559 extern CL_API_ENTRY cl_int CL_API_CALL
560 clRetainSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
561 
562 extern CL_API_ENTRY cl_int CL_API_CALL
563 clReleaseSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
564 
565 extern CL_API_ENTRY cl_int CL_API_CALL
566 clGetSamplerInfo(cl_sampler         /* sampler */,
567                  cl_sampler_info    /* param_name */,
568                  size_t             /* param_value_size */,
569                  void *             /* param_value */,
570                  size_t *           /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
571 
572 // Program Object APIs
573 extern CL_API_ENTRY cl_program CL_API_CALL
574 clCreateProgramWithSource(cl_context        /* context */,
575                           cl_uint           /* count */,
576                           const char **     /* strings */,
577                           const size_t *    /* lengths */,
578                           cl_int *          /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
579 
580 extern CL_API_ENTRY cl_program CL_API_CALL
581 clCreateProgramWithBinary(cl_context                     /* context */,
582                           cl_uint                        /* num_devices */,
583                           const cl_device_id *           /* device_list */,
584                           const size_t *                 /* lengths */,
585                           const unsigned char **         /* binaries */,
586                           cl_int *                       /* binary_status */,
587                           cl_int *                       /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
588 
589 extern CL_API_ENTRY cl_int CL_API_CALL
590 clRetainProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
591 
592 extern CL_API_ENTRY cl_int CL_API_CALL
593 clReleaseProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
594 
595 extern CL_API_ENTRY cl_int CL_API_CALL
596 clBuildProgram(cl_program           /* program */,
597                cl_uint              /* num_devices */,
598                const cl_device_id * /* device_list */,
599                const char *         /* options */,
600                void (*pfn_notify)(cl_program /* program */, void * /* user_data */),
601                void *               /* user_data */) CL_API_SUFFIX__VERSION_1_0;
602 
603 extern CL_API_ENTRY cl_int CL_API_CALL
604 clUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_0;
605 
606 extern CL_API_ENTRY cl_int CL_API_CALL
607 clGetProgramInfo(cl_program         /* program */,
608                  cl_program_info    /* param_name */,
609                  size_t             /* param_value_size */,
610                  void *             /* param_value */,
611                  size_t *           /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
612 
613 extern CL_API_ENTRY cl_int CL_API_CALL
614 clGetProgramBuildInfo(cl_program            /* program */,
615                       cl_device_id          /* device */,
616                       cl_program_build_info /* param_name */,
617                       size_t                /* param_value_size */,
618                       void *                /* param_value */,
619                       size_t *              /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
620 
621 // Kernel Object APIs
622 extern CL_API_ENTRY cl_kernel CL_API_CALL
623 clCreateKernel(cl_program      /* program */,
624                const char *    /* kernel_name */,
625                cl_int *        /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
626 
627 extern CL_API_ENTRY cl_int CL_API_CALL
628 clCreateKernelsInProgram(cl_program     /* program */,
629                          cl_uint        /* num_kernels */,
630                          cl_kernel *    /* kernels */,
631                          cl_uint *      /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0;
632 
633 extern CL_API_ENTRY cl_int CL_API_CALL
634 clRetainKernel(cl_kernel    /* kernel */) CL_API_SUFFIX__VERSION_1_0;
635 
636 extern CL_API_ENTRY cl_int CL_API_CALL
637 clReleaseKernel(cl_kernel   /* kernel */) CL_API_SUFFIX__VERSION_1_0;
638 
639 extern CL_API_ENTRY cl_int CL_API_CALL
640 clSetKernelArg(cl_kernel    /* kernel */,
641                cl_uint      /* arg_index */,
642                size_t       /* arg_size */,
643                const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0;
644 
645 extern CL_API_ENTRY cl_int CL_API_CALL
646 clGetKernelInfo(cl_kernel       /* kernel */,
647                 cl_kernel_info  /* param_name */,
648                 size_t          /* param_value_size */,
649                 void *          /* param_value */,
650                 size_t *        /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
651 
652 extern CL_API_ENTRY cl_int CL_API_CALL
653 clGetKernelWorkGroupInfo(cl_kernel                  /* kernel */,
654                          cl_device_id               /* device */,
655                          cl_kernel_work_group_info  /* param_name */,
656                          size_t                     /* param_value_size */,
657                          void *                     /* param_value */,
658                          size_t *                   /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
659 
660 // Event Object APIs
661 extern CL_API_ENTRY cl_int CL_API_CALL
662 clWaitForEvents(cl_uint             /* num_events */,
663                 const cl_event *    /* event_list */) CL_API_SUFFIX__VERSION_1_0;
664 
665 extern CL_API_ENTRY cl_int CL_API_CALL
666 clGetEventInfo(cl_event         /* event */,
667                cl_event_info    /* param_name */,
668                size_t           /* param_value_size */,
669                void *           /* param_value */,
670                size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
671 
672 extern CL_API_ENTRY cl_int CL_API_CALL
673 clRetainEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
674 
675 extern CL_API_ENTRY cl_int CL_API_CALL
676 clReleaseEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
677 
678 // Profiling APIs
679 extern CL_API_ENTRY cl_int CL_API_CALL
680 clGetEventProfilingInfo(cl_event            /* event */,
681                         cl_profiling_info   /* param_name */,
682                         size_t              /* param_value_size */,
683                         void *              /* param_value */,
684                         size_t *            /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
685 
686 // Flush and Finish APIs
687 extern CL_API_ENTRY cl_int CL_API_CALL
688 clFlush(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
689 
690 extern CL_API_ENTRY cl_int CL_API_CALL
691 clFinish(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
692 
693 // Enqueued Commands APIs
694 extern CL_API_ENTRY cl_int CL_API_CALL
695 clEnqueueReadBuffer(cl_command_queue    /* command_queue */,
696                     cl_mem              /* buffer */,
697                     cl_bool             /* blocking_read */,
698                     size_t              /* offset */,
699                     size_t              /* cb */,
700                     void *              /* ptr */,
701                     cl_uint             /* num_events_in_wait_list */,
702                     const cl_event *    /* event_wait_list */,
703                     cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
704 
705 extern CL_API_ENTRY cl_int CL_API_CALL
706 clEnqueueWriteBuffer(cl_command_queue   /* command_queue */,
707                      cl_mem             /* buffer */,
708                      cl_bool            /* blocking_write */,
709                      size_t             /* offset */,
710                      size_t             /* cb */,
711                      const void *       /* ptr */,
712                      cl_uint            /* num_events_in_wait_list */,
713                      const cl_event *   /* event_wait_list */,
714                      cl_event *         /* event */) CL_API_SUFFIX__VERSION_1_0;
715 
716 extern CL_API_ENTRY cl_int CL_API_CALL
717 clEnqueueCopyBuffer(cl_command_queue    /* command_queue */,
718                     cl_mem              /* src_buffer */,
719                     cl_mem              /* dst_buffer */,
720                     size_t              /* src_offset */,
721                     size_t              /* dst_offset */,
722                     size_t              /* cb */,
723                     cl_uint             /* num_events_in_wait_list */,
724                     const cl_event *    /* event_wait_list */,
725                     cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
726 
727 extern CL_API_ENTRY cl_int CL_API_CALL
728 clEnqueueReadImage(cl_command_queue     /* command_queue */,
729                    cl_mem               /* image */,
730                    cl_bool              /* blocking_read */,
731                    const size_t *       /* origin[3] */,
732                    const size_t *       /* region[3] */,
733                    size_t               /* row_pitch */,
734                    size_t               /* slice_pitch */,
735                    void *               /* ptr */,
736                    cl_uint              /* num_events_in_wait_list */,
737                    const cl_event *     /* event_wait_list */,
738                    cl_event *           /* event */) CL_API_SUFFIX__VERSION_1_0;
739 
740 extern CL_API_ENTRY cl_int CL_API_CALL
741 clEnqueueWriteImage(cl_command_queue    /* command_queue */,
742                     cl_mem              /* image */,
743                     cl_bool             /* blocking_write */,
744                     const size_t *      /* origin[3] */,
745                     const size_t *      /* region[3] */,
746                     size_t              /* input_row_pitch */,
747                     size_t              /* input_slice_pitch */,
748                     const void *        /* ptr */,
749                     cl_uint             /* num_events_in_wait_list */,
750                     const cl_event *    /* event_wait_list */,
751                     cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
752 
753 extern CL_API_ENTRY cl_int CL_API_CALL
754 clEnqueueCopyImage(cl_command_queue     /* command_queue */,
755                    cl_mem               /* src_image */,
756                    cl_mem               /* dst_image */,
757                    const size_t *       /* src_origin[3] */,
758                    const size_t *       /* dst_origin[3] */,
759                    const size_t *       /* region[3] */,
760                    cl_uint              /* num_events_in_wait_list */,
761                    const cl_event *     /* event_wait_list */,
762                    cl_event *           /* event */) CL_API_SUFFIX__VERSION_1_0;
763 
764 extern CL_API_ENTRY cl_int CL_API_CALL
765 clEnqueueCopyImageToBuffer(cl_command_queue /* command_queue */,
766                            cl_mem           /* src_image */,
767                            cl_mem           /* dst_buffer */,
768                            const size_t *   /* src_origin[3] */,
769                            const size_t *   /* region[3] */,
770                            size_t           /* dst_offset */,
771                            cl_uint          /* num_events_in_wait_list */,
772                            const cl_event * /* event_wait_list */,
773                            cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
774 
775 extern CL_API_ENTRY cl_int CL_API_CALL
776 clEnqueueCopyBufferToImage(cl_command_queue /* command_queue */,
777                            cl_mem           /* src_buffer */,
778                            cl_mem           /* dst_image */,
779                            size_t           /* src_offset */,
780                            const size_t *   /* dst_origin[3] */,
781                            const size_t *   /* region[3] */,
782                            cl_uint          /* num_events_in_wait_list */,
783                            const cl_event * /* event_wait_list */,
784                            cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
785 
786 extern CL_API_ENTRY void * CL_API_CALL
787 clEnqueueMapBuffer(cl_command_queue /* command_queue */,
788                    cl_mem           /* buffer */,
789                    cl_bool          /* blocking_map */,
790                    cl_map_flags     /* map_flags */,
791                    size_t           /* offset */,
792                    size_t           /* cb */,
793                    cl_uint          /* num_events_in_wait_list */,
794                    const cl_event * /* event_wait_list */,
795                    cl_event *       /* event */,
796                    cl_int *         /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
797 
798 extern CL_API_ENTRY void * CL_API_CALL
799 clEnqueueMapImage(cl_command_queue  /* command_queue */,
800                   cl_mem            /* image */,
801                   cl_bool           /* blocking_map */,
802                   cl_map_flags      /* map_flags */,
803                   const size_t *    /* origin[3] */,
804                   const size_t *    /* region[3] */,
805                   size_t *          /* image_row_pitch */,
806                   size_t *          /* image_slice_pitch */,
807                   cl_uint           /* num_events_in_wait_list */,
808                   const cl_event *  /* event_wait_list */,
809                   cl_event *        /* event */,
810                   cl_int *          /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
811 
812 extern CL_API_ENTRY cl_int CL_API_CALL
813 clEnqueueUnmapMemObject(cl_command_queue /* command_queue */,
814                         cl_mem           /* memobj */,
815                         void *           /* mapped_ptr */,
816                         cl_uint          /* num_events_in_wait_list */,
817                         const cl_event *  /* event_wait_list */,
818                         cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_0;
819 
820 extern CL_API_ENTRY cl_int CL_API_CALL
821 clEnqueueNDRangeKernel(cl_command_queue /* command_queue */,
822                        cl_kernel        /* kernel */,
823                        cl_uint          /* work_dim */,
824                        const size_t *   /* global_work_offset */,
825                        const size_t *   /* global_work_size */,
826                        const size_t *   /* local_work_size */,
827                        cl_uint          /* num_events_in_wait_list */,
828                        const cl_event * /* event_wait_list */,
829                        cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
830 
831 extern CL_API_ENTRY cl_int CL_API_CALL
832 clEnqueueTask(cl_command_queue  /* command_queue */,
833               cl_kernel         /* kernel */,
834               cl_uint           /* num_events_in_wait_list */,
835               const cl_event *  /* event_wait_list */,
836               cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_0;
837 
838 extern CL_API_ENTRY cl_int CL_API_CALL
839 clEnqueueNativeKernel(cl_command_queue  /* command_queue */,
840 					  void (*user_func)(void *),
841                       void *            /* args */,
842                       size_t            /* cb_args */,
843                       cl_uint           /* num_mem_objects */,
844                       const cl_mem *    /* mem_list */,
845                       const void **     /* args_mem_loc */,
846                       cl_uint           /* num_events_in_wait_list */,
847                       const cl_event *  /* event_wait_list */,
848                       cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_0;
849 
850 extern CL_API_ENTRY cl_int CL_API_CALL
851 clEnqueueMarker(cl_command_queue    /* command_queue */,
852                 cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
853 
854 extern CL_API_ENTRY cl_int CL_API_CALL
855 clEnqueueWaitForEvents(cl_command_queue /* command_queue */,
856                        cl_uint          /* num_events */,
857                        const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
858 
859 extern CL_API_ENTRY cl_int CL_API_CALL
860 clEnqueueBarrier(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
861 
862 #ifdef __cplusplus
863 }
864 #endif
865 
866 #endif  // __OPENCL_CL_H
867 
868