[Mesa-dev] [GLSL] defined expressions

Ian Romanick idr at freedesktop.org
Fri Dec 3 11:21:36 PST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/03/2010 08:01 AM, José Fonseca wrote:
> Hi Ian,
> 
> The current GLSL preprocessor fails to parse expressions such as
> 
>   #if 1 == 0 || defined UNDEFINED
> 
> which is used by CINEBENCH r11.
> 
> The problem is the
> 
>   parser->space_tokens = 1;
> 
> statement conditional_tokens stanza -- it causes space tokens to be
> emitted halfway before reaching the DEFINED token.
> 
> The attached patch is a quick bandaid to this problem, but I suspect
> that other space-related issues may subsist. 

I believe that Ken was going to work on this, and he has more experience
in the preprocessor.  I'll defer to him on this.

> I don't quite understand space_tokens' role here, or how it is supposed
> to work. I confess I'm not very familiar with bison/flex inner-workings:
> I though that the tokenizer was producing tokens quite ahead of the
> parser, so the parser couldn't change the behavior of the tokenizer in
> flight -- but perhaps I'm mixing up with other lexel/grammar generation
> tools.

I believe this is so that FOO() can be identified differently than FOO.
 For example:

#define FOO(x) x
FOO
FOO(1)

Should produce

FOO
1

> Also attached is an extended version of the defined-01.vert piglit
> glslparsertest test which covers more variations.

We should add this as defined-02.vert.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkz5QzwACgkQX1gOwKyEAw8KGgCdHonAZl6yBBlmuQ5VFXOzqnl6
yPgAoJRuRLnWuIQQJpIkY2Gn/AUbuTWR
=qy51
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list