dispatch.hpp revision 7ec681f3
1//
2// Copyright 2013 Francisco Jerez
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20// OTHER DEALINGS IN THE SOFTWARE.
21//
22
23#ifndef API_DISPATCH_HPP
24#define API_DISPATCH_HPP
25
26#include "CL/cl.h"
27#include "CL/cl_ext.h"
28#include "CL/cl_egl.h"
29#include "CL/cl_gl.h"
30#include "CL/cl_icd.h"
31
32namespace clover {
33   extern const cl_icd_dispatch _dispatch;
34
35   cl_int
36   GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param,
37                   size_t size, void *r_buf, size_t *r_size);
38
39   void *
40   GetExtensionFunctionAddress(const char *p_name);
41
42   void *
43   GetExtensionFunctionAddressForPlatform(cl_platform_id d_platform,
44                                          const char *p_name);
45
46   cl_int
47   IcdGetPlatformIDsKHR(cl_uint num_entries, cl_platform_id *rd_platforms,
48                        cl_uint *rnum_platforms);
49
50   cl_int
51   EnqueueSVMFree(cl_command_queue command_queue,
52                  cl_uint num_svm_pointers,
53                  void *svm_pointers[],
54                  void (CL_CALLBACK *pfn_free_func) (
55                     cl_command_queue queue, cl_uint num_svm_pointers,
56                     void *svm_pointers[], void *user_data),
57                  void *user_data,
58                  cl_uint num_events_in_wait_list,
59                  const cl_event *event_wait_list,
60                  cl_event *event,
61                  cl_int cmd);
62
63   cl_int
64   EnqueueSVMMemcpy(cl_command_queue command_queue,
65                    cl_bool blocking_copy,
66                    void *dst_ptr,
67                    const void *src_ptr,
68                    size_t size,
69                    cl_uint num_events_in_wait_list,
70                    const cl_event *event_wait_list,
71                    cl_event *event,
72                    cl_int cmd);
73
74   cl_int
75   EnqueueSVMMap(cl_command_queue command_queue,
76                 cl_bool blocking_map,
77                 cl_map_flags map_flags,
78                 void *svm_ptr,
79                 size_t size,
80                 cl_uint num_events_in_wait_list,
81                 const cl_event *event_wait_list,
82                 cl_event *event,
83                 cl_int cmd);
84
85   cl_int
86   EnqueueSVMMemFill(cl_command_queue command_queue,
87                     void *svm_ptr,
88                     const void *pattern,
89                     size_t pattern_size,
90                     size_t size,
91                     cl_uint num_events_in_wait_list,
92                     const cl_event *event_wait_list,
93                     cl_event *event,
94                     cl_int cmd);
95
96   cl_int
97   EnqueueSVMUnmap(cl_command_queue command_queue,
98                   void *svm_ptr,
99                   cl_uint num_events_in_wait_list,
100                   const cl_event *event_wait_list,
101                   cl_event *event,
102                   cl_int cmd);
103
104   cl_program
105   CreateProgramWithILKHR(cl_context d_ctx, const void *il,
106                          size_t length, cl_int *r_errcode);
107}
108
109#endif
110