ddraw/tests: Recognise E_NOTIMPL returned from UpdateOverlay() on VMware as broken.
[wine.git] / dlls / opencl / opencl.c
blob2d145bf25c81655ddb22165298515792a28b2f16
1 /*
2 * OpenCL.dll proxy for native OpenCL implementation.
4 * Copyright 2010 Peter Urbanec
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/port.h"
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
28 #include "wine/debug.h"
29 #include "wine/library.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(opencl);
33 #if defined(HAVE_CL_CL_H)
34 #define CL_USE_DEPRECATED_OPENCL_1_1_APIS
35 #define CL_USE_DEPRECATED_OPENCL_1_2_APIS
36 #define CL_USE_DEPRECATED_OPENCL_2_0_APIS
37 #include <CL/cl.h>
38 #elif defined(HAVE_OPENCL_OPENCL_H)
39 #include <OpenCL/opencl.h>
40 #endif
42 /* TODO: Figure out how to provide GL context sharing before enabling OpenGL */
43 #define OPENCL_WITH_GL 0
46 /*---------------------------------------------------------------*/
47 /* Platform API */
49 cl_int WINAPI wine_clGetPlatformIDs(cl_uint num_entries, cl_platform_id *platforms, cl_uint *num_platforms)
51 cl_int ret;
52 TRACE("(%d, %p, %p)\n", num_entries, platforms, num_platforms);
53 ret = clGetPlatformIDs(num_entries, platforms, num_platforms);
54 TRACE("(%d, %p, %p)=%d\n", num_entries, platforms, num_platforms, ret);
55 return ret;
58 cl_int WINAPI wine_clGetPlatformInfo(cl_platform_id platform, cl_platform_info param_name,
59 SIZE_T param_value_size, void * param_value, size_t * param_value_size_ret)
61 cl_int ret;
62 TRACE("(%p, 0x%x, %ld, %p, %p)\n", platform, param_name, param_value_size, param_value, param_value_size_ret);
64 /* Hide all extensions.
65 * TODO: Add individual extension support as needed.
67 if (param_name == CL_PLATFORM_EXTENSIONS)
69 ret = CL_INVALID_VALUE;
71 if (param_value && param_value_size > 0)
73 char *exts = (char *) param_value;
74 exts[0] = '\0';
75 ret = CL_SUCCESS;
78 if (param_value_size_ret)
80 *param_value_size_ret = 1;
81 ret = CL_SUCCESS;
84 else
86 ret = clGetPlatformInfo(platform, param_name, param_value_size, param_value, param_value_size_ret);
89 TRACE("(%p, 0x%x, %ld, %p, %p)=%d\n", platform, param_name, param_value_size, param_value, param_value_size_ret, ret);
90 return ret;
94 /*---------------------------------------------------------------*/
95 /* Device APIs */
97 cl_int WINAPI wine_clGetDeviceIDs(cl_platform_id platform, cl_device_type device_type,
98 cl_uint num_entries, cl_device_id * devices, cl_uint * num_devices)
100 cl_int ret;
101 TRACE("(%p, 0x%lx, %d, %p, %p)\n", platform, (long unsigned int)device_type, num_entries, devices, num_devices);
102 ret = clGetDeviceIDs(platform, device_type, num_entries, devices, num_devices);
103 TRACE("(%p, 0x%lx, %d, %p, %p)=%d\n", platform, (long unsigned int)device_type, num_entries, devices, num_devices, ret);
104 return ret;
107 cl_int WINAPI wine_clGetDeviceInfo(cl_device_id device, cl_device_info param_name,
108 SIZE_T param_value_size, void * param_value, size_t * param_value_size_ret)
110 cl_int ret;
111 TRACE("(%p, 0x%x, %ld, %p, %p)\n",device, param_name, param_value_size, param_value, param_value_size_ret);
113 /* Hide all extensions.
114 * TODO: Add individual extension support as needed.
116 if (param_name == CL_DEVICE_EXTENSIONS)
118 ret = CL_INVALID_VALUE;
120 if (param_value && param_value_size > 0)
122 char *exts = (char *) param_value;
123 exts[0] = '\0';
124 ret = CL_SUCCESS;
127 if (param_value_size_ret)
129 *param_value_size_ret = 1;
130 ret = CL_SUCCESS;
133 else
135 ret = clGetDeviceInfo(device, param_name, param_value_size, param_value, param_value_size_ret);
138 /* Filter out the CL_EXEC_NATIVE_KERNEL flag */
139 if (param_name == CL_DEVICE_EXECUTION_CAPABILITIES)
141 cl_device_exec_capabilities *caps = (cl_device_exec_capabilities *) param_value;
142 *caps &= ~CL_EXEC_NATIVE_KERNEL;
145 TRACE("(%p, 0x%x, %ld, %p, %p)=%d\n",device, param_name, param_value_size, param_value, param_value_size_ret, ret);
146 return ret;
150 /*---------------------------------------------------------------*/
151 /* Context APIs */
153 typedef struct
155 void WINAPI (*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data);
156 void *user_data;
157 } CONTEXT_CALLBACK;
159 static void context_fn_notify(const char *errinfo, const void *private_info, size_t cb, void *user_data)
161 CONTEXT_CALLBACK *ccb;
162 TRACE("(%s, %p, %ld, %p)\n", errinfo, private_info, (SIZE_T)cb, user_data);
163 ccb = (CONTEXT_CALLBACK *) user_data;
164 if(ccb->pfn_notify) ccb->pfn_notify(errinfo, private_info, cb, ccb->user_data);
165 TRACE("Callback COMPLETED\n");
168 cl_context WINAPI wine_clCreateContext(const cl_context_properties * properties, cl_uint num_devices, const cl_device_id * devices,
169 void WINAPI (*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data),
170 void * user_data, cl_int * errcode_ret)
172 cl_context ret;
173 CONTEXT_CALLBACK *ccb;
174 TRACE("(%p, %d, %p, %p, %p, %p)\n", properties, num_devices, devices, pfn_notify, user_data, errcode_ret);
175 /* FIXME: The CONTEXT_CALLBACK structure is currently leaked.
176 * Pointers to callback redirectors should be remembered and free()d when the context is destroyed.
177 * The problem is determining when a context is being destroyed. clReleaseContext only decrements
178 * the use count for a context, its destruction can come much later and therefore there is a risk
179 * that the callback could be invoked after the user_data memory has been free()d.
181 ccb = HeapAlloc(GetProcessHeap(), 0, sizeof(CONTEXT_CALLBACK));
182 ccb->pfn_notify = pfn_notify;
183 ccb->user_data = user_data;
184 ret = clCreateContext(properties, num_devices, devices, context_fn_notify, ccb, errcode_ret);
185 TRACE("(%p, %d, %p, %p, %p, %p (%d)))=%p\n", properties, num_devices, devices, &pfn_notify, user_data, errcode_ret, errcode_ret ? *errcode_ret : 0, ret);
186 return ret;
189 cl_context WINAPI wine_clCreateContextFromType(const cl_context_properties * properties, cl_device_type device_type,
190 void WINAPI (*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data),
191 void * user_data, cl_int * errcode_ret)
193 cl_context ret;
194 CONTEXT_CALLBACK *ccb;
195 TRACE("(%p, 0x%lx, %p, %p, %p)\n", properties, (long unsigned int)device_type, pfn_notify, user_data, errcode_ret);
196 /* FIXME: The CONTEXT_CALLBACK structure is currently leaked.
197 * Pointers to callback redirectors should be remembered and free()d when the context is destroyed.
198 * The problem is determining when a context is being destroyed. clReleaseContext only decrements
199 * the use count for a context, its destruction can come much later and therefore there is a risk
200 * that the callback could be invoked after the user_data memory has been free()d.
202 ccb = HeapAlloc(GetProcessHeap(), 0, sizeof(CONTEXT_CALLBACK));
203 ccb->pfn_notify = pfn_notify;
204 ccb->user_data = user_data;
205 ret = clCreateContextFromType(properties, device_type, context_fn_notify, ccb, errcode_ret);
206 TRACE("(%p, 0x%lx, %p, %p, %p (%d)))=%p\n", properties, (long unsigned int)device_type, pfn_notify, user_data, errcode_ret, errcode_ret ? *errcode_ret : 0, ret);
207 return ret;
210 cl_int WINAPI wine_clRetainContext(cl_context context)
212 cl_int ret;
213 TRACE("(%p)\n", context);
214 ret = clRetainContext(context);
215 TRACE("(%p)=%d\n", context, ret);
216 return ret;
219 cl_int WINAPI wine_clReleaseContext(cl_context context)
221 cl_int ret;
222 TRACE("(%p)\n", context);
223 ret = clReleaseContext(context);
224 TRACE("(%p)=%d\n", context, ret);
225 return ret;
228 cl_int WINAPI wine_clGetContextInfo(cl_context context, cl_context_info param_name,
229 SIZE_T param_value_size, void * param_value, size_t * param_value_size_ret)
231 cl_int ret;
232 TRACE("(%p, 0x%x, %ld, %p, %p)\n", context, param_name, param_value_size, param_value, param_value_size_ret);
233 ret = clGetContextInfo(context, param_name, param_value_size, param_value, param_value_size_ret);
234 TRACE("(%p, 0x%x, %ld, %p, %p)=%d\n", context, param_name, param_value_size, param_value, param_value_size_ret, ret);
235 return ret;
239 /*---------------------------------------------------------------*/
240 /* Command Queue APIs */
242 cl_command_queue WINAPI wine_clCreateCommandQueue(cl_context context, cl_device_id device,
243 cl_command_queue_properties properties, cl_int * errcode_ret)
245 cl_command_queue ret;
246 TRACE("(%p, %p, 0x%lx, %p)\n", context, device, (long unsigned int)properties, errcode_ret);
247 ret = clCreateCommandQueue(context, device, properties, errcode_ret);
248 TRACE("(%p, %p, 0x%lx, %p)=%p\n", context, device, (long unsigned int)properties, errcode_ret, ret);
249 return ret;
252 cl_int WINAPI wine_clRetainCommandQueue(cl_command_queue command_queue)
254 cl_int ret;
255 TRACE("(%p)\n", command_queue);
256 ret = clRetainCommandQueue(command_queue);
257 TRACE("(%p)=%d\n", command_queue, ret);
258 return ret;
261 cl_int WINAPI wine_clReleaseCommandQueue(cl_command_queue command_queue)
263 cl_int ret;
264 TRACE("(%p)\n", command_queue);
265 ret = clReleaseCommandQueue(command_queue);
266 TRACE("(%p)=%d\n", command_queue, ret);
267 return ret;
270 cl_int WINAPI wine_clGetCommandQueueInfo(cl_command_queue command_queue, cl_command_queue_info param_name,
271 SIZE_T param_value_size, void * param_value, size_t * param_value_size_ret)
273 cl_int ret;
274 TRACE("%p, %d, %ld, %p, %p\n", command_queue, param_name, param_value_size, param_value, param_value_size_ret);
275 ret = clGetCommandQueueInfo(command_queue, param_name, param_value_size, param_value, param_value_size_ret);
276 return ret;
279 cl_int WINAPI wine_clSetCommandQueueProperty(cl_command_queue command_queue, cl_command_queue_properties properties, cl_bool enable,
280 cl_command_queue_properties * old_properties)
282 FIXME("(%p, 0x%lx, %d, %p): deprecated\n", command_queue, (long unsigned int)properties, enable, old_properties);
283 return CL_INVALID_QUEUE_PROPERTIES;
287 /*---------------------------------------------------------------*/
288 /* Memory Object APIs */
290 cl_mem WINAPI wine_clCreateBuffer(cl_context context, cl_mem_flags flags, size_t size, void * host_ptr, cl_int * errcode_ret)
292 cl_mem ret;
293 TRACE("\n");
294 ret = clCreateBuffer(context, flags, size, host_ptr, errcode_ret);
295 return ret;
298 cl_mem WINAPI wine_clCreateImage2D(cl_context context, cl_mem_flags flags, cl_image_format * image_format,
299 size_t image_width, size_t image_height, size_t image_row_pitch, void * host_ptr, cl_int * errcode_ret)
301 cl_mem ret;
302 TRACE("\n");
303 ret = clCreateImage2D(context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret);
304 return ret;
307 cl_mem WINAPI wine_clCreateImage3D(cl_context context, cl_mem_flags flags, cl_image_format * image_format,
308 size_t image_width, size_t image_height, size_t image_depth, size_t image_row_pitch, size_t image_slice_pitch,
309 void * host_ptr, cl_int * errcode_ret)
311 cl_mem ret;
312 TRACE("\n");
313 ret = clCreateImage3D(context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret);
314 return ret;
317 cl_int WINAPI wine_clRetainMemObject(cl_mem memobj)
319 cl_int ret;
320 TRACE("(%p)\n", memobj);
321 ret = clRetainMemObject(memobj);
322 TRACE("(%p)=%d\n", memobj, ret);
323 return ret;
326 cl_int WINAPI wine_clReleaseMemObject(cl_mem memobj)
328 cl_int ret;
329 TRACE("(%p)\n", memobj);
330 ret = clReleaseMemObject(memobj);
331 TRACE("(%p)=%d\n", memobj, ret);
332 return ret;
335 cl_int WINAPI wine_clGetSupportedImageFormats(cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, cl_uint num_entries,
336 cl_image_format * image_formats, cl_uint * num_image_formats)
338 cl_int ret;
339 TRACE("\n");
340 ret = clGetSupportedImageFormats(context, flags, image_type, num_entries, image_formats, num_image_formats);
341 return ret;
344 cl_int WINAPI wine_clGetMemObjectInfo(cl_mem memobj, cl_mem_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret)
346 cl_int ret;
347 TRACE("\n");
348 ret = clGetMemObjectInfo(memobj, param_name, param_value_size, param_value, param_value_size_ret);
349 return ret;
352 cl_int WINAPI wine_clGetImageInfo(cl_mem image, cl_image_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret)
354 cl_int ret;
355 TRACE("\n");
356 ret = clGetImageInfo(image, param_name, param_value_size, param_value, param_value_size_ret);
357 return ret;
361 /*---------------------------------------------------------------*/
362 /* Sampler APIs */
364 cl_sampler WINAPI wine_clCreateSampler(cl_context context, cl_bool normalized_coords, cl_addressing_mode addressing_mode,
365 cl_filter_mode filter_mode, cl_int * errcode_ret)
367 cl_sampler ret;
368 TRACE("\n");
369 ret = clCreateSampler(context, normalized_coords, addressing_mode, filter_mode, errcode_ret);
370 return ret;
373 cl_int WINAPI wine_clRetainSampler(cl_sampler sampler)
375 cl_int ret;
376 TRACE("\n");
377 ret = clRetainSampler(sampler);
378 return ret;
381 cl_int WINAPI wine_clReleaseSampler(cl_sampler sampler)
383 cl_int ret;
384 TRACE("\n");
385 ret = clReleaseSampler(sampler);
386 return ret;
389 cl_int WINAPI wine_clGetSamplerInfo(cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size,
390 void * param_value, size_t * param_value_size_ret)
392 cl_int ret;
393 TRACE("\n");
394 ret = clGetSamplerInfo(sampler, param_name, param_value_size, param_value, param_value_size_ret);
395 return ret;
399 /*---------------------------------------------------------------*/
400 /* Program Object APIs */
402 cl_program WINAPI wine_clCreateProgramWithSource(cl_context context, cl_uint count, const char ** strings,
403 const size_t * lengths, cl_int * errcode_ret)
405 cl_program ret;
406 TRACE("\n");
407 ret = clCreateProgramWithSource(context, count, strings, lengths, errcode_ret);
408 return ret;
411 cl_program WINAPI wine_clCreateProgramWithBinary(cl_context context, cl_uint num_devices, const cl_device_id * device_list,
412 const size_t * lengths, const unsigned char ** binaries, cl_int * binary_status,
413 cl_int * errcode_ret)
415 cl_program ret;
416 TRACE("\n");
417 ret = clCreateProgramWithBinary(context, num_devices, device_list, lengths, binaries, binary_status, errcode_ret);
418 return ret;
421 cl_int WINAPI wine_clRetainProgram(cl_program program)
423 cl_int ret;
424 TRACE("\n");
425 ret = clRetainProgram(program);
426 return ret;
429 cl_int WINAPI wine_clReleaseProgram(cl_program program)
431 cl_int ret;
432 TRACE("\n");
433 ret = clReleaseProgram(program);
434 return ret;
437 typedef struct
439 void WINAPI (*pfn_notify)(cl_program program, void * user_data);
440 void *user_data;
441 } PROGRAM_CALLBACK;
443 static void program_fn_notify(cl_program program, void * user_data)
445 PROGRAM_CALLBACK *pcb;
446 TRACE("(%p, %p)\n", program, user_data);
447 pcb = (PROGRAM_CALLBACK *) user_data;
448 pcb->pfn_notify(program, pcb->user_data);
449 HeapFree(GetProcessHeap(), 0, pcb);
450 TRACE("Callback COMPLETED\n");
453 cl_int WINAPI wine_clBuildProgram(cl_program program, cl_uint num_devices, const cl_device_id * device_list, const char * options,
454 void WINAPI (*pfn_notify)(cl_program program, void * user_data),
455 void * user_data)
457 cl_int ret;
458 TRACE("\n");
459 if(pfn_notify)
461 /* When pfn_notify is provided, clBuildProgram is asynchronous */
462 PROGRAM_CALLBACK *pcb;
463 pcb = HeapAlloc(GetProcessHeap(), 0, sizeof(PROGRAM_CALLBACK));
464 pcb->pfn_notify = pfn_notify;
465 pcb->user_data = user_data;
466 ret = clBuildProgram(program, num_devices, device_list, options, program_fn_notify, pcb);
468 else
470 /* When pfn_notify is NULL, clBuildProgram is synchronous */
471 ret = clBuildProgram(program, num_devices, device_list, options, NULL, user_data);
473 return ret;
476 cl_int WINAPI wine_clUnloadCompiler(void)
478 cl_int ret;
479 TRACE("()\n");
480 ret = clUnloadCompiler();
481 TRACE("()=%d\n", ret);
482 return ret;
485 cl_int WINAPI wine_clGetProgramInfo(cl_program program, cl_program_info param_name,
486 size_t param_value_size, void * param_value, size_t * param_value_size_ret)
488 cl_int ret;
489 TRACE("\n");
490 ret = clGetProgramInfo(program, param_name, param_value_size, param_value, param_value_size_ret);
491 return ret;
494 cl_int WINAPI wine_clGetProgramBuildInfo(cl_program program, cl_device_id device,
495 cl_program_build_info param_name, size_t param_value_size, void * param_value,
496 size_t * param_value_size_ret)
498 cl_int ret;
499 TRACE("\n");
500 ret = clGetProgramBuildInfo(program, device, param_name, param_value_size, param_value, param_value_size_ret);
501 return ret;
505 /*---------------------------------------------------------------*/
506 /* Kernel Object APIs */
508 cl_kernel WINAPI wine_clCreateKernel(cl_program program, char * kernel_name, cl_int * errcode_ret)
510 cl_kernel ret;
511 TRACE("\n");
512 ret = clCreateKernel(program, kernel_name, errcode_ret);
513 return ret;
516 cl_int WINAPI wine_clCreateKernelsInProgram(cl_program program, cl_uint num_kernels,
517 cl_kernel * kernels, cl_uint * num_kernels_ret)
519 cl_int ret;
520 TRACE("\n");
521 ret = clCreateKernelsInProgram(program, num_kernels, kernels, num_kernels_ret);
522 return ret;
525 cl_int WINAPI wine_clRetainKernel(cl_kernel kernel)
527 cl_int ret;
528 TRACE("\n");
529 ret = clRetainKernel(kernel);
530 return ret;
533 cl_int WINAPI wine_clReleaseKernel(cl_kernel kernel)
535 cl_int ret;
536 TRACE("\n");
537 ret = clReleaseKernel(kernel);
538 return ret;
541 cl_int WINAPI wine_clSetKernelArg(cl_kernel kernel, cl_uint arg_index, size_t arg_size, void * arg_value)
543 cl_int ret;
544 TRACE("\n");
545 ret = clSetKernelArg(kernel, arg_index, arg_size, arg_value);
546 return ret;
549 cl_int WINAPI wine_clGetKernelInfo(cl_kernel kernel, cl_kernel_info param_name,
550 size_t param_value_size, void * param_value, size_t * param_value_size_ret)
552 cl_int ret;
553 TRACE("\n");
554 ret = clGetKernelInfo(kernel, param_name, param_value_size, param_value, param_value_size_ret);
555 return ret;
558 cl_int WINAPI wine_clGetKernelWorkGroupInfo(cl_kernel kernel, cl_device_id device,
559 cl_kernel_work_group_info param_name, size_t param_value_size,
560 void * param_value, size_t * param_value_size_ret)
562 cl_int ret;
563 TRACE("\n");
564 ret = clGetKernelWorkGroupInfo(kernel, device, param_name, param_value_size, param_value, param_value_size_ret);
565 return ret;
569 /*---------------------------------------------------------------*/
570 /* Event Object APIs */
572 cl_int WINAPI wine_clWaitForEvents(cl_uint num_events, cl_event * event_list)
574 cl_int ret;
575 TRACE("\n");
576 ret = clWaitForEvents(num_events, event_list);
577 return ret;
580 cl_int WINAPI wine_clGetEventInfo(cl_event event, cl_event_info param_name, size_t param_value_size,
581 void * param_value, size_t * param_value_size_ret)
583 cl_int ret;
584 TRACE("\n");
585 ret = clGetEventInfo(event, param_name, param_value_size, param_value, param_value_size_ret);
586 return ret;
589 cl_int WINAPI wine_clRetainEvent(cl_event event)
591 cl_int ret;
592 TRACE("\n");
593 ret = clRetainEvent(event);
594 return ret;
597 cl_int WINAPI wine_clReleaseEvent(cl_event event)
599 cl_int ret;
600 TRACE("\n");
601 ret = clReleaseEvent(event);
602 return ret;
606 /*---------------------------------------------------------------*/
607 /* Profiling APIs */
609 cl_int WINAPI wine_clGetEventProfilingInfo(cl_event event, cl_profiling_info param_name, size_t param_value_size,
610 void * param_value, size_t * param_value_size_ret)
612 cl_int ret;
613 TRACE("\n");
614 ret = clGetEventProfilingInfo(event, param_name, param_value_size, param_value, param_value_size_ret);
615 return ret;
619 /*---------------------------------------------------------------*/
620 /* Flush and Finish APIs */
622 cl_int WINAPI wine_clFlush(cl_command_queue command_queue)
624 cl_int ret;
625 TRACE("(%p)\n", command_queue);
626 ret = clFlush(command_queue);
627 TRACE("(%p)=%d\n", command_queue, ret);
628 return ret;
631 cl_int WINAPI wine_clFinish(cl_command_queue command_queue)
633 cl_int ret;
634 TRACE("(%p)\n", command_queue);
635 ret = clFinish(command_queue);
636 TRACE("(%p)=%d\n", command_queue, ret);
637 return ret;
641 /*---------------------------------------------------------------*/
642 /* Enqueued Commands APIs */
644 cl_int WINAPI wine_clEnqueueReadBuffer(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read,
645 size_t offset, size_t cb, void * ptr,
646 cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
648 cl_int ret;
649 TRACE("\n");
650 ret = clEnqueueReadBuffer(command_queue, buffer, blocking_read, offset, cb, ptr, num_events_in_wait_list, event_wait_list, event);
651 return ret;
654 cl_int WINAPI wine_clEnqueueWriteBuffer(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write,
655 size_t offset, size_t cb, const void * ptr,
656 cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
658 cl_int ret;
659 TRACE("\n");
660 ret = clEnqueueWriteBuffer(command_queue, buffer, blocking_write, offset, cb, ptr, num_events_in_wait_list, event_wait_list, event);
661 return ret;
664 cl_int WINAPI wine_clEnqueueCopyBuffer(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer,
665 size_t src_offset, size_t dst_offset, size_t cb,
666 cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
668 cl_int ret;
669 TRACE("\n");
670 ret = clEnqueueCopyBuffer(command_queue, src_buffer, dst_buffer, src_offset, dst_offset, cb, num_events_in_wait_list, event_wait_list, event);
671 return ret;
674 cl_int WINAPI wine_clEnqueueReadImage(cl_command_queue command_queue, cl_mem image, cl_bool blocking_read,
675 const size_t * origin, const size_t * region,
676 SIZE_T row_pitch, SIZE_T slice_pitch, void * ptr,
677 cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
679 cl_int ret;
680 TRACE("(%p, %p, %d, %p, %p, %ld, %ld, %p, %d, %p, %p)\n", command_queue, image, blocking_read,
681 origin, region, row_pitch, slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event);
682 ret = clEnqueueReadImage(command_queue, image, blocking_read, origin, region, row_pitch, slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event);
683 TRACE("(%p, %p, %d, %p, %p, %ld, %ld, %p, %d, %p, %p)=%d\n", command_queue, image, blocking_read,
684 origin, region, row_pitch, slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event, ret);
685 return ret;
688 cl_int WINAPI wine_clEnqueueWriteImage(cl_command_queue command_queue, cl_mem image, cl_bool blocking_write,
689 const size_t * origin, const size_t * region,
690 size_t input_row_pitch, size_t input_slice_pitch, const void * ptr,
691 cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
693 cl_int ret;
694 TRACE("\n");
695 ret = clEnqueueWriteImage(command_queue, image, blocking_write, origin, region, input_row_pitch, input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event);
696 return ret;
699 cl_int WINAPI wine_clEnqueueCopyImage(cl_command_queue command_queue, cl_mem src_image, cl_mem dst_image,
700 size_t * src_origin, size_t * dst_origin, size_t * region,
701 cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event)
703 cl_int ret;
704 TRACE("\n");
705 ret = clEnqueueCopyImage(command_queue, src_image, dst_image, src_origin, dst_origin, region, num_events_in_wait_list, event_wait_list, event);
706 return ret;
709 cl_int WINAPI wine_clEnqueueCopyImageToBuffer(cl_command_queue command_queue, cl_mem src_image, cl_mem dst_buffer,
710 size_t * src_origin, size_t * region, size_t dst_offset,
711 cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event)
713 cl_int ret;
714 TRACE("\n");
715 ret = clEnqueueCopyImageToBuffer(command_queue, src_image, dst_buffer, src_origin, region, dst_offset, num_events_in_wait_list, event_wait_list, event);
716 return ret;
719 cl_int WINAPI wine_clEnqueueCopyBufferToImage(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_image,
720 size_t src_offset, size_t * dst_origin, size_t * region,
721 cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event)
723 cl_int ret;
724 TRACE("\n");
725 ret = clEnqueueCopyBufferToImage(command_queue, src_buffer, dst_image, src_offset, dst_origin, region, num_events_in_wait_list, event_wait_list, event);
726 return ret;
729 void * WINAPI wine_clEnqueueMapBuffer(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map,
730 cl_map_flags map_flags, size_t offset, size_t cb,
731 cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event, cl_int * errcode_ret)
733 void * ret;
734 TRACE("\n");
735 ret = clEnqueueMapBuffer(command_queue, buffer, blocking_map, map_flags, offset, cb, num_events_in_wait_list, event_wait_list, event, errcode_ret);
736 return ret;
739 void * WINAPI wine_clEnqueueMapImage(cl_command_queue command_queue, cl_mem image, cl_bool blocking_map,
740 cl_map_flags map_flags, size_t * origin, size_t * region,
741 size_t * image_row_pitch, size_t * image_slice_pitch,
742 cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event, cl_int * errcode_ret)
744 void * ret;
745 TRACE("\n");
746 ret = clEnqueueMapImage(command_queue, image, blocking_map, map_flags, origin, region, image_row_pitch, image_slice_pitch, num_events_in_wait_list, event_wait_list, event, errcode_ret);
747 return ret;
750 cl_int WINAPI wine_clEnqueueUnmapMemObject(cl_command_queue command_queue, cl_mem memobj, void * mapped_ptr,
751 cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event)
753 cl_int ret;
754 TRACE("\n");
755 ret = clEnqueueUnmapMemObject(command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event);
756 return ret;
759 cl_int WINAPI wine_clEnqueueNDRangeKernel(cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim,
760 size_t * global_work_offset, size_t * global_work_size, size_t * local_work_size,
761 cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event)
763 cl_int ret;
764 TRACE("\n");
765 ret = clEnqueueNDRangeKernel(command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event);
766 return ret;
769 cl_int WINAPI wine_clEnqueueTask(cl_command_queue command_queue, cl_kernel kernel,
770 cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event)
772 cl_int ret;
773 TRACE("\n");
774 ret = clEnqueueTask(command_queue, kernel, num_events_in_wait_list, event_wait_list, event);
775 return ret;
778 cl_int WINAPI wine_clEnqueueNativeKernel(cl_command_queue command_queue,
779 void WINAPI (*user_func)(void *args),
780 void * args, size_t cb_args,
781 cl_uint num_mem_objects, const cl_mem * mem_list, const void ** args_mem_loc,
782 cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
784 cl_int ret = CL_INVALID_OPERATION;
785 /* FIXME: There appears to be no obvious method for translating the ABI for user_func.
786 * There is no opaque user_data structure passed, that could encapsulate the return address.
787 * The OpenCL specification seems to indicate that args has an implementation specific
788 * structure that cannot be used to stash away a return address for the WINAPI user_func.
790 #if 0
791 ret = clEnqueueNativeKernel(command_queue, user_func, args, cb_args, num_mem_objects, mem_list, args_mem_loc,
792 num_events_in_wait_list, event_wait_list, event);
793 #else
794 FIXME("not supported due to user_func ABI mismatch\n");
795 #endif
796 return ret;
799 cl_int WINAPI wine_clEnqueueMarker(cl_command_queue command_queue, cl_event * event)
801 cl_int ret;
802 TRACE("\n");
803 ret = clEnqueueMarker(command_queue, event);
804 return ret;
807 cl_int WINAPI wine_clEnqueueWaitForEvents(cl_command_queue command_queue, cl_uint num_events, cl_event * event_list)
809 cl_int ret;
810 TRACE("\n");
811 ret = clEnqueueWaitForEvents(command_queue, num_events, event_list);
812 return ret;
815 cl_int WINAPI wine_clEnqueueBarrier(cl_command_queue command_queue)
817 cl_int ret;
818 TRACE("\n");
819 ret = clEnqueueBarrier(command_queue);
820 return ret;
824 /*---------------------------------------------------------------*/
825 /* Extension function access */
827 void * WINAPI wine_clGetExtensionFunctionAddress(const char * func_name)
829 void * ret = 0;
830 TRACE("(%s)\n",func_name);
831 #if 0
832 ret = clGetExtensionFunctionAddress(func_name);
833 #else
834 FIXME("extensions not implemented\n");
835 #endif
836 TRACE("(%s)=%p\n",func_name, ret);
837 return ret;
841 #if OPENCL_WITH_GL
842 /*---------------------------------------------------------------*/
843 /* Khronos-approved (KHR) OpenCL extensions which have OpenGL dependencies. */
845 cl_mem WINAPI wine_clCreateFromGLBuffer(cl_context context, cl_mem_flags flags, cl_GLuint bufobj, int * errcode_ret)
849 cl_mem WINAPI wine_clCreateFromGLTexture2D(cl_context context, cl_mem_flags flags, cl_GLenum target,
850 cl_GLint miplevel, cl_GLuint texture, cl_int * errcode_ret)
854 cl_mem WINAPI wine_clCreateFromGLTexture3D(cl_context context, cl_mem_flags flags, cl_GLenum target,
855 cl_GLint miplevel, cl_GLuint texture, cl_int * errcode_ret)
859 cl_mem WINAPI wine_clCreateFromGLRenderbuffer(cl_context context, cl_mem_flags flags, cl_GLuint renderbuffer, cl_int * errcode_ret)
863 cl_int WINAPI wine_clGetGLObjectInfo(cl_mem memobj, cl_gl_object_type * gl_object_type, cl_GLuint * gl_object_name)
867 cl_int WINAPI wine_clGetGLTextureInfo(cl_mem memobj, cl_gl_texture_info param_name, size_t param_value_size,
868 void * param_value, size_t * param_value_size_ret)
872 cl_int WINAPI wine_clEnqueueAcquireGLObjects(cl_command_queue command_queue, cl_uint num_objects, const cl_mem * mem_objects,
873 cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
877 cl_int WINAPI wine_clEnqueueReleaseGLObjects(cl_command_queue command_queue, cl_uint num_objects, const cl_mem * mem_objects,
878 cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
883 /*---------------------------------------------------------------*/
884 /* cl_khr_gl_sharing extension */
886 cl_int WINAPI wine_clGetGLContextInfoKHR(const cl_context_properties * properties, cl_gl_context_info param_name,
887 size_t param_value_size, void * param_value, size_t * param_value_size_ret)
891 #endif
894 #if 0
895 /*---------------------------------------------------------------*/
896 /* cl_khr_icd extension */
898 cl_int WINAPI wine_clIcdGetPlatformIDsKHR(cl_uint num_entries, cl_platform_id * platforms, cl_uint * num_platforms)
901 #endif