Synthclipse Preprocessor

Synthclipse Preprocessor (SP) parses GLSL preprocessor directives to omit not reachable commands. It understands the following directives and operators:

  • #if
  • #elif
  • #else
  • #ifdef
  • #ifndef
  • #undef
  • #define
  • defined()

SP comments out not reachable code using “//X~” type of comment (see the screenshot above).

Limitations

Synthclipse Preprocessor IS NOT 100% conformant with GLSL Preprocessor. For most cases it will work as expected. It is able to evaluate nested if statements and complex logical expressions like:

#if !defined(DEBUG) || SOME_VERSION_DEF > 5

but is NOT ABLE to evaluate macro functions, e.g:

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#if MAX(SOME_VERSION_DEF, 13) != 13

It will just ignore the macro functions.