Clean up X11 OpenGL ES backend
authorGabriel Jacobo <gabomdq@gmail.com>
Wed, 20 Nov 2013 12:51:18 -0300
changeset 8018 cff03048babd
parent 8017 d84a30e5cbd5
child 8019 5d85b2186aae
Clean up X11 OpenGL ES backend If you really need to switch between OpenGL and GLES context types, just issue a SDL_GL_UnloadLibrary manually.
src/video/x11/SDL_x11opengles.c
src/video/x11/SDL_x11opengles.h
--- a/src/video/x11/SDL_x11opengles.c	Tue Nov 19 15:25:00 2013 -0500
+++ b/src/video/x11/SDL_x11opengles.c	Wed Nov 20 12:51:18 2013 -0300
@@ -36,6 +36,7 @@
     /* If the profile requested is not GL ES, switch over to X11_GL functions  */
     if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
         #if SDL_VIDEO_OPENGL_GLX
+        X11_GLES_UnloadLibrary(_this);
         _this->GL_LoadLibrary = X11_GL_LoadLibrary;
         _this->GL_GetProcAddress = X11_GL_GetProcAddress;
         _this->GL_UnloadLibrary = X11_GL_UnloadLibrary;
@@ -100,19 +101,6 @@
     return context;
 }
 
-void
-X11_GLES_DeleteContext(_THIS, SDL_GLContext context)
-{
-    /* FIXME: This "crappy fix" comes from the previous GLES X11 code, 
-     * it's required so you can create a GLX context, destroy it and create a EGL one 
-     * To be able to fix this, we need to add a function SDL_GL_ResetContext and
-     * disallow SDL_GL_MakeCurrent from taking a NULL pointer, thus ensuring we can
-     * determine if it is a GLX or EGL context
-     */
-    SDL_EGL_DeleteContext(_this, context);
-    X11_GLES_UnloadLibrary(_this);
-}
-
 SDL_EGL_SwapWindow_impl(X11)
 SDL_EGL_MakeCurrent_impl(X11)
 
--- a/src/video/x11/SDL_x11opengles.h	Tue Nov 19 15:25:00 2013 -0500
+++ b/src/video/x11/SDL_x11opengles.h	Wed Nov 20 12:51:18 2013 -0300
@@ -38,13 +38,13 @@
 #define X11_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
 #define X11_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
 #define X11_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+#define X11_GLES_DeleteContext SDL_EGL_DeleteContext
 
 extern int X11_GLES_LoadLibrary(_THIS, const char *path);
 extern XVisualInfo *X11_GLES_GetVisual(_THIS, Display * display, int screen);
 extern SDL_GLContext X11_GLES_CreateContext(_THIS, SDL_Window * window);
 extern void X11_GLES_SwapWindow(_THIS, SDL_Window * window);
 extern int X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
-extern void X11_GLES_DeleteContext(_THIS, SDL_GLContext context);
 
 #endif /* SDL_VIDEO_OPENGL_EGL */