Clean up the EGL related video backends (X11, Android, RPi)
parent
a4a7c78ce8
commit
35915d4f99
|
@ -209,9 +209,7 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa
|
|||
}
|
||||
|
||||
/* We need to select a config here to satisfy some video backends such as X11 */
|
||||
SDL_EGL_ChooseConfig(_this);
|
||||
|
||||
return 0;
|
||||
return SDL_EGL_ChooseConfig(_this);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -399,9 +397,6 @@ SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
|
|||
_this->egl_data->eglDestroyContext(_this->egl_data->egl_display, egl_context);
|
||||
}
|
||||
|
||||
/* FIXME: This "crappy fix" comes from the X11 code,
|
||||
* it's required so you can create a GLX context, destroy it and create a EGL one */
|
||||
SDL_EGL_UnloadLibrary(_this);
|
||||
}
|
||||
|
||||
EGLSurface *
|
||||
|
|
|
@ -72,6 +72,7 @@ Android_CreateWindow(_THIS, SDL_Window * window)
|
|||
data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window);
|
||||
|
||||
if (data->egl_surface == EGL_NO_SURFACE) {
|
||||
ANativeWindow_release(data->native_window);
|
||||
SDL_free(data);
|
||||
return SDL_SetError("Could not create GLES window surface");
|
||||
}
|
||||
|
@ -102,6 +103,9 @@ Android_DestroyWindow(_THIS, SDL_Window * window)
|
|||
|
||||
if(window->driverdata) {
|
||||
data = (SDL_WindowData *) window->driverdata;
|
||||
if (data->egl_surface != EGL_NO_SURFACE) {
|
||||
SDL_EGL_DestroySurface(_this, data->egl_surface);
|
||||
}
|
||||
if(data->native_window) {
|
||||
ANativeWindow_release(data->native_window);
|
||||
}
|
||||
|
|
|
@ -281,6 +281,22 @@ RPI_CreateWindow(_THIS, SDL_Window * window)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
RPI_DestroyWindow(_THIS, SDL_Window * window)
|
||||
{
|
||||
SDL_WindowData *data;
|
||||
|
||||
if(window->driverdata) {
|
||||
data = (SDL_WindowData *) window->driverdata;
|
||||
if (data->egl_surface != EGL_NO_SURFACE) {
|
||||
SDL_EGL_DestroySurface(_this, data->egl_surface);
|
||||
data->egl_surface = EGL_NO_SURFACE;
|
||||
}
|
||||
SDL_free(window->driverdata);
|
||||
window->driverdata = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
RPI_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
|
||||
{
|
||||
|
@ -331,10 +347,6 @@ void
|
|||
RPI_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
|
||||
{
|
||||
|
||||
}
|
||||
void
|
||||
RPI_DestroyWindow(_THIS, SDL_Window * window)
|
||||
{
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -100,6 +100,19 @@ 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)
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
Loading…
Reference in New Issue