Class ShaderSpirvReflection
Namespace: ValveResourceFormat.CompiledShader
Assembly: ValveResourceFormat.dll
Provides SPIR-V reflection and decompilation utilities for shaders.
public static class ShaderSpirvReflectionInheritance
object ← ShaderSpirvReflection
Methods
GetBufferMemberName(VfxProgramData, string, int, int)
Gets the member name for a buffer variable by index or offset.
public static string GetBufferMemberName(VfxProgramData program, string bufferName, int index = -1, int offset = -1)Parameters
program VfxProgramData
The shader program data.
bufferName string
The buffer name.
index int
The member index (optional).
offset int
The member offset (optional).
Returns
The member name when found, when the buffer is unknown, or "undetermined" when no selector is supplied.
GetGlobalBufferMemberName(VfxProgramData, VfxVariableIndexArray, int)
Gets the member name for a global buffer variable at a given offset.
public static string GetGlobalBufferMemberName(VfxProgramData program, VfxVariableIndexArray writeSequence, int offset)Parameters
program VfxProgramData
The shader program data.
writeSequence VfxVariableIndexArray
The write sequence containing variable indices.
offset int
The offset in the buffer.
Returns
The member name, or an empty string if not found.
GetNameForSampler(VfxProgramData, VfxVariableIndexArray, uint, BindingPointConfiguration)
Builds a descriptive sampler name for a given binding point.
public static string GetNameForSampler(VfxProgramData program, VfxVariableIndexArray writeSequence, uint samplerBinding, ShaderSpirvReflection.BindingPointConfiguration config)Parameters
program VfxProgramData
The shader program data.
writeSequence VfxVariableIndexArray
The write sequence containing variable indices.
samplerBinding uint
The sampler binding point.
config ShaderSpirvReflection.BindingPointConfiguration
The binding point configuration.
Returns
A concatenated sampler state description, or "undetermined" if no sampler is bound at the slot.
GetNameForStorageBuffer(VfxProgramData, VfxVariableIndexArray, uint, BindingPointConfiguration)
Gets the variable name for a storage buffer at a given binding point.
public static string GetNameForStorageBuffer(VfxProgramData program, VfxVariableIndexArray writeSequence, uint bufferBinding, ShaderSpirvReflection.BindingPointConfiguration config)Parameters
program VfxProgramData
The shader program data.
writeSequence VfxVariableIndexArray
The write sequence containing variable indices.
bufferBinding uint
The buffer binding point.
config ShaderSpirvReflection.BindingPointConfiguration
The binding point configuration.
Returns
The storage buffer variable name, or "undetermined" if not found.
GetNameForTexture(VfxProgramData, VfxVariableIndexArray, uint, VfxVariableType, BindingPointConfiguration)
Gets the variable name for a texture at a given binding point.
public static string GetNameForTexture(VfxProgramData program, VfxVariableIndexArray writeSequence, uint imageBinding, VfxVariableType vfxType, ShaderSpirvReflection.BindingPointConfiguration config)Parameters
program VfxProgramData
The shader program data.
writeSequence VfxVariableIndexArray
The write sequence containing variable indices.
imageBinding uint
The image binding point.
vfxType VfxVariableType
The VFX variable type to match.
config ShaderSpirvReflection.BindingPointConfiguration
The binding point configuration.
Returns
The texture variable name, or "undetermined" if not found.
GetNameForUniformBuffer(VfxProgramData, VfxVariableIndexArray, uint, uint)
Gets the variable name for a uniform buffer at a given binding point and descriptor set.
public static string GetNameForUniformBuffer(VfxProgramData program, VfxVariableIndexArray writeSequence, uint binding, uint set)Parameters
program VfxProgramData
The shader program data.
writeSequence VfxVariableIndexArray
The write sequence containing variable indices.
binding uint
The buffer binding point.
set uint
The descriptor set index.
Returns
The uniform buffer variable name, or "undetermined" if not found.
GetStageAttributeName(InputSignatureElement[]?, int, bool)
Gets the name for a shader stage input or output attribute.
public static string GetStageAttributeName(Material.InputSignatureElement[]? vsInputElements, int attributeIndex, bool input)Parameters
vsInputElements Material.InputSignatureElement[]?
The input signature elements array.
attributeIndex int
The attribute index.
input bool
True if this is an input attribute, false for output.
Returns
The attribute name from the signature, or a generated name if not found.
ReflectSpirv(VfxShaderFileVulkan, Backend, out string)
Reflects and decompiles SPIR-V bytecode to a target shader language.
public static bool ReflectSpirv(VfxShaderFileVulkan vulkanSource, Backend backend, out string code)Parameters
vulkanSource VfxShaderFileVulkan
The Vulkan shader source containing SPIR-V bytecode.
backend Backend
The target shader language backend.
code string
The decompiled shader code.
Returns
True if decompilation succeeded, false otherwise.

