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 = {
# 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)