Shader Compilation on PC: About to become a bigger bottleneck?

So while PSOs create performance, usability and user facing flexibility issues they are here to stay and the answer to whether there's any work done on improving the situation is just a "no"? Well then.

I'd say this is starting to look a lot like things were prior to AMD single-handedly launching Mantle. The same people were also giving similar "no"s to similar questions, and then they were running out of breath trying to compete with the new API an IHV made.
 
Tried about 8 game demos from the Steam Next Fest.. 6 out of 8 of them had bad shader comp stuttering.

Nothing has been learned.
Indie developers don't have the resources to deal with the problem. The only way to fix it for them is to provide completely fool proof engine side feature.
 
Indie developers don't have the resources to deal with the problem. The only way to fix it for them is to provide completely fool proof engine side feature.
Yes they do ffs.. any indie dev can play through their game... and follow Unreals steps for generating the PSO data they need to precompile.
 
Yes they do ffs.. any indie dev can play through their game... and follow Unreals steps for generating the PSO data they need to precompile.
They play through their games all the time, and this is in fact one of the reasons the issue exist as they generally don't see any compilation since they are playing their game so often.
And the "steps" which Epic propose to do are anything but simple or straight forward, especially as they don't solve the issue to the fullest either.
What is done in UE5 to solve the issue is the only proper way of fixing it.
 
They play through their games all the time, and this is in fact one of the reasons the issue exist as they generally don't see any compilation since they are playing their game so often.
And the "steps" which Epic propose to do are anything but simple or straight forward, especially as they don't solve the issue to the fullest either.
What is done in UE5 to solve the issue is the only proper way of fixing it.
I will never understand this.

They play through the game all the time during development... but at some point they "build" or "cook" the final complete game. Are you saying that nobody plays it through after that? That they can't play through the complete game.. collect all the PSOs... then build it one final time?

Because I feel like this is the absolute minimum any developer could be doing..
 
They play through the game all the time during development... but at some point they "build" or "cook" the final complete game.
They build their games on daily basis, this has nothing to do with shader compilation. A development build isn't any different than a final one here.

Are you saying that nobody plays it through after that? That they can't play through the complete game.. collect all the PSOs... then build it one final time?
It is entirely possible that whoever plays what is considered a "final build" does so with shader cache being full from all the playing of previous "non-final" builds. There won't be any compilation happening in this case.
It is also not as simple as "collecting all the PSOs from the final build" since this alone is a time consuming process which is highly prone to missing some of PSOs even when setup correctly - and you have a deadline to launch the game on the previously announced date.

Because I feel like this is the absolute minimum any developer could be doing..
Developers are doing the absolute minimum when they are shipping the game, in whatever state it is.
 
Steam Next Fest from what I could tell was very much low budget indie. A lot of these people may be making blueprint games and not know all the ins and outs of UE, but I'm not sure what games are being referred to.
 
They build their games on daily basis, this has nothing to do with shader compilation. A development build isn't any different than a final one here.
Let's help @Remij understand this part better, as more explanation can help.

Let's start with this: at this point in the thread, everyone should understand the "shader stutter" is a byproduct of raw shader code which must be compiled to most effectively use the user's graphical environment, and this compile happens automatically when the shader is first encountered. Once the shader is compiled, the completed result can be cached either by the game or the driver or a combination of both. It can also be completely uncached, which results in the same jitter / stutter / pseudo-random frame drops during gameplay.

When we're talking about developers testing their code, @DegustatoR is mostly correct, in that a high-quality dev shop will usually see individual developers compiling their own code and testing it, either in isolation or as a compiled version of their entire checked-out code branch (eg to test their code against the entire codebase.) This is even before the QA team gets ahold of it, as a way to ensure the dev isn't submitting broken code and simply shoving it onto the QA team to figure out how it's b0rked. In one of my prior roles as a development manager, we would absolutely admonish those devs who submitted code which they had not at least "unit tested" themselves. That certainly doesn't mean the code is 100% good, it just means it doesn't outright fail and, at some foundational level, meets all the functional requirements set forth without bombing the entire branch build. (WHICH ONE OF YOU JERKS BROKE THE BUILD?!?! /Bruce Y, our build lead -- don't get that guy angry lol)

Alright, so the devs are testing their snippets of code on their own worstations or maybe a QA environment they've checked out from the lab. Chances are high that workstation has seen a thousand different versions of that same code, and chances are REALLY high they haven't been playing any other games on those same workstations. As such, if the driver is doing it's standard job, then the shaders are already cached and the stutter will not show up.

