From 97d05b0da8ca22e3f4119888dcbe7dce4ed26901 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 9 Dec 2016 05:12:27 -0800 Subject: [PATCH] Fixed a bunch of SwapWindow calls that needed their return value updated --- src/video/android/SDL_androidgl.c | 4 ++-- src/video/android/SDL_androidgl.h | 2 +- src/video/emscripten/SDL_emscriptenopengles.h | 2 +- src/video/nacl/SDL_naclopengles.c | 7 +++++-- src/video/nacl/SDL_naclopengles.h | 2 +- src/video/psp/SDL_pspgl.c | 4 +++- src/video/raspberry/SDL_rpiopengles.h | 2 +- src/video/raspberry/SDL_rpivideo.h | 2 +- src/video/vivante/SDL_vivanteopengles.h | 2 +- src/video/wayland/SDL_waylandopengles.c | 8 +++++--- src/video/wayland/SDL_waylandopengles.h | 2 +- src/video/windows/SDL_windowsopengles.h | 2 +- src/video/winrt/SDL_winrtopengles.h | 2 +- 13 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/video/android/SDL_androidgl.c b/src/video/android/SDL_androidgl.c index 008d8c6cc39c6..c3758f29d3fad 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 21d4df0250a40..e3893158c6889 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 edafed82202fd..4ef420bb85887 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 e11245135c84c..1521b4758038a 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 1845e81915d67..9da9439bac046 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 a07b24e687194..d1d4af095e8ff 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 83c8000674631..e2e0bc8acca3b 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 74dcf9414695d..63020d46a94d2 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 f47bf7797a3fb..b369d31a3ff3c 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 6803dbe63d0f8..302bd68f1f7bc 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 6c3f1f38479ba..ca79eccaa54db 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 dbdf5f6a17b18..5c672d490224c 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 1da757b6cf378..a7092a9cfcd10 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);