summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mapi/new/genCommon.py20
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)