Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GraphicsStateCollection

Collection of shader variants and associated graphics states.
Read time 5 minutesLast updated 4 days ago

Definition

public sealed class GraphicsStateCollection : Object

Remarks

Use graphics state collections to record shader variants and graphics states encountered at runtime and prewarm shader variants.
Each shader variant in the collection may have one or more associated graphics states. Each permutation of a shader variant and a graphics state will result in a single GPU representation of the shader being created by Unity.

Examples

using UnityEngine;using UnityEngine.Experimental.Rendering;public class GraphicsStateCollectionTracing : MonoBehaviour{ public GraphicsStateCollection graphicsStateCollection; void Start() { graphicsStateCollection = new GraphicsStateCollection(); graphicsStateCollection.BeginTrace(); } void OnDestroy() { graphicsStateCollection.EndTrace(); }}

Constructors

Constructor

Description

GraphicsStateCollection()Create a GraphicsTextureCollection populated with contents of a file, or empty.
GraphicsStateCollection(System.String)Create a GraphicsTextureCollection populated with contents of a file, or empty.

Properties

Property

Description

completedWarmupCountThe number of shader variant permutations that have been warmed up.
graphicsDeviceTypeThe graphics device API type the collection is intended to be used with.
isTracingFlag indicating if the collection is actively tracing shader variants and graphics states.
isWarmedUpFlag indicating if the collection is warmed up.
qualityLevelNameThe quality level the collection is intended to be used with.
runtimePlatformThe platform that the collection is intended to be used with.
totalGraphicsStateCountThe total number of graphics states across all shader variants in the collection.
variantCountThe number of shader variants contained in this collection.
versionThe current version of the collection.

Methods

Method

Description

AddGraphicsStateForVariantAdds a new graphics state associated with a shader variant.
AddVariantAdds a new shader variant to the collection.
BeginTraceStart tracing shader variants and graphics states encountered at runtime.
ClearVariantsClears all shader variants and associated graphics states from collection.
ContainsVariantCheck if variant exists in collection.
EndTraceStop tracing shader variants and graphics states encountered at runtime.
GetGraphicsStateCountForVariantGet the number of graphics states associated to a shader variant.
GetGraphicsStatesForVariantPopulate given list with graphics states associated with input shader variant.
GetVariantsPopulate given list with shader variants contained in collection.
LoadFromFileLoad the GraphicsStateCollection at the given path.
RemoveGraphicsStatesForVariantRemove all associated graphics states from a shader variant.
RemoveVariantRemove shader variant and associated graphics states from collection.
SaveToFileSave GraphicsStateCollection to disk.
SendToEditorSend GraphicsStateCollection to the Editor using PlayerConnection.
WarmUpPrewarms all shader variants in this collection using associated graphics states.
WarmUpProgressivelyPrewarms the given number of shader variant permutations using associated graphics states.

Structs

Struct

Description

GraphicsStateCollection.GraphicsStateA graphics state identifies a specific rendering configuration.
GraphicsStateCollection.ShaderVariantIdentifies a specific variant of a shader stored in a GraphicsStateCollection.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.