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

PrecompiledGraphicsStateStats

struct 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

Counters describing precompiled graphics pipeline state cache hits and misses, as returned by PrecompiledGraphicsState.GetStats.

These counters come directly from the graphics driver's Direct3D 12 precompiled state database (PSDB) statistics API. Every counter is 0, and PrecompiledGraphicsStateStats.isActive is false, whenever SystemInfo.supportsPrecompiledGraphicsStateStats is false.

Additional resources: PrecompiledGraphicsState.GetStats, SystemInfo.supportsPrecompiledGraphicsStateStats.

using UnityEngine;
using UnityEngine.Rendering;

public class Example : MonoBehaviour { void LogAllStatistics() { if (!SystemInfo.supportsPrecompiledGraphicsStateStats) return;

PrecompiledGraphicsStateStats stats = PrecompiledGraphicsState.GetStats(); Debug.Log($"Precompiled state active: {stats.isActive}, created: {stats.createdCount}, " + $"precompiled misses: {stats.precompiledCacheMissCount}, all-cache misses: {stats.allCachesMissCount}, " + $"unknown status: {stats.unknownCacheStatusCount}"); } }

Properties

Property Description
allCachesMissCountThe number of pipeline state object creations that missed every one of the driver's caches, precompiled or otherwise.
createdCountThe number of pipeline state objects the graphics driver created.
isActiveReturns true if a default precompiled graphics state database is registered for this application; otherwise false.
precompiledCacheMissCountThe number of pipeline state object creations that found no match in the precompiled state database. This doesn't necessarily mean the driver compiled at runtime - the driver's own cache might still have served it.
unknownCacheStatusCountThe number of pipeline state object creations for which the driver didn't attempt a cache lookup at all. Expected on drivers that don't report cache status; doesn't indicate whether the driver actually cached those objects.