use egl_create_surface everywhere

This commit is contained in:
twinaphex 2015-11-20 13:43:05 +01:00
parent fc0f5f8889
commit 2f151896eb
8 changed files with 10 additions and 62 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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)