From 10ff9d5b6f9643d3bcae519d8bf5107711d4e55d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 17 Jun 2014 15:08:24 +0200 Subject: [PATCH] Handle invalid sample counts gracefully in FBOs Passing in a sample count of -1 should be treated as 0. This is common when setting up framebuffer formats from a QSurfaceFormat where the default, unset value is indicated by a value of -1. This broke QQuickWidget which was unaware of this limitation of QOpenGLFramebufferObject and was passing format.samples() as the sample count without making sure it is 0 or higher. Task-number: QTBUG-39699 Change-Id: I324b8b006eaa992c15ae932f9df305500fefeb65 Reviewed-by: Paul Olav Tvete Reviewed-by: Friedemann Kleint --- src/gui/opengl/qopenglframebufferobject.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index cd6468cccdf..3102e1ecd24 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -436,6 +436,7 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi samples = qBound(0, int(samples), int(maxSamples)); #endif + samples = qMax(0, samples); requestedSamples = samples; size = sz; target = texture_target;