From 3db672a60d09354e7d69306d9d0312e55472a996 Mon Sep 17 00:00:00 2001 From: Autechre Date: Mon, 25 May 2020 21:26:11 +0200 Subject: [PATCH] Revert "Revert "Revert "(video) fix "Allow Cores to Switch the Video Driver OFF" behavior""" --- retroarch.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/retroarch.c b/retroarch.c index 45234ea146..ffd4ba790b 100644 --- a/retroarch.c +++ b/retroarch.c @@ -9946,11 +9946,9 @@ static bool dynamic_verify_hw_context(enum retro_hw_context_type type, case RETRO_HW_CONTEXT_OPENGLES3: case RETRO_HW_CONTEXT_OPENGLES_VERSION: case RETRO_HW_CONTEXT_OPENGL: - if (!string_is_equal(video_ident, "gl")) - return false; - break; case RETRO_HW_CONTEXT_OPENGL_CORE: - if (!string_is_equal(video_ident, "glcore")) + if (!string_is_equal(video_ident, "gl") && + !string_is_equal(video_ident, "glcore")) return false; break; case RETRO_HW_CONTEXT_DIRECT3D: @@ -22342,27 +22340,42 @@ static bool video_driver_find_driver(void) } #endif -#if defined(HAVE_OPENGL) +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGL_CORE) if (hwr && hw_render_context_is_gl(hwr->context_type)) { RARCH_LOG("[Video]: Using HW render, OpenGL driver forced.\n"); - if (!string_is_equal(settings->arrays.video_driver, "gl")) + + /* If we have configured one of the HW render capable GL drivers, go with that. */ + if ( !string_is_equal(settings->arrays.video_driver, "gl") && + !string_is_equal(settings->arrays.video_driver, "glcore")) { RARCH_LOG("[Video]: \"%s\" saved as cached driver.\n", settings->arrays.video_driver); strlcpy(cached_video_driver, settings->arrays.video_driver, sizeof(cached_video_driver)); +#if defined(HAVE_OPENGL_CORE) + RARCH_LOG("[Video]: Forcing \"glcore\" driver.\n"); configuration_set_string(settings, - settings->arrays.video_driver, - "gl"); + settings->arrays.video_driver, "glcore"); + current_video = &video_gl_core; +#else + RARCH_LOG("[Video]: Forcing \"gl\" driver.\n"); + configuration_set_string(settings, + settings->arrays.video_driver, "gl"); + current_video = &video_gl2; +#endif + } + else + { + RARCH_LOG("[Video]: Using configured \"%s\" driver for GL HW render.\n", + settings->arrays.video_driver); } - current_video = &video_gl2; } #endif #if defined(HAVE_OPENGL_CORE) if (hwr && hw_render_context_is_glcore(hwr->context_type)) { - RARCH_LOG("[Video]: Using HW render, core OpenGL driver forced.\n"); + RARCH_LOG("[Video]: Using HW render, OpenGL core driver forced.\n"); if (!string_is_equal(settings->arrays.video_driver, "glcore")) { RARCH_LOG("[Video]: \"%s\" saved as cached driver.\n", settings->arrays.video_driver);