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

Fall back to GLES2 automatically on known problematic GPUs with poor GLES3 support #1609

Open
Calinou opened this issue Oct 4, 2020 · 12 comments
Milestone

Comments

@Calinou
Copy link
Member

Calinou commented Oct 4, 2020

Describe the project you are working on:

The Godot editor 🙂

Describe the problem or limitation you are having in your project:

Many desktop and mobile GPUs claim to support OpenGL 3.3/OpenGL ES 3.0, but do so poorly in practice. They can also have limitations that are incompatible with the current GLES3 renderer design.

Here are some examples of such GPUs I've listed over the years, based on issue reports:

Desktop

  • AMD Radeon HD 3000/4000/5000 series
  • NVIDIA GeForce 8000/9000 series
  • 3rd-generation Intel HD Graphics (Ivy Bridge)

Mobile

  • Many Adreno GPUs

Note: I don't have issue links at hand, but it should be possible to find many of them by searching for is:issue is:open label:topic:rendering gles3 in the Godot issue tracker.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:

If the project uses GLES3 and Fallback to Gles2 is enabled in the project settings, use GLES2 if the GPU is on the exclusion list.

This should be implemented in the 3.2 branch first, as the current master branch doesn't have GLES3 or GLES2 renderers yet.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

  • Store a list of substrings to detect in VisualServer::get_video_adapter_name() somewhere in the engine's source code. This list generally don't need to change over time, since new GPU models are unlikely to have poor GLES3 support.
  • If there is a match in any of the substrings, fall back to GLES2 automatically.
  • Change the--video-driver command line argument to work as follows:
    • If not specified, use the project-defined video driver. If GLES3 is used and Fallback To Gles2 is enabled in the Project Settings, fall back to GLES2 on unsupported GPUs (or GPUs on the aforementioned exclusion list).
    • If --video-driver GLES3 is used, always attempt to use GLES3 even if the GPU is on the exclusion list. This can be used to bypass the automatic fallback, just in case.

If this enhancement will not be used often, can it be worked around with a few lines of script?:

No, as the renderer choice happens before any of the project's code is run.

Is there a reason why this should be core and not an add-on in the asset library?:

This is core engine functionality, and is required to improve the user experience out of the box.

@salvprest
Copy link

I think that this is the best way to handle this kinds of broken gpu drivers, on mobile this is an unresolved problem

@Calinou
Copy link
Member Author

Calinou commented Apr 14, 2021

I started working on this on the 3.x branch: https://github.com/Calinou/godot/tree/fallback-gles2-specific-gpus

The problem is that falling back to GLES2 this way will make the project manager not draw anything other than the clear color, and OpenGL errors will be spammed to the console:

❯ bin/godot.x11.tools.64.llvm --verbose
Godot Engine v3.3.rc.custom_build.00d087e47 - https://godotengine.org
XInput: Refreshing devices.
XInput: No touch devices found.
Detecting GPUs, set DRI_PRIME in the environment to override GPU detection logic.
Only one GPU found, using default.
GeForce GTX 1080/PCIe/SSE2
Using GLES2 video driver
OpenGL ES 2.0 Renderer: GeForce GTX 1080/PCIe/SSE2
ERROR: _gl_debug_print: GL ERROR: Source: OpenGL        Type: Error     ID: 1280        Severity: High  Message: GL_INVALID_ENUM error generated. Operation is not valid from the core profile.
   At: drivers/gles2/rasterizer_gles2.cpp:133.
ERROR: _gl_debug_print: GL ERROR: Source: OpenGL        Type: Error     ID: 1281        Severity: High  Message: GL_INVALID_VALUE error generated. <internalFormat> not valid.
   At: drivers/gles2/rasterizer_gles2.cpp:133.
ERROR: _gl_debug_print: GL ERROR: Source: OpenGL        Type: Error     ID: 1280        Severity: High  Message: GL_INVALID_ENUM error generated. Cannot enable <cap> in the current profile.
   At: drivers/gles2/rasterizer_gles2.cpp:133.
OpenGL ES Batching: ON
        OPTIONS
        max_join_item_commands 16
        colored_vertex_format_threshold 0.25
        batch_buffer_size 16384
        light_scissor_area_threshold 1
        item_reordering_lookahead 4
        light_max_join_items 32
        single_rect_fallback False
        debug_flash False
        diagnose_frame False
PulseAudio: detected 2 channels
PulseAudio: audio buffer frames: 512 calculated latency: 11ms
JoypadLinux: udev enabled and loaded successfully.
 
ERROR: _gl_debug_print: GL ERROR: Source: OpenGL        Type: Error     ID: 1282        Severity: High  Message: GL_INVALID_OPERATION error generated. Invalid VAO/VBO/pointer usage.
   At: drivers/gles2/rasterizer_gles2.cpp:133.
