Why is QtQuick creating multiple Open GL Render Contexts?
-
QtQuick applications creates two Open GL Render Contexts on my machine. It seems that Qt first fails to create a context. It then creates a new context which then is used by the application. The application seems to work as intended. But is this behaviour intended or is it a Qt-bug or an indication that something is wrong with my setup? Take the template QtQuick 2 application as an example:
main.cpp
@
#include <QGuiApplication>
#include <QQmlApplicationEngine>int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec();
}
@main.qml
@
import QtQuick 2.2
import QtQuick.Window 2.1Window {
visible: true
width: 360
height: 360MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } } Text { text: qsTr("Hello World") anchors.centerIn: parent }
}
@This application (standard debug build) show two Open GL contexts when debugged with gDEBugger. The info that gDEBugger gives is a little different for the two contexts. Context 1 has Pixel Format ID 4, not Double Buffered and Stencil Channel 0 while Context 2 has Pixel Format ID 12, is Double Buffered and Stencil Channel 8. Otherwise the info is the same for both contexts.
-
Additional info:
Object creation call stack strace, retrived by gDEBugger, for Open GL Context 1:
0x62874bf3 - qwindowsd.dll
0x62874c96 - qwindowsd.dll
0x6287511d - qwindowsd.dll
0x628753f9 - qwindowsd.dll
0x6284a6ea - qwindowsd.dll
0x6284a71a - qwindowsd.dll
0x6284a610 - qwindowsd.dll
0x6284a688 - qwindowsd.dll
ZN14QWindowPrivate6createEb - Qt5Guid.dll
ZN7QWindow6createEv - Qt5Guid.dll
ZN7QWindow10setVisibleEb - Qt5Guid.dll
ZN24QQuickShaderEffectSource24scheduledUpdateCompletedEv - Qt5Quickd.dll
ZN24QQuickShaderEffectSource24scheduledUpdateCompletedEv - Qt5Quickd.dll
ZN24QQuickShaderEffectSource24scheduledUpdateCompletedEv - Qt5Quickd.dll
ZN27QQmlFileSelectorInterceptor9interceptERK4QUrlN26QQmlAbstractUrlInterceptor8DataTypeE - Qt5Qmld.dll
ZN20QQmlComponentPrivate8completeEP17QQmlEnginePrivatePNS_17ConstructionStateE - Qt5Qmld.dll
ZN20QQmlComponentPrivate14completeCreateEv - Qt5Qmld.dll
ZN13QQmlComponent14completeCreateEv - Qt5Qmld.dll
ZN13QQmlComponent6createEP11QQmlContext - Qt5Qmld.dll
ZN28QQmlApplicationEnginePrivate13_q_finishLoadEP7QObject - Qt5Qmld.dll
ZN28QQmlApplicationEnginePrivate9startLoadERK4QUrlRK10QByteArrayb - Qt5Qmld.dll
ZN21QQmlApplicationEngine4loadERK4QUrl - Qt5Qmld.dll
0x0040169d - DefaultQtQuick.exe
0x00402ac7 - DefaultQtQuick.exe
0x00402dcc - DefaultQtQuick.exe
0x004013dd - DefaultQtQuick.exe
BaseThreadInitThunk - KERNEL32.DLL
RtlTryAcquireSRWLockShared - ntdll.dll
RtlTryAcquireSRWLockShared - ntdll.dllObject creation call stack strace, retrived by gDEBugger, for Open GL Context 2:
0x628738ab - qwindowsd.dll
0x62875e8d - qwindowsd.dll
0x628726d7 - qwindowsd.dll
0x6284a89f - qwindowsd.dll
ZN14QOpenGLContext6createEv - Qt5Guid.dll
ZN13QSGRenderLoop28handleContextCreationFailureEP12QQuickWindowb - Qt5Quickd.dll
ZN12QQuickWindow9showEventEP10QShowEvent - Qt5Quickd.dll
ZN7QWindow5eventEP6QEvent - Qt5Guid.dll
ZN12QQuickWindow5eventEP6QEvent - Qt5Quickd.dll
ZN23QCoreApplicationPrivate13notify_helperEP7QObjectP6QEvent - Qt5Cored.dll
ZN16QCoreApplication6notifyEP7QObjectP6QEvent - Qt5Cored.dll
ZN15QGuiApplication6notifyEP7QObjectP6QEvent - Qt5Guid.dll
ZN16QCoreApplication14notifyInternalEP7QObjectP6QEvent - Qt5Cored.dll
ZN18QOpenGLTimeMonitor11qt_metacallEN11QMetaObject4CallEiPPv - Qt5Guid.dll
ZN7QWindow10setVisibleEb - Qt5Guid.dll
ZN24QQuickShaderEffectSource24scheduledUpdateCompletedEv - Qt5Quickd.dll
ZN24QQuickShaderEffectSource24scheduledUpdateCompletedEv - Qt5Quickd.dll
ZN24QQuickShaderEffectSource24scheduledUpdateCompletedEv - Qt5Quickd.dll
ZN27QQmlFileSelectorInterceptor9interceptERK4QUrlN26QQmlAbstractUrlInterceptor8DataTypeE - Qt5Qmld.dll
ZN20QQmlComponentPrivate8completeEP17QQmlEnginePrivatePNS_17ConstructionStateE - Qt5Qmld.dll
ZN20QQmlComponentPrivate14completeCreateEv - Qt5Qmld.dll
ZN13QQmlComponent14completeCreateEv - Qt5Qmld.dll
ZN13QQmlComponent6createEP11QQmlContext - Qt5Qmld.dll
ZN28QQmlApplicationEnginePrivate13_q_finishLoadEP7QObject - Qt5Qmld.dll
ZN28QQmlApplicationEnginePrivate9startLoadERK4QUrlRK10QByteArrayb - Qt5Qmld.dll
ZN21QQmlApplicationEngine4loadERK4QUrl - Qt5Qmld.dll
0x0040169d - DefaultQtQuick.exe
0x00402ac7 - DefaultQtQuick.exe
0x00402dcc - DefaultQtQuick.exe
0x004013dd - DefaultQtQuick.exe
BaseThreadInitThunk - KERNEL32.DLL
RtlTryAcquireSRWLockShared - ntdll.dll
RtlTryAcquireSRWLockShared - ntdll.dll