From 386968ea97d4ceeb004cc05a7aa740aa7abe6ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 13 Feb 2020 10:08:52 +0100 Subject: Remove obsolete GLES3 backend Due to the port to Vulkan and complete redesign of the rendering backend, the `drivers/gles3` code is no longer usable in this state and is not planned to be ported to the new architecture. The GLES2 backend is kept (while still disabled and non-working) as it will eventually be ported to serve as the low-end renderer for Godot 4.0. Some GLES3 features might be selectively ported to the updated GLES2 backend if there's a need for them, and extensions we can use for that. So long, OpenGL driver bugs! --- platform/iphone/export/export.cpp | 6 ++--- platform/iphone/gl_view.mm | 16 +++---------- platform/iphone/os_iphone.cpp | 48 ++++++++------------------------------- platform/iphone/platform_config.h | 1 - 4 files changed, 15 insertions(+), 56 deletions(-) (limited to 'platform/iphone') diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index f9276c16b5..0767ce7638 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -167,11 +167,9 @@ void EditorExportPlatformIOS::get_preset_features(const Ref String driver = ProjectSettings::get_singleton()->get("rendering/quality/driver/driver_name"); if (driver == "GLES2") { r_features->push_back("etc"); - } else if (driver == "GLES3") { + } else if (driver == "Vulkan") { + // FIXME: Review if this is correct. r_features->push_back("etc2"); - if (ProjectSettings::get_singleton()->get("rendering/quality/driver/fallback_to_gles2")) { - r_features->push_back("etc"); - } } Vector architectures = _get_preset_architectures(p_preset); diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index e8d737d9c3..ede60a502d 100644 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -47,7 +47,6 @@ @end */ -bool gles3_available = true; int gl_view_base_fb; static String keyboard_text; static GLView *_instance = NULL; @@ -284,20 +283,11 @@ static void clear_touches() { kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil]; - bool fallback_gl2 = false; - // Create a GL ES 3 context based on the gl driver from project settings - if (GLOBAL_GET("rendering/quality/driver/driver_name") == "GLES3") { - context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; - NSLog(@"Setting up an OpenGL ES 3.0 context. Based on Project Settings \"rendering/quality/driver/driver_name\""); - if (!context && GLOBAL_GET("rendering/quality/driver/fallback_to_gles2")) { - gles3_available = false; - fallback_gl2 = true; - NSLog(@"Failed to create OpenGL ES 3.0 context. Falling back to OpenGL ES 2.0"); - } - } + + // FIXME: Add Vulkan support via MoltenVK. Add fallback code back? // Create GL ES 2 context - if (GLOBAL_GET("rendering/quality/driver/driver_name") == "GLES2" || fallback_gl2) { + if (GLOBAL_GET("rendering/quality/driver/driver_name") == "GLES2") { context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; NSLog(@"Setting up an OpenGL ES 2.0 context."); if (!context) { diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index 7a699f9b50..634062f46b 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -33,7 +33,6 @@ #include "os_iphone.h" #include "drivers/gles2/rasterizer_gles2.h" -#include "drivers/gles3/rasterizer_gles3.h" #include "servers/visual/visual_server_raster.h" #include "servers/visual/visual_server_wrap_mt.h" @@ -57,8 +56,6 @@ int OSIPhone::get_video_driver_count() const { const char *OSIPhone::get_video_driver_name(int p_driver) const { switch (p_driver) { - case VIDEO_DRIVER_GLES3: - return "GLES3"; case VIDEO_DRIVER_GLES2: return "GLES2"; } @@ -103,44 +100,22 @@ int OSIPhone::get_current_video_driver() const { return video_driver_index; } -extern bool gles3_available; // from gl_view.mm - Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { - bool use_gl3 = GLOBAL_GET("rendering/quality/driver/driver_name") == "GLES3"; bool gl_initialization_error = false; - while (true) { - if (use_gl3) { - if (RasterizerGLES3::is_viable() == OK && gles3_available) { - RasterizerGLES3::register_config(); - RasterizerGLES3::make_current(); - break; - } else { - if (GLOBAL_GET("rendering/quality/driver/fallback_to_gles2")) { - p_video_driver = VIDEO_DRIVER_GLES2; - use_gl3 = false; - continue; - } else { - gl_initialization_error = true; - break; - } - } - } else { - if (RasterizerGLES2::is_viable() == OK) { - RasterizerGLES2::register_config(); - RasterizerGLES2::make_current(); - break; - } else { - gl_initialization_error = true; - break; - } - } + // FIXME: Add Vulkan support via MoltenVK. Add fallback code back? + + if (RasterizerGLES2::is_viable() == OK) { + RasterizerGLES2::register_config(); + RasterizerGLES2::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.", - "Unable to initialize Video driver"); + "Unable to initialize video driver"); return ERR_UNAVAILABLE; } @@ -155,10 +130,7 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p //visual_server->cursor_set_visible(false, 0); // reset this to what it should be, it will have been set to 0 after visual_server->init() is called - if (use_gl3) - RasterizerStorageGLES3::system_fbo = gl_view_base_fb; - else - RasterizerStorageGLES2::system_fbo = gl_view_base_fb; + RasterizerStorageGLES2::system_fbo = gl_view_base_fb; AudioDriverManager::initialize(p_audio_driver); @@ -467,7 +439,7 @@ bool OSIPhone::can_draw() const { int OSIPhone::set_base_framebuffer(int p_fb) { // gl_view_base_fb has not been updated yet - RasterizerStorageGLES3::system_fbo = p_fb; + RasterizerStorageGLES2::system_fbo = p_fb; return 0; }; diff --git a/platform/iphone/platform_config.h b/platform/iphone/platform_config.h index d39c64eed6..bc190ba956 100644 --- a/platform/iphone/platform_config.h +++ b/platform/iphone/platform_config.h @@ -31,7 +31,6 @@ #include #define GLES2_INCLUDE_H -#define GLES3_INCLUDE_H #define PLATFORM_REFCOUNT -- cgit v1.2.3