diff options
author | Emil Velikov <[email protected]> | 2018-11-15 18:40:21 +0000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2019-01-24 18:13:25 +0000 |
commit | 451805f810353c7a0247312f491003c31c571265 (patch) | |
tree | 956866d222d489462fc6b7cc57ad1850593e460f /src | |
parent | bba375c0160391225584b5a153c8d9febb8d2d9c (diff) |
mapi/new: use the static_data offsets in the new generator
Otherwise the incorrect ones will be used, effectively breaking the ABI.
Note: some entries in static_data.py list a suffixed API, while (for ES*
at least) we expect the one w/o suffix.
v2:
- rework path handling (Dylan)
- use else if chain (Erik)
Signed-off-by: Emil Velikov <[email protected]>
Reviewed-by: Erik Faye-Lund <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mapi/new/genCommon.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mapi/new/genCommon.py b/src/mapi/new/genCommon.py index ec48d522c05..bfcf6ed3eea 100644 --- a/src/mapi/new/genCommon.py +++ b/src/mapi/new/genCommon.py @@ -30,6 +30,11 @@ import re import sys import xml.etree.cElementTree as etree +import os +GLAPI = os.path.join(os.path.dirname(__file__), "..", "glapi", "gen") +sys.path.insert(0, GLAPI) +import static_data + MAPI_TABLE_NUM_DYNAMIC = 4096 _LIBRARY_FEATURE_NAMES = { @@ -68,11 +73,24 @@ def getFunctionsFromRoots(roots): # Sort the function list by name. functions = sorted(functions, key=lambda f: f.name) + # Lookup for fixed offset/slot functions and use it if available. # Assign a slot number to each function. This isn't strictly necessary, # since you can just look at the index in the list, but it makes it easier # to include the slot when formatting output. + + next_slot = 0 for i in range(len(functions)): - functions[i] = functions[i]._replace(slot=i) + name = functions[i].name[2:] + + if name in static_data.offsets: + functions[i] = functions[i]._replace(slot=static_data.offsets[name]) + elif not name.endswith("ARB") and name + "ARB" in static_data.offsets: + functions[i] = functions[i]._replace(slot=static_data.offsets[name + "ARB"]) + elif not name.endswith("EXT") and name + "EXT" in static_data.offsets: + functions[i] = functions[i]._replace(slot=static_data.offsets[name + "EXT"]) + else: + functions[i] = functions[i]._replace(slot=next_slot) + next_slot += 1 # Sort the function list by slot.... to simplify the diff functions = sorted(functions, key=lambda f: f.slot) |