summaryrefslogtreecommitdiff
path: root/platform/android/display_server_android.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-11-29 23:45:38 +0100
committerGitHub <noreply@github.com>2022-11-29 23:45:38 +0100
commitd75a6b5a6d74de268d61efe178dfcfc13c38450d (patch)
treec95866d528e2671e48a62eaa7c60ec682f4cbde0 /platform/android/display_server_android.cpp
parentcdd99e9bec16db60efd894a06826f6fea139d00d (diff)
parent9141984e7ebc0bdbdd474cc6ced63e388f95a686 (diff)
Merge pull request #69355 from clayjohn/android-GLES3
Enable GLES3 on Android
Diffstat (limited to 'platform/android/display_server_android.cpp')
-rw-r--r--platform/android/display_server_android.cpp33
1 files changed, 14 insertions, 19 deletions
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp
index 1b261b489e..f76f3844e9 100644
--- a/platform/android/display_server_android.cpp
+++ b/platform/android/display_server_android.cpp
@@ -41,6 +41,10 @@
#include "platform/android/vulkan/vulkan_context_android.h"
#include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
#endif
+#ifdef GLES3_ENABLED
+#include "drivers/gles3/rasterizer_gles3.h"
+#include <EGL/egl.h>
+#endif
DisplayServerAndroid *DisplayServerAndroid::get_singleton() {
return static_cast<DisplayServerAndroid *>(DisplayServer::get_singleton());
@@ -323,7 +327,7 @@ int64_t DisplayServerAndroid::window_get_native_handle(HandleType p_handle_type,
}
#ifdef GLES3_ENABLED
case OPENGL_CONTEXT: {
- return eglGetCurrentContext();
+ return reinterpret_cast<int64_t>(eglGetCurrentContext());
}
#endif
default: {
@@ -449,6 +453,14 @@ DisplayServer *DisplayServerAndroid::create_func(const String &p_rendering_drive
DisplayServer *ds = memnew(DisplayServerAndroid(p_rendering_driver, p_mode, p_vsync_mode, p_flags, p_position, p_resolution, r_error));
if (r_error != OK) {
OS::get_singleton()->alert("Your video card driver does not support any of the supported Vulkan versions.", "Unable to initialize Video driver");
+ if (p_rendering_driver == "vulkan") {
+ OS::get_singleton()->alert("Your video card driver does not support the selected Vulkan version.\n"
+ "Please try exporting your game using the gl_compatibility renderer.",
+ "Unable to initialize Video driver");
+ } else {
+ OS::get_singleton()->alert("Your video card driver does not support OpenGL ES 3.0.",
+ "Unable to initialize Video driver");
+ }
}
return ds;
}
@@ -493,28 +505,11 @@ void DisplayServerAndroid::notify_surface_changed(int p_width, int p_height) {
DisplayServerAndroid::DisplayServerAndroid(const String &p_rendering_driver, DisplayServer::WindowMode p_mode, DisplayServer::VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, Error &r_error) {
rendering_driver = p_rendering_driver;
- // TODO: rendering_driver is broken, change when different drivers are supported again
- rendering_driver = "vulkan";
-
keep_screen_on = GLOBAL_GET("display/window/energy_saving/keep_screen_on");
#if defined(GLES3_ENABLED)
if (rendering_driver == "opengl3") {
- bool gl_initialization_error = false;
-
- if (RasterizerGLES3::is_viable() == OK) {
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
- } else {
- gl_initialization_error = true;
- }
-
- if (gl_initialization_error) {
- OS::get_singleton()->alert("Your device does not support any of the supported OpenGL versions.\n"
- "Please try updating your Android version.",
- "Unable to initialize video driver");
- return;
- }
+ RasterizerGLES3::make_current();
}
#endif