diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2021-06-04 08:23:26 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2021-06-08 07:56:06 +0200 |
commit | 8e6b4f5d2a12102abe06ea6819da786c7e37de94 (patch) | |
tree | d3003da5137bee58f9e5cb3f9bf7eeb9df5ab962 /src/opengl | |
parent | 6809ee8f3e52187807807fd4ff7f59ec90a8e234 (diff) |
Fix conversion of swap interval from QGLFormat to QSurfaceFormat
When converting a QGLFormat with an unset/default swap interval
we would end up with an invalid swap interval in the resulting
QSurfaceFormat (since -1 is used as the "default" in QGLFormat).
One result of this would be that we would not vsync rendering
with QGLWidget on Wayland by default, since we implement our
own blocking swapBuffers() on Wayland.
Note: This is irrelevant for Qt 6, since QGLWidget no longer
exists.
[ChangeLog][QtOpenGL] Fixed an issue where the default swap
interval of QGLWidget's surface format would be set to an
invalid value.
Task-number: QTBUG-81504
Change-Id: If90708bbd7975d7ae1d27fafa20f837543dd81ee
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qgl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e9744abbfd..0ff5c96f55 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -493,7 +493,8 @@ QSurfaceFormat QGLFormat::toSurfaceFormat(const QGLFormat &format) retFormat.setSamples(format.samples() == -1 ? 4 : format.samples()); if (format.stencil()) retFormat.setStencilBufferSize(format.stencilBufferSize() == -1 ? 1 : format.stencilBufferSize()); - retFormat.setSwapInterval(format.swapInterval()); + if (format.swapInterval() >= 0) + retFormat.setSwapInterval(format.swapInterval()); retFormat.setStereo(format.stereo()); retFormat.setMajorVersion(format.majorVersion()); retFormat.setMinorVersion(format.minorVersion()); |