Fixed bug 3100 - SetSwapInterval should now be enabled for ANGLE/EGL
authorSam Lantinga <slouken@libsdl.org>
Mon, 09 Jan 2017 10:10:33 -0800
changeset 10800f3439b0eb486
parent 10799 234f71894a52
child 10801 4e2e979bdbee
Fixed bug 3100 - SetSwapInterval should now be enabled for ANGLE/EGL

Mark Logan 2015-08-24 15:57:50 UTC
In SDL_windowsopengles.c, WIN_GLES_SetSwapInterval is as follows:

WIN_GLES_SetSwapInterval(_THIS, int interval)
{
/* FIXME: This should call SDL_EGL_SetSwapInterval, but ANGLE has a bug that prevents this
* from working if we do (the window contents freeze and don't swap properly). So, we ignore
* the request for now.
*/
SDL_Log("WARNING: Ignoring SDL_GL_SetSwapInterval call due to ANGLE bug");
return 0;
}

With a recent version of ANGLE (early July) calling SDL_EGL_SetSwapInterval with a D3D11 backend appears to work just fine. I am working on testing this with D3D9.

--

Alex Szpakowski

I found the bug, it was fixed in 2013. https://bugs.chromium.org/p/angleproject/issues/detail?id=481

In my opinion it should be safe to unconditionally use SetSwapInterval now. Anyone who encounters the bug should update their ANGLE to a version less than 3 years old, especially since they'd be using a SDL version that's 3+ years newer than their ANGLE version.
src/video/windows/SDL_windowsopengles.c
src/video/windows/SDL_windowsopengles.h
     1.1 --- a/src/video/windows/SDL_windowsopengles.c	Mon Jan 09 06:00:58 2017 -0500
     1.2 +++ b/src/video/windows/SDL_windowsopengles.c	Mon Jan 09 10:10:33 2017 -0800
     1.3 @@ -126,17 +126,6 @@
     1.4      return WIN_GLES_MakeCurrent(_this, current_win, current_ctx);    
     1.5  }
     1.6  
     1.7 -int
     1.8 -WIN_GLES_SetSwapInterval(_THIS, int interval)
     1.9 -{
    1.10 -    /* FIXME: This should call SDL_EGL_SetSwapInterval, but ANGLE has a bug that prevents this
    1.11 -     * from working if we do (the window contents freeze and don't swap properly). So, we ignore
    1.12 -     * the request for now.
    1.13 -     */
    1.14 -    SDL_Log("WARNING: Ignoring SDL_GL_SetSwapInterval call due to ANGLE bug");
    1.15 -    return 0;
    1.16 -}
    1.17 -
    1.18  #endif /* SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL */
    1.19  
    1.20  /* vi: set ts=4 sw=4 expandtab: */
     2.1 --- a/src/video/windows/SDL_windowsopengles.h	Mon Jan 09 06:00:58 2017 -0500
     2.2 +++ b/src/video/windows/SDL_windowsopengles.h	Mon Jan 09 10:10:33 2017 -0800
     2.3 @@ -33,9 +33,7 @@
     2.4  #define WIN_GLES_GetProcAddress SDL_EGL_GetProcAddress
     2.5  #define WIN_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
     2.6  #define WIN_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
     2.7 -/* See the WIN_GLES_GetSwapInterval implementation to see why this is commented out */
     2.8 -/*#define WIN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval*/
     2.9 -extern int WIN_GLES_SetSwapInterval(_THIS, int interval);
    2.10 +#define WIN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
    2.11  
    2.12  extern int WIN_GLES_LoadLibrary(_THIS, const char *path);
    2.13  extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window * window);