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 <paul.tvete@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Laszlo Agocs 2014-06-17 15:08:24 +02:00 committed by Jani Heikkinen
parent cf7805d364
commit 10ff9d5b6f

View File

@ -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;