mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-19 07:16:21 +00:00
Implement the driver switch enable setting.
This commit is contained in:
parent
73c853def4
commit
24c798f550
49
retroarch.c
49
retroarch.c
@ -4965,7 +4965,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||
command_event_save_auto_state();
|
||||
command_event_disable_overrides();
|
||||
retroarch_unset_runtime_shader_preset();
|
||||
|
||||
|
||||
if (cached_video_driver[0])
|
||||
{
|
||||
settings_t *settings = configuration_settings;
|
||||
@ -7284,6 +7284,43 @@ static bool dynamic_request_hw_context(enum retro_hw_context_type type,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool dynamic_verify_hw_context(enum retro_hw_context_type type,
|
||||
unsigned minor, unsigned major)
|
||||
{
|
||||
settings_t *settings = configuration_settings;
|
||||
const char *video_ident = settings->arrays.video_driver;
|
||||
|
||||
if (settings->bools.driver_switch_enable)
|
||||
return true;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case RETRO_HW_CONTEXT_VULKAN:
|
||||
if (!string_is_equal(video_ident, "vulkan"))
|
||||
return false;
|
||||
break;
|
||||
case RETRO_HW_CONTEXT_OPENGLES2:
|
||||
case RETRO_HW_CONTEXT_OPENGLES3:
|
||||
case RETRO_HW_CONTEXT_OPENGLES_VERSION:
|
||||
case RETRO_HW_CONTEXT_OPENGL:
|
||||
case RETRO_HW_CONTEXT_OPENGL_CORE:
|
||||
if (!string_is_equal(video_ident, "gl") &&
|
||||
!string_is_equal(video_ident, "glcore"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case RETRO_HW_CONTEXT_DIRECT3D:
|
||||
if (!(string_is_equal(video_ident, "d3d11") && major == 11))
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void rarch_log_libretro(enum retro_log_level level,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
@ -7841,7 +7878,9 @@ static bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
unsigned *cb = (unsigned*)data;
|
||||
settings_t *settings = configuration_settings;
|
||||
RARCH_LOG("[Environ]: GET_PREFERRED_HW_RENDER.\n");
|
||||
if (!strcmp(settings->arrays.video_driver, "glcore"))
|
||||
if (!settings->bools.driver_switch_enable)
|
||||
return false;
|
||||
else if (!strcmp(settings->arrays.video_driver, "glcore"))
|
||||
*cb = RETRO_HW_CONTEXT_OPENGL_CORE;
|
||||
else if (!strcmp(settings->arrays.video_driver, "gl"))
|
||||
*cb = RETRO_HW_CONTEXT_OPENGL;
|
||||
@ -7863,11 +7902,15 @@ static bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
video_driver_get_hw_context_internal();
|
||||
|
||||
RARCH_LOG("[Environ]: SET_HW_RENDER.\n");
|
||||
|
||||
|
||||
if (!dynamic_request_hw_context(
|
||||
cb->context_type, cb->version_minor, cb->version_major))
|
||||
return false;
|
||||
|
||||
if (!dynamic_verify_hw_context(
|
||||
cb->context_type, cb->version_minor, cb->version_major))
|
||||
return false;
|
||||
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGL_CORE)
|
||||
if (!gl_set_core_context(cb->context_type)) { }
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user