Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Dumiatis's avatar
Dumiatis
Honored Guest
4 years ago
Solved

Is there a way in Unreal Engine to pre cache shaders for a given level.


I made a Quest 2 VR experience for a client. There are points in the experience where there are negative framerate spikes. I found out that the spikes are when shaders are first seen in a given level. Is there a way to pre cache the shaders?

  • Thanks! Probably exactly what I wanted. 

    I followed the instructions to the letter in the video, but unfortunately it didn't create the PSO files. I saw in the comments that Vulcan seemed to be problematic with this, which is what I am using. But still storing this info away in case it's useful in the future. 

3 Replies

Replies have been turned off for this discussion
  • Dumiatis's avatar
    Dumiatis
    Honored Guest

    Thanks! Probably exactly what I wanted. 

    I followed the instructions to the letter in the video, but unfortunately it didn't create the PSO files. I saw in the comments that Vulcan seemed to be problematic with this, which is what I am using. But still storing this info away in case it's useful in the future. 

  • CarpetFace's avatar
    CarpetFace
    Expert Protege

    I have not tried the PSO solution yet, thinking that I'd use that only for shipping builds.  But what I still did anyways was to have a warmup phase during the initial load where I basically just put everything that caused a hitch while everything was still faded out black.  This works pretty well and hasn't been too difficult to setup and maintain.  I also now have the option to just not do the PSO step, as doing so will now only speed up the initial load.  So unless my boot time gets too bad, I might just skip it.  

     

    It does make me wonder why UE doesn't just do that automatically by default.  Is there some advantage to lazily creating the shader cache?  If the alternative is a runtime hitch during gameplay, that seems like a very poor design decision, especially for VR apps, so there must be some downside that I am missing?