mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
use egl_create_surface everywhere
This commit is contained in:
parent
fc0f5f8889
commit
2f151896eb
@ -232,12 +232,14 @@ bool egl_create_context(EGLint *egl_attribs)
|
||||
bool egl_create_surface(NativeWindowType native_window)
|
||||
{
|
||||
g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_egl_config, native_window, NULL);
|
||||
if (!g_egl_surf)
|
||||
if (!g_egl_surf || g_egl_surf == EGL_NO_SURFACE)
|
||||
return false;
|
||||
|
||||
/* Connect the context to the surface. */
|
||||
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx))
|
||||
return false;
|
||||
|
||||
RARCH_LOG("[EGL]: Current context: %p.\n", (void*)eglGetCurrentContext());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -82,13 +82,7 @@ static bool android_gfx_ctx_init(void *data)
|
||||
goto error;
|
||||
}
|
||||
|
||||
g_egl_surf = eglCreateWindowSurface(g_egl_dpy,
|
||||
g_egl_config, android_app->window, 0);
|
||||
if (!g_egl_surf)
|
||||
goto error;
|
||||
|
||||
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf,
|
||||
g_egl_surf, g_egl_ctx))
|
||||
if (!egl_create_surface(android_app->window))
|
||||
goto error;
|
||||
|
||||
return true;
|
||||
|
@ -214,18 +214,8 @@ static bool gfx_ctx_qnx_init(void *data)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_egl_config, screen_win, 0)))
|
||||
{
|
||||
RARCH_ERR("eglCreateWindowSurface failed.\n");
|
||||
if (!egl_create_surface(screen_win))
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx))
|
||||
{
|
||||
RARCH_ERR("eglMakeCurrent failed.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -141,13 +141,7 @@ static bool gfx_ctx_emscripten_init(void *data)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* create an EGL window surface. */
|
||||
g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_egl_config, 0, NULL);
|
||||
if (!g_egl_surf)
|
||||
goto error;
|
||||
|
||||
/* Connect the context to the surface. */
|
||||
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx))
|
||||
if (!egl_create_surface(0))
|
||||
goto error;
|
||||
|
||||
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &width);
|
||||
|
@ -172,17 +172,8 @@ static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_egl_config, &native_window, 0)) == EGL_NO_SURFACE)
|
||||
{
|
||||
RARCH_ERR("eglCreateWindowSurface failed.\n");
|
||||
if (!egl_create_surface(&native_window))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx))
|
||||
{
|
||||
RARCH_ERR("eglMakeCurrent failed.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -135,19 +135,9 @@ static bool gfx_ctx_vivante_set_video_mode(void *data,
|
||||
}
|
||||
|
||||
window = fbCreateWindow(fbGetDisplayByIndex(0), 0, 0, 0, 0);
|
||||
g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_egl_config, window, 0);
|
||||
|
||||
if (g_egl_surf == EGL_NO_SURFACE)
|
||||
{
|
||||
RARCH_ERR("eglCreateWindowSurface failed.\n");
|
||||
if (!egl_create_surface(window))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx))
|
||||
{
|
||||
RARCH_ERR("eglMakeCurrent failed.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -504,16 +504,9 @@ static bool gfx_ctx_wl_set_video_mode(void *data,
|
||||
goto error;
|
||||
}
|
||||
|
||||
g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_egl_config,
|
||||
(EGLNativeWindowType)wl->g_win, NULL);
|
||||
if (!g_egl_surf)
|
||||
if (!egl_create_surface((EGLNativeWindowType)wl->g_win))
|
||||
goto error;
|
||||
|
||||
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx))
|
||||
goto error;
|
||||
|
||||
RARCH_LOG("[Wayland/EGL]: Current context: %p.\n", (void*)eglGetCurrentContext());
|
||||
|
||||
egl_set_swap_interval(data, g_interval);
|
||||
|
||||
if (fullscreen)
|
||||
|
@ -295,15 +295,9 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
goto error;
|
||||
}
|
||||
|
||||
g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_egl_config, (EGLNativeWindowType)g_x11_win, NULL);
|
||||
if (!g_egl_surf)
|
||||
if (!egl_create_surface((EGLNativeWindowType)g_x11_win))
|
||||
goto error;
|
||||
|
||||
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx))
|
||||
goto error;
|
||||
|
||||
RARCH_LOG("[X/EGL]: Current context: %p.\n", (void*)eglGetCurrentContext());
|
||||
|
||||
x11_set_window_attr(g_x11_dpy, g_x11_win);
|
||||
|
||||
if (fullscreen)
|
||||
|
Loading…
x
Reference in New Issue
Block a user