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