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.
main
Gabriel Jacobo 2013-11-20 12:51:18 -03:00
parent 2f30140418
commit 9095952ac4
2 changed files with 2 additions and 14 deletions

View File

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

View File

@ -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 */