Let's say the dev build is promoted to a release candidate (RC) build. The QA team lods up the final build on forty different QA workstations, and they begin automated regression for functionality and also play testing. If we're really in RC, then I wager the actual devs load up the game on their own workstations too. Everyone plays the game for days, weeks, maybe months while trawling for buggies.

Unless everyone completely wiped and reloaded their workstations from bare metal, chances are incredibly high every single workstation had cached copies of the shaders from a zillion prior code builds. They'll never see it.

"But why don't they completely reimage every workstation after every build?"

Unless that's the sort of work you do for a living, completely reloading an OS and all the requisite toolchains and binaries and drivers and yadda yada is immensely time consuming. Also consider, these cannot be 100 identical workstations. By necessity and design, all the QA machines NEED to be different hardware specs to test out all the facets of the game engine. You'll need AMD and Intel CPUs, you'll need AMD, NVIDIA and Intel GPUs, you'll need SATA spinners and SATA flash drives and NVMe flash drives, you'll need boxes with 4GB of ram and boxes with 16GB of ram and boxes with 32GB of ram. You'll want boxes with external sound cards and internal sound cards. You'll want rigs with 16:9, 16:10, 21:9, 32:9, and 4:3 monitors. This isn't an environment where someone (who doesn't do this for a living) can just "slap out" a standard image across all the boxes and call it done.

My prior software dev org specifically focused on completely hands-free OS reloads across a limited set (roughly a dozen) of hardware platforms. We wrote probably fifty thousand lines of code to manage and package the unique drivers we needed (unrelated to the PC itself), the application installs (most of which were never intended to be hands-free or support any programmatic configuration) and it took us almost a year to get really good at it.

So yeah, these test workstations have seen that code, dev QA and prod, and are highly likely never to stutter unless individual shader code is updated. And by the time an RC build hits the test bench, those workstations have all seen that shader code.
 
Worth stressing the other part as well though - these indie developers rarely even have a "QA team" let alone one which would know they need to hunt for shader compilation hitches on PC specifically.

UE has become the de facto standard engine for indie developers (won this title from Unity I'd say) but this is exactly the type of customers / engine users where you need to have measures in place which will solve as many issues as possible automatically. These were missing in UE4 and has only now matured to a point where they should actually make a difference in UE5. It's not a coincidence that best UE4 titles are made by huge AAA powerhouses (it is a bit surprising though when said powerhouses are launching their games with shader compilation problems).
 
@Albuquerque Is it really more difficult that clearing your drivers shader cache folders and maybe some cache folders for the game? Just wondering what would require clean installing. Are there other places where compiled shaders can be cached?
 
They build their games on daily basis, this has nothing to do with shader compilation. A development build isn't any different than a final one here.


It is entirely possible that whoever plays what is considered a "final build" does so with shader cache being full from all the playing of previous "non-final" builds. There won't be any compilation happening in this case.
It is also not as simple as "collecting all the PSOs from the final build" since this alone is a time consuming process which is highly prone to missing some of PSOs even when setup correctly - and you have a deadline to launch the game on the previously announced date.


Developers are doing the absolute minimum when they are shipping the game, in whatever state it is.
And that's the problem... how long does this have to go on for? Developers play builds with caches that are created as they create the game... but nobody thinks to clear their entire caches when the games are "final" and see how the game would run on a non development machine? All that stuttering, hitching, compiling and building they witness during the games creation... and nobody realizes that they should run it without the caches to see how it is for the consumer?

No, you can tell when they do "the bare minimum" because Unreal will automatically start precompiling when the game loads up. If the game doesn't precompile ANYTHING at start up, they haven't done the bare minimum.

Epic having to automate as much of the process as possible to ensure that games even do it in the first place shows me that either devs still don't know about it... or it's not worth their time to do it. Whichever one it is... is a massive failure.. and I'm tired of excuses for this.
 
The excuse I'm hearing is the equivalent of "well it works on my PC"... except it's coming from the developer... lmao
 
And that's the problem... how long does this have to go on for? Developers play builds with caches that are created as they create the game... but nobody thinks to clear their entire caches when the games are "final" and see how the game would run on a non development machine? All that stuttering, hitching, compiling and building they witness during the games creation... and nobody realizes that they should run it without the caches to see how it is for the consumer?

No, you can tell when they do "the bare minimum" because Unreal will automatically start precompiling when the game loads up. If the game doesn't precompile ANYTHING at start up, they haven't done the bare minimum.

Epic having to automate as much of the process as possible to ensure that games even do it in the first place shows me that either devs still don't know about it... or it's not worth their time to do it. Whichever one it is... is a massive failure.. and I'm tired of excuses for this.

I'm pretty sure they have automatic pso precaching as of UE 5.3. It'll just take time to get games that are actually using 5.3 (I don't think one has been released yet). It's not like they aren't doing anything. Should they have back ported this solution to 5.2, 5.1, 5.0 and UE4? I don't know. Could be technical reasons why they couldn't.
 
@Albuquerque Is it really more difficult that clearing your drivers shader cache folders and maybe some cache folders for the game? Just wondering what would require clean installing. Are there other places where compiled shaders can be cached?
That's the trick right? Where are they stored? Do the graphics vendors document these locations? Would a "clean" driver remove and reinstall fix it? Maybe? Do you need to do this for every testing workstation? Probably.

This could absolutely be solved by a full filesystem I/O tracing session on a clean workstation, one for each GPU vendor at least, and probably a few dozen lines of code to just wipe those filesystem locations and perhaps any related registry entries. Maybe it's easier just to wipe whatever key is stored which indicates under what ecosystem the shaders were compiled, e.g. to force a recompile because the engine thinks a driver change has occurred.

If you do this sort of stuff for a living, it's the stuff you think about. If all you've ever done is write awesome shaders and built game assets, maybe you have no clue how any of this truly works at the bare metal end of the spectrum. We can all point and say "well, that's a shitty dev then!" But that may not be a fair assessment for an indie dev who knows enough to get the shader they want and the level and asset design they need.
The excuse I'm hearing is the equivalent of "well it works on my PC"... except it's coming from the developer... lmao
We often hear people talk about "full stack developers", but we're treading into the territory of literally driver-level and even OS-level management. Speaking only for myself, this is what I'm really good at, yet I couldn't code myself out of a wet paper bag if I needed to write a shader. Does that make me a shoddy dev? Or do I simply possess a different set of skills, relevant to my own area of expertise and necessity?

There are good game devs out there who don't really understand how the underlying parts truly work. That doesn't make them bad game devs.
 
I'm pretty sure they have automatic pso precaching as of UE 5.3. It'll just take time to get games that are actually using 5.3 (I don't think one has been released yet). It's not like they aren't doing anything. Should they have back ported this solution to 5.2, 5.1, 5.0 and UE4? I don't know. Could be technical reasons why they couldn't.
That's irrelevant to the fact that studios are using Unreal 4 or whichever version.. and not doing their part to ensure that shaders are pre compiled.

Think of every developer who has had to wait for Unreal to compile while they're building their game.... uh... it has to compile so it works... right? There's memes of how long compiling can take. What do they think is going to happen on a completely different machine when a player goes to play?

I mean come on.. play the damn game after its finished on a cacheless machine..
 
Purging shader caches shouldn't be hard, you just install a different GPU driver version (like one driver version prior to the currently installed) and voila - there's no other way for the game to run but to compile all shaders from scratch.

The problem is that in the sheer amount of things and issues which modern game development has to combat on a daily basis this one is both too small/simple for people to concentrate on it over years of some game development and too convoluted to be fully solved by someone who doesn't know all the innards of UE4. It is a weird area which no one has or willing to have control over. And in many cases there are simply no one who even care to investigate and fix it.
 
I mean come on.. play the damn game after its finished on a cacheless machine..
Again, you're talking about this as if everyone knows how to write the entire solution to this problem -- or even fully understands how to solve it. Do you really have any understanding of exactly how to solve this in UE4? And I mean, at a code level which you'd be willing to support for tens or hundreds of thousands of installs out in the wild where you'll never be able to touch or see them?

Not every dev knows every part of this toolchain, and I believe it's unfair to relegate someone to the "bad dev" category who doesn't really understand how to solve those sorts of problems. Now if it's a bigger dev shop fielding complaints from their customers? Yeah, maybe then.
 
This is exactly the case where screaming "lazy devs" won't help because it's not a problem with laziness, it's a problem with the underlying technology and it should be fixed in this technology.
Otherwise no matter how often, long and loud people like blokes from DF will talk about the problem we will still have games released where it will happen again and again.
So I'd say that the best call to developers right now would be to upgrade their projects to UE5(.3) and enable all the options for automatic PSO gathering / processing which were included in it.
 
...
So I'd say that the best call to developers right now would be to upgrade their projects to UE5(.3) and enable all the options for automatic PSO gathering / processing which were included in it.

I'd be really curious to know how easy it is for people to integrate new engine versions for very small indie projects ... but would they even know that the automated PSO caching is a desirable feature? I imagine the bigger the game is, and the longer it's been in development the less likely devs are to try to upgrade.
 
Back
Top