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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index e10cf7c..c9fb476 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -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. */
}
}
diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp
index 5b917db..6ed5918 100644
--- a/src/video/winrt/SDL_winrtvideo.cpp
+++ b/src/video/winrt/SDL_winrtvideo.cpp
@@ -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? */