Warm up shadersA program that runs on the GPU. More info
See in Glossary if your build targets the DirectX 11, OpenGL, OpenGLES, or WebGLA JavaScript API that renders 2D and 3D graphics in a web browser. The Unity Web build option allows Unity to publish content as JavaScript programs which use HTML5 technologies and the WebGL rendering API to run Unity content in a web browser. More info
See in Glossary graphics APIs.
If your project uses the DirectX 11, OpenGL, OpenGLES, or WebGL graphics APIs, Unity provides multiple methods to warm up shaders in your project.
The GraphicsStateCollection API is compatible with DirectX 11, OpenGL, OpenGLES, or WebGL. On these APIs, GraphicsStateCollection automatically fallbacks to shader warm up. The GraphcsStateCollection API is the recommended method of warming up shaders. To learn more about warming up shaders with this API, refer to Warm up PSOs.
Note: GraphicsStateCollection automatic fallback is available in Unity 6.1 and later. If your project uses an older version of Unity, use an alternative method of shader warmup outlined in the following section.
On DirectX 11, OpenGL, OpenGLES, or WebGL graphics APIs, you can also use the following methods to warm up shaders:
To warm up a shader variant collection, do any of the following:
ShaderVariantCollection.WarmUp to warm up the shader variants when your built application starts.Note: These methods aren’t recommended on Vulkan, DirectX 12, and Metal because they can create the wrong PSOs due to missing graphics states.