# WarmUpProgressively

> Prewarms the given number of shader variant state permutations using associated graphics states.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Rendering](/engine/6000.5/script-reference/unityengine/rendering.md)
* **Assembly:** UnityEngine.CoreModule

## WarmUpProgressively(int, JobHandle)

Prewarms the given number of shader variant state permutations using associated graphics states.

```csharp
public JobHandle WarmUpProgressively(int count, JobHandle dependency = default)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The maximum number of variant permutations to warm up.**** (\[JobHandle]\(/engine/6000.5/script-reference/unity/jobs/jobhandle)): Job to wait for.

### Returns

| Type                                                                 | Description               |
| -------------------------------------------------------------------- | ------------------------- |
| [JobHandle](/engine/6000.5/script-reference/unity/jobs/jobhandle.md) | Handle to prewarming job. |

### Remarks

Except for the case of WebGPU, graphics state collection warmup is only supported when [SystemInfo.supportsParallelPSOCreation](/engine/6000.5/script-reference/unityengine/systeminfo/supportsparallelpsocreation.md) is true. Otherwise, behavior falls back to the legacy [ShaderVariantCollection.WarmUp](/engine/6000.5/script-reference/unityengine/shadervariantcollection/warmup.md) and `count` restricts the maximum number of shader variants instead of shader variant permutations.

Note that when cache miss tracing begins, only the graphics state collection entries that have completed warm up when this job finishes will be considered in identifying cache misses. Additionally, :ref::isTracingCacheMisses must be false before initiating warm up in order to set `traceCacheMisses` to true. Use [GraphicsStateCollection.EndTrace](/engine/6000.5/script-reference/unityengine/rendering/graphicsstatecollection/endtrace.md) on the [GraphicsStateCollection.cacheMissCollection](/engine/6000.5/script-reference/unityengine/rendering/graphicsstatecollection/cachemisscollection.md) to end any ongoing cache miss tracing.

```csharp
using UnityEngine;
using UnityEngine.Rendering;
using Unity.Jobs;

public class GraphicsStateCollectionWarmup : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;
    public int statesToWarmup;

    void Start()
    {
        JobHandle handle = graphicsStateCollection.WarmUpProgressively(statesToWarmup);
    }
}
```

Additional Resources: [GraphicsStateCollection.WarmUp](/engine/6000.5/script-reference/unityengine/rendering/graphicsstatecollection/warmup.md), [GraphicsStateCollection.isWarmedUp](/engine/6000.5/script-reference/unityengine/rendering/graphicsstatecollection/iswarmedup.md), [GraphicsStateCollection.completedWarmupCount](/engine/6000.5/script-reference/unityengine/rendering/graphicsstatecollection/completedwarmupcount.md), [ShaderVariantCollection.WarmUp](/engine/6000.5/script-reference/unityengine/shadervariantcollection/warmup.md).

## WarmUpProgressively(int, JobHandle, bool)

Prewarms the given number of shader variant state permutations using associated graphics states.

```csharp
public JobHandle WarmUpProgressively(int count, JobHandle dependency, bool traceCacheMisses)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The maximum number of variant permutations to warm up.**** (\[JobHandle]\(/engine/6000.5/script-reference/unity/jobs/jobhandle)): Job to wait for.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): If true, stores any graphics states used during runtime that were not prewarmed.

### Returns

| Type                                                                 | Description               |
| -------------------------------------------------------------------- | ------------------------- |
| [JobHandle](/engine/6000.5/script-reference/unity/jobs/jobhandle.md) | Handle to prewarming job. |

### Remarks

Except for the case of WebGPU, graphics state collection warmup is only supported when [SystemInfo.supportsParallelPSOCreation](/engine/6000.5/script-reference/unityengine/systeminfo/supportsparallelpsocreation.md) is true. Otherwise, behavior falls back to the legacy [ShaderVariantCollection.WarmUp](/engine/6000.5/script-reference/unityengine/shadervariantcollection/warmup.md) and `count` restricts the maximum number of shader variants instead of shader variant permutations.

Note that when cache miss tracing begins, only the graphics state collection entries that have completed warm up when this job finishes will be considered in identifying cache misses. Additionally, :ref::isTracingCacheMisses must be false before initiating warm up in order to set `traceCacheMisses` to true. Use [GraphicsStateCollection.EndTrace](/engine/6000.5/script-reference/unityengine/rendering/graphicsstatecollection/endtrace.md) on the [GraphicsStateCollection.cacheMissCollection](/engine/6000.5/script-reference/unityengine/rendering/graphicsstatecollection/cachemisscollection.md) to end any ongoing cache miss tracing.

```csharp
using UnityEngine;
using UnityEngine.Rendering;
using Unity.Jobs;

public class GraphicsStateCollectionWarmup : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;
    public int statesToWarmup;

    void Start()
    {
        JobHandle handle = graphicsStateCollection.WarmUpProgressively(statesToWarmup);
    }
}
```

Additional Resources: [GraphicsStateCollection.WarmUp](/engine/6000.5/script-reference/unityengine/rendering/graphicsstatecollection/warmup.md), [GraphicsStateCollection.isWarmedUp](/engine/6000.5/script-reference/unityengine/rendering/graphicsstatecollection/iswarmedup.md), [GraphicsStateCollection.completedWarmupCount](/engine/6000.5/script-reference/unityengine/rendering/graphicsstatecollection/completedwarmupcount.md), [ShaderVariantCollection.WarmUp](/engine/6000.5/script-reference/unityengine/shadervariantcollection/warmup.md).
