Make video_shared_context an option.

Might be part of libretro API later if necessary. Must be discussed with
other frontend developers first.
This commit is contained in:
Themaister 2014-04-19 16:37:39 +02:00
parent 5614a77cec
commit 1cbb47229a
6 changed files with 17 additions and 2 deletions

View file

@ -284,6 +284,9 @@ static unsigned swap_interval = 1;
// Threaded video. Will possibly increase performance significantly at cost of worse synchronization and latency.
static const bool video_threaded = false;
// Set to true if HW render cores should get their private context.
static const bool video_shared_context = false;
// Smooths picture
static const bool video_smooth = true;

View file

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

View file

@ -79,7 +79,11 @@ const gfx_ctx_driver_t *gfx_ctx_init_first(void *data, enum gfx_ctx_api api, uns
if (gfx_ctx_drivers[i]->bind_api(data, api, major, minor))
{
if (gfx_ctx_drivers[i]->bind_hw_render)
gfx_ctx_drivers[i]->bind_hw_render(data, hw_render_ctx);
{
gfx_ctx_drivers[i]->bind_hw_render(data,
g_settings.video.shared_context && hw_render_ctx);
}
if (gfx_ctx_drivers[i]->init(data))
return gfx_ctx_drivers[i];
}

View file

@ -1929,7 +1929,7 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl)
// Enables or disables offscreen HW context.
if (ctx->bind_hw_render)
ctx->bind_hw_render(gl, cb->context_type != RETRO_HW_CONTEXT_NONE);
ctx->bind_hw_render(gl, g_settings.video.shared_context && cb->context_type != RETRO_HW_CONTEXT_NONE);
if (!ctx->init(gl))
{

View file

@ -122,6 +122,10 @@
# Use threaded video driver. Using this might improve performance at possible cost of latency and more video stuttering.
# video_threaded = false
# Use a shared context for HW rendered libretro cores.
# Avoids having to assume GL state changes inbetween frames.
# video_shared_context = false
# Smoothens picture with bilinear filtering. Should be disabled if using pixel shaders.
# video_smooth = true

View file

@ -252,6 +252,7 @@ void config_set_defaults(void)
g_settings.video.black_frame_insertion = black_frame_insertion;
g_settings.video.swap_interval = swap_interval;
g_settings.video.threaded = video_threaded;
g_settings.video.shared_context = video_shared_context;
g_settings.video.smooth = video_smooth;
g_settings.video.force_aspect = force_aspect;
g_settings.video.scale_integer = scale_integer;
@ -775,6 +776,7 @@ bool config_load_file(const char *path, bool set_defaults)
g_settings.video.swap_interval = max(g_settings.video.swap_interval, 1);
g_settings.video.swap_interval = min(g_settings.video.swap_interval, 4);
CONFIG_GET_BOOL(video.threaded, "video_threaded");
CONFIG_GET_BOOL(video.shared_context, "video_shared_context");
CONFIG_GET_BOOL(video.smooth, "video_smooth");
CONFIG_GET_BOOL(video.force_aspect, "video_force_aspect");
CONFIG_GET_BOOL(video.scale_integer, "video_scale_integer");
@ -1280,6 +1282,7 @@ bool config_save_file(const char *path)
config_set_bool(conf, "video_scale_integer", g_settings.video.scale_integer);
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
config_set_bool(conf, "video_threaded", g_settings.video.threaded);
config_set_bool(conf, "video_shared_context", g_settings.video.shared_context);
config_set_bool(conf, "video_fullscreen", g_settings.video.fullscreen);
config_set_float(conf, "video_refresh_rate", g_settings.video.refresh_rate);
config_set_int(conf, "video_monitor_index", g_settings.video.monitor_index);