@@ -47,35 +47,42 @@ VA_API_Extensions = {
47
47
}
48
48
49
49
# Extensions to include in this file:
50
- def shouldGenerate (extension ):
51
- if extension in genExtensions:
50
+ def shouldGenerate (name ):
51
+ if name in genExtensions:
52
52
return True
53
- elif not genExtensions and not extension in skipExtensions:
53
+ elif not genExtensions and not name in skipExtensions:
54
54
return True
55
55
return False
56
56
57
57
# ifdef condition for an extension:
58
- def getIfdefCondition (extension ):
59
- if extension in GL_Extensions :
58
+ def getIfdefCondition (name ):
59
+ if name in GL_Extensions :
60
60
return ' CLEXT_INCLUDE_GL'
61
- elif extension in EGL_Extensions :
61
+ elif name in EGL_Extensions :
62
62
return ' CLEXT_INCLUDE_EGL'
63
- elif extension in DX9_Extensions :
63
+ elif name in DX9_Extensions :
64
64
return ' CLEXT_INCLUDE_DX9'
65
- elif extension in D3D10_Extensions :
65
+ elif name in D3D10_Extensions :
66
66
return ' CLEXT_INCLUDE_D3D10'
67
- elif extension in D3D11_Extensions :
67
+ elif name in D3D11_Extensions :
68
68
return ' CLEXT_INCLUDE_D3D11'
69
- elif extension in VA_API_Extensions :
69
+ elif name in VA_API_Extensions :
70
70
return ' CLEXT_INCLUDE_VA_API'
71
71
return None
72
72
73
- # XML blocks with functions to include:
73
+ # XML blocks for extensions with functions to include:
74
74
def shouldEmit (block ):
75
75
for func in block.findall(' command' ):
76
76
return True
77
77
return False
78
78
79
+ # Extensions with functions to include:
80
+ def hasFunctions (extension ):
81
+ for block in extension.findall(' require' ):
82
+ if shouldEmit(block):
83
+ return True
84
+ return False
85
+
79
86
# Order the extensions should be emitted in the headers.
80
87
# KHR -> EXT -> Vendor Extensions
81
88
def getExtensionSortKey (item ):
@@ -145,6 +152,10 @@ def getCParameterStrings(params):
145
152
# include <CL/cl_ext.h>
146
153
# if defined(CLEXT_INCLUDE_GL)
147
154
# include <CL/cl_gl.h>
155
+ // Some versions of the headers to not define cl_khr_gl_event.
156
+ # ifndef cl_khr_gl_event
157
+ # define cl_khr_gl_event 1
158
+ # endif
148
159
# endif
149
160
# if defined(CLEXT_INCLUDE_EGL)
150
161
# include <CL/cl_egl.h>
@@ -303,14 +314,11 @@ static inline cl_platform_id _get_platform(cl_accelerator_intel accelerator)
303
314
***************************************************************/
304
315
305
316
% for extension in sorted (spec.findall(' extensions/extension' ), key = getExtensionSortKey):
306
- % if shouldGenerate(extension.get(' name' )):
317
+ % if shouldGenerate(extension.get(' name' )) and hasFunctions(extension) :
307
318
% if getIfdefCondition(extension.get(' name' )):
308
319
# if defined(${getIfdefCondition(extension.get('name'))})
309
-
310
320
% endif
311
- <%
312
- name = extension.get(' name' )
313
- %> /* ${ name} */
321
+ # if defined(${extension.get('name')})
314
322
% for block in extension.findall(' require' ):
315
323
% if shouldEmit(block):
316
324
% if block.get(' condition' ):
@@ -337,10 +345,13 @@ typedef ${api.RetType} (CL_API_CALL* ${api.Name}_clextfn)(
337
345
% endif
338
346
%endfor
339
347
348
+ # else
349
+ # pragma message("Define for ${extension.get('name')} was not found! Please update your headers.")
350
+ # endif // defined(${extension.get('name')})
340
351
% if getIfdefCondition(extension.get(' name' )):
341
352
# endif // defined(${getIfdefCondition(extension.get('name'))})
342
-
343
353
% endif
354
+
344
355
% endif
345
356
%endfor
346
357
@@ -352,14 +363,11 @@ struct openclext_dispatch_table {
352
363
cl_platform_id platform;
353
364
354
365
% for extension in sorted (spec.findall(' extensions/extension' ), key = getExtensionSortKey):
355
- % if shouldGenerate(extension.get(' name' )):
366
+ % if shouldGenerate(extension.get(' name' )) and hasFunctions(extension) :
356
367
% if getIfdefCondition(extension.get(' name' )):
357
368
# if defined(${getIfdefCondition(extension.get('name'))})
358
-
359
369
% endif
360
- <%
361
- name = extension.get(' name' )
362
- %> /* ${ name} */
370
+ # if defined(${extension.get('name')})
363
371
% for block in extension.findall(' require' ):
364
372
% if shouldEmit(block):
365
373
% if block.get(' condition' ):
@@ -375,11 +383,11 @@ struct openclext_dispatch_table {
375
383
% endif
376
384
% endif
377
385
%endfor
378
-
386
+ # endif // defined(${extension.get('name')})
379
387
% if getIfdefCondition(extension.get(' name' )):
380
388
# endif // defined(${getIfdefCondition(extension.get('name'))})
381
-
382
389
% endif
390
+
383
391
% endif
384
392
%endfor
385
393
};
@@ -398,14 +406,11 @@ static void _init(cl_platform_id platform, openclext_dispatch_table* dispatch_pt
398
406
platform, #_funcname);
399
407
400
408
% for extension in sorted (spec.findall(' extensions/extension' ), key = getExtensionSortKey):
401
- % if shouldGenerate(extension.get(' name' )):
409
+ % if shouldGenerate(extension.get(' name' )) and hasFunctions(extension) :
402
410
% if getIfdefCondition(extension.get(' name' )):
403
411
# if defined(${getIfdefCondition(extension.get('name'))})
404
-
405
412
% endif
406
- <%
407
- name = extension.get(' name' )
408
- %> /* ${ name} */
413
+ # if defined(${extension.get('name')})
409
414
% for block in extension.findall(' require' ):
410
415
% if shouldEmit(block):
411
416
% if block.get(' condition' ):
@@ -421,11 +426,11 @@ static void _init(cl_platform_id platform, openclext_dispatch_table* dispatch_pt
421
426
% endif
422
427
% endif
423
428
%endfor
424
-
429
+ # endif // defined(${extension.get('name')})
425
430
% if getIfdefCondition(extension.get(' name' )):
426
431
# endif // defined(${getIfdefCondition(extension.get('name'))})
427
-
428
432
% endif
433
+
429
434
% endif
430
435
%endfor
431
436
# undef CLEXT_GET_EXTENSION
@@ -496,14 +501,11 @@ extern "C" {
496
501
***************************************************************/
497
502
498
503
% for extension in sorted (spec.findall(' extensions/extension' ), key = getExtensionSortKey):
499
- % if shouldGenerate(extension.get(' name' )):
504
+ % if shouldGenerate(extension.get(' name' )) and hasFunctions(extension) :
500
505
% if getIfdefCondition(extension.get(' name' )):
501
506
# if defined(${getIfdefCondition(extension.get('name'))})
502
-
503
507
% endif
504
- <%
505
- name = extension.get(' name' )
506
- %> /* ${ name} */
508
+ # if defined(${extension.get('name')})
507
509
% for block in extension.findall(' require' ):
508
510
% if shouldEmit(block):
509
511
% if block.get(' condition' ):
@@ -559,10 +561,12 @@ ${api.RetType} CL_API_CALL ${api.Name}(
559
561
% endif
560
562
%endfor
561
563
564
+ # endif // defined(${extension.get('name')})
562
565
% if getIfdefCondition(extension.get(' name' )):
563
566
# endif // defined(${getIfdefCondition(extension.get('name'))})
564
567
565
568
% endif
569
+
566
570
% endif
567
571
%endfor
568
572
# ifdef __cplusplus
0 commit comments