Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGL backend (e.g. in Project Manager) shows blank screen / corrupted visuals due to invalid shader cache (e.g. after driver upgrade) #77136

Closed
danboo opened this issue May 16, 2023 · 5 comments · Fixed by #77163

Comments

@danboo
Copy link
Contributor

danboo commented May 16, 2023

Godot version

v4.1.dev.custom_build.1c7a62d2c

System information

Windows 10, OpenGL API 3.3.0 NVIDIA 531.79 - Compatibility - Using Device: NVIDIA Corporation - NVIDIA GeForce GTX 1070

Issue description

I build Godot from the master branch nightly on Windows. For a while the Project Manager has been displaying corrupted visuals as below:

image

I went back through the commits from the past month and determined that it first appears when compiling PR #76092 with the commit ID of 1c7a62d.

For now I can work around the issue by starting Godot with my project directly. In doing this I've not noticed any other issues beyond the Project Manager.

Steps to reproduce

No, sample code. Just building Godot on Windows 10.

Minimal reproduction project

No project needed.

@danboo
Copy link
Contributor Author

danboo commented May 16, 2023

Looks like I can resolve this issue by deleting %APPDATA%\Godot\shader_cache. Perhaps that is sufficient and the issue can be closed, or it may suggest that other users will have issues when upgrading versions.

@wojtekpil
Copy link
Contributor

In my case same issue a bit more problematic, because it is introduced when I switch between integrated and dedicated GPUs (both AMD). Deleting %APPDATA%\Godot\shader_cache always helps but it is not a perfect solution as I need to do it each time I switch to/from battery and power supply.

@akien-mga akien-mga changed the title Project Manager - corrupted visuals OpenGL backend (e.g. in Project Manager) shows blank screen / corrupted visuals due to invalid shader cache (e.g. after driver upgrade) May 17, 2023
@akien-mga akien-mga added this to the 4.1 milestone May 17, 2023
@akien-mga
Copy link
Member

I've seen it too on Linux after my distro upgraded Mesa from 23.0 to 23.1, and it's indeed related to the shader cache added in #76092 (CC @ChibiDenDen). The shader cache is only valid for a given GPU + driver combination, so it needs to be invalidated / ignored whenever the GPU or drivers change.

We discussed this with @clayjohn on RC a couple of days ago:

clayjohn: From the spec: A program binary may fail to load if the implementation determines that there has been a change in hardware or software configuration from when the program binary was produced such as having been compiled with an incompatible or outdated version of the compiler.
So it sounds like it is our problem indeed.
https://registry.khronos.org/OpenGL-Refpages/gl4/html/glProgramBinary.xhtml
Akien: But naturally they don't recommend any API you can use to track this and encode it in your shader cache 😛
clayjohn: Nope. Its probably not possible. In 3.x we just fail shader compilation and delete the entry from our cache which forces the engine to recompile and cache again
Akien: Sounds good enough.

@ChibiDenDen
Copy link
Contributor

I think it should be enough to verify that glProgramBinary succeeds and fail loading otherwise (recompilation and overwrite for the shader cache should happen automatically)

@clayjohn
Copy link
Member

I think it should be enough to verify that glProgramBinary succeeds and fail loading otherwise (recompilation and overwrite for the shader cache should happen automatically)

Yes, I think so. It should not be too difficult to fix. We just need to check if the link was successful before returning from load_from_cache. We should instead return false if the link fails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants