Add "Force-disable sRGB FBO" option for buggy Intel OpenGL drivers

on Windows - should hopefully fix messed up colors with it enabled (untested)
This commit is contained in:
twinaphex 2014-09-21 05:23:51 +02:00
parent 45a31c9969
commit 395e2ed756
5 changed files with 18 additions and 0 deletions

View File

@ -266,6 +266,7 @@ struct settings
bool allow_rotate; bool allow_rotate;
bool shared_context; bool shared_context;
bool force_srgb_disable;
} video; } video;
#ifdef HAVE_MENU #ifdef HAVE_MENU

View File

@ -516,6 +516,9 @@ static void gl_create_fbo_textures(gl_t *gl)
RARCH_ERR("[GL]: sRGB FBO was requested, but it is not supported. Falling back to UNORM. Result may have banding!\n"); RARCH_ERR("[GL]: sRGB FBO was requested, but it is not supported. Falling back to UNORM. Result may have banding!\n");
} }
if (g_settings.video.force_srgb_disable)
srgb_fbo = false;
#ifndef HAVE_OPENGLES2 #ifndef HAVE_OPENGLES2
if (fp_fbo && gl->has_fp_fbo) if (fp_fbo && gl->has_fp_fbo)
{ {
@ -1874,6 +1877,9 @@ static bool resolve_extensions(gl_t *gl)
#endif #endif
#endif #endif
if (g_settings.video.force_srgb_disable)
gl->has_srgb_fbo = false;
#ifdef GL_DEBUG #ifdef GL_DEBUG
// Useful for debugging, but kinda obnoxious otherwise. // Useful for debugging, but kinda obnoxious otherwise.
RARCH_LOG("[GL]: Supported extensions:\n"); RARCH_LOG("[GL]: Supported extensions:\n");

View File

@ -124,6 +124,10 @@
# Video vsync. # Video vsync.
# video_vsync = true # video_vsync = true
# Forcibly disable sRGB FBO support. Some Intel OpenGL drivers on Windows
# have video problems with sRGB FBO support enabled.
# video_force_srgb_disable = false
# Attempts to hard-synchronize CPU and GPU. Can reduce latency at cost of performance. # Attempts to hard-synchronize CPU and GPU. Can reduce latency at cost of performance.
# video_hard_sync = false # video_hard_sync = false

View File

@ -306,6 +306,7 @@ void config_set_defaults(void)
g_settings.video.threaded = g_defaults.settings.video_threaded_enable; g_settings.video.threaded = g_defaults.settings.video_threaded_enable;
g_settings.video.shared_context = video_shared_context; g_settings.video.shared_context = video_shared_context;
g_settings.video.force_srgb_disable = false;
#ifdef GEKKO #ifdef GEKKO
g_settings.video.viwidth = video_viwidth; g_settings.video.viwidth = video_viwidth;
#endif #endif
@ -430,6 +431,7 @@ void config_set_defaults(void)
g_extern.console.screen.viewports.custom_vp.x = 0; g_extern.console.screen.viewports.custom_vp.x = 0;
g_extern.console.screen.viewports.custom_vp.y = 0; g_extern.console.screen.viewports.custom_vp.y = 0;
/* Make sure settings from other configs carry over into defaults /* Make sure settings from other configs carry over into defaults
* for another config. */ * for another config. */
if (!g_extern.has_set_save_path) if (!g_extern.has_set_save_path)
@ -930,6 +932,8 @@ bool config_load_file(const char *path, bool set_defaults)
CONFIG_GET_FLOAT(video.msg_pos_y, "video_message_pos_y"); CONFIG_GET_FLOAT(video.msg_pos_y, "video_message_pos_y");
CONFIG_GET_INT(video.rotation, "video_rotation"); CONFIG_GET_INT(video.rotation, "video_rotation");
CONFIG_GET_BOOL(video.force_srgb_disable, "video_force_srgb_disable");
#ifdef RARCH_CONSOLE #ifdef RARCH_CONSOLE
/* TODO - will be refactored later to make it more clean - it's more /* TODO - will be refactored later to make it more clean - it's more
* important that it works for consoles right now */ * important that it works for consoles right now */
@ -1451,6 +1455,8 @@ bool config_save_file(const char *path)
config_set_bool(conf, "video_threaded", g_settings.video.threaded); config_set_bool(conf, "video_threaded", g_settings.video.threaded);
config_set_bool(conf, "video_shared_context", config_set_bool(conf, "video_shared_context",
g_settings.video.shared_context); g_settings.video.shared_context);
config_set_bool(conf, "video_force_srgb_disable",
g_settings.video.force_srgb_disable);
config_set_bool(conf, "video_fullscreen", g_settings.video.fullscreen); config_set_bool(conf, "video_fullscreen", g_settings.video.fullscreen);
config_set_float(conf, "video_refresh_rate", g_settings.video.refresh_rate); config_set_float(conf, "video_refresh_rate", g_settings.video.refresh_rate);
config_set_int(conf, "video_monitor_index", config_set_int(conf, "video_monitor_index",

View File

@ -2413,6 +2413,7 @@ rarch_setting_t *setting_data_get_list(void)
CONFIG_UINT(g_settings.video.fullscreen_y, "video_fullscreen_y", "Fullscreen Height", fullscreen_y, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) CONFIG_UINT(g_settings.video.fullscreen_y, "video_fullscreen_y", "Fullscreen Height", fullscreen_y, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_FLOAT(g_settings.video.refresh_rate, "video_refresh_rate", "Refresh Rate", refresh_rate, "%.3f Hz", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 0, 0.001, true, false) CONFIG_FLOAT(g_settings.video.refresh_rate, "video_refresh_rate", "Refresh Rate", refresh_rate, "%.3f Hz", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 0, 0.001, true, false)
CONFIG_FLOAT(g_settings.video.refresh_rate, "video_refresh_rate_auto", "Estimated Monitor FPS", refresh_rate, "%.3f Hz", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) CONFIG_FLOAT(g_settings.video.refresh_rate, "video_refresh_rate_auto", "Estimated Monitor FPS", refresh_rate, "%.3f Hz", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(g_settings.video.force_srgb_disable, "video_force_srgb_disable", "Force-disable sRGB FBO", false, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_CMD(RARCH_CMD_REINIT)
END_SUB_GROUP() END_SUB_GROUP()
START_SUB_GROUP("Aspect", GROUP_NAME) START_SUB_GROUP("Aspect", GROUP_NAME)