ERROR: _gl_debug_print: GL ERROR: Source: OpenGL        Type: Error     ID: 1282        Severity: High  Message: GL_INVALID_OPERATION error generated. Array object is not active.
   At: drivers/gles2/rasterizer_gles2.cpp:133.
ERROR: _gl_debug_print: GL ERROR: Source: OpenGL        Type: Error     ID: 1281        Severity: High  Message: GL_INVALID_VALUE error generated. <internalFormat> not valid.
   At: drivers/gles2/rasterizer_gles2.cpp:133.
ERROR: _gl_debug_print: GL ERROR: Source: OpenGL        Type: Error     ID: 1281        Severity: High  Message: GL_INVALID_VALUE error generated. <internalFormat> not valid.
   At: drivers/gles2/rasterizer_gles2.cpp:133.
ERROR: _gl_debug_print: GL ERROR: Source: OpenGL        Type: Error     ID: 1281        Severity: High  Message: GL_INVALID_VALUE error generated. <internalFormat> not valid.
   At: drivers/gles2/rasterizer_gles2.cpp:133.
ERROR: _gl_debug_print: GL ERROR: Source: OpenGL        Type: Error     ID: 1281        Severity: High  Message: GL_INVALID_VALUE error generated. <internalFormat> not valid.
   At: drivers/gles2/rasterizer_gles2.cpp:133.
... [more error spam]

There is also some commented out code that I added to try to restart Godot with the GLES2 renderer. This way is hackier, but it could be investigated if we can't get this cleaner way to work.

@jamie-pate
Copy link

I'd like to add "Intel(R) HD Graphics*" to this list on windows I've seen some complete lockup situations with these chips.
also "Intel Iris Plus Graphics" on macs :( godotengine/godot#52722

@Calinou
Copy link
Member Author

Calinou commented Nov 10, 2021

I'd like to add "Intel(R) HD Graphics*" to this list on windows I've seen some complete lockup situations with these chips. also "Intel Iris Plus Graphics" on macs :( godotengine/godot#52722

Making all Intel IGPs on Windows fall back to GLES2 would be kind of extreme. Recent IGP models can run GLES3 just fine, and it performs well enough if you're conservative with the resolution and effects.

@jamie-pate
Copy link

jamie-pate commented Nov 11, 2021

HD vs UHD.. they are apparently different enough that the hd version crashes even though Wikipedia says that hd 620 and uhd 620 are the same generation,..
I think this exclusion list may need be en editable setting?

If there is a sane default then each developer could use that, and pile on any other gpu strings that are flaking out in their specific use case.

The real problem is that developers may not have the resources available to test all these variations. Different parts are flakey for each driver too. It's trickier, but considering the driver version could also be helpful in the rare case where they actually update and fix the issue.. (hopefully the vulkan stuff will actually be updated more frequently and this may be more important there?)

Apple feedback straight up said to me "GL is not greatly supported, we recommend that you move to Metal". This doesn't give me much confidence that they care enough about open gl to clean up this situation.

@Calinou
Copy link
Member Author

Calinou commented Nov 11, 2021

Apple feedback straight up said to me "GL is not greatly supported, we recommend that you move to Metal". This doesn't give me much confidence that they care enough about open gl to clean up this situation.

Using MetalANGLE is likely the solution here.

@jamie-pate
Copy link

jamie-pate commented Nov 11, 2021

Yes, i noticed that for webgl Chrome just uses ANGLE as well... Seems they were fed up with the situation with Windows OpenGL driver quality as well..

Oh lol godotengine/godot#44845

@jamie-pate
Copy link

FYI Getting reports today that 10th gen Intel(R) UHD Graphics are possibly also broken in GLES3

@Calinou
Copy link
Member Author

Calinou commented Nov 26, 2021

FYI Getting reports today that 10th gen Intel(R) UHD Graphics are possibly also broken in GLES3

We'd need a minimal reproduction project with someone available for testing to be able to confirm this. Otherwise, there's nothing we can do about it (GLES2 may as well be broken on such hardware, if GLES3 is).

@jamie-pate
Copy link

jamie-pate commented Nov 26, 2021 via email

@jamie-pate
Copy link

Intel says:
We recommend contacting the developer of the app in order to consider listing the app as compatible only with Iris Xe Graphics and the newer versions.

See godotengine/godot#56496 (comment)

@jamie-pate
Copy link

jamie-pate commented Jan 25, 2022

GLES2 may as well be broken on such hardware, if GLES3 is

GLES2 is 100% fine afaict on all intel igpus on all platforms. The workaround is always to fall back to GLES2

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

No branches or pull requests

3 participants