Bug 29489 - [glsl2] piglit test preprocess-01.frag fails
Summary: [glsl2] piglit test preprocess-01.frag fails
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: All All
: medium normal
Assignee: mesa-dev
QA Contact: Kenneth Graunke
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-10 12:21 UTC by Ian Romanick
Modified: 2010-08-12 10:43 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Ian Romanick 2010-08-10 12:21:12 UTC
As reported by Thomas Jones, shaders such as the one below, now in piglit test case preprocess-01.frag do not compile:

#ifdef FOO
#if FOO == 4
#elif SAMP == 5
#endif
#endif
void main()  { gl_FragData[0] = vec4(0);}
Comment 1 Carl Worth 2010-08-12 10:43:15 UTC
Thanks, Thomas and Ian for the new test case.

I recently pushed code to the glsl2 branch that fixes this problem.
It's careful to avoid doing any evaluation of an #if or #elif expression
if that expression is skipped entirely, (within an #if/#ifdef/#ifndef/#elif
block evaluated as false), or irrelevant, (subsequent to an expression that
has already evaluated as true).

Below are the headers of the two key commits for the fix.

-Carl

commit 764e096647ec8c0f20ea3b5191499af806ad23f8
Author: Carl Worth <cworth@cworth.org>
Date:   Wed Aug 11 12:45:55 2010 -0700

    glcpp: Regenerate glcpp-parse.c
    
    After a recent change to glcpp-parse.y

commit 48ba058e7a4b808271ca987b1553efd7e9792da9
Author: Carl Worth <cworth@cworth.org>
Date:   Wed Aug 11 12:43:44 2010 -0700

    glcpp: Additional fixes for not evaluating skipped #if/#elif expressions.
    
    This adds a couple of test cases to expand our coverage of invalid #if and
    being skipped, (either by being nested inside an #if/#elif that evaluates to
    zero or by being after an #if/#elif that evaluates to non-zero).


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.