Alex from DF
brought this up on today's DF Direct Weekly, at least with respect to Unreal Engine 4 and it's shader compile stutters in DX12 wrt Hellblade, and mentioned he may do a separate video on it. Obviously I'm all for that, but I would suggest it would be expanded to talk about the shader compile issues on PC in general (as Richard alludes to this is a bigger issue than UE4 games), which Alex does go into some detail as well and mentions current attempts to mitigate this, such as Steam's sharable cache as one example (which I find works extremely well, in fact it's part of my purchasing decision now for those games when they're offered on other storefronts) - albeit he doesn't mention it's Vulkan/GL only (which as another poster in this thread indicated may at least be partly due to a fundamental architectural issue in DX12).
So yeah, that would be great to see - admittedly would be quite a bit of work though to cover everything as this thread has shown! DF has a large platform and could probably have an effect in getting more attention on this and at least making a 'compile all shaders' option in a game's settings menu as expected as a resolution slider in games doing forward. I'd like to more effort to perhaps mirror Steam's approach to sharable compiled caches that are digital storefront agnostic (as Alex mentions this may be the responsibility of the GPU manufacturers ultimately), but at the very least there's gotta be that option to do it upfront and not in-game if you so choose.
I'm really glad that
@Dictator brought this up. It ABSOLUTELY needs more attention brought to it. There are a number of ways to mitigate this issue, and what we need are people like Digital Foundry and other outlets was well as developers themselves to champion them so they become general practice across the industry!
- Performance profiling and QA should be catching these stutters and developers should be optimizing and eliminating them before the game ever ships, not after the fact.
- This is basic quality assurance... you're making a product and it should work without freezing and hitching.
- If your game can't properly compile shaders at run-time causing stutters and degraded performance, you should be pre-compiling them.
- Allowing the user the option to Precompile shaders is a must going forward!
- All games should either do it as standard, or at least give the user the option to create a "full" shader cache.
- The mechanism exists to precompile shaders/PSOs after initial load to reduce/eliminate this issue.. we need devs to understand that it's OK to implement this process at initial boot, or give the user the option to build/rebuild the cache whenever. (Like Call of Duty for example)
- Shaders are precompiled on console for a reason... Doing so reduces/eliminates stutters, improves CPU performance, and also reduces loading times.
- Nvidia, AMD, Intel, and Microsoft need to do whatever it is they can to fix this issue.
- Hey Nvidia/AMD/Intel, I'll let you in on a secret... I don't give a crap if you have 10 more FPS than your competitor.. if your card has stutters and theirs doesn't, and that becomes a trend... I'm jumping ship instantly. What I'm saying here is sometimes, the effort to "improve benchmark scores" can come at the cost of stability and predictability of the drivers, causing issues for developers when debugging and profiling their games. STABLE performance comes before HIGHEST performance... always. Optimize to eliminate stutters and hitches before optimizing to increase FPS!
- MS can always be improving Windows and DirectX. Getting developers those features they're asking for, as well as bringing all the IHVs together to set standards and continuing to push the industry forward. Hopefully with their renewed and recent success in the PC market (their games often dominate Steam's Top 10 sellers lists when they release)
I believe precompiling the shaders is the obvious route to go forward. On mid/high end PCs, waiting a few minutes upon initial boot for the shaders to compile is a non issue to me. Hitches and stutters during gameplay are FAR worse, and completely unacceptable. The problem is that on some PC configurations this process can take a prohibitive amount of time.. and everyone's tolerances are different when it comes to these sorts of things. That's completely understandable.. and I think a good solution to that problem would be that when you run the game the first time (or the game detects an invalid shader cache) it connects you to a server which collects the necessary information about your GPU and driver version, and then throws a bunch of CPU cores at compiling your shader cache very quickly... dropping a 5-10 minute compilation process down to 1-2 minutes. If you aren't connected to the internet, then you simply have to wait the full duration as your processor does the compiling. This process will become faster over time and would scale with CPU cores.. so in the future, when you upgrade, your compile times will become shorter and shorter.
Another think I think which would go a long way into reducing the user experience impact of this "compilation process" is if Steam and other storefronts integrate this compilation step, into the "download/install" process. Perhaps for example Steam could download the game, and after that, it automatically runs the game in the background and begins the shader compilation process. To the user, it would appear that Steam is still "downloading/installing" the game. Then once the compilation process is done, Steam closes the game down and says your game is ready to play. The user runs the game and was never the wiser since there was no "compilation process" they had to endure after Steam told them their game was "ready to play".
Also developers who have compilation processes at initial load, please don't just leave the screen black.. or put a little logo with no other information. If you're pre-compiling shaders, the best thing you can do is actually state that's what you're doing and either have a progress bar, or state that it will take some time. I can't count the amount of times I've seen people immediately jump on the forums and blast a game for "infinite loading" "stuck at loading screen/black scree" when the game was just precompiling shaders... You need to give the user that information so they don't needlessly think your game is busted.
And Alex, PLEASE do a video on this subject. It needs a full in depth video. Please go into the problem itself from the developer perspective, various mechanisms to mitigate the problem, the reasons why precompiling processes are a good thing (performance, stability, loading times) despite the obvious drawbacks... as various solutions to reduce those drawbacks such as what I stated above. It's absolutely needed. I've seen enough shout outs of Digital Foundry in various GDC tech talks and twitter posts to know that you guys have a positive effect and influence on many developers in the industry. What is needed is awareness and knowledge so that users can PROPERLY report constructive feedback to developers themselves.