From 9095952ac4f4859a522b7d08a0d1bb489a1f1d8c Mon Sep 17 00:00:00 2001 From: Gabriel Jacobo Date: Wed, 20 Nov 2013 12:51:18 -0300 Subject: [PATCH] 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 | 14 +------------- src/video/x11/SDL_x11opengles.h | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/video/x11/SDL_x11opengles.c b/src/video/x11/SDL_x11opengles.c index f5947e4e07e16..71517a80cbd30 100644 --- a/src/video/x11/SDL_x11opengles.c +++ b/src/video/x11/SDL_x11opengles.c @@ -36,6 +36,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path) { /* 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 @@ X11_GLES_CreateContext(_THIS, SDL_Window * window) 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) diff --git a/src/video/x11/SDL_x11opengles.h b/src/video/x11/SDL_x11opengles.h index 9574e1c2bb1c6..978f91f3d4695 100644 --- a/src/video/x11/SDL_x11opengles.h +++ b/src/video/x11/SDL_x11opengles.h @@ -38,13 +38,13 @@ typedef struct SDL_PrivateGLESData #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 */