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