Bug 40269 - #ifdef isn't recognized in GLSL preprocessor
Summary: #ifdef isn't recognized in GLSL preprocessor
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium major
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords: NEEDINFO
Depends on:
Blocks:
 
Reported: 2011-08-21 06:38 UTC by snake5creator
Modified: 2011-08-21 11:44 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description snake5creator 2011-08-21 06:38:40 UTC
When I compile a shader that contains #ifdef, the compiler seems to be misinterpreting it as #if - I get two errors - unexpected $end and unterminated #if (which points to the line that contains #ifdef.

It's possible to work around the bug by using #if defined( .. ) instead of #ifdef .., however this is a very useful directive that is expected to work.

The full construct I had there was like this:

#ifdef VSHADER
..code
#elif defined( PSHADER )
..code
#endif

Works great on fglrx and Catalyst Win32 drivers.
Comment 1 Kenneth Graunke 2011-08-21 09:30:05 UTC
What version of Mesa are you using?

#ifdef does work; we have any number of tests that use it.  Additionally, I ran
your example snippet through glcpp in Mesa master and it works fine.  So there
must be something else going on with your shader.  If possible, please attach
it.
Comment 2 snake5creator 2011-08-21 11:44:55 UTC
I was using the latest version of Mesa according to Synaptic.
However, I reinstalled everything and the bug seems to be gone.
So either it was a temporary problem with the configuration or something that could happen if fglrx wouldn't be properly uninstalled, but in any case, the problem is solved.


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.