Class ShaderRegistry
Namespace: ValveResourceFormat.Renderer.Shaders
Assembly: Renderer.dll
Registry of user provided shader directories and shader name mappings.
Mounted directories take priority over the shaders shipped with the renderer, like search paths in GameFileLoader. A file in a mounted directory overrides the built-in file with the same relative path, for entry points (fallback.vert.slang) and includes (common/lighting.slang) alike.
Mappings take priority over the built-in table, translating a Source 2 shader name (shader.vfx) to a renderer shader file.
Configure before creating a RendererContext. Changing the registry drops the parsed shader cache, but already compiled shader programs keep running the old code.
public static class ShaderRegistryInheritance
object ← ShaderRegistry
Properties
Directories
Gets the mounted shader directories, highest priority first.
public static ImmutableArray<string> Directories { get; }Property Value
ImmutableArray<string>
Mappings
Gets the registered shader name mappings, keyed by the Source 2 shader name (e.g. shader.vfx).
public static ImmutableDictionary<string, string> Mappings { get; }Property Value
ImmutableDictionary<string, string>
Methods
AddShaderDirectory(string)
Mounts a shader directory above the shaders shipped with the renderer. The most recently added directory has the highest priority.
public static bool AddShaderDirectory(string path)Parameters
path string
Path to the directory that mirrors the layout of the built-in Renderer/Shaders folder.
Returns
bool
true if the directory was added, false if it was already mounted.
Exceptions
The directory does not exist.
AddShaderMapping(string, string)
Maps a Source 2 shader name to the renderer shader file used to draw it, overriding the built-in mapping.
public static void AddShaderMapping(string shaderName, string shaderFileName)Parameters
shaderName string
The Source 2 shader name, including the extension (e.g. shader.vfx).
shaderFileName string
The renderer shader name without stage or extension (e.g. my_shader for my_shader.vert.slang).
Reset()
Removes all mounted directories and registered mappings.
public static void Reset()
