[Interest] Qt 6.3.0 and OpenGL on macOS [was: Re: Creating fat binaries for Qt6 on macOS]
Dirk Hohndel
dirk at hohndel.org
Sat Apr 30 06:28:27 CEST 2022
> On Apr 13, 2022, at 06:52, Sze Howe Koh <szehowe.koh at gmail.com> wrote:
> Apple has let their OpenGL implementation stagnate since 2010 [1].
> They then officially deprecated it in 2018, citing significant
> advantages of Metal over OpenGL [2]. They have not revealed when
> OpenGL will be removed.
>
> Most of Qt Quick works well with Metal -- it's only QQuickWidget that
> doesn't. In contrast, the graphics API setting affects all of Qt
> Quick. Furthermore, QQuickWidget has limitations [3] compared to other
> ways of displaying a Qt Quick UI, so it shouldn't be the first choice
> unless you really need to mix widgets with Qt Quick.
>
> Given all this, I don't think it makes sense for Qt to default to
> something that can be killed off any day now, just to make it easier
> to use QQuickWidget.
>
> In any case, I think the error message "QQuickWidget is only supported
> on OpenGL. Use QQuickWindow::setGraphicsApi() to override the default"
> is clear enough as a once-off message for those who want to use
> QQuickWidget.
So I finally found time to try and figure out what to do here.
This is all rather confusing.
I have two different QML modules that are included in my Qt Widget based
app. One of them works. It shows maps, not a problem. I get the warning:
QQuickWidget is only supported on OpenGL. Use QQuickWindow::setGraphicsApi() to override the default.
but it still works just fine.
The other one, however, crashes in the software render when I try to instantiate
the Widget:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [80775]
VM Region Info: 0 is not in any region. Bytes before following region: 4332961792
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 10243c000-102aa8000 [ 6576K] r-x/r-x SM=COW ...OS/Subsurface
Kernel Triage:
VM - Compressor failed a blocking pager_get
VM - Compressor failed a blocking pager_get
VM - Compressor failed a blocking pager_get
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 QtQuick 0x1057423a8 QSGSoftwareRenderableNode::update() + 544 (qsgsoftwarerenderablenode.cpp:187)
1 QtQuick 0x1057423a8 QSGSoftwareRenderableNode::update() + 544 (qsgsoftwarerenderablenode.cpp:187)
2 QtQuick 0x105744a6c bool QSGSoftwareRenderableNodeUpdater::updateRenderableNode<QSGImageNode>(QSGSoftwareRenderableNode::NodeType, QSGImageNode*) + 288 (qsgsoftwarerenderablenodeupdater_p.h:135)
3 QtQuick 0x10577eb24 QSGNodeVisitorEx::visitChildren(QSGNode*) + 108 (qsgadaptationlayer.cpp:355)
4 QtQuick 0x105746008 QSGSoftwareRenderableNodeUpdater::updateNodes(QSGNode*, bool) + 1100 (qsgsoftwarerenderablenodeupdater.cpp:282)
5 QtQuick 0x10573826c QSGAbstractSoftwareRenderer::nodeAdded(QSGNode*) + 124 (qsgabstractsoftwarerenderer.cpp:267)
6 QtQuick 0x105737ee4 QSGAbstractSoftwareRenderer::nodeChanged(QSGNode*, QFlags<QSGNode::DirtyStateBit>) + 164 (qsgabstractsoftwarerenderer.cpp:108)
7 QtQuick 0x105772750 QSGRootNode::notifyNodeChange(QSGNode*, QFlags<QSGNode::DirtyStateBit>) + 44 (qsgnode.cpp:1277) [inlined]
8 QtQuick 0x105772750 QSGNode::markDirty(QFlags<QSGNode::DirtyStateBit>) + 84 (qsgnode.cpp:671) [inlined]
9 QtQuick 0x105772750 QSGNode::appendChildNode(QSGNode*) + 144 (qsgnode.cpp:454)
10 Subsurface 0x10272c2a4 ChartPixmapItem::render(StatsTheme const&) + 172 (chartitem.cpp:71)
11 Subsurface 0x10276006c StatsView::updatePaintNode(QSGNode*, QQuickItem::UpdatePaintNodeData*) + 160 (statsview.cpp:186)
Ok, so maybe the software renderer is the problem... after all everyone tells me to use OpenGL
QT_QUICK_BACKEND="opengl" ./Subsurface.app/Contents/MacOS/Subsurface -v
...
Could not create scene graph context for backend 'opengl' - check that plugins are installed correctly in /Users/hohndel/src/subsurface/build/Subsurface.app/Contents/PlugIns
QQuickWidget is only supported on OpenGL. Use QQuickWindow::setGraphicsApi() to override the default.
So I'm trying to use the OpenGL backend, but it's unclear how to do that. I looked high and lo for such a plugin. I copied all plugins... nothing.
I saw elsewhere that I actually should include the OpenGL component when building like this:
find_package(Qt6 COMPONENTS OpenGL)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES Qt6::OpenGL)
That builds, but immediately crashes on startup without even giving me a stack trace...
Any pointers would be welcome. This is right now the major show stopper that prevents me from releasing a first limited Qt6 version of Subsurface (which would give me native m1 support)
/D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220429/76c821bd/attachment.htm>
More information about the Interest
mailing list