Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PrecompiledGraphicsStateStats

Counters describing precompiled graphics pipeline state cache hits and misses, as returned by PrecompiledGraphicsState.GetStats.
Read time 1 minuteLast updated 5 days ago

Definition

public readonly struct PrecompiledGraphicsStateStats

Remarks

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.

Examples

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}"); }}

Fields

Value

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.
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.

Properties

Property

Description

isActiveReturns true if a default precompiled graphics state database is registered for this application; otherwise false.