From 8043a1a75aedc89af53859d187632fab7ed83f46 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 26 Aug 2021 18:29:16 +0200 Subject: rhi: gl: Set the screen on the context, if possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Take the screen from the window, if the window was specified. When it comes to Qt Quick, this is in fact required in order to make the behavior on par with Qt 5, see https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/quick/scenegraph/qsgthreadedrenderloop.cpp?h=5.15#n1336 try to mirror that in Qt 6 as well. There are still subtle differences between Qt 5 and Qt 6 in particular when qt_gl_global_share_context is set (do we set the screen from that or from the window?), for now leave that question unsettled. What exactly setting the screen on the context does is platform specific, and can become relevant with multi screen, multi GPU systems. Pick-to: 6.2 Change-Id: Icc90b8fea87bf1e34ecf1dec0702f4d3c411db00 Reviewed-by: Christian Strømme --- src/gui/rhi/qrhigles2.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 523269740c..e611bde2f3 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -484,6 +484,8 @@ bool QRhiGles2::create(QRhi::Flags flags) } else if (QOpenGLContext *shareContext = qt_gl_global_share_context()) { ctx->setShareContext(shareContext); ctx->setScreen(shareContext->screen()); + } else if (maybeWindow) { + ctx->setScreen(maybeWindow->screen()); } if (!ctx->create()) { qWarning("QRhiGles2: Failed to create context"); -- cgit v1.2.3