Skip to content

Commit e049b16

Browse files
authored
Define function types for prototype declaration (#230)
* Use function type definitions and use these to defines pointer types. * Add generated function type definitions. * Leverage function types in cl_icd.h. * Add missing include guards. * Cosmetic. * Add function pointer definitions for core APIs. * Use newly defined function pointers for core APIs. * Only use function types for icd dispatch table.
1 parent 4fdcfb0 commit e049b16

14 files changed

Lines changed: 2251 additions & 1612 deletions

CL/cl_d3d10.h

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,56 +97,74 @@ typedef cl_uint cl_d3d10_device_set_khr;
9797
#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018
9898

9999

100-
typedef cl_int (CL_API_CALL *
101-
clGetDeviceIDsFromD3D10KHR_fn)(
100+
typedef cl_int CL_API_CALL
101+
clGetDeviceIDsFromD3D10KHR_t(
102102
cl_platform_id platform,
103103
cl_d3d10_device_source_khr d3d_device_source,
104104
void* d3d_object,
105105
cl_d3d10_device_set_khr d3d_device_set,
106106
cl_uint num_entries,
107107
cl_device_id* devices,
108-
cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_0;
108+
cl_uint* num_devices);
109+
110+
typedef clGetDeviceIDsFromD3D10KHR_t *
111+
clGetDeviceIDsFromD3D10KHR_fn CL_API_SUFFIX__VERSION_1_0;
109112

110-
typedef cl_mem (CL_API_CALL *
111-
clCreateFromD3D10BufferKHR_fn)(
113+
typedef cl_mem CL_API_CALL
114+
clCreateFromD3D10BufferKHR_t(
112115
cl_context context,
113116
cl_mem_flags flags,
114117
ID3D10Buffer* resource,
115-
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
118+
cl_int* errcode_ret);
119+
120+
typedef clCreateFromD3D10BufferKHR_t *
121+
clCreateFromD3D10BufferKHR_fn CL_API_SUFFIX__VERSION_1_0;
116122

117-
typedef cl_mem (CL_API_CALL *
118-
clCreateFromD3D10Texture2DKHR_fn)(
123+
typedef cl_mem CL_API_CALL
124+
clCreateFromD3D10Texture2DKHR_t(
119125
cl_context context,
120126
cl_mem_flags flags,
121127
ID3D10Texture2D* resource,
122128
UINT subresource,
123-
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
129+
cl_int* errcode_ret);
130+
131+
typedef clCreateFromD3D10Texture2DKHR_t *
132+
clCreateFromD3D10Texture2DKHR_fn CL_API_SUFFIX__VERSION_1_0;
124133

125-
typedef cl_mem (CL_API_CALL *
126-
clCreateFromD3D10Texture3DKHR_fn)(
134+
typedef cl_mem CL_API_CALL
135+
clCreateFromD3D10Texture3DKHR_t(
127136
cl_context context,
128137
cl_mem_flags flags,
129138
ID3D10Texture3D* resource,
130139
UINT subresource,
131-
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
140+
cl_int* errcode_ret);
132141

133-
typedef cl_int (CL_API_CALL *
134-
clEnqueueAcquireD3D10ObjectsKHR_fn)(
142+
typedef clCreateFromD3D10Texture3DKHR_t *
143+
clCreateFromD3D10Texture3DKHR_fn CL_API_SUFFIX__VERSION_1_0;
144+
145+
typedef cl_int CL_API_CALL
146+
clEnqueueAcquireD3D10ObjectsKHR_t(
135147
cl_command_queue command_queue,
136148
cl_uint num_objects,
137149
const cl_mem* mem_objects,
138150
cl_uint num_events_in_wait_list,
139151
const cl_event* event_wait_list,
140-
cl_event* event) CL_API_SUFFIX__VERSION_1_0;
152+
cl_event* event);
141153

142-
typedef cl_int (CL_API_CALL *
143-
clEnqueueReleaseD3D10ObjectsKHR_fn)(
154+
typedef clEnqueueAcquireD3D10ObjectsKHR_t *
155+
clEnqueueAcquireD3D10ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
156+
157+
typedef cl_int CL_API_CALL
158+
clEnqueueReleaseD3D10ObjectsKHR_t(
144159
cl_command_queue command_queue,
145160
cl_uint num_objects,
146161
const cl_mem* mem_objects,
147162
cl_uint num_events_in_wait_list,
148163
const cl_event* event_wait_list,
149-
cl_event* event) CL_API_SUFFIX__VERSION_1_0;
164+
cl_event* event);
165+
166+
typedef clEnqueueReleaseD3D10ObjectsKHR_t *
167+
clEnqueueReleaseD3D10ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
150168

151169
#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
152170

@@ -212,14 +230,17 @@ clEnqueueReleaseD3D10ObjectsKHR(
212230

213231
/* when cl_khr_d3d10_sharing is supported */
214232

215-
typedef cl_int (CL_API_CALL *
216-
clGetSupportedD3D10TextureFormatsINTEL_fn)(
233+
typedef cl_int CL_API_CALL
234+
clGetSupportedD3D10TextureFormatsINTEL_t(
217235
cl_context context,
218236
cl_mem_flags flags,
219237
cl_mem_object_type image_type,
220238
cl_uint num_entries,
221239
DXGI_FORMAT* d3d10_formats,
222-
cl_uint* num_texture_formats) ;
240+
cl_uint* num_texture_formats);
241+
242+
typedef clGetSupportedD3D10TextureFormatsINTEL_t *
243+
clGetSupportedD3D10TextureFormatsINTEL_fn ;
223244

224245
#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
225246

CL/cl_d3d11.h

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,56 +97,74 @@ typedef cl_uint cl_d3d11_device_set_khr;
9797
#define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021
9898

9999

100-
typedef cl_int (CL_API_CALL *
101-
clGetDeviceIDsFromD3D11KHR_fn)(
100+
typedef cl_int CL_API_CALL
101+
clGetDeviceIDsFromD3D11KHR_t(
102102
cl_platform_id platform,
103103
cl_d3d11_device_source_khr d3d_device_source,
104104
void* d3d_object,
105105
cl_d3d11_device_set_khr d3d_device_set,
106106
cl_uint num_entries,
107107
cl_device_id* devices,
108-
cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2;
108+
cl_uint* num_devices);
109+
110+
typedef clGetDeviceIDsFromD3D11KHR_t *
111+
clGetDeviceIDsFromD3D11KHR_fn CL_API_SUFFIX__VERSION_1_2;
109112

110-
typedef cl_mem (CL_API_CALL *
111-
clCreateFromD3D11BufferKHR_fn)(
113+
typedef cl_mem CL_API_CALL
114+
clCreateFromD3D11BufferKHR_t(
112115
cl_context context,
113116
cl_mem_flags flags,
114117
ID3D11Buffer* resource,
115-
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
118+
cl_int* errcode_ret);
119+
120+
typedef clCreateFromD3D11BufferKHR_t *
121+
clCreateFromD3D11BufferKHR_fn CL_API_SUFFIX__VERSION_1_2;
116122

117-
typedef cl_mem (CL_API_CALL *
118-
clCreateFromD3D11Texture2DKHR_fn)(
123+
typedef cl_mem CL_API_CALL
124+
clCreateFromD3D11Texture2DKHR_t(
119125
cl_context context,
120126
cl_mem_flags flags,
121127
ID3D11Texture2D* resource,
122128
UINT subresource,
123-
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
129+
cl_int* errcode_ret);
130+
131+
typedef clCreateFromD3D11Texture2DKHR_t *
132+
clCreateFromD3D11Texture2DKHR_fn CL_API_SUFFIX__VERSION_1_2;
124133

125-
typedef cl_mem (CL_API_CALL *
126-
clCreateFromD3D11Texture3DKHR_fn)(
134+
typedef cl_mem CL_API_CALL
135+
clCreateFromD3D11Texture3DKHR_t(
127136
cl_context context,
128137
cl_mem_flags flags,
129138
ID3D11Texture3D* resource,
130139
UINT subresource,
131-
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
140+
cl_int* errcode_ret);
132141

133-
typedef cl_int (CL_API_CALL *
134-
clEnqueueAcquireD3D11ObjectsKHR_fn)(
142+
typedef clCreateFromD3D11Texture3DKHR_t *
143+
clCreateFromD3D11Texture3DKHR_fn CL_API_SUFFIX__VERSION_1_2;
144+
145+
typedef cl_int CL_API_CALL
146+
clEnqueueAcquireD3D11ObjectsKHR_t(
135147
cl_command_queue command_queue,
136148
cl_uint num_objects,
137149
const cl_mem* mem_objects,
138150
cl_uint num_events_in_wait_list,
139151
const cl_event* event_wait_list,
140-
cl_event* event) CL_API_SUFFIX__VERSION_1_2;
152+
cl_event* event);
141153

142-
typedef cl_int (CL_API_CALL *
143-
clEnqueueReleaseD3D11ObjectsKHR_fn)(
154+
typedef clEnqueueAcquireD3D11ObjectsKHR_t *
155+
clEnqueueAcquireD3D11ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_2;
156+
157+
typedef cl_int CL_API_CALL
158+
clEnqueueReleaseD3D11ObjectsKHR_t(
144159
cl_command_queue command_queue,
145160
cl_uint num_objects,
146161
const cl_mem* mem_objects,
147162
cl_uint num_events_in_wait_list,
148163
const cl_event* event_wait_list,
149-
cl_event* event) CL_API_SUFFIX__VERSION_1_2;
164+
cl_event* event);
165+
166+
typedef clEnqueueReleaseD3D11ObjectsKHR_t *
167+
clEnqueueReleaseD3D11ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_2;
150168

151169
#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
152170

@@ -212,15 +230,18 @@ clEnqueueReleaseD3D11ObjectsKHR(
212230

213231
/* when cl_khr_d3d11_sharing is supported */
214232

215-
typedef cl_int (CL_API_CALL *
216-
clGetSupportedD3D11TextureFormatsINTEL_fn)(
233+
typedef cl_int CL_API_CALL
234+
clGetSupportedD3D11TextureFormatsINTEL_t(
217235
cl_context context,
218236
cl_mem_flags flags,
219237
cl_mem_object_type image_type,
220238
cl_uint plane,
221239
cl_uint num_entries,
222240
DXGI_FORMAT* d3d11_formats,
223-
cl_uint* num_texture_formats) ;
241+
cl_uint* num_texture_formats);
242+
243+
typedef clGetSupportedD3D11TextureFormatsINTEL_t *
244+
clGetSupportedD3D11TextureFormatsINTEL_fn ;
224245

225246
#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
226247

CL/cl_dx9_media_sharing.h

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -110,43 +110,55 @@ typedef struct _cl_dx9_surface_info_khr {
110110
#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C
111111

112112

113-
typedef cl_int (CL_API_CALL *
114-
clGetDeviceIDsFromDX9MediaAdapterKHR_fn)(
113+
typedef cl_int CL_API_CALL
114+
clGetDeviceIDsFromDX9MediaAdapterKHR_t(
115115
cl_platform_id platform,
116116
cl_uint num_media_adapters,
117117
cl_dx9_media_adapter_type_khr* media_adapter_type,
118118
void* media_adapters,
119119
cl_dx9_media_adapter_set_khr media_adapter_set,
120120
cl_uint num_entries,
121121
cl_device_id* devices,
122-
cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2;
122+
cl_uint* num_devices);
123+
124+
typedef clGetDeviceIDsFromDX9MediaAdapterKHR_t *
125+
clGetDeviceIDsFromDX9MediaAdapterKHR_fn CL_API_SUFFIX__VERSION_1_2;
123126

124-
typedef cl_mem (CL_API_CALL *
125-
clCreateFromDX9MediaSurfaceKHR_fn)(
127+
typedef cl_mem CL_API_CALL
128+
clCreateFromDX9MediaSurfaceKHR_t(
126129
cl_context context,
127130
cl_mem_flags flags,
128131
cl_dx9_media_adapter_type_khr adapter_type,
129132
void* surface_info,
130133
cl_uint plane,
131-
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
134+
cl_int* errcode_ret);
132135

133-
typedef cl_int (CL_API_CALL *
134-
clEnqueueAcquireDX9MediaSurfacesKHR_fn)(
136+
typedef clCreateFromDX9MediaSurfaceKHR_t *
137+
clCreateFromDX9MediaSurfaceKHR_fn CL_API_SUFFIX__VERSION_1_2;
138+
139+
typedef cl_int CL_API_CALL
140+
clEnqueueAcquireDX9MediaSurfacesKHR_t(
135141
cl_command_queue command_queue,
136142
cl_uint num_objects,
137143
const cl_mem* mem_objects,
138144
cl_uint num_events_in_wait_list,
139145
const cl_event* event_wait_list,
140-
cl_event* event) CL_API_SUFFIX__VERSION_1_2;
146+
cl_event* event);
141147

142-
typedef cl_int (CL_API_CALL *
143-
clEnqueueReleaseDX9MediaSurfacesKHR_fn)(
148+
typedef clEnqueueAcquireDX9MediaSurfacesKHR_t *
149+
clEnqueueAcquireDX9MediaSurfacesKHR_fn CL_API_SUFFIX__VERSION_1_2;
150+
151+
typedef cl_int CL_API_CALL
152+
clEnqueueReleaseDX9MediaSurfacesKHR_t(
144153
cl_command_queue command_queue,
145154
cl_uint num_objects,
146155
const cl_mem* mem_objects,
147156
cl_uint num_events_in_wait_list,
148157
const cl_event* event_wait_list,
149-
cl_event* event) CL_API_SUFFIX__VERSION_1_2;
158+
cl_event* event);
159+
160+
typedef clEnqueueReleaseDX9MediaSurfacesKHR_t *
161+
clEnqueueReleaseDX9MediaSurfacesKHR_fn CL_API_SUFFIX__VERSION_1_2;
150162

151163
#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
152164

@@ -232,42 +244,54 @@ typedef cl_uint cl_dx9_device_set_intel;
232244
#define CL_COMMAND_RELEASE_DX9_OBJECTS_INTEL 0x402B
233245

234246

235-
typedef cl_int (CL_API_CALL *
236-
clGetDeviceIDsFromDX9INTEL_fn)(
247+
typedef cl_int CL_API_CALL
248+
clGetDeviceIDsFromDX9INTEL_t(
237249
cl_platform_id platform,
238250
cl_dx9_device_source_intel dx9_device_source,
239251
void* dx9_object,
240252
cl_dx9_device_set_intel dx9_device_set,
241253
cl_uint num_entries,
242254
cl_device_id* devices,
243-
cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1;
255+
cl_uint* num_devices);
244256

245-
typedef cl_mem (CL_API_CALL *
246-
clCreateFromDX9MediaSurfaceINTEL_fn)(
257+
typedef clGetDeviceIDsFromDX9INTEL_t *
258+
clGetDeviceIDsFromDX9INTEL_fn CL_API_SUFFIX__VERSION_1_1;
259+
260+
typedef cl_mem CL_API_CALL
261+
clCreateFromDX9MediaSurfaceINTEL_t(
247262
cl_context context,
248263
cl_mem_flags flags,
249264
IDirect3DSurface9* resource,
250265
HANDLE sharedHandle,
251266
UINT plane,
252-
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1;
267+
cl_int* errcode_ret);
268+
269+
typedef clCreateFromDX9MediaSurfaceINTEL_t *
270+
clCreateFromDX9MediaSurfaceINTEL_fn CL_API_SUFFIX__VERSION_1_1;
253271

254-
typedef cl_int (CL_API_CALL *
255-
clEnqueueAcquireDX9ObjectsINTEL_fn)(
272+
typedef cl_int CL_API_CALL
273+
clEnqueueAcquireDX9ObjectsINTEL_t(
256274
cl_command_queue command_queue,
257275
cl_uint num_objects,
258276
const cl_mem* mem_objects,
259277
cl_uint num_events_in_wait_list,
260278
const cl_event* event_wait_list,
261-
cl_event* event) CL_API_SUFFIX__VERSION_1_1;
279+
cl_event* event);
280+
281+
typedef clEnqueueAcquireDX9ObjectsINTEL_t *
282+
clEnqueueAcquireDX9ObjectsINTEL_fn CL_API_SUFFIX__VERSION_1_1;
262283

263-
typedef cl_int (CL_API_CALL *
264-
clEnqueueReleaseDX9ObjectsINTEL_fn)(
284+
typedef cl_int CL_API_CALL
285+
clEnqueueReleaseDX9ObjectsINTEL_t(
265286
cl_command_queue command_queue,
266287
cl_uint num_objects,
267288
cl_mem* mem_objects,
268289
cl_uint num_events_in_wait_list,
269290
const cl_event* event_wait_list,
270-
cl_event* event) CL_API_SUFFIX__VERSION_1_1;
291+
cl_event* event);
292+
293+
typedef clEnqueueReleaseDX9ObjectsINTEL_t *
294+
clEnqueueReleaseDX9ObjectsINTEL_fn CL_API_SUFFIX__VERSION_1_1;
271295

272296
#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
273297

@@ -319,15 +343,18 @@ clEnqueueReleaseDX9ObjectsINTEL(
319343

320344
/* when cl_khr_dx9_media_sharing or cl_intel_dx9_media_sharing is supported */
321345

322-
typedef cl_int (CL_API_CALL *
323-
clGetSupportedDX9MediaSurfaceFormatsINTEL_fn)(
346+
typedef cl_int CL_API_CALL
347+
clGetSupportedDX9MediaSurfaceFormatsINTEL_t(
324348
cl_context context,
325349
cl_mem_flags flags,
326350
cl_mem_object_type image_type,
327351
cl_uint plane,
328352
cl_uint num_entries,
329353
D3DFORMAT* dx9_formats,
330-
cl_uint* num_surface_formats) ;
354+
cl_uint* num_surface_formats);
355+
356+
typedef clGetSupportedDX9MediaSurfaceFormatsINTEL_t *
357+
clGetSupportedDX9MediaSurfaceFormatsINTEL_fn ;
331358

332359
#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
333360

0 commit comments

Comments
 (0)