1
0

cl.h 42 KB

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