ShaderGen takes OpenGL Shading Language sources (stored in .sl files) and define C# sources statically storing the (elaborated) contents of the shader source. In order to compile and execute shaders, ShaderGen generate C# source modules integrated with Derm; the sources are determine by the contents of the OpenGL Shading Language files processed by ShaderGen.
Of course, it's still possible to manage alternative shaders by instantiating directly a ShaderObject and ShaderProgram classes.
The shader source is composed by two parts: the interface and the source (in an analog way of header and source files found in C). The interface and the source can be associated to three sections:
Additionally to source code written in GLSL and comment, it's possible to insert special commands in the shader source. These commands begin with a comment
//!<Command> Command Arguments
The special commands are removed automatically from the final shader source.
The interface source is specified after the special command
///!<Interface> {<i>Sections</i>}
Where Sections is a sequence of pipe separated tokens, listed here:
The interface source is specified after the special command
///!<Source> {<i>Sections</i>}
Where Sections is a sequence of pipe separated tokens, listed here:
It's possible to include shader code defined in external shader soources using the command:
///!<Include> {<i>Sections</i>}
Pay attention when or'ing multiple sections. Only the sections having exact association with the section specified as argument are really included; others not matching the sections combination are not considered.
After having determine shader source sections, each single section source is analysed to determine the following declarations: