diff --git a/gfx/gl.c b/gfx/gl.c index 77cb55af7a..2b52a6196a 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1916,6 +1916,8 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl) const char *api_name = "OpenGL"; #endif + gl->shared_context_use = g_settings.video.shared_context && cb->context_type != RETRO_HW_CONTEXT_NONE; + if (*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. 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)) { @@ -1946,7 +1948,7 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl) return ctx; } 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 diff --git a/gfx/gl_common.h b/gfx/gl_common.h index fbd43788e0..734d38e47b 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -45,7 +45,7 @@ #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_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) \ gl->ctx_driver->check_window(gl, quit, resize, width, height, frame_count) @@ -179,6 +179,7 @@ typedef struct gl bool has_fp_fbo; #endif bool hw_render_use; + bool shared_context_use; bool should_resize; bool quitting;