Class ShaderParser
Namespace: ValveResourceFormat.Renderer.Shaders
Assembly: Renderer.dll
Preprocesses shader source files and extracts defines and render modes.
public class ShaderParserInheritance
object ← ShaderParser
Constructors
ShaderParser()
Initializes a new instance of the ShaderParser class and discovers all available shader files.
public ShaderParser()Fields
ExpectedShaderVersion
The GLSL version directive that must appear as the first line of every shader file.
public const string ExpectedShaderVersion = "#version 460"Field Value
string
ShaderDirectory
The embedded-resource namespace prefix used to locate shader files in the assembly manifest.
public const string ShaderDirectory = "Renderer.Shaders."Field Value
string
Properties
AvailableShaders
Gets each shader base name with its available stages (vertex, fragment, compute), from mounted directories, disk or the assembly manifest.
public Dictionary<string, bool[]> AvailableShaders { get; }Property Value
Dictionary<string, bool[]>
ShaderSourceDirectory
Gets the folder of loose built-in shader files, or null when only the embedded copies are available.
public static string? ShaderSourceDirectory { get; }Property Value
string?
Remarks
Debug builds record the absolute shader folder path at compile time for hot reloading. Release builds do not, and a recorded path that is missing on another machine falls back to the embedded shaders.
Methods
ClearBuilder()
Clears the internal StringBuilder so it is ready for the next preprocessing pass.
public void ClearBuilder()PreprocessShader(string, ParsedShaderData)
Reads and preprocesses a shader source file, resolving includes and extracting defines, render modes, and uniform names into parsedData.
public string PreprocessShader(string shaderFile, ShaderLoader.ParsedShaderData parsedData)Parameters
shaderFile string
The shader file path or embedded resource name (e.g. complex.vert.slang).
parsedData ShaderLoader.ParsedShaderData
The data container that accumulates extracted metadata across all stages.
Returns
string
The preprocessed GLSL source text ready for driver compilation.

