diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-08-27 16:54:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-27 16:54:22 +0200 |
commit | c1f687c6818883f70c2b7f85577c51ed5ad65c08 (patch) | |
tree | 68bf6b19674bd54ab6662a12cfd6aee37a4a4d83 /drivers/gles3 | |
parent | 78bb53f85d97d3a5b66d9005732c3c07c1f0e636 (diff) | |
parent | 08f452d1a95d7f171472c33a60983d95adf1665d (diff) |
Merge pull request #21387 from hpvb/fix-15324
Fall back to GLES2 if GLES3 is not working
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/rasterizer_gles3.cpp | 23 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_gles3.h | 3 |
2 files changed, 15 insertions, 11 deletions
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 0d42635194..e4824695d5 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -136,28 +136,32 @@ typedef void (*DEBUGPROCARB)(GLenum source, typedef void (*DebugMessageCallbackARB)(DEBUGPROCARB callback, const void *userParam); -void RasterizerGLES3::initialize() { - - print_verbose("Using GLES3 video driver"); +Error RasterizerGLES3::is_viable() { #ifdef GLAD_ENABLED if (!gladLoadGL()) { ERR_PRINT("Error initializing GLAD"); + return ERR_UNAVAILABLE; } // GLVersion seems to be used for both GL and GL ES, so we need different version checks for them #ifdef OPENGL_ENABLED // OpenGL 3.3 Core Profile required - if (GLVersion.major < 3 && GLVersion.minor < 3) { + if (GLVersion.major < 3 || (GLVersion.major == 3 && GLVersion.minor < 3)) { #else // OpenGL ES 3.0 if (GLVersion.major < 3) { #endif - ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 3.3 / OpenGL ES 3.0, sorry :(\n" - "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault."); - OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 3.3 / OpenGL ES 3.0, sorry :(\n" - "Godot Engine will self-destruct as soon as you acknowledge this error message.", - "Fatal error: Insufficient OpenGL / GLES driver support"); + return ERR_UNAVAILABLE; } +#endif // GLAD_ENABLED + return OK; +} + +void RasterizerGLES3::initialize() { + + print_verbose("Using GLES3 video driver"); + +#ifdef GLAD_ENABLED if (OS::get_singleton()->is_stdout_verbose()) { if (GLAD_GL_ARB_debug_output) { glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB); @@ -167,7 +171,6 @@ void RasterizerGLES3::initialize() { print_line("OpenGL debugging not supported!"); } } - #endif // GLAD_ENABLED /* // For debugging diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h index f4449ac0f9..0a264caf8f 100644 --- a/drivers/gles3/rasterizer_gles3.h +++ b/drivers/gles3/rasterizer_gles3.h @@ -62,9 +62,10 @@ public: virtual void end_frame(bool p_swap_buffers); virtual void finalize(); + static Error is_viable(); static void make_current(); - static void register_config(); + RasterizerGLES3(); ~RasterizerGLES3(); }; |