(drm_egl_ctx.c) Start using egl_create_context

This commit is contained in:
twinaphex 2015-11-19 18:18:44 +01:00
parent c1e61f7ff0
commit 033e0ac3ad
3 changed files with 26 additions and 13 deletions

View File

@ -204,3 +204,24 @@ bool egl_init_context(NativeDisplayType display,
return true;
}
bool egl_create_context(EGLint *attr, EGLint *egl_attribs)
{
g_egl_ctx = eglCreateContext(g_egl_dpy, g_egl_config, EGL_NO_CONTEXT,
(attr != egl_attribs) ? egl_attribs : NULL);
if (g_egl_ctx == EGL_NO_CONTEXT)
return false;
if (g_use_hw_ctx)
{
g_egl_hw_ctx = eglCreateContext(g_egl_dpy, g_egl_config, g_egl_ctx,
(attr != egl_attribs) ? egl_attribs : NULL);
RARCH_LOG("[EGL]: Created shared context: %p.\n", (void*)g_egl_hw_ctx);
if (g_egl_hw_ctx == EGL_NO_CONTEXT)
return false;;
}
return true;
}

View File

@ -55,4 +55,6 @@ bool egl_init_context(NativeDisplayType display,
EGLint *major, EGLint *minor,
EGLint *n, const EGLint *attrib_ptr);
bool egl_create_context(EGLint *attr, EGLint *egl_attribs);
#endif

View File

@ -731,20 +731,10 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data,
attr = egl_fill_attribs(egl_attribs);
g_egl_ctx = eglCreateContext(g_egl_dpy, g_egl_config, EGL_NO_CONTEXT,
attr != egl_attribs ? egl_attribs : NULL);
if (g_egl_ctx == EGL_NO_CONTEXT)
goto error;
if (g_use_hw_ctx)
if (!egl_create_context(attr, &egl_attribs[0]))
{
g_egl_hw_ctx = eglCreateContext(g_egl_dpy, g_egl_config, g_egl_ctx,
attr != egl_attribs ? egl_attribs : NULL);
RARCH_LOG("[KMS/EGL]: Created shared context: %p.\n", (void*)g_egl_hw_ctx);
if (g_egl_hw_ctx == EGL_NO_CONTEXT)
goto error;
egl_report_error();
goto error;
}
g_egl_surf = eglCreateWindowSurface(g_egl_dpy,