Eevee - Make shader compilation multithreaded
For production scenes, Eevee is not useable as it takes 5-10 minutes for it to compile all the shaders. The shader compilation is all single threaded, which means it could be going between 4-16x faster depending on the CPU.
3 Comments
It hurts every day here, too. Completely agree your wish!
I can't believe it's that hard to implement. Blender must have a list of all Eevee shader it needs to compile, simply create x cores compiler threads and distribute the shader queue to them. Bigger scenes are annoying to work with, have here 63 cores on 0% while one core has to force through the scene. Please implement.
It's probably down the line somewhere, I've noticed it also. In Unreal Engine 4 it can shader compile & light build multi threaded. But what I've found there are some D3D12 methods to get multi threaded shader compilation. Which is probably out of scope for Blender.
I've forgotten which OpenGL version Blender upgraded to, was it 4.3? In 4.5 there is an ARB method to multi thread shader compile. khronos.org/registry/OpenGL/extensions/ARB/ARB_parallel_shader_compile.txt
But as I said it might be a version below or two from 4.5
We might have to live with single threaded shader compilation, until Blender 2.8 is out of Beta. The reasoning might go as, it's working lets make everything work first. Then look into optimizations.
It would be nice if at sometime in the future, Blender Foundation openly states that it aims to implement a Vulkan back end. It looks like the Vulkan API is aiming to leverage way more CPU multi-threading, and also GPU offloading anything that it can. There are some impressive demos out there on the web. Here's an interesting presentation slides from nvidia about Vulkan, it mentions multi threading. developer.nvidia.com/sites/default/files/akamai/gameworks/blog/munich/mschott_vulkan_multi_threading.pdf
In conclusion, it's a great idea! it's the way forward. We just need someone smart enough to implement it, and it's probably full time effort to implement. And I would think a Vulkan evaluation would be important. Seeing that is where everything is heading.