Class ShaderLoader
Namespace: ValveResourceFormat.Renderer.Shaders
Assembly: Renderer.dll
Compiles and caches OpenGL shader programs from source files.
public class ShaderLoader : IDisposableInheritance
Implements
Constructors
ShaderLoader(RendererContext)
Initializes a new instance of the class.
public ShaderLoader(RendererContext rendererContext)Parameters
rendererContext RendererContext
The renderer context that owns this loader.
Fields
ShaderFileExtension
The file extension used to identify vertex shader entry points (.vert.slang).
public const string ShaderFileExtension = ".vert.slang"Field Value
SlangExtension
The file extension for Slang shader source files (.slang).
public const string SlangExtension = ".slang"Field Value
Properties
ShaderCount
Gets the number of compiled shader variants currently held in the cache.
public int ShaderCount { get; }Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()Dispose(bool)
Releases managed resources held by this loader.
protected virtual void Dispose(bool disposing)Parameters
disposing bool
true when called from .
LoadShader(string, params (string ComboName, byte ComboValue)[])
Loads or retrieves a cached shader compiled with the specified static combos.
public Shader LoadShader(string shaderName, params (string ComboName, byte ComboValue)[] combos)Parameters
shaderName string
The Source 2 shader name (e.g. complex.vfx).
combos (string ComboName, byte ComboValue)[]
Static combo name/value pairs to activate.
Returns
LoadShader(string, IReadOnlyDictionary<string, byte>?, bool)
Loads or retrieves a cached shader compiled with the given argument dictionary.
public Shader LoadShader(string shaderName, IReadOnlyDictionary<string, byte>? arguments = null, bool blocking = true)Parameters
shaderName string
The Source 2 shader name (e.g. complex.vfx).
arguments IReadOnlyDictionary<string, byte>?
Static combo parameter overrides, or null for defaults.
blocking bool
When true, waits for linking to complete before returning.
Returns
ShaderNameFromPath(string)
Returns the bare shader name from a full shader file path by stripping the suffix.
public static string ShaderNameFromPath(string shaderFilePath)Parameters
shaderFilePath string
The full path or file name of the shader (e.g. /path/complex.vert.slang).
Returns
The shader name without directory or extension (e.g. complex).

