Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Have our EGL interface use our logging functions.
  • Loading branch information
Sonicadvance1 committed Apr 23, 2013
1 parent c2e0b9e commit f28efc2
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions Source/Core/DolphinWX/Src/GLInterface/EGL.cpp
Expand Up @@ -71,14 +71,14 @@ bool cInterfaceEGL::Create(void *&window_handle)
GLWin.egl_dpy = Platform.EGLGetDisplay();

if (!GLWin.egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
INFO_LOG(VIDEO, "Error: eglGetDisplay() failed\n");
return false;
}

GLWin.platform = Platform.platform;

if (!eglInitialize(GLWin.egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
INFO_LOG(VIDEO, "Error: eglInitialize() failed\n");
return false;
}

Expand All @@ -89,28 +89,28 @@ bool cInterfaceEGL::Create(void *&window_handle)
#endif

if (!eglChooseConfig( GLWin.egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
exit(1);
}

if (!Platform.Init(config))
return false;

s = eglQueryString(GLWin.egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
INFO_LOG(VIDEO, "EGL_VERSION = %s\n", s);

s = eglQueryString(GLWin.egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
INFO_LOG(VIDEO, "EGL_VENDOR = %s\n", s);

s = eglQueryString(GLWin.egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
INFO_LOG(VIDEO, "EGL_EXTENSIONS = %s\n", s);

s = eglQueryString(GLWin.egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
INFO_LOG(VIDEO, "EGL_CLIENT_APIS = %s\n", s);

GLWin.egl_ctx = eglCreateContext(GLWin.egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs );
if (!GLWin.egl_ctx) {
printf("Error: eglCreateContext failed\n");
INFO_LOG(VIDEO, "Error: eglCreateContext failed\n");
exit(1);
}

Expand All @@ -119,20 +119,20 @@ bool cInterfaceEGL::Create(void *&window_handle)
GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config,
GLWin.native_window, NULL);
if (!GLWin.egl_surf) {
printf("Error: eglCreateWindowSurface failed\n");
INFO_LOG(VIDEO, "Error: eglCreateWindowSurface failed\n");
exit(1);
}

if (!eglMakeCurrent(GLWin.egl_dpy, GLWin.egl_surf, GLWin.egl_surf, GLWin.egl_ctx)) {

printf("Error: eglMakeCurrent() failed\n");
INFO_LOG(VIDEO, "Error: eglMakeCurrent() failed\n");
return false;
}

printf("GL_VENDOR: %s\n", glGetString(GL_VENDOR));
printf("GL_RENDERER: %s\n", glGetString(GL_RENDERER));
printf("GL_VERSION: %s\n", glGetString(GL_VERSION));
printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));
INFO_LOG(VIDEO, "GL_VENDOR: %s\n", glGetString(GL_VENDOR));
INFO_LOG(VIDEO, "GL_RENDERER: %s\n", glGetString(GL_RENDERER));
INFO_LOG(VIDEO, "GL_VERSION: %s\n", glGetString(GL_VERSION));
INFO_LOG(VIDEO, "GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));

Platform.ToggleFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);

Expand All @@ -152,9 +152,13 @@ void cInterfaceEGL::Shutdown()
NOTICE_LOG(VIDEO, "Could not release drawing context.");
if (GLWin.egl_ctx)
{
eglDestroyContext(GLWin.egl_dpy, GLWin.egl_ctx);
eglDestroySurface(GLWin.egl_dpy, GLWin.egl_surf);
eglTerminate(GLWin.egl_dpy);
eglMakeCurrent(GLWin.egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if(!eglDestroyContext(GLWin.egl_dpy, GLWin.egl_ctx))
NOTICE_LOG(VIDEO, "Could not destroy drawing context.");
if(!eglDestroySurface(GLWin.egl_dpy, GLWin.egl_surf))
NOTICE_LOG(VIDEO, "Could not destroy window surface.");
if(!eglTerminate(GLWin.egl_dpy))
NOTICE_LOG(VIDEO, "Could not destroy display connection.");
GLWin.egl_ctx = NULL;
}
}

0 comments on commit f28efc2

Please sign in to comment.