mirror of
https://github.com/libretro/RetroArch
synced 2025-03-22 07:21:15 +00:00
(Android) Start using egl_create_context
This commit is contained in:
parent
033e0ac3ad
commit
f84c58e777
@ -205,10 +205,10 @@ bool egl_init_context(NativeDisplayType display,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool egl_create_context(EGLint *attr, EGLint *egl_attribs)
|
bool egl_create_context(EGLint *egl_attribs)
|
||||||
{
|
{
|
||||||
g_egl_ctx = eglCreateContext(g_egl_dpy, g_egl_config, EGL_NO_CONTEXT,
|
g_egl_ctx = eglCreateContext(g_egl_dpy, g_egl_config, EGL_NO_CONTEXT,
|
||||||
(attr != egl_attribs) ? egl_attribs : NULL);
|
egl_attribs);
|
||||||
|
|
||||||
if (g_egl_ctx == EGL_NO_CONTEXT)
|
if (g_egl_ctx == EGL_NO_CONTEXT)
|
||||||
return false;
|
return false;
|
||||||
@ -216,7 +216,7 @@ bool egl_create_context(EGLint *attr, EGLint *egl_attribs)
|
|||||||
if (g_use_hw_ctx)
|
if (g_use_hw_ctx)
|
||||||
{
|
{
|
||||||
g_egl_hw_ctx = eglCreateContext(g_egl_dpy, g_egl_config, g_egl_ctx,
|
g_egl_hw_ctx = eglCreateContext(g_egl_dpy, g_egl_config, g_egl_ctx,
|
||||||
(attr != egl_attribs) ? egl_attribs : NULL);
|
egl_attribs);
|
||||||
RARCH_LOG("[EGL]: Created shared context: %p.\n", (void*)g_egl_hw_ctx);
|
RARCH_LOG("[EGL]: Created shared context: %p.\n", (void*)g_egl_hw_ctx);
|
||||||
|
|
||||||
if (g_egl_hw_ctx == EGL_NO_CONTEXT)
|
if (g_egl_hw_ctx == EGL_NO_CONTEXT)
|
||||||
|
@ -55,6 +55,6 @@ bool egl_init_context(NativeDisplayType display,
|
|||||||
EGLint *major, EGLint *minor,
|
EGLint *major, EGLint *minor,
|
||||||
EGLint *n, const EGLint *attrib_ptr);
|
EGLint *n, const EGLint *attrib_ptr);
|
||||||
|
|
||||||
bool egl_create_context(EGLint *attr, EGLint *egl_attribs);
|
bool egl_create_context(EGLint *egl_attribs);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -76,22 +76,10 @@ static bool android_gfx_ctx_init(void *data)
|
|||||||
|
|
||||||
ANativeWindow_setBuffersGeometry(android_app->window, 0, 0, format);
|
ANativeWindow_setBuffersGeometry(android_app->window, 0, 0, format);
|
||||||
|
|
||||||
g_egl_ctx = eglCreateContext(g_egl_dpy,
|
if (!egl_create_context(context_attributes))
|
||||||
g_egl_config, EGL_NO_CONTEXT, context_attributes);
|
|
||||||
|
|
||||||
if (g_egl_ctx == EGL_NO_CONTEXT)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (g_use_hw_ctx)
|
|
||||||
{
|
{
|
||||||
g_egl_hw_ctx = eglCreateContext(g_egl_dpy,
|
egl_report_error();
|
||||||
g_egl_config, g_egl_ctx,
|
goto error;
|
||||||
context_attributes);
|
|
||||||
RARCH_LOG("[Android/EGL]: Created shared context: %p.\n",
|
|
||||||
(void*)g_egl_hw_ctx);
|
|
||||||
|
|
||||||
if (g_egl_hw_ctx == EGL_NO_CONTEXT)
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_egl_surf = eglCreateWindowSurface(g_egl_dpy,
|
g_egl_surf = eglCreateWindowSurface(g_egl_dpy,
|
||||||
|
@ -722,6 +722,7 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!egl_init_context((EGLNativeDisplayType)drm->g_gbm_dev, &major,
|
if (!egl_init_context((EGLNativeDisplayType)drm->g_gbm_dev, &major,
|
||||||
&minor, &n, attrib_ptr))
|
&minor, &n, attrib_ptr))
|
||||||
{
|
{
|
||||||
@ -730,8 +731,9 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
attr = egl_fill_attribs(egl_attribs);
|
attr = egl_fill_attribs(egl_attribs);
|
||||||
|
EGLint *egl_attribs_ptr = &egl_attribs[0];
|
||||||
|
|
||||||
if (!egl_create_context(attr, &egl_attribs[0]))
|
if (!egl_create_context((attr != egl_attribs_ptr) ? egl_attribs_ptr : NULL))
|
||||||
{
|
{
|
||||||
egl_report_error();
|
egl_report_error();
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user