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);}
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.