[Mesa-dev] [PATCH 06/18] mapi/new: use the static_data offsets in the new generator
Emil Velikov
emil.l.velikov at gmail.com
Wed Nov 21 12:04:03 UTC 2018
From: Emil Velikov <emil.velikov at collabora.com>
Otherwise the incorrect ones will be used, effecitvely 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.
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
src/mapi/new/genCommon.py | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/src/mapi/new/genCommon.py b/src/mapi/new/genCommon.py
index ee3c468479d..4152ccab3f4 100644
--- a/src/mapi/new/genCommon.py
+++ b/src/mapi/new/genCommon.py
@@ -30,6 +30,11 @@ import collections
import re
import xml.etree.cElementTree as etree
+import os
+GLAPI = os.path.join(os.path.dirname(sys.argv[0]), "..", "glapi/gen")
+sys.path.append(GLAPI)
+import static_data
+
MAPI_TABLE_NUM_DYNAMIC = 4096
_LIBRARY_FEATURE_NAMES = {
@@ -71,8 +76,31 @@ def getFunctionsFromRoots(roots):
# 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:]
+ slot_set = False
+
+ if name in static_data.offsets:
+ functions[i] = functions[i]._replace(slot=static_data.offsets[name])
+ slot_set = True
+
+ if slot_set == False and name[-3:] != "ARB":
+ lname = name + "ARB"
+ if lname in static_data.offsets:
+ functions[i] = functions[i]._replace(slot=static_data.offsets[lname])
+ slot_set = True
+
+ if slot_set == False and name[-3:] != "EXT":
+ lname = name + "EXT"
+ if lname in static_data.offsets:
+ functions[i] = functions[i]._replace(slot=static_data.offsets[lname])
+ slot_set = True
+
+ if slot_set == False:
+ 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)
--
2.19.1
More information about the mesa-dev
mailing list