aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickwidgets
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-07-29 13:16:14 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-08-04 13:13:58 +0000
commit3cce585f3c05ea4dffa324f10bd99dfbc2577cfe (patch)
tree7f47848d860fb091b65e27d3d6b4aa7ce2875808 /src/quickwidgets
parentaaf163b942470c6a1f4a15e43a26e3b13a5761bb (diff)
Avoid multisampled contexts in QQuickWidget
Like with QOpenGLWidget, not requesting a multisampled context unnecessarily avoids crashing with Mesa/Intel/EGL (f.ex. in the qquickviewcomparison example when enabling multisampling). Task-number: QTBUG-47509 Change-Id: Ia22110332f639a238cfb3b2c36916f65c00a7bbc Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'src/quickwidgets')
-rw-r--r--src/quickwidgets/qquickwidget.cpp11
-rw-r--r--src/quickwidgets/qquickwidget_p.h2
2 files changed, 12 insertions, 1 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 26dd4e5b3a..553dba37fa 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -143,6 +143,7 @@ QQuickWidgetPrivate::QQuickWidgetPrivate()
, eventPending(false)
, updatePending(false)
, fakeHidden(false)
+ , requestedSamples(0)
{
}
@@ -772,7 +773,7 @@ void QQuickWidget::createFramebufferObject()
context->makeCurrent(d->offscreenSurface);
- int samples = d->offscreenWindow->requestedFormat().samples();
+ int samples = d->requestedSamples;
if (!QOpenGLExtensions(context).hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
samples = 0;
@@ -1248,6 +1249,14 @@ void QQuickWidget::setFormat(const QSurfaceFormat &format)
newFormat.setDepthBufferSize(qMax(newFormat.depthBufferSize(), currentFormat.depthBufferSize()));
newFormat.setStencilBufferSize(qMax(newFormat.stencilBufferSize(), currentFormat.stencilBufferSize()));
newFormat.setAlphaBufferSize(qMax(newFormat.alphaBufferSize(), currentFormat.alphaBufferSize()));
+
+ // Do not include the sample count. Requesting a multisampled context is not necessary
+ // since we render into an FBO, never to an actual surface. What's more, attempting to
+ // create a pbuffer with a multisampled config crashes certain implementations. Just
+ // avoid the entire hassle, the result is the same.
+ d->requestedSamples = newFormat.samples();
+ newFormat.setSamples(0);
+
d->offscreenWindow->setFormat(newFormat);
}
diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h
index dd0da96c3d..9249fa138b 100644
--- a/src/quickwidgets/qquickwidget_p.h
+++ b/src/quickwidgets/qquickwidget_p.h
@@ -115,6 +115,8 @@ public:
bool eventPending;
bool updatePending;
bool fakeHidden;
+
+ int requestedSamples;
};
QT_END_NAMESPACE