Have proper OpenGL checks in QQuickFBO and image particles
These use custom materials that can crash when running with the D3D12 backend. We prefer handling such situations gracefully, with the application surviving. Therefore check the backend in use, and skip creating a scenegraph node when the backend is not OpenGL. Task-number: QTBUG-55353 Change-Id: I0be326fd2eacb0be604a0f111fa916558376c75a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
d4e09df44d
commit
863a76281c
|
@ -49,6 +49,7 @@
|
|||
#include <private/qquicksprite_p.h>
|
||||
#include <private/qquickspriteengine_p.h>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QSGRendererInterface>
|
||||
#include <QtQuick/private/qsgshadersourcebuilder_p.h>
|
||||
#include <QtQuick/private/qsgtexture_p.h>
|
||||
#include <private/qqmlglobal_p.h>
|
||||
|
@ -1469,8 +1470,17 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
|
|||
update();
|
||||
}
|
||||
|
||||
static inline bool isOpenGL(QSGRenderContext *rc)
|
||||
{
|
||||
QSGRendererInterface *rif = rc->sceneGraphContext()->rendererInterface(rc);
|
||||
return !rif || rif->graphicsApi() == QSGRendererInterface::OpenGL;
|
||||
}
|
||||
|
||||
QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
|
||||
{
|
||||
if (!node && !isOpenGL(QQuickItemPrivate::get(this)->sceneGraphRenderContext()))
|
||||
return 0;
|
||||
|
||||
if (m_pleaseReset){
|
||||
if (node)
|
||||
delete node;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <private/qquickitem_p.h>
|
||||
|
||||
#include <QSGSimpleTextureNode>
|
||||
#include <QSGRendererInterface>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -260,6 +261,12 @@ public:
|
|||
int devicePixelRatio;
|
||||
};
|
||||
|
||||
static inline bool isOpenGL(QSGRenderContext *rc)
|
||||
{
|
||||
QSGRendererInterface *rif = rc->sceneGraphContext()->rendererInterface(rc);
|
||||
return !rif || rif->graphicsApi() == QSGRendererInterface::OpenGL;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
*/
|
||||
|
@ -278,6 +285,8 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode
|
|||
Q_D(QQuickFramebufferObject);
|
||||
|
||||
if (!n) {
|
||||
if (!isOpenGL(d->sceneGraphRenderContext()))
|
||||
return 0;
|
||||
if (!d->node)
|
||||
d->node = new QSGFramebufferObjectNode;
|
||||
n = d->node;
|
||||
|
@ -360,6 +369,8 @@ QSGTextureProvider *QQuickFramebufferObject::textureProvider() const
|
|||
qWarning("QQuickFramebufferObject::textureProvider: can only be queried on the rendering thread of an exposed window");
|
||||
return 0;
|
||||
}
|
||||
if (!isOpenGL(d->sceneGraphRenderContext()))
|
||||
return 0;
|
||||
if (!d->node)
|
||||
d->node = new QSGFramebufferObjectNode;
|
||||
return d->node;
|
||||
|
|
Loading…
Reference in New Issue