diff options
Diffstat (limited to 'platform/osx/os_osx.mm')
-rw-r--r-- | platform/osx/os_osx.mm | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 41cfada723..79d7ec410a 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1276,8 +1276,6 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core); } - video_driver_index = p_video_driver; - ADD_ATTR2(NSOpenGLPFAColorSize, colorBits); /* @@ -1333,22 +1331,58 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a /*** END OSX INITIALIZATION ***/ - // only opengl support here... + bool gles3 = true; if (p_video_driver == VIDEO_DRIVER_GLES2) { - RasterizerGLES2::register_config(); - RasterizerGLES2::make_current(); - } else { - RasterizerGLES3::register_config(); - RasterizerGLES3::make_current(); + gles3 = false; } + bool editor = Engine::get_singleton()->is_editor_hint(); + bool gl_initialization_error = false; + + while (true) { + if (gles3) { + if (RasterizerGLES3::is_viable() == OK) { + RasterizerGLES3::register_config(); + RasterizerGLES3::make_current(); + break; + } else { + if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best" || editor) { + p_video_driver = VIDEO_DRIVER_GLES2; + gles3 = 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; + } + } + } + + 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"); + return ERR_UNAVAILABLE; + } + + video_driver_index = p_video_driver; + visual_server = memnew(VisualServerRaster); if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) { visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD)); } - visual_server->init(); + visual_server->init(); AudioDriverManager::initialize(p_audio_driver); input = memnew(InputDefault); |