<p>I hadn't heard the phrase 'shader warming' before, but from some googling around, it seems that some games/engines use this term for a method of forcing the shaders to be fully compiled during level load, <a href="https://computergraphics.stackexchange.com/a/1634/48">as explained in this answer</a>, to avoid hitches during gameplay.</p>

<p>In Metal/Vulkan/D3D12, it's true that shaders are precompiled to a bytecode form, but this is hardware-independent bytecode; the shaders still need to be <em>further</em> compiled to the GPU-specific machine code, which (in those APIs) is done by the graphics driver when a pipeline state object is created. If there are a lot of shaders, that can potentially take awhile. The fully compiled shaders can also be cached, so this only needs to be done the first time you run the app (at least until you update the driver, which could invalidate the cached results).</p>

<p>So my guess about what's going on in your app is that the Metal/Vulkan renderers are calling it 'shader warming' when they go through and create all the pipeline state objects they're going to need—which entails compiling all the shaders. Meanwhile, in the Windows renderer, assuming it's D3D11 or earlier (not D3D12), perhaps the app is relying on the driver to compile shaders in the background, which lets it appear to load faster—at the cost of potentially having hitches a bit later if it tries to use a shader that's not finished compiling yet.</p>

CC BY-SA 4.0
2018-10-18T21:17:53.863Z
2018-10-18T21:17:53.863Z
Nathan Reed
<p>I am involved in a project that had been modified to run on Apple and Linux computers, when it was originally Windows only. Specifically, Metal and Vulkan renderers have been written alongside the Direct3D one.</p>

<p>Something I have noticed is that there is a static startup image for 3-4 mins with the text "warming shaders", which is not there in the Windows version. This screen is not present after the first launch.</p>

<p>Searching online did not give me any results that shed light on this. The one SO question asked about "background prewarming" which I presume could be used to avoid a long load screen? In any case, it doesn't explain what it IS.</p>

<p>Simply put, what is shader warming, and why does Metal and Vulkan seem to require it? I have experience with OpenGL from many years ago where shaders were compiled from source at runtime. Is this a related concept? As I understand it, both Metal and Vulkan use binary/bytecode shaders, so compiling shouldn't be necessary.</p>

<shader><terminology>
What is shader warming, and why does Direct3D seem to avoid it?
Ahsan Fayaz
# What is shader warming, and why does Direct3D seem to avoid it?

(Asked by: username_0 on 2018-10-18)

I am involved in a project that had been modified to run on Apple and Linux computers, when it was originally Windows only. Specifically, Metal and Vulkan renderers have been written alongside the Direct3D one.

Something I have noticed is that there is a static startup image for 3-4 mins with the text "warming shaders", which is not there in the Windows version. This screen is not present after the first launch.

Searching online did not give me any results that shed light on this. The one SO question asked about "background prewarming" which I presume could be used to avoid a long load screen? In any case, it doesn't explain what it IS.

Simply put, what is shader warming, and why does Metal and Vulkan seem to require it? I have experience with OpenGL from many years ago where shaders were compiled from source at runtime. Is this a related concept? As I understand it, both Metal and Vulkan use binary/bytecode shaders, so compiling shouldn't be necessary.

**Tags:** shader, terminology


---

## 1 answers

### Answer by username_1 on 2018-10-18. Score: 5 | Accepted answer

I hadn't heard the phrase 'shader warming' before, but from some googling around, it seems that some games/engines use this term for a method of forcing the shaders to be fully compiled during level load, [as explained in this answer](https://computergraphics.stackexchange.com/a/1634/48), to avoid hitches during gameplay.

In Metal/Vulkan/D3D12, it's true that shaders are precompiled to a bytecode form, but this is hardware-independent bytecode; the shaders still need to be *further* compiled to the GPU-specific machine code, which (in those APIs) is done by the graphics driver when a pipeline state object is created. If there are a lot of shaders, that can potentially take awhile. The fully compiled shaders can also be cached, so this only needs to be done the first time you run the app (at least until you update the driver, which could invalidate the cached results).

So my guess about what's going on in your app is that the Metal/Vulkan renderers are calling it 'shader warming' when they go through and create all the pipeline state objects they're going to need—which entails compiling all the shaders. Meanwhile, in the Windows renderer, assuming it's D3D11 or earlier (not D3D12), perhaps the app is relying on the driver to compile shaders in the background, which lets it appear to load faster—at the cost of potentially having hitches a bit later if it tries to use a shader that's not finished compiling yet.


---

