Commit 97d05b0da8ca22e3f4119888dcbe7dce4ed26901

Sam Lantinga 2016-12-09T05:12:27

Fixed a bunch of SwapWindow calls that needed their return value updated

diff --git a/src/video/android/SDL_androidgl.c b/src/video/android/SDL_androidgl.c
index 008d8c6..c3758f2 100644
--- a/src/video/android/SDL_androidgl.c
+++ b/src/video/android/SDL_androidgl.c
@@ -39,7 +39,7 @@
 SDL_EGL_CreateContext_impl(Android)
 SDL_EGL_MakeCurrent_impl(Android)
 
-void
+int
 Android_GLES_SwapWindow(_THIS, SDL_Window * window)
 {
     /* The following two calls existed in the original Java code
@@ -49,7 +49,7 @@ Android_GLES_SwapWindow(_THIS, SDL_Window * window)
     
     /*_this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE);
     _this->egl_data->eglWaitGL();*/
-    SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
+    return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
 }
 
 int
diff --git a/src/video/android/SDL_androidgl.h b/src/video/android/SDL_androidgl.h
index 21d4df0..e389315 100644
--- a/src/video/android/SDL_androidgl.h
+++ b/src/video/android/SDL_androidgl.h
@@ -25,7 +25,7 @@
 
 SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window);
 int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
-void Android_GLES_SwapWindow(_THIS, SDL_Window * window);
+int Android_GLES_SwapWindow(_THIS, SDL_Window * window);
 int Android_GLES_LoadLibrary(_THIS, const char *path);
 
 
diff --git a/src/video/emscripten/SDL_emscriptenopengles.h b/src/video/emscripten/SDL_emscriptenopengles.h
index edafed8..4ef420b 100644
--- a/src/video/emscripten/SDL_emscriptenopengles.h
+++ b/src/video/emscripten/SDL_emscriptenopengles.h
@@ -38,7 +38,7 @@
 extern int Emscripten_GLES_LoadLibrary(_THIS, const char *path);
 extern void Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context);
 extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window * window);
-extern void Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window);
 extern int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
 extern void Emscripten_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h);
 
diff --git a/src/video/nacl/SDL_naclopengles.c b/src/video/nacl/SDL_naclopengles.c
index e112451..1521b47 100644
--- a/src/video/nacl/SDL_naclopengles.c
+++ b/src/video/nacl/SDL_naclopengles.c
@@ -151,12 +151,15 @@ NACL_GLES_GetSwapInterval(_THIS)
     return 0;
 }
 
-void
+int
 NACL_GLES_SwapWindow(_THIS, SDL_Window * window)
 {
     SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
     struct PP_CompletionCallback callback = { NULL, 0, PP_COMPLETIONCALLBACK_FLAG_NONE };
-    driverdata->ppb_graphics->SwapBuffers((PP_Resource) SDL_GL_GetCurrentContext(), callback );
+    if (driverdata->ppb_graphics->SwapBuffers((PP_Resource) SDL_GL_GetCurrentContext(), callback ) != PP_OK) {
+        return SDL_SetError("SwapBuffers failed");
+    }
+    return 0;
 }
 
 void
diff --git a/src/video/nacl/SDL_naclopengles.h b/src/video/nacl/SDL_naclopengles.h
index 1845e81..9da9439 100644
--- a/src/video/nacl/SDL_naclopengles.h
+++ b/src/video/nacl/SDL_naclopengles.h
@@ -30,7 +30,7 @@ extern SDL_GLContext NACL_GLES_CreateContext(_THIS, SDL_Window * window);
 extern int NACL_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
 extern int NACL_GLES_SetSwapInterval(_THIS, int interval);
 extern int NACL_GLES_GetSwapInterval(_THIS);
-extern void NACL_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int NACL_GLES_SwapWindow(_THIS, SDL_Window * window);
 extern void NACL_GLES_DeleteContext(_THIS, SDL_GLContext context);
 
 #endif /* _SDL_naclgl_h */
diff --git a/src/video/psp/SDL_pspgl.c b/src/video/psp/SDL_pspgl.c
index a07b24e..d1d4af0 100644
--- a/src/video/psp/SDL_pspgl.c
+++ b/src/video/psp/SDL_pspgl.c
@@ -177,7 +177,9 @@ PSP_GL_GetSwapInterval(_THIS)
 int
 PSP_GL_SwapWindow(_THIS, SDL_Window * window)
 {
-    eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface);
+    if (!eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface)) {
+        return SDL_SetError("!eglSwapBuffers() failed");
+    }
     return 0;
 }
 
