Create egl_create_surface

This commit is contained in:
twinaphex 2015-11-20 13:36:16 +01:00
parent 1101bb34d3
commit fc0f5f8889
4 changed files with 17 additions and 13 deletions

View File

@ -228,3 +228,16 @@ bool egl_create_context(EGLint *egl_attribs)
return true;
}
bool egl_create_surface(NativeWindowType native_window)
{
g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_egl_config, native_window, NULL);
if (!g_egl_surf)
return false;
/* Connect the context to the surface. */
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx))
return false;
return true;
}

View File

@ -59,4 +59,6 @@ bool egl_init_context(NativeDisplayType display,
bool egl_create_context(EGLint *egl_attribs);
bool egl_create_surface(NativeWindowType native_window);
#endif

View File

@ -737,13 +737,7 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data,
goto error;
}
g_egl_surf = eglCreateWindowSurface(g_egl_dpy,
g_egl_config, (EGLNativeWindowType)drm->g_gbm_surface, NULL);
if (!g_egl_surf)
goto error;
if (!eglMakeCurrent(g_egl_dpy,
g_egl_surf, g_egl_surf, g_egl_ctx))
if (!egl_create_surface((EGLNativeWindowType)drm->g_gbm_surface))
goto error;
glClear(GL_COLOR_BUFFER_BIT);

View File

@ -259,12 +259,7 @@ static bool gfx_ctx_vc_init(void *data)
}
vc_dispmanx_update_submit_sync(dispman_update);
g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_egl_config, &nativewindow, 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(&nativewindow))
goto error;
return true;