Table of Contents

Class VfxProgramData

Namespace
ValveResourceFormat.CompiledShader
Assembly
ValveResourceFormat.dll

Represents a compiled VFX shader program with all its associated data.

public class VfxProgramData : IDisposable

Inheritance

Implements

Inherited Members

Fields

MAGIC

Magic number for VCS2 files ("vcs2").

public const int MAGIC = 846422902

Field Value

int

Properties

AdditionalFiles

Gets flags indicating which additional files are present.

public VcsAdditionalFileFlags AdditionalFiles { get; }

Property Value

VcsAdditionalFileFlags

DataReader

Gets or sets the binary reader for this shader data.

public BinaryReader? DataReader { get; set; }

Property Value

BinaryReader?

DynamicComboArray

Gets the dynamic combo configuration array.

public VfxCombo[] DynamicComboArray { get; }

Property Value

VfxCombo[]

DynamicComboRules

Gets the dynamic combo constraint rules.

public VfxRule[] DynamicComboRules { get; }

Property Value

VfxRule[]

ExtConstantBufferDescriptions

Gets the external constant buffer descriptions.

public ConstantBufferDescription[] ExtConstantBufferDescriptions { get; }

Property Value

ConstantBufferDescription[]

FeaturesHeader

Gets the features header block for feature files.

public FeaturesHeaderBlock? FeaturesHeader { get; }

Property Value

FeaturesHeaderBlock?

FileHash

Gets the file hash GUID.

public Guid FileHash { get; }

Property Value

Guid

FilenamePath

Gets the file path of the shader.

public string? FilenamePath { get; }

Property Value

string?

HashesMD5

Gets the list of MD5 hashes.

public List<Guid> HashesMD5 { get; }

Property Value

List<Guid>

IsSbox

Gets whether this is an S&box shader.

public bool IsSbox { get; init; }

Property Value

bool

Resource

The resource this VfxProgramData was read from. Starting from VCS version 70.

public Resource? Resource { get; }

Property Value

Resource?

ShaderName

Gets the shader name.

public string? ShaderName { get; }

Property Value

string?

StaticComboArray

Gets the static combo configuration array.

public VfxCombo[] StaticComboArray { get; }

Property Value

VfxCombo[]

StaticComboCache

Gets the static combo cache for efficiently retrieving parsed static combos.

public StaticCache? StaticComboCache { get; }

Property Value

StaticCache?

StaticComboEntries

Gets the static combo entries dictionary, organized by zframe ID. Zframe data contains key information needed to decompress and retrieve zframes. The sorted dictionary enables retrieval both by order (using ElementAt) and by ID (using indexer).

public SortedDictionary<long, VfxStaticComboVcsEntry> StaticComboEntries { get; }

Property Value

SortedDictionary<long, VfxStaticComboVcsEntry>

Remarks

Zframe data assigned to the ZFrameDataDescription class are key pieces of information needed to decompress and retrieve zframes (to save processing zframes are only decompressed on request). This information is organised in zframesLookup by their zframeId's. Because the zframes appear in the file in ascending order, storing their data in a sorted dictionary enables retrieval based on the order they are seen; by calling zframesLookup.ElementAt(zframeIndex). We also retrieve them based on their id using zframesLookup[zframeId]. Both methods are useful in different contexts (be aware not to mix them up).

StaticComboRules

Gets the static combo constraint rules.

public VfxRule[] StaticComboRules { get; }

Property Value

VfxRule[]

TextureChannelProcessors

Gets the texture channel processor configurations.

public VfxTextureChannelProcessor[] TextureChannelProcessors { get; }

Property Value

VfxTextureChannelProcessor[]

VSInputSignatures

Gets the vertex shader input signature elements.

public VsInputSignatureElement[] VSInputSignatures { get; }

Property Value

VsInputSignatureElement[]

VariableDescriptions

Gets the variable descriptions array.

public VfxVariableDescription[] VariableDescriptions { get; }

Property Value

VfxVariableDescription[]

VariableSourceMax

Gets the maximum variable source value (17 for up-to-date files, 14 for older files).

public int VariableSourceMax { get; }

Property Value

int

VcsPlatformType

Gets the VCS platform type (e.g., PC, Vulkan).

public VcsPlatformType VcsPlatformType { get; }

Property Value

VcsPlatformType

VcsProgramType

Gets the VCS program type (e.g., vertex shader, pixel shader).

public VcsProgramType VcsProgramType { get; }

Property Value

VcsProgramType

VcsShaderModelType

Gets the VCS shader model type (e.g., 4.0, 5.0, 6.0).

public VcsShaderModelType VcsShaderModelType { get; }

Property Value

VcsShaderModelType

VcsVersion

Gets the VCS file format version.

public int VcsVersion { get; }

Property Value

int

Methods

Dispose()

Releases streams, readers, and any cached combo data.

public void Dispose()

Dispose(bool)

Releases the unmanaged resources used by the ValveResourceFormat.CompiledShader.VfxProgramData and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

True to release both managed and unmanaged resources; false to release only unmanaged resources.

GetDBlockConfig(long)

Gets the configuration state for a dynamic block.

public int[] GetDBlockConfig(long blockId)

Parameters

blockId long

The block ID.

Returns

int[]

The configuration state array.

GetStaticCombo(long)

Retrieves and unserializes a static combo by its ID.

public VfxStaticComboData GetStaticCombo(long id)

Parameters

id long

The static combo ID.

Returns

VfxStaticComboData

The unserialized static combo data.

PrintSummary(IndentedTextWriter?)

Prints a summary of the shader program data to the console or a provided writer.

public void PrintSummary(IndentedTextWriter? outputWriter = null)

Parameters

outputWriter IndentedTextWriter?

Optional indented text writer for output.

Read(string)

Opens and reads the given filename. The file is held open until the object is disposed.

public void Read(string filenamepath)

Parameters

filenamepath string

The file to open and read.

Read(string, Stream)

Reads the given System.IO.Stream.

public void Read(string filenamepath, Stream input)

Parameters

filenamepath string

The filename System.String.

input Stream

The input System.IO.Stream to read from.