diff --git a/src/video/raspberry/SDL_rpiopengles.h b/src/video/raspberry/SDL_rpiopengles.h
index 83c8000..e2e0bc8 100644
--- a/src/video/raspberry/SDL_rpiopengles.h
+++ b/src/video/raspberry/SDL_rpiopengles.h
@@ -38,7 +38,7 @@
 
 extern int RPI_GLES_LoadLibrary(_THIS, const char *path);
 extern SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window * window);
-extern void RPI_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int RPI_GLES_SwapWindow(_THIS, SDL_Window * window);
 extern int RPI_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
 
 #endif /* SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL */
diff --git a/src/video/raspberry/SDL_rpivideo.h b/src/video/raspberry/SDL_rpivideo.h
index 74dcf94..63020d4 100644
--- a/src/video/raspberry/SDL_rpivideo.h
+++ b/src/video/raspberry/SDL_rpivideo.h
@@ -90,7 +90,7 @@ SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window * window);
 int RPI_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
 int RPI_GLES_SetSwapInterval(_THIS, int interval);
 int RPI_GLES_GetSwapInterval(_THIS);
-void RPI_GLES_SwapWindow(_THIS, SDL_Window * window);
+int RPI_GLES_SwapWindow(_THIS, SDL_Window * window);
 void RPI_GLES_DeleteContext(_THIS, SDL_GLContext context);
 
 #endif /* __SDL_RPIVIDEO_H__ */
diff --git a/src/video/vivante/SDL_vivanteopengles.h b/src/video/vivante/SDL_vivanteopengles.h
index f47bf77..b369d31 100644
--- a/src/video/vivante/SDL_vivanteopengles.h
+++ b/src/video/vivante/SDL_vivanteopengles.h
@@ -38,7 +38,7 @@
 
 extern int VIVANTE_GLES_LoadLibrary(_THIS, const char *path);
 extern SDL_GLContext VIVANTE_GLES_CreateContext(_THIS, SDL_Window * window);
-extern void VIVANTE_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int VIVANTE_GLES_SwapWindow(_THIS, SDL_Window * window);
 extern int VIVANTE_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
 
 #endif /* SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL */
diff --git a/src/video/wayland/SDL_waylandopengles.c b/src/video/wayland/SDL_waylandopengles.c
index 6803dbe..302bd68 100644
--- a/src/video/wayland/SDL_waylandopengles.c
+++ b/src/video/wayland/SDL_waylandopengles.c
@@ -54,14 +54,16 @@ Wayland_GLES_CreateContext(_THIS, SDL_Window * window)
     return context;
 }
 
-void
+int
 Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
 {
-    SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
+    if (SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface) < 0) {
+        return -1;
+    }
     WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
+    return 0;
 }
 
-
 int
 Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
 {
diff --git a/src/video/wayland/SDL_waylandopengles.h b/src/video/wayland/SDL_waylandopengles.h
index 6c3f1f3..ca79ecc 100644
--- a/src/video/wayland/SDL_waylandopengles.h
+++ b/src/video/wayland/SDL_waylandopengles.h
@@ -39,7 +39,7 @@ typedef struct SDL_PrivateGLESData
 
 extern int Wayland_GLES_LoadLibrary(_THIS, const char *path);
 extern SDL_GLContext Wayland_GLES_CreateContext(_THIS, SDL_Window * window);
-extern void Wayland_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int Wayland_GLES_SwapWindow(_THIS, SDL_Window * window);
 extern int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
 extern void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context);
 
diff --git a/src/video/windows/SDL_windowsopengles.h b/src/video/windows/SDL_windowsopengles.h
index dbdf5f6..5c672d4 100644
--- a/src/video/windows/SDL_windowsopengles.h
+++ b/src/video/windows/SDL_windowsopengles.h
@@ -39,7 +39,7 @@ extern int WIN_GLES_SetSwapInterval(_THIS, int interval);
 
 extern int WIN_GLES_LoadLibrary(_THIS, const char *path);
 extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window * window);
-extern void WIN_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int WIN_GLES_SwapWindow(_THIS, SDL_Window * window);
 extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
 extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context);
 extern int WIN_GLES_SetupWindow(_THIS, SDL_Window * window);
diff --git a/src/video/winrt/SDL_winrtopengles.h b/src/video/winrt/SDL_winrtopengles.h
index 1da757b..a7092a9 100644
--- a/src/video/winrt/SDL_winrtopengles.h
+++ b/src/video/winrt/SDL_winrtopengles.h
@@ -38,7 +38,7 @@
 extern int WINRT_GLES_LoadLibrary(_THIS, const char *path);
 extern void WINRT_GLES_UnloadLibrary(_THIS);
 extern SDL_GLContext WINRT_GLES_CreateContext(_THIS, SDL_Window * window);
-extern void WINRT_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int WINRT_GLES_SwapWindow(_THIS, SDL_Window * window);
 extern int WINRT_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);