Preprocessors And Macros

As in C, there exist pre-processors which are executed before compilation. Macros can also be defined to use meaningful names in place of value literals.

However, unlike C, macros in GLSL cannot have parameters.

Preprocessors (examples)
#if constant-expression
    // statements to run if the expression is true
#endif
#if constant-expression1
    // statements to run if the expression is true
#elif constant-expression2
    //...
#else
    //...
#endif
#ifdef macro-name
    // statements to run if 'macro-name' is defined
#endif
#ifndef macro-name
    // statements to run if 'macro-name' is undefined
#endif
#define macro-name value
#undefine macro-name
#version 101 // must be at the top of the program
#error...
#pragma...
#extension...
#line...
Built-in Macros
__LINE__ yields the line number in the shader program.
__VERSION__ yields the version of GLSL used. 100 means version 1.00.
GL_ES is defined and set to 1 if the program is running on an OpenGL-ES Shading Language.
GL_FRAGMENT_SHADER_PRECISION_HIGH is defined and set to 1 if highp is supported in the fragment language.