diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-11 14:51:40 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-11 17:24:39 +0200 |
commit | 13374ceb165c44658aa97890c37b206859c9a31c (patch) | |
tree | 562362b196a459ee3449a5a1e60e5216a9dd6984 /src/quick/scenegraph/qsgwindowsrenderloop.cpp | |
parent | ae47deba4c943c496412530a8d2a5a688ae12038 (diff) | |
parent | b5d18be5a03406d0aac83856dd41e1525fd14a28 (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I2963c1209316fb6755f572969f368970450d7991
Diffstat (limited to 'src/quick/scenegraph/qsgwindowsrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgwindowsrenderloop.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index 95df700a15..220c70c299 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -62,6 +62,10 @@ QT_BEGIN_NAMESPACE +// Single-threaded render loop with a custom animation driver. Like a +// combination of basic+threaded but still working on the main thread. Only +// compatible with direct OpenGL, no RHI support here. + extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha); #define RLDEBUG(x) qCDebug(QSG_LOG_RENDERLOOP, x) @@ -188,8 +192,14 @@ void QSGWindowsRenderLoop::show(QQuickWindow *window) RLDEBUG(" - making current"); bool current = m_gl->makeCurrent(window); RLDEBUG(" - initializing SG"); - if (current) - m_rc->initialize(m_gl); + if (current) { + QSGDefaultRenderContext::InitParams rcParams; + rcParams.sampleCount = qMax(1, m_gl->format().samples()); + rcParams.openGLContext = m_gl; + rcParams.initialSurfacePixelSize = window->size() * window->effectiveDevicePixelRatio(); + rcParams.maybeSurface = window; + m_rc->initialize(&rcParams); + } } WindowData data; @@ -440,10 +450,16 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window) if (!m_gl->isValid()) { d->cleanupNodesOnShutdown(); m_rc->invalidate(); - if (m_gl->create() && m_gl->makeCurrent(window)) - m_rc->initialize(m_gl); - else + if (m_gl->create() && m_gl->makeCurrent(window)) { + QSGDefaultRenderContext::InitParams rcParams; + rcParams.sampleCount = qMax(1, m_gl->format().samples()); + rcParams.openGLContext = m_gl; + rcParams.initialSurfacePixelSize = window->size() * window->effectiveDevicePixelRatio(); + rcParams.maybeSurface = window; + m_rc->initialize(&rcParams); + } else { return; + } } } |