[Mesa-dev] [PATCH 06/18] mapi/new: use the static_data offsets in the new generator

Dylan Baker dylan at pnwbakers.com
Fri Nov 23 22:19:26 UTC 2018


Quoting Emil Velikov (2018-11-23 05:35:31)
> On 2018/11/21, Dylan Baker wrote:
> > Quoting Emil Velikov (2018-11-21 04:04:03)
> 
> > >  
> > > +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.
> > 
> Fwiw the code above is copy/paste from src/mapi/mapi_abi.py. With a
> similar hunk in src/mesa/main/get_hash_generator.py
> 
> Not sure how it works on Windows ... will address those files with a
> small prep series and update this hunk.

That code is really old, it's doing the obvious, but not optimal thing.

> 
> 
> > > +
> > > +        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.
> > 
> Sub slices are so much shorter hence why I opted for it. But will
> rework with v2.
> 
> Thanks
> Emil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181123/2b988975/attachment.sig>


More information about the mesa-dev mailing list