Processor
Description
A simple pre-processor for assembling OpenGL shader source code.
Where applicable, ahead-of-time compilation with SPIR/V is preferred. This class is used when this is not applicable, for example if GL.GL_ARB_gl_spirv is not available or when using GLES.
Public / Methods
Preprocess
Pre-processes the given file.
The following pre-processor directives are recognized:
-
Include the given file, interpreting
file-path
as a path relative to the directory that contains the file being processed:#include <file-path> #include "file-path"
-
Add a pre-processor
TOKEN
with an optional single-lineVALUE
to the scope of the file being processed:#define TOKEN VALUE?
All subsequent occurrences of
TOKEN
will be replaced with the whitespace-trimmedVALUE
or removed if there is no value. -
Include the subsequent code only if
TOKEN
is defined:#ifdef TOKEN ... #else ... #endif
-
Include the subsequent code only if
TOKEN
is not defined:#ifndef TOKEN ... #else ... #endif
The following content is removed:
-
Single-line comments:
float value; // This is a single-line comment.
-
Multi-line comments:
/* Start of a multi-line comment. * End of a multi-line comment. */
-
Blank lines
- IOException
-
If an I/O exception has occurred while reading the file(s).