Tech Note - [Bug] 4.26 D3D11 - Shader creation on multiple threads causes hitches

Sep 9, 2021.Knowledge

Description: The engine creates a minority of shaders on the task threads, but most of them are created on the rendering thread. This can interact poorly with NVidia driver heuristics, which makes the shader creation process call a blocking heuristic (i.e. D3D12 behavior) if the driver sees shaders being created on multiple threads.

Potential Impact: [Critical] This introduces a hitch on the rendering thread, where the majority of the shaders are still created.

If you are shipping a D3D12 only game, this does not apply. Also, if you have hitches at different points of the gameplay (or on other vendor drivers), this may not apply. The issue was new to 4.26 (UE 4.25 is not affected) and was fixed for UE 4.27.

Solution: If you are affected by the issue, please consider taking the patch in the attached diff file. You can also find it shelved in CL 17373013. If you are unable to unshelve it, you can either diff it against the source revision in p4v or use p4 describe -S 17373013

This patch fixes the issue by forcing creation of all shaders on the same thread in D3D11, hence the driver will create them asynchronously.

If your game has already shipped, and it is too late for you to apply the patch, please contact NVidia via, and ask them to disable the driver heuristic for your game.