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

[macOS/Windows] Add optional ANGLE backed OpenGL renderer support (runtime backend selection). #72831

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Feb 7, 2023

Same as #72475, but do not require separate ANGLE build.

ANGLE can be enabled and overridden for specific platform in the project setting or using --rendering-driver opengl3_angle command line argument.

@Riteo
Copy link
Contributor

Riteo commented Feb 7, 2023

So does this supersede #72475?

Edit: Also, what's the advantage of having ANGLE on Windows?

@clayjohn
Copy link
Member

clayjohn commented Feb 7, 2023

So does this supersede #72475?

Edit: Also, what's the advantage of having ANGLE on Windows?

OpenGL drivers on Windows are all over the place. On many Windows devices OpenGL drivers are so bad that the driver itself produces regular stutters during gameplay.

@bruvzg
Copy link
Member Author

bruvzg commented Feb 7, 2023

So does this supersede #72475?

Yes, when it's finished.

Edit: Also, what's the advantage of having ANGLE on Windows?

Some Intel GPUs have much better DX support than OpenGL.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review on GitHub.

Comment on lines +582 to +583
else:
env.Append(LINKFLAGS=["/DEBUG:NONE"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth moving to a separate PR so it can be cherry-picked. Also relevant to propagate in godot-cpp.

I assume this means /DEBUG:NONE is not the default option when no /DEBUG is specified?

drivers/egl/SCsub Outdated Show resolved Hide resolved
drivers/egl/egl_manager.cpp Show resolved Hide resolved
drivers/egl/egl_manager.cpp Outdated Show resolved Hide resolved
drivers/egl/egl_manager.cpp Outdated Show resolved Hide resolved
platform/macos/gl_manager_macos_angle.mm Outdated Show resolved Hide resolved
platform/macos/gl_manager_macos_angle.mm Outdated Show resolved Hide resolved
platform/windows/gl_manager_windows_angle.cpp Outdated Show resolved Hide resolved
platform/windows/gl_manager_windows_angle.cpp Outdated Show resolved Hide resolved
thirdparty/angle/include/CL/cl.h Outdated Show resolved Hide resolved
@bruvzg bruvzg force-pushed the angle++ branch 3 times, most recently from 74dbad4 to d29475a Compare September 8, 2023 20:26
Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor comment nitpicks

drivers/gles3/shader_gles3.cpp Outdated Show resolved Hide resolved
drivers/gles3/shader_gles3.cpp Outdated Show resolved Hide resolved
drivers/gles3/storage/texture_storage.cpp Outdated Show resolved Hide resolved
drivers/gles3/storage/texture_storage.cpp Outdated Show resolved Hide resolved
@akien-mga
Copy link
Member

Tested successfully on Windows 10 with https://github.com/team-godog/NGJ2023_Godog (after converting the game to GL Compat backend), compiling with VS 2022.

It seems to work well, both out of the box, and with the angle_libs path at compile time.

Out of the box, it uses ANGLE provided by Windows:

OpenGL API OpenGL ES 3.0.0 (ANGLE 2.1.18912 git hash: 872d7947bb76) - Compatibil
ity - Using Device: Google Inc. (AMD) - ANGLE (AMD, Radeon RX Vega Direct3D11 vs
_5_0 ps_5_0, D3D11-31.0.21029.1006)

With the static libs, it uses our own version:

OpenGL API OpenGL ES 3.0.0 (ANGLE 2.1.21553 git hash: 430a4f559cbc) - Compatibil
ity - Using Device: Google Inc. (AMD) - ANGLE (AMD, Radeon RX Vega Direct3D11 vs
_5_0 ps_5_0, D3D11-31.0.21029.1006)

Could be worse adding something to disambiguate so we can know easily in logs if we're using the system or bundled ANGLE, the only difference here seems to be the version / git hash.

Did some light testing on Linux, didn't spot regressions in the GL renderer.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, and basic testing seems to show it works fine.

I still need to do some testing with MinGW to make sure it will work fine on the official build server.

platform/macos/display_server_macos.mm Outdated Show resolved Hide resolved
platform/macos/display_server_macos.mm Outdated Show resolved Hide resolved
platform/windows/gl_manager_windows_native.cpp Outdated Show resolved Hide resolved
@akien-mga
Copy link
Member

akien-mga commented Sep 11, 2023

Tested successfully on Windows 10 with team-godog/NGJ2023_Godog (after converting the game to GL Compat backend), compiling with VS 2022.

It seems to work well, both out of the box, and with the angle_libs path at compile time.

Out of the box, it uses ANGLE provided by Windows:

OpenGL API OpenGL ES 3.0.0 (ANGLE 2.1.18912 git hash: 872d7947bb76) - Compatibil
ity - Using Device: Google Inc. (AMD) - ANGLE (AMD, Radeon RX Vega Direct3D11 vs
_5_0 ps_5_0, D3D11-31.0.21029.1006)

With the static libs, it uses our own version:

OpenGL API OpenGL ES 3.0.0 (ANGLE 2.1.21553 git hash: 430a4f559cbc) - Compatibil
ity - Using Device: Google Inc. (AMD) - ANGLE (AMD, Radeon RX Vega Direct3D11 vs
_5_0 ps_5_0, D3D11-31.0.21029.1006)

So actually, with our static libs I get much worse performance on this demo compared to the system ANGLE.

With the Windows 10 builtin ANGLE, I get 140-160 FPS (vsync disabled), and with our static libs I get 75 FPS.

With native OpenGL, I get 400-430 FPS.

@Riteo Riteo mentioned this pull request Sep 17, 2023
…d EGL_ANDROID_blob_cache caching.

Co-authored-by: Riteo <riteo@posteo.net>
@akien-mga akien-mga merged commit 4f314a6 into godotengine:master Sep 21, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks! Amazing work 🎉

@FyiurAmron
Copy link

for posteriority: a quick test can be done by placing e.g.

[rendering]
renderer/rendering_method="gl_compatibility"
gl_compatibility/driver.windows="opengl3_angle"

in the project.godot; regardless of #65541 I couldn't find driver selection settings in the editor's UI menus.

Also, FWIW, this (i.e. switching to ANGLE-based OpenGL renderer) actually fixes #60967 for me :)

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

Successfully merging this pull request may close these issues.

8 participants