mirror of https://github.com/encounter/SDL.git
cleanup error-handling in SDL_egl.c
- always set error message in SDL_EGL_ChooseConfig / SDL_EGL_CreateContext - assume SDL_EGL_DeleteContext does not alter the error message - sync generic error message of SDL_EGL_MakeCurrent with SDL_EGL_Get/SetSwapInterval - do not overwrite error message of SDL_EGL_ChooseConfig in WINRT_CreateWindow
This commit is contained in:
parent
b5c5052608
commit
3bef4a5da6
|
@ -909,8 +909,7 @@ SDL_EGL_ChooseConfig(_THIS)
|
|||
int ret;
|
||||
|
||||
if (!_this->egl_data) {
|
||||
/* The EGL library wasn't loaded, SDL_GetError() should have info */
|
||||
return -1;
|
||||
return SDL_SetError("EGL not initialized");
|
||||
}
|
||||
|
||||
/* Try with EGL_CONFIG_CAVEAT set to EGL_NONE, to avoid any EGL_SLOW_CONFIG or EGL_NON_CONFORMANT_CONFIG */
|
||||
|
@ -943,7 +942,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
|
|||
SDL_bool profile_es = (profile_mask == SDL_GL_CONTEXT_PROFILE_ES);
|
||||
|
||||
if (!_this->egl_data) {
|
||||
/* The EGL library wasn't loaded, SDL_GetError() should have info */
|
||||
SDL_SetError("EGL not initialized");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1044,16 +1043,8 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
|
|||
_this->egl_data->egl_swapinterval = 0;
|
||||
|
||||
if (SDL_EGL_MakeCurrent(_this, egl_surface, egl_context) < 0) {
|
||||
/* Save the SDL error set by SDL_EGL_MakeCurrent */
|
||||
char errorText[1024];
|
||||
SDL_strlcpy(errorText, SDL_GetError(), SDL_arraysize(errorText));
|
||||
|
||||
/* Delete the context, which may alter the value returned by SDL_GetError() */
|
||||
/* Delete the context */
|
||||
SDL_EGL_DeleteContext(_this, egl_context);
|
||||
|
||||
/* Restore the SDL error */
|
||||
SDL_SetError("%s", errorText);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1096,7 +1087,7 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
|
|||
EGLContext egl_context = (EGLContext) context;
|
||||
|
||||
if (!_this->egl_data) {
|
||||
return SDL_SetError("OpenGL not initialized");
|
||||
return SDL_SetError("EGL not initialized");
|
||||
}
|
||||
|
||||
if (!_this->egl_data->eglMakeCurrent) {
|
||||
|
@ -1104,7 +1095,7 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
|
|||
/* Can't do the nothing there is to do? Probably trying to cleanup a failed startup, just return. */
|
||||
return 0;
|
||||
} else {
|
||||
return SDL_SetError("OpenGL not initialized"); /* something clearly went wrong somewhere. */
|
||||
return SDL_SetError("EGL not initialized"); /* something clearly went wrong somewhere. */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -670,9 +670,8 @@ WINRT_CreateWindow(_THIS, SDL_Window * window)
|
|||
* be passed into eglCreateWindowSurface.
|
||||
*/
|
||||
if (SDL_EGL_ChooseConfig(_this) != 0) {
|
||||
char buf[512];
|
||||
SDL_snprintf(buf, sizeof(buf), "SDL_EGL_ChooseConfig failed: %s", SDL_GetError());
|
||||
return SDL_SetError("%s", buf);
|
||||
/* SDL_EGL_ChooseConfig failed, SDL_GetError() should have info */
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (video_data->winrtEglWindow) { /* ... is the 'old' version of ANGLE/WinRT being used? */
|
||||
|
|
Loading…
Reference in New Issue