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
- Type: Struct
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
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.
Additional Resources: PrecompiledGraphicsState.GetStats, SystemInfo.supportsPrecompiledGraphicsStateStats.
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 |
|---|---|
| allCachesMissCount | The number of pipeline state object creations that missed every one of the driver's caches, precompiled or otherwise. |
| createdCount | The number of pipeline state objects the graphics driver created. |
| precompiledCacheMissCount | The 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. |
| unknownCacheStatusCount | The 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 |
|---|---|
| isActive | Returns true if a default precompiled graphics state database is registered for this application; otherwise false. |