diff --git a/doc/changelog.dox b/doc/changelog.dox index 2834686af..dcba6fcb0 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -725,6 +725,9 @@ See also: case as for a WebGL-enabled context - Fixed a crash in @ref Platform::GlfwApplication::setCursor() on the upcoming GLFW 3.4 +- Fixed @ref Platform::Sdl2Application::setSwapInterval() to take late swap + behavior (@cpp -1 @ce) into account instead of treating it as an error + and continuing with timer-based framerate capping - @ref SceneGraph::BasicMatrixTransformation2D, @ref SceneGraph::BasicMatrixTransformation3D, @ref SceneGraph::BasicRigidMatrixTransformation2D and diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index 73053b600..c1d6fa8be 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -781,8 +781,11 @@ bool Sdl2Application::setSwapInterval(const Int interval) { return false; } - if(SDL_GL_GetSwapInterval() != interval) { - Error() << "Platform::Sdl2Application::setSwapInterval(): swap interval setting ignored by the driver"; + /* Setting interval to 1 may cause SDL_GL_GetSwapInterval() to return -1, + which is a valid case */ + const Int actualInterval = SDL_GL_GetSwapInterval(); + if(actualInterval != interval && !(interval == 1 && actualInterval == -1)) { + Error() << "Platform::Sdl2Application::setSwapInterval(): swap interval setting ignored by the driver:" << SDL_GetError(); _flags &= ~Flag::VSyncEnabled; return false; }