No longer need to grab threaded variable from settings struct

This commit is contained in:
twinaphex 2017-04-29 16:37:49 +02:00
parent 91abbdd4f1
commit 63504cd9c8
4 changed files with 19 additions and 6 deletions

View File

@ -768,7 +768,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("video_scale_integer", &settings->bools.video_scale_integer, true, scale_integer, false); SETTING_BOOL("video_scale_integer", &settings->bools.video_scale_integer, true, scale_integer, false);
SETTING_BOOL("video_smooth", &settings->bools.video_smooth, true, video_smooth, false); SETTING_BOOL("video_smooth", &settings->bools.video_smooth, true, video_smooth, false);
SETTING_BOOL("video_force_aspect", &settings->bools.video_force_aspect, true, force_aspect, false); SETTING_BOOL("video_force_aspect", &settings->bools.video_force_aspect, true, force_aspect, false);
SETTING_BOOL("video_threaded", &settings->bools.video_threaded, true, video_threaded, false); SETTING_BOOL("video_threaded", video_driver_get_threaded(), true, video_threaded, false);
SETTING_BOOL("video_shared_context", &settings->bools.video_shared_context, true, video_shared_context, false); SETTING_BOOL("video_shared_context", &settings->bools.video_shared_context, true, video_shared_context, false);
SETTING_BOOL("auto_screenshot_filename", &settings->bools.auto_screenshot_filename, true, auto_screenshot_filename, false); SETTING_BOOL("auto_screenshot_filename", &settings->bools.auto_screenshot_filename, true, auto_screenshot_filename, false);
SETTING_BOOL("video_force_srgb_disable", &settings->bools.video_force_srgb_disable, true, false, false); SETTING_BOOL("video_force_srgb_disable", &settings->bools.video_force_srgb_disable, true, false, false);
@ -1145,7 +1145,7 @@ static void config_set_defaults(void)
} }
if (g_defaults.settings.video_threaded_enable != video_threaded) if (g_defaults.settings.video_threaded_enable != video_threaded)
settings->bools.video_threaded = g_defaults.settings.video_threaded_enable; video_driver_set_threaded(g_defaults.settings.video_threaded_enable);
settings->floats.video_msg_color_r = ((message_color >> 16) & 0xff) / 255.0f; settings->floats.video_msg_color_r = ((message_color >> 16) & 0xff) / 255.0f;
settings->floats.video_msg_color_g = ((message_color >> 8) & 0xff) / 255.0f; settings->floats.video_msg_color_g = ((message_color >> 8) & 0xff) / 255.0f;

View File

@ -130,6 +130,7 @@ const void *frame_cache_data = NULL;
static unsigned frame_cache_width = 0; static unsigned frame_cache_width = 0;
static unsigned frame_cache_height = 0; static unsigned frame_cache_height = 0;
static size_t frame_cache_pitch = 0; static size_t frame_cache_pitch = 0;
static bool video_driver_threaded = false;
static float video_driver_aspect_ratio = 0.0f; static float video_driver_aspect_ratio = 0.0f;
static unsigned video_driver_width = 0; static unsigned video_driver_width = 0;
@ -349,12 +350,20 @@ static bool hw_render_context_is_gl(enum retro_hw_context_type type)
return false; return false;
} }
bool *video_driver_get_threaded(void)
{
return &video_driver_threaded;
}
void video_driver_set_threaded(bool val)
{
video_driver_threaded = val;
}
bool video_driver_is_threaded(void) bool video_driver_is_threaded(void)
{ {
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
settings_t *settings = config_get_ptr(); if (!video_driver_is_hw_context() && video_driver_threaded)
if (!video_driver_is_hw_context()
&& settings->bools.video_threaded)
return true; return true;
#endif #endif
return false; return false;

View File

@ -606,6 +606,10 @@ void video_driver_get_record_status(
bool *has_gpu_record, bool *has_gpu_record,
uint8_t **gpu_buf); uint8_t **gpu_buf);
bool *video_driver_get_threaded(void);
void video_driver_set_threaded(bool val);
void video_driver_get_status(uint64_t *frame_count, bool * is_alive, void video_driver_get_status(uint64_t *frame_count, bool * is_alive,
bool *is_focused); bool *is_focused);

View File

@ -3498,7 +3498,7 @@ static bool setting_append_list(
#if defined(HAVE_THREADS) #if defined(HAVE_THREADS)
CONFIG_BOOL( CONFIG_BOOL(
list, list_info, list, list_info,
&settings->bools.video_threaded, video_driver_get_threaded(),
MENU_ENUM_LABEL_VIDEO_THREADED, MENU_ENUM_LABEL_VIDEO_THREADED,
MENU_ENUM_LABEL_VALUE_VIDEO_THREADED, MENU_ENUM_LABEL_VALUE_VIDEO_THREADED,
video_threaded, video_threaded,