Quoting Emil Velikov (2018-11-21 04:04:03) > From: Emil Velikov <emil.veli...@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.veli...@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")
you should use __file__ instead of sys.argv[0], also don't hardcode '/' into there, join 'glapi' and 'gen' for windows > +sys.path.append(GLAPI) also, use sys.path.insert(0, GLAPI), as python looks through paths in order, and insert is always faster. > +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": use 'is' with singletons like True, False, and None instead '=='. You might also consider using .startswith() and .endswith(), as they're clearer than random subslice. Dylan > + 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 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
signature.asc
Description: signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev