diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-11-22 20:47:07 +0100 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2014-12-12 09:41:07 +0100 |
commit | f9a00808991b01f5c3b473e9ec5d309b25b230b9 (patch) | |
tree | db6e749ef685d842c76d3bd46fa9d3e33b163564 | |
parent | 88508e9f4081a9b0008793dbe90c65f6b96c0f0f (diff) |
Default to threaded when using opengl32
This appplies only when using opengl32.dll. When using ANGLE or
when using another non-opengl32 DLL, the "windows" single-threaded
loop is chosen, just like before.
One badly written autotest is fixed. We must never assume that
performing some QQuickWindow related work will leave a context
current on the main thread. The assumption worked by accident with
the single-threaded render loop.
[ChangeLog][QtQuick] Changed to use the threaded render loop by
default on Windows when running with desktop OpenGL (opengl32.dll).
Change-Id: I21798622c19ca510a97a96c19c1e70e29f086e3a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 7 | ||||
-rw-r--r-- | tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp | 12 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index ecfbe0323c..985be8591f 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -169,7 +169,12 @@ QSGRenderLoop *QSGRenderLoop::instance() RenderLoopType loopType = BasicRenderLoop; #ifdef Q_OS_WIN - loopType = WindowsRenderLoop; + // With desktop OpenGL (opengl32.dll), use threaded. Otherwise (ANGLE) use windows. + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL + && QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL)) + loopType = ThreadedRenderLoop; + else + loopType = WindowsRenderLoop; #else if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL)) loopType = ThreadedRenderLoop; diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp index ed97123644..535a875be0 100644 --- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp +++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp @@ -36,6 +36,9 @@ #include <private/qabstractanimation_p.h> #include <private/qquickanimatedsprite_p.h> #include <QtGui/qpainter.h> +#include <QtGui/qopenglcontext.h> +#include <QtGui/qopenglfunctions.h> +#include <QtGui/qoffscreensurface.h> class tst_qquickanimatedsprite : public QQmlDataTest { @@ -251,7 +254,14 @@ void tst_qquickanimatedsprite::test_largeAnimation() prevFrame = frame; } int maxTextureSize; - ::glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); + QOpenGLContext ctx; + ctx.create(); + QOffscreenSurface offscreenSurface; + offscreenSurface.setFormat(ctx.format()); + offscreenSurface.create(); + QVERIFY(ctx.makeCurrent(&offscreenSurface)); + ctx.functions()->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); + ctx.doneCurrent(); maxTextureSize /= 512; QVERIFY(maxFrame > maxTextureSize); // make sure we go beyond the texture width limitation QCOMPARE(loopCounter, sprite->loops()); |