The gl_data is optional for the driver, so don't early out of the context delete call if it doesn't exist.
This commit is contained in:
parent
af57171b72
commit
8c71219642
4 changed files with 47 additions and 25 deletions
|
@ -2639,7 +2639,7 @@ SDL_GL_SwapWindow(SDL_Window * window)
|
||||||
void
|
void
|
||||||
SDL_GL_DeleteContext(SDL_GLContext context)
|
SDL_GL_DeleteContext(SDL_GLContext context)
|
||||||
{
|
{
|
||||||
if (!_this || !_this->gl_data || !context) {
|
if (!_this || !context) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_this->GL_MakeCurrent(_this, NULL, NULL);
|
_this->GL_MakeCurrent(_this, NULL, NULL);
|
||||||
|
|
|
@ -613,6 +613,11 @@ WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
if (!_this->gl_data) {
|
||||||
|
SDL_SetError("OpenGL not initialized");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (window) {
|
if (window) {
|
||||||
hdc = ((SDL_WindowData *) window->driverdata)->hdc;
|
hdc = ((SDL_WindowData *) window->driverdata)->hdc;
|
||||||
} else {
|
} else {
|
||||||
|
@ -666,6 +671,9 @@ WIN_GL_SwapWindow(_THIS, SDL_Window * window)
|
||||||
void
|
void
|
||||||
WIN_GL_DeleteContext(_THIS, SDL_GLContext context)
|
WIN_GL_DeleteContext(_THIS, SDL_GLContext context)
|
||||||
{
|
{
|
||||||
|
if (!_this->gl_data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
_this->gl_data->wglDeleteContext((HGLRC) context);
|
_this->gl_data->wglDeleteContext((HGLRC) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -610,6 +610,11 @@ X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
||||||
GLXContext glx_context = (GLXContext) context;
|
GLXContext glx_context = (GLXContext) context;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
if (!_this->gl_data) {
|
||||||
|
SDL_SetError("OpenGL not initialized");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
status = 0;
|
status = 0;
|
||||||
if (!_this->gl_data->glXMakeCurrent(display, drawable, glx_context)) {
|
if (!_this->gl_data->glXMakeCurrent(display, drawable, glx_context)) {
|
||||||
SDL_SetError("Unable to make GL context current");
|
SDL_SetError("Unable to make GL context current");
|
||||||
|
@ -714,6 +719,9 @@ X11_GL_DeleteContext(_THIS, SDL_GLContext context)
|
||||||
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
|
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
|
||||||
GLXContext glx_context = (GLXContext) context;
|
GLXContext glx_context = (GLXContext) context;
|
||||||
|
|
||||||
|
if (!_this->gl_data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
_this->gl_data->glXDestroyContext(display, glx_context);
|
_this->gl_data->glXDestroyContext(display, glx_context);
|
||||||
XSync(display, False);
|
XSync(display, False);
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,6 +358,11 @@ X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
||||||
// SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
// SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||||
// Display *display = data->videodata->display;
|
// Display *display = data->videodata->display;
|
||||||
|
|
||||||
|
if (!_this->gles_data) {
|
||||||
|
SDL_SetError("OpenGL not initialized");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
retval = 1;
|
retval = 1;
|
||||||
if (!_this->gles_data->eglMakeCurrent(_this->gles_data->egl_display,
|
if (!_this->gles_data->eglMakeCurrent(_this->gles_data->egl_display,
|
||||||
_this->gles_data->egl_surface,
|
_this->gles_data->egl_surface,
|
||||||
|
@ -412,32 +417,33 @@ void
|
||||||
X11_GLES_DeleteContext(_THIS, SDL_GLContext context)
|
X11_GLES_DeleteContext(_THIS, SDL_GLContext context)
|
||||||
{
|
{
|
||||||
/* Clean up GLES and EGL */
|
/* Clean up GLES and EGL */
|
||||||
if (_this->gles_data) {
|
if (!_this->gles_data) {
|
||||||
if (_this->gles_data->egl_context != EGL_NO_CONTEXT ||
|
return;
|
||||||
_this->gles_data->egl_surface != EGL_NO_SURFACE) {
|
|
||||||
_this->gles_data->eglMakeCurrent(_this->gles_data->egl_display,
|
|
||||||
EGL_NO_SURFACE, EGL_NO_SURFACE,
|
|
||||||
EGL_NO_CONTEXT);
|
|
||||||
|
|
||||||
if (_this->gles_data->egl_context != EGL_NO_CONTEXT) {
|
|
||||||
_this->gles_data->eglDestroyContext(_this->gles_data->egl_display,
|
|
||||||
_this->gles_data->
|
|
||||||
egl_context);
|
|
||||||
_this->gles_data->egl_context = EGL_NO_CONTEXT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_this->gles_data->egl_surface != EGL_NO_SURFACE) {
|
|
||||||
_this->gles_data->eglDestroySurface(_this->gles_data->egl_display,
|
|
||||||
_this->gles_data->
|
|
||||||
egl_surface);
|
|
||||||
_this->gles_data->egl_surface = EGL_NO_SURFACE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* crappy fix */
|
|
||||||
X11_GLES_UnloadLibrary(_this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_this->gles_data->egl_context != EGL_NO_CONTEXT ||
|
||||||
|
_this->gles_data->egl_surface != EGL_NO_SURFACE) {
|
||||||
|
_this->gles_data->eglMakeCurrent(_this->gles_data->egl_display,
|
||||||
|
EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||||
|
EGL_NO_CONTEXT);
|
||||||
|
|
||||||
|
if (_this->gles_data->egl_context != EGL_NO_CONTEXT) {
|
||||||
|
_this->gles_data->eglDestroyContext(_this->gles_data->egl_display,
|
||||||
|
_this->gles_data->
|
||||||
|
egl_context);
|
||||||
|
_this->gles_data->egl_context = EGL_NO_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this->gles_data->egl_surface != EGL_NO_SURFACE) {
|
||||||
|
_this->gles_data->eglDestroySurface(_this->gles_data->egl_display,
|
||||||
|
_this->gles_data->
|
||||||
|
egl_surface);
|
||||||
|
_this->gles_data->egl_surface = EGL_NO_SURFACE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* crappy fix */
|
||||||
|
X11_GLES_UnloadLibrary(_this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_ES */
|
#endif /* SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_ES */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue