diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-13 10:08:52 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-13 10:36:44 +0100 |
commit | 386968ea97d4ceeb004cc05a7aa740aa7abe6ca9 (patch) | |
tree | 4ad2333ba23b1cbe7db9e213e9d7702606ea42a6 /platform | |
parent | d661ca53575142582254f56afd5f92563db6dd9f (diff) |
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!
Diffstat (limited to 'platform')
27 files changed, 68 insertions, 274 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 7bbcb8cfa2..642b045f5b 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -683,8 +683,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { int orientation = p_preset->get("screen/orientation"); - bool min_gles3 = ProjectSettings::get_singleton()->get("rendering/quality/driver/driver_name") == "GLES3" && - !ProjectSettings::get_singleton()->get("rendering/quality/driver/fallback_to_gles2"); bool screen_support_small = p_preset->get("screen/support_small"); bool screen_support_normal = p_preset->get("screen/support_normal"); bool screen_support_large = p_preset->get("screen/support_large"); @@ -839,11 +837,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { } } - if (tname == "uses-feature" && attrname == "glEsVersion") { - - encode_uint32(min_gles3 ? 0x00030000 : 0x00020000, &p_manifest.write[iofs + 16]); - } - // FIXME: `attr_value != 0xFFFFFFFF` below added as a stopgap measure for GH-32553, // but the issue should be debugged further and properly addressed. if (tname == "meta-data" && attrname == "name" && value == "xr_mode_metadata_name") { @@ -1350,11 +1343,10 @@ public: String driver = ProjectSettings::get_singleton()->get("rendering/quality/driver/driver_name"); if (driver == "GLES2") { r_features->push_back("etc"); - } else if (driver == "GLES3") { + } + // FIXME: Review what texture formats are used for Vulkan. + if (driver == "Vulkan") { r_features->push_back("etc2"); - if (ProjectSettings::get_singleton()->get("rendering/quality/driver/fallback_to_gles2")) { - r_features->push_back("etc"); - } } Vector<String> abis = get_enabled_abis(p_preset); diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml index 7e9ce70d80..4d2eb1ef65 100644 --- a/platform/android/java/app/AndroidManifest.xml +++ b/platform/android/java/app/AndroidManifest.xml @@ -15,7 +15,6 @@ android:largeScreens="true" android:xlargeScreens="true" /> - <!-- glEsVersion is modified by the exporter, changing this value here has no effect. --> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index 2f6a93fbb1..021214b627 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -287,8 +287,6 @@ public abstract class Godot extends Activity implements SensorEventListener, IDo */ @Keep private void onVideoInit() { - boolean use_gl3 = getGLESVersionCode() >= 0x00030000; - final FrameLayout layout = new FrameLayout(this); layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); setContentView(layout); @@ -299,7 +297,7 @@ public abstract class Godot extends Activity implements SensorEventListener, IDo // ...add to FrameLayout layout.addView(edittext); - mView = new GodotView(this, xrMode, use_gl3, use_32_bits, use_debug_opengl); + mView = new GodotView(this, xrMode, use_32_bits, use_debug_opengl); layout.addView(mView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); edittext.setView(mView); io.setEdit(edittext); diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotView.java index f938583082..8d3c2ae319 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotView.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotView.java @@ -73,9 +73,8 @@ public class GodotView extends GLSurfaceView { private final GestureDetector detector; private final GodotRenderer godotRenderer; - public GodotView(Godot activity, XRMode xrMode, boolean p_use_gl3, boolean p_use_32_bits, boolean p_use_debug_opengl) { + public GodotView(Godot activity, XRMode xrMode, boolean p_use_32_bits, boolean p_use_debug_opengl) { super(activity); - GLUtils.use_gl3 = p_use_gl3; GLUtils.use_32 = p_use_32_bits; GLUtils.use_debug_opengl = p_use_debug_opengl; diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java b/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java index bbf876ea1f..9d29551f89 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java @@ -44,7 +44,6 @@ public class GLUtils { public static final boolean DEBUG = false; - public static boolean use_gl3 = false; public static boolean use_32 = false; public static boolean use_debug_opengl = false; diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java index ce4defd7a7..8409e37f8f 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java @@ -45,6 +45,8 @@ public class RegularConfigChooser implements GLSurfaceView.EGLConfigChooser { private int[] mValue = new int[1]; + // FIXME: Add support for Vulkan. + /* This EGL config specification is used to specify 2.0 rendering. * We use a minimum size of 4 bits for red/green/blue, but will * perform actual matching in chooseConfig() below. @@ -59,15 +61,6 @@ public class RegularConfigChooser implements GLSurfaceView.EGLConfigChooser { EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL10.EGL_NONE }; - private static int[] s_configAttribs3 = { - EGL10.EGL_RED_SIZE, 4, - EGL10.EGL_GREEN_SIZE, 4, - EGL10.EGL_BLUE_SIZE, 4, - // EGL10.EGL_DEPTH_SIZE, 16, - // EGL10.EGL_STENCIL_SIZE, EGL10.EGL_DONT_CARE, - EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, //apparently there is no EGL_OPENGL_ES3_BIT - EGL10.EGL_NONE - }; public RegularConfigChooser(int r, int g, int b, int a, int depth, int stencil) { mRedSize = r; @@ -83,7 +76,7 @@ public class RegularConfigChooser implements GLSurfaceView.EGLConfigChooser { /* Get the number of minimally matching EGL configurations */ int[] num_config = new int[1]; - egl.eglChooseConfig(display, GLUtils.use_gl3 ? s_configAttribs3 : s_configAttribs2, null, 0, num_config); + egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config); int numConfigs = num_config[0]; @@ -94,7 +87,7 @@ public class RegularConfigChooser implements GLSurfaceView.EGLConfigChooser { /* Allocate then read the array of minimally matching EGL configs */ EGLConfig[] configs = new EGLConfig[numConfigs]; - egl.eglChooseConfig(display, GLUtils.use_gl3 ? s_configAttribs3 : s_configAttribs2, configs, numConfigs, num_config); + egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config); if (GLUtils.DEBUG) { GLUtils.printConfigs(egl, display, configs); diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java index 22bd4ced87..f2b4c95a2c 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java @@ -52,24 +52,17 @@ public class RegularContextFactory implements GLSurfaceView.EGLContextFactory { public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) { String driver_name = GodotLib.getGlobal("rendering/quality/driver/driver_name"); - if (GLUtils.use_gl3 && !driver_name.equals("GLES3")) { - GLUtils.use_gl3 = false; - } - if (GLUtils.use_gl3) - Log.w(TAG, "creating OpenGL ES 3.0 context :"); - else - Log.w(TAG, "creating OpenGL ES 2.0 context :"); + // FIXME: Add support for Vulkan. + Log.w(TAG, "creating OpenGL ES 2.0 context :"); GLUtils.checkEglError(TAG, "Before eglCreateContext", egl); EGLContext context; if (GLUtils.use_debug_opengl) { int[] attrib_list2 = { EGL_CONTEXT_CLIENT_VERSION, 2, _EGL_CONTEXT_FLAGS_KHR, _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, EGL10.EGL_NONE }; - int[] attrib_list3 = { EGL_CONTEXT_CLIENT_VERSION, 3, _EGL_CONTEXT_FLAGS_KHR, _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, EGL10.EGL_NONE }; - context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, GLUtils.use_gl3 ? attrib_list3 : attrib_list2); + context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list2); } else { int[] attrib_list2 = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE }; - int[] attrib_list3 = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL10.EGL_NONE }; - context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, GLUtils.use_gl3 ? attrib_list3 : attrib_list2); + context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list2); } GLUtils.checkEglError(TAG, "After eglCreateContext", egl); return context; diff --git a/platform/android/java_godot_wrapper.cpp b/platform/android/java_godot_wrapper.cpp index 893b786c0b..9ac91b8ef6 100644 --- a/platform/android/java_godot_wrapper.cpp +++ b/platform/android/java_godot_wrapper.cpp @@ -99,13 +99,6 @@ jobject GodotJavaWrapper::get_class_loader() { } } -void GodotJavaWrapper::gfx_init(bool gl2) { - // beats me what this once did, there was no code, - // but we're getting false if our GLES3 driver is initialised - // and true for our GLES2 driver - // Maybe we're supposed to communicate this back or store it? -} - void GodotJavaWrapper::on_video_init(JNIEnv *p_env) { if (_on_video_init) if (p_env == NULL) diff --git a/platform/android/java_godot_wrapper.h b/platform/android/java_godot_wrapper.h index 655f5170bf..f378b1ea38 100644 --- a/platform/android/java_godot_wrapper.h +++ b/platform/android/java_godot_wrapper.h @@ -71,7 +71,6 @@ public: jobject get_class_loader(); - void gfx_init(bool gl2); void on_video_init(JNIEnv *p_env = NULL); void restart(JNIEnv *p_env = NULL); void force_quit(JNIEnv *p_env = NULL); diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index e5d9bdc60c..e86e373630 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -33,7 +33,6 @@ #include "core/io/file_access_buffered_fa.h" #include "core/project_settings.h" #include "drivers/gles2/rasterizer_gles2.h" -#include "drivers/gles3/rasterizer_gles3.h" #include "drivers/unix/dir_access_unix.h" #include "drivers/unix/file_access_unix.h" #include "file_access_android.h" @@ -67,8 +66,6 @@ int OS_Android::get_video_driver_count() const { const char *OS_Android::get_video_driver_name(int p_driver) const { switch (p_driver) { - case VIDEO_DRIVER_GLES3: - return "GLES3"; case VIDEO_DRIVER_GLES2: return "GLES2"; } @@ -123,44 +120,21 @@ int OS_Android::get_current_video_driver() const { Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { - bool use_gl3 = godot_java->get_gles_version_code() >= 0x00030000; - use_gl3 = 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) { - godot_java->gfx_init(false); - 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) { - godot_java->gfx_init(true); - RasterizerGLES2::register_config(); - RasterizerGLES2::make_current(); - break; - } else { - gl_initialization_error = true; - break; - } - } + // FIXME: Add Vulkan support. Readd fallback code from Vulkan to GLES2? + + 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.\n" "Please try updating your Android version.", - "Unable to initialize Video driver"); + "Unable to initialize video driver"); return ERR_UNAVAILABLE; } @@ -750,7 +724,6 @@ void OS_Android::vibrate_handheld(int p_duration_ms) { bool OS_Android::_check_internal_feature_support(const String &p_feature) { if (p_feature == "mobile") { - //TODO support etc2 only if GLES3 driver is selected return true; } #if defined(__aarch64__) diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp index 80ab9c6aa1..2e4bb2ff26 100644 --- a/platform/haiku/os_haiku.cpp +++ b/platform/haiku/os_haiku.cpp @@ -28,10 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "drivers/gles3/rasterizer_gles3.h" - #include "os_haiku.h" +#include "drivers/gles2/rasterizer_gles2.h" #include "main/main.h" #include "servers/physics/physics_server_sw.h" #include "servers/visual/visual_server_raster.h" @@ -78,7 +77,7 @@ int OS_Haiku::get_video_driver_count() const { } const char *OS_Haiku::get_video_driver_name(int p_driver) const { - return "GLES3"; + return "GLES2"; } int OS_Haiku::get_current_video_driver() const { @@ -112,9 +111,9 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p context_gl->initialize(); context_gl->make_current(); context_gl->set_use_vsync(current_video_mode.use_vsync); - RasterizerGLES3::register_config(); - RasterizerGLES3::make_current(); - + // FIXME: That's not how the rasterizer setup should happen. + RasterizerGLES2::register_config(); + RasterizerGLES2::make_current(); #endif visual_server = memnew(VisualServerRaster); diff --git a/platform/haiku/platform_config.h b/platform/haiku/platform_config.h index 2df3c05f36..f2d5418adf 100644 --- a/platform/haiku/platform_config.h +++ b/platform/haiku/platform_config.h @@ -33,5 +33,4 @@ // for ifaddrs.h needed in drivers/unix/ip_unix.cpp #define _BSD_SOURCE 1 -#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h" #define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h" 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<EditorExportPreset> 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<String> 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 <alloca.h> #define GLES2_INCLUDE_H <ES2/gl.h> -#define GLES3_INCLUDE_H <ES3/gl.h> #define PLATFORM_REFCOUNT diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 6e1f7d749b..c44a0270ab 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -271,11 +271,9 @@ void EditorExportPlatformJavaScript::get_preset_features(const Ref<EditorExportP 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"); - } } } } diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index f657ef483e..d22e53e7ea 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -32,7 +32,6 @@ #include "core/io/file_access_buffered_fa.h" #include "drivers/gles2/rasterizer_gles2.h" -#include "drivers/gles3/rasterizer_gles3.h" #include "drivers/unix/dir_access_unix.h" #include "drivers/unix/file_access_unix.h" #include "main/main.h" @@ -825,8 +824,6 @@ int OS_JavaScript::get_video_driver_count() const { const char *OS_JavaScript::get_video_driver_name(int p_driver) const { switch (p_driver) { - case VIDEO_DRIVER_GLES3: - return "GLES3"; case VIDEO_DRIVER_GLES2: return "GLES2"; } @@ -908,41 +905,14 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, set_window_per_pixel_transparency_enabled(true); } - bool gles3 = true; - if (p_video_driver == VIDEO_DRIVER_GLES2) { - gles3 = false; - } - bool gl_initialization_error = false; - while (true) { - if (gles3) { - if (RasterizerGLES3::is_viable() == OK) { - attributes.majorVersion = 2; - RasterizerGLES3::register_config(); - RasterizerGLES3::make_current(); - break; - } else { - if (GLOBAL_GET("rendering/quality/driver/fallback_to_gles2")) { - p_video_driver = VIDEO_DRIVER_GLES2; - gles3 = false; - continue; - } else { - gl_initialization_error = true; - break; - } - } - } else { - if (RasterizerGLES2::is_viable() == OK) { - attributes.majorVersion = 1; - RasterizerGLES2::register_config(); - RasterizerGLES2::make_current(); - break; - } else { - gl_initialization_error = true; - break; - } - } + if (RasterizerGLES2::is_viable() == OK) { + attributes.majorVersion = 1; + RasterizerGLES2::register_config(); + RasterizerGLES2::make_current(); + } else { + gl_initialization_error = true; } EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(GODOT_CANVAS_SELECTOR, &attributes); @@ -951,9 +921,8 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, } if (gl_initialization_error) { - OS::get_singleton()->alert("Your browser does not support any of the supported WebGL versions.\n" - "Please update your browser version.", - "Unable to initialize Video driver"); + OS::get_singleton()->alert("Your browser does not seem to support WebGL. Please update your browser version.", + "Unable to initialize video driver"); return ERR_UNAVAILABLE; } diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 00fc56def6..bfd13be43a 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -78,8 +78,6 @@ public: int key_event_pos; bool force_quit; - // rasterizer seems to no longer be given to visual server, its using GLES3 directly? - //Rasterizer *rasterizer; VisualServer *visual_server; List<String> args; diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h index 046512ae84..155f37ed55 100644 --- a/platform/osx/platform_config.h +++ b/platform/osx/platform_config.h @@ -30,6 +30,5 @@ #include <alloca.h> -#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h" #define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h" #define PTHREAD_RENAME_SELF diff --git a/platform/uwp/app.h b/platform/uwp/app.h index 302d9759b3..b7265ad086 100644 --- a/platform/uwp/app.h +++ b/platform/uwp/app.h @@ -34,7 +34,6 @@ #include <wrl.h> -// ANGLE doesn't provide a specific lib for GLES3, so we keep using GLES2 #include "GLES2/gl2.h" #include "os_uwp.h" diff --git a/platform/uwp/context_egl_uwp.h b/platform/uwp/context_egl_uwp.h index 7a41685867..fa61cf50c6 100644 --- a/platform/uwp/context_egl_uwp.h +++ b/platform/uwp/context_egl_uwp.h @@ -45,7 +45,7 @@ class ContextEGL_UWP { public: enum Driver { GLES_2_0, - GLES_3_0, + VULKAN, // FIXME: Add Vulkan support. }; private: diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index d5047b53ab..9748c1ef9f 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -36,7 +36,6 @@ #include "core/io/marshalls.h" #include "core/project_settings.h" #include "drivers/gles2/rasterizer_gles2.h" -#include "drivers/gles3/rasterizer_gles3.h" #include "drivers/unix/ip_unix.h" #include "drivers/windows/dir_access_windows.h" #include "drivers/windows/file_access_windows.h" @@ -186,71 +185,33 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a main_loop = NULL; outside = true; + // FIXME: Hardcoded for now, add Vulkan support. + p_video_driver = VIDEO_DRIVER_GLES2; ContextEGL_UWP::Driver opengl_api_type = ContextEGL_UWP::GLES_2_0; - if (p_video_driver == VIDEO_DRIVER_GLES2) { - opengl_api_type = ContextEGL_UWP::GLES_2_0; - } - bool gl_initialization_error = false; - gl_context = NULL; - while (!gl_context) { - gl_context = memnew(ContextEGL_UWP(window, opengl_api_type)); - - if (gl_context->initialize() != OK) { - memdelete(gl_context); - gl_context = NULL; - - if (GLOBAL_GET("rendering/quality/driver/fallback_to_gles2")) { - if (p_video_driver == VIDEO_DRIVER_GLES2) { - gl_initialization_error = true; - break; - } - - p_video_driver = VIDEO_DRIVER_GLES2; - opengl_api_type = ContextEGL_UWP::GLES_2_0; - } else { - gl_initialization_error = true; - break; - } - } - } + gl_context = memnew(ContextEGL_UWP(window, opengl_api_type)); - while (true) { - if (opengl_api_type == ContextEGL_UWP::GLES_3_0) { - if (RasterizerGLES3::is_viable() == OK) { - RasterizerGLES3::register_config(); - RasterizerGLES3::make_current(); - break; - } else { - if (GLOBAL_GET("rendering/quality/driver/fallback_to_gles2")) { - p_video_driver = VIDEO_DRIVER_GLES2; - opengl_api_type = ContextEGL_UWP::GLES_2_0; - continue; - } else { - gl_initialization_error = true; - break; - } - } - } + if (gl_context->initialize() != OK) { + memdelete(gl_context); + gl_context = NULL; + gl_initialization_error = true; + } - if (opengl_api_type == ContextEGL_UWP::GLES_2_0) { - if (RasterizerGLES2::is_viable() == OK) { - RasterizerGLES2::register_config(); - RasterizerGLES2::make_current(); - break; - } else { - gl_initialization_error = true; - break; - } + if (opengl_api_type == ContextEGL_UWP::GLES_2_0) { + 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 video card driver does not support any of the supported OpenGL versions.\n" "Please update your drivers or if you have a very old or integrated GPU upgrade it.", - "Unable to initialize Video driver"); + "Unable to initialize video driver"); return ERR_UNAVAILABLE; } diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h index 04653ee56c..290decac5f 100644 --- a/platform/windows/platform_config.h +++ b/platform/windows/platform_config.h @@ -29,8 +29,5 @@ /*************************************************************************/ #include <malloc.h> -//#else -//#include <alloca.h> -//#endif -#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h" + #define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h" diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index 3b88af28e4..5442af3bef 100644 --- a/platform/x11/context_gl_x11.cpp +++ b/platform/x11/context_gl_x11.cpp @@ -166,29 +166,11 @@ Error ContextGL_X11::initialize() { int (*oldHandler)(Display *, XErrorEvent *) = XSetErrorHandler(&ctxErrorHandler); switch (context_type) { - case OLDSTYLE: { - - p->glx_context = glXCreateContext(x11_display, vi, 0, GL_TRUE); - ERR_FAIL_COND_V(!p->glx_context, ERR_UNCONFIGURED); - } break; case GLES_2_0_COMPATIBLE: { p->glx_context = glXCreateNewContext(x11_display, fbconfig, GLX_RGBA_TYPE, 0, true); ERR_FAIL_COND_V(!p->glx_context, ERR_UNCONFIGURED); } break; - case GLES_3_0_COMPATIBLE: { - - static int context_attribs[] = { - GLX_CONTEXT_MAJOR_VERSION_ARB, 3, - GLX_CONTEXT_MINOR_VERSION_ARB, 3, - GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB, - GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB /*|GLX_CONTEXT_DEBUG_BIT_ARB*/, - None - }; - - p->glx_context = glXCreateContextAttribsARB(x11_display, fbconfig, NULL, true, context_attribs); - ERR_FAIL_COND_V(ctxErrorOccurred || !p->glx_context, ERR_UNCONFIGURED); - } break; } swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone); diff --git a/platform/x11/context_gl_x11.h b/platform/x11/context_gl_x11.h index 5e5ccc5c86..2c0643c95a 100644 --- a/platform/x11/context_gl_x11.h +++ b/platform/x11/context_gl_x11.h @@ -45,15 +45,12 @@ class ContextGL_X11 { public: enum ContextType { - OLDSTYLE, GLES_2_0_COMPATIBLE, - GLES_3_0_COMPATIBLE }; private: ContextGL_X11_Private *p; OS::VideoMode default_video_mode; - //::Colormap x11_colormap; ::Display *x11_display; ::Window &x11_window; bool double_buffer; diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h index c905ddb236..ac30519132 100644 --- a/platform/x11/platform_config.h +++ b/platform/x11/platform_config.h @@ -36,5 +36,4 @@ #define PTHREAD_BSD_SET_NAME #endif -#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h" #define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h" |