[Mesa-dev] [PATCH 2/8] genxml: Generate header genX_bits.h

Chad Versace chadversary at chromium.org
Wed Mar 22 21:02:06 UTC 2017


On Wed 22 Mar 2017, Jason Ekstrand wrote:
> Wow... This is an impressive quantity of infastructure just to get the
> number of bits in a field...

In the initial patch, I hand-wrote macros and functions. And I made
mistakes. That's when I decided to eliminate the mistakes with
generation. That's why we have the genxml, after all.

> On Tue, Mar 21, 2017 at 4:02 PM, Chad Versace <chadversary at chromium.org>
> wrote:


> > +    REGEX = re.compile('^#define (?P<token_name>GEN(?P<gen>[0-
> > 9]+)_(?P<token_basename>\w*Surface(Q?)Pitch)_bits).*$')
> >
> 
> Can we please not use XML to generate a header and then use regex to parse
> the header?  Let's just use XML for both.
> 
> I hate to ask for a rewrite, but you should have seen that coming...

Argh... yes, I knew it was coming. Yes, I knew I shouldn't have. But it
was SOOOO easy.

Now that I've had time to ponder my sin, I no longer want to maintain
a giant pile of Python "just to get the number of bits in a field". Let
me propose an alternative: Keep the Python changes to gen_pack_header.py
that emits the GEN_*Pitch_bits macros, but hand-write the genX_bits.h
headers. I think that's good compromise. What do you think?


More information about the mesa-dev mailing list