You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-24 15:26:15 +00:00
Enable GLES3 on Android
Add necessary build flags and switch from using a GLES2 context to a GLES3 one. This also enables building for OpenXR Co-authored-by: m4gr3d <fhuyakou@gmail.com> Co-authored-by: dsnopek <dsnopek@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user