Only bind shared context if necessary.

This commit is contained in:
Themaister 2014-04-19 16:59:26 +02:00
parent 1cbb47229a
commit 095718c855
2 changed files with 6 additions and 3 deletions

View File

@ -1916,6 +1916,8 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl)
const char *api_name = "OpenGL"; const char *api_name = "OpenGL";
#endif #endif
gl->shared_context_use = g_settings.video.shared_context && cb->context_type != RETRO_HW_CONTEXT_NONE;
if (*g_settings.video.gl_context) if (*g_settings.video.gl_context)
{ {
const gfx_ctx_driver_t *ctx = gfx_ctx_find_driver(g_settings.video.gl_context); const gfx_ctx_driver_t *ctx = gfx_ctx_find_driver(g_settings.video.gl_context);
@ -1929,7 +1931,7 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl)
// Enables or disables offscreen HW context. // Enables or disables offscreen HW context.
if (ctx->bind_hw_render) if (ctx->bind_hw_render)
ctx->bind_hw_render(gl, g_settings.video.shared_context && cb->context_type != RETRO_HW_CONTEXT_NONE); ctx->bind_hw_render(gl, gl->shared_context_use);
if (!ctx->init(gl)) if (!ctx->init(gl))
{ {
@ -1946,7 +1948,7 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl)
return ctx; return ctx;
} }
else else
return gfx_ctx_init_first(gl, api, major, minor, cb->context_type != RETRO_HW_CONTEXT_NONE); return gfx_ctx_init_first(gl, api, major, minor, gl->shared_context_use);
} }
#ifdef GL_DEBUG #ifdef GL_DEBUG

View File

@ -45,7 +45,7 @@
#define context_swap_buffers_func(gl) gl->ctx_driver->swap_buffers(gl) #define context_swap_buffers_func(gl) gl->ctx_driver->swap_buffers(gl)
#define context_swap_interval_func(gl, var) gl->ctx_driver->swap_interval(gl, var) #define context_swap_interval_func(gl, var) gl->ctx_driver->swap_interval(gl, var)
#define context_has_focus_func(gl) gl->ctx_driver->has_focus(gl) #define context_has_focus_func(gl) gl->ctx_driver->has_focus(gl)
#define context_bind_hw_render(gl, enable) if (gl->hw_render_use && gl->ctx_driver->bind_hw_render) gl->ctx_driver->bind_hw_render(gl, enable) #define context_bind_hw_render(gl, enable) if (gl->shared_context_use && gl->ctx_driver->bind_hw_render) gl->ctx_driver->bind_hw_render(gl, enable)
#define context_check_window_func(gl, quit, resize, width, height, frame_count) \ #define context_check_window_func(gl, quit, resize, width, height, frame_count) \
gl->ctx_driver->check_window(gl, quit, resize, width, height, frame_count) gl->ctx_driver->check_window(gl, quit, resize, width, height, frame_count)
@ -179,6 +179,7 @@ typedef struct gl
bool has_fp_fbo; bool has_fp_fbo;
#endif #endif
bool hw_render_use; bool hw_render_use;
bool shared_context_use;
bool should_resize; bool should_resize;
bool quitting; bool quitting;