Simplify gl_get_context

This commit is contained in:
twinaphex 2018-10-09 16:46:40 +02:00
parent f277489efc
commit a27bce38cd

View File

@ -1506,31 +1506,38 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl)
struct retro_hw_render_callback *hwr = video_driver_get_hw_context(); struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
unsigned major = hwr->version_major; unsigned major = hwr->version_major;
unsigned minor = hwr->version_minor; unsigned minor = hwr->version_minor;
enum retro_hw_context_type ctx_type = hwr->context_type;
bool hw_context_in_use = ctx_type != RETRO_HW_CONTEXT_NONE;
#ifdef HAVE_OPENGLES #ifdef HAVE_OPENGLES
api = GFX_CTX_OPENGL_ES_API; api = GFX_CTX_OPENGL_ES_API;
api_name = "OpenGL ES 2.0"; api_name = "OpenGL ES 2.0";
if (hwr->context_type == RETRO_HW_CONTEXT_OPENGLES3) switch (ctx_type)
{ {
major = 3; case RETRO_HW_CONTEXT_OPENGLES3:
minor = 0; major = 3;
api_name = "OpenGL ES 3.0"; minor = 0;
api_name = "OpenGL ES 3.0";
break;
case RETRO_HW_CONTEXT_OPENGLES_VERSION:
api_name = "OpenGL ES 3.1+";
break;
case RETRO_HW_CONTEXT_NONE:
default:
break;
} }
else if (hwr->context_type == RETRO_HW_CONTEXT_OPENGLES_VERSION)
api_name = "OpenGL ES 3.1+";
#else #else
api = GFX_CTX_OPENGL_API; api = GFX_CTX_OPENGL_API;
api_name = "OpenGL"; api_name = "OpenGL";
#endif #endif
(void)api_name; (void)api_name;
gl_shared_context_use = settings->bools.video_shared_context gl_shared_context_use = settings->bools.video_shared_context
&& hwr->context_type != RETRO_HW_CONTEXT_NONE; && hw_context_in_use;
if ( (libretro_get_shared_context()) if (libretro_get_shared_context() && hw_context_in_use)
&& (hwr->context_type != RETRO_HW_CONTEXT_NONE))
gl_shared_context_use = true; gl_shared_context_use = true;
return video_context_driver_init_first(gl, return video_context_driver_init_first(gl,