Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

PrecompiledGraphicsState

class in UnityEngine.Rendering

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Provides statistics about precompiled graphics pipeline state loading on the current graphics device.

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.

Additional resources: SystemInfo.supportsPrecompiledGraphicsStateStats, PrecompiledGraphicsState.GetStats, PrecompiledGraphicsStateStats.

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.