[Mesa-dev] [GLSL] defined expressions
Kenneth Graunke
kenneth at whitecape.org
Fri Dec 3 13:34:09 PST 2010
On Friday 03 December 2010 08:01:06 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.
Indeed. I'm not sure why conditional_tokens sets this. That code was pretty
much copy & pasted from pp_tokens, too, so I'm wondering if it can be removed
from there as well.
Carl, can we safely remove this line from conditional_tokens? What about
pp_tokens?
> The attached patch is a quick bandaid to this problem, but I suspect
> that other space-related issues may subsist.
>
> 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.
Apparently it can. I believe Ian's assessment is right.
> Also attached is an extended version of the defined-01.vert piglit
> glslparsertest test which covers more variations.
>
> Jose
More information about the mesa-dev
mailing list