summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-08-26 18:29:16 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2021-08-27 18:10:33 +0200
commit8043a1a75aedc89af53859d187632fab7ed83f46 (patch)
treea3bcbcec269e710795abf26c9a47a70e1b025978 /src/gui/rhi
parentf9e9d21a11cdbb7d79daefba10717de39edf9fd1 (diff)
rhi: gl: Set the screen on the context, if possible
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 <christian.stromme@qt.io>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r--src/gui/rhi/qrhigles2.cpp2
1 files changed, 2 insertions, 0 deletions
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");