aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2016-08-18 13:42:40 -0700
committerLaszlo Agocs <laszlo.agocs@qt.io>2016-08-18 14:57:04 +0000
commit863a76281cefd19d7e339a78a63c86dff0f9dcce (patch)
tree9f4f8ba3c68145f54738a9c652962dd6c55b7934 /src/particles
parentd4e09df44d55572ef4f0c3c159b214edba9033cd (diff)
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>
Diffstat (limited to 'src/particles')
-rw-r--r--src/particles/qquickimageparticle.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index 07cbee1383..c68153aca8 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -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;