Class ShaderPreprocessor
java.lang.Object
lol.trq.helios.shader.ShaderPreprocessor
Expands
#include directives and injects defines, keeping line numbers traceable.
The output starts with #version, then one #define per define, then the source. Each file gets a
GLSL source-string number, and #line directives mark every switch between files, so a driver error such as
0(12) or 0:12 names the file and line through ShaderPreprocessor.Preprocessed.describe(String).
#include "name" resolves relative to the including file; #include <name> from the root. A file
is included at most once per shader; an include cycle is an error. Helios has one dialect, GLSL 4.10 core: the
output always declares #version 410 core, an entry file may repeat exactly that line, and any other
#version is an error.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA preprocessed shader. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe one GLSL version every Helios shader uses. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
VERSION_LINE
-
-
Constructor Details
-
ShaderPreprocessor
Creates a preprocessor.- Parameters:
resolver- loads source files by name
-
-
Method Details
-
process
Expands a shader.- Parameters:
entry- the name of the entry filedefines- defines to inject, by name; a null or empty value defines the name alone- Returns:
- the expanded source and its file table
- Throws:
ShaderException- if a file is missing, an include cycles, or a define name is invalid
-