4
from generate.eglFunctionList import EGL_FUNCTIONS as GLVND_ENTRYPOINTS
7
PREFIX = 'EGL_ENTRYPOINT('
11
# These entrypoints should *not* be in the GLVND entrypoints
12
GLVND_EXCLUDED_ENTRYPOINTS = [
14
'eglDebugMessageControlKHR',
20
def check_entrypoint_sorted(entrypoints):
21
print('Checking that EGL API entrypoints are sorted...')
23
for i, _ in enumerate(entrypoints):
24
# Can't compare the first one with the previous
27
if entrypoints[i - 1] > entrypoints[i]:
28
print('ERROR: ' + entrypoints[i] + ' should come before ' + entrypoints[i - 1])
34
def check_glvnd_entrypoints(egl_entrypoints, glvnd_entrypoints):
35
print('Checking the GLVND entrypoints against the plain EGL ones...')
38
for egl_entrypoint in egl_entrypoints:
39
if egl_entrypoint in GLVND_EXCLUDED_ENTRYPOINTS:
41
if egl_entrypoint not in glvnd_entrypoints:
42
print('ERROR: ' + egl_entrypoint + ' is missing from the GLVND entrypoints (src/egl/generate/eglFunctionList.py)')
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)')
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)')
62
parser = argparse.ArgumentParser()
63
parser.add_argument('header')
64
args = parser.parse_args()
66
with open(args.header) as header:
67
lines = header.readlines()
72
if line.startswith(PREFIX):
73
assert line.endswith(SUFFIX)
74
entrypoints.append(line[len(PREFIX):-len(SUFFIX)])
76
check_entrypoint_sorted(entrypoints)
78
glvnd_entrypoints = [x[0] for x in GLVND_ENTRYPOINTS]
80
check_glvnd_entrypoints(entrypoints, glvnd_entrypoints)
82
if __name__ == '__main__':