radeonsi: merge uses_persp_opcode_interp_sample/uses_linear_opcode_interp_sample
[mesa.git] / src / egl / egl-entrypoint-check.py
1 #!/usr/bin/env python
2
3 import argparse
4 from generate.eglFunctionList import EGL_FUNCTIONS as GLVND_ENTRYPOINTS
5
6
7 PREFIX = 'EGL_ENTRYPOINT('
8 SUFFIX = ')'
9
10
11 # These entrypoints should *not* be in the GLVND entrypoints
12 GLVND_EXCLUDED_ENTRYPOINTS = [
13 # EGL_KHR_debug
14 'eglDebugMessageControlKHR',
15 'eglQueryDebugKHR',
16 'eglLabelObjectKHR',
17 ]
18
19
20 def check_entrypoint_sorted(entrypoints):
21 print('Checking that EGL API entrypoints are sorted...')
22
23 for i, _ in enumerate(entrypoints):
24 # Can't compare the first one with the previous
25 if i == 0:
26 continue
27 if entrypoints[i - 1] > entrypoints[i]:
28 print('ERROR: ' + entrypoints[i] + ' should come before ' + entrypoints[i - 1])
29 exit(1)
30
31 print('All good :)')
32
33
34 def check_glvnd_entrypoints(egl_entrypoints, glvnd_entrypoints):
35 print('Checking the GLVND entrypoints against the plain EGL ones...')
36 success = True
37
38 for egl_entrypoint in egl_entrypoints:
39 if egl_entrypoint in GLVND_EXCLUDED_ENTRYPOINTS:
40 continue
41 if egl_entrypoint not in glvnd_entrypoints:
42 print('ERROR: ' + egl_entrypoint + ' is missing from the GLVND entrypoints (src/egl/generate/eglFunctionList.py)')
43 success = False
44
45 for glvnd_entrypoint in glvnd_entrypoints:
46 if glvnd_entrypoint not in egl_entrypoints:
47 print('ERROR: ' + glvnd_entrypoint + ' is missing from the plain EGL entrypoints (src/egl/main/eglentrypoint.h)')
48 success = False
49
50 for glvnd_entrypoint in GLVND_EXCLUDED_ENTRYPOINTS:
51 if glvnd_entrypoint in glvnd_entrypoints:
52 print('ERROR: ' + glvnd_entrypoint + ' is should *not* be in the GLVND entrypoints (src/egl/generate/eglFunctionList.py)')
53 success = False
54
55 if success:
56 print('All good :)')
57 else:
58 exit(1)
59
60
61 def main():
62 parser = argparse.ArgumentParser()
63 parser.add_argument('header')
64 args = parser.parse_args()
65
66 with open(args.header) as header:
67 lines = header.readlines()
68
69 entrypoints = []
70 for line in lines:
71 line = line.strip()
72 if line.startswith(PREFIX):
73 assert line.endswith(SUFFIX)
74 entrypoints.append(line[len(PREFIX):-len(SUFFIX)])
75
76 check_entrypoint_sorted(entrypoints)
77
78 glvnd_entrypoints = [x[0] for x in GLVND_ENTRYPOINTS]
79
80 check_glvnd_entrypoints(entrypoints, glvnd_entrypoints)
81
82 if __name__ == '__main__':
83 main()