Class ShaderSpirvReflection
- Namespace
- ValveResourceFormat.CompiledShader
- Assembly
- ValveResourceFormat.dll
Provides SPIR-V reflection and decompilation utilities for shaders.
public static class ShaderSpirvReflection
Inheritance
Inherited Members
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
- string
-
The member name when found, System.String.Empty 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
- string
-
The member name, or an empty string if not found.
GetNameForSampler(VfxProgramData, VfxVariableIndexArray, uint)
Builds a descriptive sampler name for a given binding point.
public static string GetNameForSampler(VfxProgramData program, VfxVariableIndexArray writeSequence, uint samplerBinding)
Parameters
program
VfxProgramData-
The shader program data.
writeSequence
VfxVariableIndexArray-
The write sequence containing variable indices.
samplerBinding
uint-
The sampler binding point.
Returns
- string
-
A concatenated sampler state description, or "undetermined" if no sampler is bound at the slot.
GetNameForStorageBuffer(VfxProgramData, VfxVariableIndexArray, uint)
Gets the variable name for a storage buffer at a given binding point.
public static string GetNameForStorageBuffer(VfxProgramData program, VfxVariableIndexArray writeSequence, uint bufferBinding)
Parameters
program
VfxProgramData-
The shader program data.
writeSequence
VfxVariableIndexArray-
The write sequence containing variable indices.
bufferBinding
uint-
The buffer binding point.
Returns
- string
-
The storage buffer variable name, or "undetermined" if not found.
GetNameForTexture(VfxProgramData, VfxVariableIndexArray, uint, VfxVariableType)
Gets the variable name for a texture at a given binding point.
public static string GetNameForTexture(VfxProgramData program, VfxVariableIndexArray writeSequence, uint imageBinding, VfxVariableType vfxType)
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.
Returns
- string
-
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
- string
-
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
- string
-
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
- bool
-
True if decompilation succeeded, false otherwise.