aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/util/qsgengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/util/qsgengine.cpp')
-rw-r--r--src/quick/scenegraph/util/qsgengine.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/quick/scenegraph/util/qsgengine.cpp b/src/quick/scenegraph/util/qsgengine.cpp
index 91fa46033c..4880d98871 100644
--- a/src/quick/scenegraph/util/qsgengine.cpp
+++ b/src/quick/scenegraph/util/qsgengine.cpp
@@ -42,7 +42,7 @@
#include <QtQuick/qsgtexture.h>
#include <private/qsgcontext_p.h>
#include <private/qsgrenderer_p.h>
-#include <private/qsgtexture_p.h>
+#include <private/qsgplaintexture_p.h>
#if QT_CONFIG(opengl)
# include <QtGui/QOpenGLContext>
@@ -69,6 +69,10 @@ QT_BEGIN_NAMESPACE
Most of the time you will instead want to subclass QQuickItem and insert
your QSGNode in a normal QtQuick scene by overriding QQuickItem::updatePaintNode().
+ \warning This class is only suitable when working directly with OpenGL. It
+ is not compatible with the \l{Scene Graph Adaptations}{RHI-based rendering
+ path}.
+
\sa QSGAbstractRenderer
*/
@@ -126,12 +130,29 @@ void QSGEngine::initialize(QOpenGLContext *context)
#endif
if (d->sgRenderContext && !d->sgRenderContext->isValid()) {
d->sgRenderContext->setAttachToGraphicsContext(false);
- d->sgRenderContext->initialize(context);
+#if QT_CONFIG(opengl)
+ QSGDefaultRenderContext *rc = qobject_cast<QSGDefaultRenderContext *>(d->sgRenderContext.data());
+ if (rc) {
+ QSGDefaultRenderContext::InitParams params;
+ params.sampleCount = qMax(1, context->format().samples());
+ params.openGLContext = context;
+ // leave the size hint and surface unset, we do not know, that's fine
+ rc->initialize(&params);
+ } else {
+ d->sgRenderContext->initialize(nullptr);
+ }
+#else
+ d->sgRenderContext->initialize(nullptr);
+#endif
#if QT_CONFIG(opengl)
if (context)
connect(context, &QOpenGLContext::aboutToBeDestroyed, this, &QSGEngine::invalidate);
#endif
}
+
+#if !QT_CONFIG(opengl)
+ Q_UNUSED(context);
+#endif
}
/*!