Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PrecompiledGraphicsState

Provides statistics about precompiled graphics pipeline state loading on the current graphics device.
Read time 1 minuteLast updated 5 days ago

Definition

public static class PrecompiledGraphicsState

Remarks

Some graphics backends can load pipeline state objects (PSOs) from a precompiled state database instead of compiling them at runtime. This reduces stuttering caused by shader compilation. On Direct3D 12, this database is Microsoft's D3D12 Advanced Shader Delivery - State Object Database. Use this class to query how effectively the graphics backend uses the precompiled state database.
Check SystemInfo.supportsPrecompiledGraphicsStateStats before calling PrecompiledGraphicsState.GetStats. When it's false, the current graphics device doesn't report these statistics and PrecompiledGraphicsState.GetStats returns a zeroed PrecompiledGraphicsStateStats.

Examples

using UnityEngine;using UnityEngine.Rendering;public static class PrecompiledGraphicsStateExample{ public static void LogStatistics() { if (!SystemInfo.supportsPrecompiledGraphicsStateStats) { Debug.Log("Precompiled graphics state statistics aren't available on the current graphics device."); return; } PrecompiledGraphicsStateStats stats = PrecompiledGraphicsState.GetStats(); Debug.Log($"Created: {stats.createdCount}, precompiled misses: {stats.precompiledCacheMissCount}, all-cache misses: {stats.allCachesMissCount}"); }}

Static Methods

Method

Description

GetStatsReturns counters describing precompiled graphics pipeline state cache hits and misses.