godot: Ubershader async compile doesn't seem to do anything

Godot version

3.5rc4

System information

Linux, GeForce GTX 1080, Steam Deck, GLES3

Issue description

Setting shader compilation mode to Asynchronous + Cahce or Asynchronous doesn’t seem to do anything, there is still major stutter when a new material enters the view frustum for the first time. This is more apparent when running the exported build on my Steam Deck. I’m under the impression that when it’s set to Asynchronous + Cahce materials should appear white while they compile and subsequent boots of the game should not stutter, but neither of these happen. All of my shaders are set to async_visible.

The output in the editor console says:

Async. shader compilation: ON (full native support)
Shader cache: ON

See video here: https://drive.google.com/file/d/1o2jW9Ds1JShA0wbTsLD__SP-52n3cvjM/view?usp=sharing

Notice the major stutter as the camera pans around the menu scene and then again when the green glitch material appears in the level.

Steps to reproduce

Create a project with several materials and set shader compilation mode to Asynchronous + Cahce or Asynchronous.

Minimal reproduction project

It’s difficult for me to isolate this into a minimal reproduction project, but I’d be willing to add a contributor to the repository if they need to debug.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (12 by maintainers)

Most upvoted comments

Just a quick question if you don’t mind, have you managed to improve the situation on Steam Deck? I’m building a 3D game and have mostly mitigated shader-related stutters on PC, on Android they’re present but minimal, but the Deck seems to really struggle. I haven’t yet put a huge effort into improving the situation there, any tips?

I went back to the old solution with synchronous shader compilation mode and manually forcing shader compilation by placing all scene materials in front of camera and rendering a couple of frames. This gets rid of all shader compiling and jitter during gameplay.

The shader compilation is weirdly slow on Steam Deck. I have a small number (~10) of very simple materials and rendering a couple of first frames with them takes almost 3 seconds. The same thing on my average laptop with Intel GPU takes at most 400ms.

Now, given the results you report about reducing the simultaneous compiles, I’d start considering closing this as not a bug, so to speak.

Thanks for all your work on this and help trying to debug my issues. I think I’ve been able to improve the performance somewhat and will continue to reduce the number of materials my scene is using. I’m happy to close the issue.

Just a quick question if you don’t mind, have you managed to improve the situation on Steam Deck? I’m building a 3D game and have mostly mitigated shader-related stutters on PC, on Android they’re present but minimal, but the Deck seems to really struggle. I haven’t yet put a huge effort into improving the situation there, any tips?

Best tip I can give is to switch to GLES2… If you can’t do that, then try to reduce the number of materials you are using by texture atlasing or maybe even array textures.

Now, given the results you report about reducing the simultaneous compiles, I’d start considering closing this as not a bug, so to speak.

Thanks for all your work on this and help trying to debug my issues. I think I’ve been able to improve the performance somewhat and will continue to reduce the number of materials my scene is using. I’m happy to close the issue.