Class ShaderUtilHelpers
- Namespace
- ValveResourceFormat.CompiledShader
- Assembly
- ValveResourceFormat.dll
Provides utility helper methods for shader processing and manipulation.
public static class ShaderUtilHelpers
Inheritance
Inherited Members
Methods
BytesToString(ReadOnlySpan<byte>, int)
Converts a byte span to a hexadecimal string representation.
public static string BytesToString(ReadOnlySpan<byte> databytes, int breakLen = 32)
Parameters
databytes
ReadOnlySpan<byte>-
The byte data to convert.
breakLen
int-
The number of bytes per line (-1 for no breaks).
Returns
- string
-
A hexadecimal string representation of the byte data.
CombineIntArray(int[], bool)
Combines an integer array into a comma-separated string.
public static string CombineIntArray(int[] ints0, bool includeParenth = false)
Parameters
ints0
int[]-
The integer array to combine.
includeParenth
bool-
Whether to include parentheses around the result.
Returns
- string
-
A string representation of the integer array.
CombineIntsSpaceSep(int[], int)
Combines an integer array into a space-separated, padded string.
public static string CombineIntsSpaceSep(int[] ints0, int padding = 5)
Parameters
Returns
- string
-
A padded string representation of the integer array.
CombineStringArray(string[], bool)
Combines a string array into a comma-separated string.
public static string CombineStringArray(string[] strings0, bool includeParenth = false)
Parameters
strings0
string[]-
The string array to combine.
includeParenth
bool-
Whether to include parentheses around the result.
Returns
- string
-
A string representation of the string array.
CombineStringsSpaceSep(string[], int)
Combines a string array into a space-separated, padded string.
public static string CombineStringsSpaceSep(string[] strings0, int padding = 5)
Parameters
Returns
- string
-
A padded string representation of the string array.
CombineValuesBreakString(string[], int)
Combines a string array with line breaks at a specified length.
public static string[] CombineValuesBreakString(string[] strings0, int breakLen)
Parameters
strings0
string[]-
The string array to combine.
breakLen
int-
The maximum line length before breaking to a new line.
Returns
- string[]
-
An array of strings broken at the specified length.
ComputeVCSFileName(string)
Parses a VCS filename to extract shader information.
public static (string ShaderName, VcsProgramType ProgramType, VcsPlatformType PlatformType, VcsShaderModelType ShaderModelType) ComputeVCSFileName(string filenamepath)
Parameters
filenamepath
string-
The VCS file path to parse.
Returns
- (string ShaderName, VcsProgramType ProgramType, VcsPlatformType PlatformType, VcsShaderModelType ShaderModelType)
-
A tuple containing the shader name, program type, platform type, and shader model type.
ComputeVCSFileName(string, VcsProgramType, VcsPlatformType, VcsShaderModelType)
Constructs a VCS filename from shader components.
public static string ComputeVCSFileName(string shaderName, VcsProgramType programType, VcsPlatformType platformType, VcsShaderModelType shaderModelType)
Parameters
shaderName
string-
The shader name.
programType
VcsProgramType-
The program type.
platformType
VcsPlatformType-
The platform type.
shaderModelType
VcsShaderModelType-
The shader model type.
Returns
- string
-
The constructed VCS filename.
ComputeVcsProgramType(string)
Converts a program type abbreviation string to a VcsProgramType enum value.
public static VcsProgramType ComputeVcsProgramType(string abbrev)
Parameters
abbrev
string-
The program type abbreviation (e.g., "vs", "ps", "features").
Returns
- VcsProgramType
-
The corresponding VcsProgramType enum value.
ComputeVcsProgramType(VcsProgramType)
Converts a VcsProgramType enum value to its abbreviation string.
public static string ComputeVcsProgramType(VcsProgramType type)
Parameters
type
VcsProgramType-
The VcsProgramType enum value.
Returns
- string
-
The program type abbreviation (e.g., "vs", "ps", "features").
GetVfxVariableTypeString(VfxVariableType)
Converts a VfxVariableType enum value to its string representation.
public static string GetVfxVariableTypeString(VfxVariableType type)
Parameters
type
VfxVariableType-
The VFX variable type.
Returns
- string
-
The string representation of the variable type.
IntArrayToStrings(int[], int)
Converts an integer array to a string array, with optional nulled value replacement.
public static string[] IntArrayToStrings(int[] ints, int nulledValue = 2147483647)
Parameters
ints
int[]-
The integer array to convert.
nulledValue
int-
The value to treat as null and replace with underscore.
Returns
- string[]
-
An array of string representations.
ParseDynamicExpression(byte[])
Parses a dynamic expression from bytecode.
public static string ParseDynamicExpression(byte[] dynExpDatabytes)
Parameters
dynExpDatabytes
byte[]-
The dynamic expression bytecode.
Returns
- string
-
The parsed expression string, or an error message if parsing fails.
ShortenShaderParam(string)
Shortens a shader parameter name for display purposes.
public static string ShortenShaderParam(string shaderParam)
Parameters
shaderParam
string-
The full shader parameter name.
Returns
- string
-
The shortened parameter name.