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-pathas a path relative to the directory that contains the file being processed:#include <file-path> #include "file-path" 
- 
Add a pre-processor TOKENwith an optional single-lineVALUEto the scope of the file being processed:#define TOKEN VALUE? All subsequent occurrences of TOKENwill be replaced with the whitespace-trimmedVALUEor removed if there is no value.
- 
Include the subsequent code only if TOKENis defined:#ifdef TOKEN ... #else ... #endif 
- 
Include the subsequent code only if TOKENis not defined:#ifndef TOKEN ... #else ... #endif 
- 
Keep the conditional directive for being processed by the downstream GLSL compiler: #if ... ... #elif ... ... #endif 
- 
Disable macro expansion: #version ... #extension ... 
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).