Class ShaderDataProvider
Namespace: ValveResourceFormat.IO
Assembly: ValveResourceFormat.dll
Provides shader data by querying compiled shader files, with optional fallback to basic hardcoded mappings.
public class ShaderDataProvider : IShaderDataProviderInheritance
Implements
Constructors
ShaderDataProvider(IFileLoader, bool)
Initializes a new instance of the class.
public ShaderDataProvider(IFileLoader fileLoader, bool useFallback = true)Parameters
fileLoader IFileLoader
The file loader used to load shader files.
useFallback bool
Whether to use the basic provider as a fallback when shader files are unavailable.
Methods
GetInputsForTexture(string, Material)
Gets the input texture channels and names for a given texture type in a material.
public IEnumerable<(ChannelMapping Channel, string Name)> GetInputsForTexture(string textureType, Material material)Parameters
textureType string
The type of texture to query.
material Material
The material containing the texture.
Returns
IEnumerable<(ChannelMapping Channel, string Name)>
A collection of channel mappings and their corresponding input names.
Remarks
Returns texture inputs for the specified texture type, falling back to basic provider if available.
GetMaterialFeatureState(Material)
Extracts the material feature state from integer parameters.
public static IDictionary<string, byte> GetMaterialFeatureState(Material material)Parameters
material Material
The material to extract feature state from.
Returns
A dictionary of feature names (with 'F_' prefix) and their values.
GetStaticConfiguration_ForFeatureState(VfxProgramData, VfxProgramData, IDictionary<string, byte>, IDictionary<string, byte>?)
Produce a static configuration that fits the material's feature state. This configuration can be used to select one of the static variants contained in the shader file.
public static (int[] StaticConfig, long StaticComboId) GetStaticConfiguration_ForFeatureState(VfxProgramData features, VfxProgramData program, IDictionary<string, byte> featureParams, IDictionary<string, byte>? staticParams = null)Parameters
features VfxProgramData
Features vcs file that contains the feature definitions.
program VfxProgramData
Stage for which the configuration will be generated.
featureParams IDictionary<string, byte>
Feature parameters have the 'F_' prefix.
staticParams IDictionary<string, byte>?
Statics (not tied to a feature) that you want to override. Static parameters have the 'S_' prefix.
Returns
(int[] StaticConfig, long StaticComboId)
A tuple containing the static configuration array and the corresponding static combo identifier.
GetSuffixForInputTexture(string, Material)
Gets the file suffix for a given input texture name.
public string? GetSuffixForInputTexture(string inputName, Material material)Parameters
inputName string
The name of the input texture.
material Material
The material containing the texture.
Returns
The suffix string for the input texture, or null if not found.
Remarks
Returns the filename suffix for the input texture, falling back to basic provider if available.
TryReduceStaticConfiguration(VfxProgramData, int[], out int[])
Removes switches that would point to a non-existent static combo.
public static bool TryReduceStaticConfiguration(VfxProgramData program, int[] staticConfiguration, out int[] reducedConfiguration)Parameters
program VfxProgramData
The file that contains the combos and combo rules.
staticConfiguration int[]
The original static configuration.
reducedConfiguration int[]
The reduced configuration with invalid switches removed.
Returns
True if the configuration was modified, false otherwise.

